QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
QgsLayoutSerializableObject Class Referenceabstract

An interface for layout objects which can be stored and read from DOM elements. More...

#include <qgslayoutserializableobject.h>

Inheritance diagram for QgsLayoutSerializableObject:
Inheritance graph
[legend]

Public Member Functions

QgsAbstractLayoutUndoCommandcreateCommand (const QString &text, int id, QUndoCommand *parent=nullptr) override
 Creates a new layout undo command with the specified text and parent.
 
virtual QgsLayoutlayout ()=0
 Returns the layout the object belongs to.
 
virtual bool readXml (const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)=0
 Sets the objects's state from a DOM element.
 
virtual QString stringType () const =0
 Returns the object type as a string.
 
virtual bool writeXml (QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const =0
 Stores the objects's state in a DOM element.
 
- Public Member Functions inherited from QgsLayoutUndoObjectInterface
virtual ~QgsLayoutUndoObjectInterface ()=default
 

Friends

class QgsLayoutSerializableObjectUndoCommand
 

Detailed Description

An interface for layout objects which can be stored and read from DOM elements.

Definition at line 34 of file qgslayoutserializableobject.h.

Member Function Documentation

◆ createCommand()

QgsAbstractLayoutUndoCommand * QgsLayoutSerializableObject::createCommand ( const QString &  text,
int  id,
QUndoCommand *  parent = nullptr 
)
overridevirtual

Creates a new layout undo command with the specified text and parent.

The id argument can be used to specify an id number for the source event - this is used to determine whether QUndoCommand command compression can apply to the command.

Implements QgsLayoutUndoObjectInterface.

Definition at line 78 of file qgslayoutserializableobject.cpp.

◆ layout()

virtual QgsLayout * QgsLayoutSerializableObject::layout ( )
pure virtual

Returns the layout the object belongs to.

Implemented in QgsLayoutAtlas, QgsLayoutGridSettings, QgsLayoutGuideCollection, QgsLayoutPageCollection, and QgsLayoutSnapper.

◆ readXml()

virtual bool QgsLayoutSerializableObject::readXml ( const QDomElement &  element,
const QDomDocument &  document,
const QgsReadWriteContext context 
)
pure virtual

Sets the objects's state from a DOM element.

element is the DOM node corresponding to the object.

See also
writeXml()

Implemented in QgsLayoutGuideCollection, QgsLayoutPageCollection, QgsLayoutAtlas, QgsLayoutGridSettings, and QgsLayoutSnapper.

◆ stringType()

virtual QString QgsLayoutSerializableObject::stringType ( ) const
pure virtual

Returns the object type as a string.

This string must be a unique, single word, character only representation of the item type, eg "LayoutScaleBar"

Implemented in QgsLayoutAtlas, QgsLayoutGridSettings, QgsLayoutGuideCollection, QgsLayoutPageCollection, and QgsLayoutSnapper.

◆ writeXml()

virtual bool QgsLayoutSerializableObject::writeXml ( QDomElement &  parentElement,
QDomDocument &  document,
const QgsReadWriteContext context 
) const
pure virtual

Stores the objects's state in a DOM element.

The parentElement should refer to the parent layout's DOM element.

See also
readXml()

Implemented in QgsLayoutAtlas, QgsLayoutGridSettings, QgsLayoutGuideCollection, QgsLayoutPageCollection, and QgsLayoutSnapper.

Friends And Related Symbol Documentation

◆ QgsLayoutSerializableObjectUndoCommand

friend class QgsLayoutSerializableObjectUndoCommand
friend

Definition at line 66 of file qgslayoutserializableobject.h.


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