5#ifndef QQUICKSHAPE_P_P_H
6#define QQUICKSHAPE_P_P_H
19#include <QtQuickShapes/private/qquickshapesglobal_p.h>
20#include <QtQuickShapes/private/qquickshape_p.h>
21#include <private/qquickitem_p.h>
22#include <private/qsgtransform_p.h>
23#include <QPainterPath>
26#include <QElapsedTimer>
28# include <private/qopenglcontext_p.h>
41 Q_DECLARE_FLAGS(Flags,
Flag)
47 virtual void beginSync(
int totalCount,
bool *countChanged) = 0;
51 virtual void setPath(
int index,
const QQuickPath *path);
52 virtual void setPath(
int index,
const QPainterPath &path, QQuickShapePath::PathHints pathHints = {}) = 0;
57 virtual void setJoinStyle(
int index, QQuickShapePath::JoinStyle joinStyle,
int miterLimit) = 0;
58 virtual void setCapStyle(
int index, QQuickShapePath::CapStyle capStyle) = 0;
59 virtual void setStrokeStyle(
int index, QQuickShapePath::StrokeStyle strokeStyle,
60 qreal dashOffset,
const QList<qreal> &dashPattern) = 0;
63 virtual void setFillRule(
int index, QQuickShapePath::FillRule fillRule) = 0;
79 QQuickShapePath::PathHints hints;
80 QPainterPath newPath = path ? path->path() : QPainterPath();
81 if (
const auto *shapePath = qobject_cast<
const QQuickShapePath *>(path)) {
82 hints = shapePath->pathHints();
83 if (shapePath->hasTrim()) {
84 const QQuickShapeTrim *trim =
const_cast<QQuickShapePath *>(shapePath)->trim();
85 newPath = path->path().trimmed(trim->start(), trim->end(), trim->offset());
88 setPath(index, newPath, hints);
115 Q_DECLARE_PUBLIC(QQuickShapePath)
120 DirtyStrokeColor = 0x02,
121 DirtyStrokeWidth = 0x04,
122 DirtyFillColor = 0x08,
123 DirtyFillRule = 0x10,
126 DirtyFillGradient = 0x80,
127 DirtyFillTransform = 0x100,
128 DirtyFillItem = 0x200,
130 DirtyStrokeGradient = 0x800,
135 QQuickShapePathPrivate();
137 void _q_pathChanged();
138 void _q_fillGradientChanged();
139 void _q_strokeGradientChanged();
140 void _q_fillItemDestroyed();
142 void handleSceneChange();
144 void writeToDebugStream(QDebug &debug)
const override;
146 static QQuickShapePathPrivate *get(QQuickShapePath *p) {
return p->d_func(); }
149 QQuickShapeStrokeFillParams sfp;
150 QQuickShapePath::PathHints pathHints;
155 Q_DECLARE_PUBLIC(QQuickShape)
158 QQuickShapePrivate();
159 ~QQuickShapePrivate();
163 QQuickShape::RendererType selectRendererType();
164 void createRenderer();
165 QSGNode *createNode();
168 void _q_shapePathChanged();
169 void setStatus(QQuickShape::Status newStatus);
170 void handleSceneChange(QQuickWindow *w);
172 static QQuickShapePrivate *get(QQuickShape *item) {
return item->d_func(); }
174 static void asyncShapeReady(
void *data);
176 qreal getImplicitWidth()
const override;
177 qreal getImplicitHeight()
const override;
180 QList<QQuickShapePath *> sp;
181 QElapsedTimer syncTimer;
182 QQuickAbstractPathRenderer *renderer =
nullptr;
183 int syncTimingTotalDirty = 0;
184 int syncTimeCounter = 0;
185 QQuickShape::Status status = QQuickShape::Null;
186 QQuickShape::RendererType rendererType = QQuickShape::UnknownRenderer;
187 QQuickShape::RendererType preferredType = QQuickShape::UnknownRenderer;
188 QQuickShape::ContainsMode containsMode = QQuickShape::BoundingRectContains;
189 QQuickShape::FillMode fillMode = QQuickShape::NoResize;
190 QQuickShape::HAlignment horizontalAlignment = QQuickShape::AlignLeft;
191 QQuickShape::VAlignment verticalAlignment = QQuickShape::AlignTop;
193 bool spChanged =
false;
194 bool rendererChanged =
false;
196 bool enableVendorExts =
false;
197 bool syncTimingActive =
false;
198 qreal triangulationScale = 1.0;
virtual void setFillTextureProvider(int index, QQuickItem *textureProviderItem)=0
virtual void beginSync(int totalCount, bool *countChanged)=0
virtual void setStrokeColor(int index, const QColor &color)=0
virtual void setPath(int index, const QPainterPath &path, QQuickShapePath::PathHints pathHints={})=0
virtual void setAsyncCallback(void(*)(void *), void *)
virtual Flags flags() const
virtual void setCapStyle(int index, QQuickShapePath::CapStyle capStyle)=0
virtual void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle, qreal dashOffset, const QList< qreal > &dashPattern)=0
virtual void setFillGradient(int index, QQuickShapeGradient *gradient)=0
virtual ~QQuickAbstractPathRenderer()
virtual void setFillColor(int index, const QColor &color)=0
virtual void setCosmeticStroke(int index, bool c)=0
virtual void setPath(int index, const QQuickPath *path)
virtual void setTriangulationScale(int, qreal)
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 handleSceneChange(QQuickWindow *window)=0
virtual void setStrokeGradient(int index, QQuickShapeGradient *gradient)=0
virtual void setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit)=0
Combined button and popup list for selecting options.
QT_BEGIN_NAMESPACE Q_STATIC_LOGGING_CATEGORY(lcSynthesizedIterableAccess, "qt.iterable.synthesized", QtWarningMsg)
static void initResources()
static void vpe_clear(QQmlListProperty< QObject > *property)
static void vpe_append(QQmlListProperty< QObject > *property, QObject *obj)
Q_GHS_KEEP_REFERENCE(QQuickShapes_initializeModule)
QList< qreal > dashPattern
QSGTransform fillTransform
QQuickShapeStrokeFillParams()
QQuickShapeGradient * strokeGradient
QQuickShapeGradient * fillGradient