19#ifndef QGSLAYERTREEMODELLEGENDNODE_H
20#define QGSLAYERTREEMODELLEGENDNODE_H
59 if ( qobject_cast<QgsSymbolLegendNode *> ( sipCpp ) )
60 sipType = sipType_QgsSymbolLegendNode;
61 else if ( qobject_cast<QgsDataDefinedSizeLegendNode *> ( sipCpp ) )
62 sipType = sipType_QgsDataDefinedSizeLegendNode;
63 else if ( qobject_cast<QgsImageLegendNode *> ( sipCpp ) )
64 sipType = sipType_QgsImageLegendNode;
65 else if ( qobject_cast<QgsRasterSymbolLegendNode *> ( sipCpp ) )
66 sipType = sipType_QgsRasterSymbolLegendNode;
67 else if ( qobject_cast<QgsSimpleLegendNode *> ( sipCpp ) )
68 sipType = sipType_QgsSimpleLegendNode;
69 else if ( qobject_cast<QgsWmsLegendNode *> ( sipCpp ) )
70 sipType = sipType_QgsWmsLegendNode;
71 else if ( qobject_cast<QgsColorRampLegendNode *> ( sipCpp ) )
72 sipType = sipType_QgsColorRampLegendNode;
120 virtual Qt::ItemFlags flags()
const;
123 virtual QVariant
data(
int role )
const = 0;
126 virtual bool setData(
const QVariant &value,
int role );
131 virtual QString
userLabel()
const {
return mUserLabel; }
132 virtual void setUserLabel(
const QString &userLabel ) { mUserLabel = userLabel; }
143 virtual QSizeF userPatchSize()
const;
154 virtual void setUserPatchSize( QSizeF size );
162 virtual void setColumnBreak(
bool breakBeforeNode ) { mColumnBreakBeforeNode = breakBeforeNode; }
170 virtual bool columnBreak()
const {
return mColumnBreakBeforeNode; }
172 virtual bool isScaleOK(
double scale )
const { Q_UNUSED( scale )
return true; }
189 QPainter *painter =
nullptr;
201 Q_DECL_DEPRECATED
double labelXOffset = 0.0;
215 double columnLeft = 0.0;
223 double columnRight = 0.0;
230 double maxSiblingSymbolWidth = 0.0;
321 SIP_PYOBJECT __repr__();
323 QString
str = QStringLiteral(
"<QgsLayerTreeModelLegendNode: \"%1\">" ).arg( sipCpp->data( Qt::DisplayRole ).toString() );
324 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
336 void checkAllItems();
344 void uncheckAllItems();
352 void toggleAllItems();
374 bool mEmbeddedInParent;
378 bool mColumnBreakBeforeNode = false;
386 void checkAll(
bool state );
390#include "qgslegendsymbolitem.h"
417 Qt::ItemFlags flags()
const override;
418 QVariant data(
int role )
const override;
419 bool setData(
const QVariant &value,
int role )
override;
425 void setEmbeddedInParent(
bool embedded )
override;
427 void setUserLabel(
const QString &userLabel )
override { mUserLabel = userLabel; updateLabel(); }
429 bool isScaleOK(
double scale )
const override {
return mItem.isScaleOK( scale ); }
431 void invalidateMapBasedData()
override;
436 void setIconSize( QSize sz );
445 QSize minimumIconSize()
const;
496 QString symbolLabel()
const;
556 SIP_PYOBJECT __repr__();
558 QString
str = QStringLiteral(
"<QgsSymbolLegendNode: %1 \"%2\"" ).arg(
560 sipCpp->data( Qt::DisplayRole ).toString() );
561 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
570 mutable QPixmap mPixmap;
572 bool mSymbolUsesMapUnits;
576 QString mTextOnSymbolLabel;
579 std::unique_ptr< QgsSymbol > mCustomSymbol;
582 static const int INDENT_SIZE = 20;
608 QVariant data(
int role )
const override;
611 SIP_PYOBJECT __repr__();
613 QString
str = QStringLiteral(
"<QgsSimpleLegendNode: \"%1\">" ).arg( sipCpp->data( Qt::DisplayRole ).toString() );
614 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
645 QVariant data(
int role )
const override;
652 SIP_PYOBJECT __repr__();
654 QString
str = QStringLiteral(
"<QgsImageLegendNode: \"%1\">" ).arg( sipCpp->data( Qt::DisplayRole ).toString() );
655 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
685 bool isCheckable =
false,
const QString &ruleKey = QString(),
const QString &parentRuleKey = QString() );
687 Qt::ItemFlags flags()
const override;
688 QVariant data(
int role )
const override;
689 bool setData(
const QVariant &value,
int role )
override;
708 SIP_PYOBJECT __repr__();
710 QString
str = QStringLiteral(
"<QgsRasterSymbolLegendNode: \"%1\">" ).arg( sipCpp->data( Qt::DisplayRole ).toString() );
711 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
718 bool mCheckable =
false;
720 QString mParentRuleKey;
745 QVariant data(
int role )
const override;
751 void invalidateMapBasedData()
override;
757 QImage getLegendGraphicBlocking( )
const;
761 SIP_PYOBJECT __repr__();
763 QString
str = QStringLiteral(
"<QgsWmsLegendNode: \"%1\">" ).arg( sipCpp->data( Qt::DisplayRole ).toString() );
764 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
770 void getLegendGraphicFinished(
const QImage & );
771 void getLegendGraphicErrored(
const QString & );
772 void getLegendGraphicProgress( qint64, qint64 );
777 QImage getLegendGraphic(
bool synchronous =
false )
const;
779 QImage renderMessage(
const QString &msg )
const;
785 mutable std::unique_ptr<QgsImageFetcher> mFetcher;
802 QVariant data(
int role )
const override;
807 SIP_PYOBJECT __repr__();
809 QString
str = QStringLiteral(
"<QgsDataDefinedSizeLegendNode: \"%1\">" ).arg( sipCpp->data( Qt::DisplayRole ).toString() );
810 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
815 void cacheImage()
const;
817 mutable QImage mImage;
844 QVariant data(
int role )
const override;
864 SIP_PYOBJECT __repr__();
866 QString
str = QStringLiteral(
"<QgsVectorLabelLegendNode: \"%1\">" ).arg( sipCpp->data( Qt::DisplayRole ).toString() );
867 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
874 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.
@ SymbolLegend
Vector symbol legend node type.
CustomRole
Legend node data roles.
@ RuleKey
Rule key of the node (QString)
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.
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.
Stores properties relating to a screen.
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 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)
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Q_DECLARE_METATYPE(QgsDatabaseQueryLogEntry)
Q_NOWARN_DEPRECATED_PUSH ItemContext()=default
QgsLegendPatchShape patchShape
The patch shape to render for the node.
QgsScreenProperties screenProperties
Destination screen properties.
QSizeF patchSize
Symbol patch size to render for the node.
Q_DECL_DEPRECATED QPointF point
Top-left corner of the legend item.