Class: QgsAbstractReportSection¶
An abstract base class for QgsReport
subsections.
Warning
This is not considered stable API, and may change in future QGIS releases. It is exposed to the Python bindings for unit testing purposes only.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: clone()
, description()
, icon()
, type()
Class Hierarchy¶
Base classes¶
An abstract base class for |
Subclasses¶
Represents a report for use with the |
|
A report section consisting of a features. |
|
A report section consisting of a single |
Abstract Methods
Clones the report section. |
|
Returns a user-visible, translated description of the section. |
|
Returns an icon representing the section. |
|
Returns the section subclass type. |
Methods
Accepts the specified style entity visitor, causing it to visit all style entities associated with the report. |
|
Adds a child section, transferring ownership of the section to this section. |
|
Returns the number of child sections for this report section. |
|
Returns the child section at the specified index. |
|
Returns all child sections for this report section. |
|
Returns the current context for this section. |
|
Copies the common properties of a report section to a destination section. |
|
Returns the footer for the section. |
|
Returns |
|
Returns the header for the section. |
|
Returns |
|
Inserts a child section at the specified index, transferring ownership of the section to this section. |
|
Returns the parent report section. |
|
Returns the associated project. |
|
Sets the item state from a DOM element. |
|
Removes a child section, deleting it. |
|
Removes the child section at the specified index, deleting it. |
|
Returns the row number of the section within it's parent section. |
|
Sets the current context for this section. |
|
Sets the footer for the section. |
|
Sets whether the footer for the section is enabled. |
|
Sets the header for the section. |
|
Sets whether the header for the section is enabled. |
|
Stores the section state in a DOM element. |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsAbstractReportSection. See the FAQ for more details.
Returns the next body layout to export, or |
|
Called just before rendering the section's footer. |
|
Called just before rendering the section's header. |
|
Sets section state from a DOM element. |
|
Refreshes the section when global layout related options change. |
|
Resets the section, ready for a new iteration. |
|
Sets the parent report section. |
|
Stores section state within an XML DOM element. |
Attributes
- class qgis.core.QgsAbstractReportSection[source]¶
Bases:
QgsAbstractLayoutIterator
- __init__(parentSection: QgsAbstractReportSection | None = None)
Constructor for QgsAbstractReportSection, attached to the specified
parent
section. Note that ownership is not transferred toparent
.- Parameters:
parentSection (Optional[QgsAbstractReportSection] = None)
- Body = 1¶
- Children = 2¶
- End = 4¶
- Header = 0¶
- class SubSection¶
Bases:
int
- accept(self, visitor: QgsStyleEntityVisitorInterface | None) bool [source]¶
Accepts the specified style entity
visitor
, causing it to visit all style entities associated with the report.Returns
True
if the visitor should continue visiting other objects, orFalse
if visiting should be canceled.Added in version 3.10.
- Parameters:
visitor (Optional[QgsStyleEntityVisitorInterface])
- Return type:
bool
- appendChild(self, section: QgsAbstractReportSection | None)[source]¶
Adds a child
section
, transferring ownership of the section to this section.See also
children()
See also
- Parameters:
section (Optional[QgsAbstractReportSection])
- childCount(self) int [source]¶
Returns the number of child sections for this report section. The child sections form the body of the report section.
See also
children()
- Return type:
int
- childSection(self, index: int) QgsAbstractReportSection | None [source]¶
Returns the child section at the specified
index
.See also
children()
- Parameters:
index (int)
- Return type:
Optional[QgsAbstractReportSection]
- childSections(self) List[QgsAbstractReportSection] ¶
Returns all child sections for this report section. The child sections form the body of the report section.
See also
See also
child()
See also
See also
See also
- Return type:
List[QgsAbstractReportSection]
- abstract clone(self) QgsAbstractReportSection | None [source]¶
Clones the report section. Ownership of the returned section is transferred to the caller.
Subclasses should call
copyCommonProperties()
in theirclone()
implementations.- Return type:
Optional[QgsAbstractReportSection]
- context(self) QgsReportSectionContext ¶
Returns the current context for this section.
See also
- Return type:
- copyCommonProperties(self, destination: QgsAbstractReportSection | None)[source]¶
Copies the common properties of a report section to a
destination
section. This method should be called fromclone()
implementations.- Parameters:
destination (Optional[QgsAbstractReportSection])
- abstract description(self) str [source]¶
Returns a user-visible, translated description of the section.
- Return type:
str
Returns the footer for the section. Note that the footer is only included if
footerEnabled()
isTrue
.See also
See also
See also
- Return type:
Optional[QgsLayout]
Returns
True
if the footer for the section is enabled.See also
See also
See also
- Return type:
bool
- header(self) QgsLayout | None [source]¶
Returns the header for the section. Note that the header is only included if
headerEnabled()
isTrue
.See also
See also
See also
- Return type:
Optional[QgsLayout]
- headerEnabled(self) bool [source]¶
Returns
True
if the header for the section is enabled.See also
See also
See also
- Return type:
bool
- insertChild(self, index: int, section: QgsAbstractReportSection | None)[source]¶
Inserts a child
section
at the specifiedindex
, transferring ownership of the section to this section.See also
children()
See also
- Parameters:
index (int)
section (Optional[QgsAbstractReportSection])
- virtual nextBody(self)[source]¶
Returns the next body layout to export, or
None
if no body layout is required this iteration.ok
will be set toFalse
if no bodies remain for this section.
- parentSection(self) QgsAbstractReportSection | None [source]¶
Returns the parent report section.
- Return type:
Optional[QgsAbstractReportSection]
Called just before rendering the section’s footer. Should return
True
if the footer is to be included for this section, orFalse
to skip the footerfor the current section.See also
- Return type:
bool
- virtual prepareHeader(self) bool [source]¶
Called just before rendering the section’s header. Should return
True
if the header is to be included for this section, orFalse
to skip the header for the current section.See also
- Return type:
bool
- project(self) QgsProject | None [source]¶
Returns the associated project.
- Return type:
Optional[QgsProject]
- virtual readPropertiesFromElement(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool [source]¶
Sets section state from a DOM element.
See also
See also
- Parameters:
element (QDomElement)
document (QDomDocument)
context (QgsReadWriteContext)
- Return type:
bool
- readXml(self, sectionElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool [source]¶
Sets the item state from a DOM element.
See also
- Parameters:
sectionElement (QDomElement)
document (QDomDocument)
context (QgsReadWriteContext)
- Return type:
bool
- virtual reloadSettings(self)[source]¶
Refreshes the section when global layout related options change.
- removeChild(self, section: QgsAbstractReportSection | None)[source]¶
Removes a child
section
, deleting it.See also
children()
- Parameters:
section (Optional[QgsAbstractReportSection])
- removeChildAt(self, index: int)[source]¶
Removes the child section at the specified
index
, deleting it.See also
children()
- Parameters:
index (int)
- row(self) int [source]¶
Returns the row number of the section within it’s parent section.
- Return type:
int
- setContext(self, context: QgsReportSectionContext)[source]¶
Sets the current
context
for this section.See also
- Parameters:
context (QgsReportSectionContext)
Sets the
footer
for the section. Note that the footer is only included iffooterEnabled()
isTrue
. Ownership offooter
is transferred to the report section.See also
See also
See also
- Parameters:
footer (Optional[QgsLayout])
Sets whether the footer for the section is
enabled
.See also
See also
See also
- Parameters:
enabled (bool)
- setHeader(self, header: QgsLayout | None)[source]¶
Sets the
header
for the section. Note that the header is only included ifheaderEnabled()
isTrue
. Ownership ofheader
is transferred to the report section.See also
See also
See also
- Parameters:
header (Optional[QgsLayout])
- setHeaderEnabled(self, enabled: bool)[source]¶
Sets whether the header for the section is
enabled
.See also
See also
See also
- Parameters:
enabled (bool)
- virtual setParentSection(self, parent: QgsAbstractReportSection | None)[source]¶
Sets the
parent
report section.- Parameters:
parent (Optional[QgsAbstractReportSection])
- virtual writePropertiesToElement(self, element: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool [source]¶
Stores section state within an XML DOM element.
See also
See also
- Parameters:
element (QDomElement)
document (QDomDocument)
context (QgsReadWriteContext)
- Return type:
bool
- writeXml(self, parentElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool [source]¶
Stores the section state in a DOM element.
See also
- Parameters:
parentElement (QDomElement)
document (QDomDocument)
context (QgsReadWriteContext)
- Return type:
bool