23 #include <QTextStream> 54 if ( role == RuleKeyRole )
67 , mRootNode( rootNode )
68 , mFlags( ShowLegend | AllowLegendChangeState | DeferredLegendInvalidation )
69 , mAutoCollapseLegendNodesCount( -1 )
70 , mLegendFilterByScale( 0 )
71 , mLegendFilterUsesExtent( false )
72 , mLegendMapViewMupp( 0 )
73 , mLegendMapViewDpi( 0 )
74 , mLegendMapViewScale( 0 )
127 if ( column < 0 || column >=
columnCount( parent ) ||
128 row < 0 || row >=
rowCount( parent ) )
171 Q_ASSERT( parentNode );
174 if ( !grandParentNode )
178 Q_ASSERT( row >= 0 );
180 return createIndex( row, 0, static_cast<QObject*>( parentNode ) );
193 if ( role == Qt::DisplayRole || role == Qt::EditRole )
202 if ( nodeLayer->
customProperty(
"showFeatureCount", 0 ).
toInt() && role == Qt::DisplayRole )
211 else if ( role == Qt::DecorationRole && index.
column() == 0 )
274 icon =
QIcon( pixmap );
280 else if ( role == Qt::CheckStateRole )
301 else if ( role == Qt::FontRole )
310 else if ( role == Qt::ForegroundRole )
312 QBrush brush( Qt::black, Qt::SolidPattern );
323 else if ( role == Qt::ToolTipRole )
330 QString title = layer->title().
isEmpty() ? layer->shortName() : layer->title();
332 title = layer->name();
333 title =
"<b>" + title +
"</b>";
334 if ( layer->crs().isValid() )
335 title =
tr(
"%1 (%2)" ).
arg( title, layer->crs().authid() );
339 if ( !layer->abstract().isEmpty() )
341 parts <<
"<i>" + layer->publicSource() +
"</i>";
342 return parts.
join(
"<br/>" );
357 rootFlags |= Qt::ItemIsDropEnabled;
367 f |= Qt::ItemIsEditable;
376 f |= Qt::ItemIsDragEnabled;
380 f |= Qt::ItemIsUserCheckable;
383 f |= Qt::ItemIsDropEnabled;
395 bool res = sym->
setData( value, role );
405 if ( role == Qt::CheckStateRole )
426 else if ( role == Qt::EditRole )
455 Q_ASSERT( row >= 0 );
456 return index( row, 0, parentIndex );
465 if ( child->
parent() == node )
517 return symNode ? symNode->
layerNode() :
nullptr;
639 if ( useExpressions )
645 if ( enabled && !expr.
isEmpty() )
647 exprs[ nodeLayer->
layerId()] = expr;
652 if ( useExpressions && !useExtent && !polygonValid )
725 for (
int i = indexFrom; i <= indexTo; ++i )
733 return newLayerNodes;
857 if ( !nodeLayer->
layer() )
915 disconnect( nodeLayer,
nullptr,
this,
nullptr );
917 if ( !nodeLayer->
layer() )
987 for (
int i = 0; i < count; ++i )
1006 for (
int i = 0; i < count; ++i )
1012 return Qt::CopyAction | Qt::MoveAction;
1018 types <<
"application/qgis.layertreemodeldata";
1026 QModelIndexList sortedIndexes = indexes;
1027 qSort( sortedIndexes.begin(), sortedIndexes.end(), qLess<QModelIndex>() );
1043 mimeData->
setData(
"application/qgis.layertreemodeldata", txt.
toUtf8() );
1049 if ( action == Qt::IgnoreAction )
1052 if ( !data->
hasFormat(
"application/qgis.layertreemodeldata" ) )
1062 QByteArray encodedData = data->
data(
"application/qgis.layertreemodeldata" );
1069 if ( rootElem.
tagName() !=
"layer_tree_model_data" )
1087 if ( parent.
isValid() && row == -1 )
1126 return mFlags.testFlag( f );
1159 if ( ruleKey && checked )
1199 if (
mLegend.contains( nodeLayer ) )
1201 qDeleteAll(
mLegend[nodeLayer].originalNodes );
1202 delete mLegend[nodeLayer].tree;
1210 if ( !nodeL->
layer() )
1219 if ( hasStyleOverride )
1231 while ( widgetsCount > 0 )
1233 lstNew.
insert( 0,
new EmbeddedWidgetLegendNode( nodeL ) );
1254 embeddedNode = legendNode;
1266 int count = legendTree ? legendTree->
children[
nullptr].
count() : filteredLstNew.
count();
1274 data.
tree = legendTree;
1280 if ( hasStyleOverride )
1292 bool hasParentKeys =
false;
1297 hasParentKeys =
true;
1301 if ( !hasParentKeys )
1306 rule2node[
QString()] =
nullptr;
1312 if ( rule2node.
contains( ruleKey ) )
1314 rule2node[ruleKey] = n;
1344 int row = data.
tree->
children[parentLegendNode].indexOf( legendNode );
1345 return index( row, 0, parentIndex );
1350 int row = data.
tree->
children[
nullptr].indexOf( legendNode );
1351 return index( row, 0, parentIndex );
1356 Q_ASSERT( parentIndex.
isValid() );
1361 return index( row, 0, parentIndex );
1377 if ( !
mLegend.contains( nL ) )
1391 Q_ASSERT(
mLegend.contains( nL ) );
1394 return createIndex( row, column, static_cast<QObject*>( data.tree->children[
nullptr].at( row ) ) );
1396 return createIndex( row, column, static_cast<QObject*>( data.activeNodes.at( row ) ) );
1419 int row = data.
tree->
children[grandParentNode].indexOf( parentNode );
1420 return createIndex( row, 0, static_cast<QObject*>( parentNode ) );
1434 return node->
data( role );
1442 f &= ~
Qt::ItemIsUserCheckable;
1449 return mLegend[nodeLayer].embeddedNodeInParent !=
nullptr;
1454 return mLegend[nodeLayer].embeddedNodeInParent;
1463 return QIcon( qvariant_cast<QPixmap>( legendNode->
data( Qt::DecorationRole ) ) );
1469 if ( !
mLegend.contains( nodeLayer ) )
1481 return mLegend.value( nodeLayer ).originalNodes;
1487 for ( ; it !=
mLegend.constEnd(); ++it )
1490 if ( layer->
layerId() == layerId )
1537 widthMax[parentKey] = qMax( sz.width(), widthMax.contains( parentKey ) ? widthMax[parentKey] : 0 );
1545 Q_ASSERT( widthMax[parentKey] > 0 );
1546 const int twiceMarginWidth = 2;
bool restoreOverrideStyle()
Restore the original store after a call to setOverrideStyle()
QObject * child(const char *objName, const char *inheritsClass, bool recursiveSearch) const
Layer tree group node serves as a container for layers and further groups.
void legendInvalidateMapBasedData()
double mLegendMapViewMupp
static const QIcon & iconGroup()
void removeChildren(int from, int count)
Remove child nodes from index "from". The nodes will be deleted.
void refreshScaleBasedLayers(const QModelIndex &index=QModelIndex())
Updates layer data for scale dependent layers, should be called when map scale changes.
QList< QgsLayerTreeModelLegendNode * > originalNodes
Data structure for storage of legend nodes.
Base class for all map layer types.
QgsLayerTreeGroup * rootGroup() const
Return pointer to the root node of the layer tree. Always a non-null pointer.
void setLayerName(const QString &n)
virtual bool isEmbeddedInParent() const
QMimeData * mimeData(const QModelIndexList &indexes) const override
QByteArray data(const QString &mimeType) const
virtual Qt::ItemFlags flags() const
Return item flags associated with the item.
void removeLegendFromLayer(QgsLayerTreeLayer *nodeLayer)
void connectToLayer(QgsLayerTreeLayer *nodeLayer)
Q_DECL_DEPRECATED bool isIndexSymbologyNode(const QModelIndex &index) const
Return true if index represents a legend node (instead of layer node)
void setCurrentIndex(const QModelIndex ¤tIndex)
Set index of the current item. May be used by view. Item marked as current is underlined.
bool contains(const Key &key) const
QList< QgsLayerTreeNode * > indexes2nodes(const QModelIndexList &list, bool skipInternal=false) const
Convert a list of indexes to a list of layer tree nodes.
LayerLegendTree * tree
Optional pointer to a tree structure - see LayerLegendTree for details.
QDomNode appendChild(const QDomNode &newChild)
static const QIcon & iconDefault()
QList< QgsLayerTreeModelLegendNode * > layerOriginalLegendNodes(QgsLayerTreeLayer *nodeLayer)
Return original (unfiltered) list of legend nodes attached to a particular layer node.
void nodeCustomPropertyChanged(QgsLayerTreeNode *node, const QString &key)
void addLegendToLayer(QgsLayerTreeLayer *nodeL)
QgsMapLayerLegend * legend() const
Can be null.
static const QIcon & iconPoint()
virtual bool setData(const QVariant &value, int role)
Set some data associated with the item.
void disconnectFromRootNode()
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
QModelIndex indexOfParentLayerTreeNode(QgsLayerTreeNode *parentNode) const
QString toString(int indent) const
bool testFlag(Flag f) const
Check whether a flag is enabled.
static QIcon getThemeIcon(const QString &theName)
Helper to get a theme icon.
static int _numLayerCount(QgsLayerTreeGroup *group, const QString &layerId)
QgsLayerTreeModelLegendNode * legendNodeEmbeddedInParent(QgsLayerTreeLayer *nodeLayer) const
Return legend node that may be embbeded in parent (i.e.
const T & at(int i) const
const QObjectList & children() const
NodeType nodeType()
Find out about type of the node. It is usually shorter to use convenience functions from QgsLayerTree...
Qt::CheckState isVisible() const
Structure that stores tree representation of map layer's legend.
void setUnderline(bool enable)
QDomElement nextSiblingElement(const QString &tagName) const
QgsLayerTreeLayer * layerNode() const
Return pointer to the parent layer node.
QgsLayerTreeModelLegendNode * embeddedNodeInParent
A legend node that is not displayed separately, its icon is instead shown within the layer node's ite...
QgsLayerTreeModelLegendNode * findLegendNode(const QString &layerId, const QString &ruleKey) const
Searches through the layer tree to find a legend node with a matching layer ID and rule key...
QFont layerTreeNodeFont(int nodeType) const
Get font for a particular type of layer tree node. nodeType should come from QgsLayerTreeNode::NodeTy...
bool isInScaleRange(double scale) const
Tests whether the layer should be visible at the specified scale.
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
A geometry is the spatial representation of a feature.
void recursivelyEmitDataChanged(const QModelIndex &index=QModelIndex())
emit dataChanged() for layer tree node items
static bool _isChildOfNode(QgsLayerTreeNode *child, QgsLayerTreeNode *node)
void legendNodeDataChanged()
QDomElement documentElement() const
static const QIcon & iconPolygon()
QString join(const QString &separator) const
LayerLegendTree * tryBuildLegendTree(const QList< QgsLayerTreeModelLegendNode *> &nodes)
static bool _isChildOfNodes(QgsLayerTreeNode *child, const QList< QgsLayerTreeNode *> &nodes)
bool mLegendFilterUsesExtent
whether to use map filtering
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
Flags mFlags
Set of flags for the model.
virtual bool isEditable() const override
Returns true if the provider is in editing mode.
QModelIndex node2index(QgsLayerTreeNode *node) const
Return index for a given node. If the node does not belong to the layer tree, the result is undefined...
QgsMapLayer::LayerType type() const
Get the type of the layer.
QString tr(const char *sourceText, const char *disambiguation, int n)
static QPixmap getThemePixmap(const QString &theName)
Helper to get a theme icon as a pixmap.
bool qgsDoubleNear(double a, double b, double epsilon=4 *DBL_EPSILON)
Compare two doubles (but allow some difference)
virtual void writeXML(QDomElement &parentElement)=0
Write layer tree to XML.
void nodeAddedChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
bool legendEmbeddedInParent(QgsLayerTreeLayer *nodeLayer) const
QgsLayerTreeGroup * toGroup(QgsLayerTreeNode *node)
Cast node to a group. No type checking is done - use isGroup() to find out whether this operation is ...
void nodeWillAddChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
Allow check boxes for legend nodes (if supported by layer's legend)
QPixmap pixmap(const QSize &size, Mode mode, State state) const
void connectToLayers(QgsLayerTreeGroup *parentGroup)
void layerLegendChanged()
The QgsMapSettings class contains configuration for rendering of the map.
int indexOf(const T &value, int from) const
QVariant legendNodeData(QgsLayerTreeModelLegendNode *node, int role) const
Q_DECL_DEPRECATED QgsLayerTreeLayer * layerNodeForSymbologyNode(const QModelIndex &index) const
Return layer node to which a legend node belongs to.
QgsMapLayerStyleManager * styleManager() const
Get access to the layer's style manager.
void setBold(bool enable)
long featureCount(QgsSymbolV2 *symbol)
Number of features rendered with specified symbol.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Allow renaming of groups and layers.
const char * name() const
rule key of the parent legend node - for legends with tree hierarchy (QString). Added in 2...
QModelIndex legendParent(QgsLayerTreeModelLegendNode *legendNode) const
int count(const T &value) const
void append(const T &value)
QString fromUtf8(const char *str, int size)
void disconnectFromLayer(QgsLayerTreeLayer *nodeLayer)
QString id() const
Get this layer's unique ID, this ID is used to access this layer from map layer registry.
QMap< QgsLayerTreeModelLegendNode *, QgsLayerTreeModelLegendNode * > parents
Pointer to parent for each active node. Top-level nodes have null parent. Pointers are not owned...
virtual bool isScaleOK(double scale) const
QTimer mDeferLegendInvalidationTimer
int toInt(bool *ok) const
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
QModelIndex legendNode2index(QgsLayerTreeModelLegendNode *legendNode)
Return index for a given legend node.
static const QIcon & iconRaster()
void disconnectFromLayers(QgsLayerTreeGroup *parentGroup)
rule key of the node (QString)
void setLegendFilterByMap(const QgsMapSettings *settings)
Force only display of legend nodes which are valid for given map settings.
QString providerType() const
[ data provider interface ] Which provider is being used for this Raster Layer?
virtual QVariant data(int role) const override
Return data associated with the item.
static QgsLayerTreeModelLegendNode * index2legendNode(const QModelIndex &index)
Return legend node for given index.
Qt::DropActions supportedDropActions() const override
QgsLayerTreeNode * parent()
Get pointer to the parent. If parent is a null pointer, the node is a root node.
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
QMap< QString, QString > layerStyleOverrides() const
Get map of map layer style overrides (key: layer ID, value: style name) where a different style shoul...
void beginRemoveRows(const QModelIndex &parent, int first, int last)
QVariant customProperty(const QString &key, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
void setName(const QString &n) override
Set group's name.
void legendMapViewData(double *mapUnitsPerPixel, int *dpi, double *scale)
Get hints about map view - to be used in legend nodes.
The QgsMapLayerLegend class is abstract interface for implementations of legends for one map layer...
bool isEmpty() const
Returns true if the geometry is empty (ie, contains no underlying geometry accessible via geometry)...
void * internalPointer() const
This class is a base class for nodes in a layer tree.
QgsLayerTreeGroup * mRootNode
Pointer to the root node of the layer tree. Not owned by the model.
void setVisible(Qt::CheckState visible)
void insertChildNodes(int index, const QList< QgsLayerTreeNode *> &nodes)
Insert existing nodes at specified position. The nodes must not have a parent yet. The nodes will be owned by this group.
bool hasValidSettings() const
Check whether the map settings are valid and can be used for rendering.
QGis::GeometryType geometryType() const
Returns point, line or polygon.
int autoCollapseLegendNodes() const
Return at what number of legend nodes the layer node should be collapsed. -1 means no auto-collapse (...
QMap< QgsLayerTreeModelLegendNode *, QList< QgsLayerTreeModelLegendNode * > > children
List of children for each active node. Top-level nodes are under null pointer key. Pointers are not owned.
Class that runs a hit test with given map settings.
int legendNodeRowCount(QgsLayerTreeModelLegendNode *node) const
void setLegendFilterByScale(double scaleDenominator)
Force only display of legend nodes which are valid for given scale denominator.
QList< QgsLayerTreeNode * > children()
Get list of children of the node. Children are owned by the parent.
QGis::GeometryType type() const
Returns type of the geometry as a QGis::GeometryType.
bool isLayer(QgsLayerTreeNode *node)
Check whether the node is a valid layer node.
void setLayerTreeNodeFont(int nodeType, const QFont &font)
Set font for a particular type of layer tree node. nodeType should come from QgsLayerTreeNode::NodeTy...
void setFlag(Flag f, bool on=true)
Enable or disable a model flag.
QModelIndex legendNodeIndex(int row, int column, QgsLayerTreeModelLegendNode *node) const
QModelIndex createIndex(int row, int column, void *ptr) const
QPersistentModelIndex mCurrentIndex
Current index - will be underlined.
void setRootGroup(QgsLayerTreeGroup *newRootGroup)
Reset the model and use a new root group node.
const T value(const Key &key) const
double mLegendMapViewScale
double mLegendFilterByScale
scale denominator for filtering of legend nodes (<= 0 means no filtering)
void setParent(QObject *parent)
defer legend model invalidation
void refreshLayerLegend(QgsLayerTreeLayer *nodeLayer)
Force a refresh of legend nodes of a layer node.
void setExpanded(bool expanded)
Set whether the node should be shown as expanded or collapsed in GUI.
void setLegendMapViewData(double mapUnitsPerPixel, int dpi, double scale)
Give the layer tree model hints about the currently associated map view so that legend nodes that use...
void setItalic(bool enable)
QgsLayerTreeLayer * findLayer(const QString &layerId) const
Find layer node representing the map layer specified by its ID. Searches recursively the whole sub-tr...
void beginInsertRows(const QModelIndex &parent, int first, int last)
QgsMapLayer * layer() const
static const QIcon & iconTable()
void setAutoCollapseLegendNodes(int nodeCount)
Set at what number of legend nodes the layer node should be collapsed. Setting -1 disables the auto-c...
leaf node pointing to a layer
QImage previewAsImage(QSize size, const QColor &bgColor=Qt::white, QImage::Format format=QImage::Format_ARGB32_Premultiplied)
Draws a preview of the rasterlayer into a QImage.
QIcon legendIconEmbeddedInParent(QgsLayerTreeLayer *nodeLayer) const
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
static QgsLayerTreeNode * readXML(QDomElement &element, bool looseMatch=false)
Read layer tree from XML.
int mAutoCollapseLegendNodesCount
Minimal number of nodes when legend should be automatically collapsed. -1 = disabled.
QgsLayerTreeNode * index2node(const QModelIndex &index) const
Return layer tree node for given index.
QList< QgsLayerTreeModelLegendNode * > filterLegendNodes(const QList< QgsLayerTreeModelLegendNode *> &nodes)
Filter nodes from QgsMapLayerLegend according to the current filtering rules.
QSize minimumIconSize() const
Get the minimum icon size to prevent cropping.
QgsLayerTreeLayer * toLayer(QgsLayerTreeNode *node)
Cast node to a layer. No type checking is done - use isLayer() to find out whether this operation is ...
bool hasScaleBasedVisibility() const
Returns whether scale based visibility is enabled for the layer.
static void applyLayerNodeProperties(QgsLayerTreeLayer *nodeLayer, QList< QgsLayerTreeModelLegendNode *> &nodes)
update according to layer node's custom properties (order of items, user labels for items) ...
void insert(int i, const T &value)
Layer nodes may optionally include extra embedded widgets (if used in QgsLayerTreeView). Added in 2.16.
void nodeRemovedChildren()
QDomElement firstChildElement(const QString &tagName) const
void nodeNameChanged(QgsLayerTreeNode *node, const QString &name)
Updates model when node's name has changed.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
virtual bool isModified() const
Returns true if the provider has been modified since the last commit.
QStringList mimeTypes() const override
void invalidateLegendMapBasedData()
int legendRootRowCount(QgsLayerTreeLayer *nL) const
virtual QVariant data(int role) const =0
Return data associated with the item.
static const QIcon & iconLine()
The QgsLegendRendererItem class is abstract interface for legend items returned from QgsMapLayerLegen...
Qt::CheckState isVisible() const
Return the check state of the group node.
QList< QgsLayerTreeModelLegendNode * > layerLegendNodes(QgsLayerTreeLayer *nodeLayer, bool skipNodeEmbeddedInParent=false)
Return filtered list of active legend nodes attached to a particular layer node (by default it return...
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
for QgsSymbolV2LegendNode only - legacy rule key (void ptr, to be cast to QgsSymbolV2 ptr) ...
QString layerName() const
Allow user to set node visibility with a check box.
Implementation of legend node interface for displaying preview of vector symbols and their labels and...
void prepend(const T &value)
bool contains(const Key &key) const
QString name() const override
Get group's name.
Flags flags() const
Return OR-ed combination of model flags.
bool setOverrideStyle(const QString &styleDef)
Temporarily apply a different style to the layer.
void setData(const QString &mimeType, const QByteArray &data)
QVariant customProperty(const QString &value, const QVariant &defaultValue=QVariant()) const
Read a custom property from layer.
QScopedPointer< QgsMapHitTest > mLegendFilterHitTest
void setLayerStyleOverrides(const QMap< QString, QString > &overrides)
Set map of map layer style overrides (key: layer ID, value: style name) where a different style shoul...
QList< QgsLayerTreeLayer * > findLayers() const
Find all layer nodes. Searches recursively the whole sub-tree.
QDomElement createElement(const QString &tagName)
QModelIndex legendRootIndex(int row, int column, QgsLayerTreeLayer *nL) const
container of other groups and layers
int columnCount(const QModelIndex &parent=QModelIndex()) const override
QList< QgsLayerTreeModelLegendNode * > activeNodes
Active legend nodes.
For legends that support it, will show them in a tree instead of a list (needs also ShowLegend)...
QMap< QString, QString > mLayerStyleOverrides
Overrides of map layers' styles: key = layer ID, value = style XML.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setLegendFilter(const QgsMapSettings *settings, bool useExtent=true, const QgsGeometry &polygon=QgsGeometry(), bool useExpressions=true)
Filter display of legend nodes for given map settings.
Represents a vector layer which manages a vector based data sets.
Will use real preview of raster layer as icon (may be slow)
void setVisible(Qt::CheckState state)
Set check state of the group node - will also update children.
void setColor(const QColor &color)
void setFlags(const QgsLayerTreeModel::Flags &f)
Set OR-ed combination of model flags.
QScopedPointer< QgsMapSettings > mLegendFilterMapSettings
bool isGroup(QgsLayerTreeNode *node)
Check whether the node is a valid group node.
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
bool removeOne(const T &value)
int count(const Key &key) const
void setIconSize(QSize sz)
Set the icon size.
static QList< QgsLayerTreeLayer * > _layerNodesInSubtree(QgsLayerTreeNode *node, int indexFrom, int indexTo)
static QString legendFilterByExpression(const QgsLayerTreeLayer &layer, bool *enabled=nullptr)
Return the expression filter of a legend layer.
Allow reordering with drag'n'drop.
Add legend nodes for layer nodes.
virtual void invalidateMapBasedData()
Notification from model that information from associated map view has changed.
void nodeWillRemoveChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
QgsLayerTreeModel(QgsLayerTreeGroup *rootNode, QObject *parent=nullptr)
Construct a new tree model with given layer tree (root node must not be null pointer).
void nodeLayerWillBeUnloaded()
virtual QList< QgsLayerTreeModelLegendNode * > createLayerTreeModelLegendNodes(QgsLayerTreeLayer *nodeLayer)=0
Return list of legend nodes to be used for a particular layer tree layer node.
QMap< QgsLayerTreeLayer *, LayerLegendData > mLegend
Per layer data about layer's legend nodes.
Qt::ItemFlags legendNodeFlags(QgsLayerTreeModelLegendNode *node) const
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Layer tree node points to a map layer.
bool setContent(const QByteArray &data, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn)
QModelIndex currentIndex() const
Get index of the item marked as current. Item marked as current is underlined.
const T value(const Key &key) const
void replace(int i, const T &value)
void setSingleShot(bool singleShot)
void nodeVisibilityChanged(QgsLayerTreeNode *node)
Structure that stores all data associated with one map layer.
QByteArray toUtf8() const