Skip to content

Commit

Permalink
Create some properties on QgsProject
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jul 10, 2016
1 parent 3da1918 commit 9a917c4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/qgsproject.cpp
Expand Up @@ -414,7 +414,17 @@ void QgsProject::setDirty( bool b )

void QgsProject::setFileName( const QString& name )
{
if ( name == imp_->file.fileName() )
return;

QString oldHomePath = homePath();

imp_->file.setFileName( name );
emit fileNameChanged();

QString newHomePath = homePath();
if ( newHomePath != oldHomePath )
emit homePathChanged();

setDirty( true );
}
Expand Down
8 changes: 8 additions & 0 deletions src/core/qgsproject.h
Expand Up @@ -72,6 +72,8 @@ class CORE_EXPORT QgsProject : public QObject
{
Q_OBJECT
Q_PROPERTY( QStringList nonIdentifiableLayers READ nonIdentifiableLayers WRITE setNonIdentifiableLayers NOTIFY nonIdentifiableLayersChanged )
Q_PROPERTY( QString fileName READ fileName WRITE setFileName NOTIFY fileNameChanged )
Q_PROPERTY( QString homePath READ homePath NOTIFY homePathChanged )

public:

Expand Down Expand Up @@ -455,6 +457,12 @@ class CORE_EXPORT QgsProject : public QObject
//! Emitted when the list of layer which are excluded from map identification changes
void nonIdentifiableLayersChanged( QStringList nonIdentifiableLayers );

//! Emitted when the file name of the project changes
void fileNameChanged();

//! Emitted when the home path of the project changes
void homePathChanged();

public slots:

/**
Expand Down

0 comments on commit 9a917c4

Please sign in to comment.