summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/QtTextEdit.cpp3
-rw-r--r--Swift/QtUI/QtWebView.cpp14
2 files changed, 16 insertions, 1 deletions
diff --git a/Swift/QtUI/QtTextEdit.cpp b/Swift/QtUI/QtTextEdit.cpp
index 3143192..4ffd32a 100644
--- a/Swift/QtUI/QtTextEdit.cpp
+++ b/Swift/QtUI/QtTextEdit.cpp
@@ -12,6 +12,7 @@
#include <QApplication>
#include <QKeyEvent>
+#include <QKeySequence>
#include <QMenu>
#include <QTextDocument>
@@ -60,6 +61,8 @@ void QtTextEdit::keyPressEvent(QKeyEvent* event) {
|| (key == Qt::Key_Tab && modifiers == Qt::ControlModifier)
|| (key == Qt::Key_A && modifiers == Qt::AltModifier)
|| (key == Qt::Key_Tab)
+ || (event->matches(QKeySequence::ZoomIn))
+ || (event->matches(QKeySequence::ZoomOut))
) {
emit unhandledKeyPressEvent(event);
}
diff --git a/Swift/QtUI/QtWebView.cpp b/Swift/QtUI/QtWebView.cpp
index b8eb7a5..abdc17a 100644
--- a/Swift/QtUI/QtWebView.cpp
+++ b/Swift/QtUI/QtWebView.cpp
@@ -11,6 +11,7 @@
#include <QFocusEvent>
#include <QKeyEvent>
+#include <QKeySequence>
#include <QMenu>
#include <Swiften/Base/Log.h>
@@ -29,6 +30,16 @@ 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)) {
+ event->accept();
+ emit fontGrowRequested();
+ return;
+ }
+ if (event->matches(QKeySequence::ZoomOut)) {
+ event->accept();
+ emit fontShrinkRequested();
+ return;
+ }
if (modifiers == Qt::ShiftModifier && (key == Qt::Key_PageUp || key == Qt::Key_PageDown)) {
modifiers = Qt::NoModifier;
}
@@ -70,8 +81,9 @@ void QtWebView::contextMenuEvent(QContextMenuEvent* ev) {
// Add our own custom actions
menu->addAction(tr("Clear"), this, SIGNAL(clearRequested()));
- menu->addAction(tr("Increase font size"), this, SIGNAL(fontGrowRequested()));
+ menu->addAction(tr("Increase font size"), this, SIGNAL(fontGrowRequested()), QKeySequence(QKeySequence::ZoomIn));
QAction* shrink = new QAction(tr("Decrease font size"), this);
+ shrink->setShortcut(QKeySequence(QKeySequence::ZoomOut));
shrink->setEnabled(!fontSizeIsMinimal);
connect(shrink, SIGNAL(triggered()), this, SIGNAL(fontShrinkRequested()));
menu->addAction(shrink);