PDA

View Full Version : QSlider handle drawing artifacts



TheClassic
9th June 2011, 14:57
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?

high_flyer
9th June 2011, 16:10
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.

TheClassic
9th June 2011, 23:33
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

high_flyer
27th June 2011, 12:48
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.