-
I want to make another window ui1 display when I click a button on the current window ui0 (if ui1 is minimized, have it cancel the minimized state). I tried to call the ui1->show() method, but it didn't work. What can I do to achieve this function? |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 7 replies
-
This is not yet implemented. |
Beta Was this translation helpful? Give feedback.
-
Okay, thank you. |
Beta Was this translation helpful? Give feedback.
-
Right now, it is possible with private API using the i-slint-backend-winit crate. i-slint-backend-winit = "=1.1.0" with the "=" , because we don't follow semver for internal crates. fn main() {
// make sure the winit platform is initialized (as opposed to an other platform) by setting it before any other slint call
slint::platform::set_platform(Box::new(i_slint_backend_winit::Backend::new()));
// ...
i_slint_backend_winit::WinitWindowAccessor::with_winit_window(ui1.window(), |win| win.focus_window());
} (I haven't tried this) |
Beta Was this translation helpful? Give feedback.
-
Okay, that's great! Thank you! |
Beta Was this translation helpful? Give feedback.
-
Using the above method, a bug occurred on the v1.1.0 backend instead. TouchArea in Flickable has slowed down its response to clicked events. When the mouse is clicked and raised too quickly, this event is not triggered. I tried v1.0.2 again and it can trigger normally. |
Beta Was this translation helpful? Give feedback.
-
The TouchArea above is normal, while the TouchArea below is normal in version 1.0. Exception in version 1.1 (pressing the left mouse button slowly to release can respond to events, pressing the left mouse button immediately to release does not respond to events). The code is as follows: export component AppWindow inherits Window {
width: 200px;
height: 100px;
VerticalBox {
Rectangle {
height: 50px;
Text {
text: "ok";
}
TouchArea {
clicked => {
debug("ok")
}
}
}
Flickable {
Rectangle {
height: 50px;
Text {
text: "??";
}
TouchArea {
clicked => {
debug("??")
}
}
}
}
}
} |
Beta Was this translation helpful? Give feedback.
-
So I have since discovered an issue doing this that appears to be specific to the winit backend and Wayland. I haven't dug too deep, but as mentioned above, in my project I create a borderless window and recreate the window frame to theme it with the rest of the application. I need access to the backend so I can programmatically minimize it, and hide the window to "minimize" it to the tray. When I first added in the use of i_slint_backend_winit, I noticed no issues, however I was testing on Windows 11 at the time. I'm not sure entirely sure if this is relative to this discussion or I should be opening a new discussion / issue, but It came up because I was using the technique mentioned in this discussion. I need to try and get a video of it in action, and narrow it down to a minimum example, but I thought I would comment here and see if there were any ideas while I try and work on that. |
Beta Was this translation helpful? Give feedback.
-
May I ask if the software package I uploaded is also running normally on your end? This is a software package on MacOS. |
Beta Was this translation helpful? Give feedback.
Right now, it is possible with private API using the i-slint-backend-winit crate.
You need to enable it like so in your Cargo.toml file
with the "=" , because we don't follow semver for internal crates.
then you can do something like
(I haven't tried this)
But this use the winit::Window API and allow to have more …