summaryrefslogtreecommitdiff
path: root/src/downloadlistwidget.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-12-26 20:58:06 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2020-12-26 20:58:06 -0500
commit106ed49baecc60dbdf4844ed684df750e5caf3aa (patch)
treef7485c0d4e995263b313ed08856869c9e8c8b6a1 /src/downloadlistwidget.cpp
parent3eb64c32e8643a34ce2de07bdb0f2fae2869b69a (diff)
removed setUpdateDelay(false) calls, it's the default
FilterWidget for downloads tab
Diffstat (limited to 'src/downloadlistwidget.cpp')
-rw-r--r--src/downloadlistwidget.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/downloadlistwidget.cpp b/src/downloadlistwidget.cpp
index 1bb13779..ad9ea63a 100644
--- a/src/downloadlistwidget.cpp
+++ b/src/downloadlistwidget.cpp
@@ -32,9 +32,23 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
using namespace MOBase;
-void DownloadProgressDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
+DownloadProgressDelegate::DownloadProgressDelegate(
+ DownloadManager* manager, DownloadListWidget* list)
+ : QStyledItemDelegate(list), m_Manager(manager), m_List(list)
{
- QModelIndex sourceIndex = m_SortProxy->mapToSource(index);
+}
+
+void DownloadProgressDelegate::paint(
+ QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+ QModelIndex sourceIndex;
+
+ if (auto* proxy=dynamic_cast<QSortFilterProxyModel*>(m_List->model())) {
+ sourceIndex = proxy->mapToSource(index);
+ } else {
+ sourceIndex = index;
+ }
+
bool pendingDownload = (sourceIndex.row() >= m_Manager->numTotalDownloads());
if (sourceIndex.column() == DownloadList::COL_STATUS && !pendingDownload
&& m_Manager->getState(sourceIndex.row()) == DownloadManager::STATE_DOWNLOADING) {