/** * @RDE_HEADER@ * small stub to catch SIGTERM for proper shutdown * $Id$ * $HeadURL$ * $Author$ */ #include #include #ifdef Q_OS_WIN #include #include class MyEventFilter final : public QAbstractNativeEventFilter { public: bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override { Q_UNUSED(eventType); Q_UNUSED(result); const MSG *msg = reinterpret_cast(message); if (msg->message == WM_CLOSE && msg->hwnd == nullptr) QCoreApplication::quit(); return false; } }; #endif #ifndef SIGTERM # define SIGTERM 15 #endif static void signalHandler(int signal_number) { if(signal_number != SIGTERM) return; QCoreApplication::quit(); }