<div dir="ltr">i've created a minimal example to show the issues I'm having.<div>here's the code: <a href="http://pastebin.com/RzEtFKDW">http://pastebin.com/RzEtFKDW</a></div><div>here's the output I get:</div><div><div><br></div><div>self.width before setsizes: 640</div><div>nicks & text widths before setsizes: 100 100</div><div>splitter width before setsizes: 100</div><div>splitter.geometry.width before setsizes: 100</div><div>self.width after setsizes: 640</div><div>nicks & text widths after setsizes: 47 47</div><div>splitter width after setsizes: 100</div><div>splitter.geometry.width after setsizes: 100</div><div>sizes from channelwindow: [47, 47]</div><div>sizes from main: [47, 47]</div><div>sizes from keypress: [1208, 700]</div></div><div><div><br></div><div>nothing I get from QWidget.width() and QSplitter.sizes() in various conditions is consistent with anything else.</div><div>- the qsplitter's widgets take up all the horizontal space in the window, and the window's width() returns 640, yet the sum of the qsplitter's widgets' sizes' widths is 200</div><div>- after calling setSizes(), the widgets' width() calls return 47 and 47, which is wrong because a) the total doesn't add up to the total width they actually take (which is either 640 or 1208+700, depending on what result you believe), b) they're both the same (when the splitter handle is NOT in the middle of the page), and d) they're even less than the total was before calling setSizes() (while the total area taken by the left and right widgets doesn't change)</div><div>- when calling QSplitter.sizes() from the keypress event in the bottom QTextEdit, a) it returns a different result from when I call it from elsewhere, and b) those results are more believable but they don't agree with the result from self.width()  (self.width() is the width of the whole window)</div><div>it might seem as though this is because app.exec_() isn't running yet in the former case, but in my actual application (not this minimal example), i do all this while the app is actually running (not via app.exec_() but via reactor.run() since I'm using qt4reactor which allows me to use PyQt with Twisted), and in my actual application QWidget.sizes() returns [0, 0]! </div><div><br></div><div>i'm trying to use sizes information to know what to pass to setSizes(), but i can't seem to do what I want. </div><div>the closest I've gotten is to pass the values [self.width()-50, 50], but it actually sets the rightmost widget to a width of approximately 80, for any number i use that's 80 or below. for larger numbers it actually does make the widget larger. but i want it smaller than 80.</div><div><br></div><div>i tried calling setFixedWidth() on the right-side widget, and that makes it the size I want, but it doesn't actually allow me to move the qsplitter handle, which is I want to be able to do</div><div>i tried calling resize() on the right-side widget, and that had no effect.</div><div><br></div><div><div class="gmail_extra">the only solution I can imagine that might work is to find a place in my actual application from which calling QSplitter.sizes() actually returns a value like [1208, 700] (like it does in the bottom QEditText's keyPress event) and setting it up somehow to call that and setSizes() at that time, but that would be a horrible and tenuous hack.</div><div class="gmail_extra"> </div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 31, 2015 at 5:50 PM, inhahe <span dir="ltr"><<a href="mailto:inhahe@gmail.com" target="_blank">inhahe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">oops, I hit the wrong key and gmail sent the e-mail before I was finished.<div>[continued][</div><div>...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.</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 31, 2015 at 5:45 PM, inhahe <span dir="ltr"><<a href="mailto:inhahe@gmail.com" target="_blank">inhahe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">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)<div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>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 </div></div>
</blockquote></div><br></div></div>
</blockquote></div><br></div></div></div></div>