diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-12 07:33:06 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-17 00:20:46 (GMT) |
commit | 4613955f735837d8007f5558db6a07ec5efb9ab5 (patch) | |
tree | 93dc06ae6f9809df003cad39aa37a77dc4bc0790 /src/declarative/qml/qdeclarativeexpression.cpp | |
parent | a88c755e511d3aea726bd0e096621054af18ce01 (diff) | |
download | Qt-4613955f735837d8007f5558db6a07ec5efb9ab5.zip Qt-4613955f735837d8007f5558db6a07ec5efb9ab5.tar.gz Qt-4613955f735837d8007f5558db6a07ec5efb9ab5.tar.bz2 |
Optimization: Use id notifier for QtScript bindings
Diffstat (limited to 'src/declarative/qml/qdeclarativeexpression.cpp')
-rw-r--r-- | src/declarative/qml/qdeclarativeexpression.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp index 5ff22f7..f3299ba 100644 --- a/src/declarative/qml/qdeclarativeexpression.cpp +++ b/src/declarative/qml/qdeclarativeexpression.cpp @@ -656,7 +656,29 @@ void QDeclarativeExpressionPrivate::updateGuards(const QPODVector<QDeclarativeEn guard.target = q; guard.targetMethod = notifyIdx; - if (property.notifyIndex != -1) { + if (property.notifier != 0) { + + if (!noChanges && guard.isConnected(property.notifier)) { + // Nothing to do + + } else { + noChanges = false; + + bool existing = false; + for (int jj = 0; !existing && jj < ii; ++jj) + if (data->guardList[jj].isConnected(property.notifier)) + existing = true; + + if (existing) { + // duplicate + guard.disconnect(); + } else { + guard.connect(property.notifier); + } + } + + + } else if (property.notifyIndex != -1) { if (!noChanges && guard.isConnected(property.object, property.notifyIndex)) { // Nothing to do |