From 803d1b62efddcec6ecf880a9a216af0aa2d1d7b1 Mon Sep 17 00:00:00 2001 From: Phenom Date: Sat, 10 Dec 2016 19:52:46 +0100 Subject: [PATCH] Fix RSElidedItemDelegate text color. --- .../src/gui/common/RSElidedItemDelegate.cpp | 11 ++++++++++- .../src/gui/gxsforums/GxsForumThreadWidget.cpp | 10 +++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/retroshare-gui/src/gui/common/RSElidedItemDelegate.cpp b/retroshare-gui/src/gui/common/RSElidedItemDelegate.cpp index d632e54e5..2da03cd48 100644 --- a/retroshare-gui/src/gui/common/RSElidedItemDelegate.cpp +++ b/retroshare-gui/src/gui/common/RSElidedItemDelegate.cpp @@ -69,7 +69,16 @@ void RSElidedItemDelegate::drawDisplay(QPainter *painter, const QStyleOptionView plainText = plainText.replace("\n",QChar(QChar::LineSeparator)); plainText = plainText.replace("\r",QChar(QChar::LineSeparator)); - if (painter) painter->setFont(option.font); + if (painter) { + painter->setFont(option.font); + QPalette::ColorGroup cg = option.state & QStyle::State_Enabled + ? QPalette::Normal : QPalette::Disabled; + if (cg == QPalette::Normal && !(option.state & QStyle::State_Active)) + cg = QPalette::Inactive; + QColor textColor = option.palette.color(cg, QPalette::Text); + painter->setPen(textColor); + } + QTextLayout textLayout(plainText, option.font); QTextOption to = textLayout.textOption(); to.setAlignment(option.displayAlignment); diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 0d07d4d0b..ac248b556 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -647,20 +647,20 @@ void GxsForumThreadWidget::calculateIconsAndFonts(QTreeWidgetItem *item, bool &h if (!IS_GROUP_SUBSCRIBED(mSubscribeFlags)) { qf.setBold(false); - item->setTextColor(i, textColorNotSubscribed()); + item->setForeground(i, textColorNotSubscribed()); } else if (unread || isNew) { qf.setBold(true); - item->setTextColor(i, textColorUnread()); + item->setForeground(i, textColorUnread()); } else if (myUnreadChilddren) { qf.setBold(true); - item->setTextColor(i, textColorUnreadChildren()); + item->setForeground(i, textColorUnreadChildren()); } else { qf.setBold(false); - item->setTextColor(i, textColorRead()); + item->setForeground(i, textColorRead()); } if (missing) { /* Missing message */ - item->setTextColor(i, textColorMissing()); + item->setForeground(i, textColorMissing()); } item->setFont(i, qf); }