summaryrefslogtreecommitdiffstats
path: root/qt-ui/profilegraphics.h
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/profilegraphics.h')
-rw-r--r--qt-ui/profilegraphics.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h
index 0bcbf7529..deb729023 100644
--- a/qt-ui/profilegraphics.h
+++ b/qt-ui/profilegraphics.h
@@ -57,6 +57,49 @@ private:
QRectF nextRectangle;
};
+class RulerItem;
+
+class RulerNodeItem : public QObject, public QGraphicsEllipseItem
+{
+ Q_OBJECT
+ friend class RulerItem;
+public:
+ explicit RulerNodeItem(QGraphicsItem* parent, graphics_context gc);
+ void setRuler(RulerItem *r);
+ void recalculate();
+
+protected:
+ QVariant itemChange(GraphicsItemChange change, const QVariant & value );
+
+private:
+ graphics_context gc;
+ struct plot_data *entry;
+ RulerItem* ruler;
+};
+
+class RulerItem : public QGraphicsObject
+{
+ Q_OBJECT
+public:
+ explicit RulerItem(QGraphicsItem* parent,
+ RulerNodeItem *sourceMarker,
+ RulerNodeItem *destMarker);
+ void recalculate();
+
+ RulerNodeItem* sourceNode() const;
+ RulerNodeItem* destNode() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget * widget = 0);
+ QRectF boundingRect() const;
+ QPainterPath shape() const;
+
+private:
+ QPointF startPoint, endPoint;
+ RulerNodeItem *source, *dest;
+ QString text;
+ int height;
+ int paint_direction;
+};
+
class EventItem : public QGraphicsPolygonItem
{
public:
@@ -128,6 +171,10 @@ private:
void plot_pp_text();
void plot_depth_scale();
+ void create_ruler();
+ void add_ruler();
+ void remove_ruler();
+
QColor getColor(const color_indice_t i);
QColor get_sac_color(int sac, int avg_sac);
void scrollViewTo(const QPoint pos);
@@ -139,6 +186,8 @@ private:
struct dive *dive;
struct divecomputer *diveDC;
int zoomLevel;
+
+ bool rulerEnabled;
bool printMode;
bool isGrayscale;
@@ -147,6 +196,7 @@ private:
QGraphicsItem* timeMarkers;
QGraphicsItem* depthMarkers;
QGraphicsItem* diveComputer;
+ RulerItem *rulerItem;
// For 'Plan' mode.:
GraphicsTextEditor *depthEditor;