本文整理汇总了Python中PyQt4.QtGui.QDoubleSpinBox.setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:Python QDoubleSpinBox.setSizePolicy方法的具体用法?Python QDoubleSpinBox.setSizePolicy怎么用?Python QDoubleSpinBox.setSizePolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QDoubleSpinBox
的用法示例。
在下文中一共展示了QDoubleSpinBox.setSizePolicy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FloatParameterWidget
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setSizePolicy [as 别名]
class FloatParameterWidget(NumericParameterWidget):
"""Widget class for Float parameter."""
def __init__(self, parameter, parent=None):
"""Constructor
.. versionadded:: 2.2
:param parameter: A FloatParameter object.
:type parameter: FloatParameter
"""
super(FloatParameterWidget, self).__init__(parameter, parent)
self._input = QDoubleSpinBox()
self._input.setDecimals(self._parameter.precision)
self._input.setMinimum(self._parameter.minimum_allowed_value)
self._input.setMaximum(self._parameter.maximum_allowed_value)
self._input.setValue(self._parameter.value)
self._input.setSingleStep(
10 ** -self._parameter.precision)
# is it possible to use dynamic precision ?
string_min_value = '%.*f' % (
self._parameter.precision, self._parameter.minimum_allowed_value)
string_max_value = '%.*f' % (
self._parameter.precision, self._parameter.maximum_allowed_value)
tool_tip = 'Choose a number between %s and %s' % (
string_min_value, string_max_value)
self._input.setToolTip(tool_tip)
self._input.setSizePolicy(self._spin_box_size_policy)
self.inner_input_layout.addWidget(self._input)
self.inner_input_layout.addWidget(self._unit_widget)
示例2: createDoubleSpinner
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setSizePolicy [as 别名]
def createDoubleSpinner(self, minimum, maximum):
spinner = QDoubleSpinBox()
spinner.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
spinner.setMinimumWidth(105)
spinner.setRange(minimum, maximum)
spinner.setKeyboardTracking(False)
spinner.setDecimals(8)
spinner.editingFinished.connect(self.plotScaleChanged)
spinner.valueChanged.connect(self.plotScaleChanged)
return spinner
示例3: AddNewWeight
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setSizePolicy [as 别名]
class AddNewWeight(AddNewDialog):
def __init__(self, parent, item):
AddNewDialog.__init__(self, parent)
self.setText('Lisää uusi punnitus', 'Uusi punnitus')
self.ui.lineEdit.hide()
self.item = item
self.priceSelector = QDoubleSpinBox(parent=self)
self.priceSelector.setMaximum(999999)
self.priceSelector.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
self.ui.horizontalLayout.addWidget(self.priceSelector)
self.hideComboBox()
def saveCheck(self):
if self.priceSelector.value() > 0:
self.saveNewItem()
def saveNewItem(self):
item = SqlHandler.WeightControl(animal_id = self.item.id, weight=self.priceSelector.value())
SqlHandler.addItem(self.session, item)
print('WeightControl saveNweItem, ', item)
self.parent().addAskedItem(item)
self.closeDialog()