Activities: Fix color when row is selected
authorMarkus Goetz <markus@woboq.com>
Mon, 11 Jan 2016 15:52:05 +0000 (16:52 +0100)
committerMarkus Goetz <markus@woboq.com>
Mon, 11 Jan 2016 15:52:37 +0000 (16:52 +0100)
src/gui/activityitemdelegate.cpp

index 2d86ba9614a7a2bfcb057190f717b7497a1d358d..e625b973673e94965fdf906536b44d07f180e1a0 100644 (file)
@@ -122,6 +122,16 @@ void ActivityItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
     pm = userIcon.pixmap(iconWidth, iconHeight, QIcon::Normal);
     painter->drawPixmap(QPoint(userIconRect.left(), userIconRect.top()), pm);
 
+    QPalette::ColorGroup cg = option.state & QStyle::State_Enabled
+                            ? QPalette::Normal : QPalette::Disabled;
+    if (cg == QPalette::Normal && !(option.state & QStyle::State_Active))
+        cg = QPalette::Inactive;
+    if (option.state & QStyle::State_Selected) {
+        painter->setPen(option.palette.color(cg, QPalette::HighlightedText));
+    } else {
+        painter->setPen(option.palette.color(cg, QPalette::Text));
+    }
+
     const QString elidedAction = fm.elidedText(actionText, Qt::ElideRight, actionTextBox.width());
     painter->drawText(actionTextBox, elidedAction);