[PyQt] PyKDE4, KAction and signal overloads

Sebastian Wiesner lunaryorn at googlemail.com
Wed Dec 29 12:48:33 GMT 2010


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 PyQt?

Sebastian Wiesner

[1] http://api.kde.org/pykde-4.5-api/kdeui/KAction.html
[2] http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qaction.html#triggered
[3] http://api.kde.org/pykde-4.5-api/kdeui/KAction.html#triggered


More information about the PyQt mailing list