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

Implicit property resolution for a property outside the current context breaks unexpectedly

    XMLWordPrintable

Details

    Description

      (I realise that this is a vague report, and I wish I have more to offer, but this is a very complicated bug and has thus far been quite elusive to tracking down...)

      I have an application that has a component Thing.qml, looking like this (simplified a little)

      Text {
          property int priority: 2
          property bool acked
          color: priority >= 0 ? active ? Theme.activeColors[priority] : Theme.inactiveColors[priority] : "transparent"
      }

      Notably absent from this component is an 'active' property. Due to design mistakes, this has been looked up implicitly from the parent context for some years now.

      This seems to break - sometimes - in versions of newer Qt (working: 5.6, not working: 5.12+ has been tested thus far), with the following usage of Thing in one particular part of the application:

      Thing {
          property bool active: otherThing.otherProperty
          ....
      }

      When this breaks, 'active' inside Thing will resolve to undefined rather than a boolean value.

      It's unclear to me why this would break, when several other similar uses of Thing elsewhere in the application seem to work fine.

      Luckily, I have a workaround for the time being (turning it into a real property, avoiding the use of the implicit resolution), but I figure that it's worth filing this as it is a very serious problem when it goes wrong. The binding simply breaks with "correct" data as observed everywhere outside the one binding where it goes wrong.

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            w00t Robin Burchell
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes