QT dialog issue - Why is application blocked if post event to a QDialog object when it was just closed
-
The following QT interface technical problems: please help to see if there is a solution, thank you!
-
The system is connected with an external physical key/button. When the key is pressed, the key event is sent to the App through the CAN bus
-
After the App passes the CAN bus, route the key event in the following ways:
QWidget* fw = QApplication::focusWidget();
if(fw)
{
auto keyPres = new QKeyEvent(QEvent::KeyPress , Qt::Key_Return , Qt::NoModifier);
QApplication::postEvent(fw , keyPres);
}
- The problem now is that when the App pops up a dialog box (there is a confirm and cancel BUTTON on the dialog box), the tester deliberately clicks the BUTTON on the touch screen at the same time and clicks the physical button at the same time,
Occasionally, the App will not receive the touch screen message, and it feels like the App Block is living, but it can still respond to other keys.
-
-
Hi and welcome to devnet,
Is your dialog shown using exec ? If so, change the logic to use the open method. That way you will have only one event loop running to handle all your events.