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 QSPINBOX_H
|
---|
43 | #define QSPINBOX_H
|
---|
44 |
|
---|
45 | #include <QtGui/qabstractspinbox.h>
|
---|
46 |
|
---|
47 | QT_BEGIN_HEADER
|
---|
48 |
|
---|
49 | QT_BEGIN_NAMESPACE
|
---|
50 |
|
---|
51 | QT_MODULE(Gui)
|
---|
52 |
|
---|
53 | #ifndef QT_NO_SPINBOX
|
---|
54 |
|
---|
55 | class QSpinBoxPrivate;
|
---|
56 | class Q_GUI_EXPORT QSpinBox : public QAbstractSpinBox
|
---|
57 | {
|
---|
58 | Q_OBJECT
|
---|
59 |
|
---|
60 | Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
|
---|
61 | Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
|
---|
62 | Q_PROPERTY(QString cleanText READ cleanText)
|
---|
63 | Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
|
---|
64 | Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
|
---|
65 | Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep)
|
---|
66 | Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged USER true)
|
---|
67 |
|
---|
68 | public:
|
---|
69 | explicit QSpinBox(QWidget *parent = 0);
|
---|
70 | #ifdef QT3_SUPPORT
|
---|
71 | QT3_SUPPORT_CONSTRUCTOR QSpinBox(QWidget *parent, const char *name);
|
---|
72 | QT3_SUPPORT_CONSTRUCTOR QSpinBox(int min, int max, int step, QWidget *parent,
|
---|
73 | const char *name = 0);
|
---|
74 | #endif
|
---|
75 |
|
---|
76 | int value() const;
|
---|
77 |
|
---|
78 | QString prefix() const;
|
---|
79 | void setPrefix(const QString &prefix);
|
---|
80 |
|
---|
81 | QString suffix() const;
|
---|
82 | void setSuffix(const QString &suffix);
|
---|
83 |
|
---|
84 | QString cleanText() const;
|
---|
85 |
|
---|
86 | int singleStep() const;
|
---|
87 | void setSingleStep(int val);
|
---|
88 |
|
---|
89 | int minimum() const;
|
---|
90 | void setMinimum(int min);
|
---|
91 |
|
---|
92 | int maximum() const;
|
---|
93 | void setMaximum(int max);
|
---|
94 |
|
---|
95 | void setRange(int min, int max);
|
---|
96 |
|
---|
97 | #ifdef QT3_SUPPORT
|
---|
98 | inline QT3_SUPPORT void setLineStep(int step) { setSingleStep(step); }
|
---|
99 | inline QT3_SUPPORT void setMaxValue(int val) { setMaximum(val); }
|
---|
100 | inline QT3_SUPPORT void setMinValue(int val) { setMinimum(val); }
|
---|
101 | inline QT3_SUPPORT int maxValue() const { return maximum(); }
|
---|
102 | inline QT3_SUPPORT int minValue() const { return minimum(); }
|
---|
103 | #endif
|
---|
104 |
|
---|
105 | protected:
|
---|
106 | bool event(QEvent *event);
|
---|
107 | virtual QValidator::State validate(QString &input, int &pos) const;
|
---|
108 | virtual int valueFromText(const QString &text) const;
|
---|
109 | virtual QString textFromValue(int val) const;
|
---|
110 | virtual void fixup(QString &str) const;
|
---|
111 |
|
---|
112 |
|
---|
113 | public Q_SLOTS:
|
---|
114 | void setValue(int val);
|
---|
115 |
|
---|
116 | Q_SIGNALS:
|
---|
117 | void valueChanged(int);
|
---|
118 | void valueChanged(const QString &);
|
---|
119 |
|
---|
120 | private:
|
---|
121 | Q_DISABLE_COPY(QSpinBox)
|
---|
122 | Q_DECLARE_PRIVATE(QSpinBox)
|
---|
123 | };
|
---|
124 |
|
---|
125 | class QDoubleSpinBoxPrivate;
|
---|
126 | class Q_GUI_EXPORT QDoubleSpinBox : public QAbstractSpinBox
|
---|
127 | {
|
---|
128 | Q_OBJECT
|
---|
129 |
|
---|
130 | Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
|
---|
131 | Q_PROPERTY(QString suffix READ suffix WRITE setSuffix)
|
---|
132 | Q_PROPERTY(QString cleanText READ cleanText)
|
---|
133 | Q_PROPERTY(int decimals READ decimals WRITE setDecimals)
|
---|
134 | Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
|
---|
135 | Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
|
---|
136 | Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
|
---|
137 | Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged USER true)
|
---|
138 | public:
|
---|
139 | explicit QDoubleSpinBox(QWidget *parent = 0);
|
---|
140 |
|
---|
141 | double value() const;
|
---|
142 |
|
---|
143 | QString prefix() const;
|
---|
144 | void setPrefix(const QString &prefix);
|
---|
145 |
|
---|
146 | QString suffix() const;
|
---|
147 | void setSuffix(const QString &suffix);
|
---|
148 |
|
---|
149 | QString cleanText() const;
|
---|
150 |
|
---|
151 | double singleStep() const;
|
---|
152 | void setSingleStep(double val);
|
---|
153 |
|
---|
154 | double minimum() const;
|
---|
155 | void setMinimum(double min);
|
---|
156 |
|
---|
157 | double maximum() const;
|
---|
158 | void setMaximum(double max);
|
---|
159 |
|
---|
160 | void setRange(double min, double max);
|
---|
161 |
|
---|
162 | int decimals() const;
|
---|
163 | void setDecimals(int prec);
|
---|
164 |
|
---|
165 | virtual QValidator::State validate(QString &input, int &pos) const;
|
---|
166 | virtual double valueFromText(const QString &text) const;
|
---|
167 | virtual QString textFromValue(double val) const;
|
---|
168 | virtual void fixup(QString &str) const;
|
---|
169 |
|
---|
170 | public Q_SLOTS:
|
---|
171 | void setValue(double val);
|
---|
172 |
|
---|
173 | Q_SIGNALS:
|
---|
174 | void valueChanged(double);
|
---|
175 | void valueChanged(const QString &);
|
---|
176 |
|
---|
177 | private:
|
---|
178 | Q_DISABLE_COPY(QDoubleSpinBox)
|
---|
179 | Q_DECLARE_PRIVATE(QDoubleSpinBox)
|
---|
180 | };
|
---|
181 |
|
---|
182 | #endif // QT_NO_SPINBOX
|
---|
183 |
|
---|
184 | QT_END_NAMESPACE
|
---|
185 |
|
---|
186 | QT_END_HEADER
|
---|
187 |
|
---|
188 | #endif // QSPINBOX_H
|
---|