PDA

View Full Version : Problem with push button navigation.



keyurparekh
17th June 2011, 06:48
Dear Friends,

I am stuck with problem in designing with QT.
I have created one form and in that form I have total 8 push buttons. Four buttons are in one row and other four buttons are in second row.

now i want when i m pressing side arrow key it should focus only upper four push buttons.
and when i press down arrow key it will come in second row and than it will get focused only below four push buttons.

Please suggest me some solution how to do it?
I have already created 8 push button, but now i need control of these push buttons.

Please give me solution, i m stuck in this problem,

thanks in advance. waiting for your reply...

Thanks & Regards,
Keyur Parekh.

Santosh Reddy
17th June 2011, 06:53
Add the first row buttons in a group box, and add the second row buttons in another group box, and handle the down arrow key event for the first group box, and up arrow key event in second group box, left and right arrows should work as you expect once the focus is in the group box.

Edit: It may not be simple to use this way, you need to alternately disable the group boxes, but I don't thinks this will be a good solution, as you may need to be able to use mouse to click the non active row buttons, so ignore this

Another simple way, is to set a Qt::StrongFocus on active row buttons, and Qt::NoFocus on non-active buttons, when user presses down / up arrow, capture it some how and exchange change the focus settings.

keyurparekh
18th June 2011, 08:11
Hi Santosh,

thanks for your reply, I have solved the problem . Your suggestion is very helpful to me....thanks once again......