Commit graph

171 commits

Author SHA1 Message Date
Simon Hausmann
6e18513c12 GL backend: fix locating the default font in slightly atypical environments
Enable fontdb's fontconfig feature to parse fontconfig files to locate
the directories where truetype fonts are located. This helps in system
setups that differ from the defaults that fontdb uses otherwise.

Fixes #1240
2022-05-07 21:59:16 +08:00
Olivier Goffart
01bf529f79 Properly initialize the default binding of a state to its materialized value
Fixes #1237
2022-05-06 12:55:42 +02:00
Olivier Goffart
8be92eac1d Fix conversion from brush to color in the ternary operator
Fixes #1235
2022-05-06 10:29:54 +02:00
Olivier Goffart
76f3fcd89f Fix BoxShadow property incorrectly considered const
We steal the bindings for the geometry from the containing element,
so we should also take the analysis.

Fixes #1233
2022-05-05 22:03:59 +02:00
ogoffart
6395cdfc09 Bump version number to 0.2.3 2022-05-04 12:32:58 +00:00
Olivier Goffart
525e9982d8 Re-export and document ModelExt 2022-05-04 11:08:14 +02:00
Olivier Goffart
8a4d6a34ba Revert #1049
This breaks the printer demo USB page, it makes it impossible to
change the current item.
That's because the printer demo do `current-item: 1;` to preselect the cat.
But that breaks the property binding that makes current-item follow the
actual-current-item.

 * Revert "move actual-current-item to FocusScope"
   This reverts commit 8240531e6e.

 * Revert "reset StandardListView's current-item if it is out of bounds"
   This reverts commit 9d18882f9d.
