[PyQt] Pressing enter in QLineEdit clicks QPushButton?
Mads Ipsen
mpi at comxnet.dk
Tue Jun 23 10:37:42 BST 2009
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:
Mads
--
+------------------------------------------------------------+
| Mads Ipsen, Ph.D, Scientific software developer |
+------------------------------+-----------------------------+
| QuantumWise A/S | phone: +45-29716388 |
| Nørresøgade 27A | www: www.quantumwise.com |
| DK-1370 Copenhagen, Denmark | email: mpi at quantumwise.com |
+------------------------------+-----------------------------+
More information about the PyQt
mailing list