PDA

View Full Version : Mouse cursor leaving/entering a widget causes repaint for whole widget



jimfan
1st March 2008, 01:19
Hi All,

I am just wondering is this a Qt design intent to repaint the widget when mouse cursor enters/leaves the widget? Is there any way to just partially repaint the changed area for the widget in this case?

Thanks

aamer4yu
1st March 2008, 07:38
Are u sure QT paints the whole widget ???
Just check the QPaintEvent::rect() function...

wysota
1st March 2008, 09:49
In case of enter/leave events probably the whole widget is repainted. But this is a case only if the widget has Qt::WA_Hover attribute set (the style used can override the attribute for any widget it sees fit).

jimfan
3rd March 2008, 18:53
Thanks for your information Wysota, one more question though, can I just call setAttribute in the widget constructor to make sure this attribute is set to false? I tried that and it seems that Qt is still repainting the widget so just wondering if I missed anything..

BTW, I turned on QT_FLUSH_PAINT environment variable and that's how I see it's repainting the whole widget.

Thanks.

wysota
3rd March 2008, 23:15
Thanks for your information Wysota, one more question though, can I just call setAttribute in the widget constructor to make sure this attribute is set to false? I tried that and it seems that Qt is still repainting the widget so just wondering if I missed anything..
No, you can't. The style may override the hover attribute. You just have to live with it. Or change the style to one that doesn't have hover effects :)