Results 1 to 5 of 5

Thread: Mouse cursor leaving/entering a widget causes repaint for whole widget

  1. #1
    Join Date
    Dec 2007
    Posts
    15
    Qt products
    Qt4 Qt/Embedded

    Question 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

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 333 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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...

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default 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).

  4. #4
    Join Date
    Dec 2007
    Posts
    15
    Qt products
    Qt4 Qt/Embedded

    Default 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.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Mouse cursor leaving/entering a widget causes repaint for whole widget

    Quote Originally Posted by jimfan View Post
    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

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.