本文整理汇总了Python中PyQt4.QtGui.QDoubleSpinBox类的典型用法代码示例。如果您正苦于以下问题:Python QDoubleSpinBox类的具体用法?Python QDoubleSpinBox怎么用?Python QDoubleSpinBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QDoubleSpinBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initUI
def initUI(self):
self.grid = QGridLayout(self)
self.setLayout(self.grid)
self.loadSettings()
self.inputLabels = [QLabel(l) for l in self.Inputs]
self.inputBoxes = []
for i, iL in enumerate(self.inputLabels):
self.grid.addWidget(iL, i, 0)
sp = QDoubleSpinBox(self)
sp.setRange(-1e10, 1e10)
sp.setKeyboardTracking(False)
self.grid.addWidget(sp, i, 1)
self.inputBoxes.append(sp)
for val, iB in zip(self.inputValues, self.inputBoxes):
iB.setValue(val)
self.connectSpinBoxes()
self.outputValues = [0.0]*len(self.Outputs)
self.outputLabels = [QLabel(l) for l in self.Outputs]
self.outputValueLabels = [QLabel('0.0') for l in self.Outputs]
sI = len(self.inputLabels)
for i, oL in enumerate(self.outputLabels):
self.grid.addWidget(oL, sI + i, 0)
self.grid.addWidget(self.outputValueLabels[i], sI + i, 1)
示例2: __init__
def __init__(self, parent=None):
QWidget.__init__(self, parent)
v = QVBoxLayout()
f = QFormLayout()
self.mzTolSpinBox = QDoubleSpinBox(self)
self.mzTolSpinBox.setMaximum(100)
self.mzTolSpinBox.setMinimum(1)
self.mzTolSpinBox.setValue(10)
f.addRow("mz tolerance(ppm):", self.mzTolSpinBox)
self.mzSpinBox = QDoubleSpinBox(self)
self.mzSpinBox.setMaximum(2000.0)
self.mzSpinBox.setMinimum(300.0)
self.mzSpinBox.setValue(500.0)
f.addRow("requested m/z:", self.mzSpinBox)
v.addLayout(f)
self.plotButton = QPushButton("Plot")
v.addWidget(self.plotButton)
self.setLayout(v)
示例3: AbstractSnappingToleranceAction
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
示例4: ConfigWidget
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
示例5: create_doublespinbox
def create_doublespinbox(self, prefix, suffix, option,
min_=None, max_=None, step=None, tip=None):
if prefix:
plabel = QLabel(prefix)
else:
plabel = None
if suffix:
slabel = QLabel(suffix)
else:
slabel = None
spinbox = QDoubleSpinBox()
if min_ is not None:
spinbox.setMinimum(min_)
if max_ is not None:
spinbox.setMaximum(max_)
if step is not None:
spinbox.setSingleStep(step)
if tip is not None:
spinbox.setToolTip(tip)
self.spinboxes[spinbox] = option
layout = QHBoxLayout()
for subwidget in (plabel, spinbox, slabel):
if subwidget is not None:
layout.addWidget(subwidget)
layout.addStretch(1)
layout.setContentsMargins(0, 0, 0, 0)
widget = QWidget(self)
widget.setLayout(layout)
widget.spin = spinbox
return widget
示例6: createEditor
def createEditor(self, parent, option, index):
"""
Creates the combobox inside a parent.
:param parent: The container of the combobox
:type parent: QWidget
:param option: QStyleOptionViewItem class is used to describe the
parameters used to draw an item in a view widget.
:type option: Object
:param index: The index where the combobox
will be added.
:type index: QModelIndex
:return: The combobox
:rtype: QComboBox
"""
if index.column() == 0:
str_combo = QComboBox(parent)
str_combo.setObjectName(unicode(index.row()))
return str_combo
elif index.column() == 1:
spinbox = QDoubleSpinBox(parent)
spinbox.setObjectName(unicode(index.row()))
spinbox.setMinimum(0.00)
spinbox.setSuffix('%')
spinbox.setMaximum(100.00)
return spinbox
示例7: createEditor
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
示例8: __init__
def __init__(self, line_style_set=STYLESET_DEFAULT):
QWidget.__init__(self)
self._style = PlotStyle("StyleChooser Internal Style")
self._styles = STYLES['default'] if not line_style_set in STYLES else STYLES[line_style_set]
self.setMinimumWidth(140)
self.setMaximumHeight(25)
layout = QHBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
self.line_chooser = QComboBox()
self.line_chooser.setToolTip("Select line style.")
for style in self._styles:
self.line_chooser.addItem(*style)
self.marker_chooser = QComboBox()
self.marker_chooser.setToolTip("Select marker style.")
for marker in MARKERS:
self.marker_chooser.addItem(*marker)
self.thickness_spinner = QDoubleSpinBox()
self.thickness_spinner.setToolTip("Line thickness")
self.thickness_spinner.setMinimum(0.1)
self.thickness_spinner.setDecimals(1)
self.thickness_spinner.setSingleStep(0.1)
self.size_spinner = QDoubleSpinBox()
self.size_spinner.setToolTip("Marker Size")
self.size_spinner.setMinimum(0.1)
self.size_spinner.setDecimals(1)
self.size_spinner.setSingleStep(0.1)
# the text content of the spinner varies, but shouldn't push the control out of boundaries
self.line_chooser.setMinimumWidth(110)
layout.addWidget(self.line_chooser)
layout.addWidget(self.thickness_spinner)
layout.addWidget(self.marker_chooser)
layout.addWidget(self.size_spinner)
self.setLayout(layout)
self.line_chooser.currentIndexChanged.connect(self._updateStyle)
self.marker_chooser.currentIndexChanged.connect(self._updateStyle)
self.thickness_spinner.valueChanged.connect(self._updateStyle)
self.size_spinner.valueChanged.connect(self._updateStyle)
self._updateLineStyleAndMarker(self._style.line_style, self._style.marker, self._style.width, self._style.size)
self._layout = layout
示例9: createDoubleSpinner
def createDoubleSpinner(self, minimum, maximum):
spinner = QDoubleSpinBox()
spinner.setEnabled(False)
spinner.setMinimumWidth(75)
spinner.setRange(minimum, maximum)
spinner.setKeyboardTracking(False)
spinner.editingFinished.connect(self.spinning)
spinner.valueChanged.connect(self.spinning)
return spinner
示例10: initUI
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)
示例11: ConfigWidget
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
示例12: create_double_spinbox
def create_double_spinbox(self, parent, index):
"""
Creates double spinbox.
:param parent: The parent widget.
:type parent: QWidget
:param index: The index.
:type index: QModelIndex
:return: The double spinbox
:rtype: QDoubleSpinBox
"""
spinbox = QDoubleSpinBox(parent)
spinbox.setObjectName(unicode(index.row()))
return spinbox
示例13: add_layer
def add_layer(self):
i = self.dlg.table.rowCount()
self.dlg.table.insertRow(i)
layer = QgsMapLayerComboBox()
layer.setFilters(QgsMapLayerProxyModel.RasterLayer)
band = QTableWidgetItem('1')
band.setFlags(Qt.ItemIsEnabled)
mean = QDoubleSpinBox()
mean.setRange(-10000.00,10000.00)
self.dlg.table.setCellWidget(i, 0, layer)
self.dlg.table.setItem(i, 1, band)
self.dlg.table.setCellWidget(i, 2, mean)
示例14: DoubleSpinBox
class DoubleSpinBox(QWidget):
def __init__(self, id, text, **kwargs):
QWidget.__init__(self)
self.id = id
self.widget = QDoubleSpinBox(**kwargs)
label = QLabel(text)
hbox = HBoxLayout()
hbox.addWidget(label)
hbox.addWidget(self.widget)
self.setLayout(hbox)
self.widget.setMaximum(999999999)
self.widget.setMinimum(-999999999)
def parameterValues(self):
return {self.id:self.widget.value()}
示例15: __init__
def __init__(self, area_supported=False):
QWidget.__init__(self)
self._style = PlotStyle("StyleChooser Internal Style")
self._styles = STYLES if area_supported else STYLES_LINE_ONLY
self.setMinimumWidth(140)
self.setMaximumHeight(25)
layout = QHBoxLayout()
layout.setMargin(0)
layout.setSpacing(2)
self.line_chooser = QComboBox()
self.line_chooser.setToolTip("Select line style.")
for style in self._styles:
self.line_chooser.addItem(*style)
self.marker_chooser = QComboBox()
self.marker_chooser.setToolTip("Select marker style.")
for marker in MARKERS:
self.marker_chooser.addItem(*marker)
self.thickness_spinner = QDoubleSpinBox()
self.thickness_spinner.setToolTip("Line thickness")
self.thickness_spinner.setMinimum(0.1)
self.thickness_spinner.setDecimals(1)
self.thickness_spinner.setSingleStep(0.1)
self.size_spinner = QDoubleSpinBox()
self.size_spinner.setToolTip("Marker Size")
self.size_spinner.setMinimum(0.1)
self.size_spinner.setDecimals(1)
self.size_spinner.setSingleStep(0.1)
layout.addWidget(self.line_chooser)
layout.addWidget(self.thickness_spinner)
layout.addWidget(self.marker_chooser)
layout.addWidget(self.size_spinner)
self.setLayout(layout)
self.line_chooser.currentIndexChanged.connect(self._updateStyle)
self.marker_chooser.currentIndexChanged.connect(self._updateStyle)
self.thickness_spinner.valueChanged.connect(self._updateStyle)
self.size_spinner.valueChanged.connect(self._updateStyle)
self._updateLineStyleAndMarker(self._style.line_style, self._style.marker, self._style.width, self._style.size)
self._layout = layout