From 1d28b028b17f243b6609c49b21b5cde61cbd6236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 6 Dec 2013 16:24:41 +0100 Subject: [PATCH] Use IconEffect for disabled state in QIconItem Reason for this change: a QIcon might not contain the disabled pixmaps. Using the icon effect allows to get also the disabled state for such icons. REVIEW: 114334 --- src/declarativeimports/qtextracomponents/qiconitem.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/declarativeimports/qtextracomponents/qiconitem.cpp b/src/declarativeimports/qtextracomponents/qiconitem.cpp index 93b32d35d..609e843e9 100644 --- a/src/declarativeimports/qtextracomponents/qiconitem.cpp +++ b/src/declarativeimports/qtextracomponents/qiconitem.cpp @@ -111,8 +111,12 @@ void QIconItem::paint(QPainter *painter) QPixmap result = m_icon.pixmap(boundingRect().size().toSize()); result = KIconLoader::global()->iconEffect()->apply(result, KIconLoader::Desktop, KIconLoader::ActiveState); painter->drawPixmap(0, 0, result); + } else if (m_state == QIconItem::DisabledState) { + QPixmap result = m_icon.pixmap(boundingRect().size().toSize()); + result = KIconLoader::global()->iconEffect()->apply(result, KIconLoader::Desktop, KIconLoader::DisabledState); + painter->drawPixmap(0, 0, result); } else { - m_icon.paint(painter, boundingRect().toRect(), Qt::AlignCenter, isEnabled() ? QIcon::Normal : QIcon::Disabled); + m_icon.paint(painter, boundingRect().toRect(), Qt::AlignCenter, QIcon::Normal); } painter->setRenderHint(QPainter::Antialiasing, wasAntiAlias);