VCS: Fix build with Qt6

QStringRef is gone.

Task-number: QTCREATORBUG-24098
Change-Id: I38dd1602294fcabf5cf7c1553bcfd93f3c47b601
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Eike Ziller
2020-09-18 13:16:55 +02:00
parent a1e3001fa4
commit f8ae051816
9 changed files with 18 additions and 17 deletions

View File

@@ -784,7 +784,7 @@ void BranchModel::Private::parseOutputLine(const QString &line, bool force)
if (strDateTime.isEmpty())
strDateTime = lineParts.at(4);
if (!strDateTime.isEmpty()) {
const qint64 timeT = strDateTime.leftRef(strDateTime.indexOf(' ')).toLongLong();
const qint64 timeT = strDateTime.left(strDateTime.indexOf(' ')).toLongLong();
dateTime = QDateTime::fromSecsSinceEpoch(timeT);
}

View File

@@ -117,7 +117,7 @@ void GerritPushDialog::initRemoteBranches()
continue;
const QString ref = entries.at(0).mid(remotesPrefix.size());
int refBranchIndex = ref.indexOf('/');
qint64 timeT = entries.at(1).leftRef(entries.at(1).indexOf(' ')).toLongLong();
qint64 timeT = entries.at(1).left(entries.at(1).indexOf(' ')).toLongLong();
BranchDate bd(ref.mid(refBranchIndex + 1), QDateTime::fromSecsSinceEpoch(timeT).date());
m_remoteBranches.insertMulti(ref.left(refBranchIndex), bd);
}

View File

@@ -186,8 +186,8 @@ static QString sanitizeBlameOutput(const QString &b)
forever {
QTC_CHECK(prevPos < pos);
int afterParen = prevPos + parenPos;
result.append(b.midRef(prevPos, stripPos));
result.append(b.midRef(afterParen, pos - afterParen));
result.append(b.mid(prevPos, stripPos));
result.append(b.mid(afterParen, pos - afterParen));
prevPos = pos;
QTC_CHECK(prevPos != 0);
if (pos == b.size())

View File

@@ -108,7 +108,7 @@ public:
filePath.remove(0, m_ref.length());
single.fileName = m_directory + '/' + filePath;
const int textSeparator = line.indexOf(QChar::Null, lineSeparator + 1);
single.lineNumber = line.midRef(lineSeparator + 1, textSeparator - lineSeparator - 1).toInt();
single.lineNumber = line.mid(lineSeparator + 1, textSeparator - lineSeparator - 1).toInt();
QString text = line.mid(textSeparator + 1);
QRegularExpression regexp;
QVector<Match> matches;
@@ -128,11 +128,11 @@ public:
QTC_ASSERT(matchEnd != -1, break);
const int matchLength = matchEnd - matchTextStart;
Match match(matchStart, matchLength);
const QStringRef matchText = text.midRef(matchTextStart, matchLength);
const QString matchText = text.mid(matchTextStart, matchLength);
if (m_parameters.flags & FindRegularExpression)
match.regexpCapturedTexts = regexp.match(matchText).capturedTexts();
matches.append(match);
text = text.leftRef(matchStart) + matchText + text.midRef(matchEnd + resetColor.size());
text = text.left(matchStart) + matchText + text.mid(matchEnd + resetColor.size());
}
single.matchingLine = text;

View File

@@ -229,7 +229,7 @@ static inline QString nextStash(const QString &stash)
if (closingBracePos == -1)
return QString();
bool ok;
const int n = stash.midRef(openingBracePos + 1, closingBracePos - openingBracePos - 1).toInt(&ok);
const int n = stash.mid(openingBracePos + 1, closingBracePos - openingBracePos - 1).toInt(&ok);
if (!ok)
return QString();
QString rc = stash.left(openingBracePos + 1);