Hi again,

I wrote this example program, but it does not seem to work. The filter is
never hit on Windows even though I copied the qwindow.dll to the platforms
directory of my build tree. Do you know this would not work on Windows? The
filter is hit on Mac and Linux. Thanks.

Kind regards,
László

#include <QAbstractNativeEventFilter>
#include <QApplication>

#include <iostream>

class MyMSGEventFilter : public QAbstractNativeEventFilter
{
public:
    bool nativeEventFilter(const QByteArray &eventType, [[maybe_unused]]
void *message, long *) override
    {

        std::cout << eventType.toStdString() << std::endl;
#ifdef Q_OS_WIN
        if (eventType == "windows_generic_MSG") {
            MSG *msg = static_cast<MSG *>(message);
        } else if (eventType == "windows_dispatcher_MSG") {
            MSG *msg = static_cast<MSG *>(message);
        }
#endif
        return false;
    }
};

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    MyMSGEventFilter filterObject;
    app.installNativeEventFilter(&filterObject);
    return app.exec();
}

>
_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to