19#ifndef QGSLAYERTREEMODELLEGENDNODE_H
20#define QGSLAYERTREEMODELLEGENDNODE_H
60 if ( qobject_cast<QgsSymbolLegendNode *> ( sipCpp ) )
61 sipType = sipType_QgsSymbolLegendNode;
62 else if ( qobject_cast<QgsDataDefinedSizeLegendNode *> ( sipCpp ) )
63 sipType = sipType_QgsDataDefinedSizeLegendNode;
64 else if ( qobject_cast<QgsImageLegendNode *> ( sipCpp ) )
65 sipType = sipType_QgsImageLegendNode;
66 else if ( qobject_cast<QgsRasterSymbolLegendNode *> ( sipCpp ) )
67 sipType = sipType_QgsRasterSymbolLegendNode;
68 else if ( qobject_cast<QgsSimpleLegendNode *> ( sipCpp ) )
69 sipType = sipType_QgsSimpleLegendNode;
70 else if ( qobject_cast<QgsWmsLegendNode *> ( sipCpp ) )
71 sipType = sipType_QgsWmsLegendNode;
72 else if ( qobject_cast<QgsColorRampLegendNode *> ( sipCpp ) )
73 sipType = sipType_QgsColorRampLegendNode;
86 RuleKeyRole = Qt::UserRole,
111 virtual Qt::ItemFlags flags()
const;
114 virtual QVariant
data(
int role )
const = 0;
117 virtual bool setData(
const QVariant &value,
int role );
122 virtual QString
userLabel()
const {
return mUserLabel; }
123 virtual void setUserLabel(
const QString &userLabel ) { mUserLabel = userLabel; }
134 virtual QSizeF userPatchSize()
const;
145 virtual void setUserPatchSize( QSizeF size );
153 virtual void setColumnBreak(
bool breakBeforeNode ) { mColumnBreakBeforeNode = breakBeforeNode; }
161 virtual bool columnBreak()
const {
return mColumnBreakBeforeNode; }
163 virtual bool isScaleOK(
double scale )
const { Q_UNUSED( scale )
return true; }
180 QPainter *painter =
nullptr;
192 Q_DECL_DEPRECATED
double labelXOffset = 0.0;
206 double columnLeft = 0.0;
214 double columnRight = 0.0;
221 double maxSiblingSymbolWidth = 0.0;
312 void checkAllItems();
320 void uncheckAllItems();
328 void toggleAllItems();
350 bool mEmbeddedInParent;
354 bool mColumnBreakBeforeNode = false;
362 void checkAll(
bool state );
366#include "qgslegendsymbolitem.h"
394 Qt::ItemFlags flags()
const override;
395 QVariant data(
int role )
const override;
396 bool setData(
const QVariant &value,
int role )
override;
402 void setEmbeddedInParent(
bool embedded )
override;
404 void setUserLabel(
const QString &userLabel )
override { mUserLabel = userLabel; updateLabel(); }
406 bool isScaleOK(
double scale )
const override {
return mItem.isScaleOK( scale ); }
408 void invalidateMapBasedData()
override;
425 QSize minimumIconSize()
const;
479 QString symbolLabel()
const;
534 mutable QPixmap mPixmap;
536 bool mSymbolUsesMapUnits;
540 QString mTextOnSymbolLabel;
543 std::unique_ptr< QgsSymbol > mCustomSymbol;
546 static const int INDENT_SIZE = 20;
579 QVariant data(
int role )
const override;
609 QVariant data(
int role )
const override;
642 Qt::ItemFlags flags()
const override;
643 QVariant data(
int role )
const override;
644 bool setData(
const QVariant &value,
int role )
override;
665 bool mCheckable =
false;
692 QVariant data(
int role )
const override;
698 void invalidateMapBasedData()
override;
702 void getLegendGraphicFinished(
const QImage & );
703 void getLegendGraphicErrored(
const QString & );
704 void getLegendGraphicProgress( qint64, qint64 );
709 QImage getLegendGraphic()
const;
711 QImage renderMessage(
const QString &msg )
const;
717 mutable std::unique_ptr<QgsImageFetcher> mFetcher;
735 QVariant data(
int role )
const override;
740 void cacheImage()
const;
742 mutable QImage mImage;
769 QVariant data(
int role )
const override;
791 void textWidthHeight(
double &width,
double &height,
QgsRenderContext &ctx,
const QgsTextFormat &textFormat,
const QStringList &textLines )
const;
Produces legend node with a marker symbol.
Object that keeps configuration of appearance of marker symbol's data-defined size in legend.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Handles asynchronous download of images.
Implementation of legend node interface for displaying arbitrary raster image.
Layer tree node points to a map layer.
The QgsLegendRendererItem class is abstract interface for legend items returned from QgsMapLayerLegen...
virtual QVariant data(int role) const =0
Returns data associated with the item. Must be implemented in derived class.
virtual bool columnBreak() const
Returns whether a forced column break should occur before the node.
NodeTypes
Types of legend nodes.
@ SimpleLegend
Simple label with icon legend node type.
@ RasterSymbolLegend
Raster symbol legend node type.
@ ImageLegend
Raster image legend node type.
@ DataDefinedSizeLegend
Marker symbol legend node type.
@ WmsLegend
WMS legend node type.
@ EmbeddedWidget
Embedded widget placeholder node type.
@ ColorRampLegend
Color ramp legend (since QGIS 3.18)
@ SymbolLegend
Vector symbol legend node type.
virtual QString userLabel() const
virtual bool isScaleOK(double scale) const
virtual void setColumnBreak(bool breakBeforeNode)
Sets whether a forced column break should occur before the node.
virtual void invalidateMapBasedData()
Notification from model that information from associated map view has changed.
LegendNodeRoles
Legend node data roles.
@ ParentRuleKeyRole
Rule key of the parent legend node - for legends with tree hierarchy (QString). Added in 2....
@ NodeTypeRole
Type of node. Added in 3.16.
void sizeChanged()
Emitted when the size of this node changes.
void dataChanged()
Emitted on internal data change so the layer tree model can forward the signal to views.
virtual bool isEmbeddedInParent() const
QgsLayerTreeLayer * layerNode() const
Returns pointer to the parent layer node.
virtual void setEmbeddedInParent(bool embedded)
virtual void setUserLabel(const QString &userLabel)
The QgsLayerTreeModel class is model implementation for Qt item views framework.
Represents a patch shape for use in map legends.
The QgsLegendSettings class stores the appearance and layout settings for legend drawing with QgsLege...
The class stores information about one class/rule of a vector layer renderer in a unified way that ca...
The QgsMapSettings class contains configuration for rendering of the map.
Contains settings for how a map layer will be labeled.
Implementation of legend node interface for displaying raster legend entries.
QString ruleKey() const
Returns the unique identifier of node for identification of the item within renderer.
bool isCheckable() const
Returns whether the item is user-checkable - whether renderer supports enabling/disabling it.
Contains information about the context of a rendering operation.
Implementation of legend node interface for displaying arbitrary label with icon.
Implementation of legend node interface for displaying preview of vector symbols and their labels and...
static double MAXIMUM_SIZE
QString textOnSymbolLabel() const
Returns label of text to be shown on top of the symbol.
void setIconSize(QSize sz)
Set the icon size.
void setUserLabel(const QString &userLabel) override
void setTextOnSymbolTextFormat(const QgsTextFormat &format)
Sets format of text to be shown on top of the symbol.
void setTextOnSymbolLabel(const QString &label)
Sets label of text to be shown on top of the symbol.
bool isScaleOK(double scale) const override
static double MINIMUM_SIZE
QgsTextFormat textOnSymbolTextFormat() const
Returns text format of the label to be shown on top of the symbol.
Abstract base class for all rendered symbols.
Contains pre-calculated metrics of a QgsTextDocument.
Represents a document consisting of one or more QgsTextBlock objects.
Container for all settings relating to text rendering.
Produces legend node for a labeling text symbol.
Implementation of legend node interface for displaying WMS legend entries.
~QgsWmsLegendNode() override
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
Q_NOWARN_DEPRECATED_PUSH ItemContext()=default
QgsLegendPatchShape patchShape
The patch shape to render for the node.
QSizeF patchSize
Symbol patch size to render for the node.
Q_DECL_DEPRECATED QPointF point
Top-left corner of the legend item.