![]() |
Home · All Classes · Main Classes · Annotated · Grouped Classes · Functions | ![]() |
The QAbstractSpinBox class provides a spinwidget and a line edit to display values. More...
#include <QAbstractSpinBox>
Part of the QtGui module.
Inherits QWidget.
Inherited by QDateTimeEdit, QDoubleSpinBox, and QSpinBox.
|
The QAbstractSpinBox class provides a spinwidget and a line edit to display values.
The class is designed as a common super class for widgets like QSpinBox, QDoubleSpinBox and QDateTimeEdit
Here are the main properties of the class:
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 Qt::Key_Down will trigger a call to stepBy(-1).
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.
This enum type determines what the buttons in a spin box show.
Constant | Value | Description |
---|---|---|
QAbstractSpinBox::UpDownArrows | 0 | the buttons show little arrows in the classic style. |
QAbstractSpinBox::PlusMinus | 1 | the buttons show + and - symbols. |
See also QAbstractSpinBox::buttonSymbols.
Constant | Value |
---|---|
QAbstractSpinBox::StepNone | 0x00 |
QAbstractSpinBox::StepUpEnabled | 0x01 |
QAbstractSpinBox::StepDownEnabled | 0x02 |
The StepEnabled type stores an OR combination of StepEnabledFlag values.
This property holds the alignment of the spin box.
Possible Values are Qt::AlignLeft, Qt::AlignRight and Qt::AlignHCenter.
By default, the alignment is Qt::AlignLeft
Attempting to set the alignment to an illegal flag combination does nothing.
Access functions:
See also Qt::Alignment.
This property holds the current button symbol mode.
The possible values can be either UpDownArrows or PlusMinus. The default is UpDownArrows.
Access functions:
See also ButtonSymbols.
This property holds whether the spin box draws itself with a frame.
If enabled (the default) the spin box draws itself inside a frame, otherwise the spin box draws itself without any frame.
Access functions:
This property holds whether the spin box is read only.
In read-only mode, the user can still copy the text to the clipboard, or drag and drop the text; but cannot edit it.
The QLineEdit in the QAbstractSpinBox does not show a cursor in read-only mode.
Access functions:
See also QLineEdit::setReadOnly and QLineEdit::readOnly.
This property holds the spin box's text, including any and .
There is no default text.
Access functions:
This property holds whether the spin box is circular.
If wrapping is true stepping up from maximum() value will take you to the minimum() value and vica versa. Wrapping only make sense if you have minimum() and maximum() values set.
QSpinBox *spinBox = new QSpinBox(this); spinBox->setRange(0, 100); spinBox->setWrapping(true); sb->setValue(100); sb->stepBy(1); // value is 0
By default, wrapping is turned off.
Access functions:
See also QSpinBox::minimum() and QSpinBox::maximum().
Constructs an abstract spinbox with the given parent with default wrapping, and alignment properties.
Called when the QAbstractSpinBox is destroyed.
Clears the lineedit of all text but prefix and suffix
This virtual function is called by the QAbstractSpinBox if the input is not validated to QValidator::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.
This function interprets the text of the spin box. If the value has changed since last interpretation it will emit signals.
This function returns a pointer to the line edit of the spin box.
Selects all the text in the spinbox except the prefix and suffix
Sets the line edit of the spinbox to be lineEdit instead of the current line edit widget.
If validator() for the lineEdit returns 0, the internal validator of the spinbox will be set on the line edit.
Virtual function that is called whenever the user triggers a step. The steps parameter indicates how many steps were taken, e.g. Pressing Qt::Key_Down will trigger a call to stepBy(-1), whereas pressing Qt::Key_Prior will trigger a call to 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.
See also QSpinBox::setValue(), QSpinBox::minimum(), and QSpinBox::maximum().
Virtual function that determines whether stepping up and down is legal at any given time.
The up arrow will be painted as disabled unless (stepEnabled() & 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.
See also QSpinBox::minimum(), QSpinBox::maximum(), and wrapping().
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.
Copyright © 2005 Trolltech | Trademarks | Qt 4.0.0-b2 |