author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 19 Feb 2010 23:40:16 +0200 | |
branch | RCL_3 |
changeset 4 | 3b1da2848fc7 |
parent 0 | 1918ee327afb |
child 37 | 758a864f9613 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 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 QDATETIMEEDIT_H |
|
43 |
#define QDATETIMEEDIT_H |
|
44 |
||
45 |
#include <QtCore/qdatetime.h> |
|
46 |
#include <QtCore/qvariant.h> |
|
47 |
#include <QtGui/qabstractspinbox.h> |
|
48 |
||
49 |
QT_BEGIN_HEADER |
|
50 |
||
51 |
QT_BEGIN_NAMESPACE |
|
52 |
||
53 |
QT_MODULE(Gui) |
|
54 |
||
55 |
#ifndef QT_NO_DATETIMEEDIT |
|
56 |
||
57 |
class QDateTimeEditPrivate; |
|
58 |
class QStyleOptionSpinBox; |
|
59 |
class QCalendarWidget; |
|
60 |
||
61 |
class Q_GUI_EXPORT QDateTimeEdit : public QAbstractSpinBox |
|
62 |
{ |
|
63 |
Q_OBJECT |
|
64 |
||
65 |
Q_ENUMS(Section) |
|
66 |
Q_FLAGS(Sections) |
|
67 |
Q_PROPERTY(QDateTime dateTime READ dateTime WRITE setDateTime NOTIFY dateTimeChanged USER true) |
|
68 |
Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged) |
|
69 |
Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged) |
|
70 |
Q_PROPERTY(QDateTime maximumDateTime READ maximumDateTime WRITE setMaximumDateTime RESET clearMaximumDateTime) |
|
71 |
Q_PROPERTY(QDateTime minimumDateTime READ minimumDateTime WRITE setMinimumDateTime RESET clearMinimumDateTime) |
|
72 |
Q_PROPERTY(QDate maximumDate READ maximumDate WRITE setMaximumDate RESET clearMaximumDate) |
|
73 |
Q_PROPERTY(QDate minimumDate READ minimumDate WRITE setMinimumDate RESET clearMinimumDate) |
|
74 |
Q_PROPERTY(QTime maximumTime READ maximumTime WRITE setMaximumTime RESET clearMaximumTime) |
|
75 |
Q_PROPERTY(QTime minimumTime READ minimumTime WRITE setMinimumTime RESET clearMinimumTime) |
|
76 |
Q_PROPERTY(Section currentSection READ currentSection WRITE setCurrentSection) |
|
77 |
Q_PROPERTY(Sections displayedSections READ displayedSections) |
|
78 |
Q_PROPERTY(QString displayFormat READ displayFormat WRITE setDisplayFormat) |
|
79 |
Q_PROPERTY(bool calendarPopup READ calendarPopup WRITE setCalendarPopup) |
|
80 |
Q_PROPERTY(int currentSectionIndex READ currentSectionIndex WRITE setCurrentSectionIndex) |
|
81 |
Q_PROPERTY(int sectionCount READ sectionCount) |
|
82 |
Q_PROPERTY(Qt::TimeSpec timeSpec READ timeSpec WRITE setTimeSpec) |
|
83 |
public: |
|
84 |
enum Section { |
|
85 |
NoSection = 0x0000, |
|
86 |
AmPmSection = 0x0001, |
|
87 |
MSecSection = 0x0002, |
|
88 |
SecondSection = 0x0004, |
|
89 |
MinuteSection = 0x0008, |
|
90 |
HourSection = 0x0010, |
|
91 |
DaySection = 0x0100, |
|
92 |
MonthSection = 0x0200, |
|
93 |
YearSection = 0x0400, |
|
94 |
TimeSections_Mask = AmPmSection|MSecSection|SecondSection|MinuteSection|HourSection, |
|
95 |
DateSections_Mask = DaySection|MonthSection|YearSection |
|
96 |
}; |
|
97 |
||
98 |
Q_DECLARE_FLAGS(Sections, Section) |
|
99 |
||
100 |
explicit QDateTimeEdit(QWidget *parent = 0); |
|
101 |
explicit QDateTimeEdit(const QDateTime &dt, QWidget *parent = 0); |
|
102 |
explicit QDateTimeEdit(const QDate &d, QWidget *parent = 0); |
|
103 |
explicit QDateTimeEdit(const QTime &t, QWidget *parent = 0); |
|
104 |
||
105 |
QDateTime dateTime() const; |
|
106 |
QDate date() const; |
|
107 |
QTime time() const; |
|
108 |
||
109 |
QDateTime minimumDateTime() const; |
|
110 |
void clearMinimumDateTime(); |
|
111 |
void setMinimumDateTime(const QDateTime &dt); |
|
112 |
||
113 |
QDateTime maximumDateTime() const; |
|
114 |
void clearMaximumDateTime(); |
|
115 |
void setMaximumDateTime(const QDateTime &dt); |
|
116 |
||
117 |
void setDateTimeRange(const QDateTime &min, const QDateTime &max); |
|
118 |
||
119 |
QDate minimumDate() const; |
|
120 |
void setMinimumDate(const QDate &min); |
|
121 |
void clearMinimumDate(); |
|
122 |
||
123 |
QDate maximumDate() const; |
|
124 |
void setMaximumDate(const QDate &max); |
|
125 |
void clearMaximumDate(); |
|
126 |
||
127 |
void setDateRange(const QDate &min, const QDate &max); |
|
128 |
||
129 |
QTime minimumTime() const; |
|
130 |
void setMinimumTime(const QTime &min); |
|
131 |
void clearMinimumTime(); |
|
132 |
||
133 |
QTime maximumTime() const; |
|
134 |
void setMaximumTime(const QTime &max); |
|
135 |
void clearMaximumTime(); |
|
136 |
||
137 |
void setTimeRange(const QTime &min, const QTime &max); |
|
138 |
||
139 |
Sections displayedSections() const; |
|
140 |
Section currentSection() const; |
|
141 |
Section sectionAt(int index) const; |
|
142 |
void setCurrentSection(Section section); |
|
143 |
||
144 |
int currentSectionIndex() const; |
|
145 |
void setCurrentSectionIndex(int index); |
|
146 |
||
147 |
QCalendarWidget *calendarWidget() const; |
|
148 |
void setCalendarWidget(QCalendarWidget *calendarWidget); |
|
149 |
||
150 |
int sectionCount() const; |
|
151 |
||
152 |
void setSelectedSection(Section section); |
|
153 |
||
154 |
QString sectionText(Section section) const; |
|
155 |
||
156 |
QString displayFormat() const; |
|
157 |
void setDisplayFormat(const QString &format); |
|
158 |
||
159 |
bool calendarPopup() const; |
|
160 |
void setCalendarPopup(bool enable); |
|
161 |
||
162 |
Qt::TimeSpec timeSpec() const; |
|
163 |
void setTimeSpec(Qt::TimeSpec spec); |
|
164 |
||
165 |
QSize sizeHint() const; |
|
166 |
||
167 |
virtual void clear(); |
|
168 |
virtual void stepBy(int steps); |
|
169 |
||
170 |
bool event(QEvent *event); |
|
171 |
Q_SIGNALS: |
|
172 |
void dateTimeChanged(const QDateTime &date); |
|
173 |
void timeChanged(const QTime &date); |
|
174 |
void dateChanged(const QDate &date); |
|
175 |
||
176 |
public Q_SLOTS: |
|
177 |
void setDateTime(const QDateTime &dateTime); |
|
178 |
void setDate(const QDate &date); |
|
179 |
void setTime(const QTime &time); |
|
180 |
||
181 |
protected: |
|
182 |
virtual void keyPressEvent(QKeyEvent *event); |
|
183 |
#ifndef QT_NO_WHEELEVENT |
|
184 |
virtual void wheelEvent(QWheelEvent *event); |
|
185 |
#endif |
|
186 |
virtual void focusInEvent(QFocusEvent *event); |
|
187 |
virtual bool focusNextPrevChild(bool next); |
|
188 |
virtual QValidator::State validate(QString &input, int &pos) const; |
|
189 |
virtual void fixup(QString &input) const; |
|
190 |
||
191 |
virtual QDateTime dateTimeFromText(const QString &text) const; |
|
192 |
virtual QString textFromDateTime(const QDateTime &dt) const; |
|
193 |
virtual StepEnabled stepEnabled() const; |
|
194 |
virtual void mousePressEvent(QMouseEvent *event); |
|
195 |
virtual void paintEvent(QPaintEvent *event); |
|
196 |
void initStyleOption(QStyleOptionSpinBox *option) const; |
|
197 |
||
198 |
QDateTimeEdit(const QVariant &val, QVariant::Type parserType, QWidget *parent = 0); |
|
199 |
private: |
|
200 |
Q_DECLARE_PRIVATE(QDateTimeEdit) |
|
201 |
Q_DISABLE_COPY(QDateTimeEdit) |
|
202 |
||
203 |
Q_PRIVATE_SLOT(d_func(), void _q_resetButton()) |
|
204 |
}; |
|
205 |
||
206 |
class Q_GUI_EXPORT QTimeEdit : public QDateTimeEdit |
|
207 |
{ |
|
208 |
Q_OBJECT |
|
209 |
Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged USER true) |
|
210 |
public: |
|
211 |
QTimeEdit(QWidget *parent = 0); |
|
212 |
QTimeEdit(const QTime &time, QWidget *parent = 0); |
|
213 |
}; |
|
214 |
||
215 |
class Q_GUI_EXPORT QDateEdit : public QDateTimeEdit |
|
216 |
{ |
|
217 |
Q_OBJECT |
|
218 |
Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged USER true) |
|
219 |
public: |
|
220 |
QDateEdit(QWidget *parent = 0); |
|
221 |
QDateEdit(const QDate &date, QWidget *parent = 0); |
|
222 |
}; |
|
223 |
||
224 |
Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimeEdit::Sections) |
|
225 |
||
226 |
#endif // QT_NO_DATETIMEEDIT |
|
227 |
||
228 |
QT_END_NAMESPACE |
|
229 |
||
230 |
QT_END_HEADER |
|
231 |
||
232 |
#endif // QDATETIMEEDIT_H |