From c21122af402579588eaa6ed0ea05849a5346fe10 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Sun, 8 Jun 2014 13:39:32 -0300 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/profile/divepixmapitem.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'qt-ui') diff --git a/qt-ui/profile/divepixmapitem.cpp b/qt-ui/profile/divepixmapitem.cpp index 215ce99c2..4405195da 100644 --- a/qt-ui/profile/divepixmapitem.cpp +++ b/qt-ui/profile/divepixmapitem.cpp @@ -3,6 +3,7 @@ #include #include +#include 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); } -- cgit v1.2.3-70-g09d2