[Resend to list also]

On Wednesday 08 September 2010, 11:06:59 lucabe...@libero.it wrote:
> hello i need to intercept the return and the enter key in a plaintextedit
> and i have write this
> def keyPressEvent(self, event):
>         self.plainTextEdit.keyPressEvent(event)
>         if event.key()  == QtCore.Qt.Key_Return :
>             print  ' return'
>         elif event.key() == QtCore.Qt.Key_Enter :
>             print ' enter'
>
> but the def keyPressEvent is called only if i press for ex blocnum and
> not when i push normal letter or return or enter.
> Can you explain me how to do it

You need to place your event handler in a subclass of QPlainTextEdit and 
read the doc of QKeyEvent..

Pete
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to