OpenCoverage

qquickshape_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quickshapes/qquickshape_p.h
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQuick module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#ifndef QQUICKSHAPE_P_H-
41#define QQUICKSHAPE_P_H-
42-
43//-
44// W A R N I N G-
45// --------------
46//-
47// This file is not part of the Qt API. It exists purely as an-
48// implementation detail. This header file may change from version to-
49// version without notice, or even be removed.-
50//-
51// We mean it.-
52//-
53-
54#include <QtQuickShapes/private/qquickshapesglobal_p.h>-
55#include <QtQuick/qquickitem.h>-
56-
57#include <private/qtquickglobal_p.h>-
58#include <private/qquickpath_p_p.h>-
59#include <private/qquickrectangle_p.h>-
60-
61QT_BEGIN_NAMESPACE-
62-
63class QQuickShapePathPrivate;-
64class QQuickShapePrivate;-
65-
66class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeGradient : public QQuickGradient-
67{-
68 Q_OBJECT-
69 Q_PROPERTY(SpreadMode spread READ spread WRITE setSpread NOTIFY spreadChanged)-
70 Q_CLASSINFO("DefaultProperty", "stops")-
71-
72public:-
73 enum SpreadMode {-
74 PadSpread,-
75 RepeatSpread,-
76 ReflectSpread-
77 };-
78 Q_ENUM(SpreadMode)-
79-
80 QQuickShapeGradient(QObject *parent = nullptr);-
81-
82 SpreadMode spread() const;-
83 void setSpread(SpreadMode mode);-
84-
85signals:-
86 void spreadChanged();-
87-
88private:-
89 SpreadMode m_spread;-
90};-
91-
92class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeLinearGradient : public QQuickShapeGradient-
93{-
94 Q_OBJECT-
95 Q_PROPERTY(qreal x1 READ x1 WRITE setX1 NOTIFY x1Changed)-
96 Q_PROPERTY(qreal y1 READ y1 WRITE setY1 NOTIFY y1Changed)-
97 Q_PROPERTY(qreal x2 READ x2 WRITE setX2 NOTIFY x2Changed)-
98 Q_PROPERTY(qreal y2 READ y2 WRITE setY2 NOTIFY y2Changed)-
99 Q_CLASSINFO("DefaultProperty", "stops")-
100-
101public:-
102 QQuickShapeLinearGradient(QObject *parent = nullptr);-
103-
104 qreal x1() const;-
105 void setX1(qreal v);-
106 qreal y1() const;-
107 void setY1(qreal v);-
108 qreal x2() const;-
109 void setX2(qreal v);-
110 qreal y2() const;-
111 void setY2(qreal v);-
112-
113signals:-
114 void x1Changed();-
115 void y1Changed();-
116 void x2Changed();-
117 void y2Changed();-
118-
119private:-
120 QPointF m_start;-
121 QPointF m_end;-
122};-
123-
124class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeRadialGradient : public QQuickShapeGradient-
125{-
126 Q_OBJECT-
127 Q_PROPERTY(qreal centerX READ centerX WRITE setCenterX NOTIFY centerXChanged)-
128 Q_PROPERTY(qreal centerY READ centerY WRITE setCenterY NOTIFY centerYChanged)-
129 Q_PROPERTY(qreal centerRadius READ centerRadius WRITE setCenterRadius NOTIFY centerRadiusChanged)-
130 Q_PROPERTY(qreal focalX READ focalX WRITE setFocalX NOTIFY focalXChanged)-
131 Q_PROPERTY(qreal focalY READ focalY WRITE setFocalY NOTIFY focalYChanged)-
132 Q_PROPERTY(qreal focalRadius READ focalRadius WRITE setFocalRadius NOTIFY focalRadiusChanged)-
133 Q_CLASSINFO("DefaultProperty", "stops")-
134-
135public:-
136 QQuickShapeRadialGradient(QObject *parent = nullptr);-
137-
138 qreal centerX() const;-
139 void setCenterX(qreal v);-
140-
141 qreal centerY() const;-
142 void setCenterY(qreal v);-
143-
144 qreal centerRadius() const;-
145 void setCenterRadius(qreal v);-
146-
147 qreal focalX() const;-
148 void setFocalX(qreal v);-
149-
150 qreal focalY() const;-
151 void setFocalY(qreal v);-
152-
153 qreal focalRadius() const;-
154 void setFocalRadius(qreal v);-
155-
156signals:-
157 void centerXChanged();-
158 void centerYChanged();-
159 void focalXChanged();-
160 void focalYChanged();-
161 void centerRadiusChanged();-
162 void focalRadiusChanged();-
163-
164private:-
165 QPointF m_centerPoint;-
166 QPointF m_focalPoint;-
167 qreal m_centerRadius = 0;-
168 qreal m_focalRadius = 0;-
169};-
170-
171class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeConicalGradient : public QQuickShapeGradient-
172{-
173 Q_OBJECT-
174 Q_PROPERTY(qreal centerX READ centerX WRITE setCenterX NOTIFY centerXChanged)-
175 Q_PROPERTY(qreal centerY READ centerY WRITE setCenterY NOTIFY centerYChanged)-
176 Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged)-
177 Q_CLASSINFO("DefaultProperty", "stops")-
178-
179public:-
180 QQuickShapeConicalGradient(QObject *parent = nullptr);-
181-
182 qreal centerX() const;-
183 void setCenterX(qreal v);-
184-
185 qreal centerY() const;-
186 void setCenterY(qreal v);-
187-
188 qreal angle() const;-
189 void setAngle(qreal v);-
190-
191signals:-
192 void centerXChanged();-
193 void centerYChanged();-
194 void angleChanged();-
195-
196private:-
197 QPointF m_centerPoint;-
198 qreal m_angle = 0;-
199};-
200-
201class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapePath : public QQuickPath-
202{-
203 Q_OBJECT-
204-
205 Q_PROPERTY(QColor strokeColor READ strokeColor WRITE setStrokeColor NOTIFY strokeColorChanged)-
206 Q_PROPERTY(qreal strokeWidth READ strokeWidth WRITE setStrokeWidth NOTIFY strokeWidthChanged)-
207 Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged)-
208 Q_PROPERTY(FillRule fillRule READ fillRule WRITE setFillRule NOTIFY fillRuleChanged)-
209 Q_PROPERTY(JoinStyle joinStyle READ joinStyle WRITE setJoinStyle NOTIFY joinStyleChanged)-
210 Q_PROPERTY(int miterLimit READ miterLimit WRITE setMiterLimit NOTIFY miterLimitChanged)-
211 Q_PROPERTY(CapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged)-
212 Q_PROPERTY(StrokeStyle strokeStyle READ strokeStyle WRITE setStrokeStyle NOTIFY strokeStyleChanged)-
213 Q_PROPERTY(qreal dashOffset READ dashOffset WRITE setDashOffset NOTIFY dashOffsetChanged)-
214 Q_PROPERTY(QVector<qreal> dashPattern READ dashPattern WRITE setDashPattern NOTIFY dashPatternChanged)-
215 Q_PROPERTY(QQuickShapeGradient *fillGradient READ fillGradient WRITE setFillGradient RESET resetFillGradient)-
216-
217public:-
218 enum FillRule {-
219 OddEvenFill = Qt::OddEvenFill,-
220 WindingFill = Qt::WindingFill-
221 };-
222 Q_ENUM(FillRule)-
223-
224 enum JoinStyle {-
225 MiterJoin = Qt::MiterJoin,-
226 BevelJoin = Qt::BevelJoin,-
227 RoundJoin = Qt::RoundJoin-
228 };-
229 Q_ENUM(JoinStyle)-
230-
231 enum CapStyle {-
232 FlatCap = Qt::FlatCap,-
233 SquareCap = Qt::SquareCap,-
234 RoundCap = Qt::RoundCap-
235 };-
236 Q_ENUM(CapStyle)-
237-
238 enum StrokeStyle {-
239 SolidLine = Qt::SolidLine,-
240 DashLine = Qt::DashLine-
241 };-
242 Q_ENUM(StrokeStyle)-
243-
244 QQuickShapePath(QObject *parent = nullptr);-
245 ~QQuickShapePath();-
246-
247 QColor strokeColor() const;-
248 void setStrokeColor(const QColor &color);-
249-
250 qreal strokeWidth() const;-
251 void setStrokeWidth(qreal w);-
252-
253 QColor fillColor() const;-
254 void setFillColor(const QColor &color);-
255-
256 FillRule fillRule() const;-
257 void setFillRule(FillRule fillRule);-
258-
259 JoinStyle joinStyle() const;-
260 void setJoinStyle(JoinStyle style);-
261-
262 int miterLimit() const;-
263 void setMiterLimit(int limit);-
264-
265 CapStyle capStyle() const;-
266 void setCapStyle(CapStyle style);-
267-
268 StrokeStyle strokeStyle() const;-
269 void setStrokeStyle(StrokeStyle style);-
270-
271 qreal dashOffset() const;-
272 void setDashOffset(qreal offset);-
273-
274 QVector<qreal> dashPattern() const;-
275 void setDashPattern(const QVector<qreal> &array);-
276-
277 QQuickShapeGradient *fillGradient() const;-
278 void setFillGradient(QQuickShapeGradient *gradient);-
279 void resetFillGradient();-
280-
281Q_SIGNALS:-
282 void shapePathChanged();-
283 void strokeColorChanged();-
284 void strokeWidthChanged();-
285 void fillColorChanged();-
286 void fillRuleChanged();-
287 void joinStyleChanged();-
288 void miterLimitChanged();-
289 void capStyleChanged();-
290 void strokeStyleChanged();-
291 void dashOffsetChanged();-
292 void dashPatternChanged();-
293-
294private:-
295 Q_DISABLE_COPY(QQuickShapePath)-
296 Q_DECLARE_PRIVATE(QQuickShapePath)
executed 4873 times by 2 tests: return reinterpret_cast<QQuickShapePathPrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_examples
  • tst_qquickshape
