@@ -111,6 +111,16 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *layer, QgsAttr
111
111
connect ( mActionExpressionSelect , &QAction::triggered, this , &QgsAttributeTableDialog::mActionExpressionSelect_triggered );
112
112
connect ( mMainView , &QgsDualView::showContextMenuExternally, this , &QgsAttributeTableDialog::showContextMenu );
113
113
114
+ // Block/unblock table updates (feature cache signals)
115
+ connect ( QgisApp::instance (), &QgisApp::attributeTableUpdateBlocked, [ = ]( const QgsVectorLayer * layer, const bool blocked )
116
+ {
117
+ if ( layer == mLayer )
118
+ this ->blockCacheUpdateSignals ( blocked );
119
+ } );
120
+ // Massive rollbacks can also freeze the GUI due to the feature cache signals
121
+ connect ( mLayer , &QgsVectorLayer::beforeRollBack, [ = ] { this ->blockCacheUpdateSignals ( true ); } );
122
+ connect ( mLayer , &QgsVectorLayer::afterRollBack, [ = ] { this ->blockCacheUpdateSignals ( false ); } );
123
+
114
124
const QgsFields fields = mLayer ->fields ();
115
125
for ( const QgsField &field : fields )
116
126
{
@@ -718,7 +728,6 @@ void QgsAttributeTableDialog::mActionOpenFieldCalculator_triggered()
718
728
if ( calc.exec () == QDialog::Accepted )
719
729
{
720
730
int col = masterModel->fieldCol ( calc.changedAttributeId () );
721
-
722
731
if ( col >= 0 )
723
732
{
724
733
masterModel->reload ( masterModel->index ( 0 , col ), masterModel->index ( masterModel->rowCount () - 1 , col ) );
@@ -1130,6 +1139,15 @@ void QgsAttributeTableDialog::setFilterExpression( const QString &filterString,
1130
1139
mMainView ->setFilterMode ( QgsAttributeTableFilterModel::ShowFilteredList );
1131
1140
}
1132
1141
1142
+ void QgsAttributeTableDialog::blockCacheUpdateSignals ( const bool block )
1143
+ {
1144
+ QgsAttributeTableModel *masterModel = mMainView ->masterModel ();
1145
+
1146
+ if ( ! masterModel )
1147
+ return ;
1148
+
1149
+ masterModel->layerCache ()->blockSignals ( block );
1150
+ }
1133
1151
1134
1152
void QgsAttributeTableDialog::deleteFeature ( const QgsFeatureId fid )
1135
1153
{
0 commit comments