[Qt-interest] signals and slots, combination and execution order
hilbert at beuth-hochschule.de
hilbert at beuth-hochschule.de
Wed Jun 10 09:16:40 CEST 2009
On Wed, 10 Jun 2009 11:13:54 +0530, Girish Ramakrishnan wrote
> hilbert at beuth-hochschule.de wrote:
> > hello,
> >
> > i have a QLineEdit with the signal 'editingFinished()' connected
to 'slot1
> > ()'. there is also a QPushButton with the signal 'clicked()' connected
to
> > another 'slot2()'. as to be expected: when the text in the QLineEdit is
> > changed and the QPushButton ist clicked both slots are executed. in my
> > case 'slot1()' is always called first. in some cases i need to execute a
> > QMessegeBox::question(...) in 'slot1()' and wait for the return value of
the
> > question box. if this is the case, the QPushButton hangs (at least
visually)
> > in the 'pressed' state and 'slot2()' is never called. the 'clicked()'-
signal
> > of the QPushButton seems to be lost even when the connection is set to
> > Qt::QueuedConnection. is there an easy or at least a reasonable way to
solve
> > this problem without tricky event-handling?
> >
>
> The answer depends on the behavior you want: Should the button not
> appear pressed? (If so, would the user not mistake that the popup
> was as a result of the button press and not editing finished?) And
> you want the button clicked slot to be executed after the modal
> dialog is dismissed? Sounds very confusing to me :-)
>
> Girish
the popup clearly querys about the changes made to the QLineEdit. if
confirmed by the user during slot1(), slot2() should be executed but of
course only if clicking the QPushButton was the reason for the QLineEdit to
loose focus and thus sending the signal editingFinished() and executing slot1
(). if the user cancels the popup, slot2() should not be executed, but
that's a problem to discuss later or handle within slot2(). of course i do
not want slot2() to be executed if editingFinished() was emitted by some
other action.
regards,
andreas
--
Open WebMail Project (http://openwebmail.org)
More information about the Qt-interest-old
mailing list