From 118dabb58bc60ae23962ae8075b867867e1edf4b Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 27 Nov 2020 17:46:46 +0100 Subject: [PATCH] Make it possible to quit the application This will call Qt.quit when the Quit application shortcut is pressed (not just visible=false). --- qml/main.qml | 7 +++++++ src/main.cpp | 1 + 2 files changed, 8 insertions(+) diff --git a/qml/main.qml b/qml/main.qml index 34638e8c0..7b7bfcc7d 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -20,6 +20,13 @@ Kirigami.ApplicationWindow { id: root property var currentRoom: null + Connections { + target: root.quitAction + function onTriggered() { + Qt.quit() + } + } + /** * Manage opening and close rooms */ diff --git a/src/main.cpp b/src/main.cpp index c047e0bd9..11d7c0e14 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -109,6 +109,7 @@ int main(int argc, char *argv[]) QQmlApplicationEngine engine; engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); KLocalizedString::setApplicationDomain("neochat"); + QObject::connect(&engine, &QQmlApplicationEngine::quit, &app, &QCoreApplication::quit); QCommandLineParser parser; parser.setApplicationDescription(i18n("Client for the matrix communication protocol"));