[Qt-interest] Best Way To Force Complete Repaint of Widget
Willy P
willy.lists at gmail.com
Tue Oct 6 22:58:13 CEST 2009
Andre,
Thanks for your continued insight. It fixed some of the issues. It
is now not blending w/ junk but w/ a white background as opposed to my
window background. Again, total refreshes paint perfectly:
Total refresh:
http://dl.getdropbox.com/u/147719/Picture%2014.png
Mouseover repaint:
http://dl.getdropbox.com/u/147719/Picture%2015.png
Any thoughts?
On Tue, Oct 6, 2009 at 1:54 AM, Andre Somers <andre at familiesomers.nl> wrote:
> Willy P wrote:
>> I'm encountering some pretty nasty bugs embedding widgets in OpenGL
>> scenes. They are not updating properly and there are some bad
>> blending issues with the scene behind it. However, they work
>> perfectly on total repaint situations, ie when you cover the widget
>> with another window and then show it again.
>>
>> So my question is, how do I force a *total* repaint of the widget and
>> all it's children every time it needs to be updated? It's not a big
>> widget so I'm not concerned w/ the performance issues.
>>
>> I've tried this, but it only sort of solves my problem:
>>
>> void MyWidget::paintEvent( QPaintEvent* pe )
>> {
>> qDebug() << "painting";
>>
>> if( pe->rect() != rect() ) {
>> pe->accept();
>> repaint( rect() );
>> } else {
>> QWidget::paintEvent( pe );
>> }
>> }
>>
>> I say sort of, b/c it works if any child widgets are embedded in
>> layouts, they do not get updated.
>>
>> -Willy
>>
>> PS: This only seems to be a problem on Mac, Windows works fine.
>>
>>
> In that case, why not iterate over the child widgets and force a repaint
> on them too?
> Something like:
>
> QList<QWidget *> widgets = parentWidget.findChildren<QWidget *>();
> foreach (QWidget* w, widgets)
> w->repaint(rect());
>
> If it is only nessecairy on Mac, then I would make sure it is only done
> on Mac too. Use conditional compilation for that.
>
> André
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
More information about the Qt-interest-old
mailing list