summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-04-27 02:36:47 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-04-27 02:36:47 (GMT)
commitab7a0034af5f775fffc6003412bc895148181a87 (patch)
treefd8059b749c387f70b7c17d42954ae1868703633 /src
parent04a2350db6ef1fffa3c81c747b4474e92d1af70d (diff)
parent95fa13fe7cd28629567edf8d7cf6adbeb9b111aa (diff)
downloadQt-ab7a0034af5f775fffc6003412bc895148181a87.zip
Qt-ab7a0034af5f775fffc6003412bc895148181a87.tar.gz
Qt-ab7a0034af5f775fffc6003412bc895148181a87.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp30
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h3
4 files changed, 37 insertions, 12 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index f8b773e..f79a853 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -375,9 +375,11 @@ FxGridItem *QDeclarativeGridViewPrivate::createItem(int modelIndex)
if (QDeclarativeItem *item = model->item(modelIndex, false)) {
listItem = new FxGridItem(item, q);
listItem->index = modelIndex;
- listItem->item->setZValue(1);
- // complete
- model->completeItem();
+ if (model->completePending()) {
+ // complete
+ listItem->item->setZValue(1);
+ model->completeItem();
+ }
listItem->item->setParentItem(q->viewport());
unrequestedItems.remove(listItem->item);
}
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 60e8f6c..c88dab2 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -570,9 +570,11 @@ FxListItem *QDeclarativeListViewPrivate::createItem(int modelIndex)
listItem->attached->m_prevSection = sectionAt(modelIndex-1);
}
}
- listItem->item->setZValue(1);
- // complete
- model->completeItem();
+ if (model->completePending()) {
+ // complete
+ listItem->item->setZValue(1);
+ model->completeItem();
+ }
listItem->item->setParentItem(q->viewport());
QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item));
itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index e2d8bc7..43cafe3 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -176,6 +176,11 @@ QDeclarativeVisualModel::ReleaseFlags QDeclarativeVisualItemModel::release(QDecl
return 0;
}
+bool QDeclarativeVisualItemModel::completePending() const
+{
+ return false;
+}
+
void QDeclarativeVisualItemModel::completeItem()
{
// Nothing to do
@@ -352,9 +357,10 @@ public:
VDMDelegateDataType *m_delegateDataType;
friend class QDeclarativeVisualDataModelData;
- bool m_metaDataCreated;
- bool m_metaDataCacheable;
- bool m_delegateValidated;
+ bool m_metaDataCreated : 1;
+ bool m_metaDataCacheable : 1;
+ bool m_delegateValidated : 1;
+ bool m_completePending : 1;
QDeclarativeVisualDataModelData *data(QObject *item);
@@ -567,7 +573,7 @@ QDeclarativeVisualDataModelParts::QDeclarativeVisualDataModelParts(QDeclarativeV
QDeclarativeVisualDataModelPrivate::QDeclarativeVisualDataModelPrivate(QDeclarativeContext *ctxt)
: m_listModelInterface(0), m_abstractItemModel(0), m_visualItemModel(0), m_delegate(0)
, m_context(ctxt), m_parts(0), m_delegateDataType(0), m_metaDataCreated(false)
-, m_metaDataCacheable(false), m_delegateValidated(false), m_listAccessor(0)
+, m_metaDataCacheable(false), m_delegateValidated(false), m_completePending(false), m_listAccessor(0)
{
}
@@ -1026,11 +1032,14 @@ QDeclarativeItem *QDeclarativeVisualDataModel::item(int index, const QByteArray
QDeclarativeVisualDataModelData *data = new QDeclarativeVisualDataModelData(index, this);
ctxt->setContextProperty(QLatin1String("model"), data);
ctxt->setContextObject(data);
+ d->m_completePending = false;
nobj = d->m_delegate->beginCreate(ctxt);
- if (complete)
+ if (complete) {
d->m_delegate->completeCreate();
- else
+ } else {
+ d->m_completePending = true;
needComplete = true;
+ }
if (nobj) {
QDeclarative_setParent_noEvent(ctxt, nobj);
QDeclarative_setParent_noEvent(data, nobj);
@@ -1066,6 +1075,14 @@ QDeclarativeItem *QDeclarativeVisualDataModel::item(int index, const QByteArray
return item;
}
+bool QDeclarativeVisualDataModel::completePending() const
+{
+ Q_D(const QDeclarativeVisualDataModel);
+ if (d->m_visualItemModel)
+ return d->m_visualItemModel->completePending();
+ return d->m_completePending;
+}
+
void QDeclarativeVisualDataModel::completeItem()
{
Q_D(QDeclarativeVisualDataModel);
@@ -1075,6 +1092,7 @@ void QDeclarativeVisualDataModel::completeItem()
}
d->m_delegate->completeCreate();
+ d->m_completePending = false;
}
QString QDeclarativeVisualDataModel::stringValue(int index, const QString &name)
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h
index 0a9173f..edfd387 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h
@@ -82,6 +82,7 @@ public:
virtual bool isValid() const = 0;
virtual QDeclarativeItem *item(int index, bool complete=true) = 0;
virtual ReleaseFlags release(QDeclarativeItem *item) = 0;
+ virtual bool completePending() const = 0;
virtual void completeItem() = 0;
virtual QVariant evaluate(int index, const QString &expression, QObject *objectContext) = 0;
virtual QString stringValue(int, const QString &) { return QString(); }
@@ -123,6 +124,7 @@ public:
virtual bool isValid() const;
virtual QDeclarativeItem *item(int index, bool complete=true);
virtual ReleaseFlags release(QDeclarativeItem *item);
+ virtual bool completePending() const;
virtual void completeItem();
virtual QString stringValue(int index, const QString &role);
virtual QVariant evaluate(int index, const QString &expression, QObject *objectContext);
@@ -177,6 +179,7 @@ public:
QDeclarativeItem *item(int index, bool complete=true);
QDeclarativeItem *item(int index, const QByteArray &, bool complete=true);
ReleaseFlags release(QDeclarativeItem *item);
+ bool completePending() const;
void completeItem();
virtual QString stringValue(int index, const QString &role);
QVariant evaluate(int index, const QString &expression, QObject *objectContext);