kexi

KexiDateFormatter Class Reference

#include <kexidatetimeformatter.h>

List of all members.


Detailed Description

Date formatter used by KexiDateTableEdit and KexiDateTimeTableEdit.

Definition at line 27 of file kexidatetimeformatter.h.


Public Member Functions

 KexiDateFormatter ()
 ~KexiDateFormatter ()
QDate stringToDate (const QString &str) const
QVariant stringToVariant (const QString &str) const
QString dateToString (const QDate &date) const
QString inputMask () const
QString separator () const
bool isEmpty (const QString &str) const

Protected Attributes

QString m_inputMask
QDateEdit::Order m_order
bool m_longYear
bool m_monthWithLeadingZero
bool m_dayWithLeadingZero
QString m_qtFormat
int m_yearpos
int m_monthpos
int m_daypos
QString m_separator

Constructor & Destructor Documentation

KexiDateFormatter::KexiDateFormatter (  ) 

Creates new formatter with KDE setting for "short date".

Todo:
allow to override the format using column property and/or global app settings

Todo:
more variables are possible here, see void KLocale::setDateFormatShort() docs http://developer.kde.org/documentation/library/3.5-api/kdelibs-apidocs/kdecore/html/classKLocale.html#a59

Todo:
use QRegExp (to replace Y by 1, etc.) instead of hardcoded "%1%299%399" because df may contain also other characters

Definition at line 31 of file kexidatetimeformatter.cpp.

KexiDateFormatter::~KexiDateFormatter (  ) 

Todo:
KexiDateFormatter(... settings ...);

Definition at line 116 of file kexidatetimeformatter.cpp.


Member Function Documentation

QDate KexiDateFormatter::stringToDate ( const QString &  str  )  const

Converts string str to date using predefined settings.

Returns:
invalid date if the conversion is impossible

Definition at line 120 of file kexidatetimeformatter.cpp.

QVariant KexiDateFormatter::stringToVariant ( const QString &  str  )  const

Converts string str to date using predefined settings and returns QVariant containing the date value. This method does the same as stringToDate() but if string contains invalid date representation, e.g. contains only spaces and separators, null QVariant() is returned.

Definition at line 147 of file kexidatetimeformatter.cpp.

QString KexiDateFormatter::dateToString ( const QDate &  date  )  const

Converts date to string using predefined settings.

Returns:
null string if date is invalid

Definition at line 163 of file kexidatetimeformatter.cpp.

QString KexiDateFormatter::inputMask (  )  const [inline]

Returns:
Input mask generated using the formatter settings.

Can be used in QLineEdit::setInputMask().

Definition at line 55 of file kexidatetimeformatter.h.

QString KexiDateFormatter::separator (  )  const [inline]

Returns:
separator for this date format, a single character like "-" or "/"

Definition at line 58 of file kexidatetimeformatter.h.

bool KexiDateFormatter::isEmpty ( const QString &  str  )  const

Returns:
true if str contains only spaces and separators according to the date format.

Definition at line 157 of file kexidatetimeformatter.cpp.


Member Data Documentation

QString KexiDateFormatter::m_inputMask [protected]

Input mask generated using the formatter settings. Can be used in QLineEdit::setInputMask().

Definition at line 66 of file kexidatetimeformatter.h.

QDateEdit::Order KexiDateFormatter::m_order [protected]

Order of date sections.

Definition at line 69 of file kexidatetimeformatter.h.

4 or 2 digits

Definition at line 72 of file kexidatetimeformatter.h.

QString KexiDateFormatter::m_qtFormat [protected]

Date format used in dateToString().

Definition at line 77 of file kexidatetimeformatter.h.

Used in stringToDate() to convert string back to QDate.

Definition at line 80 of file kexidatetimeformatter.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys