Results 1 to 4 of 4

Thread: Filtering Events on "black-box" objects

  1. #1
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Question Filtering Events on "black-box" objects

    Hello,

    I have another mouse propagation question, this time with a twist!

    I have a set of Widgets enclosed in DLLs that are loaded by my application, and I want to monitor all mouse activity, i.e. when the user clicks one my main application intercepts it first to check it before passing it on.

    However, the enclosed objects arn't necessarily QWidgets, and they may be made up of a number of QWidgets themselves.

    Would an event filter work if I installed it just on the parent widget passed by the exported constructor? Or would this only intercept events to that widget and the child ones created by it (which my application has no knowledge of) continue to receieve events unhindered?

    Thanks!

  2. #2
    Join Date
    Apr 2008
    Location
    Russia, Moscow
    Posts
    86
    Thanks
    2
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4

    Default Re: Filtering Events on "black-box" objects

    You must recursively run installEventFilter on all childs of childs etc. Try use method QObject::children().

  3. #3
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Filtering Events on "black-box" objects

    use qApp->installEventFilter(this).

    this way u can moniter everything

  4. The following user says thank you to nish for this useful post:

    sebastian.f (12th June 2009)

  5. #4
    Join Date
    Apr 2009
    Posts
    19
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Filtering Events on "black-box" objects

    Thanks for your replies!

    I've tried to make the event filter process as simple as possible and so tried installing an event filter on the main application, and it works brilliantly.

    Thank you very much, I thought I was going to have to end up redesigning the whole thing!

Similar Threads

  1. Filtering all mouse/keyboard events
    By maverick_pol in forum Qt Programming
    Replies: 9
    Last Post: 27th November 2008, 17:03
  2. Replies: 1
    Last Post: 21st August 2007, 16:25
  3. processevents, filtering events
    By sreedhar in forum Qt Programming
    Replies: 1
    Last Post: 24th June 2006, 22:49

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.