KD Chart API Documentation 3.1
|
This class formats dates and times used in DateTimeGrid follawing a given format. More...
#include <kdganttdatetimegrid.h>
Public Types | |
enum | Range { Second , Minute , Hour , Day , Week , Month , Year } |
Public Member Functions | |
DateTimeScaleFormatter (const DateTimeScaleFormatter &other) | |
DateTimeScaleFormatter (Range range, const QString &formatString, const QString &templ, Qt::Alignment alignment=Qt::AlignCenter) | |
Creates a DateTimeScaleFormatter using range and format. | |
DateTimeScaleFormatter (Range range, const QString &formatString, Qt::Alignment alignment=Qt::AlignCenter) | |
virtual | ~DateTimeScaleFormatter () |
Qt::Alignment | alignment () const |
virtual QDateTime | currentRangeBegin (const QDateTime &datetime) const |
QString | format () const |
QString | format (const QDateTime &datetime) const |
virtual QDateTime | nextRangeBegin (const QDateTime &datetime) const |
DateTimeScaleFormatter & | operator= (const DateTimeScaleFormatter &other) |
Range | range () const |
virtual QString | text (const QDateTime &datetime) const |
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:
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 115 of file kdganttdatetimegrid.h.
Enumerator | |
---|---|
Second | |
Minute | |
Hour | |
Day | |
Week | |
Month | |
Year |
Definition at line 119 of file kdganttdatetimegrid.h.
DateTimeScaleFormatter::DateTimeScaleFormatter | ( | Range | range, |
const QString & | formatString, | ||
Qt::Alignment | alignment = Qt::AlignCenter |
||
) |
Definition at line 123 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 117 of file kdganttdatetimegrid.cpp.
DateTimeScaleFormatter::DateTimeScaleFormatter | ( | const DateTimeScaleFormatter & | other | ) |
Definition at line 128 of file kdganttdatetimegrid.cpp.
|
virtual |
Definition at line 133 of file kdganttdatetimegrid.cpp.
Qt::Alignment DateTimeScaleFormatter::alignment | ( | ) | const |
Definition at line 244 of file kdganttdatetimegrid.cpp.
References QDate::addDays(), QDateTime::addDays(), d, QDateTime::date(), Day, Hour, QTime::hour(), Minute, QTime::minute(), Month, QDate::month(), Second, QDateTime::setDate(), QDateTime::setTime(), QDateTime::time(), Week, QDate::weekNumber(), Year, and QDate::year().
QString DateTimeScaleFormatter::format | ( | ) | const |
Definition at line 150 of file kdganttdatetimegrid.cpp.
References d.
Referenced by operator=(), and text().
Definition at line 157 of file kdganttdatetimegrid.cpp.
References d, QDateTime::date(), QString::fromLatin1(), QString::length(), QString::number(), QString::replace(), QDateTime::toLocalTime(), QDateTime::toString(), QDate::weekNumber(), and QDate::year().
Definition at line 190 of file kdganttdatetimegrid.cpp.
References QDateTime::addDays(), QDate::addMonths(), QDateTime::addSecs(), QDate::addYears(), d, QDateTime::date(), Day, Hour, QTime::hour(), Minute, QTime::minute(), Month, QDate::month(), Second, QDateTime::setDate(), QDateTime::setTime(), QDateTime::time(), Week, QDate::weekNumber(), Year, and QDate::year().
DateTimeScaleFormatter & DateTimeScaleFormatter::operator= | ( | const DateTimeScaleFormatter & | other | ) |
Definition at line 138 of file kdganttdatetimegrid.cpp.
References alignment(), format(), and range().
DateTimeScaleFormatter::Range DateTimeScaleFormatter::range | ( | ) | const |
Definition at line 177 of file kdganttdatetimegrid.cpp.
References d.
Referenced by operator=().
Definition at line 170 of file kdganttdatetimegrid.cpp.
References QString::arg(), d, and format().
Referenced by KDGantt::DateTimeGrid::paintHeader().