Threadweaver::JobRunHelper::runTheJob failed/done Signals

Alex Merry kde at randomguy3.me.uk
Tue Sep 9 22:59:43 BST 2008


On Tuesday 09 September 2008 03:34:24 Alejandro Wainzinger wrote:
> I've subclassed a Threadweaver::Job, and reimplemented the success()
> method, and connected the appropriate signals/slots for done/failed
> signals that are emitted as shown above.  With this code though, both
> the failed and done signals are emitted, and so both slots are called,
> which is not what I want.  I only want the failed slot to be called if
> it fails.  I'm wondering why the above piece of code isn't an if-else.
>
> I think I can accomplish what I want by having the slot triggered by
> the failed signal, disconnect the connection to the slot triggered by
> the done signal.  Is that the right way of doing this?  It seems a bit
> ugly, as the only way I can do that is by using the QObject sender()
> method.

Well, the done() signal tells you that the job has finished, not that it 
succeeded.  You can check whether it succeeded by calling success() on the job 
passed in the signal.

Alex

-- 
Proud KDE hacker: http://www.kde.org
Get KDE 4.1 - out now!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080909/af35df3c/attachment.sig>


More information about the kde-core-devel mailing list