[PyKDE] Connections with QWidgetFactory
    Phil Thompson 
    phil at riverbankcomputing.co.uk
       
    Wed Mar 23 09:15:30 GMT 2005
    
    
  
> Hello
>
> I have a designer file that defines my app main window ("principal.ui").
>
> Then using QWidgetFactory the actual window is created:
>
> ----------------------
> def main(args):
>     app=QApplication(args)
>     pyimpl = R() # R is derived from QObject
>     mainWindow = QWidgetFactory.create("principal.ui", pyimpl)
>     pyimpl.setParent(mainWindow)
>     mainWindow.show()
>     app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
>     app.exec_loop()
> ----------------------
>
> In C++, if you pass a second parameter to QWidgetFactory.create,  qt
> automatically creates the conections defined in the ui file, using the
> slots of the 2nd parameter.
>
> But in PyQt, no connection is made. ¿Is this correct?
If R is a wrapped C++ implementation of a QObject sub-class then it should
work.
If R is a Python implementation of a QObject sub-class then it won't work
because QWidgetFactory.create() doesn't know anything about Python
objects.
Phil
    
    
More information about the PyQt
mailing list