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: Optional[QWidget] = None) Constructor for QgsDoubleSpinBox.

Parameters:

parent

parent widget

Methods

actionEvent

changeEvent

param event:

childEvent

clear

Sets the current value to the value defined by the clear value.

clearValue

Returns the value used when clear() is called.

closeEvent

connectNotify

contextMenuEvent

create

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

expressionsEnabled

Returns whether the widget will allow entry of simple expressions, which are evaluated and then discarded.

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

initPainter

initStyleOption

inputMethodEvent

isSignalConnected

keyPressEvent

keyReleaseEvent

leaveEvent

lineEdit

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

param e:

receivers

resizeEvent

sender

senderSignalIndex

setClearValue

Defines the clear value as a custom value and will automatically set the clear value mode to CustomValue.

setClearValueMode

Defines if the clear value should be the minimum or maximum values of the widget or a custom value.

setExpressionsEnabled

Sets if the widget will allow entry of simple expressions, which are evaluated and then discarded.

setLineEdit

setLineEditAlignment

Set alignment in the embedded line edit widget

setShowClearButton

Sets whether the widget will show a clear button.

setSpecialValueText

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 to minimum().

sharedPainter

showClearButton

Returns whether the widget is showing a clear button.

showEvent

stepEnabled

tabletEvent

timerEvent

param event:

updateMicroFocus

validate

param input:

valueFromText

param text:

wheelEvent

param event:

Attributes

CustomValue

MaximumValue

MinimumValue

class ClearValueMode

Bases: int

CustomValue = 2
MaximumValue = 1
MinimumValue = 0
actionEvent(self, a0: QActionEvent | None)
changeEvent(self, event: QEvent | None)
Parameters:

event (Optional[QEvent])

childEvent(self, a0: QChildEvent | None)
clear(self)

Sets the current value to the value defined by the clear value.

clearValue(self) float

Returns the value used when clear() is called.

See also

setClearValue()

Return type:

float

closeEvent(self, e: QCloseEvent | None)
connectNotify(self, signal: QMetaMethod)
contextMenuEvent(self, e: QContextMenuEvent | None)
create(self, window: PyQt5.sip.voidptr = None, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, a0: QEvent | None)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, signal: QMetaMethod)
dragEnterEvent(self, a0: QDragEnterEvent | None)
dragLeaveEvent(self, a0: QDragLeaveEvent | None)
dragMoveEvent(self, a0: QDragMoveEvent | None)
dropEvent(self, a0: QDropEvent | None)
enterEvent(self, a0: QEvent | None)
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

focusInEvent(self, e: QFocusEvent | None)
focusNextChild(self) bool
focusNextPrevChild(self, next: bool) bool
focusOutEvent(self, e: QFocusEvent | None)
focusPreviousChild(self) bool
hideEvent(self, e: QHideEvent | None)
initPainter(self, painter: QPainter | None)
initStyleOption(self, option: QStyleOptionSpinBox | None)
inputMethodEvent(self, a0: QInputMethodEvent | None)
isSignalConnected(self, signal: QMetaMethod) bool
keyPressEvent(self, e: QKeyEvent | None)
keyReleaseEvent(self, e: QKeyEvent | None)
leaveEvent(self, a0: QEvent | None)
lineEdit(self) QLineEdit | None
metric(self, a0: QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, a0: QMouseEvent | None)
mouseMoveEvent(self, e: QMouseEvent | None)
mousePressEvent(self, e: QMouseEvent | None)
mouseReleaseEvent(self, e: QMouseEvent | None)
moveEvent(self, a0: QMoveEvent | None)
nativeEvent(self, eventType: QByteArray | bytes | bytearray, message: PyQt5.sip.voidptr | None)
paintEvent(self, e: QPaintEvent | None)
Parameters:

e (Optional[QPaintEvent])

receivers(self, signal: PYQT_SIGNAL) int
resizeEvent(self, e: QResizeEvent | None)
sender(self) QObject | None
senderSignalIndex(self) int
setClearValue(self, customValue: float, clearValueText: str | None = '')

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 (Optional[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

clearValue()

setClearValueMode(self, mode: QgsDoubleSpinBox.ClearValueMode, clearValueText: str | None = '')

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 (Optional[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

setLineEdit(self, e: QLineEdit | None)
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, or False to hide it

setSpecialValueText(self, txt: str | None)

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 to minimum(). Typical use is to indicate that this choice has a special (default) meaning.

Parameters:

txt (Optional[str])

sharedPainter(self) QPainter | None
showClearButton(self) bool

Returns whether the widget is showing a clear button.

Return type:

bool

showEvent(self, e: QShowEvent | None)
stepEnabled(self) QAbstractSpinBox.StepEnabled
tabletEvent(self, a0: QTabletEvent | None)
timerEvent(self, event: QTimerEvent | None)
Parameters:

event (Optional[QTimerEvent])

updateMicroFocus(self)
validate(self, input: str | None)
Parameters:

input (Optional[str]) -> (QValidator.State)

valueFromText(self, text: str | None) float
Parameters:

text (Optional[str])

Return type:

float

wheelEvent(self, event: QWheelEvent | None)
Parameters:

event (Optional[QWheelEvent])