Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt Quick Controls 1 ScrollView Scrolling Issue

Qt Quick Controls 1 ScrollView Scrolling Issue

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmlcontrols 1.4scrollviewscrollbarquick
1 Posts 1 Posters 682 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    narayanan.krish
    wrote on 19 Oct 2018, 14:05 last edited by
    #1

    Hello all,

    I'm facing an issue in scrolling with Qt Quick Control 1 scrollview. I've 2 touchscreen devices provided by different vendors. Both are running Qt 5.9 on Ubuntu 16.04 64 bit. In one machine I'm able to access the scrollbars (all to scroll up and down), but not able to scroll them in another machine. The following is the sample code I developed to replicate. I would like to understand is there anything specific with the touch driver for the scrolling to work.

    @

    import QtQuick 2.9
    import QtQuick.Controls 1.4
    import QtQuick.Controls.Styles 1.4

    ApplicationWindow {
    id:root
    visible: true
    width: 640
    height: 480
    title: qsTr("Scroll")

    property color scrollBarNormal: "green"
    property color scrollBarPressed: "red"
    
    ScrollView {
        id:view
        anchors.fill: parent
        contentItem: lv
    
        onContentItemChanged:
        {
            console.log("##")
            //contentItem.enabled=false
        }
    
        style: FusionScrollViewStyle {
    
        }
    }
    
    ListView {
        id:lv
        anchors.fill: parent
        model: 200
        delegate: Delegate {
            width: parent.width
        }
    }
    

    }

    import QtQuick 2.9
    import QtQuick.Controls.Styles 1.4

    ScrollViewStyle {
    property real uiScale: 1
    property int scrollBarWidth: 10 * uiScale
    property color scrollBarNormal: "green"
    property color scrollBarPressed: "#ec971f"
    property real contentMargin: 0

    handleOverlap: 0
    
    handle: Item {
        implicitWidth: scrollBarWidth + contentMargin
    
    
        Rectangle {
            anchors.fill: parent
            anchors.leftMargin: contentMargin
            anchors.topMargin: 1
            anchors.bottomMargin: 1
            color: styleData.pressed ? scrollBarPressed : scrollBarNormal
        }
    }
    
    decrementControl: Item {
        implicitWidth: scrollBarWidth + contentMargin
        implicitHeight: scrollBarWidth
    
        Item {
            anchors.fill: parent
            anchors.leftMargin: contentMargin
    
            Rectangle {
                color: styleData.pressed ? scrollBarPressed : scrollBarNormal
                width: parent.width
                height: parent.width / 2
                y: parent.height / 2
            }
    
            Rectangle {
                anchors.fill: parent
                radius: width / 4
                color: styleData.pressed ? scrollBarPressed : scrollBarNormal
            }
    
            Text {
                anchors.centerIn: parent
                text: "\uf106"
                //font.family: fontId.name
                color: "white"
                font.pixelSize: parent.width / 2
            }
        }
    }
    
    incrementControl: Item {
        implicitWidth: scrollBarWidth + contentMargin
        implicitHeight: scrollBarWidth
    
        Item {
            anchors.fill: parent
            anchors.leftMargin: contentMargin
    
            Rectangle {
                color: styleData.pressed ? scrollBarPressed : scrollBarNormal
                width: parent.width
                height: parent.width / 2
            }
    
            Rectangle {
                anchors.fill: parent
                radius: width / 4
                color: styleData.pressed ? scrollBarPressed : scrollBarNormal
            }
    
            Text {
                anchors.centerIn: parent
                text: "\uf107"
                //font.family: fontId.name
                color: "white"
                font.pixelSize: parent.width / 2
            }
        }
    }
    
    scrollBarBackground: Item {
        implicitWidth: scrollBarWidth + contentMargin
    
        Rectangle {
            anchors.fill: parent
            anchors.leftMargin: contentMargin
            color: "#d3d3d3"
        }
    }
    

    }

    Any help is greatly appreciated.

    Thanks & Regards,

    Nara

    1 Reply Last reply
    0

    1/1

    19 Oct 2018, 14:05

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved