15#include <KDABLibFakes>
38 "A source model must be set before the selection can be configured.");
40 mRowSrcToProxyMap, mRowProxyToSrcMap);
48 "A source model must be set before the selection can be configured.");
50 mColSrcToProxyMap, mColProxyToSrcMap);
66 mapProxyColumnToSource(column),
79 "model must be set before the selection can be configured.");
89 int column = mapSourceColumnToProxy(
sourceIndex.column());
97 "model must be set before the selection can be configured.");
104 int row = mapProxyRowToSource(
proxyIndex.row());
105 int column = mapProxyColumnToSource(
proxyIndex.column());
106 return sourceModel()->index(row, column, mRootIndex);
113 if (mRowSrcToProxyMap.
isEmpty()) {
118 if (mRowSrcToProxyMap[
sourceRow] == -1) {
131 if (mColSrcToProxyMap.
isEmpty()) {
146int DatasetProxyModel::mapProxyRowToSource(
const int &proxyRow)
const
148 if (mRowProxyToSrcMap.
isEmpty()) {
156int DatasetProxyModel::mapProxyColumnToSource(
const int &proxyColumn)
const
158 if (mColProxyToSrcMap.
isEmpty()) {
166int DatasetProxyModel::mapSourceRowToProxy(
const int &sourceRow)
const
168 if (mRowSrcToProxyMap.
isEmpty()) {
176int DatasetProxyModel::mapSourceColumnToProxy(
const int &sourceColumn)
const
178 if (mColSrcToProxyMap.
isEmpty()) {
188 mRowSrcToProxyMap.
clear();
189 mRowProxyToSrcMap.
clear();
190 mColSrcToProxyMap.
clear();
191 mColProxyToSrcMap.
clear();
208 if (mapProxyColumnToSource(section) == -1) {
211 return sourceModel()->headerData(mapProxyColumnToSource(section), orientation, role);
214 if (mapProxyRowToSource(section) == -1) {
217 return sourceModel()->headerData(mapProxyRowToSource(section), orientation, role);
222void DatasetProxyModel::initializeDatasetDecriptors(
224 const int sourceCount,
242 "DatasetProxyModel::initializeDatasetDecriptors",
243 "column index outside of source model");
245 "DatasetProxyModel::initializeDatasetDecriptors",
246 "no duplicates allowed in mapping configuration, mapping has to be reversible");
Qt::ItemFlags flags(const QModelIndex &index) const override
QVariant data(const QModelIndex &index, int role) const override
void setDatasetRowDescriptionVector(const DatasetDescriptionVector &rowConfig)
QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
bool filterAcceptsColumn(int sourceColumn, const QModelIndex &) const override
DatasetProxyModel(QObject *parent=nullptr)
void setSourceRootIndex(const QModelIndex &rootIdx)
void setSourceModel(QAbstractItemModel *sourceModel) override
bool setData(const QModelIndex &index, const QVariant &value, int role) override
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
QModelIndex buddy(const QModelIndex &index) const override
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override
void setDatasetDescriptionVectors(const DatasetDescriptionVector &rowConfig, const DatasetDescriptionVector &columnConfig)
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
void setDatasetColumnDescriptionVector(const DatasetDescriptionVector &columnConfig)
void resetDatasetDescriptions()
QModelIndex createIndex(int row, int column, void *ptr) const const
void layoutChanged(const QList< QPersistentModelIndex > &parents, QAbstractItemModel::LayoutChangeHint hint)
Qt::ItemFlags flags() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
QObject * parent() const const
T qobject_cast(QObject *object)
virtual int columnCount(const QModelIndex &parent) const const override
virtual int rowCount(const QModelIndex &parent) const const override
virtual void setSourceModel(QAbstractItemModel *sourceModel) override
const T & at(int i) const const
bool isEmpty() const const