summaryrefslogtreecommitdiffstats
path: root/qt-ui/starwidget.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-18 20:42:59 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-18 17:06:48 -0700
commitc5e7a025e4c1abcc1ad5d701991fc8f15ae82be6 (patch)
tree6c2e53fb064aecb53ddfd21296a353f86987c63b /qt-ui/starwidget.cpp
parentde50f6625746928711d7fb7f0fa579d194931970 (diff)
downloadsubsurface-c5e7a025e4c1abcc1ad5d701991fc8f15ae82be6.tar.gz
Added option to edit the selected dive.
Added option to edit the selected dive. Now the user can click on 'Edit', and a nice box will appear stating that the dive is in edit mode, and the user can edit all of the 'Notes' tab fields, including the rating. When the edition is finished, the user needs to click on 'edit' again to mark as accepted, or in reset to reset the fields to it's original state Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/starwidget.cpp')
-rw-r--r--qt-ui/starwidget.cpp11
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;
+}