A proxy model used for storing attributes. More...
#include <KDChartAttributesModel.h>
Public Types | |
enum | PaletteType { PaletteTypeDefault = 0, PaletteTypeRainbow = 1, PaletteTypeSubdued = 2 } |
Signals | |
void | attributesChanged (const QModelIndex &, const QModelIndex &) |
Public Member Functions | |
AttributesModel (QAbstractItemModel *model, QObject *parent=0) | |
int | columnCount (const QModelIndex &) const |
[reimplemented] | |
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 AttributeModels. | |
bool | compareAttributes (int role, const QVariant &a, const QVariant &b) const |
QVariant | data (const QModelIndex &, int role=Qt::DisplayRole) const |
[reimplemented] | |
QVariant | data (int column, int role) const |
Returns the data that were specified at per column level, or the globally set data, or the default data, or QVariant(). | |
QVariant | data (int role) const |
Returns the data that were specified at global level, or the default data, or QVariant(). | |
virtual QVariant | defaultHeaderData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
Returns default values for the header data. | |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
[reimplemented] | |
QModelIndex | index (int row, int col, const QModelIndex &index) const |
void | initFrom (const AttributesModel *other) |
Copies the internal data (maps and palette) of another AttributesModel* into this one. | |
bool | isKnownAttributesRole (int role) const |
Returns whether the given role corresponds to one of the known internally used ones. | |
QModelIndex | mapFromSource (const QModelIndex &sourceIndex) const |
QModelIndex | mapToSource (const QModelIndex &proxyIndex) const |
QVariant | modelData (int role) const |
PaletteType | paletteType () const |
QModelIndex | parent (const QModelIndex &index) const |
bool | resetData (const QModelIndex &index, int role=Qt::DisplayRole) |
Remove any explicit attributes settings that might have been specified before. | |
bool | resetHeaderData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) |
Remove any explicit attributes settings that might have been specified before. | |
int | rowCount (const QModelIndex &) const |
[reimplemented] | |
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::DisplayRole) |
[reimplemented] | |
void | setDefaultForRole (int role, const QVariant &value) |
Define the default value for a certain role. | |
bool | setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::DisplayRole) |
[reimplemented] | |
bool | setModelData (const QVariant value, int role) |
void | setPaletteType (PaletteType type) |
Sets the palettetype used by this attributesmodel. | |
void | setSourceModel (QAbstractItemModel *sourceModel) |
[reimplemented] | |
~AttributesModel () | |
Protected Member Functions | |
const QMap< int, QMap< int, QMap< int, QVariant > > > | dataMap () const |
needed for serialization | |
const QMap< int, QMap< int, QVariant > > | horizontalHeaderDataMap () const |
needed for serialization | |
const QMap< int, QVariant > | modelDataMap () const |
needed for serialization | |
void | setDataMap (const QMap< int, QMap< int, QMap< int, QVariant > > > map) |
needed for serialization | |
void | setHorizontalHeaderDataMap (const QMap< int, QMap< int, QVariant > > map) |
needed for serialization | |
void | setModelDataMap (const QMap< int, QVariant > map) |
needed for serialization | |
void | setVerticalHeaderDataMap (const QMap< int, QMap< int, QVariant > > map) |
needed for serialization | |
const QMap< int, QMap< int, QVariant > > | verticalHeaderDataMap () const |
needed for serialization |
A proxy model used for storing attributes.
Definition at line 37 of file KDChartAttributesModel.h.
Definition at line 44 of file KDChartAttributesModel.h.
AttributesModel::AttributesModel | ( | QAbstractItemModel * | model, | |
QObject * | parent = 0 | |||
) | [explicit] |
Definition at line 52 of file KDChartAttributesModel.cpp.
References KDChart::DataValueLabelAttributesRole, KDChart::DataValueAttributes::defaultAttributesAsVariant(), setDefaultForRole(), and setSourceModel().
AttributesModel::~AttributesModel | ( | ) |
Definition at line 61 of file KDChartAttributesModel.cpp.
void KDChart::AttributesModel::attributesChanged | ( | const QModelIndex & | , | |
const QModelIndex & | ||||
) | [signal] |
Referenced by setData(), setHeaderData(), and setModelData().
int AttributesModel::columnCount | ( | const QModelIndex & | index | ) | const |
[reimplemented]
Definition at line 547 of file KDChartAttributesModel.cpp.
References KDChart::AbstractProxyModel::mapToSource().
Referenced by KDChart::AbstractDiagram::datasetBrushes(), KDChart::AbstractDiagram::datasetLabels(), KDChart::AbstractDiagram::datasetMarkers(), KDChart::AbstractDiagram::datasetPens(), and setModelData().
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 78 of file KDChartAttributesModel.cpp.
References compareAttributes(), and paletteType().
Referenced by KDChart::AbstractDiagram::compare().
bool AttributesModel::compareAttributes | ( | int | role, | |
const QVariant & | a, | |||
const QVariant & | b | |||
) | const |
Definition at line 226 of file KDChartAttributesModel.cpp.
References KDChart::BarAttributesRole, KDChart::DataHiddenRole, KDChart::DatasetBrushRole, KDChart::DatasetPenRole, KDChart::DataValueLabelAttributesRole, isKnownAttributesRole(), KDChart::LineAttributesRole, KDChart::PieAttributesRole, KDChart::StockBarAttributesRole, KDChart::ThreeDAttributesRole, KDChart::ThreeDBarAttributesRole, KDChart::ThreeDLineAttributesRole, KDChart::ThreeDPieAttributesRole, and KDChart::ValueTrackerAttributesRole.
Referenced by compare().
QVariant AttributesModel::data | ( | const QModelIndex & | index, | |
int | role = Qt::DisplayRole | |||
) | const |
[reimplemented]
Definition at line 393 of file KDChartAttributesModel.cpp.
References data(), dataMap(), and KDChart::AbstractProxyModel::mapToSource().
QVariant AttributesModel::data | ( | int | column, | |
int | role | |||
) | const |
Returns the data that were specified at per column level, or the globally set data, or the default data, or QVariant().
Definition at line 377 of file KDChartAttributesModel.cpp.
References data(), headerData(), and isKnownAttributesRole().
QVariant AttributesModel::data | ( | int | role | ) | const |
Returns the data that were specified at global level, or the default data, or QVariant().
Definition at line 359 of file KDChartAttributesModel.cpp.
References isKnownAttributesRole(), and modelData().
Referenced by KDChart::AbstractDiagram::brush(), data(), KDChart::AbstractDiagram::dataValueAttributes(), headerData(), KDChart::AbstractDiagram::isHidden(), and KDChart::AbstractDiagram::pen().
const QMap< int, QMap< int, QMap< int, QVariant > > > AttributesModel::dataMap | ( | ) | const [protected] |
needed for serialization
Definition at line 669 of file KDChartAttributesModel.cpp.
Referenced by data(), headerData(), setData(), and setHeaderData().
QVariant AttributesModel::defaultHeaderData | ( | int | section, | |
Qt::Orientation | orientation, | |||
int | role = Qt::DisplayRole | |||
) | const [virtual] |
Returns default values for the header data.
Definition at line 323 of file KDChartAttributesModel.cpp.
References KDChart::DatasetBrushRole, KDChart::DatasetPenRole, KDChart::Palette::defaultPalette(), KDChart::Palette::getBrush(), headerData(), modelData(), paletteType(), PaletteTypeDefault, PaletteTypeRainbow, PaletteTypeSubdued, KDChart::Palette::rainbowPalette(), and KDChart::Palette::subduedPalette().
Referenced by headerData().
QVariant AttributesModel::headerData | ( | int | section, | |
Qt::Orientation | orientation, | |||
int | role = Qt::DisplayRole | |||
) | const |
[reimplemented]
Definition at line 288 of file KDChartAttributesModel.cpp.
References KDChart::ColumnDataRole, data(), dataMap(), defaultHeaderData(), and KDChart::AbstractProxyModel::index().
Referenced by data(), KDChart::AbstractDiagram::datasetLabels(), defaultHeaderData(), KDChart::AbstractDiagram::itemRowLabels(), and setHeaderData().
const QMap< int, QMap< int, QVariant > > AttributesModel::horizontalHeaderDataMap | ( | ) | const [protected] |
needed for serialization
Definition at line 674 of file KDChartAttributesModel.cpp.
QModelIndex KDChart::AbstractProxyModel::index | ( | int | row, | |
int | col, | |||
const QModelIndex & | index | |||
) | const [inherited] |
[reimplemented]
Definition at line 77 of file KDChartAbstractProxyModel.cpp.
References KDChart::AbstractProxyModel::mapFromSource(), and KDChart::AbstractProxyModel::mapToSource().
Referenced by headerData(), setHeaderData(), and setModelData().
void AttributesModel::initFrom | ( | const AttributesModel * | other | ) |
Copies the internal data (maps and palette) of another AttributesModel* into this one.
Definition at line 65 of file KDChartAttributesModel.cpp.
References paletteType(), and setPaletteType().
Referenced by KDChart::AbstractDiagram::setModel().
bool AttributesModel::isKnownAttributesRole | ( | int | role | ) | const |
Returns whether the given role corresponds to one of the known internally used ones.
Definition at line 433 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(), setData(), and setHeaderData().
QModelIndex KDChart::AbstractProxyModel::mapFromSource | ( | const QModelIndex & | sourceIndex | ) | const [inherited] |
[reimplemented]
Definition at line 45 of file KDChartAbstractProxyModel.cpp.
Referenced by KDChart::AbstractProxyModel::index(), and KDChart::AbstractProxyModel::parent().
QModelIndex KDChart::AbstractProxyModel::mapToSource | ( | const QModelIndex & | proxyIndex | ) | const [inherited] |
[reimplemented]
Definition at line 58 of file KDChartAbstractProxyModel.cpp.
Referenced by columnCount(), data(), KDChart::AbstractProxyModel::index(), KDChart::AbstractProxyModel::parent(), rowCount(), and setData().
QVariant KDChart::AttributesModel::modelData | ( | int | role | ) | const |
Definition at line 533 of file KDChartAttributesModel.cpp.
Referenced by data(), KDChart::AbstractDiagram::dataValueAttributes(), defaultHeaderData(), and KDChart::AbstractDiagram::isHidden().
const QMap< int, QVariant > AttributesModel::modelDataMap | ( | ) | const [protected] |
needed for serialization
Definition at line 684 of file KDChartAttributesModel.cpp.
AttributesModel::PaletteType AttributesModel::paletteType | ( | ) | const |
Definition at line 517 of file KDChartAttributesModel.cpp.
Referenced by compare(), defaultHeaderData(), and initFrom().
QModelIndex KDChart::AbstractProxyModel::parent | ( | const QModelIndex & | index | ) | const [inherited] |
[reimplemented]
Definition at line 83 of file KDChartAbstractProxyModel.cpp.
References KDChart::AbstractProxyModel::mapFromSource(), and KDChart::AbstractProxyModel::mapToSource().
bool AttributesModel::resetData | ( | const QModelIndex & | index, | |
int | role = Qt::DisplayRole | |||
) |
Remove any explicit attributes settings that might have been specified before.
Definition at line 478 of file KDChartAttributesModel.cpp.
References 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 507 of file KDChartAttributesModel.cpp.
References setHeaderData().
int AttributesModel::rowCount | ( | const QModelIndex & | index | ) | const |
[reimplemented]
Definition at line 538 of file KDChartAttributesModel.cpp.
References KDChart::AbstractProxyModel::mapToSource().
Referenced by KDChart::AbstractDiagram::itemRowLabels(), setHeaderData(), and setModelData().
bool AttributesModel::setData | ( | const QModelIndex & | index, | |
const QVariant & | value, | |||
int | role = Qt::DisplayRole | |||
) |
[reimplemented]
Definition at line 464 of file KDChartAttributesModel.cpp.
References attributesChanged(), dataMap(), isKnownAttributesRole(), and KDChart::AbstractProxyModel::mapToSource().
Referenced by resetData(), KDChart::BarDiagram::setBarAttributes(), KDChart::AbstractDiagram::setBrush(), and KDChart::AbstractDiagram::setPen().
void AttributesModel::setDataMap | ( | const QMap< int, QMap< int, QMap< int, QVariant > > > | map | ) | [protected] |
needed for serialization
Definition at line 690 of file KDChartAttributesModel.cpp.
void AttributesModel::setDefaultForRole | ( | int | role, | |
const QVariant & | value | |||
) |
Define the default value for a certain role.
Passing a default-constructed QVariant is equivalent to removing the default.
Definition at line 710 of file KDChartAttributesModel.cpp.
Referenced by AttributesModel(), and KDChart::TernaryLineDiagram::TernaryLineDiagram().
bool AttributesModel::setHeaderData | ( | int | section, | |
Qt::Orientation | orientation, | |||
const QVariant & | value, | |||
int | role = Qt::DisplayRole | |||
) |
[reimplemented]
Definition at line 483 of file KDChartAttributesModel.cpp.
References attributesChanged(), dataMap(), headerData(), KDChart::AbstractProxyModel::index(), isKnownAttributesRole(), and rowCount().
Referenced by resetHeaderData().
void AttributesModel::setHorizontalHeaderDataMap | ( | const QMap< int, QMap< int, QVariant > > | map | ) | [protected] |
needed for serialization
Definition at line 695 of file KDChartAttributesModel.cpp.
bool KDChart::AttributesModel::setModelData | ( | const QVariant | value, | |
int | role | |||
) |
Definition at line 522 of file KDChartAttributesModel.cpp.
References attributesChanged(), columnCount(), KDChart::AbstractProxyModel::index(), and rowCount().
Referenced by KDChart::AbstractDiagram::setBrush(), and KDChart::AbstractDiagram::setPen().
void AttributesModel::setModelDataMap | ( | const QMap< int, QVariant > | map | ) | [protected] |
needed for serialization
Definition at line 705 of file KDChartAttributesModel.cpp.
void AttributesModel::setPaletteType | ( | AttributesModel::PaletteType | type | ) |
Sets the palettetype used by this attributesmodel.
Definition at line 512 of file KDChartAttributesModel.cpp.
Referenced by initFrom().
void AttributesModel::setSourceModel | ( | QAbstractItemModel * | sourceModel | ) |
[reimplemented]
Definition at line 556 of file KDChartAttributesModel.cpp.
Referenced by AttributesModel().
void AttributesModel::setVerticalHeaderDataMap | ( | const QMap< int, QMap< int, QVariant > > | map | ) | [protected] |
needed for serialization
Definition at line 700 of file KDChartAttributesModel.cpp.
const QMap< int, QMap< int, QVariant > > AttributesModel::verticalHeaderDataMap | ( | ) | const [protected] |
needed for serialization
Definition at line 679 of file KDChartAttributesModel.cpp.