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

Legend showing an image and a description for Gantt items. More...

#include <KDGanttLegend>

Inheritance diagram for KDGantt::Legend:

Public Member Functions

 Legend (QWidget *parent=nullptr)
 Constructor. More...
 
 ~Legend () override
 Destructor. More...
 
QModelIndex indexAt (const QPoint &point) const override
 
QSize minimumSizeHint () const override
 
void scrollTo (const QModelIndex &, ScrollHint=EnsureVisible) override
 
void setModel (QAbstractItemModel *model) override
 
QSize sizeHint () const override
 
QRect visualRect (const QModelIndex &index) const override
 

Protected Slots

virtual void modelDataChanged ()
 Triggers repainting of the legend. More...
 

Protected Member Functions

virtual QRect drawItem (QPainter *painter, const QModelIndex &index, const QPoint &pos=QPoint()) const
 Draws the legend item at index and all of it's children recursively at pos onto painter. More...
 
virtual StyleOptionGanttItem getStyleOption (const QModelIndex &index) const
 Creates a StyleOptionGanttItem with all style options filled in except the target rectangles. More...
 
int horizontalOffset () const override
 
bool isIndexHidden (const QModelIndex &) const override
 
virtual QSize measureItem (const QModelIndex &index, bool recursive=true) const
 Calculates the needed space for the legend item at index and, if recursive is true, all child items. More...
 
QModelIndex moveCursor (CursorAction, Qt::KeyboardModifiers) override
 
void paintEvent (QPaintEvent *event) override
 
void setSelection (const QRect &, QItemSelectionModel::SelectionFlags) override
 
int verticalOffset () const override
 
QRegion visualRegionForSelection (const QItemSelection &) const override
 

Detailed Description

Legend showing an image and a description for Gantt items.

This is an item view class showing a small Gantt item and it's text defined by LegendRole.

Definition at line 20 of file kdganttlegend.h.

Constructor & Destructor Documentation

◆ Legend()

Legend::Legend ( QWidget *  parent = nullptr)
explicit

Constructor.

Creates a Legend with parent parent. The QObject parent is not used for anything internally.

Definition at line 33 of file kdganttlegend.cpp.

◆ ~Legend()

Legend::~Legend ( )
override

Destructor.

Does nothing

Definition at line 42 of file kdganttlegend.cpp.

Member Function Documentation

◆ drawItem()

QRect Legend::drawItem ( QPainter *  painter,
const QModelIndex &  index,
const QPoint &  pos = QPoint() 
) const
protectedvirtual

Draws the legend item at index and all of it's children recursively at pos onto painter.

Reimplement this if you want to draw items in an user defined way.

Returns
the rectangle drawn.

Definition at line 128 of file kdganttlegend.cpp.

References KDGantt::StyleOptionGanttItem::boundingRect, d, getStyleOption(), KDGantt::StyleOptionGanttItem::itemRect, KDGantt::ItemTypeRole, measureItem(), KDGantt::StyleOptionGanttItem::text, and KDGantt::TypeEvent.

Referenced by paintEvent().

◆ getStyleOption()

StyleOptionGanttItem Legend::getStyleOption ( const QModelIndex &  index) const
protectedvirtual

Creates a StyleOptionGanttItem with all style options filled in except the target rectangles.

Definition at line 113 of file kdganttlegend.cpp.

References d, KDGantt::StyleOptionGanttItem::displayPosition, KDGantt::LegendRole, KDGantt::StyleOptionGanttItem::Right, and KDGantt::StyleOptionGanttItem::text.

Referenced by drawItem().

◆ horizontalOffset()

int KDGantt::Legend::horizontalOffset ( ) const
inlineoverrideprotected

Definition at line 47 of file kdganttlegend.h.

◆ indexAt()

QModelIndex Legend::indexAt ( const QPoint &  point) const
override

Definition at line 49 of file kdganttlegend.cpp.

◆ isIndexHidden()

bool KDGantt::Legend::isIndexHidden ( const QModelIndex &  ) const
inlineoverrideprotected

Definition at line 51 of file kdganttlegend.h.

◆ measureItem()

QSize Legend::measureItem ( const QModelIndex &  index,
bool  recursive = true 
) const
protectedvirtual

Calculates the needed space for the legend item at index and, if recursive is true, all child items.

Definition at line 167 of file kdganttlegend.cpp.

References d, and KDGantt::LegendRole.

Referenced by drawItem(), minimumSizeHint(), and sizeHint().

◆ minimumSizeHint()

QSize Legend::minimumSizeHint ( ) const
override

Definition at line 66 of file kdganttlegend.cpp.

References measureItem().

◆ modelDataChanged

void Legend::modelDataChanged ( )
protectedvirtualslot

Triggers repainting of the legend.

Definition at line 92 of file kdganttlegend.cpp.

Referenced by setModel().

◆ moveCursor()

QModelIndex KDGantt::Legend::moveCursor ( CursorAction  ,
Qt::KeyboardModifiers   
)
inlineoverrideprotected

Definition at line 55 of file kdganttlegend.h.

◆ paintEvent()

void Legend::paintEvent ( QPaintEvent *  event)
overrideprotected

Definition at line 98 of file kdganttlegend.cpp.

References drawItem().

◆ scrollTo()

void KDGantt::Legend::scrollTo ( const QModelIndex &  ,
ScrollHint  = EnsureVisible 
)
inlineoverride

Definition at line 31 of file kdganttlegend.h.

◆ setModel()

void Legend::setModel ( QAbstractItemModel *  model)
override

Definition at line 71 of file kdganttlegend.cpp.

References d, and modelDataChanged().

◆ setSelection()

void KDGantt::Legend::setSelection ( const QRect &  ,
QItemSelectionModel::SelectionFlags   
)
inlineoverrideprotected

Definition at line 59 of file kdganttlegend.h.

◆ sizeHint()

QSize Legend::sizeHint ( ) const
override

Definition at line 61 of file kdganttlegend.cpp.

References measureItem().

◆ verticalOffset()

int KDGantt::Legend::verticalOffset ( ) const
inlineoverrideprotected

Definition at line 62 of file kdganttlegend.h.

◆ visualRect()

QRect Legend::visualRect ( const QModelIndex &  index) const
override

Definition at line 55 of file kdganttlegend.cpp.

◆ visualRegionForSelection()

QRegion KDGantt::Legend::visualRegionForSelection ( const QItemSelection &  ) const
inlineoverrideprotected

Definition at line 66 of file kdganttlegend.h.


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