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

#include <kdganttgraphicsscene.h>

Inheritance diagram for KDGantt::GraphicsScene:

Public Slots

void setConstraintModel (ConstraintModel *)
 
void setModel (QAbstractItemModel *)
 
void setReadOnly (bool)
 
void setRootIndex (const QModelIndex &idx)
 
void setSelectionModel (QItemSelectionModel *selectionmodel)
 
void setSummaryHandlingModel (QAbstractProxyModel *)
 

Signals

void clicked (const QModelIndex &index)
 
void entered (const QModelIndex &index)
 
void gridChanged ()
 
void pressed (const QModelIndex &index)
 
void qrealClicked (const QModelIndex &index)
 

Public Member Functions

 GraphicsScene (QObject *parent=nullptr)
 
 ~GraphicsScene () override
 
void clearConstraintItems ()
 
void clearItems ()
 
ConstraintModelconstraintModel () const
 
GraphicsItemcreateItem (ItemType type) const
 Creates a new item of type type. More...
 
void deleteSubtree (const QModelIndex &)
 
GraphicsItemdragSource () const
 
ConstraintGraphicsItemfindConstraintItem (const Constraint &) const
 
GraphicsItemfindItem (const QModelIndex &) const
 
GraphicsItemfindItem (const QPersistentModelIndex &) const
 
AbstractGridgrid () const
 
void insertItem (const QPersistentModelIndex &, GraphicsItem *)
 
bool isReadOnly () const
 
void itemClicked (const QModelIndex &)
 
ItemDelegateitemDelegate () const
 
void itemDoubleClicked (const QModelIndex &)
 
void itemEntered (const QModelIndex &)
 
void itemPressed (const QModelIndex &)
 
QAbstractItemModel * model () const
 
void print (QPainter *painter, const QRectF &target=QRectF(), bool drawRowLabels=true, bool drawColumnLabels=true)
 Render the GanttView inside the rectangle target using the painter painter. More...
 
void print (QPainter *painter, qreal start, qreal end, const QRectF &target=QRectF(), bool drawRowLabels=true, bool drawColumnLabels=true)
 Render the GanttView inside the rectangle target using the painter painter. More...
 
void print (QPrinter *printer, bool drawRowLabels=true, bool drawColumnLabels=true)
 Print the Gantt chart using printer. More...
 
void print (QPrinter *printer, qreal start, qreal end, bool drawRowLabels=true, bool drawColumnLabels=true)
 Print part of the Gantt chart from start to end using printer. More...
 
void removeItem (const QModelIndex &)
 
QModelIndex rootIndex () const
 
AbstractRowControllerrowController () const
 
QItemSelectionModel * selectionModel () const
 
void setDragSource (GraphicsItem *item)
 
void setGrid (AbstractGrid *grid)
 
void setItemDelegate (ItemDelegate *)
 
void setRowController (AbstractRowController *rc)
 
QAbstractProxyModel * summaryHandlingModel () const
 
void updateItems ()
 
void updateRow (const QModelIndex &idx)
 

Static Public Member Functions

static QModelIndex dataIndex (const QModelIndex &idx)
 Returns the index pointing to the last column in the same row as idx. More...
 
static QModelIndex mainIndex (const QModelIndex &idx)
 

Protected Member Functions

void drawBackground (QPainter *painter, const QRectF &rect) override
 
void drawForeground (QPainter *painter, const QRectF &rect) override
 
void helpEvent (QGraphicsSceneHelpEvent *helpEvent) override
 

Detailed Description

Definition at line 36 of file kdganttgraphicsscene.h.

Constructor & Destructor Documentation

◆ GraphicsScene()

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

Definition at line 146 of file kdganttgraphicsscene.cpp.

◆ ~GraphicsScene()

GraphicsScene::~GraphicsScene ( )
override

Definition at line 153 of file kdganttgraphicsscene.cpp.

References clearConstraintItems().

Member Function Documentation

◆ clearConstraintItems()

void GraphicsScene::clearConstraintItems ( )

Definition at line 548 of file kdganttgraphicsscene.cpp.

Referenced by ~GraphicsScene().

◆ clearItems()

void GraphicsScene::clearItems ( )

Definition at line 499 of file kdganttgraphicsscene.cpp.

References d.

◆ clicked

void KDGantt::GraphicsScene::clicked ( const QModelIndex &  index)
signal

◆ constraintModel()

ConstraintModel * GraphicsScene::constraintModel ( ) const

Definition at line 221 of file kdganttgraphicsscene.cpp.

References d.

◆ createItem()

GraphicsItem * GraphicsScene::createItem ( ItemType  type) const

Creates a new item of type type.

TODO: If the user should be allowed to override this in any way, it needs to be in View!

Definition at line 331 of file kdganttgraphicsscene.cpp.

