fix preview dialog progress bar color

This commit is contained in:
Mark 2025-07-06 16:46:28 +04:00
commit 973eb74634

View file

@ -34,7 +34,6 @@
#include "base/utils/string.h" #include "base/utils/string.h"
#include "previewselectdialog.h" #include "previewselectdialog.h"
#include "transferlistmodel.h"
PreviewListDelegate::PreviewListDelegate(QObject *parent) PreviewListDelegate::PreviewListDelegate(QObject *parent)
: QStyledItemDelegate(parent) : QStyledItemDelegate(parent)
@ -54,8 +53,7 @@ void PreviewListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o
? u"100%"_s ? u"100%"_s
: (Utils::String::fromDouble(progress, 1) + u'%'); : (Utils::String::fromDouble(progress, 1) + u'%');
const QModelIndex statusIndex = index.siblingAtColumn(TransferListModel::TR_STATUS); BitTorrent::TorrentState torrentState = progress >= 100 ? BitTorrent::TorrentState::StalledUploading : BitTorrent::TorrentState::Downloading;
const auto torrentState = statusIndex.data(TransferListModel::UnderlyingDataRole).value<BitTorrent::TorrentState>();
m_progressBarPainter.paint(painter, option, text, static_cast<int>(progress), torrentState); m_progressBarPainter.paint(painter, option, text, static_cast<int>(progress), torrentState);
} }