QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgslayoutundostack.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutundostack.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 QGSLAYOUTUNDOSTACK_H
19#define QGSLAYOUTUNDOSTACK_H
20
21#include "qgis_sip.h"
22#include "qgis_core.h"
24#include "qgslayoutitem.h"
25
26#include <memory>
27
28class QgsLayout;
29class QUndoStack;
30
36class CORE_EXPORT QgsLayoutUndoStack : public QObject
37{
38 Q_OBJECT
39
40 public:
41
46
57 void beginMacro( const QString &commandText );
58
70 void endMacro();
71
84 void beginCommand( QgsLayoutUndoObjectInterface *object, const QString &commandText, int id = 0 );
85
91 void endCommand();
92
98 void cancelCommand();
99
103 QUndoStack *stack();
104
108 void notifyUndoRedoOccurred( QgsLayoutItem *item );
109
121 void blockCommands( bool blocked );
122
127 bool isBlocked() const;
128
132 void push( QUndoCommand *command SIP_TRANSFER );
133
134 signals:
135
140 void undoRedoOccurredForItems( QSet< QString > itemUuids );
141
142 private slots:
143
144 void indexChanged();
145
146 private:
147
148 QgsLayout *mLayout = nullptr;
149
150 std::unique_ptr< QUndoStack > mUndoStack;
151
152 std::vector< std::unique_ptr< QgsAbstractLayoutUndoCommand > > mActiveCommands;
153
154 QSet< QString > mUndoRedoOccurredItemUuids;
155
156 int mBlockedCommands = 0;
157
158#ifdef SIP_RUN
160#endif
161};
162
163#endif // QGSLAYOUTUNDOCOMMAND_H
Base class for graphical items within a QgsLayout.
Interface for layout objects which support undo/redo commands.
An undo stack for QgsLayouts.
void undoRedoOccurredForItems(QSet< QString > itemUuids)
Emitted when an undo or redo action has occurred, which affected a set of layout itemUuids.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition qgslayout.h:50
#define SIP_TRANSFER
Definition qgis_sip.h:36