References KDGantt::TypeEvent, KDGantt::TypeSummary, and KDGantt::TypeTask.

Referenced by updateRow().

◆ dataIndex()

QModelIndex GraphicsScene::dataIndex ( const QModelIndex &  idx)
static

Returns the index pointing to the last column in the same row as idx.

This can be thought of as in "inverse" of mainIndex()

Definition at line 313 of file kdganttgraphicsscene.cpp.

References model().

Referenced by deleteSubtree().

◆ deleteSubtree()

void GraphicsScene::deleteSubtree ( const QModelIndex &  _idx)

Definition at line 523 of file kdganttgraphicsscene.cpp.

References dataIndex(), removeItem(), and summaryHandlingModel().

◆ dragSource()

GraphicsItem * GraphicsScene::dragSource ( ) const

Definition at line 647 of file kdganttgraphicsscene.cpp.

References d.

◆ drawBackground()

void GraphicsScene::drawBackground ( QPainter *  painter,
const QRectF &  rect 
)
overrideprotected

Definition at line 585 of file kdganttgraphicsscene.cpp.

References d.

◆ drawForeground()

void GraphicsScene::drawForeground ( QPainter *  painter,
const QRectF &  rect 
)
overrideprotected

Definition at line 617 of file kdganttgraphicsscene.cpp.

References d.

◆ entered

void KDGantt::GraphicsScene::entered ( const QModelIndex &  index)
signal

◆ findConstraintItem()

ConstraintGraphicsItem * GraphicsScene::findConstraintItem ( const Constraint c) const

Definition at line 543 of file kdganttgraphicsscene.cpp.

References d.

◆ findItem() [1/2]

GraphicsItem * GraphicsScene::findItem ( const QModelIndex &  idx) const

Definition at line 481 of file kdganttgraphicsscene.cpp.

References d, and summaryHandlingModel().

Referenced by updateRow().

◆ findItem() [2/2]

GraphicsItem * GraphicsScene::findItem ( const QPersistentModelIndex &  idx) const

Definition at line 490 of file kdganttgraphicsscene.cpp.

References d, and summaryHandlingModel().

◆ grid()

AbstractGrid * GraphicsScene::grid ( ) const

Definition at line 276 of file kdganttgraphicsscene.cpp.

References d.

Referenced by setGrid(), and KDGantt::GraphicsItem::updateItem().

◆ gridChanged

void KDGantt::GraphicsScene::gridChanged ( )
signal

◆ helpEvent()

void GraphicsScene::helpEvent ( QGraphicsSceneHelpEvent *  helpEvent)
overrideprotected

◆ insertItem()

void GraphicsScene::insertItem ( const QPersistentModelIndex &  idx,
GraphicsItem item 
)

◆ isReadOnly()

bool GraphicsScene::isReadOnly ( ) const

Definition at line 286 of file kdganttgraphicsscene.cpp.

References d.

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

◆ itemClicked()

void GraphicsScene::itemClicked ( const QModelIndex &  idx)

Definition at line 632 of file kdganttgraphicsscene.cpp.

References clicked().

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

◆ itemDelegate()

ItemDelegate * GraphicsScene::itemDelegate ( ) const

◆ itemDoubleClicked()

void GraphicsScene::itemDoubleClicked ( const QModelIndex &  idx)

Definition at line 637 of file kdganttgraphicsscene.cpp.

References qrealClicked().

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

◆ itemEntered()

void GraphicsScene::itemEntered ( const QModelIndex &  idx)

Definition at line 622 of file kdganttgraphicsscene.cpp.

References entered().

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

◆ itemPressed()

void GraphicsScene::itemPressed ( const QModelIndex &  idx)

Definition at line 627 of file kdganttgraphicsscene.cpp.

References pressed().

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

◆ mainIndex()

QModelIndex GraphicsScene::mainIndex ( const QModelIndex &  idx)
static

Definition at line 296 of file kdganttgraphicsscene.cpp.

◆ model()

QAbstractItemModel * GraphicsScene::model ( ) const

Definition at line 186 of file kdganttgraphicsscene.cpp.

References d.

Referenced by dataIndex(), setGrid(), setModel(), setSummaryHandlingModel(), and updateRow().

◆ pressed

void KDGantt::GraphicsScene::pressed ( const QModelIndex &  index)
signal

◆ print() [1/4]

void GraphicsScene::print ( QPainter *  painter,
const QRectF &  _targetRect = QRectF(),
bool  drawRowLabels = true,
bool  drawColumnLabels = true 
)

Render the GanttView inside the rectangle target using the painter painter.

If drawRowLabels is true (the default), each row will have it's label printed on the left side. If drawColumnLabels is true (the default), each column will have it's label printed at the top side.

Definition at line 704 of file kdganttgraphicsscene.cpp.

