[PyQt] handling Enter in a qtextedit?

inhahe inhahe at gmail.com
Tue Sep 8 06:55:40 BST 2009

The documentation for keyPressEvent for a QTextEdit says

This function is called with key event *e* when key presses occur. It
handles PageUp, PageDown, Up, Down, Left, and Right, and ignores all other
key presses.
i guess that means if i want to react to a user pressing Enter they're not
making it easy for me?
i thought maybe i could handle the textChanged event and then grab the
current state of the keyboard to see if Enter is pressed, but I don't
even see a function to check the keyboard state.
so what's the best way to do this?
do I have to use QAction in some way?

what i want to do specifically is create an edit box where pressing
shift+enter works like pressing enter but pressing enter alone calls a
function which clears the text, etc. just like how an AIM input box works.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090908/0b073306/attachment.html

More information about the PyQt mailing list