我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用PyQt4.QtCore.Qt.Checked()。
def window_loaded(self): try: self.util.msg_log('window_loaded') self.util.msg_log('before stop') self.timer.stop() self.timer = None self.util.msg_log('before get_groupds') ok, result = self.cc.get_groups() if ok is False: QApplication.restoreOverrideCursor() self.util.dlg_warning(result) return if not result: self.list_all_clicked() else: for entry in result: item = QListWidgetItem(entry['display_name']) item.setData(Qt.UserRole, entry) #item.setCheckState(Qt.Checked) item.setCheckState(Qt.Unchecked) self.IDC_listGroup.addItem(item) finally: QApplication.restoreOverrideCursor()
def on_fields_group_box_toggled(self): """ A slot raised when the fields group box is checked or unchecked. Removes the selection from all fields when unchecked and selects all fields when checked. """ for text, column in self.field_items.iteritems(): items = self.exclude_fields_view.model().findItems( text, Qt.MatchExactly, column ) for item in items: if self.exclude_fields_groupbox.isChecked(): item.setCheckState(Qt.Checked) else: item.setCheckState(Qt.Unchecked)
def __get_selected_groups(self): groups = [] for i in range(0, self.IDC_listGroup.count()): item = self.IDC_listGroup.item(i) if item.checkState() == Qt.Checked: groups.append(item.data(Qt.UserRole)['name']) # None: means search all groups if len(groups) < 1 or len(groups) == self.IDC_listGroup.count(): return None return groups
def __get_selected_resources(self): res = [] for i in range(0, self.IDC_listRessources.count()): item = self.IDC_listRessources.item(i) if item.checkState() == Qt.Checked: res.append(item.data(Qt.UserRole)) if len(res) < 1: return None return res
def set_pw_echo_mode(self, state): self.password.setEchoMode(self.password.Normal if state == Qt.Checked else self.password.Password)
def setCheckBoxVulnerableChecked(self, checked=True): """ This function changes checkbox's state :param checked: True or False :return: None """ if checked: self.checkBoxVulnerable.setCheckState(Qt.Checked) else: self.checkBoxVulnerable.setCheckState(Qt.Unchecked)