Scrollbar visibility in QML QridView and Flickable



  • I use QtQuick 2.5 and QtQuick.Controls 2.0 in my QML-Application. For Scrolling in my Windows I us Flickable. The Scrollbar is only visible if the Scrollbar is pressed or if ist Scrolling. Same is in GridViews. Is there a psibility that the scrollbar is always visible.



  • Hello @Locate

    The solution below works but it is not very satisfying.

    It seems adding active: true in a ScrollBar is not enough but I don't know why.

    import QtQuick 2.7
    import QtQuick.Controls 2.0
    
    Rectangle {
        id: demo
        width: 800
        height: 600
        color: "#ff303030"
    
        Flickable {
            id: flick
            anchors.fill: parent
    
            contentWidth: parent.width * 2
            contentHeight: parent.height * 2
    
            ScrollBar.horizontal: ScrollBar {
                active: flick.moving || !flick.moving
    
                // The one below does not nork more than once and the scrollbar
                // goes invisible after the first move
                //active:true
            }
            ScrollBar.vertical: ScrollBar {
                active: flick.moving || !flick.moving
            }
        }
    }
    


  • I found a slution that seems to work.

            ScrollBar.vertical: ScrollBar {
                active: true;
    
                onActiveChanged: {
                    if (!active)
                        active = true;
                }
            }

Log in to reply
 

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