已解决
Q_INVOKABLE void sendCkeyPressEvent(QObject* receiver,Qt::Key CkeyId);
Q_INVOKABLE void sendCkeyReleaseEvent(QObject* receiver,Qt::Key CkeyId);
void CKeyEvent::sendCkeyPressEvent(QObject* receiver,Qt::Key CkeyId)
{
QKeyEvent keyPressEvent(QEvent::KeyPress, CkeyId, Qt::NoModifier);
QGuiApplication::sendEvent(receiver, &keyPressEvent);
}
void CKeyEvent::sendCkeyReleaseEvent(QObject* receiver,Qt::Key CkeyId)
{
QKeyEvent keyReleaseEvent(QEvent::KeyRelease, CkeyId, Qt::NoModifier);
QGuiApplication::sendEvent(receiver, &keyReleaseEvent);
}