[PyKDE] broken layout

Marcos Dione mdione at grulic.org.ar
Sun Dec 31 15:24:35 GMT 2006


On Fri, Dec 22, 2006 at 05:13:18PM +0100, Andreas Pakulat wrote:
> On 22.12.06 12:33:30, Marcos Dione wrote:
> > On Fri, Dec 22, 2006 at 03:30:22PM +0100, Andreas Pakulat wrote:
> > > Without some code we can't know. The .ui files are fine as far as I can
> > > see.
> > 
> > mdione at falcon:~/src/projects/kress/src/trunk/src$ python
> > Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
> > [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> import kdedesigner
> > >>> from kress.kressmainwindow import MainWindow
> > >>> import sys
> > >>> import kdecore
> > >>> app= kdecore.KApplication (sys.argv, "")
> > >>> w= MainWindow ()
> > ScimInputContextPlugin()
> > QLayout "unnamed" added to KMainWindow "MainWindow", which already has a layout
> > >>> w.show ()
> > MainWindow.showTab(QWidget*): Not implemented yet
> > >>> app.exec_loop ()
> > 
> >     and the window shows wrong.
> 
> The problem is very simple: pyuic doesn't recognize KMainWindow and thus
> doesn't generate the same code as for the QMainWindow:
>         self.setCentralWidget(QWidget(self,"qt_central_widget"))
>         MainWindowLayout = QVBoxLayout(self.centralWidget(),11,6,"MainWindowLayout")
> 
> and the KMainWindow create the vbox layout with "self" as parent widget.
> 
> Not sure if this will be fixed in pyuic or not, as Phil doesn't know
> wether he'll release another version of PyQt3.
> 
> A simple replace in the generated file with the above code doesn't work
> either as then there's another problem with the tabwidget. I suggest to
> build the KMainWindow ui completely by handcrafted code.

    I found out that replacing layouts with boxes works fine... but I had to
replace all the layouts, because I keep getting «QLayout "layout5" added to
QVBox "mwl", which already has a layout» (the layouts try to become their
parent's layout all over the place).

    so I guess I will only use boxes. it's only left as an excercise to ask
oneself why qt-designer doesn't offer boxes as usable widgets.

-- 
(Not so) Random fortune:
<lilo> I can read the bloody *manual* as if it were some sort of religious tract
    describing forms of enlightenment you can achieve after 10 years on a mountain.




More information about the PyQt mailing list