Refine z order for some new items

This commit is contained in:
Nyall Dawson 2017-07-25 14:14:20 +10:00
parent 0d0a3c2cdc
commit 3dbc1a0c2a
4 changed files with 7 additions and 2 deletions

View File

@ -23,9 +23,10 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator
enum ZValues
{
ZPage,
ZItem,
ZGrid,
ZMapTool,
ZSnapIndicator,
};
QgsLayout( QgsProject *project );

View File

@ -42,9 +42,10 @@ class CORE_EXPORT QgsLayout : public QGraphicsScene, public QgsExpressionContext
enum ZValues
{
ZPage = 0, //!< Z-value for page (paper) items
ZItem = 1, //!< Minimum z value for items
ZGrid = 9999, //!< Z-value for page grids
ZMapTool = 10000, //!< Z-value for temporary map tool items
ZSnapIndicator = 10001, //!< Z-value for snapping indicator
};
/**

View File

@ -29,6 +29,8 @@ QgsLayoutItem::QgsLayoutItem( QgsLayout *layout )
, QGraphicsRectItem( 0 )
, mUuid( QUuid::createUuid().toString() )
{
setZValue( QgsLayout::ZItem );
// needed to access current view transform during paint operations
setFlags( flags() | QGraphicsItem::ItemUsesExtendedStyleOption );
setCacheMode( QGraphicsItem::DeviceCoordinateCache );

View File

@ -439,6 +439,7 @@ QgsLayoutViewSnapMarker::QgsLayoutViewSnapMarker()
setPen( QPen( Qt::transparent, mSize ) );
setFlags( flags() | QGraphicsItem::ItemIgnoresTransformations );
setZValue( QgsLayout::ZSnapIndicator );
}
void QgsLayoutViewSnapMarker::paint( QPainter *p, const QStyleOptionGraphicsItem *, QWidget * )