summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/diveprofileitem.h
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2014-01-16 16:21:23 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-17 06:18:00 +0700
commit254beef5d4c0ead123556ffbc5e37dd2cc81366e (patch)
treeafd1a1babb9d3cbd727993c9c21d5508e4c61461 /qt-ui/profile/diveprofileitem.h
parent1f8078828663f6bfff768cbc2fb36e6643eb3d0e (diff)
downloadsubsurface-254beef5d4c0ead123556ffbc5e37dd2cc81366e.tar.gz
Transform the DiveProfileItem to an Abstract Generalization
The DiveProfileItem contained much of the complexity and algorithms for almost all line-based items on the canvas, so I transformed that to a general abstraction and implemented a new DiveProfileItem that uses it. this should reduce a bit of code since the implementation of the PP Graphs, Temperature Cylinder Pressure and maybe a few others will only need to reimplement the paint() and the modelDataChanged() methods. The rest is ready. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/diveprofileitem.h')
-rw-r--r--qt-ui/profile/diveprofileitem.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/qt-ui/profile/diveprofileitem.h b/qt-ui/profile/diveprofileitem.h
index 1e8c0b296..171dec053 100644
--- a/qt-ui/profile/diveprofileitem.h
+++ b/qt-ui/profile/diveprofileitem.h
@@ -21,22 +21,22 @@
class DiveCartesianAxis;
class QAbstractTableModel;
-class DiveProfileItem : public QObject, public QGraphicsPolygonItem{
+class AbstractProfilePolygonItem : public QObject, public QGraphicsPolygonItem{
Q_OBJECT
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:
- DiveProfileItem();
+ AbstractProfilePolygonItem();
void setVerticalAxis(DiveCartesianAxis *vertical);
void setHorizontalAxis(DiveCartesianAxis *horizontal);
void setModel(QAbstractTableModel *model);
void setHorizontalDataColumn(int column);
void setVerticalDataColumn(int column);
- virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+ virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) = 0;
public slots:
- void modelDataChanged();
-private:
+ virtual void modelDataChanged();
+protected:
DiveCartesianAxis *hAxis;
DiveCartesianAxis *vAxis;
QAbstractTableModel *dataModel;
@@ -44,5 +44,11 @@ private:
int vDataColumn;
};
+class DiveProfileItem : public AbstractProfilePolygonItem{
+ Q_OBJECT
+public:
+ virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+ virtual void modelDataChanged();
+};
#endif \ No newline at end of file