Class: QgsStyleEntityVisitorInterface¶
- class qgis.core.QgsStyleEntityVisitorInterface¶
Bases:
sip.wrapper
An interface for classes which can visit style entity (e.g. symbol) nodes (using the visitor pattern).
New in version 3.10:
Enums
Bases:
enum.IntEnum
Methods
Called when the visitor will visit a style
entity
.Called when the visitor starts visiting a
node
.Called when the visitor stops visiting a
node
.- class Node(type: QgsStyleEntityVisitorInterface.NodeType, identifier: str, description: str)¶
Bases:
sip.wrapper
Constructor for Node, visiting the node with the specified
identifier
anddescription
.QgsStyleEntityVisitorInterface.Node(QgsStyleEntityVisitorInterface.Node)
- description¶
- identifier¶
- type¶
- class NodeType(value)¶
Bases:
enum.IntEnum
Describes the types of nodes which may be visited by the visitor.
Project
: QGIS Project nodeLayer
: Map layerSymbolRule
: Rule based symbology or label child ruleLayouts
: Layout collectionPrintLayout
: An individual print layoutLayoutItem
: Individual item in a print layoutReport
: A QGIS print reportReportHeader
: Report header sectionReportFooter
: Report footer sectionReportSection
: Report sub sectionAnnotations
: Annotations collectionAnnotation
: An individual annotation
- Annotation = 11¶
- Annotations = 10¶
- Layer = 1¶
- LayoutItem = 5¶
- Layouts = 3¶
- PrintLayout = 4¶
- Project = 0¶
- Report = 6¶
- ReportHeader = 7¶
- ReportSection = 9¶
- SymbolRule = 2¶
- class StyleLeaf(entity: QgsStyleEntityInterface, identifier: str = '', description: str = '')¶
Bases:
sip.wrapper
Constructor for StyleLeaf, visiting the given style
entity
with the specifiedidentifier
anddescription
.Ownership of
entity
is not transferred.QgsStyleEntityVisitorInterface.StyleLeaf(QgsStyleEntityVisitorInterface.StyleLeaf)
- description¶
- entity¶
- identifier¶
- visit(self, entity: QgsStyleEntityVisitorInterface.StyleLeaf) bool ¶
Called when the visitor will visit a style
entity
.Subclasses should return
False
to abort further visitations, orTrue
to continue visiting after processing this entity.- Parameters:
entity (QgsStyleEntityVisitorInterface.StyleLeaf) –
- Return type:
bool
- visitEnter(self, node: QgsStyleEntityVisitorInterface.Node) bool ¶
Called when the visitor starts visiting a
node
.Subclasses should return
False
if they do NOT want to visit this particular node - e.g. if the node type is QgsStyleEntityVisitorInterface.NodeType.Layouts and they do not wish to visit layout objects. In this case the visitor will not process the node, and will move to the next available node instead. ReturnTrue
to proceed with visiting the node.The default implementation returns
True
.- Parameters:
node (QgsStyleEntityVisitorInterface.Node) –
- Return type:
bool
- visitExit(self, node: QgsStyleEntityVisitorInterface.Node) bool ¶
Called when the visitor stops visiting a
node
.Subclasses should return
False
to abort further visitations, orTrue
to continue visiting other nodes.The default implementation returns
True
.- Parameters:
node (QgsStyleEntityVisitorInterface.Node) –
- Return type:
bool