summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-08-21 09:33:44 (GMT)
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-08-21 11:51:32 (GMT)
commit00d7d50cde5d1e491039149d58502e17dba9b3b7 (patch)
treeba59ef8f83677c0c7c74b7db2f3f7a55c2887c16 /examples
parent487f636523dfded4c07a39e4d96ab3e83c64f95e (diff)
downloadQt-00d7d50cde5d1e491039149d58502e17dba9b3b7.zip
Qt-00d7d50cde5d1e491039149d58502e17dba9b3b7.tar.gz
Qt-00d7d50cde5d1e491039149d58502e17dba9b3b7.tar.bz2
Use pixmap filter for the drop shadow effect.
Diffstat (limited to 'examples')
-rw-r--r--examples/effects/lighting/shadoweffect.cpp6
-rw-r--r--examples/effects/lighting/shadoweffect.h1
2 files changed, 5 insertions, 2 deletions
diff --git a/examples/effects/lighting/shadoweffect.cpp b/examples/effects/lighting/shadoweffect.cpp
index 9545815..8a41aaa 100644
--- a/examples/effects/lighting/shadoweffect.cpp
+++ b/examples/effects/lighting/shadoweffect.cpp
@@ -48,17 +48,19 @@ ShadowEffect::ShadowEffect(QGraphicsItem *item, QGraphicsItem *source)
, item(item), m_lightSource(source)
{
setBlurRadius(8);
+ m_color = color();
}
void ShadowEffect::adjustForItem()
{
QPointF delta = item->pos() - m_lightSource->pos();
- setShadowOffset(delta.toPoint() / 30);
+ setOffset(delta.toPoint() / 30);
qreal dx = delta.x();
qreal dy = delta.y();
qreal dd = sqrt(dx * dx + dy * dy);
- setOpacity(qBound(0.4, 1 - dd / 200.0, 0.7));
+ m_color.setAlphaF(qBound(0.4, 1 - dd / 200.0, 0.7));
+ setColor(m_color);
}
QRectF ShadowEffect::boundingRectFor(const QRectF &rect) const
diff --git a/examples/effects/lighting/shadoweffect.h b/examples/effects/lighting/shadoweffect.h
index b20f647..7ea409e 100644
--- a/examples/effects/lighting/shadoweffect.h
+++ b/examples/effects/lighting/shadoweffect.h
@@ -58,6 +58,7 @@ private:
void adjustForItem();
private:
+ QColor m_color;
QGraphicsItem *item;
QGraphicsItem *m_lightSource;
};