diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-11-13 03:36:01 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-11-13 03:36:01 (GMT) |
commit | cd2187091e6b357c79f4e0db0a14f210df79f3fd (patch) | |
tree | 0f5b0416a605d169f3a2024c53032103340f08b7 /src/declarative/widgets/graphicswidgets.cpp | |
parent | f21957b3bb12a16a905f79f3a791931eb77663d9 (diff) | |
download | Qt-cd2187091e6b357c79f4e0db0a14f210df79f3fd.zip Qt-cd2187091e6b357c79f4e0db0a14f210df79f3fd.tar.gz Qt-cd2187091e6b357c79f4e0db0a14f210df79f3fd.tar.bz2 |
Cleanup.
Diffstat (limited to 'src/declarative/widgets/graphicswidgets.cpp')
-rw-r--r-- | src/declarative/widgets/graphicswidgets.cpp | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/declarative/widgets/graphicswidgets.cpp b/src/declarative/widgets/graphicswidgets.cpp index 5678520..40ba93e 100644 --- a/src/declarative/widgets/graphicswidgets.cpp +++ b/src/declarative/widgets/graphicswidgets.cpp @@ -43,7 +43,6 @@ QT_BEGIN_NAMESPACE -//### the single (default) property could alternatively be added to graphics view directly class QGraphicsViewDeclarativeUI : public QObject { Q_OBJECT @@ -83,27 +82,23 @@ private: virtual void clear() { for (int i = 0; i < count(); ++i) - if (QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(at(i))) - static_cast<QGraphicsScene *>(q)->removeItem(w); + if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(at(i))) + static_cast<QGraphicsScene *>(q)->removeItem(go); QmlConcreteList<QObject *>::clear(); } virtual void removeAt(int i) { - if (QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(at(i))) - static_cast<QGraphicsScene *>(q)->removeItem(w); + if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(at(i))) + static_cast<QGraphicsScene *>(q)->removeItem(go); QmlConcreteList<QObject *>::removeAt(i); } virtual void insert(int i, QObject *o) { QmlConcreteList<QObject *>::insert(i, o); - - //XXX are there any cases when insertion should be different from appension? - if (QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(o)) - static_cast<QGraphicsScene *>(q)->addItem(w); + if (QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o)) + static_cast<QGraphicsScene *>(q)->addItem(go); //else if (QWidget *w = qobject_cast<QWidget *>(o)) // static_cast<QGraphicsScene *>(q)->addWidget(w); - //else - // qWarning() << "Can't add" << o << "to a QGraphicsScene"; } private: QObject *q; @@ -139,11 +134,6 @@ private: wid->setParentItem(static_cast<QGraphicsWidget *>(parent())); } - //### - void clearWidget() - { - } - class WidgetList : public QmlConcreteList<QGraphicsItem *> { public: @@ -151,8 +141,8 @@ private: : obj(o) {} virtual void append(QGraphicsItem *w) { QmlConcreteList<QGraphicsItem *>::append(w); obj->setItemParent(w); } - virtual void clear() { QmlConcreteList<QGraphicsItem *>::clear(); obj->clearWidget(); } - virtual void removeAt(int i) { QmlConcreteList<QGraphicsItem *>::removeAt(i); } //XXX + virtual void clear() { QmlConcreteList<QGraphicsItem *>::clear(); } //### + virtual void removeAt(int i) { QmlConcreteList<QGraphicsItem *>::removeAt(i); } //### virtual void insert(int i, QGraphicsItem *item) { QmlConcreteList<QGraphicsItem *>::insert(i, item); obj->setItemParent(item); } private: |