From ba920143efebe3cdf568a13102666c7cd5f56877 Mon Sep 17 00:00:00 2001 From: Yuchen Deng Date: Sun, 28 Oct 2012 12:13:09 +0800 Subject: HistoryCompleter: Refactor saveEntry Change-Id: I21f4706aecc3aa7119be954709a1ce1f3b37d580 Reviewed-by: hjk --- src/libs/utils/historycompleter.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/libs/utils/historycompleter.cpp b/src/libs/utils/historycompleter.cpp index 7b297058b4..942cca8ee4 100644 --- a/src/libs/utils/historycompleter.cpp +++ b/src/libs/utils/historycompleter.cpp @@ -152,11 +152,8 @@ void HistoryCompleterPrivate::saveEntry(const QString &str) QTC_ASSERT(theSettings, return); const QString &entry = str.trimmed(); int removeIndex = list.indexOf(entry); - if (removeIndex != -1) { - beginRemoveRows(QModelIndex(), removeIndex, removeIndex); - list.removeAt(removeIndex); - endRemoveRows(); - } + if (removeIndex != -1) + removeRow(removeIndex); beginInsertRows (QModelIndex(), list.count(), list.count()); list.prepend(entry); list = list.mid(0, maxLines); -- cgit v1.2.1