Skip to content
Permalink
Browse files

Automatically trigger annotation layer repaint when contents change

  • Loading branch information
nyalldawson committed Aug 27, 2020
1 parent 69665cd commit 5849ddd20595680e007b4c11f97aae220d39eccc
Showing with 17 additions and 1 deletion.
  1. +16 −0 src/core/annotations/qgsannotationlayer.cpp
  2. +1 −1 src/core/annotations/qgsannotationlayer.h
@@ -47,6 +47,9 @@ QString QgsAnnotationLayer::addItem( QgsAnnotationItem *item )
{
const QString uuid = QUuid::createUuid().toString();
mItems.insert( uuid, item );

triggerRepaint();

return uuid;
}

@@ -56,13 +59,24 @@ bool QgsAnnotationLayer::removeItem( const QString &id )
return false;

delete mItems.take( id );

triggerRepaint();

return true;
}

void QgsAnnotationLayer::clear()
{
qDeleteAll( mItems );
mItems.clear();

triggerRepaint();
}

void QgsAnnotationLayer::setOpacity( double opacity )
{
mOpacity = opacity;
triggerRepaint();
}

QgsAnnotationLayer *QgsAnnotationLayer::clone() const
@@ -139,6 +153,8 @@ bool QgsAnnotationLayer::readXml( const QDomNode &layerNode, QgsReadWriteContext
QString errorMsg;
readSymbology( layerNode, errorMsg, context );

triggerRepaint();

return mValid;
}

@@ -109,7 +109,7 @@ class CORE_EXPORT QgsAnnotationLayer : public QgsMapLayer
* and 1.0 (fully opaque).
* \see opacity()
*/
void setOpacity( double opacity ) { mOpacity = opacity; }
void setOpacity( double opacity );

/**
* Returns the opacity for the annotation layer, where opacity is a value between 0 (totally transparent)

0 comments on commit 5849ddd

Please sign in to comment.
You can’t perform that action at this time.