1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the widgets module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#ifndef QABSTRACTSPINBOX_P_H
30
#define QABSTRACTSPINBOX_P_H
36
// This file is not part of the Qt API. It exists purely as an
37
// implementation detail. This header file may change from version to
38
// version without notice, or even be removed.
43
#include "qabstractspinbox.h"
44
#include <qlineedit.h>
45
#include <qstyleoption.h>
46
#include <qdatetime.h>
48
#include <qvalidator.h>
49
#include <private/qwidget_p.h>
51
bool operator<(const QVariant &arg1, const QVariant &arg2);
52
bool operator>(const QVariant &arg1, const QVariant &arg2);
53
bool operator<=(const QVariant &arg1, const QVariant &arg2);
54
bool operator>=(const QVariant &arg1, const QVariant &arg2);
55
QVariant operator+(const QVariant &arg1, const QVariant &arg2);
56
QVariant operator-(const QVariant &arg1, const QVariant &arg2);
57
QVariant operator*(const QVariant &arg1, double multiplier);
58
double operator/(const QVariant &arg1, const QVariant &arg2);
60
#define TIME_MIN QTime(0, 0, 0, 0)
61
#define TIME_MAX QTime(23, 59, 59, 999)
62
#define DATE_MIN QDate(1752, 9, 14)
63
#define DATE_MAX QDate(7999, 12, 31)
64
#define DATETIME_MIN QDateTime(DATE_MIN, TIME_MIN)
65
#define DATETIME_MAX QDateTime(DATE_MAX, TIME_MAX)
66
#define DATE_INITIAL QDate(2000, 1, 1)
88
class QSpinBoxValidator;
89
class QAbstractSpinBoxPrivate : public QWidgetPrivate
91
Q_DECLARE_PUBLIC(QAbstractSpinBox)
93
QAbstractSpinBoxPrivate();
94
~QAbstractSpinBoxPrivate();
98
void updateState(bool up);
99
QString stripped(const QString &text) const;
100
bool specialValue() const;
101
QVariant getZeroVariant() const;
102
void setBoundary(Boundary b, const QVariant &val);
103
void setValue(const QVariant &val, EmitPolicy ep, bool updateEdit = true);
104
virtual QVariant bound(const QVariant &val, const QVariant &old = QVariant(), int steps = 0) const;
105
QLineEdit *lineEdit();
106
void updateSpinBox();
108
void updateEdit() const;
110
virtual QStyleOptionSpinBox getStyleOption() const;
112
virtual void emitSignals(EmitPolicy ep, const QVariant &old);
113
virtual void interpret(EmitPolicy ep);
114
virtual QString textFromValue(const QVariant &n) const;
115
virtual QVariant valueFromText(const QString &input) const;
117
void editorTextChanged(const QString &);
118
virtual void editorCursorPositionChanged(int oldpos, int newpos);
120
QStyle::SubControl newHoverControl(const QPoint &pos);
121
bool updateHoverControl(const QPoint &pos);
124
QString prefix, suffix, specialValueText;
125
QVariant value, minimum, maximum, singleStep;
127
int spinClickTimerId, spinClickTimerInterval;
129
mutable uint dirty : 1;
130
mutable QString cachedText;
131
mutable QVariant cachedValue;
132
mutable QValidator::State cachedState;
133
uint pendingEmit : 1;
134
uint spindownEnabled : 1;
135
uint spinupEnabled : 1;
138
uint ignoreCursorPositionChanged : 1;
140
QStyle::SubControl hoverControl;
142
QAbstractSpinBox::ButtonSymbols buttonSymbols;
143
QSpinBoxValidator *validator;
146
class QSpinBoxValidator : public QValidator
149
QSpinBoxValidator(QAbstractSpinBox *qptr, QAbstractSpinBoxPrivate *dptr);
150
QValidator::State validate(QString &input, int &) const;
151
void fixup(QString &) const;
153
QAbstractSpinBox *qptr;
154
QAbstractSpinBoxPrivate *dptr;
157
#endif // QABSTRACTSPINBOX_P_H