我们从Python开源项目中,提取了以下34个代码示例,用于说明如何使用PyQt5.QtCore.Qt.Unchecked()。
def make_entry(self,root,text,true_false): depth=0 pointer=root for depth in range(0,len(text)): found=False for i in range(0,pointer.childCount()): if pointer.child(i).text(0)==text[depth]: found=True pointer=pointer.child(i) break if found==False: pointer=QTreeWidgetItem(pointer, [text[depth]]) pointer.setFlags(pointer.flags() | Qt.ItemIsUserCheckable) #if depth==0: # pointer.setIcon(0,QIcon_load("folder")) if true_false==True: pointer.setCheckState(0, Qt.Checked ) else: pointer.setCheckState(0, Qt.Unchecked )
def data(self, index: QModelIndex, role=None): row = index.row() if role == Qt.DisplayRole: if row == 0: return "not assigned" else: try: return self.participants[row-1].name + " ("+ self.participants[row-1].shortname + ")" except IndexError: return None elif role == Qt.CheckStateRole: if row == 0: return Qt.Checked if self.show_unassigned else Qt.Unchecked else: try: return Qt.Checked if self.participants[row-1].show else Qt.Unchecked except IndexError: return None
def make_tree(self, parent): tree_widget = QTreeWidget(parent) tree_widget.setHeaderLabel("Menu") tree_widget.itemClicked.connect(self.update_units) tree_widget.units = QTreeWidgetItem(tree_widget, ["Unit Systems"]) for x in units_systems: child = QTreeWidgetItem(tree_widget.units, [x]) child.setFlags(child.flags() | Qt.ItemIsUserCheckable) child.setCheckState(0, Qt.Unchecked) tree_widget.units.addChild(child) tree_widget.addTopLevelItem(tree_widget.units) tree_widget.fields = QTreeWidgetItem(tree_widget, ["Fields"]) for x in fields: child = QTreeWidgetItem(tree_widget.fields, [x]) tree_widget.fields.addChild(child) tree_widget.addTopLevelItem(tree_widget.fields) return tree_widget
def update_check(self, recursive=False, col=None): if not self.required and self.last_check_state != self.checkState(0): self.last_check_state = self.checkState(0) if not self.is_msg: if self.last_check_state == Qt.Checked: self.update(self.value) else: self.update(None) elif not self.self_pb: # We have just checked the message ! assert self.last_check_state == Qt.Checked self.get_self_pb() # Recreates parent for i in range(self.childCount()): if self.child(i).required: self.child(i).parent_pb = None self.child(i).self_pb = None self.child(i).update(self.child(i).value) else: # We have just unchecked the message ! assert self.last_check_state != Qt.Checked for i in range(self.childCount()): if not self.child(i).required: self.child(i).setCheckState(0, Qt.Unchecked) self.child(i).update_check(True) self.child(i).parent_pb = None self.child(i).self_pb = None self.get_self_pb().Clear() self.update(None) if not recursive: self.app.update_fuzzer() elif col == 0: self.prompt_rename()
def __init__(self, parent, info, title="Channel Properties"): super().__init__(parent) self.setWindowTitle(title) self.model = QStandardItemModel(info["nchan"], 4) self.model.setHorizontalHeaderLabels(["#", "Label", "Type", "Bad"]) for index, ch in enumerate(info["chs"]): item = QStandardItem() item.setData(index, Qt.DisplayRole) item.setFlags(item.flags() & ~Qt.ItemIsEditable) self.model.setItem(index, 0, item) self.model.setItem(index, 1, QStandardItem(ch["ch_name"])) kind = channel_type(info, index).upper() self.model.setItem(index, 2, QStandardItem(str(kind))) bad = QStandardItem() bad.setData(ch["ch_name"] in info["bads"], Qt.UserRole) bad.setCheckable(True) bad.setEditable(False) checked = ch["ch_name"] in info["bads"] bad.setCheckState(Qt.Checked if checked else Qt.Unchecked) self.model.setItem(index, 3, bad) self.model.itemChanged.connect(bad_changed) self.proxymodel = MySortFilterProxyModel() self.proxymodel.setSourceModel(self.model) self.view = QTableView() self.view.setModel(self.proxymodel) self.view.setItemDelegateForColumn(2, ComboBoxDelegate(self.view)) self.view.setEditTriggers(QAbstractItemView.AllEditTriggers) self.view.verticalHeader().setVisible(False) self.view.horizontalHeader().setStretchLastSection(True) self.view.setShowGrid(False) self.view.setSelectionMode(QAbstractItemView.NoSelection) self.view.setSortingEnabled(True) self.view.sortByColumn(0, Qt.AscendingOrder) self.view.resizeColumnsToContents() # for i in range(self.model.rowCount()): # self.view.openPersistentEditor(self.model.index(i, 2)) vbox = QVBoxLayout(self) vbox.addWidget(self.view) self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(self.buttonbox) self.buttonbox.accepted.connect(self.accept) self.buttonbox.rejected.connect(self.reject) self.resize(400, 650)
def on_autoscroll_state_changed(self, state): if state == Qt.Checked: self.is_auto_scrolling = True elif state == Qt.Unchecked: self.is_auto_scrolling = False
def _update_checkboxes(self, item: QTreeWidgetItem, column: int): if column != 0: return new_check_state = item.checkState(0) self._set_check_state_to_tree(item, new_check_state) while True: item = item.parent() if item is None: break has_checked_children = False has_partially_checked_children = False has_unchecked_children = False for i in range(item.childCount()): state = item.child(i).checkState(0) if state == Qt.Checked: has_checked_children = True elif state == Qt.PartiallyChecked: has_partially_checked_children = True else: has_unchecked_children = True if not has_partially_checked_children and not has_unchecked_children: new_state = Qt.Checked elif has_checked_children or has_partially_checked_children: new_state = Qt.PartiallyChecked else: new_state = Qt.Unchecked item.setCheckState(0, new_state) self._update_selection_label()
def show(self, value: bool): value = Qt.Checked if value else Qt.Unchecked if not self.is_group: self.protocol.show = value self.protocol.qt_signals.show_state_changed.emit() else: for child in self.__childItems: child.__itemData.show = value if self.childCount() > 0: self.__childItems[0].__itemData.qt_signals.show_state_changed.emit()
def group_check_state(self): if not self.is_group: return None if self.childCount() == 0: return Qt.Unchecked if all(child.show for child in self.children): return Qt.Checked elif any(child.show for child in self.children): return Qt.PartiallyChecked else: return Qt.Unchecked
def unfuzzAll(self): fuzzedLabels = [label for label in self.labels if label.fuzz_me] for label in fuzzedLabels: label.fuzz_me = Qt.Unchecked self.protolabel_fuzzing_status_changed.emit(label)
def hideAll(self): visible_labels = [label for label in self.proto_analyzer.protocol_labels if label.show] for label in visible_labels: label.show = Qt.Unchecked self.protolabel_visibility_changed.emit(label)
def __init__(self, name: str): super().__init__() self.__enabled = Qt.Unchecked self.name = name self.plugin_path = "" self.description = "" self.__settings_frame = None self.qsettings = QSettings(QSettings.IniFormat, QSettings.UserScope, "urh", self.name + "-plugin")
def enabled(self, value: bool): if value != self.__enabled: self.__enabled = Qt.Checked if value else Qt.Unchecked self.enabled_changed.emit()
def call_3DModel(self,bgcolor): """ This routine responsible for displaying 3D Cad model :param: boolean :return: """ self.display.EraseAll() if self.ui.btn3D.isChecked: self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxSeatAngle.setChecked(Qt.Unchecked) self.commLogicObj.display_3DModel("Model",bgcolor)
def call_3DBeam(self,bgcolor): """ Creating and displaying 3D Beam """ self.display.EraseAll() self.ui.chkBxBeam.setChecked(Qt.Checked) if self.ui.chkBxBeam.isChecked(): self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.chkBxSeatAngle.setChecked(Qt.Unchecked) self.ui.btn3D.setChecked(Qt.Unchecked) self.ui.mytabWidget.setCurrentIndex(0) self.commLogicObj.display_3DModel("Beam",bgcolor)
def call_3DColumn(self,bgcolor): """ """ self.display.EraseAll() self.ui.chkBxCol.setChecked(Qt.Checked) if self.ui.chkBxCol.isChecked(): self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxSeatAngle.setChecked(Qt.Unchecked) self.ui.btn3D.setChecked(Qt.Unchecked) self.ui.mytabWidget.setCurrentIndex(0) self.commLogicObj.display_3DModel("Column",bgcolor)
def call_3DSeatAngle(self,bgcolor): """Displaying Seat Angle in 3D """ self.display.EraseAll() self.ui.chkBxSeatAngle.setChecked(Qt.Checked) if self.ui.chkBxSeatAngle.isChecked(): self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.btn3D.setChecked(Qt.Unchecked) self.ui.mytabWidget.setCurrentIndex(0) self.commLogicObj.display_3DModel("SeatAngle", bgcolor)
def unchecked_allChkBox(self): self.ui.btn3D.setChecked(Qt.Unchecked) self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.chkBxSeatAngle.setChecked(Qt.Unchecked)
def call_3DModel(self, bgcolor): ''' This routine responsible for diasplaying 3D Cad model :param flag: boolean :return: ''' if self.ui.btn3D.isChecked: self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxFinplate.setChecked(Qt.Unchecked) self.commLogicObj.display_3DModel("Model",bgcolor)
def call_3DBeam(self,bgcolor): ''' Creating and displaying 3D Beam ''' self.ui.chkBxBeam.setChecked(Qt.Checked) if self.ui.chkBxBeam.isChecked(): self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.chkBxFinplate.setChecked(Qt.Unchecked) self.ui.btn3D.setChecked(Qt.Unchecked) self.ui.mytabWidget.setCurrentIndex(0) self.commLogicObj.display_3DModel("Beam",bgcolor)
def call_3DColumn(self,bgcolor): ''' ''' self.ui.chkBxCol.setChecked(Qt.Checked) if self.ui.chkBxCol.isChecked(): self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxFinplate.setChecked(Qt.Unchecked) self.ui.btn3D.setChecked(Qt.Unchecked) self.ui.mytabWidget.setCurrentIndex(0) self.commLogicObj.display_3DModel("Column",bgcolor)
def call_3DFinplate(self,bgcolor): ''' Displaying FinPlate in 3D ''' self.ui.chkBxFinplate.setChecked(Qt.Checked) if self.ui.chkBxFinplate.isChecked(): self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.mytabWidget.setCurrentIndex(0) self.ui.btn3D.setChecked(Qt.Unchecked) self.commLogicObj.display_3DModel("Plate",bgcolor)
def unchecked_allChkBox(self): ''' This routine is responsible for unchecking all checkboxes in GUI ''' self.ui.btn3D.setChecked(Qt.Unchecked) self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.chkBxFinplate.setChecked(Qt.Unchecked)
def call_end2D_drawing(self, view): # call2D_Drawing(self,view) ''' This routine saves the 2D SVG image as per the connectivity selected SVG image created through svgwrite package which takes design INPUT and OUTPUT parameters from Finplate GUI. ''' self.ui.chkBxEndplate.setChecked(Qt.Unchecked) self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.btn3D.setChecked(Qt.Unchecked) status = self.resultObj['Bolt']['status'] if status is True: if view != 'All': if view == "Front": filename = os.path.join(self.folder, "images_html", "endFront.svg") elif view == "Side": filename = os.path.join(self.folder, "images_html", "endSide.svg") else: filename = os.path.join(self.folder, "images_html", "endTop.svg") svg_file = SvgWindow() svg_file.call_svgwindow(filename, view, self.folder) else: fname = '' self.commLogicObj.call2D_Drawing(view, fname, self.folder) else: QMessageBox.about(self, 'Information', 'Design Unsafe: %s view cannot be saved' % (view))
def call_3d_model(self, bgcolor): self.ui.btn3D.setChecked(Qt.Checked) if self.ui.btn3D.isChecked(): self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.chkBxEndplate.setChecked(Qt.Unchecked) self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.commLogicObj.display_3DModel("Model",bgcolor)
def call_3d_beam(self,bgcolor): ''' Creating and displaying 3D Beam ''' self.ui.chkBxBeam.setChecked(Qt.Checked) if self.ui.chkBxBeam.isChecked(): self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.chkBxEndplate.setChecked(Qt.Unchecked) self.ui.btn3D.setChecked(Qt.Unchecked) self.ui.mytabWidget.setCurrentIndex(0) self.commLogicObj.display_3DModel("Beam",bgcolor)
def call_3d_column(self,bgcolor): ''' ''' self.ui.chkBxCol.setChecked(Qt.Checked) if self.ui.chkBxCol.isChecked(): self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxEndplate.setChecked(Qt.Unchecked) self.ui.btn3D.setChecked(Qt.Unchecked) self.ui.mytabWidget.setCurrentIndex(0) self.commLogicObj.display_3DModel("Column",bgcolor)
def call_3d_endplate(self,bgcolor): '''Displaying EndPlate in 3D ''' self.ui.chkBxEndplate.setChecked(Qt.Checked) if self.ui.chkBxEndplate.isChecked(): self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.btn3D.setChecked(Qt.Unchecked) self.ui.mytabWidget.setCurrentIndex(0) self.commLogicObj.display_3DModel("Plate",bgcolor)
def unchecked_all_checkbox(self): self.ui.btn3D.setChecked(Qt.Unchecked) self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.checkBoxCleat.setChecked(Qt.Unchecked)
def call_3d_model(self,bgcolor): """ :return: """ self.ui.btn3D.setChecked(Qt.Checked) if self.ui.btn3D.isChecked(): self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.checkBoxCleat.setChecked(Qt.Unchecked) self.commLogicObj.display_3DModel("Model",bgcolor)
def call_3d_beam(self,bgcolor): ''' Creating and displaying 3D Beam ''' self.ui.chkBxBeam.setChecked(Qt.Checked) if self.ui.chkBxBeam.isChecked(): self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.checkBoxCleat.setChecked(Qt.Unchecked) self.ui.btn3D.setChecked(Qt.Unchecked) self.ui.mytabWidget.setCurrentIndex(0) self.commLogicObj.display_3DModel("Beam",bgcolor)
def call_3d_column(self,bgcolor): """ :return: """ self.ui.chkBxCol.setChecked(Qt.Checked) if self.ui.chkBxCol.isChecked(): self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.checkBoxCleat.setChecked(Qt.Unchecked) self.ui.btn3D.setChecked(Qt.Unchecked) self.ui.mytabWidget.setCurrentIndex(0) self.commLogicObj.display_3DModel("Column",bgcolor)
def callCleat2D_drawing(self, view): ''' This routine saves the 2D SVG image as per the connectivity selected SVG image created through svgwrite package which takes design INPUT and OUTPUT parameters from CleatAngle GUI. ''' self.ui.checkBoxCleat.setChecked(Qt.Unchecked) self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.btn3D.setChecked(Qt.Unchecked) status = self.resultObj['Bolt']['status'] if status is True: if view != 'All': if view == "Front": filename = os.path.join(self.folder, "images_html", "cleatFront.svg") elif view == "Side": filename = os.path.join(self.folder, "images_html", "cleatSide.svg") else: filename = os.path.join(self.folder, "images_html", "cleatTop.svg") svg_file = SvgWindow() svg_file.call_svgwindow(filename, view, self.folder) else: fname = '' self.commLogicObj.call2D_Drawing(view, fname, self.folder) else: QMessageBox.about(self,'Information', 'Design Unsafe: %s view cannot be saved' %(view))
def callend2D_Drawing(self, view): # call2D_Drawing(self,view) ''' This routine saves the 2D SVG image as per the connectivity selected SVG image created through svgwrite package which takes design INPUT and OUTPUT parameters from Finplate GUI. ''' self.ui.chkBxEndplate.setChecked(Qt.Unchecked) self.ui.chkBxBeam.setChecked(Qt.Unchecked) self.ui.chkBxCol.setChecked(Qt.Unchecked) self.ui.btn3D.setChecked(Qt.Unchecked) status = self.resultObj['Bolt']['status'] if status is True: if view != 'All': if view == "Front": filename = os.path.join(self.folder, "images_html", "endFront.svg") elif view == "Side": filename = os.path.join(self.folder, "images_html", "endSide.svg") else: filename = os.path.join(self.folder, "images_html", "endTop.svg") svg_file = SvgWindow() svg_file.call_svgwindow(filename, view, self.folder) else: fname = '' self.commLogicObj.call2D_Drawing(view, fname, self.folder) else: pass # def call_2d_drawing(self, view): # # ''' This routine saves the 2D SVG image as per the connectivity selected # SVG image created through svgwrite pacage which takes design INPUT and OUTPUT parameters from Endplate GUI. # ''' # self.ui.chkBxEndplate.setChecked(Qt.Unchecked) # self.ui.chkBxBeam.setChecked(Qt.Unchecked) # self.ui.chkBxCol.setChecked(Qt.Unchecked) # self.ui.btn3D.setChecked(Qt.Unchecked) # # if view == "All": # filename = '' # self.call_desired_view(filename, view) # self.display.set_bg_gradient_color(255, 255, 255, 255, 255, 255) # data = os.path.join(str(self.folder), "images_html", "3D_Model.png") # self.display.ExportToImage(data) # # else: # # if view == "Front": # filename = os.path.join(self.folder, "images_html", "endFront.svg") # # elif view == "Side": # filename = os.path.join(self.folder, "images_html", "endSide.svg") # # else: # filename = os.path.join(self.folder, "images_html", "endTop.svg") # # svg_file = SvgWindow() # svg_file.call_svgwindow(filename, view, self.folder)