I've a problem catching WM_QUERYENDSESSION inside my QAbstractEventDispatcher function. Main window implements closeEvent() with event->ignore(). This prevents application to exit on system(win) shutdown. Threrefore I've set global event filter:
Qt Code:
  1. QAbstractEventDispatcher::EventFilter origEventFiler;
  2. bool testEventFilter(void *message)
  3. {
  4. MSG* m=static_cast<MSG*>(message);
  5. if (m->message == WM_QUERYENDSESSION) qDebug()<<"Shutdown detected!";
  6. if (origEventFiler) origEventFiler(message);
  7. return false;
  8. }
  9. ...
  10. origEventFiler=d->setEventFilter(digicongEventFilter);
To copy to clipboard, switch view to plain text mode 
testEventFilter catches messages, but not the WM_QUERYENDSESSION. I thought message comes at first to testEventFilter() and then will be processed by Qt event loop. It seems to be not the case. How can I provide proper shutdown without changing main window code?