For .slint files that are included, we canonicalize the path before
adding it into the import stack, to avoid duplicates. We didn't do that
for images in the global_embedded_resources.
Ensure this by canonicalizing as early as possible.
Fixes#2608
The previous code was only re-creating the layout properties for these
that had a binding, but that wasn't done if the property was just read,
leading to access to non-existing properties later.
Fixes#2483
We need to take in account that the items might be clipped when sending
mouse exit events to items.
Note that the test needed a fix to use the actual windows state.
After the `FocusScope` accepted the input event by transferring focus, stop
propagating the event and avoid it being sent to a parent,
which in turn will steal the focus.
This patch merges the changes from #2344 and #2491 and do some cleanup
In particular, this visit the init code expression when visiting the
root element expression
Closes#2344Closes#2491Fixes#2487
Otherwse they show up as error because of the deny(warning) in the test.
This is not a problem in the CI because CI uses --all-features that use
the build-time thing, but this is a problem when running locally
We cast the result of the body of functions or binding expressions to
the target type via `as _`. When the code contains a return expression,
that works fine, because `return`'s type is the never type, which can be
coerced to a value of any type. However when the return statement is
inside a sub-block, the type becomes `()`, for which the `as _` cast
fails.
Work around this by attempting to detect the situation (return produces
Type::Invalid) and omit the trailing cast.
When scrolling the printer demo, I often end up closing or opening
element i don't want to because we reached the end and therefore it is
not scrolling and forwarding the event
Don't try to install a callback handler that captures an invalid
expression. The llr pass has an invalid expression guard, and so does
the rest of this handle_property_bindings_init callback.
Fixes#2319
States are never constant because the generated state binding depend on
the time as it register the time it was set for the pottential animation
Also adjust the assert so it assert correctly which the right message
Fixes: #2274
An element with children must be fully inlined or the children array
can't be easily computed.
But the code wouldn't work if the base of a component was not inlined
Just like opacity and other properties, it needs to prevent inlining.
And also add the same warning as for opacity if it is used on the root
(the Window)
The CI gets the error
```
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(11): error C2665: 'Color::Color': no overloaded function could convert all the argument types
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(11): note: could be 'Color::Color(Color &&)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(11): note: 'Color::Color(Color &&)': cannot convert argument 1 from 'slint::SharedString' to 'Color &&'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(11): note: Reason: cannot convert from 'slint::SharedString' to 'Color'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(11): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(11): note: or 'Color::Color(const Color &)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(11): note: 'Color::Color(const Color &)': cannot convert argument 1 from 'slint::SharedString' to 'const Color &'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(11): note: Reason: cannot convert from 'slint::SharedString' to 'const Color'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(11): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(11): note: while trying to match the argument list '(slint::SharedString)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(11): note: This diagnostic occurred in the compiler generated function 'Color::Color(Color &&)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(140): note: see reference to function 'Color::Color(Color &&)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(140): note: see reference to function template instantiation 'Color TestCase::init::<lambda_2>::operator ()<std::tuple<slint::SharedString>>(const _T1 &) const' being compiled
with
[
_T1=std::tuple<slint::SharedString>
]
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): error C3511: 'SharedString': a call to a delegating constructor shall be the only member-initializer
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): note: This diagnostic occurred in the compiler generated function 'SharedString::SharedString(SharedString &&)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(147): note: see reference to function 'SharedString::SharedString(SharedString &&)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(148): note: see reference to function template instantiation 'SharedString TestCase::init::<lambda_4>::()::<lambda_1>::operator ()<slint::SharedString,slint::SharedString,int>(const _T1 &,const _T2 &,const _T3 &) const' being compiled
with
[
_T1=slint::SharedString,
_T2=slint::SharedString,
_T3=int
]
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): error C2665: 'SharedString::SharedString': no overloaded function could convert all the argument types
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): note: could be 'SharedString::SharedString(SharedString &&)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): note: 'SharedString::SharedString(SharedString &&)': cannot convert argument 1 from 'slint::SharedString' to 'SharedString &&'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): note: Reason: cannot convert from 'slint::SharedString' to 'SharedString'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): note: or 'SharedString::SharedString(const SharedString &)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): note: 'SharedString::SharedString(const SharedString &)': cannot convert argument 1 from 'slint::SharedString' to 'const SharedString &'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): note: Reason: cannot convert from 'slint::SharedString' to 'const SharedString'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): note: while trying to match the argument list '(slint::SharedString)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): note: This diagnostic occurred in the compiler generated function 'SharedString::SharedString(SharedString &&)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(147): note: see reference to function 'SharedString::SharedString(SharedString &&)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): error C2437: 'Component': has already been initialized
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): note: This diagnostic occurred in the compiler generated function 'SharedString::SharedString(SharedString &&)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(147): note: see reference to function 'SharedString::SharedString(SharedString &&)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): error C2437: 'Model': has already been initialized
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(31): note: This diagnostic occurred in the compiler generated function 'SharedString::SharedString(SharedString &&)'
C:\Users\RUNNER~1\AppData\Local\Temp\.tmpUISeUr.cpp(147): note: see reference to function 'SharedString::SharedString(SharedString &&)'
```
Which I don't feel like debugging now
Having a const generic for that didn't turn to be a good API.
Also made the C++ side more difficult
(Also renamed buffer_stride to pixel_stride)
Closes#2135
The const detection for two way binding was not detecting change if one
of the property was set to a const value in a component using it.
This would cause the compiler to generate call set_content on one of the
property in a two way bindings, and later, the "const sentinel" be
present in the dependency list, causing crash.
To avoid segfault for similar bug in the future, added added an assert!
in the property system to detect that.
Fixes#2185
Allow for a small differences as "roundeing error" while drawing gradients.
Note that when stops are involved, we still get artifacts and bigger difference
than tollerable when clipping
... in addition to the files tested earlier.
This changes the modules generated to include the relative path to the
project root. Otherwise we got errors due to the widgets module getting
defined twice (once in docs/ and once in docs/langref/src).
I think this is saver, as we can end up with files with the same name in
different directories quite easily.
Commit 24dcef5fed added a warning for the
implicit export of last component. For 1.0, this commit makes it so that
the root component is determined by the last export in the file.
The property set by the user was not kept because the binding went the
wrong way.
Also remove the undocumented (and equaly not working)
TabWidget::current-focused property from the public API.
The current-focused property is initialized by the tab.
When a global shortcut, like ^-Cmd-Q on macOS to lock the screen, causes
a loss of window focus, we'll receive a key event from the windowing
system for the modifier, but we'll never receive the "Q" in this example
(as press or release). So later, when we regain focus, we'd assume that
our keyboard modifier state is still "pressed ^/Cmd", which is
incorrect. Therefore assume that a loss of window focus implies a reset
keyboard of keyboard modifier state.
Fixes#2098