#include <kdganttdatetimegrid.h>
Public Types | |
enum | Scale { ScaleAuto, ScaleHour, ScaleDay, ScaleWeek, ScaleMonth, ScaleUserDefined } |
Public Slots | |
virtual void | setModel (QAbstractItemModel *model) |
virtual void | setRootIndex (const QModelIndex &idx) |
Signals | |
void | gridChanged () |
Public Member Functions | |
DateTimeGrid () | |
qreal | dayWidth () const |
QSet< Qt::DayOfWeek > | freeDays () const |
QBrush | freeDaysBrush () const |
bool | isSatisfiedConstraint (const Constraint &c) const |
QVariant | mapFromChart (qreal x) const |
bool | mapFromChart (const Span &span, const QModelIndex &idx, const QList< Constraint > &constraints=QList< Constraint >()) const |
qreal | mapFromDateTime (const QDateTime &dt) const |
qreal | mapToChart (const QVariant &value) const |
Span | mapToChart (const QModelIndex &idx) const |
QDateTime | mapToDateTime (qreal x) const |
QAbstractItemModel * | model () const |
QBrush | noInformationBrush () const |
void | paintGrid (QPainter *painter, const QRectF &sceneRect, const QRectF &exposedRect, AbstractRowController *rowController=0, QWidget *widget=0) |
void | paintHeader (QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=0) |
QModelIndex | rootIndex () const |
bool | rowSeparators () const |
Scale | scale () const |
void | setDayWidth (qreal) |
void | setFreeDays (const QSet< Qt::DayOfWeek > &fd) |
void | setFreeDaysBrush (const QBrush brush) |
void | setNoInformationBrush (const QBrush &brush) |
void | setRowSeparators (bool enable) |
void | setScale (Scale s) |
void | setStartDateTime (const QDateTime &dt) |
void | setUserDefinedLowerScale (DateTimeScaleFormatter *lower) |
void | setUserDefinedUpperScale (DateTimeScaleFormatter *upper) |
void | setWeekStart (Qt::DayOfWeek) |
QDateTime | startDateTime () const |
DateTimeScaleFormatter * | userDefinedLowerScale () const |
DateTimeScaleFormatter * | userDefinedUpperScale () const |
Qt::DayOfWeek | weekStart () const |
virtual | ~DateTimeGrid () |
Protected Member Functions | |
QRectF | computeRect (const QDateTime &from, const QDateTime &to, const QRectF &rect) const |
QPair< QDateTime, QDateTime > | dateTimeRange (const QRectF &rect) const |
void | drawBackground (QPainter *paint, const QRectF &rect) |
virtual void | drawDayBackground (QPainter *painter, const QRectF &rect, const QDate &date) |
virtual void | drawDayForeground (QPainter *painter, const QRectF &rect, const QDate &date) |
void | drawForeground (QPainter *paint, const QRectF &rect) |
virtual void | paintDayScaleHeader (QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=0) |
virtual void | paintHourScaleHeader (QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=0) |
virtual void | paintMonthScaleHeader (QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=0) |
virtual void | paintUserDefinedHeader (QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, const DateTimeScaleFormatter *formatter, QWidget *widget=0) |
virtual void | paintWeekScaleHeader (QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=0) |
This implementation of AbstractGrid works with QDateTime and shows days and week numbers in the header
Definition at line 67 of file kdganttdatetimegrid.h.
Definition at line 72 of file kdganttdatetimegrid.h.
DateTimeGrid::DateTimeGrid | ( | ) |
Definition at line 288 of file kdganttdatetimegrid.cpp.
DateTimeGrid::~DateTimeGrid | ( | ) | [virtual] |
Definition at line 292 of file kdganttdatetimegrid.cpp.
QRectF DateTimeGrid::computeRect | ( | const QDateTime & | from, | |
const QDateTime & | to, | |||
const QRectF & | rect | |||
) | const [protected] |
QPair< QDateTime, QDateTime > DateTimeGrid::dateTimeRange | ( | const QRectF & | rect | ) | const [protected] |
qreal DateTimeGrid::dayWidth | ( | ) | const |
Definition at line 320 of file kdganttdatetimegrid.cpp.
References d.
Referenced by drawBackground(), drawForeground(), paintDayScaleHeader(), paintGrid(), paintHourScaleHeader(), paintMonthScaleHeader(), and paintWeekScaleHeader().
void DateTimeGrid::drawBackground | ( | QPainter * | paint, | |
const QRectF & | rect | |||
) | [protected, virtual] |
Reimplemented from KDGantt::AbstractGrid.
Definition at line 1182 of file kdganttdatetimegrid.cpp.
References d, dayWidth(), and drawDayBackground().
void DateTimeGrid::drawDayBackground | ( | QPainter * | painter, | |
const QRectF & | rect, | |||
const QDate & | date | |||
) | [protected, virtual] |
Definition at line 1140 of file kdganttdatetimegrid.cpp.
Referenced by drawBackground().
void DateTimeGrid::drawDayForeground | ( | QPainter * | painter, | |
const QRectF & | rect, | |||
const QDate & | date | |||
) | [protected, virtual] |
Definition at line 1150 of file kdganttdatetimegrid.cpp.
Referenced by drawForeground().
void DateTimeGrid::drawForeground | ( | QPainter * | paint, | |
const QRectF & | rect | |||
) | [protected, virtual] |
Reimplemented from KDGantt::AbstractGrid.
Definition at line 1225 of file kdganttdatetimegrid.cpp.
References d, dayWidth(), and drawDayForeground().
QSet< Qt::DayOfWeek > DateTimeGrid::freeDays | ( | ) | const |
Definition at line 444 of file kdganttdatetimegrid.cpp.
References d.
QBrush DateTimeGrid::freeDaysBrush | ( | ) | const |
Definition at line 459 of file kdganttdatetimegrid.cpp.
References d.
void KDGantt::AbstractGrid::gridChanged | ( | ) | [signal, inherited] |
bool AbstractGrid::isSatisfiedConstraint | ( | const Constraint & | c | ) | const [inherited] |
Definition at line 86 of file kdganttabstractgrid.cpp.
References KDGantt::Span::end(), KDGantt::Constraint::endIndex(), KDGantt::AbstractGrid::mapToChart(), and KDGantt::Constraint::startIndex().
Referenced by KDAB_SCOPED_UNITTEST_SIMPLE(), and mapFromChart().
QVariant DateTimeGrid::mapFromChart | ( | qreal | x | ) | const [virtual] |
x | The x value get the datetime for.
|
Reimplemented from KDGantt::AbstractGrid.
Definition at line 510 of file kdganttdatetimegrid.cpp.
References d.
bool DateTimeGrid::mapFromChart | ( | const Span & | span, | |
const QModelIndex & | idx, | |||
const QList< Constraint > & | constraints = QList<Constraint>() | |||
) | const [virtual] |
Maps the supplied Span to QDateTimes, and puts them as start time and end time for the supplied index.
span | The span used to map from.
|
Implements KDGantt::AbstractGrid.
Definition at line 577 of file kdganttdatetimegrid.cpp.
References d, KDGantt::Constraint::endIndex(), KDGantt::EndTimeRole, KDGantt::AbstractGrid::isSatisfiedConstraint(), KDGantt::Span::length(), KDGantt::AbstractGrid::model(), KDGantt::Span::start(), KDGantt::Constraint::startIndex(), KDGantt::StartTimeRole, KDGantt::Constraint::type(), and KDGantt::Constraint::TypeHard.
Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().
qreal DateTimeGrid::mapFromDateTime | ( | const QDateTime & | dt | ) | const |
Maps a given point in time dt to an X value in the scene.
Definition at line 327 of file kdganttdatetimegrid.cpp.
References d.
Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().
qreal DateTimeGrid::mapToChart | ( | const QVariant & | value | ) | const [virtual] |
value | The datetime to get the x value for.
|
Reimplemented from KDGantt::AbstractGrid.
Definition at line 496 of file kdganttdatetimegrid.cpp.
References d.
Span DateTimeGrid::mapToChart | ( | const QModelIndex & | idx | ) | const [virtual] |
idx | The index to get the Span for.
|
Implements KDGantt::AbstractGrid.
Definition at line 518 of file kdganttdatetimegrid.cpp.
References d, KDGantt::EndTimeRole, KDGantt::AbstractGrid::model(), and KDGantt::StartTimeRole.
Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().
QDateTime DateTimeGrid::mapToDateTime | ( | qreal | x | ) | const |
Maps a given X value x in scene coordinates to a point in time.
Definition at line 334 of file kdganttdatetimegrid.cpp.
References d.
Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().
QAbstractItemModel * AbstractGrid::model | ( | ) | const [inherited] |
Definition at line 64 of file kdganttabstractgrid.cpp.
References d.
Referenced by mapFromChart(), and mapToChart().
QBrush DateTimeGrid::noInformationBrush | ( | ) | const |
Definition at line 487 of file kdganttdatetimegrid.cpp.
References d.
void DateTimeGrid::paintDayScaleHeader | ( | QPainter * | painter, | |
const QRectF & | headerRect, | |||
const QRectF & | exposedRect, | |||
qreal | offset, | |||
QWidget * | widget = 0 | |||
) | [protected, virtual] |
Paints the day scale header.
Definition at line 1024 of file kdganttdatetimegrid.cpp.
References d, and dayWidth().
Referenced by paintHeader().
void DateTimeGrid::paintGrid | ( | QPainter * | painter, | |
const QRectF & | sceneRect, | |||
const QRectF & | exposedRect, | |||
AbstractRowController * | rowController = 0 , |
|||
QWidget * | widget = 0 | |||
) | [virtual] |
Implement this to paint the background of the view -- typically with some grid lines.
painter | -- the QPainter to paint with.
|
Implements KDGantt::AbstractGrid.
Definition at line 747 of file kdganttdatetimegrid.cpp.
References d, dayWidth(), KDGantt::AbstractRowController::indexAbove(), KDGantt::AbstractRowController::indexAt(), KDGantt::AbstractRowController::indexBelow(), KDGantt::ItemTypeRole, KDGantt::Span::length(), KDGantt::AbstractRowController::rowGeometry(), scale(), ScaleAuto, ScaleDay, ScaleHour, ScaleMonth, ScaleUserDefined, ScaleWeek, and KDGantt::Span::start().
void DateTimeGrid::paintHeader | ( | QPainter * | painter, | |
const QRectF & | headerRect, | |||
const QRectF & | exposedRect, | |||
qreal | offset, | |||
QWidget * | widget = 0 | |||
) | [virtual] |
Implement this to paint the header part of the view.
painter | -- the QPainter to paint with.
|
Implements KDGantt::AbstractGrid.
Definition at line 848 of file kdganttdatetimegrid.cpp.
References d, paintDayScaleHeader(), paintHourScaleHeader(), paintMonthScaleHeader(), paintUserDefinedHeader(), paintWeekScaleHeader(), scale(), ScaleAuto, ScaleDay, ScaleHour, ScaleMonth, ScaleUserDefined, ScaleWeek, startDateTime(), and KDGantt::DateTimeScaleFormatter::text().
void DateTimeGrid::paintHourScaleHeader | ( | QPainter * | painter, | |
const QRectF & | headerRect, | |||
const QRectF & | exposedRect, | |||
qreal | offset, | |||
QWidget * | widget = 0 | |||
) | [protected, virtual] |
Paints the hour scale header.
Definition at line 983 of file kdganttdatetimegrid.cpp.
References d, and dayWidth().
Referenced by paintHeader().
void DateTimeGrid::paintMonthScaleHeader | ( | QPainter * | painter, | |
const QRectF & | headerRect, | |||
const QRectF & | exposedRect, | |||
qreal | offset, | |||
QWidget * | widget = 0 | |||
) | [protected, virtual] |
Paints the week scale header.
Definition at line 1103 of file kdganttdatetimegrid.cpp.
References d, and dayWidth().
Referenced by paintHeader().
void DateTimeGrid::paintUserDefinedHeader | ( | QPainter * | painter, | |
const QRectF & | headerRect, | |||
const QRectF & | exposedRect, | |||
qreal | offset, | |||
const DateTimeScaleFormatter * | formatter, | |||
QWidget * | widget = 0 | |||
) | [protected, virtual] |
Definition at line 901 of file kdganttdatetimegrid.cpp.
References KDGantt::DateTimeScaleFormatter::alignment(), KDGantt::DateTimeScaleFormatter::currentRangeBegin(), d, KDGantt::DateTimeScaleFormatter::nextRangeBegin(), and KDGantt::DateTimeScaleFormatter::text().
Referenced by paintHeader().
void DateTimeGrid::paintWeekScaleHeader | ( | QPainter * | painter, | |
const QRectF & | headerRect, | |||
const QRectF & | exposedRect, | |||
qreal | offset, | |||
QWidget * | widget = 0 | |||
) | [protected, virtual] |
Paints the week scale header.
Definition at line 1064 of file kdganttdatetimegrid.cpp.
References d, and dayWidth().
Referenced by paintHeader().
QModelIndex AbstractGrid::rootIndex | ( | ) | const [inherited] |
Definition at line 78 of file kdganttabstractgrid.cpp.
References d.
bool DateTimeGrid::rowSeparators | ( | ) | const |
Definition at line 465 of file kdganttdatetimegrid.cpp.
References d.
DateTimeGrid::Scale DateTimeGrid::scale | ( | ) | const |
Definition at line 367 of file kdganttdatetimegrid.cpp.
References d.
Referenced by paintGrid(), and paintHeader().
void DateTimeGrid::setDayWidth | ( | qreal | w | ) |
w | The width in pixels for each day in the grid. |
Definition at line 343 of file kdganttdatetimegrid.cpp.
References d, and KDGantt::AbstractGrid::gridChanged().
void DateTimeGrid::setFreeDays | ( | const QSet< Qt::DayOfWeek > & | fd | ) |
fd | A set of days to mark as free in the grid. |
Definition at line 437 of file kdganttdatetimegrid.cpp.
References d, and KDGantt::AbstractGrid::gridChanged().
void DateTimeGrid::setFreeDaysBrush | ( | const QBrush | brush | ) |
Sets the brush to use to paint free days.
Definition at line 451 of file kdganttdatetimegrid.cpp.
References d.
void AbstractGrid::setModel | ( | QAbstractItemModel * | model | ) | [virtual, slot, inherited] |
Sets the QAbstractItemModel used by this grid implementation. This is called by the view, you should never need to call this from client code.
Definition at line 58 of file kdganttabstractgrid.cpp.
References d.
Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().
void DateTimeGrid::setNoInformationBrush | ( | const QBrush & | brush | ) |
Sets the brush used to display rows where no data is found. Default is a red pattern. If set to QBrush() rows with no information will not be marked.
Definition at line 479 of file kdganttdatetimegrid.cpp.
References d, and KDGantt::AbstractGrid::gridChanged().
void AbstractGrid::setRootIndex | ( | const QModelIndex & | idx | ) | [virtual, slot, inherited] |
Sets the root index used by this grid implementation. This is called by the view, you should never need to call this from client code.
Definition at line 72 of file kdganttabstractgrid.cpp.
References d.
void DateTimeGrid::setRowSeparators | ( | bool | enable | ) |
enable | Whether to use row separators or not. |
Definition at line 470 of file kdganttdatetimegrid.cpp.
References d.
void DateTimeGrid::setScale | ( | Scale | s | ) |
s | The scale to be used to paint the grid. |
Definition at line 355 of file kdganttdatetimegrid.cpp.
References d, and KDGantt::AbstractGrid::gridChanged().
void DateTimeGrid::setStartDateTime | ( | const QDateTime & | dt | ) |
dt | The start date of the grid. It is used as the beginning of the horizontal scrollbar in the view. |
Definition at line 310 of file kdganttdatetimegrid.cpp.
References d, and KDGantt::AbstractGrid::gridChanged().
Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().
void DateTimeGrid::setUserDefinedLowerScale | ( | DateTimeScaleFormatter * | lower | ) |
Sets the scale formatter for the lower part of the header to the user defined formatter to lower. The DateTimeGrid object takes ownership of the formatter, which has to be allocated with new.
You have to set the scale to ScaleUserDefined for this setting to take effect.
Definition at line 379 of file kdganttdatetimegrid.cpp.
References d, and KDGantt::AbstractGrid::gridChanged().
void DateTimeGrid::setUserDefinedUpperScale | ( | DateTimeScaleFormatter * | upper | ) |
Sets the scale formatter for the upper part of the header to the user defined formatter to upper. The DateTimeGrid object takes ownership of the formatter, which has to be allocated with new.
You have to set the scale to ScaleUserDefined for this setting to take effect.
Definition at line 393 of file kdganttdatetimegrid.cpp.
References d, and KDGantt::AbstractGrid::gridChanged().
void DateTimeGrid::setWeekStart | ( | Qt::DayOfWeek | ws | ) |
ws | The start day of the week. |
Definition at line 419 of file kdganttdatetimegrid.cpp.
References d, and KDGantt::AbstractGrid::gridChanged().
QDateTime DateTimeGrid::startDateTime | ( | ) | const |
Definition at line 300 of file kdganttdatetimegrid.cpp.
References d.
Referenced by paintHeader().
DateTimeScaleFormatter * DateTimeGrid::userDefinedLowerScale | ( | ) | const |
Definition at line 402 of file kdganttdatetimegrid.cpp.
References d.
DateTimeScaleFormatter * DateTimeGrid::userDefinedUpperScale | ( | ) | const |
Definition at line 409 of file kdganttdatetimegrid.cpp.
References d.
Qt::DayOfWeek DateTimeGrid::weekStart | ( | ) | const |
Definition at line 426 of file kdganttdatetimegrid.cpp.
References d.