The Q3DateTimeEdit class combines a Q3DateEdit and Q3TimeEdit widget into a single widget for editing datetimes. More...
#include <Q3DateTimeEdit>
This class is part of the Qt 3 support library. It is provided to keep old source code working. We strongly advise against using it in new code. See Porting to Qt 4 for more information.
Inherits QWidget.
Q3DateTimeEdit ( QWidget * parent = 0, const char * name = 0 ) | |
Q3DateTimeEdit ( const QDateTime & datetime, QWidget * parent = 0, const char * name = 0 ) | |
~Q3DateTimeEdit () | |
bool | autoAdvance () const |
Q3DateEdit * | dateEdit () |
QDateTime | dateTime () const |
virtual void | setAutoAdvance ( bool advance ) |
Q3TimeEdit * | timeEdit () |
virtual QSize | minimumSizeHint () const |
virtual QSize | sizeHint () const |
virtual void | setDateTime ( const QDateTime & dt ) |
void | valueChanged ( const QDateTime & datetime ) |
virtual void | resizeEvent ( QResizeEvent * event ) |
The Q3DateTimeEdit class combines a Q3DateEdit and Q3TimeEdit widget into a single widget for editing datetimes.
Q3DateTimeEdit consists of a Q3DateEdit and Q3TimeEdit widget placed side by side and offers the functionality of both. The user can edit the date and time by using the keyboard or the arrow keys to increase/decrease date or time values. The Tab key can be used to move from section to section within the Q3DateTimeEdit widget, and the user can be moved automatically when they complete a section using setAutoAdvance(). The datetime can be set with setDateTime().
The date format is read from the system's locale settings. It is set to year, month, day order if that is not possible. See Q3DateEdit::setOrder() to change this. Times appear in the order hours, minutes, seconds using the 24 hour clock.
It is recommended that the Q3DateTimeEdit is initialised with a datetime, e.g.
Q3DateTimeEdit *dateTimeEdit = new Q3DateTimeEdit(QDateTime::currentDateTime(), this); dateTimeEdit->dateEdit()->setRange(QDateTime::currentDate(), QDateTime::currentDate().addDays(7));
Here we've created a new Q3DateTimeEdit set to the current date and time, and set the date to have a minimum date of now and a maximum date of a week from now.
Terminology: A Q3DateEdit widget consists of three 'sections', one each for the year, month and day. Similarly a Q3TimeEdit consists of three sections, one each for the hour, minute and second. The character that separates each date section is specified with setDateSeparator(); similarly setTimeSeparator() is used for the time sections.
See also Q3DateEdit and Q3TimeEdit.
This property holds the editor's datetime value.
The datetime edit's datetime which may be an invalid datetime.
Access functions:
QDateTime | dateTime () const |
virtual void | setDateTime ( const QDateTime & dt ) |
Constructs an empty datetime edit with parent parent and called name.
This is an overloaded function.
Constructs a datetime edit with the initial value datetime, parent parent and called name.
Destroys the object and frees any allocated resources.
Returns true if auto-advance is enabled, otherwise returns false.
See also setAutoAdvance().
Returns the internal widget used for editing the date part of the datetime.
Reimplemented from QWidget::minimumSizeHint().
Reimplemented from QWidget::resizeEvent().
Intercepts and handles the resize event, which hase a special meaning for the Q3DateTimeEdit.
Sets the auto advance property of the editor to advance. If set to true, the editor will automatically advance focus to the next date or time section if the user has completed a section.
See also autoAdvance().
Reimplemented from QWidget::sizeHint().
Returns the internal widget used for editing the time part of the datetime.
This signal is emitted every time the date or time changes. The datetime argument is the new datetime.