QCoreApplication::setEventFilter vs QAbstractEventDispatcher::setEventFilter



  • Hi there,

    I need to know what is the difference between installing filter via QCoreApplication::setEventFilter(...) and via
    @ QAbstractEventDispatcher* pMainDispatcher = QAbstractEventDispatcher::instance(qApp->thread());
    pMainDispatcher->setEventFilter(...);@

    As I understood from the documentation, I should have all messages which is sent to the particular application thread event loop via using QAbstractEventDispatcher. So every message initially come to the QAbstractEventDispatcher filter and after that it goes to the QCoreApplication. But when I install event filter to the QAbstractEventDispatcher(like in the piece of code above) I don't receive the WM_POWERBROADCAST message while I receive it via the filter which is installed on QCoreApplication(QCoreApplication::setEventFilter).

    Could anybody explain what I'm doing wrong?



  • Hi ixSci, i don't know the answer, but why not just use the QCoreApplication's event filter. In my opion, QAbstractEventDispatcher is a internal class, and we should not use it in our application.

    Maybe the QCoreApplication will do some initial work before :).



  • bq. QAbstractEventDispatcher is a internal class, and we should not use it in our application

    It is not. For example you have to use it for the hot keys handling in Windows.

    bq. Maybe the QCoreApplication will do some initial work before

    As I understood it should be vice versa


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.