• PySide 模块
  • PySide.QtGui
  • 内容表

    上一话题

    QGestureRecognizer

    下一话题

    QWidgetItem

    QLayoutItem

    继承者: QWidgetItem , QSpacerItem , QLayout , QStackedLayout , QGridLayout , QFormLayout , QBoxLayout , QVBoxLayout , QHBoxLayout

    详细描述

    PySide.QtGui.QLayoutItem class provides an abstract item that a PySide.QtGui.QLayout 操纵。

    这被用于自定义布局。

    纯虚函数被提供以返回布局有关信息,包括: 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 ,它可以被检索使用 PySide.QtGui.QLayoutItem.widget() . Similarly for PySide.QtGui.QLayoutItem.layout() and PySide.QtGui.QLayoutItem.spacerItem() .

    某些布局的宽度和高度是相互依赖的。这些可以被表达,使用 PySide.QtGui.QLayoutItem.hasHeightForWidth() , PySide.QtGui.QLayoutItem.heightForWidth() ,和 PySide.QtGui.QLayoutItem.minimumHeightForWidth() . For more explanation see the Qt 季刊 article Trading Height for Width.

    class PySide.QtGui. QLayoutItem ( [ alignment=0 ] )
    参数: alignment PySide.QtCore.Qt.Alignment
    PySide.QtGui.QLayoutItem. align
    PySide.QtGui.QLayoutItem. alignment ( )
    返回类型: PySide.QtCore.Qt.Alignment

    返回此项的对齐方式。

    PySide.QtGui.QLayoutItem. controlTypes ( )
    返回类型: 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.

    PySide.QtGui.QLayoutItem. expandingDirections ( )
    返回类型: 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.

    PySide.QtGui.QLayoutItem. geometry ( )
    返回类型: PySide.QtCore.QRect

    Returns the rectangle covered by this layout item.

    PySide.QtGui.QLayoutItem. hasHeightForWidth ( )
    返回类型: 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.

    PySide.QtGui.QLayoutItem. heightForWidth ( arg__1 )
    参数: arg__1 PySide.QtCore.int
    返回类型: 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.

    PySide.QtGui.QLayoutItem. invalidate ( )

    Invalidates any cached information in this layout item.

    PySide.QtGui.QLayoutItem. isEmpty ( )
    返回类型: PySide.QtCore.bool

    Implemented in subclasses to return whether this item is empty, i.e. whether it contains any widgets.

    PySide.QtGui.QLayoutItem. layout ( )
    返回类型: PySide.QtGui.QLayout

    若此项是 PySide.QtGui.QLayout , it is returned as a PySide.QtGui.QLayout ; otherwise 0 is returned. This function provides type-safe casting.

    PySide.QtGui.QLayoutItem. maximumSize ( )
    返回类型: PySide.QtCore.QSize

    Implemented in subclasses to return the maximum size of this item.

    PySide.QtGui.QLayoutItem. minimumHeightForWidth ( arg__1 )
    参数: arg__1 PySide.QtCore.int
    返回类型: PySide.QtCore.int

    Returns the minimum height this widget needs for the given width, w . The default implementation simply returns heightForWidth( w ).

    PySide.QtGui.QLayoutItem. minimumSize ( )
    返回类型: PySide.QtCore.QSize

    Implemented in subclasses to return the minimum size of this item.

    PySide.QtGui.QLayoutItem. setAlignment ( a )
    参数: a PySide.QtCore.Qt.Alignment
    PySide.QtGui.QLayoutItem. setGeometry ( arg__1 )
    参数: arg__1 PySide.QtCore.QRect

    Implemented in subclasses to set this item's geometry to r .

    PySide.QtGui.QLayoutItem. sizeHint ( )
    返回类型: PySide.QtCore.QSize

    Implemented in subclasses to return the preferred size of this item.

    PySide.QtGui.QLayoutItem. spacerItem ( )
    返回类型: PySide.QtGui.QSpacerItem

    若此项是 PySide.QtGui.QSpacerItem , it is returned as a PySide.QtGui.QSpacerItem ; otherwise 0 is returned. This function provides type-safe casting.

    PySide.QtGui.QLayoutItem. widget ( )
    返回类型: PySide.QtGui.QWidget

    若此项是 PySide.QtGui.QWidget , it is returned as a PySide.QtGui.QWidget ; otherwise 0 is returned. This function provides type-safe casting.