Classes - Annotated - Tree - Functions - Home - Structure

QDateTimeEdit Class Reference

The QDateTimeEdit class combines a QDateEdit and QTimeEdit widget into a single widget for editing datetimes. More...

#include <qdatetimeedit.h>

Inherits QFrame.

List of all member functions.

Public Members

Signals

Properties

Protected Members

Protected Slots


Detailed Description

The QDateTimeEdit class combines a QDateEdit and QTimeEdit widget into a single widget for editing datetimes.

QDateTimeEdit consists of a QDateEdit and QTimeEdit 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 field to field within the QDateTimeEdit widget. Dates appear in year, month, day order by default, see setOrder() to change this. Times appear in the order hours, minutes, seconds using the 24 hour clock. It is recommended that the QDateTimeEdit is initialised with a datetime, e.g.

    QDateTimeEdit *datetimeedit = new QDateTimeEdit( QDateTime::currentDateTime(), this );
    dateedit->setRange( QDateTime::currentDateTime(),
                        QDateTime::currentDateTime().addDays( 7 ) );
    

Here we've created a new QDateTimeEdit object with a minimum date/time of now and a maximum date/time of a week from now.

Terminology: A QDateEdit widget consists of three 'sections', one each for the year, month and day. Similarly a QTimeEdit consists of three sections, one each for the hour, minute and second.

See also QDateEdit and QTimeEdit.


Member Function Documentation

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

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

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

QDateTimeEdit::~QDateTimeEdit ()

Destroys the object and frees any allocated resources.

bool QDateTimeEdit::autoAdvance () const

Returns TRUE if auto-advance is enabled, otherwise returns FALSE.

See also setAutoAdvance().

QString QDateTimeEdit::dateSeparator () const

Returns the separator for the date in this QDateTimeEdit. The default is "-".

See also setDateSeparator().

QDateTime QDateTimeEdit::dateTime () const

Returns the datetime value of the editor. See the "dateTime" property for details.

void QDateTimeEdit::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 a user has completed a section.

void QDateTimeEdit::setDateSeparator ( const QString & s ) [virtual]

Set the separator for the date in this QDateTimeEdit to s.

See also dateSeparator().

void QDateTimeEdit::setDateTime ( const QDateTime & dt ) [virtual]

Sets the datetime value of the editor to dt. See the "dateTime" property for details.

void QDateTimeEdit::setTimeSeparator ( const QString & s ) [virtual]

Set the separator for the time in this QDateTimeEdit to s.

See also timeSeparator().

QString QDateTimeEdit::timeSeparator () const

Returns the separator for the time in this QDateTimeEdit. The default is ":".

See also setTimeSeparator().

void QDateTimeEdit::valueChanged ( const QDateTime & datetime ) [signal]

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


Property Documentation

QDateTime dateTime

This property holds the datetime value of the editor.

dateTime() returns the current datetime in the editor, or an invalid datetime if the editor does not contain a valid datetime.

Set this property's value with setDateTime() and get this property's value with dateTime().


Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):


This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.


Copyright © 2000 TrolltechTrademarks
Qt version main-beta1