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

binding loop with any Control and wrapping text

    XMLWordPrintable

Details

    • cc77a0bc549ce8f0b218661e7ae0e82e5b89e0da, a5d2fd816bcbee6026894927ae5d049536bfc7ea

    Description

      When there is any control that as mainItem has a layout (RowLayout, GridLayout, ColumnLayout) in which there is a Label that has word wrap on, if the control implicitHeight is based on contentItem's implicitHeight there will always be a binding loop

      note that most styles do indeedbase the control implicit size from contentItem, so it's likely to be a problem for any standard control

       

      Example:

      import QtQuick 2.12
      import QtQuick.Window 2.3
      import QtQuick.Controls 2.5
      import QtQuick.Layouts 1.12
      
      ApplicationWindow {
          id: mainWindow
          visible: true
      
          Control {
              implicitWidth: 600
              implicitHeight: lay.implicitHeight
              contentItem: RowLayout {
                  id: lay
      
                  onImplicitHeightChanged: print("layout implicitHeight "+implicitHeight)
      
                  Label {
                      onImplicitHeightChanged: print("label implicitHeight "+implicitHeight)
                      Layout.fillWidth: true
                      wrapMode: Text.WordWrap
                      text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id risus id augue euismod accumsan. Lorem ipsum dolor sit amet, "
                          + "consectetur adipiscing elit. Nullam id risus id augue euismod accumsan.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id risus id augue euismod accumsan."
      
                  }
              }
          }
      }
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: