From a63ca5f0c416f8f1b93cd903db80b586858371b9 Mon Sep 17 00:00:00 2001 From: jagannatharjun Date: Tue, 11 Aug 2020 00:47:35 +0530 Subject: [PATCH] Allow changing RSS article list colors from custom UI theme Use ArticleListWidget own palette to obtain default colors --- src/gui/rss/articlelistwidget.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/rss/articlelistwidget.cpp b/src/gui/rss/articlelistwidget.cpp index 7ce1115e9..b094fb0d2 100644 --- a/src/gui/rss/articlelistwidget.cpp +++ b/src/gui/rss/articlelistwidget.cpp @@ -123,11 +123,15 @@ QListWidgetItem *ArticleListWidget::createItem(RSS::Article *article) const item->setData(Qt::DisplayRole, article->title()); item->setData(Qt::UserRole, reinterpret_cast(article)); if (article->isRead()) { - item->setData(Qt::ForegroundRole, QPalette().color(QPalette::Inactive, QPalette::WindowText)); + const QColor defaultColor {palette().color(QPalette::Inactive, QPalette::WindowText)}; + const QBrush foregroundBrush {UIThemeManager::instance()->getColor("RSS.ReadArticle", defaultColor)}; + item->setData(Qt::ForegroundRole, foregroundBrush); item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("sphere"))); } else { - item->setData(Qt::ForegroundRole, QPalette().color(QPalette::Active, QPalette::Link)); + const QColor defaultColor {palette().color(QPalette::Active, QPalette::Link)}; + const QBrush foregroundBrush {UIThemeManager::instance()->getColor("RSS.UnreadArticle", defaultColor)}; + item->setData(Qt::ForegroundRole, foregroundBrush); item->setData(Qt::DecorationRole, UIThemeManager::instance()->getIcon(QLatin1String("sphere"))); }