PDA

View Full Version : Problem with push button navigation



keyurparekh
8th April 2011, 11:08
Hi friends

I have made one screen in Qt.

In my first screen there are four push buttons are there. Now i have apply focus in event on that. So when ever i press tab key it get focused.

but now i want is that when my focus reach to last button and than again if i press tab key it should come again to first push button. It comes after 4 to 5 times pressing of tab key.

so how can i restrict that navigation? Please suggests me with some source code how can i do that?

Please help me to solve this problem.

wysota
8th April 2011, 12:31
Did you set the tab order for your widgets in Designer/Creator? Do all of your buttons accept focus?

keyurparekh
11th April 2011, 07:00
Hi,

thanks for your suggestion. I have tried to set tab order as mention below... Please check it is it perfect or not? I have four push button whose pointers are

pushButton, pushButton_2,pushButton_3 , pushButton_4. So i have set tab order.


pushButton->setTabOrder(pushButton,pushButton_2);
pushButton_2->setTabOrder(pushButton_2,pushButton_3);
pushButton_3->setTabOrder(pushButton_3,pushButton_4);
pushButton_4->setTabOrder(pushButton_4,pushButton);

But still is not working as i wanted it to work. When focus is on last push button and i press tab it comes over 1st button. but when i press tab again it takes 5 to 6 tabs to go on to next push button. Please tell me some solutions for this...

Thanks in advance.
waiting for your reply...

wysota
11th April 2011, 10:24
Where is the focus during those "5 to 6 tabs"?

keyurparekh
12th April 2011, 05:53
Hi,

thanks for your reply.
But what you asking I am not clear about it?
am i missing any syntex which need to be written ?
Please tell me what to do?

I am stuck with this problem...

wysota
12th April 2011, 13:21
When you press the tab key it causes focus to move to the next widget. So I'm asking where does the focus move to during the action you described here:

but when i press tab again it takes 5 to 6 tabs to go on to next push button.

keyurparekh
13th April 2011, 14:23
Hi

I have four push buttons. I have set tab order of all four of them.

setTabOrder(pushButton,pushButton_2);
setTabOrder(pushButton_2,pushButton_3);
setTabOrder(pushButton_3,pushButton_4);
setTabOrder(pushButton_4,pushButton);

When i press tab first it selects fist push button, but when i press tab focus just disappears.
And after pressing 4 to 5 tabs it selects second push button. Than if i press tab again it directly selects push button 3 and so on. But between first and second push button it takes more tabs. Can you please tell why these happen.

One more thing i want to tell. I have one form on that i have take stack widget and on that its graphics view and after that i have put push buttons.

So because of these problem occurs or what?

Please reply me.

wysota
13th April 2011, 16:55
When i press tab first it selects fist push button, but when i press tab focus just disappears.
It doesn't dissapear. It moves to another widget. It might not be one of the push buttons you have. In doubt check QApplication::focusWidget().

keyurparekh
14th April 2011, 07:43
Hi
thanks so much for your support.
I have solve the problem......
once again thanks so much........

keyurparekh
15th April 2011, 06:57
Hi

I have attach one png file here. I want to create screen like in that image. how can i create menus

kinjal
19th July 2011, 13:18
hi ,

Please try this :
u have any widget other than push button like(graphic view)?
If u have widget other than push button than go every widget in .ui file and set no focus property in the property of that particular widgets.
all the push button has strong focus property..

kinjal.