From 3f42c989eefc61a232716779271ecac82e64521c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 18 Sep 2020 13:15:18 +0200 Subject: [PATCH] Fix Qt 6 build of ProjectExplorer and targets & build systems QStringRef is gone. qsizetype vs int. QMultiHash::insertMulti is gone. QXmlStreamWriter writes UTF-8 by default. Task-number: QTCREATORBUG-24098 Change-Id: Id217e40a1f17993a84fc725976e9cb84618b0580 Reviewed-by: hjk Reviewed-by: Christian Kandeler --- src/plugins/android/androidconfigurations.cpp | 4 +-- .../android/androidmanifesteditorwidget.cpp | 2 +- .../debugservers/uvsc/uvtargetdevicemodel.cpp | 14 ++++----- src/plugins/baremetal/keiltoolchain.cpp | 4 +-- .../cmakeprojectmanager/cmakeindenter.cpp | 2 +- .../cmakelocatorfilter.cpp | 2 +- src/plugins/ios/iostoolhandler.cpp | 6 ++-- src/plugins/projectexplorer/abi.cpp | 30 +++++++++---------- src/plugins/projectexplorer/abi.h | 10 +++---- .../customwizard/customwizardparameters.cpp | 16 +++++----- .../devicesupport/localprocesslist.cpp | 2 +- src/plugins/projectexplorer/expanddata.cpp | 2 ++ src/plugins/projectexplorer/extraabi.cpp | 2 +- src/plugins/projectexplorer/msvcparser.cpp | 2 +- src/plugins/projectexplorer/msvctoolchain.cpp | 4 +-- .../customwidgetwizard/classdefinition.cpp | 2 +- .../qmakeprojectmanager/qmakeparsernodes.cpp | 17 ++++++----- src/plugins/remotelinux/linuxdevice.cpp | 2 +- src/tools/iostool/iosdevicemanager.cpp | 2 +- src/tools/iostool/main.cpp | 1 - 20 files changed, 64 insertions(+), 62 deletions(-) diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 0e2cf3bb1de..105bf9d40ec 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -367,7 +367,7 @@ QVector AndroidConfig::availableNdkPlatforms(const BaseQtVersion *qtVersion while (it.hasNext()) { const QString &fileName = it.next(); availableNdkPlatforms.push_back( - fileName.midRef(fileName.lastIndexOf(QLatin1Char('-')) + 1).toInt()); + fileName.mid(fileName.lastIndexOf(QLatin1Char('-')) + 1).toInt()); } Utils::sort(availableNdkPlatforms, std::greater<>()); @@ -648,7 +648,7 @@ QString AndroidConfig::getAvdName(const QString &serialnumber) if (index == -1) return QString(); bool ok; - int port = serialnumber.midRef(index + 1).toInt(&ok); + int port = serialnumber.mid(index + 1).toInt(&ok); if (!ok) return QString(); diff --git a/src/plugins/android/androidmanifesteditorwidget.cpp b/src/plugins/android/androidmanifesteditorwidget.cpp index 8e7cf0c6bff..7902e3750dc 100644 --- a/src/plugins/android/androidmanifesteditorwidget.cpp +++ b/src/plugins/android/androidmanifesteditorwidget.cpp @@ -959,7 +959,7 @@ int extractVersion(const QString &string) int index = string.indexOf(QLatin1Char(':')); if (index == -1) return 0; - return string.midRef(4, index - 4).toInt(); + return string.mid(4, index - 4).toInt(); } void AndroidManifestEditorWidget::syncToEditor() diff --git a/src/plugins/baremetal/debugservers/uvsc/uvtargetdevicemodel.cpp b/src/plugins/baremetal/debugservers/uvsc/uvtargetdevicemodel.cpp index 8d0e610fb32..c8bf0fdea66 100644 --- a/src/plugins/baremetal/debugservers/uvsc/uvtargetdevicemodel.cpp +++ b/src/plugins/baremetal/debugservers/uvsc/uvtargetdevicemodel.cpp @@ -248,7 +248,7 @@ void DeviceSelectionModel::parsePackage(const QString &packageFile) return; QXmlStreamReader in(&f); while (in.readNextStartElement()) { - const QStringRef elementName = in.name(); + const auto elementName = in.name(); if (elementName == "package") parsePackage(in, packageFile); else @@ -264,7 +264,7 @@ void DeviceSelectionModel::parsePackage(QXmlStreamReader &in, const QString &pac child->fullPath = packageFile; child->version = extractPackVersion(packageFile); while (in.readNextStartElement()) { - const QStringRef elementName = in.name(); + const auto elementName = in.name(); if (elementName == "name") { fillElementProperty(in, child->name); } else if (elementName == "description") { @@ -275,7 +275,7 @@ void DeviceSelectionModel::parsePackage(QXmlStreamReader &in, const QString &pac fillElementProperty(in, child->url); } else if (elementName == "devices") { while (in.readNextStartElement()) { - const QStringRef elementName = in.name(); + const auto elementName = in.name(); if (elementName == "family") parseFamily(in, child); else @@ -296,7 +296,7 @@ void DeviceSelectionModel::parseFamily(QXmlStreamReader &in, DeviceSelectionItem child->name = attrs.value("Dfamily").toString(); fillVendor(attrs.value("Dvendor").toString(), child->vendorName, child->vendorId); while (in.readNextStartElement()) { - const QStringRef elementName = in.name(); + const auto elementName = in.name(); if (elementName == "processor") { fillCpu(in, child->cpu); } else if (elementName == "algorithm") { @@ -323,7 +323,7 @@ void DeviceSelectionModel::parseSubFamily(QXmlStreamReader &in, DeviceSelectionI const QXmlStreamAttributes attrs = in.attributes(); child->name = attrs.value("DsubFamily").toString(); while (in.readNextStartElement()) { - const QStringRef elementName = in.name(); + const auto elementName = in.name(); if (elementName == "processor") { fillCpu(in, child->cpu); } else if (elementName == "debug") { @@ -344,7 +344,7 @@ void DeviceSelectionModel::parseDevice(QXmlStreamReader &in, DeviceSelectionItem const QXmlStreamAttributes attrs = in.attributes(); child->name = attrs.value("Dname").toString(); while (in.readNextStartElement()) { - const QStringRef elementName = in.name(); + const auto elementName = in.name(); if (elementName == "processor") { fillCpu(in, child->cpu); } else if (elementName == "debug") { @@ -371,7 +371,7 @@ void DeviceSelectionModel::parseDeviceVariant(QXmlStreamReader &in, DeviceSelect const QXmlStreamAttributes attrs = in.attributes(); child->name = attrs.value("Dvariant").toString(); while (in.readNextStartElement()) { - const QStringRef elementName = in.name(); + const auto elementName = in.name(); if (elementName == "processor") { fillCpu(in, child->cpu); } else if (elementName == "memory") { diff --git a/src/plugins/baremetal/keiltoolchain.cpp b/src/plugins/baremetal/keiltoolchain.cpp index 96cef9a5830..ac548bf3c14 100644 --- a/src/plugins/baremetal/keiltoolchain.cpp +++ b/src/plugins/baremetal/keiltoolchain.cpp @@ -630,8 +630,8 @@ static QString extractVersion(const QString &toolsFile, const QString §ion) switch (state) { case Enter: if (hasSection) { - const auto content = line.midRef(firstBracket + 1, - lastBracket - firstBracket - 1); + const auto content = QStringView(line).mid(firstBracket + 1, + lastBracket - firstBracket - 1); if (content == section) state = Lookup; } diff --git a/src/plugins/cmakeprojectmanager/cmakeindenter.cpp b/src/plugins/cmakeprojectmanager/cmakeindenter.cpp index 4d0503482ae..c62f1c74083 100644 --- a/src/plugins/cmakeprojectmanager/cmakeindenter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeindenter.cpp @@ -85,7 +85,7 @@ static bool lineIsEmpty(const QString &line) static int paranthesesLevel(const QString &line) { - const QStringRef beforeComment = line.midRef(0, line.indexOf(QLatin1Char('#'))); + const QString beforeComment = line.mid(0, line.indexOf(QLatin1Char('#'))); const int opening = beforeComment.count(QLatin1Char('(')); const int closing = beforeComment.count(QLatin1Char(')')); if (opening == closing) diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp index 5e4008ab84c..6344c08bb27 100644 --- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp @@ -84,7 +84,7 @@ void CMakeTargetLocatorFilter::prepareSearch(const QString &entry) Core::LocatorFilterEntry filterEntry(this, target.title, extraData); filterEntry.extraInfo = path.shortNativePath(); - filterEntry.highlightInfo = {index, entry.length()}; + filterEntry.highlightInfo = {index, int(entry.length())}; filterEntry.fileName = path.toString(); m_result.append(filterEntry); diff --git a/src/plugins/ios/iostoolhandler.cpp b/src/plugins/ios/iostoolhandler.cpp index e78ec72db48..84d3d44d03f 100644 --- a/src/plugins/ios/iostoolhandler.cpp +++ b/src/plugins/ios/iostoolhandler.cpp @@ -437,7 +437,7 @@ void IosDeviceToolHandlerPrivate::processXml() // until the corresponding EndElement. Attributes are reported in attributes(), // namespace declarations in namespaceDeclarations(). { - QStringRef elName = outputParser.name(); + const auto elName = outputParser.name(); if (elName == QLatin1String("msg")) { stack.append(ParserState(ParserState::Msg)); } else if (elName == QLatin1String("exit")) { @@ -472,7 +472,7 @@ void IosDeviceToolHandlerPrivate::processXml() } else if (elName == QLatin1String("app_started")) { stack.append(ParserState(ParserState::AppStarted)); QXmlStreamAttributes attributes = outputParser.attributes(); - QStringRef statusStr = attributes.value(QLatin1String("status")); + const auto statusStr = attributes.value(QLatin1String("status")); Ios::IosToolHandler::OpStatus status = Ios::IosToolHandler::Unknown; if (statusStr.compare(QLatin1String("success"), Qt::CaseInsensitive) == 0) status = Ios::IosToolHandler::Success; @@ -482,7 +482,7 @@ void IosDeviceToolHandlerPrivate::processXml() } else if (elName == QLatin1String("app_transfer")) { stack.append(ParserState(ParserState::AppTransfer)); QXmlStreamAttributes attributes = outputParser.attributes(); - QStringRef statusStr = attributes.value(QLatin1String("status")); + const auto statusStr = attributes.value(QLatin1String("status")); Ios::IosToolHandler::OpStatus status = Ios::IosToolHandler::Unknown; if (statusStr.compare(QLatin1String("success"), Qt::CaseInsensitive) == 0) status = Ios::IosToolHandler::Success; diff --git a/src/plugins/projectexplorer/abi.cpp b/src/plugins/projectexplorer/abi.cpp index 8cc8bcb2895..7466e49088c 100644 --- a/src/plugins/projectexplorer/abi.cpp +++ b/src/plugins/projectexplorer/abi.cpp @@ -455,7 +455,7 @@ Abi Abi::abiFromTargetTriplet(const QString &triple) if (machine.isEmpty()) return Abi(); - const QVector parts = machine.splitRef(QRegularExpression("[ /-]")); + const QStringList parts = machine.split(QRegularExpression("[ /-]")); Architecture arch = UnknownArchitecture; OS os = UnknownOS; @@ -464,7 +464,7 @@ Abi Abi::abiFromTargetTriplet(const QString &triple) unsigned char width = 0; int unknownCount = 0; - for (const QStringRef &p : parts) { + for (const QString &p : parts) { if (p == "unknown" || p == "pc" || p == "gnu" || p == "uclibc" || p == "86_64" || p == "redhat" @@ -881,7 +881,7 @@ QString Abi::toString(int w) Abi Abi::fromString(const QString &abiString) { Abi::Architecture architecture = UnknownArchitecture; - const QVector abiParts = abiString.splitRef('-'); + const QStringList abiParts = abiString.split('-'); if (!abiParts.isEmpty()) { architecture = architectureFromString(abiParts.at(0)); if (abiParts.at(0) != toString(architecture)) @@ -919,7 +919,7 @@ Abi Abi::fromString(const QString &abiString) return Abi(architecture, os, flavor, format, wordWidth); } -Abi::Architecture Abi::architectureFromString(const QStringRef &a) +Abi::Architecture Abi::architectureFromString(const QString &a) { if (a == "unknown") return UnknownArchitecture; @@ -983,7 +983,7 @@ Abi::Architecture Abi::architectureFromString(const QStringRef &a) return UnknownArchitecture; } -Abi::OS Abi::osFromString(const QStringRef &o) +Abi::OS Abi::osFromString(const QString &o) { if (o == "unknown") return UnknownOS; @@ -1006,7 +1006,7 @@ Abi::OS Abi::osFromString(const QStringRef &o) return UnknownOS; } -Abi::OSFlavor Abi::osFlavorFromString(const QStringRef &of, const OS os) +Abi::OSFlavor Abi::osFlavorFromString(const QString &of, const OS os) { const int index = indexOfFlavor(of.toUtf8()); const auto flavor = OSFlavor(index); @@ -1015,7 +1015,7 @@ Abi::OSFlavor Abi::osFlavorFromString(const QStringRef &of, const OS os) return UnknownFlavor; } -Abi::BinaryFormat Abi::binaryFormatFromString(const QStringRef &bf) +Abi::BinaryFormat Abi::binaryFormatFromString(const QString &bf) { if (bf == "unknown") return UnknownFormat; @@ -1036,13 +1036,13 @@ Abi::BinaryFormat Abi::binaryFormatFromString(const QStringRef &bf) return UnknownFormat; } -unsigned char Abi::wordWidthFromString(const QStringRef &w) +unsigned char Abi::wordWidthFromString(const QString &w) { if (!w.endsWith("bit")) return 0; bool ok = false; - const QStringRef number = w.string()->midRef(w.position(), w.count() - 3); + const QString number = w.left(w.size() - 3); const int bitCount = number.toInt(&ok); if (!ok) return 0; @@ -1187,7 +1187,7 @@ Abis Abi::abisOfBinary(const Utils::FilePath &path) const QString fileName = QString::fromLocal8Bit(data.mid(0, 16)); quint64 fileNameOffset = 0; if (fileName.startsWith("#1/")) - fileNameOffset = fileName.midRef(3).toInt(); + fileNameOffset = fileName.mid(3).toInt(); const QString fileLength = QString::fromLatin1(data.mid(48, 10)); int toSkip = 60 + fileNameOffset; @@ -1237,19 +1237,19 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiRoundTrips() { for (int i = 0; i <= Abi::UnknownArchitecture; ++i) { const QString string = Abi::toString(static_cast(i)); - const Abi::Architecture arch = Abi::architectureFromString(QStringRef(&string)); + const Abi::Architecture arch = Abi::architectureFromString(string); QCOMPARE(static_cast(i), arch); } for (int i = 0; i <= Abi::UnknownOS; ++i) { const QString string = Abi::toString(static_cast(i)); - const Abi::OS os = Abi::osFromString(QStringRef(&string)); + const Abi::OS os = Abi::osFromString(string); QCOMPARE(static_cast(i), os); } for (const Abi::OSFlavor flavorIt : Abi::allOsFlavors()) { const QString string = Abi::toString(flavorIt); for (int os = 0; os <= Abi::UnknownOS; ++os) { const auto osEnum = static_cast(os); - const Abi::OSFlavor flavor = Abi::osFlavorFromString(QStringRef(&string), osEnum); + const Abi::OSFlavor flavor = Abi::osFlavorFromString(string, osEnum); if (isGenericFlavor(flavorIt) && flavor != Abi::UnknownFlavor) QVERIFY(isGenericFlavor(flavor)); else if (flavor == Abi::UnknownFlavor && flavorIt != Abi::UnknownFlavor) @@ -1260,12 +1260,12 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiRoundTrips() } for (int i = 0; i <= Abi::UnknownFormat; ++i) { QString string = Abi::toString(static_cast(i)); - Abi::BinaryFormat format = Abi::binaryFormatFromString(QStringRef(&string)); + Abi::BinaryFormat format = Abi::binaryFormatFromString(string); QCOMPARE(static_cast(i), format); } for (unsigned char i : {0, 8, 16, 32, 64}) { QString string = Abi::toString(i); - unsigned char wordwidth = Abi::wordWidthFromString(QStringRef(&string)); + unsigned char wordwidth = Abi::wordWidthFromString(string); QCOMPARE(i, wordwidth); } } diff --git a/src/plugins/projectexplorer/abi.h b/src/plugins/projectexplorer/abi.h index 16862db5051..3657c75d08d 100644 --- a/src/plugins/projectexplorer/abi.h +++ b/src/plugins/projectexplorer/abi.h @@ -168,11 +168,11 @@ public: static QString toString(const BinaryFormat &bf); static QString toString(int w); - static Architecture architectureFromString(const QStringRef &a); - static OS osFromString(const QStringRef &o); - static OSFlavor osFlavorFromString(const QStringRef &of, const OS os); - static BinaryFormat binaryFormatFromString(const QStringRef &bf); - static unsigned char wordWidthFromString(const QStringRef &w); + static Architecture architectureFromString(const QString &a); + static OS osFromString(const QString &o); + static OSFlavor osFlavorFromString(const QString &of, const OS os); + static BinaryFormat binaryFormatFromString(const QString &bf); + static unsigned char wordWidthFromString(const QString &w); static OSFlavor registerOsFlavor(const std::vector &oses, const QString &flavorName); static QList flavorsForOs(const OS &o); diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp index ec29cfe5634..c85aa111366 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp @@ -247,7 +247,7 @@ static inline bool assignLanguageElementText(QXmlStreamReader &reader, const QString &desiredLanguage, QString *target) { - const QStringRef elementLanguage = reader.attributes().value(QLatin1String(langAttributeC)); + const auto elementLanguage = reader.attributes().value(QLatin1String(langAttributeC)); if (elementLanguage.isEmpty()) { // Try to find a translation for our built-in Wizards *target = QCoreApplication::translate("ProjectExplorer::CustomWizard", reader.readElementText().toLatin1().constData()); @@ -268,7 +268,7 @@ static bool parseCustomProjectElement(QXmlStreamReader &reader, const QString &language, CustomWizardParameters *p) { - const QStringRef elementName = reader.name(); + const auto elementName = reader.name(); if (elementName == QLatin1String(iconElementC)) { const QString path = reader.readElementText(); const QIcon icon = wizardIcon(configFileFullPath, path); @@ -308,7 +308,7 @@ static inline QMap attributesToStringMap(const QXmlStreamAttri } // Switch parser state depending on opening element name. -static ParseState nextOpeningState(ParseState in, const QStringRef &name) +static ParseState nextOpeningState(ParseState in, const QStringView &name) { switch (in) { case ParseBeginning: @@ -375,7 +375,7 @@ static ParseState nextOpeningState(ParseState in, const QStringRef &name) } // Switch parser state depending on closing element name. -static ParseState nextClosingState(ParseState in, const QStringRef &name) +static ParseState nextClosingState(ParseState in, const QStringView &name) { switch (in) { case ParseBeginning: @@ -443,7 +443,7 @@ static ParseState nextClosingState(ParseState in, const QStringRef &name) // Parse kind attribute static inline IWizardFactory::WizardKind kindAttribute(const QXmlStreamReader &r) { - const QStringRef value = r.attributes().value(QLatin1String(kindAttributeC)); + const auto value = r.attributes().value(QLatin1String(kindAttributeC)); if (value == QLatin1String("file") || value == QLatin1String("class")) return IWizardFactory::FileWizard; return IWizardFactory::ProjectWizard; @@ -462,7 +462,7 @@ static inline QSet readRequiredFeatures(const QXmlStreamReader &reader) static inline IWizardFactory::WizardFlags wizardFlags(const QXmlStreamReader &reader) { IWizardFactory::WizardFlags flags; - const QStringRef value = reader.attributes().value(QLatin1String(platformIndependentC)); + const auto value = reader.attributes().value(QLatin1String(platformIndependentC)); if (!value.isEmpty() && value == QLatin1String("true")) flags |= IWizardFactory::PlatformIndependent; @@ -481,7 +481,7 @@ static inline QString msgError(const QXmlStreamReader &reader, static inline bool booleanAttributeValue(const QXmlStreamReader &r, const char *nameC, bool defaultValue) { - const QStringRef attributeValue = r.attributes().value(QLatin1String(nameC)); + const auto attributeValue = r.attributes().value(QLatin1String(nameC)); if (attributeValue.isEmpty()) return defaultValue; return attributeValue == QLatin1String("true"); @@ -489,7 +489,7 @@ static inline bool booleanAttributeValue(const QXmlStreamReader &r, const char * static inline int integerAttributeValue(const QXmlStreamReader &r, const char *name, int defaultValue) { - const QStringRef sValue = r.attributes().value(QLatin1String(name)); + const auto sValue = r.attributes().value(QLatin1String(name)); if (sValue.isEmpty()) return defaultValue; bool ok; diff --git a/src/plugins/projectexplorer/devicesupport/localprocesslist.cpp b/src/plugins/projectexplorer/devicesupport/localprocesslist.cpp index 46249f1c242..fe917785793 100644 --- a/src/plugins/projectexplorer/devicesupport/localprocesslist.cpp +++ b/src/plugins/projectexplorer/devicesupport/localprocesslist.cpp @@ -174,7 +174,7 @@ static QList getLocalProcessesUsingPs() if (cmdSep > 0) { const int argsSep = line.indexOf(blank, cmdSep + 1); DeviceProcessItem procData; - procData.pid = line.leftRef(pidSep).toInt(); + procData.pid = line.left(pidSep).toInt(); procData.cmdLine = line.mid(cmdSep + 1); if (argsSep == -1) procData.exe = line.mid(cmdSep + 1); diff --git a/src/plugins/projectexplorer/expanddata.cpp b/src/plugins/projectexplorer/expanddata.cpp index 605377f50da..bf3876475d7 100644 --- a/src/plugins/projectexplorer/expanddata.cpp +++ b/src/plugins/projectexplorer/expanddata.cpp @@ -25,6 +25,8 @@ #include "expanddata.h" +#include + using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; diff --git a/src/plugins/projectexplorer/extraabi.cpp b/src/plugins/projectexplorer/extraabi.cpp index 434994125c7..855d4a9e9c9 100644 --- a/src/plugins/projectexplorer/extraabi.cpp +++ b/src/plugins/projectexplorer/extraabi.cpp @@ -86,7 +86,7 @@ void ExtraAbi::load() const QStringList osNames = it.value().toStringList(); std::vector oses; for (const QString &osName : osNames) { - Abi::OS os = Abi::osFromString(&osName); + Abi::OS os = Abi::osFromString(osName); if (Abi::toString(os) != osName) qWarning() << "Invalid OS found when registering extra abi flavor" << it.key(); else diff --git a/src/plugins/projectexplorer/msvcparser.cpp b/src/plugins/projectexplorer/msvcparser.cpp index cd0dd41fc2c..0208b801d2d 100644 --- a/src/plugins/projectexplorer/msvcparser.cpp +++ b/src/plugins/projectexplorer/msvcparser.cpp @@ -51,7 +51,7 @@ static QPair parseFileName(const QString &input) if (endPos < 0) endPos = fileName.size() - 1; bool ok = false; - const int n = fileName.midRef(pos + 1, endPos - pos - 1).toInt(&ok); + const int n = fileName.mid(pos + 1, endPos - pos - 1).toInt(&ok); if (ok) { fileName = fileName.left(pos); linenumber = n; diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index c3af541a2c2..406405ee851 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -2117,9 +2117,9 @@ MsvcToolChain::WarningFlagAdder::WarningFlagAdder(const QString &flag, WarningFl } bool ok = false; if (m_doesEnable) - m_warningCode = flag.midRef(2).toInt(&ok); + m_warningCode = flag.mid(2).toInt(&ok); else - m_warningCode = flag.midRef(3).toInt(&ok); + m_warningCode = flag.mid(3).toInt(&ok); if (!ok) m_triggered = true; } diff --git a/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.cpp b/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.cpp index 0407387dc22..b11dd256fd9 100644 --- a/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.cpp +++ b/src/plugins/qmakeprojectmanager/customwidgetwizard/classdefinition.cpp @@ -79,7 +79,7 @@ static inline QString xmlFromClassName(const QString &name) if (!name.isEmpty()) { rc += name.left(1).toLower(); if (name.size() > 1) - rc += name.midRef(1); + rc += name.mid(1); } rc += QLatin1String("\">\n\n"); return rc; diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp index 126ef39bcb5..f8d2151ea28 100644 --- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp @@ -782,7 +782,10 @@ QPair QmakePriFile::readProFile() QMakeVfs vfs; QtSupport::ProMessageHandler handler; QMakeParser parser(nullptr, &vfs, &handler); - includeFile = parser.parsedProBlock(QStringRef(&contents), 0, filePath().toString(), 1); + includeFile = parser.parsedProBlock(Utils::make_stringview(contents), + 0, + filePath().toString(), + 1); } return qMakePair(includeFile, lines); } @@ -828,13 +831,11 @@ bool QmakePriFile::renameFile(const QString &oldName, const QString &newName, Ch // Reparse necessary due to changed contents. QMakeParser parser(nullptr, nullptr, nullptr); - ProFile * const proFile = parser.parsedProBlock( - QStringRef(¤tContents), - 0, - filePath().toString(), - 1, - QMakeParser::FullGrammar - ); + ProFile *const proFile = parser.parsedProBlock(Utils::make_stringview(currentContents), + 0, + filePath().toString(), + 1, + QMakeParser::FullGrammar); QTC_ASSERT(proFile, return); // The file should still be valid after what we did. ProWriter::addFiles(proFile, ¤tLines, {newName}, loc.first, continuationIndent()); diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index 238beb0f460..1292e4fbbba 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -97,7 +97,7 @@ private: continue; } bool ok; - const int pid = elements.first().midRef(6).toInt(&ok); + const int pid = elements.first().mid(6).toInt(&ok); if (!ok) { qDebug("%s: Expected number in %s. Line was '%s'.", Q_FUNC_INFO, qPrintable(elements.first()), qPrintable(visualizeNull(line))); diff --git a/src/tools/iostool/iosdevicemanager.cpp b/src/tools/iostool/iosdevicemanager.cpp index f3f1c444c6f..7003710d9d1 100644 --- a/src/tools/iostool/iosdevicemanager.cpp +++ b/src/tools/iostool/iosdevicemanager.cpp @@ -799,7 +799,7 @@ void IosDeviceManagerPrivate::deviceWithId(QString deviceId, int timeout, pendingLookup->timer.setSingleShot(true); pendingLookup->timer.setInterval(timeout); QObject::connect(&(pendingLookup->timer), &QTimer::timeout, q, &IosDeviceManager::checkPendingLookups); - m_pendingLookups.insertMulti(deviceId, pendingLookup); + m_pendingLookups.insert(deviceId, pendingLookup); pendingLookup->timer.start(); } enum GdbServerStatus { diff --git a/src/tools/iostool/main.cpp b/src/tools/iostool/main.cpp index 6195888d37f..b62b2a9b93b 100644 --- a/src/tools/iostool/main.cpp +++ b/src/tools/iostool/main.cpp @@ -521,7 +521,6 @@ IosTool::IosTool(QObject *parent): { outFile.open(stdout, QIODevice::WriteOnly, QFileDevice::DontCloseHandle); out.setAutoFormatting(true); - out.setCodec("UTF-8"); } IosTool::~IosTool()