Mouse cursor leaving/entering a widget causes repaint for whole widget
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
Re: Mouse cursor leaving/entering a widget causes repaint for whole widget
Are u sure QT paints the whole widget ???
Just check the QPaintEvent::rect() function...
Re: Mouse cursor leaving/entering a widget causes repaint for whole widget
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).
Re: Mouse cursor leaving/entering a widget causes repaint for whole widget
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.
Re: Mouse cursor leaving/entering a widget causes repaint for whole widget
Quote:
Originally Posted by
jimfan
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 :)