Commit graph

1488 commits

Author SHA1 Message Date
Tobias Hunger
96b6ca8830 janitor: Remove unnecessary references 2022-05-22 11:59:00 +02:00
Tobias Hunger
55249c90de janitor: fix redundant clones 2022-05-22 11:59:00 +02:00
Tobias Hunger
9b535e8ee8 janitor: use matches! 2022-05-22 11:59:00 +02:00
Tobias Hunger
a71848fd2c janitor: Avoid some allocations warned about by clippy 2022-05-22 11:59:00 +02:00
Olivier Goffart
9fc838206a Fix gradient interpolation
When the percentage is missing, we should interpolate between the
last valid entry to the first valid entry after that, not always the
last valid entry in the whole gradient
2022-05-21 12:00:20 +02:00
Olivier Goffart
66c443c90c Add the rust-version field to make the MRSV explicit
We changed the MSRV in the last release because some dependency depended on
Rust 1.59. But that did not concern the C++ build, for example.
Now that we rely on rust 1.59 in our own code, we should make it explicit
so that the compilation error show the proper error
2022-05-20 08:18:11 +02:00
Olivier Goffart
f611651bb7 LSP: Fix auto-completion of @-macros 2022-05-19 19:22:56 +02:00
Simon Hausmann
fd195904a1 Allow for the use of cache-rendering-hint in separate components
The `lower_property_to_element` pass usually disallows that because it
injects the Layer element and we can't do that for components. But we
can handle this like with opacity and inline.
2022-05-19 18:50:45 +02:00
Olivier Goffart
b4ebd88d35 Implements @radial-gradient(circle, ...)
Only the circle is implemented so far.

Part of #263
2022-05-19 14:07:20 +02:00
Florian Fetz
d824eef2c5 ScrollBar background is now Palette.white 2022-05-15 14:42:09 +02:00
Olivier Goffart
b3fe9cc96d Fix compiler panic when optimizing child of layout
Normally, child of layout don't get optimized anyway because
the layout sets their `x` and `y` prop, preventing the optimization.
But if the rectangle has an opacity, its `x` and `y` property are
stolen by the opacity element, and then it can get optimized anyway

Fixes #1267
2022-05-13 16:05:15 +02:00
Olivier Goffart
1d18bd634b Remove unused branch in macro
Nightly rust starts warning about this
2022-05-13 14:36:49 +02:00
Olivier Goffart
8f16585754 Rust generation: properly clone() local variable
In case we re-use a non copy type several time in an expression
2022-05-13 13:00:01 +02:00
Olivier Goffart
c8e3a05116 Fix C++ compilation when writing to the model data from a sub component 2022-05-13 13:00:01 +02:00
ogoffart
3709ded44d Bump version number to 0.2.5 2022-05-09 16:16:00 +00:00
ogoffart
c160ec2aef Bump version number to 0.2.4 2022-05-09 13:49:25 +00:00
Olivier Goffart
a2d5ddaeca Fix priority of aliases when default value are involved
This code would have unpredictable results:

```slint
export Button := Rectangle {
    property<bool> the_enabled <=> touch.enabled;
    property<bool> the_visible <=> touch.visible;
    background: !the_enabled ? blue : red;
    border-color: !the_visible ? green : yellow;
    border-width: 15px;
    touch := TouchArea {}
    fs := FocusScope {
        enabled <=> root.the_enabled;
        visible <=> root.the_visible;
    }
}

Demo := Rectangle {
    VerticalLayout {
        spacing: 10px;
        Button { the_enabled: false; the_visible: false; }
        Button { the_enabled: false; the_visible: false; }
        Button { the_enabled: false; the_visible: false; }
        Button { the_enabled: false; the_visible: false; }
        Button { the_enabled: false; the_visible: false; }
        Button { the_enabled: false; the_visible: false; }
        Button { the_enabled: false; the_visible: false; }
    }
}
```

Because the enabled and visible property defaults to true (default
enforced by the compiler), but we set it also to false via an alias
2022-05-09 09:30:01 +02:00
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