kdgantt
KDGanttViewItem Class Reference
#include <KDGanttViewItem.h>
Inheritance diagram for KDGanttViewItem:

Detailed Description
This class represents an item in a Gantt chart.This class is an abstract base class, it cannot be instantiated directly. Instead, you should create items of one of the subclasses. This class provides methods common to all Gantt items.
The initialization of the shapes/colors of the item works as follows:
Shapes: When a new item is created, the shapes are set to the default values for items of the type of this item, defined in the KDGanttView class with void setShapes( KDGanttViewItem::Type type, KDGanttViewItem::Shape start, KDGanttViewItem::Shape middle, KDGanttViewItem::Shape end ); If there is no default value defined for this type, the shapes are set as follows: For TaskViewItems all three shapes are set to Square. For SummaryViewItems all three shapes are set to TriangleDown. For EventViewItems all three shapes are set to Diamond.
Colors: When a new item is created, the colors are set to the default values for items of the type of this item, defined in the KDGanttView class with void setColors( KDGanttViewItem::Type type, const QColor& start, const QColor& middle, const QColor& end ); If there is no default value defined for this type, the colors of the shapes are set to the default color for items of this type, defined in the KDGanttView class with: void setDefaultColor( KDGanttViewItem::Type type, const QColor& ); The initial default color in the KDGanttView class is set to blue for KDGanttViewItem::Event, green for KDGanttViewItem::Task, cyan for KDGanttViewItem::Summary.
Highlight Colors: When a new item is created, the highlight colors are set to the default values for items of the type of this item, defined in the KDGanttView class with: void setHighlightColors( KDGanttViewItem::Type type, const QColor& start, const QColor& middle, const QColor& end ); If there is no default value defined for this type, the highlight colors of the shapes are set to the default color for items of this type, defined in the KDGanttView class with: void setDefaultHighlightColor( KDGanttViewItem::Type type, const QColor& ); The initial default highlight color in the KDGanttView class is set to red for all types.
Start/End time: When a new item is created, the start time and the end time is set automatically. The time, which is currently displayed in the middle of the Gantt View, is set as start/end time. At startup of a newly created Gantt view, this is the current time.
The Priority: The priority is set with setPriority(). The priority determines which items are painted over which other items. The item with the highest priority is painted on top of all others. The priority for an item can be between 1 and 199. A priority less than 100 means that the item is painted below the grid in the Gantt chart. For Task items, the default priority is 50, for all other items it is 150. This feature only makes sense for an item which is a child of another item, for which displaySubitemsAsGroup() property is set to true.
The Display Mode: The display mode is set with setDisplaySubitemsAsGroup(). In the normal view mode (set with setDisplaySubitemsAsGroup( false ); ), an item is displayed in the same manner, when its child items are shown or not. In the other mode (set with setDisplaySubitemsAsGroup( true ); ), called "calendar mode", the item is displayed as follows: If the item has no children, it is displayed as usual. If the item is opened (i.e., its children are displayed), the start/end time of this item is computed automatically according to the earliest start time/latest end time of its children. The item and its children are displayed as usual. If the item is closed (i.e., its children are hidden in the left list view), the item itself is hidden, and its children are displayed on the timeline of this item instead. To control the painting of overlapping children, call setPriority() for the childs.
Blocking of user interaction to open item: If you want to block users to open items used as parents of calendar items, call KDGanttView::setCalendarMode( true );
Example 1, Color: If you create an instance of a KDGanttView class and add a SummaryViewItem without setting any color/shape values, you get an item with three shapes of the form TriangleDown in the color magenta. If the item is highlighted, the color will change to the highlight color red.
Example 2, Calender View: To use a Gantt view as a calendar view, call KDGanttView::setCalendarMode( true ); KDGanttView::setDisplaySubitemsAsGroup( true ); Insert root items in the Gantt view. Insert items as children of these root item in the Gantt view. You may use any item type as parent and child; there are no limitations. It is, however, recommended to use KDGanttViewTaskItems Actually, you may add child items to the children themselves. Such a child behaves then like a parent. Now set the start/end time of the children to specify a time interval for these items.
Definition at line 58 of file KDGanttViewItem.h.
Public Types | |
enum | Type { Event, Task, Summary } |
enum | Shape { TriangleDown, TriangleUp, Diamond, Square, Circle } |
Public Member Functions | |
virtual | ~KDGanttViewItem () |
Type | type () const |
void | setEnabled (bool on) |
bool | enabled () const |
virtual void | setOpen (bool o) |
void | setItemVisible (bool on) |
bool | itemVisible () const |
void | setEditable (bool editable) |
bool | editable () const |
void | setShowNoInformation (bool show) |
bool | showNoInformation () |
void | setDisplaySubitemsAsGroup (bool show) |
bool | displaySubitemsAsGroup () const |
void | setPriority (int prio) |
int | priority () |
virtual void | setStartTime (const QDateTime &start) |
QDateTime | startTime () const |
virtual void | setEndTime (const QDateTime &end) |
QDateTime | endTime () const |
void | setText (const QString &text) |
QString | text () const |
void | setListViewText (const QString &text, int column=0) |
void | setListViewText (int column, const QString &text) |
QString | listViewText (int column=0) const |
void | setFont (const QFont &font) |
QFont | font () const |
void | setTooltipText (const QString &text) |
QString | tooltipText () const |
void | setWhatsThisText (const QString &text) |
QString | whatsThisText () const |
void | setPixmap (int column, const QPixmap &pixmap) |
void | setPixmap (const QPixmap &pixmap) |
const QPixmap * | pixmap (int column=0) const |
void | setHighlight (bool) |
bool | highlight () const |
bool | subitemIsCalendar () const |
void | setShapes (Shape start, Shape middle, Shape end) |
void | shapes (Shape &start, Shape &middle, Shape &end) const |
void | setDefaultColor (const QColor &) |
QColor | defaultColor () const |
void | setColors (const QColor &start, const QColor &middle, const QColor &end) |
void | colors (QColor &start, QColor &middle, QColor &end) const |
void | setDefaultHighlightColor (const QColor &) |
QColor | defaultHighlightColor () const |
void | setHighlightColors (const QColor &start, const QColor &middle, const QColor &end) |
void | highlightColors (QColor &start, QColor &middle, QColor &end) const |
void | setTextColor (const QColor &color) |
QColor | textColor () const |
void | setProgress (int percent) |
void | setFloatStartTime (const QDateTime &start) |
void | setFloatEndTime (const QDateTime &end) |
KDGanttViewItem * | firstChild () const |
KDGanttViewItem * | nextSibling () const |
KDGanttViewItem * | parent () const |
KDGanttViewItem * | itemAbove () |
KDGanttViewItem * | itemBelow (bool includeDisabled=true) |
KDGanttViewItem * | getChildByName (const QString &name) |
QString | name () const |
void | createNode (QDomDocument &doc, QDomElement &parentElement) |
Static Public Member Functions | |
static KDGanttViewItem * | find (const QString &name) |
static KDGanttViewItem * | createFromDomElement (KDGanttView *view, QDomElement &element) |
static KDGanttViewItem * | createFromDomElement (KDGanttView *view, KDGanttViewItem *previous, QDomElement &element) |
static KDGanttViewItem * | createFromDomElement (KDGanttViewItem *parent, QDomElement &element) |
static KDGanttViewItem * | createFromDomElement (KDGanttViewItem *parent, KDGanttViewItem *previous, QDomElement &element) |
Protected Member Functions | |
KDGanttViewItem (Type type, KDGanttView *view, const QString &lvtext=QString::null, const QString &name=QString::null) | |
KDGanttViewItem (Type type, KDGanttViewItem *parent, const QString &lvtext=QString::null, const QString &name=QString::null) | |
KDGanttViewItem (Type type, KDGanttView *view, KDGanttViewItem *after, const QString &lvtext=QString::null, const QString &name=QString::null) | |
KDGanttViewItem (Type type, KDGanttViewItem *parent, KDGanttViewItem *after, const QString &lvtext=QString::null, const QString &name=QString::null) | |
void | updateCanvasItems () |
int | getCoordY () |
QDateTime | myChildStartTime () |
QDateTime | myChildEndTime () |
void | generateAndInsertName (const QString &name) |
void | moveTextCanvas (int x, int y) |
Protected Attributes | |
bool | isVisibleInGanttView |
KDCanvasLine * | startLine |
KDCanvasLine * | endLine |
KDCanvasLine * | startLineBack |
KDCanvasLine * | endLineBack |
KDCanvasLine * | actualEnd |
KDCanvasPolygonItem * | startShape |
KDCanvasPolygonItem * | midShape |
KDCanvasPolygonItem * | endShape |
KDCanvasPolygonItem * | progressShape |
KDCanvasPolygonItem * | startShapeBack |
KDCanvasPolygonItem * | midShapeBack |
KDCanvasPolygonItem * | endShapeBack |
KDCanvasPolygonItem * | floatStartShape |
KDCanvasPolygonItem * | floatEndShape |
KDGanttView * | myGanttView |
KDCanvasText * | textCanvas |
QString | textCanvasText |
QDateTime | myStartTime |
QDateTime | myEndTime |
bool | isHighlighted |
bool | isEditable |
int | myItemSize |
bool | blockUpdating |
int | myProgress |
QDateTime | myFloatStartTime |
QDateTime | myFloatEndTime |
Friends | |
class | KDGanttView |
class | KDTimeTableWidget |
class | KDTimeHeaderWidget |
class | KDListView |
class | KDGanttViewTaskLink |
class | KDGanttViewTaskLinkGroup |
class | KDGanttCanvasView |
class | KDGanttViewItemDrag |
class | itemAttributeDialog |
Member Enumeration Documentation
|
This enum is used in order to specify the shapes of a Gantt chart item. Definition at line 62 of file KDGanttViewItem.h. |
|
This enum is used in order to return the type of a Gantt chart item. Definition at line 61 of file KDGanttViewItem.h. |
Constructor & Destructor Documentation
|
Constructs an empty Gantt item.
Definition at line 171 of file KDGanttViewItem.cpp. |
|
Constructs an empty Gantt item.
Definition at line 191 of file KDGanttViewItem.cpp. |
|
Constructs an empty Gantt item.
Definition at line 212 of file KDGanttViewItem.cpp. |
|
Constructs an empty Gantt item.
Definition at line 234 of file KDGanttViewItem.cpp. |
|
Destroys the object and frees any allocated resources. Definition at line 248 of file KDGanttViewItem.cpp. |
Member Function Documentation
|
Returns the colors used for this item
Definition at line 985 of file KDGanttViewItem.cpp. |
|
Creates a KDGanttViewItem according to the specification in a DOM element.
Definition at line 1710 of file KDGanttViewItem.cpp. |
|
Creates a KDGanttViewItem according to the specification in a DOM element.
Definition at line 1679 of file KDGanttViewItem.cpp. |
|
Creates a KDGanttViewItem according to the specification in a DOM element.
Definition at line 1646 of file KDGanttViewItem.cpp. |
|
Creates a KDGanttViewItem according to the specification in a DOM element.
Definition at line 1615 of file KDGanttViewItem.cpp. |
|
Creates a DOM node that describes this item.
Definition at line 1550 of file KDGanttViewItem.cpp. |
|
Returns the default color that is used for the item if no specific start, middle, or end colors are set.
Definition at line 1176 of file KDGanttViewItem.cpp. |
|
Returns the default highlighting color that is used for the item if no specific start, middle, or end colors are set.
Definition at line 1220 of file KDGanttViewItem.cpp. |
|
Returns whether this item displays hidden subitems. Initial set to false.
Definition at line 482 of file KDGanttViewItem.cpp. |
|
Returns whether this item is editable.
Definition at line 443 of file KDGanttViewItem.cpp. |
|
Returns whether this item is enabled.
Definition at line 385 of file KDGanttViewItem.cpp. |
|
Returns the end time of this item.
Definition at line 586 of file KDGanttViewItem.cpp. |
|
Returns the item with the specified name.
Definition at line 328 of file KDGanttViewItem.cpp. |
|
Returns the first child of this item.
Definition at line 1231 of file KDGanttViewItem.cpp. |
|
Returns the font used for the text in this item.
Definition at line 679 of file KDGanttViewItem.cpp. |
|
Generates a unique name if necessary and inserts it into the item dictionary. Definition at line 286 of file KDGanttViewItem.cpp. |
|
If the name of this item is name (i.e., listViewText() == name), the pointer to this item is returned. Otherwise, it looks for an item with name name in the set of children and subchildren of this item.
Definition at line 2050 of file KDGanttViewItem.cpp. |
|
Returns the y coordinate of this item.
Definition at line 1906 of file KDGanttViewItem.cpp. |
|
Returns whether this item is highlighted, either programmatically with setHighlight() or by the user with the mouse.
Definition at line 769 of file KDGanttViewItem.cpp. |
|
Returns the highlight colors used for this item
Definition at line 1037 of file KDGanttViewItem.cpp. |
|
Returns the item above this item in the listview
Definition at line 1267 of file KDGanttViewItem.cpp. |
|
Returns the item below this item in the listview. It can be specified whether the disabled items are taken into account as well.
Definition at line 1281 of file KDGanttViewItem.cpp. |
|
Returns whether this item is visible.
Definition at line 415 of file KDGanttViewItem.cpp. |
|
Returns the text to be shown in this item in the list view.
Definition at line 654 of file KDGanttViewItem.cpp. |
|
Moves this items text. Definition at line 2480 of file KDGanttViewItem.cpp. |
|
Returns the end time of the children of this item.
Definition at line 1983 of file KDGanttViewItem.cpp. |
|
Returns the start time of the children of this item.
Definition at line 1949 of file KDGanttViewItem.cpp. |
|
Returns the unique name that can identify the item.
Definition at line 314 of file KDGanttViewItem.cpp. |
|
Returns the next sibling item of this item
Definition at line 1244 of file KDGanttViewItem.cpp. |
|
Returns the parent item of this item
Definition at line 1256 of file KDGanttViewItem.cpp. |
|
Returns a pixmap that is shown in the listview.
Definition at line 1129 of file KDGanttViewItem.cpp. |
|
Returns the priority of this item.
Definition at line 523 of file KDGanttViewItem.cpp. |
|
Specifies the colors in which to draw the shapes of this item. It is advisable not to use this method, but rather set the colors for all items of a type with KDGanttView::setColors() in order to get a uniform Gantt view.
Definition at line 957 of file KDGanttViewItem.cpp. |
|
Sets the default color that is used for the item if no specific start, middle, or end colors are set. It is advisable not to use this method, but rather set the colors for all items of a type with KDGanttView::setDefaultColor() in order to get a uniform Gantt view. If the item displays its subitems (children) as a group, (displaySubitemsAsGroup() == true) all changes apply to all subitems as well.
Definition at line 1150 of file KDGanttViewItem.cpp. |
|
Sets the default highlighting color that is used for the item if no specific start, middle, or end colors are set. It is advisable not to use this method, but rather set the colors for all items of a type with KDGanttView::setDefaultHighlightColor() in order to get a uniform Gantt view. If the item displays its subitems (children) as a group, (displaySubitemsAsGroup() == true) all changes apply to all subitems as well.
Definition at line 1197 of file KDGanttViewItem.cpp. |
|
Specifies whether this item shows hidden subitems on its timeline. Useful to get a so called "calendar view" with many items in one row. When displaySubitemsAsGroup() is set to true, this item has a normal view, when it is expanded. If it is not expanded (and has at least one child), the item itself is hidden, and all children are displayed instead. To manage the painting priority of the childs (if overlapping), you may set priority() of these items.
Definition at line 461 of file KDGanttViewItem.cpp. |
|
Specifies whether this item is editable. The whole Gantt view needs to be editable as well for this to have any effect.
Definition at line 430 of file KDGanttViewItem.cpp. |
|
Specifies whether this item is enabled. If disabled, the item stays in the Gantt view and the item is shown in gray to show that the item is disabled. All signals of this item (like itemLeftClicked( this )) are blocked. If the item displays its subitems (childs) as a group, (displaySubitemsAsGroup() == true) all changes apply to all subitems as well.
Definition at line 362 of file KDGanttViewItem.cpp. |
|
Specifies the end time of this item. The parameter must be valid and non-null. If the parameter is invalid or null, no value is set. Reimplemented in the subclasses
Reimplemented in KDGanttViewSummaryItem, and KDGanttViewTaskItem. Definition at line 562 of file KDGanttViewItem.cpp. |
|
Specifies the float end time of this item. If the time is invalid, the end float is not shown.
Definition at line 2546 of file KDGanttViewItem.cpp. |
|
Specifies the float start time of this item. If the time is invalid, the start float is not shown.
Definition at line 2535 of file KDGanttViewItem.cpp. |
|
Sets the font to be used for the text in this item.
Definition at line 666 of file KDGanttViewItem.cpp. |
|
Specifies whether this item should be shown highlighted. The user can also highlight items with the mouse. If the item displays its subitems (children) as a group (displaySubitemsAsGroup() == true), all changes apply to all subitems as well.
Definition at line 746 of file KDGanttViewItem.cpp. |
|
Specifies the highlight colors in which to draw the shapes of this item. It is advisable not to use this method, but rather set the highlight colors for all items of a type with KDGanttView::setHighlightColors() in order to get a uniform Gantt view. If the item displays its subitems (children) as a group, (displaySubitemsAsGroup() == true) all changes apply to all subitems as well.
Definition at line 1011 of file KDGanttViewItem.cpp. |
|
Specifies whether this item is visible.
Definition at line 398 of file KDGanttViewItem.cpp. |
|
Sets the text to be shown in this item in the list view.
Definition at line 640 of file KDGanttViewItem.cpp. |
|
Definition at line 627 of file KDGanttViewItem.cpp. |
|
This method is reimplemented for internal purposes. Definition at line 1374 of file KDGanttViewItem.cpp. |
|
Definition at line 1116 of file KDGanttViewItem.cpp. |
|
Sets the pixmap that is shown in the listview.
Definition at line 1108 of file KDGanttViewItem.cpp. |
|
Specifies the priority of this item. Valid values are between 1 and 199. A priority less than 100 means that the item is painted in the Gantt chart below the grid. A priority more than 100 means that the item is painted in the Gantt chart over the grid. For a value of 100, the behavior is unspecified. An item with a higher priority is painted over an item with a lower priority in the Gantt chart. The painting order of items with the same priority is unspecified. For Calendar items, the default priority is 50, for all other items it is 150. This feature makes only sense for an item which is a child of another item, which displaySubitemsAsGroup() property is set to true.
Definition at line 507 of file KDGanttViewItem.cpp. |
|
Specifies the progress of this item in percent. Progress is limited to minimum 0, maximum 100.
Definition at line 2523 of file KDGanttViewItem.cpp. |
|
Specifies the shapes to be used for this item. It is advisable not to use this method, but rather set the shapes for all items of a type with KDGanttView::setShapes() in order to get a uniform Gantt view.
Definition at line 787 of file KDGanttViewItem.cpp. |
|
Specifies whether the 'showNoInformation' line should be shown for this item. The 'showNoInformation' line is drawn over the whole timeline. The height of the line is the height of the item. The brush of the line is specified by KDGanttView::setNoInformationBrush(). (i.e. the same brush for all items of the Gantt view). The default brush is QBrush( QColor ( 100,100,100 ), Qt::FDiagPattern );
Definition at line 2035 of file KDGanttViewItem.cpp. |
|
Specifies the start time of this item. The parameter must be valid and non-null. If the parameter is invalid or null, no value is set. Reimplemented in the subclasses.
Reimplemented in KDGanttViewEventItem, KDGanttViewSummaryItem, and KDGanttViewTaskItem. Definition at line 537 of file KDGanttViewItem.cpp. |
|
Sets the text to be shown in this item in the Gantt view. For a KDGanttViewTaskItem witht displaySubitemsAsGroup() == true, the text is shown in the item itself and the text is truncated automatically, if it does not fit in the item. For all other item types, the text is shown to the right of the item.
Definition at line 603 of file KDGanttViewItem.cpp. |
|
Specifies the color to be used for the text of this item. It is advisable not to use this method, but rather set the text color for all items with KDGanttView::setTextColor() in order to get a uniform Gantt view. If the item displays its subitems (children) as a group, (displaySubitemsAsGroup() == true) all changes apply to all subitems as well.
Definition at line 1057 of file KDGanttViewItem.cpp. |
|
Sets the text to show in a tooltip for this item.
Definition at line 691 of file KDGanttViewItem.cpp. |
|
Sets the text to show in a What's This window for this item.
Definition at line 716 of file KDGanttViewItem.cpp. |
|
Returns the shapes used for this item
Definition at line 937 of file KDGanttViewItem.cpp. |
|
Returns whether the 'showNoInformation' line should be shown for this item
Definition at line 2018 of file KDGanttViewItem.cpp. |
|
Returns the start time of this item.
Definition at line 548 of file KDGanttViewItem.cpp. |
|
Returns whether this item has at least one subitem that is a calendar. A subitem is a calendar, if that item has at least one subitem or displaySubitemAsGroup() is true for that item.
Definition at line 2083 of file KDGanttViewItem.cpp. |
|
Returns the text to be shown in this item in the Gantt view.
Definition at line 618 of file KDGanttViewItem.cpp. |
|
Returns the color used for the text of this item.
Definition at line 1080 of file KDGanttViewItem.cpp. |
|
Returns the tooltip text of this item
Definition at line 703 of file KDGanttViewItem.cpp. |
|
Returns the type of the item. This may be Event, Task, Summary.
Definition at line 344 of file KDGanttViewItem.cpp. |
|
Updates the colors of the item, but not the coordinates. Definition at line 1304 of file KDGanttViewItem.cpp. |
|
Returns the what's this text of this item
Definition at line 729 of file KDGanttViewItem.cpp. |
Member Data Documentation
|
the line at the actual end of the item Definition at line 86 of file KDGanttViewItem.h. |
|
if true, updates to this item are currently blocked, to reduce flicker or speed up redraws Definition at line 97 of file KDGanttViewItem.h. |
|
the line at the end of the item Definition at line 86 of file KDGanttViewItem.h. |
|
the background line at the end of the item Definition at line 86 of file KDGanttViewItem.h. |
|
the shape at the end of the item Definition at line 88 of file KDGanttViewItem.h. |
|
the background shape at the end of the item Definition at line 88 of file KDGanttViewItem.h. |
|
whether this item is currently editable or not Definition at line 95 of file KDGanttViewItem.h. |
|
whether this item is currently highlighted or not Definition at line 95 of file KDGanttViewItem.h. |
|
this instance variable is true if the item is visible in the Gantt view Definition at line 80 of file KDGanttViewItem.h. |
|
the shape in the middle of the item Definition at line 88 of file KDGanttViewItem.h. |
|
the background shape in the middle of the item Definition at line 88 of file KDGanttViewItem.h. |
|
the ending time of this item Definition at line 94 of file KDGanttViewItem.h. |
|
a pointer to the KDGanttView object to which this item belongs Definition at line 91 of file KDGanttViewItem.h. |
|
the current size of this item Definition at line 96 of file KDGanttViewItem.h. |
|
the starting time of this item Definition at line 94 of file KDGanttViewItem.h. |
|
the line at the beginning of the item Definition at line 86 of file KDGanttViewItem.h. |
|
the background line at the beginning of the item Definition at line 86 of file KDGanttViewItem.h. |
|
the shape at the beginning of the item Definition at line 88 of file KDGanttViewItem.h. |
|
the background shape at the beginning of the item Definition at line 88 of file KDGanttViewItem.h. |
|
the text object that is used for this item Definition at line 92 of file KDGanttViewItem.h. |
|
the actual string that is displayed in the text object for this item Definition at line 93 of file KDGanttViewItem.h. |
The documentation for this class was generated from the following files: