33 #include <QDomDocument> 34 #include <QDomElement> 39 , mLegendModel( new
QgsLegendModel( layout->project()->layerTreeRoot() ) )
41 #if 0 //no longer required? 42 connect( &layout->atlasComposition(), &QgsAtlasComposition::renderEnded,
this, &QgsLayoutItemLegend::onAtlasEnded );
45 mTitle = mSettings.
title();
77 if ( mFilterAskedForUpdate )
79 mFilterAskedForUpdate =
false;
80 doUpdateFilterByMap();
83 int dpi = painter->device()->logicalDpiX();
84 double dotsPerMM = dpi / 25.4;
96 QSizeF mapSizePixels = QSizeF( mMap->rect().width() * dotsPerMM, mMap->rect().height() * dotsPerMM );
102 mInitialMapScaleCalculated =
true;
105 legendRenderer.
setLegendSize( mForceResize && mSizeToContents ? QSize() : rect().size() );
108 if ( mSizeToContents )
110 QSizeF size = legendRenderer.minimumSize();
113 mForceResize =
false;
119 else if ( size.height() > rect().height() || size.width() > rect().width() )
122 QSizeF targetSize = rect().size();
123 if ( size.height() > targetSize.height() )
124 targetSize.setHeight( size.height() );
125 if ( size.width() > targetSize.width() )
126 targetSize.setWidth( size.width() );
138 if ( !mMapUuid.isEmpty() )
140 setLinkedMap( qobject_cast< QgsLayoutItemMap * >(
mLayout->itemByUuid( mMapUuid,
true ) ) );
158 painter->setPen( QPen( QColor( 0, 0, 0 ) ) );
160 if ( !mSizeToContents )
163 QRectF thisPaintRect = QRectF( 0, 0, rect().width(), rect().height() );
164 painter->setClipRect( thisPaintRect );
168 legendRenderer.
setLegendSize( mSizeToContents ? QSize() : rect().size() );
170 legendRenderer.drawLegend( painter );
177 if ( !mSizeToContents )
180 if ( !mInitialMapScaleCalculated )
191 QgsDebugMsg( QStringLiteral(
"width = %1 height = %2" ).arg( size.width() ).arg( size.height() ) );
192 if ( size.isValid() )
202 mSizeToContents = enabled;
207 return mSizeToContents;
210 void QgsLayoutItemLegend::setCustomLayerTree(
QgsLayerTree *rootGroup )
212 mLegendModel->setRootGroup( rootGroup ? rootGroup : (
mLayout ?
mLayout->project()->layerTreeRoot() : nullptr ) );
214 mCustomLayerTree.reset( rootGroup );
222 setCustomLayerTree( autoUpdate ?
nullptr :
mLayout->project()->layerTreeRoot()->clone() );
227 void QgsLayoutItemLegend::nodeCustomPropertyChanged(
QgsLayerTreeNode *,
const QString & )
239 return !mCustomLayerTree;
244 mLegendFilterByMap = enabled;
253 if (
mLayout &&
id().isEmpty() )
256 mLayout->itemsModel()->updateItemDisplayName(
this );
276 return mSettings.
rstyle( s );
281 return mSettings.
style( s );
470 legendElem.setAttribute( QStringLiteral(
"title" ), mTitle );
471 legendElem.setAttribute( QStringLiteral(
"titleAlignment" ), QString::number( static_cast< int >( mSettings.
titleAlignment() ) ) );
472 legendElem.setAttribute( QStringLiteral(
"columnCount" ), QString::number( mColumnCount ) );
473 legendElem.setAttribute( QStringLiteral(
"splitLayer" ), QString::number( mSettings.
splitLayer() ) );
474 legendElem.setAttribute( QStringLiteral(
"equalColumnWidth" ), QString::number( mSettings.
equalColumnWidth() ) );
476 legendElem.setAttribute( QStringLiteral(
"boxSpace" ), QString::number( mSettings.
boxSpace() ) );
477 legendElem.setAttribute( QStringLiteral(
"columnSpace" ), QString::number( mSettings.
columnSpace() ) );
479 legendElem.setAttribute( QStringLiteral(
"symbolWidth" ), QString::number( mSettings.
symbolSize().width() ) );
480 legendElem.setAttribute( QStringLiteral(
"symbolHeight" ), QString::number( mSettings.
symbolSize().height() ) );
481 legendElem.setAttribute( QStringLiteral(
"lineSpacing" ), QString::number( mSettings.
lineSpacing() ) );
483 legendElem.setAttribute( QStringLiteral(
"rasterBorder" ), mSettings.
drawRasterStroke() );
485 legendElem.setAttribute( QStringLiteral(
"rasterBorderWidth" ), QString::number( mSettings.
rasterStrokeWidth() ) );
487 legendElem.setAttribute( QStringLiteral(
"wmsLegendWidth" ), QString::number( mSettings.
wmsLegendSize().width() ) );
488 legendElem.setAttribute( QStringLiteral(
"wmsLegendHeight" ), QString::number( mSettings.
wmsLegendSize().height() ) );
489 legendElem.setAttribute( QStringLiteral(
"wrapChar" ), mSettings.
wrapChar() );
490 legendElem.setAttribute( QStringLiteral(
"fontColor" ), mSettings.
fontColor().name() );
492 legendElem.setAttribute( QStringLiteral(
"resizeToContents" ), mSizeToContents );
496 legendElem.setAttribute( QStringLiteral(
"map_uuid" ), mMap->
uuid() );
499 QDomElement legendStyles = doc.createElement( QStringLiteral(
"styles" ) );
500 legendElem.appendChild( legendStyles );
508 if ( mCustomLayerTree )
511 mCustomLayerTree->writeXml( legendElem, context );
514 if ( mLegendFilterByMap )
516 legendElem.setAttribute( QStringLiteral(
"legendFilterByMap" ), QStringLiteral(
"1" ) );
518 legendElem.setAttribute( QStringLiteral(
"legendFilterByAtlas" ), mFilterOutAtlas ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
526 mTitle = itemElem.attribute( QStringLiteral(
"title" ) );
528 if ( !itemElem.attribute( QStringLiteral(
"titleAlignment" ) ).isEmpty() )
530 mSettings.
setTitleAlignment( static_cast< Qt::AlignmentFlag >( itemElem.attribute( QStringLiteral(
"titleAlignment" ) ).toInt() ) );
532 int colCount = itemElem.attribute( QStringLiteral(
"columnCount" ), QStringLiteral(
"1" ) ).toInt();
533 if ( colCount < 1 ) colCount = 1;
534 mColumnCount = colCount;
536 mSettings.
setSplitLayer( itemElem.attribute( QStringLiteral(
"splitLayer" ), QStringLiteral(
"0" ) ).toInt() == 1 );
537 mSettings.
setEqualColumnWidth( itemElem.attribute( QStringLiteral(
"equalColumnWidth" ), QStringLiteral(
"0" ) ).toInt() == 1 );
539 QDomNodeList stylesNodeList = itemElem.elementsByTagName( QStringLiteral(
"styles" ) );
540 if ( !stylesNodeList.isEmpty() )
542 QDomNode stylesNode = stylesNodeList.at( 0 );
543 for (
int i = 0; i < stylesNode.childNodes().size(); i++ )
545 QDomElement styleElem = stylesNode.childNodes().at( i ).toElement();
547 style.
readXml( styleElem, doc );
548 QString name = styleElem.attribute( QStringLiteral(
"name" ) );
562 fontClr.setNamedColor( itemElem.attribute( QStringLiteral(
"fontColor" ), QStringLiteral(
"#000000" ) ) );
566 mSettings.
setBoxSpace( itemElem.attribute( QStringLiteral(
"boxSpace" ), QStringLiteral(
"2.0" ) ).toDouble() );
567 mSettings.
setColumnSpace( itemElem.attribute( QStringLiteral(
"columnSpace" ), QStringLiteral(
"2.0" ) ).toDouble() );
569 mSettings.
setSymbolSize( QSizeF( itemElem.attribute( QStringLiteral(
"symbolWidth" ), QStringLiteral(
"7.0" ) ).toDouble(), itemElem.attribute( QStringLiteral(
"symbolHeight" ), QStringLiteral(
"14.0" ) ).toDouble() ) );
570 mSettings.
setWmsLegendSize( QSizeF( itemElem.attribute( QStringLiteral(
"wmsLegendWidth" ), QStringLiteral(
"50" ) ).toDouble(), itemElem.attribute( QStringLiteral(
"wmsLegendHeight" ), QStringLiteral(
"25" ) ).toDouble() ) );
571 mSettings.
setLineSpacing( itemElem.attribute( QStringLiteral(
"lineSpacing" ), QStringLiteral(
"1.0" ) ).toDouble() );
573 mSettings.
setDrawRasterStroke( itemElem.attribute( QStringLiteral(
"rasterBorder" ), QStringLiteral(
"1" ) ) != QLatin1String(
"0" ) );
575 mSettings.
setRasterStrokeWidth( itemElem.attribute( QStringLiteral(
"rasterBorderWidth" ), QStringLiteral(
"0" ) ).toDouble() );
577 mSettings.
setWrapChar( itemElem.attribute( QStringLiteral(
"wrapChar" ) ) );
579 mSizeToContents = itemElem.attribute( QStringLiteral(
"resizeToContents" ), QStringLiteral(
"1" ) ) != QLatin1String(
"0" );
582 mLegendFilterByMap = itemElem.attribute( QStringLiteral(
"legendFilterByMap" ), QStringLiteral(
"0" ) ).toInt();
585 if ( !itemElem.attribute( QStringLiteral(
"map_uuid" ) ).isEmpty() )
587 mMapUuid = itemElem.attribute( QStringLiteral(
"map_uuid" ) );
590 setupMapConnections( mMap,
false );
593 mFilterOutAtlas = itemElem.attribute( QStringLiteral(
"legendFilterByAtlas" ), QStringLiteral(
"0" ) ).toInt();
596 QDomElement layerTreeElem = itemElem.firstChildElement( QStringLiteral(
"layer-tree" ) );
597 if ( layerTreeElem.isNull() )
598 layerTreeElem = itemElem.firstChildElement( QStringLiteral(
"layer-tree-group" ) );
600 if ( !layerTreeElem.isNull() )
604 tree->resolveReferences(
mLayout->project(), true );
605 setCustomLayerTree( tree.release() );
608 setCustomLayerTree(
nullptr );
615 if ( !
id().isEmpty() )
621 QString text = mSettings.
title();
622 if ( text.isEmpty() )
624 return tr(
"<Legend>" );
626 if ( text.length() > 25 )
628 return tr(
"%1…" ).arg( text.left( 25 ) );
637 void QgsLayoutItemLegend::setupMapConnections(
QgsLayoutItemMap *map,
bool connectSlots )
644 disconnect( map, &QObject::destroyed,
this, &QgsLayoutItemLegend::invalidateCurrentMap );
651 connect( map, &QObject::destroyed,
this, &QgsLayoutItemLegend::invalidateCurrentMap );
662 setupMapConnections( mMap,
false );
669 setupMapConnections( mMap,
true );
675 void QgsLayoutItemLegend::invalidateCurrentMap()
684 bool forceUpdate =
false;
700 if ( ok && cols >= 0 )
716 void QgsLayoutItemLegend::updateFilterByMapAndRedraw()
721 void QgsLayoutItemLegend::mapLayerStyleOverridesChanged()
727 if ( mLegendFilterByMap )
737 Q_FOREACH (
QgsLayerTreeLayer *nodeLayer, mLegendModel->rootGroup()->findLayers() )
738 mLegendModel->refreshLayerLegend( nodeLayer );
750 mFilterAskedForUpdate =
true;
756 void QgsLayoutItemLegend::doUpdateFilterByMap()
761 mLegendModel->setLayerStyleOverrides( QMap<QString, QString>() );
766 if ( mMap && ( mLegendFilterByMap || filterByExpression || mInAtlas ) )
768 int dpi =
mLayout->renderContext().dpi();
772 QSizeF size( requestRectangle.
width(), requestRectangle.
height() );
780 filterPolygon =
mLayout->reportContext().currentGeometry( mMap->
crs() );
782 mLegendModel->setLegendFilter( &ms, mInAtlas || mLegendFilterByMap, filterPolygon,
true );
785 mLegendModel->setLegendFilterByMap(
nullptr );
792 mFilterOutAtlas = doFilter;
797 return mFilterOutAtlas;
800 void QgsLayoutItemLegend::onAtlasFeature()
802 if ( !
mLayout->reportContext().feature().isValid() )
804 mInAtlas = mFilterOutAtlas;
808 void QgsLayoutItemLegend::onAtlasEnded()
830 if (
QgsLayerTree::isLayer( node ) && ( role == Qt::DisplayRole || role == Qt::EditRole ) && !node->customProperty( QStringLiteral(
"legend/title-label" ) ).isNull() )
833 QString name = node->customProperty( QStringLiteral(
"legend/title-label" ) ).toString();
834 if ( nodeLayer->
customProperty( QStringLiteral(
"showFeatureCount" ), 0 ).toInt() && role == Qt::DisplayRole )
838 name += QStringLiteral(
" [%1]" ).arg( vlayer->
featureCount() );
void setTitleAlignment(Qt::AlignmentFlag alignment)
Sets the alignment of the legend title.
void setColumnSpace(double spacing)
Sets the legend column spacing.
void setWrapChar(const QString &t)
The class is used as a container of context for various read/write operations on other objects...
void setEqualColumnWidth(bool equalize)
Sets whether column widths should be equalized.
void setLegendSize(QSizeF s)
Sets the preferred resulting legend size.
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
void setFontColor(const QColor &color)
Sets the legend font color.
void setLegendFilterOutAtlas(bool doFilter)
When set to true, during an atlas rendering, it will filter out legend elements where features are ou...
static QgsLayerTreeLayer * toLayer(QgsLayerTreeNode *node)
Cast node to a layer.
A rectangle specified with double values.
void setTitle(const QString &title)
Sets the legend title.
void setEqualColumnWidth(bool s)
Item model implementation based on layer tree model for layout legend.
int columnCount() const
Returns the legend column count.
void setBoxSpace(double s)
void setMmPerMapUnit(double mmPerMapUnit)
void setSplitLayer(bool enabled)
Sets whether the legend items from a single layer can be split over multiple columns.
double lineSpacing() const
Base class for graphical items within a QgsLayout.
void setSymbolWidth(double width)
Sets the legend symbol width.
QgsMapSettings mapSettings(const QgsRectangle &extent, QSizeF size, double dpi, bool includeLayerSettings) const
Returns map settings that will be used for drawing of the map.
double scale() const
Returns the calculated map scale.
bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const override
Stores item state within an XML DOM element.
double wmsLegendHeight() const
Returns the WMS legend height.
double lineSpacing() const
Returns the spacing in-between lines in layout units.
double rasterStrokeWidth() const
Returns the stroke width (in layout units) for the stroke drawn around raster symbol items...
QVariant customProperty(const QString &key, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer. Properties are stored in a map and saved in project file...
QString valueAsString(int key, const QgsExpressionContext &context, const QString &defaultString=QString(), bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a string...
void paint(QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget) override
QgsMapLayer * layer() const
Returns the map layer associated with this node.
double wmsLegendWidth() const
Returns the WMS legend width.
int type() const override
QMap< QString, QString > layerStyleOverrides() const
Returns stored overrides of styles for layers.
void setSymbolSize(QSizeF s)
void extentChanged()
Is emitted when the map's extent changes.
QgsRectangle requestedExtent() const
Calculates the extent to request and the yShift of the top-left point in case of rotation.
bool splitLayer() const
Returns whether the legend items from a single layer can be split over multiple columns.
double columnSpace() const
Flags flags() const
Returns OR-ed combination of model flags.
Composer legend components style.
void updateFilterByMap(bool redraw=true)
Updates the legend content when filtered by map.
A geometry is the spatial representation of a feature.
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
void setStyle(QgsLegendStyle::Style component, const QgsLegendStyle &style)
Sets the style of component to style for the legend.
void setLegendFilterByMapEnabled(bool enabled)
Set whether legend items should be filtered to show just the ones visible in the associated map...
double scaleFactor() const
Returns the scaling factor for the render to convert painter units to physical sizes.
bool drawRasterStroke() const
Returns whether a stroke will be drawn around raster symbol items.
QgsLegendStyle style(QgsLegendStyle::Style s) const
Returns legend style.
QString title() const
Returns the legend title.
bool equalColumnWidth() const
virtual void refreshDataDefinedProperty(QgsLayoutObject::DataDefinedProperty property=QgsLayoutObject::AllProperties)
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the...
Allow check boxes for legend nodes (if supported by layer's legend)
QgsLayoutSize sizeWithUnits() const
Returns the item's current size, including units.
bool autoUpdateModel() const
Returns whether the legend content should auto update to reflect changes in the project's layer tree...
void setDrawRasterStroke(bool enabled)
Sets whether a stroke will be drawn around raster symbol items.
The QgsMapSettings class contains configuration for rendering of the map.
static QString encodeColor(const QColor &color)
QString displayName() const override
Gets item display name.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
The QgsLayerTreeModel class is model implementation for Qt item views framework.
void adjustBoxSize()
Sets the legend's item bounds to fit the whole legend content.
Layout graphical items for displaying a map.
void setFont(const QFont &font)
The font for this style.
QgsPropertyCollection mDataDefinedProperties
bool legendFilterOutAtlas() const
Returns whether to filter out legend elements outside of the current atlas feature.
void draw(QgsLayoutItemRenderContext &context) override
Draws the item's contents using the specified item render context.
Namespace with helper functions for layer tree operations.
void finalizeRestoreFromXml() override
Called after all pending items have been restored from XML.
void paint(QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget) override
Handles preparing a paint surface for the layout item and painting the item's content.
static QgsLayerTreeModelLegendNode * index2legendNode(const QModelIndex &index)
Returns legend node for given index.
double symbolWidth() const
Returns the legend symbol width.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void setMapScale(double scale)
Sets the legend map scale.
QgsRenderContext & renderContext()
Returns a reference to the context's render context.
QColor rasterStrokeColor() const
Returns the stroke color for the stroke drawn around raster symbol items.
QVariant data(const QModelIndex &index, int role) const override
QgsLegendStyle & rstyle(QgsLegendStyle::Style s)
Returns reference to modifiable legend style.
bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context) override
Sets item state from a DOM element.
double columnSpace() const
Returns the legend column spacing.
QPointer< QgsLayout > mLayout
virtual void attemptResize(const QgsLayoutSize &size, bool includesFrame=false)
Attempts to resize the item to a specified target size.
void setRasterStrokeColor(const QColor &color)
Sets the stroke color for the stroke drawn around raster symbol items.
bool resizeToContents() const
Returns whether the legend should automatically resize to fit its contents.
QgsLegendModel(QgsLayerTree *rootNode, QObject *parent=nullptr)
Construct the model based on the given layer tree.
void setTitle(const QString &t)
static bool isLayer(const QgsLayerTreeNode *node)
Check whether the node is a valid layer node.
This class is a base class for nodes in a layer tree.
QgsCoordinateReferenceSystem crs() const
Returns coordinate reference system used for rendering the map.
long featureCount(const QString &legendKey) const
Number of features rendered with specified legend key.
void setRasterStrokeWidth(double width)
Sets the stroke width for the stroke drawn around raster symbol items.
virtual QString uuid() const
Returns the item identification string.
void setMargin(Side side, double margin)
QgsLayoutItemLegend(QgsLayout *layout)
Constructor for QgsLayoutItemLegend, with the specified parent layout.
void setLineSpacing(double spacing)
Sets the spacing in-between multiple lines.
void setFontColor(const QColor &c)
static bool hasLegendFilterExpression(const QgsLayerTreeGroup &group)
Test if one of the layers in a group has an expression filter.
void setColumnSpace(double s)
void setFlag(Flag f, bool on=true)
Enable or disable a model flag.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
void updateLegend()
Updates the model and all legend entries.
void setWrapString(const QString &string)
Sets the legend text wrapping string.
QSizeF minimumSize()
Run the layout algorithm and determine the size required for legend.
QColor fontColor() const
Returns the legend font color.
void writeXml(const QString &name, QDomElement &elem, QDomDocument &doc) const
Qt::AlignmentFlag titleAlignment() const
Returns the alignment of the legend title.
void setStyleFont(QgsLegendStyle::Style component, const QFont &font)
Sets the style font for a legend component.
void setResizeToContents(bool enabled)
Sets whether the legend should automatically resize to fit its contents.
virtual void redraw()
Triggers a redraw (update) of the item.
QgsLegendStyle style(QgsLegendStyle::Style s) const
Returns style.
void setAutoUpdateModel(bool autoUpdate)
Sets whether the legend content should auto update to reflect changes in the project's layer tree...
void setColumnCount(int count)
Sets the legend column count.
Contains settings and helpers relating to a render of a QgsLayoutItem.
void setLineSpacing(double s)
double symbolHeight() const
Returns the legend symbol height.
Qt::AlignmentFlag titleAlignment() const
Returns the alignment of the legend title.
void readXml(const QDomElement &elem, const QDomDocument &doc)
static QgsLayoutItemLegend * create(QgsLayout *layout)
Returns a new legend item for the specified layout.
void setWmsLegendSize(QSizeF s)
bool drawRasterStroke() const
Returns whether a stroke will be drawn around raster symbol items.
QgsLegendStyle & rstyle(QgsLegendStyle::Style s)
Returns reference to modifiable style.
QgsRectangle extent() const
Returns the current map extent.
double rasterStrokeWidth() const
Returns the stroke width (in millimeters) for the stroke drawn around raster symbol items...
void setUseAdvancedEffects(bool use)
QFont styleFont(QgsLegendStyle::Style component) const
Returns the font settings for a legend component.
void setLinkedMap(QgsLayoutItemMap *map)
Sets the map to associate with the legend.
QPainter * painter()
Returns the destination QPainter for the render operation.
void setStyle(QgsLegendStyle::Style s, const QgsLegendStyle &style)
Enable advanced effects such as blend modes.
double mapUnitsToLayoutUnits() const
Returns the conversion factor from map units to layout units.
static QgsLayerTree * readXml(QDomElement &element, const QgsReadWriteContext &context)
Load the layer tree from an XML element.
void setStyleMargin(QgsLegendStyle::Style component, double margin)
Set the margin for a legend component.
void setColumnCount(int c)
void setDrawRasterStroke(bool enabled)
Sets whether a stroke will be drawn around raster symbol items.
QString wrapString() const
Returns the legend text wrapping string.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
void refreshDataDefinedProperty(QgsLayoutObject::DataDefinedProperty property=QgsLayoutObject::AllProperties) override
void setRasterStrokeWidth(double width)
Sets the stroke width for the stroke drawn around raster symbol items.
void setWmsLegendHeight(double height)
Sets the WMS legend height.
QString id() const
Returns the item's ID name.
void layerStyleOverridesChanged()
Emitted when layer style overrides are changed...
void setWmsLegendWidth(double width)
Sets the WMS legend width.
QFont font() const
The font for this style.
Item overrides the default layout item painting method.
const QgsLayout * layout() const
Returns the layout the object is attached to.
double boxSpace() const
Returns the legend box space.
A layout item subclass for map legends.
void customPropertyChanged(QgsLayerTreeNode *node, const QString &key)
Emitted when a custom property of a node within the tree has been changed or removed.
QSizeF symbolSize() const
void setSymbolHeight(double height)
Sets the legend symbol height.
QSizeF wmsLegendSize() const
QgsLayerTreeNode * index2node(const QModelIndex &index) const
Returns layer tree node for given index.
This class provides a method of storing sizes, consisting of a width and height, for use in QGIS layo...
void setBoxSpace(double space)
Sets the legend box space.
double width() const
Returns the width of the rectangle.
void changed()
Emitted when the object's properties change.
QgsLayoutItem::Flags itemFlags() const override
Returns the item's flags, which indicate how the item behaves.
Represents a vector layer which manages a vector based data sets.
DataDefinedProperty
Data defined properties for different item types.
void setRasterStrokeColor(const QColor &color)
Sets the stroke color for the stroke drawn around raster symbol items.
void setTitleAlignment(Qt::AlignmentFlag alignment)
Sets the alignment of the legend title.
void refresh() override
Refreshes the item, causing a recalculation of any property overrides and recalculation of its positi...
QIcon icon() const override
Returns the item's icon.
Allow reordering with drag'n'drop.
bool equalColumnWidth() const
Returns whether column widths should be equalized.
void setSplitLayer(bool s)
static QColor decodeColor(const QString &str)
double height() const
Returns the height of the rectangle.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
int valueAsInt(int key, const QgsExpressionContext &context, int defaultValue=0, bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as an integer...
Layer tree node points to a map layer.
The QgsLegendRenderer class handles automatic layout and rendering of legend.
QColor rasterStrokeColor() const
Returns the stroke color for the stroke drawn around raster symbol items.