Eneboo - Documentación para desarrolladores
|
The QDateEdit class provides a date editor. Más...
#include <qdatetimeedit.h>
Tipos públicos | |
enum | Order { DMY, MDY, YMD, YDM, DMY, MDY, YMD, YDM } |
enum | Order { DMY, MDY, YMD, YDM, DMY, MDY, YMD, YDM } |
Slots públicos | |
virtual void | setDate (const QDate &date) |
virtual void | setDate (const QDate &date) |
Señales | |
void | valueChanged (const QDate &date) |
void | valueChanged (const QDate &date) |
Métodos públicos | |
QDateEdit (QWidget *parent=0, const char *name=0) | |
QDateEdit (const QDate &date, QWidget *parent=0, const char *name=0) | |
~QDateEdit () | |
QSize | sizeHint () const |
QSize | minimumSizeHint () const |
QDate | date () const |
virtual void | setOrder (Order order) |
Order | order () const |
virtual void | setAutoAdvance (bool advance) |
bool | autoAdvance () const |
virtual void | setMinValue (const QDate &d) |
QDate | minValue () const |
virtual void | setMaxValue (const QDate &d) |
QDate | maxValue () const |
virtual void | setRange (const QDate &min, const QDate &max) |
QString | separator () const |
virtual void | setSeparator (const QString &s) |
void | removeFirstNumber (int sec) |
QDateEdit (QWidget *parent=0, const char *name=0) | |
QDateEdit (const QDate &date, QWidget *parent=0, const char *name=0) | |
~QDateEdit () | |
QSize | sizeHint () const |
QSize | minimumSizeHint () const |
QDate | date () const |
virtual void | setOrder (Order order) |
Order | order () const |
virtual void | setAutoAdvance (bool advance) |
bool | autoAdvance () const |
virtual void | setMinValue (const QDate &d) |
QDate | minValue () const |
virtual void | setMaxValue (const QDate &d) |
QDate | maxValue () const |
virtual void | setRange (const QDate &min, const QDate &max) |
QString | separator () const |
virtual void | setSeparator (const QString &s) |
void | removeFirstNumber (int sec) |
Slots protegidos | |
void | updateButtons () |
void | updateButtons () |
Métodos protegidos | |
bool | event (QEvent *e) |
void | timerEvent (QTimerEvent *) |
void | resizeEvent (QResizeEvent *) |
void | stepUp () |
void | stepDown () |
QString | sectionFormattedText (int sec) |
void | addNumber (int sec, int num) |
void | removeLastNumber (int sec) |
bool | setFocusSection (int s) |
virtual void | setYear (int year) |
virtual void | setMonth (int month) |
virtual void | setDay (int day) |
virtual void | fix () |
virtual bool | outOfRange (int y, int m, int d) const |
bool | event (QEvent *e) |
void | timerEvent (QTimerEvent *) |
void | resizeEvent (QResizeEvent *) |
void | stepUp () |
void | stepDown () |
QString | sectionFormattedText (int sec) |
void | addNumber (int sec, int num) |
void | removeLastNumber (int sec) |
bool | setFocusSection (int s) |
virtual void | setYear (int year) |
virtual void | setMonth (int month) |
virtual void | setDay (int day) |
virtual void | fix () |
virtual bool | outOfRange (int y, int m, int d) const |
Propiedades | |
Order | order |
the order in which the year, month and day appear | |
QDate | date |
the editor's date value. | |
bool | autoAdvance |
whether the editor automatically advances to the next section | |
QDate | maxValue |
the editor's maximum value | |
QDate | minValue |
the editor's minimum value |
The QDateEdit class provides a date editor.
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 "-".
datetimewidgets.png Date Time Widgets
enum QDateEdit::Order |
enum QDateEdit::Order |
QDateEdit::QDateEdit | ( | QWidget * | parent = 0 , |
const char * | name = 0 |
||
) |
Constructs an empty date editor which is a child of parent and called name name.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Constructs a date editor with the initial value date, parent parent and called name.
The date editor is initialized with date.
QDateEdit::~QDateEdit | ( | ) |
Destroys the object and frees any allocated resources.
QDateEdit::QDateEdit | ( | QWidget * | parent = 0 , |
const char * | name = 0 |
||
) |
QDateEdit::~QDateEdit | ( | ) |
Implementa QDateTimeEditBase.
Implementa QDateTimeEditBase.
bool QDateEdit::autoAdvance | ( | ) | const |
bool QDateEdit::autoAdvance | ( | ) | const |
QDate QDateEdit::date | ( | ) | const |
QDate QDateEdit::date | ( | ) | const |
This is the main event handler; it handles event e. You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.
The main event handler first passes an event through all event filters that have been installed. If none of the filters intercept the event, it calls one of the specialized event handlers.
Key press and release events are treated differently from other events. event() checks for Tab and Shift+Tab and tries to move the focus appropriately. If there is no widget to move the focus to (or the key press is not Tab or Shift+Tab), event() calls keyPressEvent().
This function returns TRUE if it is able to pass the event over to someone (i.e. someone wanted the event); otherwise returns FALSE.
Reimplementado de QWidget.
void QDateEdit::fix | ( | ) | [protected, virtual] |
Attempts to fix any invalid date entries.
The rules applied are as follows:
If the year has four digits it is left unchanged. If the year has two digits, the year will be changed to four digits in the range current year - 70 to current year + 29. If the year has three digits in the range 100..999, the current millennium, i.e. 2000, will be added giving a year in the range 2100..2999. If the day or month is 0 then it will be set to 1 or the minimum valid day in the range.
Reimplementado en FLDateEdit.
virtual void QDateEdit::fix | ( | ) | [protected, virtual] |
Reimplementado en FLDateEdit.
QDate QDateEdit::maxValue | ( | ) | const |
QDate QDateEdit::maxValue | ( | ) | const |
QDate QDateEdit::minValue | ( | ) | const |
QDate QDateEdit::minValue | ( | ) | const |
Order QDateEdit::order | ( | ) | const |
Order QDateEdit::order | ( | ) | const |
void QDateEdit::removeFirstNumber | ( | int | sec | ) |
void QDateEdit::removeFirstNumber | ( | int | sec | ) |
void QDateEdit::removeLastNumber | ( | int | sec | ) | [protected, virtual] |
Implementa QDateTimeEditBase.
void QDateEdit::removeLastNumber | ( | int | sec | ) | [protected, virtual] |
Implementa QDateTimeEditBase.
void QDateEdit::resizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
Reimplementado de QWidget.
void QDateEdit::resizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive widget resize events. When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().
The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.
Widgets that have been created with the WNoAutoErase
flag will not be erased. Nevertheless, they will receive a paint event for their entire area afterwards. Again, no drawing needs to be done inside this handler.
The default implementation calls updateMask() if the widget has automatic masking enabled.
Reimplementado de QWidget.
Returns the formatted number for section sec. This will correspond to either the year, month or day section, depending on the current display order.
Implementa QDateTimeEditBase.
Implementa QDateTimeEditBase.
QString QDateEdit::separator | ( | ) | const |
QString QDateEdit::separator | ( | ) | const |
Returns the editor's separator.
virtual void QDateEdit::setAutoAdvance | ( | bool | advance | ) | [virtual] |
void QDateEdit::setAutoAdvance | ( | bool | advance | ) | [virtual] |
virtual void QDateEdit::setDate | ( | const QDate & | date | ) | [virtual, slot] |
void QDateEdit::setDate | ( | const QDate & | date | ) | [virtual, slot] |
void QDateEdit::setDay | ( | int | day | ) | [protected, virtual] |
Sets the day to day, which must be a valid day. The function will ensure that the day set is valid for the month and year.
virtual void QDateEdit::setDay | ( | int | day | ) | [protected, virtual] |
Implementa QDateTimeEditBase.
Implementa QDateTimeEditBase.
virtual void QDateEdit::setMaxValue | ( | const QDate & | d | ) | [inline, virtual] |
virtual void QDateEdit::setMaxValue | ( | const QDate & | d | ) | [inline, virtual] |
virtual void QDateEdit::setMinValue | ( | const QDate & | d | ) | [inline, virtual] |
virtual void QDateEdit::setMinValue | ( | const QDate & | d | ) | [inline, virtual] |
virtual void QDateEdit::setMonth | ( | int | month | ) | [protected, virtual] |
void QDateEdit::setMonth | ( | int | month | ) | [protected, virtual] |
Sets the month to month, which must be a valid month, i.e. between 1 and 12.
virtual void QDateEdit::setOrder | ( | Order | order | ) | [virtual] |
void QDateEdit::setOrder | ( | QDateEdit::Order | order | ) | [virtual] |
Sets the valid input range for the editor to be from min to max inclusive. If min is invalid no minimum date will be set. Similarly, if max is invalid no maximum date will be set.
virtual void QDateEdit::setSeparator | ( | const QString & | s | ) | [virtual] |
void QDateEdit::setSeparator | ( | const QString & | s | ) | [virtual] |
Sets the separator to s. Note that currently only the first character of s is used.
void QDateEdit::setYear | ( | int | year | ) | [protected, virtual] |
Sets the year to year, which must be a valid year. The range currently supported is from 1752 to 8000.
virtual void QDateEdit::setYear | ( | int | year | ) | [protected, virtual] |
void QDateEdit::stepDown | ( | ) | [protected, virtual] |
Implementa QDateTimeEditBase.
void QDateEdit::stepDown | ( | ) | [protected, virtual] |
Implementa QDateTimeEditBase.
void QDateEdit::stepUp | ( | ) | [protected, virtual] |
Implementa QDateTimeEditBase.
void QDateEdit::stepUp | ( | ) | [protected, virtual] |
Implementa QDateTimeEditBase.
void QDateEdit::timerEvent | ( | QTimerEvent * | ) | [protected, virtual] |
This event handler can be reimplemented in a subclass to receive timer events for the object.
QTimer provides a higher-level interface to the timer functionality, and also more general information about timers.
Reimplementado de QObject.
void QDateEdit::timerEvent | ( | QTimerEvent * | ) | [protected, virtual] |
Reimplementado de QObject.
void QDateEdit::updateButtons | ( | ) | [protected, slot] |
void QDateEdit::updateButtons | ( | ) | [protected, slot] |
Enables/disables the push buttons according to the min/max date for this widget.
void QDateEdit::valueChanged | ( | const QDate & | date | ) | [signal] |
void QDateEdit::valueChanged | ( | const QDate & | date | ) | [signal] |
This signal is emitted whenever the editor's value changes. The date parameter is the new value.
bool QDateEdit::autoAdvance [read, write] |
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.
QDate QDateEdit::date [read, write] |
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.
QDate QDateEdit::maxValue [read, write] |
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.
QDate QDateEdit::minValue [read, write] |
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.
Order QDateEdit::order [read, write] |
the order in which the year, month and day appear
The default order is locale dependent.