forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user