内容表

上一话题

QSlider

下一话题

QSpinBox

QSpacerItem

QSpacerItem class provides blank space in a layout. 更多

Inheritance diagram of PySide2.QtWidgets.QSpacerItem

概要

函数

详细描述

Normally, you don’t need to use this class directly. Qt’s built-in layout managers provide the following functions for manipulating empty space in layouts:

Class

函数

QHBoxLayout

addSpacing() , addStretch() , insertSpacing() , insertStretch()

QGridLayout

setRowMinimumHeight() , setRowStretch() , setColumnMinimumWidth() , setColumnStretch()

class QSpacerItem ( w , h [ , hData=QSizePolicy.Minimum [ , vData=QSizePolicy.Minimum ] ] )
param w

int

param h

int

param hData

Policy

param vData

Policy

Constructs a spacer item with preferred width w , preferred height h , horizontal size policy hPolicy and vertical size policy vPolicy .

The default values provide a gap that is able to stretch if nothing else wants the space.

PySide2.QtWidgets.QSpacerItem. changeSize ( w , h [ , hData=QSizePolicy.Minimum [ , vData=QSizePolicy.Minimum ] ] )
参数
  • w int

  • h int

  • hData Policy

  • vData Policy

Changes this spacer item to have preferred width w , preferred height h , horizontal size policy hPolicy and vertical size policy vPolicy .

The default values provide a gap that is able to stretch if nothing else wants the space.

Note that if is called after the spacer item has been added to a layout, it is necessary to invalidate the layout in order for the spacer item’s new size to take effect.

另请参阅

invalidate()

PySide2.QtWidgets.QSpacerItem. sizePolicy ( )
返回类型

QSizePolicy

返回此项的尺寸策略。