Skip to content

Commit

Permalink
Show paper properties if clicked on a Layout Page
Browse files Browse the repository at this point in the history
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 499c5da
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/gui/layout/qgslayoutviewtoolselect.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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() )
Expand All @@ -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 );
Expand Down

0 comments on commit 499c5da

Please sign in to comment.