fix focus on notification

This commit is contained in:
Cyril Anisimov 2024-11-01 08:28:27 +01:00
parent 5e9202f6ac
commit a92f706524
2 changed files with 14 additions and 2 deletions

View file

@ -18,7 +18,7 @@ Item {
// Set a timer to set focus after a short delay // Set a timer to set focus after a short delay
Timer { Timer {
id: timer id: timer
interval: 500 // Milliseconds interval: 200 // Milliseconds
onTriggered: { onTriggered: {
FocusController.resetRootObject() FocusController.resetRootObject()
FocusController.setFocusOnDefaultItem() FocusController.setFocusOnDefaultItem()

View file

@ -5,6 +5,7 @@ import QtQuick.Layouts
import Style 1.0 import Style 1.0
import "TextTypes" import "TextTypes"
import "../Config"
Popup { Popup {
id: root id: root
@ -28,7 +29,7 @@ Popup {
} }
onOpened: { onOpened: {
FocusController.pushRootObject(root) timer.start()
} }
onClosed: { onClosed: {
@ -42,6 +43,17 @@ Popup {
radius: 4 radius: 4
} }
Timer {
id: timer
interval: 400 // Milliseconds
onTriggered: {
FocusController.pushRootObject(root)
FocusController.setFocusItem(closeButton)
}
repeat: false // Stop the timer after one trigger
running: !GC.isMobile() // Start the timer
}
contentItem: Item { contentItem: Item {
implicitWidth: content.implicitWidth implicitWidth: content.implicitWidth
implicitHeight: content.implicitHeight implicitHeight: content.implicitHeight