PDA

View Full Version : How to avoid keyboard-button-toggling ?



Comer352l
23rd September 2008, 10:34
Hi,

in my application, I use a couple of QPushButtons inside a QGroupBox. The auto-exclusive-mode is activated for all buttons.
Unfortunately, you can toggle the buttons using the up-/down-/left-/right-keys.
I would like to change this behavior, so that pressing these keys will only change the focus.
In fact, I would like the auto-exclusive-buttons-group to behave like a group of "normal" buttons.
Where do I have to start ? Where do these key-operations come from ? We are not talking about shortcuts, right ?

RThaden
23rd September 2008, 12:22
Hi,

have a look at http://doc.trolltech.com/4.4/qwidget.html#keyPressEvent
reimplement it and prevent the keyboard actions you don't want.

Regards,

Rainer

Comer352l
25th September 2008, 11:02
Hi,

thanks for your answer. Implementing custom keyPressEvent()-functions would be the "hardcore"-solution...
Aren't there any parameters or switches ? I've seen so many keyboard related functionalites (like Qt::focusPolicy), but I didn't find something like that for toggling !?