summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/effects/lighting/shadoweffect.cpp6
-rw-r--r--examples/effects/lighting/shadoweffect.h2
-rw-r--r--src/gui/effects/qgraphicseffect.cpp40
-rw-r--r--src/gui/effects/qgraphicseffect.h12
-rw-r--r--src/gui/effects/qgraphicseffect_p.h6
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp2
6 files changed, 34 insertions, 34 deletions
diff --git a/examples/effects/lighting/shadoweffect.cpp b/examples/effects/lighting/shadoweffect.cpp
index f447531..9545815 100644
--- a/examples/effects/lighting/shadoweffect.cpp
+++ b/examples/effects/lighting/shadoweffect.cpp
@@ -44,7 +44,7 @@
#include <math.h>
ShadowEffect::ShadowEffect(QGraphicsItem *item, QGraphicsItem *source)
- : QGraphicsShadowEffect()
+ : QGraphicsDropShadowEffect()
, item(item), m_lightSource(source)
{
setBlurRadius(8);
@@ -64,11 +64,11 @@ void ShadowEffect::adjustForItem()
QRectF ShadowEffect::boundingRectFor(const QRectF &rect) const
{
const_cast<ShadowEffect *>(this)->adjustForItem();
- return QGraphicsShadowEffect::boundingRectFor(rect);
+ return QGraphicsDropShadowEffect::boundingRectFor(rect);
}
void ShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
{
adjustForItem();
- QGraphicsShadowEffect::draw(painter, source);
+ QGraphicsDropShadowEffect::draw(painter, source);
}
diff --git a/examples/effects/lighting/shadoweffect.h b/examples/effects/lighting/shadoweffect.h
index 68318b0..b20f647 100644
--- a/examples/effects/lighting/shadoweffect.h
+++ b/examples/effects/lighting/shadoweffect.h
@@ -45,7 +45,7 @@
#include <QGraphicsEffect>
#include <QGraphicsItem>
-class ShadowEffect: public QGraphicsShadowEffect
+class ShadowEffect: public QGraphicsDropShadowEffect
{
public:
ShadowEffect(QGraphicsItem *item, QGraphicsItem *source);
diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp
index 0747046..c6f2871 100644
--- a/src/gui/effects/qgraphicseffect.cpp
+++ b/src/gui/effects/qgraphicseffect.cpp
@@ -63,7 +63,7 @@
\o QGraphicsColorizeEffect - renders the item in shades of any given color
\o QGraphicsPixelizeEffect - pixelizes the item with any pixel size
\o QGraphicsBlurEffect - blurs the item by a given radius
- \o QGraphicsShadowEffect - renders a dropshadow behind the item
+ \o QGraphicsDropShadowEffect - renders a dropshadow behind the item
\endlist
If all you want is to add an effect to an item, you should visit the
@@ -538,24 +538,24 @@ void QGraphicsBlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
painter->setWorldTransform(restoreTransform);
}
-QGraphicsShadowEffect::QGraphicsShadowEffect(QObject *parent)
- : QGraphicsEffect(*new QGraphicsShadowEffectPrivate, parent)
+QGraphicsDropShadowEffect::QGraphicsDropShadowEffect(QObject *parent)
+ : QGraphicsEffect(*new QGraphicsDropShadowEffectPrivate, parent)
{
}
-QGraphicsShadowEffect::~QGraphicsShadowEffect()
+QGraphicsDropShadowEffect::~QGraphicsDropShadowEffect()
{
}
-QPointF QGraphicsShadowEffect::shadowOffset() const
+QPointF QGraphicsDropShadowEffect::shadowOffset() const
{
- Q_D(const QGraphicsShadowEffect);
+ Q_D(const QGraphicsDropShadowEffect);
return d->offset;
}
-void QGraphicsShadowEffect::setShadowOffset(const QPointF &ofs)
+void QGraphicsDropShadowEffect::setShadowOffset(const QPointF &ofs)
{
- Q_D(QGraphicsShadowEffect);
+ Q_D(QGraphicsDropShadowEffect);
if (d->offset == ofs)
return;
@@ -564,15 +564,15 @@ void QGraphicsShadowEffect::setShadowOffset(const QPointF &ofs)
emit shadowOffsetChanged(ofs);
}
-int QGraphicsShadowEffect::blurRadius() const
+int QGraphicsDropShadowEffect::blurRadius() const
{
- Q_D(const QGraphicsShadowEffect);
+ Q_D(const QGraphicsDropShadowEffect);
return d->radius;
}
-void QGraphicsShadowEffect::setBlurRadius(int blurRadius)
+void QGraphicsDropShadowEffect::setBlurRadius(int blurRadius)
{
- Q_D(QGraphicsShadowEffect);
+ Q_D(QGraphicsDropShadowEffect);
if (d->radius == blurRadius)
return;
@@ -581,15 +581,15 @@ void QGraphicsShadowEffect::setBlurRadius(int blurRadius)
emit blurRadiusChanged(blurRadius);
}
-qreal QGraphicsShadowEffect::opacity() const
+qreal QGraphicsDropShadowEffect::opacity() const
{
- Q_D(const QGraphicsShadowEffect);
+ Q_D(const QGraphicsDropShadowEffect);
return d->alpha;
}
-void QGraphicsShadowEffect::setOpacity(qreal opacity)
+void QGraphicsDropShadowEffect::setOpacity(qreal opacity)
{
- Q_D(QGraphicsShadowEffect);
+ Q_D(QGraphicsDropShadowEffect);
if (qFuzzyCompare(d->alpha, opacity))
return;
@@ -597,9 +597,9 @@ void QGraphicsShadowEffect::setOpacity(qreal opacity)
emit opacityChanged(opacity);
}
-QRectF QGraphicsShadowEffect::boundingRectFor(const QRectF &rect) const
+QRectF QGraphicsDropShadowEffect::boundingRectFor(const QRectF &rect) const
{
- Q_D(const QGraphicsShadowEffect);
+ Q_D(const QGraphicsDropShadowEffect);
QRectF shadowRect = rect.translated(d->offset);
QRectF blurRect = shadowRect;
qreal delta = d->radius * 3;
@@ -608,9 +608,9 @@ QRectF QGraphicsShadowEffect::boundingRectFor(const QRectF &rect) const
return blurRect;
}
-void QGraphicsShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
+void QGraphicsDropShadowEffect::draw(QPainter *painter, QGraphicsEffectSource *source)
{
- Q_D(QGraphicsShadowEffect);
+ Q_D(QGraphicsDropShadowEffect);
if (d->radius <= 0 && d->offset.isNull()) {
source->draw(painter);
return;
diff --git a/src/gui/effects/qgraphicseffect.h b/src/gui/effects/qgraphicseffect.h
index e92a4f4..4344e2d 100644
--- a/src/gui/effects/qgraphicseffect.h
+++ b/src/gui/effects/qgraphicseffect.h
@@ -226,16 +226,16 @@ private:
Q_DISABLE_COPY(QGraphicsBlurEffect)
};
-class QGraphicsShadowEffectPrivate;
-class Q_GUI_EXPORT QGraphicsShadowEffect: public QGraphicsEffect
+class QGraphicsDropShadowEffectPrivate;
+class Q_GUI_EXPORT QGraphicsDropShadowEffect: public QGraphicsEffect
{
Q_OBJECT
Q_PROPERTY(QPointF shadowOffset READ shadowOffset WRITE setShadowOffset NOTIFY shadowOffsetChanged)
Q_PROPERTY(int blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged)
Q_PROPERTY(int opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
public:
- QGraphicsShadowEffect(QObject *parent = 0);
- ~QGraphicsShadowEffect();
+ QGraphicsDropShadowEffect(QObject *parent = 0);
+ ~QGraphicsDropShadowEffect();
QRectF boundingRectFor(const QRectF &rect) const;
QPointF shadowOffset() const;
@@ -260,8 +260,8 @@ protected:
void draw(QPainter *painter, QGraphicsEffectSource *source);
private:
- Q_DECLARE_PRIVATE(QGraphicsShadowEffect)
- Q_DISABLE_COPY(QGraphicsShadowEffect)
+ Q_DECLARE_PRIVATE(QGraphicsDropShadowEffect)
+ Q_DISABLE_COPY(QGraphicsDropShadowEffect)
};
QT_END_NAMESPACE
diff --git a/src/gui/effects/qgraphicseffect_p.h b/src/gui/effects/qgraphicseffect_p.h
index 705b442..309b382 100644
--- a/src/gui/effects/qgraphicseffect_p.h
+++ b/src/gui/effects/qgraphicseffect_p.h
@@ -150,11 +150,11 @@ public:
int blurRadius;
};
-class QGraphicsShadowEffectPrivate : public QGraphicsEffectPrivate
+class QGraphicsDropShadowEffectPrivate : public QGraphicsEffectPrivate
{
- Q_DECLARE_PUBLIC(QGraphicsShadowEffect)
+ Q_DECLARE_PUBLIC(QGraphicsDropShadowEffect)
public:
- QGraphicsShadowEffectPrivate() : offset(4, 4), radius(8), alpha(0.7) {}
+ QGraphicsDropShadowEffectPrivate() : offset(4, 4), radius(8), alpha(0.7) {}
QPointF offset;
int radius;
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 976f57d..184bfe2 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -7418,7 +7418,7 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
item3->repaints = 0;
// Apply shadow effect to the entire sub-tree.
- QGraphicsShadowEffect *shadow = new QGraphicsShadowEffect;
+ QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect;
shadow->setShadowOffset(-20, -20);
item1->setGraphicsEffect(shadow);
QTest::qWait(50);