Skip to content
Permalink
Browse files

Handle item flags for action column

  • Loading branch information
m-kuhn committed May 2, 2016
1 parent e57edc3 commit c5d00f09d08c0be3f02c2b599a4839c22578c5ca
@@ -468,3 +468,13 @@ QModelIndex QgsAttributeTableFilterModel::mapFromSource( const QModelIndex& sour

return index( proxyIndex.row(), mColumnMapping.indexOf( proxyIndex.column() ), proxyIndex.parent() );
}

Qt::ItemFlags QgsAttributeTableFilterModel::flags( const QModelIndex& index ) const
{
// Handle the action column flags here, the master model doesn't know it
if ( mColumnMapping.at( index.column() ) == -1 )
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;

QModelIndex source_index = mapToSource( index );
return masterModel()->flags( source_index );
}
@@ -167,6 +167,8 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub

virtual QModelIndex mapFromSource( const QModelIndex& sourceIndex ) const override;

Qt::ItemFlags flags( const QModelIndex &index ) const override;

/**
* Sort by the given column using the given order.
* Prefetches all the data from the layer to speed up sorting.
@@ -59,6 +59,8 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
{
QgsFeatureIds ids;

QgsDebugMsg( QString( "Index count: %1" ).arg( selection.indexes().size() ) );

Q_FOREACH ( const QModelIndex& index, selection.indexes() )
{
QgsFeatureId id = index.model()->data( index, QgsAttributeTableModel::FeatureIdRole ).toLongLong();

0 comments on commit c5d00f0

Please sign in to comment.
You can’t perform that action at this time.