View Full Version : A progress bar that has a slider on top of it

11th June 2010, 16:54
Hello everyone! I'm a little bit new at QT and have been playing around with it a bit as my work is using it for GUI elements. My latest widget I've been tasked to build has me running in circles and I'm kinda confused. Essentially what I need is a progress bar with a dragable slider on top of it (along with some tickmark elements and the like, but those I'm confident I can figure out). I've been looking all over this forum and the web to try to find any way of doing it, and though I found one post here with a few answers, it wasn't really effective for what I need to do. Using Phonon's seekslider doesn't seem viable outside of its media context.

The other thing I've seen mentioned is using a style sheet, but these are entirely new to me and I was hoping at the very least somebody could point me in a good direction for some reading that would get me going towards my goal here. I've read the documentation pages, and there is so much there that I have no clue how to start.

Thanks in advance for any help anyone can offer!

11th June 2010, 17:05
What exactly do you mean by "over"? You mean you want those widgets stacked on top of each other or one should be above ("more to the north") the other?

If the latter then simply place two widgets in a vertical layout and you're done. If the former, then subclass QProgressBar, in its constructor create a slider with the progress bar as its parent and reimplement resizeEvent() of the bar where you will adjust the geometry of the slider to the geometry of the progress bar.

11th June 2010, 17:16
Sorry, I should have been smart and attached this initially. I'm looking to essentially have a progress bar that includes a slider, with the progress bar value and the current slider location independent of each other.

Thank you for the idea though. I'll look into the subclass idea and see what I can make happen.