mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Started the code for a grid that knows how to handle itself.
The code for this item is a bit too big to be just the grid of the dives and I know that, don't bully me. :) The main idea of this grid is that it knows when it should be updated. this is a bit different than the old code where all the painting happened on the same method. This is bad because it's more code, but it's better because if I break the grid, only the grid will be broken, and it's easyer to spot the breakage. in the old code if I did the wrong thing with the graphics context, the whole graph gots messed out. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
793879b6fa
commit
9cb5ea45d8
4 changed files with 119 additions and 2 deletions
|
|
@ -29,7 +29,8 @@ public:
|
|||
void setColor(const QColor& color);
|
||||
void setTextColor(const QColor& color);
|
||||
int unitSystem;
|
||||
|
||||
signals:
|
||||
void sizeChanged();
|
||||
protected:
|
||||
virtual QString textForValue(double value);
|
||||
|
||||
|
|
@ -52,4 +53,28 @@ class TimeAxis : public DiveCartesianAxis {
|
|||
protected:
|
||||
QString textForValue(double value);
|
||||
};
|
||||
|
||||
// This is a try. Maybe the CartesianPlane should have the X and Y
|
||||
// axis and handle things internally?
|
||||
class DiveCartesianPlane :public QObject, public QGraphicsRectItem{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QLineF verticalLine READ verticalLine WRITE setVerticalLine)
|
||||
Q_PROPERTY(QLineF horizontalLine READ horizontalLine WRITE setHorizontalLine)
|
||||
public:
|
||||
void setLeftAxis(DiveCartesianAxis *axis);
|
||||
void setBottomAxis(DiveCartesianAxis *axis);
|
||||
void setHorizontalLine(QLineF line);
|
||||
void setVerticalLine(QLineF line);
|
||||
QLineF horizontalLine() const;
|
||||
QLineF verticalLine() const;
|
||||
public slots:
|
||||
void setup();
|
||||
private:
|
||||
DiveCartesianAxis *leftAxis;
|
||||
DiveCartesianAxis *bottomAxis;
|
||||
QList<DiveLineItem*> verticalLines;
|
||||
QList<DiveLineItem*> horizontalLines;
|
||||
qreal verticalSize;
|
||||
qreal horizontalSize;
|
||||
};
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue