summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-07-31 05:21:23 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-07-31 05:21:23 (GMT)
commitcb9384b7ffb2f2cebba432c225a8d9a664ffd846 (patch)
tree9b3e724dde96f4af888005df8d94a1a89f546bc6
parentfb6498857241eb053cbf664d6f83928cab41cc8a (diff)
downloadQt-cb9384b7ffb2f2cebba432c225a8d9a664ffd846.zip
Qt-cb9384b7ffb2f2cebba432c225a8d9a664ffd846.tar.gz
Qt-cb9384b7ffb2f2cebba432c225a8d9a664ffd846.tar.bz2
More QFxItem cleanup.
-rw-r--r--src/declarative/fx/qfxitem.cpp20
-rw-r--r--src/declarative/fx/qfxitem.h2
-rw-r--r--src/declarative/fx/qfxitem_p.h5
-rw-r--r--src/declarative/fx/qfxlayouts.cpp10
-rw-r--r--src/declarative/fx/qfxlayouts.h2
5 files changed, 18 insertions, 21 deletions
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index a9c406d..5eb2516 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -1644,28 +1644,17 @@ bool QFxItem::sceneEvent(QEvent *event)
QVariant QFxItem::itemChange(GraphicsItemChange change,
const QVariant &value)
{
- Q_D(QFxItem);
- if (change == ItemSceneHasChanged) {
- d->canvas = qvariant_cast<QGraphicsScene *>(value);
- } else if (change == ItemChildAddedChange ||
- change == ItemChildRemovedChange) {
- childrenChanged();
- } else if (change == ItemParentHasChanged) {
+ if (change == ItemParentHasChanged) {
emit parentChanged();
}
return QGraphicsItem::itemChange(change, value);
}
-
void QFxItem::mouseUngrabEvent()
{
}
-void QFxItem::childrenChanged()
-{
-}
-
QRectF QFxItem::boundingRect() const
{
Q_D(const QFxItem);
@@ -1900,8 +1889,13 @@ void QFxItem::setOptions(Options options, bool set)
setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy, d->options & IsFocusRealm);
}
-void QFxItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
+void QFxItem::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
+{
+}
+
+bool QFxItem::event(QEvent *ev)
{
+ return QGraphicsObject::event(ev);
}
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h
index d33c07e..d9a7621 100644
--- a/src/declarative/fx/qfxitem.h
+++ b/src/declarative/fx/qfxitem.h
@@ -227,9 +227,9 @@ Q_SIGNALS:
protected:
bool isComponentComplete() const;
- virtual void childrenChanged();
virtual bool sceneEventFilter(QGraphicsItem *, QEvent *);
virtual bool sceneEvent(QEvent *);
+ virtual bool event(QEvent *);
virtual QVariant itemChange(GraphicsItemChange, const QVariant &);
virtual bool mouseFilter(QGraphicsSceneMouseEvent *);
virtual void mouseUngrabEvent();
diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h
index 862171b..ae95fb5 100644
--- a/src/declarative/fx/qfxitem_p.h
+++ b/src/declarative/fx/qfxitem_p.h
@@ -77,7 +77,7 @@ public:
_baselineOffset(0),
_componentComplete(true), _keepMouse(false),
_anchorLines(0),
- _stateGroup(0), canvas(0), origin(QFxItem::TopLeft),
+ _stateGroup(0), origin(QFxItem::TopLeft),
options(QFxItem::NoOption),
widthValid(false), heightValid(false), width(0), height(0)
{}
@@ -176,9 +176,6 @@ public:
QmlStateGroup *states();
QmlStateGroup *_stateGroup;
-
- QGraphicsScene *canvas;
-
QFxItem::TransformOrigin origin:4;
int options:10;
bool widthValid:1;
diff --git a/src/declarative/fx/qfxlayouts.cpp b/src/declarative/fx/qfxlayouts.cpp
index da34b8c..836e3e4 100644
--- a/src/declarative/fx/qfxlayouts.cpp
+++ b/src/declarative/fx/qfxlayouts.cpp
@@ -253,9 +253,15 @@ void QFxBaseLayout::componentComplete()
preLayout();
}
-void QFxBaseLayout::childrenChanged()
+QVariant QFxBaseLayout::itemChange(GraphicsItemChange change,
+ const QVariant &value)
{
- preLayout();
+ if (change == ItemChildAddedChange ||
+ change == ItemChildRemovedChange) {
+ preLayout();
+ }
+
+ return QFxItem::itemChange(change, value);
}
bool QFxBaseLayout::event(QEvent *e)
diff --git a/src/declarative/fx/qfxlayouts.h b/src/declarative/fx/qfxlayouts.h
index 03ddf3e..e9c7f51 100644
--- a/src/declarative/fx/qfxlayouts.h
+++ b/src/declarative/fx/qfxlayouts.h
@@ -88,7 +88,7 @@ public:
protected:
virtual void componentComplete();
- virtual void childrenChanged();
+ virtual QVariant itemChange(GraphicsItemChange, const QVariant &);
virtual bool event(QEvent *);
QSet<QFxItem *>* newItems();
QSet<QFxItem *>* leavingItems();