QRadioButtonwidget provides a radio button with a text label. 更多 …
def
initStyleOption
(button)
![]()
A
QRadioButtonis an option button that can be switched on (checked) or off (unchecked). Radio buttons typically present the user with a “one of many” choice. In a group of radio buttons, only one radio button at a time can be checked; if the user selects another button, the previously selected button is switched off.Radio buttons are
autoExclusiveby default. If auto-exclusive is enabled, radio buttons that belong to the same parent widget behave as if they were part of the same exclusive button group. If you need multiple exclusive button groups for radio buttons that belong to the same parent widget, put them into aQButtonGroup.Whenever a button is switched on or off, it emits the
toggled()signal. Connect to this signal if you want to trigger an action each time the button changes state. UseisChecked()to see if a particular button is selected.就像
QPushButton, a radio button displays text, and optionally a small icon. The icon is set withsetIcon(). The text can be set in the constructor or withsetText(). A shortcut key can be specified by preceding the preferred character with an ampersand in the text. For example:button = QRadioButton("Search from the &cursor", self)在此范例中快捷方式是 Alt+c 。见
QShortcutdocumentation for details. To display an actual ampersand, use ‘&&’.Important inherited members:
text(),setText(),text(),setDown(),isDown(),autoRepeat(),group(),setAutoRepeat(),toggle(),pressed(),released(),clicked(),和toggled().
QRadioButton
(
[
parent=None
]
)
¶
QRadioButton(text[, parent=None])
- param parent
- param text
unicode
Constructs a radio button with the given
parent
, but with no text or pixmap.
parent
argument is passed on to the
QAbstractButton
构造函数。
Constructs a radio button with the given
parent
and
text
string.
parent
argument is passed on to the
QAbstractButton
构造函数。
PySide2.QtWidgets.QRadioButton.
initStyleOption
(
button
)
¶
button
–
QStyleOptionButton
初始化
option
采用值来自此
QRadioButton
。此方法对子类是有用的,当需要
QStyleOptionButton
, but don’t want to fill in all the information themselves.
另请参阅