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

Michael Pyne mpyne at purinchu.net
Sun Aug 24 04:31:17 BST 2008

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, 

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.

Any comments?

 - Michael Pyne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080823/9779af51/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-kactioncollection-signals.patch
Type: text/x-patch
Size: 1799 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080823/9779af51/attachment.bin>
-------------- 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/20080823/9779af51/attachment.sig>

More information about the kde-core-devel mailing list