diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-08-01 20:52:58 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-08-02 11:08:25 +0000 |
commit | 8d8e60436da8103f98147c45a9c6da7cd31fcb80 (patch) | |
tree | 72ec53ab1b9866bce511ca86d44a966c3d01bd3d /src | |
parent | 9098bcd7061a3378c10b82cef1aec79d03f0d97f (diff) |
ProjectExplorer: Simplify return statements
Change-Id: Ifef006cd2dcc567097ce16376eab9ccedb092f04
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src')
40 files changed, 91 insertions, 100 deletions
diff --git a/src/plugins/projectexplorer/abi.cpp b/src/plugins/projectexplorer/abi.cpp index 88efb96659..165eaf2b58 100644 --- a/src/plugins/projectexplorer/abi.cpp +++ b/src/plugins/projectexplorer/abi.cpp @@ -196,7 +196,7 @@ static Abi macAbiForCpu(quint32 type) { case 0x01000000 + 12: // CPU_TYPE_ARM64 return Abi(Abi::ArmArchitecture, Abi::DarwinOS, Abi::GenericFlavor, Abi::MachOFormat, 64); default: - return Abi(); + return {}; } } @@ -451,7 +451,7 @@ Abi Abi::abiFromTargetTriplet(const QString &triple) { const QString machine = triple.toLower(); if (machine.isEmpty()) - return Abi(); + return {}; const QStringList parts = machine.split(QRegularExpression("[ /-]")); @@ -873,7 +873,7 @@ Abi Abi::fromString(const QString &abiString) if (!abiParts.isEmpty()) { architecture = architectureFromString(abiParts.at(0)); if (abiParts.at(0) != toString(architecture)) - return Abi(); + return {}; } Abi::OS os = UnknownOS; diff --git a/src/plugins/projectexplorer/addrunconfigdialog.cpp b/src/plugins/projectexplorer/addrunconfigdialog.cpp index b0b502f9ed..fa5b0bbb91 100644 --- a/src/plugins/projectexplorer/addrunconfigdialog.cpp +++ b/src/plugins/projectexplorer/addrunconfigdialog.cpp @@ -52,7 +52,7 @@ private: } return displayPath.isEmpty() ? Tr::tr("[none]") : displayPath.toUserOutput(); } - return QVariant(); + return {}; } const RunConfigurationCreationInfo m_creationInfo; diff --git a/src/plugins/projectexplorer/buildconfiguration.cpp b/src/plugins/projectexplorer/buildconfiguration.cpp index 4fe82b14cd..2d8afbd4fd 100644 --- a/src/plugins/projectexplorer/buildconfiguration.cpp +++ b/src/plugins/projectexplorer/buildconfiguration.cpp @@ -546,9 +546,8 @@ bool BuildConfiguration::isEnabled() const QString BuildConfiguration::disabledReason() const { - if (!buildSystem()->hasParsingData()) - return (Tr::tr("The project was not parsed successfully.")); - return QString(); + return buildSystem()->hasParsingData() ? QString() + : Tr::tr("The project was not parsed successfully."); } bool BuildConfiguration::regenerateBuildFiles(Node *node) diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp index c63181bc6e..516bab9f57 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp @@ -199,13 +199,13 @@ static inline QIcon wizardIcon(const QString &configFileFullPath, if (fi.isFile() && fi.isAbsolute()) return QIcon(fi.absoluteFilePath()); if (!fi.isRelative()) - return QIcon(); + return {}; // Expand by config path const QFileInfo absFi(QFileInfo(configFileFullPath).absolutePath() + QLatin1Char('/') + xmlIconFileName); if (absFi.isFile()) return QIcon(absFi.absoluteFilePath()); - return QIcon(); + return {}; } // Forward a reader over element text @@ -929,13 +929,13 @@ QString CustomWizardContext::processFile(const FieldReplacementMap &fm, QString if (!errorMessage.isEmpty()) { qWarning("Error processing custom widget file: %s\nFile:\n%s", qPrintable(errorMessage), qPrintable(in)); - return QString(); + return {}; } if (!Utils::TemplateEngine::preprocessText(in, &out, &errorMessage)) { qWarning("Error preprocessing custom widget file: %s\nFile:\n%s", qPrintable(errorMessage), qPrintable(in)); - return QString(); + return {}; } return out; } diff --git a/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp b/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp index 7d1174839d..bfc8f46ae9 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardscriptgenerator.cpp @@ -27,7 +27,7 @@ namespace Internal { QStringList fixGeneratorScript(const QString &configFile, QString binary) { if (binary.isEmpty()) - return QStringList(); + return {}; // Expand to full path if it is relative and in the wizard // directory, else assume it can be found in path. QFileInfo binaryInfo(binary); diff --git a/src/plugins/projectexplorer/dependenciespanel.cpp b/src/plugins/projectexplorer/dependenciespanel.cpp index daac52b8d7..5c6990b67d 100644 --- a/src/plugins/projectexplorer/dependenciespanel.cpp +++ b/src/plugins/projectexplorer/dependenciespanel.cpp @@ -81,7 +81,7 @@ QVariant DependenciesModel::data(const QModelIndex &index, int role) const case Qt::DecorationRole: return Utils::FileIconProvider::icon(p->projectFilePath()); default: - return QVariant(); + return {}; } } diff --git a/src/plugins/projectexplorer/deploymentdataview.cpp b/src/plugins/projectexplorer/deploymentdataview.cpp index 5c13cb3acf..c513c9cd19 100644 --- a/src/plugins/projectexplorer/deploymentdataview.cpp +++ b/src/plugins/projectexplorer/deploymentdataview.cpp @@ -45,7 +45,7 @@ public: { if (role == Qt::DisplayRole || role == Qt::EditRole) return column == 0 ? file.localFilePath().toUserOutput() : file.remoteDirectory(); - return QVariant(); + return {}; } bool setData(int column, const QVariant &data, int role) override diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp index 9880559796..4f9e07ee64 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp @@ -73,7 +73,7 @@ DesktopDevice::~DesktopDevice() = default; IDevice::DeviceInfo DesktopDevice::deviceInformation() const { - return DeviceInfo(); + return {}; } IDeviceWidget *DesktopDevice::createWidget() diff --git a/src/plugins/projectexplorer/devicesupport/devicemanagermodel.cpp b/src/plugins/projectexplorer/devicesupport/devicemanagermodel.cpp index 30e1235420..edb9999d6a 100644 --- a/src/plugins/projectexplorer/devicesupport/devicemanagermodel.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicemanagermodel.cpp @@ -141,9 +141,9 @@ int DeviceManagerModel::rowCount(const QModelIndex &parent) const QVariant DeviceManagerModel::data(const QModelIndex &index, int role) const { if (!index.isValid() || index.row() >= rowCount()) - return QVariant(); + return {}; if (role != Qt::DisplayRole && role != Qt::UserRole) - return QVariant(); + return {}; const IDevice::ConstPtr dev = device(index.row()); if (role == Qt::UserRole) return dev->id().toSetting(); diff --git a/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp b/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp index b5d138dfc9..bd73abf085 100644 --- a/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp +++ b/src/plugins/projectexplorer/devicesupport/deviceprocessesdialog.cpp @@ -259,7 +259,7 @@ ProcessInfo DeviceProcessesDialogPrivate::selectedProcess() const { const QModelIndexList indexes = procView->selectionModel()->selectedIndexes(); if (indexes.empty() || !processList) - return ProcessInfo(); + return {}; return processList->at(proxyModel.mapToSource(indexes.first()).row()); } diff --git a/src/plugins/projectexplorer/devicesupport/processlist.cpp b/src/plugins/projectexplorer/devicesupport/processlist.cpp index 2d69fb404e..b707b9b256 100644 --- a/src/plugins/projectexplorer/devicesupport/processlist.cpp +++ b/src/plugins/projectexplorer/devicesupport/processlist.cpp @@ -118,7 +118,7 @@ QVariant DeviceProcessTreeItem::data(int column, int role) const else return process.commandLine; } - return QVariant(); + return {}; } void ProcessList::setFinished() diff --git a/src/plugins/projectexplorer/devicesupport/sshsettings.cpp b/src/plugins/projectexplorer/devicesupport/sshsettings.cpp index b5f247609e..d428c4640a 100644 --- a/src/plugins/projectexplorer/devicesupport/sshsettings.cpp +++ b/src/plugins/projectexplorer/devicesupport/sshsettings.cpp @@ -114,7 +114,7 @@ static FilePath filePathValue(const FilePath &value, const QStringList &candidat if (!filePath.isEmpty()) return filePath; } - return FilePath(); + return {}; } // Keep read locker locked while calling this method diff --git a/src/plugins/projectexplorer/extracompiler.cpp b/src/plugins/projectexplorer/extracompiler.cpp index bbd34a798f..1d0cb76568 100644 --- a/src/plugins/projectexplorer/extracompiler.cpp +++ b/src/plugins/projectexplorer/extracompiler.cpp @@ -350,12 +350,12 @@ GroupItem ProcessExtraCompiler::taskItemImpl(const ContentProvider &provider) FilePath ProcessExtraCompiler::workingDirectory() const { - return FilePath(); + return {}; } QStringList ProcessExtraCompiler::arguments() const { - return QStringList(); + return {}; } bool ProcessExtraCompiler::prepareToRun(const QByteArray &sourceContents) diff --git a/src/plugins/projectexplorer/filterkitaspectsdialog.cpp b/src/plugins/projectexplorer/filterkitaspectsdialog.cpp index b773f59abc..389165976b 100644 --- a/src/plugins/projectexplorer/filterkitaspectsdialog.cpp +++ b/src/plugins/projectexplorer/filterkitaspectsdialog.cpp @@ -48,7 +48,7 @@ private: return displayName(); if (column == 1 && role == Qt::CheckStateRole) return m_enabled ? Qt::Checked : Qt::Unchecked; - return QVariant(); + return {}; } bool setData(int column, const QVariant &data, int role) override diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index cb05e25a38..ccbf9f8db8 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -1670,7 +1670,7 @@ QString ClangToolChain::sysRoot() const { const MingwToolChain *parentTC = mingwToolChainFromId(m_parentToolChainId); if (!parentTC) - return QString(); + return {}; const FilePath mingwCompiler = parentTC->compilerCommand(); return mingwCompiler.parentDir().parentDir().toString(); diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp index 8204f7aaa2..b7207ce45e 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp @@ -59,7 +59,7 @@ private: QVariant data(int column, int role) const override { if (column != 0 || role != Qt::DisplayRole) - return QVariant(); + return {}; return m_candidate->file.filePath().toUserOutput(); } @@ -192,7 +192,7 @@ JsonWizard::GeneratorFiles JsonWizard::generateFileList() Tr::tr("The wizard failed to generate files.<br>" "The error message was: \"%1\".").arg(errorMessage)); reject(); - return GeneratorFiles(); + return {}; } QList<GeneratorFile *> projectFiles; @@ -216,7 +216,7 @@ QString JsonWizard::stringValue(const QString &n) const { QVariant v = value(n); if (!v.isValid()) - return QString(); + return {}; if (v.typeId() == QVariant::String) { QString tmp = m_expander.expand(v.toString()); @@ -271,7 +271,7 @@ QVariant JsonWizard::value(const QString &n) const return v; if (hasField(n)) return field(n); // Cannot contain macros! - return QVariant(); + return {}; } bool JsonWizard::boolFromVariant(const QVariant &v, MacroExpander *expander) @@ -287,7 +287,7 @@ QString JsonWizard::stringListToArrayString(const QStringList &list, const Macro { // Todo: Handle ' embedded in the strings better. if (list.isEmpty()) - return QString(); + return {}; QStringList tmp = Utils::transform(list, [expander](const QString &i) { return expander->expand(i).replace(QLatin1Char('\''), QLatin1String("\\'")); diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp index fa6f044f07..80a0b8e0dc 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp @@ -660,7 +660,7 @@ QList<QVariant> JsonWizardFactory::objectOrList(const QVariant &data, QString *e QString JsonWizardFactory::localizedString(const QVariant &value) { if (value.isNull()) - return QString(); + return {}; if (value.typeId() == QVariant::Map) { QVariantMap tmp = value.toMap(); const QString locale = languageSetting().toLower(); @@ -671,7 +671,7 @@ QString JsonWizardFactory::localizedString(const QVariant &value) if (!result.isEmpty()) return result; } - return QString(); + return {}; } return Tr::tr(value.toByteArray()); } @@ -871,7 +871,7 @@ QVariant JsonWizardFactoryJsExtension::value(const QString &name) const return Id::toStringList(m_availableFeatures); if (name == "Plugins") return Id::toStringList(m_pluginFeatures); - return QVariant(); + return {}; } } // namespace Internal diff --git a/src/plugins/projectexplorer/kitinformation.cpp b/src/plugins/projectexplorer/kitinformation.cpp index 2b881a4716..84c203ddcf 100644 --- a/src/plugins/projectexplorer/kitinformation.cpp +++ b/src/plugins/projectexplorer/kitinformation.cpp @@ -149,7 +149,7 @@ Utils::Id SysRootKitAspect::id() FilePath SysRootKitAspect::sysRoot(const Kit *k) { if (!k) - return FilePath(); + return {}; if (!k->value(SysRootKitAspect::id()).toString().isEmpty()) return FilePath::fromString(k->value(SysRootKitAspect::id()).toString()); @@ -158,8 +158,7 @@ FilePath SysRootKitAspect::sysRoot(const Kit *k) if (!tc->sysRoot().isEmpty()) return FilePath::fromString(tc->sysRoot()); } - - return FilePath(); + return {}; } void SysRootKitAspect::setSysRoot(Kit *k, const FilePath &v) @@ -584,7 +583,7 @@ QByteArray ToolChainKitAspect::toolChainId(const Kit *k, Id language) { QTC_ASSERT(ToolChainManager::isLoaded(), return nullptr); if (!k) - return QByteArray(); + return {}; QVariantMap value = k->value(ToolChainKitAspect::id()).toMap(); return value.value(language.toString(), QByteArray()).toByteArray(); } @@ -977,7 +976,7 @@ QVariant DeviceKitAspect::defaultValue(const Kit *k) const return dev->id().toString(); } // Fail: No device set up. - return QString(); + return {}; } Tasks DeviceKitAspect::validate(const Kit *k) const @@ -1544,7 +1543,7 @@ EnvironmentItems EnvironmentKitAspect::environmentChanges(const Kit *k) { if (k) return EnvironmentItem::fromStringList(k->value(EnvironmentKitAspect::id()).toStringList()); - return EnvironmentItems(); + return {}; } void EnvironmentKitAspect::setEnvironmentChanges(Kit *k, const EnvironmentItems &changes) diff --git a/src/plugins/projectexplorer/kitmanager.cpp b/src/plugins/projectexplorer/kitmanager.cpp index 86a3b533c1..7c1eaa83f0 100644 --- a/src/plugins/projectexplorer/kitmanager.cpp +++ b/src/plugins/projectexplorer/kitmanager.cpp @@ -702,19 +702,19 @@ QList<OutputLineParser *> KitAspect::createOutputParsers(const Kit *k) const QString KitAspect::displayNamePostfix(const Kit *k) const { Q_UNUSED(k) - return QString(); + return {}; } QSet<Id> KitAspect::supportedPlatforms(const Kit *k) const { Q_UNUSED(k) - return QSet<Id>(); + return {}; } QSet<Id> KitAspect::availableFeatures(const Kit *k) const { Q_UNUSED(k) - return QSet<Id>(); + return {}; } void KitAspect::addToMacroExpander(Kit *k, MacroExpander *expander) const @@ -816,7 +816,7 @@ QString KitFeatureProvider::displayNameForPlatform(Id id) const QTC_CHECK(!dn.isEmpty()); return dn; } - return QString(); + return {}; } } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/kitoptionspage.cpp b/src/plugins/projectexplorer/kitoptionspage.cpp index db578a403e..24bafc0eeb 100644 --- a/src/plugins/projectexplorer/kitoptionspage.cpp +++ b/src/plugins/projectexplorer/kitoptionspage.cpp @@ -230,11 +230,11 @@ void KitOptionsPageWidget::updateState() QModelIndex KitOptionsPageWidget::currentIndex() const { if (!m_selectionModel) - return QModelIndex(); + return {}; QModelIndexList idxs = m_selectionModel->selectedRows(); if (idxs.count() != 1) - return QModelIndex(); + return {}; return idxs.at(0); } diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index 9b90effa3b..2e692287eb 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -116,7 +116,7 @@ static QString platformName(MsvcToolChain::Platform t) { if (const MsvcPlatform *p = platformEntry(t)) return QLatin1String(p->name); - return QString(); + return {}; } static bool hostPrefersPlatform(MsvcToolChain::Platform platform) @@ -2120,7 +2120,7 @@ std::optional<QString> MsvcToolChain::generateEnvironmentSettings(const Utils::E saver.write("@echo " + marker.toLocal8Bit() + "\r\n"); if (!saver.finalize()) { qWarning("%s: %s", Q_FUNC_INFO, qPrintable(saver.errorString())); - return QString(); + return {}; } Utils::Process run; @@ -2161,13 +2161,13 @@ std::optional<QString> MsvcToolChain::generateEnvironmentSettings(const Utils::E const int start = stdOut.indexOf(marker); if (start == -1) { qWarning("Could not find start marker in stdout output."); - return QString(); + return {}; } const int end = stdOut.indexOf(marker, start + 1); if (end == -1) { qWarning("Could not find end marker in stdout output."); - return QString(); + return {}; } const QString output = stdOut.mid(start, end - start); diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index c541d04773..85a3850447 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -725,7 +725,7 @@ FilePath Project::projectDirectory() const FilePath Project::projectDirectory(const FilePath &top) { if (top.isEmpty()) - return FilePath(); + return {}; return top.absolutePath(); } @@ -1232,10 +1232,10 @@ void Project::addVariablesToMacroExpander(const QByteArray &prefix, //: %1 is something like "Active project" ::PE::Tr::tr("%1: Variables in the active build environment.") .arg(descriptor), - [bcGetter](const QString &var) { + [bcGetter](const QString &var) -> QString { if (BuildConfiguration *const bc = bcGetter()) return bc->environment().expandedValueForKey(var); - return QString(); + return {}; }); expander->registerVariable(fullPrefix + "RunConfig:Name", @@ -1245,7 +1245,7 @@ void Project::addVariablesToMacroExpander(const QByteArray &prefix, [rcGetter]() -> QString { if (const RunConfiguration *const rc = rcGetter()) return rc->displayName(); - return QString(); + return {}; }); expander->registerFileVariables(fullPrefix + "RunConfig:Executable", //: %1 is something like "Active project" @@ -1262,25 +1262,25 @@ void Project::addVariablesToMacroExpander(const QByteArray &prefix, ::PE::Tr::tr( "%1: Variables in the environment of the active run configuration.") .arg(descriptor), - [rcGetter](const QString &var) { + [rcGetter](const QString &var) -> QString { if (const RunConfiguration *const rc = rcGetter()) { if (const auto envAspect = rc->aspect<EnvironmentAspect>()) return envAspect->environment().expandedValueForKey(var); } - return QString(); + return {}; }); expander->registerVariable(fullPrefix + "RunConfig:WorkingDir", //: %1 is something like "Active project" ::PE::Tr::tr( "%1: Working directory of the active run configuration.") .arg(descriptor), - [rcGetter] { + [rcGetter]() -> QString { if (const RunConfiguration *const rc = rcGetter()) { if (const auto wdAspect = rc->aspect<WorkingDirectoryAspect>()) return wdAspect->workingDirectory().toString(); } - return QString(); + return {}; }); } diff --git a/src/plugins/projectexplorer/projectmacro.cpp b/src/plugins/projectexplorer/projectmacro.cpp index 471cf65939..9dfe0e2b16 100644 --- a/src/plugins/projectexplorer/projectmacro.cpp +++ b/src/plugins/projectexplorer/projectmacro.cpp @@ -24,8 +24,7 @@ QByteArray Macro::toByteArray() const case MacroType::Undefine: return QByteArray("#undef ") + key; case MacroType::Invalid: break; } - - return QByteArray(); + return {}; } QByteArray Macro::toByteArray(const Macros ¯os) diff --git a/src/plugins/projectexplorer/projectmanager.cpp b/src/plugins/projectexplorer/projectmanager.cpp index e1e8175b2f..007efe1333 100644 --- a/src/plugins/projectexplorer/projectmanager.cpp +++ b/src/plugins/projectexplorer/projectmanager.cpp @@ -406,14 +406,14 @@ QString ProjectManagerPrivate::sessionTitle(const FilePath &filePath) } else { return sessionName.isEmpty() ? Tr::tr("Untitled") : sessionName; } - return QString(); + return {}; } QString ProjectManagerPrivate::locationInProject(const FilePath &filePath) { const Project *project = ProjectManager::projectForFile(filePath); if (!project) - return QString(); + return {}; const FilePath parentDir = filePath.parentDir(); if (parentDir == project->projectDirectory()) diff --git a/src/plugins/projectexplorer/projectmodels.cpp b/src/plugins/projectexplorer/projectmodels.cpp index e8ef6139d7..698fcc54da 100644 --- a/src/plugins/projectexplorer/projectmodels.cpp +++ b/src/plugins/projectexplorer/projectmodels.cpp @@ -190,7 +190,7 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const { const Node * const node = nodeForIndex(index); if (!node) - return QVariant(); + return {}; const FolderNode * const folderNode = node->asFolderNode(); const ContainerNode * const containerNode = node->asContainerNode(); @@ -247,8 +247,7 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const case Project::isParsingRole: return project && bs ? bs->isParsing() && !project->needsConfiguration() : false; } - - return QVariant(); + return {}; } Qt::ItemFlags FlatModel::flags(const QModelIndex &index) const diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp index e5c8a9a3c6..11ab5fe056 100644 --- a/src/plugins/projectexplorer/projectnodes.cpp +++ b/src/plugins/projectexplorer/projectnodes.cpp @@ -911,7 +911,7 @@ bool ProjectNode::addSubProject(const FilePath &proFilePath) QStringList ProjectNode::subProjectFileNamePatterns() const { - return QStringList(); + return {}; } bool ProjectNode::removeSubProject(const FilePath &proFilePath) diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h index 0e0068ba7b..25868d0ed7 100644 --- a/src/plugins/projectexplorer/projectnodes.h +++ b/src/plugins/projectexplorer/projectnodes.h @@ -142,7 +142,7 @@ public: virtual ContainerNode *asContainerNode() { return nullptr; } virtual const ContainerNode *asContainerNode() const { return nullptr; } - virtual QString buildKey() const { return QString(); } + virtual QString buildKey() const { return {}; } static bool sortByPath(const Node *a, const Node *b); void setParentFolderNode(FolderNode *parentFolder); diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp index 1b2b1b1edc..4fb585dee5 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.cpp +++ b/src/plugins/projectexplorer/projectwelcomepage.cpp @@ -81,10 +81,10 @@ QVariant ProjectModel::data(const QModelIndex &index, int role) const const Id projectBase = PROJECT_BASE_ID; if (Command *cmd = ActionManager::command(projectBase.withSuffix(index.row() + 1))) return cmd->keySequence().toString(QKeySequence::NativeText); - return QVariant(); + return {}; } default: - return QVariant(); + return {}; } } diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index a69ee4c855..1ad0b256a2 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -246,8 +246,7 @@ QVariant MiscSettingsPanelItem::data(int column, int role) const if (role == ActiveItemRole) // We are the active one. return QVariant::fromValue<TreeItem *>(const_cast<MiscSettingsPanelItem *>(this)); - - return QVariant(); + return {}; } Qt::ItemFlags MiscSettingsPanelItem::flags(int column) const @@ -300,7 +299,7 @@ public: if (0 <= m_currentPanelIndex && m_currentPanelIndex < childCount()) return childAt(m_currentPanelIndex)->data(column, role); } - return QVariant(); + return {}; } bool setData(int column, const QVariant &data, int role) override @@ -363,7 +362,7 @@ public: if (m_currentChildIndex == 1) return m_miscItem->data(column, role); } - return QVariant(); + return {}; } bool setData(int column, const QVariant &dat, int role) override diff --git a/src/plugins/projectexplorer/projectwizardpage.cpp b/src/plugins/projectexplorer/projectwizardpage.cpp index 75f573430d..d8a815a754 100644 --- a/src/plugins/projectexplorer/projectwizardpage.cpp +++ b/src/plugins/projectexplorer/projectwizardpage.cpp @@ -108,7 +108,7 @@ QVariant AddNewTree::data(int, int role) const case Qt::UserRole: return QVariant::fromValue(static_cast<void*>(node())); default: - return QVariant(); + return {}; } } @@ -201,7 +201,7 @@ QString BestNodeSelector::deployingProjects() const { if (m_deploys) return m_deployText; - return QString(); + return {}; } // -------------------------------------------------------------------- diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp index f0d4a7fe3b..c8418d8279 100644 --- a/src/plugins/projectexplorer/runcontrol.cpp +++ b/src/plugins/projectexplorer/runcontrol.cpp @@ -1771,7 +1771,7 @@ QString RunWorker::userMessageForProcessError(QProcess::ProcessError error, cons // "The last waitFor...() function timed out. " // "The state of QProcess is unchanged, and you can try calling " // "waitFor...() again." - return QString(); // sic! + return {}; // sic! case QProcess::WriteError: msg = Tr::tr("An error occurred when attempting to write " "to the process. For example, the process may not be running, " diff --git a/src/plugins/projectexplorer/selectablefilesmodel.cpp b/src/plugins/projectexplorer/selectablefilesmodel.cpp index de5b0b79b4..4bdc973e1b 100644 --- a/src/plugins/projectexplorer/selectablefilesmodel.cpp +++ b/src/plugins/projectexplorer/selectablefilesmodel.cpp @@ -184,12 +184,12 @@ QModelIndex SelectableFilesModel::index(int row, int column, const QModelIndex & QModelIndex SelectableFilesModel::parent(const QModelIndex &child) const { if (!child.isValid()) - return QModelIndex(); + return {}; if (!child.internalPointer()) - return QModelIndex(); + return {}; auto parent = static_cast<Tree *>(child.internalPointer())->parent; if (!parent) - return QModelIndex(); + return {}; if (!parent->parent) //then the parent is the root return createIndex(0, 0, parent); // figure out where the parent is @@ -202,7 +202,7 @@ QModelIndex SelectableFilesModel::parent(const QModelIndex &child) const QVariant SelectableFilesModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) - return QVariant(); + return {}; auto t = static_cast<Tree *>(index.internalPointer()); if (role == Qt::DisplayRole) return t->name; @@ -213,7 +213,7 @@ QVariant SelectableFilesModel::data(const QModelIndex &index, int role) const t->icon = Utils::FileIconProvider::icon(t->fullPath); return t->icon; } - return QVariant(); + return {}; } bool SelectableFilesModel::setData(const QModelIndex &index, const QVariant &value, int role) diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp index ae6d6d78ce..6f20ca8eaa 100644 --- a/src/plugins/projectexplorer/target.cpp +++ b/src/plugins/projectexplorer/target.cpp @@ -584,7 +584,7 @@ QString Target::overlayIconToolTip() QVariantMap Target::toMap() const { if (!d->m_kit) // Kit was deleted, target is only around to be copied. - return QVariantMap(); + return {}; QVariantMap map; map.insert(displayNameKey(), displayName()); diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index f17354bc5d..313588c800 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -309,8 +309,7 @@ public: default: break; } - - return QVariant(); + return {}; } bool setData(int column, const QVariant &data, int role) override @@ -554,8 +553,7 @@ public: default: break; } - - return QVariant(); + return {}; } Qt::ItemFlags flags(int column) const override @@ -611,8 +609,7 @@ public: font.setItalic(true); return font; } - - return QVariant(); + return {}; } bool setData(int column, const QVariant &data, int role) override @@ -700,8 +697,7 @@ QVariant TargetGroupItem::data(int column, int role) const d->ensureWidget(); return QVariant::fromValue<QWidget *>(d->m_configurePage.data()); } - - return QVariant(); + return {}; } bool TargetGroupItem::setData(int column, const QVariant &data, int role) diff --git a/src/plugins/projectexplorer/taskmodel.cpp b/src/plugins/projectexplorer/taskmodel.cpp index 06962dd13f..0dae3344df 100644 --- a/src/plugins/projectexplorer/taskmodel.cpp +++ b/src/plugins/projectexplorer/taskmodel.cpp @@ -283,7 +283,7 @@ Task TaskModel::task(const QModelIndex &index) const int row = index.row(); if (!index.isValid() || row < 0 || row >= m_tasks.count() || index.internalId() || index.column() > 0) { - return Task(); + return {}; } return m_tasks.at(row); } diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp index a41c749d00..2c7a81acc9 100644 --- a/src/plugins/projectexplorer/toolchain.cpp +++ b/src/plugins/projectexplorer/toolchain.cpp @@ -90,7 +90,7 @@ Id fromLanguageV1(int language) return Id(Constants::CXX_LANGUAGE_ID); case Deprecated::Toolchain::None: default: - return Id(); + return {}; } } @@ -108,7 +108,7 @@ QString languageId(Language l) case Language::Cxx: return QStringLiteral("Cxx"); }; - return QString(); + return {}; } } // namespace Deprecated::ToolChain @@ -517,7 +517,7 @@ Tasks ToolChain::validateKit(const Kit *) const QString ToolChain::sysRoot() const { - return QString(); + return {}; } QString ToolChain::explicitCodeModelTargetTriple() const diff --git a/src/plugins/projectexplorer/toolchain.h b/src/plugins/projectexplorer/toolchain.h index 337c10727b..d6f2221cb8 100644 --- a/src/plugins/projectexplorer/toolchain.h +++ b/src/plugins/projectexplorer/toolchain.h @@ -94,9 +94,9 @@ public: void setTargetAbi(const Abi &abi); virtual ProjectExplorer::Abis supportedAbis() const; - virtual QString originalTargetTriple() const { return QString(); } - virtual QStringList extraCodeModelFlags() const { return QStringList(); } - virtual Utils::FilePath installDir() const { return Utils::FilePath(); } + virtual QString originalTargetTriple() const { return {}; } + virtual QStringList extraCodeModelFlags() const { return {}; } + virtual Utils::FilePath installDir() const { return {}; } virtual bool hostPrefersToolchain() const { return true; } virtual bool isValid() const; diff --git a/src/plugins/projectexplorer/toolchainoptionspage.cpp b/src/plugins/projectexplorer/toolchainoptionspage.cpp index 8954a93fa1..c18a877ec2 100644 --- a/src/plugins/projectexplorer/toolchainoptionspage.cpp +++ b/src/plugins/projectexplorer/toolchainoptionspage.cpp @@ -78,7 +78,7 @@ public: return column == 0 && !toolChain->isValid() ? Utils::Icons::CRITICAL.icon() : QVariant(); } - return QVariant(); + return {}; } ToolChainConfigWidget *widget() diff --git a/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp b/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp index 7c005f6295..52af2cc5db 100644 --- a/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp +++ b/src/plugins/projectexplorer/toolchainsettingsaccessor.cpp @@ -306,10 +306,10 @@ public: static bool hasToolChains() { return !m_toolChains.isEmpty(); } bool isValid() const override { return m_valid; } - MacroInspectionRunner createMacroInspectionRunner() const override { return MacroInspectionRunner(); } + MacroInspectionRunner createMacroInspectionRunner() const override { return {}; } LanguageExtensions languageExtensions(const QStringList &cxxflags) const override { Q_UNUSED(cxxflags) return LanguageExtension::None; } WarningFlags warningFlags(const QStringList &cflags) const override { Q_UNUSED(cflags) return WarningFlags::NoWarnings; } - BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner(const Utils::Environment &) const override { return BuiltInHeaderPathsRunner(); } + BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner(const Utils::Environment &) const override { return {}; } void addToEnvironment(Environment &env) const override { Q_UNUSED(env) } FilePath makeCommand(const Environment &) const override { return "make"; } QList<OutputLineParser *> createOutputParsers() const override { return {}; } diff --git a/src/plugins/projectexplorer/treescanner.cpp b/src/plugins/projectexplorer/treescanner.cpp index 294ef4988e..1eefc3baf4 100644 --- a/src/plugins/projectexplorer/treescanner.cpp +++ b/src/plugins/projectexplorer/treescanner.cpp @@ -77,7 +77,7 @@ TreeScanner::Result TreeScanner::result() const { if (isFinished()) return m_scanFuture.result(); - return Result(); + return {}; } TreeScanner::Result TreeScanner::release() @@ -88,7 +88,7 @@ TreeScanner::Result TreeScanner::release() return result; } m_scanFuture = Future(); - return Result(); + return {}; } void TreeScanner::reset() |