mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
[processing] Use QgsDoubleSpinBox instead of QSpinBox
Allows for simple calculations in spin box, adds a reset control to reset widget to default value
This commit is contained in:
parent
86231d79fa
commit
53aa583da0
@ -32,8 +32,9 @@ from PyQt4 import uic
|
||||
from PyQt4.QtCore import Qt, QEvent, QPyNullVariant
|
||||
from PyQt4.QtGui import (QFileDialog, QDialog, QIcon, QStyle,
|
||||
QStandardItemModel, QStandardItem, QMessageBox, QStyledItemDelegate,
|
||||
QLineEdit, QSpinBox, QDoubleSpinBox, QWidget, QToolButton, QHBoxLayout,
|
||||
QLineEdit, QWidget, QToolButton, QHBoxLayout,
|
||||
QComboBox)
|
||||
from qgis.gui import QgsDoubleSpinBox, QgsSpinBox
|
||||
|
||||
from processing.core.ProcessingConfig import ProcessingConfig, Setting
|
||||
from processing.core.Processing import Processing
|
||||
@ -198,11 +199,11 @@ class SettingDelegate(QStyledItemDelegate):
|
||||
else:
|
||||
value = self.convertValue(index.model().data(index, Qt.EditRole))
|
||||
if isinstance(value, (int, long)):
|
||||
spnBox = QSpinBox(parent)
|
||||
spnBox = QgsSpinBox(parent)
|
||||
spnBox.setRange(-999999999, 999999999)
|
||||
return spnBox
|
||||
elif isinstance(value, float):
|
||||
spnBox = QDoubleSpinBox(parent)
|
||||
spnBox = QgsDoubleSpinBox(parent)
|
||||
spnBox.setRange(-999999999.999999, 999999999.999999)
|
||||
spnBox.setDecimals(6)
|
||||
return spnBox
|
||||
|
@ -61,6 +61,7 @@ class NumberInputPanel(BASE, WIDGET):
|
||||
self.spnValue.setMinimum(-99999999)
|
||||
|
||||
self.spnValue.setValue(float(number))
|
||||
self.spnValue.setClearValue(float(number))
|
||||
|
||||
self.btnCalc.clicked.connect(self.showNumberInputDialog)
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="spnValue">
|
||||
<widget class="QgsDoubleSpinBox" name="spnValue">
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
@ -45,6 +45,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsDoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header>qgis.gui</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
x
Reference in New Issue
Block a user