diff widgets/Thumbwheel.cpp @ 1303:13f5f84fbfad

Collect the bits of bookkeeping for mouse wheel events, and use in all widgets
author Chris Cannam
date Fri, 22 Jun 2018 17:19:48 +0100
parents a34a2a25907c
children c8a6fd3f9dff
line wrap: on
line diff
--- a/widgets/Thumbwheel.cpp	Fri Jun 22 13:41:54 2018 +0100
+++ b/widgets/Thumbwheel.cpp	Fri Jun 22 17:19:48 2018 +0100
@@ -426,15 +426,13 @@
 void
 Thumbwheel::wheelEvent(QWheelEvent *e)
 {
-    int step = int(lrintf(m_speed));
-    if (step == 0) step = 1;
+    int delta = m_wheelCounter.count(e);
 
-    if (e->delta() > 0) {
-        setValue(m_value + step);
-    } else {
-        setValue(m_value - step);
+    if (delta == 0) {
+        return;
     }
-    
+
+    setValue(m_value + delta);
     emit valueChanged(getValue());
 }