Skip to content

Commit

Permalink
Rename QgsProject::projectDirty to isDirtyChanged
Browse files Browse the repository at this point in the history
Also show unsaved status in title bar even when project has
not been first saved
  • Loading branch information
nyalldawson committed Mar 6, 2018
1 parent 51286d9 commit a30403d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsproject.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ advertised by this signal.
:param layers: List of QgsMapLayer which were added to the legend.
%End

void projectDirty( const bool dirty );
void isDirtyChanged( bool dirty );
%Docstring
Emitted when the project dirty status changes.

Expand Down
2 changes: 1 addition & 1 deletion src/app/layout/qgslayoutdesignerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla
//listen out to status bar updates from the view
connect( mView, &QgsLayoutView::statusMessage, this, &QgsLayoutDesignerDialog::statusMessageReceived );

connect( QgsProject::instance(), &QgsProject::projectDirty, this, &QgsLayoutDesignerDialog::updateWindowTitle );
connect( QgsProject::instance(), &QgsProject::isDirtyChanged, this, &QgsLayoutDesignerDialog::updateWindowTitle );
}

QgsAppLayoutDesignerInterface *QgsLayoutDesignerDialog::iface()
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,10 @@ static void setTitleBarText_( QWidget &qgisApp )
}
if ( !caption.isEmpty() )
{
if ( QgsProject::instance()->isDirty() )
caption.prepend( '*' );
caption += " - ";
}
if ( QgsProject::instance()->isDirty() )
caption.prepend( '*' );

caption += QgisApp::tr( "QGIS" );

Expand Down Expand Up @@ -754,7 +754,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
mMapCanvas->setCanvasColor( QColor( myRed, myGreen, myBlue ) );
endProfile();

connect( QgsProject::instance(), &QgsProject::projectDirty, this, [ = ] { setTitleBarText_( *this ); } );
connect( QgsProject::instance(), &QgsProject::isDirtyChanged, this, [ = ] { setTitleBarText_( *this ); } );

// what type of project to auto-open
mProjOpen = settings.value( QStringLiteral( "qgis/projOpenAtLaunch" ), 0 ).toInt();
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ bool QgsProject::isDirty() const
void QgsProject::setDirty( bool b )
{
mDirty = b;
emit projectDirty( mDirty );
emit isDirtyChanged( mDirty );
}

void QgsProject::setFileName( const QString &name )
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsproject.h
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
* \since QGIS 3.2
*
*/
void projectDirty( const bool dirty );
void isDirtyChanged( bool dirty );

public slots:

Expand Down

0 comments on commit a30403d

Please sign in to comment.