Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-22411

Bogus boolean in JSON wizards

    XMLWordPrintable

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

        For Gerrit Dashboard: QTCREATORBUG-22411
        # Subject Branch Project Status CR V

        Activity

          People

            christian_gagneraud_navico Christian Gagneraud
            christian_gagneraud_navico Christian Gagneraud
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change