QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
QgsFormAnnotation Class Reference

An annotation item that embeds a designer form showing the feature attribute. More...

#include <qgsformannotation.h>

Inheritance diagram for QgsFormAnnotation:
Inheritance graph
[legend]

Public Member Functions

 QgsFormAnnotation (QObject *parent=nullptr)
 Constructor for QgsFormAnnotation.
 
QgsFormAnnotationclone () const override
 Clones the annotation, returning a new copy of the annotation reflecting the annotation's current state.
 
QString designerForm () const
 Returns the path to the Qt Designer UI file to show in the annotation.
 
QSizeF minimumFrameSize () const override
 Returns the minimum frame size for the annotation.
 
QSizeF preferredFrameSize () const
 Returns the optimal frame size.
 
void readXml (const QDomElement &itemElem, const QgsReadWriteContext &context) override
 Restores the annotation's state from a DOM element.
 
void setAssociatedFeature (const QgsFeature &feature) override
 Sets the feature associated with the annotation.
 
void setDesignerForm (const QString &uiFile)
 Sets the path to the Qt Designer UI file to show in the annotation.
 
void writeXml (QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const override
 Writes the annotation state to a DOM element.
 
- Public Member Functions inherited from QgsAnnotation
 QgsAnnotation (QObject *parent=nullptr)
 Constructor for QgsAnnotation.
 
 ~QgsAnnotation () override
 
virtual bool accept (QgsStyleEntityVisitorInterface *visitor) const
 Accepts the specified style entity visitor, causing it to visit all style entities associated within the annotation.
 
QgsFeature associatedFeature () const
 Returns the feature associated with the annotation, or an invalid feature if none has been set.
 
QgsMargins contentsMargin () const
 Returns the margins (in millimeters) between the outside of the frame and the annotation content.
 
QgsFillSymbolfillSymbol () const
 Returns the symbol that is used for rendering the annotation frame.
 
Q_DECL_DEPRECATED QPointF frameOffsetFromReferencePoint () const
 Returns the annotation's frame's offset (in pixels) from the mapPosition() reference point.
 
QPointF frameOffsetFromReferencePointMm () const
 Returns the annotation's frame's offset (in millimeters) from the mapPosition() reference point.
 
Q_DECL_DEPRECATED QSizeF frameSize () const
 Returns the size (in pixels) of the annotation's frame (the main area in which the annotation's content is drawn).
 
QSizeF frameSizeMm () const
 Returns the size (in millimeters) of the annotation's frame (the main area in which the annotation's content is drawn).
 
bool hasFixedMapPosition () const
 Returns true if the annotation is attached to a fixed map position, or false if the annotation uses a position relative to the current map extent.
 
bool isVisible () const
 Returns true if the annotation is visible and should be rendered.
 
QgsMapLayermapLayer () const
 Returns the map layer associated with the annotation.
 
QgsPointXY mapPosition () const
 Returns the map position of the annotation, if it is attached to a fixed map position.
 
QgsCoordinateReferenceSystem mapPositionCrs () const
 Returns the CRS of the map position, or an invalid CRS if the annotation does not have a fixed map position.
 
QgsMarkerSymbolmarkerSymbol () const
 Returns the symbol that is drawn at the annotation's map position.
 
QPointF relativePosition () const
 Returns the relative position of the annotation, if it is not attached to a fixed map position.
 
void render (QgsRenderContext &context) const
 Renders the annotation to a target render context.
 
void setContentsMargin (const QgsMargins &margins)
 Sets the margins (in millimeters) between the outside of the frame and the annotation content.
 
void setFillSymbol (QgsFillSymbol *symbol)
 Sets the fill symbol used for rendering the annotation frame.
 
Q_DECL_DEPRECATED void setFrameOffsetFromReferencePoint (QPointF offset)
 Sets the annotation's frame's offset (in pixels) from the mapPosition() reference point.
 
void setFrameOffsetFromReferencePointMm (QPointF offset)
 Sets the annotation's frame's offset (in millimeters) from the mapPosition() reference point.
 
Q_DECL_DEPRECATED void setFrameSize (QSizeF size)
 Sets the size (in pixels) of the annotation's frame (the main area in which the annotation's content is drawn).
 
void setFrameSizeMm (QSizeF size)
 Sets the size (in millimeters) of the annotation's frame (the main area in which the annotation's content is drawn).
 
void setHasFixedMapPosition (bool fixed)
 Sets whether the annotation is attached to a fixed map position, or uses a position relative to the current map extent.
 
void setMapLayer (QgsMapLayer *layer)
 Sets the map layer associated with the annotation.
 
void setMapPosition (const QgsPointXY &position)
 Sets the map position of the annotation, if it is attached to a fixed map position.
 
void setMapPositionCrs (const QgsCoordinateReferenceSystem &crs)
 Sets the CRS of the map position.
 
void setMarkerSymbol (QgsMarkerSymbol *symbol)
 Sets the symbol that is drawn at the annotation's map position.
 