◆ print() [2/4]

void GraphicsScene::print ( QPainter *  painter,
qreal  start,
qreal  end,
const QRectF &  _targetRect = QRectF(),
bool  drawRowLabels = true,
bool  drawColumnLabels = true 
)

Render the GanttView inside the rectangle target using the painter painter.

If drawRowLabels is true (the default), each row will have it's label printed on the left side. If drawColumnLabels is true (the default), each column will have it's label printed at the top side.

To print a certain range of a chart with a DateTimeGrid, use qreal DateTimeGrid::mapFromDateTime( const QDateTime& dt) const to figure out the values for start and end.

Definition at line 724 of file kdganttgraphicsscene.cpp.

◆ print() [3/4]

void GraphicsScene::print ( QPrinter *  printer,
bool  drawRowLabels = true,
bool  drawColumnLabels = true 
)

Print the Gantt chart using printer.

If drawRowLabels is true (the default), each row will have it's label printed on the left side. If drawColumnLabels is true (the default), each column will have it's label printed at the top side.

This version of print() will print multiple pages.

Definition at line 660 of file kdganttgraphicsscene.cpp.

◆ print() [4/4]

void GraphicsScene::print ( QPrinter *  printer,
qreal  start,
qreal  end,
bool  drawRowLabels = true,
bool  drawColumnLabels = true 
)

Print part of the Gantt chart from start to end using printer.

If drawRowLabels is true (the default), each row will have it's label printed on the left side. If drawColumnLabels is true (the default), each column will have it's label printed at the top side.

This version of print() will print multiple pages.

To print a certain range of a chart with a DateTimeGrid, use qreal DateTimeGrid::mapFromDateTime( const QDateTime& dt) const to figure out the values for start and end.

Definition at line 684 of file kdganttgraphicsscene.cpp.

◆ qrealClicked

void KDGantt::GraphicsScene::qrealClicked ( const QModelIndex &  index)
signal

◆ removeItem()

void GraphicsScene::removeItem ( const QModelIndex &  idx)

◆ rootIndex()

QModelIndex GraphicsScene::rootIndex ( ) const

Definition at line 216 of file kdganttgraphicsscene.cpp.

References d.

◆ rowController()

AbstractRowController * GraphicsScene::rowController ( ) const

Definition at line 256 of file kdganttgraphicsscene.cpp.

References d.

Referenced by KDGantt::GraphicsItem::updateItem(), and updateRow().

◆ selectionModel()

QItemSelectionModel * GraphicsScene::selectionModel ( ) const

◆ setConstraintModel

void GraphicsScene::setConstraintModel ( ConstraintModel cm)
slot

◆ setDragSource()

void GraphicsScene::setDragSource ( GraphicsItem item)

◆ setGrid()

void GraphicsScene::setGrid ( AbstractGrid grid)

Definition at line 261 of file kdganttgraphicsscene.cpp.

References d, grid(), KDGantt::AbstractGrid::gridChanged(), and model().

◆ setItemDelegate()

void GraphicsScene::setItemDelegate ( ItemDelegate delegate)

Definition at line 173 of file kdganttgraphicsscene.cpp.

References d.

◆ setModel

void GraphicsScene::setModel ( QAbstractItemModel *  model)
slot

Definition at line 192 of file kdganttgraphicsscene.cpp.

References d, model(), and setSelectionModel().

◆ setReadOnly

void GraphicsScene::setReadOnly ( bool  ro)
slot

Definition at line 281 of file kdganttgraphicsscene.cpp.

References d.

◆ setRootIndex

void GraphicsScene::setRootIndex ( const QModelIndex &  idx)
slot

Definition at line 211 of file kdganttgraphicsscene.cpp.

References d.

◆ setRowController()

void GraphicsScene::setRowController ( AbstractRowController rc)

Definition at line 251 of file kdganttgraphicsscene.cpp.

References d.

◆ setSelectionModel

void GraphicsScene::setSelectionModel ( QItemSelectionModel *  selectionmodel)
slot

Definition at line 240 of file kdganttgraphicsscene.cpp.

References d.

Referenced by setModel().

◆ setSummaryHandlingModel

void GraphicsScene::setSummaryHandlingModel ( QAbstractProxyModel *  proxyModel)
slot

Definition at line 205 of file kdganttgraphicsscene.cpp.

References d, and model().

◆ summaryHandlingModel()

QAbstractProxyModel * GraphicsScene::summaryHandlingModel ( ) const

Definition at line 200 of file kdganttgraphicsscene.cpp.

References d.

Referenced by deleteSubtree(), findItem(), insertItem(), and updateRow().

◆ updateItems()

void GraphicsScene::updateItems ( )

◆ updateRow()

void GraphicsScene::updateRow ( const QModelIndex &  idx)

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