mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-27 08:19:30 +08:00
Omit redundant cast
This commit is contained in:
parent
f7cfdfcf63
commit
bbd781c420
@ -47,7 +47,7 @@ ArticleListWidget::ArticleListWidget(QWidget *parent)
|
||||
RSS::Article *ArticleListWidget::getRSSArticle(QListWidgetItem *item) const
|
||||
{
|
||||
Q_ASSERT(item);
|
||||
return reinterpret_cast<RSS::Article *>(item->data(Qt::UserRole).value<quintptr>());
|
||||
return item->data(Qt::UserRole).value<RSS::Article *>();
|
||||
}
|
||||
|
||||
QListWidgetItem *ArticleListWidget::mapRSSArticle(RSS::Article *rssArticle) const
|
||||
@ -127,7 +127,7 @@ QListWidgetItem *ArticleListWidget::createItem(RSS::Article *article) const
|
||||
auto *item = new QListWidgetItem;
|
||||
|
||||
item->setData(Qt::DisplayRole, article->title());
|
||||
item->setData(Qt::UserRole, reinterpret_cast<quintptr>(article));
|
||||
item->setData(Qt::UserRole, QVariant::fromValue(article));
|
||||
if (article->isRead())
|
||||
{
|
||||
const QColor defaultColor {palette().color(QPalette::Inactive, QPalette::WindowText)};
|
||||
|
@ -105,7 +105,7 @@ FeedListWidget::FeedListWidget(QWidget *parent)
|
||||
m_rssToTreeItemMapping[RSS::Session::instance()->rootFolder()] = invisibleRootItem();
|
||||
|
||||
m_unreadStickyItem = new FeedListItem(this);
|
||||
m_unreadStickyItem->setData(0, Qt::UserRole, reinterpret_cast<quintptr>(RSS::Session::instance()->rootFolder()));
|
||||
m_unreadStickyItem->setData(0, Qt::UserRole, QVariant::fromValue(RSS::Session::instance()->rootFolder()));
|
||||
m_unreadStickyItem->setText(0, tr("Unread (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
|
||||
m_unreadStickyItem->setData(0, Qt::DecorationRole, UIThemeManager::instance()->getIcon(u"mail-folder-inbox"_qs));
|
||||
m_unreadStickyItem->setData(0, StickyItemTagRole, true);
|
||||
@ -213,7 +213,7 @@ RSS::Item *FeedListWidget::getRSSItem(QTreeWidgetItem *item) const
|
||||
{
|
||||
if (!item) return nullptr;
|
||||
|
||||
return reinterpret_cast<RSS::Item *>(item->data(0, Qt::UserRole).value<quintptr>());
|
||||
return item->data(0, Qt::UserRole).value<RSS::Item *>();
|
||||
}
|
||||
|
||||
QTreeWidgetItem *FeedListWidget::mapRSSItem(RSS::Item *rssItem) const
|
||||
@ -275,7 +275,7 @@ QTreeWidgetItem *FeedListWidget::createItem(RSS::Item *rssItem, QTreeWidgetItem
|
||||
{
|
||||
auto *item = new FeedListItem;
|
||||
item->setData(0, Qt::DisplayRole, u"%1 (%2)"_qs.arg(rssItem->name(), QString::number(rssItem->unreadCount())));
|
||||
item->setData(0, Qt::UserRole, reinterpret_cast<quintptr>(rssItem));
|
||||
item->setData(0, Qt::UserRole, QVariant::fromValue(rssItem));
|
||||
m_rssToTreeItemMapping[rssItem] = item;
|
||||
|
||||
QIcon icon;
|
||||
|
@ -198,7 +198,7 @@ void RSSWidget::displayItemsListMenu()
|
||||
bool hasLink = false;
|
||||
for (const QListWidgetItem *item : asConst(m_articleListWidget->selectedItems()))
|
||||
{
|
||||
auto article = reinterpret_cast<RSS::Article *>(item->data(Qt::UserRole).value<quintptr>());
|
||||
auto article = item->data(Qt::UserRole).value<RSS::Article *>();
|
||||
Q_ASSERT(article);
|
||||
|
||||
if (!article->torrentUrl().isEmpty())
|
||||
@ -359,7 +359,7 @@ void RSSWidget::downloadSelectedTorrents()
|
||||
{
|
||||
for (QListWidgetItem *item : asConst(m_articleListWidget->selectedItems()))
|
||||
{
|
||||
auto article = reinterpret_cast<RSS::Article *>(item->data(Qt::UserRole).value<quintptr>());
|
||||
auto article = item->data(Qt::UserRole).value<RSS::Article *>();
|
||||
Q_ASSERT(article);
|
||||
|
||||
// Mark as read
|
||||
@ -380,7 +380,7 @@ void RSSWidget::openSelectedArticlesUrls()
|
||||
{
|
||||
for (QListWidgetItem *item : asConst(m_articleListWidget->selectedItems()))
|
||||
{
|
||||
auto article = reinterpret_cast<RSS::Article *>(item->data(Qt::UserRole).value<quintptr>());
|
||||
auto article = item->data(Qt::UserRole).value<RSS::Article *>();
|
||||
Q_ASSERT(article);
|
||||
|
||||
// Mark as read
|
||||
|
Loading…
Reference in New Issue
Block a user