Added the Ok / Cancel buttons on the dive planner canvas.

Added the ok / cancel buttons on the dive planner canvas.
I still need to hook the esc button to cancel it too, but
since I removed the 'floating dialog' option and merged it
into the mainwindow, it's necessary.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-06-27 16:45:58 -03:00
parent 1244438b01
commit c7c5ca7c3e
2 changed files with 71 additions and 4 deletions

View file

@ -5,14 +5,20 @@
#include <QGraphicsPathItem>
#include <QDialog>
class Button : public QObject, public QGraphicsPixmapItem {
class Button : public QObject, public QGraphicsRectItem {
Q_OBJECT
public:
explicit Button(QObject* parent = 0);
void setText(const QString& text);
void setPixmap(const QPixmap& pixmap);
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent* event);
signals:
void clicked();
private:
QGraphicsPixmapItem *icon;
QGraphicsSimpleTextItem *text;
};
class DiveHandler : public QGraphicsEllipseItem{
@ -66,6 +72,8 @@ protected:
private slots:
void increaseTime();
void increaseDepth();
void okClicked();
void cancelClicked();
private:
@ -86,7 +94,8 @@ private:
Button *plusDepth;
Button *lessTime;
Button *lessDepth;
Button *okBtn;
Button *cancelBtn;
QPointF lastValidPos;
};