Eneboo - Documentación para desarrolladores
Tipos públicos | Slots públicos | Señales | Métodos públicos | Slots protegidos | Métodos protegidos | Propiedades
Referencia de la Clase QSpinBox

The QSpinBox class provides a spin box widget (spin button). Más...

#include <qspinbox.h>

Diagrama de herencias de QSpinBox
QWidget QRangeControl QWidget QRangeControl QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject FLSpinBox QPrintDialogSpinBox

Lista de todos los miembros.

Tipos públicos

enum  ButtonSymbols { UpDownArrows, PlusMinus, UpDownArrows, PlusMinus }
enum  ButtonSymbols { UpDownArrows, PlusMinus, UpDownArrows, PlusMinus }

Slots públicos

virtual void setValue (int value)
virtual void setPrefix (const QString &text)
virtual void setSuffix (const QString &text)
virtual void stepUp ()
virtual void stepDown ()
virtual void setEnabled (bool enabled)
virtual void selectAll ()
virtual void setValue (int value)
virtual void setPrefix (const QString &text)
virtual void setSuffix (const QString &text)
virtual void stepUp ()
virtual void stepDown ()
virtual void setEnabled (bool enabled)
virtual void selectAll ()

Señales

void valueChanged (int value)
void valueChanged (const QString &valueText)
void valueChanged (int value)
void valueChanged (const QString &valueText)

Métodos públicos

 QSpinBox (QWidget *parent=0, const char *name=0)
 QSpinBox (int minValue, int maxValue, int step=1, QWidget *parent=0, const char *name=0)
 ~QSpinBox ()
QString text () const
virtual QString prefix () const
virtual QString suffix () const
virtual QString cleanText () const
virtual void setSpecialValueText (const QString &text)
QString specialValueText () const
virtual void setWrapping (bool on)
bool wrapping () const
virtual void setButtonSymbols (ButtonSymbols)
ButtonSymbols buttonSymbols () const
virtual void setValidator (const QValidator *v)
const QValidatorvalidator () const
QSize sizeHint () const
QSize minimumSizeHint () const
int minValue () const
int maxValue () const
void setMinValue (int)
void setMaxValue (int)
int lineStep () const
void setLineStep (int)
int value () const
QRect upRect () const
QRect downRect () const
 QSpinBox (QWidget *parent=0, const char *name=0)
 QSpinBox (int minValue, int maxValue, int step=1, QWidget *parent=0, const char *name=0)
 ~QSpinBox ()
QString text () const
virtual QString prefix () const
virtual QString suffix () const
virtual QString cleanText () const
virtual void setSpecialValueText (const QString &text)
QString specialValueText () const
virtual void setWrapping (bool on)
bool wrapping () const
virtual void setButtonSymbols (ButtonSymbols)
ButtonSymbols buttonSymbols () const
virtual void setValidator (const QValidator *v)
const QValidatorvalidator () const
QSize sizeHint () const
QSize minimumSizeHint () const
int minValue () const
int maxValue () const
void setMinValue (int)
void setMaxValue (int)
int lineStep () const
void setLineStep (int)
int value () const
QRect upRect () const
QRect downRect () const

Slots protegidos

void textChanged ()
void textChanged ()

Métodos protegidos

virtual QString mapValueToText (int value)
virtual int mapTextToValue (bool *ok)
QString currentValueText ()
virtual void updateDisplay ()
virtual void interpretText ()
QLineEditeditor () const
virtual void valueChange ()
virtual void rangeChange ()
bool eventFilter (QObject *obj, QEvent *ev)
void resizeEvent (QResizeEvent *ev)
void wheelEvent (QWheelEvent *)
void leaveEvent (QEvent *)
void styleChange (QStyle &)
virtual QString mapValueToText (int value)
virtual int mapTextToValue (bool *ok)
QString currentValueText ()
virtual void updateDisplay ()
virtual void interpretText ()
QLineEditeditor () const
virtual void valueChange ()
virtual void rangeChange ()
bool eventFilter (QObject *obj, QEvent *ev)
void resizeEvent (QResizeEvent *ev)
void wheelEvent (QWheelEvent *)
void leaveEvent (QEvent *)
void styleChange (QStyle &)

