[PyQt] Defining a custom slot in Designer

Henrik Pauli henrik.pauli at gmail.com
Sun Jan 18 00:32:06 GMT 2009


On Sunday 18 January 2009, David Boddie wrote:
> For me, running Qt 4.4.3 and PyQt 4.4.4, using uic.loadUi() to load a
> .ui file with a custom slot doesn't cause an exception to be raised, so
> maybe there's a problem with the version you're using.
> [...]
> Hopefully, the above code should get you started, though you may want to
> upgrade PyQt if it turns out that there's a problem with your version of
> pyuic4.

Both are freshly rolled, same versions as the ones you mention.  I packaged 
them myself, though, so there might be something gone awry :P  I don't seem 
to recall particularly stupid patches in our Qt4, but I'll look into it.

> UiClass, WidgetClass = loadUiType("/home/david/temp/untitled.ui")
>
> class Widget(UiClass, WidgetClass):
>
>   def __init__(self):
>     WidgetClass.__init__(self)
>     self.setupUi(self)
>

This is much cleaner and clearer than the examples on the site, thanks!  I'm 
doing something like this, but not exactly (I do explicitly invoke 
QtGui.QMainWindow in the init and the inheritance...).


More information about the PyQt mailing list