[PyQt] Toolbar widget sizing problems

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


Some more poking around revealed that while QLineEdit.setGeometry() and
QLineEdit.setSizePolicy() are disregarded by the toolbar, that
QLineEdit.setFixedSize() _is_ respected!  It results in the appropriately
sized line-edit being shown centered in the middle of the toolbar, with its
label on the far left.  A minor detail, but one I'll have to address.
Preferably the line-edit should be in the far left also.

Rather interesting behavior on the part of the toolbar in light of what you
mentioned earlier.

The test change to a QTextEdit gave me the idea that perhaps the toolbar is
only interested in the default size of the widget in question.  This was
shown by the size of the text edit when added being equal to its default
size when picked off the QDesigner toolbox to add to a widget.  Apparently
the .setFixedSize() affects the basic size of the widget in a way that
setGeometry() and setSizePolicy() do not.

I still don't understand the underlying reason, but if it works, I probably
don't need to understand it.

I notice that I clicked Reply instead of Reply All on my last reply,
resulting in it not being sent to the mailing list.  I'll correct that, but
you might get a second copy of it.

Thanks again,
Scott



More information about the PyQt mailing list