@@ -22,6 +22,11 @@ QgsLayerTreeModel::QgsLayerTreeModel(QgsLayerTreeGroup* rootNode, QObject *paren
22
22
23
23
// connect to all existing nodes
24
24
connectToNode (mRootNode );
25
+
26
+ connect (mRootNode , SIGNAL (willAddChildren (QgsLayerTreeNode*,int ,int )), this , SLOT (nodeWillAddChildren (QgsLayerTreeNode*,int ,int )));
27
+ connect (mRootNode , SIGNAL (addedChildren (QgsLayerTreeNode*,int ,int )), this , SLOT (nodeAddedChildren (QgsLayerTreeNode*,int ,int )));
28
+ connect (mRootNode , SIGNAL (willRemoveChildren (QgsLayerTreeNode*,int ,int )), this , SLOT (nodeWillRemoveChildren (QgsLayerTreeNode*,int ,int )));
29
+ connect (mRootNode , SIGNAL (removedChildren (QgsLayerTreeNode*,int ,int )), this , SLOT (nodeRemovedChildren ()));
25
30
}
26
31
27
32
QgsLayerTreeModel::~QgsLayerTreeModel ()
@@ -33,10 +38,6 @@ QgsLayerTreeModel::~QgsLayerTreeModel()
33
38
34
39
void QgsLayerTreeModel::connectToNode (QgsLayerTreeNode* node)
35
40
{
36
- connect (node, SIGNAL (willAddChildren (int ,int )), this , SLOT (nodeWillAddChildren (int ,int )));
37
- connect (node, SIGNAL (addedChildren (int ,int )), this , SLOT (nodeAddedChildren (int ,int )));
38
- connect (node, SIGNAL (willRemoveChildren (int ,int )), this , SLOT (nodeWillRemoveChildren (int ,int )));
39
- connect (node, SIGNAL (removedChildren (int ,int )), this , SLOT (nodeRemovedChildren ()));
40
41
connect (node, SIGNAL (visibilityChanged (Qt::CheckState)), this , SLOT (nodeVisibilityChanded ()));
41
42
42
43
if (QgsLayerTree::isLayer (node) && testFlag (ShowSymbology))
@@ -365,16 +366,14 @@ void QgsLayerTreeModel::refreshLayerSymbology(QgsLayerTreeLayer* nodeLayer)
365
366
addSymbologyToLayer (nodeLayer);
366
367
}
367
368
368
- void QgsLayerTreeModel::nodeWillAddChildren (int indexFrom, int indexTo)
369
+ void QgsLayerTreeModel::nodeWillAddChildren (QgsLayerTreeNode* node, int indexFrom, int indexTo)
369
370
{
370
- QgsLayerTreeNode* node = qobject_cast<QgsLayerTreeNode*>(sender ());
371
371
Q_ASSERT (node);
372
372
beginInsertRows (node2index (node), indexFrom, indexTo);
373
373
}
374
374
375
- void QgsLayerTreeModel::nodeAddedChildren (int indexFrom, int indexTo)
375
+ void QgsLayerTreeModel::nodeAddedChildren (QgsLayerTreeNode* node, int indexFrom, int indexTo)
376
376
{
377
- QgsLayerTreeNode* node = qobject_cast<QgsLayerTreeNode*>(sender ());
378
377
Q_ASSERT (node);
379
378
380
379
endInsertRows ();
@@ -383,9 +382,8 @@ void QgsLayerTreeModel::nodeAddedChildren(int indexFrom, int indexTo)
383
382
connectToNode ( node->children ()[i] );
384
383
}
385
384
386
- void QgsLayerTreeModel::nodeWillRemoveChildren (int indexFrom, int indexTo)
385
+ void QgsLayerTreeModel::nodeWillRemoveChildren (QgsLayerTreeNode* node, int indexFrom, int indexTo)
387
386
{
388
- QgsLayerTreeNode* node = qobject_cast<QgsLayerTreeNode*>(sender ());
389
387
Q_ASSERT (node);
390
388
391
389
beginRemoveRows (node2index (node), indexFrom, indexTo);
0 commit comments