diff --git a/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/Details.qml b/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/Details.qml index cdc6f51900b..ef8e020a5d7 100644 --- a/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/Details.qml +++ b/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/Details.qml @@ -397,13 +397,7 @@ Item { currentIndex: BackendApi.targetQtVersionIndex font.pixelSize: DialogValues.defaultPixelSize - model: ListModel { - ListElement { name: "Qt 5.15" } - ListElement { name: "Qt 6.2" } - ListElement { name: "Qt 6.3" } - ListElement { name: "Qt 6.4" } - ListElement { name: "Qt 6.5" } - } + model: BackendApi.targetQtVersions onActivated: (index) => { BackendApi.targetQtVersionIndex = index diff --git a/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json b/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json index 0bc60900074..4809b7d410b 100644 --- a/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json +++ b/share/qtcreator/qmldesigner/studio_templates/projects/application-3d/wizard.json @@ -238,7 +238,7 @@ "type": "ComboBox", "data": { - "index": 4, + "index": 3, "items": [ { diff --git a/src/plugins/studiowelcome/qdsnewdialog.cpp b/src/plugins/studiowelcome/qdsnewdialog.cpp index 4bd6293c19a..91c03828d26 100644 --- a/src/plugins/studiowelcome/qdsnewdialog.cpp +++ b/src/plugins/studiowelcome/qdsnewdialog.cpp @@ -191,21 +191,16 @@ void QdsNewDialog::onWizardCreated(QStandardItemModel *screenSizeModel, QStandar auto userPreset = m_currentPreset->asUserPreset(); if (m_qmlDetailsLoaded) { - if (m_currentPreset->isUserPreset()) { - if (m_wizard.haveVirtualKeyboard()) - setUseVirtualKeyboard(userPreset->useQtVirtualKeyboard); - - if (m_wizard.haveTargetQtVersion()) { - int index = m_wizard.targetQtVersionIndex(userPreset->qtVersion); - if (index != -1) - setTargetQtVersionIndex(index); - } - } else { - if (m_wizard.haveTargetQtVersion()) { - int index = m_wizard.targetQtVersionIndex(); - if (index != -1) - setTargetQtVersionIndex(index); - } + m_targetQtVersions.clear(); + if (m_currentPreset->isUserPreset() && m_wizard.haveVirtualKeyboard()) + setUseVirtualKeyboard(userPreset->useQtVirtualKeyboard); + if (m_wizard.haveTargetQtVersion()) { + m_targetQtVersions = m_wizard.targetQtVersionNames(); + int index = m_currentPreset->isUserPreset() ? m_wizard.targetQtVersionIndex(userPreset->qtVersion) + : m_wizard.targetQtVersionIndex(); + emit targetQtVersionsChanged(); + if (index != -1) + setTargetQtVersionIndex(index); } emit haveVirtualKeyboardChanged(); diff --git a/src/plugins/studiowelcome/qdsnewdialog.h b/src/plugins/studiowelcome/qdsnewdialog.h index f63ec4748dc..f4f24d1810a 100644 --- a/src/plugins/studiowelcome/qdsnewdialog.h +++ b/src/plugins/studiowelcome/qdsnewdialog.h @@ -41,6 +41,7 @@ public: Q_PROPERTY(QString statusType MEMBER m_qmlStatusType READ getStatusType NOTIFY statusTypeChanged) Q_PROPERTY(bool fieldsValid MEMBER m_qmlFieldsValid READ getFieldsValid NOTIFY fieldsValidChanged) Q_PROPERTY(QString presetName MEMBER m_qmlPresetName) + Q_PROPERTY(QStringList targetQtVersions MEMBER m_targetQtVersions NOTIFY targetQtVersionsChanged) Q_PROPERTY(bool detailsLoaded MEMBER m_qmlDetailsLoaded) Q_PROPERTY(bool stylesLoaded MEMBER m_qmlStylesLoaded) @@ -108,6 +109,7 @@ signals: void targetQtVersionIndexChanged(); void userPresetSaved(); void lastUserPresetRemoved(); + void targetQtVersionsChanged(); private slots: void onStatusMessageChanged(Utils::InfoLabel::InfoType type, const QString &message); @@ -174,6 +176,7 @@ private: WizardHandler m_wizard; UserPresetsStore m_recentsStore; UserPresetsStore m_userPresetsStore; + QStringList m_targetQtVersions; }; } //namespace StudioWelcome diff --git a/src/plugins/studiowelcome/wizardhandler.cpp b/src/plugins/studiowelcome/wizardhandler.cpp index d6d750d39eb..961fb701eeb 100644 --- a/src/plugins/studiowelcome/wizardhandler.cpp +++ b/src/plugins/studiowelcome/wizardhandler.cpp @@ -220,6 +220,21 @@ QString WizardHandler::targetQtVersionName(int index) const return text; } +QStringList WizardHandler::targetQtVersionNames() const +{ + auto *field = m_detailsPage->jsonField("TargetQtVersion"); + auto *cbfield = dynamic_cast(field); + QTC_ASSERT(cbfield, return {}); + + QStandardItemModel *model = cbfield->model(); + QStringList targetVersions; + + for (int i = 0; i < model->rowCount(); ++i) + targetVersions.append(model->item(i)->text()); + + return targetVersions; +} + int WizardHandler::targetQtVersionIndex(const QString &qtVersionName) const { auto *field = m_detailsPage->jsonField("TargetQtVersion"); diff --git a/src/plugins/studiowelcome/wizardhandler.h b/src/plugins/studiowelcome/wizardhandler.h index 1ceadd3a79b..e6009dd9362 100644 --- a/src/plugins/studiowelcome/wizardhandler.h +++ b/src/plugins/studiowelcome/wizardhandler.h @@ -35,6 +35,7 @@ public: void setTargetQtVersionIndex(int index); bool haveTargetQtVersion() const; QString targetQtVersionName(int index) const; + QStringList targetQtVersionNames() const; void setStyleIndex(int index); int styleIndex() const;