Bug in KAction::initPrivate
Martijn Klingens
klingens at kde.org
Thu Sep 26 12:44:26 BST 2002
On Thursday 26 September 2002 12:35, Simon Hausmann wrote:
> I'm not exactly sure how Martijn got the double connect though. Did
> the object name of the action happen to be like foo{42} ? (it's the
> only explanation I can come up with)
Nope, wrong ;-)
Since I was only working on Kopete and some personal projects that are not in
CVS at that time I was using KDE 3.0 branch, so that would be an
impossibility.
But it's much simpler: I wasn't connecting to 'activating(int)' in the first
place, I was simply connecting to 'activated()' and querying
action->currentItem() in the slot.
Whether I was modifying existing code or simply misread the KListAction docs,
I don't know, nor does it really matter. The bottom line is that Qt is
perfectly able to map 'signal(int)' onto 'slot(void)', hence the double
connection bug in Kopete.
I have no idea how to avoid that except by checking in KListAction whether we
are passing a void slot and not connecting in the case. You cannot avoid
programmers to take the same route that I took with the current API, even
though the int-signal is obviously far cleaner (I would have used it if I'd
realized its existence). Any ideas?
--
Martijn
More information about the kde-core-devel
mailing list