[PyQt] Defining a custom slot in Designer

Henrik Pauli henrik.pauli at gmail.com
Sat Jan 17 17:19:44 GMT 2009


Hi all,

I was messing around in Designer today and I wanted to add my QMainWindow a 
new slot.  The ui file has it, but the moment I try to loadUi it, I get the 
following:

Traceback (most recent call last):
  File "./testclient.py", line 11, in <module>
    w = uic.loadUi("testclient.ui")
  File "/usr/lib/python2.6/site-packages/PyQt4/uic/__init__.py", line 106, in 
loadUi
    return loader.DynamicUILoader().loadUi(uifile, baseinstance)
  File "/usr/lib/python2.6/site-packages/PyQt4/uic/Loader/loader.py", line 22, 
in loadUi
    return self.parse(filename)
  File "/usr/lib/python2.6/site-packages/PyQt4/uic/uiparser.py", line 690, in 
parse
    actor(elem)
  File "/usr/lib/python2.6/site-packages/PyQt4/uic/uiparser.py", line 624, in 
createConnections
    conn.findtext("slot").split("(")[0]))
  File "/usr/lib/python2.6/site-packages/PyQt4/uic/objcreator.py", line 80, in 
getSlot
    return self._cpolicy.getSlot(obj, slotname)
  File "/usr/lib/python2.6/site-packages/PyQt4/uic/Loader/qobjectcreator.py", 
line 75, in getSlot
    return getattr(object, slotname)
AttributeError: executeCommand

So how do I add this to my widget?

Of course, I could work around this by doing all of it in python instead of 
Designer, but I wonder if this is possible at all.

Thanks,


More information about the PyQt mailing list