How can I simulate user interaction (key press event) in Qt?

前端 未结 2 1513
清酒与你
清酒与你 2020-12-15 17:39

I need to simulate \"Enter\" key event in Qt. How can I do this?

2条回答
  •  时光说笑
    2020-12-15 18:30

    QKeyEvent *event = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Enter);
    QCoreApplication::postEvent (receiver, event)
    

提交回复
热议问题