27 , mRegistryRemovingLayers( false )
29 , mNewLayersVisible( true )
30 , mInsertionPointGroup( root )
31 , mInsertionPointIndex( 0 )
51 QList<QgsLayerTreeNode *> nodes;
61 if ( !projectFile.isEmpty() )
63 nodeLayer->setCustomProperty( QStringLiteral(
"embedded" ), 1 );
64 nodeLayer->setCustomProperty( QStringLiteral(
"embedded_project" ), projectFile );
86 Q_FOREACH (
const QString &layerId, layerIds )
97 static void _collectLayerIdsInGroup(
QgsLayerTreeGroup *group,
int indexFrom,
int indexTo, QStringList &lst )
99 for (
int i = indexFrom; i <= indexTo; ++i )
133 QStringList toRemove;
139 QgsDebugMsgLevel( QString(
"%1 layers will be removed" ).arg( toRemove.count() ), 4 );
144 QMetaObject::invokeMethod(
this,
"removeLayersFromRegistry", Qt::QueuedConnection, Q_ARG( QStringList, toRemove ) );
Layer tree group node serves as a container for layers and further groups.
static QgsLayerTreeLayer * toLayer(QgsLayerTreeNode *node)
Cast node to a layer.
Base class for all map layer types.
static bool isGroup(QgsLayerTreeNode *node)
Check whether the node is a valid group node.
static QgsLayerTreeGroup * toGroup(QgsLayerTreeNode *node)
Cast node to a group.
void willRemoveChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
Emitted when one or more nodes will be removed from a node within the tree.
QgsLayerTreeGroup * mInsertionPointGroup
void layersWillBeRemoved(const QStringList &layerIds)
void legendLayersAdded(const QList< QgsMapLayer *> &layers)
Emitted, when a layer was added to the registry and the legend.
void groupWillRemoveChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
void addedLayersToLayerTree(const QList< QgsMapLayer *> &layers)
Tell others we have just added layers to the tree (used in QGIS to auto-select first newly added laye...
void removedChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
Emitted when one or more nodes has been removed from a node within the tree.
void layersAdded(const QList< QgsMapLayer *> &layers)
QList< QgsLayerTreeNode * > children()
Gets list of children of the node. Children are owned by the parent.
bool mRegistryRemovingLayers
QgsLayerTreeGroup * mRoot
#define QgsDebugMsgLevel(str, level)
QStringList mLayerIdsForRemoval
QString layerIsEmbedded(const QString &id) const
Returns project file path if layer is embedded from other project file. Returns empty string if layer...
QgsLayerTreeNode * parent()
Gets pointer to the parent. If parent is a null pointer, the node is a root node. ...
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.
Reads and writes project states.
void insertChildNodes(int index, const QList< QgsLayerTreeNode *> &nodes)
Insert existing nodes at specified position.
void groupRemovedChildren()
void layersWillBeRemoved(const QStringList &layerIds)
Emitted when one or more layers are about to be removed from the registry.
void removeLayersFromRegistry(const QStringList &layerIds)
void setLayerInsertionPoint(QgsLayerTreeGroup *parentGroup, int index)
Set where the new layers should be inserted - can be used to follow current selection.
void setItemVisibilityChecked(bool checked)
Check or uncheck a node (independently of its ancestors or children)
void removeMapLayers(const QStringList &layerIds)
Remove a set of layers from the registry by layer ID.
QgsLayerTreeLayer * findLayer(QgsMapLayer *layer) const
Find layer node representing the map layer.
QgsLayerTreeRegistryBridge(QgsLayerTreeGroup *root, QgsProject *project, QObject *parent=nullptr)
Create the instance that synchronizes given project with a layer tree root.
Layer tree node points to a map layer.