PDA

View Full Version : tab focus on QPushbutton making QPushbutton work with spacebar but not with enter key



vinnu
26th September 2006, 11:55
Hai

I have got a problem .could anybody help me.Help is urgent.
tab focus making QPushbutton work with spacebar click but not with enter key.

I would like to expand this.
I have some controls like line edits,combo boxes ,push buttons.I am able to trace the tab focus on the QPushbutton.On click of space bar on the pushbutton i am able to open a dialog.but on click of enter key on the push button i am unable to open the dialog.

I have tried in this way.
I have set the Autodefault property value to TRUE in designer.Then i am able to get the dialog on either(space bar or enter) of the click.but the problem here i am facing is...with out the tab focus on the pushbutton also i am able to open up the dialog inspite the tab focus is in some other widget on the same dialog.

Thanking you
vinnu

jacek
26th September 2006, 12:18
Enter activates the default button regardless if it has focus or not. You can disable the autoDefault property and install an event filter on the pushbutton that would invoke animateClick() when user presses enter or return.

vinnu
26th September 2006, 12:33
hai

i didnt get the idea of install an event filter on the push button.could u please ellobrate it.

thanks
vinnu

jacek
26th September 2006, 13:16
http://doc.trolltech.com/3.3/qobject.html#installEventFilter