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

@@ -267,7 +267,7 @@ static void insertPosition(QMap<int, int> *map, int position)
bool gluedWithPrev = false;
if (itNext != map->begin()) {
auto itPrev = itNext - 1;
auto itPrev = std::prev(itNext);
const int keyStart = itPrev.key();
const int keyEnd = itPrev.value();
if (position >= keyStart && position <= keyEnd)
@@ -285,7 +285,7 @@ static void insertPosition(QMap<int, int> *map, int position)
itNext = map->erase(itNext);
if (gluedWithPrev) {
// glue with prev and next
auto itPrev = itNext - 1;
auto itPrev = std::prev(itNext);
*itPrev = keyEnd;
} else {
// glue with next