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

Not possible to resize SplitView when contents contain ListView with SplitView in delegate

    XMLWordPrintable

Details

    • Linux/X11

    Description

      I stumbled upon a problem using SplitView in my application, and have created a minimal example to reproduce it.

      What happens is that the vertical SplitView bar cannot be moved if the ListView is at index 0 or 1. If you press the button "2", the splitter can be moved. Pressing buttons 0 or 1 makes it "locked" again.

      The example has a horizontal SplitView, where the left item is a ListView that uses a vertical SplitView in its delegate.

       

      import QtQuick 2.13
      import QtQuick.Controls 2.13
      import QtQuick.Layouts 1.13
      import QtQuick.Window 2.13
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")    
          header: ToolBar {
              RowLayout {
                  TabBar {
                      id: theTabBar
                      Repeater {
                          model: listView.model
                          delegate: TabButton {
                              text: index
                              onClicked: listView.currentIndex = index
                          }
                      }
                  }
              }
          }    
      
          SplitView {
              anchors.fill: parent
              orientation: Qt.Horizontal        
              ListView {
                  id: listView
                  SplitView.fillHeight: true
                  SplitView.fillWidth: true            
                  property var colors: ["red","green","blue"]            
                  orientation: ListView.Horizontal
                  currentIndex: theTabBar.currentIndex
                  interactive: false
                  highlightMoveDuration: 50
                  highlightRangeMode: ListView.StrictlyEnforceRange
                  snapMode: ListView.SnapOneItem            
                  model: colors.length
                  delegate: Item {
                      width: ListView.view.width
                      height: ListView.view.height
                      SplitView {
                          orientation: Qt.Vertical
                          anchors.fill: parent
                          Rectangle {
                              SplitView.fillHeight: true
                              color: listView.colors[index]
                              Label {
                                  anchors.centerIn: parent
                                  text: index
                              }
                          }
                          Rectangle {
                              SplitView.minimumHeight: 30
                              color: "brown"
                              Label {
                                  text: "This splitter works fine"
                              }
                          }
                      }
                  }
              }        
              Rectangle {
                  color: "gray"
                  SplitView.minimumWidth: 300
                  SplitView.fillWidth: true
                  Label {
                      anchors.fill: parent
                      text: "<-- MOVE THIS\nWorks if button 2 is pressed\nDoes not work with button 0"
                  }
              }
          }
      }
      
      

       

      Attachments

        1. splittertest.tar.gz
          1 kB
          Ola Røer Thorsen
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            olathorsen Ola Røer Thorsen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes