mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-07-30 07:44:13 +02:00
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:
@@ -42,10 +42,14 @@ Element * ElementFactory::createElement(const ElementsLocation &location, QGraph
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto doc = location.pugiXml();
|
//Read the link_type from the (cached) QDom definition instead of
|
||||||
if (doc.document_element().attribute("link_type"))
|
//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"))
|
if (link_type == QLatin1String("next_report") || link_type == QLatin1String("previous_report"))
|
||||||
return (new ReportElement(location, link_type, qgi, state));
|
return (new ReportElement(location, link_type, qgi, state));
|
||||||
if (link_type == QLatin1String("master"))
|
if (link_type == QLatin1String("master"))
|
||||||
|
|||||||
Reference in New Issue
Block a user