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

This widget that consists of a QTreeView and a GraphicsView. More...

#include <KDGanttView>

Inheritance diagram for KDGantt::View:

Public Slots

void collapseAll (QModelIndex index=QModelIndex())
 
void expandAll (QModelIndex index=QModelIndex())
 
void setConstraintModel (ConstraintModel *)
 Sets the constraintmodel displayed by this view. More...
 
void setGrid (AbstractGrid *)
 Sets the AbstractGrid for this view. More...
 
void setItemDelegate (ItemDelegate *)
 Sets the KDGantt::ItemDelegate used for rendering items on this view. More...
 
void setModel (QAbstractItemModel *model)
 Sets the QAbstractItemModel to be displayed in this view to model. More...
 
void setRootIndex (const QModelIndex &idx)
 Sets the root index of the model displayed by this view. More...
 
void setSelectionModel (QItemSelectionModel *smodel)
 Sets the QItemSelectionModel used by this view to manage selections. More...
 

Public Member Functions

 View (QWidget *parent=nullptr)
 Constructor. More...
 
 ~View () override
 
ConstraintModelconstraintModel () const
 
void ensureVisible (const QModelIndex &index)
 
QAbstractProxyModel * ganttProxyModel ()
 
const QAbstractProxyModel * ganttProxyModel () const
 
GraphicsViewgraphicsView ()
 
const GraphicsViewgraphicsView () const
 
AbstractGridgrid () const
 
QModelIndex indexAt (const QPoint &pos) const
 
ItemDelegateitemDelegate () const
 
QAbstractItemView * leftView ()
 
const QAbstractItemView * leftView () const
 
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...
 
QModelIndex rootIndex () const
 
AbstractRowControllerrowController ()
 
const AbstractRowControllerrowController () const
 
QItemSelectionModel * selectionModel () const
 
void setGraphicsView (GraphicsView *)
 Set the GraphicsView to be used for this View. More...
 
void setLeftView (QAbstractItemView *)
 Replaces the left widget with a custom QAbstractItemView. More...
 
void setRowController (AbstractRowController *)
 Sets ctrl to be the rowcontroller used by this View. More...
 
QSplitter * splitter ()
 
const QSplitter * splitter () const
 

Protected Member Functions

void resizeEvent (QResizeEvent *) override
 

Detailed Description

This widget that consists of a QTreeView and a GraphicsView.

This is the easy to use, complete gantt chart widget. It consists of a QTreeView on the left and a KDGantt::GraphicsView on the right separated by a QSplitter. The two views share the same model.

Definition at line 35 of file kdganttview.h.

Constructor & Destructor Documentation

◆ View()

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

Constructor.

Creates a View with parent parent, a DateTimeGrid as default grid implementation and no model etc.

Definition at line 247 of file kdganttview.cpp.

◆ ~View()

View::~View ( )
override

Definition at line 257 of file kdganttview.cpp.

Member Function Documentation

◆ collapseAll

void View::collapseAll ( QModelIndex  index = QModelIndex())
slot

Definition at line 455 of file kdganttview.cpp.

References leftView().

◆ constraintModel()

ConstraintModel * View::constraintModel ( ) const
Returns
the KDGantt::ConstraintModel displayed by this view.

Definition at line 511 of file kdganttview.cpp.

References d.

◆ ensureVisible()

void View::ensureVisible ( const QModelIndex &  index)

Definition at line 526 of file kdganttview.cpp.

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

◆ expandAll

void View::expandAll ( QModelIndex  index = QModelIndex())
slot

Definition at line 449 of file kdganttview.cpp.

References leftView().

◆ ganttProxyModel() [1/2]

QAbstractProxyModel * View::ganttProxyModel ( )

Definition at line 521 of file kdganttview.cpp.

References d.

◆ ganttProxyModel() [2/2]

const QAbstractProxyModel * View::ganttProxyModel ( ) const

Definition at line 516 of file kdganttview.cpp.

References d.

Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().

◆ graphicsView() [1/2]

GraphicsView * View::graphicsView ( )

Definition at line 383 of file kdganttview.cpp.

References d.

◆ graphicsView() [2/2]

const GraphicsView * KDGantt::View::graphicsView ( ) const
Returns
a pointer to the GraphicsView

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 375 of file kdganttview.cpp.

References d.

Referenced by ensureVisible(), and print().

◆ grid()

AbstractGrid * View::grid ( ) const
Returns
the AbstractGrid used by this view.

Definition at line 463 of file kdganttview.cpp.

References d.

Referenced by setGrid().

◆ indexAt()

QModelIndex View::indexAt ( const QPoint &  pos) const
Returns
The QModelIndex for the item located at position pos in the view or an invalid index if no item was present at that position.
See also
GraphicsView::indexAt

Definition at line 552 of file kdganttview.cpp.

References d.

◆ itemDelegate()

ItemDelegate * View::itemDelegate ( ) const
Returns
the ItemDelegate used by this view to render items

Definition at line 486 of file kdganttview.cpp.

References d.

◆ leftView() [1/2]

QAbstractItemView * View::leftView ( )

Definition at line 350 of file kdganttview.cpp.

