Sort value of search field in dialog to link report/master

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3545 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2014-12-12 18:39:12 +00:00
parent 6ec416c351
commit 57edc4be80
2 changed files with 11 additions and 3 deletions

View File

@@ -152,6 +152,9 @@ void ElementSelectorWidget::buildInterface() {
* 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 @@ void ElementSelectorWidget::buildInterface() {
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();
}
@@ -240,8 +245,9 @@ void ElementSelectorWidget::filtered(const QString &str) {
}
else {
for (int i = 0; i<in_filter.size(); i++) {
if (in_filter.at(i).contains(str, Qt::CaseInsensitive))
if (in_filter.at(i).contains(str, Qt::CaseInsensitive)) {
content_list.at(i)->setHidden(false);
}
else
content_list.at(i)->setHidden(true);
}

View File

@@ -193,7 +193,9 @@ void LinkSingleElementWidget::setUpCompleter() {
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);
}