Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QCoreApplication::setEventFilter vs QAbstractEventDispatcher::setEventFilter

QCoreApplication::setEventFilter vs QAbstractEventDispatcher::setEventFilter

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 5.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ixSci
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chuck Gao
      wrote on last edited by
      #2

      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 :).

      Chuck

      1 Reply Last reply
      0
      • I Offline
        I Offline
        ixSci
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved