Skip to content

Commit 0e50b3b

Browse files
committedOct 16, 2018
Revert "Merge pull request #8177 from elpaso/bugfix-20094-field-calculator-slowness"
This reverts commit 096b4ce, reversing changes made to 87e0f69.
1 parent ee8e1ce commit 0e50b3b

11 files changed

+6
-73
lines changed
 

‎python/core/auto_generated/qgsapplication.sip.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,6 @@ Emits the signal to collect all the strings of .qgs to be included in ts file
824824
.. versionadded:: 3.4
825825
%End
826826

827-
828827
%If (ANDROID)
829828
//dummy method to workaround sip generation issue
830829
bool x11EventFilter( XEvent *event );
@@ -853,7 +852,6 @@ In order to register translatable strings, connect to this signal and register t
853852
.. versionadded:: 3.4
854853
%End
855854

856-
857855
};
858856

859857

‎python/core/auto_generated/qgsvectorlayer.sip.in

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,13 +2377,6 @@ Is emitted, before changes are committed to the data provider
23772377
void beforeRollBack();
23782378
%Docstring
23792379
Is emitted, before changes are rolled back
2380-
%End
2381-
2382-
void afterRollBack();
2383-
%Docstring
2384-
Is emitted, after changes are rolled back
2385-
2386-
.. versionadded:: 3.4
23872380
%End
23882381

23892382
void attributeAdded( int idx );

‎src/app/qgisapp.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7091,14 +7091,13 @@ void QgisApp::fieldCalculator()
70917091

70927092
void QgisApp::attributeTable( QgsAttributeTableFilterModel::FilterMode filter )
70937093
{
7094-
QgsVectorLayer *vectorLayer = qobject_cast<QgsVectorLayer *>( activeLayer() );
7095-
if ( !vectorLayer )
7094+
QgsVectorLayer *myLayer = qobject_cast<QgsVectorLayer *>( activeLayer() );
7095+
if ( !myLayer )
70967096
{
70977097
return;
70987098
}
70997099

7100-
QgsAttributeTableDialog *mDialog = new QgsAttributeTableDialog( vectorLayer, filter );
7101-
7100+
QgsAttributeTableDialog *mDialog = new QgsAttributeTableDialog( myLayer, filter );
71027101
mDialog->show();
71037102
// the dialog will be deleted by itself on close
71047103
}
@@ -9190,7 +9189,6 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel )
91909189
return res;
91919190
}
91929191

9193-
91949192
void QgisApp::saveActiveLayerEdits()
91959193
{
91969194
saveEdits( activeLayer(), true, true );
@@ -14148,8 +14146,3 @@ void QgisApp::triggerCrashHandler()
1414814146
RaiseException( 0x12345678, 0, 0, nullptr );
1414914147
#endif
1415014148
}
14151-
14152-
void QgisApp::blockAttributeTableUpdates( const QgsVectorLayer *layer, const bool blocked )
14153-
{
14154-
emit attributeTableUpdateBlocked( layer, blocked );
14155-
}

‎src/app/qgisapp.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,13 +1008,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
10081008
*/
10091009
void triggerCrashHandler();
10101010

1011-
/**
1012-
* Emits the signal to set the \a blocked state of attribute tables connected a particular \a layer
1013-
*
1014-
* \since QGIS 3.4
1015-
*/
1016-
void blockAttributeTableUpdates( const QgsVectorLayer *layer, const bool blocked );
1017-
10181011
protected:
10191012

10201013
//! Handle state changes (WindowTitleChange)
@@ -1743,13 +1736,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
17431736
*/
17441737
void activeLayerChanged( QgsMapLayer *layer );
17451738

1746-
/**
1747-
* Emitted when \a blocked status of attribute table updates for a particular \a layer must change
1748-
*
1749-
* \since QGIS 3.4
1750-
*/
1751-
void attributeTableUpdateBlocked( const QgsVectorLayer *layer, const bool blocked );
1752-
17531739
private:
17541740
void startProfile( const QString &name );
17551741
void endProfile();

‎src/app/qgsattributetabledialog.cpp

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,6 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *layer, QgsAttr
113113
connect( mActionExpressionSelect, &QAction::triggered, this, &QgsAttributeTableDialog::mActionExpressionSelect_triggered );
114114
connect( mMainView, &QgsDualView::showContextMenuExternally, this, &QgsAttributeTableDialog::showContextMenu );
115115

