2017-04-24 15:52:13 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/layertree/qgslayertreeutils.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-03 15:56:53 +07:00
|
|
|
class QgsLayerTreeUtils
|
|
|
|
{
|
2017-04-24 15:52:13 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Assorted functions for dealing with layer trees.
|
2017-04-24 15:52:13 +02:00
|
|
|
|
|
|
|
.. versionadded:: 2.4
|
2014-06-03 15:56:53 +07:00
|
|
|
%End
|
|
|
|
|
2017-04-24 15:52:13 +02:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgslayertreeutils.h"
|
|
|
|
%End
|
2014-06-03 15:56:53 +07:00
|
|
|
public:
|
|
|
|
|
2017-04-24 15:52:13 +02:00
|
|
|
static bool readOldLegend( QgsLayerTreeGroup *root, const QDomElement &legendElem );
|
|
|
|
%Docstring
|
|
|
|
Try to load layer tree from \verbatim <legend> \endverbatim tag from project files from QGIS 2.2 and below
|
|
|
|
%End
|
|
|
|
static bool readOldLegendLayerOrder( const QDomElement &legendElem, bool &hasCustomOrder, QStringList &order );
|
|
|
|
%Docstring
|
|
|
|
Try to load custom layer order from \verbatim <legend> \endverbatim tag from project files from QGIS 2.2 and below
|
|
|
|
%End
|
|
|
|
static QDomElement writeOldLegend( QDomDocument &doc, QgsLayerTreeGroup *root, bool hasCustomOrder, const QList<QgsMapLayer *> &order );
|
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns \verbatim <legend> \endverbatim tag used in QGIS 2.2 and below
|
2017-04-24 15:52:13 +02:00
|
|
|
%End
|
2014-06-03 15:56:53 +07:00
|
|
|
|
|
|
|
static QString checkStateToXml( Qt::CheckState state );
|
2017-04-24 15:52:13 +02:00
|
|
|
%Docstring
|
|
|
|
Convert Qt.CheckState to QString
|
|
|
|
%End
|
|
|
|
static Qt::CheckState checkStateFromXml( const QString &txt );
|
|
|
|
%Docstring
|
|
|
|
Convert QString to Qt.CheckState
|
|
|
|
%End
|
2014-06-03 15:56:53 +07:00
|
|
|
|
2017-04-24 15:52:13 +02:00
|
|
|
static bool layersEditable( const QList<QgsLayerTreeLayer *> &layerNodes );
|
|
|
|
%Docstring
|
2019-02-26 19:54:09 +10:00
|
|
|
Returns ``True`` if any of the layers is editable
|
2017-04-24 15:52:13 +02:00
|
|
|
%End
|
|
|
|
static bool layersModified( const QList<QgsLayerTreeLayer *> &layerNodes );
|
|
|
|
%Docstring
|
2019-02-26 19:54:09 +10:00
|
|
|
Returns ``True`` if any of the layers is modified
|
2017-04-24 15:52:13 +02:00
|
|
|
%End
|
2014-06-03 15:56:53 +07:00
|
|
|
|
2017-04-24 15:52:13 +02:00
|
|
|
static void removeInvalidLayers( QgsLayerTreeGroup *group );
|
|
|
|
%Docstring
|
2018-10-20 18:59:12 +02:00
|
|
|
Removes layer nodes that refer to invalid layers
|
|
|
|
%End
|
|
|
|
|
2018-10-30 14:47:00 +01:00
|
|
|
static void storeOriginalLayersProperties( QgsLayerTreeGroup *group, const QDomDocument *doc );
|
2018-10-20 18:59:12 +02:00
|
|
|
%Docstring
|
2018-10-30 14:47:00 +01:00
|
|
|
Stores in a layer's originalXmlProperties the layer properties information
|
2018-10-20 18:59:12 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
2017-04-24 15:52:13 +02:00
|
|
|
%End
|
2014-06-03 15:56:53 +07:00
|
|
|
|
2017-04-24 15:52:13 +02:00
|
|
|
static void replaceChildrenOfEmbeddedGroups( QgsLayerTreeGroup *group );
|
|
|
|
%Docstring
|
|
|
|
Remove subtree of embedded groups and replaces it with a custom property embedded-visible-layers
|
|
|
|
%End
|
2014-06-03 15:56:53 +07:00
|
|
|
|
2017-04-24 15:52:13 +02:00
|
|
|
static void updateEmbeddedGroupsProjectPath( QgsLayerTreeGroup *group, const QgsProject *project );
|
|
|
|
%Docstring
|
2018-05-26 16:51:58 +10:00
|
|
|
Updates an embedded ``group`` from a ``project``.
|
2017-04-24 15:52:13 +02:00
|
|
|
%End
|
2015-01-13 14:51:16 +01:00
|
|
|
|
|
|
|
static QStringList invisibleLayerList( QgsLayerTreeNode *node );
|
2017-04-24 15:52:13 +02:00
|
|
|
%Docstring
|
2018-05-26 18:44:30 +10:00
|
|
|
Gets invisible layers
|
2017-04-24 15:52:13 +02:00
|
|
|
%End
|
2015-06-26 10:12:58 +02:00
|
|
|
|
2017-04-24 15:52:13 +02:00
|
|
|
static void setLegendFilterByExpression( QgsLayerTreeLayer &layer, const QString &expr, bool enabled = true );
|
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Sets the expression filter of a legend layer
|
2017-04-24 15:52:13 +02:00
|
|
|
%End
|
|
|
|
static QString legendFilterByExpression( const QgsLayerTreeLayer &layer, bool *enabled = 0 );
|
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns the expression filter of a legend layer
|
2017-04-24 15:52:13 +02:00
|
|
|
%End
|
|
|
|
static bool hasLegendFilterExpression( const QgsLayerTreeGroup &group );
|
|
|
|
%Docstring
|
|
|
|
Test if one of the layers in a group has an expression filter
|
|
|
|
%End
|
|
|
|
|
|
|
|
static QgsLayerTreeLayer *insertLayerBelow( QgsLayerTreeGroup *group, const QgsMapLayer *refLayer, QgsMapLayer *layerToInsert );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Insert a QgsMapLayer just below another one
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param group: the tree group where layers are (can be the root group)
|
|
|
|
:param refLayer: the reference layer
|
|
|
|
:param layerToInsert: the new layer to insert just below the reference layer
|
|
|
|
|
|
|
|
:return: the new tree layer
|
2018-09-25 14:38:20 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
static QSet<QgsMapLayer *> collectMapLayersRecursive( const QList<QgsLayerTreeNode *> &nodes );
|
|
|
|
%Docstring
|
|
|
|
Returns map layers from the given list of layer tree nodes. Also recursively visits
|
|
|
|
child nodes of groups.
|
|
|
|
|
2018-09-26 10:53:06 +02:00
|
|
|
.. versionadded:: 3.4
|
|
|
|
%End
|
|
|
|
|
|
|
|
static int countMapLayerInTree( QgsLayerTreeNode *tree, QgsMapLayer *layer );
|
|
|
|
%Docstring
|
2018-09-26 12:08:26 +02:00
|
|
|
Returns how many occurrences of a map layer are there in a layer tree.
|
|
|
|
In normal situations there is at most one occurrence, but sometimes there
|
2018-09-26 10:53:06 +02:00
|
|
|
may be temporarily more: for example, during drag&drop, upon drop a new layer
|
|
|
|
node is created while the original dragged node is still in the tree, resulting
|
2018-09-26 12:08:26 +02:00
|
|
|
in two occurrences.
|
2018-09-26 10:53:06 +02:00
|
|
|
|
|
|
|
This is useful when deciding whether to start or stop listening to a signal
|
|
|
|
of a map layer within a layer tree and only connecting/disconnecting when
|
2018-09-26 12:08:26 +02:00
|
|
|
there is only one occurrence of that layer.
|
2018-09-26 10:53:06 +02:00
|
|
|
|
2018-09-25 14:38:20 +02:00
|
|
|
.. versionadded:: 3.4
|
2017-04-24 15:52:13 +02:00
|
|
|
%End
|
2014-06-03 15:56:53 +07:00
|
|
|
};
|
2017-04-24 15:52:13 +02:00
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/layertree/qgslayertreeutils.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|