1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/tqdatetimeedit.cpp:844 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQDateEdit Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQDateEdit Class Reference</h1>
<p>The TQDateEdit class provides a date editor.
<a href="#details">More...</a>
<p><tt>#include <<a href="tqdatetimeedit-h.html">tqdatetimeedit.h</a>></tt>
<p>Inherits <a href="tqdatetimeeditbase.html">TQDateTimeEditBase</a>.
<p><a href="tqdateedit-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQDateEdit"><b>TQDateEdit</b></a> ( TQWidget * parent = 0, const char * name = 0 )</li>
<li class=fn><a href="#TQDateEdit-2"><b>TQDateEdit</b></a> ( const TQDate & date, TQWidget * parent = 0, const char * name = 0 )</li>
<li class=fn><a href="#~TQDateEdit"><b>~TQDateEdit</b></a> ()</li>
<li class=fn>enum <a href="#Order-enum"><b>Order</b></a> { DMY, MDY, YMD, YDM }</li>
<li class=fn>TQDate <a href="#date"><b>date</b></a> () const</li>
<li class=fn>virtual void <a href="#setOrder"><b>setOrder</b></a> ( Order order )</li>
<li class=fn>Order <a href="#order"><b>order</b></a> () const</li>
<li class=fn>virtual void <a href="#setAutoAdvance"><b>setAutoAdvance</b></a> ( bool advance )</li>
<li class=fn>bool <a href="#autoAdvance"><b>autoAdvance</b></a> () const</li>
<li class=fn>virtual void <a href="#setMinValue"><b>setMinValue</b></a> ( const TQDate & d )</li>
<li class=fn>TQDate <a href="#minValue"><b>minValue</b></a> () const</li>
<li class=fn>virtual void <a href="#setMaxValue"><b>setMaxValue</b></a> ( const TQDate & d )</li>
<li class=fn>TQDate <a href="#maxValue"><b>maxValue</b></a> () const</li>
<li class=fn>virtual void <a href="#setRange"><b>setRange</b></a> ( const TQDate & min, const TQDate & max )</li>
<li class=fn>TQString <a href="#separator"><b>separator</b></a> () const</li>
<li class=fn>virtual void <a href="#setSeparator"><b>setSeparator</b></a> ( const TQString & s )</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>virtual void <a href="#setDate"><b>setDate</b></a> ( const TQDate & date )</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#valueChanged"><b>valueChanged</b></a> ( const TQDate & date )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>bool <a href="#autoAdvance-prop"><b>autoAdvance</b></a> - whether the editor automatically advances to the next section</li>
<li class=fn>TQDate <a href="#date-prop"><b>date</b></a> - the editor's date value</li>
<li class=fn>TQDate <a href="#maxValue-prop"><b>maxValue</b></a> - the editor's maximum value</li>
<li class=fn>TQDate <a href="#minValue-prop"><b>minValue</b></a> - the editor's minimum value</li>
<li class=fn>Order <a href="#order-prop"><b>order</b></a> - the order in which the year, month and day appear</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual TQString <a href="#sectionFormattedText"><b>sectionFormattedText</b></a> ( int sec )</li>
<li class=fn>virtual void <a href="#setYear"><b>setYear</b></a> ( int year )</li>
<li class=fn>virtual void <a href="#setMonth"><b>setMonth</b></a> ( int month )</li>
<li class=fn>virtual void <a href="#setDay"><b>setDay</b></a> ( int day )</li>
<li class=fn>virtual void <a href="#fix"><b>fix</b></a> ()</li>
</ul>
<h2>Protected Slots</h2>
<ul>
<li class=fn>void <a href="#updateButtons"><b>updateButtons</b></a> ()</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQDateEdit class provides a date editor.
<p>
<p> TQDateEdit allows the user to edit dates by using the keyboard or
the arrow keys to increase/decrease date values. The arrow keys
can be used to move from section to section within the TQDateEdit
box. Dates appear in accordance with the local date/time settings
or in year, month, day order if the system doesn't provide this
information. It is recommended that the TQDateEdit be initialised
with a date, e.g.
<p> <pre>
TQDateEdit *dateEdit = new TQDateEdit( TQDate::<a href="tqdate.html#currentDate">currentDate</a>(), this );
dateEdit-><a href="#setRange">setRange</a>( TQDate::<a href="tqdate.html#currentDate">currentDate</a>().addDays( -365 ),
TQDate::<a href="tqdate.html#currentDate">currentDate</a>().addDays( 365 ) );
dateEdit-><a href="#setOrder">setOrder</a>( TQDateEdit::<a href="#Order-enum">MDY</a> );
dateEdit-><a href="#setAutoAdvance">setAutoAdvance</a>( TRUE );
</pre>
<p> Here we've created a new TQDateEdit object initialised with today's
date and restricted the valid date range to today plus or minus
365 days. We've set the order to month, day, year. If the auto
advance property is TRUE (as we've set it here) when the user
completes a section of the date, e.g. enters two digits for the
month, they are automatically taken to the next section.
<p> The maximum and minimum values for a date value in the date editor
default to the maximum and minimum values for a <a href="tqdate.html">TQDate</a>. You can
change this by calling <a href="#setMinValue">setMinValue</a>(), <a href="#setMaxValue">setMaxValue</a>() or <a href="#setRange">setRange</a>().
<p> Terminology: A TQDateEdit widget comprises three 'sections', one
each for the year, month and day. You can change the separator
character using TQDateTimeEditor::setSeparator(), by default the
separator will be taken from the systems settings. If that is
not possible, it defaults to "-".
<p> <center><img src="datetimewidgets.png" alt="Date Time Widgets"></center>
<p> <p>See also <a href="tqdate.html">TQDate</a>, <a href="tqtimeedit.html">TQTimeEdit</a>, <a href="tqdatetimeedit.html">TQDateTimeEdit</a>, <a href="advanced.html">Advanced Widgets</a>, and <a href="time.html">Time and Date</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="Order-enum"></a>TQDateEdit::Order</h3>
<p> This enum defines the order in which the sections that comprise a
date appear.
<ul>
<li><tt>TQDateEdit::MDY</tt> - month-day-year
<li><tt>TQDateEdit::DMY</tt> - day-month-year
<li><tt>TQDateEdit::YMD</tt> - year-month-day (the default)
<li><tt>TQDateEdit::YDM</tt> - year-day-month (included for completeness; but should
not be used)
</ul>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQDateEdit"></a>TQDateEdit::TQDateEdit ( <a href="tqwidget.html">TQWidget</a> * parent = 0, const char * name = 0 )
</h3>
Constructs an empty date editor which is a child of <em>parent</em> and
called name <em>name</em>.
<h3 class=fn><a name="TQDateEdit-2"></a>TQDateEdit::TQDateEdit ( const <a href="tqdate.html">TQDate</a> & date, <a href="tqwidget.html">TQWidget</a> * parent = 0, const char * name = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Constructs a date editor with the initial value <em>date</em>, parent <em>parent</em> and called <em>name</em>.
<p> The date editor is initialized with <em>date</em>.
<h3 class=fn><a name="~TQDateEdit"></a>TQDateEdit::~TQDateEdit ()
</h3>
Destroys the object and frees any allocated resources.
<h3 class=fn>bool <a name="autoAdvance"></a>TQDateEdit::autoAdvance () const
</h3><p>Returns TRUE if the editor automatically advances to the next section; otherwise returns FALSE.
See the <a href="tqdateedit.html#autoAdvance-prop">"autoAdvance"</a> property for details.
<h3 class=fn><a href="tqdate.html">TQDate</a> <a name="date"></a>TQDateEdit::date () const
</h3><p>Returns the editor's date value.
See the <a href="tqdateedit.html#date-prop">"date"</a> property for details.
<h3 class=fn>void <a name="fix"></a>TQDateEdit::fix ()<tt> [virtual protected]</tt>
</h3>
Attempts to fix any invalid date entries.
<p> The rules applied are as follows:
<p> <ul>
<li> If the year has four digits it is left unchanged.
<li> If the year has two digits, the year will be changed to four
digits in the range current year - 70 to current year + 29.
<li> If the year has three digits in the range 100..999, the
current millennium, i.e. 2000, will be added giving a year
in the range 2100..2999.
<li> If the day or month is 0 then it will be set to 1 or the
minimum valid day\month in the range.
</ul>
<p>
<h3 class=fn><a href="tqdate.html">TQDate</a> <a name="maxValue"></a>TQDateEdit::maxValue () const
</h3><p>Returns the editor's maximum value.
See the <a href="tqdateedit.html#maxValue-prop">"maxValue"</a> property for details.
<h3 class=fn><a href="tqdate.html">TQDate</a> <a name="minValue"></a>TQDateEdit::minValue () const
</h3><p>Returns the editor's minimum value.
See the <a href="tqdateedit.html#minValue-prop">"minValue"</a> property for details.
<h3 class=fn><a href="tqdateedit.html#Order-enum">Order</a> <a name="order"></a>TQDateEdit::order () const
</h3><p>Returns the order in which the year, month and day appear.
See the <a href="tqdateedit.html#order-prop">"order"</a> property for details.
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="sectionFormattedText"></a>TQDateEdit::sectionFormattedText ( int sec )<tt> [virtual protected]</tt>
</h3>
Returns the formatted number for section <em>sec</em>. This will
correspond to either the year, month or day section, depending on
the current display order.
<p> <p>See also <a href="#order-prop">order</a>.
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="separator"></a>TQDateEdit::separator () const
</h3>
Returns the editor's separator.
<h3 class=fn>void <a name="setAutoAdvance"></a>TQDateEdit::setAutoAdvance ( bool advance )<tt> [virtual]</tt>
</h3><p>Sets whether the editor automatically advances to the next section to <em>advance</em>.
See the <a href="tqdateedit.html#autoAdvance-prop">"autoAdvance"</a> property for details.
<h3 class=fn>void <a name="setDate"></a>TQDateEdit::setDate ( const <a href="tqdate.html">TQDate</a> & date )<tt> [virtual slot]</tt>
</h3><p>Sets the editor's date value to <em>date</em>.
See the <a href="tqdateedit.html#date-prop">"date"</a> property for details.
<h3 class=fn>void <a name="setDay"></a>TQDateEdit::setDay ( int day )<tt> [virtual protected]</tt>
</h3>
Sets the day to <em>day</em>, which must be a valid day. The function
will ensure that the <em>day</em> set is valid for the month and year.
<h3 class=fn>void <a name="setMaxValue"></a>TQDateEdit::setMaxValue ( const <a href="tqdate.html">TQDate</a> & d )<tt> [virtual]</tt>
</h3><p>Sets the editor's maximum value to <em>d</em>.
See the <a href="tqdateedit.html#maxValue-prop">"maxValue"</a> property for details.
<h3 class=fn>void <a name="setMinValue"></a>TQDateEdit::setMinValue ( const <a href="tqdate.html">TQDate</a> & d )<tt> [virtual]</tt>
</h3><p>Sets the editor's minimum value to <em>d</em>.
See the <a href="tqdateedit.html#minValue-prop">"minValue"</a> property for details.
<h3 class=fn>void <a name="setMonth"></a>TQDateEdit::setMonth ( int month )<tt> [virtual protected]</tt>
</h3>
Sets the month to <em>month</em>, which must be a valid month, i.e.
between 1 and 12.
<h3 class=fn>void <a name="setOrder"></a>TQDateEdit::setOrder ( <a href="tqdateedit.html#Order-enum">Order</a> order )<tt> [virtual]</tt>
</h3><p>Sets the order in which the year, month and day appear to <em>order</em>.
See the <a href="tqdateedit.html#order-prop">"order"</a> property for details.
<h3 class=fn>void <a name="setRange"></a>TQDateEdit::setRange ( const <a href="tqdate.html">TQDate</a> & min, const <a href="tqdate.html">TQDate</a> & max )<tt> [virtual]</tt>
</h3>
Sets the valid input range for the editor to be from <em>min</em> to <em>max</em> inclusive. If <em>min</em> is invalid no minimum date will be set.
Similarly, if <em>max</em> is invalid no maximum date will be set.
<h3 class=fn>void <a name="setSeparator"></a>TQDateEdit::setSeparator ( const <a href="tqstring.html">TQString</a> & s )<tt> [virtual]</tt>
</h3>
Sets the separator to <em>s</em>. Note that currently only the first
character of <em>s</em> is used.
<h3 class=fn>void <a name="setYear"></a>TQDateEdit::setYear ( int year )<tt> [virtual protected]</tt>
</h3>
Sets the year to <em>year</em>, which must be a valid year. The range
currently supported is from 1752 to 8000.
<p> <p>See also <a href="tqdate.html">TQDate</a>.
<h3 class=fn>void <a name="updateButtons"></a>TQDateEdit::updateButtons ()<tt> [protected slot]</tt>
</h3>
Enables/disables the push buttons according to the min/max date
for this widget.
<h3 class=fn>void <a name="valueChanged"></a>TQDateEdit::valueChanged ( const <a href="tqdate.html">TQDate</a> & date )<tt> [signal]</tt>
</h3>
<p> This signal is emitted whenever the editor's value changes. The <em>date</em> parameter is the new value.
<hr><h2>Property Documentation</h2>
<h3 class=fn>bool <a name="autoAdvance-prop"></a>autoAdvance</h3>
<p>This property holds whether the editor automatically advances to the next section.
<p>If autoAdvance is TRUE, the editor will automatically advance
focus to the next date section if a user has completed a section.
The default is FALSE.
<p>Set this property's value with <a href="#setAutoAdvance">setAutoAdvance</a>() and get this property's value with <a href="#autoAdvance">autoAdvance</a>().
<h3 class=fn><a href="tqdate.html">TQDate</a> <a name="date-prop"></a>date</h3>
<p>This property holds the editor's date value.
<p>If the date property is not valid, the editor displays all zeroes
and <a href="#date">TQDateEdit::date</a>() will return an invalid date. It is strongly
recommended that the editor is given a default date value (e.g.
currentDate()). That way, attempts to set the date property to an
invalid date will fail.
<p> When changing the date property, if the date is less than
<a href="#minValue">minValue</a>(), or is greater than <a href="#maxValue">maxValue</a>(), nothing happens.
<p>Set this property's value with <a href="#setDate">setDate</a>() and get this property's value with <a href="#date">date</a>().
<h3 class=fn><a href="tqdate.html">TQDate</a> <a name="maxValue-prop"></a>maxValue</h3>
<p>This property holds the editor's maximum value.
<p>Setting the maximum date value for the editor is equivalent to
calling <a href="#setRange">TQDateEdit::setRange</a>( <a href="#minValue">minValue</a>(), <em>d</em> ), where <em>d</em> is the
maximum date. The default maximum date is 8000-12-31.
<p> <p>See also <a href="#minValue-prop">minValue</a> and <a href="#setRange">setRange</a>().
<p>Set this property's value with <a href="#setMaxValue">setMaxValue</a>() and get this property's value with <a href="#maxValue">maxValue</a>().
<h3 class=fn><a href="tqdate.html">TQDate</a> <a name="minValue-prop"></a>minValue</h3>
<p>This property holds the editor's minimum value.
<p>Setting the minimum date value is equivalent to calling
<a href="#setRange">TQDateEdit::setRange</a>( <em>d</em>, <a href="#maxValue">maxValue</a>() ), where <em>d</em> is the minimum
date. The default minimum date is 1752-09-14.
<p> <p>See also <a href="#maxValue-prop">maxValue</a> and <a href="#setRange">setRange</a>().
<p>Set this property's value with <a href="#setMinValue">setMinValue</a>() and get this property's value with <a href="#minValue">minValue</a>().
<h3 class=fn><a href="tqdateedit.html#Order-enum">Order</a> <a name="order-prop"></a>order</h3>
<p>This property holds the order in which the year, month and day appear.
<p>The default order is locale dependent.
<p> <p>See also <a href="#Order-enum">Order</a>.
<p>Set this property's value with <a href="#setOrder">setOrder</a>() and get this property's value with <a href="#order">order</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright © 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>
|