Logo Search packages:      
Sourcecode: qtodo version File versions  Download package

QTodoDateEdit Class Reference

Inheritance diagram for QTodoDateEdit:

QTodoDateTimeEditBase

List of all members.


Detailed Description

The QTodoDateEdit class provides a date editor.

QTodoDateEdit 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 QTodoDateEdit 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 QTodoDateEdit be initialised with a date, e.g.

    QTodoDateEdit *dateEdit = new QTodoDateEdit( QDate::currentDate(), this );
    dateEdit->setRange( QDate::currentDate().addDays( -365 ),
                  QDate::currentDate().addDays(  365 ) );
    dateEdit->setOrder( QTodoDateEdit::MDY );
    dateEdit->setAutoAdvance( TRUE );

Here we've created a new QTodoDateEdit 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 QTodoDateEdit widget comprises three 'sections', one each for the year, month and day. You can change the separator character using QTodoDateTimeEditor::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

See also:
QDate QTodoTimeEdit QTodoDateTimeEdit

Definition at line 94 of file qtodo_datetimeedit.h.


Public Types

enum  Order { DMY, MDY, YMD, YDM }

Public Slots

virtual void setDate (const QDate &date)

Signals

void oldValueChanged (const QDate &date)
void valueChanged (const QDate &date)

Public Member Functions

bool autoAdvance () const
QDate date () const
QDate maxValue () const
QSize minimumSizeHint () const
QDate minValue () const
Order order () const
 QTodoDateEdit (const QDate &date, QWidget *parent=0, const char *name=0)
 QTodoDateEdit (QWidget *parent=0, const char *name=0)
void removeFirstNumber (int sec)
QString separator () const
virtual void setAutoAdvance (bool advance)
void setFocusInDate (const QDate &date)
bool setFocusSection (int s)
virtual void setMaxValue (const QDate &d)
virtual void setMinValue (const QDate &d)
virtual void setOrder (Order order)
virtual void setRange (const QDate &min, const QDate &max)
virtual void setSeparator (const QString &s)
QSize sizeHint () const
 ~QTodoDateEdit ()

Protected Slots

void updateButtons ()

Protected Member Functions

void addNumber (int sec, int num)
bool event (QEvent *e)
virtual void fix ()
virtual bool outOfRange (int y, int m, int d) const
void removeLastNumber (int sec)
void resizeEvent (QResizeEvent *)
QString sectionFormattedText (int sec)
virtual void setDay (int day)
virtual void setMonth (int month)
virtual void setYear (int year)
void stepDown ()
void stepUp ()
void timerEvent (QTimerEvent *)

Properties

bool autoAdvance
 whether the editor automatically advances to the next section
QDate date
 the editor's date value.
QDate maxValue
 the editor's maximum value
QDate minValue
 the editor's minimum value
Order order
 the order in which the year, month and day appear

Private Slots

void slotFocusInSignal ()
void slotFocusOutSignal ()

Private Member Functions

void init ()
QTodoDateEditoperator= (const QTodoDateEdit &)
 QTodoDateEdit (const QTodoDateEdit &)
int sectionLength (int sec) const
int sectionOffsetEnd (int sec) const
QString sectionText (int sec) const

Private Attributes

QTodoDateEditPrivate * d
QDate focus_in_date
int m_spin_width

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index