From bfe7ab4d9431c53d67a62fa3963d7c209a593cb8 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Wed, 30 Dec 2015 11:39:34 -0800 Subject: [PATCH] Allow QML windows to quit the application --- interface/src/Application.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 5ad12102f7..7c789992dd 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -28,11 +28,13 @@ #include #include #include -#include #include #include #include +#include +#include + #include #include #include @@ -1094,8 +1096,13 @@ void Application::initializeUi() { offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/")); offscreenUi->load("Root.qml"); offscreenUi->load("RootMenu.qml"); + auto rootContext = offscreenUi->getRootContext(); + auto engine = rootContext->engine(); + connect(engine, &QQmlEngine::quit, [] { + qApp->quit(); + }); rootContext->setContextProperty("Audio", &AudioScriptingInterface::getInstance()); rootContext->setContextProperty("AnimationCache", DependencyManager::get().data()); rootContext->setContextProperty("Controller", DependencyManager::get().data());