# HG changeset patch # User sheepluva # Date 1350126795 -7200 # Node ID 31e4f6c1834b5523bd50d072992e2ea8164f8b20 # Parent edad8a7bcaeadae0fbc6f3a3f2542310c393df85 small tweak. (reverse mouse wheel directions for color change) diff -r edad8a7bcaea -r 31e4f6c1834b QTfrontend/ui/widget/colorwidget.cpp --- 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()); +} diff -r edad8a7bcaea -r 31e4f6c1834b QTfrontend/ui/widget/colorwidget.h --- 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