[PyKDE] QAccel automatically sends signal

Alfred Young alfred at tippett.com
Fri Apr 15 00:05:07 BST 2005


Hi everyone,

I've got a really simple main window with a few (QPushButton) buttons.  
What I want to do, is no matter what button has focus, hitting "Enter" 
will hit the default button.  Rather than connecting a signal on every 
button to the default button's slot, I've decided to setup a hot key, 
child of the main window:

self.shortcutKey = QAccel(self)
id = self.shortcutKey.insertItem(Qt.Key_Enter)
self.shortcutKey.connectItem(id, self.defaultButton, 
SLOT(self.defaultButton.clicked()))

However as soon as I invoke connectItem() it appears that the 
defaultButton's slot is activated.  I've tried a number of ways to get 
around this but no luck.

Does anyone know what I may be doing wrong?  Maybe I'm not understanding 
QAccel's abilities?

Btw, I'm on python/qt 3.3... any help would be greatly appreciated.  Thanks!

- alfred




More information about the PyQt mailing list