首页| 论坛| 消息

回复: qt 实现tv 界面;qt如何响应 遥控器的按键信息?
#6 [suma_alex 04-12 19:10]
已解决
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);
}

<< 1 2 >> (2/2)

回复 发表
主题 版块