forked from qt-creator/qt-creator
Utils: Add AspectList::clear()
Change-Id: Ic3e90bc76d271c1bb3b84e545fae5ba1c7a10468 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -3154,6 +3154,21 @@ void AspectList::removeItem(const std::shared_ptr<BaseAspect> &item)
|
||||
actualRemoveItem(item);
|
||||
}
|
||||
|
||||
void AspectList::clear()
|
||||
{
|
||||
if (undoStack()) {
|
||||
undoStack()->beginMacro("Clear");
|
||||
|
||||
for (auto item : volatileItems())
|
||||
undoStack()->push(new RemoveItemCommand(this, item));
|
||||
|
||||
undoStack()->endMacro();
|
||||
} else {
|
||||
for (auto item : volatileItems())
|
||||
actualRemoveItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
void AspectList::apply()
|
||||
{
|
||||
d->items = d->volatileItems;
|
||||
|
||||
Reference in New Issue
Block a user