PDA

View Full Version : TAB order on form



igor_x
8th November 2006, 11:24
Hi there!
Tell me please , is there any way to change all events connected with TAB key to another key - for example ENTER or some other? - i would like change widget focus using ENTER key.

Tanks
--
Igor

wysota
8th November 2006, 12:04
Reimplement the widgets event() method, catch all Enter (or Return) key presses and fake a tab press (or call appropriate methods related to focus yourself) and if a tab/backtab occurs, ignore the event (if you want to disable focus change on tab key press).

sunil.thaha
9th November 2006, 12:27
Better would be to have a
1. QObject sublcass and
2. Reimplement the eventFilter() and call focusNextChild() (really don't remeber the function call ) or as he said Use QApplication::sendEvent to push a KeyEvent to the queue

And then installEventFilter for all the widget that will use this feature

igor_x
10th November 2006, 05:29
can u give me some example strings of code please ?