#include <commandkeyreceiver.h>
Inherits QObject.
|
void | capturedKey (Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release) |
|
|
static const std::vector< Qt::Key > | m_composeKeys = {Qt::Key_Shift, Qt::Key_Control, Qt::Key_Meta, Qt::Key_Alt, Qt::Key_AltGr} |
|
Definition at line 27 of file commandkeyreceiver.h.
◆ CommandKeyReceiver()
CommandKeyReceiver::CommandKeyReceiver |
( |
| ) |
|
Definition at line 24 of file commandkeyreceiver.cpp.
bool m_release
check release events
bool m_pass
do not block events just tap them
◆ capturedKey
void CommandKeyReceiver::capturedKey |
( |
Qt::Key |
key, |
|
|
Qt::KeyboardModifiers |
keyModifiers, |
|
|
bool |
release |
|
) |
| |
|
signal |
◆ eventFilter()
bool CommandKeyReceiver::eventFilter |
( |
QObject * |
obj, |
|
|
QEvent * |
event |
|
) |
| |
|
protected |
Definition at line 30 of file commandkeyreceiver.cpp.
References capturedKey(), isComposeKey(), keyEventHandler(), m_pass, and m_release.
32 if (event->type() == QEvent::KeyPress)
34 QKeyEvent* keyEvent =
static_cast<QKeyEvent*
>(event);
36 if ((!keyEvent->isAutoRepeat()) && (!
isComposeKey(static_cast<Qt::Key>(keyEvent->key()))))
40 Qt::KeyboardModifiers keyModifiers;
49 else if (
m_release && (event->type()==QEvent::KeyRelease))
51 QKeyEvent* keyEvent =
static_cast<QKeyEvent*
>(event);
53 if ((!keyEvent->isAutoRepeat()) && (!
isComposeKey(static_cast<Qt::Key>(keyEvent->key()))))
57 Qt::KeyboardModifiers keyModifiers;
67 return QObject::eventFilter(obj, event);
bool m_release
check release events
void keyEventHandler(QKeyEvent *e, Qt::Key &key, Qt::KeyboardModifiers &keyModifiers)
bool m_pass
do not block events just tap them
void capturedKey(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release)
bool isComposeKey(Qt::Key key)
◆ isComposeKey()
bool CommandKeyReceiver::isComposeKey |
( |
Qt::Key |
key | ) |
|
|
private |
◆ keyEventHandler()
void CommandKeyReceiver::keyEventHandler |
( |
QKeyEvent * |
e, |
|
|
Qt::Key & |
key, |
|
|
Qt::KeyboardModifiers & |
keyModifiers |
|
) |
| |
|
private |
Definition at line 70 of file commandkeyreceiver.cpp.
Referenced by eventFilter().
72 key =
static_cast<Qt::Key
>(e->key());
76 keyModifiers = e->modifiers();
80 keyModifiers = Qt::NoModifier;
◆ setPass()
void CommandKeyReceiver::setPass |
( |
bool |
release | ) |
|
|
inline |
◆ setRelease()
void CommandKeyReceiver::setRelease |
( |
bool |
release | ) |
|
|
inline |
◆ m_composeKeys
const std::vector< Qt::Key > CommandKeyReceiver::m_composeKeys = {Qt::Key_Shift, Qt::Key_Control, Qt::Key_Meta, Qt::Key_Alt, Qt::Key_AltGr} |
|
staticprivate |
◆ m_pass
bool CommandKeyReceiver::m_pass |
|
private |
◆ m_release
bool CommandKeyReceiver::m_release |
|
private |
The documentation for this class was generated from the following files: