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)
previousVariableIndex = m_variables.size();
auto equivalents = m_variables[previousVariableIndex].toStdList();
equivalents.reverse();
for (int selectionIndex : equivalents) {
if (selections[selectionIndex].m_cursor_end.position() < cursor.position())
return cursorForIndex(selectionIndex);
const QList<int> &equivalents = m_variables[previousVariableIndex];
for (int i = equivalents.size() - 1; i >= 0; --i) {
if (selections.at(equivalents.at(i)).m_cursor_end.position() < cursor.position())
return cursorForIndex(equivalents.at(i));
}
return cursorForIndex(m_variables[previousVariableIndex].last());
}
// currently not over a variable simply select the previous available one
auto reverse = selections.toStdList();
reverse.reverse();
for (const OverlaySelection &candidate : reverse) {
if (candidate.m_cursor_end.position() < cursor.position())
return cursorForSelection(candidate);
for (int i = selections.size() - 1; i >= 0; --i) {
if (selections.at(i).m_cursor_end.position() < cursor.position())
return cursorForIndex(i);
}
return cursorForSelection(selections.last());
}