26 #include <QStringList>
28 using namespace KDGantt;
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"