From 939246acda95807bca2ed5ce536a0aae2ea8586c Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 10 Jun 2013 19:02:06 -0300 Subject: Added a simple "TextEditor" in the graph, for a plan mode. Added a simple TextEditor in the graph for the 'Dive Plan' mode, this text editor is very simple, so the user can double click on 'depth' or 'duration' to set the depth or duration of the dive. Since this was a test, only 'duration' was done, and I'll add duration on the next commit. Signed-off-by: Tomaz Canabrava --- qt-ui/profilegraphics.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'qt-ui/profilegraphics.h') diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h index a4d943233..c0326ccfa 100644 --- a/qt-ui/profilegraphics.h +++ b/qt-ui/profilegraphics.h @@ -5,6 +5,9 @@ #include #include #include +#include +#include +#include struct text_render_options; struct graphics_context; @@ -64,6 +67,20 @@ private: QIcon icon; }; +class GraphicsTextEditor : public QGraphicsTextItem{ + Q_OBJECT +public: + GraphicsTextEditor(QGraphicsItem* parent = 0); + +protected: + virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event); + virtual void keyReleaseEvent(QKeyEvent* event); + +signals: + void textChanged(const QString& text); + void editingFinished(const QString& text); +}; + class ProfileGraphicsView : public QGraphicsView { Q_OBJECT @@ -120,6 +137,10 @@ private: QGraphicsItem* depthMarkers; QGraphicsItem* diveComputer; + // For 'Plan' mode.: + GraphicsTextEditor *depthEditor; + GraphicsTextEditor *timeEditor; + enum Mode mode; }; -- cgit v1.2.3-70-g09d2