[PyQt] Pressing enter in QLineEdit clicks QPushButton?

Sibylle Koczian Sibylle.Koczian at t-online.de
Tue Jun 23 11:12:44 BST 2009

Mads Ipsen schrieb:
> projetmbc wrote:
>> Mads Ipsen a écrit :
>>> If you change 'QDialog' to 'QWidget' the problem disappears. But I
>>> have no idea why. Anybody?
>>> Best regards,
>>> Mads
>> In the first example proposed that did not work, you can see that the
>> button has the focus even if the cursor is in the lineedit. I think
>> that the problem comes from here.
>> Christophe.
> From the manual pages:
> "A dialog's default button is the button that's pressed when the user
> presses Enter (Return). This button is used to signify that the user
> accepts the dialog's settings and wants to close the dialog."
> In other words, the first button that gets added probably gets connected
> up with this behaviour, which explains the behaviour. So using a QWidget
> is probably the correct solution:

Yes, I think so too. Tried it, works, thanks to you both!


More information about the PyQt mailing list