Make it easier for QML dialogs to access the global menu, manipulate the overlay desktop

This commit is contained in:
Brad Davis 2016-01-04 17:26:46 -08:00
parent 41dcc3d52b
commit e6b59cb0a1
2 changed files with 16 additions and 12 deletions

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

@ -1173,7 +1173,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);
@ -2033,16 +2032,16 @@ void Application::keyPressEvent(QKeyEvent* event) {
break;
}
case Qt::Key_Escape: {
getActiveDisplayPlugin()->abandonCalibration();
if (!event->isAutoRepeat()) {
// this starts the HFCancelEvent
HFBackEvent startBackEvent(HFBackEvent::startType());
sendEvent(this, &startBackEvent);
}
break;
}
// case Qt::Key_Escape: {
// getActiveDisplayPlugin()->abandonCalibration();
// if (!event->isAutoRepeat()) {
// // this starts the HFCancelEvent
// HFBackEvent startBackEvent(HFBackEvent::startType());
// sendEvent(this, &startBackEvent);
// }
//
// break;
// }
default:
event->ignore();