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

"QQuickRectangle: Possible anchor loop detected on vertical anchor" in Qt 6.7

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.7
    • Quick: Controls 2
    • None
    • Fedora 39

    Description

      The following code behaves differently in Qt 6.7 compared to 6.6:

       

      import QtQuick
      import QtQuick.Controls
      
      Page {
          id: root
          header: Rectangle {
              color: "red"
              height: 20
              anchors.top: globalToolBar.visible ? globalToolBar.bottom : root.top
          }
      
          contentItem: ScrollView {
              id: scrollView
              anchors {
                  top: root.header.bottom
                  bottom: parent.bottom
                  left: parent.left
                  right: parent.right
              }
              contentItem: ListView {
                  id: locationView
                  model: 40
                  delegate: Text {
                      text: "Hello " + index
                      width: ListView.view.width
                  }
              }
          }
          data: [
              Rectangle {
                  id: globalToolBar 
      
                  color: "blue"
                  implicitHeight: 40
                  z: 9999
                  anchors {
                      left: parent.left
                      right: parent.right
                      top: parent.top
                  }
              }
          ]
      }
       

      This is a much reduced version of what KDE's Kirigami framework does internally.

      In Qt 6.6 it first shows a blue header, then a red header, then the list items starting at index 0, as expected

      In 6.7 the blue header is shown, but the red header is missing, and the first visible list item is index 1. Dragging the List down via touch reveals the missing first item.

      With 6.7 the warning "QML QQuickRectangle: Possible anchor loop detected on vertical anchor." is printed.

      QtBase commit 61566fa52d260e9246a2c487ba9048222ceed24f

      QtDeclarative commit ac0bbf86c979ab3faef102890ceaceb0378f8ed4

       

      Attachments

        For Gerrit Dashboard: QTBUG-120197
        # Subject Branch Project Status CR V

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            nicolasfella Nicolas Fella
            Votes:
            4 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change