summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Preferences.cc14
-rw-r--r--Preferences.h2
-rw-r--r--mainwin.cc2
3 files changed, 18 insertions, 0 deletions
diff --git a/Preferences.cc b/Preferences.cc
index a18e122..2634c0b 100644
--- a/Preferences.cc
+++ b/Preferences.cc
@@ -21,6 +21,7 @@
#include "Preferences.h"
#include <QFontDatabase>
+#include <QKeyEvent>
Preferences *Preferences::instance = NULL;
@@ -131,3 +132,16 @@ void Preferences::fontSizeChanged(const QString &size)
this->fontsize = size.toUInt();
emit fontChanged(this->fontfamily, this->fontsize);
}
+
+void Preferences::keyPressEvent(QKeyEvent *e)
+{
+#ifdef Q_WS_MAC
+ if (e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Period) {
+ close();
+ } else
+#endif
+ if (e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_W ||
+ e->key() == Qt::Key_Escape) {
+ close();
+ }
+}
diff --git a/Preferences.h b/Preferences.h
index 5bfb3be..24b734e 100644
--- a/Preferences.h
+++ b/Preferences.h
@@ -38,6 +38,8 @@ signals:
private:
Preferences(QWidget *parent = NULL);
+ void keyPressEvent(QKeyEvent *e);
+
QHash<QString, QMap<RenderColor, QColor> > colorschemes;
QString colorscheme;
QString fontfamily;
diff --git a/mainwin.cc b/mainwin.cc
index 4299c50..09b5c5e 100644
--- a/mainwin.cc
+++ b/mainwin.cc
@@ -1753,6 +1753,8 @@ void
MainWindow::preferences()
{
Preferences::inst()->show();
+ Preferences::inst()->activateWindow();
+ Preferences::inst()->raise();
}
void MainWindow::setFont(const QString &family, uint size)
contact: Jan Huwald // Impressum