mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Load project from xml is a little more faster
Like previous commit, in the method loadDiadrams() we call the method diagramAdded(), in this method we call rebuildDiagramsMap() updateAllTabsTitle() and these methods operate a loop for each existing DiagramView. Now loadDiagrams don't call diagramAdded (which must be used only when user add a diagram during the use of QElectroTech) but make operations itself and when all DiagramView are added, call rebuildDiagramsMap() updateAllTabsTitle() only once.
This commit is contained in:
@@ -810,30 +810,39 @@ void ProjectView::loadDiagrams()
|
|||||||
|
|
||||||
setDisplayFallbackWidget(m_project -> diagrams().isEmpty());
|
setDisplayFallbackWidget(m_project -> diagrams().isEmpty());
|
||||||
|
|
||||||
DialogWaiting *dialog = nullptr;
|
auto dialog = DialogWaiting::instance();
|
||||||
if(DialogWaiting::hasInstance())
|
if(dialog)
|
||||||
{
|
{
|
||||||
dialog = DialogWaiting::instance();
|
|
||||||
dialog->setTitle( tr("<p align=\"center\">"
|
dialog->setTitle( tr("<p align=\"center\">"
|
||||||
"<b>Ouverture du projet en cours...</b><br/>"
|
"<b>Ouverture du projet en cours...</b><br/>"
|
||||||
"Création des onglets de folio :"
|
"Création des onglets de folio :"
|
||||||
"</p>"));
|
"</p>"));
|
||||||
}
|
}
|
||||||
for(Diagram *diagram : m_project->diagrams())
|
|
||||||
|
for(auto diagram : m_project->diagrams())
|
||||||
{
|
{
|
||||||
if(dialog)
|
if(dialog)
|
||||||
{
|
{
|
||||||
dialog->setDetail(diagram->title());
|
dialog->setDetail(diagram->title());
|
||||||
dialog->setProgressBar(dialog->progressBarValue()+1);
|
dialog->setProgressBar(dialog->progressBarValue()+1);
|
||||||
}
|
}
|
||||||
diagramAdded(diagram);
|
|
||||||
|
auto dv = new DiagramView(diagram);
|
||||||
|
dv->setFrameStyle(QFrame::Plain | QFrame::NoFrame);
|
||||||
|
|
||||||
|
auto index = m_project->folioIndex(diagram);
|
||||||
|
m_tab->insertTab(index, dv, QET::Icons::Diagram, dv->title());
|
||||||
|
m_diagram_view_list.insert(index, dv);
|
||||||
|
|
||||||
|
connect(dv, &DiagramView::showDiagram, this, QOverload<Diagram*>::of(&ProjectView::showDiagram));
|
||||||
|
connect(dv, &DiagramView::titleChanged, this, &ProjectView::updateTabTitle);
|
||||||
|
connect(dv, &DiagramView::findElementRequired, this, &ProjectView::findElementRequired);
|
||||||
|
connect(&dv->diagram()->border_and_titleblock , &BorderTitleBlock::titleBlockFolioChanged, [this, dv]() {this->updateTabTitle(dv);});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DiagramView *dv = currentDiagram())
|
rebuildDiagramsMap();
|
||||||
{
|
updateAllTabsTitle();
|
||||||
dv->diagram()->loadElmtFolioSeq();
|
|
||||||
dv->diagram()->loadCndFolioSeq();
|
|
||||||
}
|
|
||||||
m_tab->setCurrentWidget(firstDiagram());
|
m_tab->setCurrentWidget(firstDiagram());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,10 +87,14 @@ class ProjectView : public QWidget
|
|||||||
private:
|
private:
|
||||||
ProjectView(const ProjectView &);
|
ProjectView(const ProjectView &);
|
||||||
|
|
||||||
|
//Method related to construction of this class
|
||||||
|
void setProject(QETProject *project);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
public:
|
public:
|
||||||
QETProject *project();
|
QETProject *project();
|
||||||
void setProject(QETProject *);
|
|
||||||
QList<DiagramView *> diagram_views() const;
|
QList<DiagramView *> diagram_views() const;
|
||||||
DiagramView *currentDiagram() const;
|
DiagramView *currentDiagram() const;
|
||||||
void closeEvent(QCloseEvent *) override;
|
void closeEvent(QCloseEvent *) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user