Skip to content

Commit

Permalink
Make "Page Properties" action set properties for visible page
Browse files Browse the repository at this point in the history
And reflect which page it refers to in the action text
  • Loading branch information
nyalldawson committed Oct 2, 2024
1 parent 82db43b commit 0b96620
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla
mHorizontalRuler->setContextMenu( rulerMenu );
mVerticalRuler->setContextMenu( rulerMenu );

connect( mLayoutMenu, &QMenu::aboutToShow, this, &QgsLayoutDesignerDialog::layoutMenuAboutToShow );
connect( mActionRefreshView, &QAction::triggered, this, &QgsLayoutDesignerDialog::refreshLayout );
connect( mActionSaveProject, &QAction::triggered, this, &QgsLayoutDesignerDialog::saveProject );
connect( mActionNewLayout, &QAction::triggered, this, &QgsLayoutDesignerDialog::newLayout );
Expand Down Expand Up @@ -1924,9 +1925,10 @@ void QgsLayoutDesignerDialog::addPages()

void QgsLayoutDesignerDialog::showPageProperties()
{
QgsLayoutItemPage *page = mLayout->pageCollection()->page( 0 );
if ( !mLayout )
return;

if ( page )
if ( QgsLayoutItemPage *page = mLayout->pageCollection()->page( mView->currentPage() ) )
{
showItemOptions( page, true );
}
Expand Down Expand Up @@ -5138,3 +5140,15 @@ void QgsLayoutDesignerDialog::onItemDestroyed( QObject *item )
delete mItemPropertiesStack->takeMainPanel();
}
}

void QgsLayoutDesignerDialog::layoutMenuAboutToShow()
{
if ( mLayout && mLayout->pageCollection()->pageCount() > 1 )
{
mActionPageProperties->setText( tr( "Page %1 Properties…" ).arg( mView->currentPage() + 1 ) );
}
else
{
mActionPageProperties->setText( tr( "Page Properties…" ) );
}
}
1 change: 1 addition & 0 deletions src/app/layout/qgslayoutdesignerdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ class QgsLayoutDesignerDialog: public QMainWindow, public Ui::QgsLayoutDesignerB
void onMapPreviewRefreshed();
void onItemAdded( QgsLayoutItem *item );
void onItemDestroyed( QObject *item );
void layoutMenuAboutToShow();

private:

Expand Down

0 comments on commit 0b96620

Please sign in to comment.