<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/widgets/qdatetimeedit.cpp:1599 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>QTimeEdit Class</title> <style type="text/css"><!-- h3.fn,span.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><a href="qtimeedit-members.html">List of all member functions.</a> <h2>Public Members</h2> <ul> <li><div class=fn><a href="#QTimeEdit"><b>QTimeEdit</b></a> ( QWidget * parent = 0, const char * name = 0 )</div></li> <li><div class=fn><a href="#QTimeEdit-2"><b>QTimeEdit</b></a> ( const QTime & time, QWidget * parent = 0, const char * name = 0 )</div></li> <li><div class=fn><a href="#~QTimeEdit"><b>~QTimeEdit</b></a> ()</div></li> <li><div class=fn>virtual void <a href="#setTime"><b>setTime</b></a> ( const QTime & time )</div></li> <li><div class=fn>QTime <a href="#time"><b>time</b></a> () const</div></li> <li><div class=fn>virtual void <a href="#setAutoAdvance"><b>setAutoAdvance</b></a> ( bool advance )</div></li> <li><div class=fn>bool <a href="#autoAdvance"><b>autoAdvance</b></a> () const</div></li> <li><div class=fn>virtual void <a href="#setMinValue"><b>setMinValue</b></a> ( const QTime & d )</div></li> <li><div class=fn>QTime <a href="#minValue"><b>minValue</b></a> () const</div></li> <li><div class=fn>virtual void <a href="#setMaxValue"><b>setMaxValue</b></a> ( const QTime & d )</div></li> <li><div class=fn>QTime <a href="#maxValue"><b>maxValue</b></a> () const</div></li> <li><div class=fn>virtual void <a href="#setRange"><b>setRange</b></a> ( const QTime & min, const QTime & max )</div></li> <li><div class=fn>QString <a href="#separator"><b>separator</b></a> () const</div></li> <li><div class=fn>virtual void <a href="#setSeparator"><b>setSeparator</b></a> ( const QString & s )</div></li> </ul> <h2>Signals</h2> <ul> <li><div class=fn>void <a href="#valueChanged"><b>valueChanged</b></a> ( const QTime & time )</div></li> </ul> <h2>Properties</h2> <ul> <li><div class=fn>bool <a href="#autoAdvance-prop"><b>autoAdvance</b></a> - whether the editor automatically advances to the next section</div></li> <li><div class=fn>QTime <a href="#maxValue-prop"><b>maxValue</b></a> - the maximum time value</div></li> <li><div class=fn>QTime <a href="#minValue-prop"><b>minValue</b></a> - the minimum time value</div></li> <li><div class=fn>QTime <a href="#time-prop"><b>time</b></a> - the time value of the editor</div></li> </ul> <h2>Protected Members</h2> <ul> <li><div class=fn>virtual QString <a href="#sectionFormattedText"><b>sectionFormattedText</b></a> ( int sec )</div></li> <li><div class=fn>virtual void <a href="#setHour"><b>setHour</b></a> ( int h )</div></li> <li><div class=fn>virtual void <a href="#setMinute"><b>setMinute</b></a> ( int m )</div></li> <li><div class=fn>virtual void <a href="#setSecond"><b>setSecond</b></a> ( int s )</div></li> </ul> <h2>Protected Slots</h2> <ul> <li><div class=fn>void <a href="#updateButtons"><b>updateButtons</b></a> ()</div></li> </ul> <hr><a name="details"></a><h2>Detailed Description</h2> The QTimeEdit class provides a time editor. <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 be initialised with a time, e.g. <p> <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>. <p> <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 name <em>name</em>. <p> <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 name <em>name</em>. <p> <h3 class=fn><a name="~QTimeEdit"></a>QTimeEdit::~QTimeEdit () </h3> Destroys the object and frees any allocated resources. <p> <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><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>. <p> <h3 class=fn><a href="qstring.html">QString</a> <a name="separator"></a>QTimeEdit::separator () const </h3> Returns the separator for the editor. <p> <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="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. <p> <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. <p> <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. <p> <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. <p> <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. <p> <h3 class=fn>void <a name="setTime"></a>QTimeEdit::setTime ( const <a href="qtime.html">QTime</a> & time )<tt> [virtual]</tt> </h3><p>Sets the time value of the editor 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 time value of the editor. See the <a href="qtimeedit.html#time-prop">"time"</a> property for details. <h3 class=fn>void <a name="updateButtons"></a>QTimeEdit::updateButtons ()<tt> [protected slot]</tt> </h3> Enables/disables the push buttons according to the min/max time for this widget. <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. <p> <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> <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="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>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>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 time value of the editor. <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> <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-2001 <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 © 2001 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a> <td align=right><div align=right>Qt version 3.0.2</div> </table></div></address></body> </html>