summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-20 15:52:27 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-20 15:52:27 -0300
commit636550d413093bee27e86b26c1a4ae408e89a8cd (patch)
tree4cde7afcb12bea502f29c1433b5d2d6038f5a274 /qt-ui
parent52a0e6c82d60076361fd0a3de7d2417c3fbc2e99 (diff)
downloadsubsurface-636550d413093bee27e86b26c1a4ae408e89a8cd.tar.gz
Added the skeleton for the Ruler Item,
The ruler will deliver the Time and the Depth, later. it should be vertical or horizontal, and will have ticks Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.cpp39
-rw-r--r--qt-ui/diveplanner.h21
2 files changed, 60 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 9fead0191..eee6e8f13 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -189,3 +189,42 @@ void DivePlanner::mouseReleaseEvent(QMouseEvent* event)
DiveHandler::DiveHandler(): QGraphicsEllipseItem(), from(0), to(0)
{
}
+
+void Ruler::setMaximum(double maximum)
+{
+ qDeleteAll(ticks);
+ max = maximum;
+ updateTicks();
+}
+
+void Ruler::setMinimum(double minimum)
+{
+ qDeleteAll(ticks);
+ min = minimum;
+ updateTicks();
+}
+
+Ruler::Ruler() : orientation(Qt::Horizontal)
+{
+}
+
+void Ruler::setOrientation(Qt::Orientation o)
+{
+ orientation = o;
+ updateTicks();
+}
+
+void Ruler::updateTicks()
+{
+
+}
+
+void Ruler::setLine(qreal x1, qreal y1, qreal x2, qreal y2)
+{
+
+}
+
+void Ruler::setTickInterval(double interval)
+{
+
+}
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index 48f254bcd..13218e4ae 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -11,6 +11,27 @@ public:
QGraphicsLineItem *from;
QGraphicsLineItem *to;
};
+
+class Ruler : public QGraphicsItem{
+public:
+ Ruler();
+ void setMinimum(double minimum);
+ void setMaximum(double maximum);
+ void setTickInterval(double interval);
+ void setOrientation(Qt::Orientation orientation);
+ void setLine(qreal x1, qreal y1, qreal x2, qreal y2);
+
+private:
+ void updateTicks();
+ Qt::Orientation orientation;
+ QList<QGraphicsLineItem*> ticks;
+ double min;
+ double max;
+
+ double posBegin;
+ double posEnd;
+};
+
class DivePlanner : public QGraphicsView {
Q_OBJECT
public: