File: qgslayertreegroup.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (325 lines) | stat: -rw-r--r-- 9,462 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/layertree/qgslayertreegroup.h                               *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/




class QgsLayerTreeGroup : QgsLayerTreeNode
{
%Docstring(signature="appended")
Layer tree group node serves as a container for layers and further
groups.

Group names do not need to be unique within one tree nor within one
parent.

While a layer tree group is typically used for hierarchical organisation
of a :py:class:`QgsProject`, they can optionally be associated with a
:py:class:`QgsGroupLayer` for map rendering purposes.
%End

%TypeHeaderCode
#include "qgslayertreegroup.h"
%End
  public:

    QgsLayerTreeGroup( const QString &name = QString(), bool checked = true );
%Docstring
Constructor
%End


    SIP_PYOBJECT __repr__();
%MethodCode
    QString str = QStringLiteral( "<QgsLayerTreeGroup: %1>" ).arg( sipCpp->name() );
    sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

    virtual QString name() const;

%Docstring
Returns the group's name.
%End

    virtual void setName( const QString &n );

%Docstring
Sets the group's name.
%End

    QgsLayerTreeGroup *insertGroup( int index, const QString &name );
%Docstring
Insert a new group node with given name at specified position. The newly
created node is owned by this group.
%End

    QgsLayerTreeGroup *addGroup( const QString &name );
%Docstring
Append a new group node with given name. Newly created node is owned by
this group.
%End

    QgsLayerTreeLayer *insertLayer( int index, QgsMapLayer *layer );
%Docstring
Insert a new layer node for given map layer at specified position. The
newly created node is owned by this group.
%End

    QgsLayerTreeLayer *addLayer( QgsMapLayer *layer );
%Docstring
Append a new layer node for given map layer. The newly created node is
owned by this group.
%End

    void insertChildNodes( int index, const QList<QgsLayerTreeNode *> &nodes /Transfer/ );
%Docstring
Insert existing nodes at specified position. The nodes must not have a
parent yet. The nodes will be owned by this group.
%End

    void insertChildNode( int index, QgsLayerTreeNode *node /Transfer/ );
%Docstring
Insert existing node at specified position. The node must not have a
parent yet. The node will be owned by this group.
%End

    void addChildNode( QgsLayerTreeNode *node /Transfer/ );
%Docstring
Append an existing node. The node must not have a parent yet. The node
will be owned by this group.
%End

    void removeChildNode( QgsLayerTreeNode *node );
%Docstring
Remove a child node from this group. The node will be deleted.
%End

    void removeLayer( QgsMapLayer *layer );
%Docstring
Remove map layer's node from this group. The node will be deleted.
%End

    void removeChildren( int from, int count );
%Docstring
Remove child nodes from index "from". The nodes will be deleted.
%End

    void removeChildrenGroupWithoutLayers();
%Docstring
Remove all child group nodes without layers. The groupnodes will be
deleted.
%End

    void removeAllChildren();
%Docstring
Remove all child nodes. The nodes will be deleted.
%End

    QgsLayerTreeLayer *findLayer( QgsMapLayer *layer ) const;
%Docstring
Find layer node representing the map layer. Searches recursively the
whole sub-tree.
%End

    QgsLayerTreeLayer *findLayer( const QString &layerId ) const;
%Docstring
Find layer node representing the map layer specified by its ID. Searches
recursively the whole sub-tree.
%End

    QList<QgsLayerTreeLayer *> findLayers() const;
%Docstring
Find all layer nodes. Searches recursively the whole sub-tree.
%End

    void reorderGroupLayers( const QList< QgsMapLayer * > &order );
%Docstring
Reorders layers in the group to match the order specified by ``order``.

Only layers which are direct children of this group will be reordered,
other layers will be ignored.

.. note::

   This method does not recursively reorder child groups.

.. note::

   Matching layers will be moved to the start of the group, with any existing
   non-matching layers and group nodes moved to sit after the re-ordered matching layers.

.. versionadded:: 3.30
%End


    QStringList findLayerIds() const;
%Docstring
Find layer IDs used in all layer nodes. Searches recursively the whole
sub-tree.
%End

    QgsLayerTreeGroup *findGroup( const QString &name );
%Docstring
Find group node with specified name. Searches recursively the whole
sub-tree.
%End

