mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-06 00:03:16 -05:00
sipify QgsLayerTreeGroup
This commit is contained in:
parent
0b36ee3aac
commit
468c784f7e
@ -218,7 +218,6 @@ core/fieldformatter/qgsrelationreferencefieldformatter.sip
|
|||||||
core/fieldformatter/qgsvaluemapfieldformatter.sip
|
core/fieldformatter/qgsvaluemapfieldformatter.sip
|
||||||
core/fieldformatter/qgsvaluerelationfieldformatter.sip
|
core/fieldformatter/qgsvaluerelationfieldformatter.sip
|
||||||
core/layertree/qgslayertree.sip
|
core/layertree/qgslayertree.sip
|
||||||
core/layertree/qgslayertreegroup.sip
|
|
||||||
core/layertree/qgslayertreelayer.sip
|
core/layertree/qgslayertreelayer.sip
|
||||||
core/layertree/qgslayertreemodel.sip
|
core/layertree/qgslayertreemodel.sip
|
||||||
core/layertree/qgslayertreemodellegendnode.sip
|
core/layertree/qgslayertreemodellegendnode.sip
|
||||||
|
|||||||
@ -1,107 +1,227 @@
|
|||||||
/**
|
/************************************************************************
|
||||||
* Layer tree group node serves as a container for layers and further groups.
|
* This file has been generated automatically from *
|
||||||
*
|
* *
|
||||||
* Group names do not need to be unique within one tree nor within one parent.
|
* src/core/layertree/qgslayertreegroup.h *
|
||||||
*
|
* *
|
||||||
* @note added in 2.4
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||||
*/
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class QgsLayerTreeGroup : QgsLayerTreeNode
|
class QgsLayerTreeGroup : QgsLayerTreeNode
|
||||||
{
|
{
|
||||||
%TypeHeaderCode
|
%Docstring
|
||||||
#include <qgslayertreegroup.h>
|
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.
|
||||||
|
|
||||||
|
.. versionadded:: 2.4
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
%TypeHeaderCode
|
||||||
|
#include "qgslayertreegroup.h"
|
||||||
|
%End
|
||||||
public:
|
public:
|
||||||
QgsLayerTreeGroup( const QString& name = QString(), Qt::CheckState checked = Qt::Checked );
|
|
||||||
|
|
||||||
//! Get group's name
|
QgsLayerTreeGroup( const QString &name = QString(), bool checked = true );
|
||||||
|
%Docstring
|
||||||
|
Constructor
|
||||||
|
%End
|
||||||
|
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
//! Set group's name
|
%Docstring
|
||||||
void setName( const QString& n );
|
Returns the group's name.
|
||||||
|
:rtype: str
|
||||||
|
%End
|
||||||
|
|
||||||
//! Insert a new group node with given name at specified position. Newly created node is owned by this group.
|
void setName( const QString &n );
|
||||||
QgsLayerTreeGroup* insertGroup( int index, const QString& name );
|
%Docstring
|
||||||
//! Append a new group node with given name. Newly created node is owned by this group.
|
Sets the group's name.
|
||||||
QgsLayerTreeGroup* addGroup( const QString& name );
|
%End
|
||||||
//! Insert a new layer node for given map layer at specified position. Newly created node is owned by this group.
|
|
||||||
QgsLayerTreeLayer* insertLayer( int index, QgsMapLayer* layer );
|
|
||||||
//! Append a new layer node for given map layer. Newly created node is owned by this group.
|
|
||||||
QgsLayerTreeLayer* addLayer( QgsMapLayer* layer );
|
|
||||||
|
|
||||||
//! Insert existing nodes at specified position. The nodes must not have a parent yet. The nodes will be owned by this group.
|
QgsLayerTreeGroup *insertGroup( int index, const QString &name );
|
||||||
void insertChildNodes( int index, const QList<QgsLayerTreeNode*>& nodes /Transfer/ );
|
%Docstring
|
||||||
//! Insert existing node at specified position. The node must not have a parent yet. The node will be owned by this group.
|
Insert a new group node with given name at specified position. The newly created node is owned by this group.
|
||||||
void insertChildNode( int index, QgsLayerTreeNode* node /Transfer/ );
|
:rtype: QgsLayerTreeGroup
|
||||||
//! Append an existing node. The node must not have a parent yet. The node will be owned by this group.
|
%End
|
||||||
void addChildNode( QgsLayerTreeNode* node /Transfer/ );
|
|
||||||
|
QgsLayerTreeGroup *addGroup( const QString &name );
|
||||||
|
%Docstring
|
||||||
|
Append a new group node with given name. Newly created node is owned by this group.
|
||||||
|
:rtype: QgsLayerTreeGroup
|
||||||
|
%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.
|
||||||
|
:rtype: QgsLayerTreeLayer
|
||||||
|
%End
|
||||||
|
|
||||||
|
QgsLayerTreeLayer *addLayer( QgsMapLayer *layer );
|
||||||
|
%Docstring
|
||||||
|
Append a new layer node for given map layer. The newly created node is owned by this group.
|
||||||
|
:rtype: QgsLayerTreeLayer
|
||||||
|
%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
|
||||||
|
|
||||||
//! Remove a child node from this group. The node will be deleted.
|
|
||||||
void removeChildNode( QgsLayerTreeNode* node );
|
|
||||||
//! Remove map layer's node from this group. The node will be deleted.
|
|
||||||
void removeLayer( QgsMapLayer* layer );
|
|
||||||
//! Remove child nodes from index "from". The nodes will be deleted.
|
|
||||||
void removeChildren( int from, int count );
|
void removeChildren( int from, int count );
|
||||||
//! Remove all child group nodes without layers. The groupnodes will be deleted.
|
%Docstring
|
||||||
|
Remove child nodes from index "from". The nodes will be deleted.
|
||||||
|
%End
|
||||||
|
|
||||||
void removeChildrenGroupWithoutLayers();
|
void removeChildrenGroupWithoutLayers();
|
||||||
//! Remove all child nodes. The nodes will be deleted.
|
%Docstring
|
||||||
|
Remove all child group nodes without layers. The groupnodes will be deleted.
|
||||||
|
%End
|
||||||
|
|
||||||
void removeAllChildren();
|
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.
|
||||||
|
.. versionadded:: 3.0
|
||||||
|
:rtype: QgsLayerTreeLayer
|
||||||
|
%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.
|
||||||
|
:rtype: QgsLayerTreeLayer
|
||||||
|
%End
|
||||||
|
|
||||||
|
QList<QgsLayerTreeLayer *> findLayers() const;
|
||||||
|
%Docstring
|
||||||
|
Find all layer nodes. Searches recursively the whole sub-tree.
|
||||||
|
:rtype: list of QgsLayerTreeLayer
|
||||||
|
%End
|
||||||
|
|
||||||
//! Find layer node representing the map layer. Searches recursively the whole sub-tree.
|
|
||||||
//! @note added in 3.0
|
|
||||||
QgsLayerTreeLayer* findLayer( QgsMapLayer* layer ) const;
|
|
||||||
//! Find layer node representing the map layer specified by its ID. Searches recursively the whole sub-tree.
|
|
||||||
QgsLayerTreeLayer* findLayer( const QString& layerId );
|
|
||||||
//! Find all layer nodes. Searches recursively the whole sub-tree.
|
|
||||||
QList<QgsLayerTreeLayer*> findLayers() const;
|
|
||||||
//! Find layer IDs used in all layer nodes. Searches recursively the whole sub-tree.
|
|
||||||
QStringList findLayerIds() const;
|
QStringList findLayerIds() const;
|
||||||
//! Find group node with specified name. Searches recursively the whole sub-tree.
|
%Docstring
|
||||||
QgsLayerTreeGroup* findGroup( const QString& name );
|
Find layer IDs used in all layer nodes. Searches recursively the whole sub-tree.
|
||||||
|
:rtype: list of str
|
||||||
|
%End
|
||||||
|
|
||||||
//! Read group (tree) from XML element <layer-tree-group> and return the newly created group (or null on error).
|
QgsLayerTreeGroup *findGroup( const QString &name );
|
||||||
//! Does not resolve textual references to layers. Call resolveReferences() afterwards to do it.
|
%Docstring
|
||||||
static QgsLayerTreeGroup* readXml( QDomElement& element ) /Factory/;
|
Find group node with specified name. Searches recursively the whole sub-tree.
|
||||||
//! Read group (tree) from XML element <layer-tree-group> and return the newly created group (or null on error).
|
:rtype: QgsLayerTreeGroup
|
||||||
//! Also resolves textual references to layers from the project (calls resolveReferences() internally).
|
%End
|
||||||
//! @note added in 3.0
|
|
||||||
static QgsLayerTreeGroup* readXml( QDomElement& element, const QgsProject* project ) /Factory/;
|
|
||||||
|
|
||||||
//! Write group (tree) as XML element <layer-tree-group> and add it to the given parent element
|
static QgsLayerTreeGroup *readXml( QDomElement &element ) /Factory/;
|
||||||
virtual void writeXml( QDomElement& parentElement );
|
%Docstring
|
||||||
//! Read children from XML and append them to the group.
|
Read group (tree) from XML element <layer-tree-group> and return the newly created group (or null on error).
|
||||||
//! Does not resolve textual references to layers. Call resolveReferences() afterwards to do it.
|
Does not resolve textual references to layers. Call resolveReferences() afterwards to do it.
|
||||||
void readChildrenFromXml( QDomElement& element );
|
:rtype: QgsLayerTreeGroup
|
||||||
|
%End
|
||||||
|
|
||||||
|
static QgsLayerTreeGroup *readXml( QDomElement &element, const QgsProject *project ) /Factory/;
|
||||||
|
%Docstring
|
||||||
|
Read group (tree) from XML element <layer-tree-group> and return the newly created group (or null on error).
|
||||||
|
Also resolves textual references to layers from the project (calls resolveReferences() internally).
|
||||||
|
.. versionadded:: 3.0
|
||||||
|
:rtype: QgsLayerTreeGroup
|
||||||
|
%End
|
||||||
|
|
||||||
|
virtual void writeXml( QDomElement &parentElement );
|
||||||
|
%Docstring
|
||||||
|
Write group (tree) as XML element <layer-tree-group> and add it to the given parent element
|
||||||
|
%End
|
||||||
|
|
||||||
|
void readChildrenFromXml( QDomElement &element );
|
||||||
|
%Docstring
|
||||||
|
Read children from XML and append them to the group.
|
||||||
|
Does not resolve textual references to layers. Call resolveReferences() afterwards to do it.
|
||||||
|
%End
|
||||||
|
|
||||||
//! Return text representation of the tree. For debugging purposes only.
|
|
||||||
virtual QString dump() const;
|
virtual QString dump() const;
|
||||||
|
%Docstring
|
||||||
|
Return text representation of the tree. For debugging purposes only.
|
||||||
|
:rtype: str
|
||||||
|
%End
|
||||||
|
|
||||||
//! Return a clone of the group. The children are cloned too.
|
virtual QgsLayerTreeGroup *clone() const /Factory/;
|
||||||
virtual QgsLayerTreeGroup* clone() const /Factory/;
|
%Docstring
|
||||||
|
Return a clone of the group. The children are cloned too.
|
||||||
|
:rtype: QgsLayerTreeGroup
|
||||||
|
%End
|
||||||
|
|
||||||
//! Calls resolveReferences() on child tree nodes
|
|
||||||
//! \since QGIS 3.0
|
|
||||||
virtual void resolveReferences( const QgsProject *project, bool looseMatching = false );
|
virtual void resolveReferences( const QgsProject *project, bool looseMatching = false );
|
||||||
|
%Docstring
|
||||||
|
Calls resolveReferences() on child tree nodes
|
||||||
|
.. versionadded:: 3.0
|
||||||
|
%End
|
||||||
|
|
||||||
//! Check or uncheck a node and all its children (taking into account exclusion rules)
|
|
||||||
virtual void setItemVisibilityCheckedRecursive( bool checked );
|
virtual void setItemVisibilityCheckedRecursive( bool checked );
|
||||||
|
%Docstring
|
||||||
|
Check or uncheck a node and all its children (taking into account exclusion rules)
|
||||||
|
%End
|
||||||
|
|
||||||
//! Return whether the group is mutually exclusive (only one child can be checked at a time)
|
|
||||||
//! @note added in 2.12
|
|
||||||
bool isMutuallyExclusive() const;
|
bool isMutuallyExclusive() const;
|
||||||
//! Set whether the group is mutually exclusive (only one child can be checked at a time).
|
%Docstring
|
||||||
//! The initial child index determines which child should be initially checked. The default value
|
Return whether the group is mutually exclusive (only one child can be checked at a time)
|
||||||
//! of -1 will determine automatically (either first one currently checked or none)
|
.. versionadded:: 2.12
|
||||||
//! @note added in 2.12
|
:rtype: bool
|
||||||
|
%End
|
||||||
|
|
||||||
void setIsMutuallyExclusive( bool enabled, int initialChildIndex = -1 );
|
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)
|
||||||
|
.. versionadded:: 2.12
|
||||||
|
%End
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void nodeVisibilityChanged( QgsLayerTreeNode* node );
|
void nodeVisibilityChanged( QgsLayerTreeNode *node );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! Set check state of children - if mutually exclusive
|
|
||||||
void updateChildVisibilityMutuallyExclusive();
|
void updateChildVisibilityMutuallyExclusive();
|
||||||
|
%Docstring
|
||||||
|
Set check state of children - if mutually exclusive
|
||||||
|
%End
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QgsLayerTreeGroup( const QgsLayerTreeGroup& other );
|
QgsLayerTreeGroup( const QgsLayerTreeGroup &other );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* This file has been generated automatically from *
|
||||||
|
* *
|
||||||
|
* src/core/layertree/qgslayertreegroup.h *
|
||||||
|
* *
|
||||||
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||||
|
************************************************************************/
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
#define QGSLAYERTREEGROUP_H
|
#define QGSLAYERTREEGROUP_H
|
||||||
|
|
||||||
#include "qgis_core.h"
|
#include "qgis_core.h"
|
||||||
|
#include "qgis.h"
|
||||||
#include "qgslayertreenode.h"
|
#include "qgslayertreenode.h"
|
||||||
|
|
||||||
class QgsMapLayer;
|
class QgsMapLayer;
|
||||||
@ -33,88 +34,169 @@ class CORE_EXPORT QgsLayerTreeGroup : public QgsLayerTreeNode
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
|
||||||
QgsLayerTreeGroup( const QString &name = QString(), bool checked = true );
|
|
||||||
QgsLayerTreeGroup( const QgsLayerTreeGroup &other );
|
|
||||||
|
|
||||||
//! Get group's name
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
QgsLayerTreeGroup( const QString &name = QString(), bool checked = true );
|
||||||
|
|
||||||
|
#ifndef SIP_RUN
|
||||||
|
QgsLayerTreeGroup( const QgsLayerTreeGroup &other );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the group's name.
|
||||||
|
*/
|
||||||
QString name() const override;
|
QString name() const override;
|
||||||
//! Set group's name
|
|
||||||
|
/**
|
||||||
|
* Sets the group's name.
|
||||||
|
*/
|
||||||
void setName( const QString &n ) override;
|
void setName( const QString &n ) override;
|
||||||
|
|
||||||
//! Insert a new group node with given name at specified position. Newly created node is owned by this group.
|
/**
|
||||||
|
* Insert a new group node with given name at specified position. The newly created node is owned by this group.
|
||||||
|
*/
|
||||||
QgsLayerTreeGroup *insertGroup( int index, const QString &name );
|
QgsLayerTreeGroup *insertGroup( int index, const QString &name );
|
||||||
//! Append a new group node with given name. Newly created node is owned by this group.
|
|
||||||
|
/**
|
||||||
|
* Append a new group node with given name. Newly created node is owned by this group.
|
||||||
|
*/
|
||||||
QgsLayerTreeGroup *addGroup( const QString &name );
|
QgsLayerTreeGroup *addGroup( const QString &name );
|
||||||
//! Insert a new layer node for given map layer at specified position. Newly created node is owned by this group.
|
|
||||||
|
/**
|
||||||
|
* Insert a new layer node for given map layer at specified position. The newly created node is owned by this group.
|
||||||
|
*/
|
||||||
QgsLayerTreeLayer *insertLayer( int index, QgsMapLayer *layer );
|
QgsLayerTreeLayer *insertLayer( int index, QgsMapLayer *layer );
|
||||||
//! Append a new layer node for given map layer. Newly created node is owned by this group.
|
|
||||||
|
/**
|
||||||
|
* Append a new layer node for given map layer. The newly created node is owned by this group.
|
||||||
|
*/
|
||||||
QgsLayerTreeLayer *addLayer( QgsMapLayer *layer );
|
QgsLayerTreeLayer *addLayer( QgsMapLayer *layer );
|
||||||
|
|
||||||
//! Insert existing nodes at specified position. The nodes must not have a parent yet. The nodes will be owned by this group.
|
/**
|
||||||
void insertChildNodes( int index, const QList<QgsLayerTreeNode *> &nodes );
|
* Insert existing nodes at specified position. The nodes must not have a parent yet. The nodes will be owned by this group.
|
||||||
//! Insert existing node at specified position. The node must not have a parent yet. The node will be owned by this group.
|
*/
|
||||||
void insertChildNode( int index, QgsLayerTreeNode *node );
|
void insertChildNodes( int index, const QList<QgsLayerTreeNode *> &nodes SIP_TRANSFER );
|
||||||
//! Append an existing node. The node must not have a parent yet. The node will be owned by this group.
|
|
||||||
void addChildNode( QgsLayerTreeNode *node );
|
|
||||||
|
|
||||||
//! Remove a child node from this group. The node will be deleted.
|
/**
|
||||||
|
* Insert existing node at specified position. The node must not have a parent yet. The node will be owned by this group.
|
||||||
|
*/
|
||||||
|
void insertChildNode( int index, QgsLayerTreeNode *node SIP_TRANSFER );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append an existing node. The node must not have a parent yet. The node will be owned by this group.
|
||||||
|
*/
|
||||||
|
void addChildNode( QgsLayerTreeNode *node SIP_TRANSFER );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a child node from this group. The node will be deleted.
|
||||||
|
*/
|
||||||
void removeChildNode( QgsLayerTreeNode *node );
|
void removeChildNode( QgsLayerTreeNode *node );
|
||||||
//! Remove map layer's node from this group. The node will be deleted.
|
|
||||||
|
/**
|
||||||
|
* Remove map layer's node from this group. The node will be deleted.
|
||||||
|
*/
|
||||||
void removeLayer( QgsMapLayer *layer );
|
void removeLayer( QgsMapLayer *layer );
|
||||||
//! Remove child nodes from index "from". The nodes will be deleted.
|
|
||||||
|
/**
|
||||||
|
* Remove child nodes from index "from". The nodes will be deleted.
|
||||||
|
*/
|
||||||
void removeChildren( int from, int count );
|
void removeChildren( int from, int count );
|
||||||
//! Remove all child group nodes without layers. The groupnodes will be deleted.
|
|
||||||
|
/**
|
||||||
|
* Remove all child group nodes without layers. The groupnodes will be deleted.
|
||||||
|
*/
|
||||||
void removeChildrenGroupWithoutLayers();
|
void removeChildrenGroupWithoutLayers();
|
||||||
//! Remove all child nodes. The nodes will be deleted.
|
|
||||||
|
/**
|
||||||
|
* Remove all child nodes. The nodes will be deleted.
|
||||||
|
*/
|
||||||
void removeAllChildren();
|
void removeAllChildren();
|
||||||
|
|
||||||
//! Find layer node representing the map layer. Searches recursively the whole sub-tree.
|
/**
|
||||||
//! \since QGIS 3.0
|
* Find layer node representing the map layer. Searches recursively the whole sub-tree.
|
||||||
|
* \since QGIS 3.0
|
||||||
|
*/
|
||||||
QgsLayerTreeLayer *findLayer( QgsMapLayer *layer ) const;
|
QgsLayerTreeLayer *findLayer( QgsMapLayer *layer ) const;
|
||||||
//! Find layer node representing the map layer specified by its ID. Searches recursively the whole sub-tree.
|
|
||||||
|
/**
|
||||||
|
* Find layer node representing the map layer specified by its ID. Searches recursively the whole sub-tree.
|
||||||
|
*/
|
||||||
QgsLayerTreeLayer *findLayer( const QString &layerId ) const;
|
QgsLayerTreeLayer *findLayer( const QString &layerId ) const;
|
||||||
//! Find all layer nodes. Searches recursively the whole sub-tree.
|
|
||||||
|
/**
|
||||||
|
* Find all layer nodes. Searches recursively the whole sub-tree.
|
||||||
|
*/
|
||||||
QList<QgsLayerTreeLayer *> findLayers() const;
|
QList<QgsLayerTreeLayer *> findLayers() const;
|
||||||
//! Find layer IDs used in all layer nodes. Searches recursively the whole sub-tree.
|
|
||||||
|
/**
|
||||||
|
* Find layer IDs used in all layer nodes. Searches recursively the whole sub-tree.
|
||||||
|
*/
|
||||||
QStringList findLayerIds() const;
|
QStringList findLayerIds() const;
|
||||||
//! Find group node with specified name. Searches recursively the whole sub-tree.
|
|
||||||
|
/**
|
||||||
|
* Find group node with specified name. Searches recursively the whole sub-tree.
|
||||||
|
*/
|
||||||
QgsLayerTreeGroup *findGroup( const QString &name );
|
QgsLayerTreeGroup *findGroup( const QString &name );
|
||||||
|
|
||||||
//! Read group (tree) from XML element <layer-tree-group> and return the newly created group (or null on error).
|
/**
|
||||||
//! Does not resolve textual references to layers. Call resolveReferences() afterwards to do it.
|
* Read group (tree) from XML element <layer-tree-group> and return the newly created group (or null on error).
|
||||||
static QgsLayerTreeGroup *readXml( QDomElement &element );
|
* Does not resolve textual references to layers. Call resolveReferences() afterwards to do it.
|
||||||
//! Read group (tree) from XML element <layer-tree-group> and return the newly created group (or null on error).
|
*/
|
||||||
//! Also resolves textual references to layers from the project (calls resolveReferences() internally).
|
static QgsLayerTreeGroup *readXml( QDomElement &element ) SIP_FACTORY;
|
||||||
//! \since QGIS 3.0
|
|
||||||
static QgsLayerTreeGroup *readXml( QDomElement &element, const QgsProject *project );
|
|
||||||
|
|
||||||
//! Write group (tree) as XML element <layer-tree-group> and add it to the given parent element
|
/**
|
||||||
|
* Read group (tree) from XML element <layer-tree-group> and return the newly created group (or null on error).
|
||||||
|
* Also resolves textual references to layers from the project (calls resolveReferences() internally).
|
||||||
|
* \since QGIS 3.0
|
||||||
|
*/
|
||||||
|
static QgsLayerTreeGroup *readXml( QDomElement &element, const QgsProject *project ) SIP_FACTORY;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write group (tree) as XML element <layer-tree-group> and add it to the given parent element
|
||||||
|
*/
|
||||||
virtual void writeXml( QDomElement &parentElement ) override;
|
virtual void writeXml( QDomElement &parentElement ) override;
|
||||||
//! Read children from XML and append them to the group.
|
|
||||||
//! Does not resolve textual references to layers. Call resolveReferences() afterwards to do it.
|
/**
|
||||||
|
* Read children from XML and append them to the group.
|
||||||
|
* Does not resolve textual references to layers. Call resolveReferences() afterwards to do it.
|
||||||
|
*/
|
||||||
void readChildrenFromXml( QDomElement &element );
|
void readChildrenFromXml( QDomElement &element );
|
||||||
|
|
||||||
//! Return text representation of the tree. For debugging purposes only.
|
/**
|
||||||
|
* Return text representation of the tree. For debugging purposes only.
|
||||||
|
*/
|
||||||
virtual QString dump() const override;
|
virtual QString dump() const override;
|
||||||
|
|
||||||
//! Return a clone of the group. The children are cloned too.
|
/**
|
||||||
virtual QgsLayerTreeGroup *clone() const override;
|
* Return a clone of the group. The children are cloned too.
|
||||||
|
*/
|
||||||
|
virtual QgsLayerTreeGroup *clone() const override SIP_FACTORY;
|
||||||
|
|
||||||
//! Calls resolveReferences() on child tree nodes
|
/**
|
||||||
//! \since QGIS 3.0
|
* Calls resolveReferences() on child tree nodes
|
||||||
|
* \since QGIS 3.0
|
||||||
|
*/
|
||||||
virtual void resolveReferences( const QgsProject *project, bool looseMatching = false ) override;
|
virtual void resolveReferences( const QgsProject *project, bool looseMatching = false ) override;
|
||||||
|
|
||||||
//! Check or uncheck a node and all its children (taking into account exclusion rules)
|
/**
|
||||||
|
* Check or uncheck a node and all its children (taking into account exclusion rules)
|
||||||
|
*/
|
||||||
virtual void setItemVisibilityCheckedRecursive( bool checked ) override;
|
virtual void setItemVisibilityCheckedRecursive( bool checked ) override;
|
||||||
|
|
||||||
//! Return whether the group is mutually exclusive (only one child can be checked at a time)
|
/**
|
||||||
//! \since QGIS 2.12
|
* Return whether the group is mutually exclusive (only one child can be checked at a time)
|
||||||
|
* \since QGIS 2.12
|
||||||
|
*/
|
||||||
bool isMutuallyExclusive() const;
|
bool isMutuallyExclusive() const;
|
||||||
//! 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)
|
* Set whether the group is mutually exclusive (only one child can be checked at a time).
|
||||||
//! \since QGIS 2.12
|
* 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)
|
||||||
|
* \since QGIS 2.12
|
||||||
|
*/
|
||||||
void setIsMutuallyExclusive( bool enabled, int initialChildIndex = -1 );
|
void setIsMutuallyExclusive( bool enabled, int initialChildIndex = -1 );
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
@ -122,10 +204,11 @@ class CORE_EXPORT QgsLayerTreeGroup : public QgsLayerTreeNode
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! Set check state of children - if mutually exclusive
|
/**
|
||||||
|
* Set check state of children - if mutually exclusive
|
||||||
|
*/
|
||||||
void updateChildVisibilityMutuallyExclusive();
|
void updateChildVisibilityMutuallyExclusive();
|
||||||
|
|
||||||
protected:
|
|
||||||
QString mName;
|
QString mName;
|
||||||
|
|
||||||
bool mChangingChildVisibility;
|
bool mChangingChildVisibility;
|
||||||
@ -135,6 +218,13 @@ class CORE_EXPORT QgsLayerTreeGroup : public QgsLayerTreeNode
|
|||||||
//! Keeps track which child has been most recently selected
|
//! Keeps track which child has been most recently selected
|
||||||
//! (so if the whole group is unchecked and checked again, we know which child to check)
|
//! (so if the whole group is unchecked and checked again, we know which child to check)
|
||||||
int mMutuallyExclusiveChildIndex;
|
int mMutuallyExclusiveChildIndex;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
#ifdef SIP_RUN
|
||||||
|
QgsLayerTreeGroup( const QgsLayerTreeGroup &other );
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user