Rewrite dialog code to use Quick Controls 2
This commit is contained in:
parent
060a00b9c7
commit
73604020d7
15 changed files with 92 additions and 80 deletions
26
app/gui/NavigableDialog.qml
Normal file
26
app/gui/NavigableDialog.qml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.2
|
||||
|
||||
Dialog {
|
||||
property Item originalFocusItem
|
||||
|
||||
x: Math.round((window.width - width) / 2)
|
||||
y: Math.round((window.height - height) / 2)
|
||||
|
||||
onAboutToShow: {
|
||||
originalFocusItem = window.activeFocusItem
|
||||
}
|
||||
|
||||
onOpened: {
|
||||
// Force focus on the dialog to ensure keyboard navigation works
|
||||
forceActiveFocus()
|
||||
}
|
||||
|
||||
onClosed: {
|
||||
// We must force focus back to the last item for platforms without
|
||||
// support for more than one active window like Steam Link. If
|
||||
// we don't, gamepad and keyboard navigation will break after a
|
||||
// dialog appears.
|
||||
originalFocusItem.forceActiveFocus()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue