9#include <private/qsgplaintexture_p.h>
10#include <private/qquicksvgparser_p.h>
11#include <QtGui/private/qdrawhelper_p.h>
12#include <QOpenGLFunctions>
13#include <QLoggingCategory>
82 : strokeColor(
Qt::white),
194 return d->sfp.strokeColor;
200 if (
d->sfp.strokeColor !=
color) {
201 d->sfp.strokeColor =
color;
221 return d->sfp.strokeWidth;
227 if (
d->sfp.strokeWidth !=
w) {
228 d->sfp.strokeWidth =
w;
248 return d->sfp.fillColor;
254 if (
d->sfp.fillColor !=
color) {
279 return d->sfp.fillRule;
313 return d->sfp.joinStyle;
319 if (
d->sfp.joinStyle != style) {
320 d->sfp.joinStyle = style;
339 return d->sfp.miterLimit;
345 if (
d->sfp.miterLimit !=
limit) {
346 d->sfp.miterLimit =
limit;
373 return d->sfp.capStyle;
379 if (
d->sfp.capStyle != style) {
380 d->sfp.capStyle = style;
400 return d->sfp.strokeStyle;
406 if (
d->sfp.strokeStyle != style) {
407 d->sfp.strokeStyle = style;
428 return d->sfp.dashOffset;
434 if (
d->sfp.dashOffset !=
offset) {
459 return d->sfp.dashPattern;
465 if (
d->sfp.dashPattern !=
array) {
466 d->sfp.dashPattern =
array;
490 return d->sfp.fillGradient;
496 if (
d->sfp.fillGradient != gradient) {
497 if (
d->sfp.fillGradient)
500 d->sfp.fillGradient = gradient;
501 if (
d->sfp.fillGradient)
513 emit q->shapePathChanged();
566 if (
d->pathHints == newPathHints)
568 d->pathHints = newPathHints;
569 emit pathHintsChanged();
584 return d->sfp.fillTransform.matrix();
590 if (
d->sfp.fillTransform !=
matrix) {
591 d->sfp.fillTransform.setMatrix(
matrix);
593 emit fillTransformChanged();
724 emit q->boundingRectChanged();
725 auto br =
q->boundingRect();
726 q->setImplicitSize(br.right(), br.bottom());
732 if (
status != newStatus) {
734 emit q->statusChanged();
741 return q->boundingRect().right();
747 return q->boundingRect().bottom();
802 return d->rendererType;
826 return d->preferredType;
832 if (
d->preferredType == preferredType)
835 d->preferredType = preferredType;
838 for (
int i = 0;
i <
d->sp.size(); ++
i) {
844 d->_q_shapePathChanged();
848 emit preferredRendererTypeChanged();
876 if (
d->async != async) {
879 if (
d->componentComplete)
880 d->_q_shapePathChanged();
896 qreal pw =
path->strokeColor().alpha() ?
path->strokeWidth() : 0;
898 brect = brect.
united(
path->path().boundingRect().adjusted(-d, -d, d, d));
917 return d->enableVendorExts;
923 if (
d->enableVendorExts !=
enable) {
980 return d->containsMode;
990 emit containsModeChanged();
996 switch (
d->containsMode) {
1001 if (
path->path().contains(point))
1029void QQuickShape::setFillMode(FillMode newFillMode)
1032 if (
d->fillMode == newFillMode)
1034 d->fillMode = newFillMode;
1035 emit fillModeChanged();
1055 return d->horizontalAlignment;
1058void QQuickShape::setHorizontalAlignment(HAlignment newHorizontalAlignment)
1061 if (
d->horizontalAlignment == newHorizontalAlignment)
1063 d->horizontalAlignment = newHorizontalAlignment;
1064 emit horizontalAlignmentChanged();
1070 return d->verticalAlignment;
1073void QQuickShape::setVerticalAlignment(VAlignment newVerticalAlignment)
1076 if (
d->verticalAlignment == newVerticalAlignment)
1078 d->verticalAlignment = newVerticalAlignment;
1079 emit verticalAlignmentChanged();
1092 if (
path &&
d->componentComplete) {
1094 d->_q_shapePathChanged();
1110 if (
d->componentComplete)
1111 d->_q_shapePathChanged();
1126 return QQmlListProperty<QObject>(
this,
1148 d->_q_shapePathChanged();
1155 const int currentEffectRefCount =
d->extra.isAllocated() ?
d->extra->recursiveEffectRefCount : 0;
1156 if (!
d->spChanged && currentEffectRefCount <= d->effectRefCount)
1159 d->spChanged =
false;
1160 d->effectRefCount = currentEffectRefCount;
1163 if (
d->rendererType != expectedRenderer) {
1165 d->renderer =
nullptr;
1169 d->createRenderer();
1188 d->_q_shapePathChanged();
1190 for (
int i = 0;
i <
d->sp.size(); ++
i)
1192 d->_q_shapePathChanged();
1204 if (
d->renderer ||
d->rendererChanged) {
1205 if (!node ||
d->rendererChanged) {
1206 d->rendererChanged =
false;
1208 node =
d->createNode();
1211 d->renderer->updateNode();
1223 xScale = yScale =
qMin(xScale, yScale);
1225 xScale = yScale =
qMax(xScale, yScale);
1226 fillModeTransform.scale(xScale, yScale);
1241 fillModeTransform.translate(tx / xScale,
ty / yScale);
1256 static const bool environmentPreferCurve =
1259 switch (ri->graphicsApi()) {
1271 qWarning(
"No path backend for this graphics API yet");
1290 switch (selectedType) {
1318 switch (ri->graphicsApi()) {
1335 qWarning(
"No path backend for this graphics API yet");
1351 if (self->syncTimingActive)
1352 qDebug(
"[Shape %p] [%d] [dirty=0x%x] async update took %lld ms",
1353 self->q_func(), self->syncTimeCounter, self->syncTimingTotalDirty, self->syncTimer.elapsed());
1370 bool countChanged =
false;
1377 totalDirty |=
dirty;
1414 qDebug(
"[Shape %p] [%d] [dirty=0x%x] update took %lld ms",
1421 if (totalDirty || countChanged)
1471 if (m_spread !=
mode) {
1520 if (m_start.
x() !=
v) {
1534 if (m_start.
y() !=
v) {
1548 if (m_end.
x() !=
v) {
1562 if (m_end.
y() !=
v) {
1632 return m_centerPoint.
x();
1637 if (m_centerPoint.
x() !=
v) {
1638 m_centerPoint.
setX(
v);
1646 return m_centerPoint.
y();
1651 if (m_centerPoint.
y() !=
v) {
1652 m_centerPoint.
setY(
v);
1668 return m_centerRadius;
1673 if (m_centerRadius !=
v) {
1682 return m_focalPoint.
x();
1687 if (m_focalPoint.
x() !=
v) {
1688 m_focalPoint.
setX(
v);
1696 return m_focalPoint.
y();
1701 if (m_focalPoint.
y() !=
v) {
1702 m_focalPoint.
setY(
v);
1710 return m_focalRadius;
1715 if (m_focalRadius !=
v) {
1758 return m_centerPoint.
x();
1763 if (m_centerPoint.
x() !=
v) {
1764 m_centerPoint.
setX(
v);
1772 return m_centerPoint.
y();
1777 if (m_centerPoint.
y() !=
v) {
1778 m_centerPoint.
setY(
v);
1807#include "moc_qquickshape_p.cpp"
The QColor class provides colors based on RGB, HSV or CMYK values.
qint64 elapsed() const noexcept
Returns the number of milliseconds since this QElapsedTimer was last started.
void start() noexcept
\typealias QElapsedTimer::Duration Synonym for std::chrono::nanoseconds.
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
constexpr void setY(qreal y) noexcept
Sets the y coordinate of this point to the given finite y coordinate.
constexpr void setX(qreal x) noexcept
Sets the x coordinate of this point to the given finite x coordinate.
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 setJoinStyle(int index, QQuickShapePath::JoinStyle joinStyle, int miterLimit)=0
static void data_clear(QQmlListProperty< QObject > *)
static qsizetype data_count(QQmlListProperty< QObject > *)
\qmlproperty list<QtObject> QtQuick::Item::data \qmldefault
static QObject * data_at(QQmlListProperty< QObject > *, qsizetype)
QQmlListProperty< QObject > data()
static void data_append(QQmlListProperty< QObject > *, QObject *)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
void classBegin() override
\reimp Derived classes should call the base class method before adding their own action to perform at...
void setFlag(Flag flag, bool enabled=true)
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disable...
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
virtual Q_INVOKABLE bool contains(const QPointF &point) const
\qmlmethod bool QtQuick::Item::contains(point point)
qreal width
This property holds the width of this item.
virtual void itemChange(ItemChange, const ItemChangeData &)
Called when change occurs for this item.
qreal height
This property holds the height of this item.
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
void update()
Schedules a call to updatePaintNode() for this item.
void polish()
Schedules a polish event for this item.
QQuickShapeConicalGradient(QObject *parent=nullptr)
Conical gradient.
QQuickShapeGradient(QObject *parent=nullptr)
Base type of Shape fill gradients.
void setSpread(SpreadMode mode)
QQuickShapeLinearGradient(QObject *parent=nullptr)
Linear gradient.
void _q_fillGradientChanged()
static QQuickShapePathPrivate * get(QQuickShapePath *p)
QQuickShapePathPrivate()
Describes a Path and associated properties for stroking and filling.
void setDashPattern(const QVector< qreal > &array)
void setJoinStyle(JoinStyle style)
void setFillGradient(QQuickShapeGradient *gradient)
void strokeColorChanged()
void setStrokeColor(const QColor &color)
void setFillRule(FillRule fillRule)
void setMiterLimit(int limit)
void setStrokeWidth(qreal w)
void setPathHints(PathHints newPathHints)
void dashPatternChanged()
void setDashOffset(qreal offset)
void setFillTransform(const QMatrix4x4 &matrix)
void strokeWidthChanged()
QQuickShapePath(QObject *parent=nullptr)
void strokeStyleChanged()
void setCapStyle(CapStyle style)
QVector< qreal > dashPattern
void setStrokeStyle(StrokeStyle style)
FINALQMatrix4x4 fillTransform
QQuickShapeGradient * fillGradient
void setFillColor(const QColor &color)
QQuickShape::RendererType rendererType
QVector< QQuickShapePath * > sp
QQuickShapePrivate()
Renders a path.
static QQuickShapePrivate * get(QQuickShape *item)
qreal getImplicitWidth() const override
void setStatus(QQuickShape::Status newStatus)
void _q_shapePathChanged()
qreal getImplicitHeight() const override
QQuickShape::Status status
QQuickAbstractPathRenderer * renderer
QQuickShape::RendererType preferredType
static void asyncShapeReady(void *data)
QQuickShape::RendererType selectRendererType()
void focalRadiusChanged()
void setCenterRadius(qreal v)
QQuickShapeRadialGradient(QObject *parent=nullptr)
Radial gradient.
void setFocalRadius(qreal v)
void centerRadiusChanged()
RendererType preferredRendererType
\qmlproperty enumeration QtQuick.Shapes::Shape::preferredRendererType
void itemChange(ItemChange change, const ItemChangeData &data) override
Called when change occurs for this item.
QSGNode * updatePaintNode(QSGNode *node, UpdatePaintNodeData *) override
Called on the render thread when it is time to sync the state of the item with the scene graph.
void classBegin() override
\reimp Derived classes should call the base class method before adding their own action to perform at...
void vendorExtensionsEnabledChanged()
void asynchronousChanged()
FINALFillMode fillMode
\qmlproperty enumeration QtQuick.Shapes::Shape::fillMode
bool contains(const QPointF &point) const override
\qmlmethod bool QtQuick::Item::contains(point point)
bool vendorExtensionsEnabled
RendererType rendererType
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
void setContainsMode(ContainsMode containsMode)
FINALVAlignment verticalAlignment
void setAsynchronous(bool async)
QQuickShape(QQuickItem *parent=nullptr)
void setVendorExtensionsEnabled(bool enable)
FINALHAlignment horizontalAlignment
\qmlproperty enumeration QtQuick.Shapes::Shape::horizontalAlignment \qmlproperty enumeration QtQuick....
void updatePolish() override
This function should perform any layout as required for this item.
QRectF boundingRect
\qmlproperty rect QtQuick.Shapes::Shape::boundingRect \readonly
ContainsMode containsMode
FINALQQmlListProperty< QObject > data
\qmlproperty list<Object> QtQuick.Shapes::Shape::data
static void defineModule()
\inmodule QtCore\reentrant
QRectF united(const QRectF &other) const noexcept
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
void appendChildNode(QSGNode *node)
Appends node to this node's list of children.
An interface providing access to some of the graphics API specific internals of the scenegraph.
static bool isApiRhiBased(GraphicsApi api)
QString toLower() const &
Combined button and popup list for selecting options.
Q_CONSTRUCTOR_FUNCTION(qt_apple_check_os_version)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
#define Q_LOGGING_CATEGORY(name,...)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLsizei const GLfloat * v
[13]
GLfloat GLfloat GLfloat w
[0]
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset
GLfloat GLfloat GLfloat GLfloat h
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
#define qmlobject_disconnect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
Disconnect Signal of Sender from Method of Receiver.
#define qmlobject_connect(Sender, SenderType, Signal, Receiver, ReceiverType, Method)
Connect Signal of Sender to Method of Receiver.
static void initResources()
static void vpe_clear(QQmlListProperty< QObject > *property)
static void vpe_append(QQmlListProperty< QObject > *property, QObject *obj)
QT_BEGIN_NAMESPACE void QQuickShapes_initializeModule()
\qmlmodule QtQuick.Shapes 1.
QLatin1StringView QLatin1String
QString qEnvironmentVariable(const char *varName, const QString &defaultValue)
#define Q_INIT_RESOURCE(name)
QQuickShapeStrokeFillParams()
QVector< qreal > dashPattern