How-to move vertical scrollbar on left side of ScrollView?



  • Hi all,

    I have create a custom scrollbar for my ScrollView with a ScrollViewStyle sub class, to have something like this:
    0_1521795892460_2ca6fd4c-115c-4a0a-aade-dbc0d7d555f3-image.png

    But this Scrollbar always appears on right side of the ScrollView, is there a way to move it on the left side?

    Seems to be so easy... but I don't find how to do this!

    Regards

    Fabrice



  • @KroMignon
    hi,

    looking through the implementation, it says that the vertical scrollbar is anchored to the right:

    ScrollBar {
            id: vscrollbar
            readonly property int scrollAmount: contentHeight - availableHeight
            readonly property bool scrollable: scrollAmount > 0
            isTransient: !!__panel && !!__panel.isTransient
            active: !!__panel && (__panel.sunken || __panel.activeControl !== "none")
            enabled: !isTransient || __panel.visible
            orientation: Qt.Vertical
            visible: verticalScrollBarPolicy === Qt.ScrollBarAsNeeded ? scrollable : verticalScrollBarPolicy === Qt.ScrollBarAlwaysOn
            width: visible ? implicitWidth : 0
            z: 1
            anchors.bottom: cornerFill.top
            maximumValue: scrollable ? scrollAmount + __viewTopMargin : 0
            minimumValue: 0
            anchors.right: parent.right
            anchors.top: parent.top
            anchors.topMargin: __scrollBarTopMargin + topMargin
            anchors.rightMargin: rightMargin
            onScrollAmountChanged: {
                if (flickableItem && (flickableItem.atYBeginning || flickableItem.atYEnd)) {
                    value = flickableItem.contentY - flickableItem.originY
                }
            }
            onValueChanged: {
                if (flickableItem && !blockUpdates && enabled) {
                    flickableItem.contentY = value + flickableItem.originY
                }
            }
            Binding {
                target: vscrollbar.__panel
                property: "raised"
                value: hscrollbar.active || scrollHelper.active
                when: vscrollbar.isTransient
            }
            Binding {
                target: vscrollbar.__panel
                property: "visible"
                value: true
                when: !vscrollbar.isTransient || scrollHelper.active
            }
            function flash() {
                if (vscrollbar.isTransient) {
                    vscrollbar.__panel.on = true
                    vscrollbar.__panel.visible = true
                    vFlasher.start()
                }
            }
            Timer {
                id: vFlasher
                interval: 10
                onTriggered: vscrollbar.__panel.on = false
            }
        }
    

    So i don't think you can change it.

    But you should be able can make your own Scrollbar component and place it wherever you like it to be.



  • @J.Hilk thanks for your help. In fact, it seems not to be supported :(


Log in to reply
 

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