[Qt-creator] JSON Wizard broken?

Eike Ziller Eike.Ziller at qt.io
Mon May 6 09:32:57 CEST 2019

> On 4. May 2019, at 06:40, Christian Gagneraud <chgans at gmail.com> wrote:
> Hi there,
> According to the documentation:
> ----
> The following information is only available when the wizard was
> triggered via the context menu of a node in the Projects view:
> - InitialPath with the path to the selected node.
> - ProjectExplorer.Profile.Ids contains a list of Kits configured for
> the project of the selected node.
> ----
> But it turns out that this is true for 'InitialPath' but not for
> 'ProjectExplorer.Profile.Ids'. (Confirmed by debugging the
> m_expander.registerPrefix("Exists",...) in JsonWizard::JsonWizard())

Yes, that is broken.

> Some json wizard rely on this to deduce top level project vs subproject.
> eg.
> IsTopLevelProject: "%{JS: !'%{Exists:ProjectExplorer.Profile.Ids}'"
> And then, this deducing is actually broken (even w/o the above bug).
> Since ProjectExplorer.Profile.Ids would be set only from the context
> menu, and from the context menu on a project node you cannot create a
> top level project, only subprojects.

Without the above bug, that would work. IsTopLevelProject would correctly be false when the wizard was triggered from the context menu, and true otherwise.

> As well some wizards use '"enabled": "%{JS: ! %{IsSubproject}}", but
> it seems that IsSubproject is only set in the summary page.

Correct. Was incorrectly done in b0229acd54793a559837ed01fee678949a9d5d5a .

> I now have my "subdirs" project template sorted, i now just need to
> know if the project is top-level or not, so that i can set either
> "openAsProject" or "openInEditor" to true in my generator data.
> For a subproject, openInEditor has to be set to true, other wise this
> will trigger
> https://github.com/qt-creator/qt-creator/blob/master/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp#L477
> Can't we have IsTopLevelProject/IsSubproject set all the time, for any
> page, and both from context menu or main menu?

So, yes the behavior (and which variables are available etc) of the JSON wizards in case of subdirs is broken (afaict since quite a while).
It is on the list of things I want to investigate in the nearer future.

Note that there are more issues, like
- If you start the wizard from the main menu you can still add it as a subproject on the summary page - but you where asked for the build system before, and a list of kits. As far as I can tell, if multiple build systems support subdirs (e.g. qmake + qbs), then you’ll be suggested e.g. qmake projects even if you selected qbs as the build system for your new project.
- If the Build System page is hidden in case of a subdir project wizard, no build system is selected, and the filters in the file generation section are broken. So e.g. if the wizard was triggered for creating a subproject, it must be given some information about the build system that it should create files for.

Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
eike.ziller at qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B

More information about the Qt-creator mailing list