KGantt::DateTimeGrid
#include <kganttdatetimegrid.h>
Public Types | |
enum | HeaderType { NoHeader , UpperHeader , LowerHeader } |
enum | Scale { ScaleAuto , ScaleHour , ScaleDay , ScaleWeek , ScaleMonth , ScaleUserDefined } |
Detailed Description
This implementation of AbstractGrid works with QDateTime and shows days and week numbers in the header
Definition at line 30 of file kganttdatetimegrid.h.
Member Enumeration Documentation
◆ HeaderType
enum KGantt::DateTimeGrid::HeaderType |
Definition at line 43 of file kganttdatetimegrid.h.
◆ Scale
enum KGantt::DateTimeGrid::Scale |
Definition at line 35 of file kganttdatetimegrid.h.
Constructor & Destructor Documentation
◆ DateTimeGrid()
DateTimeGrid::DateTimeGrid | ( | ) |
Definition at line 240 of file kganttdatetimegrid.cpp.
◆ ~DateTimeGrid()
|
override |
Definition at line 244 of file kganttdatetimegrid.cpp.
Member Function Documentation
◆ computeRect()
|
protected |
Return the rectangle that represents the date-range.
Definition at line 1103 of file kganttdatetimegrid.cpp.
◆ dateTimeRange()
Return a date-range represented by the rectangle.
Definition at line 1112 of file kganttdatetimegrid.cpp.
◆ dayWidth()
qreal DateTimeGrid::dayWidth | ( | ) | const |
- Returns
- The width in pixels for each day in the grid.
The default is 100 pixels.
Definition at line 262 of file kganttdatetimegrid.cpp.
◆ drawBackground()
|
overrideprotectedvirtual |
- Todo
- document this function
Reimplemented from KGantt::AbstractGrid.
Definition at line 1123 of file kganttdatetimegrid.cpp.
◆ drawDayBackground()
|
protectedvirtual |
Draw the background for a day.
Definition at line 1085 of file kganttdatetimegrid.cpp.
◆ drawDayForeground()
|
protectedvirtual |
Draw the foreground for a day.
Definition at line 1094 of file kganttdatetimegrid.cpp.
◆ drawForeground()
|
overrideprotectedvirtual |
- Todo
- document this function
Reimplemented from KGantt::AbstractGrid.
Definition at line 1168 of file kganttdatetimegrid.cpp.
◆ freeDays()
QSet< Qt::DayOfWeek > DateTimeGrid::freeDays | ( | ) | const |
- Returns
- The days marked as free in the grid.
Definition at line 349 of file kganttdatetimegrid.cpp.
◆ freeDaysBrush()
QBrush DateTimeGrid::freeDaysBrush | ( | ) | const |
- Returns
- The brush used to paint free days.
Definition at line 361 of file kganttdatetimegrid.cpp.
◆ mapFromChart() [1/2]
|
overridevirtual |
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 unsuccessful. 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 KGantt::AbstractGrid.
Definition at line 454 of file kganttdatetimegrid.cpp.
◆ mapFromChart() [2/2]
|
overridevirtual |
- Parameters
-
x The x value to get the datetime for.
- Returns
- The datetime corresponding to x or an invalid datetime if x cannot be mapped.
Reimplemented from KGantt::AbstractGrid.
Definition at line 402 of file kganttdatetimegrid.cpp.
◆ mapFromDateTime()
Maps a given point in time dt to an X value in the scene.
Definition at line 268 of file kganttdatetimegrid.cpp.
◆ mapToChart() [1/2]
|
overridevirtual |
- Parameters
-
idx The index to get the Span for.
- Returns
- The start and end pixels, in a Span, of the specified index.
Implements KGantt::AbstractGrid.
Definition at line 408 of file kganttdatetimegrid.cpp.
◆ mapToChart() [2/2]
- Parameters
-
value The datetime to get the x value for.
- Returns
- The x value corresponding to value or -1.0 if value is not a datetime variant.
Reimplemented from KGantt::AbstractGrid.
Definition at line 391 of file kganttdatetimegrid.cpp.
◆ mapToDateTime()
QDateTime DateTimeGrid::mapToDateTime | ( | qreal | x | ) | const |
Maps a given X value x in scene coordinates to a point in time.
Definition at line 274 of file kganttdatetimegrid.cpp.
◆ noInformationBrush()
QBrush DateTimeGrid::noInformationBrush | ( | ) | const |
- Returns
- the brush used to mark rows with no information.
Definition at line 385 of file kganttdatetimegrid.cpp.
◆ paintDayScaleHeader()
|
protectedvirtual |
Paints the day scale header.
- See also
- paintHeader()
Definition at line 975 of file kganttdatetimegrid.cpp.
◆ paintGrid()
|
overridevirtual |
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 KGantt::AbstractGrid.
Definition at line 665 of file kganttdatetimegrid.cpp.
◆ paintHeader()
|
overridevirtual |
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 KGantt::AbstractGrid.
Definition at line 799 of file kganttdatetimegrid.cpp.
◆ paintHourScaleHeader()
|
protectedvirtual |
Paints the hour scale header.
- See also
- paintHeader()
Definition at line 936 of file kganttdatetimegrid.cpp.
◆ paintMonthScaleHeader()
|
protectedvirtual |
Paints the week scale header.
- See also
- paintHeader()
Definition at line 1050 of file kganttdatetimegrid.cpp.
◆ paintUserDefinedHeader()
|
protectedvirtual |
Definition at line 852 of file kganttdatetimegrid.cpp.
◆ paintWeekScaleHeader()
|
protectedvirtual |
Paints the week scale header.
- See also
- paintHeader()
Definition at line 1013 of file kganttdatetimegrid.cpp.
◆ rowSeparators()
bool DateTimeGrid::rowSeparators | ( | ) | const |
- Returns
- true if row separators are used.
Definition at line 367 of file kganttdatetimegrid.cpp.
◆ scale()
DateTimeGrid::Scale DateTimeGrid::scale | ( | ) | const |
- Returns
- The scale used to paint the grid.
The default is ScaleAuto, which means the day scale will be used as long as the day width is less or equal to 500.
- See also
- Scale
Definition at line 295 of file kganttdatetimegrid.cpp.
◆ sectionHandleAtPos()
DateTimeGrid::HeaderType DateTimeGrid::sectionHandleAtPos | ( | int | x, |
int | y, | ||
const QRect & | headerRect ) const |
Definition at line 776 of file kganttdatetimegrid.cpp.
◆ setDayWidth()
void DateTimeGrid::setDayWidth | ( | qreal | w | ) |
- Parameters
-
w The width in pixels for each day in the grid.
The signal gridChanged() is emitted after the day width is changed.
Definition at line 280 of file kganttdatetimegrid.cpp.
◆ setFreeDays()
void DateTimeGrid::setFreeDays | ( | const QSet< Qt::DayOfWeek > & | fd | ) |
- Parameters
-
fd A set of days to mark as free in the grid.
Free days are filled with the alternate base brush of the palette used by the view. The signal gridChanged() is emitted after the free days are changed.
Definition at line 342 of file kganttdatetimegrid.cpp.
◆ setFreeDaysBrush()
Sets the brush to use to paint free days.
Definition at line 355 of file kganttdatetimegrid.cpp.
◆ setNoInformationBrush()
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 378 of file kganttdatetimegrid.cpp.
◆ setRowSeparators()
void DateTimeGrid::setRowSeparators | ( | bool | enable | ) |
- Parameters
-
enable Whether to use row separators or not.
Definition at line 372 of file kganttdatetimegrid.cpp.
◆ setScale()
void DateTimeGrid::setScale | ( | Scale | s | ) |
- Parameters
-
s The scale to be used to paint the grid.
The signal gridChanged() is emitted after the scale has changed.
- See also
- Scale
Following example demonstrates how to change the format of the header to use a date-scaling with the header-label displayed with the ISO date-notation.
Definition at line 288 of file kganttdatetimegrid.cpp.
◆ setStartDateTime()
- Parameters
-
dt The start date of the grid. It is used as the beginning of the horizontal scrollbar in the view.
Emits gridChanged() after the start date has changed.
Definition at line 255 of file kganttdatetimegrid.cpp.
◆ setUserDefinedLowerScale()
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.
- See also
- DateTimeScaleFormatter
Definition at line 301 of file kganttdatetimegrid.cpp.
◆ setUserDefinedUpperScale()
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.
- See also
- DateTimeScaleFormatter
Definition at line 309 of file kganttdatetimegrid.cpp.
◆ setWeekStart()
void DateTimeGrid::setWeekStart | ( | Qt::DayOfWeek | ws | ) |
- Parameters
-
ws The start day of the week.
A solid line is drawn on the grid to mark the beginning of a new week. Emits gridChanged() after the start day has changed.
Definition at line 329 of file kganttdatetimegrid.cpp.
◆ startDateTime()
QDateTime DateTimeGrid::startDateTime | ( | ) | const |
- Returns
- The QDateTime used as start date for the grid.
The default is three days before the current date.
Definition at line 249 of file kganttdatetimegrid.cpp.
◆ timeLine()
DateTimeTimeLine * DateTimeGrid::timeLine | ( | ) | const |
- Returns
- the timeline control object
Definition at line 1212 of file kganttdatetimegrid.cpp.
◆ userDefinedLowerScale()
DateTimeScaleFormatter * DateTimeGrid::userDefinedLowerScale | ( | ) | const |
- Returns
- The DateTimeScaleFormatter being used to render the lower scale.
Definition at line 317 of file kganttdatetimegrid.cpp.
◆ userDefinedUpperScale()
DateTimeScaleFormatter * DateTimeGrid::userDefinedUpperScale | ( | ) | const |
- Returns
- The DateTimeScaleFormatter being used to render the upper scale.
Definition at line 323 of file kganttdatetimegrid.cpp.
◆ weekStart()
Qt::DayOfWeek DateTimeGrid::weekStart | ( | ) | const |
- Returns
- The start day of the week
Definition at line 336 of file kganttdatetimegrid.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:21 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.