我知道如何发布单键事件
QKeyEvent *poKeyEvent = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier);
QCoreApplication::postEvent (this, poKeyEvent);
现在我想发布关键事件的组合
例如QKeySequence(tr("Ctrl+L"));
这是发布关键序列事件的正确方法吗?
// First key event - 'Ctrl'
QKeyEvent *poFirstKeyEvent = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Control, Qt::NoModifier);
QCoreApplication::postEvent (this, poFirstKeyEvent);
// Second key event - 'L'
QKeyEvent *poSecondtKeyEvent = new QKeyEvent ( QEvent::KeyPress, Qt::Key_L, Qt::NoModifier);
QCoreApplication::postEvent (this, poSecondtKeyEvent);
实现此目的的其他任何方式?
谢谢,