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

REG [5.15 → 6.x]: With `height: implicitHeight` binding changes to implicitHeight won't trigger property interceptor (e.g. Behavior + Animation)

    XMLWordPrintable

Details

    • All
    • 52fcaec65 (dev), e7c2b7aa5 (6.6), e64fbdcdd (6.5), 6a39ab58a (tqtc/lts-6.2)

    Description

      As demonstrated in the following example, explicitly binding height to implicitHeight won't trigger an animation through property interceptor (Behavior) on height. Same with width and implicitWidth. This works (i.e. animates) in Qt 5.15, but not in Qt 6.5.

      import QtQuick 2.15
      
      Item {
          width: 300
          height: 300
      
          Rectangle {
              id: r1
      
              // set binding at runtime
              height: undefined
      
              implicitHeight: 30
              implicitWidth: 30
      
              color: "#2BAE61"
      
              Behavior on height {
                  NumberAnimation {
                      duration: 2000
                  }
              }
          }
      
          Component.onCompleted: {
              r1.height = Qt.binding(() => r1.implicitHeight);
              r1.implicitHeight = 60;
          }
      }
      

      Bigger snippets with more options to compare Qt 5 & 6 behavior is available at https://invent.kde.org/frameworks/kirigami/-/snippets/2717

      Further investigation shows that the bug depends on which expression was bound to the height property at compile time. If it was undefined, then it won't animate; but it was bound to implicitHeight or omitted, then it would animate. Of course, same goes for width.

      Not sure which component is to blame here. Also, while binding to implicitHeight is a regression, neither Qt 5 or 6 ever animated/intercepted property changes for undefined/reset height, which severely limits our animating capabilities.

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            ratijas ivan tkachenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews