6#include <QAbstractEventDispatcher>
7#include <QLoggingCategory>
9CHook* CHook::GetHook(QObject *parent)
17CHookUnix::CHookUnix(QObject *parent)
25CHookUnix::~CHookUnix()
30int CHookUnix::RegisterKeyboard()
32 if(!m_pNativeEventFilter)
37#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
38 qApp->installNativeEventFilter(m_pNativeEventFilter);
40 if(QCoreApplication::eventDispatcher())
41 QCoreApplication::eventDispatcher()->installNativeEventFilter(m_pNativeEventFilter);
46int CHookUnix::UnRegisterKeyboard()
48 if(!m_pNativeEventFilter)
return -1;
50#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
51 qApp->removeNativeEventFilter(m_pNativeEventFilter);
53 if(QCoreApplication::eventDispatcher())
54 QCoreApplication::eventDispatcher()->removeNativeEventFilter(m_pNativeEventFilter);
The class is the HOOK abstract class.