[PyQt] Toolbar widget sizing problems

Andreas Pakulat apaku at gmx.de
Sat Sep 6 12:30:21 BST 2008


On 05.09.08 22:13:40, Scott Price wrote:
> Well, what you say makes sense and I follow your reasoning, however it still
> doesn't seem to work for making the line-edit show the size I want it to.
> 
> Giving the group-box an explicit parent doesn't work, that is.

If you follow the C++ source code, you'll see why. QToolBar::addWidget()
uses QWidgetAction to embed the widget and calls
QWidgetAction::setDefaultWidget(). That in turn calls setParent(0), so
wether or not you pass in a parent when creating the groupbox doesn't
matter. You could try to do something like

self.grpbox = QtGui.QGroupBox() 

instead, which also keeps a reference to the groupbox.

I didn't look at the sources, but have you tried to directly put the
lineedit as widget, instead of a groupbox with layout and such things?
QWidgetAction and hence QToolBar::addWidget might not be made for
complex or compound widgets.

Andreas

-- 
It is so very hard to be an
on-your-own-take-care-of-yourself-because-there-is-no-one-else-to-do-it-for-you
grown-up.


More information about the PyQt mailing list