[190] | 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/src/widgets/qdatetimeedit.cpp:1780 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QTimeEdit Class</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>QTimeEdit Class Reference</h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QTimeEdit class provides a time editor.
|
---|
| 35 | <a href="#details">More...</a>
|
---|
| 36 | <p><tt>#include <<a href="qdatetimeedit-h.html">qdatetimeedit.h</a>></tt>
|
---|
| 37 | <p>Inherits <a href="qdatetimeeditbase.html">QDateTimeEditBase</a>.
|
---|
| 38 | <p><a href="qtimeedit-members.html">List of all member functions.</a>
|
---|
| 39 | <h2>Public Members</h2>
|
---|
| 40 | <ul>
|
---|
| 41 | <li class=fn>enum <a href="#Display-enum"><b>Display</b></a> { Hours = 0x01, Minutes = 0x02, Seconds = 0x04, AMPM = 0x10 }</li>
|
---|
| 42 | <li class=fn><a href="#QTimeEdit"><b>QTimeEdit</b></a> ( QWidget * parent = 0, const char * name = 0 )</li>
|
---|
| 43 | <li class=fn><a href="#QTimeEdit-2"><b>QTimeEdit</b></a> ( const QTime & time, QWidget * parent = 0, const char * name = 0 )</li>
|
---|
| 44 | <li class=fn><a href="#~QTimeEdit"><b>~QTimeEdit</b></a> ()</li>
|
---|
| 45 | <li class=fn>QTime <a href="#time"><b>time</b></a> () const</li>
|
---|
| 46 | <li class=fn>virtual void <a href="#setAutoAdvance"><b>setAutoAdvance</b></a> ( bool advance )</li>
|
---|
| 47 | <li class=fn>bool <a href="#autoAdvance"><b>autoAdvance</b></a> () const</li>
|
---|
| 48 | <li class=fn>virtual void <a href="#setMinValue"><b>setMinValue</b></a> ( const QTime & d )</li>
|
---|
| 49 | <li class=fn>QTime <a href="#minValue"><b>minValue</b></a> () const</li>
|
---|
| 50 | <li class=fn>virtual void <a href="#setMaxValue"><b>setMaxValue</b></a> ( const QTime & d )</li>
|
---|
| 51 | <li class=fn>QTime <a href="#maxValue"><b>maxValue</b></a> () const</li>
|
---|
| 52 | <li class=fn>virtual void <a href="#setRange"><b>setRange</b></a> ( const QTime & min, const QTime & max )</li>
|
---|
| 53 | <li class=fn>QString <a href="#separator"><b>separator</b></a> () const</li>
|
---|
| 54 | <li class=fn>virtual void <a href="#setSeparator"><b>setSeparator</b></a> ( const QString & s )</li>
|
---|
| 55 | <li class=fn>uint <a href="#display"><b>display</b></a> () const</li>
|
---|
| 56 | <li class=fn>void <a href="#setDisplay"><b>setDisplay</b></a> ( uint disp )</li>
|
---|
| 57 | </ul>
|
---|
| 58 | <h2>Public Slots</h2>
|
---|
| 59 | <ul>
|
---|
| 60 | <li class=fn>virtual void <a href="#setTime"><b>setTime</b></a> ( const QTime & time )</li>
|
---|
| 61 | </ul>
|
---|
| 62 | <h2>Signals</h2>
|
---|
| 63 | <ul>
|
---|
| 64 | <li class=fn>void <a href="#valueChanged"><b>valueChanged</b></a> ( const QTime & time )</li>
|
---|
| 65 | </ul>
|
---|
| 66 | <h2>Properties</h2>
|
---|
| 67 | <ul>
|
---|
| 68 | <li class=fn>bool <a href="#autoAdvance-prop"><b>autoAdvance</b></a> - whether the editor automatically advances to the next section</li>
|
---|
| 69 | <li class=fn>Display <a href="#display-prop"><b>display</b></a> - the sections that are displayed in the time edit</li>
|
---|
| 70 | <li class=fn>QTime <a href="#maxValue-prop"><b>maxValue</b></a> - the maximum time value</li>
|
---|
| 71 | <li class=fn>QTime <a href="#minValue-prop"><b>minValue</b></a> - the minimum time value</li>
|
---|
| 72 | <li class=fn>QTime <a href="#time-prop"><b>time</b></a> - the editor's time value</li>
|
---|
| 73 | </ul>
|
---|
| 74 | <h2>Protected Members</h2>
|
---|
| 75 | <ul>
|
---|
| 76 | <li class=fn>virtual QString <a href="#sectionFormattedText"><b>sectionFormattedText</b></a> ( int sec )</li>
|
---|
| 77 | <li class=fn>virtual void <a href="#setHour"><b>setHour</b></a> ( int h )</li>
|
---|
| 78 | <li class=fn>virtual void <a href="#setMinute"><b>setMinute</b></a> ( int m )</li>
|
---|
| 79 | <li class=fn>virtual void <a href="#setSecond"><b>setSecond</b></a> ( int s )</li>
|
---|
| 80 | </ul>
|
---|
| 81 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 82 |
|
---|
| 83 |
|
---|
| 84 | The QTimeEdit class provides a time editor.
|
---|
| 85 | <p>
|
---|
| 86 |
|
---|
| 87 |
|
---|
| 88 | <p> QTimeEdit allows the user to edit times by using the keyboard or
|
---|
| 89 | the arrow keys to increase/decrease time values. The arrow keys
|
---|
| 90 | can be used to move from section to section within the QTimeEdit
|
---|
| 91 | box. The user can automatically be moved to the next section once
|
---|
| 92 | they complete a section using <a href="#setAutoAdvance">setAutoAdvance</a>(). Times appear in
|
---|
| 93 | hour, minute, second order. It is recommended that the QTimeEdit
|
---|
| 94 | is initialised with a time, e.g.
|
---|
| 95 | <pre>
|
---|
| 96 | <a href="qtime.html">QTime</a> timeNow = QTime::<a href="qtime.html#currentTime">currentTime</a>();
|
---|
| 97 | QTimeEdit *timeEdit = new QTimeEdit( timeNow, this );
|
---|
| 98 | timeEdit-><a href="#setRange">setRange</a>( timeNow, timeNow.<a href="qtime.html#addSecs">addSecs</a>( 60 * 60 ) );
|
---|
| 99 | </pre>
|
---|
| 100 |
|
---|
| 101 | Here we've created a QTimeEdit widget set to the current time.
|
---|
| 102 | We've also set the minimum value to the current time and the
|
---|
| 103 | maximum time to one hour from now.
|
---|
| 104 | <p> The maximum and minimum values for a time value in the time editor
|
---|
| 105 | default to the maximum and minimum values for a <a href="qtime.html">QTime</a>. You can
|
---|
| 106 | change this by calling <a href="#setMinValue">setMinValue</a>(), <a href="#setMaxValue">setMaxValue</a>() or <a href="#setRange">setRange</a>().
|
---|
| 107 | <p> Terminology: A QTimeWidget consists of three sections, one each
|
---|
| 108 | for the hour, minute and second. You can change the separator
|
---|
| 109 | character using <a href="#setSeparator">setSeparator</a>(), by default the separator is read
|
---|
| 110 | from the system's settings.
|
---|
| 111 | <p> <center><img src="datetimewidgets.png" alt="Date Time Widgets"></center>
|
---|
| 112 | <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>.
|
---|
| 113 |
|
---|
| 114 | <hr><h2>Member Type Documentation</h2>
|
---|
| 115 | <h3 class=fn><a name="Display-enum"></a>QTimeEdit::Display</h3>
|
---|
| 116 |
|
---|
| 117 | <p> This enum defines the sections that comprise a time
|
---|
| 118 | <ul>
|
---|
| 119 | <li><tt>QTimeEdit::Hours</tt> - The hours section
|
---|
| 120 | <li><tt>QTimeEdit::Minutes</tt> - The minutes section
|
---|
| 121 | <li><tt>QTimeEdit::Seconds</tt> - The seconds section
|
---|
| 122 | <li><tt>QTimeEdit::AMPM</tt> - The AM/PM section
|
---|
| 123 | </ul><p> The values can be or'ed together to show any combination.
|
---|
| 124 |
|
---|
| 125 | <hr><h2>Member Function Documentation</h2>
|
---|
| 126 | <h3 class=fn><a name="QTimeEdit"></a>QTimeEdit::QTimeEdit ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0 )
|
---|
| 127 | </h3>
|
---|
| 128 | Constructs an empty time edit with parent <em>parent</em> and called <em>name</em>.
|
---|
| 129 |
|
---|
| 130 | <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 )
|
---|
| 131 | </h3>
|
---|
| 132 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
| 133 | <p> Constructs a time edit with the initial time value, <em>time</em>,
|
---|
| 134 | parent <em>parent</em> and called <em>name</em>.
|
---|
| 135 |
|
---|
| 136 | <h3 class=fn><a name="~QTimeEdit"></a>QTimeEdit::~QTimeEdit ()
|
---|
| 137 | </h3>
|
---|
| 138 | Destroys the object and frees any allocated resources.
|
---|
| 139 |
|
---|
| 140 | <h3 class=fn>bool <a name="autoAdvance"></a>QTimeEdit::autoAdvance () const
|
---|
| 141 | </h3><p>Returns TRUE if the editor automatically advances to the next section; otherwise returns FALSE.
|
---|
| 142 | See the <a href="qtimeedit.html#autoAdvance-prop">"autoAdvance"</a> property for details.
|
---|
| 143 | <h3 class=fn>uint <a name="display"></a>QTimeEdit::display () const
|
---|
| 144 | </h3><p>Returns the sections that are displayed in the time edit.
|
---|
| 145 | See the <a href="qtimeedit.html#display-prop">"display"</a> property for details.
|
---|
| 146 | <h3 class=fn><a href="qtime.html">QTime</a> <a name="maxValue"></a>QTimeEdit::maxValue () const
|
---|
| 147 | </h3><p>Returns the maximum time value.
|
---|
| 148 | See the <a href="qtimeedit.html#maxValue-prop">"maxValue"</a> property for details.
|
---|
| 149 | <h3 class=fn><a href="qtime.html">QTime</a> <a name="minValue"></a>QTimeEdit::minValue () const
|
---|
| 150 | </h3><p>Returns the minimum time value.
|
---|
| 151 | See the <a href="qtimeedit.html#minValue-prop">"minValue"</a> property for details.
|
---|
| 152 | <h3 class=fn><a href="qstring.html">QString</a> <a name="sectionFormattedText"></a>QTimeEdit::sectionFormattedText ( int sec )<tt> [virtual protected]</tt>
|
---|
| 153 | </h3>
|
---|
| 154 | Returns the formatted number for section <em>sec</em>. This will
|
---|
| 155 | correspond to either the hour, minute or second section, depending
|
---|
| 156 | on <em>sec</em>.
|
---|
| 157 |
|
---|
| 158 | <h3 class=fn><a href="qstring.html">QString</a> <a name="separator"></a>QTimeEdit::separator () const
|
---|
| 159 | </h3>
|
---|
| 160 | Returns the editor's separator.
|
---|
| 161 |
|
---|
| 162 | <h3 class=fn>void <a name="setAutoAdvance"></a>QTimeEdit::setAutoAdvance ( bool advance )<tt> [virtual]</tt>
|
---|
| 163 | </h3><p>Sets whether the editor automatically advances to the next section to <em>advance</em>.
|
---|
| 164 | See the <a href="qtimeedit.html#autoAdvance-prop">"autoAdvance"</a> property for details.
|
---|
| 165 | <h3 class=fn>void <a name="setDisplay"></a>QTimeEdit::setDisplay ( uint disp )
|
---|
| 166 | </h3><p>Sets the sections that are displayed in the time edit to <em>disp</em>.
|
---|
| 167 | See the <a href="qtimeedit.html#display-prop">"display"</a> property for details.
|
---|
| 168 | <h3 class=fn>void <a name="setHour"></a>QTimeEdit::setHour ( int h )<tt> [virtual protected]</tt>
|
---|
| 169 | </h3>
|
---|
| 170 | Sets the hour to <em>h</em>, which must be a valid hour, i.e. in the
|
---|
| 171 | range 0..24.
|
---|
| 172 |
|
---|
| 173 | <h3 class=fn>void <a name="setMaxValue"></a>QTimeEdit::setMaxValue ( const <a href="qtime.html">QTime</a> & d )<tt> [virtual]</tt>
|
---|
| 174 | </h3><p>Sets the maximum time value to <em>d</em>.
|
---|
| 175 | See the <a href="qtimeedit.html#maxValue-prop">"maxValue"</a> property for details.
|
---|
| 176 | <h3 class=fn>void <a name="setMinValue"></a>QTimeEdit::setMinValue ( const <a href="qtime.html">QTime</a> & d )<tt> [virtual]</tt>
|
---|
| 177 | </h3><p>Sets the minimum time value to <em>d</em>.
|
---|
| 178 | See the <a href="qtimeedit.html#minValue-prop">"minValue"</a> property for details.
|
---|
| 179 | <h3 class=fn>void <a name="setMinute"></a>QTimeEdit::setMinute ( int m )<tt> [virtual protected]</tt>
|
---|
| 180 | </h3>
|
---|
| 181 | Sets the minute to <em>m</em>, which must be a valid minute, i.e. in the
|
---|
| 182 | range 0..59.
|
---|
| 183 |
|
---|
| 184 | <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>
|
---|
| 185 | </h3>
|
---|
| 186 | 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.
|
---|
| 187 | Similarly, if <em>max</em> is invalid no maximum time is set.
|
---|
| 188 |
|
---|
| 189 | <h3 class=fn>void <a name="setSecond"></a>QTimeEdit::setSecond ( int s )<tt> [virtual protected]</tt>
|
---|
| 190 | </h3>
|
---|
| 191 | Sets the second to <em>s</em>, which must be a valid second, i.e. in the
|
---|
| 192 | range 0..59.
|
---|
| 193 |
|
---|
| 194 | <h3 class=fn>void <a name="setSeparator"></a>QTimeEdit::setSeparator ( const <a href="qstring.html">QString</a> & s )<tt> [virtual]</tt>
|
---|
| 195 | </h3>
|
---|
| 196 | Sets the separator to <em>s</em>. Note that currently only the first
|
---|
| 197 | character of <em>s</em> is used.
|
---|
| 198 |
|
---|
| 199 | <h3 class=fn>void <a name="setTime"></a>QTimeEdit::setTime ( const <a href="qtime.html">QTime</a> & time )<tt> [virtual slot]</tt>
|
---|
| 200 | </h3><p>Sets the editor's time value to <em>time</em>.
|
---|
| 201 | See the <a href="qtimeedit.html#time-prop">"time"</a> property for details.
|
---|
| 202 | <h3 class=fn><a href="qtime.html">QTime</a> <a name="time"></a>QTimeEdit::time () const
|
---|
| 203 | </h3><p>Returns the editor's time value.
|
---|
| 204 | See the <a href="qtimeedit.html#time-prop">"time"</a> property for details.
|
---|
| 205 | <h3 class=fn>void <a name="valueChanged"></a>QTimeEdit::valueChanged ( const <a href="qtime.html">QTime</a> & time )<tt> [signal]</tt>
|
---|
| 206 | </h3>
|
---|
| 207 |
|
---|
| 208 | <p> This signal is emitted whenever the editor's value changes. The <em>time</em> parameter is the new value.
|
---|
| 209 |
|
---|
| 210 | <hr><h2>Property Documentation</h2>
|
---|
| 211 | <h3 class=fn>bool <a name="autoAdvance-prop"></a>autoAdvance</h3>
|
---|
| 212 | <p>This property holds whether the editor automatically advances to the next section.
|
---|
| 213 | <p>If autoAdvance is TRUE, the editor will automatically advance
|
---|
| 214 | focus to the next time section if a user has completed a section.
|
---|
| 215 | The default is FALSE.
|
---|
| 216 |
|
---|
| 217 | <p>Set this property's value with <a href="#setAutoAdvance">setAutoAdvance</a>() and get this property's value with <a href="#autoAdvance">autoAdvance</a>().
|
---|
| 218 | <h3 class=fn><a href="qtimeedit.html#Display-enum">Display</a> <a name="display-prop"></a>display</h3>
|
---|
| 219 | <p>This property holds the sections that are displayed in the time edit.
|
---|
| 220 | <p>The value can be any combination of the values in the Display enum.
|
---|
| 221 | By default, the widget displays hours, minutes and seconds.
|
---|
| 222 |
|
---|
| 223 | <p>Set this property's value with <a href="#setDisplay">setDisplay</a>() and get this property's value with <a href="#display">display</a>().
|
---|
| 224 | <h3 class=fn><a href="qtime.html">QTime</a> <a name="maxValue-prop"></a>maxValue</h3>
|
---|
| 225 | <p>This property holds the maximum time value.
|
---|
| 226 | <p>Setting the maximum time value is equivalent to calling
|
---|
| 227 | <a href="#setRange">QTimeEdit::setRange</a>( <a href="#minValue">minValue</a>(), <em>t</em> ), where <em>t</em> is the maximum
|
---|
| 228 | time. The default maximum time is 23:59:59.
|
---|
| 229 | <p> <p>See also <a href="#minValue-prop">minValue</a> and <a href="#setRange">setRange</a>().
|
---|
| 230 |
|
---|
| 231 | <p>Set this property's value with <a href="#setMaxValue">setMaxValue</a>() and get this property's value with <a href="#maxValue">maxValue</a>().
|
---|
| 232 | <h3 class=fn><a href="qtime.html">QTime</a> <a name="minValue-prop"></a>minValue</h3>
|
---|
| 233 | <p>This property holds the minimum time value.
|
---|
| 234 | <p>Setting the minimum time value is equivalent to calling
|
---|
| 235 | <a href="#setRange">QTimeEdit::setRange</a>( <em>t</em>, <a href="#maxValue">maxValue</a>() ), where <em>t</em> is the minimum
|
---|
| 236 | time. The default minimum time is 00:00:00.
|
---|
| 237 | <p> <p>See also <a href="#maxValue-prop">maxValue</a> and <a href="#setRange">setRange</a>().
|
---|
| 238 |
|
---|
| 239 | <p>Set this property's value with <a href="#setMinValue">setMinValue</a>() and get this property's value with <a href="#minValue">minValue</a>().
|
---|
| 240 | <h3 class=fn><a href="qtime.html">QTime</a> <a name="time-prop"></a>time</h3>
|
---|
| 241 | <p>This property holds the editor's time value.
|
---|
| 242 | <p>When changing the time property, if the time is less than
|
---|
| 243 | <a href="#minValue">minValue</a>(), or is greater than <a href="#maxValue">maxValue</a>(), nothing happens.
|
---|
| 244 |
|
---|
| 245 | <p>Set this property's value with <a href="#setTime">setTime</a>() and get this property's value with <a href="#time">time</a>().
|
---|
| 246 | <!-- eof -->
|
---|
| 247 | <hr><p>
|
---|
| 248 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 249 | Copyright © 1995-2007
|
---|
| 250 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 251 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 252 | <td>Copyright © 2007
|
---|
| 253 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 254 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 255 | </table></div></address></body>
|
---|
| 256 | </html>
|
---|