Results 1 to 2 of 2

Thread: mouseMove Event

  1. #1
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default mouseMove Event

    Hi,
    I've a problem with mouseMoveEvet reimplementation. I've a class called myMainWindow witch inherit from QWidget and I reimplement it's mouseMoveEvent to know every time the position of the mouse on the screen. I set for it's istance the setMouseTracking(true).
    The myMainWindow mainWindow istance has 3 child ( each has several widget inside) in a grid layout so my mouseMoveEvet don't work. It works only in the space between two child. I think that the solution is to set setMouseTracking for all the widgets on the screen but it requires a lot of work.
    Is there a way to say to all child of mainWindow to tracking the mouse move event?

  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: mouseMove Event

    Your problem is that first an event is delivered to the "youngest" (in parent-child relationship) widget occupying a particular coordinates. Only if this widget ignores the event, it will propagate to the widget's parent eventually reaching your widget where you monitor for mouse moves. So you have basically two choices if any of your child widgets handle the events themselves - either reimplement their mouse event handlers and explicitely ignore events or install an event Filter (see QObject::eventFilter for details) on each child and handle the event in the filter (remember to return false if you want the event to reach the target it was originally meant for).

Similar Threads

  1. QDockWidget-title
    By moowy in forum Qt Programming
    Replies: 18
    Last Post: 23rd April 2014, 20:13
  2. Replies: 1
    Last Post: 16th October 2007, 22:41
  3. The event fired by the mouse click on the frame
    By Placido Currò in forum Qt Programming
    Replies: 8
    Last Post: 3rd March 2007, 09:05
  4. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55
  5. Replies: 6
    Last Post: 3rd February 2006, 09: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.