How can I simulate user interaction (key press event) in Qt ?
How can I simulate user interaction (key press event) in Qt ?
The user interaction key press event in Qt:
QKeyEvent *event = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Enter); QCoreApplication::postEvent (receiver, event)
The given code answer is:
QKeyEvent *event = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier); QCoreApplication::postEvent (receiver, event);
The no matching function for call :
QtKeyEvent::QtKeyEvent(Type type, int key)
Here is,
QtKeyEvent::QtKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers)
QKeyEvent *event = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Enter);
QCoreApplication::postEvent (receiver, event)