summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2017-02-20 16:23:59 (GMT)
committerTobias Markmann <tm@ayena.de>2017-02-20 16:24:36 (GMT)
commitf4246a23eb76cb09c1a603d54891f80ec1e54eb5 (patch)
treeb97ab65b1b07efac07b5a2ece4e9529400ee2852 /Swift
parent9fe83ff62fb48662df7920afc0be71d04dafe3e4 (diff)
downloadswift-f4246a23eb76cb09c1a603d54891f80ec1e54eb5.zip
swift-f4246a23eb76cb09c1a603d54891f80ec1e54eb5.tar.bz2
Add alternative zoom shortcuts on macOS and workaround Qt bug
This adds the Ctrl + Minus and Ctrl + Equal shortcuts for zoom out and zoom in respectively. In addition, this commit provides a workaround for QTBUG-56571. Test-Information: Tested on macOS 10.12.3 with Qt 5.7.1. Tested with German and UK keyboard layout. On UK layout both shortcuts, Ctrl + (+/-) and Ctrl + (=/-) work. On German layout only Ctrl + (+/-) works. Change-Id: Ifbcab308c9a8f4c88b51978969c73c3c1138a9ba
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/QtTextEdit.cpp6
-rw-r--r--Swift/QtUI/QtWebView.cpp6
2 files changed, 8 insertions, 4 deletions
diff --git a/Swift/QtUI/QtTextEdit.cpp b/Swift/QtUI/QtTextEdit.cpp
index e9708bf..1b4d76d 100644
--- a/Swift/QtUI/QtTextEdit.cpp
+++ b/Swift/QtUI/QtTextEdit.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -59,6 +59,10 @@ void QtTextEdit::keyPressEvent(QKeyEvent* event) {
|| (key == Qt::Key_Tab && modifiers == Qt::ControlModifier)
|| (key == Qt::Key_A && modifiers == Qt::AltModifier)
|| (key == Qt::Key_Tab)
+#ifdef SWIFTEN_PLATFORM_MACOSX
+ || (key == Qt::Key_Minus && (modifiers & Qt::ControlModifier))
+ || (key == Qt::Key_Equal && (modifiers & Qt::ControlModifier))
+#endif
|| (event->matches(QKeySequence::ZoomIn))
|| (event->matches(QKeySequence::ZoomOut))
) {
diff --git a/Swift/QtUI/QtWebView.cpp b/Swift/QtUI/QtWebView.cpp
index abdc17a..967be1a 100644
--- a/Swift/QtUI/QtWebView.cpp
+++ b/Swift/QtUI/QtWebView.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -30,12 +30,12 @@ QtWebView::QtWebView(QWidget* parent) : QWebView(parent), fontSizeIsMinimal(fals
void QtWebView::keyPressEvent(QKeyEvent* event) {
Qt::KeyboardModifiers modifiers = event->modifiers();
int key = event->key();
- if (event->matches(QKeySequence::ZoomIn)) {
+ if (event->matches(QKeySequence::ZoomIn) || (key == Qt::Key_Equal && (modifiers & Qt::ControlModifier))) {
event->accept();
emit fontGrowRequested();
return;
}
- if (event->matches(QKeySequence::ZoomOut)) {
+ if (event->matches(QKeySequence::ZoomOut) || (key == Qt::Key_Minus && (modifiers & Qt::ControlModifier))) {
event->accept();
emit fontShrinkRequested();
return;