[qet] [3545] Sort value of search field in dialog to link report/master

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


Revision: 3545
Author:   blacksun
Date:     2014-12-12 19:39:12 +0100 (Fri, 12 Dec 2014)
Log Message:
-----------
Sort value of search field in dialog to link report/master

Modified Paths:
--------------
    trunk/sources/ui/elementselectorwidget.cpp
    trunk/sources/ui/linksingleelementwidget.cpp

Modified: trunk/sources/ui/elementselectorwidget.cpp
===================================================================
--- trunk/sources/ui/elementselectorwidget.cpp	2014-12-12 13:27:13 UTC (rev 3544)
+++ trunk/sources/ui/elementselectorwidget.cpp	2014-12-12 18:39:12 UTC (rev 3545)
@@ -152,6 +152,9 @@
 			 * we add this text to the button label and provide it through the filter
 			 */
 		if (elmt -> linkType() & Element::AllReport) {
+				//Add empty string to keep the same index with content_list
+				//see how work filtered for more detail why we need this
+			in_filter << "";
 				//Report have one terminal, but we check it to prevent assert.
 			if (!elmt -> terminals().isEmpty()) {
 					//We must to have at least one conductor
@@ -166,6 +169,8 @@
 
 					if (QET::eachStrIsEqual(str_list)) {
 						button_text = tr("N\260 fil : ") + str_list.first() + "\n";
+							//Replace the last empty string by the conductor text
+						in_filter.pop_back();
 						in_filter  << str_list.first();
 						out_filter << str_list.first();
 					}
@@ -239,9 +244,10 @@
 		foreach (QWidget *w, content_list) w->setHidden(false);
 	}
 	else {
-		for (int i =0; i<in_filter.size(); i++) {
-			if (in_filter.at(i).contains(str, Qt::CaseInsensitive))
+		for (int i = 0; i<in_filter.size(); i++) {
+			if (in_filter.at(i).contains(str, Qt::CaseInsensitive)) {
 				content_list.at(i)->setHidden(false);
+			}
 			else
 				content_list.at(i)->setHidden(true);
 		}

Modified: trunk/sources/ui/linksingleelementwidget.cpp
===================================================================
--- trunk/sources/ui/linksingleelementwidget.cpp	2014-12-12 13:27:13 UTC (rev 3544)
+++ trunk/sources/ui/linksingleelementwidget.cpp	2014-12-12 18:39:12 UTC (rev 3545)
@@ -193,7 +193,9 @@
 		search_field -> clear();
 		delete search_field -> completer();
 
-		QCompleter *comp = new QCompleter(esw_ -> filter(), search_field);
+		QStringList filter = esw_->filter();
+		filter.sort();
+		QCompleter *comp = new QCompleter(filter, search_field);
 		comp -> setCaseSensitivity(Qt::CaseInsensitive);
 		search_field -> setCompleter(comp);
 	}


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