actiondrawer: Preload for first open

Preload the action drawer so that it doesn't get loaded only when the
user attempts to open it for the first time (making it laggy).
This commit is contained in:
Devin Lin 2026-03-07 11:06:39 -05:00
parent a8b858dc3e
commit 16d8a26a97

View file

@ -35,13 +35,27 @@ Window {
property alias actionDrawer: drawer
property alias state: drawer.state
visible: drawer.intendedToBeVisible
visible: true
color: "transparent"
// set input to transparent when closing to prevent window from taking unwanted touch inputs
// Set input to transparent when closing to prevent window from taking unwanted touch inputs
onStateChanged: MobileShell.ShellUtil.setInputTransparent(window, state === "close")
// Preload and render content to avoid lag on first open
Component.onCompleted: {
preloadTimer.start();
}
Timer {
id: preloadTimer
interval: 1
onTriggered: {
// Set window visibility binding after preloading content to the action drawer state
window.visible = Qt.binding(() => drawer.intendedToBeVisible);
}
}
onVisibleChanged: {
if (visible) {
window.raise();