QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
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
35class CORE_EXPORT QgsLayoutUndoStack : public QObject
36{
37 Q_OBJECT
38
39 public:
40
45
56 void beginMacro( const QString &commandText );
57
69 void endMacro();
70
83 void beginCommand( QgsLayoutUndoObjectInterface *object, const QString &commandText, int id = 0 );
84
90 void endCommand();
91
97 void cancelCommand();
98
102 QUndoStack *stack();
103
107 void notifyUndoRedoOccurred( QgsLayoutItem *item );
108
120 void blockCommands( bool blocked );
121
126 bool isBlocked() const;
127
131 void push( QUndoCommand *command SIP_TRANSFER );
132
133 signals:
134
139 void undoRedoOccurredForItems( QSet< QString > itemUuids );
140
141 private slots:
142
143 void indexChanged();
144
145 private:
146
147 QgsLayout *mLayout = nullptr;
148
149 std::unique_ptr< QUndoStack > mUndoStack;
150
151 std::vector< std::unique_ptr< QgsAbstractLayoutUndoCommand > > mActiveCommands;
152
153 QSet< QString > mUndoRedoOccurredItemUuids;
154
155 int mBlockedCommands = 0;
156
157#ifdef SIP_RUN
159#endif
160};
161
162#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:49
#define SIP_TRANSFER
Definition qgis_sip.h:36