summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@viroteck.net>2015-12-31 18:57:17 +0100
committerRobin Burchell <robin.burchell@viroteck.net>2016-01-05 09:38:44 +0000
commit5588eec637fc521576318753410dca62767dfa85 (patch)
tree18e21a97197d2b7834fc101bceb8429f9f836d58
parenta4b2fa94d28327b83c8a1ddce5741c29cb0a7e0c (diff)
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>
-rw-r--r--src/quick/items/qquickrepeater.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp
index 09b504b742..30fd98a63c 100644
--- a/src/quick/items/qquickrepeater.cpp
+++ b/src/quick/items/qquickrepeater.cpp
@@ -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();