diff options
Diffstat (limited to 'src/declarative/graphicsitems/qmlgraphicsrepeater.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsrepeater.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp index 0c27f4c..fc78ef8 100644 --- a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp @@ -60,8 +60,6 @@ QmlGraphicsRepeaterPrivate::~QmlGraphicsRepeaterPrivate() delete model; } -QML_DEFINE_TYPE(Qt,4,6,Repeater,QmlGraphicsRepeater) - /*! \qmlclass Repeater QmlGraphicsRepeater \inherits Item @@ -159,6 +157,9 @@ QVariant QmlGraphicsRepeater::model() const void QmlGraphicsRepeater::setModel(const QVariant &model) { Q_D(QmlGraphicsRepeater); + if (d->dataSource == model) + return; + clear(); if (d->model) { disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); @@ -170,6 +171,7 @@ void QmlGraphicsRepeater::setModel(const QVariant &model) */ } d->dataSource = model; + emit modelChanged(); QObject *object = qvariant_cast<QObject*>(model); QmlGraphicsVisualModel *vim = 0; if (object && (vim = qobject_cast<QmlGraphicsVisualModel *>(object))) { @@ -221,6 +223,10 @@ QmlComponent *QmlGraphicsRepeater::delegate() const void QmlGraphicsRepeater::setDelegate(QmlComponent *delegate) { Q_D(QmlGraphicsRepeater); + if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model)) + if (delegate == dataModel->delegate()) + return; + if (!d->ownModel) { d->model = new QmlGraphicsVisualDataModel(qmlContext(this)); d->ownModel = true; @@ -228,6 +234,7 @@ void QmlGraphicsRepeater::setDelegate(QmlComponent *delegate) if (QmlGraphicsVisualDataModel *dataModel = qobject_cast<QmlGraphicsVisualDataModel*>(d->model)) { dataModel->setDelegate(delegate); regenerate(); + emit delegateChanged(); } } |