diff options
author | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-07-22 07:15:55 (GMT) |
---|---|---|
committer | Bjørn Erik Nilsen <bjorn.nilsen@nokia.com> | 2009-07-23 23:26:20 (GMT) |
commit | 8e18256d023e6e78081a34b573d548d52137575d (patch) | |
tree | 1c604917bab463f545fba3233f18e500ad6f6a14 /examples | |
parent | 787f2252077434581101df64d0f0d576c26b7ce8 (diff) | |
download | Qt-8e18256d023e6e78081a34b573d548d52137575d.zip Qt-8e18256d023e6e78081a34b573d548d52137575d.tar.gz Qt-8e18256d023e6e78081a34b573d548d52137575d.tar.bz2 |
QGraphicsEffect API cleanup.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/graphicsview/blurpicker/blureffect.cpp | 2 | ||||
-rw-r--r-- | examples/graphicsview/blurpicker/blureffect.h | 2 | ||||
-rw-r--r-- | examples/graphicsview/blurpicker/blurpicker.cpp | 6 | ||||
-rw-r--r-- | examples/graphicsview/blurpicker/blurpicker.h | 1 | ||||
-rw-r--r-- | examples/graphicsview/lighting/lighting.cpp | 4 | ||||
-rw-r--r-- | examples/graphicsview/lighting/lighting.h | 1 | ||||
-rw-r--r-- | examples/graphicsview/lighting/shadoweffect.cpp | 4 | ||||
-rw-r--r-- | examples/graphicsview/lighting/shadoweffect.h | 2 |
8 files changed, 8 insertions, 14 deletions
diff --git a/examples/graphicsview/blurpicker/blureffect.cpp b/examples/graphicsview/blurpicker/blureffect.cpp index 8345d0b..6c2095d 100644 --- a/examples/graphicsview/blurpicker/blureffect.cpp +++ b/examples/graphicsview/blurpicker/blureffect.cpp @@ -43,7 +43,7 @@ #include <QDebug> -BlurEffect::BlurEffect(QObject *parent) +BlurEffect::BlurEffect() : QGraphicsBlurEffect() , m_baseLine(200) { diff --git a/examples/graphicsview/blurpicker/blureffect.h b/examples/graphicsview/blurpicker/blureffect.h index 24a6867..cafd910 100644 --- a/examples/graphicsview/blurpicker/blureffect.h +++ b/examples/graphicsview/blurpicker/blureffect.h @@ -48,7 +48,7 @@ class BlurEffect: public QGraphicsBlurEffect { public: - BlurEffect(QObject *parent = 0); + BlurEffect(); void setBaseLine(qreal y) { m_baseLine = y; } diff --git a/examples/graphicsview/blurpicker/blurpicker.cpp b/examples/graphicsview/blurpicker/blurpicker.cpp index 887d7ef..10ce44f 100644 --- a/examples/graphicsview/blurpicker/blurpicker.cpp +++ b/examples/graphicsview/blurpicker/blurpicker.cpp @@ -79,9 +79,9 @@ void BlurPicker::updateIconPositions() pos -= QPointF(40, 40); icon->setPos(pos); baseline = qMax(baseline, ys); + static_cast<BlurEffect *>(icon->effect())->setBaseLine(baseline); } - m_blurEffect->setBaseLine(baseline); m_scene.update(); } @@ -89,8 +89,6 @@ void BlurPicker::setupScene() { m_scene.setSceneRect(-200, -120, 400, 240); - m_blurEffect = new BlurEffect(this); - QStringList names; names << ":/images/accessories-calculator.png"; names << ":/images/accessories-text-editor.png"; @@ -105,7 +103,7 @@ void BlurPicker::setupScene() QPixmap pixmap(names[i]); QGraphicsPixmapItem *icon = m_scene.addPixmap(pixmap); icon->setZValue(1); - icon->setEffect(m_blurEffect); + icon->setGraphicsEffect(new BlurEffect); m_icons << icon; } diff --git a/examples/graphicsview/blurpicker/blurpicker.h b/examples/graphicsview/blurpicker/blurpicker.h index e41c608..b7ea3b4 100644 --- a/examples/graphicsview/blurpicker/blurpicker.h +++ b/examples/graphicsview/blurpicker/blurpicker.h @@ -67,7 +67,6 @@ private: private: qreal m_index; QGraphicsScene m_scene; - BlurEffect *m_blurEffect; QList<QGraphicsItem*> m_icons; QTimeLine m_timeLine; }; diff --git a/examples/graphicsview/lighting/lighting.cpp b/examples/graphicsview/lighting/lighting.cpp index 445d7f9..fff2204 100644 --- a/examples/graphicsview/lighting/lighting.cpp +++ b/examples/graphicsview/lighting/lighting.cpp @@ -88,8 +88,6 @@ void Lighting::setupScene() m_lightSource = m_scene.addPixmap(pixmap); m_lightSource->setZValue(2); - m_shadowEffect = new ShadowEffect(m_lightSource, this); - for (int i = -2; i < 3; ++i) for (int j = -2; j < 3; ++j) { QAbstractGraphicsShapeItem *item; @@ -100,7 +98,7 @@ void Lighting::setupScene() item->setPen(QPen(Qt::black)); item->setBrush(QBrush(Qt::white)); - item->setEffect(m_shadowEffect); + item->setGraphicsEffect(new ShadowEffect(m_lightSource)); item->setZValue(1); item->setPos(i * 80, j * 80); m_scene.addItem(item); diff --git a/examples/graphicsview/lighting/lighting.h b/examples/graphicsview/lighting/lighting.h index 66237f6..70a4d48 100644 --- a/examples/graphicsview/lighting/lighting.h +++ b/examples/graphicsview/lighting/lighting.h @@ -64,7 +64,6 @@ private: qreal angle; QGraphicsScene m_scene; QGraphicsItem *m_lightSource; - ShadowEffect *m_shadowEffect; QList<QGraphicsItem*> m_items; }; diff --git a/examples/graphicsview/lighting/shadoweffect.cpp b/examples/graphicsview/lighting/shadoweffect.cpp index 726cbd0..c1d384a 100644 --- a/examples/graphicsview/lighting/shadoweffect.cpp +++ b/examples/graphicsview/lighting/shadoweffect.cpp @@ -43,8 +43,8 @@ #include <math.h> -ShadowEffect::ShadowEffect(QGraphicsItem *source, QObject *parent) - : QGraphicsShadowEffect(parent) +ShadowEffect::ShadowEffect(QGraphicsItem *source) + : QGraphicsShadowEffect() , m_lightSource(source) { setBlurRadius(8); diff --git a/examples/graphicsview/lighting/shadoweffect.h b/examples/graphicsview/lighting/shadoweffect.h index 02d0bf1..09b63e3 100644 --- a/examples/graphicsview/lighting/shadoweffect.h +++ b/examples/graphicsview/lighting/shadoweffect.h @@ -48,7 +48,7 @@ class ShadowEffect: public QGraphicsShadowEffect { public: - ShadowEffect(QGraphicsItem *source, QObject *parent = 0); + ShadowEffect(QGraphicsItem *source); QRectF boundingRectFor(const QGraphicsItem *item); |