diff options
author | Cidorvan Leite <cidorvan.leite@openbossa.org> | 2012-03-21 11:24:26 -0300 |
---|---|---|
committer | Anselmo L. S. Melo <anselmo.melo@openbossa.org> | 2012-03-22 19:39:39 +0100 |
commit | daf3e63ae52284ab0b384650c5ed43f4fc4bb208 (patch) | |
tree | 9c6af2dea9e7988058f0461ff87f307b2a4d50da | |
parent | 669c8c9eb4f35e4c1690b1ffb93a86f982c5b7dd (diff) |
Fixed UiCompletionModel filter result
The model wasn't updating the result row count.
Change-Id: I47a4da2d550458f24228bbbd4d52e6205c667a8d
Reviewed-by: Anselmo L. S. Melo <anselmo.melo@openbossa.org>
-rw-r--r-- | src/models/uicompletionmodel.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/models/uicompletionmodel.cpp b/src/models/uicompletionmodel.cpp index 9a71644..6589ad2 100644 --- a/src/models/uicompletionmodel.cpp +++ b/src/models/uicompletionmodel.cpp @@ -321,19 +321,19 @@ void UiCompletionModel::filter(const QStringList& parts) void UiCompletionModel::resetModel() { - if (rowCount() == 0) { - beginResetModel(); - endResetModel(); - return; + beginResetModel(); + + if (rowCount() > 0) { + emit layoutAboutToBeChanged(); + QModelIndexList piList = persistentIndexList(); + QModelIndexList empty; + for (int i = 0; i < piList.size(); i++) + empty.append(QModelIndex()); + changePersistentIndexList(piList, empty); + emit layoutChanged(); } - emit layoutAboutToBeChanged(); - QModelIndexList piList = persistentIndexList(); - QModelIndexList empty; - for (int i = 0; i < piList.size(); i++) - empty.append(QModelIndex()); - changePersistentIndexList(piList, empty); - emit layoutChanged(); + endResetModel(); } /*! @@ -416,9 +416,6 @@ UiCompletionModel::ModelSorting UiCompletionModel::modelSorting() const \property UiCompletionModel::completionColumn \brief the column in the model in which completions are searched for. - If the popup() is a QListView, it is automatically setup to display - this column. - By default, the match column is 0. \sa completionRole, caseSensitivity |