Merge pull request #567 from DieterMayerOSS/pr/factory-drop-pugixml-pass

ElementFactory: read link_type from the cached QDom, drop the pugixml pass
This commit is contained in:
Laurent Trinques
2026-07-28 17:43:01 +02:00
committed by GitHub
+7 -3
View File
@@ -42,10 +42,14 @@ Element * ElementFactory::createElement(const ElementsLocation &location, QGraph
return nullptr;
}
auto doc = location.pugiXml();
if (doc.document_element().attribute("link_type"))
//Read the link_type from the (cached) QDom definition instead of
//running a second, pugixml parse of the same definition: this
//dispatch runs once per element instance on project load, and the
//pugixml detour was ~4 % of the whole load time of a big project.
const QString link_type =
location.xml().attribute(QStringLiteral("link_type"));
if (!link_type.isEmpty())
{
QString link_type(doc.document_element().attribute("link_type").as_string());
if (link_type == QLatin1String("next_report") || link_type == QLatin1String("previous_report"))
return (new ReportElement(location, link_type, qgi, state));
if (link_type == QLatin1String("master"))