Commit graph

246 commits

Author SHA1 Message Date
Tobias Hunger
07ad20a09c
Basic Slint accessibility support (#1294)
Implement basic accessibility (a11y) support, using the Qt backend.

_This should get us started, but accessibility support is an additional way to interact with UIs that is very different from the "graphical way" most users will interact with the UI. No single PR will "make a toolkit accessibility", this needs to be an ongoing effort!_

Parts of this PR:

* Add functions to access a11y-related properties to Component
* Add helper functions to Item struct 
* Handle accessible- properties in the compiler
* Add documentation, add description, enforce some basic rules
* Make the Text element accessible by default
* Don't optimize away accessibility property in the LLR
* Ensure that accessibility property are marked as used
* Add some accessibility properties to the native style widgets
* Support for bool and integer `accessible` properties
* Implement basic support for accessibility
* Make basic widgets accessible by default
* Make slider focus-able and interactable with keyboard
* Tell a11y layer about value changes
* Generate QAccessible constants using bindgen
* Don't expose the `accessible` properties when using the MCU backend: There is no backend to make use of them
* Handle focus change based on keyboard focus of the window
* Report accessible widgets at correct positions
* Allow for (virtual) focus delegation at the a11y level
* Calculate value step size dynamically
* Make sure to not send notifications to a11y backend about dead objects
2022-06-08 20:42:10 +02:00
Simon Hausmann
565262f5c1 Fix formatting
Re-ran `cargo fmt`
2022-06-08 09:23:31 +02:00
pubg-hacks
aed71311ca Add a read-only propery to TextInput, LineEdit and TextEdit 2022-06-08 09:23:01 +02:00
Olivier Goffart
fa6be65a04 Revert "Rename the free_graphics_resources to component_destroyed"
This reverts commit 1b9fee96c16f7a660ed2c14bb3287fceedc72ba7.

The MCU backend still need the array of item, so it's too realy for this change
2022-05-31 10:48:24 +02:00
Olivier Goffart
ad2d19165a Rename the free_graphics_resources to component_destroyed
And do not iterate over the items anymore
2022-05-31 10:48:24 +02:00
Olivier Goffart
6cbf2c0609 Put the new cache in corelib and use it in the GL backend 2022-05-31 10:48:24 +02:00
Olivier Goffart
615c7635ee Qt: use a HashMap for the cache
And not the cache dirrectly within the item, because it is already in use
for the partial rendering
2022-05-31 10:48:24 +02:00
Olivier Goffart
d2186593c0 Pass the ItemRc to each draw_function
So that it can be used as a key to the cache
2022-05-31 10:48:24 +02:00
Tobias Hunger
18cbda0269 janitor: Run cargo clippy --fix 2022-05-22 11:59:00 +02:00
Olivier Goffart
9ae6d71619 Qt: fix gradient that have stop at the same position
Qt implementation only keep one stop if two are at the same location.
So mangle the stop position to be sure they are all at sligntly different position
2022-05-21 11:43:53 +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
Olivier Goffart
0c19751a1e Qt: do not wrap QPainter directly, but use a unique_ptr instead
Because QPainter can't be relocated.

Fixes #1230
2022-05-05 13:50:26 +02:00
Tobias Hunger
11f23cbbdb
Hack to make Qt not close newly opened popups when running on Windows (#1227)
* Hack to make Qt not close newly opened popups when running on Windows

Windows sends a mouse release event after the close event when running
on windows. This confuses our hack to close popups!

So hack around the problem by ignoring any mouse button release event
that does not follow a mouse button press event. I hope this will
not couse too many side effects.

Fixes: #1211

* Update internal/backends/qt/qt_window.rs

Co-authored-by: Olivier Goffart <olivier@woboq.com>

Co-authored-by: Olivier Goffart <olivier@woboq.com>
2022-05-03 18:46:53 +02:00
Olivier Goffart
931838e2ce Qt: quit the application when calling hide() on the last window
Fixes the todo example not exiting when clicking on "yes" in
the close popup

cc #1212
2022-05-03 17:20:41 +02:00
Olivier Goffart
1b9917db37 Fix PopupMenu showing in a wrong place from qt_viewer
qt_viewer reparent the window so we need to use mapToGlobal to compute
the popup position

Fixes #1219
2022-05-03 11:54:53 +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
8eddeb6a80 Qt: Fix text_input_byte_offset_for_position when at the end of the last line 2022-04-04 15:36:43 +02:00
Olivier Goffart
d7616ae03b Qt backend: fix text_input_byte_offset_for_position at end of lines
We must include the trailing spaces in the lines, and if we are past that
we must always go back to the last character of the line
2022-04-04 14:57:44 +02:00
Olivier Goffart
054144c236 text_input_byte_offset_for_position: clicking past the end should return the last position
Instead of 0.
(But passing a negative y coordinate should return 0)
2022-04-04 14:57:44 +02:00
Olivier Goffart
16a0f28449 Keep the existing size re-using a window
Eg, in the viewer or in the preview.

The preferred size is still set as the size when the window is first open
2022-04-01 16:18:59 +02:00
Lukas Jung
b6171530ab replace text_input_position_for_byte_offset with text_input_cursor_rect_for_byte_offset 2022-03-28 10:07:07 +02:00
Simon Hausmann
033cf3721e Improve performance of opacity rendering
Avoid an opacity layer also in the case where it is applied to an element with no children.
2022-03-25 10:50:02 +01:00
Simon Hausmann
d6a569b8f8 Make rendering_metrics_collector a public module
... instead of pulling it entirely into the graphics module.
2022-03-24 21:20:28 +01:00
Simon Hausmann
f3b1ba6717 Collect statistics about the number of layers created in the GL and Qt renderer 2022-03-24 21:20:28 +01:00
Simon Hausmann
7b194b3f8c Rename FPSCounter to RenderingMetricsCollector
In preparation for collecting additional data
2022-03-24 21:20:28 +01:00
Simon Hausmann
fee858271c Fix the frame per second counter when using refresh_full_speed
After commit 575665994a we need to explictly schedule a repaint,
so that we draw and call `measure_frame_rendered`.
2022-03-24 14:49:20 +01:00
Simon Hausmann
caca532ada Released unused opacity layers 2022-03-23 17:37:27 +01:00
Simon Hausmann
4799ac9ce8 Don't create layers for opacity if it's not needed
More could be done towards this, but after literally seeing `opacity: 1;` in
.slint files, this seems worth doing.
2022-03-23 17:37:27 +01:00
Simon Hausmann
bef31d3169 Rename the layer boolean property to cache-rendering-hit 2022-03-21 20:22:43 +01:00
Simon Hausmann
849282a5a8 Don't render with layers if the layer property is false 2022-03-21 20:22:43 +01:00
Simon Hausmann
3a5181d31f Implement the Layer element for the Qt renderer 2022-03-21 20:22:43 +01:00
Simon Hausmann
a72aa9f799 Implement correct opacity for the Qt backend
Relates to #725
2022-03-18 16:35:26 +01:00
Lukas Jung
5495a8a701 add close request handling the qt backend 2022-03-17 08:51:00 +01:00
Olivier Goffart
a85482e5a4 Fix selection and clicking on password fields 2022-03-02 21:55:49 +01:00
Olivier Goffart
70bc75c267 Use a better character for the password replacement char
Also don't use the byte len, but the char length.
It's not entierly correct, but it's good enough
2022-03-02 21:55:49 +01:00
Jared Moulton
b884a4ca19 Fix CI issues, remove references to replace-char, add a test, fix creation of string 2022-03-02 15:47:32 +01:00
Jared Moulton
fdbc8056b3 Add an option to draw *'s instead of characters for password fields 2022-03-02 15:47:32 +01:00
Olivier Goffart
f7a0fda86c
Send a MouseExit event when the mouse leaves the window
Fixes #989
2022-03-01 11:23:39 +01:00
Simon Hausmann
b65b66b871 Replace use of SFPS prefix in Qt wrapper functions 2022-02-14 16:17:55 +01:00
Tobias Hunger
4230ac2572
Update copyright information to reflect name change
Also run resue over the codebase and fix complaints from that tool.
2022-02-09 10:27:47 +01:00
Tobias Hunger
de4e195280
Rename internal crates and add a README.md to them
The README.md contains the warning that used to be in lib.rs.

Add README.md files to all internal crates

... pointing to the official public crate to use instead.

Rename internal crates

fixup: README files

fixup rename
2022-02-07 13:12:48 +01:00
Olivier Goffart
1586235478 Rename SixtyFPSWidget 2022-02-02 14:29:30 +01:00
Simon Hausmann
c846633708 Rename C ffi functions 2022-02-02 11:12:34 +01:00
Simon Hausmann
ad0c020aa4 Rename the sixtyfps-corelib crate 2022-02-01 18:04:30 +01:00
Simon Hausmann
0bd627cad6 Rename the common crate 2022-02-01 18:00:25 +01:00
Tobias Hunger
a3b86690ff [reorg]: Move the rendering backends into internal 2022-01-31 16:00:50 +01:00
Renamed from sixtyfps_runtime/rendering_backends/qt/qt_window.rs (Browse further)