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

Martin Takeo Wiechert martin.wiechert at gmx.de
Mon Jul 28 16:49:00 BST 2003


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()




More information about the PyQt mailing list