Utils: add default file path to string aspect

Change-Id: Ia3df289b0b2dc59f6e7098332c21a335dce207f1
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
David Schulz
2022-05-05 10:21:13 +02:00
parent ebf3144f22
commit 7000ab04fb
2 changed files with 10 additions and 1 deletions

View File

@@ -874,6 +874,11 @@ void StringAspect::setFilePath(const FilePath &value)
setValue(value.toUserOutput());
}
void StringAspect::setDefaultFilePath(const FilePath &value)
{
setDefaultValue(value.toUserOutput());
}
PathChooser *StringAspect::pathChooser() const
{
return d->m_pathChooserDisplay.data();
@@ -1085,7 +1090,10 @@ void StringAspect::addToLayout(LayoutBuilder &builder)
d->m_pathChooserDisplay->setEnvironmentChange(d->m_environmentChange);
d->m_pathChooserDisplay->setBaseDirectory(d->m_baseFileName);
d->m_pathChooserDisplay->setOpenTerminalHandler(d->m_openTerminal);
d->m_pathChooserDisplay->setFilePath(FilePath::fromUserInput(displayedString));
if (defaultValue() == value())
d->m_pathChooserDisplay->setDefaultValue(defaultValue().toString());
else
d->m_pathChooserDisplay->setFilePath(FilePath::fromUserInput(displayedString));
d->updateWidgetFromCheckStatus(this, d->m_pathChooserDisplay.data());
addLabeledItem(builder, d->m_pathChooserDisplay);
useMacroExpander(d->m_pathChooserDisplay->lineEdit());

View File

@@ -421,6 +421,7 @@ public:
Utils::FilePath filePath() const;
void setFilePath(const Utils::FilePath &value);
void setDefaultFilePath(const Utils::FilePath &value);
PathChooser *pathChooser() const; // Avoid to use.