2017-05-14 09:48:41 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgslegendrenderer.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-22 11:19:45 +07:00
|
|
|
|
|
|
|
class QgsLegendRenderer
|
|
|
|
{
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2018-05-26 14:10:30 +10:00
|
|
|
The QgsLegendRenderer class handles automatic layout and rendering of legend.
|
2017-12-15 10:36:55 -04:00
|
|
|
The content is given by QgsLayerTreeModel instance. Various layout properties can be configured
|
|
|
|
within QgsLegendRenderer.
|
2017-05-14 09:48:41 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
All spacing and sizes are in millimeters.
|
2017-05-14 09:48:41 +02:00
|
|
|
|
|
|
|
.. versionadded:: 2.6
|
2014-08-22 11:19:45 +07:00
|
|
|
%End
|
|
|
|
|
2017-05-14 09:48:41 +02:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgslegendrenderer.h"
|
|
|
|
%End
|
2014-08-22 11:19:45 +07:00
|
|
|
public:
|
2019-01-10 09:38:25 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsLegendRenderer( QgsLayerTreeModel *legendModel, const QgsLegendSettings &settings );
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2019-01-10 09:38:25 +10:00
|
|
|
Constructor for QgsLegendRenderer. The ownership of the legend model is not changed,
|
|
|
|
and the model must exist for the lifetime of this renderer.
|
2017-05-14 09:48:41 +02:00
|
|
|
%End
|
2014-08-22 11:19:45 +07:00
|
|
|
|
2019-01-18 14:03:29 +10:00
|
|
|
QSizeF minimumSize( QgsRenderContext *renderContext = 0 );
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2019-01-10 09:38:25 +10:00
|
|
|
Runs the layout algorithm and returns the minimum size required for the legend.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setLegendSize`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`legendSize`
|
2017-05-14 09:48:41 +02:00
|
|
|
%End
|
2014-08-22 11:19:45 +07:00
|
|
|
|
|
|
|
void setLegendSize( QSizeF s );
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Sets the preferred resulting legend size.
|
2019-01-10 09:38:25 +10:00
|
|
|
|
|
|
|
If the size is null, the legend will be drawn with the minimum possible size to fit its content.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`legendSize`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`minimumSize`
|
2017-05-14 09:48:41 +02:00
|
|
|
%End
|
2014-08-22 11:19:45 +07:00
|
|
|
|
|
|
|
QSizeF legendSize() const;
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2019-01-10 09:38:25 +10:00
|
|
|
Returns the preferred legend size set by the client.
|
|
|
|
|
|
|
|
If the returned size is null, the legend will be drawn with the minimum possible size to fit its content.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`minimumSize`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setLegendSize`
|
2017-05-14 09:48:41 +02:00
|
|
|
%End
|
2014-08-22 11:19:45 +07:00
|
|
|
|
2020-04-28 08:25:53 +10:00
|
|
|
void drawLegend( QPainter *painter ) /Deprecated/;
|
2017-05-14 09:48:41 +02:00
|
|
|
%Docstring
|
2020-06-15 09:04:13 +10:00
|
|
|
Draws the legend with given ``painter``. The legend will occupy the area reported in :py:func:`~QgsLegendRenderer.legendSize`.
|
2019-01-10 09:38:25 +10:00
|
|
|
The ``painter`` should be scaled beforehand so that units correspond to millimeters.
|
2020-04-28 08:25:53 +10:00
|
|
|
|
|
|
|
.. deprecated::
|
|
|
|
Use the variant which accepts a QgsRenderContext instead.
|
2017-05-14 09:48:41 +02:00
|
|
|
%End
|
2014-08-22 11:19:45 +07:00
|
|
|
|
2019-01-10 09:39:33 +10:00
|
|
|
void drawLegend( QgsRenderContext &context );
|
2019-01-08 06:42:29 -05:00
|
|
|
%Docstring
|
2020-06-15 09:04:13 +10:00
|
|
|
Draws the legend using a given render ``context``. The legend will occupy the area reported in :py:func:`~QgsLegendRenderer.legendSize`.
|
2019-01-10 09:39:33 +10:00
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
2019-03-04 15:02:49 +00:00
|
|
|
%End
|
|
|
|
|
2020-05-08 23:36:47 +02:00
|
|
|
QJsonObject exportLegendToJson( const QgsRenderContext &context );
|
2019-03-04 15:02:49 +00:00
|
|
|
%Docstring
|
|
|
|
Renders the legend in a ``json`` object.
|
|
|
|
|
|
|
|
.. versionadded:: 3.8
|
2019-01-08 06:42:29 -05:00
|
|
|
%End
|
2014-08-22 11:19:45 +07:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
static void setNodeLegendStyle( QgsLayerTreeNode *node, QgsLegendStyle::Style style );
|
2019-01-08 18:23:49 -05:00
|
|
|
%Docstring
|
2019-01-10 09:38:25 +10:00
|
|
|
Sets the ``style`` of a ``node``.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`nodeLegendStyle`
|
2019-01-08 18:23:49 -05:00
|
|
|
%End
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
static QgsLegendStyle::Style nodeLegendStyle( QgsLayerTreeNode *node, QgsLayerTreeModel *model );
|
2019-01-08 18:23:49 -05:00
|
|
|
%Docstring
|
2019-01-10 09:38:25 +10:00
|
|
|
Returns the style for the given ``node``, within the specified ``model``.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setNodeLegendStyle`
|
2019-01-08 18:23:49 -05:00
|
|
|
%End
|
|
|
|
|
2014-08-22 11:19:45 +07:00
|
|
|
};
|
2017-05-14 09:48:41 +02:00
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgslegendrenderer.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|