Add a method to check whether partition is part of operationStack.
This commit is contained in:
parent
ffa24e4451
commit
063c50aec6
|
@ -449,6 +449,22 @@ void OperationStack::pop()
|
||||||
emit operationsChanged();
|
emit operationsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Check whether previous operations involve given partition.
|
||||||
|
|
||||||
|
@param p Pointer to the Partition. Must not be nullptr.
|
||||||
|
*/
|
||||||
|
bool OperationStack::contains(const Partition* p) const
|
||||||
|
{
|
||||||
|
Q_ASSERT(p);
|
||||||
|
|
||||||
|
foreach(Operation * o, operations()) {
|
||||||
|
if (o->targets(*p))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/** Removes all Operations from the OperationStack, calling Operation::undo() on them and deleting them. */
|
/** Removes all Operations from the OperationStack, calling Operation::undo() on them and deleting them. */
|
||||||
void OperationStack::clearOperations()
|
void OperationStack::clearOperations()
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,6 +61,7 @@ Q_SIGNALS:
|
||||||
public:
|
public:
|
||||||
void push(Operation* o);
|
void push(Operation* o);
|
||||||
void pop();
|
void pop();
|
||||||
|
bool contains(const Partition* p) const;
|
||||||
void clearOperations();
|
void clearOperations();
|
||||||
int size() const {
|
int size() const {
|
||||||
return operations().size(); /**< @return number of operations */
|
return operations().size(); /**< @return number of operations */
|
||||||
|
|
Loading…
Reference in New Issue