KD Chart 2  [rev.2.7]
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:
Inheritance graph
[legend]
Collaboration diagram for KDGantt::Legend:
Collaboration graph
[legend]

Public Member Functions

QModelIndex indexAt (const QPoint &point) const override
 
 Legend (QWidget *parent=0)
 
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
 
 ~Legend () override
 

Protected Slots

virtual void modelDataChanged ()
 

Protected Member Functions

virtual QRect drawItem (QPainter *painter, const QModelIndex &index, const QPoint &pos=QPoint()) const
 
virtual StyleOptionGanttItem getStyleOption (const QModelIndex &index) const
 
int horizontalOffset () const override
 
bool isIndexHidden (const QModelIndex &) const override
 
virtual QSize measureItem (const QModelIndex &index, bool recursive=true) const
 
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 33 of file kdganttlegend.h.

Constructor & Destructor Documentation

Legend::Legend ( QWidget parent = 0)
explicit

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

Definition at line 45 of file kdganttlegend.cpp.

Legend::~Legend ( )
override

Destructor. Does nothing

Definition at line 54 of file kdganttlegend.cpp.

Member Function Documentation

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 142 of file kdganttlegend.cpp.

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

Referenced by paintEvent().

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

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

Definition at line 127 of file kdganttlegend.cpp.

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

Referenced by drawItem().

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

Definition at line 58 of file kdganttlegend.h.

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

Definition at line 61 of file kdganttlegend.cpp.

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

Definition at line 59 of file kdganttlegend.h.

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 184 of file kdganttlegend.cpp.

References d, and KDGantt::LegendRole.

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

QSize Legend::minimumSizeHint ( ) const
override

Definition at line 78 of file kdganttlegend.cpp.

References measureItem().

void Legend::modelDataChanged ( )
protectedvirtualslot

Triggers repainting of the legend.

Definition at line 106 of file kdganttlegend.cpp.

Referenced by setModel().

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

Definition at line 60 of file kdganttlegend.h.

void Legend::paintEvent ( QPaintEvent *  event)
overrideprotected

Definition at line 112 of file kdganttlegend.cpp.

References drawItem().

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

Definition at line 44 of file kdganttlegend.h.

void Legend::setModel ( QAbstractItemModel *  model)
override

Definition at line 83 of file kdganttlegend.cpp.

References d, and modelDataChanged().

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

Definition at line 61 of file kdganttlegend.h.

QSize Legend::sizeHint ( ) const
override

Definition at line 73 of file kdganttlegend.cpp.

References measureItem().

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

Definition at line 62 of file kdganttlegend.h.

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

Definition at line 67 of file kdganttlegend.cpp.

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

Definition at line 63 of file kdganttlegend.h.


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

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/