Skip to content

Commit

Permalink
Fix key event no modifier test
Browse files Browse the repository at this point in the history
  • Loading branch information
elecpower committed Dec 22, 2024
1 parent 31009ea commit e19e20e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion companion/src/simulation/radiouiaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,18 @@ class RadioUiAction : public QObject
bool eventFilter(QObject * obj, QEvent * event)
{
if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {

QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
qDebug() << "Key:" << keyEvent->key() <<
"Text:" << keyEvent->text() <<
"Modifiers:" << keyEvent->modifiers() <<
"Shift:" << (bool)(keyEvent->modifiers() & Qt::ShiftModifier) <<
"Keypad:" << (bool)(keyEvent->modifiers() & Qt::KeypadModifier) <<
"Ctrl:" << (bool)(keyEvent->modifiers() & Qt::ControlModifier) <<
"Alt:" << (bool)(keyEvent->modifiers() & Qt::AltModifier) <<
"Meta:" << (bool)(keyEvent->modifiers() & Qt::MetaModifier);
// Note: Qt::KeypadModifier is required for arrow keys as they are considered part of the keypad
if ((keyEvent->modifiers() & Qt::NoModifier || keyEvent->modifiers() & Qt::ShiftModifier || keyEvent->modifiers() & Qt::KeypadModifier) &&
if (((keyEvent->modifiers() == Qt::NoModifier) || (keyEvent->modifiers() & Qt::ShiftModifier) || (keyEvent->modifiers() & Qt::KeypadModifier)) &&
m_keys.contains(keyEvent->key())) {
qDebug() << "Key found in list";
trigger(event->type() == QEvent::KeyPress);
Expand Down

0 comments on commit e19e20e

Please sign in to comment.