[Qt-creator] JSON Wizard broken?

Christian Gagneraud chgans at gmail.com
Sat May 4 06:40:02 CEST 2019


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())

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.

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

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?

Chris


More information about the Qt-creator mailing list