TQDateTimeEdit Class

Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# TQDateTimeEdit Class Reference

The TQDateTimeEdit class combines a TQDateEdit and TQTimeEdit widget into a single widget for editing datetimes. More...

`#include <ntqdatetimeedit.h>`

Inherits TQWidget.

List of all member functions.

## Public Members

- TQDateTimeEdit ( TQWidget * parent = 0, const char * name = 0 )
- TQDateTimeEdit ( const TQDateTime & datetime, TQWidget * parent = 0, const char * name = 0 )
- ~TQDateTimeEdit ()
- TQDateTime dateTime () const
- TQDateEdit * dateEdit ()
- TQTimeEdit * timeEdit ()
- virtual void setAutoAdvance ( bool advance )
- bool autoAdvance () const

## Public Slots

- virtual void setDateTime ( const TQDateTime & dt )

## Signals

- void valueChanged ( const TQDateTime & datetime )

## Properties

- TQDateTime dateTime - the editor's datetime value

## Detailed Description

The TQDateTimeEdit class combines a TQDateEdit and TQTimeEdit widget into a single widget for editing datetimes.

TQDateTimeEdit consists of a TQDateEdit and TQTimeEdit 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 TQDateTimeEdit 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 TQDateEdit::setOrder() to change this. Times appear in the order hours, minutes, seconds using the 24 hour clock.

It is recommended that the TQDateTimeEdit is initialised with a datetime, e.g.

        TQDateTimeEdit *dateTimeEdit = new TQDateTimeEdit( TQDateTime::currentDateTime(), this );
        dateTimeEdit->dateEdit()->setRange( TQDateTime::currentDate(),
                                            TQDateTime::currentDate().addDays( 7 ) );

Here we've created a new TQDateTimeEdit 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 TQDateEdit widget consists of three 'sections', one each for the year, month and day. Similarly a TQTimeEdit 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 TQDateEdit, TQTimeEdit, Advanced Widgets, and Time and Date.

## Member Function Documentation

### TQDateTimeEdit::TQDateTimeEdit ( TQWidget * parent = 0, const char * name = 0 )

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

### TQDateTimeEdit::TQDateTimeEdit ( const TQDateTime & datetime, TQWidget * 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 called name.

### TQDateTimeEdit::~TQDateTimeEdit ()

Destroys the object and frees any allocated resources.

### bool TQDateTimeEdit::autoAdvance () const

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

See also setAutoAdvance().

### TQDateEdit * TQDateTimeEdit::dateEdit ()

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

### TQDateTime TQDateTimeEdit::dateTime () const

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

### void TQDateTimeEdit::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.

### void TQDateTimeEdit::setDateTime ( const TQDateTime & dt )`[virtual slot]`

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

### TQTimeEdit * TQDateTimeEdit::timeEdit ()

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

### void TQDateTimeEdit::valueChanged ( const TQDateTime & datetime )`[signal]`

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

## Property Documentation

### TQDateTime dateTime

This property holds the editor's datetime value.

The datetime edit's datetime which may be an invalid datetime.

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

This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.