[PyQt] Problem with toolbars

Phil Thompson phil at riverbankcomputing.co.uk
Thu Aug 9 18:43:30 BST 2007


On Thursday 09 August 2007 5:36 pm, Hernán Rajchert wrote:
> Hi, I've designed a Qt app that has one toolbar in the left and two
> toolbars in the top (one above the other) using the designer. Using the
> preview option the window seems fine, but when using it with pyqt4 all
> toolbars get stuck one after the other.
>
> Im loading the ui file dynamically but also tried to use pyuic for seeing
> what was the code supposed to do, what i found was this:
>
>         self.tbImage = QtGui.QToolBar(MainWindow)
>         self.tbImage.setMovable(True)
>         self.tbImage.setObjectName("tbImage")
>         MainWindow.addToolBar(self.tbImage)
> This is the code to add the toolbar to the left, as you can see it has no
> option to actually put it in the left.
>
> looking at the api i found the method initStyleOption that seems to be what
> im looking for, but using the following code didn't worked:
>         self.tbImage = QtGui.QToolBar(MainWindow)
>         self.tbImage.setMovable(True)
>         self.tbImage.setObjectName("tbImage")
>         a = QtGui.QStyleOptionToolBar()
>         a.toolBarArea = QtCore.Qt.LeftToolBarArea
>         a.positionOfLine = QtGui.QStyleOptionToolBar.End
>         self.tbImage.initStyleOption(a)
>
> in qt4.3 api initStyleOption doesn't exists.

If you think there is a bug in pyuic then send me the .ui file.

Phil



More information about the PyQt mailing list