[KStandardItemListWidget] Pass icon state to overlay painter

Ensures the overlay is painted in the same icon state, especially the selected one so dark overlays turn white.

Differential Revision: https://phabricator.kde.org/D16307
This commit is contained in:
Kai Uwe Broulik 2018-10-24 09:52:36 +02:00
parent 200e0d1f07
commit 502a5c86fe

View file

@ -1500,9 +1500,25 @@ QPixmap KStandardItemListWidget::pixmapForIcon(const QString& name, const QStrin
// setup time.
foreach (const QString& overlay, overlays) {
if (!overlay.isEmpty()) {
int state = KIconLoader::DefaultState;
switch (mode) {
case QIcon::Normal:
break;
case QIcon::Active:
state = KIconLoader::ActiveState;
break;
case QIcon::Disabled:
state = KIconLoader::DisabledState;
break;
case QIcon::Selected:
state = KIconLoader::SelectedState;
break;
}
// There is at least one overlay, draw all overlays above m_pixmap
// and cancel the check
KIconLoader::global()->drawOverlays(overlays, pixmap, KIconLoader::Desktop);
KIconLoader::global()->drawOverlays(overlays, pixmap, KIconLoader::Desktop, state);
break;
}
}