Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

void QWidget::grabKeyboard (  )  [inherited]

Grabs the keyboard input.

This widget receives all keyboard events until releaseKeyboard() is called; other widgets get no keyboard events at all. Mouse events are not affected. Use grabMouse() if you want to grab that.

The focus widget is not affected, except that it doesn't receive any keyboard events. setFocus() moves the focus as usual, but the new focus widget receives keyboard events only after releaseKeyboard() is called.

If a different widget is currently grabbing keyboard input, that widget's grab is released first.

See also:
releaseKeyboard() grabMouse() releaseMouse() focusWidget()

Definition at line 1284 of file qwidget_x11.cpp.

References QWidget::releaseKeyboard().

{
    if (!qt_nograb()) {
        if (keyboardGrb)
            keyboardGrb->releaseKeyboard();
        XGrabKeyboard(X11->display, data->winid, False, GrabModeAsync, GrabModeAsync,
                      X11->time);
        keyboardGrb = this;
    }
}


Generated by  Doxygen 1.6.0   Back to index