mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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
1 changed files with 10 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue