Qt6: Adapt to removed QMap functionality

QMap::iterator::operator+() was removed in 14090760a8, necessitating
extra code using std::next/prev to workaround.

QMap::unite is gone, the replacement QMap::insert was only introduced
in 5.15.

QMap key values need to have an operator==() available.

Task-number: QTCREATORBUG-24098
Change-Id: Ic4cf429ab18cad58b1218180de40eb65586afd77
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
hjk
2020-08-12 09:40:51 +02:00
parent 0c4135e380
commit 89296a98a0
7 changed files with 27 additions and 11 deletions

View File

@@ -486,16 +486,16 @@ void TextEditorOverlay::mapEquivalentSelections()
m_equivalentSelections.clear();
m_equivalentSelections.resize(m_selections.size());
QMap<QString, int> all;
QMultiMap<QString, int> all;
for (int i = 0; i < m_selections.size(); ++i)
all.insertMulti(selectionText(i).toLower(), i);
all.insert(selectionText(i).toLower(), i);
const QList<QString> &uniqueKeys = all.uniqueKeys();
foreach (const QString &key, uniqueKeys) {
QList<int> indexes;
const auto cAll = all;
QMap<QString, int>::const_iterator lbit = cAll.lowerBound(key);
QMap<QString, int>::const_iterator ubit = cAll.upperBound(key);
QMultiMap<QString, int>::const_iterator lbit = cAll.lowerBound(key);
QMultiMap<QString, int>::const_iterator ubit = cAll.upperBound(key);
while (lbit != ubit) {
indexes.append(lbit.value());
++lbit;