KD Chart 2  [rev.2.8]
kdganttgraphicsview.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2021 Klaralvdalens Datakonsult AB. All rights reserved.
3 **
4 ** This file is part of the KD Chart library.
5 **
6 ** Licensees holding valid commercial KD Chart licenses may use this file in
7 ** accordance with the KD Chart Commercial License Agreement provided with
8 ** the Software.
9 **
10 **
11 ** This file may be distributed and/or modified under the terms of the
12 ** GNU General Public License version 2 and version 3 as published by the
13 ** Free Software Foundation and appearing in the file LICENSE.GPL.txt included.
14 **
15 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 **
18 ** Contact info@kdab.com if any conditions of this licensing are not
19 ** clear to you.
20 **
21 **********************************************************************/
22 
23 #include "kdganttgraphicsview.h"
24 #include "kdganttgraphicsview_p.h"
26 #include "kdganttgraphicsitem.h"
27 #include "kdganttconstraintmodel.h"
28 
29 #include <QMenu>
30 #include <QPainter>
31 #include <QPaintEvent>
32 #include <QResizeEvent>
33 #include <QScrollBar>
34 #include <QAbstractProxyModel>
35 #include <QPrinter>
36 
37 #include <cassert>
38 
39 #if defined KDAB_EVAL
40 #include "../evaldialog/evaldialog.h"
41 #endif
42 
47 using namespace KDGantt;
48 
49 HeaderWidget::HeaderWidget( GraphicsView* parent )
50  : QWidget( parent ), m_offset( 0. )
51 {
52  assert( parent ); // Parent must be set
53 }
54 
55 HeaderWidget::~HeaderWidget()
56 {
57 }
58 
59 void HeaderWidget::scrollTo( int v )
60 {
61  m_offset = v;
62  // QWidget::scroll() wont work properly for me on Mac
63  //scroll( static_cast<int>( old-v ), 0 );
64  update();
65 }
66 
67 void HeaderWidget::paintEvent( QPaintEvent* ev )
68 {
69  QPainter p( this );
70  view()->grid()->paintHeader( &p, rect(), ev->rect(), m_offset, this );
71 }
72 
73 bool HeaderWidget::event( QEvent* event )
74 {
75  if ( event->type() == QEvent::ToolTip ) {
76  DateTimeGrid* const grid = qobject_cast< DateTimeGrid* >( view()->grid() );
77  if ( grid ) {
78  QHelpEvent *e = static_cast<QHelpEvent*>( event );
79  QDateTime dt = grid->mapFromChart( view()->mapToScene( e->x(), 0 ).x() ).toDateTime();
80  setToolTip( dt.toString() );
81  }
82  }
83  return QWidget::event( event );
84 }
85 
86 void HeaderWidget::contextMenuEvent( QContextMenuEvent* event )
87 {
88  QMenu contextMenu;
89 
90  DateTimeGrid* const grid = qobject_cast< DateTimeGrid* >( view()->grid() );
91  QAction* actionScaleAuto = 0;
92  QAction* actionScaleMonth = 0;
93  QAction* actionScaleWeek = 0;
94  QAction* actionScaleDay = 0;
95  QAction* actionScaleHour = 0;
96  QAction* actionZoomIn = 0;
97  QAction* actionZoomOut = 0;
98  if ( grid != 0 )
99  {
100  QMenu* menuScale = new QMenu( tr( "Scale" ), &contextMenu );
101  QActionGroup* scaleGroup = new QActionGroup( &contextMenu );
102  scaleGroup->setExclusive( true );
103 
104  actionScaleAuto = new QAction( tr( "Auto" ), menuScale );
105  actionScaleAuto->setCheckable( true );
106  actionScaleAuto->setChecked( grid->scale() == DateTimeGrid::ScaleAuto );
107  actionScaleMonth = new QAction( tr( "Month" ), menuScale );
108  actionScaleMonth->setCheckable( true );
109  actionScaleMonth->setChecked( grid->scale() == DateTimeGrid::ScaleMonth );
110  actionScaleWeek = new QAction( tr( "Week" ), menuScale );
111  actionScaleWeek->setCheckable( true );
112  actionScaleWeek->setChecked( grid->scale() == DateTimeGrid::ScaleWeek );
113  actionScaleDay = new QAction( tr( "Day" ), menuScale );
114  actionScaleDay->setCheckable( true );
115  actionScaleDay->setChecked( grid->scale() == DateTimeGrid::ScaleDay );
116  actionScaleHour = new QAction( tr( "Hour" ), menuScale );
117  actionScaleHour->setCheckable( true );
118  actionScaleHour->setChecked( grid->scale() == DateTimeGrid::ScaleHour );
119 
120  scaleGroup->addAction( actionScaleAuto );
121  menuScale->addAction( actionScaleAuto );
122 
123  scaleGroup->addAction( actionScaleMonth );
124  menuScale->addAction( actionScaleMonth );
125 
126  scaleGroup->addAction( actionScaleWeek );
127  menuScale->addAction( actionScaleWeek );
128 
129  scaleGroup->addAction( actionScaleDay );
130  menuScale->addAction( actionScaleDay );
131 
132  scaleGroup->addAction( actionScaleHour );
133  menuScale->addAction( actionScaleHour );
134 
135  contextMenu.addMenu( menuScale );
136 
137  contextMenu.addSeparator();
138 
139  actionZoomIn = new QAction( tr( "Zoom In" ), &contextMenu );
140  contextMenu.addAction( actionZoomIn );
141  actionZoomOut = new QAction( tr( "Zoom Out" ), &contextMenu );
142  contextMenu.addAction( actionZoomOut );
143  }
144 
145  if ( contextMenu.isEmpty() )
146  {
147  event->ignore();
148  return;
149  }
150 
151  const QAction* const action = contextMenu.exec( event->globalPos() );
152  if ( action == 0 ) {}
153  else if ( action == actionScaleAuto )
154  {
155  assert( grid != 0 );
156  grid->setScale( DateTimeGrid::ScaleAuto );
157  }
158  else if ( action == actionScaleMonth )
159  {
160  assert( grid != 0 );
161  grid->setScale( DateTimeGrid::ScaleMonth );
162  }
163  else if ( action == actionScaleWeek )
164  {
165  assert( grid != 0 );
166  grid->setScale( DateTimeGrid::ScaleWeek );
167  }
168  else if ( action == actionScaleDay )
169  {
170  assert( grid != 0 );
171  grid->setScale( DateTimeGrid::ScaleDay );
172  }
173  else if ( action == actionScaleHour )
174  {
175  assert( grid != 0 );
176  grid->setScale( DateTimeGrid::ScaleHour );
177  }
178  else if ( action == actionZoomIn )
179  {
180  assert( grid != 0 );
181  grid->setDayWidth( qMax(0.1, grid->dayWidth() + grid->dayWidth() * 0.2) );
182  }
183  else if ( action == actionZoomOut )
184  {
185  assert( grid != 0 );
186  grid->setDayWidth( qMax(0.1, grid->dayWidth() - grid->dayWidth() * 0.2) );
187  }
188 
189  event->accept();
190 }
191 
192 GraphicsView::Private::Private( GraphicsView* _q )
193  : q( _q ), rowcontroller(0), headerwidget( _q )
194 {
195 }
196 
197 void GraphicsView::Private::updateHeaderGeometry()
198 {
199  q->setViewportMargins(0,rowcontroller->headerHeight(),0,0);
200  headerwidget.setGeometry( q->viewport()->x(),
201  q->viewport()->y() - rowcontroller->headerHeight(),
202  q->viewport()->width(),
203  rowcontroller->headerHeight() );
204 }
205 
206 void GraphicsView::Private::slotGridChanged()
207 {
208  updateHeaderGeometry();
209  headerwidget.update();
210  q->updateSceneRect();
211  q->update();
212 }
213 
214 void GraphicsView::Private::slotHorizontalScrollValueChanged( int val )
215 {
216  const QRectF viewRect = q->transform().mapRect( q->sceneRect() );
217  headerwidget.scrollTo( val-q->horizontalScrollBar()->minimum()+static_cast<int>( viewRect.left() ) );
218 }
219 
220 void GraphicsView::Private::slotColumnsInserted( const QModelIndex& parent, int start, int end )
221 {
222  Q_UNUSED( start );
223  Q_UNUSED( end );
224  QModelIndex idx = scene.model()->index( 0, 0, scene.summaryHandlingModel()->mapToSource( parent ) );
225  do {
226  scene.updateRow( scene.summaryHandlingModel()->mapFromSource( idx ) );
227  } while ( ( idx = rowcontroller->indexBelow( idx ) ) != QModelIndex() && rowcontroller->isRowVisible( idx ) );
228  //} while ( ( idx = d->treeview.indexBelow( idx ) ) != QModelIndex() && d->treeview.visualRect(idx).isValid() );
229  q->updateSceneRect();
230 }
231 
232 void GraphicsView::Private::slotColumnsRemoved( const QModelIndex& parent, int start, int end )
233 {
234  // TODO
235  Q_UNUSED( start );
236  Q_UNUSED( end );
237  Q_UNUSED( parent );
238  q->updateScene();
239 }
240 
241 void GraphicsView::Private::slotDataChanged( const QModelIndex& topLeft, const QModelIndex& bottomRight )
242 {
243  //qDebug() << "GraphicsView::slotDataChanged("<<topLeft<<bottomRight<<")";
244  const QModelIndex parent = topLeft.parent();
245  for ( int row = topLeft.row(); row <= bottomRight.row(); ++row ) {
246  scene.updateRow( scene.summaryHandlingModel()->index( row, 0, parent ) );
247  }
248 }
249 
250 void GraphicsView::Private::slotLayoutChanged()
251 {
252  //qDebug() << "slotLayoutChanged()";
253  q->updateScene();
254 }
255 
256 void GraphicsView::Private::slotModelReset()
257 {
258  //qDebug() << "slotModelReset()";
259  q->updateScene();
260 }
261 
262 void GraphicsView::Private::slotRowsInserted( const QModelIndex& parent, int start, int end )
263 {
264  Q_UNUSED( parent );
265  Q_UNUSED( start );
266  Q_UNUSED( end );
267  q->updateScene(); // TODO: This might be optimised
268 }
269 
270 void GraphicsView::Private::slotRowsAboutToBeRemoved( const QModelIndex& parent, int start, int end )
271 {
272  //qDebug() << "GraphicsView::Private::slotRowsAboutToBeRemoved("<<parent<<start<<end<<")";
273  for ( int row = start; row <= end; ++row ) {
274  for ( int col = 0; col < scene.summaryHandlingModel()->columnCount( parent ); ++col ) {
275  //qDebug() << "removing "<<scene.summaryHandlingModel()->index( row, col, parent );
276  scene.removeItem( scene.summaryHandlingModel()->index( row, col, parent ) );
277  }
278  }
279 }
280 
281 void GraphicsView::Private::slotRowsRemoved( const QModelIndex& parent, int start, int end )
282 {
283  //qDebug() << "GraphicsView::Private::slotRowsRemoved("<<parent<<start<<end<<")";
284  // TODO
285  Q_UNUSED( parent );
286  Q_UNUSED( start );
287  Q_UNUSED( end );
288 
289  q->updateScene();
290 }
291 
292 void GraphicsView::Private::slotItemClicked( const QModelIndex& idx )
293 {
294  QModelIndex sidx = idx;//scene.summaryHandlingModel()->mapToSource( idx );
295  emit q->clicked( sidx );
296  if (q->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, q))
297  emit q->activated( sidx );
298 }
299 
300 void GraphicsView::Private::slotItemDoubleClicked( const QModelIndex& idx )
301 {
302  QModelIndex sidx = idx;//scene.summaryHandlingModel()->mapToSource( idx );
303  emit q->qrealClicked( sidx );
304  if (!q->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, q))
305  emit q->activated( sidx );
306 }
307 
308 void GraphicsView::Private::slotHeaderContextMenuRequested( const QPoint& pt )
309 {
310  emit q->headerContextMenuRequested( headerwidget.mapToGlobal( pt ) );
311 }
312 
335  : QGraphicsView( parent ), _d( new Private( this ) )
336 {
337 
338 #if defined KDAB_EVAL
339  EvalDialog::checkEvalLicense( "KD Gantt" );
340 #endif
341  connect( horizontalScrollBar(), SIGNAL( valueChanged( int ) ),
342  this, SLOT( slotHorizontalScrollValueChanged( int ) ) );
343  connect( &_d->scene, SIGNAL( gridChanged() ),
344  this, SLOT( slotGridChanged() ) );
345  connect( &_d->scene, SIGNAL( entered( const QModelIndex& ) ),
346  this, SIGNAL( entered( const QModelIndex& ) ) );
347  connect( &_d->scene, SIGNAL( pressed( const QModelIndex& ) ),
348  this, SIGNAL( pressed( const QModelIndex& ) ) );
349  connect( &_d->scene, SIGNAL( clicked( const QModelIndex& ) ),
350  this, SLOT( slotItemClicked( const QModelIndex& ) ) );
351  connect( &_d->scene, SIGNAL( qrealClicked( const QModelIndex& ) ),
352  this, SLOT( slotItemDoubleClicked( const QModelIndex& ) ) );
353  connect( &_d->scene, SIGNAL( sceneRectChanged( const QRectF& ) ),
354  this, SLOT( updateSceneRect() ) );
355  connect( &_d->headerwidget, SIGNAL( customContextMenuRequested( const QPoint& ) ),
356  this, SLOT( slotHeaderContextMenuRequested( const QPoint& ) ) );
357  setScene( &_d->scene );
358 
359  // HACK!
360  setSummaryHandlingModel( _d->scene.summaryHandlingModel() );
361 
362  // So that AbstractGrid::drawBackground() and AbstractGrid::drawForeground()
363  // works properly
364  setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
365 
366  //setCacheMode( CacheBackground );
367 }
368 
371 {
372  delete _d;
373 }
374 
375 #define d d_func()
376 
390 void GraphicsView::setModel( QAbstractItemModel* model )
391 {
392  if ( d->scene.model() ) {
393  disconnect( d->scene.model() );
394  }
395 
396  d->scene.setModel( model );
397  connect( model, SIGNAL( dataChanged( const QModelIndex&, const QModelIndex& ) ),
398  this, SLOT( updateSceneRect() ) );
399  updateScene();
400 }
401 
404 QAbstractItemModel* GraphicsView::model() const
405 {
406  return d->scene.model();
407 }
408 
410 {
411  disconnect( d->scene.summaryHandlingModel() );
412  d->scene.setSummaryHandlingModel( proxyModel );
413 
414  /* Connections. We have to rely on the treeview
415  * to receive the signals before we do(!)
416  */
417  connect( proxyModel, SIGNAL( columnsInserted( const QModelIndex&, int, int ) ),
418  this, SLOT( slotColumnsInserted( const QModelIndex&, int, int ) ) );
419  connect( proxyModel, SIGNAL( columnsRemoved( const QModelIndex&, int, int ) ),
420  this, SLOT( slotColumnsRemoved( const QModelIndex&, int, int ) ) );
421  connect( proxyModel, SIGNAL( dataChanged( const QModelIndex&, const QModelIndex& ) ),
422  this, SLOT( slotDataChanged( const QModelIndex&, const QModelIndex& ) ) );
423  connect( proxyModel, SIGNAL( layoutChanged() ),
424  this, SLOT( slotLayoutChanged() ) );
425  connect( proxyModel, SIGNAL( modelReset() ),
426  this, SLOT( slotModelReset() ) );
427  connect( proxyModel, SIGNAL( rowsInserted( const QModelIndex&, int, int ) ),
428  this, SLOT( slotRowsInserted( const QModelIndex&, int, int ) ) );
429  connect( proxyModel, SIGNAL( rowsAboutToBeRemoved( const QModelIndex&, int, int ) ),
430  this, SLOT( slotRowsAboutToBeRemoved( const QModelIndex&, int, int ) ) );
431  connect( proxyModel, SIGNAL( rowsRemoved( const QModelIndex&, int, int ) ),
432  this, SLOT( slotRowsRemoved( const QModelIndex&, int, int ) ) );
433 
434  updateScene();
435 }
436 
441 {
442  d->scene.setConstraintModel( cmodel );
443 }
444 
448 {
449  return d->scene.constraintModel();
450 }
451 
455 {
456  return d->scene.summaryHandlingModel();
457 }
458 
462 void GraphicsView::setRootIndex( const QModelIndex& idx )
463 {
464  d->scene.setRootIndex( idx );
465 }
466 
469 QModelIndex GraphicsView::rootIndex() const
470 {
471  return d->scene.rootIndex();
472 }
473 
477 void GraphicsView::setSelectionModel( QItemSelectionModel* model )
478 {
479  d->scene.setSelectionModel( model );
480 }
481 
484 QItemSelectionModel* GraphicsView::selectionModel() const
485 {
486  return d->scene.selectionModel();
487 }
488 
493 {
494  d->scene.setItemDelegate( delegate );
495 }
496 
500 {
501  return d->scene.itemDelegate();
502 }
503 
510 {
511  d->rowcontroller = rowcontroller;
512  d->scene.setRowController( rowcontroller );
513  updateScene();
514 }
515 
520 {
521  return d->rowcontroller;
522 }
523 
529 void GraphicsView::setGrid( AbstractGrid* grid )
530 {
531  d->scene.setGrid( grid );
532  d->slotGridChanged();
533 }
534 
537 AbstractGrid* GraphicsView::grid() const
538 {
539  return d->scene.grid();
540 }
541 
546 {
547  d->scene.setReadOnly( ro );
548 }
549 
553 {
554  return d->scene.isReadOnly();
555 }
556 
566 void GraphicsView::setHeaderContextMenuPolicy( Qt::ContextMenuPolicy p )
567 {
568  d->headerwidget.setContextMenuPolicy( p );
569 }
570 
573 Qt::ContextMenuPolicy GraphicsView::headerContextMenuPolicy() const
574 {
575  return d->headerwidget.contextMenuPolicy();
576 }
577 
586 void GraphicsView::addConstraint( const QModelIndex& from,
587  const QModelIndex& to,
588  Qt::KeyboardModifiers modifiers )
589 {
590  if ( isReadOnly() ) return;
591  ConstraintModel* cmodel = constraintModel();
592  assert( cmodel );
593  Constraint c( from, to, ( modifiers&Qt::ShiftModifier )?Constraint::TypeHard:Constraint::TypeSoft );
594  if ( cmodel->hasConstraint( c ) ) cmodel->removeConstraint( c );
595  else cmodel->addConstraint( c );
596 }
597 
598 void GraphicsView::resizeEvent( QResizeEvent* ev )
599 {
600  d->updateHeaderGeometry();
601  QRectF r = scene()->itemsBoundingRect();
602  // To scroll more to the left than the actual item start, bug #4516
603  r.setLeft( qMin<qreal>( 0.0, r.left() ) );
604  // TODO: take scrollbars into account (if not always on)
605  // The scene should be at least the size of the viewport
606  QSizeF size = viewport()->size();
607  //TODO: why -2 below? size should be ex. frames etc?
608  if ( size.width() > r.width() ) {
609  r.setWidth( size.width() - 2 );
610  }
611  if ( size.height() > r.height() ) {
612  r.setHeight( size.height() - 2 );
613  }
614  const int totalh = rowController()->totalHeight();
615  if ( r.height() < totalh ) {
616  r.setHeight( totalh );
617  }
618 
619  scene()->setSceneRect( r );
620 
621  QGraphicsView::resizeEvent( ev );
622 }
623 
630 QModelIndex GraphicsView::indexAt( const QPoint& pos ) const
631 {
632  QGraphicsItem* item = itemAt( pos );
633  if ( GraphicsItem* gitem = qgraphicsitem_cast<GraphicsItem*>( item ) ) {
634  return d->scene.summaryHandlingModel()->mapToSource( gitem->index() );
635  } else {
636  return QModelIndex();
637  }
638 }
639 
642 {
643  d->scene.clearItems();
644 }
645 
647 void GraphicsView::updateRow( const QModelIndex& idx )
648 {
649  d->scene.updateRow( d->scene.summaryHandlingModel()->mapFromSource( idx ) );
650 }
651 
656 {
657  /* What to do with this? We need to shrink the view to
658  * make collapsing items work
659  */
660  qreal range = horizontalScrollBar()->maximum()-horizontalScrollBar()->minimum();
661  const qreal hscroll = horizontalScrollBar()->value()/( range>0?range:1 );
662  QRectF r = d->scene.itemsBoundingRect();
663  // To scroll more to the left than the actual item start, bug #4516
664  r.setTop( 0. );
665  r.setLeft( qMin<qreal>( 0.0, r.left() ) );
666  r.setSize( r.size().expandedTo( viewport()->size() ) );
667  const int totalh = rowController()->totalHeight();
668  if ( r.height() < totalh ) r.setHeight( totalh );
669  d->scene.setSceneRect( r );
670 
671  /* set scrollbar to keep the same time in view */
672  range = horizontalScrollBar()->maximum()-horizontalScrollBar()->minimum();
673  if ( range>0 ) horizontalScrollBar()->setValue( qRound( hscroll*range ) );
674 
675  /* We have to update here to adjust for any rows with no
676  * information because they are painted with a different
677  * background brush
678  */
679  d->scene.invalidate( QRectF(), QGraphicsScene::BackgroundLayer );
680 }
681 
686 {
687  clearItems();
688  if ( !model()) return;
689  if ( !rowController()) return;
690  QModelIndex idx = model()->index( 0, 0, rootIndex() );
691  do {
692  updateRow( idx );
693  } while ( ( idx = rowController()->indexBelow( idx ) ) != QModelIndex() && rowController()->isRowVisible(idx) );
694  //constraintModel()->cleanup();
695  //qDebug() << constraintModel();
696  updateSceneRect();
697  if ( scene() ) scene()->invalidate( QRectF(), QGraphicsScene::BackgroundLayer );
698 }
699 
701 GraphicsItem* GraphicsView::createItem( ItemType type ) const
702 {
703  return d->scene.createItem( type );
704 }
705 
707 void GraphicsView::deleteSubtree( const QModelIndex& idx )
708 {
709  d->scene.deleteSubtree( d->scene.summaryHandlingModel()->mapFromSource( idx ) );
710 }
711 
720 void GraphicsView::print( QPrinter* printer, bool drawRowLabels, bool drawColumnLabels )
721 {
722  d->scene.print( printer, drawRowLabels, drawColumnLabels );
723 }
724 
737 void GraphicsView::print( QPrinter* printer, qreal start, qreal end, bool drawRowLabels, bool drawColumnLabels )
738 {
739  d->scene.print( printer, start, end, drawRowLabels, drawColumnLabels );
740 }
741 
748 void GraphicsView::print( QPainter* painter, const QRectF& targetRect, bool drawRowLabels, bool drawColumnLabels )
749 {
750  d->scene.print(painter, targetRect, drawRowLabels, drawColumnLabels);
751 }
752 
763 void GraphicsView::print( QPainter* painter, qreal start, qreal end,
764  const QRectF& targetRect, bool drawRowLabels, bool drawColumnLabels )
765 {
766  d->scene.print(painter, start, end, targetRect, drawRowLabels, drawColumnLabels);
767 }
768 
769 
770 #include "moc_kdganttgraphicsview.cpp"
KDGantt::AbstractRowController::totalHeight
virtual int totalHeight() const =0
KDGantt::GraphicsView::setSelectionModel
void setSelectionModel(QItemSelectionModel *)
Definition: kdganttgraphicsview.cpp:477
KDGantt::GraphicsView::setItemDelegate
void setItemDelegate(ItemDelegate *delegate)
Definition: kdganttgraphicsview.cpp:492
QWidget
Class only listed here to document inheritance of some KDChart classes.
KDGantt::GraphicsView::model
QAbstractItemModel * model() const
Definition: kdganttgraphicsview.cpp:404
d
#define d
Definition: kdganttgraphicsview.cpp:375
KDGantt::Constraint::TypeSoft
@ TypeSoft
Definition: kdganttconstraint.h:43
KDGantt::GraphicsItem
Definition: kdganttgraphicsitem.h:42
KDGantt::GraphicsView::~GraphicsView
~GraphicsView() override
Definition: kdganttgraphicsview.cpp:370
KDGantt::GraphicsView::itemDelegate
ItemDelegate * itemDelegate() const
Definition: kdganttgraphicsview.cpp:499
KDGantt::GraphicsView::headerContextMenuPolicy
Qt::ContextMenuPolicy headerContextMenuPolicy() const
Definition: kdganttgraphicsview.cpp:573
KDGantt::GraphicsView::updateScene
void updateScene()
Definition: kdganttgraphicsview.cpp:685
KDGantt::GraphicsView::setModel
void setModel(QAbstractItemModel *)
Definition: kdganttgraphicsview.cpp:390
KDGantt::GraphicsView::clearItems
void clearItems()
Definition: kdganttgraphicsview.cpp:641
KDGantt::GraphicsView::setGrid
void setGrid(AbstractGrid *)
Definition: kdganttgraphicsview.cpp:529
kdganttgraphicsview.h
KDGantt::GraphicsView::setReadOnly
void setReadOnly(bool)
Definition: kdganttgraphicsview.cpp:545
KDGantt::GraphicsView::rootIndex
QModelIndex rootIndex() const
Definition: kdganttgraphicsview.cpp:469
KDGantt::GraphicsView::setSummaryHandlingModel
void setSummaryHandlingModel(QAbstractProxyModel *model)
Definition: kdganttgraphicsview.cpp:409
KDGantt::GraphicsView
The GraphicsView class provides a model/view implementation of a gantt chart.
Definition: kdganttgraphicsview.h:45
KDGantt::AbstractRowController
Abstract baseclass for row controllers. A row controller is used by the GraphicsView to nagivate the ...
Definition: kdganttabstractrowcontroller.h:34
KDGantt
Definition: kdganttabstractrowcontroller.h:33
KDGantt::GraphicsView::clicked
void clicked(const QModelIndex &index)
KDGantt::GraphicsView::setRowController
void setRowController(AbstractRowController *)
Definition: kdganttgraphicsview.cpp:509
KDGantt::GraphicsView::GraphicsView
GraphicsView(QWidget *parent=0)
Definition: kdganttgraphicsview.cpp:334
KDGantt::GraphicsView::print
void print(QPrinter *printer, bool drawRowLabels=true, bool drawColumnLabels=true)
Definition: kdganttgraphicsview.cpp:720
KDGantt::ItemDelegate
Class used to render gantt items in a KDGantt::GraphicsView.
Definition: kdganttitemdelegate.h:37
KDGantt::ConstraintModel::removeConstraint
virtual bool removeConstraint(const Constraint &c)
Definition: kdganttconstraintmodel.cpp:144
KDGantt::GraphicsView::updateRow
void updateRow(const QModelIndex &)
Definition: kdganttgraphicsview.cpp:647
KDGantt::GraphicsView::rowController
AbstractRowController * rowController() const
Definition: kdganttgraphicsview.cpp:519
KDGantt::GraphicsView::selectionModel
QItemSelectionModel * selectionModel() const
Definition: kdganttgraphicsview.cpp:484
KDGantt::GraphicsView::setConstraintModel
void setConstraintModel(ConstraintModel *)
Definition: kdganttgraphicsview.cpp:440
QGraphicsView
KDGantt::GraphicsView::resizeEvent
void resizeEvent(QResizeEvent *) override
Definition: kdganttgraphicsview.cpp:598
kdganttabstractrowcontroller.h
KDGantt::GraphicsView::isReadOnly
bool isReadOnly() const
Definition: kdganttgraphicsview.cpp:552
QAbstractProxyModel
KDGantt::Constraint
A class used to represent a dependency.
Definition: kdganttconstraint.h:38
KDGantt::ConstraintModel
Definition: kdganttconstraintmodel.h:33
KDGantt::GraphicsView::addConstraint
virtual void addConstraint(const QModelIndex &from, const QModelIndex &to, Qt::KeyboardModifiers modifiers)
Definition: kdganttgraphicsview.cpp:586
KDGantt::GraphicsView::indexAt
QModelIndex indexAt(const QPoint &pos) const
Definition: kdganttgraphicsview.cpp:630
KDGantt::GraphicsView::summaryHandlingModel
QAbstractProxyModel * summaryHandlingModel() const
Definition: kdganttgraphicsview.cpp:454
KDGantt::GraphicsView::qrealClicked
void qrealClicked(const QModelIndex &index)
kdganttgraphicsitem.h
KDGantt::GraphicsView::pressed
void pressed(const QModelIndex &index)
KDGantt::ItemType
ItemType
Definition: kdganttglobal.h:225
KDGantt::GraphicsView::entered
void entered(const QModelIndex &index)
KDGantt::ConstraintModel::hasConstraint
bool hasConstraint(const Constraint &c) const
Definition: kdganttconstraintmodel.cpp:228
KDGantt::ConstraintModel::addConstraint
virtual void addConstraint(const Constraint &c)
Subclassing ConstraintModel and overriding addConstraint() and removeConstraint() can provide re-entr...
Definition: kdganttconstraintmodel.cpp:115
QGraphicsItem
KDGantt::GraphicsView::constraintModel
ConstraintModel * constraintModel() const
Definition: kdganttgraphicsview.cpp:447
kdganttconstraintmodel.h
KDGantt::GraphicsView::setRootIndex
void setRootIndex(const QModelIndex &)
Definition: kdganttgraphicsview.cpp:462
KDGantt::GraphicsView::deleteSubtree
void deleteSubtree(const QModelIndex &)
Definition: kdganttgraphicsview.cpp:707
KDGantt::GraphicsView::setHeaderContextMenuPolicy
void setHeaderContextMenuPolicy(Qt::ContextMenuPolicy)
Definition: kdganttgraphicsview.cpp:566
KDGantt::GraphicsView::grid
AbstractGrid * grid() const
Definition: kdganttgraphicsview.cpp:537
KDGantt::GraphicsView::updateSceneRect
void updateSceneRect()
Definition: kdganttgraphicsview.cpp:655
KDGantt::Constraint::TypeHard
@ TypeHard
Definition: kdganttconstraint.h:44

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/