mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
When a grouped item is selected, we only draw the individual item
bounds (not the group bounds)
This commit is contained in:
parent
7c81a1516d
commit
eb2b181a92
@ -25,6 +25,7 @@
|
|||||||
#include "qgslayoutview.h"
|
#include "qgslayoutview.h"
|
||||||
#include "qgslayoutviewtoolselect.h"
|
#include "qgslayoutviewtoolselect.h"
|
||||||
#include "qgslayoutsnapper.h"
|
#include "qgslayoutsnapper.h"
|
||||||
|
#include "qgslayoutitemgroup.h"
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QGraphicsSceneHoverEvent>
|
#include <QGraphicsSceneHoverEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@ -130,7 +131,22 @@ void QgsLayoutMouseHandles::drawSelectedItemBounds( QPainter *painter )
|
|||||||
painter->setPen( selectedItemPen );
|
painter->setPen( selectedItemPen );
|
||||||
painter->setBrush( Qt::NoBrush );
|
painter->setBrush( Qt::NoBrush );
|
||||||
|
|
||||||
|
QList< QgsLayoutItem * > itemsToDraw;
|
||||||
for ( QgsLayoutItem *item : selectedItems )
|
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
|
//get bounds of selected item
|
||||||
QPolygonF itemBounds;
|
QPolygonF itemBounds;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user