Utils: Fix build with Qt6

Do not use QStringRef related API, replace with QStringView where
appropriate.

Adapt to removal of QAbstractItemView::viewOptions().

Task-number: QTCREATORBUG-24098
Change-Id: I5a7a9821984583222083733f91b46df39c21d592
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2020-09-07 10:08:59 +02:00
parent 3dd224c466
commit 7e8c3e91a1
10 changed files with 30 additions and 20 deletions

View File

@@ -78,7 +78,7 @@ static int commonOverlap(const QString &text1, const QString &text2)
const int text2Count = text2.count();
const int maxCount = qMin(text1Count, text2Count);
while (i < maxCount) {
if (text1.midRef(text1Count - maxCount + i) == text2.leftRef(maxCount - i))
if (QStringView(text1).mid(text1Count - maxCount + i) == QStringView(text2).left(maxCount - i))
return maxCount - i;
i++;
}
@@ -298,7 +298,7 @@ QList<Diff> Differ::moveWhitespaceIntoEqualities(const QList<Diff> &input)
}
if (j > 0) {
// diff starts with j whitespaces, move them to the previous diff
previousDiff.text.append(diff.text.leftRef(j));
previousDiff.text.append(diff.text.left(j));
diff.text = diff.text.mid(j);
}
}