diff --git a/src/plugins/marketplace/productlistmodel.cpp b/src/plugins/marketplace/productlistmodel.cpp index bceb6595fa1..0e240cc243e 100644 --- a/src/plugins/marketplace/productlistmodel.cpp +++ b/src/plugins/marketplace/productlistmodel.cpp @@ -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() diff --git a/src/plugins/marketplace/productlistmodel.h b/src/plugins/marketplace/productlistmodel.h index cda47b52da5..42d13dc417f 100644 --- a/src/plugins/marketplace/productlistmodel.h +++ b/src/plugins/marketplace/productlistmodel.h @@ -111,6 +111,7 @@ private: QMap 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;