Skip to content
Permalink
Browse files

[FIX] Show attribute table for layers without geometry

And add a message to the message log when an iterator is closed due to missing geometry
  • Loading branch information
m-kuhn committed Apr 2, 2013
1 parent 45b931b commit 1de8c76450e122be35a08ba485bd35810c08c367
@@ -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() );

loadAttributes();
@@ -302,7 +307,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 1de8c76

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