4#ifndef QQUICKSHAPE_P_P_H
5#define QQUICKSHAPE_P_P_H
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>
25#include <QElapsedTimer>
27# include <private/qopenglcontext_p.h>
40 Q_DECLARE_FLAGS(Flags,
Flag)
46 virtual void beginSync(
int totalCount,
bool *countChanged) = 0;
50 virtual void setPath(
int index,
const QQuickPath *path);
51 virtual void setPath(
int index,
const QPainterPath &path, QQuickShapePath::PathHints pathHints = {}) = 0;
56 virtual void setFillRule(
int index, QQuickShapePath::FillRule fillRule) = 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 QVector<qreal> &dashPattern) = 0;
75 QQuickShapePath::PathHints hints;
76 QPainterPath newPath = path ? path->path() : QPainterPath();
77 if (
const auto *shapePath = qobject_cast<
const QQuickShapePath *>(path)) {
78 hints = shapePath->pathHints();
79 if (shapePath->hasTrim()) {
80 const QQuickShapeTrim *trim =
const_cast<QQuickShapePath *>(shapePath)->trim();
81 newPath = path->path().trimmed(trim->start(), trim->end(), trim->offset());
84 setPath(index, newPath, hints);
110 Q_DECLARE_PUBLIC(QQuickShapePath)
115 DirtyStrokeColor = 0x02,
116 DirtyStrokeWidth = 0x04,
117 DirtyFillColor = 0x08,
118 DirtyFillRule = 0x10,
121 DirtyFillGradient = 0x80,
122 DirtyFillTransform = 0x100,
123 DirtyFillItem = 0x200,
129 QQuickShapePathPrivate();
131 void _q_pathChanged();
132 void _q_fillGradientChanged();
133 void _q_fillItemDestroyed();
135 void handleSceneChange();
137 void writeToDebugStream(QDebug &debug)
const override;
139 static QQuickShapePathPrivate *get(QQuickShapePath *p) {
return p->d_func(); }
142 QQuickShapeStrokeFillParams sfp;
143 QQuickShapePath::PathHints pathHints;
148 Q_DECLARE_PUBLIC(QQuickShape)
151 QQuickShapePrivate();
152 ~QQuickShapePrivate();
156 QQuickShape::RendererType selectRendererType();
157 void createRenderer();
158 QSGNode *createNode();
161 void _q_shapePathChanged();
162 void setStatus(QQuickShape::Status newStatus);
163 void handleSceneChange(QQuickWindow *w);
165 static QQuickShapePrivate *get(QQuickShape *item) {
return item->d_func(); }
167 static void asyncShapeReady(
void *data);
169 qreal getImplicitWidth()
const override;
170 qreal getImplicitHeight()
const override;
173 QVector<QQuickShapePath *> sp;
174 QElapsedTimer syncTimer;
175 QQuickAbstractPathRenderer *renderer =
nullptr;
176 int syncTimingTotalDirty = 0;
177 int syncTimeCounter = 0;
178 QQuickShape::Status status = QQuickShape::Null;
179 QQuickShape::RendererType rendererType = QQuickShape::UnknownRenderer;
180 QQuickShape::RendererType preferredType = QQuickShape::UnknownRenderer;
181 QQuickShape::ContainsMode containsMode = QQuickShape::BoundingRectContains;
182 QQuickShape::FillMode fillMode = QQuickShape::NoResize;
183 QQuickShape::HAlignment horizontalAlignment = QQuickShape::AlignLeft;
184 QQuickShape::VAlignment verticalAlignment = QQuickShape::AlignTop;
186 bool spChanged =
false;
187 bool rendererChanged =
false;
189 bool enableVendorExts =
false;
190 bool syncTimingActive =
false;
191 qreal triangulationScale = 1.0;
virtual void setTriangulationScale(qreal)
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 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 ~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 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 setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit)=0
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")
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)
QSGTransform fillTransform
QQuickShapeStrokeFillParams()
QVector< qreal > dashPattern
QQuickShapeGradient * fillGradient