| 1 | #pragma once |
| 2 | |
| 3 | #include <QQuickPaintedItem> |
| 4 | #include <QColor> |
| 5 | |
| 6 | #include <GUI/GettingStartedTip.hxx> |
| 7 | |
| 8 | class TipBackgroundBox : public QQuickPaintedItem |
| 9 | { |
| 10 | Q_OBJECT |
| 11 | |
| 12 | Q_PROPERTY(GettingStartedTip::Arrow arrow READ arrowPosition WRITE setArrowPosition NOTIFY arrowPositionChanged) |
| 13 | |
| 14 | Q_PROPERTY(QColor fill READ fill WRITE setFill NOTIFY fillChanged) |
| 15 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) |
| 16 | Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged) |
| 17 | |
| 18 | public: |
| 19 | TipBackgroundBox(QQuickItem* parent = nullptr); |
| 20 | |
| 21 | GettingStartedTip::Arrow arrowPosition() const; |
| 22 | |
| 23 | QColor borderColor() const; |
| 24 | |
| 25 | int borderWidth() const; |
| 26 | |
| 27 | QColor fill() const; |
| 28 | |
| 29 | static int arrowSideOffset(); |
| 30 | |
| 31 | static int arrowHeight(); |
| 32 | |
| 33 | public slots: |
| 34 | void setArrowPosition(GettingStartedTip::Arrow arrow); |
| 35 | |
| 36 | void setBorderColor(QColor borderColor); |
| 37 | |
| 38 | void setBorderWidth(int borderWidth); |
| 39 | |
| 40 | void setFill(QColor fill); |
| 41 | |
| 42 | signals: |
| 43 | void arrowPositionChanged(GettingStartedTip::Arrow arrow); |
| 44 | |
| 45 | void borderColorChanged(QColor borderColor); |
| 46 | |
| 47 | void borderWidthChanged(int borderWidth); |
| 48 | |
| 49 | void fillChanged(QColor fill); |
| 50 | |
| 51 | protected: |
| 52 | void paint(QPainter* painter) override; |
| 53 | |
| 54 | private: |
| 55 | GettingStartedTip::Arrow _arrow = GettingStartedTip::Arrow::TopCenter; |
| 56 | |
| 57 | QColor _borderColor; |
| 58 | int _borderWidth = -1; // off |
| 59 | QColor _fill; |
| 60 | }; |
| 61 |