summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-12-01 08:18:42 +0100
committerMontel Laurent <[email protected]>2017-12-01 08:18:42 +0100
commitc5f8fa660ef8bf72edc5798ba385b66232ff8ee7 (patch)
tree280c5aa7df53311414f51c14f86c468adc81b01d
parentd34a1fe8886fe65186b5b95bda2edbe566683c17 (diff)
Fix Bug 387166 - mousewheel should scroll font size in composer
FIXED-IN: 5.7.0 BUG: 387166
-rw-r--r--src/texteditor/plaintexteditor/plaintexteditor.cpp13
-rw-r--r--src/texteditor/plaintexteditor/plaintexteditor.h1
-rw-r--r--src/texteditor/richtexteditor/richtexteditor.cpp12
-rw-r--r--src/texteditor/richtexteditor/richtexteditor.h1
4 files changed, 27 insertions, 0 deletions
diff --git a/src/texteditor/plaintexteditor/plaintexteditor.cpp b/src/texteditor/plaintexteditor/plaintexteditor.cpp
index 9e7830c..a3b916b 100644
--- a/src/texteditor/plaintexteditor/plaintexteditor.cpp
+++ b/src/texteditor/plaintexteditor/plaintexteditor.cpp
@@ -630,6 +630,19 @@ bool PlainTextEditor::handleShortcut(QKeyEvent *event)
return false;
}
+void PlainTextEditor::wheelEvent(QWheelEvent *event)
+{
+ if (QApplication::keyboardModifiers() & Qt::ControlModifier) {
+ if (event->delta() > 0) {
+ zoomIn();
+ } else if (event->delta() < 0) {
+ zoomOut();
+ }
+ event->accept();
+ }
+}
+
+
void PlainTextEditor::keyPressEvent(QKeyEvent *event)
{
if (handleShortcut(event)) {
diff --git a/src/texteditor/plaintexteditor/plaintexteditor.h b/src/texteditor/plaintexteditor/plaintexteditor.h
index 6fd625b..f40dca1 100644
--- a/src/texteditor/plaintexteditor/plaintexteditor.h
+++ b/src/texteditor/plaintexteditor/plaintexteditor.h
@@ -99,6 +99,7 @@ protected:
void keyPressEvent(QKeyEvent *event) override;
bool overrideShortcut(QKeyEvent *event);
bool handleShortcut(QKeyEvent *event);
+ void wheelEvent(QWheelEvent *event) override;
virtual Sonnet::SpellCheckDecorator *createSpellCheckDecorator();
void setHighlighter(Sonnet::Highlighter *_highLighter);
diff --git a/src/texteditor/richtexteditor/richtexteditor.cpp b/src/texteditor/richtexteditor/richtexteditor.cpp
index 2aa74c2..312e9cf 100644
--- a/src/texteditor/richtexteditor/richtexteditor.cpp
+++ b/src/texteditor/richtexteditor/richtexteditor.cpp
@@ -706,6 +706,18 @@ bool RichTextEditor::event(QEvent *ev)
return QTextEdit::event(ev);
}
+void RichTextEditor::wheelEvent(QWheelEvent *event)
+{
+ if (QApplication::keyboardModifiers() & Qt::ControlModifier) {
+ if (event->delta() > 0) {
+ zoomIn();
+ } else if (event->delta() < 0) {
+ zoomOut();
+ }
+ event->accept();
+ }
+}
+
bool RichTextEditor::handleShortcut(QKeyEvent *event)
{
const int key = event->key() | event->modifiers();
diff --git a/src/texteditor/richtexteditor/richtexteditor.h b/src/texteditor/richtexteditor/richtexteditor.h
index c72a07d..43b33d5 100644
--- a/src/texteditor/richtexteditor/richtexteditor.h
+++ b/src/texteditor/richtexteditor/richtexteditor.h
@@ -108,6 +108,7 @@ protected:
void focusInEvent(QFocusEvent *event) override;
bool event(QEvent *ev) override;
void keyPressEvent(QKeyEvent *event) override;
+ void wheelEvent(QWheelEvent *e) override;
QMenu *mousePopupMenu(QPoint pos);
virtual Sonnet::SpellCheckDecorator *createSpellCheckDecorator();