Skip to content

Commit

Permalink
Don't even call addLayerListeners() when handling the QgsProject::onL…
Browse files Browse the repository at this point in the history
…ayersAdded signal
  • Loading branch information
nirvn committed May 27, 2023
1 parent 39f6c8d commit 6c70b25
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/core/layerobserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ void LayerObserver::onHomePathChanged()
void LayerObserver::onLayersAdded( const QList<QgsMapLayer *> &layers )
{
Q_UNUSED( layers );
addLayerListeners();
if ( !QFieldCloudUtils::getProjectId( mProject->fileName() ).isEmpty() )
{
addLayerListeners();
}
}


void LayerObserver::onBeforeCommitChanges()
{
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( sender() );
Expand Down Expand Up @@ -282,11 +284,6 @@ void LayerObserver::onEditingStopped()
void LayerObserver::addLayerListeners()
{
const QList<QgsMapLayer *> layers = mProject->mapLayers().values();

// we should keep track only of the layers on cloud projects
if ( QFieldCloudUtils::getProjectId( mProject->fileName() ).isEmpty() )
return;

for ( QgsMapLayer *layer : layers )
{
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( layer );
Expand Down

0 comments on commit 6c70b25

Please sign in to comment.