--- a/QTfrontend/ui/widget/SmartLineEdit.h Wed Oct 19 21:14:21 2011 +0200
+++ b/QTfrontend/ui/widget/SmartLineEdit.h Wed Oct 19 21:55:42 2011 +0200
@@ -17,8 +17,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
-#ifndef HEDGEWARS_SMARTLINEEDIT
-#define HEDGEWARS_SMARTLINEEDIT
+#ifndef HEDGEWARS_SMARTLINEEDIT_H
+#define HEDGEWARS_SMARTLINEEDIT_H
#include <QStringList>
@@ -132,4 +132,4 @@
-#endif // HEDGEWARS_SMARTLINEEDIT
+#endif // HEDGEWARS_SMARTLINEEDIT_H
--- 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
{
--- a/QTfrontend/ui/widget/itemNum.h Wed Oct 19 21:14:21 2011 +0200
+++ b/QTfrontend/ui/widget/itemNum.h Wed Oct 19 21:55:42 2011 +0200
@@ -50,6 +50,7 @@
// from QWidget
virtual void mousePressEvent ( QMouseEvent * event );
+ virtual void wheelEvent ( QWheelEvent * event );
virtual void paintEvent(QPaintEvent* event);
// to be implemented in child