}
painter->setFont(m_customizedFont);
- painter->setPen(textColor());
+ painter->setPen(textColor(*widget));
const TextInfo *textInfo = m_textInfo.value("text");
if (!textInfo) {
}
}
-QColor KStandardItemListWidget::textColor() const
+QColor KStandardItemListWidget::textColor(const QWidget &widget) const
{
if (!isSelected()) {
if (m_isHidden) {
}
}
- const QPalette::ColorGroup group = isActiveWindow() ? QPalette::Active : QPalette::Inactive;
+ const QPalette::ColorGroup group = isActiveWindow() && widget.hasFocus() ? QPalette::Active : QPalette::Inactive;
const QPalette::ColorRole role = isSelected() ? QPalette::HighlightedText : normalTextColorRole();
return styleOption().palette.color(group, role);
}
iconName = QStringLiteral("unknown");
}
const QStringList overlays = values["iconOverlays"].toStringList();
- m_pixmap =
- pixmapForIcon(iconName, overlays, maxIconHeight, m_layout != IconsLayout && isActiveWindow() && isSelected() ? QIcon::Selected : QIcon::Normal);
+ const bool hasFocus = scene()->views()[0]->parentWidget()->hasFocus();
+ m_pixmap = pixmapForIcon(iconName,
+ overlays,
+ maxIconHeight,
+ m_layout != IconsLayout && isActiveWindow() && isSelected() && hasFocus ? QIcon::Selected : QIcon::Normal);
} else if (m_pixmap.width() / m_pixmap.devicePixelRatio() != maxIconWidth || m_pixmap.height() / m_pixmap.devicePixelRatio() != maxIconHeight) {
// A custom pixmap has been applied. Assure that the pixmap
void KStandardItemListWidget::updateAdditionalInfoTextColor()
{
QColor c1;
+ const bool hasFocus = scene()->views()[0]->parentWidget()->hasFocus();
if (m_customTextColor.isValid()) {
c1 = m_customTextColor;
- } else if (isSelected() && (m_layout != DetailsLayout || m_highlightEntireRow)) {
+ } else if (isSelected() && hasFocus && (m_layout != DetailsLayout || m_highlightEntireRow)) {
// The detail text colour needs to match the main text (HighlightedText) for the same level
// of readability. We short circuit early here to avoid interpolating with another colour.
m_additionalInfoTextColor = styleOption().palette.color(QPalette::HighlightedText);