[PyQt] Re: Pressing enter in QLineEdit clicks QPushButton?

Sibylle Koczian Sibylle.Koczian at t-online.de
Wed Jun 24 16:29:41 BST 2009


> Message: 1
> Date: Tue, 23 Jun 2009 14:41:20 +0200
> From: "V. Armando Sol?" <sole at esrf.fr>
> Subject: Re: [PyQt] Pressing enter in QLineEdit clicks QPushButton?
> To: Mads Ipsen <mpi at comxnet.dk>
> Cc: Sibylle Koczian <Sibylle.Koczian at t-online.de>,	PyQt-Liste
> 	<pyqt at riverbankcomputing.com>
> 
> Mads Ipsen wrote:
>> rom 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:
>>
> 
> It is certainly not the correct solution if you really need a dialog :-)
> 

Right, but in this case I don't need a return value from my window and
so I don't think I need a dialog. This is a small application with only
one form.

> You can also call setAutoDefault(False) for all the buttons.
> 

Yes, just tried it, that works too. So, this being solved, on to the
next problem I won't be able to solve for myself.

Thank you,
Sibylle


More information about the PyQt mailing list