KD Chart 2
[rev.2.7]
|
DatasetProxyModel takes a KDChart dataset configuration and translates it into a filtering proxy model. More...
#include <KDChartDatasetProxyModel.h>
Public Slots | |
void | resetDatasetDescriptions () |
Reset all dataset description. More... | |
void | setDatasetColumnDescriptionVector (const DatasetDescriptionVector &columnConfig) |
Configure the dataset selection for the columns. More... | |
void | setDatasetDescriptionVectors (const DatasetDescriptionVector &rowConfig, const DatasetDescriptionVector &columnConfig) |
Convenience method to configure rows and columns in one step. More... | |
void | setDatasetRowDescriptionVector (const DatasetDescriptionVector &rowConfig) |
Configure the dataset selection for the rows. More... | |
Public Member Functions | |
QModelIndex | buddy (const QModelIndex &index) const override |
QVariant | data (const QModelIndex &index, int role) const override |
Overloaded from base class. More... | |
DatasetProxyModel (QObject *parent=0) | |
Create a DatasetProxyModel. More... | |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
Overloaded from base class. More... | |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
QModelIndex | mapFromSource (const QModelIndex &sourceIndex) const override |
Implements the mapping from the source to the proxy indexes. More... | |
QModelIndex | mapToSource (const QModelIndex &proxyIndex) const override |
Implements the mapping from the proxy to the source indexes. More... | |
QModelIndex | parent (const QModelIndex &child) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role) override |
Overloaded from base class. More... | |
void | setSourceModel (QAbstractItemModel *sourceModel) override |
Overloaded from base class. More... | |
void | setSourceRootIndex (const QModelIndex &rootIdx) |
Set the root index of the table in the source model. More... | |
Protected Member Functions | |
bool | filterAcceptsColumn (int sourceColumn, const QModelIndex &) const override |
Decide whether the column is accepted. More... | |
bool | filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override |
Decide whether the row is accepted. More... | |
DatasetProxyModel takes a KDChart dataset configuration and translates it into a filtering proxy model.
The resulting model will only contain the part of the model that is selected by the dataset, and the according row and column header data.
Currently, this model is implemented for table models only. The way it would work with models representing a tree is to be decided.
The column selection is configured by passing a dataset description vector to the model. This vector (of integers) is supposed to have one value for each column of the original model. If the value at position x is -1, column x of the original model is not included in the dataset. If it is between 0 and (columnCount() -1), it is the column the source column is mapped to in the resulting model. Any other value is an error.
Definition at line 55 of file KDChartDatasetProxyModel.h.
|
explicit |
Create a DatasetProxyModel.
Without further configuration, this model is invalid.
Definition at line 32 of file KDChartDatasetProxyModel.cpp.
|
override |
Definition at line 37 of file KDChartDatasetProxyModel.cpp.
References index().
|
override |
Overloaded from base class.
Definition at line 216 of file KDChartDatasetProxyModel.cpp.
References mapToSource().
|
overrideprotected |
Decide whether the column is accepted.
Definition at line 143 of file KDChartDatasetProxyModel.cpp.
|
overrideprotected |
Decide whether the row is accepted.
Definition at line 123 of file KDChartDatasetProxyModel.cpp.
|
override |
Definition at line 42 of file KDChartDatasetProxyModel.cpp.
References mapToSource().
|
override |
Overloaded from base class.
Definition at line 226 of file KDChartDatasetProxyModel.cpp.
References index().
|
override |
Definition at line 75 of file KDChartDatasetProxyModel.cpp.
References mapFromSource().
Referenced by buddy(), and headerData().
|
override |
Implements the mapping from the source to the proxy indexes.
Definition at line 89 of file KDChartDatasetProxyModel.cpp.
|
override |
|
override |
Definition at line 83 of file KDChartDatasetProxyModel.cpp.
References mapFromSource(), and mapToSource().
|
slot |
Reset all dataset description.
After that, the result of the proxying is an empty model (a new dataset description needs to be set to achieve a non-empty result).
Definition at line 207 of file KDChartDatasetProxyModel.cpp.
Referenced by setSourceModel(), and setSourceRootIndex().
|
override |
Overloaded from base class.
Definition at line 221 of file KDChartDatasetProxyModel.cpp.
References mapToSource().
|
slot |
Configure the dataset selection for the columns.
Every call to this method resets the previous dataset description.
Definition at line 57 of file KDChartDatasetProxyModel.cpp.
Referenced by setDatasetDescriptionVectors().
|
slot |
Convenience method to configure rows and columns in one step.
Definition at line 67 of file KDChartDatasetProxyModel.cpp.
References setDatasetColumnDescriptionVector(), and setDatasetRowDescriptionVector().
|
slot |
Configure the dataset selection for the rows.
Every call to this method resets the previous dataset description.
Definition at line 47 of file KDChartDatasetProxyModel.cpp.
Referenced by setDatasetDescriptionVectors().
|
override |
Overloaded from base class.
Definition at line 276 of file KDChartDatasetProxyModel.cpp.
References resetDatasetDescriptions().
void DatasetProxyModel::setSourceRootIndex | ( | const QModelIndex & | rootIdx | ) |
Set the root index of the table in the source model.
Definition at line 292 of file KDChartDatasetProxyModel.cpp.
References resetDatasetDescriptions().