Pārlūkot izejas kodu

BUG: Fixed missing list elements problem

When there are two strings with the only difference that one is longer (e.g., "Label Statistics" and "Label Statistics (BRAINS)") then one of them is missing from the search results.

The problem was that QAbstractItemModel::match was used for checking if the string is already in the model and by default Match uses Qt::MatchStartsWith option.

Fixed by using Qt::MatchFixedString.
Andras Lasso 10 gadi atpakaļ
vecāks
revīzija
6ab9b11f25
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      Libs/Widgets/ctkMenuComboBox.cpp

+ 1 - 1
Libs/Widgets/ctkMenuComboBox.cpp

@@ -248,7 +248,7 @@ void ctkMenuComboBoxPrivate::addActionToCompleter(QAction *action)
     this->SearchCompleter->sourceModel());
   Q_ASSERT(model);
   QModelIndex start = model->index(0,0);
-  QModelIndexList indexList = model->match(start, 0, action->text());
+  QModelIndexList indexList = model->match(start, 0, action->text(), 1, Qt::MatchFixedString|Qt::MatchWrap);
   if (indexList.count())
     {
     return;