Class: QgsDoubleSpinBox¶
- class qgis.gui.QgsDoubleSpinBox¶
Bases:
PyQt5.QtWidgets.QDoubleSpinBox
The
QgsSpinBox
is a spin box with a clear button that will set the value to the defined clear value. The clear value can be either the minimum or the maiximum value of the spin box or a custom value. This value can then be handled by a special value text.QgsDoubleSpinBox(parent: QWidget = None) Constructor for QgsDoubleSpinBox.
- Parameters:
parent –
parent widget
Methods
- param event:
Sets the current value to the value defined by the clear value.
Returns the value used when
clear()
is called.Returns whether the widget will allow entry of simple expressions, which are evaluated and then discarded.
- param e:
Defines the clear value as a custom value and will automatically set the clear value mode to CustomValue.
Defines if the clear value should be the minimum or maximum values of the widget or a custom value.
Sets if the widget will allow entry of simple expressions, which are evaluated and then discarded.
Set alignment in the embedded line edit widget
Sets whether the widget will show a clear button.
Set the special-value text to be
txt
If set, the spin box will display this text instead of a numeric value whenever the current value is equal tominimum()
.Returns whether the widget is showing a clear button.
- param event:
- param input:
- param text:
- param event:
Attributes
- class ClearValueMode¶
Bases:
int
- CustomValue = 2¶
- MaximumValue = 1¶
- MinimumValue = 0¶
- actionEvent(self, QActionEvent)¶
- changeEvent(self, event: QEvent)¶
- Parameters:
event (QEvent) –
- childEvent(self, QChildEvent)¶
- clear(self)¶
Sets the current value to the value defined by the clear value.
- closeEvent(self, QCloseEvent)¶
- connectNotify(self, QMetaMethod)¶
- contextMenuEvent(self, QContextMenuEvent)¶
- create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)¶
- customEvent(self, QEvent)¶
- destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)¶
- disconnectNotify(self, QMetaMethod)¶
- dragEnterEvent(self, QDragEnterEvent)¶
- dragLeaveEvent(self, QDragLeaveEvent)¶
- dragMoveEvent(self, QDragMoveEvent)¶
- dropEvent(self, QDropEvent)¶
- enterEvent(self, QEvent)¶
- expressionsEnabled(self) bool ¶
Returns whether the widget will allow entry of simple expressions, which are evaluated and then discarded.
- Return type:
bool
- Returns:
True
if spin box allows expression entry
New in version 2.7.
- focusInEvent(self, QFocusEvent)¶
- focusNextChild(self) bool ¶
- focusNextPrevChild(self, bool) bool ¶
- focusOutEvent(self, QFocusEvent)¶
- focusPreviousChild(self) bool ¶
- hideEvent(self, QHideEvent)¶
- initPainter(self, QPainter)¶
- initStyleOption(self, QStyleOptionSpinBox)¶
- inputMethodEvent(self, QInputMethodEvent)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- keyPressEvent(self, QKeyEvent)¶
- keyReleaseEvent(self, QKeyEvent)¶
- leaveEvent(self, QEvent)¶
- lineEdit(self) QLineEdit ¶
- metric(self, QPaintDevice.PaintDeviceMetric) int ¶
- mouseDoubleClickEvent(self, QMouseEvent)¶
- mouseMoveEvent(self, QMouseEvent)¶
- mousePressEvent(self, QMouseEvent)¶
- mouseReleaseEvent(self, QMouseEvent)¶
- moveEvent(self, QMoveEvent)¶
- nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int] ¶
- paintEvent(self, e: QPaintEvent)¶
- Parameters:
e (QPaintEvent) –
- receivers(self, PYQT_SIGNAL) int ¶
- resizeEvent(self, QResizeEvent)¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setClearValue(self, customValue: float, clearValueText: str = '')¶
Defines the clear value as a custom value and will automatically set the clear value mode to CustomValue.
- Parameters:
customValue (float) – defines the numerical value used as the clear value
clearValueText (str = '') – is the text displayed when the spin box is at the clear value. If not specified, no special value text is used.
See also
- setClearValueMode(self, mode: QgsDoubleSpinBox.ClearValueMode, clearValueText: str = '')¶
Defines if the clear value should be the minimum or maximum values of the widget or a custom value.
- Parameters:
mode (QgsDoubleSpinBox.ClearValueMode) – mode to user for clear value
clearValueText (str = '') – is the text displayed when the spin box is at the clear value. If not specified, no special value text is used.
- setExpressionsEnabled(self, enabled: bool)¶
Sets if the widget will allow entry of simple expressions, which are evaluated and then discarded.
- Parameters:
enabled (bool) – set to
True
to allow expression entry
New in version 2.7.
- setLineEdit(self, QLineEdit)¶
- setLineEditAlignment(self, alignment: Qt.Alignment | Qt.AlignmentFlag)¶
Set alignment in the embedded line edit widget
- Parameters:
alignment (Union[Qt.Alignment) –
- setShowClearButton(self, showClearButton: bool)¶
Sets whether the widget will show a clear button. The clear button allows users to reset the widget to a default or empty state.
- Parameters:
showClearButton (bool) – set to
True
to show the clear button, orFalse
to hide it
See also
- setSpecialValueText(self, txt: str)¶
Set the special-value text to be
txt
If set, the spin box will display this text instead of a numeric value whenever the current value is equal tominimum()
. Typical use is to indicate that this choice has a special (default) meaning.- Parameters:
txt (str) –
- showClearButton(self) bool ¶
Returns whether the widget is showing a clear button.
See also
- Return type:
bool
- showEvent(self, QShowEvent)¶
- stepEnabled(self) QAbstractSpinBox.StepEnabled ¶
- tabletEvent(self, QTabletEvent)¶
- timerEvent(self, event: QTimerEvent)¶
- Parameters:
event (QTimerEvent) –
- updateMicroFocus(self)¶
- validate(self, input: str) Tuple[QValidator.State, int] ¶
- Parameters:
input (str) –
- Return type:
Tuple[QValidator.State, int]
- valueFromText(self, text: str) float ¶
- Parameters:
text (str) –
- Return type:
float
- wheelEvent(self, event: QWheelEvent)¶
- Parameters:
event (QWheelEvent) –