Open project is a litle more faster

In the methods readDiagramsXml we call addDiagram for each diagrams
loaded from xml, inside the addDiagram method we call the method
updateDiagramsFolioData() and to finish this method operate a loop for
each existing diagram.

Then when we load a project from xml of
10 folios, loop inside updateDiagramsFolioData() is called 55 time.
50 folios, loop inside updateDiagramsFolioData() is called 1275 time.
100 folios, loop inside updateDiagramsFolioData() is called 5050 time.

Now instead of call addDiagram, we add diagram directly inside the
methods readDiagramsXml and call the method updateDiagramsFolioData()
only once when all diagrams are loaded.
This commit is contained in:
joshua 2021-05-14 13:38:59 +02:00
parent ffabeb9caa
commit 0aea48bdaa

View File

@ -1398,15 +1398,13 @@ void QETProject::readDiagramsXml(QDomDocument &xml_project)
QDomElement diagram_xml_element = diagram_nodes
.at(i)
.toElement();
Diagram *diagram = new Diagram(this);
auto diagram = new Diagram(this);
m_diagrams_list << diagram;
int diagram_order = -1;
if (!QET::attributeIsAnInteger(diagram_xml_element,
QStringLiteral("order"),
&diagram_order))
diagram_order = 500000;
addDiagram(diagram, diagram_order-1);
connect(&diagram->border_and_titleblock, &BorderTitleBlock::needFolioData,
this, &QETProject::updateDiagramsFolioData);
connect(diagram, &Diagram::usedTitleBlockTemplateChanged,
this, &QETProject::usedTitleBlockTemplateChanged);
diagram->initFromXml(diagram_xml_element);
if(dlgWaiting)
@ -1414,6 +1412,8 @@ void QETProject::readDiagramsXml(QDomDocument &xml_project)
}
}
updateDiagramsFolioData();
//Initialise links between elements in this project
//and refresh the text of conductor
if(dlgWaiting)