内容表

上一话题

QGridLayout

下一话题

QHBoxLayout

QGroupBox

QGroupBox widget provides a group box frame with a title. 更多

Inheritance diagram of PySide2.QtWidgets.QGroupBox

概要

函数

信号

详细描述

../../_images/windows-groupbox.png

A group box provides a frame, a title on top, a keyboard shortcut, and displays various other widgets inside itself. The keyboard shortcut moves keyboard focus to one of the group box’s child widgets.

QGroupBox also lets you set the title (normally set in the constructor) and the title’s alignment . Group boxes can be checkable . Child widgets in checkable group boxes are enabled or disabled depending on whether or not the group box is checked .

You can minimize the space consumption of a group box by enabling the flat property. In most styles , enabling this property results in the removal of the left, right and bottom edges of the frame.

QGroupBox doesn’t automatically lay out the child widgets (which are often QCheckBox es or QRadioButton s but can be any widgets). The following example shows how we can set up a QGroupBox with a layout:

groupBox = QGroupBox("Exclusive Radio Buttons")
radio1 = QRadioButton("&Radio button 1")
radio2 = QRadioButton("R&adio button 2")
radio3 = QRadioButton("Ra&dio button 3")
radio1.setChecked(True)
vbox = QVBoxLayout()
vbox.addWidget(radio1)
vbox.addWidget(radio2)
vbox.addWidget(radio3)
vbox.addStretch(1)
groupBox.setLayout(vbox)
											
class QGroupBox ( [ parent=None ] )

QGroupBox(title[, parent=None])

param parent

QWidget

param title

unicode

Constructs a group box widget with the given parent but with no title.

Constructs a group box with the given title and parent .

PySide2.QtWidgets.QGroupBox. alignment ( )
返回类型

Alignment

另请参阅

setAlignment()

PySide2.QtWidgets.QGroupBox. clicked ( [ checked=false ] )
参数

checked bool

PySide2.QtWidgets.QGroupBox. initStyleOption ( option )
参数

option QStyleOptionGroupBox

初始化 option 采用值来自此 QGroupBox 。此方法对子类是有用的,当需要 QStyleOptionGroupBox , but don’t want to fill in all the information themselves.

另请参阅

initFrom()

PySide2.QtWidgets.QGroupBox. isCheckable ( )
返回类型

bool

PySide2.QtWidgets.QGroupBox. isChecked ( )
返回类型

bool

PySide2.QtWidgets.QGroupBox. isFlat ( )
返回类型

bool

PySide2.QtWidgets.QGroupBox. setAlignment ( alignment )
参数

alignment int

另请参阅

alignment()

PySide2.QtWidgets.QGroupBox. setCheckable ( checkable )
参数

checkable bool

另请参阅

isCheckable()

PySide2.QtWidgets.QGroupBox. setChecked ( checked )
参数

checked bool

另请参阅

isChecked()

PySide2.QtWidgets.QGroupBox. setFlat ( flat )
参数

flat bool

另请参阅

isFlat()

PySide2.QtWidgets.QGroupBox. setTitle ( title )
参数

title – unicode

另请参阅

title()

PySide2.QtWidgets.QGroupBox. title ( )
返回类型

unicode

另请参阅

setTitle()

PySide2.QtWidgets.QGroupBox. toggled ( arg__1 )
参数

arg__1 bool