summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-07-22 09:15:55 +0200
committerBjørn Erik Nilsen <bjorn.nilsen@nokia.com>2009-07-24 01:26:20 +0200
commit8e18256d023e6e78081a34b573d548d52137575d (patch)
tree1c604917bab463f545fba3233f18e500ad6f6a14 /examples
parent787f2252077434581101df64d0f0d576c26b7ce8 (diff)
QGraphicsEffect API cleanup.
Diffstat (limited to 'examples')
-rw-r--r--examples/graphicsview/blurpicker/blureffect.cpp2
-rw-r--r--examples/graphicsview/blurpicker/blureffect.h2
-rw-r--r--examples/graphicsview/blurpicker/blurpicker.cpp6
-rw-r--r--examples/graphicsview/blurpicker/blurpicker.h1
-rw-r--r--examples/graphicsview/lighting/lighting.cpp4
-rw-r--r--examples/graphicsview/lighting/lighting.h1
-rw-r--r--examples/graphicsview/lighting/shadoweffect.cpp4
-rw-r--r--examples/graphicsview/lighting/shadoweffect.h2
8 files changed, 8 insertions, 14 deletions
diff --git a/examples/graphicsview/blurpicker/blureffect.cpp b/examples/graphicsview/blurpicker/blureffect.cpp
index 8345d0b8e..6c2095d5c 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 24a686729..cafd910fa 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 887d7ef88..10ce44fc5 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 e41c608d6..b7ea3b4e0 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 445d7f964..fff22046d 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 66237f61a..70a4d48eb 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 726cbd095..c1d384ab1 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 02d0bf1fd..09b63e390 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);