dde-dock/frame/item/components/hoverhighlighteffect.cpp
石博文 782ad6e08d refactor: move highlight effect to dock item base class
Change-Id: I80c162b4af84718f533d006768bc33f1023064c1
2018-01-23 13:35:42 +08:00

24 lines
473 B
C++

#include "hoverhighlighteffect.h"
#include "util/imagefactory.h"
#include <QPainter>
#include <QDebug>
HoverHighlightEffect::HoverHighlightEffect(QObject *parent)
: QGraphicsEffect(parent)
{
}
void HoverHighlightEffect::draw(QPainter *painter)
{
const QPixmap pix = sourcePixmap(Qt::DeviceCoordinates);
if (isEnabled())
{
painter->drawPixmap(0, 0, ImageFactory::lighterEffect(pix));
} else {
painter->drawPixmap(0, 0, pix);
}
}