Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |
The QDateEdit class provides a date editor. More...
#include <qdatetimeedit.h>
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 in accordance with 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.
QDateEdit *dateEdit = new QDateEdit( QDate::currentDate(), this ); dateEdit->setRange( QDate::currentDate().addDays( -365 ), QDate::currentDate().addDays( 365 ) ); dateEdit->setOrder( QDateEdit::MDY ); dateEdit->setAutoAdvance( TRUE );
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.
The maximum and minimum values for a date value in the date editor default to the maximum and minimum values for a QDate. You can change this by calling setMinValue(), setMaxValue() or setRange().
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 not possible, it defaults to "-".
See also QDate, QTimeEdit, QDateTimeEdit, Advanced Widgets, and Time and Date.
This enum defines the order in which the sections that comprise a date appear.
Constructs a date editor with the initial value date, parent parent and called name.
The date editor is initialized with date.
Returns TRUE if the editor automatically advances to the next section; otherwise returns FALSE. See the "autoAdvance" property for details.
Returns the editor's date value. See the "date" property for details.
The rules applied are as follows:
Returns the editor's maximum value. See the "maxValue" property for details.
Returns the editor's minimum value. See the "minValue" property for details.
Returns the order in which the year, month and day appear. See the "order" property for details.
See also order.
Sets whether the editor automatically advances to the next section to advance. See the "autoAdvance" property for details.
Sets the editor's date value to date. See the "date" property for details.
Sets the editor's maximum value to d. See the "maxValue" property for details.
Sets the editor's minimum value to d. See the "minValue" property for details.
Sets the order in which the year, month and day appear to order. See the "order" property for details.
See also QDate.
This signal is emitted whenever the editor's value changes. The date parameter is the new value.
This property holds whether the editor automatically advances to the next section.
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.
Set this property's value with setAutoAdvance() and get this property's value with autoAdvance().
This property holds the editor's date value.
If the date property is not valid, the editor displays all zeroes and QDateEdit::date() will return an invalid date. It is strongly recommended that the editor is given a default date value (e.g. currentDate()). That way, attempts to set the date property to an invalid date will fail.
When changing the date property, if the date is less than minValue(), or is greater than maxValue(), nothing happens.
Set this property's value with setDate() and get this property's value with date().
This property holds the editor's maximum value.
Setting the maximum date value for the editor is equivalent to calling QDateEdit::setRange( minValue(), d ), where d is the maximum date. The default maximum date is 8000-12-31.
See also minValue and setRange().
Set this property's value with setMaxValue() and get this property's value with maxValue().
This property holds the editor's minimum value.
Setting the minimum date value is equivalent to calling QDateEdit::setRange( d, maxValue() ), where d is the minimum date. The default minimum date is 1752-09-14.
See also maxValue and setRange().
Set this property's value with setMinValue() and get this property's value with minValue().
This property holds the order in which the year, month and day appear.
The default order is locale dependent.
See also Order.
Set this property's value with setOrder() and get this property's value with order().
This file is part of the Qt toolkit. Copyright © 1995-2003 Trolltech. All Rights Reserved.
Copyright © 2003 Trolltech | Trademarks | Qt version 3.1.2
|