QButtonGroup

The QButtonGroup class provides a container to organize groups of button widgets. More

Inheritance diagram of PySide6.QtWidgets.QButtonGroup

Synopsis

Functions

Detailed Description

QButtonGroup provides an abstract container into which button widgets can be placed. It does not provide a visual representation of this container (see QGroupBox for a container widget), but instead manages the states of each of the buttons in the group.

An exclusive button group switches off all checkable (toggle) buttons except the one that has been clicked. By default, a button group is exclusive. The buttons in a button group are usually checkable QPushButton s, QCheckBox es (normally for non-exclusive button groups), or QRadioButton s. If you create an exclusive button group, you should ensure that one of the buttons in the group is initially checked; otherwise, the group will initially be in a state where no buttons are checked.

A button can be added to the group with and removed with . If the group is exclusive, the currently checked button is available with . If a button is clicked, the signal is emitted; for a checkable button in an exclusive group this means that the button has been checked. The list of buttons in the group is returned by .

In addition, QButtonGroup can map between integers and buttons. You can assign an integer id to a button with , and retrieve it with . The id of the currently checked button is available with , and there is an overloaded signal which emits the id of the button. The id -1 is reserved by QButtonGroup to mean “no such button”. The purpose of the mapping mechanism is to simplify the representation of enum values in a user interface.

class PySide6.QtWidgets.QButtonGroup([parent=None])
Parameters

parentPySide6.QtCore.QObject

PySide6.QtWidgets.QButtonGroup.addButton(arg__1[, id=-1])
Parameters
PySide6.QtWidgets.QButtonGroup.button(id)
Parameters

id – int

Return type

PySide6.QtWidgets.QAbstractButton

PySide6.QtWidgets.QButtonGroup.buttonClicked(arg__1)
Parameters

arg__1PySide6.QtWidgets.QAbstractButton

PySide6.QtWidgets.QButtonGroup.buttonPressed(arg__1)
Parameters

arg__1PySide6.QtWidgets.QAbstractButton

PySide6.QtWidgets.QButtonGroup.buttonReleased(arg__1)
Parameters

arg__1PySide6.QtWidgets.QAbstractButton

PySide6.QtWidgets.QButtonGroup.buttonToggled(arg__1, arg__2)
Parameters
PySide6.QtWidgets.QButtonGroup.buttons()
Return type

PySide6.QtWidgets.QButtonGroup.checkedButton()
Return type

PySide6.QtWidgets.QAbstractButton

PySide6.QtWidgets.QButtonGroup.checkedId()
Return type

int

PySide6.QtWidgets.QButtonGroup.exclusive()
Return type

bool

See also

setExclusive()

PySide6.QtWidgets.QButtonGroup.id(button)
Parameters

buttonPySide6.QtWidgets.QAbstractButton

Return type

int

PySide6.QtWidgets.QButtonGroup.idClicked(arg__1)
Parameters

arg__1 – int

PySide6.QtWidgets.QButtonGroup.idPressed(arg__1)
Parameters

arg__1 – int

PySide6.QtWidgets.QButtonGroup.idReleased(arg__1)
Parameters

arg__1 – int

PySide6.QtWidgets.QButtonGroup.idToggled(arg__1, arg__2)
Parameters
  • arg__1 – int

  • arg__2 – bool

PySide6.QtWidgets.QButtonGroup.removeButton(arg__1)
Parameters

arg__1PySide6.QtWidgets.QAbstractButton

PySide6.QtWidgets.QButtonGroup.setExclusive(arg__1)
Parameters

arg__1 – bool

See also

exclusive()

PySide6.QtWidgets.QButtonGroup.setId(button, id)
Parameters