Skip to content

Commit

Permalink
Refine z order for some new items
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 7, 2017
1 parent 0d0a3c2 commit 3dbc1a0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion python/core/layout/qgslayout.sip
Expand Up @@ -23,9 +23,10 @@ class QgsLayout : QGraphicsScene, QgsExpressionContextGenerator
enum ZValues
{
ZPage,
ZItem,
ZGrid,
ZMapTool,

ZSnapIndicator,
};

QgsLayout( QgsProject *project );
Expand Down
3 changes: 2 additions & 1 deletion src/core/layout/qgslayout.h
Expand Up @@ -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
};

/**
Expand Down
2 changes: 2 additions & 0 deletions src/core/layout/qgslayoutitem.cpp
Expand Up @@ -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 );
Expand Down
1 change: 1 addition & 0 deletions src/gui/layout/qgslayoutview.cpp
Expand Up @@ -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 * )
Expand Down

0 comments on commit 3dbc1a0

Please sign in to comment.