Skip to content

Commit

Permalink
Also update layout designer title bar to reflect unsaved changes
Browse files Browse the repository at this point in the history
indicator
  • Loading branch information
nyalldawson committed Mar 6, 2018
1 parent d4a3520 commit d73c775
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Expand Up @@ -750,6 +750,8 @@ 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 );
}

QgsAppLayoutDesignerInterface *QgsLayoutDesignerDialog::iface()
Expand Down Expand Up @@ -4130,10 +4132,16 @@ void QgsLayoutDesignerDialog::updateActionNames( QgsMasterLayoutInterface::Type

void QgsLayoutDesignerDialog::updateWindowTitle()
{
QString title;
if ( mSectionTitle.isEmpty() )
setWindowTitle( mTitle );
title = mTitle;
else
setWindowTitle( QStringLiteral( "%1 - %2" ).arg( mTitle, mSectionTitle ) );
title = QStringLiteral( "%1 - %2" ).arg( mTitle, mSectionTitle );

if ( QgsProject::instance()->isDirty() )
title.prepend( '*' );

setWindowTitle( title );
}

void QgsLayoutDesignerDialog::selectItems( const QList<QgsLayoutItem *> items )
Expand Down
4 changes: 3 additions & 1 deletion src/app/layout/qgslayoutdesignerdialog.h
Expand Up @@ -348,6 +348,8 @@ class QgsLayoutDesignerDialog: public QMainWindow, private Ui::QgsLayoutDesigner
//! Populate layouts menu from main app's
void populateLayoutsMenu();

void updateWindowTitle();

private:

static bool sInitializedRegistry;
Expand Down Expand Up @@ -499,7 +501,7 @@ class QgsLayoutDesignerDialog: public QMainWindow, private Ui::QgsLayoutDesigner
QPrinter *printer();
QString reportTypeString();
void updateActionNames( QgsMasterLayoutInterface::Type type );
void updateWindowTitle();

};

#endif // QGSLAYOUTDESIGNERDIALOG_H
Expand Down

0 comments on commit d73c775

Please sign in to comment.