QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
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;
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; }
144 QPainter *painter =
nullptr;
156 Q_DECL_DEPRECATED
double labelXOffset = 0.0;
170 double columnLeft = 0.0;
178 double columnRight = 0.0;
185 double maxSiblingSymbolWidth = 0.0;
266 bool mEmbeddedInParent;
270 bool mColumnBreakBeforeNode = false;
273 #include "qgslegendsymbolitem.h"
298 Qt::ItemFlags
flags()
const override;
299 QVariant
data(
int role )
const override;
300 bool setData(
const QVariant &value,
int role )
override;
310 bool isScaleOK(
double scale )
const override {
return mItem.isScaleOK( scale ); }
329 QSize minimumIconSize()
const;
383 QString symbolLabel()
const;
441 void checkAllItems();
449 void uncheckAllItems();
457 void toggleAllItems();
464 mutable QPixmap mPixmap;
466 bool mSymbolUsesMapUnits;
469 QString mTextOnSymbolLabel;
472 std::unique_ptr< QgsSymbol > mCustomSymbol;
475 static const int INDENT_SIZE = 20;
487 void checkAll(
bool state );
513 QVariant
data(
int role )
const override;
543 QVariant
data(
int role )
const override;
574 QVariant
data(
int role )
const override;
606 QVariant
data(
int role )
const override;
616 void getLegendGraphicFinished(
const QImage & );
617 void getLegendGraphicErrored(
const QString & );
618 void getLegendGraphicProgress( qint64, qint64 );
623 QImage getLegendGraphic()
const;
625 QImage renderMessage(
const QString &msg )
const;
631 mutable std::unique_ptr<QgsImageFetcher> mFetcher;
649 QVariant
data(
int role )
const override;
654 void cacheImage()
const;
656 mutable QImage mImage;
659 #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.
Q_DECL_DEPRECATED QPointF point
Top-left corner of the legend item.
virtual void setUserPatchSize(QSizeF size)
Sets the user (overridden) size for the legend node.
bool isScaleOK(double scale) const override
QgsLegendPatchShape patchShape
The patch shape to render for the node.
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
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)
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...
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
QString textOnSymbolLabel() const
Returns label of text to be shown on top of the symbol.
virtual QSizeF drawSymbol(const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight) const
Draws symbol on the left side of the item.
virtual bool isScaleOK(double scale) const
#define Q_NOWARN_DEPRECATED_PUSH
virtual void setColumnBreak(bool breakBeforeNode)
Sets whether a forced column break should occur before the node.