Replace some PathChooser::setFile with setFilePath

Change-Id: I9a135e27d97b6706ea199b60a0b0b28838c77dcc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-09-08 17:16:43 +02:00
parent f72c4cb8ac
commit 704b0af8db
8 changed files with 14 additions and 15 deletions

View File

@@ -225,7 +225,7 @@ QWidget *AndroidBuildApkWidget::createSignPackageGroup()
auto keystoreLocationChooser = new PathChooser(group); auto keystoreLocationChooser = new PathChooser(group);
keystoreLocationChooser->setExpectedKind(PathChooser::File); keystoreLocationChooser->setExpectedKind(PathChooser::File);
keystoreLocationChooser->lineEdit()->setReadOnly(true); keystoreLocationChooser->lineEdit()->setReadOnly(true);
keystoreLocationChooser->setPath(m_step->keystorePath().toUserOutput()); keystoreLocationChooser->setFilePath(m_step->keystorePath());
keystoreLocationChooser->setInitialBrowsePathBackup(FileUtils::homePath()); keystoreLocationChooser->setInitialBrowsePathBackup(FileUtils::homePath());
keystoreLocationChooser->setPromptDialogFilter(tr("Keystore files (*.keystore *.jks)")); keystoreLocationChooser->setPromptDialogFilter(tr("Keystore files (*.keystore *.jks)"));
keystoreLocationChooser->setPromptDialogTitle(tr("Select Keystore File")); keystoreLocationChooser->setPromptDialogTitle(tr("Select Keystore File"));
@@ -241,7 +241,7 @@ QWidget *AndroidBuildApkWidget::createSignPackageGroup()
AndroidCreateKeystoreCertificate d; AndroidCreateKeystoreCertificate d;
if (d.exec() != QDialog::Accepted) if (d.exec() != QDialog::Accepted)
return; return;
keystoreLocationChooser->setPath(d.keystoreFilePath().toUserOutput()); keystoreLocationChooser->setFilePath(d.keystoreFilePath());
m_step->setKeystorePath(d.keystoreFilePath()); m_step->setKeystorePath(d.keystoreFilePath());
m_step->setKeystorePassword(d.keystorePassword()); m_step->setKeystorePassword(d.keystorePassword());
m_step->setCertificateAlias(d.certificateAlias()); m_step->setCertificateAlias(d.certificateAlias());

View File

@@ -217,24 +217,23 @@ void ChooseDirectoryPage::initializePage()
const Target *target = m_wizard->buildSystem()->target(); const Target *target = m_wizard->buildSystem()->target();
const QString buildKey = m_wizard->buildKey(); const QString buildKey = m_wizard->buildKey();
const BuildTargetInfo bti = target->buildTarget(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)) 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()) { if (androidPackageDir.isEmpty()) {
m_label->setText(tr("Select the Android package source directory.\n\n" 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 " "The files in the Android package source directory are copied to the build directory's "
"Android directory and the default files are overwritten.")); "Android directory and the default files are overwritten."));
m_androidPackageSourceDir->setPath(projectDir + "/android"); m_androidPackageSourceDir->setFilePath(bti.projectFilePath / "android");
connect(m_androidPackageSourceDir, &PathChooser::rawPathChanged, connect(m_androidPackageSourceDir, &PathChooser::rawPathChanged,
this, &ChooseDirectoryPage::checkPackageSourceDir); this, &ChooseDirectoryPage::checkPackageSourceDir);
} else { } else {
m_label->setText(tr("The Android template files will be created in the %1 set in the .pro " 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))); "file.").arg(QLatin1String(Constants::ANDROID_PACKAGE_SOURCE_DIR)));
m_androidPackageSourceDir->setPath(androidPackageDir); m_androidPackageSourceDir->setFilePath(androidPackageDir);
m_androidPackageSourceDir->setReadOnly(true); m_androidPackageSourceDir->setReadOnly(true);
} }

View File

