forked from qt-creator/qt-creator
Utils: Add sorted() function
For simpler calling code. Change-Id: Ia0a16a28770fd172f74d06a626148248bf5d3c0c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -351,13 +351,14 @@ void QmlJSEditorWidget::updateUses()
|
||||
return;
|
||||
|
||||
QList<QTextEdit::ExtraSelection> selections;
|
||||
QList<SourceLocation> locations
|
||||
= m_qmlJsEditorDocument->semanticInfo().idLocations.value(wordUnderCursor());
|
||||
|
||||
// code model may present the locations not in a document order
|
||||
Utils::sort(locations, [](const SourceLocation &lhs, const SourceLocation &rhs) {
|
||||
const QList<SourceLocation> locations = Utils::sorted(
|
||||
m_qmlJsEditorDocument->semanticInfo().idLocations.value(wordUnderCursor()),
|
||||
[](const SourceLocation &lhs, const SourceLocation &rhs) {
|
||||
return lhs.begin() < rhs.begin();
|
||||
});
|
||||
for (const SourceLocation &loc : std::as_const(locations)) {
|
||||
for (const SourceLocation &loc : locations) {
|
||||
if (! loc.isValid())
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user