QGIS API Documentation 4.3.0-Master (621ced71bd7)
Loading...
Searching...
No Matches
QgsSymbolLayerModelNode Class Reference

A node contained within a QgsSymbolLayerModel. More...

#include <qgssymbollayermodel.h>

Public Member Functions

 QgsSymbolLayerModelNode ()
 Constructor for QgsSymbolLayerModelNode for an empty node.
 QgsSymbolLayerModelNode (QgsSymbol *symbol, QgsVectorLayer *vectorLayer, QScreen *screen)
 Constructor for QgsSymbolLayerModelNode for a symbol node.
 QgsSymbolLayerModelNode (QgsSymbolLayer *layer, Qgis::SymbolType symbolType, QgsVectorLayer *vectorLayer, QScreen *screen)
 Constructor for QgsSymbolLayerModelNode for a symbol layer node.
 ~QgsSymbolLayerModelNode ()
QgsSymbolLayerModelNodeaddChildNode (std::unique_ptr< QgsSymbolLayerModelNode > node)
 Adds a child node to this node, transferring ownership of the node.
QgsSymbolLayerModelNodechildAt (int index) const
 Returns the child node at the given index.
QVariant data (int role) const
 Returns the item's data for the given role.
void deleteChildren ()
 Deletes all child nodes from this node.
QIcon icon () const
 Returns the item preview icon.
int indexOf (const QgsSymbolLayerModelNode *node)
 Returns the index position of the given node within the current node's children.
QgsSymbolLayerModelNodeinsertChildNode (int index, std::unique_ptr< QgsSymbolLayerModelNode > node)
 Inserts a child node to this node at index, transferring ownership of the node.
bool isLayer () const
 Returns true if the node is a symbol layer. And otherwise, it is a symbol.
bool isRootNode () const
 Returns true if the node is a root node (i.e. has no parent).
QgsSymbolLayerlayer ()
 Returns the symbol layer pointer.
void moveChildNode (QgsSymbolLayerModelNode *node, int to)
 Move a child node of the current node, the ownership of the moved node is transferred to the current node.
QgsSymbolLayerModelNodeparent ()
 Returns the pointer of the parent node. If parent is nullptr, the node is a root node.
void removeChildNode (QgsSymbolLayerModelNode *node)
 Remove a child node of the current node.
int rowCount () const
 Returns the number of rows(children) belonging to the node.
int rowIndex () const
 Returns the row index of the node within its parent.
void setLayer (QgsSymbolLayer *layer, Qgis::SymbolType symbolType)
 Sets the layer associated with the node, and the symbolType of the QgsSymbol it belongs to.
void setScreen (QScreen *screen)
 Sets the screen associated with the node, which is used to render the preview icons.
QgsSymbolsymbol ()
 Returns the symbol pointer; helpful in determining a layer's parent symbol.

Friends

class TestQgsSymbolLayerModel

Detailed Description

A node contained within a QgsSymbolLayerModel.

May represent a symbol or a layer.

Warning
Not part of stable API and may change in future QGIS releases.
Since
QGIS 4.4

Definition at line 41 of file qgssymbollayermodel.h.

Constructor & Destructor Documentation

◆ QgsSymbolLayerModelNode() [1/3]

QgsSymbolLayerModelNode::QgsSymbolLayerModelNode ( )

Constructor for QgsSymbolLayerModelNode for an empty node.

e.g a root node.

Definition at line 36 of file qgssymbollayermodel.cpp.

◆ QgsSymbolLayerModelNode() [2/3]

QgsSymbolLayerModelNode::QgsSymbolLayerModelNode ( QgsSymbolLayer * layer,
Qgis::SymbolType symbolType,
QgsVectorLayer * vectorLayer,
QScreen * screen )

Constructor for QgsSymbolLayerModelNode for a symbol layer node.

e.g a child node of a symbol.

Note
The ownership of the symbol layer is not transferred and must exist for the lifetime of the object.

Definition at line 39 of file qgssymbollayermodel.cpp.

◆ QgsSymbolLayerModelNode() [3/3]

QgsSymbolLayerModelNode::QgsSymbolLayerModelNode ( QgsSymbol * symbol,
QgsVectorLayer * vectorLayer,
QScreen * screen )

Constructor for QgsSymbolLayerModelNode for a symbol node.

Note
The ownership of the symbol is not transferred and must exist for the lifetime of the object.

Definition at line 46 of file qgssymbollayermodel.cpp.

◆ ~QgsSymbolLayerModelNode()

QgsSymbolLayerModelNode::~QgsSymbolLayerModelNode ( )

