mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: convert the "ruler item" to qt-quick
Code is mostly based on the "tooltip item". The dragging code was slightly reworked to be more logical. A "disk item" was added for the handles. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
b167e130a4
commit
ea0085fef6
14 changed files with 313 additions and 228 deletions
|
|
@ -30,7 +30,7 @@ public:
|
|||
const bool dragable; // Item can be dragged with the mouse. Must be set in constructor.
|
||||
virtual ~ChartItem(); // Attention: must only be called by render thread.
|
||||
QRectF getRect() const;
|
||||
virtual void setPos(QPointF pos); // Called when dragging the item
|
||||
virtual void drag(QPointF pos); // Called when dragging the item
|
||||
virtual void stopDrag(QPointF pos); // Called when dragging the item finished
|
||||
protected:
|
||||
ChartItem(ChartView &v, size_t z, bool dragable = false);
|
||||
|
|
@ -81,7 +81,8 @@ public:
|
|||
ChartPixmapItem(ChartView &v, size_t z, bool dragable = false);
|
||||
~ChartPixmapItem();
|
||||
|
||||
void setPos(QPointF pos) override;
|
||||
virtual void setPos(QPointF pos);
|
||||
void drag(QPointF pos) override; // calls setPos() by default
|
||||
void setScale(double scale);
|
||||
void render() override;
|
||||
protected:
|
||||
|
|
@ -131,6 +132,19 @@ private:
|
|||
QSize originalSize;
|
||||
};
|
||||
|
||||
// A solid disk, potentially with border.
|
||||
class ChartDiskItem : public ChartPixmapItem {
|
||||
public:
|
||||
ChartDiskItem(ChartView &v, size_t z, const QPen &pen, const QBrush &brush, bool dragable = false);
|
||||
~ChartDiskItem();
|
||||
void resize(double radius);
|
||||
void setPos(QPointF pos) override;
|
||||
QPointF getPos() const;
|
||||
private:
|
||||
QPen pen;
|
||||
QBrush brush;
|
||||
};
|
||||
|
||||
// Attention: text is only drawn after calling setColor()!
|
||||
class ChartTextItem : public ChartPixmapItem {
|
||||
public:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue