1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qdatetimeedit.h:1 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>qdatetimeedit.h Include File</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qdatetimeedit.h</h1>
|
---|
33 |
|
---|
34 | <p>This is the verbatim text of the qdatetimeedit.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
---|
35 | <hr>
|
---|
36 | <pre>
|
---|
37 | /****************************************************************************
|
---|
38 | ** $Id: qdatetimeedit-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
---|
39 | **
|
---|
40 | ** Definition of date and time edit classes
|
---|
41 | **
|
---|
42 | ** Created : 001103
|
---|
43 | **
|
---|
44 | ** Copyright (C) 2005-2007 Trolltech ASA. All rights reserved.
|
---|
45 | **
|
---|
46 | ** This file is part of the widgets module of the Qt GUI Toolkit.
|
---|
47 | **
|
---|
48 | ** This file may be distributed under the terms of the Q Public License
|
---|
49 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
---|
50 | ** LICENSE.QPL included in the packaging of this file.
|
---|
51 | **
|
---|
52 | ** This file may be distributed and/or modified under the terms of the
|
---|
53 | ** GNU General Public License version 2 as published by the Free Software
|
---|
54 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
55 | ** packaging of this file.
|
---|
56 | **
|
---|
57 | ** Licensees holding valid Qt Enterprise Edition licenses may use this
|
---|
58 | ** file in accordance with the Qt Commercial License Agreement provided
|
---|
59 | ** with the Software.
|
---|
60 | **
|
---|
61 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
62 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
63 | **
|
---|
64 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
65 | ** information about Qt Commercial License Agreements.
|
---|
66 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
67 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
68 | **
|
---|
69 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
70 | ** not clear to you.
|
---|
71 | **
|
---|
72 | **********************************************************************/
|
---|
73 |
|
---|
74 | #ifndef QDATETIMEEDIT_H
|
---|
75 | #define QDATETIMEEDIT_H
|
---|
76 |
|
---|
77 | #ifndef QT_H
|
---|
78 | #include "qwidget.h"
|
---|
79 | #include "qstring.h"
|
---|
80 | #include "qdatetime.h"
|
---|
81 | #endif // QT_H
|
---|
82 |
|
---|
83 | #ifndef QT_NO_DATETIMEEDIT
|
---|
84 |
|
---|
85 | class Q_EXPORT QDateTimeEditBase : public QWidget
|
---|
86 | {
|
---|
87 | Q_OBJECT
|
---|
88 | public:
|
---|
89 | QDateTimeEditBase( QWidget* parent=0, const char* name=0 )
|
---|
90 | : QWidget( parent, name ) {}
|
---|
91 |
|
---|
92 | virtual bool setFocusSection( int sec ) = 0;
|
---|
93 | virtual QString sectionFormattedText( int sec ) = 0;
|
---|
94 | virtual void addNumber( int sec, int num ) = 0;
|
---|
95 | virtual void removeLastNumber( int sec ) = 0;
|
---|
96 |
|
---|
97 | public slots:
|
---|
98 | virtual void stepUp() = 0;
|
---|
99 | virtual void stepDown() = 0;
|
---|
100 |
|
---|
101 | private:
|
---|
102 | #if defined(Q_DISABLE_COPY) // Disabled copy constructor and operator=
|
---|
103 | QDateTimeEditBase( const QDateTimeEditBase & );
|
---|
104 | QDateTimeEditBase &operator=( const QDateTimeEditBase & );
|
---|
105 | #endif
|
---|
106 | };
|
---|
107 |
|
---|
108 | class QDateEditPrivate;
|
---|
109 |
|
---|
110 | class Q_EXPORT QDateEdit : public QDateTimeEditBase
|
---|
111 | {
|
---|
112 | Q_OBJECT
|
---|
113 | Q_ENUMS( Order )
|
---|
114 | Q_PROPERTY( Order order READ order WRITE setOrder )
|
---|
115 | Q_PROPERTY( QDate date READ date WRITE setDate )
|
---|
116 | Q_PROPERTY( bool autoAdvance READ autoAdvance WRITE setAutoAdvance )
|
---|
117 | Q_PROPERTY( QDate maxValue READ maxValue WRITE setMaxValue )
|
---|
118 | Q_PROPERTY( QDate minValue READ minValue WRITE setMinValue )
|
---|
119 |
|
---|
120 | public:
|
---|
121 | QDateEdit( QWidget* parent=0, const char* name=0 );
|
---|
122 | QDateEdit( const QDate& date, QWidget* parent=0, const char* name=0 );
|
---|
123 | ~QDateEdit();
|
---|
124 |
|
---|
125 | enum Order { DMY, MDY, YMD, YDM };
|
---|
126 |
|
---|
127 | QSize sizeHint() const;
|
---|
128 | QSize minimumSizeHint() const;
|
---|
129 |
|
---|
130 | public slots:
|
---|
131 | virtual void setDate( const QDate& date );
|
---|
132 |
|
---|
133 | public:
|
---|
134 | QDate date() const;
|
---|
135 | virtual void setOrder( Order order );
|
---|
136 | Order order() const;
|
---|
137 | virtual void setAutoAdvance( bool advance );
|
---|
138 | bool autoAdvance() const;
|
---|
139 |
|
---|
140 | virtual void setMinValue( const QDate& d ) { setRange( d, maxValue() ); }
|
---|
141 | QDate minValue() const;
|
---|
142 | virtual void setMaxValue( const QDate& d ) { setRange( minValue(), d ); }
|
---|
143 | QDate maxValue() const;
|
---|
144 | virtual void setRange( const QDate& min, const QDate& max );
|
---|
145 | QString separator() const;
|
---|
146 | virtual void setSeparator( const QString& s );
|
---|
147 |
|
---|
148 | // Make removeFirstNumber() virtual in QDateTimeEditBase in 4.0
|
---|
149 | void removeFirstNumber( int sec );
|
---|
150 |
|
---|
151 | signals:
|
---|
152 | void valueChanged( const QDate& date );
|
---|
153 |
|
---|
154 | protected:
|
---|
155 | bool event( QEvent *e );
|
---|
156 | void timerEvent( QTimerEvent * );
|
---|
157 | void resizeEvent( QResizeEvent * );
|
---|
158 | void stepUp();
|
---|
159 | void stepDown();
|
---|
160 | QString sectionFormattedText( int sec );
|
---|
161 | void addNumber( int sec, int num );
|
---|
162 |
|
---|
163 | void removeLastNumber( int sec );
|
---|
164 | bool setFocusSection( int s );
|
---|
165 |
|
---|
166 | virtual void setYear( int year );
|
---|
167 | virtual void setMonth( int month );
|
---|
168 | virtual void setDay( int day );
|
---|
169 | virtual void fix();
|
---|
170 | virtual bool outOfRange( int y, int m, int d ) const;
|
---|
171 |
|
---|
172 | protected slots:
|
---|
173 | void updateButtons();
|
---|
174 |
|
---|
175 | private:
|
---|
176 | void init();
|
---|
177 | int sectionOffsetEnd( int sec ) const;
|
---|
178 | int sectionLength( int sec ) const;
|
---|
179 | QString sectionText( int sec ) const;
|
---|
180 | QDateEditPrivate* d;
|
---|
181 |
|
---|
182 | #if defined(Q_DISABLE_COPY)
|
---|
183 | QDateEdit( const QDateEdit & );
|
---|
184 | QDateEdit &operator=( const QDateEdit & );
|
---|
185 | #endif
|
---|
186 | };
|
---|
187 |
|
---|
188 | class QTimeEditPrivate;
|
---|
189 |
|
---|
190 | class Q_EXPORT QTimeEdit : public QDateTimeEditBase
|
---|
191 | {
|
---|
192 | Q_OBJECT
|
---|
193 | Q_SETS( Display )
|
---|
194 | Q_PROPERTY( QTime time READ time WRITE setTime )
|
---|
195 | Q_PROPERTY( bool autoAdvance READ autoAdvance WRITE setAutoAdvance )
|
---|
196 | Q_PROPERTY( QTime maxValue READ maxValue WRITE setMaxValue )
|
---|
197 | Q_PROPERTY( QTime minValue READ minValue WRITE setMinValue )
|
---|
198 | Q_PROPERTY( Display display READ display WRITE setDisplay )
|
---|
199 |
|
---|
200 | public:
|
---|
201 | enum Display {
|
---|
202 | Hours = 0x01,
|
---|
203 | Minutes = 0x02,
|
---|
204 | Seconds = 0x04,
|
---|
205 | /*Reserved = 0x08,*/
|
---|
206 | AMPM = 0x10
|
---|
207 | };
|
---|
208 |
|
---|
209 | QTimeEdit( QWidget* parent=0, const char* name=0 );
|
---|
210 | QTimeEdit( const QTime& time, QWidget* parent=0, const char* name=0 );
|
---|
211 | ~QTimeEdit();
|
---|
212 |
|
---|
213 | QSize sizeHint() const;
|
---|
214 | QSize minimumSizeHint() const;
|
---|
215 |
|
---|
216 | public slots:
|
---|
217 | virtual void setTime( const QTime& time );
|
---|
218 |
|
---|
219 | public:
|
---|
220 | QTime time() const;
|
---|
221 | virtual void setAutoAdvance( bool advance );
|
---|
222 | bool autoAdvance() const;
|
---|
223 |
|
---|
224 | virtual void setMinValue( const QTime& d ) { setRange( d, maxValue() ); }
|
---|
225 | QTime minValue() const;
|
---|
226 | virtual void setMaxValue( const QTime& d ) { setRange( minValue(), d ); }
|
---|
227 | QTime maxValue() const;
|
---|
228 | virtual void setRange( const QTime& min, const QTime& max );
|
---|
229 | QString separator() const;
|
---|
230 | virtual void setSeparator( const QString& s );
|
---|
231 |
|
---|
232 | uint display() const;
|
---|
233 | void setDisplay( uint disp );
|
---|
234 |
|
---|
235 | // Make removeFirstNumber() virtual in QDateTimeEditBase in 4.0
|
---|
236 | void removeFirstNumber( int sec );
|
---|
237 |
|
---|
238 | signals:
|
---|
239 | void valueChanged( const QTime& time );
|
---|
240 |
|
---|
241 | protected:
|
---|
242 | bool event( QEvent *e );
|
---|
243 | void timerEvent( QTimerEvent *e );
|
---|
244 | void resizeEvent( QResizeEvent * );
|
---|
245 | void stepUp();
|
---|
246 | void stepDown();
|
---|
247 | QString sectionFormattedText( int sec );
|
---|
248 | void addNumber( int sec, int num );
|
---|
249 | void removeLastNumber( int sec );
|
---|
250 | bool setFocusSection( int s );
|
---|
251 |
|
---|
252 | virtual bool outOfRange( int h, int m, int s ) const;
|
---|
253 | virtual void setHour( int h );
|
---|
254 | virtual void setMinute( int m );
|
---|
255 | virtual void setSecond( int s );
|
---|
256 |
|
---|
257 | protected slots:
|
---|
258 | void updateButtons();
|
---|
259 |
|
---|
260 | private:
|
---|
261 | void init();
|
---|
262 | QString sectionText( int sec );
|
---|
263 | QTimeEditPrivate* d;
|
---|
264 |
|
---|
265 | #if defined(Q_DISABLE_COPY)
|
---|
266 | QTimeEdit( const QTimeEdit & );
|
---|
267 | QTimeEdit &operator=( const QTimeEdit & );
|
---|
268 | #endif
|
---|
269 | };
|
---|
270 |
|
---|
271 |
|
---|
272 | class QDateTimeEditPrivate;
|
---|
273 |
|
---|
274 | class Q_EXPORT QDateTimeEdit : public QWidget
|
---|
275 | {
|
---|
276 | Q_OBJECT
|
---|
277 | Q_PROPERTY( QDateTime dateTime READ dateTime WRITE setDateTime )
|
---|
278 |
|
---|
279 | public:
|
---|
280 | QDateTimeEdit( QWidget* parent=0, const char* name=0 );
|
---|
281 | QDateTimeEdit( const QDateTime& datetime, QWidget* parent=0,
|
---|
282 | const char* name=0 );
|
---|
283 | ~QDateTimeEdit();
|
---|
284 |
|
---|
285 | QSize sizeHint() const;
|
---|
286 | QSize minimumSizeHint() const;
|
---|
287 |
|
---|
288 | public slots:
|
---|
289 | virtual void setDateTime( const QDateTime & dt );
|
---|
290 |
|
---|
291 | public:
|
---|
292 | QDateTime dateTime() const;
|
---|
293 |
|
---|
294 | QDateEdit* dateEdit() { return de; }
|
---|
295 | QTimeEdit* timeEdit() { return te; }
|
---|
296 |
|
---|
297 | virtual void setAutoAdvance( bool advance );
|
---|
298 | bool autoAdvance() const;
|
---|
299 |
|
---|
300 | signals:
|
---|
301 | void valueChanged( const QDateTime& datetime );
|
---|
302 |
|
---|
303 | protected:
|
---|
304 | // ### make init() private in Qt 4.0
|
---|
305 | void init();
|
---|
306 | void resizeEvent( QResizeEvent * );
|
---|
307 |
|
---|
308 | protected slots:
|
---|
309 | // ### make these two functions private in Qt 4.0,
|
---|
310 | // and merge them into one with no parameter
|
---|
311 | void newValue( const QDate& d );
|
---|
312 | void newValue( const QTime& t );
|
---|
313 |
|
---|
314 | private:
|
---|
315 | QDateEdit* de;
|
---|
316 | QTimeEdit* te;
|
---|
317 | QDateTimeEditPrivate* d;
|
---|
318 |
|
---|
319 | #if defined(Q_DISABLE_COPY)
|
---|
320 | QDateTimeEdit( const QDateTimeEdit & );
|
---|
321 | QDateTimeEdit &operator=( const QDateTimeEdit & );
|
---|
322 | #endif
|
---|
323 | };
|
---|
324 |
|
---|
325 | #endif
|
---|
326 | #endif
|
---|
327 | </pre>
|
---|
328 | <!-- eof -->
|
---|
329 | <p><address><hr><div align=center>
|
---|
330 | <table width=100% cellspacing=0 border=0><tr>
|
---|
331 | <td>Copyright © 2007
|
---|
332 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
333 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
334 | </table></div></address></body>
|
---|
335 | </html>
|
---|