當前位置: 首頁>>代碼示例>>Python>>正文


Python Qt.Checked方法代碼示例

本文整理匯總了Python中qgis.PyQt.QtCore.Qt.Checked方法的典型用法代碼示例。如果您正苦於以下問題:Python Qt.Checked方法的具體用法?Python Qt.Checked怎麽用?Python Qt.Checked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在qgis.PyQt.QtCore.Qt的用法示例。


在下文中一共展示了Qt.Checked方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: validateCurrentPage

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def validateCurrentPage(self):
        if self.currentId() == 0:
            if self.importRadioButton.checkState() == Qt.Unchecked() and self.createNewRadioButton.checkState() == Qt.Unchecked() and self.installRadioButton.checkState() == Qt.Unchecked():
                errorMsg = self.tr('An option must be chosen!\n')
                QMessageBox.warning(self, self.tr('Error!'), errorMsg)
                return False
            if self.installRadioButton.checkState() == Qt.Checked():
                if self.settingComboBox.currentIndex() == 0:
                    errorMsg = self.tr('A setting must be chosen!\n')
                    QMessageBox.warning(self, self.tr('Error!'), errorMsg)
                    return False
                else:
                    return True
            return True
        else:
            return True 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:18,代碼來源:selectTaskWizard.py

示例2: populateFromUiParameterJsonDict

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def populateFromUiParameterJsonDict(self, uiParameterJsonDict):
        """
        builds ui from uiParameterJsonDict
        {
            'domainComboBox': --current text of domainComboBox --
            'allDomainCheckBox': --state of allDomainCheckBox--
            'codeLineEdit': --current text of codeLineEdit--
            'codeNameLineEdit': --current text of codeNameLineEdit--
        }
        """
        if uiParameterJsonDict:
            if uiParameterJsonDict['allDomainCheckBox']:
                self.allDomainCheckBox.setCheckState(Qt.Checked)
            else:
                domainIdx = self.domainComboBox.findText(uiParameterJsonDict['domainComboBox'], flags = Qt.MatchExactly)
                self.domainComboBox.setCurrentIndex(domainIdx)
            self.codeLineEdit.setText(uiParameterJsonDict['codeLineEdit'])
            self.codeNameLineEdit.setText(uiParameterJsonDict['codeNameLineEdit']) 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:20,代碼來源:newDomainValueWidget.py

示例3: populateFromUiParameterJsonDict

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def populateFromUiParameterJsonDict(self, uiParameterJsonDict):
        """
        {
            'schemaComboBox': --current text of schemaComboBox --
            'tableComboBox': --current text of tableComboBox--
            'allTablesCheckBox': --state of allTablesCheckBox--
            'attrWidget' : -- uiParameterJson from addAttributeWidget--
        }
        """
        if uiParameterJsonDict:
            if uiParameterJsonDict['allTablesCheckBox']:
                self.allTablesCheckBox.setCheckState(Qt.Checked)
            else:
                schemaIdx = self.schemaComboBox.findText(uiParameterJsonDict['schemaComboBox'], flags = Qt.MatchExactly)
                self.schemaComboBox.setCurrentIndex(schemaIdx)
                tableIdx = self.tableComboBox.findText(uiParameterJsonDict['tableComboBox'], flags = Qt.MatchExactly)
                self.tableComboBox.setCurrentIndex(tableIdx)
            self.addAttributeWidget.populateFromUiParameterJsonDict(uiParameterJsonDict['attrWidget']) 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:20,代碼來源:newAttributeWidget.py

示例4: getParameterDict

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def getParameterDict(self):
        """
        Returns a dict in the format:
        {
            'buttonColor':--color of the button--, 
            'buttonToolTip':--button toolTip--, 
            'buttonGroupTag':--group tag of the button--,
            'buttonShortcut':--shortcut--
        }
        """
        parameterDict = dict()
        if self.colorCheckBox.checkState() == Qt.Checked:
            parameterDict['buttonColor'] = ','.join(map(str,self.mColorButton.color().getRgb())) #must map to string
        if self.tooltipCheckBox.checkState() == Qt.Checked:
            parameterDict['buttonToolTip'] = self.toolTipLineEdit.text()
        if self.customCategoryCheckBox.checkState() == Qt.Checked:
            parameterDict['buttonGroupTag'] = self.customCategoryLineEdit.text()
        if self.shortcutCheckBox.checkState() == Qt.Checked:
            parameterDict['buttonShortcut'] = self.shortcutWidget.getShortcut()
        if self.openFormCheckBox.checkState() == Qt.Checked:
            parameterDict['openForm'] = True
        return parameterDict 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:24,代碼來源:buttonPropWidget.py

示例5: setEditorData

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def setEditorData(self, editor, index):
        """
        load data from model to editor
        """
        m = index.model()
        try:
            if index.column() == self.column:
                txt = m.data(index, Qt.DisplayRole)
                checkList = txt[1:-1].split(',')
                for i in range(editor.count()):
                    item = editor.item(i)
                    item.setCheckState(Qt.Checked if item.text() in checkList else Qt.Unchecked)
            else:
                # use default
                QItemDelegate.setEditorData(self, editor, index)
        except:
            pass 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:19,代碼來源:manageComplex.py

