KD Chart 2  [rev.2.8]
KDChartAbstractDiagram.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 "KDChartAbstractDiagram.h"
24 #include "KDChartAbstractDiagram_p.h"
25 
26 #include <QPainter>
27 #include <QDebug>
28 #include <QApplication>
29 #include <QAbstractProxyModel>
30 #include <QSizeF>
31 
33 #include "KDChartChart.h"
35 #include "KDChartTextAttributes.h"
39 #include "KDChartPainterSaver_p.h"
40 
41 #include <KDABLibFakes>
42 
43 #include <limits>
44 
45 using namespace KDChart;
46 
47 #define d d_func()
48 
50  : QAbstractItemView ( parent ), _d( new Private() )
51 {
52  _d->init( plane );
53  init();
54 }
55 
57 {
58  emit aboutToBeDestroyed();
59  delete _d;
60 }
61 
62 void AbstractDiagram::init()
63 {
64  _d->diagram = this;
65  d->reverseMapper.setDiagram( this );
66 }
67 
68 
69 bool AbstractDiagram::compare( const AbstractDiagram* other ) const
70 {
71  if ( other == this ) return true;
72  if ( !other ) {
73  return false;
74  }
75  return // compare QAbstractScrollArea properties
76  (horizontalScrollBarPolicy() == other->horizontalScrollBarPolicy()) &&
77  (verticalScrollBarPolicy() == other->verticalScrollBarPolicy()) &&
78  // compare QFrame properties
79  (frameShadow() == other->frameShadow()) &&
80  (frameShape() == other->frameShape()) &&
81 // frameWidth is a read-only property defined by the style, it should not be in here:
82  // (frameWidth() == other->frameWidth()) &&
83  (lineWidth() == other->lineWidth()) &&
84  (midLineWidth() == other->midLineWidth()) &&
85  // compare QAbstractItemView properties
86  (alternatingRowColors() == other->alternatingRowColors()) &&
87  (hasAutoScroll() == other->hasAutoScroll()) &&
88  (dragDropMode() == other->dragDropMode()) &&
89  (dragDropOverwriteMode() == other->dragDropOverwriteMode()) &&
90  (horizontalScrollMode() == other->horizontalScrollMode ()) &&
91  (verticalScrollMode() == other->verticalScrollMode()) &&
92  (dragEnabled() == other->dragEnabled()) &&
93  (editTriggers() == other->editTriggers()) &&
94  (iconSize() == other->iconSize()) &&
95  (selectionBehavior() == other->selectionBehavior()) &&
96  (selectionMode() == other->selectionMode()) &&
97  (showDropIndicator() == other->showDropIndicator()) &&
98  (tabKeyNavigation() == other->tabKeyNavigation()) &&
99  (textElideMode() == other->textElideMode()) &&
100  // compare all of the properties stored in the attributes model
101  attributesModel()->compare( other->attributesModel() ) &&
102  // compare own properties
103  (rootIndex().column() == other->rootIndex().column()) &&
104  (rootIndex().row() == other->rootIndex().row()) &&
106  (antiAliasing() == other->antiAliasing()) &&
107  (percentMode() == other->percentMode()) &&
108  (datasetDimension() == other->datasetDimension());
109 }
110 
112 {
113  return d->plane;
114 }
115 
117 {
118  if ( d->databoundariesDirty ) {
119  d->databoundaries = calculateDataBoundaries ();
120  d->databoundariesDirty = false;
121  }
122  return d->databoundaries;
123 }
124 
126 {
127  d->databoundariesDirty = true;
128  update();
129 }
130 
131 void AbstractDiagram::setModel( QAbstractItemModel * newModel )
132 {
133  if ( newModel == model() ) {
134  return;
135  }
136 
137  AttributesModel* amodel = new PrivateAttributesModel( newModel, this );
138  amodel->initFrom( d->attributesModel );
139  d->setAttributesModel(amodel);
140 
141  QAbstractItemView::setModel( newModel );
142 
143  scheduleDelayedItemsLayout();
145  emit modelsChanged();
146 }
147 
148 void AbstractDiagram::setSelectionModel( QItemSelectionModel* newSelectionModel )
149 {
150  if ( selectionModel() )
151  {
152  disconnect( selectionModel(), SIGNAL( currentChanged( QModelIndex, QModelIndex ) ), this, SIGNAL( modelsChanged() ) );
153  disconnect( selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), this, SIGNAL( modelsChanged() ) );
154  }
155  QAbstractItemView::setSelectionModel( newSelectionModel );
156  if ( selectionModel() )
157  {
158  connect( selectionModel(), SIGNAL( currentChanged( QModelIndex, QModelIndex ) ), this, SIGNAL( modelsChanged() ) );
159  connect( selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), this, SIGNAL( modelsChanged() ) );
160  }
161  emit modelsChanged();
162 }
163 
172 {
173  if ( amodel->sourceModel() != model() ) {
174  qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
175  "Trying to set an attributesmodel which works on a different "
176  "model than the diagram.");
177  return;
178  }
179  if ( qobject_cast<PrivateAttributesModel*>(amodel) ) {
180  qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
181  "Trying to set an attributesmodel that is private to another diagram.");
182  return;
183  }
184 
185  d->setAttributesModel( amodel );
186  scheduleDelayedItemsLayout();
188  emit modelsChanged();
189 }
190 
192 {
193  return d->usesExternalAttributesModel();
194 }
195 
197 {
198  return d->attributesModel;
199 }
200 
201 QModelIndex AbstractDiagram::conditionallyMapFromSource( const QModelIndex & index ) const
202 {
203  Q_ASSERT( !index.isValid() || index.model() == attributesModel() || index.model() == attributesModel()->sourceModel() );
204  return index.model() == attributesModel() ? index : attributesModel()->mapFromSource( index );
205 }
206 
208 void AbstractDiagram::setRootIndex ( const QModelIndex& idx )
209 {
210  QAbstractItemView::setRootIndex( idx );
211  setAttributesModelRootIndex( d->attributesModel->mapFromSource( idx ) );
212 }
213 
215 void AbstractDiagram::setAttributesModelRootIndex( const QModelIndex& idx )
216 {
217  d->attributesModelRootIndex = idx;
219  scheduleDelayedItemsLayout();
220 }
221 
225 {
226  if ( !d->attributesModelRootIndex.isValid() )
227  d->attributesModelRootIndex = d->attributesModel->mapFromSource( rootIndex() );
228  return d->attributesModelRootIndex;
229 }
230 
232 {
233  d->plane = parent;
234 }
235 
237 {
238  if ( d->plane ) {
239  d->plane->layoutDiagrams();
240  update();
241  }
242  QAbstractItemView::doItemsLayout();
243 }
244 
245 void AbstractDiagram::dataChanged( const QModelIndex &topLeft,
246  const QModelIndex &bottomRight,
247  const QVector<int> & )
248 {
249  Q_UNUSED( topLeft );
250  Q_UNUSED( bottomRight );
251  // We are still too dumb to do intelligent updates...
253  scheduleDelayedItemsLayout();
254 }
255 
256 
257 void AbstractDiagram::setHidden( const QModelIndex & index, bool hidden )
258 {
259  d->attributesModel->setData(
260  conditionallyMapFromSource( index ),
261  qVariantFromValue( hidden ),
262  DataHiddenRole );
263  emit dataHidden();
264 }
265 
266 void AbstractDiagram::setHidden( int dataset, bool hidden )
267 {
268  d->setDatasetAttrs( dataset, qVariantFromValue( hidden ), DataHiddenRole );
269  emit dataHidden();
270 }
271 
272 void AbstractDiagram::setHidden( bool hidden )
273 {
274  d->attributesModel->setModelData( qVariantFromValue( hidden ), DataHiddenRole );
275  emit dataHidden();
276 }
277 
279 {
280  return attributesModel()->modelData( DataHiddenRole ).value< bool >();
281 }
282 
283 bool AbstractDiagram::isHidden( int dataset ) const
284 {
285  const QVariant boolFlag( d->datasetAttrs( dataset, DataHiddenRole ) );
286  if ( boolFlag.isValid() )
287  return boolFlag.value< bool >();
288  return isHidden();
289 }
290 
291 bool AbstractDiagram::isHidden( const QModelIndex & index ) const
292 {
293  const QVariant boolFlag( attributesModel()->data( conditionallyMapFromSource( index ),
294  DataHiddenRole ) );
295  if ( boolFlag.isValid() ) {
296  return boolFlag.value< bool >();
297  }
298  int dataset = index.column() / d->datasetDimension;
299  return isHidden( dataset );
300 }
301 
302 
303 void AbstractDiagram::setDataValueAttributes( const QModelIndex & index,
304  const DataValueAttributes & a )
305 {
306  d->attributesModel->setData( conditionallyMapFromSource( index ), qVariantFromValue( a ),
308  emit propertiesChanged();
309 }
310 
311 
313 {
314  d->setDatasetAttrs( dataset, qVariantFromValue( a ), DataValueLabelAttributesRole );
315  emit propertiesChanged();
316 }
317 
319 {
321 }
322 
324 {
325  /*
326  The following did not work!
327  (khz, 2008-01-25)
328  If there was some attrs specified for the 0-th cells of a dataset,
329  then this logic would return the cell's settings instead of the header settings:
330 
331  return qVariantValue<DataValueAttributes>(
332  attributesModel()->data( attributesModel()->mapFromSource(columnToIndex( column )),
333  KDChart::DataValueLabelAttributesRole ) );
334  */
335 
336  const QVariant headerAttrs(
337  d->datasetAttrs( dataset, KDChart::DataValueLabelAttributesRole ) );
338  if ( headerAttrs.isValid() )
339  return headerAttrs.value< DataValueAttributes >();
340  return dataValueAttributes();
341 }
342 
344 {
345  return attributesModel()->data(
346  conditionallyMapFromSource( index ),
348 }
349 
351 {
352  d->attributesModel->setModelData( qVariantFromValue( a ), DataValueLabelAttributesRole );
353  emit propertiesChanged();
354 }
355 
357 {
359  attrs.setShowOverlappingDataLabels( allow );
360  setDataValueAttributes( attrs );
361  d->allowOverlappingDataValueTexts = allow;
362  emit propertiesChanged();
363 }
364 
366 {
367  return d->allowOverlappingDataValueTexts;
368 }
369 
371 {
372  d->antiAliasing = enabled;
373  emit propertiesChanged();
374 }
375 
377 {
378  return d->antiAliasing;
379 }
380 
381 void AbstractDiagram::setPercentMode ( bool percent )
382 {
383  d->percent = percent;
384  emit propertiesChanged();
385 }
386 
388 {
389  return d->percent;
390 }
391 
392 
393 void AbstractDiagram::paintDataValueText( QPainter* painter,
394  const QModelIndex& index,
395  const QPointF& pos,
396  qreal value )
397 {
398  d->paintDataValueText( painter, index, pos, value );
399 }
400 
401 
402 void AbstractDiagram::paintDataValueTexts( QPainter* painter )
403 {
404  if ( !checkInvariants() ) {
405  return;
406  }
407 
408  d->forgetAlreadyPaintedDataValues();
409  const int rowCount = model()->rowCount( rootIndex() );
410  const int columnCount = model()->columnCount( rootIndex() );
411  for ( int column = 0; column < columnCount; column += datasetDimension() ) {
412  for ( int row = 0; row < rowCount; ++row ) {
413  QModelIndex index = model()->index( row, column, rootIndex() ); // checked
414  qreal x;
415  qreal y;
416  if ( datasetDimension() == 1 ) {
417  x = row;
418  y = index.data().toReal();
419  } else {
420  x = index.data().toReal();
421  y = model()->index( row, column + 1, rootIndex() ).data().toReal();
422  }
423  paintDataValueText( painter, index, coordinatePlane()->translate( QPointF( x, y ) ), y );
424  }
425  }
426 }
427 
428 
429 void AbstractDiagram::paintMarker( QPainter* painter,
430  const DataValueAttributes& a,
431  const QModelIndex& index,
432  const QPointF& pos )
433 {
434  if ( !checkInvariants() || !a.isVisible() ) return;
435  const MarkerAttributes ma = a.markerAttributes();
436  if ( !ma.isVisible() ) return;
437 
438  const PainterSaver painterSaver( painter );
439  // the size of the marker - unscaled
440  const QSizeF maSize( ma.markerSize().width() / painter->matrix().m11(),
441  ma.markerSize().height() / painter->matrix().m22() );
442  QBrush indexBrush( brush( index ) );
443  QPen indexPen( ma.pen() );
444  if ( ma.markerColor().isValid() )
445  indexBrush.setColor( ma.markerColor() );
446 
447  paintMarker( painter, ma, indexBrush, indexPen, pos, maSize );
448 
449  // workaround: BC cannot be changed, otherwise we would pass the
450  // index down to next-lower paintMarker function. So far, we
451  // basically save a circle of radius maSize at pos in the
452  // reverseMapper. This means that ^^^ this version of paintMarker
453  // needs to be called to reverse-map the marker.
454  d->reverseMapper.addCircle( index.row(), index.column(), pos, 2 * maSize );
455 }
456 
457 void AbstractDiagram::paintMarker( QPainter* painter,
458  const QModelIndex& index,
459  const QPointF& pos )
460 {
461  if ( !checkInvariants() ) return;
462  paintMarker( painter, dataValueAttributes( index ), index, pos );
463 }
464 
465 void AbstractDiagram::paintMarker( QPainter* painter,
466  const MarkerAttributes& markerAttributes,
467  const QBrush& brush,
468  const QPen& pen,
469  const QPointF& pos,
470  const QSizeF& maSize )
471 {
472  const QPen oldPen( painter->pen() );
473  // Pen is used to paint 4Pixels - 1 Pixel - Ring and FastCross types.
474  // make sure to use the brush color - see above in those cases.
475  const bool isFourPixels = (markerAttributes.markerStyle() == MarkerAttributes::Marker4Pixels);
476  if ( isFourPixels || (markerAttributes.markerStyle() == MarkerAttributes::Marker1Pixel) ) {
477  // for high-performance point charts with tiny point markers:
478  painter->setPen( PrintingParameters::scalePen( QPen( brush.color().light() ) ) );
479  if ( isFourPixels ) {
480  const qreal x = pos.x();
481  const qreal y = pos.y();
482  painter->drawLine( QPointF(x-1.0,y-1.0),
483  QPointF(x+1.0,y-1.0) );
484  painter->drawLine( QPointF(x-1.0,y),
485  QPointF(x+1.0,y) );
486  painter->drawLine( QPointF(x-1.0,y+1.0),
487  QPointF(x+1.0,y+1.0) );
488  }
489  painter->drawPoint( pos );
490  } else {
491  const PainterSaver painterSaver( painter );
492  QPen painterPen( pen );
493  painter->setPen( PrintingParameters::scalePen( painterPen ) );
494  painter->setBrush( brush );
495  painter->setRenderHint ( QPainter::Antialiasing );
496  painter->translate( pos );
497  switch ( markerAttributes.markerStyle() ) {
499  {
500  if ( markerAttributes.threeD() ) {
501  QRadialGradient grad;
502  grad.setCoordinateMode( QGradient::ObjectBoundingMode );
503  QColor drawColor = brush.color();
504  grad.setCenter( 0.5, 0.5 );
505  grad.setRadius( 1.0 );
506  grad.setFocalPoint( 0.35, 0.35 );
507  grad.setColorAt( 0.00, drawColor.lighter( 150 ) );
508  grad.setColorAt( 0.20, drawColor );
509  grad.setColorAt( 0.50, drawColor.darker( 150 ) );
510  grad.setColorAt( 0.75, drawColor.darker( 200 ) );
511  grad.setColorAt( 0.95, drawColor.darker( 250 ) );
512  grad.setColorAt( 1.00, drawColor.darker( 200 ) );
513  QBrush newBrush( grad );
514  newBrush.setMatrix( brush.matrix() );
515  painter->setBrush( newBrush );
516  }
517  painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
518  maSize.height(), maSize.width()) );
519  }
520  break;
522  {
523  QRectF rect( 0 - maSize.width()/2, 0 - maSize.height()/2,
524  maSize.width(), maSize.height() );
525  painter->drawRect( rect );
526  break;
527  }
529  {
530  QVector <QPointF > diamondPoints;
531  QPointF top, left, bottom, right;
532  top = QPointF( 0, 0 - maSize.height()/2 );
533  left = QPointF( 0 - maSize.width()/2, 0 );
534  bottom = QPointF( 0, maSize.height()/2 );
535  right = QPointF( maSize.width()/2, 0 );
536  diamondPoints << top << left << bottom << right;
537  painter->drawPolygon( diamondPoints );
538  break;
539  }
540  // both handled on top of the method:
543  break;
545  {
546  painter->setBrush( Qt::NoBrush );
547  painter->setPen( PrintingParameters::scalePen( QPen( brush.color() ) ) );
548  painter->drawEllipse( QRectF( 0 - maSize.height()/2, 0 - maSize.width()/2,
549  maSize.height(), maSize.width()) );
550  break;
551  }
553  {
554  // Note: Markers can have outline,
555  // so just drawing two rects is NOT the solution here!
556  const qreal w02 = maSize.width() * 0.2;
557  const qreal w05 = maSize.width() * 0.5;
558  const qreal h02 = maSize.height()* 0.2;
559  const qreal h05 = maSize.height()* 0.5;
560  QVector <QPointF > crossPoints;
561  QPointF p[12];
562  p[ 0] = QPointF( -w02, -h05 );
563  p[ 1] = QPointF( w02, -h05 );
564  p[ 2] = QPointF( w02, -h02 );
565  p[ 3] = QPointF( w05, -h02 );
566  p[ 4] = QPointF( w05, h02 );
567  p[ 5] = QPointF( w02, h02 );
568  p[ 6] = QPointF( w02, h05 );
569  p[ 7] = QPointF( -w02, h05 );
570  p[ 8] = QPointF( -w02, h02 );
571  p[ 9] = QPointF( -w05, h02 );
572  p[10] = QPointF( -w05, -h02 );
573  p[11] = QPointF( -w02, -h02 );
574  for ( int i=0; i<12; ++i )
575  crossPoints << p[i];
576  crossPoints << p[0];
577  painter->drawPolygon( crossPoints );
578  break;
579  }
581  {
582  QPointF left, right, top, bottom;
583  left = QPointF( -maSize.width()/2, 0 );
584  right = QPointF( maSize.width()/2, 0 );
585  top = QPointF( 0, -maSize.height()/2 );
586  bottom= QPointF( 0, maSize.height()/2 );
587  painter->setPen( PrintingParameters::scalePen( QPen( brush.color() ) ) );
588  painter->drawLine( left, right );
589  painter->drawLine( top, bottom );
590  break;
591  }
593  break;
595  {
596  QPainterPath path = markerAttributes.customMarkerPath();
597  const QRectF pathBoundingRect = path.boundingRect();
598  const qreal xScaling = maSize.height() / pathBoundingRect.height();
599  const qreal yScaling = maSize.width() / pathBoundingRect.width();
600  const qreal scaling = qMin( xScaling, yScaling );
601  painter->scale( scaling, scaling );
602  painter->setPen( PrintingParameters::scalePen( QPen( brush.color() ) ) );
603  painter->drawPath(path);
604  break;
605  }
606  default:
607  Q_ASSERT_X ( false, "paintMarkers()",
608  "Type item does not match a defined Marker Type." );
609  }
610  }
611  painter->setPen( oldPen );
612 }
613 
614 void AbstractDiagram::paintMarkers( QPainter* painter )
615 {
616  if ( !checkInvariants() ) {
617  return;
618  }
619 
620  const int rowCount = model()->rowCount( rootIndex() );
621  const int columnCount = model()->columnCount( rootIndex() );
622  for ( int column = 0; column < columnCount; column += datasetDimension() ) {
623  for ( int row = 0; row < rowCount; ++row ) {
624  QModelIndex index = model()->index( row, column, rootIndex() ); // checked
625  qreal x;
626  qreal y;
627  if ( datasetDimension() == 1 ) {
628  x = row;
629  y = index.data().toReal();
630  } else {
631  x = index.data().toReal();
632  y = model()->index( row, column + 1, rootIndex() ).data().toReal();
633  }
634  paintMarker( painter, index, coordinatePlane()->translate( QPointF( x, y ) ) );
635  }
636  }
637 }
638 
639 
640 void AbstractDiagram::setPen( const QModelIndex& index, const QPen& pen )
641 {
643  conditionallyMapFromSource( index ),
644  qVariantFromValue( pen ), DatasetPenRole );
645  emit propertiesChanged();
646 }
647 
648 void AbstractDiagram::setPen( const QPen& pen )
649 {
651  qVariantFromValue( pen ), DatasetPenRole );
652  emit propertiesChanged();
653 }
654 
655 void AbstractDiagram::setPen( int dataset, const QPen& pen )
656 {
657  d->setDatasetAttrs( dataset, qVariantFromValue( pen ), DatasetPenRole );
658  emit propertiesChanged();
659 }
660 
662 {
663  return attributesModel()->data( DatasetPenRole ).value< QPen >();
664 }
665 
666 QPen AbstractDiagram::pen( int dataset ) const
667 {
668  const QVariant penSettings( d->datasetAttrs( dataset, DatasetPenRole ) );
669  if ( penSettings.isValid() )
670  return penSettings.value< QPen >();
671  return pen();
672 }
673 
674 QPen AbstractDiagram::pen( const QModelIndex& index ) const
675 {
676  return attributesModel()->data(
677  conditionallyMapFromSource( index ),
678  DatasetPenRole ).value< QPen >();
679 }
680 
681 void AbstractDiagram::setBrush( const QModelIndex& index, const QBrush& brush )
682 {
684  conditionallyMapFromSource( index ),
685  qVariantFromValue( brush ), DatasetBrushRole );
686  emit propertiesChanged();
687 }
688 
689 void AbstractDiagram::setBrush( const QBrush& brush )
690 {
692  qVariantFromValue( brush ), DatasetBrushRole );
693  emit propertiesChanged();
694 }
695 
696 void AbstractDiagram::setBrush( int dataset, const QBrush& brush )
697 {
698  d->setDatasetAttrs( dataset, qVariantFromValue( brush ), DatasetBrushRole );
699  emit propertiesChanged();
700 }
701 
703 {
704  return attributesModel()->data( DatasetBrushRole ).value< QBrush >();
705 }
706 
707 QBrush AbstractDiagram::brush( int dataset ) const
708 {
709  const QVariant brushSettings( d->datasetAttrs( dataset, DatasetBrushRole ) );
710  if ( brushSettings.isValid() )
711  return brushSettings.value< QBrush >();
712  return brush();
713 }
714 
715 QBrush AbstractDiagram::brush( const QModelIndex& index ) const
716 {
717  return
718  attributesModel()->data( conditionallyMapFromSource( index ), DatasetBrushRole ).value< QBrush >();
719 }
720 
727 void AbstractDiagram::setUnitPrefix( const QString& prefix, int column, Qt::Orientation orientation )
728 {
729  d->unitPrefixMap[ column ][ orientation ]= prefix;
730 }
731 
737 void AbstractDiagram::setUnitPrefix( const QString& prefix, Qt::Orientation orientation )
738 {
739  d->unitPrefix[ orientation ] = prefix;
740 }
741 
748 void AbstractDiagram::setUnitSuffix( const QString& suffix, int column, Qt::Orientation orientation )
749 {
750  d->unitSuffixMap[ column ][ orientation ]= suffix;
751 }
752 
758 void AbstractDiagram::setUnitSuffix( const QString& suffix, Qt::Orientation orientation )
759 {
760  d->unitSuffix[ orientation ] = suffix;
761 }
762 
770 QString AbstractDiagram::unitPrefix( int column, Qt::Orientation orientation, bool fallback ) const
771 {
772  if ( !fallback || d->unitPrefixMap[ column ].contains( orientation ) )
773  return d->unitPrefixMap[ column ][ orientation ];
774  return d->unitPrefix[ orientation ];
775 }
776 
781 QString AbstractDiagram::unitPrefix( Qt::Orientation orientation ) const
782 {
783  return d->unitPrefix[ orientation ];
784 }
785 
793 QString AbstractDiagram::unitSuffix( int column, Qt::Orientation orientation, bool fallback ) const
794 {
795  if ( !fallback || d->unitSuffixMap[ column ].contains( orientation ) )
796  return d->unitSuffixMap[ column ][ orientation ];
797  return d->unitSuffix[ orientation ];
798 }
799 
804 QString AbstractDiagram::unitSuffix( Qt::Orientation orientation ) const
805 {
806  return d->unitSuffix[ orientation ];
807 }
808 
809 // implement QAbstractItemView:
810 QRect AbstractDiagram::visualRect( const QModelIndex &index ) const
811 {
812  return d->reverseMapper.boundingRect( index.row(), index.column() ).toRect();
813 }
814 
815 void AbstractDiagram::scrollTo(const QModelIndex &, ScrollHint )
816 {}
817 
818 // indexAt ... down below
819 
820 QModelIndex AbstractDiagram::moveCursor(CursorAction, Qt::KeyboardModifiers )
821 { return QModelIndex(); }
822 
824 { return 0; }
825 
827 { return 0; }
828 
829 bool AbstractDiagram::isIndexHidden(const QModelIndex &) const
830 { return true; }
831 
832 void AbstractDiagram::setSelection(const QRect& rect , QItemSelectionModel::SelectionFlags command )
833 {
834  const QModelIndexList indexes = d->indexesIn( rect );
835  QItemSelection selection;
836  KDAB_FOREACH( const QModelIndex& index, indexes )
837  {
838  selection.append( QItemSelectionRange( index ) );
839  }
840  selectionModel()->select( selection, command );
841 }
842 
843 QRegion AbstractDiagram::visualRegionForSelection(const QItemSelection &selection) const
844 {
845  QPolygonF polygon;
846  KDAB_FOREACH( const QModelIndex& index, selection.indexes() )
847  {
848  polygon << d->reverseMapper.polygon(index.row(), index.column());
849  }
850  return polygon.isEmpty() ? QRegion() : QRegion( polygon.toPolygon() );
851 }
852 
853 QRegion AbstractDiagram::visualRegion(const QModelIndex &index) const
854 {
855  QPolygonF polygon = d->reverseMapper.polygon(index.row(), index.column());
856  return polygon.isEmpty() ? QRegion() : QRegion( polygon.toPolygon() );
857 }
858 
860 {
861  d->attributesModel->setPaletteType( AttributesModel::PaletteTypeDefault );
862 }
863 
865 {
866  d->attributesModel->setPaletteType( AttributesModel::PaletteTypeSubdued );
867 }
868 
870 {
871  d->attributesModel->setPaletteType( AttributesModel::PaletteTypeRainbow );
872 }
873 
875 {
876  QStringList ret;
877  if ( model() ) {
878  //qDebug() << "AbstractDiagram::itemRowLabels(): " << attributesModel()->rowCount(attributesModelRootIndex()) << "entries";
879  const int rowCount = attributesModel()->rowCount(attributesModelRootIndex());
880  for ( int i = 0; i < rowCount; ++i ) {
881  //qDebug() << "item row label: " << attributesModel()->headerData( i, Qt::Vertical, Qt::DisplayRole ).toString();
882  ret << unitPrefix( i, Qt::Horizontal, true ) +
883  attributesModel()->headerData( i, Qt::Vertical, Qt::DisplayRole ).toString() +
884  unitSuffix( i, Qt::Horizontal, true );
885  }
886  }
887  return ret;
888 }
889 
891 {
892  QStringList ret;
893  if ( !model() ) {
894  return ret;
895  }
896  const int datasetCount = d->datasetCount();
897  for ( int i = 0; i < datasetCount; ++i ) {
898  ret << d->datasetAttrs( i, Qt::DisplayRole ).toString();
899  }
900  return ret;
901 }
902 
904 {
905  QList<QBrush> ret;
906  if ( !model() ) {
907  return ret;
908  }
909  const int datasetCount = d->datasetCount();
910  for ( int i = 0; i < datasetCount; ++i ) {
911  ret << brush( i );
912  }
913  return ret;
914 }
915 
917 {
918  QList<QPen> ret;
919  if ( !model() ) {
920  return ret;
921  }
922  const int datasetCount = d->datasetCount();
923  for ( int i = 0; i < datasetCount; ++i ) {
924  ret << pen( i );
925  }
926  return ret;
927 }
928 
930 {
932  if ( !model() ) {
933  return ret;
934  }
935  const int datasetCount = d->datasetCount();
936  for ( int i = 0; i < datasetCount; ++i ) {
938  }
939  return ret;
940 }
941 
942 bool AbstractDiagram::checkInvariants( bool justReturnTheStatus ) const
943 {
944  if ( ! justReturnTheStatus ) {
945  Q_ASSERT_X ( model(), "AbstractDiagram::checkInvariants()",
946  "There is no usable model set, for the diagram." );
947 
948  Q_ASSERT_X ( coordinatePlane(), "AbstractDiagram::checkInvariants()",
949  "There is no usable coordinate plane set, for the diagram." );
950  }
951  return model() && coordinatePlane();
952 }
953 
955 {
956  return d->datasetDimension;
957 }
958 
960 {
961  Q_UNUSED( dimension );
962  qDebug() << "Setting the dataset dimension using AbstractDiagram::setDatasetDimension is "
963  "obsolete. Use the specific diagram types instead.";
964 }
965 
967 {
968  Q_ASSERT( dimension != 0 );
969  if ( d->datasetDimension == dimension ) {
970  return;
971  }
972  d->datasetDimension = dimension;
973  d->attributesModel->setDatasetDimension( dimension );
975  emit layoutChanged( this );
976 }
977 
978 qreal AbstractDiagram::valueForCell( int row, int column ) const
979 {
980  if ( !d->attributesModel->hasIndex( row, column, attributesModelRootIndex() ) ) {
981  qWarning() << "AbstractDiagram::valueForCell(): Requesting value for invalid index!";
982  return std::numeric_limits<qreal>::quiet_NaN();
983  }
984  return d->attributesModel->data(
985  d->attributesModel->index( row, column, attributesModelRootIndex() ) ).toReal(); // checked
986 }
987 
989 {
990  if ( d->plane ) {
991  d->plane->update();
992  }
993 }
994 
995 QModelIndex AbstractDiagram::indexAt( const QPoint& point ) const
996 {
997  return d->indexAt( point );
998 }
999 
1000 QModelIndexList AbstractDiagram::indexesAt( const QPoint& point ) const
1001 {
1002  return d->indexesAt( point );
1003 }
1004 
1005 QModelIndexList AbstractDiagram::indexesIn( const QRect& rect ) const
1006 {
1007  return d->indexesIn( rect );
1008 }
KDChart::AbstractDiagram::itemRowLabels
QStringList itemRowLabels() const
The set of item row labels currently displayed, for use in Abscissa axes, etc.
Definition: KDChartAbstractDiagram.cpp:874
KDChart::AbstractDiagram::datasetDimension
int datasetDimension() const
The dataset dimension of a diagram determines how many value dimensions it expects each datapoint to ...
Definition: KDChartAbstractDiagram.cpp:954
KDChart::MarkerAttributes::MarkerRing
@ MarkerRing
Definition: KDChartMarkerAttributes.h:57
KDChart::AbstractDiagram::setUnitSuffix
void setUnitSuffix(const QString &suffix, int column, Qt::Orientation orientation)
Set the unit prefix to be used on axes for one specific column.
Definition: KDChartAbstractDiagram.cpp:748
KDChart::AbstractDiagram::moveCursor
QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override
[reimplemented]
Definition: KDChartAbstractDiagram.cpp:820
QWidget
Class only listed here to document inheritance of some KDChart classes.
translate
QPointF translate(const TernaryPoint &point)
Definition: TernaryPoint.cpp:86
KDChart::AbstractDiagram::paintDataValueText
void paintDataValueText(QPainter *painter, const QModelIndex &index, const QPointF &pos, qreal value)
Definition: KDChartAbstractDiagram.cpp:393
KDChart::AbstractDiagram::paintMarkers
virtual void paintMarkers(QPainter *painter)
Definition: KDChartAbstractDiagram.cpp:614
KDChart::AbstractDiagram::setSelection
void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) override
[reimplemented]
Definition: KDChartAbstractDiagram.cpp:832
KDChart::MarkerAttributes
A set of attributes controlling the appearance of data set markers.
Definition: KDChartMarkerAttributes.h:44
KDChart::MarkerAttributes::customMarkerPath
QPainterPath customMarkerPath() const
Definition: KDChartMarkerAttributes.cpp:177
KDChart::MarkerAttributes::NoMarker
@ NoMarker
Definition: KDChartMarkerAttributes.h:60
KDChart::AbstractDiagram::datasetPens
QList< QPen > datasetPens() const
The set of dataset pens currently used, for use in legends, etc.
Definition: KDChartAbstractDiagram.cpp:916
KDChart::AbstractDiagram::horizontalOffset
int horizontalOffset() const override
[reimplemented]
Definition: KDChartAbstractDiagram.cpp:823
QList
Definition: KDChartPosition.h:36
KDChart::AbstractDiagram::setRootIndex
void setRootIndex(const QModelIndex &idx) override
Set the root index in the model, where the diagram starts referencing data for display.
Definition: KDChartAbstractDiagram.cpp:208
KDChart::AbstractDiagram::useSubduedColors
void useSubduedColors()
Set the palette to be used, for painting datasets to the subdued palette.
Definition: KDChartAbstractDiagram.cpp:864
KDChartAbstractThreeDAttributes.h
KDChart::AbstractDiagram::coordinatePlane
AbstractCoordinatePlane * coordinatePlane() const
The coordinate plane associated with the diagram.
Definition: KDChartAbstractDiagram.cpp:111
KDChart::AbstractProxyModel::mapFromSource
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override
Definition: KDChartAbstractProxyModel.cpp:55
KDChart::AbstractDiagram::dataBoundaries
const QPair< QPointF, QPointF > dataBoundaries() const
Return the bottom left and top right data point, that the diagram will display (unless the grid adjus...
Definition: KDChartAbstractDiagram.cpp:116
KDChart::AbstractDiagram::dataChanged
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles=QVector< int >()) override
[reimplemented]
Definition: KDChartAbstractDiagram.cpp:245
KDChart::AbstractDiagram::setBrush
void setBrush(const QModelIndex &index, const QBrush &brush)
Set the brush to be used, for painting the datapoint at the given index.
Definition: KDChartAbstractDiagram.cpp:681
KDChart::MarkerAttributes::markerSize
QSizeF markerSize() const
Definition: KDChartMarkerAttributes.cpp:157
KDChart::MarkerAttributes::Marker1Pixel
@ Marker1Pixel
Definition: KDChartMarkerAttributes.h:55
KDChart::AbstractDiagram::scrollTo
void scrollTo(const QModelIndex &index, ScrollHint hint=EnsureVisible) override
[reimplemented]
Definition: KDChartAbstractDiagram.cpp:815
KDChart::AttributesModel::PaletteTypeRainbow
@ PaletteTypeRainbow
Definition: KDChartAttributesModel.h:53
KDChart::AbstractDiagram::~AbstractDiagram
~AbstractDiagram() override
Definition: KDChartAbstractDiagram.cpp:56
KDChart::AbstractDiagram::layoutChanged
void layoutChanged(AbstractDiagram *)
Diagrams are supposed to emit this signal, when the layout of one of their element changes.
KDChart::DataValueLabelAttributesRole
@ DataValueLabelAttributesRole
Definition: KDChartGlobal.h:192
KDChart::AbstractDiagram::usesExternalAttributesModel
virtual bool usesExternalAttributesModel() const
Returns whether the diagram is using its own built-in attributes model or an attributes model that wa...
Definition: KDChartAbstractDiagram.cpp:191
KDChart::DataValueAttributes::markerAttributes
MarkerAttributes markerAttributes() const
Definition: KDChartDataValueAttributes.cpp:204
KDChart::MarkerAttributes::MarkerCircle
@ MarkerCircle
Definition: KDChartMarkerAttributes.h:52
KDChart::MarkerAttributes::PainterPathMarker
@ PainterPathMarker
Definition: KDChartMarkerAttributes.h:61
KDChart::PrintingParameters::scalePen
static QPen scalePen(const QPen &pen)
Definition: KDChartPrintingParameters.cpp:48
KDChart::AbstractDiagram::datasetBrushes
QList< QBrush > datasetBrushes() const
The set of dataset brushes currently used, for use in legends, etc.
Definition: KDChartAbstractDiagram.cpp:903
KDChart::AbstractDiagram::pen
QPen pen() const
Retrieve the pen to be used for painting datapoints globally.
Definition: KDChartAbstractDiagram.cpp:661
KDChart::AbstractDiagram::setAntiAliasing
void setAntiAliasing(bool enabled)
Set whether anti-aliasing is to be used while rendering this diagram.
Definition: KDChartAbstractDiagram.cpp:370
KDChart::AbstractDiagram::dataHidden
void dataHidden()
This signal is emitted, when the hidden status of at least one data cell was (un)set.
KDChart::DatasetPenRole
@ DatasetPenRole
Definition: KDChartGlobal.h:190
KDChart::AbstractDiagram::update
void update() const
Definition: KDChartAbstractDiagram.cpp:988
KDChart
Definition: KDChartAbstractCartesianDiagram.h:30
KDChart::AbstractDiagram::valueForCell
qreal valueForCell(int row, int column) const
Helper method, retrieving the data value (DisplayRole) for a given row and column.
Definition: KDChartAbstractDiagram.cpp:978
KDChart::MarkerAttributes::MarkerFastCross
@ MarkerFastCross
Definition: KDChartMarkerAttributes.h:59
KDChart::AbstractDiagram::setAllowOverlappingDataValueTexts
void setAllowOverlappingDataValueTexts(bool allow)
Set whether data value labels are allowed to overlap.
Definition: KDChartAbstractDiagram.cpp:356
KDChart::DataValueAttributes::setShowOverlappingDataLabels
void setShowOverlappingDataLabels(bool showOverlappingDataLabels)
Set whether data value texts overlapping other data value texts of the same diagram should be drawn.
Definition: KDChartDataValueAttributes.cpp:284
KDChart::AbstractDiagram::setDatasetDimension
void setDatasetDimension(int dimension)
Definition: KDChartAbstractDiagram.cpp:959
KDChart::AttributesModel::rowCount
int rowCount(const QModelIndex &) const override
[reimplemented]
Definition: KDChartAttributesModel.cpp:501
KDChart::AbstractDiagram::doItemsLayout
void doItemsLayout() override
[reimplemented]
Definition: KDChartAbstractDiagram.cpp:236
KDChart::AttributesModel::PaletteTypeSubdued
@ PaletteTypeSubdued
Definition: KDChartAttributesModel.h:54
KDChart::AbstractDiagram::paintDataValueTexts
virtual void paintDataValueTexts(QPainter *painter)
Definition: KDChartAbstractDiagram.cpp:402
KDChart::MarkerAttributes::threeD
bool threeD() const
Definition: KDChartMarkerAttributes.cpp:127
KDChart::AbstractDiagram::setDataBoundariesDirty
void setDataBoundariesDirty() const
Definition: KDChartAbstractDiagram.cpp:125
KDChart::DatasetBrushRole
@ DatasetBrushRole
Definition: KDChartGlobal.h:191
KDChart::AbstractDiagram::isHidden
bool isHidden() const
Retrieve the hidden status specified globally.
Definition: KDChartAbstractDiagram.cpp:278
KDChart::AbstractDiagram::setDatasetDimensionInternal
void setDatasetDimensionInternal(int dimension)
Definition: KDChartAbstractDiagram.cpp:966
KDChart::AbstractDiagram::calculateDataBoundaries
virtual const QPair< QPointF, QPointF > calculateDataBoundaries() const =0
KDChart::AbstractDiagram::compare
bool compare(const AbstractDiagram *other) const
Returns true if both diagrams have the same settings.
Definition: KDChartAbstractDiagram.cpp:69
KDChart::AttributesModel::headerData
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
[reimplemented]
Definition: KDChartAttributesModel.cpp:247
KDChart::AbstractDiagram::setUnitPrefix
void setUnitPrefix(const QString &prefix, int column, Qt::Orientation orientation)
Set the unit prefix to be used on axes for one specific column.
Definition: KDChartAbstractDiagram.cpp:727
KDChart::AttributesModel::modelData
QVariant modelData(int role) const
Definition: KDChartAttributesModel.cpp:496
KDChart::AbstractDiagram::useRainbowColors
void useRainbowColors()
Set the palette to be used, for painting datasets to the rainbow palette.
Definition: KDChartAbstractDiagram.cpp:869
KDChart::AbstractDiagram::antiAliasing
bool antiAliasing() const
Definition: KDChartAbstractDiagram.cpp:376
KDChart::AbstractDiagram::AbstractDiagram
AbstractDiagram(Private *p, QWidget *parent, AbstractCoordinatePlane *plane)
KDChart::AttributesModel::PaletteTypeDefault
@ PaletteTypeDefault
Definition: KDChartAttributesModel.h:52
KDChart::AttributesModel::setModelData
bool setModelData(const QVariant value, int role)
Definition: KDChartAttributesModel.cpp:482
KDChart::MarkerAttributes::isVisible
bool isVisible() const
Definition: KDChartMarkerAttributes.cpp:117
KDChart::AbstractDiagram::setPercentMode
void setPercentMode(bool percent)
Deprecated method that turns the percent mode of this diagram on or off.
Definition: KDChartAbstractDiagram.cpp:381
KDChart::AbstractDiagram::datasetMarkers
QList< MarkerAttributes > datasetMarkers() const
The set of dataset markers currently used, for use in legends, etc.
Definition: KDChartAbstractDiagram.cpp:929
KDChartMarkerAttributes.h
KDChart::AbstractDiagram::paintMarker
virtual void paintMarker(QPainter *painter, const MarkerAttributes &markerAttributes, const QBrush &brush, const QPen &, const QPointF &point, const QSizeF &size)
Definition: KDChartAbstractDiagram.cpp:465
KDChart::AbstractDiagram::setDataValueAttributes
void setDataValueAttributes(const QModelIndex &index, const DataValueAttributes &a)
Set the DataValueAttributes for the given index.
Definition: KDChartAbstractDiagram.cpp:303
KDChart::AbstractDiagram::visualRect
QRect visualRect(const QModelIndex &index) const override
[reimplemented]
Definition: KDChartAbstractDiagram.cpp:810
KDChartAbstractDiagram.h
KDChart::AbstractDiagram::verticalOffset
int verticalOffset() const override
[reimplemented]
Definition: KDChartAbstractDiagram.cpp:826
QAbstractItemView
Class only listed here to document inheritance of some KDChart classes.
KDChart::MarkerAttributes::MarkerDiamond
@ MarkerDiamond
Definition: KDChartMarkerAttributes.h:54
KDChart::AttributesModel
A proxy model used for decorating data with attributes.
Definition: KDChartAttributesModel.h:47
KDChart::AbstractDiagram::attributesModel
virtual AttributesModel * attributesModel() const
Returns the AttributesModel, that is used by this diagram.
Definition: KDChartAbstractDiagram.cpp:196
KDChart::AbstractDiagram::setModel
void setModel(QAbstractItemModel *model) override
Associate a model with the diagram.
Definition: KDChartAbstractDiagram.cpp:131
KDChart::AbstractDiagram::unitSuffix
QString unitSuffix(int column, Qt::Orientation orientation, bool fallback=false) const
Retrieves the axis unit suffix for a specific column.
Definition: KDChartAbstractDiagram.cpp:793
KDChartThreeDLineAttributes.h
KDChart::AbstractDiagram::allowOverlappingDataValueTexts
bool allowOverlappingDataValueTexts() const
Definition: KDChartAbstractDiagram.cpp:365
d
#define d
Definition: KDChartAbstractDiagram.cpp:47
KDChart::AbstractDiagram::setHidden
void setHidden(const QModelIndex &index, bool hidden)
Hide (or unhide, resp.) a data cell.
Definition: KDChartAbstractDiagram.cpp:257
KDChart::AbstractDiagram
AbstractDiagram defines the interface for diagram classes.
Definition: KDChartAbstractDiagram.h:51
KDChart::AbstractDiagram::dataValueAttributes
DataValueAttributes dataValueAttributes() const
Retrieve the DataValueAttributes specified globally.
Definition: KDChartAbstractDiagram.cpp:318
KDChart::MarkerAttributes::markerColor
QColor markerColor() const
Definition: KDChartMarkerAttributes.cpp:167
KDChart::AbstractDiagram::indexAt
QModelIndex indexAt(const QPoint &point) const override
[reimplemented]
Definition: KDChartAbstractDiagram.cpp:995
KDChart::AbstractDiagram::visualRegionForSelection
QRegion visualRegionForSelection(const QItemSelection &selection) const override
[reimplemented]
Definition: KDChartAbstractDiagram.cpp:843
KDChart::AbstractDiagram::setPen
void setPen(const QModelIndex &index, const QPen &pen)
Set the pen to be used, for painting the datapoint at the given index.
Definition: KDChartAbstractDiagram.cpp:640
KDChart::AttributesModel::data
QVariant data(int role) const
Returns the data that were specified at global level, or the default data, or QVariant().
Definition: KDChartAttributesModel.cpp:299
KDChart::DataHiddenRole
@ DataHiddenRole
Definition: KDChartGlobal.h:201
KDChart::AbstractDiagram::percentMode
bool percentMode() const
Returns whether this diagram is drawn in percent mode.
Definition: KDChartAbstractDiagram.cpp:387
KDChart::AbstractDiagram::setAttributesModel
virtual void setAttributesModel(AttributesModel *model)
Associate an AttributesModel with this diagram.
Definition: KDChartAbstractDiagram.cpp:171
KDChart::AbstractDiagram::aboutToBeDestroyed
void aboutToBeDestroyed()
This signal is emitted when this diagram is being destroyed, but before all the data,...
KDChartDataValueAttributes.h
Declaring the class KDChart::DataValueAttributes.
KDChart::AbstractDiagram::setAttributesModelRootIndex
void setAttributesModelRootIndex(const QModelIndex &)
Definition: KDChartAbstractDiagram.cpp:215
KDChartTextAttributes.h
KDChartChart.h
KDChart::AbstractDiagram::attributesModelRootIndex
QModelIndex attributesModelRootIndex() const
Definition: KDChartAbstractDiagram.cpp:224
KDChart::AbstractDiagram::unitPrefix
QString unitPrefix(int column, Qt::Orientation orientation, bool fallback=false) const
Retrieves the axis unit prefix for a specific column.
Definition: KDChartAbstractDiagram.cpp:770
QPair
Definition: KDChartWidget.h:35
KDChartAbstractCoordinatePlane.h
KDChart::AbstractDiagram::visualRegion
virtual QRegion visualRegion(const QModelIndex &index) const
Definition: KDChartAbstractDiagram.cpp:853
KDChart::DataValueAttributes::isVisible
bool isVisible() const
Definition: KDChartDataValueAttributes.cpp:164
KDChart::AbstractDiagram::modelsChanged
void modelsChanged()
This signal is emitted when either the model or the AttributesModel is replaced.
KDChart::AttributesModel::initFrom
void initFrom(const AttributesModel *other)
Copies the internal data (maps and palette) of another AttributesModel* into this one.
Definition: KDChartAttributesModel.cpp:92
KDChart::DataValueAttributes
Diagram attributes dealing with data value labels.
Definition: KDChartDataValueAttributes.h:56
KDChart::AbstractDiagram::propertiesChanged
void propertiesChanged()
Emitted upon change of a property of the Diagram.
QVector< int >
KDChart::MarkerAttributes::Marker4Pixels
@ Marker4Pixels
Definition: KDChartMarkerAttributes.h:56
KDChart::AttributesModel::compare
bool compare(const AttributesModel *other) const
Returns true if both, all of the attributes set, and the palette set is equal in both of the Attribut...
Definition: KDChartAttributesModel.cpp:123
KDChart::AbstractDiagram::indexesAt
QModelIndexList indexesAt(const QPoint &point) const
This method is added alongside with indexAt from QAIM, since in kdchart multiple indexes can be displ...
Definition: KDChartAbstractDiagram.cpp:1000
KDChart::AttributesModel::setData
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::DisplayRole) override
[reimplemented]
Definition: KDChartAttributesModel.cpp:397
KDChart::MarkerAttributes::markerStyle
uint markerStyle() const
Definition: KDChartMarkerAttributes.cpp:147
KDChart::MarkerAttributes::MarkerCross
@ MarkerCross
Definition: KDChartMarkerAttributes.h:58
KDChart::AbstractDiagram::indexesIn
QModelIndexList indexesIn(const QRect &rect) const
Definition: KDChartAbstractDiagram.cpp:1005
KDChart::MarkerAttributes::pen
QPen pen() const
Definition: KDChartMarkerAttributes.cpp:187
KDChart::AbstractDiagram::checkInvariants
virtual bool checkInvariants(bool justReturnTheStatus=false) const
Definition: KDChartAbstractDiagram.cpp:942
KDChart::PrivateAttributesModel
Internally used class just adding a special constructor used by AbstractDiagram.
Definition: KDChartAbstractDiagram.h:730
KDChart::AbstractDiagram::setCoordinatePlane
virtual void setCoordinatePlane(AbstractCoordinatePlane *plane)
Set the coordinate plane associated with the diagram.
Definition: KDChartAbstractDiagram.cpp:231
KDChart::MarkerAttributes::MarkerSquare
@ MarkerSquare
Definition: KDChartMarkerAttributes.h:53
KDChart::AbstractDiagram::datasetLabels
QStringList datasetLabels() const
The set of dataset labels currently displayed, for use in legends, etc.
Definition: KDChartAbstractDiagram.cpp:890
KDChart::AbstractDiagram::isIndexHidden
bool isIndexHidden(const QModelIndex &index) const override
[reimplemented]
Definition: KDChartAbstractDiagram.cpp:829
KDChart::AbstractDiagram::useDefaultColors
void useDefaultColors()
Set the palette to be used, for painting datasets to the default palette.
Definition: KDChartAbstractDiagram.cpp:859
KDChart::AbstractDiagram::brush
QBrush brush() const
Retrieve the brush to be used for painting datapoints globally.
Definition: KDChartAbstractDiagram.cpp:702
KDChart::AbstractCoordinatePlane
Base class common for all coordinate planes, CartesianCoordinatePlane, PolarCoordinatePlane,...
Definition: KDChartAbstractCoordinatePlane.h:45
KDChart::AbstractDiagram::setSelectionModel
void setSelectionModel(QItemSelectionModel *selectionModel) override
Associate a seleection model with the diagrom.
Definition: KDChartAbstractDiagram.cpp:148

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/