Propiedades

QString text
 the spin box's text, including any prefix() and suffix()
QString prefix
 the spin box's prefix
QString suffix
 the suffix of the spin box
QString cleanText
 the spin box's text with no prefix(), suffix() or leading or trailing whitespace.
QString specialValueText
 the special-value text
bool wrapping
 whether it is possible to step the value from the highest value to the lowest value and vice versa
ButtonSymbols buttonSymbols
 the current button symbol mode
int maxValue
 the maximum value of the spin box
int minValue
 the minimum value of the spin box
int lineStep
 the line step
int value
 the value of the spin box

Descripción detallada

The QSpinBox class provides a spin box widget (spin button).

QSpinBox allows the user to choose a value either by clicking the up/down buttons to increase/decrease the value currently displayed or by typing the value directly into the spin box. If the value is entered directly into the spin box, Enter (or Return) must be pressed to apply the new value. The value is usually an integer.

Every time the value changes QSpinBox emits the valueChanged() signal. The current value can be fetched with value() and set with setValue().

The spin box keeps the value within a numeric range, and to multiples of the lineStep() size (see QRangeControl for details). Clicking the up/down buttons or using the keyboard accelerator's up and down arrows will increase or decrease the current value in steps of size lineStep(). The minimum and maximum value and the step size can be set using one of the constructors, and can be changed later with setMinValue(), setMaxValue() and setLineStep().

Most spin boxes are directional, but QSpinBox can also operate as a circular spin box, i.e. if the range is 0-99 and the current value is 99, clicking "up" will give 0. Use setWrapping() if you want circular behavior.

The displayed value can be prepended and appended with arbitrary strings indicating, for example, currency or the unit of measurement. See setPrefix() and setSuffix(). The text in the spin box is retrieved with text() (which includes any prefix() and suffix()), or with cleanText() (which has no prefix(), no suffix() and no leading or trailing whitespace). currentValueText() returns the spin box's current value as text.

Normally the spin box displays up and down arrows in the buttons. You can use setButtonSymbols() to change the display to show + and - symbols if you prefer. In either case the up and down arrow keys work as expected.

It is often desirable to give the user a special (often default) choice in addition to the range of numeric values. See setSpecialValueText() for how to do this with QSpinBox.

The default QWidget::focusPolicy() is StrongFocus.

If using prefix(), suffix() and specialValueText() don't provide enough control, you can ignore them and subclass QSpinBox instead.

QSpinBox can easily be subclassed to allow the user to input things other than an integer value as long as the allowed input can be mapped to a range of integers. This can be done by overriding the virtual functions mapValueToText() and mapTextToValue(), and setting another suitable validator using setValidator().

For example, these functions could be changed so that the user provided values from 0.0 to 10.0, or -1 to signify 'Auto', while the range of integers used inside the program would be -1 to 100:

        class MySpinBox : public QSpinBox
        {
            Q_OBJECT
        public:
            ...

            QString mapValueToText( int value )
            {
                if ( value == -1 ) // special case
                    return QString( "Auto" );

                return QString( "%1.%2" ) // 0.0 to 10.0
                    .arg( value / 10 ).arg( value % 10 );
            }

            int mapTextToValue( bool *ok )
            {
                if ( text() == "Auto" ) // special case
                    return -1;

                return (int) ( 10 * text().toFloat() ); // 0 to 100
            }
        };
qspinbox-m.png
qspinbox-w.png
Ver también:
QScrollBar QSlider GUI Design Handbook: Spin Box

Documentación de las enumeraciones miembro de la clase

This enum type determines what the buttons in a spin box show.

UpDownArrows the buttons show little arrows in the classic style.

PlusMinus the buttons show + and - symbols.

Ver también:
QSpinBox::buttonSymbols
Valores de enumeraciones:
UpDownArrows 
PlusMinus 
UpDownArrows 
PlusMinus 
Valores de enumeraciones:
UpDownArrows 
PlusMinus 
UpDownArrows 
PlusMinus 

Documentación del constructor y destructor

QSpinBox::QSpinBox ( QWidget parent = 0,
const char *  name = 0 
)

