KD Chart API Documentation 3.1
|
A proxy model used for decorating data with attributes. More...
#include <KDChartAttributesModel.h>
Public Types | |
enum | PaletteType { PaletteTypeDefault = 0 , PaletteTypeRainbow = 1 , PaletteTypeSubdued = 2 } |
Public Types inherited from QAbstractItemModel | |
enum | CheckIndexOption |
enum | LayoutChangeHint |
Signals | |
void | attributesChanged (const QModelIndex &, const QModelIndex &) |
A proxy model used for decorating data with attributes.
An AttributesModel forwards data from and to the source model and adds attributes, data that influences the graphical rendering of the source model data. The attributes are distinguished from the source model's data by their @p role values. Therefore this class does not need to, and does not, change the data layout from the source model's; indexes that refer to the same data have the same row and column values in both models. Attribute changes, that is changes to data with the attribute role, via the interface of this class (including setData()) are stored internally and not forwarded to the source model.
Definition at line 34 of file KDChartAttributesModel.h.
Enumerator | |
---|---|
PaletteTypeDefault | |
PaletteTypeRainbow | |
PaletteTypeSubdued |
Definition at line 39 of file KDChartAttributesModel.h.
|
explicit |
Definition at line 61 of file KDChartAttributesModel.cpp.
References KDChart::DataValueLabelAttributesRole, KDChart::DataValueAttributes::defaultAttributesAsVariant(), setDefaultForRole(), and setSourceModel().
|
override |
Definition at line 70 of file KDChartAttributesModel.cpp.
|
signal |
Referenced by setData(), and setHeaderData().
|
overridevirtual |
Reimplemented for internal purposes.
Implements QAbstractItemModel.
Definition at line 473 of file KDChartAttributesModel.cpp.
References KDChart::AbstractProxyModel::index(), KDChart::AbstractProxyModel::mapToSource(), and QAbstractProxyModel::sourceModel.
Referenced by KDChart::StockDiagram::calculateDataBoundaries(), KDChart::StockDiagram::paint(), and setHeaderData().
bool AttributesModel::compare | ( | const AttributesModel * | other | ) | const |
Returns true if both, all of the attributes set, and the palette set is equal in both of the AttributeModels.
Definition at line 107 of file KDChartAttributesModel.cpp.
References compareAttributes(), QMap< T, K >::constBegin(), d, and QObject::qobject_cast().
Referenced by KDChart::AbstractDiagram::compare().
Definition at line 168 of file KDChartAttributesModel.cpp.
References KDChart::BarAttributesRole, KDChart::DataHiddenRole, KDChart::DatasetBrushRole, KDChart::DatasetPenRole, KDChart::DataValueLabelAttributesRole, isKnownAttributesRole(), KDChart::LineAttributesRole, KDChart::PieAttributesRole, QObject::qobject_cast(), KDChart::StockBarAttributesRole, KDChart::ThreeDAttributesRole, KDChart::ThreeDBarAttributesRole, KDChart::ThreeDLineAttributesRole, KDChart::ThreeDPieAttributesRole, QVariant::value(), and KDChart::ValueTrackerAttributesRole.
Referenced by compare().
|
overridevirtual |
Reimplemented for internal purposes.
Reimplemented from QAbstractProxyModel.
Definition at line 295 of file KDChartAttributesModel.cpp.
References QModelIndex::column(), QMap< T, K >::contains(), d, data(), KDChart::AbstractProxyModel::index(), QModelIndex::isValid(), KDChart::AbstractProxyModel::mapToSource(), QModelIndex::model(), QObject::qobject_cast(), QModelIndex::row(), and QAbstractProxyModel::sourceModel.
Returns the data that were specified at per column level, or the globally set data, or the default data, or QVariant().
Definition at line 280 of file KDChartAttributesModel.cpp.
References data(), headerData(), Qt::Horizontal, isKnownAttributesRole(), and QObject::qobject_cast().
Returns the data that were specified at global level, or the default data, or QVariant().
Definition at line 266 of file KDChartAttributesModel.cpp.
References isKnownAttributesRole(), modelData(), and QObject::qobject_cast().
Referenced by KDChart::AbstractDiagram::brush(), KDChart::AbstractDiagram::brush(), data(), data(), KDChart::AbstractDiagram::dataValueAttributes(), KDChart::AbstractDiagram::pen(), and KDChart::AbstractDiagram::pen().
int AttributesModel::datasetDimension | ( | ) | const |
Definition at line 672 of file KDChartAttributesModel.cpp.
References d.
|
virtual |
Returns default values for the header data.
Definition at line 241 of file KDChartAttributesModel.cpp.
References QBrush::color(), d, KDChart::DatasetBrushRole, KDChart::DatasetPenRole, Qt::DisplayRole, headerData(), QVariant::isValid(), modelData(), QString::number(), QObject::qobject_cast(), QVariant::value(), and Qt::Vertical.
Referenced by headerData().
|
overridevirtual |
Reimplemented for internal purposes.
Reimplemented from QAbstractProxyModel.
Definition at line 217 of file KDChartAttributesModel.cpp.
References QMap< T, K >::constEnd(), d, defaultHeaderData(), QMap< T, K >::find(), Qt::Horizontal, QObject::qobject_cast(), QAbstractProxyModel::sourceModel, QMap< T, K >::iterator::value(), and QMap< T, K >::value().
Referenced by data(), defaultHeaderData(), KDChart::AbstractDiagram::itemRowLabels(), and setHeaderData().
void AttributesModel::initFrom | ( | const AttributesModel * | other | ) |
Copies the internal data (maps and palette) of another AttributesModel* into this one.
Definition at line 76 of file KDChartAttributesModel.cpp.
References d, and QObject::qobject_cast().
Returns whether the given role corresponds to one of the known internally used ones.
Definition at line 332 of file KDChartAttributesModel.cpp.
References KDChart::BarAttributesRole, KDChart::DataHiddenRole, KDChart::DatasetBrushRole, KDChart::DatasetPenRole, KDChart::DataValueLabelAttributesRole, KDChart::LineAttributesRole, KDChart::PieAttributesRole, KDChart::StockBarAttributesRole, KDChart::ThreeDAttributesRole, KDChart::ThreeDBarAttributesRole, KDChart::ThreeDLineAttributesRole, KDChart::ThreeDPieAttributesRole, and KDChart::ValueTrackerAttributesRole.
Referenced by compareAttributes(), data(), data(), setData(), and setHeaderData().
Definition at line 459 of file KDChartAttributesModel.cpp.
References d, and QVariant::value().
Referenced by data(), KDChart::AbstractDiagram::dataValueAttributes(), defaultHeaderData(), KDChart::AbstractDiagram::isHidden(), KDChart::StockDiagram::stockBarAttributes(), and KDChart::StockDiagram::threeDBarAttributes().
AttributesModel::PaletteType AttributesModel::paletteType | ( | ) | const |
Definition at line 440 of file KDChartAttributesModel.cpp.
References d.
bool AttributesModel::resetData | ( | const QModelIndex & | index, |
int | role = Qt::DisplayRole |
||
) |
Remove any explicit attributes settings that might have been specified before.
Definition at line 374 of file KDChartAttributesModel.cpp.
References KDChart::AbstractProxyModel::index(), and setData().
bool AttributesModel::resetHeaderData | ( | int | section, |
Qt::Orientation | orientation, | ||
int | role = Qt::DisplayRole |
||
) |
Remove any explicit attributes settings that might have been specified before.
Definition at line 414 of file KDChartAttributesModel.cpp.
References setHeaderData().
|
overridevirtual |
Reimplemented for internal purposes.
Implements QAbstractItemModel.
Definition at line 464 of file KDChartAttributesModel.cpp.
References KDChart::AbstractProxyModel::index(), KDChart::AbstractProxyModel::mapToSource(), and QAbstractProxyModel::sourceModel.
Referenced by KDChart::StockDiagram::calculateDataBoundaries(), KDChart::AbstractDiagram::itemRowLabels(), KDChart::StockDiagram::paint(), and setHeaderData().
|
overridevirtual |
Reimplemented for internal purposes.
Reimplemented from QAbstractProxyModel.
Definition at line 361 of file KDChartAttributesModel.cpp.
References attributesChanged(), QModelIndex::column(), d, KDChart::AbstractProxyModel::index(), QMap< T, K >::insert(), isKnownAttributesRole(), KDChart::AbstractProxyModel::mapToSource(), QObject::Q_EMIT(), QObject::qobject_cast(), QModelIndex::row(), and QAbstractProxyModel::sourceModel.
Referenced by resetData(), KDChart::BarDiagram::setBarAttributes(), KDChart::AbstractDiagram::setBrush(), and KDChart::AbstractDiagram::setPen().
Set the dimension of the dataset in the source model.
Definition at line 666 of file KDChartAttributesModel.cpp.
References d, and QObject::qobject_cast().
Define the default value for a certain role. Passing a default-constructed QVariant is equivalent to removing the default.
Definition at line 651 of file KDChartAttributesModel.cpp.
References d, QVariant::isValid(), QObject::qobject_cast(), and QVariant::value().
Referenced by AttributesModel(), and KDChart::TernaryLineDiagram::TernaryLineDiagram().
|
overridevirtual |
Reimplemented for internal purposes.
Reimplemented from QAbstractProxyModel.
Definition at line 379 of file KDChartAttributesModel.cpp.
References attributesChanged(), columnCount(), d, QAbstractItemModel::dataChanged(), headerData(), QAbstractItemModel::headerDataChanged(), Qt::Horizontal, KDChart::AbstractProxyModel::index(), QMap< T, K >::insert(), isKnownAttributesRole(), QObject::Q_EMIT(), QObject::qobject_cast(), rowCount(), QAbstractProxyModel::sourceModel, and Qt::Vertical.
Referenced by resetHeaderData().
Definition at line 445 of file KDChartAttributesModel.cpp.
References d.
Referenced by KDChart::AbstractDiagram::setBrush(), KDChart::AbstractDiagram::setPen(), KDChart::StockDiagram::setStockBarAttributes(), and KDChart::StockDiagram::setThreeDBarAttributes().
void AttributesModel::setPaletteType | ( | AttributesModel::PaletteType | type | ) |
Sets the palettetype used by this attributesmodel
Definition at line 419 of file KDChartAttributesModel.cpp.
References d, KDChart::Palette::defaultPalette(), PaletteTypeDefault, PaletteTypeRainbow, PaletteTypeSubdued, QObject::qobject_cast(), KDChart::Palette::rainbowPalette(), and KDChart::Palette::subduedPalette().
|
overridevirtual |
Reimplemented for internal purposes.
Reimplemented from QAbstractProxyModel.
Definition at line 482 of file KDChartAttributesModel.cpp.
References QAbstractItemModel::columnsAboutToBeInserted(), QAbstractItemModel::columnsAboutToBeRemoved(), QAbstractItemModel::columnsInserted(), QAbstractItemModel::columnsRemoved(), QObject::connect(), QAbstractItemModel::dataChanged(), QObject::disconnect(), QAbstractItemModel::layoutChanged(), QAbstractItemModel::modelAboutToBeReset(), QAbstractItemModel::modelReset(), QObject::qobject_cast(), QAbstractItemModel::rowsAboutToBeInserted(), QAbstractItemModel::rowsAboutToBeRemoved(), QAbstractItemModel::rowsInserted(), QAbstractItemModel::rowsRemoved(), QAbstractProxyModel::setSourceModel(), and QAbstractProxyModel::sourceModel.
Referenced by AttributesModel().