Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
Qt Creator 4.10.0-beta1
-
None
Description
By just adding debug code in JsonWizard::boolFromVariant:
bool JsonWizard::boolFromVariant(const QVariant &v, Utils::MacroExpander *expander) { if (v.type() == QVariant::String) { const QString tmp = expander->expand(v.toString()); const auto result = !(tmp.isEmpty() || tmp == QLatin1String("false")); qDebug() << __FUNCTION__ << tmp << result; return result; } qDebug() << __FUNCTION__ << v << v.toBool(); return v.toBool(); }
I get:
boolFromVariant "true || [ 'CodePaster', 'Bazaar', 'Bookmarks', 'CVS', 'ClangCodeModel', 'Git', 'Help', 'Macros', 'Mercurial', 'Subversion', 'Welcome', 'Android', 'AutoTest', 'BinEditor', 'CMakeProjectManager', 'ClangFormat', 'ClangTools', 'ClassView', 'CompilationDatabaseProjectManager', 'Core', 'CppEditor', 'CppTools', 'Debugger', 'Designer', 'DiffEditor', 'FakeVim', 'GLSLEditor', 'GenericProjectManager', 'ImageViewer', 'LanguageClient', 'ModelEditor', 'PerfProfiler', 'ProjectExplorer', 'PythonEditor', 'QbsProjectManager', 'QmakeProjectManager', 'QmlDesigner', 'QmlJSEditor', 'QmlJSTools', 'QmlPreview', 'QmlProfiler', 'QmlProjectManager', 'Qnx', 'QtSupport', 'RemoteLinux', 'ResourceEditor', 'ScxmlEditor', 'TaskList', 'TextEditor', 'Todo', 'Valgrind', 'VcsBase' ].indexOf('QbsProjectManager') >= 0}" true boolFromVariant "%{JS: ! %{IsSubproject}}" true
These are logic errors in the json files.
Would be nice to have better syntax checks, maybe boolFromVariant should warn if the string is neither "true" or "false"
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTCREATORBUG-22411 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
261097,3 | JsonWizard: Fix Exists macro expander and boolean interpretation | master | qt-creator/qt-creator | Status: NEW | 0 | 0 |