@@ -1088,9 +1088,9 @@ int QgsStyleManagerDialog::addTag()
10881088
10891089 // block the auto-repopulation of groups when the style emits groupsModified
10901090 // instead, we manually update the model items for better state retention
1091- mBlockGroupUpdates = true ;
1091+ mBlockGroupUpdates ++ ;
10921092 id = mStyle ->addTag ( itemName );
1093- mBlockGroupUpdates = false ;
1093+ mBlockGroupUpdates -- ;
10941094
10951095 if ( !id )
10961096 {
@@ -1130,9 +1130,9 @@ int QgsStyleManagerDialog::addSmartgroup()
11301130
11311131 // block the auto-repopulation of groups when the style emits groupsModified
11321132 // instead, we manually update the model items for better state retention
1133- mBlockGroupUpdates = true ;
1133+ mBlockGroupUpdates ++ ;
11341134 id = mStyle ->addSmartgroup ( dlg.smartgroupName (), dlg.conditionOperator (), dlg.conditionMap () );
1135- mBlockGroupUpdates = false ;
1135+ mBlockGroupUpdates -- ;
11361136
11371137 if ( !id )
11381138 return 0 ;
@@ -1166,7 +1166,7 @@ void QgsStyleManagerDialog::removeGroup()
11661166
11671167 // block the auto-repopulation of groups when the style emits groupsModified
11681168 // instead, we manually update the model items for better state retention
1169- mBlockGroupUpdates = true ;
1169+ mBlockGroupUpdates ++ ;
11701170
11711171 if ( parentItem->data ( Qt::UserRole + 1 ).toString () == QLatin1String ( " smartgroups" ) )
11721172 {
@@ -1177,7 +1177,7 @@ void QgsStyleManagerDialog::removeGroup()
11771177 mStyle ->remove ( QgsStyle::TagEntity, index.data ( Qt::UserRole + 1 ).toInt () );
11781178 }
11791179
1180- mBlockGroupUpdates = false ;
1180+ mBlockGroupUpdates -- ;
11811181 parentItem->removeRow ( index.row () );
11821182}
11831183
@@ -1186,6 +1186,7 @@ void QgsStyleManagerDialog::groupRenamed( QStandardItem *item )
11861186 QgsDebugMsg ( QStringLiteral ( " Symbol group edited: data=%1 text=%2" ).arg ( item->data ( Qt::UserRole + 1 ).toString (), item->text () ) );
11871187 int id = item->data ( Qt::UserRole + 1 ).toInt ();
11881188 QString name = item->text ();
1189+ mBlockGroupUpdates ++;
11891190 if ( item->parent ()->data ( Qt::UserRole + 1 ) == " smartgroups" )
11901191 {
11911192 mStyle ->rename ( QgsStyle::SmartgroupEntity, id, name );
@@ -1194,6 +1195,7 @@ void QgsStyleManagerDialog::groupRenamed( QStandardItem *item )
11941195 {
11951196 mStyle ->rename ( QgsStyle::TagEntity, id, name );
11961197 }
1198+ mBlockGroupUpdates --;
11971199}
11981200
11991201void QgsStyleManagerDialog::tagSymbolsAction ()
@@ -1548,8 +1550,10 @@ void QgsStyleManagerDialog::editSmartgroupAction()
15481550 if ( dlg.exec () == QDialog::Rejected )
15491551 return ;
15501552
1553+ mBlockGroupUpdates ++;
15511554 mStyle ->remove ( QgsStyle::SmartgroupEntity, item->data ().toInt () );
15521555 int id = mStyle ->addSmartgroup ( dlg.smartgroupName (), dlg.conditionOperator (), dlg.conditionMap () );
1556+ mBlockGroupUpdates --;
15531557 if ( !id )
15541558 {
15551559 QMessageBox::critical ( this , tr ( " Edit Smart Group" ),
0 commit comments