[PyQt] Pressing enter in QLineEdit clicks QPushButton?
Mads Ipsen
mpi at comxnet.dk
Mon Jun 22 07:13:53 BST 2009
Sibylle Koczian wrote:
> Hello,
>
> I've got a dialog with a QLineEdit and a QPushButton. The QLineEdit is
> connected to a method which takes its text and appends it to a
> QTextBrowser (that's taken from the first GUI example in the PyQt book
> by M. Summerfield). The "clicked()" signal of the QPushButton is
> connected to a method that just prints a message. The problem: this
> method, which should only be called by clicking the button, is called
> every time Enter is pressed in the QLineEdit. This happens even if the
> edit control isn't connected to any method.
>
> The button is next to the line edit in the form and in the tab order.
>
> With "setAutoDefault(false)" for this button and for the exit button
> which follows in tab order I can prevent this behavior, but that isn't
> really very comfortable. And it shouldn't be necessary, should it?
>
> All this on openSUSE with Python 2.6, PyQt 4.4.4.
>
> Thank you for help,
> Sibylle
>
>
Can you supply a simple example that reproduces the behavior?
Best regards,
Mads
More information about the PyQt
mailing list