TextEditor: Fix compile with Qt6

toStdList() has been removed in Qt6.
Amends a2dadb3d0b.

Change-Id: Id2032d7e0a0c3345614bc56d98152c41f199af07
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Stenger
2021-05-04 09:18:21 +02:00
committed by David Schulz
parent 4c375e31a3
commit 1e019b1c1e

View File

@@ -128,20 +128,17 @@ QTextCursor SnippetOverlay::previousSelectionCursor(const QTextCursor &cursor) c
if (previousVariableIndex < 0) if (previousVariableIndex < 0)
previousVariableIndex = m_variables.size(); previousVariableIndex = m_variables.size();
auto equivalents = m_variables[previousVariableIndex].toStdList(); const QList<int> &equivalents = m_variables[previousVariableIndex];
equivalents.reverse(); for (int i = equivalents.size() - 1; i >= 0; --i) {
for (int selectionIndex : equivalents) { if (selections.at(equivalents.at(i)).m_cursor_end.position() < cursor.position())
if (selections[selectionIndex].m_cursor_end.position() < cursor.position()) return cursorForIndex(equivalents.at(i));
return cursorForIndex(selectionIndex);
} }
return cursorForIndex(m_variables[previousVariableIndex].last()); return cursorForIndex(m_variables[previousVariableIndex].last());
} }
// currently not over a variable simply select the previous available one // currently not over a variable simply select the previous available one
auto reverse = selections.toStdList(); for (int i = selections.size() - 1; i >= 0; --i) {
reverse.reverse(); if (selections.at(i).m_cursor_end.position() < cursor.position())
for (const OverlaySelection &candidate : reverse) { return cursorForIndex(i);
if (candidate.m_cursor_end.position() < cursor.position())
return cursorForSelection(candidate);
} }
return cursorForSelection(selections.last()); return cursorForSelection(selections.last());
} }