本文整理汇总了Python中PyQt4.Qt.QCheckBox.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QCheckBox.__init__方法的具体用法?Python QCheckBox.__init__怎么用?Python QCheckBox.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QCheckBox
的用法示例。
在下文中一共展示了QCheckBox.__init__方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import __init__ [as 别名]
def __init__(self,
parentWidget,
text = '',
widgetColumn = 1,
state = None, ##Qt.Unchecked,
setAsDefault = True,
spanWidth = False
):
"""
Appends a QCheckBox (Qt) widget to the bottom of I{parentWidget},
a Property Manager group box.
@param parentWidget: The parent group box containing this widget.
@type parentWidget: PM_GroupBox
@param text: This property holds the text shown on the checkbox.
@type text: str
@param widgetColumn: The column number of the PM_CheckBox widget
in the group box grid layout. The only valid values
are 0 (left column) and 1 (right column).
The default is 1 (right column).
@type widgetColumn: int
@param state: Set's the check box's check state. The default is
Qt.Unchecked (unchecked).
@type state: U{B{Qt.CheckState}<http://doc.trolltech.com/4/
qt.html#CheckState-enum>}
@param setAsDefault: If True, will restore I{state} when the
"Restore Defaults" button is clicked.
@type setAsDefault: bool
@param spanWidth: if True, the widget and its label will span the width
of the group box. Its label will appear directly above
the widget (unless the label is empty) and is left
justified.
@type spanWidth: bool
@see: U{B{QCheckBox}<http://doc.trolltech.com/4/qcheckbox.html>}
"""
QCheckBox.__init__(self)
self.parentWidget = parentWidget
self.setText(text)
self.widgetColumn = widgetColumn
self.setAsDefault = setAsDefault
self.spanWidth = spanWidth
#Ideally, this should be simply self.setCheckState(state) with the
#default state = Qt.UnChecked in the ,init argument itself. But,
#apparently pylint chokes up when init argument is a Qt enum.
#This problem happened while running pylint 0.23 on the SEMBOT server
#so comitting this temporary workaround. The pylint on my machine is
#0.25 and it runs fine even before this workaround. Similar changes made
#in PM_Slider.
#-- Ninad 2008-06-30
if state is None:
state = Qt.Unchecked
if self.setAsDefault:
self.setDefaultState(state)
self.setCheckState(state)
parentWidget.addPmWidget(self)
示例2: __init__
# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import __init__ [as 别名]
def __init__(self, data, key, text, parent):
QCheckBox.__init__(self, text, parent)
self.data, self.key = data, key
self.setChecked(data.get(key, False))
self.stateChanged.connect(self._changed)