diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp index d3d747c1a89..6458e2903e5 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp @@ -931,6 +931,14 @@ void CheckBoxField::setChecked(bool value) emit w->clicked(value); } +bool CheckBoxField::isChecked() const +{ + auto w = qobject_cast(widget()); + QTC_ASSERT(w, return false); + + return w->isChecked(); +} + bool CheckBoxField::validate(MacroExpander *expander, QString *message) { if (!JsonFieldPage::Field::validate(expander, message)) diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage_p.h b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage_p.h index e8995157bdf..3b1ffe8ebb3 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage_p.h +++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage_p.h @@ -215,6 +215,7 @@ public: bool suppressName() const override { return true; } void setChecked(bool); + bool isChecked() const; private: bool parseData(const QVariant &data, QString *errorMessage) override; diff --git a/src/plugins/studiowelcome/fieldhelper.cpp b/src/plugins/studiowelcome/fieldhelper.cpp index d99296c53d2..c5e777ed252 100644 --- a/src/plugins/studiowelcome/fieldhelper.cpp +++ b/src/plugins/studiowelcome/fieldhelper.cpp @@ -21,6 +21,12 @@ void CheckBoxHelper::setChecked(bool value) m_field->setChecked(value); } +bool CheckBoxHelper::isChecked() const +{ + QTC_ASSERT(m_field, return false); + return m_field->isChecked(); +} + ComboBoxHelper::ComboBoxHelper(ProjectExplorer::JsonFieldPage *detailsPage, const QString &fieldName) : m_field(dynamic_cast(detailsPage->jsonField(fieldName))) {} diff --git a/src/plugins/studiowelcome/fieldhelper.h b/src/plugins/studiowelcome/fieldhelper.h index 886e49d0df8..39cd5443aa1 100644 --- a/src/plugins/studiowelcome/fieldhelper.h +++ b/src/plugins/studiowelcome/fieldhelper.h @@ -21,6 +21,7 @@ public: CheckBoxHelper(ProjectExplorer::JsonFieldPage *detailsPage, const QString &fieldName); void setChecked(bool value); + bool isChecked() const; private: ProjectExplorer::CheckBoxField *m_field = nullptr; diff --git a/src/plugins/studiowelcome/qdsnewdialog.cpp b/src/plugins/studiowelcome/qdsnewdialog.cpp index f87f28c0be4..34803236901 100644 --- a/src/plugins/studiowelcome/qdsnewdialog.cpp +++ b/src/plugins/studiowelcome/qdsnewdialog.cpp @@ -205,6 +205,13 @@ void QdsNewDialog::onWizardCreated(QStandardItemModel *screenSizeModel, QStandar setEnableCMakeGeneration(userPreset->enableCMakeGeneration); setStyleName(userPreset->styleName); + } else { + if (getHaveVirtualKeyboard()) + setUseVirtualKeyboard(m_wizard.virtualKeyboardUsed()); + if (hasCMakeGeneration()) + setEnableCMakeGeneration(m_wizard.cmakeGenerationEnabled()); + + setStyleName(m_wizard.styleName()); } m_targetQtVersions.clear(); @@ -440,7 +447,7 @@ UserPresetData QdsNewDialog::currentUserPresetData(const QString &displayName) c targetQtVersion = m_wizard.targetQtVersionName(m_qmlTargetQtVersionIndex); if (m_wizard.haveStyleModel()) - styleName = m_wizard.styleName(getStyleIndex()); + styleName = m_wizard.styleNameAt(getStyleIndex()); if (m_wizard.haveVirtualKeyboard()) useVirtualKeyboard = m_qmlUseVirtualKeyboard; diff --git a/src/plugins/studiowelcome/wizardhandler.cpp b/src/plugins/studiowelcome/wizardhandler.cpp index a1882f50a2e..bcba47c01ab 100644 --- a/src/plugins/studiowelcome/wizardhandler.cpp +++ b/src/plugins/studiowelcome/wizardhandler.cpp @@ -197,11 +197,16 @@ int WizardHandler::styleIndex(const QString &styleName) const return ComboBoxHelper(m_detailsPage, "ControlsStyle").indexOf(styleName); } -QString WizardHandler::styleName(int index) const +QString WizardHandler::styleNameAt(int index) const { return ComboBoxHelper(m_detailsPage, "ControlsStyle").text(index); } +QString WizardHandler::styleName() const +{ + return styleNameAt(styleIndex()); +} + void WizardHandler::setUseVirtualKeyboard(bool value) { CheckBoxHelper(m_detailsPage, "UseVirtualKeyboard").setChecked(value); @@ -212,6 +217,11 @@ bool WizardHandler::haveVirtualKeyboard() const return m_wizard->hasField("UseVirtualKeyboard"); } +bool WizardHandler::virtualKeyboardUsed() const +{ + return CheckBoxHelper(m_detailsPage, "UseVirtualKeyboard").isChecked(); +} + void WizardHandler::enableCMakeGeneration(bool value) { CheckBoxHelper(m_detailsPage, "EnableCMakeGeneration").setChecked(value); @@ -222,6 +232,11 @@ bool WizardHandler::hasCMakeGeneration() const return m_wizard->hasField("EnableCMakeGeneration"); } +bool WizardHandler::cmakeGenerationEnabled() const +{ + return CheckBoxHelper(m_detailsPage, "EnableCMakeGeneration").isChecked(); +} + void WizardHandler::run(const std::function &processPage) { m_wizard->restart(); diff --git a/src/plugins/studiowelcome/wizardhandler.h b/src/plugins/studiowelcome/wizardhandler.h index 640ebb41342..4458f0485b7 100644 --- a/src/plugins/studiowelcome/wizardhandler.h +++ b/src/plugins/studiowelcome/wizardhandler.h @@ -40,16 +40,19 @@ public: void setStyleIndex(int index); int styleIndex() const; int styleIndex(const QString &styleName) const; - QString styleName(int index) const; + QString styleNameAt(int index) const; + QString styleName() const; bool haveStyleModel() const; void destroyWizard(); void setUseVirtualKeyboard(bool value); bool haveVirtualKeyboard() const; + bool virtualKeyboardUsed() const; void enableCMakeGeneration(bool value); bool hasCMakeGeneration() const; + bool cmakeGenerationEnabled() const; void setProjectName(const QString &name); void setProjectLocation(const Utils::FilePath &location);