mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cartesian Axis, based on the Ruler class on the Dive Planner.
This is the same class as the Ruler, but uses the DiveLineItem and DiveTextItem classes created to make it animateable. The next few commits will work on that part. The Ruler was a very bad name for a class that's actually an Axis, that's why I depreceated the later. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ca07f45561
commit
49f4052c67
3 changed files with 210 additions and 2 deletions
46
qt-ui/profile/divecartesianaxis.h
Normal file
46
qt-ui/profile/divecartesianaxis.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
#ifndef DIVECARTESIANAXIS_H
|
||||
#define DIVECARTESIANAXIS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QGraphicsLineItem>
|
||||
class DiveTextItem;
|
||||
class DiveLineItem;
|
||||
|
||||
class DiveCartesianAxis : public QObject, public QGraphicsLineItem{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QLineF line WRITE setLine READ line)
|
||||
Q_PROPERTY(QPointF pos WRITE setPos READ pos)
|
||||
Q_PROPERTY(qreal x WRITE setX READ x)
|
||||
Q_PROPERTY(qreal y WRITE setY READ y)
|
||||
public:
|
||||
DiveCartesianAxis();
|
||||
virtual ~DiveCartesianAxis();
|
||||
void setMinimum(double minimum);
|
||||
void setMaximum(double maximum);
|
||||
void setTickInterval(double interval);
|
||||
void setOrientation(Qt::Orientation orientation);
|
||||
void setTickSize(qreal size);
|
||||
void updateTicks();
|
||||
double minimum() const;
|
||||
double maximum() const;
|
||||
qreal valueAt(const QPointF& p);
|
||||
qreal percentAt(const QPointF& p);
|
||||
qreal posAtValue(qreal value);
|
||||
void setColor(const QColor& color);
|
||||
void setTextColor(const QColor& color);
|
||||
int unitSystem;
|
||||
|
||||
protected:
|
||||
virtual QString textForValue(double value);
|
||||
|
||||
Qt::Orientation orientation;
|
||||
QList<DiveLineItem*> ticks;
|
||||
QList<DiveTextItem*> labels;
|
||||
double min;
|
||||
double max;
|
||||
double interval;
|
||||
double tickSize;
|
||||
QColor textColor;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue