Issue with nested ListViews and scroll bar



  • Hello,

    I am facing a problem with nested ListViews and scroll bar. I want to apply a scroll bar to the outer ListView which may contain multiple children ListViews and these can be of different heights so now the scroll bar is giving me the problem because of the variable heights of the inner ListViews.

    @
    ListView {
    id: list
    anchors.fill: parent
    clip: true
    model: items
    delegate: trackDelegate
    }
    ScrollBar {
    id: verticalScrollBar
    target: list
    clip: true
    }@

    This gives me the scroll bar problem. The contentHeight of "list" becomes dynamic when scrolling down.
    I tried the following:

    @ Flickable{
    id: mainList
    anchors.fill: parent
    contentHeight: list.contentHeight
    clip: true

        ListView {
            id: list
            anchors.fill: parent
            clip: true
            model: items
            delegate: trackDelegate
            interactive: false
        }
    }
    ScrollBar {
        id: verticalScrollBar
        target: mainList
        clip: true
    }@
    

    This fixed the problem but new problem is occurred. If I false the visible property of the item that contains the above component and then set true it hangs the screen and results into Not Responding state.

    please help me to come out of this problem.



  • p


Log in to reply
 

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