8#include <private/qsgcurveprocessor_p.h>
9#include <private/qquickshape_p.h>
10#include <private/qquadpath_p.h>
11#include <private/qquickitem_p.h>
12#include <private/qquickimagebase_p_p.h>
14#include <QtCore/qloggingcategory.h>
22 m_items.
push(parentItem);
23 m_parentItem = parentItem;
32 if (!
info.isDefaultTransform) {
33 auto sx =
info.transform.m11();
34 auto sy =
info.transform.m22();
35 auto x =
info.transform.m31();
36 auto y =
info.transform.m32();
38 auto xformProp = currentItem()->
transform();
49 xformProp.append(&xformProp,
scale);
54 xformProp.append(&xformProp,
xform);
57 if (!
info.isDefaultOpacity) {
78 imageItem->setX(
info.rect.x());
79 imageItem->setY(
info.rect.y());
80 imageItem->setWidth(
info.rect.width());
81 imageItem->setHeight(
info.rect.height());
85 addCurrentItem(imageItem,
info);
95 if (!
info.isDefaultTransform)
96 qCWarning(lcQuickVectorImage) <<
"Skipped transform for node" <<
info.nodeId <<
"type" <<
info.typeName <<
"(this is not supposed to happen)";
103 addCurrentItem(shapeItem,
info);
104 m_parentShapeItem = shapeItem;
105 m_inShapeItem =
true;
112 m_inShapeItem =
false;
113 m_parentShapeItem =
nullptr;
136 if (!
info.nodeId.isEmpty())
142 shapePath->setStrokeColor(
info.strokeStyle.color);
143 shapePath->setStrokeWidth(
info.strokeStyle.width);
146 shapePath->setMiterLimit(
info.strokeStyle.miterLimit);
147 if (
info.strokeStyle.dashArray.length() != 0) {
149 shapePath->setDashPattern(
info.strokeStyle.dashArray.toVector());
150 shapePath->setDashOffset(
info.strokeStyle.dashOffset);
159 shapePath->setFillColor(
info.fillColor);
161 shapePath->setFillRule(fillRule);
162 if (!
info.fillTransform.isIdentity())
163 shapePath->setFillTransform(
info.fillTransform);
168 pathSvg->
setPath(svgPathString);
169 pathSvg->setParent(shapePath);
171 auto pathElementProp = shapePath->pathElements();
172 pathElementProp.append(&pathElementProp, pathSvg);
174 shapePath->setParent(currentItem());
175 auto shapeDataProp = m_parentShapeItem->
data();
176 shapeDataProp.append(&shapeDataProp, shapePath);
185 auto stopsProp = quickGrad->stops();
186 for (
auto &stop : stops) {
188 stopObj->setPosition(stop.first);
189 stopObj->setColor(stop.second);
190 stopsProp.append(&stopsProp, stopObj);
197 QRectF gradRect(linGrad->start(), linGrad->finalStop());
201 quickGrad->setX1(logRect.left());
202 quickGrad->setY1(logRect.top());
203 quickGrad->setX2(logRect.right());
204 quickGrad->setY2(logRect.bottom());
205 setStops(quickGrad, linGrad->stops());
207 shapePath->setFillGradient(quickGrad);
211 quickGrad->setCenterX(radGrad->center().x());
212 quickGrad->setCenterY(radGrad->center().y());
213 quickGrad->setCenterRadius(radGrad->radius());
214 quickGrad->setFocalX(radGrad->focalPoint().x());
215 quickGrad->setFocalY(radGrad->focalPoint().y());
216 setStops(quickGrad, radGrad->stops());
218 shapePath->setFillGradient(quickGrad);
227 qCWarning(lcQuickVectorImage) <<
"SVG NODE NOT IMPLEMENTED: "
229 <<
" type: " <<
info.typeName;
241 addCurrentItem(containerItem,
info);
245 if (!
info.isTextArea) {
247 alignItem->setX(
info.position.x());
248 alignItem->setY(
info.position.y());
252 addCurrentItem(textItem,
info);
254 if (
info.isTextArea) {
255 textItem->setX(
info.position.x());
256 textItem->setY(
info.position.y());
257 if (
info.size.width() > 0)
258 textItem->setWidth(
info.size.width());
259 if (
info.size.height() > 0)
260 textItem->setHeight(
info.size.height());
262 textItem->setClip(
true);
268 switch (
info.alignment) {
276 qCDebug(lcQuickVectorImage) <<
"Unexpected text alignment" <<
info.alignment;
284 textItem->setColor(
info.fillColor);
286 textItem->setText(
info.text);
287 textItem->setFont(
info.font);
290 textItem->setStyleColor(
info.strokeColor);
294 m_items.
pop(); m_items.
pop();
319 if (!
info.forceSeparatePaths &&
info.isPathContainer) {
320 m_inShapeItem =
true;
324 m_parentShapeItem = shapeItem;
325 addCurrentItem(shapeItem,
info);
333 m_inShapeItem =
false;
334 m_parentShapeItem =
nullptr;
347 if (
info.size.width() > 0)
350 if (
info.size.height() > 0)
362 if (
info.size.width() > 0)
365 if (
info.size.height() > 0)
372 m_inShapeItem =
false;
373 m_parentShapeItem =
nullptr;
382 return m_items.
top();
Type type() const
Returns the type of gradient.
void setParentItem(QGraphicsItem *parent)
Sets this item's parent item to newParent.
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
void setParent(QObject *parent)
Makes the object a child of parent.
Qt::FillRule fillRule() const
Returns the painter path's currently set fill rule.
void setHorizontalCenter(const QQuickAnchorLine &edge)
void setBaseline(const QQuickAnchorLine &edge)
void setRight(const QQuickAnchorLine &edge)
void setLeft(const QQuickAnchorLine &edge)
void optimizePaths(const PathNodeInfo &info)
QQuickVectorImageGenerator::GeneratorFlags m_flags
bool isNodeVisible(const NodeInfo &info)
QQuickPixmap * currentPix
void generateNodeBase(const NodeInfo &info) override
void outputShapePath(const PathNodeInfo &info, const QPainterPath *path, const QQuadPath *quadPath, QQuickVectorImageGenerator::PathSelector pathSelector, const QRectF &boundingRect) override
QQuickItemGenerator(const QString fileName, QQuickVectorImageGenerator::GeneratorFlags flags, QQuickItem *parentItem)
bool generateStructureNode(const StructureNodeInfo &info) override
void generateNode(const NodeInfo &info) override
void generatePath(const PathNodeInfo &info) override
void generateUseNode(const UseNodeInfo &info) override
void generateImageNode(const ImageNodeInfo &info) override
bool generateDefsNode(const NodeInfo &info) override
void generateTextNode(const TextNodeInfo &info) override
bool generateRootNode(const StructureNodeInfo &info) override
static QQuickItemPrivate * get(QQuickItem *item)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
void setImplicitHeight(qreal)
void setImplicitWidth(qreal)
QQmlListProperty< QQuickTransform > transform
\qmlproperty list<Transform> QtQuick::Item::transform This property holds the list of transformations...
void setPath(const QString &path)
void setImage(const QImage &)
void setContainsMode(ContainsMode containsMode)
FINALQQmlListProperty< QObject > data
\qmlproperty list<Object> QtQuick.Shapes::Shape::data
\inmodule QtCore\reentrant
T & top()
Returns a reference to the stack's top item.
T pop()
Removes the top item from the stack and returns it.
void push(const T &t)
Adds element t to the top of the stack.
\macro QT_RESTRICTED_CAST_FROM_ASCII
constexpr QColor Transparent
QRectF mapToQtLogicalMode(const QRectF &objModeRect, const QRectF &boundingRect)
QString toSvgString(const QPainterPath &path)
Combined button and popup list for selecting options.
#define qCWarning(category,...)
#define qCDebug(category,...)
GLint GLint GLint GLint GLint x
[0]
GLenum GLenum GLenum GLenum GLenum scale
static const QRectF boundingRect(const QPointF *points, int pointCount)
QQuickAnchors * anchors(QQuickItem *item)
#define QStringLiteral(str)
static bool translate(xcb_connection_t *connection, xcb_window_t child, xcb_window_t parent, int *x, int *y)