8 #include <QItemSelection>
11 : QAbstractProxyModel( parent )
25 mFilterModel = sourceModel;
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 )
64 return mExpression->
evaluate( &feat, fields );
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 );
100 return QVariant::fromValue( feat );
103 return sourceModel()->data(
mapToSource( index ), role );
108 return sourceModel()->flags(
mapToSource( index ) ) & ~Qt::ItemIsEditable;
140 return mParserErrorString;
155 beginRemoveRows( parent, first, last );
168 beginInsertRows( parent, first, last );
181 if ( !proxyIndex.isValid() )
182 return QModelIndex();
184 return mFilterModel->
mapToMaster( mFilterModel->index( proxyIndex.row(), proxyIndex.column() ) );
189 if ( !sourceIndex.isValid() )
190 return QModelIndex();
192 return createIndex( mFilterModel->
mapFromMaster( sourceIndex ).row(), 0 );
197 return mapSelectionFromSource( mFilterModel->mapSelectionFromSource( selection ) );
202 return mFilterModel->mapSelectionToSource( mapSelectionToSource( selection ) );
209 if ( !proxyIndex.isValid() )
210 return QModelIndex();
212 return sourceModel()->index( proxyIndex.row(), proxyIndex.column() );
217 if ( !sourceIndex.isValid() )
218 return QModelIndex();
220 return createIndex( sourceIndex.row(), 0 );
226 return createIndex( row, column );
232 return QModelIndex();
244 return sourceModel()->rowCount();
254 return QModelIndexList() <<
fidToIndex( fid );