mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Show commit errors in transaction mode
This commit is contained in:
parent
70ae301310
commit
e0fc641402
@ -467,8 +467,15 @@ class QgsProject : QObject
|
||||
*/
|
||||
void variablesChanged();
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* Emitted whenever a new transaction group has been created or a
|
||||
* transaction group has been removed.
|
||||
*
|
||||
* @note Added in QGIS 3.0
|
||||
*/
|
||||
void transactionGroupsChanged();
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* Flag the project as dirty (modified). If this flag is set, the user will
|
||||
* be asked to save changes to the project before closing the current project.
|
||||
|
@ -2773,6 +2773,8 @@ void QgisApp::setupConnections()
|
||||
connect( this, SIGNAL( projectRead() ),
|
||||
this, SLOT( fileOpenedOKAfterLaunch() ) );
|
||||
|
||||
connect( QgsProject::instance(), &QgsProject::transactionGroupsChanged, this, &QgisApp::onTransactionGroupsChanged );
|
||||
|
||||
// connect preview modes actions
|
||||
connect( mActionPreviewModeOff, SIGNAL( triggered() ), this, SLOT( disablePreviewMode() ) );
|
||||
connect( mActionPreviewModeGrayscale, SIGNAL( triggered() ), this, SLOT( activateGrayscalePreview() ) );
|
||||
@ -11201,6 +11203,14 @@ void QgisApp::keyPressEvent( QKeyEvent * e )
|
||||
}
|
||||
}
|
||||
|
||||
void QgisApp::onTransactionGroupsChanged()
|
||||
{
|
||||
Q_FOREACH ( QgsTransactionGroup* tg, QgsProject::instance()->transactionGroups().values() )
|
||||
{
|
||||
connect( tg, SIGNAL( commitError( QString ) ), this, SLOT( displayMessage( QString, QString, QgsMessageBar::MessageLevel ) ), Qt::UniqueConnection );
|
||||
}
|
||||
}
|
||||
|
||||
void QgisApp::startProfile( const QString& name )
|
||||
{
|
||||
mProfiler->start( name );
|
||||
|
@ -726,6 +726,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
void onTransactionGroupsChanged();
|
||||
|
||||
//! validate a SRS
|
||||
void validateCrs( QgsCoordinateReferenceSystem &crs );
|
||||
|
||||
|
@ -995,6 +995,8 @@ void QgsProject::onMapLayersAdded( const QList<QgsMapLayer*>& layers )
|
||||
{
|
||||
QMap<QString, QgsMapLayer*> existingMaps = QgsMapLayerRegistry::instance()->mapLayers();
|
||||
|
||||
bool tgChanged = false;
|
||||
|
||||
Q_FOREACH ( QgsMapLayer* layer, layers )
|
||||
{
|
||||
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer*>( layer );
|
||||
@ -1013,8 +1015,7 @@ void QgsProject::onMapLayersAdded( const QList<QgsMapLayer*>& layers )
|
||||
{
|
||||
tg = new QgsTransactionGroup();
|
||||
mTransactionGroups.insert( qMakePair( key, connString ), tg );
|
||||
|
||||
connect( tg, SIGNAL( commitError( QString ) ), this, SLOT( displayMapToolMessage( QString ) ) );
|
||||
tgChanged = true;
|
||||
}
|
||||
tg->addLayer( vlayer );
|
||||
}
|
||||
@ -1022,6 +1023,9 @@ void QgsProject::onMapLayersAdded( const QList<QgsMapLayer*>& layers )
|
||||
vlayer->dataProvider()->setProviderProperty( QgsVectorDataProvider::EvaluateDefaultValues, evaluateDefaultValues() );
|
||||
}
|
||||
|
||||
if ( tgChanged )
|
||||
emit transactionGroupsChanged();
|
||||
|
||||
connect( layer, SIGNAL( configChanged() ), this, SLOT( setDirty() ) );
|
||||
|
||||
// check if we have to update connections for layers with dependencies
|
||||
@ -1039,18 +1043,22 @@ void QgsProject::onMapLayersAdded( const QList<QgsMapLayer*>& layers )
|
||||
|
||||
void QgsProject::cleanTransactionGroups( bool force )
|
||||
{
|
||||
bool changed = false;
|
||||
for ( QMap< QPair< QString, QString>, QgsTransactionGroup*>::Iterator tg = mTransactionGroups.begin(); tg != mTransactionGroups.end(); )
|
||||
{
|
||||
if ( tg.value()->isEmpty() || force )
|
||||
{
|
||||
delete tg.value();
|
||||
tg = mTransactionGroups.erase( tg );
|
||||
changed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
++tg;
|
||||
}
|
||||
}
|
||||
if ( changed )
|
||||
emit transactionGroupsChanged();
|
||||
}
|
||||
|
||||
bool QgsProject::read( QDomNode &layerNode )
|
||||
|
@ -513,9 +513,11 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
|
||||
//! emitted when an old project file is read.
|
||||
void oldProjectVersionWarning( const QString& );
|
||||
|
||||
//! emitted when a layer from a projects was read
|
||||
// @param i current layer
|
||||
// @param n number of layers
|
||||
/**
|
||||
* Emitted when a layer from a projects was read.
|
||||
* @param i current layer
|
||||
* @param n number of layers
|
||||
*/
|
||||
void layerLoaded( int i, int n );
|
||||
|
||||
void loadingLayer( const QString& );
|
||||
@ -536,8 +538,15 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
|
||||
*/
|
||||
void variablesChanged();
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* Emitted whenever a new transaction group has been created or a
|
||||
* transaction group has been removed.
|
||||
*
|
||||
* @note Added in QGIS 3.0
|
||||
*/
|
||||
void transactionGroupsChanged();
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* Flag the project as dirty (modified). If this flag is set, the user will
|
||||
* be asked to save changes to the project before closing the current project.
|
||||
|
Loading…
x
Reference in New Issue
Block a user