When a grouped item is selected, we only draw the individual item

bounds (not the group bounds)
This commit is contained in:
Nyall Dawson 2017-10-09 13:18:36 +10:00
parent 7c81a1516d
commit eb2b181a92

View File

@ -25,6 +25,7 @@
#include "qgslayoutview.h"
#include "qgslayoutviewtoolselect.h"
#include "qgslayoutsnapper.h"
#include "qgslayoutitemgroup.h"
#include <QGraphicsView>
#include <QGraphicsSceneHoverEvent>
#include <QPainter>
@ -130,7 +131,22 @@ void QgsLayoutMouseHandles::drawSelectedItemBounds( QPainter *painter )
painter->setPen( selectedItemPen );
painter->setBrush( Qt::NoBrush );
QList< QgsLayoutItem * > itemsToDraw;
for ( QgsLayoutItem *item : selectedItems )
{
if ( item->type() == QgsLayoutItemRegistry::LayoutGroup )
{
// if a group is selected, we don't draw the bounds of the group - instead we draw the bounds of the grouped items
itemsToDraw.append( static_cast< QgsLayoutItemGroup * >( item )->items() );
}
else
{
itemsToDraw << item;
}
}
for ( QgsLayoutItem *item : qgsAsConst( itemsToDraw ) )
{
//get bounds of selected item
QPolygonF itemBounds;