I am able to get key value's from HAL through a call back function in Qt. Created event for that key by
QKeyEvent *event = new QKeyEvent (QEvent::KeyPress,
inputKey.keyValue,
Qt::NoModifier);
Note: inputKey.keyValue
Key value received from HAL Layer.
Now I need to Register This key event in Qt, So that if any key press happened in IR Remote then in respective form, keyPressEvent(e)
or event(e)
will get invoke. and based on the key press, specific action will get execute.
Note: More than one form is there, where key press event will trigger And more than one keys are there "Page_Up, Page_Down, Ok Key etc....."
tried to invoke Postevent() and connect(.......) but nothing helped me. KeyPressEvent() is not getting executed.
E.g. like this:
You can find more info here.
You can reimplement
QObject::event()
orQWidget::keyPressEvent
in your widget to receive key events. Visit this link or link for more information. See the example code below which consists of two buttons and a label. ClickingpushButton
sends 'enter pressed' andpushButton_2
sends 'letter A pressed'. Key events are received in theevent()
function and label is updated accordingly.