QLayoutItemclass provides an abstract item that aQLayout操纵。 更多 …
继承者: QSpacerItem , QWidgetItem
def
alignment
()
def
setAlignment
(a)
def
controlTypes
()
def
expandingDirections
()
def
geometry
()
def
hasHeightForWidth
()
def
heightForWidth
(arg__1)
def
invalidate
()
def
isEmpty
()
def
layout
()
def
maximumSize
()
def
minimumHeightForWidth
(arg__1)
def
minimumSize
()
def
setGeometry
(arg__1)
def
sizeHint
()
def
spacerItem
()
def
widget
()
这被用于自定义布局。
纯虚函数被提供以返回布局有关信息,包括:
sizeHint(),minimumSize(),maximumSize()and expanding().The layout’s geometry can be set and retrieved with
setGeometry()andgeometry(), and its alignment withsetAlignment()andalignment().
isEmpty()returns whether the layout item is empty. If the concrete item is aQWidget,它可以被检索使用widget(). Similarly forlayout()andspacerItem().某些布局的宽度和高度是相互依赖的。这些可以被表达,使用
hasHeightForWidth(),heightForWidth(),和minimumHeightForWidth(). For more explanation see the Qt 季刊 文章 交易高度为宽度 .另请参阅
QLayoutItem
(
[
alignment=Qt.Alignment()
]
)
¶
- param alignment
Alignment
构造布局项采用
alignment
。并非所有子类都支持对齐。
PySide2.QtWidgets.QLayoutItem.
align
¶
PySide2.QtWidgets.QLayoutItem.
alignment
(
)
¶
Alignment
返回此项的对齐方式。
另请参阅
PySide2.QtWidgets.QLayoutItem.
controlTypes
(
)
¶
ControlTypes
Returns the control type(s) for the layout item. For a
QWidgetItem
, the control type comes from the widget’s size policy; for a
QLayoutItem
, the control types is derived from the layout’s contents.
另请参阅
PySide2.QtWidgets.QLayoutItem.
expandingDirections
(
)
¶
Orientations
Returns whether this layout item can make use of more space than
sizeHint()
. A value of
Vertical
or
Horizontal
means that it wants to grow in only one dimension, whereas
Vertical
|
Horizontal
means that it wants to grow in both dimensions.
PySide2.QtWidgets.QLayoutItem.
geometry
(
)
¶
QRect
Returns the rectangle covered by this layout item.
另请参阅
PySide2.QtWidgets.QLayoutItem.
hasHeightForWidth
(
)
¶
bool
返回
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.
PySide2.QtWidgets.QLayoutItem.
heightForWidth
(
arg__1
)
¶
arg__1
–
int
int
Returns the preferred height for this layout item, given the width, which is not used in this default implementation.
The default implementation returns -1, indicating that the preferred height is independent of the width of the item. Using the function
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.
另请参阅
PySide2.QtWidgets.QLayoutItem.
invalidate
(
)
¶
Invalidates any cached information in this layout item.
PySide2.QtWidgets.QLayoutItem.
isEmpty
(
)
¶
bool
Implemented in subclasses to return whether this item is empty, i.e. whether it contains any widgets.
PySide2.QtWidgets.QLayoutItem.
layout
(
)
¶
若此项是
QLayout
, it is returned as a
QLayout
;否则
None
is returned. This function provides type-safe casting.
另请参阅
PySide2.QtWidgets.QLayoutItem.
maximumSize
(
)
¶
QSize
Implemented in subclasses to return the maximum size of this item.
PySide2.QtWidgets.QLayoutItem.
minimumHeightForWidth
(
arg__1
)
¶
arg__1
–
int
int
Returns the minimum height this widget needs for the given width,
w
. The default implementation simply returns
heightForWidth
(
w
).
PySide2.QtWidgets.QLayoutItem.
minimumSize
(
)
¶
QSize
Implemented in subclasses to return the minimum size of this item.
PySide2.QtWidgets.QLayoutItem.
setAlignment
(
a
)
¶
a
–
Alignment
把此项的对齐方式设为
alignment
.
注意
Item alignment is only supported by
QLayoutItem
subclasses where it would have a visual effect. Except for
QSpacerItem
, which provides blank space for layouts, all public Qt classes that inherit
QLayoutItem
support item alignment.
另请参阅
PySide2.QtWidgets.QLayoutItem.
setGeometry
(
arg__1
)
¶
arg__1
–
QRect
Implemented in subclasses to set this item’s geometry to
r
.
另请参阅
PySide2.QtWidgets.QLayoutItem.
sizeHint
(
)
¶
QSize
Implemented in subclasses to return the preferred size of this item.
PySide2.QtWidgets.QLayoutItem.
spacerItem
(
)
¶
若此项是
QSpacerItem
, it is returned as a
QSpacerItem
;否则
None
is returned. This function provides type-safe casting.
PySide2.QtWidgets.QLayoutItem.
widget
(
)
¶
若此项管理
QWidget
, returns that widget. Otherwise,
None
被返回。
注意
While the functions
layout()
and
spacerItem()
perform casts, this function returns another object:
QLayout
and
QSpacerItem
inherit
QLayoutItem
,而
QWidget
does not.
另请参阅