Marketplace: Fix leak

Change-Id: Ifd31a38514a630e9b8e36d4255dc4de6d6588925
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2020-06-17 12:42:25 +02:00
parent 92bae70432
commit fb13a124c1
2 changed files with 5 additions and 3 deletions

View File

@@ -164,6 +164,7 @@ SectionedProducts::SectionedProducts(QWidget *parent)
: QStackedWidget(parent)
, m_allProductsView(new ProductGridView(this))
, m_filteredAllProductsModel(new Core::ListModelFilter(new AllProductsModel(this), this))
, m_gridModel(new Core::GridProxyModel)
, m_productDelegate(new ProductItemDelegate)
{
auto area = new QScrollArea(this);
@@ -180,10 +181,9 @@ SectionedProducts::SectionedProducts(QWidget *parent)
addWidget(area);
auto gridModel = new Core::GridProxyModel;
gridModel->setSourceModel(m_filteredAllProductsModel);
m_gridModel->setSourceModel(m_filteredAllProductsModel);
m_allProductsView->setItemDelegate(m_productDelegate);
m_allProductsView->setModel(gridModel);
m_allProductsView->setModel(m_gridModel);
addWidget(m_allProductsView);
connect(m_productDelegate, &ProductItemDelegate::tagClicked,
@@ -194,6 +194,7 @@ SectionedProducts::~SectionedProducts()
{
qDeleteAll(m_gridViews.values());
delete m_productDelegate;
delete m_gridModel;
}
void SectionedProducts::updateCollections()

View File

@@ -111,6 +111,7 @@ private:
QMap<Section, ProductGridView *> m_gridViews;
ProductGridView *m_allProductsView = nullptr;
Core::ListModelFilter *m_filteredAllProductsModel = nullptr;
Core::GridProxyModel * const m_gridModel;
ProductItemDelegate *m_productDelegate = nullptr;
bool m_isDownloadingImage = false;
int m_columnCount = 1;