Make changes in the QtCreator side required for QDS new project dialog

* We need the showing of the Wizard dialog to be optional
* Each wizard has a "detailsPage.qml" file that stores wizard-specific
  UI configuration. We need a way to access that path (QUrl) from QDS.
* ComboboxField is used directly by QDS, and the field object is
  fetched by a call to JsonFieldPage::jsonField() - hence, the
  ComboboxField needs to be dllexported. We need to access fields
  directly from QDS because the QML controls use those fields as backend.
* From QDS we need to select / activate in a combobox field, and to see
  which item is current (activated). We also need to make use of the
  model that the ComboBoxField uses in order to show those same items in
  the qml controls of QDS.
* From QDS we need to set the text in a LineEditField

Task-number: QDS-4490
Change-Id: Ia42d539a5bcbf3dff4593fb027ac18c52da4d046
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Samuel Ghinet
2021-09-06 11:42:04 +03:00
parent 87c1f597e3
commit b985530144
9 changed files with 92 additions and 13 deletions

View File

@@ -257,14 +257,17 @@ QString IWizardFactory::runPath(const QString &defaultPath) const
created. The wizard should fill this in its path selection elements as a
default path.
*/
Utils::Wizard *IWizardFactory::runWizard(const QString &path, QWidget *parent, Id platform, const QVariantMap &variables)
Utils::Wizard *IWizardFactory::runWizard(const QString &path, QWidget *parent, Id platform,
const QVariantMap &variables,
bool showWizard)
{
QTC_ASSERT(!s_isWizardRunning, return nullptr);
s_isWizardRunning = true;
ICore::updateNewItemDialogState();
Utils::Wizard *wizard = runWizardImpl(path, parent, platform, variables);
Utils::Wizard *wizard = runWizardImpl(path, parent, platform, variables, showWizard);
if (wizard) {
s_currentWizard = wizard;
@@ -286,7 +289,8 @@ Utils::Wizard *IWizardFactory::runWizard(const QString &path, QWidget *parent, I
s_reopenData.reopen();
});
s_inspectWizardAction->setEnabled(true);
wizard->show();
if (showWizard)
wizard->show();
Core::ICore::registerWindow(wizard, Core::Context("Core.NewWizard"));
} else {
s_isWizardRunning = false;
@@ -418,3 +422,18 @@ void IWizardFactory::initialize()
s_inspectWizardAction = new QAction(tr("Inspect Wizard State"), ActionManager::instance());
ActionManager::registerAction(s_inspectWizardAction, "Wizard.Inspect");
}
void IWizardFactory::setDetailsPageQmlPath(const QString &filePath)
{
if (filePath.isEmpty())
return;
if (filePath.startsWith(':')) {
m_detailsPageQmlPath.setScheme(QLatin1String("qrc"));
QString path = filePath;
path.remove(0, 1);
m_detailsPageQmlPath.setPath(path);
} else {
m_detailsPageQmlPath = QUrl::fromLocalFile(filePath);
}
}