116-
// Block/unblock table updates (feature cache signals)
117-
connect( QgisApp::instance(), &QgisApp::attributeTableUpdateBlocked, this, [ = ]( const QgsVectorLayer * layer, const bool blocked )
118-
{
119-
if ( layer == mLayer )
120-
this->blockCacheUpdateSignals( blocked );
121-
} );
122-
// Massive rollbacks can also freeze the GUI due to the feature cache signals
123-
connect( mLayer, &QgsVectorLayer::beforeRollBack, this, [ = ] { this->blockCacheUpdateSignals( true ); } );
124-
connect( mLayer, &QgsVectorLayer::afterRollBack, this, [ = ] { this->blockCacheUpdateSignals( false ); } );
125-
126116
const QgsFields fields = mLayer->fields();
127117
for ( const QgsField &field : fields )
128118
{
@@ -743,6 +733,7 @@ void QgsAttributeTableDialog::mActionOpenFieldCalculator_triggered()
743733
if ( calc.exec() == QDialog::Accepted )
744734
{
745735
int col = masterModel->fieldCol( calc.changedAttributeId() );
736+
746737
if ( col >= 0 )
747738
{
748739
masterModel->reload( masterModel->index( 0, col ), masterModel->index( masterModel->rowCount() - 1, col ) );
@@ -1154,15 +1145,6 @@ void QgsAttributeTableDialog::setFilterExpression( const QString &filterString,
11541145
mMainView->setFilterMode( QgsAttributeTableFilterModel::ShowFilteredList );
11551146
}
11561147

1157-
void QgsAttributeTableDialog::blockCacheUpdateSignals( const bool block )
1158-
{
1159-
QgsAttributeTableModel *masterModel = mMainView->masterModel();
1160-
1161-
if ( ! masterModel )
1162-
return;
1163-
1164-
masterModel->layerCache()->blockSignals( block );
1165-
}
11661148

11671149
void QgsAttributeTableDialog::deleteFeature( const QgsFeatureId fid )
11681150
{

‎src/app/qgsattributetabledialog.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ class APP_EXPORT QgsAttributeTableDialog : public QDialog, private Ui::QgsAttrib
242242

243243
void updateMultiEditButtonState();
244244
void deleteFeature( QgsFeatureId fid );
245-
void blockCacheUpdateSignals( const bool block );
246245

247246
friend class TestQgsAttributeTable;
248247
};

‎src/app/qgsfieldcalculator.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,8 @@ void QgsFieldCalculator::accept()
159159
{
160160
builder->saveToRecent( QStringLiteral( "fieldcalc" ) );
161161

162-
if ( ! mVectorLayer )
163-
{
162+
if ( !mVectorLayer )
164163
return;
165-
}
166164

167165
// Set up QgsDistanceArea each time we (re-)calculate
168166
QgsDistanceArea myDa;
@@ -262,10 +260,6 @@ void QgsFieldCalculator::accept()
262260
return;
263261
}
264262

265-
// Begin feature modifications, block updates for attr tables
266-
// connected to this layer
267-
QgisApp::instance()->blockAttributeTableUpdates( mVectorLayer, true );
268-
269263
//go through all the features and change the new attribute
270264
QgsFeature feature;
271265
bool calculationSuccess = true;
@@ -326,8 +320,6 @@ void QgsFieldCalculator::accept()
326320
rownum++;
327321
}
328322

329-
QgisApp::instance()->blockAttributeTableUpdates( mVectorLayer, false );
330-
331323
if ( !calculationSuccess )
332324
{
333325
cursorOverride.release();
@@ -336,6 +328,7 @@ void QgsFieldCalculator::accept()
336328
mVectorLayer->destroyEditCommand();
337329
return;
338330
}
331+
339332
mVectorLayer->endEditCommand();
340333
}
341334
QDialog::accept();

‎src/core/qgsapplication.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,6 @@ void QgsApplication::collectTranslatableObjects( QgsTranslationContext *translat
15281528
emit requestForTranslatableObjects( translationContext );
15291529
}
15301530

1531-
15321531
QString QgsApplication::nullRepresentation()
15331532
{
15341533
ApplicationMembers *appMembers = members();

‎src/core/qgsapplication.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,6 @@ class CORE_EXPORT QgsApplication : public QApplication
757757
*/
758758
void collectTranslatableObjects( QgsTranslationContext *translationContext );
759759

760-
761760
#ifdef SIP_RUN
762761
SIP_IF_FEATURE( ANDROID )
763762
//dummy method to workaround sip generation issue
@@ -789,7 +788,6 @@ class CORE_EXPORT QgsApplication : public QApplication
789788
*/
790789
void requestForTranslatableObjects( QgsTranslationContext *translationContext );
791790

792-
793791
private:
794792

795793
static void copyPath( const QString &src, const QString &dst );

‎src/core/qgsvectorlayer.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,8 +2983,6 @@ bool QgsVectorLayer::rollBack( bool deleteBuffer )
29832983

29842984
mEditBuffer->rollBack();
29852985

2986-
emit afterRollBack();
2987-
29882986
if ( isModified() )
29892987
{
29902988
// new undo stack roll back method

‎src/core/qgsvectorlayer.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2173,12 +2173,6 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
21732173
//! Is emitted, before changes are rolled back
21742174
void beforeRollBack();
21752175

2176-
/**
2177-
* Is emitted, after changes are rolled back
2178-
* \since QGIS 3.4
2179-
*/
2180-
void afterRollBack();
2181-
21822176
/**
21832177
* Will be emitted, when a new attribute has been added to this vector layer.
21842178
* Applies only to types QgsFields::OriginEdit, QgsFields::OriginProvider and QgsFields::OriginExpression

0 commit comments

Comments
 (0)
Please sign in to comment.