PDA

View Full Version : Implementing Spotify's volume slider with QSlider.



Victor Moreau
19th May 2017, 22:06
Hi everyone, this is my first post!

So, I'm trying to create a volume slider similar to the one found in the desktop version of Spotify on Windows. I'm posting images showing the behaviors I'm interested in if you are not familiar with Spotify. As you see when you hover the sub-page is turning green and the handle appears. So my issues are 2.

1) Can't turn green the sub-page on QSlider::sub-page:hover.
2) Can't show the handle only on QSlider::groove:hover.

I don't know if it is doable with setStyleSheet(), but I prefer it over having to subclass QSlider. I'm happy to post the relevant code if you want, though I believe that I can't set background on sub-page.

wysota
1st June 2017, 22:40
Stylesheets are deprecated. It's very easy to do what you want by drawing a custom slider.

d_stranz
3rd June 2017, 22:30
Stylesheets are deprecated.

@wysota: Welcome back. Can you please provide a link? I'm not finding anything in the online documentation of obsolete / deprecated classes that references style sheets.

wysota
4th June 2017, 17:41
Thanks. It's deprecated not in terms that they are going to vanish any time soon. I can't give you a docs link, I think my info is based on some other source (blog, DevDays presentation? Can't remember right now). One way or another this technology is not developed anymore and there are many pieces missing there so it's hardly usable for anything more advanced than making a red push-button.