Skip to content

Commit d4a3520

Browse files
committed
[hig] Show standard '*' prefix in application title bar when project
has unsaved changes E.g. '*my project - QGIS'
1 parent 7ffc148 commit d4a3520

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/app/qgisapp.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,12 +467,18 @@ static void setTitleBarText_( QWidget &qgisApp )
467467
else
468468
{
469469
QFileInfo projectFileInfo( QgsProject::instance()->fileName() );
470-
caption = projectFileInfo.completeBaseName() + " - ";
470+
caption = projectFileInfo.completeBaseName();
471471
}
472472
}
473473
else
474474
{
475-
caption = QgsProject::instance()->title() + " - ";
475+
caption = QgsProject::instance()->title();
476+
}
477+
if ( !caption.isEmpty() )
478+
{
479+
if ( QgsProject::instance()->isDirty() )
480+
caption.prepend( '*' );
481+
caption += " - ";
476482
}
477483

478484
caption += QgisApp::tr( "QGIS" );
@@ -748,6 +754,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
748754
mMapCanvas->setCanvasColor( QColor( myRed, myGreen, myBlue ) );
749755
endProfile();
750756

757+
connect( QgsProject::instance(), &QgsProject::projectDirty, this, [ = ] { setTitleBarText_( *this ); } );
758+
751759
// what type of project to auto-open
752760
mProjOpen = settings.value( QStringLiteral( "qgis/projOpenAtLaunch" ), 0 ).toInt();
753761

0 commit comments

Comments
 (0)