KD Chart API Documentation  3.1
KDChartAttributesModel.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 
11 #include "KDChartAttributesModel.h"
12 #include "KDChartGlobal.h"
13 #include "KDChartPalette.h"
14 
15 #include <QDebug>
16 #include <QPen>
17 #include <QPointer>
18 
21 #include <KDChartBarAttributes.h>
23 #include <KDChartFrameAttributes.h>
24 #include <KDChartGridAttributes.h>
25 #include <KDChartLineAttributes.h>
27 #include <KDChartPieAttributes.h>
29 #include <KDChartTextAttributes.h>
34 
35 #include <KDABLibFakes>
36 
37 using namespace KDChart;
38 
39 class AttributesModel::Private
40 {
41 public:
42  Private();
43 
45  QMap<int, QMap<int, QVariant>> horizontalHeaderDataMap;
46  QMap<int, QMap<int, QVariant>> verticalHeaderDataMap;
47  QMap<int, QVariant> modelDataMap;
48  QMap<int, QVariant> defaultsMap;
49  int dataDimension = 1;
51  Palette palette;
52 };
53 
54 AttributesModel::Private::Private()
55  : palette(Palette::defaultPalette())
56 {
57 }
58 
59 #define d d_func()
60 
61 AttributesModel::AttributesModel(QAbstractItemModel *model, QObject *parent /* = 0 */)
62  : AbstractProxyModel(parent)
63  , _d(new Private)
64 {
65  setSourceModel(model);
68 }
69 
71 {
72  delete _d;
73  _d = nullptr;
74 }
75 
77 {
78  *d = *other->d;
79 }
80 
81 bool AttributesModel::compareHeaderDataMaps(const QMap<int, QMap<int, QVariant>> &mapA,
82  const QMap<int, QMap<int, QVariant>> &mapB) const
83 {
84  if (mapA.count() != mapB.count()) {
85  return false;
86  }
87  QMap<int, QMap<int, QVariant>>::const_iterator itA = mapA.constBegin();
88  QMap<int, QMap<int, QVariant>>::const_iterator itB = mapB.constBegin();
89  for (; itA != mapA.constEnd(); ++itA, ++itB) {
90  if (itA->count() != itB->count()) {
91  return false;
92  }
93  QMap<int, QVariant>::const_iterator it2A = itA->constBegin();
94  QMap<int, QVariant>::const_iterator it2B = itB->constBegin();
95  for (; it2A != itA->constEnd(); ++it2A, ++it2B) {
96  if (it2A.key() != it2B.key()) {
97  return false;
98  }
99  if (!compareAttributes(it2A.key(), it2A.value(), it2B.value())) {
100  return false;
101  }
102  }
103  }
104  return true;
105 }
106 
108 {
109  if (other == this) {
110  return true;
111  }
112  if (!other || d->paletteType != other->d->paletteType) {
113  return false;
114  }
115 
116  {
117  if (d->dataMap.count() != other->d->dataMap.count()) {
118  return false;
119  }
120  QMap<int, QMap<int, QMap<int, QVariant>>>::const_iterator itA = d->dataMap.constBegin();
121  QMap<int, QMap<int, QMap<int, QVariant>>>::const_iterator itB = other->d->dataMap.constBegin();
122  for (; itA != d->dataMap.constEnd(); ++itA, ++itB) {
123  if (itA->count() != itB->count()) {
124  return false;
125  }
126  QMap<int, QMap<int, QVariant>>::const_iterator it2A = itA->constBegin();
127  QMap<int, QMap<int, QVariant>>::const_iterator it2B = itB->constBegin();
128  for (; it2A != itA->constEnd(); ++it2A, ++it2B) {
129  if (it2A->count() != it2B->count()) {
130  return false;
131  }
132  QMap<int, QVariant>::const_iterator it3A = it2A->constBegin();
133  QMap<int, QVariant>::const_iterator it3B = it2B->constBegin();
134  for (; it3A != it2A->constEnd(); ++it3A, ++it3B) {
135  if (it3A.key() != it3B.key()) {
136  return false;
137  }
138  if (!compareAttributes(it3A.key(), it3A.value(), it3B.value())) {
139  return false;
140  }
141  }
142  }
143  }
144  }
145 
146  if (!compareHeaderDataMaps(d->horizontalHeaderDataMap, other->d->horizontalHeaderDataMap) || !compareHeaderDataMaps(d->verticalHeaderDataMap, other->d->verticalHeaderDataMap)) {
147  return false;
148  }
149 
150  {
151  if (d->modelDataMap.count() != other->d->modelDataMap.count()) {
152  return false;
153  }
154  QMap<int, QVariant>::const_iterator itA = d->modelDataMap.constBegin();
155  QMap<int, QVariant>::const_iterator itB = other->d->modelDataMap.constBegin();
156  for (; itA != d->modelDataMap.constEnd(); ++itA, ++itB) {
157  if (itA.key() != itB.key()) {
158  return false;
159  }
160  if (!compareAttributes(itA.key(), itA.value(), itB.value())) {
161  return false;
162  }
163  }
164  }
165  return true;
166 }
167 
169  int role, const QVariant &a, const QVariant &b) const
170 {
171  if (isKnownAttributesRole(role)) {
172  switch (role) {
174  return (a.value<DataValueAttributes>() == b.value<DataValueAttributes>());
175  case DatasetBrushRole:
176  return (a.value<QBrush>() == b.value<QBrush>());
177  case DatasetPenRole:
178  return (a.value<QPen>() == b.value<QPen>());
180  // As of yet there is no ThreeDAttributes class,
181  // and the AbstractThreeDAttributes class is pure virtual,
182  // so we ignore this role for now.
183  // (khz, 04.04.2007)
184  /*
185  return (qVariantValue<ThreeDAttributes>( a ) ==
186  qVariantValue<ThreeDAttributes>( b ));
187  */
188  break;
189  case LineAttributesRole:
190  return (a.value<LineAttributes>() == b.value<LineAttributes>());
192  return (a.value<ThreeDLineAttributes>() == b.value<ThreeDLineAttributes>());
193  case BarAttributesRole:
194  return (a.value<BarAttributes>() == b.value<BarAttributes>());
196  return (a.value<StockBarAttributes>() == b.value<StockBarAttributes>());
198  return (a.value<ThreeDBarAttributes>() == b.value<ThreeDBarAttributes>());
199  case PieAttributesRole:
200  return (a.value<PieAttributes>() == b.value<PieAttributes>());
202  return (a.value<ThreeDPieAttributes>() == b.value<ThreeDPieAttributes>());
204  return (a.value<ValueTrackerAttributes>() == b.value<ValueTrackerAttributes>());
205  case DataHiddenRole:
206  return (a.value<bool>() == b.value<bool>());
207  default:
208  Q_ASSERT(false); // all of our own roles need to be handled
209  break;
210  }
211  } else {
212  return (a == b);
213  }
214  return true;
215 }
216 
217 QVariant AttributesModel::headerData(int section, Qt::Orientation orientation,
218  int role /* = Qt::DisplayRole */) const
219 {
220  if (sourceModel()) {
221  const QVariant sourceData = sourceModel()->headerData(section, orientation, role);
222  if (sourceData.isValid()) {
223  return sourceData;
224  }
225  }
226 
227  // the source model didn't have data set, let's use our stored values
228  const QMap<int, QMap<int, QVariant>> &map = orientation == Qt::Horizontal ? d->horizontalHeaderDataMap : d->verticalHeaderDataMap;
229  QMap<int, QMap<int, QVariant>>::const_iterator mapIt = map.find(section);
230  if (mapIt != map.constEnd()) {
231  const QMap<int, QVariant> &dataMap = mapIt.value();
232  QMap<int, QVariant>::const_iterator dataMapIt = dataMap.find(role);
233  if (dataMapIt != dataMap.constEnd()) {
234  return dataMapIt.value();
235  }
236  }
237 
238  return defaultHeaderData(section, orientation, role);
239 }
240 
241 QVariant AttributesModel::defaultHeaderData(int section, Qt::Orientation orientation, int role) const
242 {
243  // Default values if nothing else matches
244 
245  const int dataset = section / d->dataDimension;
246 
247  switch (role) {
248  case Qt::DisplayRole:
249  // TODO for KDChart 3.0: return QString::number( dataset + 1 );
250  return QString {QLatin1String(orientation == Qt::Vertical ? "Series " : "Item ") + QString::number(dataset)};
252  return d->palette.getBrush(dataset);
254  // if no per model override was set, use the (possibly default) color set for the brush
255  if (!modelData(role).isValid()) {
256  QBrush brush = headerData(section, orientation, DatasetBrushRole).value<QBrush>();
257  return QPen(brush.color());
258  }
259  default:
260  break;
261  }
262 
263  return QVariant();
264 }
265 
266 QVariant AttributesModel::data(int role) const
267 {
268  if (isKnownAttributesRole(role)) {
269  // check if there is something set at global level
270  QVariant v = modelData(role);
271 
272  // else return the default setting, if any
273  if (!v.isValid())
274  v = defaultsForRole(role);
275  return v;
276  }
277  return QVariant();
278 }
279 
280 QVariant AttributesModel::data(int column, int role) const
281 {
282  if (isKnownAttributesRole(role)) {
283  // check if there is something set for the column (dataset)
284  QVariant v;
285  v = headerData(column, Qt::Horizontal, role);
286 
287  // check if there is something set at global level
288  if (!v.isValid())
289  v = data(role); // includes automatic fallback to default
290  return v;
291  }
292  return QVariant();
293 }
294 
295 QVariant AttributesModel::data(const QModelIndex &index, int role) const
296 {
297  if (index.isValid()) {
298  Q_ASSERT(index.model() == this);
299  }
300  if (!sourceModel()) {
301  return QVariant();
302  }
303 
304  if (index.isValid()) {
305  const QVariant sourceData = sourceModel()->data(mapToSource(index), role);
306  if (sourceData.isValid()) {
307  return sourceData;
308  }
309  }
310 
311  // check if we are storing a value for this role at this cell index
312  if (d->dataMap.contains(index.column())) {
313  const QMap<int, QMap<int, QVariant>> &colDataMap = d->dataMap[index.column()];
314  if (colDataMap.contains(index.row())) {
315  const QMap<int, QVariant> &dataMap = colDataMap[index.row()];
316  if (dataMap.contains(role)) {
317  const QVariant v = dataMap[role];
318  if (v.isValid()) {
319  return v;
320  }
321  }
322  }
323  }
324  // check if there is something set for the column (dataset), or at global level
325  if (index.isValid()) {
326  return data(index.column(), role); // includes automatic fallback to default
327  }
328 
329  return QVariant();
330 }
331 
333 {
334  switch (role) {
335  // fallthrough intended
337  case DatasetBrushRole:
338  case DatasetPenRole:
340  case LineAttributesRole:
342  case BarAttributesRole:
345  case PieAttributesRole:
348  case DataHiddenRole:
349  return true;
350  default:
351  return false;
352  }
353 }
354 
355 QVariant AttributesModel::defaultsForRole(int role) const
356 {
357  // returns default-constructed QVariant if not found
358  return d->defaultsMap.value(role);
359 }
360 
361 bool AttributesModel::setData(const QModelIndex &index, const QVariant &value, int role)
362 {
363  if (!isKnownAttributesRole(role)) {
364  return sourceModel()->setData(mapToSource(index), value, role);
365  } else {
366  QMap<int, QMap<int, QVariant>> &colDataMap = d->dataMap[index.column()];
367  QMap<int, QVariant> &dataMap = colDataMap[index.row()];
368  dataMap.insert(role, value);
369  Q_EMIT attributesChanged(index, index);
370  return true;
371  }
372 }
373 
374 bool AttributesModel::resetData(const QModelIndex &index, int role)
375 {
376  return setData(index, QVariant(), role);
377 }
378 
379 bool AttributesModel::setHeaderData(int section, Qt::Orientation orientation,
380  const QVariant &value, int role)
381 {
382  if (sourceModel() && headerData(section, orientation, role) == value) {
383  return true;
384  }
385 
386  if (!isKnownAttributesRole(role)) {
387  return sourceModel()->setHeaderData(section, orientation, value, role);
388  } else {
389  QMap<int, QMap<int, QVariant>> &sectionDataMap = orientation == Qt::Horizontal ? d->horizontalHeaderDataMap : d->verticalHeaderDataMap;
390 
391  QMap<int, QVariant> &dataMap = sectionDataMap[section];
392  dataMap.insert(role, value);
393  if (sourceModel()) {
394  int numRows = rowCount(QModelIndex());
395  int numCols = columnCount(QModelIndex());
396  if (orientation == Qt::Horizontal && numRows > 0)
397  Q_EMIT attributesChanged(index(0, section, QModelIndex()),
398  index(numRows - 1, section, QModelIndex()));
399  else if (orientation == Qt::Vertical && numCols > 0)
400  Q_EMIT attributesChanged(index(section, 0, QModelIndex()),
401  index(section, numCols - 1, QModelIndex()));
402  Q_EMIT headerDataChanged(orientation, section, section);
403 
404  // FIXME: This only makes sense for orientation == Qt::Horizontal,
405  // but what if orientation == Qt::Vertical?
406  if (section != -1 && numRows > 0)
407  Q_EMIT dataChanged(index(0, section, QModelIndex()),
408  index(numRows - 1, section, QModelIndex()));
409  }
410  return true;
411  }
412 }
413 
414 bool AttributesModel::resetHeaderData(int section, Qt::Orientation orientation, int role)
415 {
416  return setHeaderData(section, orientation, QVariant(), role);
417 }
418 
420 {
421  if (d->paletteType == type) {
422  return;
423  }
424  d->paletteType = type;
425  switch (type) {
426  case PaletteTypeDefault:
427  d->palette = Palette::defaultPalette();
428  break;
429  case PaletteTypeSubdued:
430  d->palette = Palette::subduedPalette();
431  break;
432  case PaletteTypeRainbow:
433  d->palette = Palette::rainbowPalette();
434  break;
435  default:
436  qWarning("Unknown palette type!");
437  }
438 }
439 
441 {
442  return d->paletteType;
443 }
444 
445 bool KDChart::AttributesModel::setModelData(const QVariant value, int role)
446 {
447  d->modelDataMap.insert(role, value);
448  int numRows = rowCount(QModelIndex());
449  int numCols = columnCount(QModelIndex());
450  if (sourceModel() && numRows > 0 && numCols > 0) {
451  Q_EMIT attributesChanged(index(0, 0, QModelIndex()),
452  index(numRows - 1, numCols - 1, QModelIndex()));
453  beginResetModel();
454  endResetModel();
455  }
456  return true;
457 }
458 
459 QVariant KDChart::AttributesModel::modelData(int role) const
460 {
461  return d->modelDataMap.value(role, QVariant());
462 }
463 
464 int AttributesModel::rowCount(const QModelIndex &index) const
465 {
466  if (sourceModel()) {
467  return sourceModel()->rowCount(mapToSource(index));
468  } else {
469  return 0;
470  }
471 }
472 
473 int AttributesModel::columnCount(const QModelIndex &index) const
474 {
475  if (sourceModel()) {
476  return sourceModel()->columnCount(mapToSource(index));
477  } else {
478  return 0;
479  }
480 }
481 
482 void AttributesModel::setSourceModel(QAbstractItemModel *newModel)
483 {
484  QAbstractItemModel *oldModel = sourceModel();
485  if (oldModel != nullptr) {
486  disconnect(oldModel, &QAbstractItemModel::dataChanged,
487  this, &AttributesModel::slotDataChanged);
488  disconnect(oldModel, &QAbstractItemModel::rowsInserted,
489  this, &AttributesModel::slotRowsInserted);
490  disconnect(oldModel, &QAbstractItemModel::rowsRemoved,
491  this, &AttributesModel::slotRowsRemoved);
492  disconnect(oldModel, &QAbstractItemModel::rowsAboutToBeInserted,
493  this, &AttributesModel::slotRowsAboutToBeInserted);
494  disconnect(oldModel, &QAbstractItemModel::rowsAboutToBeRemoved,
495  this, &AttributesModel::slotRowsAboutToBeRemoved);
496  disconnect(oldModel, &QAbstractItemModel::columnsInserted,
497  this, &AttributesModel::slotColumnsInserted);
498  disconnect(oldModel, &QAbstractItemModel::columnsRemoved,
499  this, &AttributesModel::slotColumnsRemoved);
500  disconnect(oldModel, &QAbstractItemModel::columnsAboutToBeInserted,
501  this, &AttributesModel::slotColumnsAboutToBeInserted);
502  disconnect(oldModel, &QAbstractItemModel::columnsAboutToBeRemoved,
503  this, &AttributesModel::slotColumnsAboutToBeRemoved);
504  disconnect(oldModel, &QAbstractItemModel::modelAboutToBeReset,
505  this, &AttributesModel::modelAboutToBeReset);
506  disconnect(oldModel, &QAbstractItemModel::modelReset,
507  this, &AttributesModel::modelReset);
508  disconnect(oldModel, &QAbstractItemModel::layoutChanged,
509  this, &AttributesModel::layoutChanged);
510  }
511  QAbstractProxyModel::setSourceModel(newModel);
512  if (newModel != nullptr) {
513  connect(newModel, &QAbstractItemModel::dataChanged,
514  this, &AttributesModel::slotDataChanged);
515  connect(newModel, &QAbstractItemModel::rowsInserted,
516  this, &AttributesModel::slotRowsInserted);
517  connect(newModel, &QAbstractItemModel::rowsRemoved,
518  this, &AttributesModel::slotRowsRemoved);
519  connect(newModel, &QAbstractItemModel::rowsAboutToBeInserted,
520  this, &AttributesModel::slotRowsAboutToBeInserted);
521  connect(newModel, &QAbstractItemModel::rowsAboutToBeRemoved,
522  this, &AttributesModel::slotRowsAboutToBeRemoved);
523  connect(newModel, &QAbstractItemModel::columnsInserted,
524  this, &AttributesModel::slotColumnsInserted);
525  connect(newModel, &QAbstractItemModel::columnsRemoved,
526  this, &AttributesModel::slotColumnsRemoved);
527  connect(newModel, &QAbstractItemModel::columnsAboutToBeInserted,
528  this, &AttributesModel::slotColumnsAboutToBeInserted);
529  connect(newModel, &QAbstractItemModel::columnsAboutToBeRemoved,
530  this, &AttributesModel::slotColumnsAboutToBeRemoved);
531  connect(newModel, &QAbstractItemModel::modelAboutToBeReset,
532  this, &AttributesModel::modelAboutToBeReset);
533  connect(newModel, &QAbstractItemModel::modelReset,
534  this, &AttributesModel::modelReset);
535  connect(newModel, &QAbstractItemModel::layoutChanged,
536  this, &AttributesModel::layoutChanged);
537  }
538 }
539 
540 void AttributesModel::slotRowsAboutToBeInserted(const QModelIndex &parent, int start, int end)
541 {
542  beginInsertRows(mapFromSource(parent), start, end);
543 }
544 
545 void AttributesModel::slotColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end)
546 {
547  beginInsertColumns(mapFromSource(parent), start, end);
548 }
549 
550 void AttributesModel::slotRowsInserted(const QModelIndex &parent, int start, int end)
551 {
552  Q_UNUSED(parent);
553  Q_UNUSED(start);
554  Q_UNUSED(end);
555  endInsertRows();
556 }
557 
558 void AttributesModel::slotColumnsInserted(const QModelIndex &parent, int start, int end)
559 {
560  Q_UNUSED(parent);
561  Q_UNUSED(start);
562  Q_UNUSED(end);
563  endInsertColumns();
564 }
565 
566 void AttributesModel::slotRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
567 {
568  beginRemoveRows(mapFromSource(parent), start, end);
569 }
570 
571 void AttributesModel::slotColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
572 {
573  beginRemoveColumns(mapFromSource(parent), start, end);
574 }
575 
576 void AttributesModel::slotRowsRemoved(const QModelIndex &parent, int start, int end)
577 {
578  Q_UNUSED(parent);
579  Q_UNUSED(start);
580  Q_UNUSED(end);
581  endRemoveRows();
582 }
583 
584 void AttributesModel::removeEntriesFromDataMap(int start, int end)
585 {
586  QMap<int, QMap<int, QMap<int, QVariant>>>::iterator it = d->dataMap.find(end);
587  // check that the element was found
588  if (it != d->dataMap.end()) {
589  ++it;
590  QVector<int> indexesToDel;
591  for (int i = start; i < end && it != d->dataMap.end(); ++i) {
592  d->dataMap[i] = it.value();
593  indexesToDel << it.key();
594  ++it;
595  }
596  if (indexesToDel.isEmpty()) {
597  for (int i = start; i < end; ++i) {
598  indexesToDel << i;
599  }
600  }
601  for (int i = 0; i < indexesToDel.count(); ++i) {
602  d->dataMap.remove(indexesToDel[i]);
603  }
604  }
605 }
606 
607 void AttributesModel::removeEntriesFromDirectionDataMaps(Qt::Orientation dir, int start, int end)
608 {
609  QMap<int, QMap<int, QVariant>> &sectionDataMap = dir == Qt::Horizontal ? d->horizontalHeaderDataMap : d->verticalHeaderDataMap;
610  QMap<int, QMap<int, QVariant>>::iterator it = sectionDataMap.upperBound(end);
611  // check that the element was found
612  if (it != sectionDataMap.end()) {
613  QVector<int> indexesToDel;
614  for (int i = start; i < end && it != sectionDataMap.end(); ++i) {
615  sectionDataMap[i] = it.value();
616  indexesToDel << it.key();
617  ++it;
618  }
619  if (indexesToDel.isEmpty()) {
620  for (int i = start; i < end; ++i) {
621  indexesToDel << i;
622  }
623  }
624  for (int i = 0; i < indexesToDel.count(); ++i) {
625  sectionDataMap.remove(indexesToDel[i]);
626  }
627  }
628 }
629 
630 void AttributesModel::slotColumnsRemoved(const QModelIndex &parent, int start, int end)
631 {
632  Q_UNUSED(parent);
633  Q_UNUSED(start);
634  Q_UNUSED(end);
635  Q_ASSERT_X(sourceModel(), "removeColumn", "This should only be triggered if a valid source Model exists!");
636  for (int i = start; i <= end; ++i) {
637  d->verticalHeaderDataMap.remove(start);
638  }
639  removeEntriesFromDataMap(start, end);
640  removeEntriesFromDirectionDataMaps(Qt::Horizontal, start, end);
641  removeEntriesFromDirectionDataMaps(Qt::Vertical, start, end);
642 
643  endRemoveColumns();
644 }
645 
646 void AttributesModel::slotDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
647 {
648  Q_EMIT dataChanged(mapFromSource(topLeft), mapFromSource(bottomRight));
649 }
650 
651 void AttributesModel::setDefaultForRole(int role, const QVariant &value)
652 {
653  if (value.isValid()) {
654  d->defaultsMap.insert(role, value);
655  } else {
656  // erase the possibly existing value to not let the map grow:
657  QMap<int, QVariant>::iterator it = d->defaultsMap.find(role);
658  if (it != d->defaultsMap.end()) {
659  d->defaultsMap.erase(it);
660  }
661  }
662 
663  Q_ASSERT(defaultsForRole(role).value<KDChart::DataValueAttributes>() == value.value<KDChart::DataValueAttributes>());
664 }
665 
667 {
668  // ### need to "reformat" or throw away internal data?
669  d->dataDimension = dimension;
670 }
671 
673 {
674  return d->dataDimension;
675 }
#define d
Declaring the class KDChart::DataValueAttributes.
Contains KDChart macros.
Base class for all proxy models used inside KD Chart.
QModelIndex index(int row, int col, const QModelIndex &index) const override
Reimplemented for internal purposes.
QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
Reimplemented for internal purposes.
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override
Reimplemented for internal purposes.
QModelIndex parent(const QModelIndex &index) const override
Reimplemented for internal purposes.
A proxy model used for decorating data with attributes.
virtual QVariant defaultHeaderData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
void attributesChanged(const QModelIndex &, const QModelIndex &)
QVariant data(int role) const
int rowCount(const QModelIndex &) const override
bool compareAttributes(int role, const QVariant &a, const QVariant &b) const
void setDatasetDimension(int dimension)
bool resetHeaderData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole)
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::DisplayRole) override
QVariant modelData(int role) const
void setPaletteType(PaletteType type)
void setSourceModel(QAbstractItemModel *sourceModel) override
bool resetData(const QModelIndex &index, int role=Qt::DisplayRole)
void setDefaultForRole(int role, const QVariant &value)
void initFrom(const AttributesModel *other)
bool compare(const AttributesModel *other) const
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::DisplayRole) override
bool isKnownAttributesRole(int role) const
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
int columnCount(const QModelIndex &) const override
bool setModelData(const QVariant value, int role)
Set of attributes for changing the appearance of bar charts.
Diagram attributes dealing with data value labels.
static const QVariant & defaultAttributesAsVariant()
Set of attributes for changing the appearance of line charts.
A Palette is a set of brushes (or colors) to be used for painting data sets.
static const Palette & subduedPalette()
static const Palette & defaultPalette()
static const Palette & rainbowPalette()
A set of attributes controlling the appearance of pie charts.
Attributes to customize the appearance of a column in a stock chart.
Cell-specific attributes regarding value tracking.
@ DataValueLabelAttributesRole
@ LineAttributesRole
@ ThreeDLineAttributesRole
@ ThreeDBarAttributesRole
@ ThreeDPieAttributesRole
@ ThreeDAttributesRole
@ StockBarAttributesRole
@ PieAttributesRole
@ BarAttributesRole
@ DataHiddenRole
@ DatasetBrushRole
@ ValueTrackerAttributesRole
@ DatasetPenRole

© 2001 Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
https://www.kdab.com/development-resources/qt-tools/kd-chart/
Generated by doxygen 1.9.1