diff options
Diffstat (limited to 'qt-ui/starwidget.cpp')
-rw-r--r-- | qt-ui/starwidget.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/qt-ui/starwidget.cpp b/qt-ui/starwidget.cpp index 4d1fa066c..c43ad1111 100644 --- a/qt-ui/starwidget.cpp +++ b/qt-ui/starwidget.cpp @@ -4,6 +4,7 @@ #include <QPaintEvent> #include <QDebug> #include <QMouseEvent> +#include <unistd.h> QPixmap* StarWidget::activeStar = 0; QPixmap* StarWidget::inactiveStar = 0; @@ -25,6 +26,10 @@ int StarWidget::currentStars() const void StarWidget::mouseReleaseEvent(QMouseEvent* event) { + if (readOnly){ + return; + } + int starClicked = event->pos().x() / IMG_SIZE + 1; if (starClicked > TOTALSTARS) starClicked = TOTALSTARS; @@ -34,6 +39,7 @@ void StarWidget::mouseReleaseEvent(QMouseEvent* event) else current = starClicked; + Q_EMIT valueChanged(current); update(); } @@ -98,3 +104,8 @@ QSize StarWidget::sizeHint() const { return QSize(IMG_SIZE * TOTALSTARS + SPACING * (TOTALSTARS-1), IMG_SIZE); } + +void StarWidget::setReadOnly(bool r) +{ + readOnly = r; +} |