Important: Please read the Qt Code of Conduct -

[Solved] global eventfilter?! is it possible?

  • Hello,

    I have some pages (QWidgets) and a user system.
    I want to reset the userlevel after a timespan without any mouse events.
    But how can I do that? Do I have to make an eventfilter in every widget
    or is there a better way?

  • You could install an event filter on the QApplication object instead. Note that this will only catch events for your application. If the user is working with another application in the meantime, this method will not catch that.

  • thank you for your help, it's working now.
    But could this be a performance leak? i catch every
    event and only if it's a mousepressevent, I do something,
    otherwise I send it back with return QObject::eventFilter(object,event);

  • Without seeing your code, I cannot say for sure if you're leaking memory, but I don't think so. Note that you should probably not really handle any event you receive. You only want to know about the events, but you don't want to process them.

  • thx

Log in to reply