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

Qt 5.11 -> 5.12 regression: binding typeof(name) not reevaluating when property gets defined

    XMLWordPrintable

    Details

    • Commits:
      cca5d1ec2f2c1f038c7c933b6c57d89888fc683b (qt/qtdeclarative/5.12)

      Description

      Beginning with Qt 5.12, the binding like typeof (name) will not update when property name was undefined and then became defined as context property. It worked in Qt 5.11 and before.

      Consider the following QML code:

      import QtQuick 2.11
      import QtQuick.Window 2.11
      
      Window {
          visible: true
          Text { text: "model is " + typeof (model) }
      }
      

      Then I define model context property through C++ code, like:

      engine.rootContext()->setContextProperty("model", QVariant::fromValue(obj));
      

      I expect binding to be reevaluated, however it isn't. It is now only updated only if it directly binds to model (without the typeof check).
      The text remains model is null instead of changing to model is object.

      See the attachment for the full project demonstrating the problem.

      This breaks quite a much of my code (preventing upgrade from Qt 5.11), as I was using the typeof frequently to avoid ReferenceError.

       

      Please let me know, if any further information is needed.

        Attachments

        1. UpdateTest.pro
          1 kB
        2. main.cpp
          0.9 kB
        3. qml.qrc
          0.1 kB
        4. main.qml
          0.1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              shausman Simon Hausmann
              Reporter:
              mwu Michał Urbańczyk
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes