You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/html/tqtimeedit.html

257 lines
15 KiB

<!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:1780 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQTimeEdit 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&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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>TQTimeEdit Class Reference</h1>
<p>The TQTimeEdit class provides a time editor.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="tqdatetimeedit-h.html">tqdatetimeedit.h</a>&gt;</tt>
<p>Inherits <a href="tqdatetimeeditbase.html">TQDateTimeEditBase</a>.
<p><a href="tqtimeedit-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="#TQTimeEdit"><b>TQTimeEdit</b></a> ( TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#TQTimeEdit-2"><b>TQTimeEdit</b></a> ( const&nbsp;TQTime&nbsp;&amp;&nbsp;time, TQWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#~TQTimeEdit"><b>~TQTimeEdit</b></a> ()</li>
<li class=fn>TQTime <a href="#time"><b>time</b></a> () const</li>
<li class=fn>virtual void <a href="#setAutoAdvance"><b>setAutoAdvance</b></a> ( bool&nbsp;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&nbsp;TQTime&nbsp;&amp;&nbsp;d )</li>
<li class=fn>TQTime <a href="#minValue"><b>minValue</b></a> () const</li>
<li class=fn>virtual void <a href="#setMaxValue"><b>setMaxValue</b></a> ( const&nbsp;TQTime&nbsp;&amp;&nbsp;d )</li>
<li class=fn>TQTime <a href="#maxValue"><b>maxValue</b></a> () const</li>
<li class=fn>virtual void <a href="#setRange"><b>setRange</b></a> ( const&nbsp;TQTime&nbsp;&amp;&nbsp;min, const&nbsp;TQTime&nbsp;&amp;&nbsp;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&nbsp;TQString&nbsp;&amp;&nbsp;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&nbsp;disp )</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>virtual void <a href="#setTime"><b>setTime</b></a> ( const&nbsp;TQTime&nbsp;&amp;&nbsp;time )</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#valueChanged"><b>valueChanged</b></a> ( const&nbsp;TQTime&nbsp;&amp;&nbsp;time )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>bool <a href="#autoAdvance-prop"><b>autoAdvance</b></a>&nbsp;- whether the editor automatically advances to the next section</li>
<li class=fn>Display <a href="#display-prop"><b>display</b></a>&nbsp;- the sections that are displayed in the time edit</li>
<li class=fn>TQTime <a href="#maxValue-prop"><b>maxValue</b></a>&nbsp;- the maximum time value</li>
<li class=fn>TQTime <a href="#minValue-prop"><b>minValue</b></a>&nbsp;- the minimum time value</li>
<li class=fn>TQTime <a href="#time-prop"><b>time</b></a>&nbsp;- the editor's time value</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual TQString <a href="#sectionFormattedText"><b>sectionFormattedText</b></a> ( int&nbsp;sec )</li>
<li class=fn>virtual void <a href="#setHour"><b>setHour</b></a> ( int&nbsp;h )</li>
<li class=fn>virtual void <a href="#setMinute"><b>setMinute</b></a> ( int&nbsp;m )</li>
<li class=fn>virtual void <a href="#setSecond"><b>setSecond</b></a> ( int&nbsp;s )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQTimeEdit class provides a time editor.
<p>
<p> TQTimeEdit 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 TQTimeEdit
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 TQTimeEdit
is initialised with a time, e.g.
<pre>
<a href="tqtime.html">TQTime</a> timeNow = TQTime::<a href="tqtime.html#currentTime">currentTime</a>();
TQTimeEdit *timeEdit = new TQTimeEdit( timeNow, this );
timeEdit-&gt;<a href="#setRange">setRange</a>( timeNow, timeNow.<a href="tqtime.html#addSecs">addSecs</a>( 60 * 60 ) );
</pre>
Here we've created a TQTimeEdit 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="tqtime.html">TQTime</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 TQTimeWidget 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="tqtime.html">TQTime</a>, <a href="tqdateedit.html">TQDateEdit</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="Display-enum"></a>TQTimeEdit::Display</h3>
<p> This enum defines the sections that comprise a time
<ul>
<li><tt>TQTimeEdit::Hours</tt> - The hours section
<li><tt>TQTimeEdit::Minutes</tt> - The minutes section
<li><tt>TQTimeEdit::Seconds</tt> - The seconds section
<li><tt>TQTimeEdit::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="TQTimeEdit"></a>TQTimeEdit::TQTimeEdit ( <a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs an empty time edit with parent <em>parent</em> and called <em>name</em>.
<h3 class=fn><a name="TQTimeEdit-2"></a>TQTimeEdit::TQTimeEdit ( const&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;time, <a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;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="~TQTimeEdit"></a>TQTimeEdit::~TQTimeEdit ()
</h3>
Destroys the object and frees any allocated resources.
<h3 class=fn>bool <a name="autoAdvance"></a>TQTimeEdit::autoAdvance () const
</h3><p>Returns TRUE if the editor automatically advances to the next section; otherwise returns FALSE.
See the <a href="tqtimeedit.html#autoAdvance-prop">"autoAdvance"</a> property for details.
<h3 class=fn>uint <a name="display"></a>TQTimeEdit::display () const
</h3><p>Returns the sections that are displayed in the time edit.
See the <a href="tqtimeedit.html#display-prop">"display"</a> property for details.
<h3 class=fn><a href="tqtime.html">TQTime</a> <a name="maxValue"></a>TQTimeEdit::maxValue () const
</h3><p>Returns the maximum time value.
See the <a href="tqtimeedit.html#maxValue-prop">"maxValue"</a> property for details.
<h3 class=fn><a href="tqtime.html">TQTime</a> <a name="minValue"></a>TQTimeEdit::minValue () const
</h3><p>Returns the minimum time value.
See the <a href="tqtimeedit.html#minValue-prop">"minValue"</a> property for details.
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="sectionFormattedText"></a>TQTimeEdit::sectionFormattedText ( int&nbsp;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="tqstring.html">TQString</a> <a name="separator"></a>TQTimeEdit::separator () const
</h3>
Returns the editor's separator.
<h3 class=fn>void <a name="setAutoAdvance"></a>TQTimeEdit::setAutoAdvance ( bool&nbsp;advance )<tt> [virtual]</tt>
</h3><p>Sets whether the editor automatically advances to the next section to <em>advance</em>.
See the <a href="tqtimeedit.html#autoAdvance-prop">"autoAdvance"</a> property for details.
<h3 class=fn>void <a name="setDisplay"></a>TQTimeEdit::setDisplay ( uint&nbsp;disp )
</h3><p>Sets the sections that are displayed in the time edit to <em>disp</em>.
See the <a href="tqtimeedit.html#display-prop">"display"</a> property for details.
<h3 class=fn>void <a name="setHour"></a>TQTimeEdit::setHour ( int&nbsp;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>TQTimeEdit::setMaxValue ( const&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;d )<tt> [virtual]</tt>
</h3><p>Sets the maximum time value to <em>d</em>.
See the <a href="tqtimeedit.html#maxValue-prop">"maxValue"</a> property for details.
<h3 class=fn>void <a name="setMinValue"></a>TQTimeEdit::setMinValue ( const&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;d )<tt> [virtual]</tt>
</h3><p>Sets the minimum time value to <em>d</em>.
See the <a href="tqtimeedit.html#minValue-prop">"minValue"</a> property for details.
<h3 class=fn>void <a name="setMinute"></a>TQTimeEdit::setMinute ( int&nbsp;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>TQTimeEdit::setRange ( const&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;min, const&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;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>TQTimeEdit::setSecond ( int&nbsp;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>TQTimeEdit::setSeparator ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;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>TQTimeEdit::setTime ( const&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;time )<tt> [virtual slot]</tt>
</h3><p>Sets the editor's time value to <em>time</em>.
See the <a href="tqtimeedit.html#time-prop">"time"</a> property for details.
<h3 class=fn><a href="tqtime.html">TQTime</a> <a name="time"></a>TQTimeEdit::time () const
</h3><p>Returns the editor's time value.
See the <a href="tqtimeedit.html#time-prop">"time"</a> property for details.
<h3 class=fn>void <a name="valueChanged"></a>TQTimeEdit::valueChanged ( const&nbsp;<a href="tqtime.html">TQTime</a>&nbsp;&amp;&nbsp;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="tqtimeedit.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="tqtime.html">TQTime</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">TQTimeEdit::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="tqtime.html">TQTime</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">TQTimeEdit::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="tqtime.html">TQTime</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">TQt toolkit</a>.
Copyright &copy; 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 &copy; 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>