Public Types | Signals | Public Member Functions | Protected Member Functions

KDChart::AttributesModel Class Reference

A proxy model used for storing attributes. More...

#include <KDChartAttributesModel.h>

Inheritance diagram for KDChart::AttributesModel:
Inheritance graph
[legend]
Collaboration diagram for KDChart::AttributesModel:
Collaboration graph
[legend]

List of all members.

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 role) const
 Returns the data that were specified at global level, or the default data, or QVariant().
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().
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

Detailed Description

A proxy model used for storing attributes.

Definition at line 37 of file KDChartAttributesModel.h.


Member Enumeration Documentation

Enumerator:
PaletteTypeDefault 
PaletteTypeRainbow 
PaletteTypeSubdued 

Definition at line 44 of file KDChartAttributesModel.h.


Constructor & Destructor Documentation

AttributesModel::AttributesModel ( QAbstractItemModel *  model,
QObject parent = 0 
) [explicit]
AttributesModel::~AttributesModel (  ) 

Definition at line 61 of file KDChartAttributesModel.cpp.


Member Function Documentation

void KDChart::AttributesModel::attributesChanged ( const QModelIndex &  ,
const QModelIndex &   
) [signal]
int AttributesModel::columnCount ( const QModelIndex &  index  )  const
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
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().

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 ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const

[reimplemented]

Definition at line 393 of file KDChartAttributesModel.cpp.

References data(), dataMap(), and KDChart::AbstractProxyModel::mapToSource().

const QMap< int, QMap< int, QMap< int, QVariant > > > AttributesModel::dataMap (  )  const [protected]

needed for serialization

Definition at line 666 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]
QVariant AttributesModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
const QMap< int, QMap< int, QVariant > > AttributesModel::horizontalHeaderDataMap (  )  const [protected]

needed for serialization

Definition at line 671 of file KDChartAttributesModel.cpp.

QModelIndex KDChart::AbstractProxyModel::index ( int  row,
int  col,
const QModelIndex &  index 
) const [inherited]
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
QModelIndex KDChart::AbstractProxyModel::mapFromSource ( const QModelIndex &  sourceIndex  )  const [inherited]
QModelIndex KDChart::AbstractProxyModel::mapToSource ( const QModelIndex &  proxyIndex  )  const [inherited]
QVariant KDChart::AttributesModel::modelData ( int  role  )  const
const QMap< int, QVariant > AttributesModel::modelDataMap (  )  const [protected]

needed for serialization

Definition at line 681 of file KDChartAttributesModel.cpp.

AttributesModel::PaletteType AttributesModel::paletteType (  )  const

Definition at line 514 of file KDChartAttributesModel.cpp.

Referenced by compare(), defaultHeaderData(), and initFrom().

QModelIndex KDChart::AbstractProxyModel::parent ( const QModelIndex &  index  )  const [inherited]
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 504 of file KDChartAttributesModel.cpp.

References setHeaderData().

int AttributesModel::rowCount ( const QModelIndex &  index  )  const
bool AttributesModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::DisplayRole 
)
void AttributesModel::setDataMap ( const QMap< int, QMap< int, QMap< int, QVariant > > >  map  )  [protected]

needed for serialization

Definition at line 687 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 707 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 
)
void AttributesModel::setHorizontalHeaderDataMap ( const QMap< int, QMap< int, QVariant > >  map  )  [protected]

needed for serialization

Definition at line 692 of file KDChartAttributesModel.cpp.

bool KDChart::AttributesModel::setModelData ( const QVariant  value,
int  role 
)
void AttributesModel::setModelDataMap ( const QMap< int, QVariant >  map  )  [protected]

needed for serialization

Definition at line 702 of file KDChartAttributesModel.cpp.

void AttributesModel::setPaletteType ( AttributesModel::PaletteType  type  ) 

Sets the palettetype used by this attributesmodel.

Definition at line 509 of file KDChartAttributesModel.cpp.

Referenced by initFrom().

void AttributesModel::setSourceModel ( QAbstractItemModel *  sourceModel  ) 

[reimplemented]

Definition at line 553 of file KDChartAttributesModel.cpp.

Referenced by AttributesModel().

void AttributesModel::setVerticalHeaderDataMap ( const QMap< int, QMap< int, QVariant > >  map  )  [protected]

needed for serialization

Definition at line 697 of file KDChartAttributesModel.cpp.

const QMap< int, QMap< int, QVariant > > AttributesModel::verticalHeaderDataMap (  )  const [protected]

needed for serialization

Definition at line 676 of file KDChartAttributesModel.cpp.


The documentation for this class was generated from the following files: