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

Nested ListViews break clipping

    XMLWordPrintable

    Details

      Description

      The example below shows nested ListViews (listView and subListView). The ListView "listView" has a margin of 50 to the window and should clip its content. Clicking through listView shows that clipping breaks. If the ListView "subListView" is removed, the clipping does not break.

      Tests have shown that when OpenGL is available everything works as expected. If the software renderer is used instead, clipping breaks as described above.

       

      import QtQuick 2.5
      import QtQuick.Window 2.2
      
      Window {
        visible: true
        width: 800
        height: 600
      
        ListView {
          id: listView
          anchors.fill: parent
          anchors.margins: 50
          orientation: ListView.Horizontal
          snapMode: ListView.SnapOneItem
          highlightRangeMode: ListView.StrictlyEnforceRange
          highlightMoveDuration: 200
          interactive: false
          clip: true
          cacheBuffer: Math.max(0, model.count * width)
          model: VisualItemModel {
            ListView {
              id: subListView
              width: listView.width
              height: listView.height
              clip: true
              model: VisualItemModel {
                Rectangle {
                  width: subListView.width
                  height: 70
                  color: "yellow"
                }
                Rectangle {
                  width: subListView.width
                  height: 70
                  color: "pink"
                }
                Rectangle {
                  width: subListView.width
                  height: 70
                  color: "purple"
                }
              }
              Text {
                  visible: listView.currentItem != parent
                  text: "This text should not be visible but clipped"
                  rotation: 90
                  font.pixelSize: 20
                  anchors.right: parent.right
                  anchors.bottom: parent.bottom
                  transformOrigin: Item.TopRight
              }
            }
            Rectangle {
              color: "green"
              width: listView.width
              height: listView.height
              
              Text {
                  visible: listView.currentItem != parent
                  text: "This text should not be visible but clipped"
                  rotation: 90
                  font.pixelSize: 20
                  anchors.right: parent.right
                  anchors.bottom: parent.bottom
                  transformOrigin: Item.TopRight
              }
              
              Text {
                  visible: listView.currentItem != parent
                  text: "This text should not be visible but clipped"
                  rotation: 90
                  font.pixelSize: 20
                  transformOrigin: Item.BottomLeft
              }
            }
            Rectangle {
              color: "blue"
              width: listView.width
              height: listView.height
              
              Text {
                  visible: listView.currentItem != parent
                  text: "This text should not be visible but clipped"
                  rotation: 90
                  font.pixelSize: 20
                  transformOrigin: Item.BottomLeft
              }
            }
          }
        }
      
        MouseArea {
          anchors.fill: parent
          onClicked: listView.currentIndex = (listView.currentIndex + 1) % listView.model.count
        }
      }
      

        Attachments

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

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rainmaker rainmaker
            • Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes