mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
60 lines
1.4 KiB
C++
60 lines
1.4 KiB
C++
#ifndef DIVEPLANNER_H
|
|
#define DIVEPLANNER_H
|
|
|
|
#include <QGraphicsView>
|
|
#include <QGraphicsPathItem>
|
|
|
|
class DiveHandler : public QGraphicsEllipseItem{
|
|
public:
|
|
DiveHandler();
|
|
|
|
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:
|
|
static DivePlanner *instance();
|
|
protected:
|
|
virtual void mouseDoubleClickEvent(QMouseEvent* event);
|
|
virtual void showEvent(QShowEvent* event);
|
|
virtual void resizeEvent(QResizeEvent* event);
|
|
virtual void mouseMoveEvent(QMouseEvent* event);
|
|
virtual void mousePressEvent(QMouseEvent* event);
|
|
virtual void mouseReleaseEvent(QMouseEvent* event);
|
|
|
|
void clear_generated_deco();
|
|
void create_deco_stop();
|
|
bool isPointOutOfBoundaries(QPointF point);
|
|
|
|
private:
|
|
DivePlanner(QWidget* parent = 0);
|
|
void moveActiveHandler(QPointF pos);
|
|
QList<QGraphicsLineItem*> lines;
|
|
QList<DiveHandler *> handles;
|
|
QGraphicsLineItem *verticalLine;
|
|
QGraphicsLineItem *horizontalLine;
|
|
DiveHandler *activeDraggedHandler;
|
|
};
|
|
#endif
|