PDA

View Full Version : Howto combine a slider and a progress bar?



Cruz
20th March 2010, 23:35
Hello there,

I would like to create a little widget that all of you should know from YouTube. Underneath the movie player you can see a progress bar that indicates how far the movies is loaded. At the same time you can also use this widget as a slider to navigate in the timeline of the movie. How can I accomplish this in Qt?

The one idea I have is to place a QSlider on top of a QProgressBar and make the background transparent. This could probably work, but I don't see how it's possible to configure this to my favorite look of this kind of widget: a pale red progress indicator in the background and a bright red "slider" in the foreground, that you can click and drag. At least so far I didn't find the right style sheet syntax to color the two halves of a QSlider in different ways.

Other than that, what's left? Starting from a QWidget and implementing all the drawing and mouse handling myself? There must be a better way.

It would be great to abuse a QProgessBar as a slider, but unfortunately it doesn't offer a nice interface to report clicks and value changes, like the QSlider does. Maybe I should subclass a QProgressBar and add the gore details for the mouse handling so that at least I can reuse the painting. Any thoughts?


Thanks
Cruz

wysota
21st March 2010, 02:00
You can probably do it with style sheets.

casual0402
21st March 2010, 06:08
Hi!
Maybe Phonon/SeekSlider will do help for you.
http://doc.trolltech.com/4.4/phonon-seekslider.html

Cruz
21st March 2010, 12:09
Maybe Phonon/SeekSlider will do help for you.

Thanks for the interesting suggestion, but this doesn't look like the right path. The functionalities of the SeekSlider are tied to the MediaObject and it's also unclear how much it can be styled, as it's not listed on the page of stylable widgets.