mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-30 23:27:22 +00:00
Fix rendering of the Qt platform example with high-dpi
- Provide a C++ platform event for the scale factor change and send it - Report the correct logical and physical sizes to Slint
This commit is contained in:
parent
459f810bd8
commit
dd61890e23
3 changed files with 34 additions and 12 deletions
|
@ -139,7 +139,7 @@ pub unsafe extern "C" fn slint_windowrc_has_active_animations(
|
|||
window_adapter.window().has_active_animations()
|
||||
}
|
||||
|
||||
/// Dispatch a key pressed or release event
|
||||
/// Dispatch resize event
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn slint_windowrc_dispatch_resize_event(
|
||||
handle: *const WindowAdapterRcOpaque,
|
||||
|
@ -152,6 +152,18 @@ pub unsafe extern "C" fn slint_windowrc_dispatch_resize_event(
|
|||
});
|
||||
}
|
||||
|
||||
/// Dispatch scale factor change event
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn slint_windowrc_dispatch_scale_factor_change_event(
|
||||
handle: *const WindowAdapterRcOpaque,
|
||||
scale_factor: f32,
|
||||
) {
|
||||
let window_adapter = &*(handle as *const Rc<dyn WindowAdapter>);
|
||||
window_adapter
|
||||
.window()
|
||||
.dispatch_event(i_slint_core::platform::WindowEvent::ScaleFactorChanged { scale_factor });
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn slint_platform_update_timers_and_animations() {
|
||||
i_slint_core::platform::update_timers_and_animations()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue