forked from qt-creator/qt-creator
JsonWizard: Treat no visible page the same as no page at all
Just accept the dialog and try to generate files when no page is displayed. Change-Id: I0ae9aa6c29e55f52f3edad35742869a0cc535521 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -396,12 +396,14 @@ void JsonWizardFactory::runWizard(const QString &path, QWidget *parent, const QS
|
||||
for (auto i = m_options.constBegin(); i != m_options.constEnd(); ++i)
|
||||
wizard.setValue(i.key(), i.value());
|
||||
|
||||
bool havePage = false;
|
||||
foreach (const Page &data, m_pages) {
|
||||
QTC_ASSERT(data.isValid(), continue);
|
||||
|
||||
if (!JsonWizard::boolFromVariant(data.enabled, wizard.expander()))
|
||||
continue;
|
||||
|
||||
havePage = true;
|
||||
JsonWizardPageFactory *factory = Utils::findOr(s_pageFactories, 0,
|
||||
[&data](JsonWizardPageFactory *f) {
|
||||
return f->canCreate(data.typeId);
|
||||
@@ -436,7 +438,7 @@ void JsonWizardFactory::runWizard(const QString &path, QWidget *parent, const QS
|
||||
wizard.addGenerator(gen);
|
||||
}
|
||||
|
||||
if (!m_pages.isEmpty()) {
|
||||
if (havePage) {
|
||||
Core::ICore::registerWindow(&wizard, Core::Context("Core.NewJSONWizard"));
|
||||
wizard.exec();
|
||||
} else {
|
||||
@@ -475,7 +477,6 @@ QString JsonWizardFactory::localizedString(const QVariant &value)
|
||||
return QString();
|
||||
}
|
||||
return QCoreApplication::translate("ProjectExplorer::JsonWizardFactory", value.toByteArray());
|
||||
|
||||
}
|
||||
|
||||
void JsonWizardFactory::destroyAllFactories()
|
||||
|
||||
Reference in New Issue
Block a user