App UI is freezing after returning from Windows Lock screen.
-
Hi,
I'm trying to create something similar to sliding notification windows near system tray. Notifications data will be stored in a ListModel later on, so to maximize simplicity I used Repeater, Loader, and Window with appropriate flags (Loader was used because Repeater as a delegate requires an element derived from Item)I noticed that the application can freeze, especially when the user is on the login screen (WinKey + L for quick access there) After returning from this screen, the application interface is frozen. Not always but often, I also noticed that this has some connection to the x/y coordinates when creating the notification window. If I set them somewhere off-screen, it freezes much more frequently after returning from the lock screen
I've prepared a minimalistic code fragment that frequently triggers the mentioned problem. On my laptop it's enough to go to the lock screen (WinKey + L) 2-3 times to freeze the UI. On much stronger PC its way more difficult to reproduce it at least for me.
import QtQuick Window { width: 640 height: 480 visible: true title: qsTr("Hello World") Rectangle { id: animatedRect anchors.centerIn: parent width: 100; height: 100 color: "#00FF00" NumberAnimation { target: animatedRect properties: "rotation" from: 0; to: 360 running: true duration: 500 loops: Animation.Infinite } } Timer { interval: 2000 repeat: true running: true onTriggered: { repeater.model = 0 repeater.model = 9 } } Repeater { id: repeater model: 0 delegate: Loader { sourceComponent: Window { x: (Screen.desktopAvailableWidth - 100) + index * 20 y: (Screen.desktopAvailableHeight - 100) + index * 20 flags: Qt.Window | Qt.Tool | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint visible: true Component.onCompleted: raise() Rectangle { anchors.fill: parent color: "#FFCCCC" border.color: "#000000" border.width: 2 } } } } }I'm using Qt 6.9.2, on 6.8 this problem doesnt exist for some reason. Perhaps instead of using Repeater/Loader/Window and ListModel, I should dynamically load the component through Qt.createComponent. However, I would first like to understand why my method causes such problems and, if necessary, report a bug.
Does anyone have any ideas?