| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 2 | |
Good day Qters, By default, pressing arrow keys on QDialog will move focus between its children. Looking at the source code, I imagine that changing this behaviour is not difficult. However, neither reimplementing of keyPressEvent() nor install of event filter can help. Could anybody tell me why? Thanks in advance, Trung PS: in attachment is a small test program -- I expect to see a QMessageBox whenever Key_Up is pressed, but Key_Up only moves focus between two QPushButtons :-(
Attachment:
ignore_event.tar.gz
Description: GNU Zip compressed data
Trung Nguyen wrote: Hi Trung, > Good day Qters, > > By default, pressing arrow keys on QDialog will move focus > between its children. Looking at the source code, I imagine that changing > this behaviour is not difficult. However, neither reimplementing of > keyPressEvent() nor install of event filter can help. > Could anybody tell me why? Looking at the source for QDialog I found that the qdialog ignores, in the QDialog::keyPressEvent funktion, the arrow key events( up & left & down & right ), but they do "manage the focus" of the widgets in the dialog... so they are sent to the parent widget. So I think they never reach the function keyPressEvent you implemented. It would be nice if someone would explain this further. /G > > > Thanks in advance, > Trung > > PS: in attachment is a small test program -- I expect to see a QMessageBox > whenever Key_Up is pressed, but Key_Up only moves focus between two > QPushButtons :-( > > ------------------------------------------------------------------------ > Name: ignore_event.tar.gz > ignore_event.tar.gz Type: Unix Tape Archive (application/x-tar) > Encoding: base64 -- [ signature omitted ]