Skip to content

Commit

Permalink
When a grouped item is selected, we only draw the individual item
Browse files Browse the repository at this point in the history
bounds (not the group bounds)
  • Loading branch information
nyalldawson committed Oct 9, 2017
1 parent 7c81a15 commit eb2b181
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/gui/layout/qgslayoutmousehandles.cpp
Expand Up @@ -25,6 +25,7 @@
#include "qgslayoutview.h"
#include "qgslayoutviewtoolselect.h"
#include "qgslayoutsnapper.h"
#include "qgslayoutitemgroup.h"
#include <QGraphicsView>
#include <QGraphicsSceneHoverEvent>
#include <QPainter>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit eb2b181

Please sign in to comment.