本文整理汇总了Python中PyQt4.QtGui.QDoubleSpinBox.addItem方法的典型用法代码示例。如果您正苦于以下问题:Python QDoubleSpinBox.addItem方法的具体用法?Python QDoubleSpinBox.addItem怎么用?Python QDoubleSpinBox.addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QDoubleSpinBox
的用法示例。
在下文中一共展示了QDoubleSpinBox.addItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: widgetByType
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import addItem [as 别名]
def widgetByType(self, valueType):
if isinstance(valueType, str):
valPieces = valueType.lower().split(":")
typeStr = valPieces[0]
rngMin = "min"
rngMax = "max"
if len(valPieces) == 3:
rngMin = valPieces[1] if valPieces[1] != "" else "min"
rngMax = valPieces[2] if valPieces[2] != "" else "max"
if typeStr == "float":
box = QDoubleSpinBox(self)
if rngMin == "min":
rngMin = -2000000000.
else:
rngMin = float(rngMin)
if rngMax == "max":
rngMax = 2000000000.
else:
rngMax = float(rngMax)
box.setRange(rngMin, rngMax)
box.setDecimals(10)
return box
elif typeStr == "int":
box = QSpinBox(self)
if rngMin == "min":
rngMin = -2**31 + 1
else:
rngMin = int(rngMin)
if rngMax == "max":
rngMax = 2**31 - 1
else:
rngMax = int(rngMax)
box.setRange(rngMin, rngMax)
return box
elif typeStr == "str":
return QLineEdit(self)
elif typeStr == "bool":
return QCheckBox(self)
elif isinstance(valueType, list):
box = QComboBox(self)
for item in valueType:
box.addItem(item)
return box