QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 <QObject>
20 #include <QStringList>
21 
22 class QgsLayerTreeGroup;
23 class QgsLayerTreeNode;
24 class QgsMapLayer;
25 
26 
39 class CORE_EXPORT QgsLayerTreeRegistryBridge : public QObject
40 {
41  Q_OBJECT
42  public:
43  explicit QgsLayerTreeRegistryBridge( QgsLayerTreeGroup* root, QObject *parent = 0 );
44 
45  void setEnabled( bool enabled ) { mEnabled = enabled; }
46  bool isEnabled() const { return mEnabled; }
47 
48  void setNewLayersVisible( bool enabled ) { mNewLayersVisible = enabled; }
49  bool newLayersVisible() const { return mNewLayersVisible; }
50 
53  void setLayerInsertionPoint( QgsLayerTreeGroup* parentGroup, int index );
54 
55  signals:
56 
57  protected slots:
58  void layersAdded( QList<QgsMapLayer*> layers );
59  void layersWillBeRemoved( QStringList layerIds );
60 
61  void groupWillRemoveChildren( QgsLayerTreeNode* node, int indexFrom, int indexTo );
62  void groupRemovedChildren();
63 
64  void removeLayersFromRegistry( QStringList layerIds );
65 
66  protected:
68  QStringList mLayerIdsForRemoval;
70  bool mEnabled;
72 
75 };
76 
77 #endif // QGSLAYERTREEREGISTRYBRIDGE_H
Layer tree group node serves as a container for layers and further groups.
Definition: qgslayertreegroup.h:31
static unsigned index
Definition: mersenne-twister.cpp:36
Base class for all map layer types.
Definition: qgsmaplayer.h:48
QgsLayerTreeGroup * mInsertionPointGroup
Definition: qgslayertreeregistrybridge.h:73
bool mNewLayersVisible
Definition: qgslayertreeregistrybridge.h:71
bool mRegistryRemovingLayers
Definition: qgslayertreeregistrybridge.h:69
QgsLayerTreeGroup * mRoot
Definition: qgslayertreeregistrybridge.h:67
QStringList mLayerIdsForRemoval
Definition: qgslayertreeregistrybridge.h:68
Listens to the updates in map layer registry and does changes in layer tree.
Definition: qgslayertreeregistrybridge.h:39
bool newLayersVisible() const
Definition: qgslayertreeregistrybridge.h:49
This class is a base class for nodes in a layer tree.
Definition: qgslayertreenode.h:63
bool mEnabled
Definition: qgslayertreeregistrybridge.h:70
void setNewLayersVisible(bool enabled)
Definition: qgslayertreeregistrybridge.h:48
void setEnabled(bool enabled)
Definition: qgslayertreeregistrybridge.h:45
int mInsertionPointIndex
Definition: qgslayertreeregistrybridge.h:74
bool isEnabled() const
Definition: qgslayertreeregistrybridge.h:46