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);
|
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()
|
void AspectList::apply()
|
||||||
{
|
{
|
||||||
d->items = d->volatileItems;
|
d->items = d->volatileItems;
|
||||||
|
|||||||
@@ -1031,6 +1031,7 @@ public:
|
|||||||
|
|
||||||
void removeItem(const std::shared_ptr<BaseAspect> &item);
|
void removeItem(const std::shared_ptr<BaseAspect> &item);
|
||||||
void actualRemoveItem(const std::shared_ptr<BaseAspect> &item);
|
void actualRemoveItem(const std::shared_ptr<BaseAspect> &item);
|
||||||
|
void clear();
|
||||||
|
|
||||||
void apply() override;
|
void apply() override;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user