Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] Unable to scroll on ListView within Column
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Unable to scroll on ListView within Column

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    literA2
    wrote on last edited by literA2
    #1

    I cannot scroll the pageif I start scrolling within the Listview, however if I start scrolling on the text, it works fine.

    Item {
      anchors {
        top: parent.top
        left: parent.left
        right: parent.right
      }
      implicitHeight: selectItemsColumn.implicitHeight
    
      Column {
        id: selectItemsColumn
        anchors {
          top: parent.top
          left: parent.left
          right: parent.right
        }
        spacing: 50
    
        Text {
           id: title
           anchors {
              left: parent.left
              right: parent.right
           }
           text: "Title"
         }
    
         Item {
           id: itemsHolder
           anchors {
              left: parent.left
              right: parent.right
           }
           implicitHeight: selectList.contentHeight
    
           ListView {
              id: selectList
              anchors.fill: parent
              //model: testModel
              boundsBehavior: Flickable.StopAtBounds
              delegate: Item {}
           }
         }
      }
    

    PS: This qml file is being push into StackView

    Any advise? Thanks.

    1 Reply Last reply
    0
    • CharbyC Offline
      CharbyC Offline
      Charby
      wrote on last edited by
      #2

      Hi literA2,
      I am not sure I have well understood your issue, I think a comprehensive exemple would helps...but I don't understand why do you ensure every containing items to have an implicit height of its content : doesn't it remove the need of the flickable ?

      L 1 Reply Last reply
      0
      • CharbyC Offline
        CharbyC Offline
        Charby
        wrote on last edited by
        #3

        I have modified your exemple to clarify my doubt about the implicit height (the button switch from your design to a height limitation)...is it relevant ?

        import QtQuick 2.2
        import QtQuick.Window 2.1
        import QtQuick.Controls 1.2
        import QtQml 2.2
        
        Window{
            id:page1
            visible:true
        
            width:640
            height:480
        
            property color baseColor : "lightgrey"
            property bool limitHeight : false;
        
            Rectangle {
              color : Qt.darker(itemsHolder.color)
              anchors {
                top: parent.top
                left: parent.left
                right: parent.right
              }
              implicitHeight: page1.limitHeight ? Math.min(300,selectItemsColumn.implicitHeight) : selectItemsColumn.implicitHeight
        
        
              Column {
                id: selectItemsColumn
                anchors {
                  top: parent.top
                  left: parent.left
                  right: parent.right
                }
                spacing: 50
        
                Button{
                    anchors.horizontalCenter: parent.horizontalCenter
                    text: "change height constraint"
                    onClicked: page1.limitHeight = !page1.limitHeight
                }
                Text {
                   id: title
                   anchors {
                      left: parent.left
                      right: parent.right
                   }
                   text: "Title"
                 }
        
        
                 Rectangle {
                   id: itemsHolder
                   color : Qt.darker(page1.baseColor)
                   anchors {
                      left: parent.left
                      right: parent.right
                   }
                   implicitHeight: page1.limitHeight ? Math.min(250,selectList.contentHeight) : selectList.contentHeight
        
                   ListView {
                      id: selectList
                      anchors.fill: parent
                      model: 30//testModel
                      boundsBehavior: Flickable.StopAtBounds
                      delegate: Rectangle{
                          anchors.horizontalCenter: parent.horizontalCenter
                          color:page1.baseColor; width: parent.width *.8;  height: 20
                          Text {
                          anchors.centerIn: parent
                          text:index
                          }
                      }
                   }
                 }
              }
            }
        }
        
        
        1 Reply Last reply
        0
        • CharbyC Charby

          Hi literA2,
          I am not sure I have well understood your issue, I think a comprehensive exemple would helps...but I don't understand why do you ensure every containing items to have an implicit height of its content : doesn't it remove the need of the flickable ?

          L Offline
          L Offline
          literA2
          wrote on last edited by
          #4

          @Charby Thanks for the reply.

          I actually set an implicitHeight on the main Item so that it will be flickable once pushed into StackView's holder.

          My problem is I cannot flick or scroll if i start scrolling on the listview delegates. However, if i will start scrolling on the title, it will scroll up.

          1 Reply Last reply
          0
          • CharbyC Offline
            CharbyC Offline
            Charby
            wrote on last edited by
            #5

            Sorry I still don't understand your issue...

            Do you have the same problem with my example ? Is it the same after having clicked on "change height constraint" ?
            Or please send a complete example so I could reproduce the problem.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              literA2
              wrote on last edited by
              #6

              @Charby Thank you for your time replying on this issue.

              After several tries, i managed to resolved the issue by creating ListView as main component and make use of the header for the title.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved