diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-03-17 02:56:52 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-03-17 02:56:52 (GMT) |
commit | 20470e30d11733ada5443ff993d8518aa14737ca (patch) | |
tree | 81a53040ba43bfb378eeb1a9c4382a887ab8e467 /src/declarative | |
parent | dc829ac31694f382bf7b8a0702f73409762e36f0 (diff) | |
download | Qt-20470e30d11733ada5443ff993d8518aa14737ca.zip Qt-20470e30d11733ada5443ff993d8518aa14737ca.tar.gz Qt-20470e30d11733ada5443ff993d8518aa14737ca.tar.bz2 |
Tests for default count(), get() values should be run on the worker
list model instead of being ignored. Also do some cleaning up in the
list model.
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/util/qdeclarativelistmodel.cpp | 2 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativelistmodelworkeragent.cpp | 7 |
2 files changed, 2 insertions, 7 deletions
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 61e49ce..824e1b5 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -483,7 +483,7 @@ void QDeclarativeListModel::append(const QScriptValue& valuemap) qmlInfo(this) << tr("append: value is not an object"); return; } - + insert(count(), valuemap); } diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp index ee43447..2951262 100644 --- a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp +++ b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp @@ -160,9 +160,6 @@ void QDeclarativeListModelWorkerAgent::insert(int index, const QScriptValue &val QScriptValue QDeclarativeListModelWorkerAgent::get(int index) const { - if (index < 0 || index >= count()) - return m_engine->undefinedValue(); - return m_copy->get(index); } @@ -206,7 +203,7 @@ bool QDeclarativeListModelWorkerAgent::event(QEvent *e) FlatListModel *orig = m_orig->m_flat; FlatListModel *copy = s->list->m_flat; if (!orig || !copy) { - qWarning("QML List worker: cannot synchronize lists"); + qWarning("QML ListModel worker: sync() failed"); return QObject::event(e); } orig->m_roles = copy->m_roles; @@ -233,8 +230,6 @@ bool QDeclarativeListModelWorkerAgent::event(QEvent *e) if (cc) emit m_orig->countChanged(m_copy->count()); - - //qDebug() << "------sync():" << m_copy->count() << s->list->count() << m_orig->count(); } } |