- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# qabstractspinbox.h

Go to the documentation of this file.

    00001 /****************************************************************************
    00002 **
    00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    00004 ** All rights reserved.
    00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
    00006 **
    00007 ** This file is part of the QtGui module of the Qt Toolkit.
    00008 **
    00009 ** $QT_BEGIN_LICENSE:LGPL$
    00010 ** Commercial Usage
    00011 ** Licensees holding valid Qt Commercial licenses may use this file in
    00012 ** accordance with the Qt Commercial License Agreement provided with the
    00013 ** Software or, alternatively, in accordance with the terms contained in
    00014 ** a written agreement between you and Nokia.
    00015 **
    00016 ** GNU Lesser General Public License Usage
    00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
    00018 ** General Public License version 2.1 as published by the Free Software
    00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
    00020 ** packaging of this file.  Please review the following information to
    00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
    00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    00023 **
    00024 ** In addition, as a special exception, Nokia gives you certain additional
    00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
    00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
    00027 **
    00028 ** GNU General Public License Usage
    00029 ** Alternatively, this file may be used under the terms of the GNU
    00030 ** General Public License version 3.0 as published by the Free Software
    00031 ** Foundation and appearing in the file LICENSE.GPL included in the
    00032 ** packaging of this file.  Please review the following information to
    00033 ** ensure the GNU General Public License version 3.0 requirements will be
    00034 ** met: http://www.gnu.org/copyleft/gpl.html.
    00035 **
    00036 ** If you have questions regarding the use of this file, please contact
    00037 ** Nokia at qt-info@nokia.com.
    00038 ** $QT_END_LICENSE$
    00039 **
    00040 ****************************************************************************/
    00041
    00042 #ifndef QABSTRACTSPINBOX_H
    00043 #define QABSTRACTSPINBOX_H
    00044
    00045 #include <QtGui/qwidget.h>
    00046 #include <QtGui/qvalidator.h>
    00047
    00048 QT_BEGIN_HEADER
    00049
    00050 QT_BEGIN_NAMESPACE
    00051
    00052 QT_MODULE(Gui)
    00053
    00054 #ifndef QT_NO_SPINBOX
    00055
    00056 class QLineEdit;
    00057
    00058 class QAbstractSpinBoxPrivate;
    00059 class QStyleOptionSpinBox;
    00060
    00061 class Q_GUI_EXPORT QAbstractSpinBox : public QWidget
    00062 {
    00063     Q_OBJECT
    00064
    00065     Q_ENUMS(ButtonSymbols)
    00066     Q_ENUMS(CorrectionMode)
    00067     Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping)
    00068     Q_PROPERTY(bool frame READ hasFrame WRITE setFrame)
    00069     Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
    00070     Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
    00071     Q_PROPERTY(ButtonSymbols buttonSymbols READ buttonSymbols WRITE setButtonSymbols)
    00072     Q_PROPERTY(QString specialValueText READ specialValueText WRITE setSpecialValueText)
    00073     Q_PROPERTY(QString text READ text)
    00074     Q_PROPERTY(bool accelerated READ isAccelerated WRITE setAccelerated)
    00075     Q_PROPERTY(CorrectionMode correctionMode READ correctionMode WRITE setCorrectionMode)
    00076     Q_PROPERTY(bool acceptableInput READ hasAcceptableInput)
    00077     Q_PROPERTY(bool keyboardTracking READ keyboardTracking WRITE setKeyboardTracking)
    00078 public:
    00079     explicit QAbstractSpinBox(QWidget *parent = 0);
    00080     ~QAbstractSpinBox();
    00081
    00082     enum StepEnabledFlag { StepNone = 0x00, StepUpEnabled = 0x01,
    00083                            StepDownEnabled = 0x02 };
    00084     Q_DECLARE_FLAGS(StepEnabled, StepEnabledFlag)
    00085
    00086     enum ButtonSymbols { UpDownArrows, PlusMinus, NoButtons };
    00087
    00088     ButtonSymbols buttonSymbols() const;
    00089     void setButtonSymbols(ButtonSymbols bs);
    00090
    00091     enum CorrectionMode  { CorrectToPreviousValue, CorrectToNearestValue };
    00092
    00093     void setCorrectionMode(CorrectionMode cm);
    00094     CorrectionMode correctionMode() const;
    00095
    00096     bool hasAcceptableInput() const;
    00097     QString text() const;
    00098
    00099     QString specialValueText() const;
    00100     void setSpecialValueText(const QString &txt);
    00101
    00102     bool wrapping() const;
    00103     void setWrapping(bool w);
    00104
    00105     void setReadOnly(bool r);
    00106     bool isReadOnly() const;
    00107
    00108     void setKeyboardTracking(bool kt);
    00109     bool keyboardTracking() const;
    00110
    00111     void setAlignment(Qt::Alignment flag);
    00112     Qt::Alignment alignment() const;
    00113
    00114     void setFrame(bool);
    00115     bool hasFrame() const;
    00116
    00117     void setAccelerated(bool on);
    00118     bool isAccelerated() const;
    00119
    00120     QSize sizeHint() const;
    00121     QSize minimumSizeHint() const;
    00122     void interpretText();
    00123     bool event(QEvent *event);
    00124
    00125     QVariant inputMethodQuery(Qt::InputMethodQuery) const;
    00126
    00127     virtual QValidator::State validate(QString &input, int &pos) const;
    00128     virtual void fixup(QString &input) const;
    00129
    00130     virtual void stepBy(int steps);
    00131 public Q_SLOTS:
    00132     void stepUp();
    00133     void stepDown();
    00134     void selectAll();
    00135     virtual void clear();
    00136 protected:
    00137     void resizeEvent(QResizeEvent *event);
    00138     void keyPressEvent(QKeyEvent *event);
    00139     void keyReleaseEvent(QKeyEvent *event);
    00140 #ifndef QT_NO_WHEELEVENT
    00141     void wheelEvent(QWheelEvent *event);
    00142 #endif
    00143     void focusInEvent(QFocusEvent *event);
    00144     void focusOutEvent(QFocusEvent *event);
    00145     void contextMenuEvent(QContextMenuEvent *event);
    00146     void changeEvent(QEvent *event);
    00147     void closeEvent(QCloseEvent *event);
    00148     void hideEvent(QHideEvent *event);
    00149     void mousePressEvent(QMouseEvent *event);
    00150     void mouseReleaseEvent(QMouseEvent *event);
    00151     void mouseMoveEvent(QMouseEvent *event);
    00152     void timerEvent(QTimerEvent *event);
    00153     void paintEvent(QPaintEvent *event);
    00154     void showEvent(QShowEvent *event);
    00155     void initStyleOption(QStyleOptionSpinBox *option) const;
    00156
    00157     QLineEdit *lineEdit() const;
    00158     void setLineEdit(QLineEdit *edit);
    00159
    00160     virtual StepEnabled stepEnabled() const;
    00161 Q_SIGNALS:
    00162     void editingFinished();
    00163 protected:
    00164     QAbstractSpinBox(QAbstractSpinBoxPrivate &dd, QWidget *parent = 0);
    00165
    00166 private:
    00167     Q_PRIVATE_SLOT(d_func(), void _q_editorTextChanged(const QString &))
    00168     Q_PRIVATE_SLOT(d_func(), void _q_editorCursorPositionChanged(int, int))
    00169
    00170     Q_DECLARE_PRIVATE(QAbstractSpinBox)
    00171     Q_DISABLE_COPY(QAbstractSpinBox)
    00172 };
    00173 Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSpinBox::StepEnabled)
    00174
    00175 #endif // QT_NO_SPINBOX
    00176
    00177 QT_END_NAMESPACE
    00178
    00179 QT_END_HEADER
    00180
    00181 #endif // QABSTRACTSPINBOX_H