forked from qt-creator/qt-creator
Locator: Case sensitivity of input affects prioritizing
So far candidates were prefix matched case sensitive which led to
an unfavorable results order.
With this patch, if the input is lower case, the prioritizing happens by
a case insensitive prefix match. Otherwise the match happens case
sensitive (just like before).
Example:
Search for e.g. "m cppmodelmanager"
Top result before: AbstractEditorSupport (match at parameter type)
Top result now: CppModelManager
Change-Id: Ic27042cfe717be812a2237a3437399597c98dd74
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -222,7 +222,8 @@ QMap<QString, QUrl> HelpManager::linksForIdentifier(const QString &id) const
|
||||
}
|
||||
|
||||
// This should go into Qt 4.8 once we start using it for Qt Creator
|
||||
QStringList HelpManager::findKeywords(const QString &key, int maxHits) const
|
||||
QStringList HelpManager::findKeywords(const QString &key, Qt::CaseSensitivity caseSensitivity,
|
||||
int maxHits) const
|
||||
{
|
||||
if (d->m_needsSetup)
|
||||
return QStringList();
|
||||
@@ -251,7 +252,7 @@ QStringList HelpManager::findKeywords(const QString &key, int maxHits) const
|
||||
while (query.next()) {
|
||||
const QString &keyValue = query.value(0).toString();
|
||||
if (!keyValue.isEmpty()) {
|
||||
if (keyValue.startsWith(key, Qt::CaseInsensitive))
|
||||
if (keyValue.startsWith(key, caseSensitivity))
|
||||
keywordsToSort.insert(keyValue);
|
||||
else
|
||||
keywords.insert(keyValue);
|
||||
|
||||
Reference in New Issue
Block a user