From ba5f7f5d80c95e3822a69527c6314c92303ece9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= Date: Mon, 3 May 2021 18:23:57 +0200 Subject: [PATCH] [TD] Make the root SVG group a layer for Inkscape MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Layers are Inkscape way of marking top level groups. Inkscape provides convenient UI to show and hide these groups as well as to lock them to prevent users from accidentally editing them. Although Inkscape can open and edit files without layers (without any top level group having the groupmode attribute set to "layer"), it is somewhat cumbersome to move the group created by TechDraw to a separate layer, which is what I do, when I want to add more layers with additional information. Signed-off-by: Ɓukasz Stelmach --- src/Mod/TechDraw/Gui/QGVPage.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Mod/TechDraw/Gui/QGVPage.cpp b/src/Mod/TechDraw/Gui/QGVPage.cpp index f0df865ff6..76e84a9748 100644 --- a/src/Mod/TechDraw/Gui/QGVPage.cpp +++ b/src/Mod/TechDraw/Gui/QGVPage.cpp @@ -114,6 +114,7 @@ #define CC_NS_URI "http://creativecommons.org/ns#" #define DC_NS_URI "http://purl.org/dc/elements/1.1/" #define RDF_NS_URI "http://www.w3.org/1999/02/22-rdf-syntax-ns#" +#define INKSCAPE_NS_URI "http://www.inkscape.org/namespaces/inkscape" using namespace Gui; using namespace TechDraw; @@ -899,10 +900,16 @@ void QGVPage::postProcessXml(QTemporaryFile& temporaryFile, QString fileName, QS QString::fromUtf8(DC_NS_URI)); exportDocElem.setAttribute(QString::fromUtf8("xmlns:rdf"), QString::fromUtf8(RDF_NS_URI)); + exportDocElem.setAttribute(QString::fromUtf8("xmlns:inkscape"), + QString::fromUtf8(INKSCAPE_NS_URI)); // Create the root group which will host the drawing group and the template group QDomElement rootGroup = exportDoc.createElement(QString::fromUtf8("g")); rootGroup.setAttribute(QString::fromUtf8("id"), pageName); + rootGroup.setAttribute(QString::fromUtf8("inkscape:groupmode"), + QString::fromUtf8("layer")); + rootGroup.setAttribute(QString::fromUtf8("inkscape:label"), + QString::fromUtf8("TechDraw")); // Now insert our template QGISVGTemplate *svgTemplate = dynamic_cast(pageTemplate);