QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgslayoutserializableobject.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutserializableobject.h
3 -----------------------------
4 begin : July 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSLAYOUTSERIALIZABLEOBJECT_H
19#define QGSLAYOUTSERIALIZABLEOBJECT_H
20
21#include "qgis_sip.h"
22#include "qgis_core.h"
24
25class QDomElement;
26class QDomDocument;
29
36{
37 public:
38
44 virtual QString stringType() const = 0;
45
49 virtual QgsLayout *layout() = 0;
50
55 virtual bool writeXml( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context ) const = 0;
56
61 virtual bool readXml( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context ) = 0;
62
63 QgsAbstractLayoutUndoCommand *createCommand( const QString &text, int id, QUndoCommand *parent = nullptr ) override SIP_FACTORY;
64
65 private:
66
67 friend class QgsLayoutSerializableObjectUndoCommand;
68
69};
70
71#endif // QGSLAYOUTSERIALIZABLEOBJECT_H
Base class for commands to undo/redo layout and layout object changes.
An interface for layout objects which can be stored and read from DOM elements.
virtual bool writeXml(QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const =0
Stores the objects's state in a DOM element.
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 QgsLayout * layout()=0
Returns the layout the object belongs to.
Interface for layout objects which support undo/redo commands.
virtual QgsAbstractLayoutUndoCommand * createCommand(const QString &text, int id=0, QUndoCommand *parent=nullptr)=0
Creates a new layout undo command with the specified text and parent.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:51
The class is used as a container of context for various read/write operations on other objects.
#define SIP_FACTORY
Definition: qgis_sip.h:76