Skip to content
Permalink
Browse files

vector cache: don't try to request geometries, if there aren't any

  • Loading branch information
jef-n committed Apr 2, 2013
1 parent 6e6b8fe commit 2b0d3e705d1e5a72f4dcdfddb87559042174c470
Showing with 9 additions and 6 deletions.
  1. +4 −4 src/core/qgsvectorlayercache.cpp
  2. +5 −2 src/gui/attributetable/qgsattributetablemodel.cpp
@@ -49,7 +49,7 @@ int QgsVectorLayerCache::cacheSize()

void QgsVectorLayerCache::setCacheGeometry( bool cacheGeometry )
{
mCacheGeometry = cacheGeometry;
mCacheGeometry = cacheGeometry && mLayer->hasGeometryType();
if ( cacheGeometry )
{
connect( mLayer, SIGNAL( geometryChanged( QgsFeatureId, QgsGeometry& ) ), SLOT( geometryChanged( QgsFeatureId, QgsGeometry& ) ) );
@@ -277,7 +277,7 @@ bool QgsVectorLayerCache::checkInformationCovered( const QgsFeatureRequest& feat
{
QgsAttributeList requestedAttributes;

if ( false == featureRequest.flags().testFlag( QgsFeatureRequest::SubsetOfAttributes ) )
if ( !featureRequest.flags().testFlag( QgsFeatureRequest::SubsetOfAttributes ) )
{
requestedAttributes = mLayer->pendingAllAttributesList();
}
@@ -296,8 +296,8 @@ bool QgsVectorLayerCache::checkInformationCovered( const QgsFeatureRequest& feat
}

// If the request needs geometry but we don't cache this...
if ( false == featureRequest.flags().testFlag( QgsFeatureRequest::NoGeometry )
&& false == mCacheGeometry )
if ( !featureRequest.flags().testFlag( QgsFeatureRequest::NoGeometry )
&& !mCacheGeometry )
{
return false;
}
@@ -31,13 +31,16 @@
#include <limits>

QgsAttributeTableModel::QgsAttributeTableModel( QgsVectorLayerCache *layerCache, QObject *parent )
: QAbstractTableModel( parent ),
mLayerCache( layerCache )
: QAbstractTableModel( parent )
, mLayerCache( layerCache )
{
QgsDebugMsg( "entered." );

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

if ( !layer()->hasGeometryType() )
mFeatureRequest.setFlags( QgsFeatureRequest::NoGeometry );

loadAttributes();

connect( layer(), SIGNAL( attributeValueChanged( QgsFeatureId, int, const QVariant& ) ), this, SLOT( attributeValueChanged( QgsFeatureId, int, const QVariant& ) ) );

0 comments on commit 2b0d3e7

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