Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
blockAttributeTableUpdates: single signal with bool
- Loading branch information
|
@@ -9190,16 +9190,6 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel ) |
|
|
} |
|
|
|
|
|
|
|
|
void QgisApp::unblockAttributeTableUpdates( const QgsVectorLayer *layer ) |
|
|
{ |
|
|
emit attributeTableUpdateUnblocked( layer ); |
|
|
} |
|
|
|
|
|
void QgisApp::blockAttributeTableUpdates( const QgsVectorLayer *layer ) |
|
|
{ |
|
|
emit attributeTableUpdateBlocked( layer ); |
|
|
} |
|
|
|
|
|
void QgisApp::saveActiveLayerEdits() |
|
|
{ |
|
|
saveEdits( activeLayer(), true, true ); |
|
@@ -14162,3 +14152,8 @@ void QgisApp::triggerCrashHandler() |
|
|
RaiseException( 0x12345678, 0, 0, nullptr ); |
|
|
#endif |
|
|
} |
|
|
|
|
|
void QgisApp::blockAttributeTableUpdates( const QgsVectorLayer *layer, const bool blocked ) |
|
|
{ |
|
|
emit attributeTableUpdateBlocked( layer, blocked ); |
|
|
} |
|
@@ -1009,18 +1009,11 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow |
|
|
void triggerCrashHandler(); |
|
|
|
|
|
/** |
|
|
* Emits the signal to block updates for attribute tables connected a particular \a layer |
|
|
* Emits the signal to set the \a blocked state of attribute tables connected a particular \a layer |
|
|
* |
|
|
* \since QGIS 3.4 |
|
|
*/ |
|
|
void blockAttributeTableUpdates( const QgsVectorLayer *layer ); |
|
|
|
|
|
/** |
|
|
* Emits the signal to unblock updates for attribute tables connected a particular \a layer |
|
|
* |
|
|
* \since QGIS 3.4 |
|
|
*/ |
|
|
void unblockAttributeTableUpdates( const QgsVectorLayer *layer ); |
|
|
void blockAttributeTableUpdates( const QgsVectorLayer *layer, const bool blocked ); |
|
|
|
|
|
protected: |
|
|
|
|
@@ -1756,18 +1749,11 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow |
|
|
void activeLayerChanged( QgsMapLayer *layer ); |
|
|
|
|
|
/** |
|
|
* Emitted when attribute table updates for a particular \a layer must be blocked |
|
|
* |
|
|
* \since QGIS 3.4 |
|
|
*/ |
|
|
void attributeTableUpdateBlocked( const QgsVectorLayer *layer ); |
|
|
|
|
|
/** |
|
|
* Emitted when all attribute table updates for a particular \a layer must be unblocked |
|
|
* Emitted when \a blocked status of attribute table updates for a particular \a layer must change |
|
|
* |
|
|
* \since QGIS 3.4 |
|
|
*/ |
|
|
void attributeTableUpdateUnblocked( const QgsVectorLayer *layer ); |
|
|
void attributeTableUpdateBlocked( const QgsVectorLayer *layer, const bool blocked ); |
|
|
|
|
|
private: |
|
|
void startProfile( const QString &name ); |
|
|
|
@@ -112,15 +112,10 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *layer, QgsAttr |
|
|
connect( mMainView, &QgsDualView::showContextMenuExternally, this, &QgsAttributeTableDialog::showContextMenu ); |
|
|
|
|
|
// Block/unblock table updates (feature cache signals) |
|
|
connect( QgisApp::instance(), &QgisApp::attributeTableUpdateBlocked, [ = ]( const QgsVectorLayer * layer ) |
|
|
connect( QgisApp::instance(), &QgisApp::attributeTableUpdateBlocked, [ = ]( const QgsVectorLayer * layer, const bool blocked ) |
|
|
{ |
|
|
if ( layer == mLayer ) |
|
|
this->blockCacheUpdateSignals( true ); |
|
|
} ); |
|
|
connect( QgisApp::instance(), &QgisApp::attributeTableUpdateUnblocked, [ = ]( const QgsVectorLayer * layer ) |
|
|
{ |
|
|
if ( layer == mLayer ) |
|
|
this->blockCacheUpdateSignals( false ); |
|
|
this->blockCacheUpdateSignals( blocked ); |
|
|
} ); |
|
|
// Massive rollbacks can also freeze the GUI due to the feature cache signals |
|
|
connect( mLayer, &QgsVectorLayer::beforeRollBack, [ = ] { this->blockCacheUpdateSignals( true ); } ); |
|
|
|
@@ -269,7 +269,7 @@ void QgsFieldCalculator::accept() |
|
|
|
|
|
// Begin feature modifications, block updates for attr tables |
|
|
// connected to this layer |
|
|
QgisApp::instance()->blockAttributeTableUpdates( mVectorLayer ); |
|
|
QgisApp::instance()->blockAttributeTableUpdates( mVectorLayer, true ); |
|
|
|
|
|
//go through all the features and change the new attribute |
|
|
QgsFeature feature; |
|
@@ -321,7 +321,7 @@ void QgsFieldCalculator::accept() |
|
|
rownum++; |
|
|
} |
|
|
|
|
|
QgisApp::instance()->unblockAttributeTableUpdates( mVectorLayer ); |
|
|
QgisApp::instance()->blockAttributeTableUpdates( mVectorLayer, false ); |
|
|
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
|
|