@@ -597,9 +597,9 @@ void ExternalToolConfig::showInfoForItem(const QModelIndex &index)
const ExternalTool *tool = ExternalToolModel::toolForIndex(index); const ExternalTool *tool = ExternalToolModel::toolForIndex(index);
if (!tool) { if (!tool) {
m_ui.description->clear(); m_ui.description->clear();
m_ui.executable->setPath(QString()); m_ui.executable->setFilePath({});
m_ui.arguments->clear(); m_ui.arguments->clear();
m_ui.workingDirectory->setPath(QString()); m_ui.workingDirectory->setFilePath({});
m_ui.inputText->clear(); m_ui.inputText->clear();
m_ui.infoWidget->setEnabled(false); m_ui.infoWidget->setEnabled(false);
m_environment.clear(); m_environment.clear();

View File

@@ -623,7 +623,7 @@ void BreakpointDialog::clearOtherParts(unsigned partsMask)
{ {
const unsigned invertedPartsMask = ~partsMask; const unsigned invertedPartsMask = ~partsMask;
if (invertedPartsMask & FileAndLinePart) { if (invertedPartsMask & FileAndLinePart) {
m_pathChooserFileName->setPath(QString()); m_pathChooserFileName->setFilePath({});
m_lineEditLineNumber->clear(); m_lineEditLineNumber->clear();
m_comboBoxPathUsage->setCurrentIndex(BreakpointPathUsageEngineDefault); m_comboBoxPathUsage->setCurrentIndex(BreakpointPathUsageEngineDefault);
} }

View File

@@ -72,7 +72,7 @@ void ExtPropertiesMView::visitMPackage(const qmt::MPackage *package)
} }
if (!m_configPath->hasFocus()) { if (!m_configPath->hasFocus()) {
if (project->configPath().isEmpty()) { if (project->configPath().isEmpty()) {
m_configPath->setPath(QString()); m_configPath->setFilePath({});
} else { } else {
// make path absolute (may be relative to current project's directory) // make path absolute (may be relative to current project's directory)
QDir projectDir = QFileInfo(project->fileName()).absoluteDir(); QDir projectDir = QFileInfo(project->fileName()).absoluteDir();

View File

@@ -127,7 +127,7 @@ bool NimToolChainConfigWidget::isDirtyImpl() const
{ {
auto tc = static_cast<NimToolChain *>(toolChain()); auto tc = static_cast<NimToolChain *>(toolChain());
Q_ASSERT(tc); Q_ASSERT(tc);
return tc->compilerCommand().toString() != m_compilerCommand->filePath().toString(); return tc->compilerCommand() != m_compilerCommand->filePath();
} }
void NimToolChainConfigWidget::makeReadOnlyImpl() void NimToolChainConfigWidget::makeReadOnlyImpl()
@@ -139,7 +139,7 @@ void NimToolChainConfigWidget::fillUI()
{ {
auto tc = static_cast<NimToolChain *>(toolChain()); auto tc = static_cast<NimToolChain *>(toolChain());
Q_ASSERT(tc); Q_ASSERT(tc);
m_compilerCommand->setPath(tc->compilerCommand().toString()); m_compilerCommand->setFilePath(tc->compilerCommand());
m_compilerVersion->setText(tc->compilerVersion()); m_compilerVersion->setText(tc->compilerVersion());
} }

View File

@@ -73,7 +73,7 @@ public:
void updateInterpreter(const Interpreter &interpreter) void updateInterpreter(const Interpreter &interpreter)
{ {
m_name->setText(interpreter.name); m_name->setText(interpreter.name);
m_executable->setPath(interpreter.command.toString()); m_executable->setFilePath(interpreter.command);
m_currentId = interpreter.id; m_currentId = interpreter.id;
} }

View File

@@ -110,7 +110,7 @@ QString ExamplesWelcomePage::copyToAlternativeLocation(const QFileInfo& proFileI
chooser->setHistoryCompleter(QLatin1String("Qt.WritableExamplesDir.History")); chooser->setHistoryCompleter(QLatin1String("Qt.WritableExamplesDir.History"));
const QString defaultRootDirectory = DocumentManager::projectsDirectory().toString(); const QString defaultRootDirectory = DocumentManager::projectsDirectory().toString();
QtcSettings *settings = ICore::settings(); 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(txt, 1, 0);
lay->addWidget(chooser, 1, 1); lay->addWidget(chooser, 1, 1);
enum { Copy = QDialog::Accepted + 1, Keep = QDialog::Accepted + 2 }; enum { Copy = QDialog::Accepted + 1, Keep = QDialog::Accepted + 2 };