Page 1 of 1

DONE: Signal called more than once

PostPosted: Sun May 06, 2012 7:06 am
by Slowdown
Code: Select all
' this is the mainwindow scope

Outlet lineEdit As QLineEdit

Event Init()
  SetFocus(lineEdit)
End Event

Signal on_lineEdit_editingFinished()
  Print "This Signal is called twice !! " & "\n"
  Print "and is also called if the form is closed by the close button" & "\n"
End Signal

Will result that the Signal is called twice when editing is finished.
And it's called again when the form is closed by the close button.

Re: Signal called more than once

PostPosted: Mon May 07, 2012 7:40 am
by berndnoetscher
Hi Joost

thanks though this is the correct behaviour.

Qt says
"
This signal is emitted when the Return or Enter key is pressed or the line edit loses focus.
"

and that is exactly what it does.

When Print is used it looses focus-> 2nd signal call

Re: Signal called more than once

PostPosted: Mon May 07, 2012 2:33 pm
by Slowdown
Did read the Qt manual and indeed you're right.
In my humble opinion it's not quite logical but it's how Qt does it.
find out that,
Code: Select all
Signal on_lineEdit_returnPressed()
  Print "done editing"
End Signal

Also can be used.