Commit graph

246 commits

Author SHA1 Message Date
Olivier Goffart
e04f028c91 Fix default-font-size not working with PopupWindow with the Qt backend
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
2025-07-09 17:08:24 +02:00
Olivier Goffart
4cfd2ae272 Qt: Fix text_input_byte_offset_for_position when pos is exactly at the end of a line
This can happen when pressing the "up" arrow if two lines are identical

Fixes #8551
2025-05-27 11:29:41 +02:00
Olivier Goffart
23962b3e25
Upgrade cbindgen and use unsafe(no_mangle) attributes (#8539)
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
2025-05-26 11:21:33 +02:00
omahs
74232eae8d
Fix typos (#8421) 2025-05-12 13:03:59 +02:00
Simon Hausmann
f4cab86d43 qt backend: Fix mouse up not being sent when pressing multiple buttons
Detect if a button is still pressed before deciding that no button is down.

Fixes #8335
2025-05-05 12:03:05 +02:00
npwoods
80cde76e2a
Qt backend: Created an accessor for the Qt backend to access a window's QWidget
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
2025-04-28 16:47:03 +02:00
Simon Hausmann
b098bccc32 Propagate default font properties into PopupWindow 2025-04-24 09:18:45 +02:00
Simon Hausmann
eb825f2e95 Support default-font-* properties in Live-Preview
... 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
2025-04-24 09:18:45 +02:00
Olivier Goffart
409413b835 Qt: re-arm the timer after callback from invoke_from_event_loop
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
2025-04-11 12:41:10 +02:00
szecket
ed47d1e70a
matching the math for skia and femtovg renders for radial gradient (#7899) 2025-03-21 10:53:04 -04:00
Olivier Goffart
97fdda5c09 Qt: Fix processing of the mouse release event in popup menu
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
2025-02-24 12:02:38 +01:00
Olivier Goffart
ce7a785138
Qt: don't clear selection when the window gain focus
(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
2025-02-11 18:10:09 +01:00
Olivier Goffart
22317d29b4
Qt: Fix event forwarding for native popups
So that popup menus can handle hover events.

This also remove some of the code in the qt backend that used the
private API
2025-02-11 17:11:43 +01:00
Olivier Goffart
ceb7ea00f5
Qt: don't call deleteLater on the main widget
Otherwise we crash at exit

Fixes #7570
2025-02-11 12:53:53 +01:00
Simon Hausmann
85b91bd325 Reduce size of CachedItemGeometryAndTransform and fix filter_item to respect the bounding rect
Remove the geometry field and merely store the offset/transform. This brings the size down from 40 to 32 bytes on aarch64.

Related, filter_item() now respects the item's bounding rect for the decision whether to draw the item or not.
2025-01-30 10:55:28 +01:00
Simon Hausmann
05e70e8c8b Fix support for Window.background tracking with the partial renderer
Fixes #5219
2025-01-29 16:32:42 +01:00
Simon Hausmann
cf9b515a92 Clean up rendering of component container
Instead of creating a dummy Rectangle with background property, implement a RenderRectangle trait.
2025-01-29 12:39:40 +01:00
Simon Hausmann
0d723953f9 Add support for line caps in Path Strokes
ChangeLog: Added `Path::stroke-line-cap` property.

Fixes #4676
2025-01-20 22:28:45 +01:00
Simon Hausmann
53f2d572b1 Remove some uses of once_cell 2025-01-14 14:18:24 +01:00
Olivier Goffart
e34c19325c
Fix closing PopupWindow when the click opens another PopupWindow
Fix #7322
2025-01-10 21:57:35 +01:00
Simon Hausmann
c764da4aab
Add property to toggle anti-aliasing on Path elements (#7308)
This enables working around bugs in GPU drivers. Especially the GC7000UL
plus its driver on imx8mp has been observed to sometimes horribly degrade in
performance when Skia renders anti-aliased paths (when a function like
`gcoSURF_BlitCPU` shows up at the top of `perf` that's a bad sign).
2025-01-10 10:28:01 +01:00
FloVanGH
0d1412afc5
removed skip-taskbar property from window (#6982) 2024-12-03 10:07:36 +00:00
FloVanGH
712f930897
windows: added skip_taskbar (#6911)
* Update internal/backends/winit/winitwindowadapter.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/backends/winit/winitwindowadapter.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update docs/src/content/docs/reference/window/window.mdx

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-11-27 09:55:11 +00:00
Simon Hausmann
1888e58735 Add API to set the XDG app id
ChangeLog: Added function to set the XDG app id on Wayland/X11. This needs to be added with respective function names in the language sections.

Fixes #1332
2024-11-22 11:24:06 +01:00
Brandon Fowler
6da0f55b05
Associate PopupWindows with an ID for their active popup (#6693)
Popups are stored in a HashMap and are assigned an ID so popup.close(); closes the correct popup and so a single PopupWindow cannot be opened multiple times
2024-11-04 09:17:55 +01:00
Olivier Goffart
2d944b242c Support multiple PopupWindow
Fixes #4356

Still not perfect:
 - Calling several times `popup.show()` on the same popup, will open
   that popup multiple times (instead of being a noop once opened)
 - Calling `some-popup.close()` will always close the top of the stack,
   without considering if it is the `some-popup` or another popup.

Both problems are because we don't remember whether a particular popup
is open and we don't associate `close()` with a particular popup
2024-10-31 22:27:56 +01:00
Olivier Goffart
3ce0e49003 Qt: Fix PopupClosePolicy::CloseOnClickOutside 2024-10-31 22:27:56 +01:00
FloVanGH
14c7910d49
PopupWindow: added close-policy property (#6614)
* Update api/cpp/include/slint_window.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update docs/reference/src/language/builtins/elements.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

* Update internal/core/window.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/interpreter/eval.rs

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

* Update internal/backends/qt/qt_window.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/interpreter/dynamic_item_tree.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/compiler/passes/materialize_fake_properties.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-10-24 09:27:39 +00:00
Simon Hausmann
a4eb794e43 Fix missing redraws when embedding Slint into QWidget hierarchy
Commit 5718b15899 regressed this by
issuing the update on the window, which breaks when the widget is
embedded in a hierarchy (like a QGraphicsView). We really need to mark
the widget as dirty, even if that means we don't get frame throttling
then.
2024-10-17 16:45:16 +02:00
Simon Hausmann
0b028bfb6f
Add support for a font-metrics property to Text/TextInput. (#6452)
The struct held provides access to the design metrics of the font scaled
to the font pixel size used by the element.

ChangeLog: Slint Language: Added font-metrics property to `Text` and `TextInput`.

Closes #6047
2024-10-05 17:00:46 +02:00
Simon Hausmann
f772cb8e11
live-preview: Bring the window to the front and focus it when the use… (#6295)
Fixes #196


Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2024-09-24 17:05:03 +02:00
crai0
3f3ac7e347
common: add support for back and forward pointing-device buttons (#6149)
Closes #6043

ChangeLog: add support for back and forward pointing-device buttons
2024-09-18 07:48:30 +02:00
Simon Hausmann
e35d05f6b9 API Review: Remove SharedImageBuffer from public API and rename Window::grab_window() to take_snapshot()
Use SharedPixelBuffer as return value for take_snapshot() and provide counter-parts to from_rgb* in Image as to_rgb*
2024-07-05 20:46:55 +02:00
Olivier Goffart
8b5df70dd0 Make a trait for the Text rendering
So we can Split Text
2024-07-05 12:51:25 +02:00
Olivier Goffart
f4085cfd13 winit: Fix setting the size with set_size before showing the window
Fixes #5489

We shouldn't resize the window to the size of the WindowItem after
start. This happens when set_size is called before show. The the
resize event didn't yet propagate the size to the WindowItem properties.
2024-06-27 16:12:35 +02:00
Simon Hausmann
977b827df2
Add Rust API to grab the contents of a slint::Window into a slint::SharedImageBuffer (#5445) 2024-06-22 09:33:18 +02:00
Olivier Goffart
99bb23eb02 Qt backend: fix combobox quiting the application with Qt6
When the popup window is destroyed, the hack we did to close the app on
the last window was too aggressive with Qt6 and closed the application
when it shouldn't have.

Fixes #4803
2024-06-18 15:51:46 +02:00
Daniel Stuart
436efaceea renderer: Use TextWrap enum for text_size function 2024-06-17 23:52:04 -07:00
Daniel Stuart
9f63d157d1 Add character wrapping for Qt Backend
This adds a new wrapping mode called `char-wrap`, which allows for wrapping at any character.
Currently, it only supports the Qt backend, with the other backends falling back to `word-wrap` when this option is selected.
2024-06-17 23:52:04 -07:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Noah Sweilem
3ae3da3a04 Fix formatting issues 2024-04-26 13:16:19 +02:00
Noah Sweilem
15b8e6c9fa Text stroking: implement hairline stroking when width is zero 2024-04-26 13:16:19 +02:00
Noah Sweilem
f51d91f9f1 Text stroking: check if brush is transparent instead of stroke width to disable rendering 2024-04-26 13:16:19 +02:00
Noah Sweilem
d9caef02e1 Qt text stroke implementation 2024-04-26 13:16:19 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
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"
2024-04-15 15:18:55 +02:00
Simon Hausmann
68083243b2
Add an in-out boolean color-scheme property to Palette (#4701)
This allows applications to force dark/light mode, as well as determine
which mode is active.
2024-03-26 15:44:22 +01:00
Olivier Goffart
b7e437fb37 Qt: Fix valgrind warning "Conditional jump or move depends on uninitialised value"
The rust_window is initialized shortly after the constructor is
finished, but changeEvent can happen before that/

The warning can be shown in the log of #4803 (but that is not the cause of the bug)
2024-03-11 08:51:29 +01:00
Olivier Goffart
3910095e4d Tiling for the nine slice images 2024-02-26 12:16:41 +01:00
Olivier Goffart
5e7ddf3a19 Image Tiling
(Doesn't work yet with 9slice)
2024-02-26 12:16:41 +01:00