Results 1 to 4 of 4

Thread: Howto combine a slider and a progress bar?

  1. #1
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Howto combine a slider and a progress bar?

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Howto combine a slider and a progress bar?

    You can probably do it with style sheets.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2010
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Howto combine a slider and a progress bar?

    Hi!
    Maybe Phonon/SeekSlider will do help for you.
    http://doc.trolltech.com/4.4/phonon-seekslider.html

  4. #4
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Howto combine a slider and a progress bar?

    Quote Originally Posted by casual0402 View Post
    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.

Similar Threads

  1. how to combine keypress event and mousebuttonpress event?
    By hildebrand in forum Qt Programming
    Replies: 2
    Last Post: 26th May 2009, 23:08
  2. Combine C++ Qt with PyQT
    By NoRulez in forum Qt Programming
    Replies: 1
    Last Post: 7th January 2009, 16:14
  3. Replies: 4
    Last Post: 11th March 2008, 11:44
  4. Rotating a slider...
    By ACFred in forum Newbie
    Replies: 7
    Last Post: 24th February 2008, 15:56
  5. get slider value
    By eric in forum Qt Programming
    Replies: 1
    Last Post: 8th November 2007, 19:47

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.