I want to make a UI that carries out an action when the user presses
return (think like in Pidgin), and I have a couple questions about how
to do this. I've dabbled a very small amount but I'm basically a (Py)Qt
newb.

From what I can tell, I want to use a QPlainTextEdit. I don't think a
QLineEdit will work because I will sometimes need multiple lines, but
they'll arise in ways other than the user pressing enter. (Again, think
about Pidgin: enter sends a message, shift-enter adds a newline.)

Looking at the signals that are available, I don't see one that says
what key has been pressed. I might be able connect a slot to
textChanged() then do something like figure out what the cursor is and
then look at the preceding character or something like that, but it
seems much better to create a subclass of QPlainTextEdit and override
the keyPressEvent() (or maybe keyReleaseEvent()?) function.

Does this all seem reasonable, or am I missing a better approach?

Evan


Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to