[PyQt] Toolbar widget sizing problems

Scott Price scottmprice at gmail.com
Sat Sep 6 04:13:40 BST 2008


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.

The only thing I could find in the documentation regarding
QToolBar.addWidget() is the reference to not being able to populate the
extension pop up with widgets added using addWidget(), but this only seems
to apply when the toolbar is not owned by the main window.  It also doesn't
speak to the toolbar not taking ownership of the widget that is added, nor
to disregarding the widgets' geometry.  

It's not a great problem, as it _does_ show the widget, just not the size I
tell it to use... Oh well, there are worse things in life I suppose.

Just doing some testing, changing the QLineEdit to a QTextEdit gives some
strange results:  the resulting text box shows on the toolbar as a square of
about 150x150 pixels...  not exactly an optimum substitution, even though it
is larger than the line-edit :-).

Toolbars seem to be optimized for showing only toolbuttons, and even those I
found it doesn't like to resize either; I notice the documentation does
speak of the extension pop up being fixed in a future edition, perhaps the
resizing issue will be fixed as well?

If I can't make it work I'll just discard the toolbar and replace it with a
layout on the main window.

Thanks anyway,
Scott



More information about the PyQt mailing list