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
Timer {
id: timer
interval: 500 // Milliseconds
interval: 200 // Milliseconds
onTriggered: {
FocusController.resetRootObject()
FocusController.setFocusOnDefaultItem()

View file

@ -5,6 +5,7 @@ import QtQuick.Layouts
import Style 1.0
import "TextTypes"
import "../Config"
Popup {
id: root
@ -28,7 +29,7 @@ Popup {
}
onOpened: {
FocusController.pushRootObject(root)
timer.start()
}
onClosed: {
@ -42,6 +43,17 @@ Popup {
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 {
implicitWidth: content.implicitWidth
implicitHeight: content.implicitHeight