Important: Please read the Qt Code of Conduct -

ScrollView.verticalScrollBarPolicy not working on Qt 5.4?

  • Hi, I am trying to keep the vertical scrollbar always on the screen in my ScrollView for clarity. I was hoping that the property verticalScrollBarPolicy with the value Qt.ScrollBarAlwaysOn could accomplish this. I'm afraid the result is the same as with Qt.ScrollBarAsNeeded: the scroll bar will appear only when doing some flicking action on the view, with which I mean using the mouse scroll or a touch pad for instance on desktop.

    I am using Qt 5.4.

    Any tips, other than installing latest Qt? Is this a bug?


  • Hi! This works for me with Qt 5.6.0:

    import QtQuick 2.5
    import QtQuick.Window 2.2
    import QtQuick.Controls 1.4
    Window {
        visible: true
        width: 1000
        height: 600
        ScrollView {
            anchors.fill: parent
            verticalScrollBarPolicy: Qt.ScrollBarAlwaysOn
            Image { source: "file:///home/pw/img.jpg" }

Log in to reply