Results 1 to 12 of 12

Thread: Qt widget enter/leave event

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Qt widget enter/leave event

    Hey there,

    I'm using the latest Qt 4.4 snapshot.
    I have a widgets with enter and leave event implementations.

    When I get an enter event I'm highlighting the widget.

    On some very specific cases the enter / leave event is not called.

    For example when deleting a widget and the cursor goes directly inside the next one.

    Is there a more reliable way to detect if the cursor is in or out the widget?

    Thanks.

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

    Default Re: Qt widget enter/leave event

    You can use QWidget::underMouse() to check if the cursor is inside a specific widget.

  3. #3
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: Qt widget enter/leave event

    Thanks,

    I've done several tests.
    It appears those Enter / Leave event are working fine on Qt 4.3.

    In Qt 4.4 the enter / leave event seems different and doesn't work all the time.

    Are you aware of some changes ? Because that issue is not new on the Qt snapshot.

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

    Default Re: Qt widget enter/leave event

    Qt 4.4 is not stable yet, so you use it at your own risk.

  5. The following user says thank you to wysota for this useful post:

    bunjee (7th December 2007)

  6. #5
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: Qt widget enter/leave event

    Do you know when the stable version is scheduled ? January ?

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

    Default Re: Qt widget enter/leave event

    It'll be out in March.

  8. #7
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt widget enter/leave event

    Quote Originally Posted by bunjee View Post
    In Qt 4.4 the enter / leave event seems different and doesn't work all the time. Are you aware of some changes ? Because that issue is not new on the Qt snapshot.
    Read http://labs.trolltech.com/blogs/2007...of-all-flicker and you will understand, why it is very likely to find problems like these in 4.4 snapshots. If you have an important application it's probably a good idea to wait for 4.4.1.

    Uwe

  9. #8
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: Qt widget enter/leave event

    Actually, that's the feature I need for my application to work.

    I'm working on an application heavily based on widgets (to say the least ).

    But I'm not sure if there is a link with my enter/leave events issue.
    And I'm not sure this is even a bug (since widgets are no longer the same in 4.4).

  10. #9
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt widget enter/leave event

    Quote Originally Posted by bunjee View Post
    Actually, that's the feature I need for my application to work. I'm working on an application heavily based on widgets (to say the least ).
    The article is about, that Qt 4.4 will reimplement functionalities of the underlying window system, because it can't control it enough to avoid flickering. How is this related to your application ?
    But I'm not sure if there is a link with my enter/leave events issue.
    "Moving away from native windows isn’t done over the night. Window handles have been in Qt from day one, and consequently our GUI kernel is heavily built around them. The main technical challenges in that respect have been core functionality such as mouse events, widget cursors, enter/leave events, drag’n'drop and so on. With native windows all widget events are related to a window handle and our job is simply to map system events into Qt events. Consequently, when we make our child widgets windowless, all events are related to the top-level window and we have to figure out ourselves which widget is the correct receiver for the given event."
    And I'm not sure this is even a bug (since widgets are no longer the same in 4.4).
    QWidgets will continue being QWidgets: they have to receive exactly the same events. Otherwise almost all applications will break.

    Uwe

  11. The following user says thank you to Uwe for this useful post:

    bunjee (8th December 2007)

  12. #10
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: Qt widget enter/leave event

    With few exceptions you will get enter/leave events when the cursor
    moves in/out of a widget. Exceptions are when there is:

    1) a mouse grabber (QWidget::grabMouse is called).
    2) a mouse button pressed.
    3) a modal dialog.
    4) an active popup.

    The Qt::WA_UnderMouse attribute is set on the entered widget.

    As I said, enter/leave events doesn't quite work how it's suppose to
    work at the moment, but we will look into it.

    --
    Bjoern Erik Nilsen - bnilsen at trolltech.com
    Trolltech ASA - Sandakervn. 116, P.O. Box 4332 Nydalen, 0402 Oslo, Norway
    Here is the trolltech answer.

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

    Default Re: Qt widget enter/leave event

    "The Qt::WA_UnderMouse attribute is set on the entered widget."

    This is your case...

  14. #12
    Join Date
    Dec 2013
    Posts
    8
    Thanks
    4
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Android

    Default Re: Qt widget enter/leave event

    Have you find out what's the point?I encoutered the similar problem as you did.

Similar Threads

  1. Replies: 3
    Last Post: 17th October 2007, 12:52
  2. When is the best time to delete a QCanvasItem
    By irudkin in forum Qt Programming
    Replies: 12
    Last Post: 8th March 2007, 21:28
  3. How to get focus event in child widget
    By YuriyRusinov in forum Qt Programming
    Replies: 4
    Last Post: 17th October 2006, 07:53
  4. [Qt 4.1.0] Split a widget on demand
    By Townk in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2006, 14:16
  5. QRubberBand painting in the scroll area widget
    By SkripT in forum Qt Programming
    Replies: 7
    Last Post: 17th January 2006, 16:48

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.