Commit graph

346 commits

Author SHA1 Message Date
Olivier Goffart
d6706494a5
Binding between a read only property to input-output is deprecated (#6419)
ChangeLog: deprecated two way binding between `in` and `in-out` property

Fixes #6400
2024-10-01 16:00:06 +02:00
Tobias Hunger
a0c46d65bd live-preview: Use modern features in API now that 1.8 is out 2024-09-24 10:51:12 +02:00
Tobias Hunger
eb3e1dded1 live-preview: Re-ordering of properties in property editor
All other tools have custom widgets for x/y, width/height, etc.,
let's try to come close by at least presenting the properties in
in a logical order that lends itself to data input.

This reorders geometry to show `x`, `y`, `width` and `height` followed by `z`.

It also orders layout as `min-width`, `min-height`, `preferred-width/-height',
and `max-width/height` followed by horizontal and vertical stretch.
2024-09-20 14:49:42 +02:00
szecket
8f8eb0d120
made adjustments using the awesome new data in api (#6223) 2024-09-20 03:32:10 +12:00
Olivier Goffart
e842a25c81 live-preview: Allow resizing if only one of the dimention is contrained
If the height is contreained but not the width, we should still be able
to resize
2024-09-19 15:55:29 +02:00
Tobias Hunger
6b07d525ad live-preview: Add a Del key handler into the selection
Make sure the handler gets activated whenever the selection
gets clicked.
2024-09-19 15:51:56 +02:00
Tobias Hunger
04e11ec849 live-preview: Remove some dead code form property-view.slint 2024-09-19 15:51:56 +02:00
Tobias Hunger
74f3663932 live-preview: Remove failed attempt to have global shortcuts
It does not work too well and it breaks switching between LineEdits
in the property editor. Downside: We have no more way to delete the
selected element anymore. We could have it in a tool button, but
IMHO we should have Undo before we make it that obvious.
2024-09-19 15:51:56 +02:00
Simon Hausmann
24b2032e9f Remove stray horizontal line in library view 2024-09-19 13:25:34 +02:00
Simon Hausmann
cd1de28cd7 Make it easier to preview the properties view
Provide some dummy property data, and provide a preferred height that makes the preview show the properties.
2024-09-19 12:11:21 +02:00
szecket
860014a8f1
Cleanup columns (#6202)
* floatwidget and ResettingLineEdit updated

* ColorWidget adjusted

* most attributes visible again

* spacing more consistent and added italic to not-edited double encoding

* all controls rendering.

* consistent sizes for all column distributions.

* removed debug code and optimized logic a bit
2024-09-18 18:31:25 -04:00
Tobias Hunger
f968b1d135 live-preview: Apply on focus change
Apply changes when the focus changes out of a 
(Resetting)LineEdit..
2024-09-18 23:22:42 +02:00
Tobias Hunger
bdf173d08c live-preview: Update the down-arrow icon
... using the chevron-down icon from the codicons
icon set.
2024-09-18 21:30:18 +02:00
Tobias Hunger
0e751b1eea livve-preview: Make the color widget editable
... in a bare-bones fashion.
2024-09-18 15:38:45 +02:00
Tobias Hunger
81be4f2208 live-preview: Reset can-compile when resetting to property value
... in ResettingLineEdit.
2024-09-18 15:38:45 +02:00
Tobias Hunger
ef18244b31 live-preview: Mark wrong code as wrong again
... and fix the FloatWidget not passing on the unit, breaking
the update of property data.
2024-09-18 13:42:02 +02:00
Tobias Hunger
33afbe7cf6 live-preview: Print properties set in an element in bold 2024-09-18 10:54:10 +02:00
szecket
126ab85366 live-preview: Prettify the property editor 2024-09-17 18:39:37 +02:00
Tobias Hunger
2d8323be5a live-preview: Add a ResetButton for properties
This button can be used to remove an existing property
assignment, thus resetting to the default value the
element inherited.
2024-09-17 18:39:37 +02:00
Tobias Hunger
41bdadd960 live-preview: Add a CodeButton component
... and use it in places
2024-09-17 18:39:37 +02:00
Florian Blasius
a32b0ac6d0 live-preview: Refactoring of property editor ui code 2024-09-17 18:39:37 +02:00
Tobias Hunger
ca64212369 live-preview: Less model updates for property editor
Move the model into an extra porperty and move information
irrelevant for the UI behind a callback, so that changing that info
will not invalidate the UI.
2024-09-17 10:29:31 +02:00
Tobias Hunger
1ca3726e4e live-preview: Fix size being displayed wrongly
Stop abusing the init callback, abuse the changed callback instead ;-)

Also merge the initial size calculation into one place. This fixes the
preview showing the wrong sizes. It does introduce a bit of flicker though
as the UI is rendered in the wrong state once and then immediently corrects
itself.

That is annoying, but strictly better than staying in the wrong state till
the user does something.

Closes: #5954
2024-09-16 15:54:40 +02:00
Olivier Goffart
ca6d9af2ba live-preview: Use a checkerboard as the background
Also have a slightly bigger preferred size by default when the previewed
component is very small
2024-09-16 10:13:01 +02:00
Tobias Hunger
1697226fc1 live-preview: Use the entire screen when preferred-size of a UI is 0
Use the entire screen-space (minus borders) when the preferred size
of a UI is 0 and we are asking to reset to the preferred size.

I was reluctant to implement this before as I think it is surprising
to start with a huge size when the size info is most likely wrong...
People typically render outside the component's area in that case.

Now that we clip away anything that is not inside the UI area, I think
this is discoverable enough now: When resizing you will see the UI
getting clipped after all.

The big size also avoids confusion when nothing shows up :-)
2024-09-13 15:06:51 +02:00
Tobias Hunger
e0426353a8
live-preview: Improve icons in hide/show sidebar buttons (#6128) 2024-09-13 09:06:02 -04:00
Tobias Hunger
86f2e397c9
live-preview: Prettify group component (#6127) 2024-09-13 08:11:31 -04:00
szecket
0bdf44b12f live-preview: Prettify the statusbar 2024-09-13 13:51:31 +02:00
szecket
f79043c70b
live-preview: Prettify the HeaderView (#6117)
* live-preview: Polish the header-view

* live-preview: Clean up the previous patch a bit

---------

Co-authored-by: Tobias Hunger <tobias.hunger@slint.dev>
2024-09-13 23:14:09 +12:00
Tobias Hunger
0ae32b5a33 live-preview: Clip drawing outside of ComponentContainer
Clip anything the previewed UI wants to draw outside
of the area the previewed component claims to be using.

There are several reasons to do this:

 * A window will clip the contained component
 * Selection outside of the area taken up by the
   root component can not be selected or interacted
   with
 * It is more obvious that you are doing something
   wrong when your UI is clipped. Before we happily
   showed the right thing in the preview and then
   failed hard when using that component.
2024-09-13 12:11:49 +02:00
Tobias Hunger
b95f0e62c8 live-preview: Always unselect when clicking onto background
Always unseelct the currently selected item when clicking onto
the background around the previewed UI.
2024-09-12 13:53:39 +02:00
Simon Hausmann
2ccc468b27 Fix location of comment 2024-09-12 13:30:55 +02:00
Simon Hausmann
5825cb4f46 Use command instead of control for the status text when running on macOS 2024-09-12 12:48:34 +02:00
Tobias Hunger
026e723029 live-preview: Add buttons to hide sidebars 2024-09-11 16:16:18 +02:00
Tobias Hunger
b01f0f926b live-preview: Add statusline with help text 2024-09-11 16:08:27 +02:00
Tobias Hunger
f5667b4d2b live-preview: Clean up icon handling 2024-09-11 13:22:04 +02:00
Tobias Hunger
8d5670f93b live-preview: Add an "selection mode" to the edit mode 2024-09-11 13:03:04 +02:00
Tobias Hunger
5682b6eae4 live-preview: Remove unnecessary padding rom HeaderView
This makes the combobox less fat and looks much nicer IMHO.
2024-09-11 11:20:07 +02:00
Tobias Hunger
8859be7695 live-preview: Hide resize elements in interactive mode
... by rendering the elements as transparent. They are still
there and work, so you can still resize, but you still get a
better view of your UI.

We still draw a border around the UI, just to show where
it ends and the background begins, but that is purely
decorative :-)

I am not totally happy wioth this: It still sets mouse cursors
in the area that should actually be controlled by the UI and
overlays its own touchareas around the border of the UI, stealing
a few pixels from the interactive area of the UI.
2024-09-11 09:55:18 +02:00
Tobias Hunger
677838de83 live-preview: Only show style dropdown when importing std-widgets 2024-09-10 16:21:57 +02:00
Nigel Breslaw
dd190fe83e Align refresh to the left/start 2024-09-10 14:19:54 +02:00
Tobias Hunger
242ff57d5e live-preview: Add reload preview command to Api
... and make `Ctrl-Shift-R` trigger it in edit mode, in the same broken
way we handle the `Delete` key. It works -- till you hit `Tab` to move
the focus.

We really need #4063 or similar!
2024-09-10 14:19:54 +02:00
Tobias Hunger
063d976d28 live-preview: Report @tr properly to property editor
... so that all information for a round-trip into the Property editor
and back is available.
2024-08-30 19:52:55 +02:00
Tobias Hunger
c92960b9d3 live-preview: Remove setters that are not too helpful
We are getting too many setters for properties in our Api IMHO,
so remove two that are easy enough to replicate with `set_code_property`.
2024-08-30 19:52:55 +02:00
Tobias Hunger
64e8330d04 live-preview: Add setter for color property changes 2024-08-30 19:52:55 +02:00
Tobias Hunger
aadff0ca42 live-preview: Show properties for Empty
For beauty-reasons we no longer report `Empty` though and replace
that with `""`. This prevents the property editor from showing a UI:
The `type-name` field being empty was abused to indicate that no
data is available -- we do not have options in Slint :-/

Replace that test with the length of the model holding the properties.

We assume we got no data when that model is empty... which is probably
a safer bet for "no property data availabel" than the `type-name`
field.
2024-08-30 18:56:04 +02:00
Tobias Hunger
a7c0ae30e8 live-preview: Report property values with units to UI 2024-08-29 17:08:26 +02:00
Tobias Hunger
82fad654a4 live-preview: Parse Color in property data 2024-08-29 17:08:26 +02:00
Tobias Hunger
fae9b09d86 live-preview: Parse Float32 in property values 2024-08-29 17:08:26 +02:00
Tobias Hunger
e0cf679c0f live-preview: Improve conversion of property info to UI
... and use that in the (still almost unchanged) UI.
2024-08-28 18:02:47 +02:00