Definition at line 53 of file qgssymbollayermodel.cpp.

Member Function Documentation

◆ addChildNode()

QgsSymbolLayerModelNode * QgsSymbolLayerModelNode::addChildNode ( std::unique_ptr< QgsSymbolLayerModelNode > node)

Adds a child node to this node, transferring ownership of the node.

to this node.

Definition at line 159 of file qgssymbollayermodel.cpp.

◆ childAt()

QgsSymbolLayerModelNode * QgsSymbolLayerModelNode::childAt ( int index) const

Returns the child node at the given index.

Definition at line 210 of file qgssymbollayermodel.cpp.

◆ data()

QVariant QgsSymbolLayerModelNode::data ( int role) const

Returns the item's data for the given role.

Definition at line 98 of file qgssymbollayermodel.cpp.

◆ deleteChildren()

void QgsSymbolLayerModelNode::deleteChildren ( )

Deletes all child nodes from this node.

Definition at line 154 of file qgssymbollayermodel.cpp.

◆ icon()

QIcon QgsSymbolLayerModelNode::icon ( ) const

Returns the item preview icon.

Definition at line 78 of file qgssymbollayermodel.cpp.

◆ indexOf()

int QgsSymbolLayerModelNode::indexOf ( const QgsSymbolLayerModelNode * node)

Returns the index position of the given node within the current node's children.

Definition at line 215 of file qgssymbollayermodel.cpp.

◆ insertChildNode()

QgsSymbolLayerModelNode * QgsSymbolLayerModelNode::insertChildNode ( int index,
std::unique_ptr< QgsSymbolLayerModelNode > node )

Inserts a child node to this node at index, transferring ownership of the node.

to this node.

Definition at line 170 of file qgssymbollayermodel.cpp.

◆ isLayer()

bool QgsSymbolLayerModelNode::isLayer ( ) const
inline

Returns true if the node is a symbol layer. And otherwise, it is a symbol.

Definition at line 72 of file qgssymbollayermodel.h.

◆ isRootNode()

bool QgsSymbolLayerModelNode::isRootNode ( ) const
inline

Returns true if the node is a root node (i.e. has no parent).

Definition at line 118 of file qgssymbollayermodel.h.

◆ layer()

QgsSymbolLayer * QgsSymbolLayerModelNode::layer ( )
inline

Returns the symbol layer pointer.

Definition at line 84 of file qgssymbollayermodel.h.

◆ moveChildNode()

void QgsSymbolLayerModelNode::moveChildNode ( QgsSymbolLayerModelNode * node,
int to )

Move a child node of the current node, the ownership of the moved node is transferred to the current node.

Definition at line 181 of file qgssymbollayermodel.cpp.

◆ parent()

QgsSymbolLayerModelNode * QgsSymbolLayerModelNode::parent ( )
inline

Returns the pointer of the parent node. If parent is nullptr, the node is a root node.

Definition at line 115 of file qgssymbollayermodel.h.

◆ removeChildNode()

void QgsSymbolLayerModelNode::removeChildNode ( QgsSymbolLayerModelNode * node)

Remove a child node of the current node.

Definition at line 198 of file qgssymbollayermodel.cpp.

◆ rowCount()

int QgsSymbolLayerModelNode::rowCount ( ) const

Returns the number of rows(children) belonging to the node.

Definition at line 226 of file qgssymbollayermodel.cpp.

◆ rowIndex()

int QgsSymbolLayerModelNode::rowIndex ( ) const

Returns the row index of the node within its parent.

Definition at line 231 of file qgssymbollayermodel.cpp.

◆ setLayer()

void QgsSymbolLayerModelNode::setLayer ( QgsSymbolLayer * layer,
Qgis::SymbolType symbolType )

Sets the layer associated with the node, and the symbolType of the QgsSymbol it belongs to.

Note
The ownership of the symbol layer is not transferred and must exist for the lifetime of the object.

Definition at line 58 of file qgssymbollayermodel.cpp.

◆ setScreen()

void QgsSymbolLayerModelNode::setScreen ( QScreen * screen)

Sets the screen associated with the node, which is used to render the preview icons.

Definition at line 66 of file qgssymbollayermodel.cpp.

◆ symbol()

QgsSymbol * QgsSymbolLayerModelNode::symbol ( )
inline

Returns the symbol pointer; helpful in determining a layer's parent symbol.

Definition at line 81 of file qgssymbollayermodel.h.

◆ TestQgsSymbolLayerModel

friend class TestQgsSymbolLayerModel
friend

Definition at line 158 of file qgssymbollayermodel.h.


The documentation for this class was generated from the following files: