#include <kexidatetimeformatter.h>
Public Member Functions | |
| KexiDateFormatter () | |
| ~KexiDateFormatter () | |
| TQDate | stringToDate (const TQString &str) const |
| TQVariant | stringToVariant (const TQString &str) const |
| TQString | dateToString (const TQDate &date) const |
| TQString | inputMask () const |
| TQString | separator () const |
| bool | isEmpty (const TQString &str) const |
Protected Attributes | |
| TQString | m_inputMask |
| TQDateEdit::Order | m_order |
| bool | m_longYear |
| bool | m_monthWithLeadingZero |
| bool | m_dayWithLeadingZero |
| TQString | m_qtFormat |
| int | m_yearpos |
| int | m_monthpos |
| int | m_daypos |
| TQString | m_separator |
Detailed Description
Date formatter used by KexiDateTableEdit and KexiDateTimeTableEdit.
Definition at line 27 of file kexidatetimeformatter.h.
Constructor & Destructor Documentation
◆ KexiDateFormatter()
| 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 TDELocale::setDateFormatShort() docs http://developer.kde.org/documentation/library/3.5-api/tdelibs-apidocs/tdecore/html/classTDELocale.html#a59
- Todo
- use TQRegExp (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::~KexiDateFormatter | ( | ) |
Creates new formatter with given settings
Definition at line 116 of file kexidatetimeformatter.cpp.
Member Function Documentation
◆ dateToString()
| TQString KexiDateFormatter::dateToString | ( | const TQDate & | date | ) | const |
Converts date to string using predefined settings.
- Returns
- null string if date is invalid
Definition at line 163 of file kexidatetimeformatter.cpp.
◆ inputMask()
|
inline |
- Returns
- Input mask generated using the formatter settings. Can be used in TQLineEdit::setInputMask().
Definition at line 55 of file kexidatetimeformatter.h.
◆ isEmpty()
| bool KexiDateFormatter::isEmpty | ( | const TQString & | str | ) | const |
- Returns
- true if str contains only spaces and separators according to the date format.
Definition at line 157 of file kexidatetimeformatter.cpp.
◆ separator()
|
inline |
- Returns
- separator for this date format, a single character like "-" or "/"
Definition at line 58 of file kexidatetimeformatter.h.
◆ stringToDate()
| TQDate KexiDateFormatter::stringToDate | ( | const TQString & | 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.
◆ stringToVariant()
| TQVariant KexiDateFormatter::stringToVariant | ( | const TQString & | str | ) | const |
Converts string str to date using predefined settings and returns TQVariant 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 TQVariant() is returned.
Definition at line 147 of file kexidatetimeformatter.cpp.
Member Data Documentation
◆ m_daypos
|
protected |
Definition at line 80 of file kexidatetimeformatter.h.
◆ m_dayWithLeadingZero
|
protected |
Definition at line 74 of file kexidatetimeformatter.h.
◆ m_inputMask
|
protected |
Input mask generated using the formatter settings. Can be used in TQLineEdit::setInputMask().
Definition at line 66 of file kexidatetimeformatter.h.
◆ m_longYear
|
protected |
4 or 2 digits
Definition at line 72 of file kexidatetimeformatter.h.
◆ m_monthpos
|
protected |
Definition at line 80 of file kexidatetimeformatter.h.
◆ m_monthWithLeadingZero
|
protected |
Definition at line 74 of file kexidatetimeformatter.h.
◆ m_order
|
protected |
Order of date sections.
Definition at line 69 of file kexidatetimeformatter.h.
◆ m_qtFormat
|
protected |
Date format used in dateToString().
Definition at line 77 of file kexidatetimeformatter.h.
◆ m_separator
|
protected |
Definition at line 82 of file kexidatetimeformatter.h.
◆ m_yearpos
|
protected |
Used in stringToDate() to convert string back to TQDate.
Definition at line 80 of file kexidatetimeformatter.h.
The documentation for this class was generated from the following files:
