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 // pre-first version. only for the first occurrence
if (filever[file].first.isEmpty()) { if (filever[file].first.isEmpty()) {
int verpos = shortver.lastIndexOf(QRegularExpression("[^0-9]")) + 1; int verpos = shortver.lastIndexOf(QRegularExpression("[^0-9]")) + 1;
int vernum = shortver.midRef(verpos).toInt(); int vernum = shortver.mid(verpos).toInt();
if (vernum) if (vernum)
--vernum; --vernum;
shortver.replace(verpos, shortver.length() - verpos, QString::number(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()); QTC_CHECK(!absFile.isEmpty());
const QRegularExpression reState("^\\s*\\[[^\\]]*\\]"); // [hijacked]; [loaded but missing] 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()) { if (match.hasMatch()) {
const QString ccState = match.captured(); const QString ccState = match.captured();
if (ccState.indexOf("hijacked") != -1) if (ccState.indexOf("hijacked") != -1)

View File

@@ -222,7 +222,7 @@ QString previousRevision(const QString &rev)
const int dotPos = rev.lastIndexOf(QLatin1Char('.')); const int dotPos = rev.lastIndexOf(QLatin1Char('.'));
if (dotPos == -1) if (dotPos == -1)
return rev; 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); 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()) if (strDateTime.isEmpty())
strDateTime = lineParts.at(4); strDateTime = lineParts.at(4);
if (!strDateTime.isEmpty()) { if (!strDateTime.isEmpty()) {
const qint64 timeT = strDateTime.leftRef(strDateTime.indexOf(' ')).toLongLong(); const qint64 timeT = strDateTime.left(strDateTime.indexOf(' ')).toLongLong();
dateTime = QDateTime::fromSecsSinceEpoch(timeT); dateTime = QDateTime::fromSecsSinceEpoch(timeT);
} }

View File

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

View File

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

View File

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

View File

@@ -229,7 +229,7 @@ static inline QString nextStash(const QString &stash)
if (closingBracePos == -1) if (closingBracePos == -1)
return QString(); return QString();
bool ok; 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) if (!ok)
return QString(); return QString();
QString rc = stash.left(openingBracePos + 1); QString rc = stash.left(openingBracePos + 1);

View File

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