[PATCH] Improve signal/slot connections for KActionCollection::add()

Olivier Goffart ogoffart at kde.org
Mon Aug 25 19:32:29 BST 2008


Le dimanche 24 août 2008, Michael Pyne a écrit :
> Hi all,
>
> template<> KActionCollection::add(name, obj, slot) has a problem connecting
> the "triggered" signal of the created QAction to the given slot when the
> slot accepts a bool parameter.  I've attached a patch to improve our
> handling of this issue and allow slots with a bool parameter or no
> parameter.
>
> i.e. right now this wouldn't work:
>
> QAction *act = actionCollection->add<KToggleAction>("show", this,
> SLOT(setShown(bool)));
>
> in spite of the fact that the triggered signal has a bool parameter because
> the connection is from triggered().
>
> The patch fixes this by converting triggered() signals to triggered(bool)
> in the connection.  Existing code which connects to a slot with no
> parameters would be unaffected as Qt will simply ignore the extra
> parameter.

The patch looks ok to me.


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


More information about the kde-core-devel mailing list