QTfrontend/ui/widget/itemNum.cpp
changeset 6153 3881126e06e8
parent 6060 fdfc01419815
child 6428 2d2b5e3c59a7
--- a/QTfrontend/ui/widget/itemNum.cpp	Wed Oct 19 21:14:21 2011 +0200
+++ b/QTfrontend/ui/widget/itemNum.cpp	Wed Oct 19 21:55:42 2011 +0200
@@ -60,6 +60,34 @@
   }
   repaint();
 }
+void ItemNum::wheelEvent ( QWheelEvent * event )
+{
+    if (nonInteractive) return;
+    if (!enabled)
+    {
+        event->ignore();
+        return;
+    }
+    event->accept();
+
+    bool up = (event->delta() > 0); // positive delta is up, negative is down
+
+    // negative delta on horizontal wheel is not left, but right
+    if (event->orientation() == Qt::Horizontal)
+        up = !up;
+
+    if(up)
+    {
+        if((infinityState && numItems <= maxItems) || (!infinityState && numItems < maxItems))
+            incItems();
+    }
+    else
+    {
+        if(numItems > minItems)
+            decItems();
+    }
+  repaint();
+}
 
 QSize ItemNum::sizeHint () const
 {