References d.

◆ leftView() [2/2]

const QAbstractItemView * KDGantt::View::leftView ( ) const
Returns
a pointer to the QAbstractItemView in the left part of the widget.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 342 of file kdganttview.cpp.

References d.

Referenced by collapseAll(), expandAll(), model(), rootIndex(), selectionModel(), setItemDelegate(), setModel(), setRootIndex(), and setSelectionModel().

◆ model()

QAbstractItemModel * View::model ( ) const
Returns
the current model displayed by this view

Definition at line 406 of file kdganttview.cpp.

References leftView().

Referenced by ensureVisible(), and setModel().

◆ print() [1/4]

void View::print ( QPainter *  painter,
const QRectF &  target = 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 593 of file kdganttview.cpp.

References d.

◆ print() [2/4]

void View::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.

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 611 of file kdganttview.cpp.

References d.

◆ print() [3/4]

void View::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 565 of file kdganttview.cpp.

References graphicsView(), and KDGantt::GraphicsView::print().

◆ print() [4/4]

void View::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 582 of file kdganttview.cpp.

References graphicsView(), and KDGantt::GraphicsView::print().

◆ resizeEvent()

void View::resizeEvent ( QResizeEvent *  ev)
overrideprotected

Definition at line 541 of file kdganttview.cpp.

◆ rootIndex()

QModelIndex View::rootIndex ( ) const
Returns
the rootindex for this view.

Definition at line 470 of file kdganttview.cpp.

References leftView().

◆ rowController() [1/2]

AbstractRowController * KDGantt::View::rowController ( )
Returns
a pointer to the current rowcontroller.
See also
AbstractRowController

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 326 of file kdganttview.cpp.

References d.

◆ rowController() [2/2]

const AbstractRowController * View::rowController ( ) const

Definition at line 333 of file kdganttview.cpp.

References d.

◆ selectionModel()

QItemSelectionModel * View::selectionModel ( ) const
Returns
the QItemSelectionModel used by this view

Definition at line 425 of file kdganttview.cpp.

References leftView().

◆ setConstraintModel

void View::setConstraintModel ( ConstraintModel cm)
slot

Sets the constraintmodel displayed by this view.

See also
KDGantt::ConstraintModel.

Definition at line 503 of file kdganttview.cpp.

References d.

◆ setGraphicsView()

void View::setGraphicsView ( GraphicsView gv)

Set the GraphicsView to be used for this View.

It only makes sense to call this if you need to subclass GraphicsView.

NOTE: Only call this right after creating the View, before setting a model or any other attributes.

Definition at line 361 of file kdganttview.cpp.

References d, and KDGantt::GraphicsView::grid().

◆ setGrid

void View::setGrid ( AbstractGrid grid)
slot

Sets the AbstractGrid for this view.

The grid is an object that controls how QModelIndexes are mapped to and from the view and how the background and header is rendered.

See also
AbstractGrid and DateTimeGrid.

Definition at line 444 of file kdganttview.cpp.

References d, and grid().

◆ setItemDelegate

void View::setItemDelegate ( ItemDelegate delegate)
slot

Sets the KDGantt::ItemDelegate used for rendering items on this view.

See also
ItemDelegate and QAbstractItemDelegate.

Definition at line 494 of file kdganttview.cpp.

References d, and leftView().

◆ setLeftView()

void View::setLeftView ( QAbstractItemView *  aiv)

Replaces the left widget with a custom QAbstractItemView.

Parameters
aivThe view to be used to the left, instead of the default tree view
See also
setRowController()

Definition at line 269 of file kdganttview.cpp.

References d.

Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().

◆ setModel

void View::setModel ( QAbstractItemModel *  model)
slot

Sets the QAbstractItemModel to be displayed in this view to model.

See also
GraphicsView::setModel

Definition at line 416 of file kdganttview.cpp.

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

◆ setRootIndex

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

Sets the root index of the model displayed by this view.

Similar to QAbstractItemView::setRootIndex, default is QModelIndex().

Definition at line 478 of file kdganttview.cpp.

References d, and leftView().

◆ setRowController()

void View::setRowController ( AbstractRowController ctrl)

Sets ctrl to be the rowcontroller used by this View.

The default rowcontroller is owned by KDGantt::View and is suitable for the default treeview in the left part of the view. You probably only want to change this if you replace the treeview.

Definition at line 315 of file kdganttview.cpp.

References d.

Referenced by KDAB_SCOPED_UNITTEST_SIMPLE().

◆ setSelectionModel

void View::setSelectionModel ( QItemSelectionModel *  smodel)
slot

Sets the QItemSelectionModel used by this view to manage selections.

Similar to QAbstractItemView::setSelectionModel

Definition at line 433 of file kdganttview.cpp.

References d, and leftView().

◆ splitter() [1/2]

QSplitter * View::splitter ( )

Definition at line 399 of file kdganttview.cpp.

References d.

◆ splitter() [2/2]

const QSplitter * KDGantt::View::splitter ( ) const
Returns
a pointer to the QSplitter that manages the left view and graphicsView

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 391 of file kdganttview.cpp.

References d.


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