Skip to content
Permalink
Browse files

Add QgsProject::write( filename ) convenience function

  • Loading branch information
m-kuhn committed Dec 21, 2016
1 parent 4644af3 commit cbac49b63bfa3beebb6331d9c0544f6775bdc991
Showing with 19 additions and 0 deletions.
  1. +1 −0 python/core/qgsproject.sip
  2. +7 −0 src/core/qgsproject.cpp
  3. +11 −0 src/core/qgsproject.h
@@ -144,6 +144,7 @@ class QgsProject : QObject, QgsExpressionContextGenerator
*
*/
bool read( QDomNode& layerNode );
bool write(const QString& filename);

/** Writes the project to a file.
* @param file destination file
@@ -1147,6 +1147,13 @@ bool QgsProject::read( QDomNode &layerNode )
return false;
}

bool QgsProject::write( const QString& filename )
{
mFile.setFileName( filename );

return write();
}

bool QgsProject::write( QFileInfo const &file )
{
mFile.setFileName( file.filePath() );
@@ -205,6 +205,17 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
*/
bool read( QDomNode& layerNode );

/**
* Writes the project to a file.
* @param file destination file
* @note calling this implicitly sets the project's filename (see setFileName() )
* @note isDirty() will be set to false if project is successfully written
* @returns true if project was written successfully
*
* \note Added in QGIS 3.0
*/
bool write( const QString& filename );

/** Writes the project to a file.
* @param file destination file
* @note calling this implicitly sets the project's filename (see setFileName() )

0 comments on commit cbac49b

Please sign in to comment.
You can’t perform that action at this time.