QAbstractSpinBox¶
The
QAbstractSpinBox
class provides a spinbox and a line edit to display values. More…
Inherited by: QDateEdit, QDateTimeEdit, QDoubleSpinBox, QSpinBox, QTimeEdit
Synopsis¶
Functions¶
def
alignment
()def
buttonSymbols
()def
correctionMode
()def
hasAcceptableInput
()def
hasFrame
()def
initStyleOption
(option)def
interpretText
()def
isAccelerated
()def
isGroupSeparatorShown
()def
isReadOnly
()def
keyboardTracking
()def
lineEdit
()def
setAccelerated
(on)def
setAlignment
(flag)def
setButtonSymbols
(bs)def
setCorrectionMode
(cm)def
setFrame
(arg__1)def
setGroupSeparatorShown
(shown)def
setKeyboardTracking
(kt)def
setLineEdit
(edit)def
setReadOnly
(r)def
setSpecialValueText
(txt)def
setWrapping
(w)def
specialValueText
()def
text
()def
wrapping
()
Virtual functions¶
def
clear
()def
fixup
(input)def
stepBy
(steps)def
stepEnabled
()def
validate
(input, pos)
Signals¶
def
editingFinished
()
Detailed Description¶
The class is designed as a common super class for widgets like
QSpinBox
,QDoubleSpinBox
andQDateTimeEdit
Here are the main properties of the class:
text
: The text that is displayed in theQAbstractSpinBox
.alignment : The alignment of the text in the
QAbstractSpinBox
.
wrapping
: Whether theQAbstractSpinBox
wraps from the minimum value to the maximum value and vice versa.
QAbstractSpinBox
provides a virtualstepBy()
function that is called whenever the user triggers a step. This function takes an integer value to signify how many steps were taken. E.g. PressingKey_Down
will trigger a call tostepBy
(-1).When the user triggers a step whilst holding the
ControlModifier
,QAbstractSpinBox
steps by 10 instead of making a single step. This step modifier affects wheel events, key events and interaction with the spinbox buttons. Note that on macOS , Control corresponds to the Command key.Since Qt 5.12,
SH_SpinBox_StepModifier
can be used to select whichKeyboardModifier
increases the step rate.NoModifier
disables this feature.
QAbstractSpinBox
also provide a virtual functionstepEnabled()
to determine whether stepping up/down is allowed at any point. This function returns a bitset ofStepEnabled
.
-
class
QAbstractSpinBox
([parent=None])¶ - param parent
Constructs an abstract spinbox with the given
parent
with defaultwrapping
, and alignment properties.
-
PySide2.QtWidgets.QAbstractSpinBox.
StepEnabledFlag
¶ Constant
Description
QAbstractSpinBox.StepNone
QAbstractSpinBox.StepUpEnabled
QAbstractSpinBox.StepDownEnabled
-
PySide2.QtWidgets.QAbstractSpinBox.
ButtonSymbols
¶ This enum type describes the symbols that can be displayed on the buttons in a spin box.
Constant
Description
QAbstractSpinBox.UpDownArrows
Little arrows in the classic style.
QAbstractSpinBox.PlusMinus
+ and - symbols.
QAbstractSpinBox.NoButtons
Don’t display buttons.
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
CorrectionMode
¶ This enum type describes the mode the spinbox will use to correct an
Intermediate
value if editing finishes.Constant
Description
QAbstractSpinBox.CorrectToPreviousValue
The spinbox will revert to the last valid value.
QAbstractSpinBox.CorrectToNearestValue
The spinbox will revert to the nearest valid value.
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
StepType
¶ Constant
Description
QAbstractSpinBox.DefaultStepType
QAbstractSpinBox.AdaptiveDecimalStepType
New in version 5.12.
-
PySide2.QtWidgets.QAbstractSpinBox.
alignment
()¶ - Return type
Alignment
See also
- Return type
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
clear
()¶ Clears the lineedit of all text but prefix and suffix.
-
PySide2.QtWidgets.QAbstractSpinBox.
correctionMode
()¶ - Return type
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
editingFinished
()¶
-
PySide2.QtWidgets.QAbstractSpinBox.
fixup
(input)¶ - Parameters
input – unicode
This virtual function is called by the
QAbstractSpinBox
if theinput
is not validated toAcceptable
when Return is pressed orinterpretText()
is called. It will try to change the text so it is valid. Reimplemented in the various subclasses.
-
PySide2.QtWidgets.QAbstractSpinBox.
hasAcceptableInput
()¶ - Return type
bool
-
PySide2.QtWidgets.QAbstractSpinBox.
hasFrame
()¶ - Return type
bool
-
PySide2.QtWidgets.QAbstractSpinBox.
initStyleOption
(option)¶ - Parameters
option –
QStyleOptionSpinBox
Initialize
option
with the values from thisQSpinBox
. This method is useful for subclasses when they need aQStyleOptionSpinBox
, but don’t want to fill in all the information themselves.See also
-
PySide2.QtWidgets.QAbstractSpinBox.
interpretText
()¶ This function interprets the text of the spin box. If the value has changed since last interpretation it will emit signals.
-
PySide2.QtWidgets.QAbstractSpinBox.
isAccelerated
()¶ - Return type
bool
-
PySide2.QtWidgets.QAbstractSpinBox.
isGroupSeparatorShown
()¶ - Return type
bool
-
PySide2.QtWidgets.QAbstractSpinBox.
isReadOnly
()¶ - Return type
bool
-
PySide2.QtWidgets.QAbstractSpinBox.
keyboardTracking
()¶ - Return type
bool
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
lineEdit
()¶ - Return type
This function returns a pointer to the line edit of the spin box.
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
selectAll
()¶ Selects all the text in the spinbox except the prefix and suffix.
-
PySide2.QtWidgets.QAbstractSpinBox.
setAccelerated
(on)¶ - Parameters
on –
bool
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
setAlignment
(flag)¶ - Parameters
flag –
Alignment
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
setButtonSymbols
(bs)¶ - Parameters
bs –
ButtonSymbols
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
setCorrectionMode
(cm)¶ - Parameters
cm –
CorrectionMode
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
setFrame
(arg__1)¶ - Parameters
arg__1 –
bool
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
setGroupSeparatorShown
(shown)¶ - Parameters
shown –
bool
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
setKeyboardTracking
(kt)¶ - Parameters
kt –
bool
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
setLineEdit
(edit)¶ - Parameters
edit –
QLineEdit
Sets the line edit of the spinbox to be
lineEdit
instead of the current line edit widget.lineEdit
can not be 0.QAbstractSpinBox
takes ownership of the newlineEdit
If
validator()
for thelineEdit
returnsNone
, the internal validator of the spinbox will be set on the line edit.See also
-
PySide2.QtWidgets.QAbstractSpinBox.
setReadOnly
(r)¶ - Parameters
r –
bool
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
setSpecialValueText
(txt)¶ - Parameters
txt – unicode
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
setWrapping
(w)¶ - Parameters
w –
bool
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
specialValueText
()¶ - Return type
unicode
See also
-
PySide2.QtWidgets.QAbstractSpinBox.
stepBy
(steps)¶ - Parameters
steps –
int
Virtual function that is called whenever the user triggers a step. The
steps
parameter indicates how many steps were taken. For example, pressingQt::Key_Down
will trigger a call tostepBy(-1)
, whereas pressingQt::Key_PageUp
will trigger a call tostepBy(10)
.If you subclass
QAbstractSpinBox
you must reimplement this function. Note that this function is called even if the resulting value will be outside the bounds of minimum and maximum. It’s this function’s job to handle these situations.See also
stepUp()
stepDown()
keyPressEvent()
-
PySide2.QtWidgets.QAbstractSpinBox.
stepDown
()¶ Steps down by one linestep Calling this slot is analogous to calling
stepBy
(-1);
-
PySide2.QtWidgets.QAbstractSpinBox.
stepEnabled
()¶ - Return type
StepEnabled
Virtual function that determines whether stepping up and down is legal at any given time.
The up arrow will be painted as disabled unless ( &
StepUpEnabled
) != 0.The default implementation will return (
StepUpEnabled
|StepDownEnabled
) if wrapping is turned on. Else it will returnStepDownEnabled
if value is > minimum() or’ed withStepUpEnabled
if value < maximum().If you subclass
QAbstractSpinBox
you will need to reimplement this function.See also
-
PySide2.QtWidgets.QAbstractSpinBox.
stepUp
()¶ Steps up by one linestep Calling this slot is analogous to calling
stepBy
(1);See also
-
PySide2.QtWidgets.QAbstractSpinBox.
text
()¶ - Return type
unicode
-
PySide2.QtWidgets.QAbstractSpinBox.
validate
(input, pos)¶ - Parameters
input – unicode
pos –
int
- Return type
PyObject
This virtual function is called by the
QAbstractSpinBox
to determine whetherinput
is valid. Thepos
parameter indicates the position in the string. Reimplemented in the various subclasses.
-
PySide2.QtWidgets.QAbstractSpinBox.
wrapping
()¶ - Return type
bool
See also
© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.