本文整理汇总了Python中PyQt4.QtGui.QDoubleSpinBox.setDecimals方法的典型用法代码示例。如果您正苦于以下问题:Python QDoubleSpinBox.setDecimals方法的具体用法?Python QDoubleSpinBox.setDecimals怎么用?Python QDoubleSpinBox.setDecimals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QDoubleSpinBox
的用法示例。
在下文中一共展示了QDoubleSpinBox.setDecimals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createEditor
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [as 别名]
def createEditor( self, parent, option, index ):
if index.column() == DESCRIPCION:
combo = QComboBox( parent )
combo.setEditable( True )
value = index.data().toString()
self.filtrados.append( value )
self.proxymodel.setFilterRegExp( self.filter() )
combo.setModel( self.proxymodel )
combo.setModelColumn( 1 )
combo.setCompleter( self.completer )
return combo
elif index.column() == BANCO:
combo = QComboBox( parent )
#combo.setEditable(True)
combo.setModel( self.bancosmodel )
combo.setModelColumn( 1 )
#combo.setCompleter(self.completer)
return combo
elif index.column() == MONTO:
doublespinbox = QDoubleSpinBox( parent )
doublespinbox.setMinimum( -1000000 )
doublespinbox.setMaximum( 1000000 )
doublespinbox.setDecimals( 4 )
doublespinbox.setAlignment( Qt.AlignHCenter )
return doublespinbox
elif index.column() == REFERENCIA:
textbox = QStyledItemDelegate.createEditor( self, parent, option, index )
textbox.setAlignment( Qt.AlignHCenter )
return textbox
示例2: FloatParameterWidget
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [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)
示例3: ChangeConfLevelDlg
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [as 别名]
class ChangeConfLevelDlg(QDialog):
''' Dialog for changing confidence level '''
def __init__(self, previous_value=DEFAULT_CONF_LEVEL, parent=None):
super(ChangeConfLevelDlg, self).__init__(parent)
cl_label = QLabel("Global Confidence Level:")
self.conf_level_spinbox = QDoubleSpinBox()
self.conf_level_spinbox.setRange(50, 99.999 )
self.conf_level_spinbox.setSingleStep(0.1)
self.conf_level_spinbox.setSuffix(QString("%"))
self.conf_level_spinbox.setValue(previous_value)
self.conf_level_spinbox.setDecimals(1)
buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
hlayout = QHBoxLayout()
hlayout.addWidget(cl_label)
hlayout.addWidget(self.conf_level_spinbox)
vlayout = QVBoxLayout()
vlayout.addLayout(hlayout)
vlayout.addWidget(buttonBox)
self.setLayout(vlayout)
self.connect(buttonBox, SIGNAL("accepted()"), self, SLOT("accept()"))
self.connect(buttonBox, SIGNAL("rejected()"), self, SLOT("reject()"))
self.setWindowTitle("Change Confidence Level")
def get_value(self):
return self.conf_level_spinbox.value()
示例4: _getSpinbox
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [as 别名]
def _getSpinbox(self, minvalue, maxvalue, step, nullable = True, value = 0):
'''
Get a combobox filled with the given values
:param values: The values as key = value, value = description or text
:type values: Dict
:returns: A combobox
:rtype: QWidget
'''
widget = QWidget()
spinbox = QDoubleSpinBox()
spinbox.setMinimum(minvalue)
spinbox.setMaximum(maxvalue)
spinbox.setSingleStep(step)
spinbox.setDecimals(len(str(step).split('.')[1]) if len(str(step).split('.'))==2 else 0)
if nullable:
spinbox.setMinimum(minvalue - step)
spinbox.setValue(spinbox.minimum())
spinbox.setSpecialValueText(str(QSettings().value('qgis/nullValue', 'NULL' )))
if value is not None:
spinbox.setValue(value)
layout = QHBoxLayout(widget)
layout.addWidget(spinbox, 1);
layout.setAlignment(Qt.AlignCenter);
layout.setContentsMargins(5,0,5,0);
widget.setLayout(layout);
return widget
示例5: AbstractSnappingToleranceAction
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [as 别名]
class AbstractSnappingToleranceAction(QWidgetAction):
"""Abstract action for Snapping Tolerance."""
snappingToleranceChanged = pyqtSignal(float)
def __init__(self, parent=None):
super(AbstractSnappingToleranceAction, self).__init__(parent)
self._iface = None
self._toleranceSpin = QDoubleSpinBox(parent)
self._toleranceSpin.setDecimals(5)
self._toleranceSpin.setRange(0.0, 100000000.0)
self.setDefaultWidget(self._toleranceSpin)
self.setText('Snapping Tolerance')
self.setStatusTip('Set the snapping tolerance')
self._refresh()
self._toleranceSpin.valueChanged.connect(self._changed)
def setInterface(self, iface):
self._iface = iface
self._refresh()
# Private API
def _changed(self, tolerance):
pass
def _refresh(self):
pass
示例6: buildAntispam
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [as 别名]
def buildAntispam(self, layout, row, col):
antispam = QGroupBox(self)
antispam.setTitle(tr('Antispam'))
antispam_layout = QFormLayout(antispam)
antispam_enable = QCheckBox()
info = QLabel(tr("This will add an <code>X-Spam-Score:</code> header "
"field to all the messages and add a <code>Subject:</code> line "
"beginning with *<i>SPAM</i>* and containing the original subject "
"to the messages detected as spam."))
info.setWordWrap(True)
antispam_layout.addRow(info)
antispam_layout.addRow(tr('Activate the antispam'), antispam_enable)
mark_spam_level = QDoubleSpinBox(self)
mark_spam_level.setDecimals(1)
antispam_layout.addRow(tr('Mark the message as spam if its score is greater than'), mark_spam_level)
deny_spam_level = QDoubleSpinBox(self)
deny_spam_level.setDecimals(1)
antispam_layout.addRow(tr('Refuse the message if its score is greater than'), deny_spam_level)
# enable/disable spam levels
self.connect(antispam_enable, SIGNAL('toggled(bool)'), mark_spam_level.setEnabled)
self.connect(antispam_enable, SIGNAL('toggled(bool)'), deny_spam_level.setEnabled)
# update config
self.connect(mark_spam_level, SIGNAL('valueChanged(double)'), self.setMarkSpamLevel)
self.connect(deny_spam_level, SIGNAL('valueChanged(double)'), self.setDenySpamLevel)
self.connect(antispam_enable, SIGNAL('clicked(bool)'), self.setAntispamEnabled)
layout.addWidget(antispam, row, col)
self.mainwindow.writeAccessNeeded(mark_spam_level, deny_spam_level)
return antispam_enable, mark_spam_level, deny_spam_level
示例7: ConfigWidget
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [as 别名]
class ConfigWidget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
layout = QFormLayout()
self.setLayout(layout)
self.label_ip = QLabel("IP")
self.lineedit_ip = QLineEdit()
layout.addRow(self.label_ip, self.lineedit_ip)
self.label_port = QLabel("Port")
self.spinbox_port = QSpinBox()
self.spinbox_port.setMinimum(0)
self.spinbox_port.setMaximum(65535)
layout.addRow(self.label_port, self.spinbox_port)
self.label_password = QLabel("Password")
self.lineedit_password = QLineEdit()
layout.addRow(self.label_password, self.lineedit_password)
self.label_mount = QLabel("Mount")
self.lineedit_mount = QLineEdit()
layout.addRow(self.label_mount, self.lineedit_mount)
#
# Audio Quality
#
self.label_audio_quality = QLabel("Audio Quality")
self.spinbox_audio_quality = QDoubleSpinBox()
self.spinbox_audio_quality.setMinimum(0.0)
self.spinbox_audio_quality.setMaximum(1.0)
self.spinbox_audio_quality.setSingleStep(0.1)
self.spinbox_audio_quality.setDecimals(1)
self.spinbox_audio_quality.setValue(0.3) # Default value 0.3
#
# Video Quality
#
self.label_video_quality = QLabel("Video Quality (kb/s)")
self.spinbox_video_quality = QSpinBox()
self.spinbox_video_quality.setMinimum(0)
self.spinbox_video_quality.setMaximum(16777215)
self.spinbox_video_quality.setValue(2400) # Default value 2400
def get_video_quality_layout(self):
layout_video_quality = QHBoxLayout()
layout_video_quality.addWidget(self.label_video_quality)
layout_video_quality.addWidget(self.spinbox_video_quality)
return layout_video_quality
def get_audio_quality_layout(self):
layout_audio_quality = QHBoxLayout()
layout_audio_quality.addWidget(self.label_audio_quality)
layout_audio_quality.addWidget(self.spinbox_audio_quality)
return layout_audio_quality
示例8: createEditor
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [as 别名]
def createEditor(self, type, parent):
if type != QVariant.Double:
raise ValueError("This factory only creates editor for doubles")
w = QDoubleSpinBox(parent)
w.setDecimals(5)
w.setMinimum(0.0001)
w.setMaximum(10000)
return w
示例9: createDoubleSpinner
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [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
示例10: createEditor
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [as 别名]
def createEditor( self, parent, _option, index ):
if index.column() == ABONO:
spinbox = QDoubleSpinBox( parent )
max = index.model().lines[index.row()].totalFac
spinbox.setRange( 0.0001, max )
spinbox.setDecimals( 4 )
spinbox.setSingleStep( 1 )
spinbox.setAlignment( Qt.AlignRight | Qt.AlignVCenter )
return spinbox
else:
None
示例11: initUI
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [as 别名]
def initUI(self):
vbox = QHBoxLayout()
edit = QDoubleSpinBox(self)
edit.setLocale(QLocale(QLocale.English))
edit.setDecimals(2)
vbox.addWidget(edit)
vbox.addWidget(QLabel("10^"))
expo = QSpinBox(self)
expo.setMinimum(-8)
expo.setMaximum(8)
vbox.addWidget(expo)
self.setLayout(vbox)
示例12: widgetByType
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [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
示例13: ConfigWidget
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [as 别名]
class ConfigWidget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
layout = QFormLayout()
self.setLayout(layout)
#
# Audio Quality
#
self.label_audio_quality = QLabel("Audio Quality")
self.spinbox_audio_quality = QDoubleSpinBox()
self.spinbox_audio_quality.setMinimum(0.0)
self.spinbox_audio_quality.setMaximum(1.0)
self.spinbox_audio_quality.setSingleStep(0.1)
self.spinbox_audio_quality.setDecimals(1)
self.spinbox_audio_quality.setValue(0.3) # Default value 0.3
#
# Video Quality
#
self.label_video_quality = QLabel("Video Quality (kb/s)")
self.spinbox_video_quality = QSpinBox()
self.spinbox_video_quality.setMinimum(0)
self.spinbox_video_quality.setMaximum(16777215)
self.spinbox_video_quality.setValue(2400) # Default value 2400
#
# Misc.
#
self.label_matterhorn = QLabel("Matterhorn Metadata")
self.label_matterhorn.setToolTip("Generates Matterhorn Metadata in XML format")
self.checkbox_matterhorn = QCheckBox()
layout.addRow(self.label_matterhorn, self.checkbox_matterhorn)
def get_video_quality_layout(self):
layout_video_quality = QHBoxLayout()
layout_video_quality.addWidget(self.label_video_quality)
layout_video_quality.addWidget(self.spinbox_video_quality)
return layout_video_quality
def get_audio_quality_layout(self):
layout_audio_quality = QHBoxLayout()
layout_audio_quality.addWidget(self.label_audio_quality)
layout_audio_quality.addWidget(self.spinbox_audio_quality)
return layout_audio_quality
示例14: createEditor
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [as 别名]
def createEditor( self, parent, _option, index ):
if index.column() in ( CODCUENTA, NCUENTA ):
value = index.model().index( index.row(), 0 ).data().toString()
self.removeFromFilter( value )
self.proxymodel.setFilterRegExp( self.filter() )
sp = SearchPanel( self.proxymodel, parent, self.showTable )
sp.setColumn( index.column() )
return sp
elif index.column() == MONTO:
doublespinbox = QDoubleSpinBox( parent )
doublespinbox.setMinimum( -1000000 )
doublespinbox.setMaximum( 1000000 )
doublespinbox.setDecimals( 4 )
return doublespinbox
示例15: createEditor
# 需要导入模块: from PyQt4.QtGui import QDoubleSpinBox [as 别名]
# 或者: from PyQt4.QtGui.QDoubleSpinBox import setDecimals [as 别名]
def createEditor( self, parent, option, index ):
if index.column() in ( CODCUENTA, NCUENTA ):
model = index.model()
self.proxymodel.setSourceModel( self.accounts )
current = model.data( model.index( index.row(), IDCUENTA ) )
self.proxymodel.setFilterRegExp( self.filter( model, current ) )
sp = super( AccountsSelectorDelegate, self ).createEditor( parent, option, index )
sp.setColumnHidden( IDCUENTA )
return sp
elif index.column() == MONTO:
doublespinbox = QDoubleSpinBox( parent )
doublespinbox.setMinimum( -100000000000 )
doublespinbox.setMaximum( 100000000000 )
doublespinbox.setDecimals( 4 )
return doublespinbox