kdgantt
KDGantt::DateTimeGrid Class Reference
#include <kdganttdatetimegrid.h>

Detailed Description
This implementation of AbstractGrid works with QDateTime and shows days and week numbers in the header
- Todo:
- Extend to work with hours, minutes,... as units too.
Definition at line 34 of file kdganttdatetimegrid.h.
Public Types | |
| enum | Scale { ScaleAuto, ScaleHour, ScaleDay, ScaleWeek } |
Public Member Functions | |
| DateTimeGrid () | |
| qreal | dayWidth () const |
| QSet< Qt::DayOfWeek > | freeDays () const |
| bool | mapFromChart (const Span &span, const QModelIndex &idx, const QList< Constraint > &constraints=QList< Constraint >()) const |
| Span | mapToChart (const QModelIndex &idx) 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) |
| bool | rowSeparators () const |
| Scale | scale () const |
| void | setDayWidth (qreal) |
| void | setFreeDays (const QSet< Qt::DayOfWeek > &fd) |
| void | setRowSeparators (bool enable) |
| void | setScale (Scale s) |
| void | setStartDateTime (const QDateTime &dt) |
| void | setWeekStart (Qt::DayOfWeek) |
| QDateTime | startDateTime () const |
| Qt::DayOfWeek | weekStart () const |
| virtual | ~DateTimeGrid () |
Protected Member Functions | |
| 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 | paintWeekScaleHeader (QPainter *painter, const QRectF &headerRect, const QRectF &exposedRect, qreal offset, QWidget *widget=0) |
Member Enumeration Documentation
Definition at line 38 of file kdganttdatetimegrid.h.
Constructor & Destructor Documentation
| DateTimeGrid::DateTimeGrid | ( | ) |
Definition at line 78 of file kdganttdatetimegrid.cpp.
| DateTimeGrid::~DateTimeGrid | ( | ) | [virtual] |
Definition at line 82 of file kdganttdatetimegrid.cpp.
Member Function Documentation
| qreal DateTimeGrid::dayWidth | ( | ) | const |
- Returns:
- The width in pixels for each day in the grid.
Definition at line 110 of file kdganttdatetimegrid.cpp.
| QSet< Qt::DayOfWeek > DateTimeGrid::freeDays | ( | ) | const |
- Returns:
- The days marked as free in the grid.
Definition at line 179 of file kdganttdatetimegrid.cpp.
| 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.
- Parameters:
-
span The span used to map from. idx The index used for setting the start time and end time in the model. constraints A list of hard constraints to match against the start time and end time mapped from the span.
- Returns:
- true if the start time and time was successfully added to the model, or false if unsucessful. Also returns false if any of the constraints isn't satisfied. That is, if the start time of the constrained index is before the end time of the dependency index, or the end time of the constrained index is before the start time of the dependency index.
Implements KDGantt::AbstractGrid.
Definition at line 257 of file kdganttdatetimegrid.cpp.
| Span DateTimeGrid::mapToChart | ( | const QModelIndex & | idx | ) | const [virtual] |
- Parameters:
-
idx The index to get the Span for.
- Returns:
- The start and end pixels, in a Span, of the specified index.
Implements KDGantt::AbstractGrid.
Definition at line 198 of file kdganttdatetimegrid.cpp.
| void DateTimeGrid::paintDayScaleHeader | ( | QPainter * | painter, | |
| const QRectF & | headerRect, | |||
| const QRectF & | exposedRect, | |||
| qreal | offset, | |||
| QWidget * | widget = 0 | |||
| ) | [protected, virtual] |
Paints the day scale header.
- See also:
- paintHeader()
Definition at line 386 of file kdganttdatetimegrid.cpp.
| 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.
- Parameters:
-
painter -- the QPainter to paint with. sceneRect -- the total bounding rectangle of the scene. exposedRect -- the rectangle that needs to be painted. rowController -- the row controller used by the view -- may be 0. widget -- the widget used by the view -- may be 0.
Implements KDGantt::AbstractGrid.
Definition at line 283 of file kdganttdatetimegrid.cpp.
| 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.
- Parameters:
-
painter -- the QPainter to paint with. headerRect -- the total rectangle occupied by the header. exposedRect -- the rectangle that needs to be painted. offset -- the horizontal scroll offset of the view. widget -- the widget used by the view -- may be 0.
Implements KDGantt::AbstractGrid.
Definition at line 329 of file kdganttdatetimegrid.cpp.
| void DateTimeGrid::paintHourScaleHeader | ( | QPainter * | painter, | |
| const QRectF & | headerRect, | |||
| const QRectF & | exposedRect, | |||
| qreal | offset, | |||
| QWidget * | widget = 0 | |||
| ) | [protected, virtual] |
Paints the hour scale header.
- See also:
- paintHeader()
Definition at line 351 of file kdganttdatetimegrid.cpp.
| void DateTimeGrid::paintWeekScaleHeader | ( | QPainter * | painter, | |
| const QRectF & | headerRect, | |||
| const QRectF & | exposedRect, | |||
| qreal | offset, | |||
| QWidget * | widget = 0 | |||
| ) | [protected, virtual] |
Paints the week scale header.
- See also:
- paintHeader()
Definition at line 424 of file kdganttdatetimegrid.cpp.
| bool DateTimeGrid::rowSeparators | ( | ) | const |
| DateTimeGrid::Scale DateTimeGrid::scale | ( | ) | const |
- Returns:
- The scale used to paint the grid.
- See also:
- Scale
Definition at line 144 of file kdganttdatetimegrid.cpp.
| void DateTimeGrid::setDayWidth | ( | qreal | w | ) |
- Parameters:
-
w The width in pixels for each day in the grid. Day width is limited to minimum 1.0.
Definition at line 120 of file kdganttdatetimegrid.cpp.
| void DateTimeGrid::setFreeDays | ( | const QSet< Qt::DayOfWeek > & | fd | ) |
- Parameters:
-
fd A set of days to mark as free in the grid.
Definition at line 172 of file kdganttdatetimegrid.cpp.
| void DateTimeGrid::setRowSeparators | ( | bool | enable | ) |
- Parameters:
-
enable Whether to use row separators or not.
Definition at line 190 of file kdganttdatetimegrid.cpp.
| void DateTimeGrid::setScale | ( | Scale | s | ) |
- Parameters:
-
s The scale to be used to paint the grid.
- See also:
- Scale
Definition at line 132 of file kdganttdatetimegrid.cpp.
| void DateTimeGrid::setStartDateTime | ( | const QDateTime & | dt | ) |
- Parameters:
-
dt The start date of the grid. It is used as the beginning of the horizontal scrollbar in the view.
Definition at line 100 of file kdganttdatetimegrid.cpp.
| void DateTimeGrid::setWeekStart | ( | Qt::DayOfWeek | ws | ) |
- Parameters:
-
ws The start day of the week.
Definition at line 154 of file kdganttdatetimegrid.cpp.
| QDateTime DateTimeGrid::startDateTime | ( | ) | const |
- Returns:
- The QDateTime used as start date for the grid.
Definition at line 90 of file kdganttdatetimegrid.cpp.
| Qt::DayOfWeek DateTimeGrid::weekStart | ( | ) | const |
The documentation for this class was generated from the following files:
KDE 4.1 API Reference