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>
This commit is contained in:
Tomaz Canabrava 2013-05-18 20:42:59 -03:00 committed by Dirk Hohndel
parent de50f66257
commit c5e7a025e4
5 changed files with 243 additions and 29 deletions

View file

@ -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;
}