QGIS/python/core/layertree/qgslayertreemodellegendnode.sip.in

417 lines
10 KiB
Plaintext
Raw Normal View History

2017-04-24 15:52:13 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layertree/qgslayertreemodellegendnode.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2017-04-25 08:27:52 +02:00
class QgsLayerTreeModelLegendNode : QObject
{
2017-04-24 15:52:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
The QgsLegendRendererItem class is abstract interface for legend items
returned from QgsMapLayerLegend implementation.
2017-04-24 15:52:13 +02:00
2017-12-15 10:36:55 -04:00
The objects are used in QgsLayerTreeModel. Custom implementations may offer additional interactivity
and customized look.
2017-04-24 15:52:13 +02:00
.. versionadded:: 2.6
%End
2014-11-13 23:13:13 +01:00
2017-04-24 15:52:13 +02:00
%TypeHeaderCode
#include "qgslayertreemodellegendnode.h"
%End
public:
enum LegendNodeRoles
{
2017-06-08 15:50:48 +02:00
RuleKeyRole,
2017-04-24 15:52:13 +02:00
ParentRuleKeyRole
};
2017-04-24 15:52:13 +02:00
QgsLayerTreeLayer *layerNode() const;
%Docstring
Return pointer to the parent layer node
%End
2017-04-24 15:52:13 +02:00
QgsLayerTreeModel *model() const;
%Docstring
Return pointer to model owning this legend node
%End
virtual Qt::ItemFlags flags() const;
2017-04-24 15:52:13 +02:00
%Docstring
Return item flags associated with the item. Default implementation returns Qt.ItemIsEnabled.
%End
virtual QVariant data( int role ) const = 0;
2017-04-24 15:52:13 +02:00
%Docstring
Return data associated with the item. Must be implemented in derived class.
%End
2017-04-24 15:52:13 +02:00
virtual bool setData( const QVariant &value, int role );
%Docstring
Set some data associated with the item. Default implementation does nothing and returns false.
%End
virtual bool isEmbeddedInParent() const;
virtual void setEmbeddedInParent( bool embedded );
virtual QString userLabel() const;
2017-04-24 15:52:13 +02:00
virtual void setUserLabel( const QString &userLabel );
virtual bool isScaleOK( double scale ) const;
virtual void invalidateMapBasedData();
2017-04-24 15:52:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Notification from model that information from associated map view has changed.
Default implementation does nothing. *
2017-04-24 15:52:13 +02:00
%End
struct ItemContext
{
2017-04-24 15:52:13 +02:00
QPainter *painter;
QPointF point;
double labelXOffset;
};
struct ItemMetrics
{
QSizeF symbolSize;
QSizeF labelSize;
};
2017-04-24 15:52:13 +02:00
virtual ItemMetrics draw( const QgsLegendSettings &settings, ItemContext *ctx );
%Docstring
2017-12-15 10:36:55 -04:00
Entry point called from QgsLegendRenderer to do the rendering.
Default implementation calls drawSymbol() and drawSymbolText() methods.
2017-04-24 15:52:13 +02:00
2017-12-15 10:36:55 -04:00
If ctx is null, this is just first stage when preparing layout - without actual rendering.
2017-04-24 15:52:13 +02:00
%End
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Draws symbol on the left side of the item
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param settings: Legend layout configuration
:param ctx: Context for rendering - may be null if only doing layout without actual rendering
:param itemHeight: Minimal height of the legend item - used for correct positioning when rendering
:return: Real size of the symbol (may be bigger than "normal" symbol size from settings)
2017-04-24 15:52:13 +02:00
%End
virtual QSizeF drawSymbolText( const QgsLegendSettings &settings, ItemContext *ctx, QSizeF symbolSize ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Draws label on the right side of the item
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param settings: Legend layout configuration
:param ctx: Context for rendering - may be null if only doing layout without actual rendering
:param symbolSize: Real size of the associated symbol - used for correct positioning when rendering
:return: Size of the label (may span multiple lines)
2017-04-24 15:52:13 +02:00
%End
signals:
void dataChanged();
2017-04-24 15:52:13 +02:00
%Docstring
Emitted on internal data change so the layer tree model can forward the signal to views
%End
protected:
2017-04-24 15:52:13 +02:00
explicit QgsLayerTreeModelLegendNode( QgsLayerTreeLayer *nodeL, QObject *parent /TransferThis/ = 0 );
%Docstring
Construct the node with pointer to its parent layer node
%End
QgsRenderContext *createTemporaryRenderContext() const /Factory/;
%Docstring
Returns a temporary context or null if legendMapViewData are not valid
%End
2017-04-24 15:52:13 +02:00
protected:
};
2016-08-05 08:09:43 +02:00
class QgsSymbolLegendNode : QgsLayerTreeModelLegendNode
{
2017-04-24 15:52:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Implementation of legend node interface for displaying preview of vector symbols and their labels
and allowing interaction with the symbol / renderer.
2017-04-24 15:52:13 +02:00
.. versionadded:: 2.6
%End
%TypeHeaderCode
2017-04-24 15:52:13 +02:00
#include "qgslayertreemodellegendnode.h"
%End
public:
2017-04-25 08:27:52 +02:00
2017-04-24 15:52:13 +02:00
QgsSymbolLegendNode( QgsLayerTreeLayer *nodeLayer, const QgsLegendSymbolItem &item, QObject *parent /TransferThis/ = 0 );
2017-04-25 08:27:52 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsSymbolLegendNode.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param nodeLayer: layer node
:param item: the legend symbol item
:param parent: attach a parent QObject to the legend node.
2017-04-25 08:27:52 +02:00
%End
virtual Qt::ItemFlags flags() const;
virtual QVariant data( int role ) const;
2017-04-24 15:52:13 +02:00
virtual bool setData( const QVariant &value, int role );
2017-04-24 15:52:13 +02:00
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;
virtual void setEmbeddedInParent( bool embedded );
2017-04-24 15:52:13 +02:00
virtual void setUserLabel( const QString &userLabel );
virtual bool isScaleOK( double scale ) const;
virtual void invalidateMapBasedData();
void setIconSize( QSize sz );
2017-04-24 15:52:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Set the icon size
2017-04-24 15:52:13 +02:00
.. versionadded:: 2.10
%End
QSize iconSize() const;
2017-04-24 15:52:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
2017-04-24 15:52:13 +02:00
.. versionadded:: 2.10
%End
QSize minimumIconSize() const;
2017-04-24 15:52:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Calculates the minimum icon size to prevent cropping. When evaluating
the size for multiple icons it is more efficient to create a single
2017-12-19 11:43:52 -04:00
render context in advance and use the variant which accepts a :py:class:`QgsRenderContext`
2017-12-15 10:36:55 -04:00
argument.
2017-04-24 15:52:13 +02:00
.. versionadded:: 2.10
%End
QSize minimumIconSize( QgsRenderContext *context ) const;
%Docstring
2017-12-15 10:36:55 -04:00
Calculates the minimum icon size to prevent cropping. When evaluating
the size for multiple icons it is more efficient to create a single
render context in advance and call this method instead of minimumIconSize().
2017-04-24 15:52:13 +02:00
.. versionadded:: 2.18
%End
2017-04-24 15:52:13 +02:00
const QgsSymbol *symbol() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns the symbol used by the legend node.
.. seealso:: :py:func:`setSymbol`
2017-12-15 10:36:55 -04:00
2017-04-24 15:52:13 +02:00
.. versionadded:: 2.14
%End
void setSymbol( QgsSymbol *symbol );
%Docstring
2017-12-15 10:36:55 -04:00
Sets the symbol to be used by the legend node. The symbol change is also propagated
to the associated vector layer's renderer.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param symbol: new symbol for node. Ownership is transferred.
.. seealso:: :py:func:`symbol`
2017-12-15 10:36:55 -04:00
2017-04-24 15:52:13 +02:00
.. versionadded:: 2.14
%End
public slots:
void checkAllItems();
2017-04-24 15:52:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Checks all items belonging to the same layer as this node.
2017-04-24 15:52:13 +02:00
.. versionadded:: 2.14
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`uncheckAllItems`
2017-04-24 15:52:13 +02:00
%End
void uncheckAllItems();
2017-04-24 15:52:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Unchecks all items belonging to the same layer as this node.
2017-04-24 15:52:13 +02:00
.. versionadded:: 2.14
2017-12-15 10:36:55 -04:00
.. seealso:: :py:func:`checkAllItems`
2017-04-24 15:52:13 +02:00
%End
};
class QgsSimpleLegendNode : QgsLayerTreeModelLegendNode
{
2017-04-24 15:52:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Implementation of legend node interface for displaying arbitrary label with icon.
2017-04-24 15:52:13 +02:00
.. versionadded:: 2.6
%End
%TypeHeaderCode
2017-04-24 15:52:13 +02:00
#include "qgslayertreemodellegendnode.h"
%End
public:
2017-04-25 08:27:52 +02:00
2017-04-24 15:52:13 +02:00
QgsSimpleLegendNode( QgsLayerTreeLayer *nodeLayer, const QString &label, const QIcon &icon = QIcon(), QObject *parent /TransferThis/ = 0, const QString &key = QString() );
2017-04-25 08:27:52 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsSimpleLegendNode.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param nodeLayer: layer node
:param label: label
:param icon: icon
:param parent: attach a parent QObject to the legend node.
:param key: the rule key
2017-04-25 08:27:52 +02:00
%End
virtual QVariant data( int role ) const;
2017-04-24 15:52:13 +02:00
};
class QgsImageLegendNode : QgsLayerTreeModelLegendNode
{
2017-04-24 15:52:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Implementation of legend node interface for displaying arbitrary raster image
2017-04-24 15:52:13 +02:00
.. versionadded:: 2.6
%End
%TypeHeaderCode
2017-04-24 15:52:13 +02:00
#include "qgslayertreemodellegendnode.h"
%End
public:
2017-04-25 08:27:52 +02:00
2017-04-24 15:52:13 +02:00
QgsImageLegendNode( QgsLayerTreeLayer *nodeLayer, const QImage &img, QObject *parent /TransferThis/ = 0 );
2017-04-25 08:27:52 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsImageLegendNode.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param nodeLayer: layer node
:param img: the image
:param parent: attach a parent QObject to the legend node.
2017-04-25 08:27:52 +02:00
%End
virtual QVariant data( int role ) const;
2017-04-24 15:52:13 +02:00
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;
};
class QgsRasterSymbolLegendNode : QgsLayerTreeModelLegendNode
{
2017-04-24 15:52:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Implementation of legend node interface for displaying raster legend entries
2017-04-24 15:52:13 +02:00
.. versionadded:: 2.6
%End
%TypeHeaderCode
2017-04-24 15:52:13 +02:00
#include "qgslayertreemodellegendnode.h"
%End
public:
2017-04-25 08:27:52 +02:00
2017-04-24 15:52:13 +02:00
QgsRasterSymbolLegendNode( QgsLayerTreeLayer *nodeLayer, const QColor &color, const QString &label, QObject *parent /TransferThis/ = 0 );
2017-04-25 08:27:52 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsRasterSymbolLegendNode.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param nodeLayer: layer node
:param color: color
:param label: label
:param parent: attach a parent QObject to the legend node.
2017-04-25 08:27:52 +02:00
%End
virtual QVariant data( int role ) const;
2017-04-24 15:52:13 +02:00
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;
};
2017-04-24 15:52:13 +02:00
class QgsWmsLegendNode : QgsLayerTreeModelLegendNode
{
2017-04-24 15:52:13 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Implementation of legend node interface for displaying WMS legend entries
2017-04-24 15:52:13 +02:00
.. versionadded:: 2.8
%End
%TypeHeaderCode
2017-04-24 15:52:13 +02:00
#include "qgslayertreemodellegendnode.h"
%End
public:
2017-04-24 15:52:13 +02:00
QgsWmsLegendNode( QgsLayerTreeLayer *nodeLayer, QObject *parent /TransferThis/ = 0 );
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsWmsLegendNode.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param nodeLayer: layer node
:param parent: attach a parent QObject to the legend node.
2017-04-24 15:52:13 +02:00
%End
virtual QVariant data( int role ) const;
2017-04-24 15:52:13 +02:00
virtual QSizeF drawSymbol( const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight ) const;
virtual void invalidateMapBasedData();
};
2017-04-24 15:52:13 +02:00
class QgsDataDefinedSizeLegendNode : QgsLayerTreeModelLegendNode
{
%Docstring
2017-12-15 10:36:55 -04:00
Produces legend node with a marker symbol
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgslayertreemodellegendnode.h"
%End
public:
QgsDataDefinedSizeLegendNode( QgsLayerTreeLayer *nodeLayer, const QgsDataDefinedSizeLegend &settings, QObject *parent /TransferThis/ = 0 );
%Docstring
Construct the node using QgsDataDefinedSizeLegend as definition of the node's appearance
%End
2017-06-26 12:18:34 +10:00
~QgsDataDefinedSizeLegendNode();
virtual QVariant data( int role ) const;
virtual ItemMetrics draw( const QgsLegendSettings &settings, ItemContext *ctx );
};
2017-04-24 15:52:13 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layertree/qgslayertreemodellegendnode.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/