QButtonGroupclass provides a container to organize groups of button widgets. 更多 …
def
addButton
(arg__1[, id=-1])
def
button
(id)
def
buttons
()
def
checkedButton
()
def
checkedId
()
def
exclusive
()
def
id
(button)
def
removeButton
(arg__1)
def
setExclusive
(arg__1)
def
setId
(button, id)
def
buttonClicked
(arg__1)
def
buttonClicked
(arg__1)
def
buttonPressed
(arg__1)
def
buttonPressed
(arg__1)
def
buttonReleased
(arg__1)
def
buttonReleased
(arg__1)
def
buttonToggled
(arg__1, arg__2)
def
buttonToggled
(arg__1, arg__2)
def
idClicked
(arg__1)
def
idPressed
(arg__1)
def
idReleased
(arg__1)
def
idToggled
(arg__1, arg__2)
QButtonGroupprovides an abstract container into which button widgets can be placed. It does not provide a visual representation of this container (seeQGroupBox了解容器 Widget),但代替管理组中每个按钮的状态。An
exclusivebutton 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 checkableQPushButtons,QCheckBoxes (normally for non-exclusive button groups), orQRadioButtons. 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
addButton()and removed withremoveButton(). If the group is exclusive, the currently checked button is available withcheckedButton(). If a button is clicked, thebuttonClicked()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 bybuttons().此外,
QButtonGroupcan map between integers and buttons. You can assign an integer id to a button withsetId(), and retrieve it withid(). The id of the currently checked button is available withcheckedId(), and there is an overloaded signalbuttonClicked()which emits the id of the button. The id-1is reserved byQButtonGroupto mean “no such button”. The purpose of the mapping mechanism is to simplify the representation of enum values in a user interface.
QButtonGroup
(
[
parent=None
]
)
¶
- param parent
QObject
Constructs a new, empty button group with the given
parent
.
PySide2.QtWidgets.QButtonGroup.
addButton
(
arg__1
[
,
id=-1
]
)
¶
arg__1
–
QAbstractButton
id
–
int
添加给定
button
to the button group. If
id
is -1, an id will be assigned to the button. Automatically assigned ids are guaranteed to be negative, starting with -2. If you are assigning your own ids, use positive values to avoid conflicts.
另请参阅
id
–
int
Returns the button with the specified
id
,或
None
if no such button exists.
arg__1
–
QAbstractButton
PySide2.QtWidgets.QButtonGroup.
buttonClicked
(
arg__1
)
¶
arg__1
–
int
注意
此函数被弃用。
arg__1
–
QAbstractButton
PySide2.QtWidgets.QButtonGroup.
buttonPressed
(
arg__1
)
¶
arg__1
–
int
注意
此函数被弃用。
arg__1
–
QAbstractButton
PySide2.QtWidgets.QButtonGroup.
buttonReleased
(
arg__1
)
¶
arg__1
–
int
注意
此函数被弃用。
arg__1
–
QAbstractButton
arg__2
–
bool
PySide2.QtWidgets.QButtonGroup.
buttonToggled
(
arg__1
,
arg__2
)
¶
arg__1
–
int
arg__2
–
bool
注意
此函数被弃用。
Returns the button group’s list of buttons. This may be empty.
PySide2.QtWidgets.QButtonGroup.
checkedButton
(
)
¶
Returns the button group’s checked button, or
None
if no buttons are checked.
另请参阅
PySide2.QtWidgets.QButtonGroup.
checkedId
(
)
¶
int
Returns the id of the
checkedButton()
, or -1 if no button is checked.
另请参阅
PySide2.QtWidgets.QButtonGroup.
exclusive
(
)
¶
bool
另请参阅
PySide2.QtWidgets.QButtonGroup.
id
(
button
)
¶
button
–
QAbstractButton
int
Returns the id for the specified
button
, or -1 if no such button exists.
另请参阅
PySide2.QtWidgets.QButtonGroup.
idClicked
(
arg__1
)
¶
arg__1
–
int
PySide2.QtWidgets.QButtonGroup.
idPressed
(
arg__1
)
¶
arg__1
–
int
PySide2.QtWidgets.QButtonGroup.
idReleased
(
arg__1
)
¶
arg__1
–
int
PySide2.QtWidgets.QButtonGroup.
idToggled
(
arg__1
,
arg__2
)
¶
arg__1
–
int
arg__2
–
bool
PySide2.QtWidgets.QButtonGroup.
removeButton
(
arg__1
)
¶
arg__1
–
QAbstractButton
移除给定
button
从按钮组。
另请参阅
PySide2.QtWidgets.QButtonGroup.
setExclusive
(
arg__1
)
¶
arg__1
–
bool
另请参阅
PySide2.QtWidgets.QButtonGroup.
setId
(
button
,
id
)
¶
button
–
QAbstractButton
id
–
int
设置
id
为指定
button
。注意
id
不可以是 -1。
另请参阅