• PySide 模块
  • PySide.QtGui
  • 内容表

    上一话题

    QHBoxLayout

    下一话题

    QActionGroup

    QButtonGroup

    概要

    函数

    信号

    详细描述

    PySide.QtGui.QButtonGroup class provides a container to organize groups of button widgets.

    PySide.QtGui.QButtonGroup provides an abstract container into which button widgets can be placed. It does not provide a visual representation of this container (see PySide.QtGui.QGroupBox 了解容器 Widget),但代替管理组中每个按钮的状态。

    An PySide.QtGui.QButtonGroup.exclusive() button group switches off all checkable (toggle) buttons except the one that was clicked. By default, a button group is exclusive. The buttons in a button group are usually checkable PySide.QtGui.QPushButton ‘s, PySide.QtGui.QCheckBox es (normally for non-exclusive button groups), or PySide.QtGui.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 is added to the group with PySide.QtGui.QButtonGroup.addButton() . It can be removed from the group with PySide.QtGui.QButtonGroup.removeButton() . If the group is exclusive, the currently checked button is available as PySide.QtGui.QButtonGroup.checkedButton() . If a button is clicked the PySide.QtGui.QButtonGroup.buttonClicked() signal is emitted. For a checkable button in an exclusive group this means that the button was checked. The list of buttons in the group is returned by PySide.QtGui.QButtonGroup.buttons() .

    此外, PySide.QtGui.QButtonGroup can map between integers and buttons. You can assign an integer id to a button with PySide.QtGui.QButtonGroup.setId() , and retrieve it with PySide.QtGui.QButtonGroup.id() . The id of the currently checked button is available with PySide.QtGui.QButtonGroup.checkedId() , and there is an overloaded signal PySide.QtGui.QButtonGroup.buttonClicked() which emits the id of the button. The id -1 is reserved by PySide.QtGui.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 PySide.QtGui. QButtonGroup ( [ parent=None ] )
    参数: parent PySide.QtCore.QObject

    Constructs a new, empty button group with the given parent .

    PySide.QtGui.QButtonGroup. addButton ( arg__1 , id )
    参数:

    添加给定 button to the button group, with the given id . It is recommended to assign only positive ids.

    PySide.QtGui.QButtonGroup. addButton ( arg__1 )
    参数: arg__1 PySide.QtGui.QAbstractButton

    添加给定 button to the end of the group's internal list of buttons. An id will be assigned to the button by this PySide.QtGui.QButtonGroup . Automatically assigned ids are guaranteed to be negative, starting with -2. If you are also assigning your own ids, use positive values to avoid conflicts.

    PySide.QtGui.QButtonGroup. button ( id )
    参数: id PySide.QtCore.int
    返回类型: PySide.QtGui.QAbstractButton

    Returns the button with the specified id , or 0 if no such button exists.

    PySide.QtGui.QButtonGroup. buttonClicked ( arg__1 )
    参数: arg__1 PySide.QtCore.int
    PySide.QtGui.QButtonGroup. buttonClicked ( arg__1 )
    参数: arg__1 PySide.QtGui.QAbstractButton
    PySide.QtGui.QButtonGroup. buttonPressed ( arg__1 )
    参数: arg__1 PySide.QtGui.QAbstractButton
    PySide.QtGui.QButtonGroup. buttonPressed ( arg__1 )
    参数: arg__1 PySide.QtCore.int
    PySide.QtGui.QButtonGroup. buttonReleased ( arg__1 )
    参数: arg__1 PySide.QtCore.int
    PySide.QtGui.QButtonGroup. buttonReleased ( arg__1 )
    参数: arg__1 PySide.QtGui.QAbstractButton
    PySide.QtGui.QButtonGroup. buttons ( )
    返回类型:

    Returns the list of this groups's buttons. This may be empty.

    PySide.QtGui.QButtonGroup. checkedButton ( )
    返回类型: PySide.QtGui.QAbstractButton

    Returns the button group's checked button, or 0 if no buttons are checked.

    PySide.QtGui.QButtonGroup. checkedId ( )
    返回类型: PySide.QtCore.int

    Returns the id of the PySide.QtGui.QButtonGroup.checkedButton() , or -1 if no button is checked.

    PySide.QtGui.QButtonGroup. exclusive ( )
    返回类型: PySide.QtCore.bool

    This property holds whether the button group is exclusive.

    If this property is true then only one button in the group can be checked at any given time. The user can click on any button to check it, and that button will replace the existing one as the checked button in the group.

    In an exclusive group, the user cannot uncheck the currently checked button by clicking on it; instead, another button in the group must be clicked to set the new checked button for that group.

    默认情况下,此特性为 true。

    PySide.QtGui.QButtonGroup. id ( button )
    参数: button PySide.QtGui.QAbstractButton
    返回类型: PySide.QtCore.int

    Returns the id for the specified button , or -1 if no such button exists.

    PySide.QtGui.QButtonGroup. removeButton ( arg__1 )
    参数: arg__1 PySide.QtGui.QAbstractButton

    移除给定 button 从按钮组。

    PySide.QtGui.QButtonGroup. setExclusive ( arg__1 )
    参数: arg__1 PySide.QtCore.bool

    This property holds whether the button group is exclusive.

    If this property is true then only one button in the group can be checked at any given time. The user can click on any button to check it, and that button will replace the existing one as the checked button in the group.

    In an exclusive group, the user cannot uncheck the currently checked button by clicking on it; instead, another button in the group must be clicked to set the new checked button for that group.

    默认情况下,此特性为 true。

    PySide.QtGui.QButtonGroup. setId ( button , id )
    参数:

    设置 id 为指定 button 。注意 id can not be -1.