本文整理汇总了Python中PyQt4.Qt.QCheckBox.setCheckState方法的典型用法代码示例。如果您正苦于以下问题:Python QCheckBox.setCheckState方法的具体用法?Python QCheckBox.setCheckState怎么用?Python QCheckBox.setCheckState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QCheckBox
的用法示例。
在下文中一共展示了QCheckBox.setCheckState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setCheckState
# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import setCheckState [as 别名]
def setCheckState(self, state, setAsDefault = False):###bruce 070815 bugfix True -> False
"""
Sets the check box's check state to I{state}.
@param state: Set's the check box's check state.
@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
"""
if setAsDefault:
self.setAsDefault = setAsDefault
self.defaultState = state
QCheckBox.setCheckState(self, state)
示例2: AnnotationsAppearance
# 需要导入模块: from PyQt4.Qt import QCheckBox [as 别名]
# 或者: from PyQt4.Qt.QCheckBox import setCheckState [as 别名]
class AnnotationsAppearance(SizePersistedDialog):
'''
Dialog for managing CSS rules, including Preview window
'''
if isosx:
FONT = QFont('Monaco', 12)
elif iswindows:
FONT = QFont('Lucida Console', 9)
elif islinux:
FONT = QFont('Monospace', 9)
FONT.setStyleHint(QFont.TypeWriter)
def __init__(self, parent, icon, prefs):
self.opts = parent.opts
self.parent = parent
self.prefs = prefs
self.icon = icon
super(AnnotationsAppearance, self).__init__(parent, 'appearance_dialog')
self.setWindowTitle('Annotations appearance')
self.setWindowIcon(icon)
self.l = QVBoxLayout(self)
self.setLayout(self.l)
# Add a label for description
#self.description_label = QLabel("Descriptive text here")
#self.l.addWidget(self.description_label)
# Add a group box, vertical layout for preview window
self.preview_gb = QGroupBox(self)
self.preview_gb.setTitle("Preview")
self.preview_vl = QVBoxLayout(self.preview_gb)
self.l.addWidget(self.preview_gb)
self.wv = QWebView()
self.wv.setHtml('<p></p>')
self.wv.setMinimumHeight(100)
self.wv.setMaximumHeight(16777215)
self.wv.setGeometry(0, 0, 200, 100)
self.wv.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.preview_vl.addWidget(self.wv)
# Create a group box, horizontal layout for the table
self.css_table_gb = QGroupBox(self)
self.css_table_gb.setTitle("Annotation elements")
self.elements_hl = QHBoxLayout(self.css_table_gb)
self.l.addWidget(self.css_table_gb)
# Add the group box to the main layout
self.elements_table = AnnotationElementsTable(self, 'annotation_elements_tw')
self.elements_hl.addWidget(self.elements_table)
self.elements_table.initialize()
# Options
self.options_gb = QGroupBox(self)
self.options_gb.setTitle("Options")
self.options_gl = QGridLayout(self.options_gb)
self.l.addWidget(self.options_gb)
current_row = 0
# <hr/> separator
# addWidget(widget, row, col, rowspan, colspan)
self.hr_checkbox = QCheckBox('Add horizontal rule between annotations')
self.hr_checkbox.stateChanged.connect(self.hr_checkbox_changed)
self.hr_checkbox.setCheckState(
prefs.get('appearance_hr_checkbox', False))
self.options_gl.addWidget(self.hr_checkbox, current_row, 0, 1, 4)
current_row += 1
# Timestamp
self.timestamp_fmt_label = QLabel("Timestamp format:")
self.options_gl.addWidget(self.timestamp_fmt_label, current_row, 0)
self.timestamp_fmt_le = QLineEdit(
prefs.get('appearance_timestamp_format', default_timestamp),
parent=self)
self.timestamp_fmt_le.textEdited.connect(self.timestamp_fmt_changed)
self.timestamp_fmt_le.setFont(self.FONT)
self.timestamp_fmt_le.setObjectName('timestamp_fmt_le')
self.timestamp_fmt_le.setToolTip('Format string for timestamp')
self.timestamp_fmt_le.setMaximumWidth(16777215)
self.timestamp_fmt_le.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
self.options_gl.addWidget(self.timestamp_fmt_le, current_row, 1)
self.timestamp_fmt_reset_tb = QToolButton(self)
self.timestamp_fmt_reset_tb.setToolTip("Reset to default")
self.timestamp_fmt_reset_tb.setIcon(QIcon(I('trash.png')))
self.timestamp_fmt_reset_tb.clicked.connect(self.reset_timestamp_to_default)
self.options_gl.addWidget(self.timestamp_fmt_reset_tb, current_row, 2)
self.timestamp_fmt_help_tb = QToolButton(self)
self.timestamp_fmt_help_tb.setToolTip("Format string reference")
self.timestamp_fmt_help_tb.setIcon(QIcon(I('help.png')))
self.timestamp_fmt_help_tb.clicked.connect(self.show_help)
self.options_gl.addWidget(self.timestamp_fmt_help_tb, current_row, 3)
# Button box
bb = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
#.........这里部分代码省略.........