18#ifndef QGSLAYOUTITEMLEGEND_H
19#define QGSLAYOUTITEMLEGEND_H
54 QVariant
data(
const QModelIndex &index,
int role )
const override;
56 Qt::ItemFlags
flags(
const QModelIndex &index )
const override;
131 int type()
const override;
132 QIcon icon()
const override;
133 QgsLayoutItem::Flags itemFlags()
const override;
135 QString displayName()
const override;
140 void adjustBoxSize();
148 void setResizeToContents(
bool enabled );
154 bool resizeToContents()
const;
166 void setAutoUpdateModel(
bool autoUpdate );
173 bool autoUpdateModel()
const;
179 void setLegendFilterByMapEnabled(
bool enabled );
192 void setLegendFilterOutAtlas(
bool doFilter );
198 bool legendFilterOutAtlas()
const;
204 void setTitle(
const QString &title );
210 QString title()
const;
216 Qt::AlignmentFlag titleAlignment()
const;
222 void setTitleAlignment( Qt::AlignmentFlag alignment );
265 double lineSpacing()
const;
271 void setLineSpacing(
double spacing );
277 double boxSpace()
const;
283 void setBoxSpace(
double space );
289 double columnSpace()
const;
295 void setColumnSpace(
double spacing );
301 QColor fontColor()
const;
307 void setFontColor(
const QColor &color );
313 double symbolWidth()
const;
319 void setSymbolWidth(
double width );
327 double maximumSymbolSize()
const;
337 void setMaximumSymbolSize(
double size );
345 double minimumSymbolSize()
const;
355 void setMinimumSymbolSize(
double size );
365 void setSymbolAlignment( Qt::AlignmentFlag alignment );
375 Qt::AlignmentFlag symbolAlignment()
const;
381 double symbolHeight()
const;
387 void setSymbolHeight(
double height );
393 double wmsLegendWidth()
const;
399 void setWmsLegendWidth(
double width );
405 double wmsLegendHeight()
const;
411 void setWmsLegendHeight(
double height );
417 void setWrapString(
const QString &
string );
423 QString wrapString()
const;
435 void setColumnCount(
int count );
442 bool splitLayer()
const;
449 void setSplitLayer(
bool enabled );
455 bool equalColumnWidth()
const;
461 void setEqualColumnWidth(
bool equalize );
469 bool drawRasterStroke()
const;
478 void setDrawRasterStroke(
bool enabled );
487 QColor rasterStrokeColor()
const;
496 void setRasterStrokeColor(
const QColor &color );
505 double rasterStrokeWidth()
const;
514 void setRasterStrokeWidth(
double width );
535 QString themeName()
const;
545 void updateFilterByMap(
bool redraw =
true );
552 void paint( QPainter *painter,
const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget )
override;
554 void finalizeRestoreFromXml()
override;
557 ExportLayerBehavior exportLayerBehavior()
const override;
562 void refresh()
override;
567 bool writePropertiesToElement( QDomElement &element, QDomDocument &document,
const QgsReadWriteContext &context )
const override;
568 bool readPropertiesFromElement(
const QDomElement &element,
const QDomDocument &document,
const QgsReadWriteContext &context )
override;
573 void invalidateCurrentMap();
575 void updateFilterByMapAndRedraw();
579 void mapLayerStyleOverridesChanged();
581 void mapThemeChanged(
const QString &theme );
585 void onAtlasFeature();
590 void clearLegendCachedData();
600 void setModelStyleOverrides(
const QMap<QString, QString> &overrides );
602 std::unique_ptr< QgsLegendModel > mLegendModel;
603 std::unique_ptr< QgsLayerTreeGroup > mCustomLayerTree;
608 int mColumnCount = 1;
613 bool mLegendFilterByMap =
false;
614 bool mLegendFilterByExpression =
false;
617 bool mFilterOutAtlas =
false;
620 bool mFilterAskedForUpdate =
false;
622 void doUpdateFilterByMap();
624 bool mInAtlas =
false;
627 bool mInitialMapScaleCalculated =
false;
630 bool mForceResize =
false;
633 bool mSizeToContents =
true;
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Layer tree node points to a map layer.
The QgsLayerTreeModel class is model implementation for Qt item views framework.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Flags flags() const
Returns OR-ed combination of model flags.
QList< QgsLayerTreeModelLegendNode * > layerLegendNodes(QgsLayerTreeLayer *nodeLayer, bool skipNodeEmbeddedInParent=false)
Returns filtered list of active legend nodes attached to a particular layer node (by default it retur...
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
void nodeCustomPropertyChanged(QgsLayerTreeNode *node, const QString &key)
This class is a base class for nodes in a layer tree.
Namespace with helper functions for layer tree operations.
A layout item subclass for map legends.
QgsLegendModel * model()
Returns the legend model.
QgsLayoutItemMap * linkedMap() const
Returns the associated map.
const QgsLegendSettings & legendSettings() const
Returns the legend's renderer settings object.
bool legendFilterByMapEnabled() const
Find out whether legend items are filtered to show just the ones visible in the associated map.
Layout graphical items for displaying a map.
Contains settings and helpers relating to a render of a QgsLayoutItem.
Base class for graphical items within a QgsLayout.
DataDefinedProperty
Data defined properties for different item types.
@ AllProperties
All properties for item.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Item model implementation based on layer tree model for layout legend.
void refreshLegend()
Emitted to refresh the legend.
The QgsLegendRenderer class handles automatic layout and rendering of legend.
The QgsLegendSettings class stores the appearance and layout settings for legend drawing with QgsLege...
Contains detailed styling information relating to how a layout legend should be rendered.
Style
Component of legends which can be styled.
The class is used as a container of context for various read/write operations on other objects.
An interface for classes which can visit style entity (e.g.
Abstract base class for all rendered symbols.