diff options
author | Tim Jenssen <tim.jenssen@qt.io> | 2023-09-14 17:25:47 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@qt.io> | 2023-09-14 17:37:24 +0200 |
commit | 1a3a8ecc96542d6556baac373c8f8d8de5c68325 (patch) | |
tree | ae2bdce03596e8c6461c55de791720531d9c8e91 /src/plugins/studiowelcome | |
parent | 93273af6dc2ee18c5748bd267628ce3d6cff2d5f (diff) | |
parent | 3473d9d3887ef6851797eec248352ced4d4b4857 (diff) |
Merge remote-tracking branch 'origin/qds/dev'
Change-Id: Id242ab4ca485527defdcc1555d204e12e50ddb7a
Diffstat (limited to 'src/plugins/studiowelcome')
-rw-r--r-- | src/plugins/studiowelcome/qdsnewdialog.cpp | 25 | ||||
-rw-r--r-- | src/plugins/studiowelcome/qdsnewdialog.h | 3 | ||||
-rw-r--r-- | src/plugins/studiowelcome/studiowelcomeplugin.cpp | 7 | ||||
-rw-r--r-- | src/plugins/studiowelcome/wizardhandler.cpp | 15 | ||||
-rw-r--r-- | src/plugins/studiowelcome/wizardhandler.h | 1 |
5 files changed, 34 insertions, 17 deletions
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/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index 30902093c21..2f576b331b9 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -266,7 +266,7 @@ public: Q_INVOKABLE void showHelp() { - QDesktopServices::openUrl(QUrl("qthelp://org.qt-project.qtcreator/doc/index.html")); + QDesktopServices::openUrl(QUrl("qthelp://org.qt-project.qtdesignstudio/doc/index.html")); } Q_INVOKABLE void openExample(const QString &examplePath, @@ -423,8 +423,11 @@ static QString tags(const FilePath &projectFilePath) QVariant ProjectModel::data(const QModelIndex &index, int role) const { - if (index.row() >= ProjectExplorer::ProjectExplorerPlugin::recentProjects().count()) + if (!index.isValid() || + index.row() >= ProjectExplorer::ProjectExplorerPlugin::recentProjects().count()) { + return {}; + } const ProjectExplorer::RecentProjectsEntry data = ProjectExplorer::ProjectExplorerPlugin::recentProjects().at(index.row()); 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<ProjectExplorer::ComboBoxField *>(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; |