Small tweaks to selection behavior

This commit is contained in:
Nyall Dawson 2017-10-10 19:39:07 +10:00
parent 06650808b5
commit 3735c7f06f
2 changed files with 14 additions and 6 deletions

View File

@ -644,12 +644,11 @@ void QgsLayoutDesignerDialog::showItemOptions( QgsLayoutItem *item, bool bringPa
} }
std::unique_ptr< QgsLayoutItemBaseWidget > widget( QgsGui::layoutItemGuiRegistry()->createItemWidget( item ) ); std::unique_ptr< QgsLayoutItemBaseWidget > widget( QgsGui::layoutItemGuiRegistry()->createItemWidget( item ) );
if ( ! widget )
{
return;
}
delete mItemPropertiesStack->takeMainPanel(); delete mItemPropertiesStack->takeMainPanel();
if ( ! widget )
return;
widget->setDockMode( true ); widget->setDockMode( true );
connect( item, &QgsLayoutItem::destroyed, widget.get(), [this] connect( item, &QgsLayoutItem::destroyed, widget.get(), [this]
{ {

View File

@ -112,6 +112,10 @@ void QgsLayoutViewToolSelect::layoutPressEvent( QgsLayoutViewMouseEvent *event )
{ {
emit itemFocused( selectedItems.at( 0 ) ); emit itemFocused( selectedItems.at( 0 ) );
} }
else
{
emit itemFocused( nullptr );
}
} }
else else
{ {
@ -173,7 +177,7 @@ void QgsLayoutViewToolSelect::layoutReleaseEvent( QgsLayoutViewMouseEvent *event
else else
{ {
//not adding to or removing from selection, so clear current selection //not adding to or removing from selection, so clear current selection
layout()->deselectAll(); whileBlocking( layout() )->deselectAll();
} }
//determine item selection mode, default to intersection //determine item selection mode, default to intersection
@ -221,6 +225,11 @@ void QgsLayoutViewToolSelect::layoutReleaseEvent( QgsLayoutViewMouseEvent *event
{ {
emit itemFocused( selectedItemList.at( 0 ) ); emit itemFocused( selectedItemList.at( 0 ) );
} }
else
{
emit itemFocused( nullptr );
}
mMouseHandles->selectionChanged();
} }
void QgsLayoutViewToolSelect::wheelEvent( QWheelEvent *event ) void QgsLayoutViewToolSelect::wheelEvent( QWheelEvent *event )