内容表

上一话题

QAbstractSlider

下一话题

QAccessibleWidget

QAbstractSpinBox

QAbstractSpinBox class provides a spinbox and a line edit to display values. 更多

Inheritance diagram of PySide2.QtWidgets.QAbstractSpinBox

继承者: QDateEdit , QDateTimeEdit , QDoubleSpinBox , QSpinBox , QTimeEdit

详细描述

此类被设计作为 Widget 的通用超类像 QSpinBox , QDoubleSpinBox and QDateTimeEdit

这里是类的主要特性:

  1. text : The text that is displayed in the QAbstractSpinBox .

  2. alignment : The alignment of the text in the QAbstractSpinBox .

  3. wrapping : Whether the QAbstractSpinBox wraps from the minimum value to the maximum value and vice versa.

QAbstractSpinBox provides a virtual stepBy() 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. Pressing Key_Down 将触发调用 stepBy (-1).

当用户触发步进时的同时按住 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.

从 Qt 5.12 起, SH_SpinBox_StepModifier 可以用来选择 KeyboardModifier 递增步幅速率。 NoModifier 禁用此特征。

QAbstractSpinBox also provide a virtual function stepEnabled() to determine whether stepping up/down is allowed at any point. This function returns a bitset of StepEnabled .

class QAbstractSpinBox ( [ parent=None ] )
param parent

QWidget

构造抽象 Spinbox 采用给定 parent 采用默认 wrapping ,和 alignment 特性。

PySide2.QtWidgets.QAbstractSpinBox. StepEnabledFlag

常量

描述

QAbstractSpinBox.StepNone

QAbstractSpinBox.StepUpEnabled

QAbstractSpinBox.StepDownEnabled

PySide2.QtWidgets.QAbstractSpinBox. ButtonSymbols

此枚举类型描述可以在自旋框按钮中显示的符号。

qspinbox-updown1 qspinbox-plusminus2

常量

描述

QAbstractSpinBox.UpDownArrows

经典风格小箭头。

QAbstractSpinBox.PlusMinus

+ and - 符号。

QAbstractSpinBox.NoButtons

Don’t display buttons.

另请参阅

buttonSymbols

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.

另请参阅

correctionMode

PySide2.QtWidgets.QAbstractSpinBox. StepType

常量

描述

QAbstractSpinBox.DefaultStepType

QAbstractSpinBox.AdaptiveDecimalStepType

New in version 5.12.

PySide2.QtWidgets.QAbstractSpinBox. alignment ( )
返回类型

Alignment

另请参阅

setAlignment()

PySide2.QtWidgets.QAbstractSpinBox. buttonSymbols ( )
返回类型

ButtonSymbols

PySide2.QtWidgets.QAbstractSpinBox. clear ( )

清零所有文本的 lineedit,除前缀和后缀外。

PySide2.QtWidgets.QAbstractSpinBox. correctionMode ( )
返回类型

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.

另请参阅

initFrom()

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 ( )
返回类型

QLineEdit

This function returns a pointer to the line edit of the spin box.

另请参阅

setLineEdit()

PySide2.QtWidgets.QAbstractSpinBox. selectAll ( )

Selects all the text in the spinbox except the prefix and suffix.

PySide2.QtWidgets.QAbstractSpinBox. setAccelerated ( on )
参数

on bool

另请参阅

isAccelerated()

PySide2.QtWidgets.QAbstractSpinBox. setAlignment ( flag )
参数

flag Alignment

另请参阅

alignment()

PySide2.QtWidgets.QAbstractSpinBox. setButtonSymbols ( bs )
参数

bs ButtonSymbols

另请参阅

buttonSymbols()

PySide2.QtWidgets.QAbstractSpinBox. setCorrectionMode ( cm )
参数

cm CorrectionMode

另请参阅

correctionMode()

PySide2.QtWidgets.QAbstractSpinBox. setFrame ( arg__1 )
参数

arg__1 bool

另请参阅

hasFrame()

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.

另请参阅

lineEdit()

PySide2.QtWidgets.QAbstractSpinBox. setReadOnly ( r )
参数

r bool

另请参阅

isReadOnly()

PySide2.QtWidgets.QAbstractSpinBox. setSpecialValueText ( txt )
参数

txt – unicode

PySide2.QtWidgets.QAbstractSpinBox. setWrapping ( w )
参数

w bool

另请参阅

wrapping()

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

另请参阅

setWrapping()