26 #include <QStringList> 47 if ( !sourceIndex.isValid() )
49 assert( sourceIndex.model() == sourceModel() );
53 return createIndex( sourceIndex.row(), sourceIndex.column(), sourceIndex.internalPointer() );
57 #define ATTRIBUTE __attribute__((__may_alias__)) 67 const QAbstractItemModel *m;
74 if ( !proxyIndex.isValid() )
76 assert( proxyIndex.model() == this );
79 QModelIndex sourceIndex;
80 KDPrivateModelIndex* hack =
reinterpret_cast<KDPrivateModelIndex*
>(&sourceIndex);
81 hack->r = proxyIndex.row();
82 hack->c = proxyIndex.column();
83 hack->p = proxyIndex.internalPointer();
84 hack->m = sourceModel();
85 assert( sourceIndex.isValid() );
95 if ( sourceModel() ) sourceModel()->disconnect(
this );
96 BASE::setSourceModel( model );
105 connect( model, SIGNAL(dataChanged(
const QModelIndex&,
const QModelIndex&)),
109 connect( model, SIGNAL(columnsAboutToBeInserted(
const QModelIndex&,
int,
int)),
111 connect( model, SIGNAL(columnsInserted(
const QModelIndex&,
int,
int)),
113 connect( model, SIGNAL(columnsAboutToBeRemoved(
const QModelIndex&,
int,
int)),
115 connect( model, SIGNAL(columnsRemoved(
const QModelIndex&,
int,
int)),
118 connect( model, SIGNAL(rowsAboutToBeInserted(
const QModelIndex&,
int,
int)),
120 connect( model, SIGNAL(rowsInserted(
const QModelIndex&,
int,
int)),
122 connect( model, SIGNAL(rowsAboutToBeRemoved(
const QModelIndex&,
int,
int)),
124 connect( model, SIGNAL(rowsRemoved(
const QModelIndex&,
int,
int)),
153 emit layoutAboutToBeChanged();
182 beginInsertColumns(
mapFromSource( parentIdx ), start, end );
190 Q_UNUSED( parentIdx );
203 beginRemoveColumns(
mapFromSource( parentIdx ), start, end );
211 Q_UNUSED( parentIdx );
230 Q_UNUSED( parentIdx );
249 Q_UNUSED( parentIdx );
258 return sourceModel()->rowCount(
mapToSource( idx ) );
264 return sourceModel()->columnCount(
mapToSource( idx ) );
283 return sourceModel()->setData(
mapToSource( index ), value, role );
288 QModelIndexList source_indexes;
289 for (
int i = 0; i < indexes.count(); ++i)
291 return sourceModel()->mimeData(source_indexes);
296 if ((row == -1) && (column == -1))
297 return sourceModel()->dropMimeData(data, action, -1, -1,
mapToSource(parent));
298 int source_destination_row = -1;
299 int source_destination_column = -1;
300 QModelIndex source_parent;
303 source_destination_row = sourceModel()->rowCount(source_parent);
305 QModelIndex proxy_index =
index(row, column, parent);
306 QModelIndex source_index =
mapToSource(proxy_index);
307 source_destination_row = source_index.row();
308 source_destination_column = source_index.column();
309 source_parent = source_index.parent();
311 return sourceModel()->dropMimeData(data, action, source_destination_row, source_destination_column, source_parent);
316 return sourceModel()->mimeTypes();
321 return sourceModel()->supportedDropActions();
324 #include "moc_kdganttforwardingproxymodel.cpp" QMimeData * mimeData(const QModelIndexList &indexes) const override
virtual void sourceRowsRemoved(const QModelIndex &, int start, int end)
virtual void sourceModelAboutToBeReset()
virtual void sourceColumnsAboutToBeRemoved(const QModelIndex &idx, int start, int end)
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override
virtual void sourceColumnsAboutToBeInserted(const QModelIndex &idx, int start, int end)
void setSourceModel(QAbstractItemModel *model) override
~ForwardingProxyModel() override
virtual void sourceLayoutChanged()
Class only listed here to document inheritance of some KDChart classes.
virtual void sourceModelReset()
QModelIndex parent(const QModelIndex &idx) const override
virtual void sourceRowsAboutToBeInserted(const QModelIndex &idx, int start, int end)
virtual void sourceColumnsRemoved(const QModelIndex &idx, int start, int end)
int rowCount(const QModelIndex &idx=QModelIndex()) const override
ForwardingProxyModel(QObject *parent=0)
virtual void sourceDataChanged(const QModelIndex &from, const QModelIndex &to)
Qt::DropActions supportedDropActions() const override
QStringList mimeTypes() const override
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
virtual void sourceRowsAboutToBeRemoved(const QModelIndex &, int start, int end)
Class only listed here to document inheritance of some KDChart classes.
virtual void sourceRowsInserted(const QModelIndex &idx, int start, int end)
QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
int columnCount(const QModelIndex &idx=QModelIndex()) const override
virtual void sourceLayoutAboutToBeChanged()
virtual void sourceColumnsInserted(const QModelIndex &idx, int start, int end)