summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicseffect.cpp13
-rw-r--r--src/gui/graphicsview/qgraphicseffect.h12
-rw-r--r--src/gui/graphicsview/qgraphicseffect_p.h6
3 files changed, 18 insertions, 13 deletions
diff --git a/src/gui/graphicsview/qgraphicseffect.cpp b/src/gui/graphicsview/qgraphicseffect.cpp
index 6f60ab9..b04af7a 100644
--- a/src/gui/graphicsview/qgraphicseffect.cpp
+++ b/src/gui/graphicsview/qgraphicseffect.cpp
@@ -316,19 +316,12 @@ void QGraphicsEffect::updateBoundingRect()
This virtual function is called by QGraphicsEffect to notify the effect
that the source has changed. If the effect applies any cache, then this
cache must be purged in order to reflect the new appearance of the source.
-*/
-void QGraphicsEffect::sourceChanged()
-{
-}
-/*!
- This virtual function is called by QGraphicsEffect to notify the effect
- that the source's bounding rectangle has changed. If the effect applies any
- cache, then this cache must be purged in order to reflect the new
- appearance of the source.
+ The \a flags describes what has changed.
*/
-void QGraphicsEffect::sourceBoundingRectChanged()
+void QGraphicsEffect::sourceChanged(ChangeFlags flags)
{
+ Q_UNUSED(flags);
}
QGraphicsGrayscaleEffect::QGraphicsGrayscaleEffect()
diff --git a/src/gui/graphicsview/qgraphicseffect.h b/src/gui/graphicsview/qgraphicseffect.h
index bb79563..d171b1b 100644
--- a/src/gui/graphicsview/qgraphicseffect.h
+++ b/src/gui/graphicsview/qgraphicseffect.h
@@ -94,8 +94,17 @@ class QGraphicsEffectPrivate;
class Q_GUI_EXPORT QGraphicsEffect : public QObject
{
Q_OBJECT
+ Q_FLAGS(ChangeFlags)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
public:
+ enum ChangeFlag {
+ SourceAttached = 0x1,
+ SourceDetached = 0x2,
+ SourceBoundingRectChanged = 0x4,
+ SourceInvalidated = 0x8
+ };
+ Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag);
+
QGraphicsEffect();
virtual ~QGraphicsEffect();
@@ -114,8 +123,7 @@ public Q_SLOTS:
protected:
QGraphicsEffect(QGraphicsEffectPrivate &d);
virtual void draw(QPainter *painter, QGraphicsEffectSource *source) = 0;
- virtual void sourceChanged();
- virtual void sourceBoundingRectChanged();
+ virtual void sourceChanged(ChangeFlags flags);
void updateBoundingRect();
private:
diff --git a/src/gui/graphicsview/qgraphicseffect_p.h b/src/gui/graphicsview/qgraphicseffect_p.h
index 6664a03..6d546cc 100644
--- a/src/gui/graphicsview/qgraphicseffect_p.h
+++ b/src/gui/graphicsview/qgraphicseffect_p.h
@@ -94,12 +94,16 @@ public:
inline void setGraphicsEffectSource(QGraphicsEffectSource *newSource)
{
+ QGraphicsEffect::ChangeFlags flags;
if (source) {
+ flags |= QGraphicsEffect::SourceDetached;
source->d_func()->detach();
delete source;
}
source = newSource;
- q_func()->sourceChanged();
+ if (newSource)
+ flags |= QGraphicsEffect::SourceAttached;
+ q_func()->sourceChanged(flags);
}
QGraphicsEffectSource *source;