Merge pull request #596 from PhenomRetroShare/Fix_RSElidedItemDelegateTextColor

Fix RSElidedItemDelegate text color.
This commit is contained in:
csoler 2016-12-10 20:51:12 +01:00 committed by GitHub
commit f2898dacdb
2 changed files with 15 additions and 6 deletions

View File

@ -69,7 +69,16 @@ void RSElidedItemDelegate::drawDisplay(QPainter *painter, const QStyleOptionView
plainText = plainText.replace("\n",QChar(QChar::LineSeparator)); plainText = plainText.replace("\n",QChar(QChar::LineSeparator));
plainText = plainText.replace("\r",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); QTextLayout textLayout(plainText, option.font);
QTextOption to = textLayout.textOption(); QTextOption to = textLayout.textOption();
to.setAlignment(option.displayAlignment); to.setAlignment(option.displayAlignment);

View File

@ -647,20 +647,20 @@ void GxsForumThreadWidget::calculateIconsAndFonts(QTreeWidgetItem *item, bool &h
if (!IS_GROUP_SUBSCRIBED(mSubscribeFlags)) { if (!IS_GROUP_SUBSCRIBED(mSubscribeFlags)) {
qf.setBold(false); qf.setBold(false);
item->setTextColor(i, textColorNotSubscribed()); item->setForeground(i, textColorNotSubscribed());
} else if (unread || isNew) { } else if (unread || isNew) {
qf.setBold(true); qf.setBold(true);
item->setTextColor(i, textColorUnread()); item->setForeground(i, textColorUnread());
} else if (myUnreadChilddren) { } else if (myUnreadChilddren) {
qf.setBold(true); qf.setBold(true);
item->setTextColor(i, textColorUnreadChildren()); item->setForeground(i, textColorUnreadChildren());
} else { } else {
qf.setBold(false); qf.setBold(false);
item->setTextColor(i, textColorRead()); item->setForeground(i, textColorRead());
} }
if (missing) { if (missing) {
/* Missing message */ /* Missing message */
item->setTextColor(i, textColorMissing()); item->setForeground(i, textColorMissing());
} }
item->setFont(i, qf); item->setFont(i, qf);
} }