Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickshape_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKSHAPE_P_P_H
5#define QQUICKSHAPE_P_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuickShapes/private/qquickshapesglobal_p.h>
19#include <QtQuickShapes/private/qquickshape_p.h>
20#include <private/qquickitem_p.h>
21#include <private/qsgtransform_p.h>
22#include <QPainterPath>
23#include <QColor>
24#include <QBrush>
25#include <QElapsedTimer>
26#if QT_CONFIG(opengl)
27# include <private/qopenglcontext_p.h>
28#endif
30
31class QSGPlainTexture;
32class QRhi;
33
35{
36public:
37 enum Flag {
38 SupportsAsync = 0x01
39 };
42
44
45 // Gui thread
46 virtual void beginSync(int totalCount, bool *countChanged) = 0;
47 virtual void endSync(bool async) = 0;
48 virtual void setAsyncCallback(void (*)(void *), void *) { }
49 virtual Flags flags() const { return {}; }
50 virtual void setPath(int index, const QQuickPath *path) = 0;
51 virtual void setStrokeColor(int index, const QColor &color) = 0;
52 virtual void setStrokeWidth(int index, qreal w) = 0;
53 virtual void setFillColor(int index, const QColor &color) = 0;
54 virtual void setFillRule(int index, QQuickShapePath::FillRule fillRule) = 0;
55 virtual void setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit) = 0;
56 virtual void setCapStyle(int index, QQuickShapePath::CapStyle capStyle) = 0;
57 virtual void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle,
58 qreal dashOffset, const QVector<qreal> &dashPattern) = 0;
59 virtual void setFillGradient(int index, QQuickShapeGradient *gradient) = 0;
60 virtual void setFillTransform(int index, const QSGTransform &transform) = 0;
61 virtual void setTriangulationScale(qreal) { }
62
63 // Render thread, with gui blocked
64 virtual void updateNode() = 0;
65};
66
67Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickAbstractPathRenderer::Flags)
68
86
87class Q_QUICKSHAPES_EXPORT QQuickShapePathPrivate : public QQuickPathPrivate
88{
89 Q_DECLARE_PUBLIC(QQuickShapePath)
90
91public:
92 enum Dirty {
93 DirtyPath = 0x01,
94 DirtyStrokeColor = 0x02,
95 DirtyStrokeWidth = 0x04,
96 DirtyFillColor = 0x08,
97 DirtyFillRule = 0x10,
98 DirtyStyle = 0x20,
99 DirtyDash = 0x40,
100 DirtyFillGradient = 0x80,
101 DirtyFillTransform = 0x100,
102
103 DirtyAll = 0x1FF
104 };
105
107
109 void _q_fillGradientChanged();
110
111 static QQuickShapePathPrivate *get(QQuickShapePath *p) { return p->d_func(); }
112
113 int dirty;
115 QQuickShapePath::PathHints pathHints;
116};
117
119{
120 Q_DECLARE_PUBLIC(QQuickShape)
121
122public:
125
127 void createRenderer();
129 void sync();
130
131 void _q_shapePathChanged();
132 void setStatus(QQuickShape::Status newStatus);
133
134 static QQuickShapePrivate *get(QQuickShape *item) { return item->d_func(); }
135
136 static void asyncShapeReady(void *data);
137
138 qreal getImplicitWidth() const override;
139 qreal getImplicitHeight() const override;
140
142 QVector<QQuickShapePath *> sp;
154
155 bool spChanged = false;
156 bool rendererChanged = false;
157 bool async = false;
158 bool enableVendorExts = false;
159 bool syncTimingActive = false;
161};
162
164
165#endif
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtCore
virtual void setPath(int index, const QQuickPath *path)=0
virtual void setTriangulationScale(qreal)
virtual void beginSync(int totalCount, bool *countChanged)=0
virtual void setStrokeColor(int index, const QColor &color)=0
virtual void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle, qreal dashOffset, const QVector< qreal > &dashPattern)=0
virtual void setAsyncCallback(void(*)(void *), void *)
virtual Flags flags() const
virtual void setCapStyle(int index, QQuickShapePath::CapStyle capStyle)=0
virtual void setFillGradient(int index, QQuickShapeGradient *gradient)=0
virtual void setFillColor(int index, const QColor &color)=0
virtual void setFillRule(int index, QQuickShapePath::FillRule fillRule)=0
virtual void setStrokeWidth(int index, qreal w)=0
virtual void setFillTransform(int index, const QSGTransform &transform)=0
virtual void endSync(bool async)=0
virtual void updateNode()=0
virtual void setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit)=0
QQuickShapePath::PathHints pathHints
QQuickShapeStrokeFillParams sfp
static QQuickShapePathPrivate * get(QQuickShapePath *p)
QQuickShape::RendererType rendererType
QVector< QQuickShapePath * > sp
QQuickShapePrivate()
Renders a path.
static QQuickShapePrivate * get(QQuickShape *item)
qreal getImplicitWidth() const override
void setStatus(QQuickShape::Status newStatus)
QElapsedTimer syncTimer
qreal getImplicitHeight() const override
QQuickShape::VAlignment verticalAlignment
QQuickShape::Status status
QQuickAbstractPathRenderer * renderer
QQuickShape::RendererType preferredType
static void asyncShapeReady(void *data)
QQuickShape::ContainsMode containsMode
QQuickShape::RendererType selectRendererType()
QQuickShape::HAlignment horizontalAlignment
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1804
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
Combined button and popup list for selecting options.
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
Flags
GLfloat GLfloat GLfloat w
[0]
GLenum fillMode
GLuint index
[2]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint color
[2]
GLuint GLenum GLenum transform
GLsizei const GLchar *const * path
GLfloat GLfloat p
[1]
double qreal
Definition qtypes.h:187
QGraphicsItem * item
QQuickShapePath::JoinStyle joinStyle
QQuickShapePath::FillRule fillRule
QQuickShapePath::CapStyle capStyle
QQuickShapePath::StrokeStyle strokeStyle
QQuickShapeGradient * fillGradient