changeset 25985:49ffd0e0242d

enable resetting doc browser zoom level even when zooming with mouse wheel * documentation.cc (documentation_browser::wheelEvent): reimplement mouse wheel event and, in case of active control modifier, call own zooming function which are keeping track of the zoom level * documentation.h: new protected method for reimplemented wheel event
author Torsten <mttl@mailbox.org>
date Tue, 30 Oct 2018 22:50:40 +0100
parents a807865bd78b
children 07d14d092d77
files libgui/src/documentation.cc libgui/src/documentation.h
diffstat 2 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/documentation.cc	Tue Oct 30 14:34:57 2018 -0700
+++ b/libgui/src/documentation.cc	Tue Oct 30 22:50:40 2018 +0100
@@ -614,4 +614,20 @@
     zoomIn (- m_zoom_level);
     m_zoom_level = 0;
   }
-}
+
+  void documentation_browser::wheelEvent (QWheelEvent *we)
+  {
+    if (we->modifiers () == Qt::ControlModifier)
+      {
+        if (we->delta () > 0)
+          zoom_in ();
+        else
+          zoom_out ();
+
+        we->accept ();
+      }
+    else
+      QTextEdit::wheelEvent (we);
+  }
+
+}
\ No newline at end of file
--- a/libgui/src/documentation.h	Tue Oct 30 14:34:57 2018 -0700
+++ b/libgui/src/documentation.h	Tue Oct 30 22:50:40 2018 +0100
@@ -59,6 +59,10 @@
     void zoom_normal (void);
     //!@}
 
+  protected:
+
+     void wheelEvent (QWheelEvent *we);
+
   private:
 
     QHelpEngine *m_help_engine;