Skip to content

Commit 468c784

Browse files
committedApr 18, 2017
sipify QgsLayerTreeGroup
1 parent 0b36ee3 commit 468c784

File tree

3 files changed

+336
-127
lines changed

3 files changed

+336
-127
lines changed
 

‎python/auto_sip.blacklist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ core/fieldformatter/qgsrelationreferencefieldformatter.sip
218218
core/fieldformatter/qgsvaluemapfieldformatter.sip
219219
core/fieldformatter/qgsvaluerelationfieldformatter.sip
220220
core/layertree/qgslayertree.sip
221-
core/layertree/qgslayertreegroup.sip
222221
core/layertree/qgslayertreelayer.sip
223222
core/layertree/qgslayertreemodel.sip
224223
core/layertree/qgslayertreemodellegendnode.sip
Lines changed: 197 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,227 @@
1-
/**
2-
* Layer tree group node serves as a container for layers and further groups.
3-
*
4-
* Group names do not need to be unique within one tree nor within one parent.
5-
*
6-
* @note added in 2.4
7-
*/
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/layertree/qgslayertreegroup.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
812
class QgsLayerTreeGroup : QgsLayerTreeNode
913
{
10-
%TypeHeaderCode
11-
#include <qgslayertreegroup.h>
14+
%Docstring
15+
Layer tree group node serves as a container for layers and further groups.
16+
17+
Group names do not need to be unique within one tree nor within one parent.
18+
19+
.. versionadded:: 2.4
1220
%End
1321

22+
%TypeHeaderCode
23+
#include "qgslayertreegroup.h"
24+
%End
1425
public:
15-
QgsLayerTreeGroup( const QString& name = QString(), Qt::CheckState checked = Qt::Checked );
1626

17-
//! Get group's name
27+
QgsLayerTreeGroup( const QString &name = QString(), bool checked = true );
28+
%Docstring
29+
Constructor
30+
%End
31+
32+
1833
QString name() const;
19-
//! Set group's name
20-
void setName( const QString& n );
21-
22-
//! Insert a new group node with given name at specified position. Newly created node is owned by this group.
23-
QgsLayerTreeGroup* insertGroup( int index, const QString& name );
24-
//! Append a new group node with given name. Newly created node is owned by this group.
25-
QgsLayerTreeGroup* addGroup( const QString& name );
26-
//! Insert a new layer node for given map layer at specified position. Newly created node is owned by this group.
27-
QgsLayerTreeLayer* insertLayer( int index, QgsMapLayer* layer );
28-
//! Append a new layer node for given map layer. Newly created node is owned by this group.
29-
QgsLayerTreeLayer* addLayer( QgsMapLayer* layer );
30-
31-
//! Insert existing nodes at specified position. The nodes must not have a parent yet. The nodes will be owned by this group.
32-
void insertChildNodes( int index, const QList<QgsLayerTreeNode*>& nodes /Transfer/ );
33-
//! Insert existing node at specified position. The node must not have a parent yet. The node will be owned by this group.
34-
void insertChildNode( int index, QgsLayerTreeNode* node /Transfer/ );
35-
//! Append an existing node. The node must not have a parent yet. The node will be owned by this group.
36-
void addChildNode( QgsLayerTreeNode* node /Transfer/ );
37-
38-
//! Remove a child node from this group. The node will be deleted.
39-
void removeChildNode( QgsLayerTreeNode* node );
40-
//! Remove map layer's node from this group. The node will be deleted.
41-
void removeLayer( QgsMapLayer* layer );
42-
//! Remove child nodes from index "from". The nodes will be deleted.
34+
%Docstring
35+
Returns the group's name.
36+
:rtype: str
37+
%End
38+
39+
void setName( const QString &n );
40+
%Docstring
41+
Sets the group's name.
42+
%End
43+
44+
QgsLayerTreeGroup *insertGroup( int index, const QString &name );
45+
%Docstring
46+
Insert a new group node with given name at specified position. The newly created node is owned by this group.
47+
:rtype: QgsLayerTreeGroup
48+
%End
49+
50+
QgsLayerTreeGroup *addGroup( const QString &name );
51+
%Docstring
52+
Append a new group node with given name. Newly created node is owned by this group.
53+
:rtype: QgsLayerTreeGroup
54+
%End
55+
56+
QgsLayerTreeLayer *insertLayer( int index, QgsMapLayer *layer );
57+
%Docstring
58+
Insert a new layer node for given map layer at specified position. The newly created node is owned by this group.
59+
:rtype: QgsLayerTreeLayer
60+
%End
61+
62+
QgsLayerTreeLayer *addLayer( QgsMapLayer *layer );
63+
%Docstring
64+
Append a new layer node for given map layer. The newly created node is owned by this group.
65+
:rtype: QgsLayerTreeLayer
66+
%End
67+
68+
void insertChildNodes( int index, const QList<QgsLayerTreeNode *> &nodes /Transfer/ );
69+
%Docstring
70+
Insert existing nodes at specified position. The nodes must not have a parent yet. The nodes will be owned by this group.
71+
%End
72+
73+
void insertChildNode( int index, QgsLayerTreeNode *node /Transfer/ );
74+
%Docstring
75+
Insert existing node at specified position. The node must not have a parent yet. The node will be owned by this group.
76+
%End
77+
78+
void addChildNode( QgsLayerTreeNode *node /Transfer/ );
79+
%Docstring
80+
Append an existing node. The node must not have a parent yet. The node will be owned by this group.
81+
%End
82+
83+
void removeChildNode( QgsLayerTreeNode *node );
84+
%Docstring
85+
Remove a child node from this group. The node will be deleted.
86+
%End
87+
88+
void removeLayer( QgsMapLayer *layer );
89+
%Docstring
90+
Remove map layer's node from this group. The node will be deleted.
91+
%End
92+
4393
void removeChildren( int from, int count );
44-
//! Remove all child group nodes without layers. The groupnodes will be deleted.
94+
%Docstring
95+
Remove child nodes from index "from". The nodes will be deleted.
96+
%End
97+
4598
void removeChildrenGroupWithoutLayers();
46-
//! Remove all child nodes. The nodes will be deleted.
99+
%Docstring
100+
Remove all child group nodes without layers. The groupnodes will be deleted.
101+
%End
102+
47103
void removeAllChildren();
104+
%Docstring
105+
Remove all child nodes. The nodes will be deleted.
106+
%End
107+
108+
QgsLayerTreeLayer *findLayer( QgsMapLayer *layer ) const;
109+
%Docstring
110+
Find layer node representing the map layer. Searches recursively the whole sub-tree.
111+
.. versionadded:: 3.0
112+
:rtype: QgsLayerTreeLayer
113+
%End
114+
115+
QgsLayerTreeLayer *findLayer( const QString &layerId ) const;
116+
%Docstring
117+
Find layer node representing the map layer specified by its ID. Searches recursively the whole sub-tree.
118+
:rtype: QgsLayerTreeLayer
119+
%End
120+
121+
QList<QgsLayerTreeLayer *> findLayers() const;
122+
%Docstring
123+
Find all layer nodes. Searches recursively the whole sub-tree.
124+
:rtype: list of QgsLayerTreeLayer
125+
%End
48126

49-
//! Find layer node representing the map layer. Searches recursively the whole sub-tree.
50-
//! @note added in 3.0
51-
QgsLayerTreeLayer* findLayer( QgsMapLayer* layer ) const;
52-
//! Find layer node representing the map layer specified by its ID. Searches recursively the whole sub-tree.
53-
QgsLayerTreeLayer* findLayer( const QString& layerId );
54-
//! Find all layer nodes. Searches recursively the whole sub-tree.
55-
QList<QgsLayerTreeLayer*> findLayers() const;
56-
//! Find layer IDs used in all layer nodes. Searches recursively the whole sub-tree.
57127
QStringList findLayerIds() const;
58-
//! Find group node with specified name. Searches recursively the whole sub-tree.
59-
QgsLayerTreeGroup* findGroup( const QString& name );
60-
61-
//! Read group (tree) from XML element <layer-tree-group> and return the newly created group (or null on error).
62-
//! Does not resolve textual references to layers. Call resolveReferences() afterwards to do it.
63-
static QgsLayerTreeGroup* readXml( QDomElement& element ) /Factory/;
64-
//! Read group (tree) from XML element <layer-tree-group> and return the newly created group (or null on error).
65-
//! Also resolves textual references to layers from the project (calls resolveReferences() internally).
66-
//! @note added in 3.0
67-
static QgsLayerTreeGroup* readXml( QDomElement& element, const QgsProject* project ) /Factory/;
68-
69-
//! Write group (tree) as XML element <layer-tree-group> and add it to the given parent element
70-
virtual void writeXml( QDomElement& parentElement );
71-
//! Read children from XML and append them to the group.
72-
//! Does not resolve textual references to layers. Call resolveReferences() afterwards to do it.
73-
void readChildrenFromXml( QDomElement& element );
74-
75-
//! Return text representation of the tree. For debugging purposes only.
128+
%Docstring
129+
Find layer IDs used in all layer nodes. Searches recursively the whole sub-tree.
130+
:rtype: list of str
131+
%End
132+
133+
QgsLayerTreeGroup *findGroup( const QString &name );
134+
%Docstring
135+
Find group node with specified name. Searches recursively the whole sub-tree.
136+
:rtype: QgsLayerTreeGroup
137+
%End
138+
139+
static QgsLayerTreeGroup *readXml( QDomElement &element ) /Factory/;
140+
%Docstring
141+
Read group (tree) from XML element <layer-tree-group> and return the newly created group (or null on error).
142+
Does not resolve textual references to layers. Call resolveReferences() afterwards to do it.
143+
:rtype: QgsLayerTreeGroup
144+
%End
145+
146+
static QgsLayerTreeGroup *readXml( QDomElement &element, const QgsProject *project ) /Factory/;
147+
%Docstring
148+
Read group (tree) from XML element <layer-tree-group> and return the newly created group (or null on error).
149+
Also resolves textual references to layers from the project (calls resolveReferences() internally).
150+
.. versionadded:: 3.0
151+
:rtype: QgsLayerTreeGroup
152+
%End
153+
154+
virtual void writeXml( QDomElement &parentElement );
155+
%Docstring
156+
Write group (tree) as XML element <layer-tree-group> and add it to the given parent element
157+
%End
158+
159+
void readChildrenFromXml( QDomElement &element );
160+
%Docstring
161+
Read children from XML and append them to the group.
162+
Does not resolve textual references to layers. Call resolveReferences() afterwards to do it.
163+
%End
164+
76165
virtual QString dump() const;
166+
%Docstring
167+
Return text representation of the tree. For debugging purposes only.
168+
:rtype: str
169+
%End
77170

78-
//! Return a clone of the group. The children are cloned too.
79-
virtual QgsLayerTreeGroup* clone() const /Factory/;
171+
virtual QgsLayerTreeGroup *clone() const /Factory/;
172+
%Docstring
173+
Return a clone of the group. The children are cloned too.
174+
:rtype: QgsLayerTreeGroup
175+
%End
80176

81-
//! Calls resolveReferences() on child tree nodes
82-
//! \since QGIS 3.0
83177
virtual void resolveReferences( const QgsProject *project, bool looseMatching = false );
178+
%Docstring
179+
Calls resolveReferences() on child tree nodes
180+
.. versionadded:: 3.0
181+
%End
84182

85-
//! Check or uncheck a node and all its children (taking into account exclusion rules)
86183
virtual void setItemVisibilityCheckedRecursive( bool checked );
184+
%Docstring
185+
Check or uncheck a node and all its children (taking into account exclusion rules)
186+
%End
87187

88-
//! Return whether the group is mutually exclusive (only one child can be checked at a time)
89-
//! @note added in 2.12
90188
bool isMutuallyExclusive() const;
91-
//! Set whether the group is mutually exclusive (only one child can be checked at a time).
92-
//! The initial child index determines which child should be initially checked. The default value
93-
//! of -1 will determine automatically (either first one currently checked or none)
94-
//! @note added in 2.12
189+
%Docstring
190+
Return whether the group is mutually exclusive (only one child can be checked at a time)
191+
.. versionadded:: 2.12
192+
:rtype: bool
193+
%End
194+
95195
void setIsMutuallyExclusive( bool enabled, int initialChildIndex = -1 );
196+
%Docstring
197+
Set whether the group is mutually exclusive (only one child can be checked at a time).
198+
The initial child index determines which child should be initially checked. The default value
199+
of -1 will determine automatically (either first one currently checked or none)
200+
.. versionadded:: 2.12
201+
%End
96202

97203
protected slots:
98-
void nodeVisibilityChanged( QgsLayerTreeNode* node );
204+
void nodeVisibilityChanged( QgsLayerTreeNode *node );
99205

100206
protected:
101207

102-
//! Set check state of children - if mutually exclusive
103208
void updateChildVisibilityMutuallyExclusive();
209+
%Docstring
210+
Set check state of children - if mutually exclusive
211+
%End
212+
213+
214+
104215

105216
private:
106-
QgsLayerTreeGroup( const QgsLayerTreeGroup& other );
217+
QgsLayerTreeGroup( const QgsLayerTreeGroup &other );
107218
};
219+
220+
221+
/************************************************************************
222+
* This file has been generated automatically from *
223+
* *
224+
* src/core/layertree/qgslayertreegroup.h *
225+
* *
226+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
227+
************************************************************************/

0 commit comments

Comments
 (0)