Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Keyboard key values and State
benjiii last edited by
I am using Qt in ubuntu linux.
In my program I want to know the status of currently pressed key,that is pressed state ,released state or continuous state
and pressed key value. How to achieve this?
rschaub last edited by
for that, you'll have to either implement an "eventFilter":http://qt-project.org/doc/qt-4.8/qobject.html#eventFilter and "install it":http://qt-project.org/doc/qt-4.8/qobject.html#installEventFilter, or reimplement the "keyPressEvent":http://qt-project.org/doc/qt-4.8/qwidget.html#keyPressEvent on a QWidget.
The event you'll get in either of those two methods will hold the currently (or at the time of the event) pressed key.