From b5badf97b7dcfce08e7b4c0ef70fa36e967713b8 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Sat, 13 Jul 2019 14:08:37 +0200 Subject: GenericProposalModel: Modernize and cleanup Change-Id: Iae0733c9734f63900af32c89f553d6a337b49daf Reviewed-by: Orgad Shaneh --- src/plugins/texteditor/codeassist/genericproposalmodel.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/plugins/texteditor/codeassist/genericproposalmodel.cpp b/src/plugins/texteditor/codeassist/genericproposalmodel.cpp index b5d9b00340..29efd1799d 100644 --- a/src/plugins/texteditor/codeassist/genericproposalmodel.cpp +++ b/src/plugins/texteditor/codeassist/genericproposalmodel.cpp @@ -116,12 +116,11 @@ struct ContentLessThan { bool operator()(const QChar &a, const QChar &b) { - if (a == QLatin1Char('_')) + if (a == '_') return false; - else if (b == QLatin1Char('_')) + if (b == '_') return true; - else - return a < b; + return a < b; } }; @@ -158,7 +157,7 @@ static QString cleanText(const QString &original) int ignore = 0; for (int i = clean.length() - 1; i >= 0; --i, ++ignore) { const QChar &c = clean.at(i); - if (c.isLetterOrNumber() || c == QLatin1Char('_') + if (c.isLetterOrNumber() || c == '_' || c.isHighSurrogate() || c.isLowSurrogate()) { break; } @@ -300,7 +299,7 @@ void GenericProposalModel::filter(const QString &prefix) m_currentItems.clear(); const QString lowerPrefix = prefix.toLower(); - foreach (const auto &item, m_originalItems) { + for (const auto &item : qAsConst(m_originalItems)) { const QString &text = item->text(); if (regExp.match(text).capturedStart() == 0) { m_currentItems.append(item); -- cgit v1.2.3