8 #include <QItemSelection>
11 : QAbstractProxyModel( parent )
29 connect(
mFilterModel, SIGNAL( rowsAboutToBeRemoved(
const QModelIndex&,
int,
int ) ), SLOT(
onBeginRemoveRows(
const QModelIndex&,
int,
int ) ) );
30 connect(
mFilterModel, SIGNAL( rowsRemoved(
const QModelIndex&,
int,
int ) ), SLOT(
onEndRemoveRows(
const QModelIndex&,
int,
int ) ) );
31 connect(
mFilterModel, SIGNAL( rowsAboutToBeInserted(
const QModelIndex&,
int,
int ) ), SLOT(
onBeginInsertRows(
const QModelIndex&,
int,
int ) ) );
32 connect(
mFilterModel, SIGNAL( rowsInserted(
const QModelIndex&,
int,
int ) ), SLOT(
onEndInsertRows(
const QModelIndex&,
int,
int ) ) );
34 connect(
mFilterModel, SIGNAL( layoutAboutToBeChanged() ),
this, SIGNAL( layoutAboutToBeChanged() ) );
35 connect(
mFilterModel, SIGNAL( layoutChanged() ),
this, SIGNAL( layoutChanged() ) );
56 if ( role == Qt::DisplayRole || role == Qt::EditRole )
67 if ( role == Qt::UserRole )
79 const QList<QgsFeatureId> addedFeatures = editBuffer->
addedFeatures().keys();
82 if ( addedFeatures.contains( feat.
id() ) )
84 featInfo.
isNew =
true;
86 if ( changedFeatures.contains( feat.
id() ) )
92 return QVariant::fromValue( featInfo );
95 return sourceModel()->data(
mapToSource( index ), role );
100 return sourceModel()->flags(
mapToSource( index ) ) & ~Qt::ItemIsEditable;
147 beginRemoveRows( parent, first, last );
160 beginInsertRows( parent, first, last );
173 if ( !proxyIndex.isValid() )
174 return QModelIndex();
181 if ( !sourceIndex.isValid() )
182 return QModelIndex();
189 return mapSelectionFromSource(
mFilterModel->mapSelectionFromSource( selection ) ) ;
194 return mFilterModel->mapSelectionToSource( mapSelectionToSource( selection ) ) ;
201 if ( !proxyIndex.isValid() )
202 return QModelIndex();
204 return sourceModel()->index( proxyIndex.row(), proxyIndex.column() );
209 if ( !sourceIndex.isValid() )
210 return QModelIndex();
212 return createIndex( sourceIndex.row(), 0 );
218 return createIndex( row, column );
224 return QModelIndex();
236 return sourceModel()->rowCount();
246 return QModelIndexList() <<
fidToIndex( fid );