[PyQt] How to get index of splitter

Russell Valentine russ at coldstonelabs.org
Tue Jun 15 21:48:13 BST 2010


Whats in your splitter then? The list widget and another widget with a
three widgets in that?

Yeah, I haven't used QtDesigner. I've done everything by code. So if it
is a concern with QtDesigner I probably can't help.

I'm a bit confused since you say the splitter is in a layout with the
tabwidget as well as there being a splitter in the first tab. Do you
have two splitters?

What it sounded like to me is below:

SomeWidget with a layout
  + TabWidget
  |   + Tab1 = Widget with layout
  |   |   + Splitter
  |   |   |   + Whats in splitter?
  |   |   |   + Whats in splitter?
  |   |   + ListWidget
  |   |   + Another widget with stuff in it
  |   + Tab2
  |   + Tab3
  + Splitter2 (A different one than in tab1 widget? I hope?)

I might suggest making a very small program with a splitter as the main
widget. Get it to do what you want your splitter to do. Once you figure
that out then put it in your more complicated real program.

Russell Valentine

On 06/15/10 14:15, F.A.Pinkse wrote:
> Hi Russell
> I havetested your suggestions.
> This is what I observe.
> In a Tabwidget I hav ethree tabs. The first tab has in a splitter a List
> widget and a layout of three fields.
> The splitter is in a layout with the tabwidget.
> Only .getRanges(1) produces results I can explain viz. [0,617]
> Only .setSizes() produces the result I want when the sum of the
> arguments is 617.
> I also played with .moverSplitter()
> It only shifts the splitter when I give the second argument as 1.
> With best regards.
> Frans.
> Op 6/15/2010 6:12 PM, Russell Valentine schreef:
>> The index is the index for the widgets in the splitter. I usually only
>> have two widgets in a splitter so I would use index 0 or 1. If it is
>> horizontal splitter then 0 is the left and 1 is the right.
>> I like splitter.sizes() better than getRange personally.
>> On 06/15/10 10:01, F.A.Pinkse wrote:
>>> Hi,
>>> I want to change the position of a splitter handle programmaticly.
>>> I use the spltter.setSizes(). that change the posotion alright, but can
>>> figure out the logic when using different value's.
>>> When I do a splitter.getRange(<index>) I get the begin and end positions
>>> of the splitter.
>>>  From these I can easily generate the proper value's for
>>> splitter.setSizes.
>>> The.getRange() needs an index as argument but how do I get the index of
>>> the splitter.
>>> Working wit PyQt4 on Python3
>>> With best regards,
>>> Frans.
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

More information about the PyQt mailing list