0

I design an application where I will not have access to the system keyboard (writing under Debian). It is for this key panel monitor connected via RS232. The buttons have to emit the keys Tab, Backtab, arrows and Enter. In the class of the main dialog , I emit signals corresponding buttons, ie.

if (key == KEY_TAB)
{
    emit KeyPressTab ();
}

This signal is captured in the various dialog boxes by using the call:

QObject :: connect (mainwindow, SIGNAL (KeyPressTab ()), this, SLOT (OnKeyPressTab ()));

In turn, the same function slot is:

void SecondDialog :: OnKeyPressTab ()
{
    QKeyEvent event (QEvent :: KeyPress, Qt :: Key_Tab, Qt :: NoModifier);
    QApplication :: sendEvent (this, & event);
}

In this way, tabulation and BackTab works without a problem, but the arrow and enter not work. I am using the same mechanism, such as:

------------------------------- ----------------- Main Window ------------
if (key == KEY_LEFT)
    emit KeyPressLeft ();

------------------------------- ----------------- Second Dialog-----------
QObject :: connect (mainwindow, SIGNAL (KeyPressLeft ()), this, SLOT (OnKeyPressLeft ()));

void SecondDialog:: OnKeyPressLeft ()
{
    QKeyEvent event (QEvent::KeyPress, Qt::Key_left, Qt::NoModifier);
    QApplication :: sendEvent (this, & event);
}

Unfortunately, no reaction.

For clarification I posted algorithm below.

enter image description here

0 Answers0