[PyQt] Key return

Milan Hemžal milan at 3trees.cz
Fri Nov 21 11:02:02 GMT 2008


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?

> >Date: Sat,  1 Nov 2008 18:46:29 +0100
> > From: "lucaberto\@libero\.it" <lucaberto at libero.it>
> > Subject: [PyQt] Key return
> > To: "pyqt" <pyqt at riverbankcomputing.com>
> > Message-ID: <K9O1DH$AB8CE19B38A8774437A43FEF37AD48C7 at libero.it>
> > Content-Type: text/plain; charset=iso-8859-1
> >
> > Hello
> > 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
> >
> > Regards
> >
> > Luca
>
> Its a little unclear what you are asking. If you do not want the original
> widget to process the event then you would need to redifine the
> keyPressEvent() to emit a signal with the event as an argument. Then you
> connect your button widget to that event.  Line Edits will already send the
> event, and I"m not sure if you can sent a QEvent as a signal.  I don't know
> what it's appropriate c signature is offhand.
>
> def keyPressEvent(self,event):
>     if event.key()==QtCore.Qt.Key_Return:
>         self.emit(QtCore.SIGNAL("returnPressed( QEvent )"),event)
>     else:
>         event.accept()
>
>
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

-- 
Milan Hemžal
3 Trees s.r.o.
--------------------------
Dřevěné podlahy a koupelny

Kontakt info:
GSM +420 775 393 335
www: www.3trees.cz



More information about the PyQt mailing list