KD Chart API Documentation  3.1
Public Types | Public Member Functions | Protected Member Functions | List of all members
KDGantt::ItemDelegate Class Reference

Class used to render gantt items in a KDGantt::GraphicsView. More...

#include <KDGanttItemDelegate>

Inheritance diagram for KDGantt::ItemDelegate:

Public Types

enum  InteractionState {
  State_None = 0 , State_Move , State_ExtendLeft , State_ExtendRight ,
  State_DragConstraint
}
 This enum is used for communication between the view and the delegate about user interaction with gantt items. More...
 

Public Member Functions

 ItemDelegate (QObject *parent=nullptr)
 Constructor. More...
 
 ~ItemDelegate () override
 Destructor. More...
 
virtual QRectF constraintBoundingRect (const QPointF &start, const QPointF &end, const Constraint &constraint) const
 
QBrush defaultBrush (ItemType type) const
 
QPen defaultPen (ItemType type) const
 
virtual InteractionState interactionStateFor (const QPointF &pos, const StyleOptionGanttItem &opt, const QModelIndex &idx) const
 
virtual Span itemBoundingSpan (const StyleOptionGanttItem &opt, const QModelIndex &idx) const
 
virtual void paintConstraintItem (QPainter *p, const QStyleOptionGraphicsItem &opt, const QPointF &start, const QPointF &end, const Constraint &constraint)
 Paints the constraint between points start and end using painter and opt. More...
 
virtual void paintGanttItem (QPainter *p, const StyleOptionGanttItem &opt, const QModelIndex &idx)
 Paints the gantt item idx using painter and opt. More...
 
void setDefaultBrush (ItemType type, const QBrush &brush)
 Sets the default brush used for items of type type to brush. More...
 
void setDefaultPen (ItemType type, const QPen &pen)
 Sets the default pen used for items of type type to pen. More...
 
virtual QString toolTip (const QModelIndex &idx) const
 

Protected Member Functions

QPolygonF finishFinishArrow (const QPointF &start, const QPointF &end) const
 
QPolygonF finishFinishLine (const QPointF &start, const QPointF &end) const
 
QPolygonF finishStartArrow (const QPointF &start, const QPointF &end) const
 
QPolygonF finishStartLine (const QPointF &start, const QPointF &end) const
 
void paintFinishFinishConstraint (QPainter *p, const QStyleOptionGraphicsItem &opt, const QPointF &start, const QPointF &end, const Constraint &constraint)
 
void paintFinishStartConstraint (QPainter *p, const QStyleOptionGraphicsItem &opt, const QPointF &start, const QPointF &end, const Constraint &constraint)
 
void paintStartFinishConstraint (QPainter *p, const QStyleOptionGraphicsItem &opt, const QPointF &start, const QPointF &end, const Constraint &constraint)
 
void paintStartStartConstraint (QPainter *p, const QStyleOptionGraphicsItem &opt, const QPointF &start, const QPointF &end, const Constraint &constraint)
 
QPolygonF startFinishArrow (const QPointF &start, const QPointF &end) const
 
QPolygonF startFinishLine (const QPointF &start, const QPointF &end) const
 
QPolygonF startStartArrow (const QPointF &start, const QPointF &end) const
 
QPolygonF startStartLine (const QPointF &start, const QPointF &end) const
 

Detailed Description

Class used to render gantt items in a KDGantt::GraphicsView.

Definition at line 25 of file kdganttitemdelegate.h.

Member Enumeration Documentation

◆ InteractionState

This enum is used for communication between the view and the delegate about user interaction with gantt items.

See also
KDGantt::ItemDelegate::interactionStateFor
Enumerator
State_None 
State_Move 
State_ExtendLeft 
State_ExtendRight 
State_DragConstraint 

Definition at line 30 of file kdganttitemdelegate.h.

Constructor & Destructor Documentation

◆ ItemDelegate()

ItemDelegate::ItemDelegate ( QObject *  parent = nullptr)
explicit

Constructor.

Creates an ItemDelegate with parent parent

Definition at line 112 of file kdganttitemdelegate.cpp.

◆ ~ItemDelegate()

