Update categoryfiltermodel.cpp

This commit is contained in:
Ruslan 2025-01-28 01:01:35 +03:00 committed by GitHub
commit fb349f0d78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,7 +25,7 @@
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*/
#include <memory>
#include "categoryfiltermodel.h"
#include <QHash>
@ -333,8 +333,12 @@ void CategoryFilterModel::categoryAdded(const QString &categoryName)
const int row = parent->childCount();
beginInsertRows(index(parent), row, row);
new CategoryModelItem(
parent, m_isSubcategoriesEnabled ? shortName(categoryName) : categoryName);
std::unique_ptr<CategoryModelItem> newItem = std::make_unique<CategoryModelItem>(
parent, m_isSubcategoriesEnabled ? shortName(categoryName) : categoryName
);
parent->addChild(std::move(newItem));
endInsertRows();
}