请教:
希望模拟向GUI发送按键事件:
QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_F1, Qt::NoModifier, QString());
QApplication::postEvent(qApp, &keyPress);
但是不知道此时活动的widget是谁,就直接向QApplication发送,但其运行时错误提示:
QCoreApplication::removePostedEvent: Internal error: 0xe05d908 6 is posted
该如何实现这个目的呢?
谢谢!