[PyQt] Toolbar widget sizing problems

David Boddie david at boddie.org.uk
Sat Sep 6 18:58:26 BST 2008


On Sat Sep 6 12:30:21 BST 2008, Andreas Pakulat wrote:

> 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.

I think it will make a difference in that ownership of the group box will
be transferred to C++ if you create it with a parent. (The /TransferThis/
annotation in the qgroupbox.sip file indicates this.)

The call to setParent() inside QWidgetAction just means that the action
will have to delete the widget later on. It won't suddenly get deleted
just because it no longer has a parent object.

David


More information about the PyQt mailing list