Inherited by: QWidgetItem, QSpacerItem, QLayout, QStackedLayout, QGridLayout, QFormLayout, QBoxLayout, QVBoxLayout, QHBoxLayout
The PySide.QtGui.QLayoutItem class provides an abstract item that a PySide.QtGui.QLayout manipulates.
This is used by custom layouts.
Pure virtual functions are provided to return information about the layout, including, PySide.QtGui.QLayoutItem.sizeHint() , PySide.QtGui.QLayoutItem.minimumSize() , PySide.QtGui.QLayoutItem.maximumSize() and expanding().
The layout’s geometry can be set and retrieved with PySide.QtGui.QLayoutItem.setGeometry() and PySide.QtGui.QLayoutItem.geometry() , and its alignment with PySide.QtGui.QLayoutItem.setAlignment() and PySide.QtGui.QLayoutItem.alignment() .
PySide.QtGui.QLayoutItem.isEmpty() returns whether the layout item is empty. If the concrete item is a PySide.QtGui.QWidget , it can be retrieved using PySide.QtGui.QLayoutItem.widget() . Similarly for PySide.QtGui.QLayoutItem.layout() and PySide.QtGui.QLayoutItem.spacerItem() .
Some layouts have width and height interdependencies. These can be expressed using PySide.QtGui.QLayoutItem.hasHeightForWidth() , PySide.QtGui.QLayoutItem.heightForWidth() , and PySide.QtGui.QLayoutItem.minimumHeightForWidth() . For more explanation see the Qt Quarterly article Trading Height for Width.
See also
Parameters: | alignment – PySide.QtCore.Qt.Alignment |
---|
Return type: | PySide.QtCore.Qt.Alignment |
---|
Returns the alignment of this item.
Return type: | PySide.QtGui.QSizePolicy.ControlTypes |
---|
Returns the control type(s) for the layout item. For a PySide.QtGui.QWidgetItem , the control type comes from the widget’s size policy; for a PySide.QtGui.QLayoutItem , the control types is derived from the layout’s contents.
See also
Return type: | PySide.QtCore.Qt.Orientations |
---|
Returns whether this layout item can make use of more space than PySide.QtGui.QLayoutItem.sizeHint() . A value of Qt.Vertical or Qt.Horizontal means that it wants to grow in only one dimension, whereas Qt.Vertical | Qt.Horizontal means that it wants to grow in both dimensions.
Return type: | PySide.QtCore.QRect |
---|
Returns the rectangle covered by this layout item.
Return type: | PySide.QtCore.bool |
---|
Returns true if this layout’s preferred height depends on its width; otherwise returns false. The default implementation returns false.
Reimplement this function in layout managers that support height for width.
Parameters: | arg__1 – PySide.QtCore.int |
---|---|
Return type: | PySide.QtCore.int |
Returns the preferred height for this layout item, given the width w .
The default implementation returns -1, indicating that the preferred height is independent of the width of the item. Using the function PySide.QtGui.QLayoutItem.hasHeightForWidth() will typically be much faster than calling this function and testing for -1.
Reimplement this function in layout managers that support height for width. A typical implementation will look like this:
def heightForWidth(self, w):
if cache_dirty or cached_width != w:
h = calculateHeightForWidth(w)
self.cached_hfw = h
return h
return cached_hfw
Caching is strongly recommended; without it layout will take exponential time.
Invalidates any cached information in this layout item.
Return type: | PySide.QtCore.bool |
---|
Implemented in subclasses to return whether this item is empty, i.e. whether it contains any widgets.
Return type: | PySide.QtGui.QLayout |
---|
If this item is a PySide.QtGui.QLayout , it is returned as a PySide.QtGui.QLayout ; otherwise 0 is returned. This function provides type-safe casting.
Return type: | PySide.QtCore.QSize |
---|
Implemented in subclasses to return the maximum size of this item.
Parameters: | arg__1 – PySide.QtCore.int |
---|---|
Return type: | PySide.QtCore.int |
Returns the minimum height this widget needs for the given width, w . The default implementation simply returns heightForWidth(w ).
Return type: | PySide.QtCore.QSize |
---|
Implemented in subclasses to return the minimum size of this item.
Parameters: | a – PySide.QtCore.Qt.Alignment |
---|
Parameters: | arg__1 – PySide.QtCore.QRect |
---|
Implemented in subclasses to set this item’s geometry to r .
See also
Return type: | PySide.QtCore.QSize |
---|
Implemented in subclasses to return the preferred size of this item.
Return type: | PySide.QtGui.QSpacerItem |
---|
If this item is a PySide.QtGui.QSpacerItem , it is returned as a PySide.QtGui.QSpacerItem ; otherwise 0 is returned. This function provides type-safe casting.
Return type: | PySide.QtGui.QWidget |
---|
If this item is a PySide.QtGui.QWidget , it is returned as a PySide.QtGui.QWidget ; otherwise 0 is returned. This function provides type-safe casting.