QGroupBox

The QGroupBox widget provides a group box frame with a title. More

Inheritance diagram of PySide6.QtWidgets.QGroupBox

Synopsis

Functions

Virtual functions

Detailed Description

../../_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:

QGroupBox *groupBox = new QGroupBox(tr("Exclusive Radio Buttons"));

QRadioButton *radio1 = new QRadioButton(tr("&Radio button 1"));
QRadioButton *radio2 = new QRadioButton(tr("R&adio button 2"));
QRadioButton *radio3 = new QRadioButton(tr("Ra&dio button 3"));

radio1->setChecked(true);


QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(radio1);
vbox->addWidget(radio2);
vbox->addWidget(radio3);
vbox->addStretch(1);
groupBox->setLayout(vbox);
class PySide6.QtWidgets.QGroupBox([parent=None])

PySide6.QtWidgets.QGroupBox(title[, parent=None])

Parameters

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

Constructs a group box with the given title and parent.

PySide6.QtWidgets.QGroupBox.alignment()
Return type

Alignment

See also

setAlignment()

PySide6.QtWidgets.QGroupBox.clicked([checked=false])
Parameters

checked – bool

PySide6.QtWidgets.QGroupBox.initStyleOption(option)
Parameters

optionPySide6.QtWidgets.QStyleOptionGroupBox

Initialize option with the values from this QGroupBox . This method is useful for subclasses when they need a QStyleOptionGroupBox , but don’t want to fill in all the information themselves.

See also

initFrom()

PySide6.QtWidgets.QGroupBox.isCheckable()
Return type

bool

PySide6.QtWidgets.QGroupBox.isChecked()
Return type

bool

PySide6.QtWidgets.QGroupBox.isFlat()
Return type

bool

PySide6.QtWidgets.QGroupBox.setAlignment(alignment)
Parameters

alignment – int

See also

alignment()

PySide6.QtWidgets.QGroupBox.setCheckable(checkable)
Parameters

checkable – bool

See also

isCheckable()

PySide6.QtWidgets.QGroupBox.setChecked(checked)
Parameters

checked – bool

See also

isChecked()

PySide6.QtWidgets.QGroupBox.setFlat(flat)
Parameters

flat – bool

See also

isFlat()

PySide6.QtWidgets.QGroupBox.setTitle(title)
Parameters

title – str

See also

title()

PySide6.QtWidgets.QGroupBox.title()
Return type

str

See also

setTitle()

PySide6.QtWidgets.QGroupBox.toggled(arg__1)
Parameters

arg__1 – bool