Navigation Menu

Skip to content

Commit

Permalink
[hig] Show standard '*' prefix in application title bar when project
Browse files Browse the repository at this point in the history
has unsaved changes

E.g.

'*my project - QGIS'
  • Loading branch information
nyalldawson committed Mar 6, 2018
1 parent 7ffc148 commit d4a3520
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -467,12 +467,18 @@ static void setTitleBarText_( QWidget &qgisApp )
else
{
QFileInfo projectFileInfo( QgsProject::instance()->fileName() );
caption = projectFileInfo.completeBaseName() + " - ";
caption = projectFileInfo.completeBaseName();
}
}
else
{
caption = QgsProject::instance()->title() + " - ";
caption = QgsProject::instance()->title();
}
if ( !caption.isEmpty() )
{
if ( QgsProject::instance()->isDirty() )
caption.prepend( '*' );
caption += " - ";
}

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

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

// what type of project to auto-open
mProjOpen = settings.value( QStringLiteral( "qgis/projOpenAtLaunch" ), 0 ).toInt();

Expand Down

0 comments on commit d4a3520

Please sign in to comment.