[solved] Flickable doesn't function in a Column



  • Hello,

    I have a Column, where only some Elements are seen, the others should appear upon scrolling.
    Here is my code:

    @
    Flickable {
    width: parent.width
    height: parent.height
    flickableDirection: Flickable.VerticalFlick
    clip: true

                Column {
                    id: column
                    width: contentLayout.width*0.9
                    height: contentLayout.height*0.9
                    anchors {
                        horizontalCenter: parent.horizontalCenter
                        verticalCenter: parent.verticalCenter
                    }
                    spacing: width*0.05
    
                    FirstComponent {}
                    SecondComponent {}
                    ThirdComponent {}
          }
    

    }
    @

    It shows the first two Components alright. When I flick I can also see the third component, but it snaps back down after i release the mouse.

    Can anyone help me out here?

    Best regards



  • Hi, I think you have to set the contentHeight of the Flickable to the height of the Column, also the Column height should be the height of all children, usually you don't need to set the height in a Column unless the child elements have no implicit height. I see you are also using anchors in the Flickable, the Column should fill the flickable by itself, I don't know if that is a good idea to use anchors there.
    From my experience with Flickable you get this issue when the content size is not set or not correct.



  • Hi!
    I tried to set the contentHeight and contentWidth like this:

    @
    Flickable {
    width: parent.width
    height: parent.height
    contentHeight: column.height
    contentWidth: column.width
    flickableDirection: Flickable.VerticalFlick
    clip: true

                Column {
                               id: column
                               .......
                }
    

    }
    @

    But it still doesn't function. :(
    More suggestions?



  • Hey,

    The flickable contentheight should be higher than the parent height.
    Add contentHeight: parent.height * 2

    Hope this helps.

    Ansif



  • Thank you! That was it! Now it functions. :)

    Best regards,

    Jago


  • Moderators

    Hi,

    Please add [solved] to the topic so everyone can see that this problem is solved. You can do that by editing your first post.



  • Glad I could help you.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.