executed 11599 times by 2 tests: return reinterpret_cast<const QQuickShapePathPrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_examples
  • tst_qquickshape
4873-11599
297 Q_PRIVATE_SLOT(d_func(), void _q_fillGradientChanged())-
298};-
299-
300class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShape : public QQuickItem-
301{-
302 Q_OBJECT-
303 Q_PROPERTY(RendererType rendererType READ rendererType NOTIFY rendererChanged)-
304 Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged)-
305 Q_PROPERTY(bool vendorExtensionsEnabled READ vendorExtensionsEnabled WRITE setVendorExtensionsEnabled NOTIFY vendorExtensionsEnabledChanged)-
306 Q_PROPERTY(Status status READ status NOTIFY statusChanged)-
307 Q_PROPERTY(ContainsMode containsMode READ containsMode WRITE setContainsMode NOTIFY containsModeChanged REVISION 11)-
308 Q_PROPERTY(QQmlListProperty<QObject> data READ data)-
309 Q_CLASSINFO("DefaultProperty", "data")-
310-
311public:-
312 enum RendererType {-
313 UnknownRenderer,-
314 GeometryRenderer,-
315 NvprRenderer,-
316 SoftwareRenderer-
317 };-
318 Q_ENUM(RendererType)-
319-
320 enum Status {-
321 Null,-
322 Ready,-
323 Processing-
324 };-
325 Q_ENUM(Status)-
326-
327 enum ContainsMode {-
328 BoundingRectContains,-
329 FillContains-
330 };-
331 Q_ENUM(ContainsMode)-
332-
333 QQuickShape(QQuickItem *parent = nullptr);-
334 ~QQuickShape();-
335-
336 RendererType rendererType() const;-
337-
338 bool asynchronous() const;-
339 void setAsynchronous(bool async);-
340-
341 bool vendorExtensionsEnabled() const;-
342 void setVendorExtensionsEnabled(bool enable);-
343-
344 Status status() const;-
345-
346 ContainsMode containsMode() const;-
347 void setContainsMode(ContainsMode containsMode);-
348-
349 bool contains(const QPointF &point) const override;-
350-
351 QQmlListProperty<QObject> data();-
352-
353protected:-
354 QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *) override;-
355 void updatePolish() override;-
356 void itemChange(ItemChange change, const ItemChangeData &data) override;-
357 void componentComplete() override;-
358 void classBegin() override;-
359-
360Q_SIGNALS:-
361 void rendererChanged();-
362 void asynchronousChanged();-
363 void vendorExtensionsEnabledChanged();-
364 void statusChanged();-
365 Q_REVISION(11) void containsModeChanged();-
366-
367private:-
368 Q_DISABLE_COPY(QQuickShape)-
369 Q_DECLARE_PRIVATE(QQuickShape)
executed 2034 times by 2 tests: return reinterpret_cast<QQuickShapePrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_examples
  • tst_qquickshape
executed 24 times by 2 tests: return reinterpret_cast<const QQuickShapePrivate *>(qGetPtrHelper(d_ptr));
Executed by:
  • tst_examples
  • tst_qquickshape
24-2034
370 Q_PRIVATE_SLOT(d_func(), void _q_shapePathChanged())-
371};-
372-
373QT_END_NAMESPACE-
374-
375QML_DECLARE_TYPE(QQuickShape)-
376-
377#endif // QQUICKSHAPE_P_H-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0