示例6: selectAll

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def selectAll(self):
        cnt = self.model.rowCount()
        for i in range(0, cnt):
            item = self.model.item(i)
            item.setCheckState(Qt.Checked) 
開發者ID:NationalSecurityAgency,項目名稱:qgis-kmltools-plugin,代碼行數:7,代碼來源:htmlExpansionDialog.py

示例7: accept

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def accept(self):
        self.selected = []
        cnt = self.model.rowCount()
        for i in range(0, cnt):
            item = self.model.item(i)
            if item.checkState() == Qt.Checked:
                self.selected.append(item.text())
        self.close() 
開發者ID:NationalSecurityAgency,項目名稱:qgis-kmltools-plugin,代碼行數:10,代碼來源:htmlExpansionDialog.py

示例8: toggle_menu_triggered

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def toggle_menu_triggered(self, action):
        """
        Toggles usae of layers
        :param action: the menu action that triggered this
        """
        sync_action = SyncAction.NO_ACTION
        if action in (self.remove_hidden_action, self.remove_all_action):
            sync_action = SyncAction.REMOVE
        elif action in (self.add_all_offline_action, self.add_visible_offline_action):
            sync_action = SyncAction.OFFLINE

        # all layers
        if action in (self.remove_all_action, self.add_all_copy_action, self.add_all_offline_action):
            for i in range(self.layersTable.rowCount()):
                item = self.layersTable.item(i, 0)
                layer_source = item.data(Qt.UserRole)
                old_action = layer_source.action
                available_actions, _ = zip(*layer_source.available_actions)
                if sync_action in available_actions:
                    layer_source.action = sync_action
                    if layer_source.action != old_action:
                        self.project.setDirty(True)
                    layer_source.apply()
        # based on visibility
        elif action in (self.remove_hidden_action, self.add_visible_copy_action, self.add_visible_offline_action):
            visible = Qt.Unchecked if action == self.remove_hidden_action else Qt.Checked
            root = QgsProject.instance().layerTreeRoot()
            for layer in QgsProject.instance().mapLayers().values():
                node = root.findLayer(layer.id())
                if node and node.isVisible() == visible:
                    layer_source = LayerSource(layer)
                    old_action = layer_source.action
                    available_actions, _ = zip(*layer_source.available_actions)
                    if sync_action in available_actions:
                        layer_source.action = sync_action
                        if layer_source.action != old_action:
                            self.project.setDirty(True)
                        layer_source.apply()

        self.reloadProject() 
開發者ID:opengisch,項目名稱:qfieldsync,代碼行數:42,代碼來源:project_configuration_dialog.py

示例9: populateDelimiters

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def populateDelimiters(self):
        """
        Populates line classes (area delimiters)
        """
        delimiterList = []
        for i in range(self.linesCustomSelector.toList.__len__()):
            delimiterList.append(self.linesCustomSelector.toList.item(i).text())
        for i in range(self.treeWidget.invisibleRootItem().childCount()):
            for delimiter in delimiterList:
                treeItem = QtWidgets.QTreeWidgetItem(self.treeWidget.invisibleRootItem().child(i))
                treeItem.setText(1,delimiter)
                treeItem.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
                treeItem.setCheckState(1,Qt.Checked)
            self.treeWidget.invisibleRootItem().child(i).setExpanded(True) 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:16,代碼來源:setupEarthCoverage.py

示例10: getEarthCoverageDictFromTree

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def getEarthCoverageDictFromTree(self):
        """
        Gets earth coverage configuration from the tree widget
        """
        invRootItem = self.treeWidget.invisibleRootItem()
        earthCoverageDict = dict()
        for i in range(invRootItem.childCount()):
            childClass = invRootItem.child(i)
            earthCoverageDict[childClass.text(0)] = []
            for j in range(childClass.childCount()):
                if childClass.child(j).checkState(1) == Qt.Checked:
                    earthCoverageDict[childClass.text(0)].append(childClass.child(j).text(1))
        return earthCoverageDict 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:15,代碼來源:setupEarthCoverage.py

示例11: validateEarthCoverageTreeWidget

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def validateEarthCoverageTreeWidget(self):
        rootNode = self.treeWidget.invisibleRootItem()
        childCount = rootNode.childCount()
        for i in range(childCount):
            areaItem = rootNode.child(i)
            lineChildCount = areaItem.childCount()
            hasSelected = False
            for j in range(lineChildCount):
                lineChild = areaItem.child(j)
                if lineChild.checkState(1) == Qt.Checked:
                    hasSelected = True
                    break
            if not hasSelected:
                return False
        return True 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:17,代碼來源:setupEarthCoverage.py

示例12: manageCombos

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def manageCombos(self):
        if self.installRadioButton.checkState() == Qt.Checked:
            self.hideSettings(False)
            self.populateSettingCombo(self.settingList)
        else:
            self.hideSettings(True)
            self.populateSettnigCombo.clear() 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:9,代碼來源:selectTaskWizard.py

