本文整理汇总了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
示例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'])
示例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'])
示例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
示例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
示例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)
示例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()
示例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()
示例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)
示例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
示例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
示例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()
示例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'])
示例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'])
示例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)