Constructs a spin box with the default QRangeControl range and step values. It is called name and has parent parent.

Ver también:
minValue(), maxValue(), setRange(), lineStep(), setSteps()
QSpinBox::QSpinBox ( int  minValue,
int  maxValue,
int  step = 1,
QWidget parent = 0,
const char *  name = 0 
)

Constructs a spin box that allows values from minValue to maxValue inclusive, with step amount step. The value is initially set to minValue.

The spin box is called name and has parent parent.

Ver también:
minValue(), maxValue(), setRange(), lineStep(), setSteps()
QSpinBox::~QSpinBox ( )

Destroys the spin box, freeing all memory and other resources.

QSpinBox::QSpinBox ( QWidget parent = 0,
const char *  name = 0 
)
QSpinBox::QSpinBox ( int  minValue,
int  maxValue,
int  step = 1,
QWidget parent = 0,
const char *  name = 0 
)
QSpinBox::~QSpinBox ( )

Documentación de las funciones miembro

ButtonSymbols QSpinBox::buttonSymbols ( ) const
ButtonSymbols QSpinBox::buttonSymbols ( ) const
virtual QString QSpinBox::cleanText ( ) const [virtual]
virtual QString QSpinBox::cleanText ( ) const [virtual]
QString QSpinBox::currentValueText ( ) [protected]

Returns the full text calculated from the current value, including any prefix and suffix. If there is special value text and the value is minValue() the specialValueText() is returned.

QString QSpinBox::currentValueText ( ) [protected]
QRect QSpinBox::downRect ( ) const
QRect QSpinBox::downRect ( ) const

Returns the geometry of the "down" button.

QLineEdit * QSpinBox::editor ( ) const [protected]

Returns a pointer to the embedded QLineEdit.

QLineEdit* QSpinBox::editor ( ) const [protected]
bool QSpinBox::eventFilter ( QObject o,
QEvent ev 
) [protected, virtual]

Intercepts and handles the events coming to the embedded QLineEdit that have special meaning for the QSpinBox. The object is passed as o and the event is passed as ev.

Reimplementado de QObject.

bool QSpinBox::eventFilter ( QObject ,
QEvent  
) [protected, virtual]

Filters events if this object has been installed as an event filter for the watched object.

In your reimplementation of this function, if you want to filter the event e, out, i.e. stop it being handled further, return TRUE; otherwise return FALSE.

Example:

    class MyMainWindow : public QMainWindow
    {
    public:
        MyMainWindow( QWidget *parent = 0, const char *name = 0 );

    protected:
        bool eventFilter( QObject *obj, QEvent *ev );

    private:
        QTextEdit *textEdit;
    };

    MyMainWindow::MyMainWindow( QWidget *parent, const char *name )
        : QMainWindow( parent, name )
    {
        textEdit = new QTextEdit( this );
        setCentralWidget( textEdit );
        textEdit->installEventFilter( this );
    }

    bool MyMainWindow::eventFilter( QObject *obj, QEvent *ev )
    {
        if ( obj == textEdit ) {
            if ( e->type() == QEvent::KeyPress ) {
                QKeyEvent *k = (QKeyEvent*)ev;
                qDebug( "Ate key press %d", k->key() );
                return TRUE;
            } else {
                return FALSE;
            }
        } else {
            // pass the event on to the parent class
            return QMainWindow::eventFilter( obj, ev );
        }
    }

Notice in the example above that unhandled events are passed to the base class's eventFilter() function, since the base class might have reimplemented eventFilter() for its own internal purposes.

Atención:
If you delete the receiver object in this function, be sure to return TRUE. Otherwise, Qt will forward the event to the deleted object and the program might crash.
Ver también:
installEventFilter()

Reimplementado de QObject.

void QSpinBox::interpretText ( ) [protected, virtual]

QSpinBox calls this after the user has manually edited the contents of the spin box (i.e. by typing in the embedded QLineEdit, rather than using the up/down buttons/keys).

The default implementation of this function interprets the new text using mapTextToValue(). If mapTextToValue() is successful, it changes the spin box's value; if not, the value is left unchanged.

Ver también:
editor()

