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

Binding loop when propagating the implicit height from Text to its parent item, while the size propagates downward

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.14.0
    • Quick: Layouts
    • None

      When there is the hierarchy

      Control (or any of its subclasses from QtQuickControls2)

      a layout (ColumknLayout, RowLayout or GridLayout)

      and Text (or Label from QtQuickControls2)

      Item {
          width: 300
          implicitHeight: layout.implicitHeight
      
          ColumnLayout {
              id: layout
              anchors.fill:parent
              Text {
                  Layout.fillWidth: true
                  text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam purus lacus, cursus id fermentum vel"
                  wrapMode: Text.WordWrap
              }
          }
      }
      

       

      we have a binding loop on implicitHeight if the Control has a fixed width and height not set (default)

       

      This is a very common case in listviews, where one can have a Delegate as ListView delegate and a layout with various labels inside to show the model data, leading to views with visible layout problems.

        1. textbindingloop.qml
          0.3 kB
          Marco Martin
        2. textbindingloop2.qml
          0.4 kB
          Marco Martin
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            notmart Marco Martin
            Votes:
            9 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes