QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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. More...
 
virtual QgsLayoutlayout ()=0
 Returns the layout the object belongs to. More...
 
virtual bool readXml (const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)=0
 Sets the objects's state from a DOM element. More...
 
virtual QString stringType () const =0
 Returns the object type as a string. More...
 
virtual bool writeXml (QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const =0
 Stores the objects's state in a DOM element. More...
 
- Public Member Functions inherited from QgsLayoutUndoObjectInterface
virtual ~QgsLayoutUndoObjectInterface ()=default
 Destructor for QgsLayoutUndoObjectInterface. More...
 

Friends

class QgsLayoutSerializableObjectUndoCommand
 

Detailed Description

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

Since
QGIS 3.0

Definition at line 35 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 QgsLayoutSnapper, QgsLayoutPageCollection, QgsLayoutGuideCollection, QgsLayoutGridSettings, and QgsLayoutAtlas.

◆ 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 QgsLayoutSnapper, QgsLayoutGridSettings, QgsLayoutAtlas, QgsLayoutPageCollection, and QgsLayoutGuideCollection.

◆ 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 QgsLayoutSnapper, QgsLayoutPageCollection, QgsLayoutGuideCollection, QgsLayoutGridSettings, and QgsLayoutAtlas.

◆ 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 QgsLayoutSnapper, QgsLayoutPageCollection, QgsLayoutGuideCollection, QgsLayoutGridSettings, and QgsLayoutAtlas.

Friends And Related Function Documentation

◆ QgsLayoutSerializableObjectUndoCommand

friend class QgsLayoutSerializableObjectUndoCommand
friend

Definition at line 67 of file qgslayoutserializableobject.h.


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