QAbstractSpinBoxclass provides a spinbox and a line edit to display values. 更多 …
继承者: QDateEdit , QDateTimeEdit , QDoubleSpinBox , QSpinBox , QTimeEdit
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
()
def
clear
()
def
fixup
(input)
def
stepBy
(steps)
def
stepEnabled
()
def
validate
(input, pos)
def
editingFinished
()
此类被设计作为 Widget 的通用超类像
QSpinBox,QDoubleSpinBoxandQDateTimeEdit这里是类的主要特性:
text: The text that is displayed in theQAbstractSpinBox.alignment : The alignment of the text in the
QAbstractSpinBox.
wrapping: Whether theQAbstractSpinBoxwraps from the minimum value to the maximum value and vice versa.
QAbstractSpinBoxprovides 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将触发调用stepBy(-1).当用户触发步进时的同时按住
ControlModifier,QAbstractSpinBoxsteps 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.从 Qt 5.12 起,
SH_SpinBox_StepModifier可以用来选择KeyboardModifier递增步幅速率。NoModifier禁用此特征。
QAbstractSpinBoxalso provide a virtual functionstepEnabled()to determine whether stepping up/down is allowed at any point. This function returns a bitset ofStepEnabled.
QAbstractSpinBox
(
[
parent=None
]
)
¶
- param parent
PySide2.QtWidgets.QAbstractSpinBox.
StepEnabledFlag
¶
|
常量 |
描述 |
|---|---|
|
QAbstractSpinBox.StepNone |
|
|
QAbstractSpinBox.StepUpEnabled |
|
|
QAbstractSpinBox.StepDownEnabled |
PySide2.QtWidgets.QAbstractSpinBox.
ButtonSymbols
¶
此枚举类型描述可以在自旋框按钮中显示的符号。
|
常量 |
描述 |
|---|---|
|
QAbstractSpinBox.UpDownArrows |
经典风格小箭头。 |
|
QAbstractSpinBox.PlusMinus |
+ and - 符号。 |
|
QAbstractSpinBox.NoButtons |
Don’t display buttons. |
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
CorrectionMode
¶
此枚举类型描述的自旋框模式用于校正
中间体
值若编辑完成。
|
常量 |
描述 |
|---|---|
|
QAbstractSpinBox.CorrectToPreviousValue |
The spinbox will revert to the last valid value. |
|
QAbstractSpinBox.CorrectToNearestValue |
The spinbox will revert to the nearest valid value. |
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
StepType
¶
|
常量 |
描述 |
|---|---|
|
QAbstractSpinBox.DefaultStepType |
|
|
QAbstractSpinBox.AdaptiveDecimalStepType |
New in version 5.12.
PySide2.QtWidgets.QAbstractSpinBox.
alignment
(
)
¶
Alignment
另请参阅
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
clear
(
)
¶
清零所有文本的 lineedit,除前缀和后缀外。
PySide2.QtWidgets.QAbstractSpinBox.
correctionMode
(
)
¶
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
editingFinished
(
)
¶
PySide2.QtWidgets.QAbstractSpinBox.
fixup
(
input
)
¶
input – unicode
This virtual function is called by the
QAbstractSpinBox
若
input
is not validated to
Acceptable
when Return is pressed or
interpretText()
is called. It will try to change the text so it is valid. Reimplemented in the various subclasses.
PySide2.QtWidgets.QAbstractSpinBox.
hasAcceptableInput
(
)
¶
bool
PySide2.QtWidgets.QAbstractSpinBox.
hasFrame
(
)
¶
bool
PySide2.QtWidgets.QAbstractSpinBox.
initStyleOption
(
option
)
¶
option
–
QStyleOptionSpinBox
初始化
option
采用值来自此
QSpinBox
。此方法对子类是有用的,当需要
QStyleOptionSpinBox
, but don’t want to fill in all the information themselves.
另请参阅
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
(
)
¶
bool
PySide2.QtWidgets.QAbstractSpinBox.
isGroupSeparatorShown
(
)
¶
bool
PySide2.QtWidgets.QAbstractSpinBox.
isReadOnly
(
)
¶
bool
PySide2.QtWidgets.QAbstractSpinBox.
keyboardTracking
(
)
¶
bool
PySide2.QtWidgets.QAbstractSpinBox.
lineEdit
(
)
¶
This function returns a pointer to the line edit of the spin box.
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
selectAll
(
)
¶
Selects all the text in the spinbox except the prefix and suffix.
PySide2.QtWidgets.QAbstractSpinBox.
setAccelerated
(
on
)
¶
on
–
bool
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
setAlignment
(
flag
)
¶
flag
–
Alignment
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
setButtonSymbols
(
bs
)
¶
bs
–
ButtonSymbols
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
setCorrectionMode
(
cm
)
¶
cm
–
CorrectionMode
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
setFrame
(
arg__1
)
¶
arg__1
–
bool
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
setGroupSeparatorShown
(
shown
)
¶
shown
–
bool
PySide2.QtWidgets.QAbstractSpinBox.
setKeyboardTracking
(
kt
)
¶
kt
–
bool
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
setLineEdit
(
edit
)
¶
edit
–
QLineEdit
Sets the line edit of the spinbox to be
lineEdit
instead of the current line edit widget.
lineEdit
不能是
None
.
QAbstractSpinBox
takes ownership of the new
lineEdit
若
validator()
为
lineEdit
返回
None
, the internal validator of the spinbox will be set on the line edit.
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
setReadOnly
(
r
)
¶
r
–
bool
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
setSpecialValueText
(
txt
)
¶
txt – unicode
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
setWrapping
(
w
)
¶
w
–
bool
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
specialValueText
(
)
¶
unicode
PySide2.QtWidgets.QAbstractSpinBox.
stepBy
(
steps
)
¶
steps
–
int
Virtual function that is called whenever the user triggers a step. The
steps
parameter indicates how many steps were taken. For example, pressing
Qt::Key_Down
将触发调用
stepBy(-1)
, whereas pressing
Qt::Key_PageUp
将触发调用
stepBy(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.
另请参阅
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
(
)
¶
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 return
StepDownEnabled
if value is > minimum() or’ed with
StepUpEnabled
if value < maximum().
If you subclass
QAbstractSpinBox
you will need to reimplement this function.
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
stepUp
(
)
¶
Steps up by one linestep Calling this slot is analogous to calling
stepBy
(1);
另请参阅
PySide2.QtWidgets.QAbstractSpinBox.
text
(
)
¶
unicode
PySide2.QtWidgets.QAbstractSpinBox.
validate
(
input
,
pos
)
¶
input – unicode
pos
–
int
PyObject
This virtual function is called by the
QAbstractSpinBox
to determine whether
input
is valid. The
pos
parameter indicates the position in the string. Reimplemented in the various subclasses.
PySide2.QtWidgets.QAbstractSpinBox.
wrapping
(
)
¶
bool
另请参阅