Add a drop shadow on the picture
This patch adds a drop shadow on the picture. a real blurry shadow could be much better, but without OpenGL it's too costly to calculate the shadow for each picture. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8e682c41e8
commit
c21122af40
@ -3,6 +3,7 @@
|
||||
|
||||
#include <QPen>
|
||||
#include <QBrush>
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
|
||||
DivePixmapItem::DivePixmapItem(QObject *parent) : QObject(parent), QGraphicsPixmapItem()
|
||||
{
|
||||
@ -22,6 +23,15 @@ void DivePictureItem::setPixmap(const QPixmap &pix)
|
||||
rect->setPen(Qt::NoPen);
|
||||
rect->setBrush(QColor(Qt::white));
|
||||
rect->setFlag(ItemStacksBehindParent);
|
||||
rect->setZValue(-1);
|
||||
|
||||
QGraphicsRectItem *shadow = new QGraphicsRectItem(rect->boundingRect(), this);
|
||||
shadow->setPos(5,5);
|
||||
shadow->setPen(Qt::NoPen);
|
||||
shadow->setBrush(QColor(Qt::lightGray));
|
||||
shadow->setFlag(ItemStacksBehindParent);
|
||||
shadow->setZValue(-2);
|
||||
|
||||
setTransformOriginPoint(boundingRect().width()/2, boundingRect().height()/2);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user