ScreenTranslator/GlobalActionHelper.h

30 lines
911 B
C
Raw Normal View History

2013-11-23 13:48:34 +07:00
#ifndef GLOBALACTIONHELPER_H
#define GLOBALACTIONHELPER_H
// Some functions copied from QXT lib
#include <QAbstractNativeEventFilter>
#include <QAction>
2015-09-23 01:41:08 +07:00
class GlobalActionHelper : public QAbstractNativeEventFilter {
2013-11-23 13:48:34 +07:00
public:
bool nativeEventFilter (const QByteArray &eventType, void *message,
long *result);
static void init ();
2015-09-23 01:41:08 +07:00
static bool makeGlobal (QAction *action);
static bool removeGlobal (QAction *action);
2013-11-23 13:48:34 +07:00
private:
2015-09-23 01:41:08 +07:00
static QHash<QPair<quint32, quint32>, QAction *> actions_;
2013-11-23 13:48:34 +07:00
static quint32 nativeKeycode (Qt::Key key);
static quint32 nativeModifiers (Qt::KeyboardModifiers modifiers);
static bool registerHotKey (quint32 nativeKey, quint32 nativeMods);
static bool unregisterHotKey (quint32 nativeKey, quint32 nativeMods);
2015-09-27 22:58:06 +07:00
static void triggerHotKey (quint32 nativeKey, quint32 nativeMods);
2013-11-23 13:48:34 +07:00
};
#endif // GLOBALACTIONHELPER_H