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
ogoffart
6395cdfc09
Bump version number to 0.2.3
2022-05-04 12:32:58 +00: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
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
Olivier Goffart
f117cb77cc
NativeSpinBox: Handle the key press in native code
2022-04-19 11:27:19 +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
Tobias Hunger
57e120509d
qt: Handle focus in checkbox
2022-04-08 08:32:05 +02:00
Tobias Hunger
70cfc33659
qt: Handle focus in native button
2022-04-08 08:32:05 +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
Simon Hausmann
75949e702c
Prepare item rendering for children self-handling
...
The render function now takes a self_rc and returns a enum that permits
the implementation to handle rendering of children on its own and
thus make the caller skip that traversal step.
2022-03-18 15:42:49 +01:00
Lukas Jung
5495a8a701
add close request handling the qt backend
2022-03-17 08:51:00 +01:00
ogoffart
7b50791db4
Bump version number to 0.2.2
2022-03-10 08:48:33 +00:00
Lukas Jung
10dc49d294
don't draw lineEdit's focus ring if it is not enabled
2022-03-09 19:52:18 +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
Lukas Jung
dba6f11aec
make SpinBox only focusable if enabled
2022-03-02 17:51:31 +01:00
Lukas Jung
7e21e16e2e
change the qstyle of NativeSpinBox when rendering
2022-03-02 17:51:31 +01:00
Lukas Jung
c15b0e1486
Add focus and keyboard control to native/qt spinbox
2022-03-02 17:51:31 +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
Simon Hausmann
39a2290221
Build the backends without rtti unless needed ( #1001 )
...
* Build the backends without rtti unless needed
Only the interpreter needs the rtti generated code.
* Since `SlintElement` emits `#[cfg(feature = "rtti")]` tokens, each
crate using `SlintElement` needs to have an `rtti` feature.
* The selector gets backend specific rtti selection features, in order
for the interpreter to enable them.
* Enable rtti when building the C++ project with the interpreter enabled
2022-03-01 18:37:07 +01:00
n-raine
beda5aca07
Add dark style detection support for GL backend
...
With the help of dark-light crate this is now exposed as dark-style
boolean property in NativeStyleMetrics.
Co-authored-by: Olivier Goffart <olivier@slint-ui.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-03-01 16:41:20 +01:00
Olivier Goffart
0ab86bc0d1
Fix initialization of NativeStyleMetrics with the interpreter
2022-03-01 11:28:55 +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
Olivier Goffart
0dc188f328
Support for referring to other globals from globals
...
- We need to make sure that the initialization of global is in the right order.
- In C++ and rust, we need to add accessor to the global component
- There can be `PropertyReference::Global` in binding of globals
- The interpreter globals need to hold references to the global they may depend on
Fixes #175
2022-02-28 10:14:34 +01:00
Olivier Goffart
6ecd9b5565
Upgrade qttypes
...
It now expose the flag via env variable, and allow to report
the reason why Qt was not found
2022-02-23 22:17:12 +01:00
Tobias Hunger
f3feab1267
Implement ptr_eq for VWeak and PartialEq for Items ( #976 )
...
* Implement ptr_eq for VWeaks
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-02-21 17:45:18 +01:00
Tobias Hunger
6795d3ee00
Introduce a FocusEventResult enum ( #975 )
2022-02-21 17:43:41 +01:00
Tobias Hunger
9fefc03bcc
Reuse compliance cleanups (found by the new tooling)
2022-02-15 11:34:37 +01:00
Simon Hausmann
b65b66b871
Replace use of SFPS prefix in Qt wrapper functions
2022-02-14 16:17:55 +01:00