ItemDelegate::~ItemDelegate ( )
override

Destructor.

Definition at line 119 of file kdganttitemdelegate.cpp.

Member Function Documentation

◆ constraintBoundingRect()

QRectF ItemDelegate::constraintBoundingRect ( const QPointF &  start,
const QPointF &  end,
const Constraint constraint 
) const
virtual

◆ defaultBrush()

QBrush ItemDelegate::defaultBrush ( ItemType  type) const
Returns
The default brush for item type type

Definition at line 141 of file kdganttitemdelegate.cpp.

References d.

Referenced by paintGanttItem().

◆ defaultPen()

QPen ItemDelegate::defaultPen ( ItemType  type) const
Returns
The default pen for item type type

Definition at line 161 of file kdganttitemdelegate.cpp.

References d.

Referenced by paintGanttItem().

◆ finishFinishArrow()

QPolygonF ItemDelegate::finishFinishArrow ( const QPointF &  start,
const QPointF &  end 
) const
protected

Definition at line 537 of file kdganttitemdelegate.cpp.

References TURN.

Referenced by constraintBoundingRect(), and paintFinishFinishConstraint().

◆ finishFinishLine()

QPolygonF ItemDelegate::finishFinishLine ( const QPointF &  start,
const QPointF &  end 
) const
protected

Definition at line 515 of file kdganttitemdelegate.cpp.

References TURN.

Referenced by constraintBoundingRect(), and paintFinishFinishConstraint().

◆ finishStartArrow()

QPolygonF ItemDelegate::finishStartArrow ( const QPointF &  start,
const QPointF &  end 
) const
protected

Definition at line 491 of file kdganttitemdelegate.cpp.

References TURN.

Referenced by constraintBoundingRect(), and paintFinishStartConstraint().

◆ finishStartLine()

QPolygonF ItemDelegate::finishStartLine ( const QPointF &  start,
const QPointF &  end 
) const
protected

Definition at line 469 of file kdganttitemdelegate.cpp.

References TURN.

Referenced by constraintBoundingRect(), and paintFinishStartConstraint().

◆ interactionStateFor()

ItemDelegate::InteractionState ItemDelegate::interactionStateFor ( const QPointF &  pos,
const StyleOptionGanttItem opt,
const QModelIndex &  idx 
) const
virtual
Returns
The interaction state for position pos on item idx when rendered with options opt. This is used to tell the view about how the item should react to mouse click/drag.

Override to implement new items or interactions.

Definition at line 235 of file kdganttitemdelegate.cpp.

References KDGantt::StyleOptionGanttItem::itemRect, KDGantt::ItemTypeRole, State_ExtendLeft, State_ExtendRight, State_Move, State_None, KDGantt::TypeEvent, KDGantt::TypeNone, and KDGantt::TypeSummary.

Referenced by KDGantt::GraphicsItem::hoverMoveEvent(), KDGantt::GraphicsItem::mouseDoubleClickEvent(), and KDGantt::GraphicsItem::mousePressEvent().

◆ itemBoundingSpan()

Span ItemDelegate::itemBoundingSpan ( const StyleOptionGanttItem opt,
const QModelIndex &  idx 
) const
virtual
Returns
The bounding Span for the item identified by idx when rendered with options opt. This is often the same as the span given by the AbstractGrid for idx, but it might be larger in case there are additional texts or decorations on the item.

Override this to implement new itemtypes or to change the look of the existing ones.

Definition at line 194 of file kdganttitemdelegate.cpp.

References KDGantt::StyleOptionGanttItem::Center, KDGantt::StyleOptionGanttItem::displayPosition, KDGantt::StyleOptionGanttItem::Hidden, KDGantt::StyleOptionGanttItem::itemRect, KDGantt::ItemTypeRole, KDGantt::StyleOptionGanttItem::Left, KDGantt::StyleOptionGanttItem::Right, and KDGantt::TypeEvent.

Referenced by KDGantt::GraphicsItem::updateItem().

◆ paintConstraintItem()

void ItemDelegate::paintConstraintItem ( QPainter *  painter,
const QStyleOptionGraphicsItem &  opt,
const QPointF &  start,
const QPointF &  end,
const Constraint constraint 
)
virtual

