diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-06-08 13:39:32 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-06-08 12:42:51 -0700 |
commit | c21122af402579588eaa6ed0ea05849a5346fe10 (patch) | |
tree | a0b2d5d8c77f6235533d3e260c579309c4d8d510 /qt-ui | |
parent | 8e682c41e831c174e3a513ff6704d9ff3734f7a4 (diff) | |
download | subsurface-c21122af402579588eaa6ed0ea05849a5346fe10.tar.gz |
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>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/profile/divepixmapitem.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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 <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); } |