void setRelativePosition (QPointF position)
 Sets the relative position of the annotation, if it is not attached to a fixed map position.
 
void setVisible (bool visible)
 Sets whether the annotation is visible and should be rendered.
 

Static Public Member Functions

static QgsFormAnnotationcreate ()
 Returns a new QgsFormAnnotation object.
 

Protected Member Functions

void renderAnnotation (QgsRenderContext &context, QSizeF size) const override
 Renders the annotation's contents to a target /a context at the specified /a size.
 
- Protected Member Functions inherited from QgsAnnotation
void _readXml (const QDomElement &annotationElem, const QgsReadWriteContext &context)
 Reads common annotation properties from a DOM element.
 
void _writeXml (QDomElement &itemElem, QDomDocument &doc, const QgsReadWriteContext &context) const
 Writes common annotation properties to a DOM element.
 
void copyCommonProperties (QgsAnnotation *target) const
 Copies common annotation properties to the targe annotation.
 

Additional Inherited Members

- Signals inherited from QgsAnnotation
void appearanceChanged ()
 Emitted whenever the annotation's appearance changes.
 
void mapLayerChanged ()
 Emitted when the map layer associated with the annotation changes.
 
void moved ()
 Emitted when the annotation's position has changed and items need to be moved to reflect this.
 
- Properties inherited from QgsAnnotation
QSizeF frameSize
 
bool hasFixedMapPosition
 
QgsPointXY mapPosition
 
bool visible
 

Detailed Description

An annotation item that embeds a designer form showing the feature attribute.

Definition at line 32 of file qgsformannotation.h.

Constructor & Destructor Documentation

◆ QgsFormAnnotation()

QgsFormAnnotation::QgsFormAnnotation ( QObject *  parent = nullptr)

Constructor for QgsFormAnnotation.

Definition at line 43 of file qgsformannotation.cpp.

Member Function Documentation

◆ clone()

QgsFormAnnotation * QgsFormAnnotation::clone ( ) const
overridevirtual

Clones the annotation, returning a new copy of the annotation reflecting the annotation's current state.

Implements QgsAnnotation.

Definition at line 47 of file qgsformannotation.cpp.

◆ create()

static QgsFormAnnotation * QgsFormAnnotation::create ( )
inlinestatic

Returns a new QgsFormAnnotation object.

Definition at line 68 of file qgsformannotation.h.

◆ designerForm()

QString QgsFormAnnotation::designerForm ( ) const
inline

Returns the path to the Qt Designer UI file to show in the annotation.

See also
setDesignerForm()

Definition at line 58 of file qgsformannotation.h.

◆ minimumFrameSize()

QSizeF QgsFormAnnotation::minimumFrameSize ( ) const
overridevirtual

Returns the minimum frame size for the annotation.

Subclasses should implement this if they cannot be resized smaller than a certain minimum size.

Reimplemented from QgsAnnotation.

Definition at line 138 of file qgsformannotation.cpp.

◆ preferredFrameSize()

QSizeF QgsFormAnnotation::preferredFrameSize ( ) const

Returns the optimal frame size.

Definition at line 152 of file qgsformannotation.cpp.

◆ readXml()

void QgsFormAnnotation::readXml ( const QDomElement &  itemElem,
const QgsReadWriteContext context 
)
overridevirtual

Restores the annotation's state from a DOM element.

Derived classes should call _readXml() within their implementation of this method.

See also
writeXml()
_readXml()

Implements QgsAnnotation.

Definition at line 172 of file qgsformannotation.cpp.

◆ renderAnnotation()

void QgsFormAnnotation::renderAnnotation ( QgsRenderContext context,
QSizeF  size 
) const
overrideprotectedvirtual

Renders the annotation's contents to a target /a context at the specified /a size.

Derived classes should implement their custom annotation drawing logic here.

Implements QgsAnnotation.

Definition at line 121 of file qgsformannotation.cpp.

◆ setAssociatedFeature()

void QgsFormAnnotation::setAssociatedFeature ( const QgsFeature feature)
overridevirtual

Sets the feature associated with the annotation.

See also
associatedFeature()

Reimplemented from QgsAnnotation.

Definition at line 195 of file qgsformannotation.cpp.

◆ setDesignerForm()

void QgsFormAnnotation::setDesignerForm ( const QString &  uiFile)

Sets the path to the Qt Designer UI file to show in the annotation.

See also
designerForm()

Definition at line 55 of file qgsformannotation.cpp.

◆ writeXml()

void QgsFormAnnotation::writeXml ( QDomElement &  elem,
QDomDocument &  doc,
const QgsReadWriteContext context 
) const
overridevirtual

Writes the annotation state to a DOM element.

Derived classes should call _writeXml() within their implementation of this method.

See also
readXml()
_writeXml()

Implements QgsAnnotation.

Definition at line 164 of file qgsformannotation.cpp.


The documentation for this class was generated from the following files: