diff options
author | Eike Ziller <eike.ziller@qt.io> | 2020-09-18 13:18:30 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2020-09-18 14:41:32 +0000 |
commit | 6225d33c282fc56d1c7b634bdeef04bccf6a914a (patch) | |
tree | a975cea0e29c1a7dc7aa7369015aad1426a5ad60 /src | |
parent | 2a70bc1d0983b9c26c3db513e37410bcabc73d90 (diff) | |
download | qt-creator-6225d33c282fc56d1c7b634bdeef04bccf6a914a.tar.gz |
Fix build issues with Qt6
Change from QStringRef to QStringView at various places.
Task-number: QTCREATORBUG-24098
Change-Id: Ia7a634fa26464fbb2962724d5f0e188cecc68801
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/autotest/catch/catchoutputreader.cpp | 4 | ||||
-rw-r--r-- | src/plugins/autotest/qtest/qttestoutputreader.cpp | 10 | ||||
-rw-r--r-- | src/plugins/autotest/qtest/qttestresult.cpp | 2 | ||||
-rw-r--r-- | src/plugins/beautifier/abstractsettings.cpp | 8 | ||||
-rw-r--r-- | src/plugins/bookmarks/bookmarkmanager.cpp | 2 | ||||
-rw-r--r-- | src/plugins/cpaster/fileshareprotocol.cpp | 2 | ||||
-rw-r--r-- | src/plugins/cpaster/pastebindotcomprotocol.cpp | 7 | ||||
-rw-r--r-- | src/plugins/fakevim/fakevimhandler.cpp | 2 | ||||
-rw-r--r-- | src/plugins/glsleditor/glslhighlighter.cpp | 8 | ||||
-rw-r--r-- | src/plugins/glsleditor/glslhighlighter.h | 2 | ||||
-rw-r--r-- | src/plugins/imageviewer/multiexportdialog.cpp | 6 | ||||
-rw-r--r-- | src/plugins/nim/editor/nimindenter.cpp | 6 | ||||
-rw-r--r-- | src/plugins/valgrind/callgrind/callgrindparsedata.cpp | 4 | ||||
-rw-r--r-- | src/plugins/valgrind/callgrind/callgrindparser.cpp | 2 | ||||
-rw-r--r-- | src/plugins/valgrind/xmlprotocol/parser.cpp | 22 |
15 files changed, 46 insertions, 41 deletions
diff --git a/src/plugins/autotest/catch/catchoutputreader.cpp b/src/plugins/autotest/catch/catchoutputreader.cpp index 68d4f0b260..60dea45cd5 100644 --- a/src/plugins/autotest/catch/catchoutputreader.cpp +++ b/src/plugins/autotest/catch/catchoutputreader.cpp @@ -133,14 +133,14 @@ void CatchOutputReader::processOutputLine(const QByteArray &outputLineWithNewLin break; } case QXmlStreamReader::Characters: { - const QStringRef text = m_xmlReader.text(); + const auto text = m_xmlReader.text(); if (m_currentTagName == CatchXml::ExpandedElement) { m_currentExpression.append(text); } break; } case QXmlStreamReader::EndElement: { - const QStringRef currentTag = m_xmlReader.name(); + const auto currentTag = m_xmlReader.name(); if (currentTag == CatchXml::SectionElement) { sendResult(ResultType::TestEnd); diff --git a/src/plugins/autotest/qtest/qttestoutputreader.cpp b/src/plugins/autotest/qtest/qttestoutputreader.cpp index 548aa6636b..b262ade27d 100644 --- a/src/plugins/autotest/qtest/qttestoutputreader.cpp +++ b/src/plugins/autotest/qtest/qttestoutputreader.cpp @@ -49,7 +49,7 @@ static QString decode(const QString& original) const QRegularExpressionMatch match = it.next(); const QString value = match.captured(1); if (value.startsWith('x')) - result.replace(match.captured(0), QChar(value.midRef(1).toInt(nullptr, 16))); + result.replace(match.captured(0), QChar(value.mid(1).toInt(nullptr, 16))); else result.replace(match.captured(0), QChar(value.toInt(nullptr, 10))); } @@ -267,7 +267,7 @@ void QtTestOutputReader::processXMLOutput(const QByteArray &outputLine) } case QXmlStreamReader::Characters: { m_expectTag = false; - QStringRef text = m_xmlReader.text().trimmed(); + const QStringView text = m_xmlReader.text().trimmed(); if (text.isEmpty()) break; @@ -278,7 +278,7 @@ void QtTestOutputReader::processXMLOutput(const QByteArray &outputLine) case Description: if (!m_description.isEmpty()) m_description.append('\n'); - m_description.append(text); + m_description.append(text.toString()); break; case QtVersion: m_description = trQtVersion(text.toString()); @@ -299,7 +299,7 @@ void QtTestOutputReader::processXMLOutput(const QByteArray &outputLine) case QXmlStreamReader::EndElement: { m_expectTag = true; m_cdataMode = None; - const QStringRef currentTag = m_xmlReader.name(); + const QStringView currentTag = m_xmlReader.name(); if (currentTag == QStringLiteral("TestFunction")) { sendFinishMessage(true); m_futureInterface.setProgressValue(m_futureInterface.progressValue() + 1); @@ -434,7 +434,7 @@ void QtTestOutputReader::processResultOutput(const QString &result, const QStrin if (!description.isEmpty()) { if (!m_description.isEmpty()) m_description.append('\n'); - m_description.append(description.midRef(1)); // cut the first whitespace + m_description.append(description.mid(1)); // cut the first whitespace } m_formerTestCase = m_testCase; } diff --git a/src/plugins/autotest/qtest/qttestresult.cpp b/src/plugins/autotest/qtest/qttestresult.cpp index 44daaf4aeb..a0a360651d 100644 --- a/src/plugins/autotest/qtest/qttestresult.cpp +++ b/src/plugins/autotest/qtest/qttestresult.cpp @@ -67,7 +67,7 @@ const QString QtTestResult::outputString(bool selected) const int breakPos = desc.indexOf('('); output.append(": ").append(desc.left(breakPos)); if (selected) - output.append('\n').append(desc.midRef(breakPos)); + output.append('\n').append(desc.mid(breakPos)); } break; default: diff --git a/src/plugins/beautifier/abstractsettings.cpp b/src/plugins/beautifier/abstractsettings.cpp index ab3a880afe..3c65322bc1 100644 --- a/src/plugins/beautifier/abstractsettings.cpp +++ b/src/plugins/beautifier/abstractsettings.cpp @@ -333,13 +333,13 @@ void AbstractSettings::readDocumentation() QStringList keys; while (!(xml.atEnd() || xml.hasError())) { if (xml.readNext() == QXmlStreamReader::StartElement) { - const QStringRef &name = xml.name(); - if (name == Constants::DOCUMENTATION_XMLENTRY) { + const QStringView &name = xml.name(); + if (name == QLatin1String(Constants::DOCUMENTATION_XMLENTRY)) { keys.clear(); - } else if (name == Constants::DOCUMENTATION_XMLKEY) { + } else if (name == QLatin1String(Constants::DOCUMENTATION_XMLKEY)) { if (xml.readNext() == QXmlStreamReader::Characters) keys << xml.text().toString(); - } else if (name == Constants::DOCUMENTATION_XMLDOC) { + } else if (name == QLatin1String(Constants::DOCUMENTATION_XMLDOC)) { if (xml.readNext() == QXmlStreamReader::Characters) { m_docu << xml.text().toString(); const int index = m_docu.size() - 1; diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index 2eea0235ea..01f76026f8 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -743,7 +743,7 @@ void BookmarkManager::addBookmark(const QString &s) if (index3 != -1 || index2 != -1 || index1 != -1) { const QString &filePath = s.mid(index1+1, index2-index1-1); const QString ¬e = s.mid(index3 + 1); - const int lineNumber = s.midRef(index2 + 1, index3 - index2 - 1).toInt(); + const int lineNumber = s.mid(index2 + 1, index3 - index2 - 1).toInt(); if (!filePath.isEmpty() && !findBookmark(FilePath::fromString(filePath), lineNumber)) { auto b = new Bookmark(lineNumber, this); b->updateFileName(FilePath::fromString(filePath)); diff --git a/src/plugins/cpaster/fileshareprotocol.cpp b/src/plugins/cpaster/fileshareprotocol.cpp index 937165a3f2..3669a1c7b7 100644 --- a/src/plugins/cpaster/fileshareprotocol.cpp +++ b/src/plugins/cpaster/fileshareprotocol.cpp @@ -101,7 +101,7 @@ static bool parse(const QString &fileName, QXmlStreamReader reader(&file); while (!reader.atEnd()) { if (reader.readNext() == QXmlStreamReader::StartElement) { - const QStringRef elementName = reader.name(); + const auto elementName = reader.name(); // Check start element if (elementCount == 0 && elementName != QLatin1String(pasterElementC)) { *errorMessage = FileShareProtocol::tr("%1 does not appear to be a paster file.").arg(fileName); diff --git a/src/plugins/cpaster/pastebindotcomprotocol.cpp b/src/plugins/cpaster/pastebindotcomprotocol.cpp index ed4db9cf46..6b95871a77 100644 --- a/src/plugins/cpaster/pastebindotcomprotocol.cpp +++ b/src/plugins/cpaster/pastebindotcomprotocol.cpp @@ -25,6 +25,7 @@ #include "pastebindotcomprotocol.h" +#include <utils/porting.h> #include <utils/qtcassert.h> #include <QDebug> @@ -149,7 +150,7 @@ void PasteBinDotComProtocol::fetch(const QString &id) QString link = QLatin1String(PASTEBIN_BASE) + QLatin1String(PASTEBIN_RAW); if (id.startsWith(QLatin1String("http://"))) - link.append(id.midRef(id.lastIndexOf(QLatin1Char('/')) + 1)); + link.append(id.mid(id.lastIndexOf(QLatin1Char('/')) + 1)); else link.append(id); @@ -227,7 +228,7 @@ QDebug operator<<(QDebug d, const QXmlStreamAttributes &al) static inline ParseState nextOpeningState(ParseState current, const QXmlStreamReader &reader) { - const QStringRef &element = reader.name(); + const auto element = reader.name(); switch (current) { case OutSideTable: // Trigger on main table only. @@ -259,7 +260,7 @@ static inline ParseState nextOpeningState(ParseState current, const QXmlStreamRe return ParseError; } -static inline ParseState nextClosingState(ParseState current, const QStringRef &element) +static inline ParseState nextClosingState(ParseState current, const Utils::StringView &element) { switch (current) { case OutSideTable: diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 0af3938b79..80b1611b8d 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -5551,7 +5551,7 @@ bool FakeVimHandler::Private::handleExSubstituteCommand(const ExCommand &cmd) if (cmd.cmd.isEmpty()) { // keep previous substitution flags on '&&' and '~&' if (line.size() > 1 && line[1] == '&') - g.lastSubstituteFlags += line.midRef(2); + g.lastSubstituteFlags += line.mid(2); else g.lastSubstituteFlags = line.mid(1); if (line[0] == '~') diff --git a/src/plugins/glsleditor/glslhighlighter.cpp b/src/plugins/glsleditor/glslhighlighter.cpp index 0ec949e05c..7eb0d03fa4 100644 --- a/src/plugins/glsleditor/glslhighlighter.cpp +++ b/src/plugins/glsleditor/glslhighlighter.cpp @@ -27,9 +27,12 @@ #include "glsleditor.h" #include <glsl/glsllexer.h> #include <glsl/glslparser.h> + #include <texteditor/textdocumentlayout.h> #include <texteditor/textdocument.h> +#include <utils/porting.h> + #include <QDebug> using namespace TextEditor; @@ -151,7 +154,8 @@ void GlslHighlighter::highlightBlock(const QString &text) highlightLine(text, tk.begin(), tk.length, formatForCategory(C_PREPROCESSOR)); highlightAsPreprocessor = true; - } else if (highlightCurrentWordAsPreprocessor && isPPKeyword(text.midRef(tk.begin(), tk.length))) { + } else if (highlightCurrentWordAsPreprocessor + && isPPKeyword(Utils::midView(text, tk.begin(), tk.length))) { setFormat(tk.begin(), tk.length, formatForCategory(C_PREPROCESSOR)); } else if (tk.is(GLSL::Parser::T_NUMBER)) { @@ -256,7 +260,7 @@ void GlslHighlighter::highlightLine(const QString &text, int position, int lengt } } -bool GlslHighlighter::isPPKeyword(const QStringRef &text) const +bool GlslHighlighter::isPPKeyword(const QStringView &text) const { switch (text.length()) { diff --git a/src/plugins/glsleditor/glslhighlighter.h b/src/plugins/glsleditor/glslhighlighter.h index 2b29818aca..868705efad 100644 --- a/src/plugins/glsleditor/glslhighlighter.h +++ b/src/plugins/glsleditor/glslhighlighter.h @@ -40,7 +40,7 @@ public: protected: void highlightBlock(const QString &text) override; void highlightLine(const QString &text, int position, int length, const QTextCharFormat &format); - bool isPPKeyword(const QStringRef &text) const; + bool isPPKeyword(const QStringView &text) const; }; } // namespace Internal diff --git a/src/plugins/imageviewer/multiexportdialog.cpp b/src/plugins/imageviewer/multiexportdialog.cpp index c47768434e..36876e8f14 100644 --- a/src/plugins/imageviewer/multiexportdialog.cpp +++ b/src/plugins/imageviewer/multiexportdialog.cpp @@ -54,7 +54,7 @@ static const int standardIconSizesValues[] = {16, 24, 32, 48, 64, 128, 256}; // Helpers to convert a size specifications from QString to QSize // and vv. The format is '2x4' or '4' as shortcut for '4x4'. -static QSize sizeFromString(const QStringRef &r) +static QSize sizeFromString(const QString &r) { if (r.isEmpty()) return {}; @@ -104,9 +104,9 @@ static QVector<QSize> stringToSizes(const QString &s) { QVector<QSize> result; const QString trimmed = s.trimmed(); - const QVector<QStringRef> &sizes = trimmed.splitRef(',', Qt::SkipEmptyParts); + const QStringList &sizes = trimmed.split(',', Qt::SkipEmptyParts); result.reserve(sizes.size()); - for (const QStringRef &sizeSpec : sizes) { + for (const QString &sizeSpec : sizes) { const QSize size = sizeFromString(sizeSpec); if (!size.isValid() || size.isEmpty()) return {}; diff --git a/src/plugins/nim/editor/nimindenter.cpp b/src/plugins/nim/editor/nimindenter.cpp index 7cf24f3c0f..cb1522b4dc 100644 --- a/src/plugins/nim/editor/nimindenter.cpp +++ b/src/plugins/nim/editor/nimindenter.cpp @@ -109,13 +109,13 @@ bool NimIndenter::startsBlock(const QString &line, int state) const // electric characters start a new block, and are operators if (previous.type == NimLexer::TokenType::Operator) { - QStringRef ref = line.midRef(previous.begin, previous.length); + QStringView ref = QStringView(line).mid(previous.begin, previous.length); return ref.isEmpty() ? false : electricCharacters().contains(ref.at(0)); } // some keywords starts a new block if (previous.type == NimLexer::TokenType::Keyword) { - QStringRef ref = line.midRef(previous.begin, previous.length); + QStringView ref = QStringView(line).mid(previous.begin, previous.length); return ref == QLatin1String("type") || ref == QLatin1String("var") || ref == QLatin1String("let") @@ -140,7 +140,7 @@ bool NimIndenter::endsBlock(const QString &line, int state) const // Some keywords end a block if (previous.type == NimLexer::TokenType::Keyword) { - QStringRef ref = line.midRef(previous.begin, previous.length); + QStringView ref = QStringView(line).mid(previous.begin, previous.length); return ref == QLatin1String("return") || ref == QLatin1String("break") || ref == QLatin1String("continue"); diff --git a/src/plugins/valgrind/callgrind/callgrindparsedata.cpp b/src/plugins/valgrind/callgrind/callgrindparsedata.cpp index 186df0676b..55398ce79a 100644 --- a/src/plugins/valgrind/callgrind/callgrindparsedata.cpp +++ b/src/plugins/valgrind/callgrind/callgrindparsedata.cpp @@ -182,9 +182,9 @@ QString ParseData::prettyStringForEvent(const QString &event) type = ParseData::Private::tr("Instruction"); else if (event.at(0) == 'D') type = ParseData::Private::tr("Cache"); - else if (event.leftRef(2) == "Bc") + else if (event.left(2) == "Bc") type = ParseData::Private::tr("Conditional branches"); - else if (event.leftRef(2) == "Bi") + else if (event.left(2) == "Bi") type = ParseData::Private::tr("Indirect branches"); QStringList prettyString; diff --git a/src/plugins/valgrind/callgrind/callgrindparser.cpp b/src/plugins/valgrind/callgrind/callgrindparser.cpp index 60e604f9b9..f481ff2dd9 100644 --- a/src/plugins/valgrind/callgrind/callgrindparser.cpp +++ b/src/plugins/valgrind/callgrind/callgrindparser.cpp @@ -321,7 +321,7 @@ void Parser::Private::parseHeader(QIODevice *device) } else if (line.startsWith("summary: ")) { QString values = getValue(line, 9); uint i = 0; - foreach (const QStringRef &value, values.splitRef(' ', Qt::SkipEmptyParts)) + foreach (const QString &value, values.split(' ', Qt::SkipEmptyParts)) data->setTotalCost(i++, value.toULongLong()); } else if (!line.trimmed().isEmpty()) { // handle line and exit parseHeader diff --git a/src/plugins/valgrind/xmlprotocol/parser.cpp b/src/plugins/valgrind/xmlprotocol/parser.cpp index 81208327c0..e405911247 100644 --- a/src/plugins/valgrind/xmlprotocol/parser.cpp +++ b/src/plugins/valgrind/xmlprotocol/parser.cpp @@ -303,7 +303,7 @@ XWhat Parser::Private::parseXWhat() blockingReadNext(); if (reader.isEndElement()) break; - const QStringRef name = reader.name(); + const auto name = reader.name(); if (name == "text") what.text = blockingReadElementText(); else if (name == "leakedbytes") @@ -325,7 +325,7 @@ XauxWhat Parser::Private::parseXauxWhat() blockingReadNext(); if (reader.isEndElement()) break; - const QStringRef name = reader.name(); + const auto name = reader.name(); if (name == "text") what.text = blockingReadElementText(); else if (name == "file") @@ -433,7 +433,7 @@ void Parser::Private::parseError() break; if (reader.isStartElement()) lastAuxWhat++; - const QStringRef name = reader.name(); + const auto name = reader.name(); if (name == "unique") { e.setUnique(parseHex(blockingReadElementText(), "unique")); } else if (name == "tid") { @@ -504,7 +504,7 @@ Frame Parser::Private::parseFrame() if (reader.isEndElement()) break; if (reader.isStartElement()) { - const QStringRef name = reader.name(); + const auto name = reader.name(); if (name == "ip") frame.setInstructionPointer(parseHex(blockingReadElementText(), "error/frame/ip")); else if (name == "obj") @@ -534,7 +534,7 @@ void Parser::Private::parseAnnounceThread() if (reader.isEndElement()) break; if (reader.isStartElement()) { - const QStringRef name = reader.name(); + const auto name = reader.name(); if (name == "hthreadid") at.setHelgrindThreadId(parseInt64(blockingReadElementText(), "announcethread/hthreadid")); else if (name == "stack") @@ -562,7 +562,7 @@ void Parser::Private::parseErrorCounts() if (reader.isEndElement()) break; if (reader.isStartElement()) { - const QStringRef name = reader.name(); + const auto name = reader.name(); if (name == "unique") unique = parseHex(blockingReadElementText(), "errorcounts/pair/unique"); else if (name == "count") @@ -595,7 +595,7 @@ void Parser::Private::parseSuppressionCounts() if (reader.isEndElement()) break; if (reader.isStartElement()) { - const QStringRef name = reader.name(); + const auto name = reader.name(); if (name == "name") pairName = blockingReadElementText(); else if (name == "count") @@ -621,7 +621,7 @@ void Parser::Private::parseStatus() if (reader.isEndElement()) break; if (reader.isStartElement()) { - const QStringRef name = reader.name(); + const auto name = reader.name(); if (name == "state") s.setState(parseState(blockingReadElementText())); else if (name == "time") @@ -659,7 +659,7 @@ SuppressionFrame Parser::Private::parseSuppressionFrame() if (reader.isEndElement()) break; if (reader.isStartElement()) { - const QStringRef name = reader.name(); + const auto name = reader.name(); if (name == "obj") frame.setObject(blockingReadElementText()); else if (name == "fun") @@ -681,7 +681,7 @@ Suppression Parser::Private::parseSuppression() if (reader.isEndElement()) break; if (reader.isStartElement()) { - const QStringRef name = reader.name(); + const auto name = reader.name(); if (name == "sname") supp.setName(blockingReadElementText()); else if (name == "skind") @@ -707,7 +707,7 @@ void Parser::Private::parse(QIODevice *device) try { while (notAtEnd()) { blockingReadNext(); - QStringRef name = reader.name(); + const auto name = reader.name(); if (name == "error") parseError(); else if (name == "announcethread") |