mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
Tint icon by selection color if selected, consistent with Dolphin.
This commit is contained in:
parent
15428f1910
commit
f979fab6c8
1 changed files with 11 additions and 1 deletions
|
@ -37,6 +37,7 @@
|
|||
#include <KDirModel>
|
||||
#include <KGlobalSettings>
|
||||
#include <KIcon>
|
||||
#include <KIconEffect>
|
||||
#include <KStringHandler>
|
||||
#include <KFileItemDelegate>
|
||||
|
||||
|
@ -1053,7 +1054,16 @@ void IconView::paintItem(QPainter *painter, const QStyleOptionViewItemV4 &option
|
|||
const QIcon icon = qvariant_cast<QIcon>(index.data(Qt::DecorationRole));
|
||||
const QRect ir = QStyle::alignedRect(option.direction, Qt::AlignTop | Qt::AlignHCenter,
|
||||
option.decorationSize, r);
|
||||
icon.paint(painter, ir);
|
||||
|
||||
|
||||
if (selected) {
|
||||
const QColor color = option.palette.brush(QPalette::Normal, QPalette::Highlight).color();
|
||||
QImage image = icon.pixmap(ir.size()).toImage();
|
||||
KIconEffect::colorize(image, color, 0.8f);
|
||||
painter->drawPixmap(ir, QPixmap::fromImage(image));
|
||||
} else {
|
||||
icon.paint(painter, ir);
|
||||
}
|
||||
|
||||
const QRect tr = r.adjusted(0, ir.bottom() - r.top() + 2, 0, 0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue