The PySide.QtGui.QSplitter class implements a splitter widget.
A splitter lets the user control the size of child widgets by dragging the boundary between the children. Any number of widgets may be controlled by a single splitter. The typical use of a PySide.QtGui.QSplitter is to create several widgets and add them using PySide.QtGui.QSplitter.insertWidget() or PySide.QtGui.QSplitter.addWidget() .
The following example will show a PySide.QtGui.QListView , PySide.QtGui.QTreeView , and PySide.QtGui.QTextEdit side by side, with two splitter handles:
splitter = QSplitter(parent) listview = QListView() treeview = QTreeView() textedit = QTextEdit() splitter.addWidget(listview) splitter.addWidget(treeview) splitter.addWidget(textedit)If a widget is already inside a PySide.QtGui.QSplitter when PySide.QtGui.QSplitter.insertWidget() or PySide.QtGui.QSplitter.addWidget() is called, it will move to the new position. This can be used to reorder widgets in the splitter later. You can use PySide.QtGui.QSplitter.indexOf() , PySide.QtGui.QSplitter.widget() , and PySide.QtGui.QSplitter.count() to get access to the widgets inside the splitter.
A default PySide.QtGui.QSplitter lays out its children horizontally (side by side); you can use setOrientation( Qt.Vertical ) to lay its children out vertically.
By default, all widgets can be as large or as small as the user wishes, between the PySide.QtGui.QSplitter.minimumSizeHint() (or PySide.QtGui.QWidget.minimumSize() ) and PySide.QtGui.QWidget.maximumSize() of the widgets.
PySide.QtGui.QSplitter resizes its children dynamically by default. If you would rather have PySide.QtGui.QSplitter resize the children only at the end of a resize operation, call setOpaqueResize(false).
The initial distribution of size between the widgets is determined by multiplying the initial size with the stretch factor. You can also use PySide.QtGui.QSplitter.setSizes() to set the sizes of all the widgets. The function PySide.QtGui.QSplitter.sizes() returns the sizes set by the user. Alternatively, you can save and restore the sizes of the widgets from a PySide.QtCore.QByteArray using PySide.QtGui.QSplitter.saveState() and PySide.QtGui.QSplitter.restoreState() respectively.
When you PySide.QtGui.QWidget.hide() a child its space will be distributed among the other children. It will be reinstated when you PySide.QtGui.QWidget.show() it again.
Parameters: |
|
---|
Constructs a horizontal splitter with the parent argument passed on to the PySide.QtGui.QFrame constructor.
Parameters: | widget – PySide.QtGui.QWidget |
---|
Adds the given widget to the splitter’s layout after all the other items.
If widget is already in the splitter, it will be moved to the new position.
Return type: | PySide.QtCore.bool |
---|
This property holds whether child widgets can be resized down to size 0 by the user.
By default, children are collapsible. It is possible to enable and disable the collapsing of individual children using PySide.QtGui.QSplitter.setCollapsible() .
Parameters: |
|
---|---|
Return type: | PySide.QtCore.int |
Returns the closest legal position to pos of the widget with index index .
For right-to-left languages such as Arabic and Hebrew, the layout of horizontal splitters is reversed. Positions are then measured from the right edge of the widget.
See also
Return type: | PySide.QtCore.int |
---|
Returns the number of widgets contained in the splitter’s layout.
Return type: | PySide.QtGui.QSplitterHandle |
---|
Returns a new splitter handle as a child widget of this splitter. This function can be reimplemented in subclasses to provide support for custom handles.
Parameters: | index – PySide.QtCore.int |
---|
Returns the valid range of the splitter with index index in *``min`` and *``max`` if min and max are not 0.
Parameters: | index – PySide.QtCore.int |
---|---|
Return type: | PySide.QtGui.QSplitterHandle |
Returns the handle to the left (or above) for the item in the splitter’s layout at the given index . The handle at index 0 is always hidden.
For right-to-left languages such as Arabic and Hebrew, the layout of horizontal splitters is reversed. The handle will be to the right of the widget at index .
Return type: | PySide.QtCore.int |
---|
This property holds the width of the splitter handles.
By default, this property contains a value that depends on the user’s platform and style preferences.
If you set PySide.QtGui.QSplitter.handleWidth() to 1, the actual grab area will grow to overlap a few pixels of it’s respective widgets.
Parameters: | w – PySide.QtGui.QWidget |
---|---|
Return type: | PySide.QtCore.int |
Returns the index in the splitter’s layout of the specified widget . This also works for handles.
Handles are numbered from 0. There are as many handles as there are child widgets, but the handle at position 0 is always hidden.
Parameters: |
|
---|
Inserts the widget specified into the splitter’s layout at the given index .
If widget is already in the splitter, it will be moved to the new position.
if index is an invalid index, then the widget will be inserted at the end.
Parameters: | index – PySide.QtCore.int |
---|---|
Return type: | PySide.QtCore.bool |
Returns true if the widget at index is collapsible, otherwise returns false
Parameters: |
|
---|
Moves the left or top edge of the splitter handle at index as close as possible to position pos , which is the distance from the left or top edge of the widget.
For right-to-left languages such as Arabic and Hebrew, the layout of horizontal splitters is reversed. pos is then the distance from the right edge of the widget.
Return type: | PySide.QtCore.bool |
---|
This property holds whether resizing is opaque.
Opaque resizing is on by default.
Return type: | PySide.QtCore.Qt.Orientation |
---|
This property holds the orientation of the splitter.
By default the orientation is horizontal (i.e., the widgets are laid out side by side). The possible orientations are Qt.Horizontal and Qt.Vertical .
See also
Updates the splitter’s state. You should not need to call this function.
Parameters: | state – PySide.QtCore.QByteArray |
---|---|
Return type: | PySide.QtCore.bool |
Restores the splitter’s layout to the state specified. Returns true if the state is restored; otherwise returns false.
Typically this is used in conjunction with PySide.QtCore.QSettings to restore the size from a past session. Here is an example:
Restore the splitters’s state:
settings = QSettings()
splitter.restoreState(settings.value("splitterSizes").toByteArray())
A failure to restore the splitter’s layout may result from either invalid or out-of-date data in the supplied byte array.
See also
Return type: | PySide.QtCore.QByteArray |
---|
Saves the state of the splitter’s layout.
Typically this is used in conjunction with PySide.QtCore.QSettings to remember the size for a future session. A version number is stored as part of the data. Here is an example:
settings = QSettings()
settings.setValue("splitterSizes", splitter.saveState())
Parameters: | arg__1 – PySide.QtCore.bool |
---|
This property holds whether child widgets can be resized down to size 0 by the user.
By default, children are collapsible. It is possible to enable and disable the collapsing of individual children using PySide.QtGui.QSplitter.setCollapsible() .
Parameters: |
|
---|
Sets whether the child widget at index index is collapsible to collapse .
By default, children are collapsible, meaning that the user can resize them down to size 0, even if they have a non-zero PySide.QtGui.QWidget.minimumSize() or PySide.QtGui.QSplitter.minimumSizeHint() . This behavior can be changed on a per-widget basis by calling this function, or globally for all the widgets in the splitter by setting the PySide.QtGui.QSplitter.childrenCollapsible() property.
Parameters: | arg__1 – PySide.QtCore.int |
---|
This property holds the width of the splitter handles.
By default, this property contains a value that depends on the user’s platform and style preferences.
If you set PySide.QtGui.QSplitter.handleWidth() to 1, the actual grab area will grow to overlap a few pixels of it’s respective widgets.
Parameters: | opaque – PySide.QtCore.bool |
---|
This property holds whether resizing is opaque.
Opaque resizing is on by default.
Parameters: | arg__1 – PySide.QtCore.Qt.Orientation |
---|
This property holds the orientation of the splitter.
By default the orientation is horizontal (i.e., the widgets are laid out side by side). The possible orientations are Qt.Horizontal and Qt.Vertical .
See also
Parameters: | position – PySide.QtCore.int |
---|
Displays a rubber band at position pos . If pos is negative, the rubber band is removed.
Parameters: | list – |
---|
Parameters: |
|
---|
Updates the size policy of the widget at position index to have a stretch factor of stretch .
stretch is not the effective stretch factor; the effective stretch factor is calculated by taking the initial size of the widget and multiplying it with stretch .
This function is provided for convenience. It is equivalent to
widget = splitter.widget(index)
policy = widget.sizePolicy()
policy.setHorizontalStretch(stretch)
policy.setVerticalStretch(stretch)
widget.setSizePolicy(policy)
Return type: |
---|
Returns a list of the size parameters of all the widgets in this splitter.
If the splitter’s orientation is horizontal, the list contains the widgets width in pixels, from left to right; if the orientation is vertical, the list contains the widgets height in pixels, from top to bottom.
Giving the values to another splitter’s PySide.QtGui.QSplitter.setSizes() function will produce a splitter with the same layout as this one.
Note that invisible widgets have a size of 0.
See also
Parameters: |
|
---|
Parameters: | index – PySide.QtCore.int |
---|---|
Return type: | PySide.QtGui.QWidget |
Returns the widget at the given index in the splitter’s layout.