Skip to content
Permalink
Browse files

Merge pull request #498 from matthias-kuhn/feature-request-no-geom

[FIX] Show attribute table for layers without geometry
  • Loading branch information
jef-n committed Apr 3, 2013
2 parents cf4fd4a + 1de8c76 commit e3155706b04a9ec6437a1bd5c5f50506f514ba6e
@@ -36,6 +36,11 @@ QgsAttributeTableModel::QgsAttributeTableModel( QgsVectorLayerCache *layerCache,
{
QgsDebugMsg( "entered." );

if ( layerCache->layer()->geometryType() == QGis::NoGeometry )
{
mFeatureRequest.setFlags( QgsFeatureRequest::NoGeometry );
}

mFeat.setFeatureId( std::numeric_limits<int>::min() );

if ( !layer()->hasGeometryType() )
@@ -305,7 +310,7 @@ void QgsAttributeTableModel::loadLayer()
removeRows( 0, rowCount() );
endRemoveRows();

QgsFeatureIterator features = layer()->getFeatures( mFeatureRequest );
QgsFeatureIterator features = mLayerCache->getFeatures( mFeatureRequest );

int i = 0;

@@ -296,6 +296,7 @@ bool QgsPostgresFeatureIterator::declareCursor( const QString& whereClause )
bool fetchGeometry = !( mRequest.flags() & QgsFeatureRequest::NoGeometry );
if ( fetchGeometry && P->mGeometryColumn.isNull() )
{
QgsMessageLog::logMessage( QObject::tr( "Trying to fetch geometry on a layer without geometry." ), QObject::tr( "PostgreSQL" ) );
return false;
}

0 comments on commit e315570

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