summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Chereau <guillaume@noctua-software.com>2015-08-18 19:14:52 +0800
committerGuillaume Chereau <guillaume@noctua-software.com>2015-08-18 19:14:52 +0800
commit9b368d965b7e6472e0b1de4d58181d488015d02e (patch)
tree76bbdc1617b336ea2f1354c919d4a2b2cbee04b7
parent1bc8d546b7806aee5ee5c8c005edb6cf56a4c375 (diff)
qml: add quit buttonqml
There is a bug. When we quit the application is destroyed before the gui, resulting in a lot of warning messages.
-rw-r--r--src/core/StelGui.cpp8
-rw-r--r--src/core/StelGui.hpp3
2 files changed, 11 insertions, 0 deletions
diff --git a/src/core/StelGui.cpp b/src/core/StelGui.cpp
index 85f486b5a7..220cc8fd19 100644
--- a/src/core/StelGui.cpp
+++ b/src/core/StelGui.cpp
@@ -102,6 +102,7 @@ StelGui::StelGui():
StelActionMgr *actionMgr = StelApp::getInstance().getStelActionManager();
actionMgr->addAction("actionAutoHideHorizontalButtonBar", miscGroup, N_("Auto hide horizontal button bar"), this, "autoHideHorizontalButtonBar");
actionMgr->addAction("actionAutoHideVerticalButtonBar", miscGroup, N_("Auto hide vertical button bar"), this, "autoHideVerticalButtonBar");
+ actionMgr->addAction("actionQuit_Global", miscGroup, N_("Quit"), this, "quit()", "Ctrl+Q", "Ctrl+X");
// Register all default buttons.
// Maybe this should be done in the different modules directly.
@@ -190,6 +191,8 @@ StelGui::StelGui():
"actionIncrease_Time_Speed",
"070-timeGroup");
+ addButton("qrc:///graphicGui/btQuit.png", NULL, "actionQuit_Global", "080-quitGroup");
+
// Add all the windows bar actions and buttons.
// actionMgr->addAction("actionAutoHideHorizontalButtonBar", miscGroup, N_("Auto hide horizontal button bar"), this, "autoHideHorizontalButtonBar");
// actionMgr->addAction("actionAutoHideVerticalButtonBar", miscGroup, N_("Auto hide vertical button bar"), this, "autoHideVerticalButtonBar");
@@ -323,3 +326,8 @@ double StelGui::jdFromDate(int Y, int M, int D, int h, int m, int s) const
jd -= (StelApp::getInstance().getLocaleMgr().getGMTShift(jd)/24.0); // local tz -> UTC
return jd;
}
+
+void StelGui::quit()
+{
+ StelApp::getInstance().quit();
+}
diff --git a/src/core/StelGui.hpp b/src/core/StelGui.hpp
index 734c17d5d1..86b0dedb54 100644
--- a/src/core/StelGui.hpp
+++ b/src/core/StelGui.hpp
@@ -96,6 +96,9 @@ public:
Q_INVOKABLE QVariantList jdToDate(double jd) const;
Q_INVOKABLE double jdFromDate(int Y, int M, int D, int h, int m, int s) const;
+private slots:
+ void quit();
+
private:
QVariantList buttons;
bool autoHideHorizontalButtonBar;