From 704b0af8dbe0a95f3a59221ad105fc48faca91af Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 8 Sep 2021 17:16:43 +0200 Subject: [PATCH] Replace some PathChooser::setFile with setFilePath Change-Id: I9a135e27d97b6706ea199b60a0b0b28838c77dcc Reviewed-by: Christian Stenger --- src/plugins/android/androidbuildapkstep.cpp | 4 ++-- src/plugins/android/createandroidmanifestwizard.cpp | 9 ++++----- src/plugins/coreplugin/dialogs/externaltoolconfig.cpp | 4 ++-- src/plugins/debugger/breakhandler.cpp | 2 +- src/plugins/modeleditor/extpropertiesmview.cpp | 2 +- src/plugins/nim/project/nimtoolchainfactory.cpp | 4 ++-- src/plugins/python/pythonsettings.cpp | 2 +- src/plugins/qtsupport/gettingstartedwelcomepage.cpp | 2 +- 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp index 558f4300a37..997416ef9a0 100644 --- a/src/plugins/android/androidbuildapkstep.cpp +++ b/src/plugins/android/androidbuildapkstep.cpp @@ -225,7 +225,7 @@ QWidget *AndroidBuildApkWidget::createSignPackageGroup() auto keystoreLocationChooser = new PathChooser(group); keystoreLocationChooser->setExpectedKind(PathChooser::File); keystoreLocationChooser->lineEdit()->setReadOnly(true); - keystoreLocationChooser->setPath(m_step->keystorePath().toUserOutput()); + keystoreLocationChooser->setFilePath(m_step->keystorePath()); keystoreLocationChooser->setInitialBrowsePathBackup(FileUtils::homePath()); keystoreLocationChooser->setPromptDialogFilter(tr("Keystore files (*.keystore *.jks)")); keystoreLocationChooser->setPromptDialogTitle(tr("Select Keystore File")); @@ -241,7 +241,7 @@ QWidget *AndroidBuildApkWidget::createSignPackageGroup() AndroidCreateKeystoreCertificate d; if (d.exec() != QDialog::Accepted) return; - keystoreLocationChooser->setPath(d.keystoreFilePath().toUserOutput()); + keystoreLocationChooser->setFilePath(d.keystoreFilePath()); m_step->setKeystorePath(d.keystoreFilePath()); m_step->setKeystorePassword(d.keystorePassword()); m_step->setCertificateAlias(d.certificateAlias()); diff --git a/src/plugins/android/createandroidmanifestwizard.cpp b/src/plugins/android/createandroidmanifestwizard.cpp index 344b650f0d8..266f77cf038 100644 --- a/src/plugins/android/createandroidmanifestwizard.cpp +++ b/src/plugins/android/createandroidmanifestwizard.cpp @@ -217,24 +217,23 @@ void ChooseDirectoryPage::initializePage() const Target *target = m_wizard->buildSystem()->target(); const QString buildKey = m_wizard->buildKey(); const BuildTargetInfo bti = target->buildTarget(buildKey); - const QString projectDir = bti.projectFilePath.toFileInfo().absolutePath(); - QString androidPackageDir; + FilePath androidPackageDir; if (const ProjectNode *node = target->project()->findNodeForBuildKey(buildKey)) - androidPackageDir = node->data(Android::Constants::AndroidPackageSourceDir).toString(); + androidPackageDir = FilePath::fromVariant(node->data(Android::Constants::AndroidPackageSourceDir)); if (androidPackageDir.isEmpty()) { m_label->setText(tr("Select the Android package source directory.\n\n" "The files in the Android package source directory are copied to the build directory's " "Android directory and the default files are overwritten.")); - m_androidPackageSourceDir->setPath(projectDir + "/android"); + m_androidPackageSourceDir->setFilePath(bti.projectFilePath / "android"); connect(m_androidPackageSourceDir, &PathChooser::rawPathChanged, this, &ChooseDirectoryPage::checkPackageSourceDir); } else { m_label->setText(tr("The Android template files will be created in the %1 set in the .pro " "file.").arg(QLatin1String(Constants::ANDROID_PACKAGE_SOURCE_DIR))); - m_androidPackageSourceDir->setPath(androidPackageDir); + m_androidPackageSourceDir->setFilePath(androidPackageDir); m_androidPackageSourceDir->setReadOnly(true); } diff --git a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp index 197505a63e0..3387564b12f 100644 --- a/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp +++ b/src/plugins/coreplugin/dialogs/externaltoolconfig.cpp @@ -597,9 +597,9 @@ void ExternalToolConfig::showInfoForItem(const QModelIndex &index) const ExternalTool *tool = ExternalToolModel::toolForIndex(index); if (!tool) { m_ui.description->clear(); - m_ui.executable->setPath(QString()); + m_ui.executable->setFilePath({}); m_ui.arguments->clear(); - m_ui.workingDirectory->setPath(QString()); + m_ui.workingDirectory->setFilePath({}); m_ui.inputText->clear(); m_ui.infoWidget->setEnabled(false); m_environment.clear(); diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index b7bacb678c4..827cbaa1e14 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -623,7 +623,7 @@ void BreakpointDialog::clearOtherParts(unsigned partsMask) { const unsigned invertedPartsMask = ~partsMask; if (invertedPartsMask & FileAndLinePart) { - m_pathChooserFileName->setPath(QString()); + m_pathChooserFileName->setFilePath({}); m_lineEditLineNumber->clear(); m_comboBoxPathUsage->setCurrentIndex(BreakpointPathUsageEngineDefault); } diff --git a/src/plugins/modeleditor/extpropertiesmview.cpp b/src/plugins/modeleditor/extpropertiesmview.cpp index 5eb1e5c55f8..a6bf554287a 100644 --- a/src/plugins/modeleditor/extpropertiesmview.cpp +++ b/src/plugins/modeleditor/extpropertiesmview.cpp @@ -72,7 +72,7 @@ void ExtPropertiesMView::visitMPackage(const qmt::MPackage *package) } if (!m_configPath->hasFocus()) { if (project->configPath().isEmpty()) { - m_configPath->setPath(QString()); + m_configPath->setFilePath({}); } else { // make path absolute (may be relative to current project's directory) QDir projectDir = QFileInfo(project->fileName()).absoluteDir(); diff --git a/src/plugins/nim/project/nimtoolchainfactory.cpp b/src/plugins/nim/project/nimtoolchainfactory.cpp index b55a9e9119b..91e74e3e3aa 100644 --- a/src/plugins/nim/project/nimtoolchainfactory.cpp +++ b/src/plugins/nim/project/nimtoolchainfactory.cpp @@ -127,7 +127,7 @@ bool NimToolChainConfigWidget::isDirtyImpl() const { auto tc = static_cast(toolChain()); Q_ASSERT(tc); - return tc->compilerCommand().toString() != m_compilerCommand->filePath().toString(); + return tc->compilerCommand() != m_compilerCommand->filePath(); } void NimToolChainConfigWidget::makeReadOnlyImpl() @@ -139,7 +139,7 @@ void NimToolChainConfigWidget::fillUI() { auto tc = static_cast(toolChain()); Q_ASSERT(tc); - m_compilerCommand->setPath(tc->compilerCommand().toString()); + m_compilerCommand->setFilePath(tc->compilerCommand()); m_compilerVersion->setText(tc->compilerVersion()); } diff --git a/src/plugins/python/pythonsettings.cpp b/src/plugins/python/pythonsettings.cpp index 580df442aaf..4bc3e0ca7b2 100644 --- a/src/plugins/python/pythonsettings.cpp +++ b/src/plugins/python/pythonsettings.cpp @@ -73,7 +73,7 @@ public: void updateInterpreter(const Interpreter &interpreter) { m_name->setText(interpreter.name); - m_executable->setPath(interpreter.command.toString()); + m_executable->setFilePath(interpreter.command); m_currentId = interpreter.id; } diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp index f8ea269bd26..16613cfa5d5 100644 --- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp +++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp @@ -110,7 +110,7 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI chooser->setHistoryCompleter(QLatin1String("Qt.WritableExamplesDir.History")); const QString defaultRootDirectory = DocumentManager::projectsDirectory().toString(); QtcSettings *settings = ICore::settings(); - chooser->setPath(settings->value(C_FALLBACK_ROOT, defaultRootDirectory).toString()); + chooser->setFilePath(FilePath::fromVariant(settings->value(C_FALLBACK_ROOT, defaultRootDirectory))); lay->addWidget(txt, 1, 0); lay->addWidget(chooser, 1, 1); enum { Copy = QDialog::Accepted + 1, Keep = QDialog::Accepted + 2 };