Skip to content

Commit

Permalink
Show only annotation items in composermap, no rubberbands etc. Fixes …
Browse files Browse the repository at this point in the history
…ticket #3774
  • Loading branch information
Marco Hugentobler committed May 21, 2011
1 parent 694c356 commit b02d06b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/core/composer/qgscomposermap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ void QgsComposerMap::drawCanvasItems( QPainter* painter, const QStyleOptionGraph
{
currentItem = itemList.at( i );
//don't draw mapcanvasmap (has z value -10)
if ( !currentItem || currentItem->zValue() == -10 )
if ( !currentItem || currentItem->data( 0 ).toString() != "AnnotationItem" )
{
continue;
}
Expand All @@ -1495,7 +1495,7 @@ void QgsComposerMap::drawCanvasItems( QPainter* painter, const QStyleOptionGraph
{
currentItem = itemList.at( i );
//don't draw mapcanvasmap (has z value -10)
if ( !currentItem || currentItem->zValue() == -10 )
if ( !currentItem || currentItem->data( 0 ) != "AnnotationItem" )
{
continue;
}
Expand Down Expand Up @@ -1564,9 +1564,9 @@ void QgsComposerMap::drawCanvasItem( QGraphicsItem* item, QPainter* painter, con
painter->scale( scaleFactor, scaleFactor );

//a little trick to let the item know that the paint request comes from the composer
item->setData( 0, "composer" );
item->setData( 1, "composer" );
item->paint( painter, itemStyle, 0 );
item->setData( 0, "" );
item->setData( 1, "" );
painter->restore();
}

Expand Down
3 changes: 2 additions & 1 deletion src/gui/qgsannotationitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ QgsAnnotationItem::QgsAnnotationItem( QgsMapCanvas* mapCanvas ): QgsMapCanvasIte
mFrameBorderWidth = 1.0;
mFrameColor = QColor( 0, 0, 0 );
mFrameBackgroundColor = QColor( 255, 255, 255 );
setData( 0, "AnnotationItem" );
}

QgsAnnotationItem::~QgsAnnotationItem()
Expand Down Expand Up @@ -232,7 +233,7 @@ void QgsAnnotationItem::drawSelectionBoxes( QPainter* p )
}

//no selection boxes for composer mode
if ( data( 0 ).toString() == "composer" )
if ( data( 1 ).toString() == "composer" )
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmapcanvasitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ bool QgsMapCanvasItem::setRenderContextVariables( QPainter* p, QgsRenderContext&
double rasterScaleFactor = 1.0;

//little trick to find out if painting origines from composer or main map canvas
if ( data( 0 ).toString() == "composer" )
if ( data( 1 ).toString() == "composer" )
{
rasterScaleFactor = painterDpi / 25.4;
scaleFactor = dpi / 25.4;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/georeferencer/qgsgcpcanvasitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void QgsGCPCanvasItem::paint( QPainter* p )
p->drawText( textBounds, Qt::AlignLeft, msg );
}

if ( data( 0 ) != "composer" ) //draw residuals only on screen
if ( data( 1 ) != "composer" ) //draw residuals only on screen
{
drawResidualArrow( p, context );
}
Expand Down

0 comments on commit b02d06b

Please sign in to comment.