File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -414,7 +414,17 @@ void QgsProject::setDirty( bool b )
414414
415415void QgsProject::setFileName ( const QString& name )
416416{
417+ if ( name == imp_->file .fileName () )
418+ return ;
419+
420+ QString oldHomePath = homePath ();
421+
417422 imp_->file .setFileName ( name );
423+ emit fileNameChanged ();
424+
425+ QString newHomePath = homePath ();
426+ if ( newHomePath != oldHomePath )
427+ emit homePathChanged ();
418428
419429 setDirty ( true );
420430}
Original file line number Diff line number Diff line change @@ -72,6 +72,8 @@ class CORE_EXPORT QgsProject : public QObject
7272{
7373 Q_OBJECT
7474 Q_PROPERTY ( QStringList nonIdentifiableLayers READ nonIdentifiableLayers WRITE setNonIdentifiableLayers NOTIFY nonIdentifiableLayersChanged )
75+ Q_PROPERTY ( QString fileName READ fileName WRITE setFileName NOTIFY fileNameChanged )
76+ Q_PROPERTY ( QString homePath READ homePath NOTIFY homePathChanged )
7577
7678 public:
7779
@@ -455,6 +457,12 @@ class CORE_EXPORT QgsProject : public QObject
455457 // ! Emitted when the list of layer which are excluded from map identification changes
456458 void nonIdentifiableLayersChanged ( QStringList nonIdentifiableLayers );
457459
460+ // ! Emitted when the file name of the project changes
461+ void fileNameChanged ();
462+
463+ // ! Emitted when the home path of the project changes
464+ void homePathChanged ();
465+
458466 public slots:
459467
460468 /* *
You can’t perform that action at this time.
0 commit comments