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

Qt Creator should create new SCXML files with datamodel="ecmascript"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • Qt Creator 4.12.0
    • SCXML support
    • None
    • All

    Description

      This not a technical bug, but rather a usability issue, which I still consider important considering how much time I spent on it.

      This took me more than a day to figure out, and to save other people from falling into the same trap, I think changing the default behavior of Qt Creator regarding SCXML files would be helpful.

      In short: Qt Creator should create SCXML models with

      datamodel="ecmascript"

      preset, to be aligned with the Qt documentation examples.

       

      Background:

      This is the first time I am using SCXML models and I would like to use them as a controller for a Qt Quick application. After looking at the QML SCXML examples, I tried to create my own project with a new SCXML model and use in it QML. However, my conditional transitions (e.g. transitions using

      cond="In('s1')"

      ) didn't work like they did in the examples (they did not trigger, even though s1 was active and the cond should return true). Transitions with empty cond would work.

       

      After debugging this for hours, I stumbled upon the "datamodel=ecmascript" parameter, which was set in all the Qt SCXML examples that use cond, but not in my newly created SCXML file. Changing this setting makes it possible to use cond properties like above. If this is not set, the "null" datamodel is used, which requires cond properties to be written differently, like this:

       

      cond="In(s1)"

       

      This difference between the null datamodel and the ecmascript datamodel wasn't obvious from the Qt documentation, I just noticed it after reading the SCXML specification multiple times. All Qt examples using cond have datamodel set to ecmascript (but don't explain why this might be useful and which implications it has), so copying and pasting parts of example SCXML files won't work with a newly created SCXML file.

       

      I created this as a Qt Creator bug, because I think this is the easiest way help other to avoid this issue. Maybe a checkbox to enable the ecmascript datamodel in the "new SXCML file" dialog would already suffice. The alternative option would be to change the Qt documentation to make it obvious that new SCXML files use the null datamodel (and that this has implications on how properties like cond are parsed) and that none of the examples will work when copied into SCXML files created from scratch.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jkobus Jarek Kobus
            hko.solutions Hanno Kolvenbach
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes