[Qt-creator] JSON Wizard broken?

Christian Gagneraud chgans at gmail.com
Mon May 6 12:57:47 CEST 2019

On Mon, 6 May 2019 at 19:32, Eike Ziller <Eike.Ziller at qt.io> wrote:
> > On 4. May 2019, at 06:40, Christian Gagneraud <chgans at gmail.com> wrote:
> > 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.

"would work", "would correctly be false", the reality is that "would"
doesn't happen for a lot of reasons.
The main issue is Qt'c JSON Wizard's "bool from variant" and QtC's
macro expansion system doesn't mix well with javascript concept of
true or false.
Using the debugger i saw things such as a string like "true || (some
more unexpanded/unevaluated stuff related to qtc plugins)" being
evaluating as Wizard's True b/c the it is not an empty string or not
equal to the string "false".
I even saw strings like "JS Error: blah, blah, blah" being evaluated
as true b/c it's not empty/null/"false"...

> 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.

I'm fine with that one, this is minor annoyance (UX repetition). As
long as the end goal is achieved (project manager implementation being
notified of the "sub-project addition/removal")

> - 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.

I naively tried to "solve" that one, and gave up rather quickly. This
is IMHO more worrisome.


More information about the Qt-creator mailing list