KD Chart 2  [rev.2.7]
Public Types | Public Member Functions | List of all members
KDGantt::DateTimeScaleFormatter Class Reference

#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 (Range range, const QString &formatString, Qt::Alignment alignment=Qt::AlignCenter)
 
 DateTimeScaleFormatter (Range range, const QString &formatString, const QString &templ, Qt::Alignment alignment=Qt::AlignCenter)
 
 DateTimeScaleFormatter (const DateTimeScaleFormatter &other)
 
QString format () const
 
QString format (const QDateTime &datetime) const
 
virtual QDateTime nextRangeBegin (const QDateTime &datetime) const
 
DateTimeScaleFormatteroperator= (const DateTimeScaleFormatter &other)
 
Range range () const
 
virtual QString text (const QDateTime &datetime) const
 
virtual ~DateTimeScaleFormatter ()
 

Detailed Description

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

Optionally, you can set an user defined text alignment flag. The default value is Qt::AlignCenter.

See also
DateTimeScaleFormatter::DateTimeScaleFormatter

This class even controls the range of the grid sections.

See also
KDGanttDateTimeScaleFormatter::Range

Definition at line 126 of file kdganttdatetimegrid.h.

Member Enumeration Documentation

Enumerator
Second 
Minute 
Hour 
Day 
Week 
Month 
Year 

Definition at line 130 of file kdganttdatetimegrid.h.

Constructor & Destructor Documentation

DateTimeScaleFormatter::DateTimeScaleFormatter ( Range  range,
const QString &  formatString,
Qt::Alignment  alignment = Qt::AlignCenter 
)

Definition at line 122 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 116 of file kdganttdatetimegrid.cpp.

DateTimeScaleFormatter::DateTimeScaleFormatter ( const DateTimeScaleFormatter other)

Definition at line 127 of file kdganttdatetimegrid.cpp.

DateTimeScaleFormatter::~DateTimeScaleFormatter ( )
virtual

Definition at line 132 of file kdganttdatetimegrid.cpp.

Member Function Documentation

Qt::Alignment DateTimeScaleFormatter::alignment ( ) const

Definition at line 181 of file kdganttdatetimegrid.cpp.

References d.

Referenced by operator=(), and KDGantt::DateTimeGrid::paintUserDefinedHeader().

QDateTime DateTimeScaleFormatter::currentRangeBegin ( const QDateTime &  datetime) const
virtual
Returns
the QDateTime being the begin of the range containing datetime
See also
nextRangeBegin

Definition at line 244 of file kdganttdatetimegrid.cpp.

References d, Day, Hour, Minute, Month, Second, Week, and Year.

Referenced by KDGantt::DateTimeGrid::mapFromChart(), and KDGantt::DateTimeGrid::paintUserDefinedHeader().

QString DateTimeScaleFormatter::format ( ) const
Returns
The format being used for formatting dates and times.

Definition at line 149 of file kdganttdatetimegrid.cpp.

References d.

Referenced by operator=(), and text().

QString DateTimeScaleFormatter::format ( const QDateTime &  datetime) const
Returns
The datetime as string respecting the format.

Definition at line 156 of file kdganttdatetimegrid.cpp.

References d.

QDateTime DateTimeScaleFormatter::nextRangeBegin ( const QDateTime &  datetime) const
virtual
Returns
the QDateTime being the begin of the range after the one containing datetime
See also
currentRangeBegin

Definition at line 189 of file kdganttdatetimegrid.cpp.

References d, Day, Hour, Minute, Month, Second, Week, and Year.

Referenced by KDGantt::DateTimeGrid::mapFromChart(), and KDGantt::DateTimeGrid::paintUserDefinedHeader().

DateTimeScaleFormatter & DateTimeScaleFormatter::operator= ( const DateTimeScaleFormatter other)

Definition at line 137 of file kdganttdatetimegrid.cpp.

References alignment(), format(), and range().

DateTimeScaleFormatter::Range DateTimeScaleFormatter::range ( ) const
Returns
The range of each item on a DateTimeGrid header.
See also
DateTimeScaleFormatter::Range

Definition at line 176 of file kdganttdatetimegrid.cpp.

References d.

Referenced by operator=().

QString DateTimeScaleFormatter::text ( const QDateTime &  datetime) const
virtual

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

Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/

https://www.kdab.com/development-resources/qt-tools/kd-chart/