QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
19 #ifndef QGSLAYERTREEMODELLEGENDNODE_H
20 #define QGSLAYERTREEMODELLEGENDNODE_H
26 #include "qgis_core.h"
55 if ( qobject_cast<QgsSymbolLegendNode *> ( sipCpp ) )
56 sipType = sipType_QgsSymbolLegendNode;
65 RuleKeyRole = Qt::UserRole,
76 virtual Qt::ItemFlags flags()
const;
79 virtual QVariant
data(
int role )
const = 0;
82 virtual bool setData(
const QVariant &value,
int role );
87 virtual QString
userLabel()
const {
return mUserLabel; }
88 virtual void setUserLabel(
const QString &userLabel ) { mUserLabel = userLabel; }
99 virtual QSizeF userPatchSize()
const;
110 virtual void setUserPatchSize( QSizeF size );
118 virtual void setColumnBreak(
bool breakBeforeNode ) { mColumnBreakBeforeNode = breakBeforeNode; }
126 virtual bool columnBreak()
const {
return mColumnBreakBeforeNode; }
128 virtual bool isScaleOK(
double scale )
const { Q_UNUSED( scale )
return true; }
145 QPainter *painter =
nullptr;
157 Q_DECL_DEPRECATED
double labelXOffset = 0.0;
171 double columnLeft = 0.0;
179 double columnRight = 0.0;
186 double maxSiblingSymbolWidth = 0.0;
274 bool mEmbeddedInParent;
278 bool mColumnBreakBeforeNode = false;
281 #include "qgslegendsymbolitem.h"
306 Qt::ItemFlags
flags()
const override;
307 QVariant
data(
int role )
const override;
308 bool setData(
const QVariant &value,
int role )
override;
318 bool isScaleOK(
double scale )
const override {
return mItem.isScaleOK( scale ); }
337 QSize minimumIconSize()
const;
391 QString symbolLabel()
const;
449 void checkAllItems();
457 void uncheckAllItems();
465 void toggleAllItems();
472 mutable QPixmap mPixmap;
474 bool mSymbolUsesMapUnits;
477 QString mTextOnSymbolLabel;
480 std::unique_ptr< QgsSymbol > mCustomSymbol;
483 static const int INDENT_SIZE = 20;
495 void checkAll(
bool state );
521 QVariant
data(
int role )
const override;
551 QVariant
data(
int role )
const override;
582 QVariant
data(
int role )
const override;
614 QVariant
data(
int role )
const override;
624 void getLegendGraphicFinished(
const QImage & );
625 void getLegendGraphicErrored(
const QString & );
626 void getLegendGraphicProgress( qint64, qint64 );
631 QImage getLegendGraphic()
const;
633 QImage renderMessage(
const QString &msg )
const;
639 mutable std::unique_ptr<QgsImageFetcher> mFetcher;
657 QVariant
data(
int role )
const override;
662 void cacheImage()
const;
664 mutable QImage mImage;
667 #endif // QGSLAYERTREEMODELLEGENDNODE_H
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Handles asynchronous download of images.
virtual bool isEmbeddedInParent() const
QgsTextFormat textOnSymbolTextFormat() const
Returns text format of the label to be shown on top of the symbol.
virtual void invalidateMapBasedData()
Notification from model that information from associated map view has changed.
virtual QVariant data(int role) const =0
Returns data associated with the item. Must be implemented in derived class.
QSizeF patchSize
Symbol patch size to render for the node.
Implementation of legend node interface for displaying arbitrary label with icon.
Q_DECL_DEPRECATED QPointF point
Top-left corner of the legend item.
Object that keeps configuration of appearance of marker symbol's data-defined size in legend.
Contains information about the context of a rendering operation.
bool isScaleOK(double scale) const override
QgsLegendPatchShape patchShape
The patch shape to render for the node.
The QgsLayerTreeModel class is model implementation for Qt item views framework.
Abstract base class for all rendered symbols.
Produces legend node with a marker symbol.
Represents a patch shape for use in map legends.
virtual QJsonObject exportSymbolToJson(const QgsLegendSettings &settings, const QgsRenderContext &context) const
Adds a symbol in base64 string within a JSON object with the key "icon".
virtual QString userLabel() const
void sizeChanged()
Emitted when the size of this node changes.
virtual Qt::ItemFlags flags() const
Returns item flags associated with the item. Default implementation returns Qt::ItemIsEnabled.
virtual ItemMetrics draw(const QgsLegendSettings &settings, ItemContext *ctx)
Entry point called from QgsLegendRenderer to do the rendering.
#define Q_NOWARN_DEPRECATED_POP
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Container for all settings relating to text rendering.
The class stores information about one class/rule of a vector layer renderer in a unified way that ca...
Layer tree node points to a map layer.
void setTextOnSymbolTextFormat(const QgsTextFormat &format)
Sets format of text to be shown on top of the symbol.
void setIconSize(QSize sz)
Set the icon size.
void setTextOnSymbolLabel(const QString &label)
Sets label of text to be shown on top of the symbol.
The QgsLegendSettings class stores the appearance and layout settings for legend drawing with QgsLege...
Implementation of legend node interface for displaying WMS legend entries.
Q_NOWARN_DEPRECATED_PUSH ItemContext()=default
virtual void setEmbeddedInParent(bool embedded)
virtual bool columnBreak() const
Returns whether a forced column break should occur before the node.
Single scope for storing variables and functions for use within a QgsExpressionContext.
virtual bool setData(const QVariant &value, int role)
Sets some data associated with the item. Default implementation does nothing and returns false.
virtual void setUserLabel(const QString &userLabel)
QgsLayerTreeLayer * layerNode() const
Returns pointer to the parent layer node.
void setUserLabel(const QString &userLabel) override
Implementation of legend node interface for displaying arbitrary raster image.
QString textOnSymbolLabel() const
Returns label of text to be shown on top of the symbol.
Implementation of legend node interface for displaying raster legend entries.
virtual QSizeF drawSymbol(const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight) const
Draws symbol on the left side of the item.
The QgsMapSettings class contains configuration for rendering of the map.
virtual bool isScaleOK(double scale) const
Implementation of legend node interface for displaying preview of vector symbols and their labels and...
#define Q_NOWARN_DEPRECATED_PUSH
void dataChanged()
Emitted on internal data change so the layer tree model can forward the signal to views.
virtual void setColumnBreak(bool breakBeforeNode)
Sets whether a forced column break should occur before the node.
The QgsLegendRendererItem class is abstract interface for legend items returned from QgsMapLayerLegen...