Fix RSElidedItemDelegate text color.

This commit is contained in:
Phenom 2016-12-10 19:52:46 +01:00
parent 242338d10c
commit 803d1b62ef
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("\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);

View File

@ -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);
}