QInputMethodEvent用法的任何示例吗?

| Qt应用程序中是否有使用“ 0”的示例? 谢谢     
已邀请:
        是的,例如,当您创建自己的虚拟键盘时。 我在这里看到了一个例子https://github.com/githubuser0xFFFF/QtFreeVirtualKeyboard
void DeclarativeInputEngine::sendKeyToFocusItem(const QString& text)
{
    qDebug() << \"CDeclarativeInputEngine::sendKeyToFocusItem \" << text;
    QInputMethodEvent ev;
    if (text == QString(\"\\x7F\"))
    {
        //delete one char
        ev.setCommitString(\"\",-1,1);

    } else
    {
        //add some text
        ev.setCommitString(text);
    }
    QCoreApplication::sendEvent(QGuiApplication::focusObject(),&ev);
}
    

要回复问题请先登录注册