Skip to content

Commit

Permalink
Add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Mar 19, 2019
1 parent c98a2ec commit 94fb2e1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/core/layertree/qgslayertreemodellegendnode.h
Expand Up @@ -110,6 +110,12 @@ class CORE_EXPORT QgsLayerTreeModelLegendNode : public QObject
*/
virtual ItemMetrics draw( const QgsLegendSettings &settings, ItemContext *ctx );

/**
* Entry point called from QgsLegendRenderer to do the rendering in a \a
* json object.
*
* \since QGIS 3.8
*/
void draw( const QgsLegendSettings &settings, QJsonObject &json );

/**
Expand All @@ -121,6 +127,14 @@ class CORE_EXPORT QgsLayerTreeModelLegendNode : public QObject
*/
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;

/**
* Adds a symbol in base64 string within the \a json object with the key
* "icon".
* \param settings Legend layout configuration
* \param json The json object to update
*
* \since QGIS 3.8
*/
virtual void drawSymbol( const QgsLegendSettings &settings, QJsonObject &json ) const;

/**
Expand All @@ -132,6 +146,13 @@ class CORE_EXPORT QgsLayerTreeModelLegendNode : public QObject
*/
virtual QSizeF drawSymbolText( const QgsLegendSettings &settings, ItemContext *ctx, QSizeF symbolSize ) const;

/**
* Adds a label in the \a json object with the key "title".
* \param settings Legend layout configuration
* \param json The json object to update
*
* \since QGIS 3.8
*/
void drawSymbolText( const QgsLegendSettings &settings, QJsonObject &json ) const;

signals:
Expand Down
10 changes: 10 additions & 0 deletions src/core/qgslegendrenderer.h
Expand Up @@ -93,6 +93,11 @@ class CORE_EXPORT QgsLegendRenderer
*/
void drawLegend( QgsRenderContext &context );

/**
* Renders the legend in a \a json object.
*
* \since QGIS 3.8
*/
void drawLegend( QJsonObject &json );

/**
Expand Down Expand Up @@ -235,6 +240,11 @@ class CORE_EXPORT QgsLegendRenderer
*/
QSizeF drawGroupTitle( QgsLayerTreeGroup *nodeGroup, QPainter *painter = nullptr, QPointF point = QPointF() );

/**
* Renders a group item in a \a json object.
*
* \since QGIS 3.8
*/
void drawLegend( QgsLayerTreeGroup *nodeGroup, QJsonObject &json );

/**
Expand Down

0 comments on commit 94fb2e1

Please sign in to comment.