QQuickRepeater: Use qmlobject_(dis)connect instead of regular (dis)connect.

A bit faster, not that this is the most important case for it.

Change-Id: I3e50bd4a45d2b60c105a9315ccf0b2c34502cb8d
Reviewed-by: Michael Brasser <michael.brasser@live.com>
This commit is contained in:
Robin Burchell 2015-12-31 18:57:17 +01:00
parent a4b2fa94d2
commit 5588eec637
1 changed files with 12 additions and 10 deletions

View File

@ -200,11 +200,12 @@ void QQuickRepeater::setModel(const QVariant &m)
clear();
if (d->model) {
disconnect(d->model, SIGNAL(modelUpdated(QQmlChangeSet,bool)),
this, SLOT(modelUpdated(QQmlChangeSet,bool)));
disconnect(d->model, SIGNAL(createdItem(int,QObject*)), this, SLOT(createdItem(int,QObject*)));
disconnect(d->model, SIGNAL(initItem(int,QObject*)), this, SLOT(initItem(int,QObject*)));
// disconnect(d->model, SIGNAL(destroyingItem(QObject*)), this, SLOT(destroyingItem(QObject*)));
qmlobject_disconnect(d->model, QQmlInstanceModel, SIGNAL(modelUpdated(QQmlChangeSet,bool)),
this, QQuickRepeater, SLOT(modelUpdated(QQmlChangeSet,bool)));
qmlobject_disconnect(d->model, QQmlInstanceModel, SIGNAL(createdItem(int,QObject*)),
this, QQuickRepeater, SLOT(createdItem(int,QObject*)));
qmlobject_disconnect(d->model, QQmlInstanceModel, SIGNAL(initItem(int,QObject*)),
this, QQuickRepeater, SLOT(initItem(int,QObject*)));
}
d->dataSource = model;
QObject *object = qvariant_cast<QObject*>(model);
@ -228,11 +229,12 @@ void QQuickRepeater::setModel(const QVariant &m)
dataModel->setModel(model);
}
if (d->model) {
connect(d->model, SIGNAL(modelUpdated(QQmlChangeSet,bool)),
this, SLOT(modelUpdated(QQmlChangeSet,bool)));
connect(d->model, SIGNAL(createdItem(int,QObject*)), this, SLOT(createdItem(int,QObject*)));
connect(d->model, SIGNAL(initItem(int,QObject*)), this, SLOT(initItem(int,QObject*)));
// connect(d->model, SIGNAL(destroyingItem(QObject*)), this, SLOT(destroyingItem(QObject*)));
qmlobject_connect(d->model, QQmlInstanceModel, SIGNAL(modelUpdated(QQmlChangeSet,bool)),
this, QQuickRepeater, SLOT(modelUpdated(QQmlChangeSet,bool)));
qmlobject_connect(d->model, QQmlInstanceModel, SIGNAL(createdItem(int,QObject*)),
this, QQuickRepeater, SLOT(createdItem(int,QObject*)));
qmlobject_connect(d->model, QQmlInstanceModel, SIGNAL(initItem(int,QObject*)),
this, QQuickRepeater, SLOT(initItem(int,QObject*)));
regenerate();
}
emit modelChanged();