From ce33aa1fd8973cf066d0e5b8fc88971404d6b037 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 14 Oct 2009 15:46:37 +1000 Subject: Fix memory leak and remove redundant ContextIdRole. --- tools/qmldebugger/objectpropertiesview.cpp | 22 ++++++++++++++++------ tools/qmldebugger/objecttree.cpp | 4 ++-- tools/qmldebugger/objecttree.h | 4 ---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/tools/qmldebugger/objectpropertiesview.cpp b/tools/qmldebugger/objectpropertiesview.cpp index 2237fbb..f725194 100644 --- a/tools/qmldebugger/objectpropertiesview.cpp +++ b/tools/qmldebugger/objectpropertiesview.cpp @@ -1,3 +1,5 @@ +#include + #include #include @@ -53,6 +55,9 @@ ObjectPropertiesView::ObjectPropertiesView(QmlEngineDebug *client, QWidget *pare void ObjectPropertiesView::reload(const QmlDebugObjectReference &obj) { + if (m_query) + delete m_query; + m_query = m_client->queryObjectRecursive(obj, this); if (!m_query->isWaiting()) queryFinished(); @@ -63,16 +68,20 @@ void ObjectPropertiesView::reload(const QmlDebugObjectReference &obj) void ObjectPropertiesView::queryFinished() { - if (m_watch) { - m_client->removeWatch(m_watch); - delete m_watch; - m_watch = 0; - } + if (!m_query) + return; QmlDebugObjectReference obj = m_query->object(); QmlDebugWatch *watch = m_client->addWatch(obj, this); - if (watch->state() != QmlDebugWatch::Dead) { + if (watch->state() == QmlDebugWatch::Dead) { + delete watch; + watch = 0; + } else { + if (m_watch) { + m_client->removeWatch(m_watch); + delete m_watch; + } m_watch = watch; QObject::connect(watch, SIGNAL(valueChanged(QByteArray,QVariant)), this, SLOT(valueChanged(QByteArray,QVariant))); @@ -89,6 +98,7 @@ void ObjectPropertiesView::setObject(const QmlDebugObjectReference &object) m_object = object; m_tree->clear(); + QList properties = object.properties(); for (int i=0; isetText(0, obj.className()); item->setData(0, Qt::UserRole, qVariantFromValue(obj)); - item->setData(0, ObjectTree::ContextIdRole, obj.contextDebugId()); if (parent && obj.contextDebugId() >= 0 - && obj.contextDebugId() != parent->data(0, ObjectTree::ContextIdRole).toInt()) { + && obj.contextDebugId() != parent->data(0, Qt::UserRole + ).value().contextDebugId()) { QmlDebugFileReference source = obj.source(); if (!source.url().isEmpty()) { QString toolTipString = QLatin1String("URL: ") + source.url().toString(); diff --git a/tools/qmldebugger/objecttree.h b/tools/qmldebugger/objecttree.h index a924ec5..bba6c08 100644 --- a/tools/qmldebugger/objecttree.h +++ b/tools/qmldebugger/objecttree.h @@ -17,10 +17,6 @@ class ObjectTree : public QTreeWidget { Q_OBJECT public: - enum AdditionalRoles { - ContextIdRole = Qt::UserRole + 1 - }; - ObjectTree(QmlEngineDebug *client, QWidget *parent = 0); signals: -- cgit v0.12 From 2cb6b94e4587f32a109e0b7c2283978f3d78c649 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 14 Oct 2009 16:07:44 +1000 Subject: ParentChange docs --- src/declarative/util/qmlstateoperations.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index 07eb641..60fd421 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -114,7 +114,16 @@ void QmlParentChangePrivate::doChange(QFxItem *targetParent, QFxItem *stackBefor /*! \preliminary \qmlclass ParentChange - \brief The ParentChange element allows you to reparent an object in a state. + \brief The ParentChange element allows you to reparent an Item in a state change. + + ParentChange reparents an Item while preserving its visual appearance (position, rotation, + and scale) on screen. You can then specify a transition to move/rotate/scale the Item to + its final intended appearance. + + ParentChange can only preserve visual appearance if no complex transforms are involved. + More specifically, it will not work if the transform property has been set for any + Items involved in the reparenting (defined as any Items in the common ancestor tree + for the original and new parent). */ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ParentChange,QmlParentChange) -- cgit v0.12