[PyQt] Problem with toolbars

Hernán Rajchert hrajchert at gmail.com
Thu Aug 9 17:36:08 BST 2007


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.
Thanks
Hernan Rajchert*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070809/b08145e9/attachment.html


More information about the PyQt mailing list