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
|
<!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/qdatetimeedit.cpp:1780 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QTimeEdit 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>QTimeEdit Class Reference</h1>
<p>The QTimeEdit class provides a time editor.
<a href="#details">More...</a>
<p><tt>#include <<a href="qdatetimeedit-h.html">qdatetimeedit.h</a>></tt>
<p>Inherits <a href="qdatetimeeditbase.html">QDateTimeEditBase</a>.
<p><a href="qtimeedit-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>enum <a href="#Display-enum"><b>Display</b></a> { Hours = 0x01, Minutes = 0x02, Seconds = 0x04, AMPM = 0x10 }</li>
<li class=fn><a href="#QTimeEdit"><b>QTimeEdit</b></a> ( QWidget * parent = 0, const char * name = 0 )</li>
<li class=fn><a href="#QTimeEdit-2"><b>QTimeEdit</b></a> ( const QTime & time, QWidget * parent = 0, const char * name = 0 )</li>
<li class=fn><a href="#~QTimeEdit"><b>~QTimeEdit</b></a> ()</li>
<li class=fn>QTime <a href="#time"><b>time</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 QTime & d )</li>
<li class=fn>QTime <a href="#minValue"><b>minValue</b></a> () const</li>
<li class=fn>virtual void <a href="#setMaxValue"><b>setMaxValue</b></a> ( const QTime & d )</li>
<li class=fn>QTime <a href="#maxValue"><b>maxValue</b></a> () const</li>
<li class=fn>virtual void <a href="#setRange"><b>setRange</b></a> ( const QTime & min, const QTime & max )</li>
<li class=fn>QString <a href="#separator"><b>separator</b></a> () const</li>
<li class=fn>virtual void <a href="#setSeparator"><b>setSeparator</b></a> ( const QString & s )</li>
<li class=fn>uint <a href="#display"><b>display</b></a> () const</li>
<li class=fn>void <a href="#setDisplay"><b>setDisplay</b></a> ( uint disp )</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>virtual void <a href="#setTime"><b>setTime</b></a> ( const QTime & time )</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#valueChanged"><b>valueChanged</b></a> ( const QTime & time )</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>Display <a href="#display-prop"><b>display</b></a> - the sections that are displayed in the time edit</li>
<li class=fn>QTime <a href="#maxValue-prop"><b>maxValue</b></a> - the maximum time value</li>
<li class=fn>QTime <a href="#minValue-prop"><b>minValue</b></a> - the minimum time value</li>
<li class=fn>QTime <a href="#time-prop"><b>time</b></a> - the editor's time value</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual QString <a href="#sectionFormattedText"><b>sectionFormattedText</b></a> ( int sec )</li>
<li class=fn>virtual void <a href="#setHour"><b>setHour</b></a> ( int h )</li>
<li class=fn>virtual void <a href="#setMinute"><b>setMinute</b></a> ( int m )</li>
<li class=fn>virtual void <a href="#setSecond"><b>setSecond</b></a> ( int s )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The QTimeEdit class provides a time editor.
<p>
<p> QTimeEdit allows the user to edit times by using the keyboard or
the arrow keys to increase/decrease time values. The arrow keys
can be used to move from section to section within the QTimeEdit
box. The user can automatically be moved to the next section once
they complete a section using <a href="#setAutoAdvance">setAutoAdvance</a>(). Times appear in
hour, minute, second order. It is recommended that the QTimeEdit
is initialised with a time, e.g.
<pre>
<a href="qtime.html">QTime</a> timeNow = QTime::<a href="qtime.html#currentTime">currentTime</a>();
QTimeEdit *timeEdit = new QTimeEdit( timeNow, this );
timeEdit-><a href="#setRange">setRange</a>( timeNow, timeNow.<a href="qtime.html#addSecs">addSecs</a>( 60 * 60 ) );
</pre>
Here we've created a QTimeEdit widget set to the current time.
We've also set the minimum value to the current time and the
maximum time to one hour from now.
<p> The maximum and minimum values for a time value in the time editor
default to the maximum and minimum values for a <a href="qtime.html">QTime</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 QTimeWidget consists of three sections, one each
for the hour, minute and second. You can change the separator
character using <a href="#setSeparator">setSeparator</a>(), by default the separator is read
from the system's settings.
<p> <center><img src="datetimewidgets.png" alt="Date Time Widgets"></center>
<p> <p>See also <a href="qtime.html">QTime</a>, <a href="qdateedit.html">QDateEdit</a>, <a href="qdatetimeedit.html">QDateTimeEdit</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="Display-enum"></a>QTimeEdit::Display</h3>
<p> This enum defines the sections that comprise a time
<ul>
<li><tt>QTimeEdit::Hours</tt> - The hours section
<li><tt>QTimeEdit::Minutes</tt> - The minutes section
<li><tt>QTimeEdit::Seconds</tt> - The seconds section
<li><tt>QTimeEdit::AMPM</tt> - The AM/PM section
</ul><p> The values can be or'ed together to show any combination.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QTimeEdit"></a>QTimeEdit::QTimeEdit ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0 )
</h3>
Constructs an empty time edit with parent <em>parent</em> and called <em>name</em>.
<h3 class=fn><a name="QTimeEdit-2"></a>QTimeEdit::QTimeEdit ( const <a href="qtime.html">QTime</a> & time, <a href="qwidget.html">QWidget</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 time edit with the initial time value, <em>time</em>,
parent <em>parent</em> and called <em>name</em>.
<h3 class=fn><a name="~QTimeEdit"></a>QTimeEdit::~QTimeEdit ()
</h3>
Destroys the object and frees any allocated resources.
<h3 class=fn>bool <a name="autoAdvance"></a>QTimeEdit::autoAdvance () const
</h3><p>Returns TRUE if the editor automatically advances to the next section; otherwise returns FALSE.
See the <a href="qtimeedit.html#autoAdvance-prop">"autoAdvance"</a> property for details.
<h3 class=fn>uint <a name="display"></a>QTimeEdit::display () const
</h3><p>Returns the sections that are displayed in the time edit.
See the <a href="qtimeedit.html#display-prop">"display"</a> property for details.
<h3 class=fn><a href="qtime.html">QTime</a> <a name="maxValue"></a>QTimeEdit::maxValue () const
</h3><p>Returns the maximum time value.
See the <a href="qtimeedit.html#maxValue-prop">"maxValue"</a> property for details.
<h3 class=fn><a href="qtime.html">QTime</a> <a name="minValue"></a>QTimeEdit::minValue () const
</h3><p>Returns the minimum time value.
See the <a href="qtimeedit.html#minValue-prop">"minValue"</a> property for details.
<h3 class=fn><a href="qstring.html">QString</a> <a name="sectionFormattedText"></a>QTimeEdit::sectionFormattedText ( int sec )<tt> [virtual protected]</tt>
</h3>
Returns the formatted number for section <em>sec</em>. This will
correspond to either the hour, minute or second section, depending
on <em>sec</em>.
<h3 class=fn><a href="qstring.html">QString</a> <a name="separator"></a>QTimeEdit::separator () const
</h3>
Returns the editor's separator.
<h3 class=fn>void <a name="setAutoAdvance"></a>QTimeEdit::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="qtimeedit.html#autoAdvance-prop">"autoAdvance"</a> property for details.
<h3 class=fn>void <a name="setDisplay"></a>QTimeEdit::setDisplay ( uint disp )
</h3><p>Sets the sections that are displayed in the time edit to <em>disp</em>.
See the <a href="qtimeedit.html#display-prop">"display"</a> property for details.
<h3 class=fn>void <a name="setHour"></a>QTimeEdit::setHour ( int h )<tt> [virtual protected]</tt>
</h3>
Sets the hour to <em>h</em>, which must be a valid hour, i.e. in the
range 0..24.
<h3 class=fn>void <a name="setMaxValue"></a>QTimeEdit::setMaxValue ( const <a href="qtime.html">QTime</a> & d )<tt> [virtual]</tt>
</h3><p>Sets the maximum time value to <em>d</em>.
See the <a href="qtimeedit.html#maxValue-prop">"maxValue"</a> property for details.
<h3 class=fn>void <a name="setMinValue"></a>QTimeEdit::setMinValue ( const <a href="qtime.html">QTime</a> & d )<tt> [virtual]</tt>
</h3><p>Sets the minimum time value to <em>d</em>.
See the <a href="qtimeedit.html#minValue-prop">"minValue"</a> property for details.
<h3 class=fn>void <a name="setMinute"></a>QTimeEdit::setMinute ( int m )<tt> [virtual protected]</tt>
</h3>
Sets the minute to <em>m</em>, which must be a valid minute, i.e. in the
range 0..59.
<h3 class=fn>void <a name="setRange"></a>QTimeEdit::setRange ( const <a href="qtime.html">QTime</a> & min, const <a href="qtime.html">QTime</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 time is set.
Similarly, if <em>max</em> is invalid no maximum time is set.
<h3 class=fn>void <a name="setSecond"></a>QTimeEdit::setSecond ( int s )<tt> [virtual protected]</tt>
</h3>
Sets the second to <em>s</em>, which must be a valid second, i.e. in the
range 0..59.
<h3 class=fn>void <a name="setSeparator"></a>QTimeEdit::setSeparator ( const <a href="qstring.html">QString</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="setTime"></a>QTimeEdit::setTime ( const <a href="qtime.html">QTime</a> & time )<tt> [virtual slot]</tt>
</h3><p>Sets the editor's time value to <em>time</em>.
See the <a href="qtimeedit.html#time-prop">"time"</a> property for details.
<h3 class=fn><a href="qtime.html">QTime</a> <a name="time"></a>QTimeEdit::time () const
</h3><p>Returns the editor's time value.
See the <a href="qtimeedit.html#time-prop">"time"</a> property for details.
<h3 class=fn>void <a name="valueChanged"></a>QTimeEdit::valueChanged ( const <a href="qtime.html">QTime</a> & time )<tt> [signal]</tt>
</h3>
<p> This signal is emitted whenever the editor's value changes. The <em>time</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 time 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="qtimeedit.html#Display-enum">Display</a> <a name="display-prop"></a>display</h3>
<p>This property holds the sections that are displayed in the time edit.
<p>The value can be any combination of the values in the Display enum.
By default, the widget displays hours, minutes and seconds.
<p>Set this property's value with <a href="#setDisplay">setDisplay</a>() and get this property's value with <a href="#display">display</a>().
<h3 class=fn><a href="qtime.html">QTime</a> <a name="maxValue-prop"></a>maxValue</h3>
<p>This property holds the maximum time value.
<p>Setting the maximum time value is equivalent to calling
<a href="#setRange">QTimeEdit::setRange</a>( <a href="#minValue">minValue</a>(), <em>t</em> ), where <em>t</em> is the maximum
time. The default maximum time is 23:59:59.
<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="qtime.html">QTime</a> <a name="minValue-prop"></a>minValue</h3>
<p>This property holds the minimum time value.
<p>Setting the minimum time value is equivalent to calling
<a href="#setRange">QTimeEdit::setRange</a>( <em>t</em>, <a href="#maxValue">maxValue</a>() ), where <em>t</em> is the minimum
time. The default minimum time is 00:00:00.
<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="qtime.html">QTime</a> <a name="time-prop"></a>time</h3>
<p>This property holds the editor's time value.
<p>When changing the time property, if the time 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="#setTime">setTime</a>() and get this property's value with <a href="#time">time</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt 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>Qt 3.3.8</div>
</table></div></address></body>
</html>
|