Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1161

libqt3-devel-3.0.2-2mdk.i586.rpm

<!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:727 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QDateEdit 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&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>QDateEdit Class Reference</h1>

<p>The QDateEdit class provides a date editor.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qdatetimeedit-h.html">qdatetimeedit.h</a>&gt;</tt>
<p><a href="qdateedit-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class=fn><a href="#QDateEdit"><b>QDateEdit</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li>
<li><div class=fn><a href="#QDateEdit-2"><b>QDateEdit</b></a> ( const&nbsp;QDate&nbsp;&amp;&nbsp;date, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li>
<li><div class=fn><a href="#~QDateEdit"><b>~QDateEdit</b></a> ()</div></li>
<li><div class=fn>enum <a href="#Order-enum"><b>Order</b></a> { DMY, MDY, YMD, YDM }</div></li>
<li><div class=fn>virtual void <a href="#setDate"><b>setDate</b></a> ( const&nbsp;QDate&nbsp;&amp;&nbsp;date )</div></li>
<li><div class=fn>QDate <a href="#date"><b>date</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setOrder"><b>setOrder</b></a> ( Order&nbsp;order )</div></li>
<li><div class=fn>Order <a href="#order"><b>order</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setAutoAdvance"><b>setAutoAdvance</b></a> ( bool&nbsp;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&nbsp;QDate&nbsp;&amp;&nbsp;d )</div></li>
<li><div class=fn>QDate <a href="#minValue"><b>minValue</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setMaxValue"><b>setMaxValue</b></a> ( const&nbsp;QDate&nbsp;&amp;&nbsp;d )</div></li>
<li><div class=fn>QDate <a href="#maxValue"><b>maxValue</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setRange"><b>setRange</b></a> ( const&nbsp;QDate&nbsp;&amp;&nbsp;min, const&nbsp;QDate&nbsp;&amp;&nbsp;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&nbsp;QString&nbsp;&amp;&nbsp;s )</div></li>
</ul>
<h2>Signals</h2>
<ul>
<li><div class=fn>void <a href="#valueChanged"><b>valueChanged</b></a> ( const&nbsp;QDate&nbsp;&amp;&nbsp;date )</div></li>
</ul>
<h2>Properties</h2>
<ul>
<li><div class=fn>bool <a href="#autoAdvance-prop"><b>autoAdvance</b></a>&nbsp;- whether the editor automatically advances to the next section</div></li>
<li><div class=fn>QDate <a href="#date-prop"><b>date</b></a>&nbsp;- the date value of the editor</div></li>
<li><div class=fn>QDate <a href="#maxValue-prop"><b>maxValue</b></a>&nbsp;- the maximum editor value</div></li>
<li><div class=fn>QDate <a href="#minValue-prop"><b>minValue</b></a>&nbsp;- the minimum editor value</div></li>
<li><div class=fn>Order <a href="#order-prop"><b>order</b></a>&nbsp;- the order in which the year, month and day appear</div></li>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class=fn>virtual QString <a href="#sectionFormattedText"><b>sectionFormattedText</b></a> ( int&nbsp;sec )</div></li>
<li><div class=fn>virtual void <a href="#setYear"><b>setYear</b></a> ( int&nbsp;year )</div></li>
<li><div class=fn>virtual void <a href="#setMonth"><b>setMonth</b></a> ( int&nbsp;month )</div></li>
<li><div class=fn>virtual void <a href="#setDay"><b>setDay</b></a> ( int&nbsp;day )</div></li>
<li><div class=fn>virtual void <a href="#fix"><b>fix</b></a> ()</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 QDateEdit class provides a date editor.
<p> QDateEdit 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 QDateEdit box. Dates
appear according the local date/time settings or in year, month, day
order if the system doesn't provide this information. It is recommended that
the QDateEdit be initialised with a date, e.g.
<p> <pre>
    QDateEdit *dateEdit = new QDateEdit( QDate::<a href="qdate.html#currentDate">currentDate</a>(), this );
    dateEdit-&gt;<a href="#setRange">setRange</a>( QDate::<a href="qdate.html#currentDate">currentDate</a>().addDays( -365 ),
                        QDate::<a href="qdate.html#currentDate">currentDate</a>().addDays(  365 ) );
    dateEdit-&gt;<a href="#setOrder">setOrder</a>( QDateEdit::<a href="#Order-enum">MDY</a> );
    dateEdit-&gt;<a href="#setAutoAdvance">setAutoAdvance</a>( TRUE );
    </pre>
 
<p> Here we've created a new QDateEdit 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="qdate.html">QDate</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 QDateEdit widget comprises three 'sections', one each
for the year, month and day. You can change the separator character
using QDateTimeEditor::setSeparator(), by default the separator will
be taken from the systems settings. If that is impossible, it defaults
to "-".
<p> <center><img src="datetimewidgets.png" alt="Date Time Widgets"></center> 
<p> <p>See also <a href="qdate.html">QDate</a>, <a href="qtimeedit.html">QTimeEdit</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="Order-enum"></a>QDateEdit::Order</h3>

<p> This enum defines the order in which the sections that comprise a date
appear.
<ul>
<li><tt>QDateEdit::MDY</tt> - month-day-year
<li><tt>QDateEdit::DMY</tt> - day-month-year
<li><tt>QDateEdit::YMD</tt> - year-month-day (the default)
<li><tt>QDateEdit::YDM</tt> - year-day-month (a very bad idea)
</ul>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QDateEdit"></a>QDateEdit::QDateEdit ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3> Constructs an empty date editor which is a child of <em>parent</em> and the
name <em>name</em>.
<p> 
<h3 class=fn><a name="QDateEdit-2"></a>QDateEdit::QDateEdit ( const&nbsp;<a href="qdate.html">QDate</a>&nbsp;&amp;&nbsp;date, <a href="qwidget.html">QWidget</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 date editor with the initial value <em>date</em>, parent <em>parent</em> and name <em>name</em>.
<p> The date editor is initialized with <em>date</em>.

<h3 class=fn><a name="~QDateEdit"></a>QDateEdit::~QDateEdit ()
</h3> Destroys the object and frees any allocated resources.
<p> 
<h3 class=fn>bool <a name="autoAdvance"></a>QDateEdit::autoAdvance () const
</h3><p>Returns TRUE if the editor automatically advances to the next section; otherwise returns FALSE.
See the <a href="qdateedit.html#autoAdvance-prop">"autoAdvance"</a> property for details.
<h3 class=fn><a href="qdate.html">QDate</a> <a name="date"></a>QDateEdit::date () const
</h3><p>Returns the date value of the editor.
See the <a href="qdateedit.html#date-prop">"date"</a> property for details.
<h3 class=fn>void <a name="fix"></a>QDateEdit::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 in the range 70..99, the previous
century, i.e. 1900, will be added giving a year in the range
1970..1999.
<li>If the year has two digits in the range 0..69, the current
century, i.e. 2000, will be added giving a year in the range
2000..2069.
<li>If the year is in the range 100..999, the current century, i.e.
2000, will be added giving a year in the range 2100..2999.
</ul>
<p> 
<h3 class=fn><a href="qdate.html">QDate</a> <a name="maxValue"></a>QDateEdit::maxValue () const
</h3><p>Returns the maximum editor value.
See the <a href="qdateedit.html#maxValue-prop">"maxValue"</a> property for details.
<h3 class=fn><a href="qdate.html">QDate</a> <a name="minValue"></a>QDateEdit::minValue () const
</h3><p>Returns the minimum editor value.
See the <a href="qdateedit.html#minValue-prop">"minValue"</a> property for details.
<h3 class=fn><a href="qdateedit.html#Order-enum">Order</a> <a name="order"></a>QDateEdit::order () const
</h3><p>Returns the order in which the year, month and day appear.
See the <a href="qdateedit.html#order-prop">"order"</a> property for details.
<h3 class=fn><a href="qstring.html">QString</a> <a name="sectionFormattedText"></a>QDateEdit::sectionFormattedText ( int&nbsp;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>.

<p> 
<h3 class=fn><a href="qstring.html">QString</a> <a name="separator"></a>QDateEdit::separator () const
</h3> Returns the separator for the editor.
<p> 
<h3 class=fn>void <a name="setAutoAdvance"></a>QDateEdit::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="qdateedit.html#autoAdvance-prop">"autoAdvance"</a> property for details.
<h3 class=fn>void <a name="setDate"></a>QDateEdit::setDate ( const&nbsp;<a href="qdate.html">QDate</a>&nbsp;&amp;&nbsp;date )<tt> [virtual]</tt>
</h3><p>Sets the date value of the editor to <em>date</em>.
See the <a href="qdateedit.html#date-prop">"date"</a> property for details.
<h3 class=fn>void <a name="setDay"></a>QDateEdit::setDay ( int&nbsp;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.
<p> 
<h3 class=fn>void <a name="setMaxValue"></a>QDateEdit::setMaxValue ( const&nbsp;<a href="qdate.html">QDate</a>&nbsp;&amp;&nbsp;d )<tt> [virtual]</tt>
</h3><p>Sets the maximum editor value to <em>d</em>.
See the <a href="qdateedit.html#maxValue-prop">"maxValue"</a> property for details.
<h3 class=fn>void <a name="setMinValue"></a>QDateEdit::setMinValue ( const&nbsp;<a href="qdate.html">QDate</a>&nbsp;&amp;&nbsp;d )<tt> [virtual]</tt>
</h3><p>Sets the minimum editor value to <em>d</em>.
See the <a href="qdateedit.html#minValue-prop">"minValue"</a> property for details.
<h3 class=fn>void <a name="setMonth"></a>QDateEdit::setMonth ( int&nbsp;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.
<p> 
<h3 class=fn>void <a name="setOrder"></a>QDateEdit::setOrder ( <a href="qdateedit.html#Order-enum">Order</a>&nbsp;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="qdateedit.html#order-prop">"order"</a> property for details.
<h3 class=fn>void <a name="setRange"></a>QDateEdit::setRange ( const&nbsp;<a href="qdate.html">QDate</a>&nbsp;&amp;&nbsp;min, const&nbsp;<a href="qdate.html">QDate</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 date will be set.
Similarly, if <em>max</em> is invalid no maximum date will be set.
<p> 
<h3 class=fn>void <a name="setSeparator"></a>QDateEdit::setSeparator ( const&nbsp;<a href="qstring.html">QString</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.
<p> 
<h3 class=fn>void <a name="setYear"></a>QDateEdit::setYear ( int&nbsp;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="qdate.html">QDate</a>.

<p> 
<h3 class=fn>void <a name="updateButtons"></a>QDateEdit::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>QDateEdit::valueChanged ( const&nbsp;<a href="qdate.html">QDate</a>&nbsp;&amp;&nbsp;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.
<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 date 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="qdate.html">QDate</a> <a name="date-prop"></a>date</h3> <p>This property holds the date value of the editor.
<p>If the date property is not valid, the editor displays all zeroes
and <a href="#date">QDateEdit::date</a>() will return an invalid date.  It is strongly
recommended that the editor be given a default date value.  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> 
<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="qdate.html">QDate</a> <a name="maxValue-prop"></a>maxValue</h3> <p>This property holds the maximum editor value.
<p>Setting the maximum date value for the editor is equivalent to
calling <a href="#setRange">QDateEdit::setRange</a>( <a href="#minValue">minValue</a>(), <em>d</em> ), where <em>d</em> is the
maximum date. Teh default maximum date is 8000-12-31.

<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="qdate.html">QDate</a> <a name="minValue-prop"></a>minValue</h3> <p>This property holds the minimum editor value.
<p>Setting the minimum date value is equivalent to calling
<a href="#setRange">QDateEdit::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>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="qdateedit.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">Qt toolkit</a>.
Copyright &copy; 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 &copy; 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>