Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Transparent scroll bar in QListView
Forum Updated to NodeBB v4.3 + New Features

Transparent scroll bar in QListView

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 5.6k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    munknex
    wrote on last edited by
    #1

    I'd like to make a background of a scrollbar of QListView transparent. It should be painted over the content. Something like "this":http://i.imgur.com/P3aIh.png. I searched for where is the scrollbar drawn but find nothing. :) Please, point me to methods I need to reimplement. Or may be it can be done by qss?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      munknex
      wrote on last edited by
      #2

      As far as I can see, the position of the scroll bar is set in the private class QAbstractScrollAreaPrivate::layoutChildren(). So this is the method I need to reimplement, but is it ok to derive from privite class? Are there any workarounds?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        Why not use a QML-based list instead then? In QML, this is very easy while in the QWidget world, this is quite a hassle. You can keep the rest of your application using classic widgets, but just replace your QListView with a QDeclarativeView, load a QML file that defines the list and the delegates for the items, and set your model as the model for the list. I think that makes it far easier to reach your goal of creating a list like you show on the screenshot.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          munknex
          wrote on last edited by
          #4

          I ended up with this hack. I just created a new vertical scroll bar, placed it onto viewport and connected it with the original scroll bar. Then I just hidden the original scrollbar :)

          !http://i.imgur.com/N6e62.png(scrollbar over the view)!

          1 Reply Last reply
          0
          • A Offline
            A Offline
            alnzo
            wrote on last edited by
            #5

            Hey @munknex how did you place it onto the viewport? I'm currently trying something really similar to what you achieved but I haven't had any succes yet

            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