1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** package.
|
---|
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 | **
|
---|
36 | ** If you are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department at [email protected].
|
---|
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 |
|
---|
125 | virtual QValidator::State validate(QString &input, int &pos) const;
|
---|
126 | virtual void fixup(QString &input) const;
|
---|
127 |
|
---|
128 | virtual void stepBy(int steps);
|
---|
129 | public Q_SLOTS:
|
---|
130 | void stepUp();
|
---|
131 | void stepDown();
|
---|
132 | void selectAll();
|
---|
133 | virtual void clear();
|
---|
134 | protected:
|
---|
135 | void resizeEvent(QResizeEvent *event);
|
---|
136 | void keyPressEvent(QKeyEvent *event);
|
---|
137 | void keyReleaseEvent(QKeyEvent *event);
|
---|
138 | void wheelEvent(QWheelEvent *event);
|
---|
139 | void focusInEvent(QFocusEvent *event);
|
---|
140 | void focusOutEvent(QFocusEvent *event);
|
---|
141 | void contextMenuEvent(QContextMenuEvent *event);
|
---|
142 | void changeEvent(QEvent *event);
|
---|
143 | void closeEvent(QCloseEvent *event);
|
---|
144 | void hideEvent(QHideEvent *event);
|
---|
145 | void mousePressEvent(QMouseEvent *event);
|
---|
146 | void mouseReleaseEvent(QMouseEvent *event);
|
---|
147 | void mouseMoveEvent(QMouseEvent *event);
|
---|
148 | void timerEvent(QTimerEvent *event);
|
---|
149 | void paintEvent(QPaintEvent *event);
|
---|
150 | void showEvent(QShowEvent *event);
|
---|
151 | void initStyleOption(QStyleOptionSpinBox *option) const;
|
---|
152 |
|
---|
153 | QLineEdit *lineEdit() const;
|
---|
154 | void setLineEdit(QLineEdit *edit);
|
---|
155 |
|
---|
156 | virtual StepEnabled stepEnabled() const;
|
---|
157 | Q_SIGNALS:
|
---|
158 | void editingFinished();
|
---|
159 | protected:
|
---|
160 | QAbstractSpinBox(QAbstractSpinBoxPrivate &dd, QWidget *parent = 0);
|
---|
161 |
|
---|
162 | private:
|
---|
163 | Q_PRIVATE_SLOT(d_func(), void _q_editorTextChanged(const QString &))
|
---|
164 | Q_PRIVATE_SLOT(d_func(), void _q_editorCursorPositionChanged(int, int))
|
---|
165 |
|
---|
166 | Q_DECLARE_PRIVATE(QAbstractSpinBox)
|
---|
167 | Q_DISABLE_COPY(QAbstractSpinBox)
|
---|
168 | };
|
---|
169 | Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSpinBox::StepEnabled)
|
---|
170 |
|
---|
171 | #endif // QT_NO_SPINBOX
|
---|
172 |
|
---|
173 | QT_END_NAMESPACE
|
---|
174 |
|
---|
175 | QT_END_HEADER
|
---|
176 |
|
---|
177 | #endif // QABSTRACTSPINBOX_H
|
---|