[PyKDE] QWidgetFactory.create and custom python "slots"

Phil Thompson phil at riverbankcomputing.co.uk
Mon Jul 28 20:24:01 BST 2003


Not easily, if at all.

Phil

On Monday 28 July 2003 4:50 pm, Martin Takeo Wiechert wrote:
> Is there a way to make it work in Python?
>
> Martin.
>
> Am Montag, 28. Juli 2003 17:34 schrieb Phil Thompson:
> > You have created a Python slot. QWidgetFactory knows nothing about Python
> > slots.
> >
> > Phil
> >
> > On Monday 28 July 2003 1:24 pm, Martin Takeo Wiechert wrote:
> > > Hi.
> > >
> > > I'm trying to build a dynamic dialog with QtDesigner.
> > >
> > > In QtDesigner I've created a main window ('wehner-mainwindow.ui') and
> > > added and connected a custom slot 'about()'.
> > > I've implemented this slot in a receiver class, an instance of which I
> > > pass to QWidgetFactory.create(...) (see code below).
> > >
> > > The code below will show the main window, but the about slot does not
> > > work.
> > >
> > > Is this a technical limitation or did I do something wrong?
> > >
> > > Regards,
> > > Martin Wiechert.
> > >
> > >
> > > import sys
> > > from qt import *
> > > from qtui import *
> > >
> > > class receiver(QObject):
> > >     def about(self):
> > >         about_dialog = QWidgetFactory.create('about.ui')
> > >         about_dialog.exec_loop()
> > >     def setParent(self,parent):
> > >         self.p = parent
> > >
> > > if __name__ == "__main__":
> > >     a = QApplication(sys.argv)
> > >     QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
> > >     r = receiver()
> > >     w = QWidgetFactory.create('wehner-mainwindow.ui',r)
> > >     r.setParent(w)
> > >     a.setMainWidget(w)
> > >     w.show()
> > >     a.exec_loop()
> > >
> > > _______________________________________________
> > > PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> > > http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
> >
> > _______________________________________________
> > PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> > http://mats.imk.fraunhofer.de/mailman/listinfo/pykde




More information about the PyQt mailing list