1QDateEdit(3qt) QDateEdit(3qt)
2
3
4
6 QDateEdit - Date editor
7
9 #include <qdatetimeedit.h>
10
11 Inherits QDateTimeEditBase.
12
13 Public Members
14 QDateEdit ( QWidget * parent = 0, const char * name = 0 )
15 QDateEdit ( const QDate & date, QWidget * parent = 0, const char * name
16 = 0 )
17 ~QDateEdit ()
18 enum Order { DMY, MDY, YMD, YDM }
19 QDate date () const
20 virtual void setOrder ( Order order )
21 Order order () const
22 virtual void setAutoAdvance ( bool advance )
23 bool autoAdvance () const
24 virtual void setMinValue ( const QDate & d )
25 QDate minValue () const
26 virtual void setMaxValue ( const QDate & d )
27 QDate maxValue () const
28 virtual void setRange ( const QDate & min, const QDate & max )
29 QString separator () const
30 virtual void setSeparator ( const QString & s )
31
32 Public Slots
33 virtual void setDate ( const QDate & date )
34
35 Signals
36 void valueChanged ( const QDate & date )
37
38 Properties
39 bool autoAdvance - whether the editor automatically advances to the
40 next section
41 QDate date - the editor's date value
42 QDate maxValue - the editor's maximum value
43 QDate minValue - the editor's minimum value
44 Order order - the order in which the year, month and day appear
45
46 Protected Members
47 virtual QString sectionFormattedText ( int sec )
48 virtual void setYear ( int year )
49 virtual void setMonth ( int month )
50 virtual void setDay ( int day )
51 virtual void fix ()
52
53 Protected Slots
54 void updateButtons ()
55
57 The QDateEdit class provides a date editor.
58
59 QDateEdit allows the user to edit dates by using the keyboard or the
60 arrow keys to increase/decrease date values. The arrow keys can be used
61 to move from section to section within the QDateEdit box. Dates appear
62 in accordance with the local date/time settings or in year, month, day
63 order if the system doesn't provide this information. It is recommended
64 that the QDateEdit be initialised with a date, e.g.
65
66 QDateEdit *dateEdit = new QDateEdit( QDate::currentDate(), this );
67 dateEdit->setRange( QDate::currentDate().addDays( -365 ),
68 QDate::currentDate().addDays( 365 ) );
69 dateEdit->setOrder( QDateEdit::MDY );
70 dateEdit->setAutoAdvance( TRUE );
71
72 Here we've created a new QDateEdit object initialised with today's date
73 and restricted the valid date range to today plus or minus 365 days.
74 We've set the order to month, day, year. If the auto advance property
75 is TRUE (as we've set it here) when the user completes a section of the
76 date, e.g. enters two digits for the month, they are automatically
77 taken to the next section.
78
79 The maximum and minimum values for a date value in the date editor
80 default to the maximum and minimum values for a QDate. You can change
81 this by calling setMinValue(), setMaxValue() or setRange().
82
83 Terminology: A QDateEdit widget comprises three 'sections', one each
84 for the year, month and day. You can change the separator character
85 using QDateTimeEditor::setSeparator(), by default the separator will be
86 taken from the systems settings. If that is not possible, it defaults
87 to "-".
88
89 <center>
90 [Image Omitted]
91
92 </center>
93
94 See also QDate, QTimeEdit, QDateTimeEdit, Advanced Widgets, and Time
95 and Date.
96
97 Member Type Documentation
99 This enum defines the order in which the sections that comprise a date
100 appear.
101
102 QDateEdit::MDY - month-day-year
103
104 QDateEdit::DMY - day-month-year
105
106 QDateEdit::YMD - year-month-day (the default)
107
108 QDateEdit::YDM - year-day-month (included for completeness; but should
109 not be used)
110
113 Constructs an empty date editor which is a child of parent and called
114 name name.
115
117 name = 0 )
118 This is an overloaded member function, provided for convenience. It
119 behaves essentially like the above function.
120
121 Constructs a date editor with the initial value date, parent parent and
122 called name.
123
124 The date editor is initialized with date.
125
127 Destroys the object and frees any allocated resources.
128
130 Returns TRUE if the editor automatically advances to the next section;
131 otherwise returns FALSE. See the "autoAdvance" property for details.
132
134 Returns the editor's date value. See the "date" property for details.
135
137 Attempts to fix any invalid date entries.
138
139 The rules applied are as follows:
140
141 If the year has four digits it is left unchanged.
142
143 If the year has two digits, the year will be changed to four digits in
144 the range current year - 70 to current year + 29.
145
146 If the year has three digits in the range 100..999, the current
147 millennium, i.e. 2000, will be added giving a year in the range
148 2100..2999.
149
150 If the day or month is 0 then it will be set to 1 or the minimum valid
151 day\month in the range.
152
154 Returns the editor's maximum value. See the "maxValue" property for
155 details.
156
158 Returns the editor's minimum value. See the "minValue" property for
159 details.
160
162 Returns the order in which the year, month and day appear. See the
163 "order" property for details.
164
166 Returns the formatted number for section sec. This will correspond to
167 either the year, month or day section, depending on the current display
168 order.
169
170 See also order.
171
173 Returns the editor's separator.
174
176 Sets whether the editor automatically advances to the next section to
177 advance. See the "autoAdvance" property for details.
178
180 Sets the editor's date value to date. See the "date" property for
181 details.
182
184 Sets the day to day, which must be a valid day. The function will
185 ensure that the day set is valid for the month and year.
186
188 Sets the editor's maximum value to d. See the "maxValue" property for
189 details.
190
192 Sets the editor's minimum value to d. See the "minValue" property for
193 details.
194
196 Sets the month to month, which must be a valid month, i.e. between 1
197 and 12.
198
200 Sets the order in which the year, month and day appear to order. See
201 the "order" property for details.
202
204 Sets the valid input range for the editor to be from min to max
205 inclusive. If min is invalid no minimum date will be set. Similarly, if
206 max is invalid no maximum date will be set.
207
209 Sets the separator to s. Note that currently only the first character
210 of s is used.
211
213 Sets the year to year, which must be a valid year. The range currently
214 supported is from 1752 to 8000.
215
216 See also QDate.
217
219 Enables/disables the push buttons according to the min/max date for
220 this widget.
221
223 This signal is emitted whenever the editor's value changes. The date
224 parameter is the new value.
225
226 Property Documentation
228 This property holds whether the editor automatically advances to the
229 next section.
230
231 If autoAdvance is TRUE, the editor will automatically advance focus to
232 the next date section if a user has completed a section. The default is
233 FALSE.
234
235 Set this property's value with setAutoAdvance() and get this property's
236 value with autoAdvance().
237
239 This property holds the editor's date value.
240
241 If the date property is not valid, the editor displays all zeroes and
242 QDateEdit::date() will return an invalid date. It is strongly
243 recommended that the editor is given a default date value (e.g.
244 currentDate()). That way, attempts to set the date property to an
245 invalid date will fail.
246
247 When changing the date property, if the date is less than minValue(),
248 or is greater than maxValue(), nothing happens.
249
250 Set this property's value with setDate() and get this property's value
251 with date().
252
254 This property holds the editor's maximum value.
255
256 Setting the maximum date value for the editor is equivalent to calling
257 QDateEdit::setRange( minValue(), d ), where d is the maximum date. The
258 default maximum date is 8000-12-31.
259
260 See also minValue and setRange().
261
262 Set this property's value with setMaxValue() and get this property's
263 value with maxValue().
264
266 This property holds the editor's minimum value.
267
268 Setting the minimum date value is equivalent to calling
269 QDateEdit::setRange( d, maxValue() ), where d is the minimum date. The
270 default minimum date is 1752-09-14.
271
272 See also maxValue and setRange().
273
274 Set this property's value with setMinValue() and get this property's
275 value with minValue().
276
278 This property holds the order in which the year, month and day appear.
279
280 The default order is locale dependent.
281
282 See also Order.
283
284 Set this property's value with setOrder() and get this property's value
285 with order().
286
287
289 http://doc.trolltech.com/qdateedit.html
290 http://www.trolltech.com/faq/tech.html
291
293 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
294 license file included in the distribution for a complete license
295 statement.
296
298 Generated automatically from the source code.
299
301 If you find a bug in Qt, please report it as described in
302 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
303 help you. Thank you.
304
305 The definitive Qt documentation is provided in HTML format; it is
306 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
307 web browser. This man page is provided as a convenience for those users
308 who prefer man pages, although this format is not officially supported
309 by Trolltech.
310
311 If you find errors in this manual page, please report them to qt-
312 bugs@trolltech.com. Please include the name of the manual page
313 (qdateedit.3qt) and the Qt version (3.3.8).
314
315
316
317Trolltech AS 2 February 2007 QDateEdit(3qt)