QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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
35{
36 public:
37
43 virtual QString stringType() const = 0;
44
48 virtual QgsLayout *layout() = 0;
49
54 virtual bool writeXml( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context ) const = 0;
55
60 virtual bool readXml( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context ) = 0;
61
62 QgsAbstractLayoutUndoCommand *createCommand( const QString &text, int id, QUndoCommand *parent = nullptr ) override SIP_FACTORY;
63
64 private:
65
66 friend class QgsLayoutSerializableObjectUndoCommand;
67
68};
69
70#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:49
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