PDA

View Full Version : about tab order



hesummar
14th November 2006, 11:06
hello , everyone.Can i use Qt::Key_Left , Qt::Key_Up , Qt::Key_Right and Qt::Key_Down to implement tab order function???

drhex
14th November 2006, 11:20
You have my permission ;)

hesummar
14th November 2006, 14:52
what???what??

hesummar
14th November 2006, 15:08
I sorry about my english . I mean that I don't want to use tab key ,and use Key_Left , Key_Up, Key_Right,Key_Down to implement the same function as tab key . Can anyone tell me how to do that?

jacek
14th November 2006, 20:00
The easiest way is to create QAccel and tie it to a custom slot and invoke QWidget::focusNextChild() or QWidget::focusPreviousChild() from it, but probably you want more.

Other solution is to install an event filter using QObject::installEventFilter() and check if you caught the right QKeyEvent and invoke QWidget::setFocus().

hesummar
15th November 2006, 02:44
Hello , jacek . Can you some examples about the above two solutions ?my e-mail is:
hesummar@126.com .. Thank you

jacek
15th November 2006, 20:29
You can find an example in QObject::installEventFilter() docs. All you have to do is to check what key was pressed and invoke setFocus().

What exactly should happen if for example user presses Key_Up?

hesummar
16th November 2006, 06:45
jacek,Thank you ,because my work is to develop a program for a machine , and the machine's keyboard doesn't have an key_tab key. but I found an example in <<c++ gui design with qt3>> .