[qet] [1499] Expand projects tree only the first time they are displayed.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 1499
Author:   xavier
Date:     2012-02-12 18:17:44 +0100 (Sun, 12 Feb 2012)
Log Message:
-----------
Expand projects tree only the first time they are displayed.

Modified Paths:
--------------
    branches/0.3/sources/elementspanel.cpp

Modified: branches/0.3/sources/elementspanel.cpp
===================================================================
--- branches/0.3/sources/elementspanel.cpp	2012-02-12 16:47:37 UTC (rev 1498)
+++ branches/0.3/sources/elementspanel.cpp	2012-02-12 17:17:44 UTC (rev 1499)
@@ -387,6 +387,8 @@
 	@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 @@
 		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 @@
 	@param project Projet ouvert a rajouter au panel
 */
 void ElementsPanel::projectWasOpened(QETProject *project) {
+	addProject(project);
 	projects_to_display_ << project;
-	addProject(project);
 	emit(panelContentChanged());
 }
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/