diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-12-01 13:03:31 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-01 05:43:05 +0100 |
commit | e6bafe10966f9faa649befcbee4620470ddd31ef (patch) | |
tree | 913272ab9a97d07ceb080ef5140215be730b9d71 /src | |
parent | 51f869699ed4e91860ee58579832ec986a971f12 (diff) |
Repeater delegates have no parent in Component.onCompleted
Task-number: QTBUG-22279
Change-Id: I5c0b4a9becfee06dfc4a52e546ad81fb0b6f238a
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/items/qquickrepeater.cpp | 10 | ||||
-rw-r--r-- | src/declarative/items/qquickrepeater_p.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/declarative/items/qquickrepeater.cpp b/src/declarative/items/qquickrepeater.cpp index f207afdcae..efa83eec38 100644 --- a/src/declarative/items/qquickrepeater.cpp +++ b/src/declarative/items/qquickrepeater.cpp @@ -189,6 +189,7 @@ void QQuickRepeater::setModel(const QVariant &model) disconnect(d->model, SIGNAL(modelUpdated(QDeclarativeChangeSet,bool)), this, SLOT(modelUpdated(QDeclarativeChangeSet,bool))); disconnect(d->model, SIGNAL(createdItem(int,QQuickItem*)), this, SLOT(createdItem(int,QQuickItem*))); + disconnect(d->model, SIGNAL(initItem(int,QQuickItem*)), this, SLOT(initItem(int,QQuickItem*))); // disconnect(d->model, SIGNAL(destroyingItem(QQuickItem*)), this, SLOT(destroyingItem(QQuickItem*))); } d->dataSource = model; @@ -214,6 +215,7 @@ void QQuickRepeater::setModel(const QVariant &model) connect(d->model, SIGNAL(modelUpdated(QDeclarativeChangeSet,bool)), this, SLOT(modelUpdated(QDeclarativeChangeSet,bool))); connect(d->model, SIGNAL(createdItem(int,QQuickItem*)), this, SLOT(createdItem(int,QQuickItem*))); + connect(d->model, SIGNAL(initItem(int,QQuickItem*)), this, SLOT(initItem(int,QQuickItem*))); // connect(d->model, SIGNAL(destroyingItem(QQuickItem*)), this, SLOT(destroyingItem(QQuickItem*))); regenerate(); } @@ -397,13 +399,19 @@ void QQuickRepeaterPrivate::createItems() inRequest = false; } -void QQuickRepeater::createdItem(int index, QQuickItem *item) +void QQuickRepeater::createdItem(int, QQuickItem *) { Q_D(QQuickRepeater); if (!d->inRequest) d->createItems(); } +void QQuickRepeater::initItem(int, QQuickItem *item) +{ + QDeclarative_setParent_noEvent(item, parentItem()); + item->setParentItem(parentItem()); +} + void QQuickRepeater::modelUpdated(const QDeclarativeChangeSet &changeSet, bool reset) { Q_D(QQuickRepeater); diff --git a/src/declarative/items/qquickrepeater_p.h b/src/declarative/items/qquickrepeater_p.h index 6da6adb989..5b90d74e65 100644 --- a/src/declarative/items/qquickrepeater_p.h +++ b/src/declarative/items/qquickrepeater_p.h @@ -95,6 +95,7 @@ protected: private Q_SLOTS: void createdItem(int index, QQuickItem *item); + void initItem(int, QQuickItem *item); void modelUpdated(const QDeclarativeChangeSet &changeSet, bool reset); private: |