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 );
279 Q_DECL_DEPRECATED
void setLineSpacing(
double spacing )
SIP_DEPRECATED;
285 double boxSpace() const;
291 void setBoxSpace(
double space );
297 double columnSpace() const;
303 void setColumnSpace(
double spacing );
319 Q_DECL_DEPRECATED
void setFontColor( const QColor &color )
SIP_DEPRECATED;
325 double symbolWidth() const;
331 void setSymbolWidth(
double width );
339 double maximumSymbolSize() const;
349 void setMaximumSymbolSize(
double size );
357 double minimumSymbolSize() const;
367 void setMinimumSymbolSize(
double size );
377 void setSymbolAlignment( Qt::AlignmentFlag alignment );
387 Qt::AlignmentFlag symbolAlignment() const;
393 double symbolHeight() const;
399 void setSymbolHeight(
double height );
405 double wmsLegendWidth() const;
411 void setWmsLegendWidth(
double width );
417 double wmsLegendHeight() const;
423 void setWmsLegendHeight(
double height );
429 void setWrapString( const QString &
string );
435 QString wrapString() const;
441 int columnCount() const;
447 void setColumnCount(
int count );
454 bool splitLayer() const;
461 void setSplitLayer(
bool enabled );
467 bool equalColumnWidth() const;
473 void setEqualColumnWidth(
bool equalize );
481 bool drawRasterStroke() const;
490 void setDrawRasterStroke(
bool enabled );
499 QColor rasterStrokeColor() const;
508 void setRasterStrokeColor( const QColor &color );
517 double rasterStrokeWidth() const;
526 void setRasterStrokeWidth(
double width );
549 void setFilterByMapItems(
const QList< QgsLayoutItemMap * > &maps );
559 QList< QgsLayoutItemMap * > filterByMapItems()
const;
568 QString themeName()
const;
578 void updateFilterByMap(
bool redraw =
true );
585 void paint( QPainter *painter,
const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget )
override;
587 void finalizeRestoreFromXml()
override;
590 ExportLayerBehavior exportLayerBehavior()
const override;
592 bool isRefreshing()
const override;
596 void refresh()
override;
597 void invalidateCache()
override;
602 bool writePropertiesToElement( QDomElement &element, QDomDocument &document,
const QgsReadWriteContext &context )
const override;
603 bool readPropertiesFromElement(
const QDomElement &element,
const QDomDocument &document,
const QgsReadWriteContext &context )
override;
608 void invalidateCurrentMap();
610 void updateFilterByMapAndRedraw();
614 void mapLayerStyleOverridesChanged();
616 void mapThemeChanged(
const QString &theme );
620 void onAtlasFeature();
625 void clearLegendCachedData();
635 void setModelStyleOverrides(
const QMap<QString, QString> &overrides );
637 std::unique_ptr< QgsLegendModel > mLegendModel;
638 std::unique_ptr< QgsLayerTreeGroup > mCustomLayerTree;
643 int mColumnCount = 1;
648 QList< QString > mFilterByMapUuids;
649 QList< QPointer< QgsLayoutItemMap >> mFilterByMapItems;
651 bool mLegendFilterByMap =
false;
652 bool mLegendFilterByExpression =
false;
655 bool mFilterOutAtlas =
false;
658 bool mFilterAskedForUpdate =
false;
660 void doUpdateFilterByMap();
662 bool mInAtlas =
false;
665 bool mInitialMapScaleCalculated =
false;
668 bool mForceResize =
false;
671 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.
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.
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.