[PyQt] PyKDE4, KAction and signal overloads

Phil Thompson phil at riverbankcomputing.com
Fri Dec 31 14:48:22 GMT 2010

On Wed, 29 Dec 2010 13:48:33 +0100, Sebastian Wiesner
<lunaryorn at googlemail.com> wrote:
> Hallo,
> KDE 4 uses its own action class called "KAction" [1], derived from
> "QAction".  This class overloads the standard "triggered(bool)"-Signal
> from "QAction" [2] as "triggered(Qt.MouseButtons,
> Qt.KeyboardModifiers)" [3].
> Unfortunately, when using the new-style API for signals and slots, the
> "triggered(bool)" overload from "QAction" is hidden on "KAction"
> instances.  "act.triggered[bool].connect(foobar)" (where "act" is an
> instance of "KAction" or any subclass thereof) raises a "KeyError:
> 'there is no matching overloaded signal'".  An old-style connection
> works like "self.connect(act, SIGNAL('triggered(bool)'), foobar)"
> works, just like an explicit cast to "QAction" (e.g. "sip.cast(act,
> QAction).triggered[bool].connect(foo)").  However, compared to a
> straight new-style connection, both alternatives are rather ugly.
> Is this a bug in PyKDE4, or is this a technical restriction in sip or

The scoping works the same as any other sort of attribute, so you can use

    super(KAction, act).triggered[bool].connect(foobar)


More information about the PyQt mailing list