Exemplo n.º 1
0
void Navit::sendKey(NavitKey key) {
    static int key2keycode[] = {
        0,
        XK_Return,
        XK_Escape,
        XK_Up,
        XK_Right,
        XK_Down,
        XK_Left
    };

    _sendKeyEvent(true, key2keycode[key], 0);
    _sendKeyEvent(false, key2keycode[key], 0);
}
Exemplo n.º 2
0
bool QmlKeyInjector::send(QInputMethodEvent* inputEvent, QQuickItem* rootItem)
{
    // Work around missing key event support in Qt for offscreen windows.
    const auto items = rootItem->findChildren<QQuickItem*>();
    for (auto item : items)
    {
        if (!item->hasFocus())
            continue;

        if (_isEnterEvent(inputEvent) && _sendKeyEvent(Qt::Key_Enter, item))
            return true;
        if (_sendEvent(inputEvent, item))
            return true;
    }
    return false;
}