We can now set all the properties exposed to the
business logic of a UI we are previewing.
Simple properties only so far, everything else falls
back to JSON data.
Next step is to add more sophisticated UI to actually
edit more complex data like arrays more graphically.
changed the interaction for header view
both library and properties can be shown anytime
and selection is is a toggle button at any time
suggestions:
goes hand in hand with the selection mode
likely requires settings for toggle or single
select.
attempting a header change to optimize usability
TODO: make dragging from library automatically
into edit mode
the toggle that existed is the same as toggling a button - whcih can sit next to the closed library and properties.
properties should be editable while selection is active so those should be openable / visible whether in edit mode or not.
STILL TODO:
- make dragging from library automatically into edit mode
- add settings to either single select 'inspect' button or toggle on off
- change display of active icon OR add icon for toggled mode for clearer display than blue icon for inspect
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.
* live-preview: Polish the header-view
* live-preview: Clean up the previous patch a bit
---------
Co-authored-by: Tobias Hunger <tobias.hunger@slint.dev>
... 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!
Updated the version from 1.1 to 1.2
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
... so we can have a better idea what we need to visualize.
Move the decision on which color to use into the slint file as well:
A designer should make that call, not a developer ;-)
Only process key events while the preview is in design mode and does
not show an error. So far the only key that actually does something
is the delete key, which deletes elements. Unfortunately we do not
know which text range is covered by the element we want to delete,
so we delete random chunks of text.
So disable that when we ran into an error.
This partially addresses #4872.
Add `fills_aprent` and `default_properties` to
`ComponentInformation`. The first is a bool showing
whether the Component will fill its parent or not.
The later is a set of properties that the UI will set
when the widget gets dropped.
Refactor the data passing a bit: Keep the data on known
components around. Pass only the component name into
the UI, but pass the entire `ComponentInformation` to
the `drop_location` methods.
Changing the size of a UI will most likely move elements
around. So reselect the current selection when that happens.
This is not a proper solution: It e.g. ignores animations
changing element sizes, etc. but it does handle one
annoying case.
We need to decorate an Element so we can interact with it. I want
to decorate only *one* instance of a repeated element to avoid
cluttering up the screen. So pick one good candidate for decoration:
Ideally the one the user clicked on, got for the first one
otherwise.
Store this information so we can get it back after re-rendering,
and so that we can actually mark newly added elements for selection
after they get rendered.