QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
layertree
qgslayertreecustomnode.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgslayertreecustomnode.h
3
------------------------
4
begin : July 2025
5
copyright : (C) 2025 by Germán Carrillo
6
email : german at opengis dot ch
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#ifndef QGSLAYERTREECUSTOMNODE_H
19
#define QGSLAYERTREECUSTOMNODE_H
20
21
#include "qgis_core.h"
22
#include "
qgis_sip.h
"
23
#include "
qgslayertreenode.h
"
24
25
#include <QObject>
26
#include <QString>
27
28
using namespace
Qt::StringLiterals;
29
39
class
CORE_EXPORT
QgsLayerTreeCustomNode
:
public
QgsLayerTreeNode
40
{
41
Q_OBJECT
42
public
:
50
explicit
QgsLayerTreeCustomNode
(
const
QString &
nodeId
,
const
QString &nodeName = QString(),
bool
checked =
true
);
51
52
#ifndef SIP_RUN
53
QgsLayerTreeCustomNode
(
const
QgsLayerTreeCustomNode
&other );
54
#endif
55
56
#ifdef SIP_RUN
57
// clang-format off
58
SIP_PYOBJECT __repr__();
59
% MethodCode
60
QString str = u
"<QgsLayerTreeCustomNode: %1>"
_s.arg( sipCpp->name() );
61
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
62
% End
63
// clang-format on
64
#endif
65
66
QString
id
()
const override
67
{
68
return
mId;
69
}
70
76
Q_DECL_DEPRECATED QString
nodeId
() const
SIP_DEPRECATED
{
return
mId; }
77
81
QString
name
()
const override
;
82
86
void
setName
(
const
QString &name )
override
;
87
91
static
QgsLayerTreeCustomNode
*
readXml
(
const
QDomElement &element,
const
QgsReadWriteContext
&context )
SIP_FACTORY
;
// cppcheck-suppress duplInheritedMember
92
96
void
writeXml
( QDomElement &parentElement,
const
QgsReadWriteContext
&context )
override
;
97
98
QString
dump
()
const override
;
99
100
QgsLayerTreeCustomNode
*
clone
() const override
SIP_FACTORY
;
101
102
void
resolveReferences( const
QgsProject
*project,
bool
looseMatching = false ) override;
103
104
private:
105
#ifdef SIP_RUN
106
110
QgsLayerTreeCustomNode
(
const
QgsLayerTreeCustomNode
&other );
111
#endif
112
113
QgsLayerTreeCustomNode
&operator=(
const
QgsLayerTreeCustomNode
& ) =
delete
;
114
115
QString mId;
116
QString mName;
117
};
118
119
#endif
// QGSLAYERTREECUSTOMNODE_H
QgsLayerTreeCustomNode
Layer tree custom node serves as a node for objects that are not layers nor groups.
Definition
qgslayertreecustomnode.h:40
QgsLayerTreeCustomNode::id
QString id() const override
Returns the node's unique identifier.
Definition
qgslayertreecustomnode.h:66
QgsLayerTreeCustomNode::nodeId
Q_DECL_DEPRECATED QString nodeId() const
Returns the node's unique identifier.
Definition
qgslayertreecustomnode.h:76
QgsLayerTreeCustomNode::QgsLayerTreeCustomNode
QgsLayerTreeCustomNode(const QString &nodeId, const QString &nodeName=QString(), bool checked=true)
Constructor to create custom nodes that represent application objects other than layers and groups.
Definition
qgslayertreecustomnode.cpp:28
QgsLayerTreeNode::setName
virtual void setName(const QString &name)=0
Set name of the node.
QgsLayerTreeNode::dump
virtual QString dump() const =0
Returns string with layer tree structure. For debug purposes only.
QgsLayerTreeNode::writeXml
virtual void writeXml(QDomElement &parentElement, const QgsReadWriteContext &context)=0
Write layer tree to XML.
QgsLayerTreeNode::readXml
static QgsLayerTreeNode * readXml(QDomElement &element, const QgsReadWriteContext &context)
Read layer tree from XML.
Definition
qgslayertreenode.cpp:72
QgsLayerTreeNode::name
virtual QString name() const =0
Returns name of the node.
QgsLayerTreeNode::QgsLayerTreeNode
QgsLayerTreeNode(NodeType t, bool checked=true)
Constructor.
Definition
qgslayertreenode.cpp:30
QgsLayerTreeNode::clone
virtual QgsLayerTreeNode * clone() const =0
Create a copy of the node. Returns new instance.
QgsProject
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition
qgsproject.h:114
QgsReadWriteContext
A container for the context for various read/write operations on objects.
Definition
qgsreadwritecontext.h:38
qgis_sip.h
SIP_DEPRECATED
#define SIP_DEPRECATED
Definition
qgis_sip.h:113
SIP_FACTORY
#define SIP_FACTORY
Definition
qgis_sip.h:83
qgslayertreenode.h
Generated on
for QGIS API Documentation by
1.17.0