[Qt-interest] Force enter to default button rather than textEdit?

Israel Brewster israel at frontierflying.com
Thu Sep 15 02:00:12 CEST 2011


I have a window with a QPlaintextEdit and a button (among other things). The QPlainTextEdit gets the focus by default, which I want (so you can just type in it). However, when return is pressed, rather than entering a new line in the QPlainTextEdit, I want it to activate the button (which is set to default). I have successfully gotten the QPlainTextEdit to ignore the enter key by overriding the keyPressEvent function, but even so the button isn't picking up on it. I would use a QlineEdit, but I want to be able to display more text than the width alone allows. How can I make this work? Thanks.

-----------------------------------------------
Israel Brewster
Computer Support Technician II
Era Alaska
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x7293
-----------------------------------------------



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110914/c6f4270a/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Israel Brewster.vcf
Type: text/directory
Size: 417 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110914/c6f4270a/attachment.bin 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110914/c6f4270a/attachment-0001.html 


More information about the Qt-interest-old mailing list