本文整理汇总了Python中qgis.gui.QgsSpinBox.setDecimals方法的典型用法代码示例。如果您正苦于以下问题:Python QgsSpinBox.setDecimals方法的具体用法?Python QgsSpinBox.setDecimals怎么用?Python QgsSpinBox.setDecimals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgis.gui.QgsSpinBox
的用法示例。
在下文中一共展示了QgsSpinBox.setDecimals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createEditor
# 需要导入模块: from qgis.gui import QgsSpinBox [as 别名]
# 或者: from qgis.gui.QgsSpinBox import setDecimals [as 别名]
def createEditor(self, parent, options, index):
setting = index.model().data(index, Qt.UserRole)
if setting.valuetype == Setting.FOLDER:
return FileDirectorySelector(parent)
elif setting.valuetype == Setting.FILE:
return FileDirectorySelector(parent, True)
elif setting.valuetype == Setting.SELECTION:
combo = QComboBox(parent)
combo.addItems(setting.options)
return combo
elif setting.valuetype == Setting.MULTIPLE_FOLDERS:
return MultipleDirectorySelector(parent)
else:
value = self.convertValue(index.model().data(index, Qt.EditRole))
if isinstance(value, int):
spnBox = QgsSpinBox(parent)
spnBox.setRange(-999999999, 999999999)
return spnBox
elif isinstance(value, float):
spnBox = QgsDoubleSpinBox(parent)
spnBox.setRange(-999999999.999999, 999999999.999999)
spnBox.setDecimals(6)
return spnBox
elif isinstance(value, str):
return QLineEdit(parent)