Utils: Fix constness in AspectList functions

Change-Id: I960e02e1a193856de3ed0e090fdf694884a28ac5
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Marcus Tillmanns
2023-09-14 14:04:05 +02:00
parent 78f89fc777
commit 26b436f46f
2 changed files with 6 additions and 6 deletions

View File

@@ -3089,7 +3089,7 @@ QList<std::shared_ptr<BaseAspect>> AspectList::volatileItems() const
return d->volatileItems; return d->volatileItems;
} }
std::shared_ptr<BaseAspect> AspectList::addItem(std::shared_ptr<BaseAspect> item) std::shared_ptr<BaseAspect> AspectList::addItem(const std::shared_ptr<BaseAspect> &item)
{ {
if (undoStack()) if (undoStack())
pushUndo(new AddItemCommand(this, item)); pushUndo(new AddItemCommand(this, item));
@@ -3099,7 +3099,7 @@ std::shared_ptr<BaseAspect> AspectList::addItem(std::shared_ptr<BaseAspect> item
return item; return item;
} }
void AspectList::actualRemoveItem(std::shared_ptr<BaseAspect> item) void AspectList::actualRemoveItem(const std::shared_ptr<BaseAspect> &item)
{ {
d->volatileItems.removeOne(item); d->volatileItems.removeOne(item);
if (d->itemRemoved) if (d->itemRemoved)
@@ -3109,7 +3109,7 @@ void AspectList::actualRemoveItem(std::shared_ptr<BaseAspect> item)
d->items = d->volatileItems; d->items = d->volatileItems;
} }
void AspectList::removeItem(std::shared_ptr<BaseAspect> item) void AspectList::removeItem(const std::shared_ptr<BaseAspect> &item)
{ {
if (undoStack()) if (undoStack())
pushUndo(new RemoveItemCommand(this, item)); pushUndo(new RemoveItemCommand(this, item));

View File

@@ -1013,11 +1013,11 @@ public:
QList<std::shared_ptr<BaseAspect>> items() const; QList<std::shared_ptr<BaseAspect>> items() const;
QList<std::shared_ptr<BaseAspect>> volatileItems() const; QList<std::shared_ptr<BaseAspect>> volatileItems() const;
std::shared_ptr<BaseAspect> addItem(std::shared_ptr<BaseAspect> item); std::shared_ptr<BaseAspect> addItem(const std::shared_ptr<BaseAspect> &item);
std::shared_ptr<BaseAspect> actualAddItem(const std::shared_ptr<BaseAspect> &item); std::shared_ptr<BaseAspect> actualAddItem(const std::shared_ptr<BaseAspect> &item);
void removeItem(std::shared_ptr<BaseAspect> item); void removeItem(const std::shared_ptr<BaseAspect> &item);
void actualRemoveItem(std::shared_ptr<BaseAspect> item); void actualRemoveItem(const std::shared_ptr<BaseAspect> &item);
void apply() override; void apply() override;