On Wed Jul 15 16:25:07 BST 2009, David Boddie wrote:
> On Wed Jul 15 15:46:30 BST 2009, Michael Adolph wrote:
> > I've got a problem with Qt-Designer and Python. It's pretty basic but I
> > can't find any solution.
> >
> > I designed to forms in Qt-Designer and I'm writing a QMainWindow class in
> > Python. The widgets are imported and should be layouted. My Problem ist,
> > that both widgets are shown one over another, not caring about my layout.
> > This reduces usability pretty much.
>
> The solution is quite simple. You need to call the setupUi() method of each
> generated widget and pass the widget itself (not the parent).
>
> Here's your code with my changes:
>
>   class BasisTest(QtGui.QMainWindow):
>       def __init__(self):
>           QtGui.QMainWindow.__init__(self)
>           self.centralWidget=QtGui.QWidget(self)
>           self.setCentralWidget(self.centralWidget)
>           self.label=QtGui.QLabel("Test",self.centralWidget) # two Labels
>                                                              # for Testing
>           self.label2=QtGui.QLabel("schalalala",self.centralWidget) 
>           self.Uebersicht=QtGui.QWidget() # instanciate first Ui-Widget
>           ui = Uebersicht.Ui_Uebersicht()
>           ui.setupUi(self.Uebersicht) #show Widget
>
>           self.Dialog=QtGui.QWidget()
>           ui = liegenschaftAuswahlDlg.Ui_liegenschaftAuswahlDlg()
>           ui.setupUi(self.Dialog)

I tried this trick later and found that it didn't do what I expected with
the widgets created by the setupUi() method. These are created as attributes
of the ui object and not the widget they are applied to.

I just thought I'd mention this in case someone was trying to use this
technique and found that they couldn't reference the widgets in their user
interface.

David
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to