[qet] [2644] Add highlight item on drag element (test it)

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


Revision: 2644
Author:   cfdev
Date:     2013-11-28 16:36:25 +0100 (Thu, 28 Nov 2013)
Log Message:
-----------
Add highlight item on drag element (test it)

Modified Paths:
--------------
    trunk/sources/elementspanel.cpp
    trunk/sources/elementspanel.h

Modified: trunk/sources/elementspanel.cpp
===================================================================
--- trunk/sources/elementspanel.cpp	2013-11-26 21:05:07 UTC (rev 2643)
+++ trunk/sources/elementspanel.cpp	2013-11-28 15:36:25 UTC (rev 2644)
@@ -97,6 +97,10 @@
 	setContextMenuPolicy(Qt::CustomContextMenu);
 	
 	setElementsCache(QETApp::collectionCache());
+	
+	// Init ptr of item treeview
+	it_ = 0;
+	it_prev_ = 0;
 }
 
 /**
@@ -131,6 +135,11 @@
 	@return la collection, la categorie ou l'element selectionne(e)
 */
 ElementsCollectionItem *ElementsPanel::selectedItem() const {
+	// change color of drag element
+	if(it_prev_) {
+		it_prev_->setBackgroundColor(0, Qt::white);
+	}
+	
 	ElementsLocation selected_location(selectedElementLocation());
 	if (!selected_location.isNull()) {
 		return(QETApp::collectionItem(selected_location));
@@ -199,6 +208,17 @@
 	}
 #endif
 	
+	// Change color on mouse over
+	it_ = itemAt(e -> pos());
+	if(it_prev_){
+		if(it_ != it_prev_){
+			it_->setBackgroundColor(0, Qt::cyan);
+			it_prev_->setBackgroundColor(0, Qt::white);
+			it_prev_ = it_;
+		}
+	}
+	else it_prev_ = it_;
+	
 	e -> accept();
 	/// @todo mettre en valeur le lieu de depot 
 }

Modified: trunk/sources/elementspanel.h
===================================================================
--- trunk/sources/elementspanel.h	2013-11-26 21:05:07 UTC (rev 2643)
+++ trunk/sources/elementspanel.h	2013-11-28 15:36:25 UTC (rev 2644)
@@ -121,5 +121,6 @@
 	int loading_progress_;                         ///< used to track the loading progress of elements collections
 	bool first_reload_;                            ///< used to distinguish the first time this panel is reloaded
 	QString filter_;                               ///< Currently applied filter
+	QTreeWidgetItem *it_prev_, *it_;
 };
 #endif


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