Skip to content

Commit

Permalink
forceRelaod function including requesting feature reset
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Dec 6, 2019
1 parent 2f5d210 commit e5b0c9d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -343,6 +343,15 @@ void QgsPostgresProvider::setListening( bool isListening )
}
}

void QgsPostgresProvider::forceReload()
{
mShared->setFeaturesCounted( -1 );
mLayerExtent.setMinimal();

QgsVectorDataProvider::forceReload();
}


QgsPostgresConn *QgsPostgresProvider::connectionRW()
{
if ( mTransaction )
Expand Down Expand Up @@ -3323,11 +3332,13 @@ bool QgsPostgresProvider::setSubsetString( const QString &theSQL, bool updateFea

if ( updateFeatureCount )
{
mShared->setFeaturesCounted( -1 );
forceReload();
}
else
{
mLayerExtent.setMinimal();
QgsVectorDataProvider::forceReload();
}
mLayerExtent.setMinimal();

emit dataChanged();

return true;
}
Expand Down
8 changes: 8 additions & 0 deletions src/providers/postgres/qgspostgresprovider.h
Expand Up @@ -240,6 +240,14 @@ class QgsPostgresProvider : public QgsVectorDataProvider
*/
void setListening( bool isListening ) override;

/**
* Effect a reload including resetting the feature count
* and setting the layer extent to minimal
*
* \since QGIS 3.12
*/
void forceReload() override;

private:
Relkind relkind() const;

Expand Down

0 comments on commit e5b0c9d

Please sign in to comment.