2022-05-02 14:13:37 +02:00
Tobias Hunger
9a881f9a90
Clippy 0 2 3 (#1203)
* janitor: Fix clippy error in textlayout.rs

This one is almost certainly a bug.

* janitor: clippy fixes in inline_expressions.rs

Clippy claims the original code was slower and less clean, so let's
change this.
2022-05-02 13:23:35 +02:00
Olivier Goffart
b2cdd8c2a0 Fix a bunch of documentation warnings
llr::optim_passes::count_property_use is referenced by some documentation
comment and that's why it must be public
2022-04-26 12:47:34 +02:00
Olivier Goffart
9fe4992a23 StandardListView: restore behavior to get focus on click
In previous versions of Slint, the StandardListView gets the focus
on click so we can move the selected items with the up and down arrow
2022-04-22 12:49:46 +02:00
Tobias Hunger
7ac4231150 Focus: Do not send keyboard event to invisible widgets
Do not send keyboard events to invisible widgets, reset the keyboard
focus instead.

That fixes #798 again with a bit less of a work-around. To properly fix
this we will need to make the tab widget (and probably others) more
intelligent though.
2022-04-21 12:37:32 +02:00
Tobias Hunger
09f9dbe371 Do not set focus on click for most FocusScopes 2022-04-20 17:07:02 +02:00
Tobias Hunger
2312954f11 Remove unused property in NativeStyleMetrics 2022-04-20 17:07:02 +02:00
Tobias Hunger
9ef1f08163 Take alignment from QStyle infos into account when rendering the TabBar 2022-04-20 15:19:16 +02:00
Tobias Hunger
6c10edc957 Draw focus rect on focused tabs 2022-04-20 15:19:16 +02:00
Tobias Hunger
06749c6469 native: Implement keyboard focus support in Tab widget 2022-04-20 15:19:16 +02:00
Tobias Hunger
416aa42d90 Component: Replace parent_item to parent_node
Remove the `parent_item` function. After the recent changes that did not
return an item anymore and since the item tree is exposed, this function
was only used to find the repeater a component was created by.

So replace the old function with a new one that only returns the parent
node in the parent component.

This saves a few lines of generated code that is not used anymore.

Co-authored-by: Simon Hausmann <hausmann@gmail.com>
2022-04-20 14:29:18 +02:00
Olivier Goffart
67e9a59398 Add a Model::row_data_tracked function
Closes #1177
2022-04-19 15:12:15 +02:00
Olivier Goffart
f117cb77cc NativeSpinBox: Handle the key press in native code 2022-04-19 11:27:19 +02:00
Olivier Goffart
e85e69fda0
Declare .slint enum in one place in i-slint-common
This avoid repeating the enums both in the compiler and in
the runtime library, and register them in a bunch of other places.

So it should be easier to add enums and enum values

Since cbindgen doesn't see through the macro, generate the enum
manually
2022-04-14 19:17:48 +02:00
Tobias Hunger
df9f86ba4a janitor: cspell fixes 2022-04-13 14:42:32 +02:00
Tobias Hunger
2c82fd7618 Tab: Make tab accept keyboard 2022-04-13 14:42:32 +02:00
Simon Hausmann
9a8c5fed9f Remove the ugly style
It's ugly ;-)

The combo box for the style is commented out for now, so that we can
easily re-add it in the future once we add a new style.
2022-04-13 10:35:42 +02:00
Olivier Goffart
54a6cb22ee Allow .darker and .brighter on Brush 2022-04-12 13:01:53 +02:00
Tobias Hunger
c825eee228 janitor: Update global cspell
Update global cspell words and remove some file-wide words.

Also remove a manual test that is now also run as a proper test case.
2022-04-12 12:03:45 +02:00
Tobias Hunger
49e0a2f32b janitor: cspell fixes 2022-04-12 12:03:45 +02:00
Tobias Hunger
a50d1e7d02 fluent: Make ComboBox accept keyboard input 2022-04-12 10:48:09 +02:00
Tobias Hunger
f883b45a4b Make fluent CheckBox accept keyboard actions 2022-04-12 10:48:09 +02:00
Tobias Hunger
b33c407878 Make fluent Button accept keyboard focus 2022-04-12 10:48:09 +02:00
Tobias Hunger
73e178a840 Add enabled property to FocusScope 2022-04-12 10:48:09 +02:00
Olivier Goffart
1b91158b46 corelib: allow to use i32 for coordinate instead of f32 2022-04-11 17:46:50 +02:00
Simon Hausmann
5aae0b7312 Fix wasm build 2022-04-08 15:11:26 +02:00
Simon Hausmann
07d0c6e578 mcu: provide a default font size
We default to 12 pixels in the MCU renderer if no size is specified
2022-04-08 15:11:26 +02:00
Simon Hausmann
70f3f50359 mcu: Add support for automatic font size detection
Continue to support specififying logical font sizes in the compile step
via SLINT_FONT_SIZES, but additionally look for Text/TextInput/Window elements
and extract any constant font sizes
found.

This makes it work out of the box with the printer demo.
2022-04-08 15:11:26 +02:00
Simon Hausmann
819c058fd6 Add support for multiplication and divison to the constant propagation when only one unit is present 2022-04-08 15:11:26 +02:00
Tobias Hunger
a639cc5acb fluent: Make checkmark in Combobox look slimmer 2022-04-07 13:48:01 +02:00
Tobias Hunger
6795564414 fluent: Make ComboBox dropdown icon thinner
This is closer to the original.
2022-04-07 13:48:01 +02:00
Olivier Goffart
40c98d6d05 Update cbindgen and enable MouseCursor::move
cbindgen 0.21 was released which contains https://github.com/eqrion/cbindgen/pull/724
which allow to use raw identifier in enums shared with C++.
So now we can have `MouseCursor.move` in slint  despite it being a rust keyword

Note that the strum macro also have trouble with the raw identifier, so we
take that in account in the conversion functions in the interpreter
2022-04-05 06:39:50 +02:00
Olivier Goffart
f8f61dc2b7 Fix a bunch more issue with PopupWindow
* Make sure that the compiler don't panic if the parent of a PopupWindow
   is optimized (by not optiizing such element)

 * Ensure that we can call popup.show() from within a deeper repeater

 * Ensure that the parent element of the popup is the right one in case of
   repeater (and not the node in the parent component)

This partially revert ad5991f8fa and
6c7a7aed0e because we must do the lower_popup
adter the repeater pass, because otherwise the parent element of the
created component for the PopupWindow might be wrong and it is not easy to
adjust (we would have to make Component::parent_element a RefCell or duplicate
it again.

Fixes #1132
2022-04-01 14:06:38 +02:00
Tobias Hunger
072a6fd5e4 Update internal/compiler/generator/cpp.rs
Co-authored-by: Olivier Goffart <olivier@woboq.com>
2022-03-31 17:43:57 +02:00
Tobias Hunger
e05d24b2cf c++: Implement subtree_index(...) 2022-03-31 17:43:57 +02:00
Tobias Hunger
1888ecfd65 c++: Generate better indices for the parent node of repeaters 2022-03-31 14:40:57 +02:00
Tobias Hunger
8a036ef293 rust: Generate better indices for the parent node of repeaters
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-03-31 14:40:57 +02:00
Olivier Goffart
ad5991f8fa Fix PopupWindow within repeater
* The LLR expect that the popup_window is actually contained in it's parent
   component popup_windows, otherwise the context is not correct.
 * There is no index property for a PopupWindow

Fixes #1113
2022-03-30 16:46:55 +02:00
Olivier Goffart
6622f33327
Fix conversion of struct with array of literals (#1109)
Fixes #944
2022-03-28 14:41:11 +02:00
Tobias Hunger
e5aadd7c26 C++: Make component_at() return a ComponentWeak 2022-03-28 14:13:36 +02:00
Tobias Hunger
ee68716d07 Component: Add information to stich together ItemTrees
Add accessors to the information necessary to stitch together the
Component-wide ItemTrees (which include DynamicNodes) into one logical
tree of Items.
2022-03-28 14:13:36 +02:00
Olivier Goffart
cf49568373 Compiler: make the image processing an enum in the config 2022-03-24 13:16:21 +01:00
Olivier Goffart
41b20fdd59 MCU build system: pass information about embedding images and glyph to the compiler
... using metadata from the build script send with the DEP_I_SLINT_BACKEND_MCU

Saves two environment variable that we don't have to pass
2022-03-24 13:16:21 +01:00
Tobias Hunger
24d325a53b Do not eat all keypresses in SpinBox 2022-03-22 18:34:05 +01:00