PDA

View Full Version : setAccel does not work with QKeyEvent



Ezio Sella
6th October 2015, 08:00
Hi Everybody,

I am working with qt3.3.8b.

I add a QKeyEvent as describe below:



....
QWidget* targetWidget = QApplication::focusWidget();
QKeyEvent kev(QEvent::KeyPress, Qt::Key_F1, 0, Qt::NoButton, NULL, false, 1);
QApplication::sendEvent(targetWidget, &kev);
.....


It works fine on the main widget::keyPressEvent(QKeyEvent *k), i can receive
the key, also the QLineEdit are working fine.

With the QBushButton even if i define setAccel(Qt::Key_F1), there is no way to works out.
If i press F1 on the keybord the button works but it does not calling the sendEvent.

Is there anybody can give me a typ about that?

Thanks in advance
Ezio