    QList<QgsLayerTreeGroup *> findGroups( bool recursive = false ) const;
%Docstring
Find group layer nodes. Searches recursively the whole sub-tree, if
recursive is set.
%End

    static QgsLayerTreeGroup *readXml( QDomElement &element, const QgsReadWriteContext &context ) /Factory/;
%Docstring
Read group (tree) from XML element <layer-tree-group> and return the
newly created group (or ``None`` on error). Does not resolve textual
references to layers. Call
:py:func:`~QgsLayerTreeGroup.resolveReferences` afterwards to do it.
%End

    static QgsLayerTreeGroup *readXml( QDomElement &element, const QgsProject *project, const QgsReadWriteContext &context ) /Factory/;
%Docstring
Read group (tree) from XML element <layer-tree-group> and return the
newly created group (or ``None`` on error). Also resolves textual
references to layers from the project (calls
:py:func:`~QgsLayerTreeGroup.resolveReferences` internally).
%End

    virtual void writeXml( QDomElement &parentElement, const QgsReadWriteContext &context );

%Docstring
Write group (tree) as XML element <layer-tree-group> and add it to the
given parent element
%End

    void readChildrenFromXml( QDomElement &element, const QgsReadWriteContext &context );
%Docstring
Read children from XML and append them to the group. Does not resolve
textual references to layers. Call
:py:func:`~QgsLayerTreeGroup.resolveReferences` afterwards to do it.
%End

    virtual QString dump() const;

%Docstring
Returns text representation of the tree. For debugging purposes only.
%End

    virtual QgsLayerTreeGroup *clone() const /Factory/;

%Docstring
Returns a clone of the group. The children are cloned too.
%End

    virtual void resolveReferences( const QgsProject *project, bool looseMatching = false );

%Docstring
Calls :py:func:`~QgsLayerTreeGroup.resolveReferences` on child tree
nodes
%End

    virtual void setItemVisibilityCheckedRecursive( bool checked );

%Docstring
Check or uncheck a node and all its children (taking into account
exclusion rules)
%End

    bool isMutuallyExclusive() const;
%Docstring
Returns whether the group is mutually exclusive (only one child can be
checked at a time)
%End

    void setIsMutuallyExclusive( bool enabled, int initialChildIndex = -1 );
%Docstring
Set whether the group is mutually exclusive (only one child can be
checked at a time). The initial child index determines which child
should be initially checked. The default value of -1 will determine
automatically (either first one currently checked or none)
%End

    QgsGroupLayer *groupLayer();
%Docstring
Returns a reference to the associated group layer, if the layer tree
group will be treated as group layer during map rendering.

.. seealso:: :py:func:`setGroupLayer`

.. seealso:: :py:func:`convertToGroupLayer`

.. versionadded:: 3.24
%End

    void setGroupLayer( QgsGroupLayer *layer );
%Docstring
Sets the associated group ``layer``, if the layer tree group will be
treated as group layer during map rendering.

This method does not take ownership of the group layer, and only a weak
reference to the layer is stored.

.. seealso:: :py:func:`groupLayer`

.. seealso:: :py:func:`convertToGroupLayer`

.. versionadded:: 3.24
%End

    QgsGroupLayer *convertToGroupLayer( const QgsGroupLayer::LayerOptions &options ) /Factory/;
%Docstring
Converts the group to a :py:class:`QgsGroupLayer`.

This method will convert the layer tree group to an equivalent
:py:class:`QgsGroupLayer`, and return the result. The caller takes
ownership of the returned layer, and it is the caller's responsibility
to add the layer to the associated :py:class:`QgsProject`.

If the group is already associated with a group layer (see
:py:func:`~QgsLayerTreeGroup.groupLayer`), ``None`` will be returned.

.. seealso:: :py:func:`groupLayer`

.. seealso:: :py:func:`setGroupLayer`

.. versionadded:: 3.24
%End

  protected slots:

    void nodeVisibilityChanged( QgsLayerTreeNode *node );

  protected:

    void updateChildVisibilityMutuallyExclusive();
%Docstring
Set check state of children - if mutually exclusive
%End






  private:

    QgsLayerTreeGroup( const QgsLayerTreeGroup &other );
%Docstring
Copies are not allowed
%End
};


/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/layertree/qgslayertreegroup.h                               *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/