From 9038c6f5773a1c62eecb60a9046c56a8db120e8c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 6 Aug 2024 08:16:49 +0200 Subject: [PATCH] VectorImage: Allow fewer types to be children of shapes We allowed certain node types to be allowed as children underneath a Shape item. There is no clear reasoning for why these nodes were selected. An issue with making items children of what is actually a sibling is that the z order will no longer be automatically handled, as the shape will be drawn underneath its children. There is no way to merge two shapes into one and ensure that an item wedged between them is placed at the correct z level relative to both. One case which would work is for text when it is drawn using paths, so this is a potential optimization. However, it would require factoring out the logic which detects whether this is needed. Text may not be a common enough use case for this to be worth it. Pick-to: 6.8 Fixes: QTBUG-127656 Change-Id: I7c73535f9298897e1f9e2e4a80814df966f5a501 Reviewed-by: Eirik Aavitsland --- src/quickvectorimage/generator/qsvgvisitorimpl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/quickvectorimage/generator/qsvgvisitorimpl.cpp b/src/quickvectorimage/generator/qsvgvisitorimpl.cpp index 0717aa21e9..5336194dfb 100644 --- a/src/quickvectorimage/generator/qsvgvisitorimpl.cpp +++ b/src/quickvectorimage/generator/qsvgvisitorimpl.cpp @@ -159,15 +159,15 @@ inline bool isPathContainer(const QSvgStructureNode *node) case QSvgNode::Animation: case QSvgNode::Use: case QSvgNode::Video: + case QSvgNode::Image: + case QSvgNode::Textarea: + case QSvgNode::Text: + case QSvgNode::Tspan: //qCDebug(lcQuickVectorGraphics) << "NOT path container because" << node->typeName() ; return false; // nodes that could go inside Shape{} case QSvgNode::Defs: - case QSvgNode::Image: - case QSvgNode::Textarea: - case QSvgNode::Text: - case QSvgNode::Tspan: break; // nodes that are done as pure ShapePath{}