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
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla


//listen out to status bar updates from the view //listen out to status bar updates from the view
connect( mView, &QgsLayoutView::statusMessage, this, &QgsLayoutDesignerDialog::statusMessageReceived ); connect( mView, &QgsLayoutView::statusMessage, this, &QgsLayoutDesignerDialog::statusMessageReceived );

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


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


void QgsLayoutDesignerDialog::updateWindowTitle() void QgsLayoutDesignerDialog::updateWindowTitle()
{ {
QString title;
if ( mSectionTitle.isEmpty() ) if ( mSectionTitle.isEmpty() )
setWindowTitle( mTitle ); title = mTitle;
else 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 ) void QgsLayoutDesignerDialog::selectItems( const QList<QgsLayoutItem *> items )
Expand Down
4 changes: 3 additions & 1 deletion src/app/layout/qgslayoutdesignerdialog.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ class QgsLayoutDesignerDialog: public QMainWindow, private Ui::QgsLayoutDesigner
//! Populate layouts menu from main app's //! Populate layouts menu from main app's
void populateLayoutsMenu(); void populateLayoutsMenu();


void updateWindowTitle();

private: private:


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


#endif // QGSLAYOUTDESIGNERDIALOG_H #endif // QGSLAYOUTDESIGNERDIALOG_H
Expand Down

0 comments on commit d73c775

Please sign in to comment.