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

@@ -1304,7 +1304,7 @@ void ClearCasePluginPrivate::diffActivity()
// pre-first version. only for the first occurrence
if (filever[file].first.isEmpty()) {
int verpos = shortver.lastIndexOf(QRegularExpression("[^0-9]")) + 1;
int vernum = shortver.midRef(verpos).toInt();
int vernum = shortver.mid(verpos).toInt();
if (vernum)
--vernum;
shortver.replace(verpos, shortver.length() - verpos, QString::number(vernum));

View File

@@ -93,7 +93,7 @@ void ClearCaseSync::processCleartoolLsLine(const QDir &viewRootDir, const QStrin
QTC_CHECK(!absFile.isEmpty());
const QRegularExpression reState("^\\s*\\[[^\\]]*\\]"); // [hijacked]; [loaded but missing]
const QRegularExpressionMatch match = reState.match(buffer.midRef(wspos + 1));
const QRegularExpressionMatch match = reState.match(buffer.mid(wspos + 1));
if (match.hasMatch()) {
const QString ccState = match.captured();
if (ccState.indexOf("hijacked") != -1)

View File

@@ -222,7 +222,7 @@ QString previousRevision(const QString &rev)
const int dotPos = rev.lastIndexOf(QLatin1Char('.'));
if (dotPos == -1)
return rev;
const int minor = rev.midRef(dotPos + 1).toInt();
const int minor = rev.mid(dotPos + 1).toInt();
return rev.left(dotPos + 1) + QString::number(minor - 1);
}

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);

View File

@@ -31,19 +31,20 @@
#include "vcsbaseeditorconfig.h"
#include "vcscommand.h"
#include <coreplugin/icore.h>
#include <coreplugin/vcsmanager.h>
#include <coreplugin/patchtool.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditorfactory.h>
#include <coreplugin/icore.h>
#include <coreplugin/patchtool.h>
#include <coreplugin/vcsmanager.h>
#include <cpaster/codepasterservice.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/editorconfiguration.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
#include <texteditor/textdocument.h>
#include <texteditor/textdocumentlayout.h>
#include <utils/porting.h>
#include <utils/progressindicator.h>
#include <utils/qtcassert.h>
@@ -1564,8 +1565,8 @@ void VcsBaseEditorWidget::addChangeActions(QMenu *, const QString &)
QSet<QString> VcsBaseEditorWidget::annotationChanges() const
{
QSet<QString> changes;
QString text = toPlainText();
QStringRef txt(&text);
const QString text = toPlainText();
StringView txt = make_stringview(text);
if (txt.isEmpty())
return changes;
if (!d->m_annotationSeparatorPattern.pattern().isEmpty()) {