mirror of
https://github.com/lubosz/overte.git
synced 2025-04-13 06:42:10 +02:00
Focus hack for menu fix
This commit is contained in:
parent
3d46eda165
commit
f343598d91
3 changed files with 39 additions and 8 deletions
|
@ -16,12 +16,7 @@ FocusScope {
|
|||
property bool desktopRoot: true
|
||||
|
||||
// The VR version of the primary menu
|
||||
property var rootMenu: Menu {
|
||||
id: rootMenu; objectName: "rootMenu"
|
||||
Component.onCompleted: {
|
||||
console.log("ROOT_MENU " + rootMenu);
|
||||
}
|
||||
}
|
||||
property var rootMenu: Menu { objectName: "rootMenu" }
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
|
@ -210,7 +205,13 @@ FocusScope {
|
|||
|
||||
// Debugging help for figuring out focus issues
|
||||
property var offscreenWindow;
|
||||
onOffscreenWindowChanged: offscreenWindow.activeFocusItemChanged.connect(onWindowFocusChanged);
|
||||
onOffscreenWindowChanged: {
|
||||
offscreenWindow.activeFocusItemChanged.connect(onWindowFocusChanged);
|
||||
focusHack.start();
|
||||
}
|
||||
|
||||
FocusHack { id: focusHack; }
|
||||
|
||||
function onWindowFocusChanged() {
|
||||
console.log("Focus item is " + offscreenWindow.activeFocusItem);
|
||||
var focusedItem = offscreenWindow.activeFocusItem ;
|
||||
|
@ -223,11 +224,14 @@ FocusScope {
|
|||
focusDebugger.height = rect.height
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: focusDebugger;
|
||||
z: 9999; visible: false; color: "red"
|
||||
ColorAnimation on color { from: "#7fffff00"; to: "#7f0000ff"; duration: 1000; loops: 9999 }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
26
interface/resources/qml/desktop/FocusHack.qml
Normal file
26
interface/resources/qml/desktop/FocusHack.qml
Normal file
|
@ -0,0 +1,26 @@
|
|||
import QtQuick 2.5
|
||||
|
||||
FocusScope {
|
||||
id: root
|
||||
|
||||
TextInput {
|
||||
id: textInput;
|
||||
focus: true
|
||||
width: 10; height: 10
|
||||
onActiveFocusChanged: root.destroy()
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: focusTimer
|
||||
running: false
|
||||
interval: 100
|
||||
onTriggered: textInput.forceActiveFocus()
|
||||
}
|
||||
|
||||
function start() {
|
||||
focusTimer.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -86,5 +86,6 @@ DISTFILES += \
|
|||
../../interface/resources/qml/menus/MenuMouseHandler.qml \
|
||||
../../interface/resources/qml/menus/VrMenuItem.qml \
|
||||
../../interface/resources/qml/menus/VrMenuView.qml \
|
||||
../../interface/resources/qml/windows/ModalWindow.qml
|
||||
../../interface/resources/qml/windows/ModalWindow.qml \
|
||||
../../interface/resources/qml/desktop/FocusHack.qml
|
||||
|
||||
|
|
Loading…
Reference in a new issue