summaryrefslogtreecommitdiffstats
path: root/src/svg/qsvgnode.cpp
diff options
context:
space:
mode:
authorMatthias Rauter <matthias.rauter@qt.io>2024-03-06 13:17:18 +0100
committerMatthias Rauter <matthias.rauter@qt.io>2024-03-15 16:35:04 +0100
commit247453e7d5c84837b80444c26b1afd6165f63477 (patch)
tree9350c128db094514cc5429b45843e205065f75dc /src/svg/qsvgnode.cpp
parentd99f357bb7b3e07d2a7b061140ab430bcaa5010e (diff)
Enable <use> elements in <mask> and propagate state to mask children
The use node could not be created within a mask due to a missing entry in a switch statement. This is corrected with this patch. The mask element was implemented such that states do not propagate to it's children. This is not correct and states are propagated correctly with this patch. Pick-to: 6.7 6.7.0 Fixes: QTBUG-123010 Change-Id: I4aab070c73b2e8a9bd0c642c70ea5b28eaef3416 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/svg/qsvgnode.cpp')
-rw-r--r--src/svg/qsvgnode.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/svg/qsvgnode.cpp b/src/svg/qsvgnode.cpp
index deb4d71..f6b52e9 100644
--- a/src/svg/qsvgnode.cpp
+++ b/src/svg/qsvgnode.cpp
@@ -233,6 +233,22 @@ void QSvgNode::applyStyle(QPainter *p, QSvgExtraStates &states) const
m_style.apply(p, this, states);
}
+/*!
+ \internal
+
+ Apply the styles of all parents to the painter and the states.
+ The styles are applied from the top level node to the current node.
+ This function can be used to set the correct style for a node
+ if it's draw function is triggered out of the ordinary draw context,
+ for example the mask node, that is cross-referenced.
+*/
+void QSvgNode::applyStyleRecursive(QPainter *p, QSvgExtraStates &states) const
+{
+ if (parent())
+ parent()->applyStyleRecursive(p, states);
+ applyStyle(p, states);
+}
+
void QSvgNode::revertStyle(QPainter *p, QSvgExtraStates &states) const
{
m_style.revert(p, states);
@@ -591,6 +607,16 @@ qreal QSvgNode::strokeWidth(QPainter *p)
return pen.widthF();
}
+void QSvgNode::initPainter(QPainter *p)
+{
+ QPen pen(Qt::NoBrush, 1, Qt::SolidLine, Qt::FlatCap, Qt::SvgMiterJoin);
+ pen.setMiterLimit(4);
+ p->setPen(pen);
+ p->setBrush(Qt::black);
+ p->setRenderHint(QPainter::Antialiasing);
+ p->setRenderHint(QPainter::SmoothPixmapTransform);
+}
+
bool QSvgNode::shouldDrawNode(QPainter *p, QSvgExtraStates &states) const
{
static bool alwaysDraw = qEnvironmentVariableIntValue("QT_SVG_DISABLE_SIZE_LIMIT");