author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 02 Feb 2010 00:43:10 +0200 | |
changeset 3 | 41300fa6a67c |
parent 0 | 1918ee327afb |
child 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
** All rights reserved. |
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
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 |
** |
|
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. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QABSTRACTSPINBOX_P_H |
|
43 |
#define QABSTRACTSPINBOX_P_H |
|
44 |
||
45 |
// |
|
46 |
// W A R N I N G |
|
47 |
// ------------- |
|
48 |
// |
|
49 |
// This file is not part of the Qt API. It exists purely as an |
|
50 |
// implementation detail. This header file may change from version to |
|
51 |
// version without notice, or even be removed. |
|
52 |
// |
|
53 |
// We mean it. |
|
54 |
// |
|
55 |
||
56 |
#include "QtGui/qabstractspinbox.h" |
|
57 |
||
58 |
#ifndef QT_NO_SPINBOX |
|
59 |
||
60 |
#include "QtGui/qlineedit.h" |
|
61 |
#include "QtGui/qstyleoption.h" |
|
62 |
#include "QtGui/qvalidator.h" |
|
63 |
#include "QtCore/qdatetime.h" |
|
64 |
#include "QtCore/qvariant.h" |
|
65 |
#include "private/qwidget_p.h" |
|
66 |
#include "private/qdatetime_p.h" |
|
67 |
||
68 |
QT_BEGIN_NAMESPACE |
|
69 |
||
70 |
QVariant operator+(const QVariant &arg1, const QVariant &arg2); |
|
71 |
QVariant operator-(const QVariant &arg1, const QVariant &arg2); |
|
72 |
QVariant operator*(const QVariant &arg1, double multiplier); |
|
73 |
double operator/(const QVariant &arg1, const QVariant &arg2); |
|
74 |
||
75 |
enum EmitPolicy { |
|
76 |
EmitIfChanged, |
|
77 |
AlwaysEmit, |
|
78 |
NeverEmit |
|
79 |
}; |
|
80 |
||
81 |
enum Button { |
|
82 |
None = 0x000, |
|
83 |
Keyboard = 0x001, |
|
84 |
Mouse = 0x002, |
|
85 |
Wheel = 0x004, |
|
86 |
ButtonMask = 0x008, |
|
87 |
Up = 0x010, |
|
88 |
Down = 0x020, |
|
89 |
DirectionMask = 0x040 |
|
90 |
}; |
|
91 |
class QSpinBoxValidator; |
|
92 |
class QAbstractSpinBoxPrivate : public QWidgetPrivate |
|
93 |
{ |
|
94 |
Q_DECLARE_PUBLIC(QAbstractSpinBox) |
|
95 |
public: |
|
96 |
QAbstractSpinBoxPrivate(); |
|
97 |
~QAbstractSpinBoxPrivate(); |
|
98 |
||
99 |
void init(); |
|
100 |
void reset(); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
101 |
void updateState(bool up, bool fromKeyboard = false); |
0 | 102 |
QString stripped(const QString &text, int *pos = 0) const; |
103 |
bool specialValue() const; |
|
104 |
virtual QVariant getZeroVariant() const; |
|
105 |
virtual void setRange(const QVariant &min, const QVariant &max); |
|
106 |
void setValue(const QVariant &val, EmitPolicy ep, bool updateEdit = true); |
|
107 |
virtual QVariant bound(const QVariant &val, const QVariant &old = QVariant(), int steps = 0) const; |
|
108 |
virtual void updateEdit(); |
|
109 |
||
110 |
virtual void emitSignals(EmitPolicy ep, const QVariant &old); |
|
111 |
virtual void interpret(EmitPolicy ep); |
|
112 |
virtual QString textFromValue(const QVariant &n) const; |
|
113 |
virtual QVariant valueFromText(const QString &input) const; |
|
114 |
||
115 |
void _q_editorTextChanged(const QString &); |
|
116 |
virtual void _q_editorCursorPositionChanged(int oldpos, int newpos); |
|
117 |
||
118 |
virtual QStyle::SubControl newHoverControl(const QPoint &pos); |
|
119 |
bool updateHoverControl(const QPoint &pos); |
|
120 |
||
121 |
virtual void clearCache() const; |
|
122 |
virtual void updateEditFieldGeometry(); |
|
123 |
||
124 |
static int variantCompare(const QVariant &arg1, const QVariant &arg2); |
|
125 |
static QVariant variantBound(const QVariant &min, const QVariant &value, const QVariant &max); |
|
126 |
||
127 |
QLineEdit *edit; |
|
128 |
QString prefix, suffix, specialValueText; |
|
129 |
QVariant value, minimum, maximum, singleStep; |
|
130 |
QVariant::Type type; |
|
131 |
int spinClickTimerId, spinClickTimerInterval, spinClickThresholdTimerId, spinClickThresholdTimerInterval; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
132 |
int effectiveSpinRepeatRate; |
0 | 133 |
uint buttonState; |
134 |
mutable QString cachedText; |
|
135 |
mutable QVariant cachedValue; |
|
136 |
mutable QValidator::State cachedState; |
|
137 |
mutable QSize cachedSizeHint, cachedMinimumSizeHint; |
|
138 |
uint pendingEmit : 1; |
|
139 |
uint readOnly : 1; |
|
140 |
uint wrapping : 1; |
|
141 |
uint ignoreCursorPositionChanged : 1; |
|
142 |
uint frame : 1; |
|
143 |
uint accelerate : 1; |
|
144 |
uint keyboardTracking : 1; |
|
145 |
uint cleared : 1; |
|
146 |
uint ignoreUpdateEdit : 1; |
|
147 |
QAbstractSpinBox::CorrectionMode correctionMode; |
|
148 |
int acceleration; |
|
149 |
QStyle::SubControl hoverControl; |
|
150 |
QRect hoverRect; |
|
151 |
QAbstractSpinBox::ButtonSymbols buttonSymbols; |
|
152 |
QSpinBoxValidator *validator; |
|
153 |
}; |
|
154 |
||
155 |
class QSpinBoxValidator : public QValidator |
|
156 |
{ |
|
157 |
public: |
|
158 |
QSpinBoxValidator(QAbstractSpinBox *qptr, QAbstractSpinBoxPrivate *dptr); |
|
159 |
QValidator::State validate(QString &input, int &) const; |
|
160 |
void fixup(QString &) const; |
|
161 |
private: |
|
162 |
QAbstractSpinBox *qptr; |
|
163 |
QAbstractSpinBoxPrivate *dptr; |
|
164 |
}; |
|
165 |
||
166 |
QT_END_NAMESPACE |
|
167 |
||
168 |
#endif // QT_NO_SPINBOX |
|
169 |
||
170 |
#endif // QABSTRACTSPINBOX_P_H |