This is supposed to be emitted whenever the user performs an
intentional interaction, which works whenever you scroll the Slint
Flickable with the scrollwheel. Dragging the scrollbar on the Qt
style didn't do anything, since that was never hooked up to this
callback.
I only implemented this in the Qt style, because that's the only
one that uses the NativeScrollView element.
See #9574.
This fixes a regression seen with 0910024aeb
where text outlines no longer rendered with Qt and the text color
was wrong in general.
It turns out drawGlyphRun doesn't work when drawing outlines. It
only uses the current QPen color and that's it - so not a built-in
way to draw the outlines separately. There was also another bug
where we weren't setting the correct QPen color, which regressed
any dark themes. (Presumably because no one expected it to fill
text with the QPen!)
We can fix this by only using drawGlyphRun for filling in glyphs.
For drawing the glyph outlines, we can skip the built-in QPainter
functions altogether and use QRawFont's ability to create
QPainterPaths for us. This restores the text to its previous
appearance while keeping the nicer text layouting!
* Add scale method to backends
* Rename Rotate to Transform
* Add scaling to Transform
* Fix tests
* Insert Transform if any of scale-x, scale-y or rotation-angle are set
* Add scaling to child_transform and handle events as a result
* Cargo fmt
* Femtovg clipping
* Fix femotovg clipping
* Add newline to actual_render.scale
* Cargo fmt tools/lsp changes
* Modify docs
* Change type to a float instead of percent and fix defaults
* Add note about software renderer
* Add basic event scaling test
It's nice that the default icon size comes from the style, but sometimes
the user wants a big button with a big icon.
Tested in all 5 styles, with PNG and SVG, with and without icon-size
set.
ChangeLog: Added `icon-size` property to Button
* Start on touch event rotation work
* [autofix.ci] apply automated fixes
* Use ItemTransform instead.
* [autofix.ci] apply automated fixes
* Use casts to deal with integer Coords on some platforms
* Remove rotation checks
* Transform the exit event as well
* Delete check_rotation pass
* Do casts around transform_point to handle i32 Coords
* Remove errors from rotation syntax test
* Basic event rotation test
Working changes
* Fix clicks on rotated objects
* Add RendererSealed::suppports_transformation for runtime checks
* [autofix.ci] apply automated fixes
* Add a few missing line breaks, only transform events if supported by
renderer
* Improve test
* Remove extra whitespace
* Get absolute-position working
* Ensure map_to_window does the coordinate cast thing.
* Manually test mouse-x and mouse-y, test absolute_position()
* Whitespace stuff again
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
- Take in account the scale factor (unfortunately we don't have access to the actual window scale factor so just use the Qt one)
- Draw directly in the final SharedPixelBuffer
- Use an intermediate Rectangle to center the image because otherwise we get height for width dependency that breaks layout.
After commit e04f028c91, the
default-font-size property on WindowItem isn't set anymore by default,
so BuiltinFunction::GetWindowDefaultFontSize, which reads it, would
return zero.
Instead, delegate to a run-time function where we can fall back to the
default from the renderer.
This patch changes rem.slint to use the newer syntax. The main change to
the test case though is to removal of the explicit default-font-size
property setting, so that we fall back to the value provided by the
renderer. This test relies on being run with the testing backend.
Fixes#8961
- Implement @conic-gradient(color angle, ...) syntax
- Center is always at rectangle center (no center_x/center_y parameters)
- 0 degrees starts at north (12 o'clock position)
- Support Slint angle units: deg, rad, turn
- Software renderer: Full native implementation
- Qt backend: Native support with angle offset correction
- Skia backend: Native support with angle offset correction
- FemtoVG backend: Fallback to solid color (first gradient stop)
ChangeLog: Added support for `@conic-gradient`
Fixes#3957
... and call that during key event delivery.
Add `capture_key_pressed` and `capture_key_released` callbacks
to `FocusScope` to expose this functionality.
Add a simple test to make sure Interception of key events works as
expected.
Related to: #102, #6390
When applying colorize with gradients to images, use the actual pixmap
dimensions for the gradient brush instead of the destination rectangle
dimensions. This ensures gradients are properly applied to the source
image before any transformations.
We had code on the window to reset the default-font-size property to the
default from the renderer.
For the Qt backend, the PopupWindow being their own Window, this code
was activated also for the PopupWindow's hidden default-font-size
property, which caused all PopupWindow's font to not follow the
default-font-size
Fixes#8855
This exposes FocusReason to .slint, and adds it as an argument to focus-event-changed callback on FocusScope to close#8387. It also adds two new callbacks, focus-gained and focus-lost, which are identical to focus-event-changed but are only invoked on focus gain or loss respectively.
In addition to this, it removes the FocusEventReason::AccessKit variant, replacing it with the mouse variant to hopefully make AccessKit more compatible with any Slint code that will use FocusEventReason.
Finally, I added two tests based on focus_change_event.slint, one for testing the FocusEventReason argument and another for testing the new callbacks.
close#8387
ChangeLog: Added `focus-gained` and `focus-lost` callback to FocusScope. Pass an `FocusReason` enum to the FocusScope callbacks
Closes#5992
Adds the enum FocusEventReason and makes it an argument for FocusEvent. This reason could eventually be exposed in Slint to solve #8387.
Using the focus reason tracking, I also added a select all on keyboard focus for TextInputs (except on macOS), which should close#5992.
ChangeLog: TextInput selects its content when focused with the keyboard on Windows and Linux
To be compatible with the 2024 edition, we need to wrap the
`no_mangle` attribute in `unsafe()`.
The parsing for that in cbindgen was only added in the version 0.28,
but we couldn't upgrade cbindgen before because of a regression in
cbindgen 0.27 that prevented us from upgrading.
Now that cbindgen 0.29 is released with a fix, we can prepare for the
2024 edition
This is a hook for the Qt backend that provides the ability to access the `QWidget` for a window, similar to how the `winit` back end supports accessing the `winit` `Window` object
... by changing the resolution for the `WindowItem` to traverse the
item tree from the current item, instead of going to the window.
This doesn't quite fix#4298 because `rem` resolution is still missing.
That requires the built-in default font size function to be fixed as
well, which is non-trivial.
cc #4298
This is only exposed when internal types are exposed (such as in the lsp).
The plan is to make this public under a new name/global after the release.
Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
This fixes the preview window not showing with the Qt backend,
because the preview uses a timer to show the window, but we would not
start the Qt timer and so the window was never shown
Commit cd6f2e2 reformated the .toml, but the 80 char width column is
judged too small to be practical
Add a .taplo.toml file
Also do not split feature array
... using taplo with default settings
I tried this with 4 spaces indentation, but the patch is almost as
big as this one, so I went with default settings instead as that
is just easier:-)
We really need to dispatch the release event otherwise the wrong
item keeps the drag and this breaks the behavior.
This is not perfect yet as if the release is done on the wrong popup,
then we'll still not get the release event.
We should probably remove the grab when a popup open. But that's
slightly more complicated
(or popup menu gets closed)
We receive an empty `QInputMethodEvent` when the window gets active
and we should not have a replacement range if there is nothing to
replace, otherwise we clear the selection
This is a hacky approach, but does help a lot with the tedious fixes.
See https://rust-lang.github.io/rust-clippy/master/index.html#/unnecessary_map_or
```
__CARGO_FIX_YOLO=1 cargo clippy --fix --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::unnecessary_map_or
cargo fmt --all
```