QmlDesigner: More unique ptr

Change-Id: Iabce3eb5eb8832c0edf8864adeb7d7a56d965a3a
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2024-04-03 16:11:57 +02:00
parent 7883f15299
commit 047b2ef361
2 changed files with 12 additions and 11 deletions

View File

@@ -118,9 +118,9 @@ void ItemLibraryWidget::resizeEvent(QResizeEvent *event)
ItemLibraryWidget::ItemLibraryWidget(AsynchronousImageCache &imageCache)
: m_itemIconSize(24, 24)
, m_itemLibraryModel(new ItemLibraryModel(this))
, m_addModuleModel(new ItemLibraryAddImportModel(this))
, m_itemsWidget(new StudioQuickWidget(this))
, m_itemLibraryModel(std::make_unique<ItemLibraryModel>())
, m_addModuleModel(std::make_unique<ItemLibraryAddImportModel>())
, m_itemsWidget(Utils::makeUniqueObjectPtr<StudioQuickWidget>())
, m_imageCache{imageCache}
{
m_compressionTimer.setInterval(1000);
@@ -146,7 +146,7 @@ ItemLibraryWidget::ItemLibraryWidget(AsynchronousImageCache &imageCache)
auto layout = new QVBoxLayout(this);
layout->setContentsMargins({});
layout->setSpacing(0);
layout->addWidget(m_itemsWidget.data());
layout->addWidget(m_itemsWidget.get());
updateSearch();
@@ -167,8 +167,8 @@ ItemLibraryWidget::ItemLibraryWidget(AsynchronousImageCache &imageCache)
auto map = m_itemsWidget->registerPropertyMap("ItemLibraryBackend");
map->setProperties({{"itemLibraryModel", QVariant::fromValue(m_itemLibraryModel.data())},
{"addModuleModel", QVariant::fromValue(m_addModuleModel.data())},
map->setProperties({{"itemLibraryModel", QVariant::fromValue(m_itemLibraryModel.get())},
{"addModuleModel", QVariant::fromValue(m_addModuleModel.get())},
{"itemLibraryIconWidth", m_itemIconSize.width()},
{"itemLibraryIconHeight", m_itemIconSize.height()},
{"rootView", QVariant::fromValue(this)},

View File

@@ -10,9 +10,10 @@
#include <studioquickwidget.h>
#include <utils/fancylineedit.h>
#include <utils/dropsupport.h>
#include <previewtooltip/previewtooltipbackend.h>
#include <utils/dropsupport.h>
#include <utils/fancylineedit.h>
#include <utils/uniqueobjectptr.h>
#include <QFileIconProvider>
#include <QFrame>
@@ -104,10 +105,10 @@ private:
#ifndef QDS_USE_PROJECTSTORAGE
QPointer<ItemLibraryInfo> m_itemLibraryInfo;
#endif
QPointer<ItemLibraryModel> m_itemLibraryModel;
QPointer<ItemLibraryAddImportModel> m_addModuleModel;
std::unique_ptr<ItemLibraryModel> m_itemLibraryModel;
std::unique_ptr<ItemLibraryAddImportModel> m_addModuleModel;
QScopedPointer<StudioQuickWidget> m_itemsWidget;
Utils::UniqueObjectPtr<StudioQuickWidget> m_itemsWidget;
std::unique_ptr<PreviewTooltipBackend> m_previewTooltipBackend;
QShortcut *m_qmlSourceUpdateShortcut;