[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [lokalize] src: Allow Ctrl+Wheel to zoom in/out on the target text
From:       Simon Depiets <null () kde ! org>
Date:       2018-07-21 23:25:13
Message-ID: E1fh1FR-0006hw-CM () code ! kde ! org
[Download RAW message or body]

Git commit 7d01f616f4c1a0f5c22f30ab7de6aacd03f2f11f by Simon Depiets.
Committed on 21/07/2018 at 22:14.
Pushed by sdepiets into branch 'master'.

Allow Ctrl+Wheel to zoom in/out on the target text

Summary:
Allow Ctrl+Wheel to zoom in and out of the target text (change its font size) when \
the wheel navigation is disabled. This makes the target field more consistent with \
the source field. By default the QTextEdit Qt component allows Ctrl+Wheel zooming \
only for read only fields.

https://bugs.kde.org/show_bug.cgi?id=375251

Reviewers: #localization, aacid, ltoscano, shaforostoff, mlaurent

Reviewed By: #localization, aacid

Subscribers: safaalfulaij

Tags: #localization

Differential Revision: https://phabricator.kde.org/D14151

M  +8    -0    src/xlifftextedit.cpp

https://commits.kde.org/lokalize/7d01f616f4c1a0f5c22f30ab7de6aacd03f2f11f

diff --git a/src/xlifftextedit.cpp b/src/xlifftextedit.cpp
index 4d14355..5e3b4c1 100644
--- a/src/xlifftextedit.cpp
+++ b/src/xlifftextedit.cpp
@@ -1083,6 +1083,14 @@ void \
TranslationUnitTextEdit::contextMenuEvent(QContextMenuEvent *event)  
 void TranslationUnitTextEdit::wheelEvent(QWheelEvent *event)
 {
+    //Override default KTextEdit behavior which ignores Ctrl+wheelEvent when the \
field is not ReadOnly (i/o zooming) +    if (m_part==DocPosition::Target && \
!Settings::mouseWheelGo() && (event->modifiers() == Qt::ControlModifier)) +    {
+        float delta=event->angleDelta().y() / 120.f;
+        zoomInF(delta);
+        return;
+    }
+
     if (m_part==DocPosition::Source || !Settings::mouseWheelGo())
         return KTextEdit::wheelEvent(event);
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic