Skip to content
Permalink
Browse files

Show paper properties if clicked on a Layout Page

Currently the only way to see the current Page properties (most
notably the page orientation and size) is via a context menu.
In my experience several people failed to 'find' it.
Now if you click on a page the props will be shown (just like
if you use the context menu).
  • Loading branch information
rduivenvoorde authored and nyalldawson committed Mar 31, 2021
1 parent cc482dc commit 499c5dae8f2149e2a96938fed66393ffda471b77
Showing with 16 additions and 1 deletion.
  1. +16 −1 src/gui/layout/qgslayoutviewtoolselect.cpp
@@ -50,7 +50,6 @@ void QgsLayoutViewToolSelect::layoutPressEvent( QgsLayoutViewMouseEvent *event )
//swallow clicks while dragging/resizing items
return;
}

if ( mMouseHandles->isVisible() )
{
//selection handles are being shown, get mouse action for current cursor position
@@ -218,10 +217,13 @@ void QgsLayoutViewToolSelect::layoutReleaseEvent( QgsLayoutViewMouseEvent *event
itemList = layout()->items( rect.center(), selectionMode );
else
itemList = layout()->items( rect, selectionMode );

bool paperItemFocused = false;
for ( QGraphicsItem *item : std::as_const( itemList ) )
{
QgsLayoutItem *layoutItem = dynamic_cast<QgsLayoutItem *>( item );
QgsLayoutItemPage *paperItem = dynamic_cast<QgsLayoutItemPage *>( item );

if ( layoutItem && !paperItem )
{
if ( !layoutItem->isLocked() )
@@ -241,14 +243,27 @@ void QgsLayoutViewToolSelect::layoutReleaseEvent( QgsLayoutViewMouseEvent *event
}
}
}
else
{
if ( paperItem )
{
emit itemFocused( paperItem );
paperItemFocused = true;
}
}
}


//update item panel
const QList<QgsLayoutItem *> selectedItemList = layout()->selectedLayoutItems();
if ( !selectedItemList.isEmpty() )
{
emit itemFocused( selectedItemList.at( 0 ) );
}
else if ( paperItemFocused )
{
// do NOT emit nullptr because that will remove the page properties...
}
else
{
emit itemFocused( nullptr );

0 comments on commit 499c5da

Please sign in to comment.