diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-03-17 07:26:50 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-03-17 07:26:50 (GMT) |
commit | fd63689b6202fac71e2b037f70a3ee808ba571ec (patch) | |
tree | 4fb55fc579efe88ebbf85756471ea019d5a2a280 /src/declarative | |
parent | 77d7ed2ca248bfcf6942e6795def38546a91b89b (diff) | |
parent | c8566c74bb9c285e6b7b1cf1d22f7de9077c2e58 (diff) | |
download | Qt-fd63689b6202fac71e2b037f70a3ee808ba571ec.zip Qt-fd63689b6202fac71e2b037f70a3ee808ba571ec.tar.gz Qt-fd63689b6202fac71e2b037f70a3ee808ba571ec.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/util/qdeclarativelistmodel.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 32a996d..5b0a7ea 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -308,7 +308,7 @@ QDeclarativeListModelWorkerAgent *QDeclarativeListModel::agent() return 0; } - m_agent = new QDeclarativeListModelWorkerAgent(this); + m_agent = new QDeclarativeListModelWorkerAgent(this); return m_agent; } @@ -388,8 +388,10 @@ void QDeclarativeListModel::remove(int index) else m_nested->remove(index); - if (!m_isWorkerCopy) + if (!m_isWorkerCopy) { + emit itemsRemoved(index, 1); emit countChanged(this->count()); + } } /*! @@ -617,7 +619,7 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser const QVariant &value = values.at(ii); if(value.userType() == qMetaTypeId<QDeclarativeCustomParserNode>()) { - QDeclarativeCustomParserNode node = + QDeclarativeCustomParserNode node = qvariant_cast<QDeclarativeCustomParserNode>(value); { @@ -664,7 +666,7 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser } else { - QDeclarativeParser::Variant variant = + QDeclarativeParser::Variant variant = qvariant_cast<QDeclarativeParser::Variant>(value); int ref = data.count(); @@ -722,15 +724,15 @@ QByteArray QDeclarativeListModelParser::compile(const QList<QDeclarativeCustomPa } } - int size = sizeof(ListModelData) + - instr.count() * sizeof(ListInstruction) + + int size = sizeof(ListModelData) + + instr.count() * sizeof(ListInstruction) + data.count(); QByteArray rv; rv.resize(size); ListModelData *lmd = (ListModelData *)rv.data(); - lmd->dataOffset = sizeof(ListModelData) + + lmd->dataOffset = sizeof(ListModelData) + instr.count() * sizeof(ListInstruction); lmd->instrCount = instr.count(); for (int ii = 0; ii < instr.count(); ++ii) @@ -916,7 +918,7 @@ QScriptValue FlatListModel::get(int index) const QScriptValue rv = scriptEngine->newObject(); QHash<int, QVariant> row = m_values.at(index); - for (QHash<int, QVariant>::ConstIterator iter = row.begin(); iter != row.end(); ++iter) + for (QHash<int, QVariant>::ConstIterator iter = row.begin(); iter != row.end(); ++iter) rv.setProperty(m_roles.value(iter.key()), qScriptValueFromValue(scriptEngine, iter.value())); return rv; @@ -942,7 +944,7 @@ void FlatListModel::setProperty(int index, const QString& property, const QVaria m_roles.insert(role, property); m_strings.insert(property, role); } else { - role = iter.value(); + role = iter.value(); } roles->append(role); @@ -989,7 +991,7 @@ bool FlatListModel::addValue(const QScriptValue &value, QHash<int, QVariant> *ro m_roles.insert(role, name); iter = m_strings.insert(name, role); if (roles) - roles->append(role); + roles->append(role); } row->insert(*iter, v); } @@ -1043,7 +1045,7 @@ QVariant NestedListModel::valueForNode(ModelNode *node, bool *hasNested) const return QVariant::fromValue(rv); } else { return QVariant(); - } + } } QHash<int,QVariant> NestedListModel::data(int index, const QList<int> &roles, bool *hasNested) const @@ -1053,7 +1055,7 @@ QHash<int,QVariant> NestedListModel::data(int index, const QList<int> &roles, bo QHash<int, QVariant> rv; ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(index)); - if (!node) + if (!node) return rv; for (int ii = 0; ii < roles.count(); ++ii) { @@ -1160,7 +1162,7 @@ bool NestedListModel::append(const QScriptValue& valuemap) QScriptValue NestedListModel::get(int index) const { ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(index)); - if (!node) + if (!node) return 0; QDeclarativeEngine *eng = qmlEngine(m_listModel); if (!eng) { @@ -1216,7 +1218,7 @@ void NestedListModel::checkRoles() const if (!roleStrings.contains(role)) roleStrings.append(role); } - } + } } _rolesOk = true; |