Changeset View
Changeset View
Standalone View
Standalone View
src/shadowedrectangle.h
Show All 35 Lines | 33 | public: | |||
---|---|---|---|---|---|
36 | qreal width() const; | 36 | qreal width() const; | ||
37 | void setWidth(qreal newWidth); | 37 | void setWidth(qreal newWidth); | ||
38 | 38 | | |||
39 | QColor color() const; | 39 | QColor color() const; | ||
40 | void setColor(const QColor &newColor); | 40 | void setColor(const QColor &newColor); | ||
41 | 41 | | |||
42 | Q_SIGNAL void changed(); | 42 | Q_SIGNAL void changed(); | ||
43 | 43 | | |||
44 | inline bool isEnabled() const | ||||
45 | { | ||||
46 | return !qFuzzyIsNull(m_width); | ||||
47 | } | ||||
48 | | ||||
44 | private: | 49 | private: | ||
45 | qreal m_width = 0.0; | 50 | qreal m_width = 0.0; | ||
46 | QColor m_color = Qt::black; | 51 | QColor m_color = Qt::black; | ||
47 | }; | 52 | }; | ||
48 | 53 | | |||
49 | /** | 54 | /** | ||
50 | * Grouped property for rectangle shadow. | 55 | * Grouped property for rectangle shadow. | ||
51 | */ | 56 | */ | ||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | |||||
105 | 110 | | |||
106 | /** | 111 | /** | ||
107 | * A rectangle with a shadow. | 112 | * A rectangle with a shadow. | ||
108 | * | 113 | * | ||
109 | * This item will render a rectangle, with a shadow below it. The rendering is done | 114 | * This item will render a rectangle, with a shadow below it. The rendering is done | ||
110 | * using distance fields, which provide greatly improved performance. The shadow is | 115 | * using distance fields, which provide greatly improved performance. The shadow is | ||
111 | * rendered outside of the item's bounds, so the item's width and height are the | 116 | * rendered outside of the item's bounds, so the item's width and height are the | ||
112 | * rectangle's width and height. | 117 | * rectangle's width and height. | ||
118 | * | ||||
119 | * @since 5.69 / 2.12 | ||||
113 | */ | 120 | */ | ||
114 | class ShadowedRectangle : public QQuickItem | 121 | class ShadowedRectangle : public QQuickItem | ||
115 | { | 122 | { | ||
116 | Q_OBJECT | 123 | Q_OBJECT | ||
117 | /** | 124 | /** | ||
118 | * Corner radius of the rectangle. | 125 | * Corner radius of the rectangle. | ||
119 | * | 126 | * | ||
120 | * This is the amount of rounding to apply to the rectangle's corners, in pixels. | 127 | * This is the amount of rounding to apply to the rectangle's corners, in pixels. | ||
Show All 32 Lines | 150 | public: | |||
153 | 160 | | |||
154 | QColor color() const; | 161 | QColor color() const; | ||
155 | void setColor(const QColor &newColor); | 162 | void setColor(const QColor &newColor); | ||
156 | Q_SIGNAL void colorChanged(); | 163 | Q_SIGNAL void colorChanged(); | ||
157 | 164 | | |||
158 | void componentComplete() override; | 165 | void componentComplete() override; | ||
159 | 166 | | |||
160 | protected: | 167 | protected: | ||
161 | void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value); | 168 | void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value) override; | ||
162 | QSGNode *updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNodeData *data) override; | 169 | QSGNode *updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNodeData *data) override; | ||
163 | 170 | | |||
164 | private: | 171 | private: | ||
165 | void checkSoftwareItem(); | 172 | void checkSoftwareItem(); | ||
166 | const std::unique_ptr<BorderGroup> m_border; | 173 | const std::unique_ptr<BorderGroup> m_border; | ||
167 | const std::unique_ptr<ShadowGroup> m_shadow; | 174 | const std::unique_ptr<ShadowGroup> m_shadow; | ||
168 | qreal m_radius = 0.0; | 175 | qreal m_radius = 0.0; | ||
169 | QColor m_color = Qt::white; | 176 | QColor m_color = Qt::white; | ||
170 | PaintedRectangleItem *m_softwareItem = nullptr; | 177 | PaintedRectangleItem *m_softwareItem = nullptr; | ||
171 | }; | 178 | }; |