summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2014-04-25 07:37:47 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-04-25 07:20:33 -0700
commitfcaf30081f5b1e6f4ae547af78270c8a251ad844 (patch)
treeda8f33228f8b9de979f5c880a83c3a0dd993ab7f
parent126106f9b05afb26b339c194f353a726d131cd41 (diff)
downloadsubsurface-4.0.96.tar.gz
Close yearly statistics with shortcutv4.0.96
This enables closing the yearly statistics window with esc or ctrl+w keys. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/mainwindow.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 2d3388d9e..003f924cd 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -19,6 +19,7 @@
#include <QDesktopServices>
#include <QStringList>
#include <QSettings>
+#include <QShortcut>
#include "divelistview.h"
#include "starwidget.h"
@@ -437,6 +438,10 @@ void MainWindow::on_actionYearlyStatistics_triggered()
yearlyStats->setMinimumWidth(600);
yearlyStats->setWindowTitle(tr("Yearly Statistics"));
yearlyStats->setWindowIcon(QIcon(":subsurface-icon"));
+ QShortcut* closeKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), yearlyStats);
+ connect(closeKey, SIGNAL(activated()), yearlyStats, SLOT(close()));
+ closeKey = new QShortcut(QKeySequence(Qt::Key_Escape), yearlyStats);
+ connect(closeKey, SIGNAL(activated()), yearlyStats, SLOT(close()));
}
/* problem here is that without more MainWindow variables or a separate YearlyStatistics
* class the user needs to close the window/widget and re-open it for it to update.