Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-135242

<content expr=> fails silently because it handles expr as an id of a data entry in a datamodel

    XMLWordPrintable

Details

    Description

      Reproducer attached. It contains 2 tests: "doesnotwork1" and "doesnotwork2". Both try to obtain the <content> QScxmlEvent::data. The first test sends out <content expr="'should see string'"/> from state machine and gets QVariant(void*, 0x0). The second test sends out <content expr="foo"/> and gets the same QVariant(void*, 0x0).

      What happens here is that I think Qt handles <content> in a way that its "expr" is always treated as an id of some data model. In the first test, there is no datamodel at all. In the second test, the <data> is named "FOO" instead of "foo". So Qt cannot match anything in either situation. In fact, if one changes the id in the second test then it's going to wotks.

      Therefore, I think it is better to:
      1. Fix this behavior or warn people in documentation (that <content expr=> only accepts data id)
      2. Add some warning messages in Qt source to warn people in compile/runtime too, i.e. Qt cannot match anything with the current expr.

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            luqiaochen Luqiao Chen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes