diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-02-28 15:33:25 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2020-03-10 09:53:53 +0000 |
commit | 829faf7eefbf8646ca8f30f8b050dc9542b9779f (patch) | |
tree | fdf3a69446e172f158a21c9891d96c979b27e7e9 /src/libs/utils/filewizardpage.cpp | |
parent | e35289243dd857315fb7a9ae3c11a6ce557de1ff (diff) |
File wizards: Optionally show the default suffix
In wizards that create a single new file, there's almost always a
default suffix that gets appended if the user provides only the base
name. However, there's currently no visual indication on the page that
such a suffix will be appended. Therefore, we add an optional field to
the FileWizardPage that displays the default suffix if the wizard
provides one.
Change-Id: Ia1c8966e7de14b484d065dbd4a41aa74f484f085
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/libs/utils/filewizardpage.cpp')
-rw-r--r-- | src/libs/utils/filewizardpage.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libs/utils/filewizardpage.cpp b/src/libs/utils/filewizardpage.cpp index cd9f3b345b..f486229253 100644 --- a/src/libs/utils/filewizardpage.cpp +++ b/src/libs/utils/filewizardpage.cpp @@ -110,6 +110,19 @@ void FileWizardPage::setPathLabel(const QString &label) d->m_ui.pathLabel->setText(label); } +void FileWizardPage::setDefaultSuffix(const QString &suffix) +{ + if (suffix.isEmpty()) { + const auto layout = qobject_cast<QFormLayout *>(this->layout()); + if (layout->rowCount() == 3) + layout->removeRow(0); + } else { + d->m_ui.defaultSuffixLabel->setText( + tr("The default suffix if you do not explicitly specify a file extension is \".%1\".") + .arg(suffix)); + } +} + bool FileWizardPage::forceFirstCapitalLetterForFileName() const { return d->m_ui.nameLineEdit->forceFirstCapitalLetter(); |