#include <kdganttdatetimegrid.h>
Public Types | |
enum | Range { Second, Minute, Hour, Day, Week, Month, Year } |
Public Member Functions | |
Qt::Alignment | alignment () const |
virtual QDateTime | currentRangeBegin (const QDateTime &datetime) const |
DateTimeScaleFormatter (const DateTimeScaleFormatter &other) | |
DateTimeScaleFormatter (Range range, const QString &formatString, const QString &templ, Qt::Alignment alignment=Qt::AlignCenter) | |
DateTimeScaleFormatter (Range range, const QString &formatString, Qt::Alignment alignment=Qt::AlignCenter) | |
QString | format (const QDateTime &datetime) const |
QString | format () const |
virtual QDateTime | nextRangeBegin (const QDateTime &datetime) const |
DateTimeScaleFormatter & | operator= (const DateTimeScaleFormatter &other) |
Range | range () const |
virtual QString | text (const QDateTime &datetime) const |
virtual | ~DateTimeScaleFormatter () |
This class formats dates and times used in DateTimeGrid follawing a given format.
The format follows the format of QDateTime::toString(), with one addition: "w" is replaced with the week number of the date as number without a leading zero (1-53) "ww" is replaced with the week number of the date as number with a leading zero (01-53)
For example:
// formatter to print the complete date over the current week // This leads to the first day of the week being printed DateTimeScaleFormatter formatter = DateTimeScaleFormatter( DateTimeScaleFormatter::Week, "yyyy-MM-dd" );
Optionally, you can set an user defined text alignment flag. The default value is Qt::AlignCenter.
This class even controls the range of the grid sections.Definition at line 33 of file kdganttdatetimegrid.h.
Definition at line 37 of file kdganttdatetimegrid.h.
DateTimeScaleFormatter::DateTimeScaleFormatter | ( | Range | range, | |
const QString & | formatString, | |||
Qt::Alignment | alignment = Qt::AlignCenter | |||
) |
Definition at line 124 of file kdganttdatetimegrid.cpp.
DateTimeScaleFormatter::DateTimeScaleFormatter | ( | Range | range, | |
const QString & | format, | |||
const QString & | templ, | |||
Qt::Alignment | alignment = Qt::AlignCenter | |||
) |
Creates a DateTimeScaleFormatter using range and format. The text on the header is aligned following alignment.
Definition at line 118 of file kdganttdatetimegrid.cpp.
DateTimeScaleFormatter::DateTimeScaleFormatter | ( | const DateTimeScaleFormatter & | other | ) |
Definition at line 129 of file kdganttdatetimegrid.cpp.
DateTimeScaleFormatter::~DateTimeScaleFormatter | ( | ) | [virtual] |
Definition at line 134 of file kdganttdatetimegrid.cpp.
Qt::Alignment DateTimeScaleFormatter::alignment | ( | ) | const |
Definition at line 180 of file kdganttdatetimegrid.cpp.
References d.
Referenced by operator=(), and KDGantt::DateTimeGrid::paintUserDefinedHeader().
QDateTime DateTimeScaleFormatter::currentRangeBegin | ( | const QDateTime & | datetime | ) | const [virtual] |
Definition at line 243 of file kdganttdatetimegrid.cpp.
References d, Day, Hour, Minute, Month, Second, Week, and Year.
Referenced by KDGantt::DateTimeGrid::paintUserDefinedHeader().
QString DateTimeScaleFormatter::format | ( | const QDateTime & | datetime | ) | const |
Definition at line 155 of file kdganttdatetimegrid.cpp.
References d.
QString DateTimeScaleFormatter::format | ( | ) | const |
Definition at line 148 of file kdganttdatetimegrid.cpp.
References d.
Referenced by operator=(), and text().
QDateTime DateTimeScaleFormatter::nextRangeBegin | ( | const QDateTime & | datetime | ) | const [virtual] |
Definition at line 188 of file kdganttdatetimegrid.cpp.
References d, Day, Hour, Minute, Month, Second, Week, and Year.
Referenced by KDGantt::DateTimeGrid::paintUserDefinedHeader().
DateTimeScaleFormatter & DateTimeScaleFormatter::operator= | ( | const DateTimeScaleFormatter & | other | ) |
Definition at line 139 of file kdganttdatetimegrid.cpp.
References alignment(), format(), and range().
DateTimeScaleFormatter::Range DateTimeScaleFormatter::range | ( | ) | const |
Definition at line 175 of file kdganttdatetimegrid.cpp.
References d.
Referenced by operator=().
QString DateTimeScaleFormatter::text | ( | const QDateTime & | datetime | ) | const [virtual] |
Definition at line 168 of file kdganttdatetimegrid.cpp.
Referenced by KDGantt::DateTimeGrid::paintHeader(), and KDGantt::DateTimeGrid::paintUserDefinedHeader().