small tweak. (reverse mouse wheel directions for color change)
authorsheepluva
Sat, 13 Oct 2012 13:13:15 +0200
changeset 7750 31e4f6c1834b
parent 7749 edad8a7bcaea
child 7751 8c7f5c43ea5e
small tweak. (reverse mouse wheel directions for color change)
QTfrontend/ui/widget/colorwidget.cpp
QTfrontend/ui/widget/colorwidget.h
--- a/QTfrontend/ui/widget/colorwidget.cpp	Sat Oct 13 00:35:20 2012 +0400
+++ b/QTfrontend/ui/widget/colorwidget.cpp	Sat Oct 13 13:13:15 2012 +0200
@@ -56,10 +56,10 @@
     switch(event->button())
     {
         case Qt::LeftButton:
-            setColor((m_color + 1) % m_colorsModel->rowCount());
+            nextColor();
             break;
         case Qt::RightButton:
-            setColor((m_color + m_colorsModel->rowCount() - 1) % m_colorsModel->rowCount());
+            previousColor();
             break;
         default:;
     }
@@ -68,7 +68,17 @@
 void ColorWidget::wheelEvent(QWheelEvent *event)
 {
     if(event->delta() > 0)
-        setColor((m_color + 1) % m_colorsModel->rowCount());
+        previousColor();
     else
-        setColor((m_color + m_colorsModel->rowCount() - 1) % m_colorsModel->rowCount());
+        nextColor();
 }
+
+void ColorWidget::nextColor()
+{
+    setColor((m_color + 1) % m_colorsModel->rowCount());
+}
+
+void ColorWidget::previousColor()
+{
+    setColor((m_color + m_colorsModel->rowCount() - 1) % m_colorsModel->rowCount());
+}
--- a/QTfrontend/ui/widget/colorwidget.h	Sat Oct 13 00:35:20 2012 +0400
+++ b/QTfrontend/ui/widget/colorwidget.h	Sat Oct 13 13:13:15 2012 +0200
@@ -35,6 +35,8 @@
 protected:
     void mousePressEvent(QMouseEvent * event);
     void wheelEvent(QWheelEvent * event);
+    void nextColor();
+    void previousColor();
 };
 
 #endif // COLORWIDGET_H