Commit 95564edf authored by Alessandro Portale's avatar Alessandro Portale

Utils: Allow Icon::pixmap to return pixmaps for different QIcon::Modes

We need disabled state of the Icon as pixmap, e.g. in the CrumblePath.

Change-Id: I3dfea5145c2c12f436e2dca73f1ac96839139236
Reviewed-by: Thomas Hartmann's avatarThomas Hartmann <>
parent 76807c13
......@@ -203,7 +203,7 @@ QIcon Icon::icon() const
QPixmap Icon::pixmap() const
QPixmap Icon::pixmap(QIcon::Mode iconMode) const
if (isEmpty()) {
return QPixmap();
......@@ -213,7 +213,9 @@ QPixmap Icon::pixmap() const
const MasksAndColors masks =
masksAndColors(*this, qRound(qApp->devicePixelRatio()));
const QPixmap combinedMask = Utils::combinedMask(masks, m_style);
return masksToIcon(masks, combinedMask, m_style);
return iconMode == QIcon::Disabled
? maskToColorAndAlpha(combinedMask, creatorTheme()->color(Theme::IconsDisabledColor))
: masksToIcon(masks, combinedMask, m_style);
......@@ -28,11 +28,11 @@
#include "utils_global.h"
#include "theme/theme.h"
#include <QIcon>
#include <QPair>
#include <QVector>
......@@ -64,7 +64,7 @@ public:
QIcon icon() const;
// Same as icon() but without disabled state.
QPixmap pixmap() const;
QPixmap pixmap(QIcon::Mode iconMode = QIcon::Normal) const;
// Try to avoid it. it is just there for special API cases in Qt Creator
// where icons are still defined as filename.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment