Fix invisble annotations are still rendered

Fixes #17763
This commit is contained in:
Nyall Dawson 2018-01-03 12:01:05 +10:00
parent 230e91c44b
commit a4147b7a38
2 changed files with 8 additions and 2 deletions

View File

@ -287,6 +287,9 @@ double QgsMapCanvasAnnotationItem::scaledSymbolSize() const
void QgsMapCanvasAnnotationItem::paint( QPainter *painter )
{
if ( !mAnnotation || !mAnnotation->isVisible() )
return;
QgsRenderContext rc = QgsRenderContext::fromQPainter( painter );
rc.setFlag( QgsRenderContext::Antialiasing, true );

View File

@ -2806,11 +2806,14 @@ namespace QgsWms
void QgsRenderer::annotationsRendering( QPainter *painter ) const
{
const QgsAnnotationManager *annotationManager = mProject->annotationManager();
QList< QgsAnnotation * > annotations = annotationManager->annotations();
const QList< QgsAnnotation * > annotations = annotationManager->annotations();
QgsRenderContext renderContext = QgsRenderContext::fromQPainter( painter );
Q_FOREACH ( QgsAnnotation *annotation, annotations )
for ( QgsAnnotation *annotation : annotations )
{
if ( !annotation || !annotation->isVisible() )
continue;
annotation->render( renderContext );
}
}