Results 1 to 2 of 2

Thread: enterEvent / leaveEvent on Widget really slow on MacOSX

  1. #1
    Join Date
    Jan 2008
    Posts
    56
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default enterEvent / leaveEvent on Widget really slow on MacOSX

    Hi all,

    I ported an application from Windows to MacOSX (10.6) and have some really undesirable behaviour.

    There are about 10 widgets next to eachother and to highlight the current one, I use enterEvent and leaveEvent to change the color of the widget a bit.
    The code is
    Qt Code:
    1. void Widget::enterEvent(QEvent* event)
    2. {
    3. setAutoFillBackground(true);
    4. QPalette pal=palette();
    5. QColor bgnd = pal.color(QPalette::Window);
    6. pal.setColor(QPalette::Window, bgnd.darker(125));
    7. setPalette(pal);
    8. }
    9.  
    10. void Widget::leaveEvent(QEvent* event)
    11. {
    12. setAutoFillBackground(false);
    13. QPalette pal=QApplication::palette();
    14. setPalette(pal);
    15. }
    To copy to clipboard, switch view to plain text mode 

    On Windows and Linux, this works nice and smoothly. The color changes immediately follow the cursor.
    On MacOSX, however, it takes about 500ms for the color to change after the cursor has entered the widget.
    This means, that if the user moves with the cursor from the most left to the most right widget (10 in total), the color changes have about 5 seconds delay in total.

    Any idea what might cause this?

    Best regards,

    Rainer

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: enterEvent / leaveEvent on Widget really slow on MacOSX

    Try calling repaint() after changing the palette.
    That will trigger immidiete repaint and should help for the lag.

Similar Threads

  1. Make image bigger on enterEvent, maller on leaveEvent
    By Globulus in forum Qt Programming
    Replies: 4
    Last Post: 10th August 2011, 15:38
  2. Highligt QGraphicsItem on mouse enterevent.
    By matteo.boscolo in forum Qt Programming
    Replies: 3
    Last Post: 13th June 2010, 12:37
  3. QTable widget works slow :(
    By THRESHE in forum Qt Programming
    Replies: 3
    Last Post: 27th February 2008, 12:54
  4. enterEvent, leaveEvent, setWindowFlags
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 3rd February 2007, 09:15
  5. Subclassed QLabel and enterEvent
    By Lykurg in forum Qt Programming
    Replies: 2
    Last Post: 29th August 2006, 06:44

Tags for this Thread

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.