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. ScrollBar handle customization
Forum Updated to NodeBB v4.3 + New Features

ScrollBar handle customization

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 641 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.
  • U Offline
    U Offline
    umit sivri
    wrote on last edited by
    #1

    Hi,

    I want to customize QtQuick.Controls scrollbar scroll to something similar to below:

    Untitled.png

    I can't find a way to customize scrollbar handle. My code until now is:

    ScrollBar.vertical: ScrollBar {
                id: scroll
                active: true
                policy: ScrollBar.AlwaysOn
                visible: true
                anchors {
                    top: listView.top
                    bottom: listView.bottom
                }
    
                contentItem: Rectangle {
                    id: bckground
                    implicitWidth: scrollBarWidth
                    implicitHeight: 30
                    height: 0.5
                    color: "red"
                    anchors.right: parent.right
                    radius: scrollBarWidth / 2
                }
    
            }
    

    Isn't there a way to customize scrollbar handle like the image above?

    Thanks

    1 Reply Last reply
    0
    • MarkkyboyM Offline
      MarkkyboyM Offline
      Markkyboy
      wrote on last edited by
      #2

      https://doc.qt.io/qt-5/qtquickcontrols2-customize.html#customizing-scrollbar

      Don't just sit there standing around, pick up a shovel and sweep up!

      I live by the sea, not in it.

      1 Reply Last reply
      0
      • U Offline
        U Offline
        umit sivri
        wrote on last edited by
        #3

        Thanks but what I want to do is more customization than the content in the link.
        I wnat to make handle height fixed, not changing according to content size.

        This should be doable, seems like a simple change. I don't believe scrollbar is so rigid that won't allow such customizations.

        MarkkyboyM 1 Reply Last reply
        0
        • U umit sivri

          Thanks but what I want to do is more customization than the content in the link.
          I wnat to make handle height fixed, not changing according to content size.

          This should be doable, seems like a simple change. I don't believe scrollbar is so rigid that won't allow such customizations.

          MarkkyboyM Offline
          MarkkyboyM Offline
          Markkyboy
          wrote on last edited by
          #4

          Well, the link I set, is from QML, it gives you basics of customising 'background' and 'contentItem'. of ScrollBar.

          The image you give is styled more like a Slider rather than a scrollbar.

          Don't just sit there standing around, pick up a shovel and sweep up!

          I live by the sea, not in it.

          1 Reply Last reply
          0

          • Login

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