diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index d6a4162272..a2bce693fc 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -364,8 +364,9 @@ void QCompletionModel::setFiltered(bool filtered) { if (showAll == !filtered) return; + beginResetModel(); showAll = !filtered; - resetModel(); + endResetModel(); } bool QCompletionModel::hasChildren(const QModelIndex &parent) const @@ -410,30 +411,14 @@ void QCompletionModel::invalidate() void QCompletionModel::filter(const QStringList& parts) { Q_D(QCompletionModel); + beginResetModel(); engine->filter(parts); - resetModel(); + endResetModel(); if (d->model->canFetchMore(engine->curParent)) d->model->fetchMore(engine->curParent); } -void QCompletionModel::resetModel() -{ - if (rowCount() == 0) { - beginResetModel(); - endResetModel(); - return; - } - - emit layoutAboutToBeChanged(); - QModelIndexList piList = persistentIndexList(); - QModelIndexList empty; - for (int i = 0; i < piList.size(); i++) - empty.append(QModelIndex()); - changePersistentIndexList(piList, empty); - emit layoutChanged(); -} - ////////////////////////////////////////////////////////////////////////////// void QCompletionEngine::filter(const QStringList& parts) { diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h index b74122665d..dcfe489cc3 100644 --- a/src/widgets/util/qcompleter_p.h +++ b/src/widgets/util/qcompleter_p.h @@ -224,7 +224,6 @@ public: int currentRow() const { return engine->curRow; } bool setCurrentRow(int row); QModelIndex currentIndex(bool) const; - void resetModel(); QModelIndex index(int row, int column, const QModelIndex & = QModelIndex()) const; int rowCount(const QModelIndex &index = QModelIndex()) const;