Important: Please read the Qt Code of Conduct -

How to install multiple event filter on qApp??

  • Hi All,
    Is there any possibility of installing multiple event filters on qApp? I want to read one file and based on the contents i have to make the keys disable, when new window is opened then another file is read and based on that new keys are added/removed in the list that needs to be blocked. When i dispose a window then i should delete/uninstall the specific event filter.

    Is it possible in QT? Or any other mechanism i have to follow? Kindly give me some pointers how to proceed.


  • Lifetime Qt Champion


    Shouldn't you rather crate a configurable filter object ?

    Should the filter only work for certain widget at certain time or globally ?

  • @SGaist Thanks for your reply. The filter should be a global filter. If at one time one filter is present and then another filter is applied then the overall it is viewed as a union of the both filters and again when the latest filter is removed then i have to revert back to old filter. Filter is nothing but just filtering of key and mouse events based on QRect.

    Can you please send me some links on configurable filter object. I was unable to find in QT help. How to install more than one event filter to qApp??

    Thanks :)

  • @SGaist Is it possible to modify the event filter at run time? Or i need to remove the event filter and install it again?

  • Lifetime Qt Champion

    Your event filter is nothing more than a standard QObject where you reimplement the eventFilter method. From there it's up to you to make it configurable the way you want it to be

  • @SGaist I got it. Thanks for the reply. Cheers