What is grabKeyboard, grabMouse,... ?
-
hi!
what is grabKeyboard, grabMouse, releaseKeyboard, releaseMouse functions? are they events? what is their difference from keyPressEvent ,... ?
can you show me an example of using them? I searched them in documentation but found nothing! -
Hi,
Just to be sure, did you miss these
"grabKeyBoard":http://qt-project.org/doc/qt-5/qwidget.html#grabKeyboard
"releaseKeyBoard":http://qt-project.org/doc/qt-5/qwidget.html#releaseKeyboard
"grabMouse":http://qt-project.org/doc/qt-5/qwidget.html#grabMouse
"releaseMouse":http://qt-project.org/doc/qt-5/qwidget.html#releaseMouse?
-
I saw those but still didn't get that! I need some example to learn how they work!
-
Call grabMouse on a widget and only that widget will receive mouse events (mouseMoves etc.), the same applies for grabKeyboard.
This means that the other widgets from your application will not get any mouse/keyboard event until you call the corresponding release function. They are only useful in a handful of cases.
The best way to see what it does is to create a little application containing some controls like QSlider, QSpinBox etc. and call the grabXXX functions on one of them.
-
if a widget grabkeyboard, then I delete it while it doesn't releasekeyboard. So, now,who get keyboard event?
-
Hi and welcome to devnet,
Did you try to implement a test application to check what happens ?