On Sat Nov 1 17:46:29 GMT 2008, lucaberto wrote: > i need that when i press the Return key, one button intercept the pression > of it and process the event Can you explain me how i can do it
On Fri Nov 21 11:02:02 GMT 2008, Milan Hemžal wrote: > On Sunday 02 November 2008 18:46:44 Matt Smith wrote: > Ok, but i also have this problem. > > pls. howto use press enter in button if have more button? All of this depends on how you guys are using those buttons. If you are using a QDialog subclass, you can make one of the buttons the "default" button for the dialog: http://www.riverbankcomputing.com/static/Docs/PyQt4/html/qdialog.html#default If you are using some other widget to display the buttons, there are other ways to connect a key press with a specific button. For example, you could create an action with a keyboard shortcut, connect its triggered() signal to a push button's animateClick() slot, and add it to the button's parent widget: # b is the chosen button # w is the button's parent widget action = QAction(w) action.setShortcut(QKeySequence("Return")) w.connect(action, SIGNAL("triggered()"), b, SLOT("animateClick()")) w.addAction(action) You might need to add another action to the widget if you also want the Enter key to have the same effect as the Return key. David _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
