@@ -79,73 +79,74 @@ class CORE_EXPORT QgsLayerTreeNode : public QObject
7979 // ! Find out about type of the node. It is usually shorter to use convenience functions from QgsLayerTree namespace for that
8080 NodeType nodeType () { return mNodeType ; }
8181 // ! Get pointer to the parent. If parent is a null pointer, the node is a root node
82- QgsLayerTreeNode* parent () { return mParent ; }
82+ QgsLayerTreeNode * parent () { return mParent ; }
8383 // ! Get list of children of the node. Children are owned by the parent
8484 QList<QgsLayerTreeNode*> children () { return mChildren ; }
8585
8686 // ! Read layer tree from XML. Returns new instance
87- static QgsLayerTreeNode* readXML ( QDomElement& element );
87+ static QgsLayerTreeNode * readXML ( QDomElement & element );
8888 // ! Write layer tree to XML
89- virtual void writeXML ( QDomElement& parentElement ) = 0;
89+ virtual void writeXML ( QDomElement & parentElement ) = 0;
9090
9191 // ! Return string with layer tree structure. For debug purposes only
9292 virtual QString dump () const = 0;
9393
9494 // ! Create a copy of the node. Returns new instance
95- virtual QgsLayerTreeNode* clone () const = 0;
95+ virtual QgsLayerTreeNode * clone () const = 0;
9696
9797 // ! Return whether the node should be shown as expanded or collapsed in GUI
9898 bool isExpanded () const ;
9999 // ! Set whether the node should be shown as expanded or collapsed in GUI
100100 void setExpanded ( bool expanded );
101101
102102 /* * Set a custom property for the node. Properties are stored in a map and saved in project file. */
103- void setCustomProperty ( const QString& key, const QVariant& value );
103+ void setCustomProperty ( const QString & key, const QVariant & value );
104104 /* * Read a custom property from layer. Properties are stored in a map and saved in project file. */
105- QVariant customProperty ( const QString& key, const QVariant& defaultValue = QVariant() ) const ;
105+ QVariant customProperty ( const QString & key, const QVariant & defaultValue = QVariant() ) const ;
106106 /* * Remove a custom property from layer. Properties are stored in a map and saved in project file. */
107- void removeCustomProperty ( const QString& key );
107+ void removeCustomProperty ( const QString & key );
108108 /* * Return list of keys stored in custom properties */
109109 QStringList customProperties () const ;
110+ /* * Remove a child from a node */
111+ bool takeChild ( QgsLayerTreeNode *node );
110112
111113 signals:
112114
113115 // ! Emitted when one or more nodes will be added to a node within the tree
114- void willAddChildren ( QgsLayerTreeNode* node, int indexFrom, int indexTo );
116+ void willAddChildren ( QgsLayerTreeNode * node, int indexFrom, int indexTo );
115117 // ! Emitted when one or more nodes have been added to a node within the tree
116- void addedChildren ( QgsLayerTreeNode* node, int indexFrom, int indexTo );
118+ void addedChildren ( QgsLayerTreeNode * node, int indexFrom, int indexTo );
117119 // ! Emitted when one or more nodes will be removed from a node within the tree
118- void willRemoveChildren ( QgsLayerTreeNode* node, int indexFrom, int indexTo );
120+ void willRemoveChildren ( QgsLayerTreeNode * node, int indexFrom, int indexTo );
119121 // ! Emitted when one or more nodes has been removed from a node within the tree
120- void removedChildren ( QgsLayerTreeNode* node, int indexFrom, int indexTo );
122+ void removedChildren ( QgsLayerTreeNode * node, int indexFrom, int indexTo );
121123 // ! Emitted when check state of a node within the tree has been changed
122- void visibilityChanged ( QgsLayerTreeNode* node, Qt::CheckState state );
124+ void visibilityChanged ( QgsLayerTreeNode * node, Qt::CheckState state );
123125 // ! Emitted when a custom property of a node within the tree has been changed or removed
124- void customPropertyChanged ( QgsLayerTreeNode* node, QString key );
126+ void customPropertyChanged ( QgsLayerTreeNode * node, QString key );
125127 // ! Emitted when the collapsed/expanded state of a node within the tree has been changed
126- void expandedChanged ( QgsLayerTreeNode* node, bool expanded );
128+ void expandedChanged ( QgsLayerTreeNode * node, bool expanded );
127129
128130 protected:
129131
130132 QgsLayerTreeNode ( NodeType t );
131- QgsLayerTreeNode ( const QgsLayerTreeNode& other );
133+ QgsLayerTreeNode ( const QgsLayerTreeNode & other );
132134
133135 // low-level utility functions
134136
135- void readCommonXML ( QDomElement& element );
136- void writeCommonXML ( QDomElement& element );
137+ void readCommonXML ( QDomElement & element );
138+ void writeCommonXML ( QDomElement & element );
137139
138140 // ! Low-level insertion of children to the node. The children must not have any parent yet!
139141 void insertChildrenPrivate ( int index, QList<QgsLayerTreeNode*> nodes );
140142 // ! Low-level removal of children from the node.
141- void removeChildrenPrivate ( int from, int count );
142-
143+ void removeChildrenPrivate ( int from, int count, bool destroy = true );
143144
144145 protected:
145146 // ! type of the node - determines which subclass is used
146147 NodeType mNodeType ;
147148 // ! pointer to the parent node - null in case of root node
148- QgsLayerTreeNode* mParent ;
149+ QgsLayerTreeNode * mParent ;
149150 // ! list of children - node is responsible for their deletion
150151 QList<QgsLayerTreeNode*> mChildren ;
151152 // ! whether the node should be shown in GUI as expanded
0 commit comments