KGantt::GraphicsView
#include <KGanttGraphicsView>
Signals | |
void | activated (const QModelIndex &index) |
void | clicked (const QModelIndex &index) |
void | entered (const QModelIndex &index) |
void | headerContextMenuRequested (const QPoint &pt) |
void | pressed (const QModelIndex &index) |
void | qrealClicked (const QModelIndex &index) |
Public Slots | |
void | setConstraintModel (KGantt::ConstraintModel *) |
void | setGrid (KGantt::AbstractGrid *) |
void | setItemDelegate (KGantt::ItemDelegate *delegate) |
void | setModel (QAbstractItemModel *) |
void | setReadOnly (bool) |
void | setRootIndex (const QModelIndex &) |
void | setRowController (KGantt::AbstractRowController *) |
void | setSelectionModel (QItemSelectionModel *) |
void | setSummaryHandlingModel (QAbstractProxyModel *model) |
void | updateSceneRect () |
Detailed Description
The GraphicsView class provides a model/view implementation of a gantt chart.
Definition at line 36 of file kganttgraphicsview.h.
Property Documentation
◆ readOnly
|
readwrite |
Definition at line 40 of file kganttgraphicsview.h.
Constructor & Destructor Documentation
◆ GraphicsView()
Constructor. Creates a new KGantt::GraphicsView with parent parent.
Definition at line 433 of file kganttgraphicsview.cpp.
◆ ~GraphicsView()
|
override |
Destroys this view.
Definition at line 468 of file kganttgraphicsview.cpp.
Member Function Documentation
◆ addConstraint()
|
virtual |
Adds a constraint from from to to. modifiers are the keyboard modifiers pressed by the user when the action is invoked.
Override this to control how constraints are added. The default implementation adds a soft constraint unless the Shift key is pressed, in that case it adds a hard constraint. If a constraint is already present, it is removed and nothing is added.
Definition at line 636 of file kganttgraphicsview.cpp.
◆ clearItems()
|
protected |
Definition at line 686 of file kganttgraphicsview.cpp.
◆ constraintModel()
ConstraintModel * GraphicsView::constraintModel | ( | ) | const |
- Returns
- the KGantt::ConstraintModel displayed by this view.
Definition at line 531 of file kganttgraphicsview.cpp.
◆ deleteSubtree()
void GraphicsView::deleteSubtree | ( | const QModelIndex & | idx | ) |
Definition at line 756 of file kganttgraphicsview.cpp.
◆ grid()
AbstractGrid * GraphicsView::grid | ( | ) | const |
- Returns
- the AbstractGrid used by this view.
Definition at line 600 of file kganttgraphicsview.cpp.
◆ headerContextMenuPolicy()
Qt::ContextMenuPolicy GraphicsView::headerContextMenuPolicy | ( | ) | const |
- Returns
- the context menu policy for the header
Definition at line 630 of file kganttgraphicsview.cpp.
◆ headerContextMenuRequested
This signal is emitted when the header has contextMenuPolicy Qt::CustomContextMenu and the widget wants to show a context menu for the header. Unlike in QWidget::customContextMenuRequested() signal, pt is here in global coordinates.
◆ indexAt()
QModelIndex GraphicsView::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.
This is useful for for example contextmenus.
Definition at line 675 of file kganttgraphicsview.cpp.
◆ isReadOnly()
bool GraphicsView::isReadOnly | ( | ) | const |
- Returns
- true if the view is in read-only mode
Definition at line 618 of file kganttgraphicsview.cpp.
◆ itemDelegate()
ItemDelegate * GraphicsView::itemDelegate | ( | ) | const |
- Returns
- the ItemDelegate used by this view to render items
Definition at line 573 of file kganttgraphicsview.cpp.
◆ model()
QAbstractItemModel * GraphicsView::model | ( | ) | const |
- Returns
- the current model displayed by this view
Note: The returned model is not the model set with setModel()
- See also
- GraphicsView::setModel
Definition at line 491 of file kganttgraphicsview.cpp.
◆ print() [1/4]
void GraphicsView::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 774 of file kganttgraphicsview.cpp.
◆ print() [2/4]
void GraphicsView::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 780 of file kganttgraphicsview.cpp.
◆ print() [3/4]
void GraphicsView::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 762 of file kganttgraphicsview.cpp.
◆ print() [4/4]
void GraphicsView::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 768 of file kganttgraphicsview.cpp.
◆ printDiagram()
void GraphicsView::printDiagram | ( | QPrinter * | printer, |
const PrintingContext & | context ) |
Print the Gantt chart on the printer in accordance with the PrintingContext context
- See also
- PrintingContext
- Since
- 2.8.0
Definition at line 786 of file kganttgraphicsview.cpp.
◆ resizeEvent()
|
overrideprotectedvirtual |
Reimplemented from QGraphicsView.
Definition at line 648 of file kganttgraphicsview.cpp.
◆ rootIndex()
QModelIndex GraphicsView::rootIndex | ( | ) | const |
- Returns
- the rootindex for this view.
Definition at line 549 of file kganttgraphicsview.cpp.
◆ rowController()
AbstractRowController * GraphicsView::rowController | ( | ) | const |
- Returns
- the AbstractRowController for this view.
- See also
- setRowController
Definition at line 587 of file kganttgraphicsview.cpp.
◆ selectionModel()
QItemSelectionModel * GraphicsView::selectionModel | ( | ) | const |
- Returns
- the QItemSelectionModel used by this view
Definition at line 561 of file kganttgraphicsview.cpp.
◆ setConstraintModel
|
slot |
Sets the constraintmodel displayed by this view.
- See also
- KGantt::ConstraintModel.
Definition at line 525 of file kganttgraphicsview.cpp.
◆ setGrid
|
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 593 of file kganttgraphicsview.cpp.
◆ setHeaderContextMenuPolicy()
void GraphicsView::setHeaderContextMenuPolicy | ( | Qt::ContextMenuPolicy | p | ) |
Sets the context menu policy for the header. The default value Qt::DefaultContextMenu results in a standard context menu on the header that allows the user to set the scale and zoom.
Setting this to Qt::CustomContextMenu will cause the signal headerContextMenuRequested(const QPoint& pt) to be emitted instead.
Definition at line 624 of file kganttgraphicsview.cpp.
◆ setItemDelegate
|
slot |
Sets the KGantt::ItemDelegate used for rendering items on this view.
- See also
- ItemDelegate and QAbstractItemDelegate.
Definition at line 567 of file kganttgraphicsview.cpp.
◆ setModel
|
slot |
Sets the model to be displayed in this view to model. The view does not take ownership of the model.
To make a model work well with GraphicsView it must have a certain layout. Whether the model is flat or has a treestrucure is not important, as long as an AbstractRowController is provided that can navigate the model.
GraphicsView operates per row in the model. The data is always taken from the last item in the row. The ItemRoles used are Qt::DisplayRole and the roles defined in KGantt::ItemDataRole.
Note: This model is not returned by model()
- See also
- GraphicsView::model
Definition at line 476 of file kganttgraphicsview.cpp.
◆ setReadOnly
|
slot |
Sets the view to read-only mode if to is true. The default is read/write if the model permits it.
Definition at line 612 of file kganttgraphicsview.cpp.
◆ setRootIndex
|
slot |
Sets the root index of the model displayed by this view. Similar to QAbstractItemView::setRootIndex, default is QModelIndex().
Definition at line 543 of file kganttgraphicsview.cpp.
◆ setRowController
|
slot |
Sets the AbstractRowController used by this view. The AbstractRowController deals with the height and position of each row and with which parts of the model are displayed.
- See also
- AbstractRowController
Definition at line 579 of file kganttgraphicsview.cpp.
◆ setSelectionModel
|
slot |
Sets the QItemSelectionModel used by this view to manage selections. Similar to QAbstractItemView::setSelectionModel
Definition at line 555 of file kganttgraphicsview.cpp.
◆ setSummaryHandlingModel
|
slot |
Definition at line 496 of file kganttgraphicsview.cpp.
◆ summaryHandlingModel()
QAbstractProxyModel * GraphicsView::summaryHandlingModel | ( | ) | const |
- Returns
- the KGantt::SummaryHandlingProxyModel used by this view.
Definition at line 537 of file kganttgraphicsview.cpp.
◆ takeGrid()
AbstractGrid * GraphicsView::takeGrid | ( | ) |
- Returns
- the AbstractGrid used by this view.
Definition at line 606 of file kganttgraphicsview.cpp.
◆ updateRow()
void GraphicsView::updateRow | ( | const QModelIndex & | idx | ) |
Definition at line 692 of file kganttgraphicsview.cpp.
◆ updateScene()
void GraphicsView::updateScene | ( | ) |
Resets the state of the view.
Definition at line 730 of file kganttgraphicsview.cpp.
◆ updateSceneRect
|
slot |
Adjusts the bounding rectangle of the scene.
Definition at line 698 of file kganttgraphicsview.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:21 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.