if (!d->ownModel) {
d->model = new QSGVisualDataModel(qmlContext(this), this);
d->ownModel = true;
+ if (isComponentComplete())
+ static_cast<QSGVisualDataModel *>(d->model.data())->componentComplete();
} else {
d->model = oldModel;
}
void QSGItemView::componentComplete()
{
Q_D(QSGItemView);
+ if (d->model && d->ownModel)
+ static_cast<QSGVisualDataModel *>(d->model.data())->componentComplete();
+
QSGFlickable::componentComplete();
updateSections();
d->moveReason = QSGItemViewPrivate::Other;
d->fixupPosition();
}
+ if (d->model && d->model->count())
+ emit countChanged();
}
if (!d->ownModel) {
d->model = new QSGVisualDataModel(qmlContext(this));
d->ownModel = true;
+ if (isComponentComplete())
+ static_cast<QSGVisualDataModel *>(d->model.data())->componentComplete();
}
if (QSGVisualDataModel *dataModel = qobject_cast<QSGVisualDataModel*>(d->model))
dataModel->setModel(model);
void QSGPathView::componentComplete()
{
Q_D(QSGPathView);
+ if (d->model && d->ownModel)
+ static_cast<QSGVisualDataModel *>(d->model.data())->componentComplete();
+
QSGItem::componentComplete();
+
d->createHighlight();
// It is possible that a refill has already happended to to Path
// bindings being handled in the componentComplete(). If so
d->regenerate();
}
d->updateHighlight();
+
+ if (d->modelCount)
+ emit countChanged();
}
void QSGPathView::refill()
if (!d->ownModel) {
d->model = new QSGVisualDataModel(qmlContext(this));
d->ownModel = true;
+ if (isComponentComplete())
+ static_cast<QSGVisualDataModel *>(d->model)->componentComplete();
}
if (QSGVisualDataModel *dataModel = qobject_cast<QSGVisualDataModel*>(d->model))
dataModel->setModel(model);
void QSGRepeater::componentComplete()
{
+ Q_D(QSGRepeater);
+ if (d->model && d->ownModel)
+ static_cast<QSGVisualDataModel *>(d->model)->componentComplete();
QSGItem::componentComplete();
regenerate();
+ if (d->model && d->model->count())
+ emit countChanged();
}
void QSGRepeater::itemChange(ItemChange change, const ItemChangeData &value)
{
Q_D(QSGVisualDataModel);
d->init();
- componentComplete();
}
QSGVisualDataModel::~QSGVisualDataModel()
&inserts);
d->itemsInserted(inserts);
d->emitChanges();
+
+ if (d->m_adaptorModel->canFetchMore())
+ QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
}
/*!
{
Q_D(QSGVisualDataModel);
d->m_adaptorModel->setModel(model, d->m_context ? d->m_context->engine() : qmlEngine(this));
- if (d->m_adaptorModel->canFetchMore())
+ if (d->m_complete && d->m_adaptorModel->canFetchMore())
QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
}
import QtQuick 2.0
GridView {
- width: 400
+ width: 405
height: 200
cellWidth: width/9
cellHeight: height/2
QSGGridView *view = qobject_cast<QSGGridView*>(canvas.rootObject());
- QCOMPARE(view->cellWidth(), qreal(400)/qreal(9));
+ QCOMPARE(view->cellWidth(), qreal(405)/qreal(9));
QCOMPARE(view->cellHeight(), qreal(100));
QList<QSGItem*> items = findItems<QSGItem>(view, "delegate");