[PyQt] Width() is whack [continued, first message was incomplete]

inhahe inhahe at gmail.com
Sun May 31 22:50:44 BST 2015


oops, I hit the wrong key and gmail sent the e-mail before I was finished.
[continued][
...the values are 47 and 47, despite the facts that a) they're two
different sizes as seen visually, and b) the sizes should add up to 200 if
they were previously 100 and 100, or even better, 640 since that's the
width of the container widget which they span all the way across.

So width() isn't working very well, and even if the 640 value is
sufficient, setSizes() still doesn't seem to be working right for some
reason.

Btw, a number of people have suggested I try Qt Designer, but that's not
helping because I don't see a QSplitter widget in the menu to add to it,
and also, I couldn't figure out how to expand a widget to take all
available room in the designer. I messed with policies making them
[maximum, maximum] and [expanding, expanding] and the widgets shown weren't
changed in any way.


On Sun, May 31, 2015 at 5:45 PM, inhahe <inhahe at gmail.com> wrote:

> 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/6f02a73a/attachment.html>


More information about the PyQt mailing list