From 5f49567bf7cf061b7a6661e9db26bdcc1ca115ad Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sat, 18 Jul 2020 04:18:46 +0200 Subject: [PATCH] Make GlobalShortcut::nativeEventFilter compatible with Qt 6 --- src/globalshortcuts/globalshortcut-win.cpp | 5 +++++ src/globalshortcuts/globalshortcut-x11.cpp | 4 ++++ src/globalshortcuts/globalshortcut.h | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/src/globalshortcuts/globalshortcut-win.cpp b/src/globalshortcuts/globalshortcut-win.cpp index 90622f47c..c7cdeca6f 100644 --- a/src/globalshortcuts/globalshortcut-win.cpp +++ b/src/globalshortcuts/globalshortcut-win.cpp @@ -54,7 +54,12 @@ bool GlobalShortcut::unregisterShortcut(quint32 native_key, quint32 native_mods) return UnregisterHotKey(0, native_mods ^ native_key); } + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +bool GlobalShortcut::nativeEventFilter(const QByteArray &eventtype, void *message, qintptr *result) { +#else bool GlobalShortcut::nativeEventFilter(const QByteArray &eventtype, void *message, long *result) { +#endif Q_UNUSED(eventtype); Q_UNUSED(result); diff --git a/src/globalshortcuts/globalshortcut-x11.cpp b/src/globalshortcuts/globalshortcut-x11.cpp index bcd60580e..a38e4ce15 100644 --- a/src/globalshortcuts/globalshortcut-x11.cpp +++ b/src/globalshortcuts/globalshortcut-x11.cpp @@ -82,7 +82,11 @@ bool GlobalShortcut::unregisterShortcut(quint32 native_key, quint32 native_mods) return true; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +bool GlobalShortcut::nativeEventFilter(const QByteArray &eventtype, void *message, qintptr *result) { +#else bool GlobalShortcut::nativeEventFilter(const QByteArray &eventtype, void *message, long *result) { +#endif Q_UNUSED(eventtype); Q_UNUSED(result); diff --git a/src/globalshortcuts/globalshortcut.h b/src/globalshortcuts/globalshortcut.h index ebc8c238b..49ba4549d 100644 --- a/src/globalshortcuts/globalshortcut.h +++ b/src/globalshortcuts/globalshortcut.h @@ -61,7 +61,11 @@ class GlobalShortcut : public QObject, QAbstractNativeEventFilter { bool registerShortcut(quint32 native_key, quint32 native_mods); bool unregisterShortcut(quint32 native_key, quint32 native_mods); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + bool nativeEventFilter(const QByteArray &eventtype, void *message, qintptr *result) override; +#else bool nativeEventFilter(const QByteArray &eventtype, void *message, long *result) override; +#endif static GlobalShortcut *initialized_; static QHash, GlobalShortcut*> internal_shortcuts_;