[PyQt] Width() is whack.

inhahe inhahe at gmail.com
Sun May 31 22:45:11 BST 2015


I made a QSplitter, and I want to set the position of the splitter handle
such that the right-side widget is a fixed width and the left-side widget
takes all the rest of the available space (in the top portion of a
QVBoxLayout)

One way I tried to do this was to use setSizes and pass [x-y, y]  where x
is the width of the entire container widget (using width()) and y is the
size i want the right-side widget to be.

Apparently x turns out to be 640. Fine, except that it actually puts the
splitter handle in the same place (not in the middle, somewhere closer to
the right side) whether y is 100, 50, 30, etc.

So I tried getting the widths from the individual widgets on the left and
right of the splitter, and they're both 100.. even though together on the
screen they take up the entire width of the container.  Then, just for fun,
I use setSizes (as described above, using the width() of the container
widget) and get the widths of the left and right widgets again, and the
values are
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150531/0e0fb343/attachment.html>


More information about the PyQt mailing list