summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-03-30 03:28:43 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-03-30 03:41:08 (GMT)
commit68d3e2da7719ff0fc230e8204946b27018e42c14 (patch)
tree63bfb52ada494e3498f53600787dfd5c1f7f9130
parent8368e041e35ab2a79c79f651a56e6ee53a46549f (diff)
downloadQt-68d3e2da7719ff0fc230e8204946b27018e42c14.zip
Qt-68d3e2da7719ff0fc230e8204946b27018e42c14.tar.gz
Qt-68d3e2da7719ff0fc230e8204946b27018e42c14.tar.bz2
Fix parenting after 6f88388db4e8e202780d789e66664ff824691948.
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp3
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp11
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp10
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.h1
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem_p.h6
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp22
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp5
8 files changed, 31 insertions, 35 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index 98502fd..fb22429 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -137,7 +137,8 @@ QDeclarativeFlickablePrivate::QDeclarativeFlickablePrivate()
void QDeclarativeFlickablePrivate::init()
{
Q_Q(QDeclarativeFlickable);
- viewport->setParent(q);
+ QDeclarative_setParent_noEvent(viewport, q);
+ viewport->setParentItem(q);
static int timelineUpdatedIdx = -1;
static int timelineCompletedIdx = -1;
static int flickableTickedIdx = -1;
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 17f74db..250832b 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -372,7 +372,7 @@ FxGridItem *QDeclarativeGridViewPrivate::createItem(int modelIndex)
listItem->item->setZValue(1);
// complete
model->completeItem();
- listItem->item->setParent(q->viewport());
+ listItem->item->setParentItem(q->viewport());
unrequestedItems.remove(listItem->item);
}
requestedIndex = -1;
@@ -644,7 +644,7 @@ void QDeclarativeGridViewPrivate::createHighlight()
QDeclarativeContext *highlightContext = new QDeclarativeContext(qmlContext(q));
QObject *nobj = highlightComponent->create(highlightContext);
if (nobj) {
- highlightContext->setParent(nobj);
+ QDeclarative_setParent_noEvent(highlightContext, nobj);
item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item)
delete nobj;
@@ -653,10 +653,12 @@ void QDeclarativeGridViewPrivate::createHighlight()
}
} else {
item = new QDeclarativeItem;
- item->setParent(q->viewport());
+ QDeclarative_setParent_noEvent(item, q->viewport());
+ item->setParentItem(q->viewport());
}
if (item) {
- item->setParent(q->viewport());
+ QDeclarative_setParent_noEvent(item, q->viewport());
+ item->setParentItem(q->viewport());
highlight = new FxGridItem(item, q);
highlightXAnimator = new QDeclarativeEaseFollow(q);
highlightXAnimator->setTarget(QDeclarativeProperty(highlight->item, QLatin1String("x")));
@@ -2180,7 +2182,6 @@ void QDeclarativeGridView::modelReset()
void QDeclarativeGridView::createdItem(int index, QDeclarativeItem *item)
{
Q_D(QDeclarativeGridView);
- item->setParentItem(this);
if (d->requestedIndex != index) {
item->setParentItem(this);
d->unrequestedItems.insert(item, index);
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index e8f3652..29490e3 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -1442,14 +1442,6 @@ void QDeclarativeItem::setParentItem(QDeclarativeItem *parent)
}
/*!
- \fn void QDeclarativeItem::setParent(QDeclarativeItem *parent)
- \overload
- Sets both the parent object and parent item to \a parent. This
- function avoids the programming error of calling setParent()
- when you mean setParentItem().
-*/
-
-/*!
Returns the QDeclarativeItem parent of this item.
*/
QDeclarativeItem *QDeclarativeItem::parentItem() const
@@ -1651,7 +1643,7 @@ QRectF QDeclarativeItem::childrenRect()
Q_D(QDeclarativeItem);
if (!d->_contents) {
d->_contents = new QDeclarativeContents;
- d->_contents->setParent(this);
+ QDeclarative_setParent_noEvent(d->_contents, this);
d->_contents->setItem(this);
}
return d->_contents->rectF();
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.h b/src/declarative/graphicsitems/qdeclarativeitem.h
index 712e854..917e480 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem.h
@@ -107,7 +107,6 @@ public:
QDeclarativeItem *parentItem() const;
void setParentItem(QDeclarativeItem *parent);
- void setParent(QDeclarativeItem *parent) { setParentItem(parent); }
QDeclarativeListProperty<QObject> data();
QDeclarativeListProperty<QObject> resources();
diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h
index 10c0c25..2607137 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h
@@ -63,6 +63,7 @@
#include <private/qdeclarativestate_p.h>
#include <private/qdeclarativenullablevalue_p_p.h>
#include <private/qdeclarativenotifier_p.h>
+#include <private/qdeclarativeglobal_p.h>
#include <qdeclarative.h>
#include <qdeclarativecontext.h>
@@ -129,9 +130,10 @@ public:
void init(QDeclarativeItem *parent)
{
Q_Q(QDeclarativeItem);
-
- if (parent)
+ if (parent) {
+ QDeclarative_setParent_noEvent(q, parent);
q->setParentItem(parent);
+ }
_baselineOffset.invalidate();
mouseSetsFocus = false;
}
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 85fcc27..ef8d2fd 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -541,7 +541,7 @@ FxListItem *QDeclarativeListViewPrivate::createItem(int modelIndex)
listItem->item->setZValue(1);
// complete
model->completeItem();
- listItem->item->setParent(q->viewport());
+ listItem->item->setParentItem(q->viewport());
QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item));
itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
if (sectionCriteria && sectionCriteria->delegate()) {
@@ -803,7 +803,7 @@ void QDeclarativeListViewPrivate::createHighlight()
QDeclarativeContext *highlightContext = new QDeclarativeContext(qmlContext(q));
QObject *nobj = highlightComponent->create(highlightContext);
if (nobj) {
- highlightContext->setParent(nobj);
+ QDeclarative_setParent_noEvent(highlightContext, nobj);
item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item)
delete nobj;
@@ -814,7 +814,8 @@ void QDeclarativeListViewPrivate::createHighlight()
item = new QDeclarativeItem;
}
if (item) {
- item->setParent(q->viewport());
+ QDeclarative_setParent_noEvent(item, q->viewport());
+ item->setParentItem(q->viewport());
highlight = new FxListItem(item, q);
if (currentItem && autoHighlight) {
if (orient == QDeclarativeListView::Vertical) {
@@ -880,13 +881,14 @@ void QDeclarativeListViewPrivate::createSection(FxListItem *listItem)
context->setContextProperty(QLatin1String("section"), listItem->attached->m_section);
QObject *nobj = sectionCriteria->delegate()->create(context);
if (nobj) {
- context->setParent(nobj);
+ QDeclarative_setParent_noEvent(context, nobj);
listItem->section = qobject_cast<QDeclarativeItem *>(nobj);
if (!listItem->section) {
delete nobj;
} else {
listItem->section->setZValue(1);
- listItem->section->setParent(q->viewport());
+ QDeclarative_setParent_noEvent(listItem->section, q->viewport());
+ listItem->section->setParentItem(q->viewport());
}
} else {
delete context;
@@ -1002,7 +1004,7 @@ void QDeclarativeListViewPrivate::updateFooter()
QDeclarativeContext *context = new QDeclarativeContext(qmlContext(q));
QObject *nobj = footerComponent->create(context);
if (nobj) {
- context->setParent(nobj);
+ QDeclarative_setParent_noEvent(context, nobj);
item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item)
delete nobj;
@@ -1010,7 +1012,8 @@ void QDeclarativeListViewPrivate::updateFooter()
delete context;
}
if (item) {
- item->setParent(q->viewport());
+ QDeclarative_setParent_noEvent(item, q->viewport());
+ item->setParentItem(q->viewport());
item->setZValue(1);
footer = new FxListItem(item, q);
}
@@ -1039,7 +1042,7 @@ void QDeclarativeListViewPrivate::updateHeader()
QDeclarativeContext *context = new QDeclarativeContext(qmlContext(q));
QObject *nobj = headerComponent->create(context);
if (nobj) {
- context->setParent(nobj);
+ QDeclarative_setParent_noEvent(context, nobj);
item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item)
delete nobj;
@@ -1047,7 +1050,8 @@ void QDeclarativeListViewPrivate::updateHeader()
delete context;
}
if (item) {
- item->setParent(q->viewport());
+ QDeclarative_setParent_noEvent(item, q->viewport());
+ item->setParentItem(q->viewport());
item->setZValue(1);
header = new FxListItem(item, q);
if (visibleItems.isEmpty())
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index 0d62afa..2f1511e 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -301,12 +301,8 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
item = qobject_cast<QGraphicsObject *>(obj);
if (item) {
QDeclarative_setParent_noEvent(ctxt, obj);
- if (QDeclarativeItem* qmlItem = qobject_cast<QDeclarativeItem *>(item)) {
- qmlItem->setParentItem(q);
- } else {
- item->setParentItem(q);
- item->setParent(q);
- }
+ QDeclarative_setParent_noEvent(item, q);
+ item->setParentItem(q);
// item->setFocus(true);
initResize();
} else {
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index dd1edd6..3574c9f 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -188,7 +188,7 @@ void QDeclarativePathViewPrivate::createHighlight()
QDeclarativeContext *highlightContext = new QDeclarativeContext(qmlContext(q));
QObject *nobj = highlightComponent->create(highlightContext);
if (nobj) {
- highlightContext->setParent(nobj);
+ QDeclarative_setParent_noEvent(highlightContext, nobj);
item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item)
delete nobj;
@@ -199,7 +199,8 @@ void QDeclarativePathViewPrivate::createHighlight()
item = new QDeclarativeItem;
}
if (item) {
- item->setParent(q);
+ QDeclarative_setParent_noEvent(item, q);
+ item->setParentItem(q);
highlightItem = item;
changed = true;
}