KDEGames
kgamesvgdocument.cpp
50 * @brief Performs a preorder traversal of the DOM tree to find element matching @c attributeName & @c attributeValue
57 QDomNode findElementById(const QString &attributeName, const QString &attributeValue, const QDomNode &node);
130const QString KGameSvgDocumentPrivate::SVG_XML_PREPEND = QStringLiteral("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><svg>");
154QDomNode KGameSvgDocument::elementByUniqueAttributeValue(const QString &attributeName, const QString &attributeValue)
302void KGameSvgDocument::setStyleProperty(const QString &propertyName, const QString &propertyValue)
324 pattern = QLatin1String("url") + WSP_ASTERISK + OPEN_PARENS + WSP_ASTERISK + QLatin1String("#(.*)") + WSP_ASTERISK + CLOSE_PARENS;
431void KGameSvgDocument::setStyleProperties(const QHash<QString, QString> &_styleProperties, const StylePropertySortOptions &options)
436 d->m_inkscapeOrder << QStringLiteral("fill") << QStringLiteral("fill-opacity") << QStringLiteral("fill-rule") << QStringLiteral("stroke")
437 << QStringLiteral("stroke-width") << QStringLiteral("stroke-linecap") << QStringLiteral("stroke-linejoin")
493 qCWarning(KDEGAMESPRIVATE_LOG) << "Transform attribute seems to be invalid. Check your SVG file.";
499 while (transformAttribute.size() > 0 && i < 32) // 32 is an arbitrary limit for the number of transforms for a single node
593 if ((transform() == QLatin1String("Element has no transform attribute.")) && (matrix == null)) {
604QDomNode KGameSvgDocumentPrivate::findElementById(const QString &attributeName, const QString &attributeValue, const QDomNode &node)
607 QString value = e.attribute(attributeName, QStringLiteral("Element has no attribute with that name."));
void close() override
bool open(QIODevice::OpenMode mode) override
void translate(int xPixels, int yPixels, MatrixOptions options=ApplyToCurrentMatrix)
Moves the origin of the current node.
Definition kgamesvgdocument.cpp:226
void setTransformMatrix(QTransform &matrix, MatrixOptions options=ApplyToCurrentMatrix)
Sets the transform attribute of the current node.
Definition kgamesvgdocument.cpp:576
void scale(double xFactor, double yFactor, MatrixOptions options=ApplyToCurrentMatrix)
Scales the origin of the current node.
Definition kgamesvgdocument.cpp:260
QDomNodeList linearGradients() const
Returns the linearGradients in the document.
Definition kgamesvgdocument.cpp:378
void setTransform(const QString &transformAttribute)
Sets the transform attribute of the current node.
Definition kgamesvgdocument.cpp:403
KGameSvgDocument & operator=(const KGameSvgDocument &doc)
Assignment Operator.
Definition kgamesvgdocument.cpp:147
void rotate(double degrees, MatrixOptions options=ApplyToCurrentMatrix)
Rotates the origin of the current node counterclockwise.
Definition kgamesvgdocument.cpp:213
void setStyleProperties(const QHash< QString, QString > &_styleProperties, const StylePropertySortOptions &options=Unsorted)
Sets the style properties of the current node.
Definition kgamesvgdocument.cpp:431
void setSvgFilename(const QString &svgFilename)
Sets the current SVG filename.
Definition kgamesvgdocument.cpp:292
QDomNode elementById(const QString &attributeValue)
Returns a node with the given id.
Definition kgamesvgdocument.cpp:167
void setStyleProperty(const QString &propertyName, const QString &propertyValue)
Sets the value of the style property given for the current node.
Definition kgamesvgdocument.cpp:302
QString svgFilename() const
Returns the name of the SVG file this DOM represents.
Definition kgamesvgdocument.cpp:287
QHash< QString, QString > styleProperties() const
Returns a hash of the style properties of the current node.
Definition kgamesvgdocument.cpp:408
QString nodeToSvg() const
Returns the current node and its children as a new xml svg document.
Definition kgamesvgdocument.cpp:312
void shear(double xRadians, double yRadians, MatrixOptions options=ApplyToCurrentMatrix)
Shears the origin of the current node.
Definition kgamesvgdocument.cpp:239
QString styleProperty(const QString &propertyName) const
Returns the value of the style property given for the current node.
Definition kgamesvgdocument.cpp:297
QDomNodeList radialGradients() const
Returns the radialGradients in the document.
Definition kgamesvgdocument.cpp:383
void setStyle(const QString &styleAttribute)
Sets the style attribute of the current node.
Definition kgamesvgdocument.cpp:368
QDomNodeList patterns() const
Returns the patterns in the document.
Definition kgamesvgdocument.cpp:373
QString transform() const
Returns the transform attribute of the current node.
Definition kgamesvgdocument.cpp:398
QTransform transformMatrix() const
Returns the transform attribute of the current node as a matrix.
Definition kgamesvgdocument.cpp:466
QString style() const
Returns the style attribute of the current node.
Definition kgamesvgdocument.cpp:363
QDomNode currentNode() const
Returns the last node found by elementById, or null if node not found.
Definition kgamesvgdocument.cpp:276
void skew(double xDegrees, double yDegrees, MatrixOptions options=ApplyToCurrentMatrix)
Skews the origin of the current node.
Definition kgamesvgdocument.cpp:252
QDomNode elementByUniqueAttributeValue(const QString &attributeName, const QString &attributeValue)
Returns the node with the given value for the given attribute.
Definition kgamesvgdocument.cpp:154
QByteArray nodeToByteArray() const
Builds a new svg document and returns a QByteArray suitable for passing to QSvgRenderer::load().
Definition kgamesvgdocument.cpp:358
@ UseInkscapeOrder
When building a style attribute, sort properties the same way Inkscape does.
Definition kgamesvgdocument.h:150
bool startsWith(QByteArrayView bv) const const
QDomElement documentElement() const const
QDomNodeList elementsByTagName(const QString &tagname) const const
QDomDocument & operator=(const QDomDocument &x)
ParseResult setContent(QAnyStringView text, ParseOptions options)
QString attribute(const QString &name, const QString &defValue) const const
QDomNode firstChild() const const
bool isNull() const const
QDomNode nextSibling() const const
void save(QTextStream &stream, int indent, EncodingPolicy encodingPolicy) const const
QDomElement toElement() const const
QDomNode at(int index) const const
bool open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags)
virtual void close() override
iterator insert(const Key &key, const T &value)
bool hasNext() const const
const Key & key() const const
Item next()
const T & value() const const
QByteArray readAll()
ReadOnly
void append(QList< T > &&value)
const_reference at(qsizetype i) const const
QRegularExpressionMatchIterator globalMatch(QStringView subjectView, qsizetype offset, MatchType matchType, MatchOptions matchOptions) const const
QRegularExpressionMatch match(QStringView subjectView, qsizetype offset, MatchType matchType, MatchOptions matchOptions) const const
void setPattern(const QString &pattern)
bool hasMatch() const const
bool hasNext() const const
QRegularExpressionMatch next()
void chop(qsizetype n)
QString mid(qsizetype position, qsizetype n) const const
QString & setNum(double n, char format, int precision)
qsizetype size() const const
QStringList split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
QByteArray toUtf8() const const
QString trimmed() const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
QList< QStringView > split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
QString * string() const const
qreal dx() const const
qreal dy() const const
qreal m11() const const
qreal m12() const const
qreal m21() const const
qreal m22() const const
QTransform & rotate(qreal a, Qt::Axis axis)
QTransform & scale(qreal sx, qreal sy)
QTransform & shear(qreal sh, qreal sv)
QTransform & translate(qreal dx, qreal dy)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:04 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:04 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.