◆ paintFinishFinishConstraint()

void ItemDelegate::paintFinishFinishConstraint ( QPainter *  p,
const QStyleOptionGraphicsItem &  opt,
const QPointF &  start,
const QPointF &  end,
const Constraint constraint 
)
protected

Definition at line 502 of file kdganttitemdelegate.cpp.

References d, finishFinishArrow(), and finishFinishLine().

Referenced by paintConstraintItem().

◆ paintFinishStartConstraint()

void ItemDelegate::paintFinishStartConstraint ( QPainter *  p,
const QStyleOptionGraphicsItem &  opt,
const QPointF &  start,
const QPointF &  end,
const Constraint constraint 
)
protected

Definition at line 456 of file kdganttitemdelegate.cpp.

References d, finishStartArrow(), and finishStartLine().

Referenced by paintConstraintItem().

◆ paintGanttItem()

void ItemDelegate::paintGanttItem ( QPainter *  p,
const StyleOptionGanttItem opt,
const QModelIndex &  idx 
)
virtual

◆ paintStartFinishConstraint()

void ItemDelegate::paintStartFinishConstraint ( QPainter *  p,
const QStyleOptionGraphicsItem &  opt,
const QPointF &  start,
const QPointF &  end,
const Constraint constraint 
)
protected

Definition at line 593 of file kdganttitemdelegate.cpp.

References d, startFinishArrow(), and startFinishLine().

Referenced by paintConstraintItem().

◆ paintStartStartConstraint()

void ItemDelegate::paintStartStartConstraint ( QPainter *  p,
const QStyleOptionGraphicsItem &  opt,
const QPointF &  start,
const QPointF &  end,
const Constraint constraint 
)
protected

Definition at line 548 of file kdganttitemdelegate.cpp.

References d, startStartArrow(), and startStartLine().

Referenced by paintConstraintItem().

◆ setDefaultBrush()

void ItemDelegate::setDefaultBrush ( ItemType  type,
const QBrush &  brush 
)

Sets the default brush used for items of type type to brush.

The default brush is used in the case when the model does not provide an explicit brush.

Definition at line 132 of file kdganttitemdelegate.cpp.

References d.

◆ setDefaultPen()

void ItemDelegate::setDefaultPen ( ItemType  type,
const QPen &  pen 
)

Sets the default pen used for items of type type to pen.

The default pen is used in the case when the model does not provide an explicit pen.

Definition at line 152 of file kdganttitemdelegate.cpp.

References d.

◆ startFinishArrow()

QPolygonF ItemDelegate::startFinishArrow ( const QPointF &  start,
const QPointF &  end 
) const
protected

Definition at line 630 of file kdganttitemdelegate.cpp.

References TURN.

Referenced by constraintBoundingRect(), and paintStartFinishConstraint().

◆ startFinishLine()

QPolygonF ItemDelegate::startFinishLine ( const QPointF &  start,
const QPointF &  end 
) const
protected

Definition at line 606 of file kdganttitemdelegate.cpp.

References TURN.

Referenced by constraintBoundingRect(), and paintStartFinishConstraint().

◆ startStartArrow()

QPolygonF ItemDelegate::startStartArrow ( const QPointF &  start,
const QPointF &  end 
) const
protected

Definition at line 582 of file kdganttitemdelegate.cpp.

References TURN.

Referenced by constraintBoundingRect(), and paintStartStartConstraint().

◆ startStartLine()

QPolygonF ItemDelegate::startStartLine ( const QPointF &  start,
const QPointF &  end 
) const
protected

Definition at line 561 of file kdganttitemdelegate.cpp.

References TURN.

Referenced by constraintBoundingRect(), and paintStartStartConstraint().

◆ toolTip()

QString ItemDelegate::toolTip ( const QModelIndex &  idx) const
virtual
Returns
The tooltip for index idx

Definition at line 168 of file kdganttitemdelegate.cpp.

References KDGantt::EndTimeRole, and KDGantt::StartTimeRole.

Referenced by KDGantt::GraphicsItem::ganttToolTip().


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

© 2001 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/
Generated by doxygen 1.9.1