Reimplementado en QPrintDialogSpinBox.

virtual void QSpinBox::interpretText ( ) [protected, virtual]

Reimplementado en QPrintDialogSpinBox.

void QSpinBox::leaveEvent ( QEvent ) [protected, virtual]

Reimplementado de QWidget.

void QSpinBox::leaveEvent ( QEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive widget leave events.

A leave event is sent to the widget when the mouse cursor leaves the widget.

Ver también:
enterEvent(), mouseMoveEvent(), event()

Reimplementado de QWidget.

int QSpinBox::lineStep ( ) const

Returns the line step.

Ver también:
setSteps() pageStep()

Reimplementado de QRangeControl.

int QSpinBox::lineStep ( ) const

Returns the line step.

Ver también:
setSteps() pageStep()

Reimplementado de QRangeControl.

int QSpinBox::mapTextToValue ( bool ok) [protected, virtual]

This virtual function is used by the spin box whenever it needs to interpret text entered by the user as a value. The text is available as text() and as cleanText(), and this function must parse it if possible. If ok is not 0: if it parses the text successfully, *ok is set to TRUE; otherwise *ok is set to FALSE.

Subclasses that need to display spin box values in a non-numeric way need to reimplement this function.

Note that Qt handles specialValueText() separately; this function is only concerned with the other values.

The default implementation tries to interpret the text() as an integer in the standard way and returns the integer value.

Ver también:
interpretText(), mapValueToText()
virtual int QSpinBox::mapTextToValue ( bool ok) [protected, virtual]
QString QSpinBox::mapValueToText ( int  v) [protected, virtual]

This virtual function is used by the spin box whenever it needs to display value v. The default implementation returns a string containing v printed in the standard way. Reimplementations may return anything. (See the example in the detailed description.)

Note that Qt does not call this function for specialValueText() and that neither prefix() nor suffix() are included in the return value.

If you reimplement this, you may also need to reimplement mapTextToValue().

Ver también:
updateDisplay(), mapTextToValue()
virtual QString QSpinBox::mapValueToText ( int  value) [protected, virtual]
int QSpinBox::maxValue ( ) const

Returns the maximum value of the range.

Ver también:
setMaxValue() setRange() minValue()

Reimplementado de QRangeControl.

int QSpinBox::maxValue ( ) const

Returns the maximum value of the range.

Ver también:
setMaxValue() setRange() minValue()

Reimplementado de QRangeControl.

QSize QSpinBox::minimumSizeHint ( ) const [virtual]

Reimplementado de QWidget.

QSize QSpinBox::minimumSizeHint ( ) const [virtual]

Reimplementado de QWidget.

int QSpinBox::minValue ( ) const

Returns the minimum value of the range.

Ver también:
setMinValue() setRange() maxValue()

Reimplementado de QRangeControl.

int QSpinBox::minValue ( ) const

Returns the minimum value of the range.

Ver también:
setMinValue() setRange() maxValue()

Reimplementado de QRangeControl.

virtual QString QSpinBox::prefix ( ) const [virtual]
virtual QString QSpinBox::prefix ( ) const [virtual]
void QSpinBox::rangeChange ( ) [protected, virtual]

This virtual function is called by QRangeControl whenever the range has changed. It adjusts the default validator and updates the display; if you need additional processing, you can reimplement this function.

Reimplementado de QRangeControl.

virtual void QSpinBox::rangeChange ( ) [protected, virtual]

This virtual function is called whenever the range control's range changes. You can reimplement it if you want to be notified when the range changes. The default implementation does nothing.

Note that this method is called after the range has changed.

Ver también:
setRange(), valueChange(), stepChange()

Reimplementado de QRangeControl.

void QSpinBox::resizeEvent ( QResizeEvent ev) [protected, virtual]

Reimplementado de QWidget.

void QSpinBox::resizeEvent ( QResizeEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive widget resize events. When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().

The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.

Widgets that have been created with the WNoAutoErase flag will not be erased. Nevertheless, they will receive a paint event for their entire area afterwards. Again, no drawing needs to be done inside this handler.

The default implementation calls updateMask() if the widget has automatic masking enabled.

Ver también:
moveEvent(), event(), resize(), QResizeEvent, paintEvent()

Reimplementado de QWidget.

virtual void QSpinBox::selectAll ( ) [virtual, slot]
void QSpinBox::selectAll ( ) [virtual, slot]

Selects all the text in the spin box's editor.

void QSpinBox::setButtonSymbols ( ButtonSymbols  newSymbols) [virtual]
virtual void QSpinBox::setButtonSymbols ( ButtonSymbols  ) [virtual]
virtual void QSpinBox::setEnabled ( bool  enabled) [virtual, slot]

Reimplementado de QWidget.

void QSpinBox::setEnabled ( bool  enabled) [virtual, slot]

Reimplementado de QWidget.

void QSpinBox::setLineStep ( int  )
void QSpinBox::setLineStep ( int  i)
void QSpinBox::setMaxValue ( int  maxVal)

Sets the minimum value of the range to maxVal.

If necessary, the minValue() is adjusted so that the range remains valid.

Ver también:
maxValue() setMinValue()

Reimplementado de QRangeControl.

void QSpinBox::setMaxValue ( int  maxVal)

Sets the minimum value of the range to maxVal.

If necessary, the minValue() is adjusted so that the range remains valid.

Ver también:
maxValue() setMinValue()

Reimplementado de QRangeControl.

void QSpinBox::setMinValue ( int  minVal)

Sets the minimum value of the range to minVal.

If necessary, the maxValue() is adjusted so that the range remains valid.

Ver también:
minValue() setMaxValue()

Reimplementado de QRangeControl.

void QSpinBox::setMinValue ( int  minVal)

Sets the minimum value of the range to minVal.

If necessary, the maxValue() is adjusted so that the range remains valid.

Ver también:
minValue() setMaxValue()

Reimplementado de QRangeControl.

virtual void QSpinBox::setPrefix ( const QString text) [virtual, slot]
void QSpinBox::setPrefix ( const QString text) [virtual, slot]
void QSpinBox::setSpecialValueText ( const QString text) [virtual]
virtual void QSpinBox::setSpecialValueText ( const QString text) [virtual]
virtual void QSpinBox::setSuffix ( const QString text) [virtual, slot]
void QSpinBox::setSuffix ( const QString text) [virtual, slot]
void QSpinBox::setValidator ( const QValidator v) [virtual]

Sets the validator to v. The validator controls what keyboard input is accepted when the user is editing in the value field. The default is to use a suitable QIntValidator.

Use setValidator(0) to turn off input validation (entered input will still be kept within the spin box's range).

virtual void QSpinBox::setValidator ( const QValidator v) [virtual]
void QSpinBox::setValue ( int  value) [virtual, slot]

Sets the range control's value to value and forces it to be within the legal range.

Calls the virtual valueChange() function if the new value is different from the previous value. The old value can still be retrieved using prevValue().

Ver también:
value()

Reimplementado de QRangeControl.

virtual void QSpinBox::setValue ( int  value) [virtual, slot]

Sets the range control's value to value and forces it to be within the legal range.

Calls the virtual valueChange() function if the new value is different from the previous value. The old value can still be retrieved using prevValue().

Ver también:
value()

Reimplementado de QRangeControl.

virtual void QSpinBox::setWrapping ( bool  on) [virtual]
void QSpinBox::setWrapping ( bool  on) [virtual]
QSize QSpinBox::sizeHint ( ) const [virtual]

Reimplementado de QWidget.

QSize QSpinBox::sizeHint ( ) const [virtual]

Reimplementado de QWidget.

QString QSpinBox::specialValueText ( ) const
QString QSpinBox::specialValueText ( ) const
virtual void QSpinBox::stepDown ( ) [virtual, slot]
void QSpinBox::stepDown ( ) [virtual, slot]

Decreases the spin box's value one lineStep(), wrapping as necessary if wrapping() is TRUE. This is the same as clicking on the pointing-down button and can be used for keyboard accelerators, for example.

Ver también:
stepUp(), subtractLine(), lineStep(), setSteps(), setValue(), value()
virtual void QSpinBox::stepUp ( ) [virtual, slot]
void QSpinBox::stepUp ( ) [virtual, slot]

Increases the spin box's value by one lineStep(), wrapping as necessary if wrapping() is TRUE. This is the same as clicking on the pointing-up button and can be used for keyboard accelerators, for example.

Ver también:
stepDown(), addLine(), lineStep(), setSteps(), setValue(), value()
void QSpinBox::styleChange ( QStyle old) [protected, virtual]

Reimplementado de QWidget.

void QSpinBox::styleChange ( QStyle ) [protected, virtual]

This virtual function is called when the style of the widgets changes. oldStyle is the previous GUI style; you can get the new style from style().

Reimplement this function if your widget needs to know when its GUI style changes. You will almost certainly need to update the widget using update().

The default implementation updates the widget including its geometry.

Ver también:
QApplication::setStyle(), style(), update(), updateGeometry()

Reimplementado de QWidget.

virtual QString QSpinBox::suffix ( ) const [virtual]
virtual QString QSpinBox::suffix ( ) const [virtual]
QString QSpinBox::text ( ) const
QString QSpinBox::text ( ) const
void QSpinBox::textChanged ( ) [protected, slot]

This slot is called whenever the user edits the spin box's text.

void QSpinBox::textChanged ( ) [protected, slot]
virtual void QSpinBox::updateDisplay ( ) [protected, virtual]
void QSpinBox::updateDisplay ( ) [protected, virtual]

Updates the contents of the embedded QLineEdit to reflect the current value using mapValueToText(). Also enables/disables the up/down push buttons accordingly.

Ver también:
mapValueToText()
QRect QSpinBox::upRect ( ) const
QRect QSpinBox::upRect ( ) const

Returns the geometry of the "up" button.

const QValidator* QSpinBox::validator ( ) const
const QValidator * QSpinBox::validator ( ) const

Returns the validator that constrains editing for this spin box if there is any; otherwise returns 0.

Ver también:
setValidator() QValidator
int QSpinBox::value ( ) const

Returns the current range control value. This is guaranteed to be within the range [minValue(), maxValue()].

Ver también:
setValue() prevValue()

Reimplementado de QRangeControl.

int QSpinBox::value ( ) const

Returns the current range control value. This is guaranteed to be within the range [minValue(), maxValue()].

Ver también:
setValue() prevValue()

Reimplementado de QRangeControl.

void QSpinBox::valueChange ( ) [protected, virtual]

This virtual function is called by QRangeControl whenever the value has changed. The QSpinBox reimplementation updates the display and emits the valueChanged() signals; if you need additional processing, either reimplement this or connect to one of the valueChanged() signals.

Reimplementado de QRangeControl.

virtual void QSpinBox::valueChange ( ) [protected, virtual]

This virtual function is called whenever the range control value changes. You can reimplement it if you want to be notified when the value changes. The default implementation does nothing.

Note that this method is called after the value has changed. The previous value can be retrieved using prevValue().

Ver también:
setValue(), addPage(), subtractPage(), addLine(), subtractLine() rangeChange(), stepChange()

Reimplementado de QRangeControl.

void QSpinBox::valueChanged ( const QString valueText) [signal]
void QSpinBox::valueChanged ( int  value) [signal]

This signal is emitted every time the value of the spin box changes; the new value is passed in value. This signal will be emitted as a result of a call to setValue(), or because the user changed the value by using a keyboard accelerator or mouse click, etc.

Note that the valueChanged() signal is emitted every time, not just for the "last" step; i.e. if the user clicks "up" three times, this signal is emitted three times.

Ver también:
value()
void QSpinBox::valueChanged ( int  value) [signal]
void QSpinBox::valueChanged ( const QString valueText) [signal]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. This signal is emitted whenever the valueChanged( int ) signal is emitted, i.e. every time the value of the spin box changes (whatever the cause, e.g. by setValue(), by a keyboard accelerator, by mouse clicks, etc.).

The valueText parameter is the same string that is displayed in the edit field of the spin box.

Ver también:
value() prefix() suffix() specialValueText()
void QSpinBox::wheelEvent ( QWheelEvent e) [protected, virtual]

Reimplementado de QWidget.

void QSpinBox::wheelEvent ( QWheelEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive wheel events for the widget.

If you reimplement this handler, it is very important that you ignore() the event if you do not handle it, so that the widget's parent can interpret it.

The default implementation ignores the event.

Ver también:
QWheelEvent::ignore(), QWheelEvent::accept(), event(), QWheelEvent

Reimplementado de QWidget.

bool QSpinBox::wrapping ( ) const
bool QSpinBox::wrapping ( ) const

Documentación de propiedades

ButtonSymbols QSpinBox::buttonSymbols [read, write]

the current button symbol mode

The possible values can be either UpDownArrows or PlusMinus. The default is UpDownArrows.

Ver también:
ButtonSymbols
QString QSpinBox::cleanText [read]

the spin box's text with no prefix(), suffix() or leading or trailing whitespace.

Ver también:
text, prefix, suffix
int QSpinBox::lineStep [read, write]

the line step

When the user uses the arrows to change the spin box's value the value will be incremented/decremented by the amount of the line step.

The setLineStep() function calls the virtual stepChange() function if the new line step is different from the previous setting.

Ver también:
QRangeControl::setSteps() setRange()
int QSpinBox::maxValue [read, write]

the maximum value of the spin box

When setting this property, QSpinBox::minValue is adjusted, if necessary, to ensure that the range remains valid.

Ver también:
setRange() setSpecialValueText()
int QSpinBox::minValue [read, write]

the minimum value of the spin box

When setting this property, QSpinBox::maxValue is adjusted, if necessary, to ensure that the range remains valid.

Ver también:
setRange() setSpecialValueText()
QString QSpinBox::prefix [read, write]

the spin box's prefix

The prefix is prepended to the start of the displayed value. Typical use is to display a unit of measurement or a currency symbol. For example:

        sb->setPrefix( "$" );

To turn off the prefix display, set this property to an empty string. The default is no prefix. The prefix is not displayed for the minValue() if specialValueText() is not empty.

If no prefix is set, prefix() returns QString::null.

Ver también:
suffix()
QString QSpinBox::specialValueText [read, write]

the special-value text

If set, the spin box will display this text instead of a numeric value whenever the current value is equal to minVal(). Typical use is to indicate that this choice has a special (default) meaning.

For example, if your spin box allows the user to choose the margin width in a print dialog and your application is able to automatically choose a good margin width, you can set up the spin box like this:

        QSpinBox marginBox( -1, 20, 1, parent, "marginBox" );
        marginBox->setSuffix( " mm" );
        marginBox->setSpecialValueText( "Auto" );

The user will then be able to choose a margin width from 0-20 millimeters or select "Auto" to leave it to the application to choose. Your code must then interpret the spin box value of -1 as the user requesting automatic margin width.

All values are displayed with the prefix() and suffix() (if set), except for the special value, which only shows the special value text.

To turn off the special-value text display, call this function with an empty string. The default is no special-value text, i.e. the numeric value is shown as usual.

If no special-value text is set, specialValueText() returns QString::null.

QString QSpinBox::suffix [read, write]

the suffix of the spin box

The suffix is appended to the end of the displayed value. Typical use is to display a unit of measurement or a currency symbol. For example:

        sb->setSuffix( " km" );

To turn off the suffix display, set this property to an empty string. The default is no suffix. The suffix is not displayed for the minValue() if specialValueText() is not empty.

If no suffix is set, suffix() returns a QString::null.

Ver también:
prefix()
QString QSpinBox::text [read]

the spin box's text, including any prefix() and suffix()

There is no default text.

Ver también:
value()
int QSpinBox::value [read, write]

the value of the spin box

Ver también:
QRangeControl::setValue()
bool QSpinBox::wrapping [read, write]

whether it is possible to step the value from the highest value to the lowest value and vice versa

By default, wrapping is turned off.

If you have a range of 0..100 and wrapping is off when the user reaches 100 and presses the Up Arrow nothing will happen; but if wrapping is on the value will change from 100 to 0, then to 1, etc. When wrapping is on, navigating past the highest value takes you to the lowest and vice versa.

Ver también:
minValue, maxValue, setRange()

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'