From 5664b39e68addaff2b515fb3daa9da86c4f039f7 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Wed, 6 Nov 2024 12:14:50 +0100 Subject: [PATCH] display tooltip with more feed data in discover feeds dialog --- .../services/abstract/accountcheckmodel.cpp | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/librssguard/services/abstract/accountcheckmodel.cpp b/src/librssguard/services/abstract/accountcheckmodel.cpp index b1e49934a..df2523e31 100644 --- a/src/librssguard/services/abstract/accountcheckmodel.cpp +++ b/src/librssguard/services/abstract/accountcheckmodel.cpp @@ -4,6 +4,7 @@ #include "3rd-party/boolinq/boolinq.h" #include "definitions/definitions.h" +#include "services/abstract/feed.h" AccountCheckModel::AccountCheckModel(QObject* parent) : QAbstractItemModel(parent), m_rootItem(nullptr), m_recursiveChange(false) {} @@ -172,7 +173,7 @@ QVariant AccountCheckModel::data(const QModelIndex& index, int role) const { return m_checkStates.value(item); } else { - return static_cast(Qt::Unchecked); + return static_cast(Qt::CheckState::Unchecked); } } else if (role == Qt::ItemDataRole::DecorationRole) { @@ -193,9 +194,22 @@ QVariant AccountCheckModel::data(const QModelIndex& index, int role) const { return item->title(); } } - else { - return QVariant(); + else if (role == Qt::ItemDataRole::ToolTipRole) { + if (item->kind() == RootItem::Kind::Feed) { + auto desc = item->description(); + auto url = item->toFeed()->source(); + + QString txt = url; + + if (!desc.isEmpty()) { + txt += QSL("\n\n%1").arg(desc); + } + + return txt; + } } + + return QVariant(); } bool AccountCheckModel::setData(const QModelIndex& index, const QVariant& value, int role) {