chore(cpn): generic simulator (#5692)
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
|
||||
/*
|
||||
* This class is somewhat like a QAction but specific for the radio UI.
|
||||
* Actions can have one or more keyboard shortcuts associated with them (currently single-key only, w/out modifiers).
|
||||
* Actions can have one or more keyboard shortcuts associated with them.
|
||||
*/
|
||||
class RadioUiAction : public QObject
|
||||
{
|
||||
@@ -115,11 +115,26 @@ class RadioUiAction : public QObject
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
if ((!keyEvent->modifiers() || keyEvent->modifiers() == Qt::KeypadModifier) && m_keys.contains(keyEvent->key())) {
|
||||
// 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)) &&
|
||||
m_keys.contains(keyEvent->key())) {
|
||||
// qDebug() << "Event:" << event->type() << "Key:" << QString("0x%1").arg(keyEvent->key(), 8, 16, QLatin1Char( '0' )) << "Text:" << keyEvent->text() << "found";
|
||||
trigger(event->type() == QEvent::KeyPress);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// qDebug() << "Key not found";
|
||||
// qDebug() << "Event:" << event->type() <<
|
||||
// "Key:" << QString("0x%1").arg(keyEvent->key(), 8, 16, QLatin1Char( '0' )) <<
|
||||
// "Text:" << keyEvent->text() <<
|
||||
// "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);
|
||||
}
|
||||
}
|
||||
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user