[Development] Windows plugin customisation: QWindowsKeyMapper

Laszlo Papp lpapp at kde.org
Tue Aug 2 00:07:33 CEST 2022


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();
}

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20220801/c025403d/attachment.htm>


More information about the Development mailing list