From b50ff0fb8a580904dde97e15472e95959a3072d7 Mon Sep 17 00:00:00 2001 From: xavier Date: Sun, 12 Feb 2012 17:17:44 +0000 Subject: [PATCH] Expand projects tree only the first time they are displayed. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1499 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/elementspanel.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sources/elementspanel.cpp b/sources/elementspanel.cpp index b0a17c97b..1a55701ba 100644 --- a/sources/elementspanel.cpp +++ b/sources/elementspanel.cpp @@ -387,6 +387,8 @@ void ElementsPanel::panelContentChange() { @return Le QTreeWidgetItem insere le plus haut */ QTreeWidgetItem *ElementsPanel::addProject(QETProject *project) { + bool first_add = (first_reload_ || !projects_to_display_.contains(project)); + // create the QTreeWidgetItem representing the project QTreeWidgetItem *qtwi_project = GenericPanel::addProject(project, 0, GenericPanel::All); // the project will be inserted right before the common tb templates collection @@ -394,17 +396,17 @@ QTreeWidgetItem *ElementsPanel::addProject(QETProject *project) { indexOfTopLevelItem(common_tbt_collection_item_), qtwi_project ); - qtwi_project -> setExpanded(true); + if (first_add) qtwi_project -> setExpanded(true); if (TitleBlockTemplatesCollection *tbt_collection = project -> embeddedTitleBlockTemplatesCollection()) { if (QTreeWidgetItem *tbt_collection_qtwi = itemForTemplatesCollection(tbt_collection)) { - tbt_collection_qtwi -> setExpanded(true); + if (first_add) tbt_collection_qtwi -> setExpanded(true); } } if (ElementsCollection *elmt_collection = project -> embeddedCollection()) { if (QTreeWidgetItem *elmt_collection_qtwi = itemForElementsCollection(elmt_collection)) { - elmt_collection_qtwi -> setExpanded(true); + if (first_add) elmt_collection_qtwi -> setExpanded(true); } } @@ -688,8 +690,8 @@ void ElementsPanel::filter(const QString &m, QET::Filtering filtering) { @param project Projet ouvert a rajouter au panel */ void ElementsPanel::projectWasOpened(QETProject *project) { - projects_to_display_ << project; addProject(project); + projects_to_display_ << project; emit(panelContentChanged()); }