QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
layout
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 <memory>
22
23
#include "qgis_core.h"
24
#include "
qgis_sip.h
"
25
#include "
qgslayoutitem.h
"
26
#include "
qgslayoutundocommand.h
"
27
28
class
QgsLayout
;
29
class
QUndoStack;
30
35
class
CORE_EXPORT
QgsLayoutUndoStack
:
public
QObject
36
{
37
Q_OBJECT
38
39
public
:
43
QgsLayoutUndoStack
(
QgsLayout
*layout );
44
55
void
beginMacro
(
const
QString &commandText );
56
68
void
endMacro
();
69
82
void
beginCommand
(
QgsLayoutUndoObjectInterface
*
object
,
const
QString &commandText,
int
id
= 0 );
83
89
void
endCommand
();
90
96
void
cancelCommand
();
97
101
QUndoStack *
stack
();
102
106
void
notifyUndoRedoOccurred
(
QgsLayoutItem
*item );
107
119
void
blockCommands
(
bool
blocked );
120
125
bool
isBlocked
()
const
;
126
130
void
push
( QUndoCommand *command
SIP_TRANSFER
);
131
132
signals:
133
138
void
undoRedoOccurredForItems
( QSet< QString > itemUuids );
139
140
private
slots:
141
142
void
indexChanged();
143
144
private
:
145
QgsLayout
*mLayout =
nullptr
;
146
147
std::unique_ptr< QUndoStack > mUndoStack;
148
149
std::vector< std::unique_ptr< QgsAbstractLayoutUndoCommand > > mActiveCommands;
150
151
QSet< QString > mUndoRedoOccurredItemUuids;
152
153
int
mBlockedCommands = 0;
154
155
#ifdef SIP_RUN
156
QgsLayoutUndoStack
(
const
QgsLayoutUndoStack
&other );
157
#endif
158
};
159
160
#endif
// QGSLAYOUTUNDOCOMMAND_H
QgsLayoutItem
Base class for graphical items within a QgsLayout.
Definition
qgslayoutitem.h:106
QgsLayoutUndoObjectInterface
Interface for layout objects which support undo/redo commands.
Definition
qgslayoutundocommand.h:123
QgsLayoutUndoStack::endCommand
void endCommand()
Saves final state of an object and pushes the active command to the undo history.
Definition
qgslayoutundostack.cpp:57
QgsLayoutUndoStack::cancelCommand
void cancelCommand()
Cancels the active command, discarding it without pushing to the undo history.
Definition
qgslayoutundostack.cpp:72
QgsLayoutUndoStack::beginMacro
void beginMacro(const QString &commandText)
Starts a macro command, with the given descriptive commandText.
Definition
qgslayoutundostack.cpp:34
QgsLayoutUndoStack::beginCommand
void beginCommand(QgsLayoutUndoObjectInterface *object, const QString &commandText, int id=0)
Begins a new undo command for the specified object.
Definition
qgslayoutundostack.cpp:46
QgsLayoutUndoStack::notifyUndoRedoOccurred
void notifyUndoRedoOccurred(QgsLayoutItem *item)
Notifies the stack that an undo or redo action occurred for a specified item.
Definition
qgslayoutundostack.cpp:85
QgsLayoutUndoStack::push
void push(QUndoCommand *command)
Manually pushes a command to the stack, and takes ownership of the command.
Definition
qgslayoutundostack.cpp:108
QgsLayoutUndoStack::endMacro
void endMacro()
Ends a macro command.
Definition
qgslayoutundostack.cpp:40
QgsLayoutUndoStack::isBlocked
bool isBlocked() const
Returns true if undo commands are currently blocked.
Definition
qgslayoutundostack.cpp:103
QgsLayoutUndoStack::undoRedoOccurredForItems
void undoRedoOccurredForItems(QSet< QString > itemUuids)
Emitted when an undo or redo action has occurred, which affected a set of layout itemUuids.
QgsLayoutUndoStack::stack
QUndoStack * stack()
Returns a pointer to the internal QUndoStack.
Definition
qgslayoutundostack.cpp:80
QgsLayoutUndoStack::blockCommands
void blockCommands(bool blocked)
Sets whether undo commands for the layout should be temporarily blocked.
Definition
qgslayoutundostack.cpp:90
QgsLayoutUndoStack::QgsLayoutUndoStack
QgsLayoutUndoStack(QgsLayout *layout)
Constructor for QgsLayoutUndoStack, for the specified parent layout.
Definition
qgslayoutundostack.cpp:27
QgsLayout
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition
qgslayout.h:51
qgis_sip.h
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:35
qgslayoutitem.h
qgslayoutundocommand.h
Generated on
for QGIS API Documentation by
1.17.0