Skip to content

Commit

Permalink
Merge pull request #1738 from mbernasocchi/emit-saved-as
Browse files Browse the repository at this point in the history
added layerSavedAs signal
  • Loading branch information
NathanW2 committed Dec 21, 2014
2 parents df06057 + 729bdec commit 07182b6
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/gui/qgisinterface.sip
Expand Up @@ -522,4 +522,9 @@ class QgisInterface : QObject
signal for when this happens.
*/
void newProjectCreated();
/**This signal is emitted when a layer has been saved using save as
@note
added in version 2.7
*/
void layerSavedAs( QgsMapLayer* l, QString path );
};
5 changes: 5 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -5000,6 +5000,10 @@ void QgisApp::saveAsRasterFile()
QMessageBox::Ok );

}
else
{
emit layerSavedAs( rasterLayer, d.outputFileName() );
}
delete pipe;
}
}
Expand Down Expand Up @@ -5146,6 +5150,7 @@ void QgisApp::saveAsVectorFileGeneral( QgsVectorLayer* vlayer, bool symbologyOpt
{
addVectorLayers( QStringList( newFilename ), encoding, "file" );
}
emit layerSavedAs( vlayer, vectorFilename );
messageBar()->pushMessage( tr( "Saving done" ),
tr( "Export to vector file has been completed" ),
QgsMessageBar::INFO, messageTimeout() );
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgisapp.h
Expand Up @@ -1254,6 +1254,11 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow

void customSrsValidation( QgsCoordinateReferenceSystem &crs );

/**This signal is emitted when a layer has been saved using save as
@note added in version 2.7
*/
void layerSavedAs( QgsMapLayer* l, QString path );

private:
/** This method will open a dialog so the user can select GDAL sublayers to load
* @returns true if any items were loaded
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgisappinterface.cpp
Expand Up @@ -65,6 +65,8 @@ QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
this, SIGNAL( newProjectCreated() ) );
connect( qgis, SIGNAL( projectRead() ),
this, SIGNAL( projectRead() ) );
connect( qgis, SIGNAL( layerSavedAs( QgsMapLayer*, QString ) ),
this, SIGNAL( layerSavedAs(QgsMapLayer*, QString ) ) );
}

QgisAppInterface::~QgisAppInterface()
Expand Down
6 changes: 6 additions & 0 deletions src/gui/qgisinterface.h
Expand Up @@ -575,6 +575,12 @@ class GUI_EXPORT QgisInterface : public QObject
signal for when this happens.
*/
void newProjectCreated();

/**This signal is emitted when a layer has been saved using save as
@note
added in version 2.7
*/
void layerSavedAs( QgsMapLayer* l, QString path );
};

// FIXME: also in core/qgis.h
Expand Down

0 comments on commit 07182b6

Please sign in to comment.