Merge pull request #6768 from jherico/vr_keys

Tweaks for supporting the new QML UI
This commit is contained in:
Andrew Meadows 2016-01-05 10:31:57 -08:00
commit 62688d5c07
10 changed files with 23 additions and 21 deletions

View file

@ -11,7 +11,7 @@
{ "from": "Standard.DR", "to": "Actions.UiNavLateral" },
{ "from": "Standard.LB", "to": "Actions.UiNavGroup","filters": "invert" },
{ "from": "Standard.RB", "to": "Actions.UiNavGroup" },
{ "from": [ "Standard.A", "Standard.X", "Standard.RT", "Standard.LT" ], "to": "Actions.UiNavSelect" },
{ "from": [ "Standard.A", "Standard.X" ], "to": "Actions.UiNavSelect" },
{ "from": [ "Standard.B", "Standard.Y", "Standard.RightPrimaryThumb", "Standard.LeftPrimaryThumb" ], "to": "Actions.UiNavBack" },
{
"from": [ "Standard.RT", "Standard.LT" ],

View file

@ -169,8 +169,10 @@ DialogContainer {
switch (event.key) {
case Qt.Key_Escape:
case Qt.Key_Back:
enabled = false
event.accepted = true
if (enabled) {
enabled = false
event.accepted = true
}
break
case Qt.Key_Enter:
case Qt.Key_Return:

View file

@ -96,6 +96,9 @@ DialogContainer {
}
Keys.onPressed: {
if (!enabled) {
return
}
switch (event.key) {
case Qt.Key_Escape:
case Qt.Key_Back:

View file

@ -343,8 +343,10 @@ DialogContainer {
switch (event.key) {
case Qt.Key_Escape:
case Qt.Key_Back:
enabled = false
event.accepted = true
if (enabled) {
enabled = false
event.accepted = true
}
break
case Qt.Key_Enter:
case Qt.Key_Return:

View file

@ -300,6 +300,10 @@ VrDialog {
Keys.onPressed: {
if (!enabled) {
return
}
if (event.modifiers === Qt.ControlModifier)
switch (event.key) {
case Qt.Key_A:

View file

@ -10,7 +10,6 @@ import "styles"
VrDialog {
id: root
objectName: "topLevelWindow"
HifiConstants { id: hifi }
title: "QmlWindow"
resizable: true
@ -43,10 +42,6 @@ VrDialog {
focus: true
property var dialog: root
onLoaded: {
forceActiveFocus()
}
Keys.onPressed: {
console.log("QmlWindow pageLoader keypress")
}

View file

@ -1,11 +1,16 @@
import Hifi 1.0
import QtQuick 2.3
import QtQuick 2.5
import QtQuick.Controls 1.4
// This is our primary 'window' object to which all dialogs and controls will
// be childed.
Root {
id: root
objectName: "desktopRoot"
anchors.fill: parent
property var rootMenu: Menu {
objectName: "rootMenu"
}
onParentChanged: {
forceActiveFocus();

View file

@ -1,9 +0,0 @@
import QtQuick 2.4
import QtQuick.Controls 1.3
Item {
Menu {
id: root
objectName: "rootMenu"
}
}

View file

@ -5,6 +5,7 @@ import "../styles"
Item {
id: root
objectName: "topLevelWindow"
HifiConstants { id: hifi }
implicitHeight: contentImplicitHeight + titleBorder.height + hifi.styles.borderWidth
implicitWidth: contentImplicitWidth + hifi.styles.borderWidth * 2

View file

@ -1177,7 +1177,6 @@ void Application::initializeUi() {
offscreenUi->setProxyWindow(_window->windowHandle());
offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));
offscreenUi->load("Root.qml");
offscreenUi->load("RootMenu.qml");
// FIXME either expose so that dialogs can set this themselves or
// do better detection in the offscreen UI of what has focus
offscreenUi->setNavigationFocused(false);