[PyQt] derive from a designer widget

Mario Daniel Carugno carugnom at gmail.com
Fri Mar 13 08:36:04 GMT 2009


2009/3/12 Mario Daniel Carugno <carugnom at gmail.com>:
> 2009/3/12 Andreas Pakulat <apaku at gmx.de>:
>>> Thank you Andreas, i'll try it. Just in case, do you have some example
>>> of that ?
>>
>> Its pretty easy (from the top of my head, so might not work right away, but
>> you should get the idea)
>>
>> class MyMainWindow(QMainWindow):
>>    def __init__(self,parent):
>>        QMainWindow.__init__(self,parent)
>>        self.ui = Ui_MainWindow()
>>        self.ui.setupUi(this)
>>
>> class MyCustomMainWindow(MyMainWindow):
>>    def __init__(self,parent):
>>        MyMainWindow.__init__(self,parent)
>>        self.mybutton = QPushButton(self.ui.centralFrame)
>>
>
> Great ! Thank you very much
>

I've tried the example, and that's not exactly what i need.
But it helped me to get a better idea of what i want.
Ok, i want to design a 'main window' with navigation buttons
and a central area.
Then i design a separate widget 'data' (the records to show)
to put in the main window's central area.
But how to put it there and 'integrate' both ? That's the hard point.

I want that it could be as simple as derivating the 'data' class
from the 'main window' class. I've read that derivating a widget
from another one, makes that widget to appear inside it's parent,
right ?
Well, this is the same case, execpt that i want the child to
appear into a *specific* widget of its parent.

BTW, Andreas, your example helped me a lot, thank you.



More information about the PyQt mailing list