Qt 4.8: Q3DateTimeEdit Class Reference

Qt Reference Documentation

- Qt 4.8
- ALL VERSIONS

- A
- A
- A
- Print

# Q3DateTimeEdit Class Reference

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.

- List of all members, including inherited members

## Properties

- dateTime : QDateTime

- 58 properties inherited from QWidget
- 1 property inherited from QObject

## Public Functions

| 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 ()

## Reimplemented Public Functions

virtual QSize | minimumSizeHint () const
virtual QSize | sizeHint () const

- 221 public functions inherited from QWidget
- 29 public functions inherited from QObject
- 13 public functions inherited from QPaintDevice

## Public Slots

virtual void | setDateTime ( const QDateTime & dt )

- 19 public slots inherited from QWidget
- 1 public slot inherited from QObject

## Signals

void | valueChanged ( const QDateTime & datetime )

- 1 signal inherited from QWidget
- 1 signal inherited from QObject

## Reimplemented Protected Functions

virtual void | resizeEvent ( QResizeEvent * event )

- 37 protected functions inherited from QWidget
- 8 protected functions inherited from QObject
- 1 protected function inherited from QPaintDevice

### Additional Inherited Members

- 4 static public members inherited from QWidget
- 7 static public members inherited from QObject
- 37 protected functions inherited from QWidget
- 8 protected functions inherited from QObject
- 1 protected function inherited from QPaintDevice
- 1 protected slot inherited from QWidget

## Detailed Description

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.

## Property Documentation

### dateTime : QDateTime

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 )

## Member Function Documentation

### Q3DateTimeEdit::Q3DateTimeEdit ( QWidget * parent = 0, const char * name = 0 )

Constructs an empty datetime edit with parent parent and called name.

### Q3DateTimeEdit::Q3DateTimeEdit ( const QDateTime & datetime, QWidget * parent = 0, const char * name = 0 )

This is an overloaded function.

Constructs a datetime edit with the initial value datetime, parent parent and called name.

### Q3DateTimeEdit::~Q3DateTimeEdit ()

Destroys the object and frees any allocated resources.

### bool Q3DateTimeEdit::autoAdvance () const

Returns true if auto-advance is enabled, otherwise returns false.

See also setAutoAdvance().

### Q3DateEdit * Q3DateTimeEdit::dateEdit ()

Returns the internal widget used for editing the date part of the datetime.

### QSize Q3DateTimeEdit::minimumSizeHint () const`[virtual]`

Reimplemented from QWidget::minimumSizeHint().

### void Q3DateTimeEdit::resizeEvent ( QResizeEvent * event )`[virtual protected]`

Reimplemented from QWidget::resizeEvent().

Intercepts and handles the resize event, which hase a special meaning for the Q3DateTimeEdit.

### void Q3DateTimeEdit::setAutoAdvance ( bool advance )`[virtual]`

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().

### QSize Q3DateTimeEdit::sizeHint () const`[virtual]`

Reimplemented from QWidget::sizeHint().

### Q3TimeEdit * Q3DateTimeEdit::timeEdit ()

Returns the internal widget used for editing the time part of the datetime.

### void Q3DateTimeEdit::valueChanged ( const QDateTime & datetime )`[signal]`

This signal is emitted every time the date or time changes. The datetime argument is the new datetime.