Skip to content

Commit b02d06b

Browse files
author
Marco Hugentobler
committed
Show only annotation items in composermap, no rubberbands etc. Fixes ticket #3774
1 parent 694c356 commit b02d06b

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

src/core/composer/qgscomposermap.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,7 @@ void QgsComposerMap::drawCanvasItems( QPainter* painter, const QStyleOptionGraph
14811481
{
14821482
currentItem = itemList.at( i );
14831483
//don't draw mapcanvasmap (has z value -10)
1484-
if ( !currentItem || currentItem->zValue() == -10 )
1484+
if ( !currentItem || currentItem->data( 0 ).toString() != "AnnotationItem" )
14851485
{
14861486
continue;
14871487
}
@@ -1495,7 +1495,7 @@ void QgsComposerMap::drawCanvasItems( QPainter* painter, const QStyleOptionGraph
14951495
{
14961496
currentItem = itemList.at( i );
14971497
//don't draw mapcanvasmap (has z value -10)
1498-
if ( !currentItem || currentItem->zValue() == -10 )
1498+
if ( !currentItem || currentItem->data( 0 ) != "AnnotationItem" )
14991499
{
15001500
continue;
15011501
}
@@ -1564,9 +1564,9 @@ void QgsComposerMap::drawCanvasItem( QGraphicsItem* item, QPainter* painter, con
15641564
painter->scale( scaleFactor, scaleFactor );
15651565

15661566
//a little trick to let the item know that the paint request comes from the composer
1567-
item->setData( 0, "composer" );
1567+
item->setData( 1, "composer" );
15681568
item->paint( painter, itemStyle, 0 );
1569-
item->setData( 0, "" );
1569+
item->setData( 1, "" );
15701570
painter->restore();
15711571
}
15721572

src/gui/qgsannotationitem.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ QgsAnnotationItem::QgsAnnotationItem( QgsMapCanvas* mapCanvas ): QgsMapCanvasIte
3030
mFrameBorderWidth = 1.0;
3131
mFrameColor = QColor( 0, 0, 0 );
3232
mFrameBackgroundColor = QColor( 255, 255, 255 );
33+
setData( 0, "AnnotationItem" );
3334
}
3435

3536
QgsAnnotationItem::~QgsAnnotationItem()
@@ -232,7 +233,7 @@ void QgsAnnotationItem::drawSelectionBoxes( QPainter* p )
232233
}
233234

234235
//no selection boxes for composer mode
235-
if ( data( 0 ).toString() == "composer" )
236+
if ( data( 1 ).toString() == "composer" )
236237
{
237238
return;
238239
}

src/gui/qgsmapcanvasitem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ bool QgsMapCanvasItem::setRenderContextVariables( QPainter* p, QgsRenderContext&
126126
double rasterScaleFactor = 1.0;
127127

128128
//little trick to find out if painting origines from composer or main map canvas
129-
if ( data( 0 ).toString() == "composer" )
129+
if ( data( 1 ).toString() == "composer" )
130130
{
131131
rasterScaleFactor = painterDpi / 25.4;
132132
scaleFactor = dpi / 25.4;

src/plugins/georeferencer/qgsgcpcanvasitem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void QgsGCPCanvasItem::paint( QPainter* p )
9292
p->drawText( textBounds, Qt::AlignLeft, msg );
9393
}
9494

95-
if ( data( 0 ) != "composer" ) //draw residuals only on screen
95+
if ( data( 1 ) != "composer" ) //draw residuals only on screen
9696
{
9797
drawResidualArrow( p, context );
9898
}

0 commit comments

Comments
 (0)