From 8c0cc1664c919a5e61e4d614a146339da4751a4e Mon Sep 17 00:00:00 2001 From: kelteseth Date: Mon, 30 Oct 2017 23:18:25 +0100 Subject: [PATCH] Add workaround for Workshop duplicate entries --- qml/Components/Workshop.qml | 3 +++ src/steamworkshoplistmodel.cpp | 8 ++++++++ src/steamworkshoplistmodel.h | 1 + 3 files changed, 12 insertions(+) diff --git a/qml/Components/Workshop.qml b/qml/Components/Workshop.qml index 2bd3630f..49cd7815 100644 --- a/qml/Components/Workshop.qml +++ b/qml/Components/Workshop.qml @@ -6,7 +6,9 @@ CustomPage { pageName: "" Component.onCompleted: { + workshopListModel.clear() steamWorkshop.searchWorkshop() + } GridView { @@ -112,6 +114,7 @@ CustomPage { Item { id: searchBar height: 100 + visible: false anchors { top: banner.bottom right: parent.right diff --git a/src/steamworkshoplistmodel.cpp b/src/steamworkshoplistmodel.cpp index 89628e33..ebf7724a 100644 --- a/src/steamworkshoplistmodel.cpp +++ b/src/steamworkshoplistmodel.cpp @@ -81,6 +81,14 @@ unsigned int SteamWorkshopListModel::getBannerID() return m_workshopItemList.at(0)->m_id; } +void SteamWorkshopListModel::clear() +{ + beginResetModel(); + m_workshopItemList.clear(); + m_workshopItemList.squeeze(); + endResetModel(); +} + bool SteamWorkshopListModel::setData(const QModelIndex& index, const QVariant& value, int role) { if (data(index, role) != value) { diff --git a/src/steamworkshoplistmodel.h b/src/steamworkshoplistmodel.h index 4796db29..63918cfd 100644 --- a/src/steamworkshoplistmodel.h +++ b/src/steamworkshoplistmodel.h @@ -34,6 +34,7 @@ public: Q_INVOKABLE QUrl getBannerUrl(); Q_INVOKABLE QString getBannerText(); Q_INVOKABLE unsigned int getBannerID(); + Q_INVOKABLE void clear(); // Editable: bool setData(const QModelIndex& index, const QVariant& value,