Results 1 to 4 of 4

Thread: QSlider handle drawing artifacts

  1. #1
    Join Date
    May 2011
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QSlider handle drawing artifacts

    I have a QSlider that is a child of a widget that does 3D drawing. When I drag the slider handle artifacts of where the handle has been are left behind (the handle is "smeared"). How can I fix this?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QSlider handle drawing artifacts

    I guess your slider is on a QGLWidget or maybe some other self drawing viewport.
    The effect is caused by the fact that you are not updating that widget when you move the slider.
    One easy way would be to connect the slider valueChanged() signal to the update() slot of your QGLWidget.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    TheClassic (9th June 2011)

  4. #3
    Join Date
    May 2011
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSlider handle drawing artifacts

    Thanks, that makes sense. Its not a QGLWidget, but its something similar that does OpenGL drawing in a seperate thread. I have a second question which I think has the same answer.
    I have a widget that serves only as a container for a few child widgets (on top of this same 3D . I don't want to draw this container widget (just its children), and have tried overriding the paintEvent with an empty implementation, however it still appears to be drawing the widget, or at least the 3D drawing widget underneath is obscured by it. Is this the same problem? I found one work around for this is to just use a QObject to contain the other widgets instead, although it obviously requires me to reimplement things like move(), hide(), etc

  5. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QSlider handle drawing artifacts

    Is this the same problem?
    Kind of.
    You widget which is on top of your 3D widget has no information about the 3D stuff being rendered, so it can't use that information to behave as transparent.
    Your workaround sounds a good way to do it.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. QSlider: Increase handle size -> How ?
    By ArneBurghardt in forum Qt Programming
    Replies: 6
    Last Post: 11th August 2016, 20:58
  2. QSlider: changing the groove without changing the handle
    By Olivier Berten in forum Qt Programming
    Replies: 3
    Last Post: 30th April 2013, 10:02
  3. QGraphicsScene artifacts
    By psih128 in forum Qt Programming
    Replies: 7
    Last Post: 17th February 2011, 13:19
  4. How to put custom handle image in QSlider using code?
    By montylee in forum Qt Programming
    Replies: 6
    Last Post: 29th January 2009, 19:38
  5. QSlider custom handle image not displayed
    By planglois in forum Qt Programming
    Replies: 1
    Last Post: 5th September 2008, 13:49

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.