示例13: populateFromUiParameterJsonDict

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def populateFromUiParameterJsonDict(self, uiParameterJsonDict):
        """
        {
            'schemaComboBox': --current text of schemaComboBox --
            'tableComboBox': ---current text of tableComboBox --
            'attributeComboBox': ---current text of attributeComboBox --
            'allAttributesCheckBox': --current state of allAttributesCheckBox--
            'allTablesCheckBox': --current state of allTablesCheckBox--
            'filterCustomSelectorWidgetToList': [--list of selected values on filterCustomSelectorWidget--]
            'singleValueComboBox': --current text of singleValueComboBox--
            'actionComboBoxIdx': --current index of actionComboBoxIdx--
        }
        """
        if uiParameterJsonDict:
            if uiParameterJsonDict['allTablesCheckBox']:
                self.allTablesCheckBox.setCheckState(Qt.Checked)
                singleValueIdx = self.singleValueComboBox.findText(uiParameterJsonDict['singleValueComboBox'], flags = Qt.MatchExactly)
                self.singleValueComboBox.setCurrentIndex(singleValueIdx)
                self.actionComboBox.setCurrentIndex(uiParameterJsonDict['actionComboBoxIdx'])
            else:
                schemaIdx = self.schemaComboBox.findText(uiParameterJsonDict['schemaComboBox'], flags = Qt.MatchExactly)
                self.schemaComboBox.setCurrentIndex(schemaIdx)
                tableIdx = self.tableComboBox.findText(uiParameterJsonDict['tableComboBox'], flags = Qt.MatchExactly)
                self.tableComboBox.setCurrentIndex(tableIdx)
                if uiParameterJsonDict['allAttributesCheckBox']:
                    self.allAttributesCheckBox.setCheckState(Qt.Checked)
                    singleValueIdx = self.singleValueComboBox.findText(uiParameterJsonDict['singleValueComboBox'], flags = Qt.MatchExactly)
                    self.singleValueComboBox.setCurrentIndex(singleValueIdx)
                    self.actionComboBox.setCurrentIndex(uiParameterJsonDict['actionComboBoxIdx'])
                else:
                    attributeIdx = self.attributeComboBox.findText(uiParameterJsonDict['attributeComboBox'], flags = Qt.MatchExactly)
                    self.attributeComboBox.setCurrentIndex(attributeIdx)
                    self.filterCustomSelectorWidget.selectItems(True, selectedItems=uiParameterJsonDict['filterCustomSelectorWidgetToList']) 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:35,代碼來源:changeFilterWidget.py

示例14: populateFromUiParameterJsonDict

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def populateFromUiParameterJsonDict(self, uiParameterJsonDict):
        """
        builds a dict with the following format:
        {
            'schemaComboBox': --current text of schemaComboBox --
            'tableComboBox': --current text of tableComboBox--
            'allAttributesCheckBox': --state of allAttributesCheckBox--
            'allTablesCheckBox': --state of allTablesCheckBox--
            'attributeComboBox': --current text of attributeComboBox--
            'actionComboBoxIdx': --current index of actionComboBox--
        }
        """
        if uiParameterJsonDict:
            if uiParameterJsonDict['allTablesCheckBox']:
                self.allTablesCheckBox.setCheckState(Qt.Checked)
            else:
                schemaIdx = self.schemaComboBox.findText(uiParameterJsonDict['schemaComboBox'], flags = Qt.MatchExactly)
                self.schemaComboBox.setCurrentIndex(schemaIdx)
                tableIdx = self.tableComboBox.findText(uiParameterJsonDict['tableComboBox'], flags = Qt.MatchExactly)
                self.tableComboBox.setCurrentIndex(tableIdx)
                if uiParameterJsonDict['allAttributesCheckBox']:
                    self.allAttributesCheckBox.setCheckState(Qt.Checked)
                else:
                    attributeIdx = self.attributeComboBox.findText(uiParameterJsonDict['attributeComboBox'], flags = Qt.MatchExactly)
                    self.attributeComboBox.setCurrentIndex(attributeIdx)
                self.actionComboBox.setCurrentIndex(uiParameterJsonDict['actionComboBoxIdx']) 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:28,代碼來源:changeNullityWidget.py

示例15: setModelData

# 需要導入模塊: from qgis.PyQt.QtCore import Qt [as 別名]
# 或者: from qgis.PyQt.QtCore.Qt import Checked [as 別名]
def setModelData(self, editor, model, index):
        """
        save data from editor back to model
        """
        if index.column() == self.column:
            checkedItems = []
            for i in range(editor.count()):
                item = editor.item(i)
                if item.checkState() == Qt.Checked:
                    checkedItems.append(item.text())
            model.setData(index, '{%s}' % ','.join(checkedItems))
        else:
            # use default
            QItemDelegate.setModelData(self, editor, model, index) 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:16,代碼來源:manageComplex.py


注:本文中的qgis.PyQt.QtCore.Qt.Checked方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。