QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgslayertreeregistrybridge.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayertreeregistrybridge.h
3 --------------------------------------
4 Date : May 2014
5 Copyright : (C) 2014 by Martin Dobias
6 Email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSLAYERTREEREGISTRYBRIDGE_H
17#define QGSLAYERTREEREGISTRYBRIDGE_H
18
19#include "qgis.h"
20#include "qgis_core.h"
21#include "qgis_sip.h"
22#include "qgslayertreegroup.h"
23
24#include <QObject>
25#include <QPointer>
26#include <QStringList>
27
29class QgsMapLayer;
30class QgsProject;
31
32
45class CORE_EXPORT QgsLayerTreeRegistryBridge : public QObject
46{
47 Q_OBJECT
48 public:
65
67 explicit QgsLayerTreeRegistryBridge( QgsLayerTreeGroup *root, QgsProject *project, QObject *parent SIP_TRANSFERTHIS = nullptr );
68
69 void setEnabled( bool enabled ) { mEnabled = enabled; }
70 bool isEnabled() const { return mEnabled; }
71
72 void setNewLayersVisible( bool enabled ) { mNewLayersVisible = enabled; }
73 bool newLayersVisible() const { return mNewLayersVisible; }
74
80 Q_DECL_DEPRECATED void setLayerInsertionPoint( QgsLayerTreeGroup *parentGroup, int index ) SIP_DEPRECATED;
81
87 void setLayerInsertionPoint( const InsertionPoint &insertionPoint );
88
93 InsertionPoint layerInsertionPoint() const;
94
100
106
107 signals:
108
112 void addedLayersToLayerTree( const QList<QgsMapLayer *> &layers );
113
114 protected slots:
115 void layersAdded( const QList<QgsMapLayer *> &layers );
116 void layersWillBeRemoved( const QStringList &layerIds );
117
118 void groupWillRemoveChildren( QgsLayerTreeNode *node, int indexFrom, int indexTo );
120
121 void removeLayersFromRegistry( const QStringList &layerIds );
122
123 protected:
128 bool mEnabled = true;
129 bool mNewLayersVisible = true;
130
131 QPointer< QgsLayerTreeGroup > mInsertionPointGroup;
133
135};
136
137#endif // QGSLAYERTREEREGISTRYBRIDGE_H
LayerTreeInsertionMethod
Layer tree insertion methods.
Definition qgis.h:4666
@ AboveInsertionPoint
Layers are added in the tree above the insertion point.
Definition qgis.h:4667
Layer tree group node serves as a container for layers and further groups.
Base class for nodes in a layer tree.
void removeLayersFromRegistry(const QStringList &layerIds)
void layersWillBeRemoved(const QStringList &layerIds)
void layersAdded(const QList< QgsMapLayer * > &layers)
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 groupWillRemoveChildren(QgsLayerTreeNode *node, int indexFrom, int indexTo)
QPointer< QgsLayerTreeGroup > mInsertionPointGroup
QgsLayerTreeRegistryBridge(QgsLayerTreeGroup *root, QgsProject *project, QObject *parent=nullptr)
Create the instance that synchronizes given project with a layer tree root.
Qgis::LayerTreeInsertionMethod layerInsertionMethod() const
Returns the insertion method used to add layers to the tree.
Qgis::LayerTreeInsertionMethod mInsertionMethod
void setLayerInsertionMethod(Qgis::LayerTreeInsertionMethod method)
Sets the insertion method used to add layers to the tree.
Base class for all map layer types.
Definition qgsmaplayer.h:83
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:113
#define SIP_DEPRECATED
Definition qgis_sip.h:113
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
InsertionPoint(QgsLayerTreeGroup *group, int position)
Constructs an insertion point as layer tree group with its corresponding position.