[2] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
[846] | 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
[561] | 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
---|
[2] | 6 | **
|
---|
| 7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
| 8 | **
|
---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
| 10 | ** Commercial Usage
|
---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
| 14 | ** a written agreement between you and Nokia.
|
---|
| 15 | **
|
---|
| 16 | ** GNU Lesser General Public License Usage
|
---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
| 20 | ** packaging of this file. Please review the following information to
|
---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
| 23 | **
|
---|
[561] | 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
[2] | 27 | **
|
---|
| 28 | ** GNU General Public License Usage
|
---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 32 | ** packaging of this file. Please review the following information to
|
---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
| 35 | **
|
---|
[561] | 36 | ** If you have questions regarding the use of this file, please contact
|
---|
| 37 | ** Nokia at qt-info@nokia.com.
|
---|
[2] | 38 | ** $QT_END_LICENSE$
|
---|
| 39 | **
|
---|
| 40 | ****************************************************************************/
|
---|
| 41 |
|
---|
| 42 | #ifndef QABSTRACTSPINBOX_H
|
---|
| 43 | #define QABSTRACTSPINBOX_H
|
---|
| 44 |
|
---|
| 45 | #include <QtGui/qwidget.h>
|
---|
| 46 | #include <QtGui/qvalidator.h>
|
---|
| 47 |
|
---|
| 48 | QT_BEGIN_HEADER
|
---|
| 49 |
|
---|
| 50 | QT_BEGIN_NAMESPACE
|
---|
| 51 |
|
---|
| 52 | QT_MODULE(Gui)
|
---|
| 53 |
|
---|
| 54 | #ifndef QT_NO_SPINBOX
|
---|
| 55 |
|
---|
| 56 | class QLineEdit;
|
---|
| 57 |
|
---|
| 58 | class QAbstractSpinBoxPrivate;
|
---|
| 59 | class QStyleOptionSpinBox;
|
---|
| 60 |
|
---|
| 61 | class Q_GUI_EXPORT QAbstractSpinBox : public QWidget
|
---|
| 62 | {
|
---|
| 63 | Q_OBJECT
|
---|
| 64 |
|
---|
| 65 | Q_ENUMS(ButtonSymbols)
|
---|
| 66 | Q_ENUMS(CorrectionMode)
|
---|
| 67 | Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping)
|
---|
| 68 | Q_PROPERTY(bool frame READ hasFrame WRITE setFrame)
|
---|
| 69 | Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
|
---|
| 70 | Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
|
---|
| 71 | Q_PROPERTY(ButtonSymbols buttonSymbols READ buttonSymbols WRITE setButtonSymbols)
|
---|
| 72 | Q_PROPERTY(QString specialValueText READ specialValueText WRITE setSpecialValueText)
|
---|
| 73 | Q_PROPERTY(QString text READ text)
|
---|
| 74 | Q_PROPERTY(bool accelerated READ isAccelerated WRITE setAccelerated)
|
---|
| 75 | Q_PROPERTY(CorrectionMode correctionMode READ correctionMode WRITE setCorrectionMode)
|
---|
| 76 | Q_PROPERTY(bool acceptableInput READ hasAcceptableInput)
|
---|
| 77 | Q_PROPERTY(bool keyboardTracking READ keyboardTracking WRITE setKeyboardTracking)
|
---|
| 78 | public:
|
---|
| 79 | explicit QAbstractSpinBox(QWidget *parent = 0);
|
---|
| 80 | ~QAbstractSpinBox();
|
---|
| 81 |
|
---|
| 82 | enum StepEnabledFlag { StepNone = 0x00, StepUpEnabled = 0x01,
|
---|
| 83 | StepDownEnabled = 0x02 };
|
---|
| 84 | Q_DECLARE_FLAGS(StepEnabled, StepEnabledFlag)
|
---|
| 85 |
|
---|
| 86 | enum ButtonSymbols { UpDownArrows, PlusMinus, NoButtons };
|
---|
| 87 |
|
---|
| 88 | ButtonSymbols buttonSymbols() const;
|
---|
| 89 | void setButtonSymbols(ButtonSymbols bs);
|
---|
| 90 |
|
---|
| 91 | enum CorrectionMode { CorrectToPreviousValue, CorrectToNearestValue };
|
---|
| 92 |
|
---|
| 93 | void setCorrectionMode(CorrectionMode cm);
|
---|
| 94 | CorrectionMode correctionMode() const;
|
---|
| 95 |
|
---|
| 96 | bool hasAcceptableInput() const;
|
---|
| 97 | QString text() const;
|
---|
| 98 |
|
---|
| 99 | QString specialValueText() const;
|
---|
| 100 | void setSpecialValueText(const QString &txt);
|
---|
| 101 |
|
---|
| 102 | bool wrapping() const;
|
---|
| 103 | void setWrapping(bool w);
|
---|
| 104 |
|
---|
| 105 | void setReadOnly(bool r);
|
---|
| 106 | bool isReadOnly() const;
|
---|
| 107 |
|
---|
| 108 | void setKeyboardTracking(bool kt);
|
---|
| 109 | bool keyboardTracking() const;
|
---|
| 110 |
|
---|
| 111 | void setAlignment(Qt::Alignment flag);
|
---|
| 112 | Qt::Alignment alignment() const;
|
---|
| 113 |
|
---|
| 114 | void setFrame(bool);
|
---|
| 115 | bool hasFrame() const;
|
---|
| 116 |
|
---|
| 117 | void setAccelerated(bool on);
|
---|
| 118 | bool isAccelerated() const;
|
---|
| 119 |
|
---|
| 120 | QSize sizeHint() const;
|
---|
| 121 | QSize minimumSizeHint() const;
|
---|
| 122 | void interpretText();
|
---|
| 123 | bool event(QEvent *event);
|
---|
| 124 |
|
---|
[561] | 125 | QVariant inputMethodQuery(Qt::InputMethodQuery) const;
|
---|
| 126 |
|
---|
[2] | 127 | virtual QValidator::State validate(QString &input, int &pos) const;
|
---|
| 128 | virtual void fixup(QString &input) const;
|
---|
| 129 |
|
---|
| 130 | virtual void stepBy(int steps);
|
---|
| 131 | public Q_SLOTS:
|
---|
| 132 | void stepUp();
|
---|
| 133 | void stepDown();
|
---|
| 134 | void selectAll();
|
---|
| 135 | virtual void clear();
|
---|
| 136 | protected:
|
---|
| 137 | void resizeEvent(QResizeEvent *event);
|
---|
| 138 | void keyPressEvent(QKeyEvent *event);
|
---|
| 139 | void keyReleaseEvent(QKeyEvent *event);
|
---|
[769] | 140 | #ifndef QT_NO_WHEELEVENT
|
---|
[2] | 141 | void wheelEvent(QWheelEvent *event);
|
---|
[769] | 142 | #endif
|
---|
[2] | 143 | void focusInEvent(QFocusEvent *event);
|
---|
| 144 | void focusOutEvent(QFocusEvent *event);
|
---|
| 145 | void contextMenuEvent(QContextMenuEvent *event);
|
---|
| 146 | void changeEvent(QEvent *event);
|
---|
| 147 | void closeEvent(QCloseEvent *event);
|
---|
| 148 | void hideEvent(QHideEvent *event);
|
---|
| 149 | void mousePressEvent(QMouseEvent *event);
|
---|
| 150 | void mouseReleaseEvent(QMouseEvent *event);
|
---|
| 151 | void mouseMoveEvent(QMouseEvent *event);
|
---|
| 152 | void timerEvent(QTimerEvent *event);
|
---|
| 153 | void paintEvent(QPaintEvent *event);
|
---|
| 154 | void showEvent(QShowEvent *event);
|
---|
| 155 | void initStyleOption(QStyleOptionSpinBox *option) const;
|
---|
| 156 |
|
---|
| 157 | QLineEdit *lineEdit() const;
|
---|
| 158 | void setLineEdit(QLineEdit *edit);
|
---|
| 159 |
|
---|
| 160 | virtual StepEnabled stepEnabled() const;
|
---|
| 161 | Q_SIGNALS:
|
---|
| 162 | void editingFinished();
|
---|
| 163 | protected:
|
---|
| 164 | QAbstractSpinBox(QAbstractSpinBoxPrivate &dd, QWidget *parent = 0);
|
---|
| 165 |
|
---|
| 166 | private:
|
---|
| 167 | Q_PRIVATE_SLOT(d_func(), void _q_editorTextChanged(const QString &))
|
---|
| 168 | Q_PRIVATE_SLOT(d_func(), void _q_editorCursorPositionChanged(int, int))
|
---|
| 169 |
|
---|
| 170 | Q_DECLARE_PRIVATE(QAbstractSpinBox)
|
---|
| 171 | Q_DISABLE_COPY(QAbstractSpinBox)
|
---|
| 172 | };
|
---|
| 173 | Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSpinBox::StepEnabled)
|
---|
| 174 |
|
---|
| 175 | #endif // QT_NO_SPINBOX
|
---|
| 176 |
|
---|
| 177 | QT_END_NAMESPACE
|
---|
| 178 |
|
---|
| 179 | QT_END_HEADER
|
---|
| 180 |
|
---|
| 181 | #endif // QABSTRACTSPINBOX_H
|
---|