From ca60f9a300638afc0aa0105c2b24e8dbb89e98a1 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sat, 3 Feb 2018 19:51:19 +0100 Subject: [PATCH] VerticalTabs: Don't use selected icon mode for favicons On some styles (particularly QStyleSheetStyle) it returns pixmap drawn onto background color. --- src/plugins/VerticalTabs/tablistdelegate.cpp | 4 +--- src/plugins/VerticalTabs/tabtreedelegate.cpp | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/plugins/VerticalTabs/tablistdelegate.cpp b/src/plugins/VerticalTabs/tablistdelegate.cpp index ac0bf046f..1246dcdb6 100644 --- a/src/plugins/VerticalTabs/tablistdelegate.cpp +++ b/src/plugins/VerticalTabs/tablistdelegate.cpp @@ -56,8 +56,6 @@ void TabListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio const int height = opt.rect.height(); const int center = height / 2 + opt.rect.top(); - const QIcon::Mode iconMode = opt.state & QStyle::State_Selected ? QIcon::Selected : QIcon::Normal; - // Draw background style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, w); @@ -69,7 +67,7 @@ void TabListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio if (index.data(TabModel::LoadingRole).toBool()) { pixmap = m_loadingAnimator->pixmap(index); } else { - pixmap = index.data(Qt::DecorationRole).value().pixmap(iconSize, iconMode); + pixmap = index.data(Qt::DecorationRole).value().pixmap(iconSize); } painter->drawPixmap(iconRect, pixmap); diff --git a/src/plugins/VerticalTabs/tabtreedelegate.cpp b/src/plugins/VerticalTabs/tabtreedelegate.cpp index 6242193ec..3e7ab8f6b 100644 --- a/src/plugins/VerticalTabs/tabtreedelegate.cpp +++ b/src/plugins/VerticalTabs/tabtreedelegate.cpp @@ -159,7 +159,6 @@ void TabTreeDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio int leftPosition = opt.rect.left() + m_indentation + m_indentation * depth + m_padding; int rightPosition = opt.rect.right() - m_padding * 2 - m_closeButton->size().width(); - const QIcon::Mode iconMode = opt.state & QStyle::State_Selected ? QIcon::Selected : QIcon::Normal; const QPalette::ColorRole colorRole = opt.state & QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Text; QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; @@ -202,7 +201,7 @@ void TabTreeDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio if (index.data(TabModel::LoadingRole).toBool()) { pixmap = m_loadingAnimator->pixmap(index); } else { - pixmap = index.data(Qt::DecorationRole).value().pixmap(iconSize, iconMode); + pixmap = index.data(Qt::DecorationRole).value().pixmap(iconSize); } painter->drawPixmap(iconRect, pixmap); leftPosition += iconRect.width() + m_padding;