KD Chart API Documentation 3.1
Loading...
Searching...
No Matches
KDChartAbstractDiagram.cpp
Go to the documentation of this file.
1/****************************************************************************
2**
3** This file is part of the KD Chart library.
4**
5** SPDX-FileCopyrightText: 2001 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6**
7** SPDX-License-Identifier: MIT
8**
9****************************************************************************/
10
12#include "KDChartAbstractDiagram_p.h"
13
14#include <QAbstractProxyModel>
15#include <QApplication>
16#include <QDebug>
17#include <QPainter>
18#include <QSizeF>
19
22#include "KDChartChart.h"
25#include "KDChartPainterSaver_p.h"
28
29#include <KDABLibFakes>
30
31#include <limits>
32
33using namespace KDChart;
34
35#define d d_func()
36
38 : QAbstractItemView(parent)
39 , _d(new Private())
40{
41 _d->init(plane);
42 init();
43}
44
50
51void AbstractDiagram::init()
52{
53 _d->diagram = this;
54 d->reverseMapper.setDiagram(this);
55}
56
58{
59 if (other == this)
60 return true;
61 if (!other) {
62 return false;
63 }
64 return // compare QAbstractScrollArea properties
65 (horizontalScrollBarPolicy() == other->horizontalScrollBarPolicy()) && (verticalScrollBarPolicy() == other->verticalScrollBarPolicy()) &&
66 // compare QFrame properties
67 (frameShadow() == other->frameShadow()) && (frameShape() == other->frameShape()) &&
68 // frameWidth is a read-only property defined by the style, it should not be in here:
69 // (frameWidth() == other->frameWidth()) &&
70 (lineWidth() == other->lineWidth()) && (midLineWidth() == other->midLineWidth()) &&
71 // compare QAbstractItemView properties
72 (alternatingRowColors() == other->alternatingRowColors()) && (hasAutoScroll() == other->hasAutoScroll()) && (dragDropMode() == other->dragDropMode()) && (dragDropOverwriteMode() == other->dragDropOverwriteMode()) && (horizontalScrollMode() == other->horizontalScrollMode()) && (verticalScrollMode() == other->verticalScrollMode()) && (dragEnabled() == other->dragEnabled()) && (editTriggers() == other->editTriggers()) && (iconSize() == other->iconSize()) && (selectionBehavior() == other->selectionBehavior()) && (selectionMode() == other->selectionMode()) && (showDropIndicator() == other->showDropIndicator()) && (tabKeyNavigation() == other->tabKeyNavigation()) && (textElideMode() == other->textElideMode()) &&
73 // compare all of the properties stored in the attributes model
74 attributesModel()->compare(other->attributesModel()) &&
75 // compare own properties
76 (rootIndex().column() == other->rootIndex().column()) && (rootIndex().row() == other->rootIndex().row()) && (allowOverlappingDataValueTexts() == other->allowOverlappingDataValueTexts()) && (antiAliasing() == other->antiAliasing()) && (percentMode() == other->percentMode()) && (datasetDimension() == other->datasetDimension());
77}
78
83
85{
86 if (d->databoundariesDirty) {
87 d->databoundaries = calculateDataBoundaries();
88 d->databoundariesDirty = false;
89 }
90 return d->databoundaries;
91}
92
94{
95 d->databoundariesDirty = true;
96 update();
97}
98
121
135
144{
145 if (amodel->sourceModel() != model()) {
146 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
147 "Trying to set an attributesmodel which works on a different "
148 "model than the diagram.");
149 return;
150 }
152 qWarning("KDChart::AbstractDiagram::setAttributesModel() failed: "
153 "Trying to set an attributesmodel that is private to another diagram.");
154 return;
155 }
156
157 d->setAttributesModel(amodel);
161}
162
164{
165 return d->usesExternalAttributesModel();
166}
167
169{
170 return d->attributesModel;
171}
172
173QModelIndex AbstractDiagram::conditionallyMapFromSource(const QModelIndex &index) const
174{
175 Q_ASSERT(!index.isValid() || index.model() == attributesModel() || index.model() == attributesModel()->sourceModel());
176 return index.model() == attributesModel() ? index : attributesModel()->mapFromSource(index);
177}
178
181{
183 setAttributesModelRootIndex(d->attributesModel->mapFromSource(idx));
184}
185
188{
189 d->attributesModelRootIndex = idx;
192}
193
197{
198 if (!d->attributesModelRootIndex.isValid())
199 d->attributesModelRootIndex = d->attributesModel->mapFromSource(rootIndex());
200 return d->attributesModelRootIndex;
201}
202
207
209{
210 if (d->plane) {
211 d->plane->layoutDiagrams();
212 update();
213 }
214 QAbstractItemView::doItemsLayout();
215}
216
218 const QModelIndex &bottomRight,
219 const QVector<int> &)
220{
221 Q_UNUSED(topLeft);
222 Q_UNUSED(bottomRight);
223 // We are still too dumb to do intelligent updates...
226}
227
228void AbstractDiagram::setHidden(const QModelIndex &index, bool hidden)
229{
230 d->attributesModel->setData(
231 conditionallyMapFromSource(index),
232 QVariant::fromValue(hidden),
235}
236
237void AbstractDiagram::setHidden(int dataset, bool hidden)
238{
239 d->setDatasetAttrs(dataset, QVariant::fromValue(hidden), DataHiddenRole);
241}
242
244{
245 d->attributesModel->setModelData(QVariant::fromValue(hidden), DataHiddenRole);
247}
248
250{
252}
253
254bool AbstractDiagram::isHidden(int dataset) const
255{
256 const QVariant boolFlag(d->datasetAttrs(dataset, DataHiddenRole));
257 if (boolFlag.isValid())
258 return boolFlag.value<bool>();
259 return isHidden();
260}
261
263{
264 const QVariant boolFlag(attributesModel()->data(conditionallyMapFromSource(index),
266 if (boolFlag.isValid()) {
267 return boolFlag.value<bool>();
268 }
269 int dataset = index.column() / d->datasetDimension;
270 return isHidden(dataset);
271}
272
274 const DataValueAttributes &a)
275{
276 d->attributesModel->setData(conditionallyMapFromSource(index), QVariant::fromValue(a),
279}
280
286
291
293{
294 /*
295 The following did not work!
296 (khz, 2008-01-25)
297 If there was some attrs specified for the 0-th cells of a dataset,
298 then this logic would return the cell's settings instead of the header settings:
299
300 return qVariantValue<DataValueAttributes>(
301 attributesModel()->data( attributesModel()->mapFromSource(columnToIndex( column )),
302 KDChart::DataValueLabelAttributesRole ) );
303 */
304
305 const QVariant headerAttrs(
307 if (headerAttrs.isValid())
308 return headerAttrs.value<DataValueAttributes>();
309 return dataValueAttributes();
310}
311
313{
314 return attributesModel()->data(
315 conditionallyMapFromSource(index),
318}
319
325
327{
329 attrs.setShowOverlappingDataLabels(allow);
331 d->allowOverlappingDataValueTexts = allow;
333}
334
336{
337 return d->allowOverlappingDataValueTexts;
338}
339
341{
342 d->antiAliasing = enabled;
344}
345
347{
348 return d->antiAliasing;
349}
350
352{
353 d->percent = percent;
355}
356
358{
359 return d->percent;
360}
361
363 const QModelIndex &index,
364 const QPointF &pos,
365 qreal value)
366{
367 d->paintDataValueText(painter, index, pos, value);
368}
369
371{
372 if (!checkInvariants()) {
373 return;
374 }
375
376 d->forgetAlreadyPaintedDataValues();
377 const int rowCount = model()->rowCount(rootIndex());
378 const int columnCount = model()->columnCount(rootIndex());
379 for (int column = 0; column < columnCount; column += datasetDimension()) {
380 for (int row = 0; row < rowCount; ++row) {
381 QModelIndex index = model()->index(row, column, rootIndex()); // checked
382 qreal x;
383 qreal y;
384 if (datasetDimension() == 1) {
385 x = row;
386 y = index.data().toReal();
387 } else {
388 x = index.data().toReal();
389 y = model()->index(row, column + 1, rootIndex()).data().toReal();
390 }
391 paintDataValueText(painter, index, coordinatePlane()->translate(QPointF(x, y)), y);
392 }
393 }
394}
395
397 const DataValueAttributes &a,
398 const QModelIndex &index,
399 const QPointF &pos)
400{
401 if (!checkInvariants() || !a.isVisible())
402 return;
404 if (!ma.isVisible())
405 return;
406
407 const PainterSaver painterSaver(painter);
408 // the size of the marker - unscaled
409 const QSizeF maSize(ma.markerSize().width() / painter->transform().m11(),
410 ma.markerSize().height() / painter->transform().m22());
411 QBrush indexBrush(brush(index));
412 QPen indexPen(ma.pen());
413 if (ma.markerColor().isValid())
414 indexBrush.setColor(ma.markerColor());
415
417
418 // workaround: BC cannot be changed, otherwise we would pass the
419 // index down to next-lower paintMarker function. So far, we
420 // basically save a circle of radius maSize at pos in the
421 // reverseMapper. This means that ^^^ this version of paintMarker
422 // needs to be called to reverse-map the marker.
423 d->reverseMapper.addCircle(index.row(), index.column(), pos, 2 * maSize);
424}
425
427 const QModelIndex &index,
428 const QPointF &pos)
429{
430 if (!checkInvariants())
431 return;
432 paintMarker(painter, dataValueAttributes(index), index, pos);
433}
434
436 const MarkerAttributes &markerAttributes,
437 const QBrush &brush,
438 const QPen &pen,
439 const QPointF &pos,
440 const QSizeF &maSize)
441{
442 const QPen oldPen(painter->pen());
443 // Pen is used to paint 4Pixels - 1 Pixel - Ring and FastCross types.
444 // make sure to use the brush color - see above in those cases.
445 const bool isFourPixels = (markerAttributes.markerStyle() == MarkerAttributes::Marker4Pixels);
446 if (isFourPixels || (markerAttributes.markerStyle() == MarkerAttributes::Marker1Pixel)) {
447 // for high-performance point charts with tiny point markers:
449 if (isFourPixels) {
450 const qreal x = pos.x();
451 const qreal y = pos.y();
452 painter->drawLine(QPointF(x - 1.0, y - 1.0),
453 QPointF(x + 1.0, y - 1.0));
454 painter->drawLine(QPointF(x - 1.0, y),
455 QPointF(x + 1.0, y));
456 painter->drawLine(QPointF(x - 1.0, y + 1.0),
457 QPointF(x + 1.0, y + 1.0));
458 }
459 painter->drawPoint(pos);
460 } else {
461 const PainterSaver painterSaver(painter);
464 painter->setBrush(brush);
466 painter->translate(pos);
467 switch (markerAttributes.markerStyle()) {
469 if (markerAttributes.threeD()) {
473 grad.setCenter(0.5, 0.5);
474 grad.setRadius(1.0);
475 grad.setFocalPoint(0.35, 0.35);
476 grad.setColorAt(0.00, drawColor.lighter(150));
477 grad.setColorAt(0.20, drawColor);
478 grad.setColorAt(0.50, drawColor.darker(150));
479 grad.setColorAt(0.75, drawColor.darker(200));
480 grad.setColorAt(0.95, drawColor.darker(250));
481 grad.setColorAt(1.00, drawColor.darker(200));
483 newBrush.setTransform(brush.transform());
484 painter->setBrush(newBrush);
485 }
486 painter->drawEllipse(QRectF(0 - maSize.height() / 2, 0 - maSize.width() / 2,
487 maSize.height(), maSize.width()));
488 } break;
490 QRectF rect(0 - maSize.width() / 2, 0 - maSize.height() / 2,
491 maSize.width(), maSize.height());
492 painter->drawRect(rect);
493 break;
494 }
497 QPointF top, left, bottom, right;
498 top = QPointF(0, 0 - maSize.height() / 2);
499 left = QPointF(0 - maSize.width() / 2, 0);
500 bottom = QPointF(0, maSize.height() / 2);
501 right = QPointF(maSize.width() / 2, 0);
502 diamondPoints << top << left << bottom << right;
503 painter->drawPolygon(diamondPoints);
504 break;
505 }
506 // both handled on top of the method:
509 break;
511 painter->setBrush(Qt::NoBrush);
513 painter->drawEllipse(QRectF(0 - maSize.height() / 2, 0 - maSize.width() / 2,
514 maSize.height(), maSize.width()));
515 break;
516 }
518 // Note: Markers can have outline,
519 // so just drawing two rects is NOT the solution here!
520 const qreal w02 = maSize.width() * 0.2;
521 const qreal w05 = maSize.width() * 0.5;
522 const qreal h02 = maSize.height() * 0.2;
523 const qreal h05 = maSize.height() * 0.5;
525 QPointF p[12];
526 p[0] = QPointF(-w02, -h05);
527 p[1] = QPointF(w02, -h05);
528 p[2] = QPointF(w02, -h02);
529 p[3] = QPointF(w05, -h02);
530 p[4] = QPointF(w05, h02);
531 p[5] = QPointF(w02, h02);
532 p[6] = QPointF(w02, h05);
533 p[7] = QPointF(-w02, h05);
534 p[8] = QPointF(-w02, h02);
535 p[9] = QPointF(-w05, h02);
536 p[10] = QPointF(-w05, -h02);
537 p[11] = QPointF(-w02, -h02);
538 for (int i = 0; i < 12; ++i)
539 crossPoints << p[i];
540 crossPoints << p[0];
541 painter->drawPolygon(crossPoints);
542 break;
543 }
545 QPointF left, right, top, bottom;
546 left = QPointF(-maSize.width() / 2, 0);
547 right = QPointF(maSize.width() / 2, 0);
548 top = QPointF(0, -maSize.height() / 2);
549 bottom = QPointF(0, maSize.height() / 2);
551 painter->drawLine(left, right);
552 painter->drawLine(top, bottom);
553 break;
554 }
556 break;
558 QPainterPath path = markerAttributes.customMarkerPath();
559 const QRectF pathBoundingRect = path.boundingRect();
560 const qreal xScaling = maSize.height() / pathBoundingRect.height();
561 const qreal yScaling = maSize.width() / pathBoundingRect.width();
563 painter->scale(scaling, scaling);
565 painter->drawPath(path);
566 break;
567 }
568 default:
569 Q_ASSERT_X(false, "paintMarkers()",
570 "Type item does not match a defined Marker Type.");
571 }
572 }
573 painter->setPen(oldPen);
574}
575
577{
578 if (!checkInvariants()) {
579 return;
580 }
581
582 const int rowCount = model()->rowCount(rootIndex());
583 const int columnCount = model()->columnCount(rootIndex());
584 for (int column = 0; column < columnCount; column += datasetDimension()) {
585 for (int row = 0; row < rowCount; ++row) {
586 QModelIndex index = model()->index(row, column, rootIndex()); // checked
587 qreal x;
588 qreal y;
589 if (datasetDimension() == 1) {
590 x = row;
591 y = index.data().toReal();
592 } else {
593 x = index.data().toReal();
594 y = model()->index(row, column + 1, rootIndex()).data().toReal();
595 }
596 paintMarker(painter, index, coordinatePlane()->translate(QPointF(x, y)));
597 }
598 }
599}
600
601void AbstractDiagram::setPen(const QModelIndex &index, const QPen &pen)
602{
604 conditionallyMapFromSource(index),
607}
608
615
616void AbstractDiagram::setPen(int dataset, const QPen &pen)
617{
618 d->setDatasetAttrs(dataset, QVariant::fromValue(pen), DatasetPenRole);
620}
621
626
627QPen AbstractDiagram::pen(int dataset) const
628{
629 const QVariant penSettings(d->datasetAttrs(dataset, DatasetPenRole));
630 if (penSettings.isValid())
631 return penSettings.value<QPen>();
632 return pen();
633}
634
636{
637 return attributesModel()->data(
638 conditionallyMapFromSource(index),
640 .value<QPen>();
641}
642
643void AbstractDiagram::setBrush(const QModelIndex &index, const QBrush &brush)
644{
646 conditionallyMapFromSource(index),
649}
650
657
658void AbstractDiagram::setBrush(int dataset, const QBrush &brush)
659{
662}
663
668
670{
671 const QVariant brushSettings(d->datasetAttrs(dataset, DatasetBrushRole));
672 if (brushSettings.isValid())
673 return brushSettings.value<QBrush>();
674 return brush();
675}
676
678{
679 return attributesModel()->data(conditionallyMapFromSource(index), DatasetBrushRole).value<QBrush>();
680}
681
688void AbstractDiagram::setUnitPrefix(const QString &prefix, int column, Qt::Orientation orientation)
689{
690 d->unitPrefixMap[column][orientation] = prefix;
691}
692
699{
700 d->unitPrefix[orientation] = prefix;
701}
702
709void AbstractDiagram::setUnitSuffix(const QString &suffix, int column, Qt::Orientation orientation)
710{
711 d->unitSuffixMap[column][orientation] = suffix;
712}
713
720{
721 d->unitSuffix[orientation] = suffix;
722}
723
731QString AbstractDiagram::unitPrefix(int column, Qt::Orientation orientation, bool fallback) const
732{
733 if (!fallback || d->unitPrefixMap[column].contains(orientation))
734 return d->unitPrefixMap[column][orientation];
735 return d->unitPrefix[orientation];
736}
737
743{
744 return d->unitPrefix[orientation];
745}
746
754QString AbstractDiagram::unitSuffix(int column, Qt::Orientation orientation, bool fallback) const
755{
756 if (!fallback || d->unitSuffixMap[column].contains(orientation))
757 return d->unitSuffixMap[column][orientation];
758 return d->unitSuffix[orientation];
759}
760
766{
767 return d->unitSuffix[orientation];
768}
769
770// implement QAbstractItemView:
772{
773 return d->reverseMapper.boundingRect(index.row(), index.column()).toRect();
774}
775
779
780// indexAt ... down below
781
786
788{
789 return 0;
790}
791
793{
794 return 0;
795}
796
798{
799 return true;
800}
801
803{
804 const QModelIndexList indexes = d->indexesIn(rect);
805 QItemSelection selection;
806 for (const QModelIndex &index : indexes) {
807 selection.append(QItemSelectionRange(index));
808 }
809 selectionModel()->select(selection, command);
810}
811
813{
814 QPolygonF polygon;
815 const auto constIndexes = selection.indexes();
816 for (const QModelIndex &index : constIndexes) {
817 polygon << d->reverseMapper.polygon(index.row(), index.column());
818 }
819 return polygon.isEmpty() ? QRegion() : QRegion(polygon.toPolygon());
820}
821
823{
824 QPolygonF polygon = d->reverseMapper.polygon(index.row(), index.column());
825 return polygon.isEmpty() ? QRegion() : QRegion(polygon.toPolygon());
826}
827
829{
830 d->attributesModel->setPaletteType(AttributesModel::PaletteTypeDefault);
831}
832
834{
835 d->attributesModel->setPaletteType(AttributesModel::PaletteTypeSubdued);
836}
837
839{
840 d->attributesModel->setPaletteType(AttributesModel::PaletteTypeRainbow);
841}
842
844{
846 if (model()) {
847 // qDebug() << "AbstractDiagram::itemRowLabels(): " << attributesModel()->rowCount(attributesModelRootIndex()) << "entries";
848 const int rowCount = attributesModel()->rowCount(attributesModelRootIndex());
849 for (int i = 0; i < rowCount; ++i) {
850 // qDebug() << "item row label: " << attributesModel()->headerData( i, Qt::Vertical, Qt::DisplayRole ).toString();
852 }
853 }
854 return ret;
855}
856
858{
860 if (!model()) {
861 return ret;
862 }
863 const int datasetCount = d->datasetCount();
864 for (int i = 0; i < datasetCount; ++i) {
865 ret << d->datasetAttrs(i, Qt::DisplayRole).toString();
866 }
867 return ret;
868}
869
871{
873 if (!model()) {
874 return ret;
875 }
876 const int datasetCount = d->datasetCount();
877 for (int i = 0; i < datasetCount; ++i) {
878 ret << brush(i);
879 }
880 return ret;
881}
882
884{
886 if (!model()) {
887 return ret;
888 }
889 const int datasetCount = d->datasetCount();
890 for (int i = 0; i < datasetCount; ++i) {
891 ret << pen(i);
892 }
893 return ret;
894}
895
897{
899 if (!model()) {
900 return ret;
901 }
902 const int datasetCount = d->datasetCount();
903 for (int i = 0; i < datasetCount; ++i) {
905 }
906 return ret;
907}
908
909bool AbstractDiagram::checkInvariants(bool justReturnTheStatus) const
910{
911 if (!justReturnTheStatus) {
912 Q_ASSERT_X(model(), "AbstractDiagram::checkInvariants()",
913 "There is no usable model set, for the diagram.");
914
915 Q_ASSERT_X(coordinatePlane(), "AbstractDiagram::checkInvariants()",
916 "There is no usable coordinate plane set, for the diagram.");
917 }
918 return model() && coordinatePlane();
919}
920
922{
923 return d->datasetDimension;
924}
925
927{
929 qDebug() << "Setting the dataset dimension using AbstractDiagram::setDatasetDimension is "
930 "obsolete. Use the specific diagram types instead.";
931}
932
934{
935 Q_ASSERT(dimension != 0);
936 if (d->datasetDimension == dimension) {
937 return;
938 }
939 d->datasetDimension = dimension;
940 d->attributesModel->setDatasetDimension(dimension);
942 Q_EMIT layoutChanged(this);
943}
944
945qreal AbstractDiagram::valueForCell(int row, int column) const
946{
947 if (!d->attributesModel->hasIndex(row, column, attributesModelRootIndex())) {
948 qWarning() << "AbstractDiagram::valueForCell(): Requesting value for invalid index!";
949 return std::numeric_limits<qreal>::quiet_NaN();
950 }
951 return d->attributesModel->data(
952 d->attributesModel->index(row, column, attributesModelRootIndex()))
953 .toReal(); // checked
954}
955
957{
958 if (d->plane) {
959 d->plane->update();
960 }
961}
962
964{
965 return d->indexAt(point);
966}
967
968QModelIndexList AbstractDiagram::indexesAt(const QPoint &point) const
969{
970 return d->indexesAt(point);
971}
972
973QModelIndexList AbstractDiagram::indexesIn(const QRect &rect) const
974{
975 return d->indexesIn(rect);
976}
Declaring the class KDChart::DataValueAttributes.
QPointF translate(const TernaryPoint &point)
Base class common for all coordinate planes, CartesianCoordinatePlane, PolarCoordinatePlane,...
AbstractDiagram defines the interface for diagram classes.
void setModel(QAbstractItemModel *model) override
void setDataValueAttributes(const QModelIndex &index, const DataValueAttributes &a)
virtual Q_DECL_DEPRECATED void paintDataValueTexts(QPainter *painter)
virtual AttributesModel * attributesModel() const
bool compare(const AbstractDiagram *other) const
void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) override
void setUnitPrefix(const QString &prefix, int column, Qt::Orientation orientation)
virtual bool checkInvariants(bool justReturnTheStatus=false) const
void setPen(const QModelIndex &index, const QPen &pen)
virtual void paintMarker(QPainter *painter, const MarkerAttributes &markerAttributes, const QBrush &brush, const QPen &, const QPointF &point, const QSizeF &size)
int horizontalOffset() const override
QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override
DataValueAttributes dataValueAttributes() const
void paintDataValueText(QPainter *painter, const QModelIndex &index, const QPointF &pos, qreal value)
QRect visualRect(const QModelIndex &index) const override
void layoutChanged(AbstractDiagram *)
AbstractDiagram(Private *p, QWidget *parent, AbstractCoordinatePlane *plane)
QModelIndex attributesModelRootIndex() const
returns a QModelIndex pointing into the AttributesModel that corresponds to the root index of the dia...
const QPair< QPointF, QPointF > dataBoundaries() const
Return the bottom left and top right data point, that the diagram will display (unless the grid adjus...
void scrollTo(const QModelIndex &index, ScrollHint hint=EnsureVisible) override
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles=QVector< int >()) override
QList< QBrush > datasetBrushes() const
virtual void setAttributesModel(AttributesModel *model)
Sets an external AttributesModel on this diagram.
virtual const QPair< QPointF, QPointF > calculateDataBoundaries() const =0
Q_DECL_DEPRECATED qreal valueForCell(int row, int column) const
QString unitPrefix(int column, Qt::Orientation orientation, bool fallback=false) const
AbstractCoordinatePlane * coordinatePlane() const
void setHidden(const QModelIndex &index, bool hidden)
bool isIndexHidden(const QModelIndex &index) const override
void setUnitSuffix(const QString &suffix, int column, Qt::Orientation orientation)
QModelIndexList indexesIn(const QRect &rect) const
void setBrush(const QModelIndex &index, const QBrush &brush)
Q_DECL_DEPRECATED void setPercentMode(bool percent)
Deprecated method that turns the percent mode of this diagram on or off.
void setAllowOverlappingDataValueTexts(bool allow)
bool percentMode() const
Returns whether this diagram is drawn in percent mode.
void setSelectionModel(QItemSelectionModel *selectionModel) override
Q_DECL_DEPRECATED void setDatasetDimension(int dimension)
virtual bool usesExternalAttributesModel() const
virtual void setCoordinatePlane(AbstractCoordinatePlane *plane)
QModelIndex indexAt(const QPoint &point) const override
QModelIndexList indexesAt(const QPoint &point) const
void setRootIndex(const QModelIndex &idx) override
Reimplemented for internal purposes.
virtual QRegion visualRegion(const QModelIndex &index) const
virtual Q_DECL_DEPRECATED void paintMarkers(QPainter *painter)
QList< MarkerAttributes > datasetMarkers() const
QString unitSuffix(int column, Qt::Orientation orientation, bool fallback=false) const
void setAttributesModelRootIndex(const QModelIndex &)
void setDatasetDimensionInternal(int dimension)
QRegion visualRegionForSelection(const QItemSelection &selection) const override
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override
Reimplemented for internal purposes.
A proxy model used for decorating data with attributes.
QVariant data(int role) const
int rowCount(const QModelIndex &) const override
QVariant modelData(int role) const
bool compare(const AttributesModel *other) const
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::DisplayRole) override
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
bool setModelData(const QVariant value, int role)
Diagram attributes dealing with data value labels.
A set of attributes controlling the appearance of data set markers.
static QPen scalePen(const QPen &pen)
Internally used class just adding a special constructor used by AbstractDiagram.
@ DataValueLabelAttributesRole
virtual int columnCount(const QModelIndex &parent) const const=0
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
virtual int rowCount(const QModelIndex &parent) const const=0
bool hasAutoScroll() const const
QAbstractItemModel * model() const const
QModelIndex rootIndex() const const
void scheduleDelayedItemsLayout()
QItemSelectionModel * selectionModel() const const
virtual void setModel(QAbstractItemModel *model)
virtual void setRootIndex(const QModelIndex &index)
virtual void setSelectionModel(QItemSelectionModel *selectionModel)
const QColor & color() const const
QTransform transform() const const
QColor lighter(int factor) const const
void setCoordinateMode(QGradient::CoordinateMode mode)
QModelIndexList indexes() const const
void currentChanged(const QModelIndex &current, const QModelIndex &previous)
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
void append(const T &value)
int column() const const
QVariant data(int role) const const
bool isValid() const const
const QAbstractItemModel * model() const const
int row() const const
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
QObject * parent() const const
T qobject_cast(QObject *object)
void drawEllipse(const QRectF &rectangle)
void drawLine(const QLineF &line)
void drawPath(const QPainterPath &path)
void drawPoint(const QPointF &position)
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule)
void drawRect(const QRectF &rectangle)
const QPen & pen() const const
void scale(qreal sx, qreal sy)
void setBrush(const QBrush &brush)
void setPen(const QColor &color)
void setRenderHint(QPainter::RenderHint hint, bool on)
const QTransform & transform() const const
void translate(const QPointF &offset)
QRectF boundingRect() const const
QPolygon toPolygon() const const
qreal height() const const
DisplayRole
typedef KeyboardModifiers
Orientation
qreal m11() const const
qreal m22() const const
QVariant fromValue(const T &value)
qreal toReal(bool *ok) const const
QString toString() const const
T value() const const
bool isEmpty() const const

© 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 on Fri Apr 26 2024 00:04:56 for KD Chart API Documentation by doxygen 1.9.8