diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-08-24 07:05:49 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-08-24 07:05:49 (GMT) |
commit | 6536f950bb4eb21f769086a9e95bb76e81a39e3c (patch) | |
tree | 2992dd868b3ae491961da535c48cb85b4507f29e /src | |
parent | 2cb91f6371a7918cfe54cc31efe61a39df89ab9e (diff) | |
parent | 0f3d7560855dd83b63ee090ee74b8770163e806c (diff) | |
download | Qt-6536f950bb4eb21f769086a9e95bb76e81a39e3c.zip Qt-6536f950bb4eb21f769086a9e95bb76e81a39e3c.tar.gz Qt-6536f950bb4eb21f769086a9e95bb76e81a39e3c.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src')
13 files changed, 15 insertions, 62 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index ec1b6cf..2e2e08c 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -983,7 +983,7 @@ void QDeclarativeListViewPrivate::updateSections() void QDeclarativeListViewPrivate::updateCurrentSection() { if (!sectionCriteria || visibleItems.isEmpty()) { - currentSection = QString(); + currentSection.clear(); return; } int index = 0; diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 535fb90..4b97505 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -480,7 +480,8 @@ void QDeclarativePathView::setModel(const QVariant &model) connect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); connect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); } - d->offset = qmlMod(d->offset, qreal(d->model->count())); + if (d->model->count()) + d->offset = qmlMod(d->offset, qreal(d->model->count())); if (d->offset < 0) d->offset = d->model->count() + d->offset; d->regenerate(); diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index fcd112e..b96b43c 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -1218,7 +1218,7 @@ void QDeclarativeText::mousePressEvent(QGraphicsSceneMouseEvent *event) if (!d->richText || !d->doc || d->doc->documentLayout()->anchorAt(event->pos()).isEmpty()) { event->setAccepted(false); - d->activeLink = QString(); + d->activeLink.clear(); } else { d->activeLink = d->doc->documentLayout()->anchorAt(event->pos()); } diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 764676a..50a0a33 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -238,20 +238,6 @@ QString QDeclarativeVisualItemModel::stringValue(int index, const QString &name) return QDeclarativeEngine::contextForObject(d->children.at(index).item)->contextProperty(name).toString(); } -QVariant QDeclarativeVisualItemModel::evaluate(int index, const QString &expression, QObject *objectContext) -{ - Q_D(QDeclarativeVisualItemModel); - if (index < 0 || index >= d->children.count()) - return QVariant(); - QDeclarativeContext *ccontext = qmlContext(this); - QDeclarativeContext *ctxt = new QDeclarativeContext(ccontext); - ctxt->setContextObject(d->children.at(index).item); - QDeclarativeExpression e(ctxt, objectContext, expression); - QVariant value = e.evaluate(); - delete ctxt; - return value; -} - int QDeclarativeVisualItemModel::indexOf(QDeclarativeItem *item, QObject *) const { Q_D(const QDeclarativeVisualItemModel); @@ -728,6 +714,7 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model) QObject::disconnect(d->m_abstractItemModel, SIGNAL(rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int)), this, SLOT(_q_rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int))); QObject::disconnect(d->m_abstractItemModel, SIGNAL(modelReset()), this, SLOT(_q_modelReset())); + d->m_abstractItemModel = 0; } else if (d->m_visualItemModel) { QObject::disconnect(d->m_visualItemModel, SIGNAL(itemsInserted(int,int)), this, SIGNAL(itemsInserted(int,int))); @@ -1167,38 +1154,6 @@ QString QDeclarativeVisualDataModel::stringValue(int index, const QString &name) return val; } -QVariant QDeclarativeVisualDataModel::evaluate(int index, const QString &expression, QObject *objectContext) -{ - Q_D(QDeclarativeVisualDataModel); - if (d->m_visualItemModel) - return d->m_visualItemModel->evaluate(index, expression, objectContext); - - if ((!d->m_listModelInterface && !d->m_abstractItemModel) || !d->m_delegate) - return QVariant(); - - QVariant value; - QObject *nobj = d->m_cache.item(index); - if (nobj) { - QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(nobj); - if (item) { - QDeclarativeExpression e(qmlContext(item), objectContext, expression); - value = e.evaluate(); - } - } else { - QDeclarativeContext *ccontext = d->m_context; - if (!ccontext) ccontext = qmlContext(this); - QDeclarativeContext *ctxt = new QDeclarativeContext(ccontext); - QDeclarativeVisualDataModelData *data = new QDeclarativeVisualDataModelData(index, this); - ctxt->setContextObject(data); - QDeclarativeExpression e(ctxt, objectContext, expression); - value = e.evaluate(); - delete data; - delete ctxt; - } - - return value; -} - int QDeclarativeVisualDataModel::indexOf(QDeclarativeItem *item, QObject *) const { QVariant val = QDeclarativeEngine::contextForObject(item)->contextProperty(QLatin1String("index")); diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h index d5c0de2..50d2c53 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h @@ -79,7 +79,6 @@ public: virtual ReleaseFlags release(QDeclarativeItem *item) = 0; virtual bool completePending() const = 0; virtual void completeItem() = 0; - virtual QVariant evaluate(int index, const QString &expression, QObject *objectContext) = 0; virtual QString stringValue(int, const QString &) { return QString(); } virtual int indexOf(QDeclarativeItem *item, QObject *objectContext) const = 0; @@ -122,7 +121,6 @@ public: virtual bool completePending() const; virtual void completeItem(); virtual QString stringValue(int index, const QString &role); - virtual QVariant evaluate(int index, const QString &expression, QObject *objectContext); virtual int indexOf(QDeclarativeItem *item, QObject *objectContext) const; @@ -177,7 +175,6 @@ public: bool completePending() const; void completeItem(); virtual QString stringValue(int index, const QString &role); - QVariant evaluate(int index, const QString &expression, QObject *objectContext); int indexOf(QDeclarativeItem *item, QObject *objectContext) const; diff --git a/src/declarative/qml/parser/qdeclarativejslexer.cpp b/src/declarative/qml/parser/qdeclarativejslexer.cpp index 65a6af2..cd08658 100644 --- a/src/declarative/qml/parser/qdeclarativejslexer.cpp +++ b/src/declarative/qml/parser/qdeclarativejslexer.cpp @@ -120,7 +120,7 @@ Lexer::~Lexer() void Lexer::setCode(const QString &c, int lineno) { - errmsg = QString(); + errmsg.clear(); yylineno = lineno; yycolumn = 1; restrKeyword = false; diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp index 26b2a9b..2e77534 100644 --- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp +++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp @@ -544,7 +544,7 @@ int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData } - foreach (QDeclarativeScriptParser::Import imp, unit->data.imports()) { + foreach (const QDeclarativeScriptParser::Import &imp, unit->data.imports()) { QDeclarativeDirComponents qmldircomponentsnetwork; if (imp.type == QDeclarativeScriptParser::Import::Script) continue; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index cedf9d5..4e45636 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -2079,7 +2079,7 @@ void QDeclarativeEnginePrivate::registerCompositeType(QDeclarativeCompiledData * QByteArray name = data->root->className(); QByteArray ptr = name + '*'; - QByteArray lst = "QDeclarativeListProperty<" + name + ">"; + QByteArray lst = "QDeclarativeListProperty<" + name + '>'; int ptr_type = QMetaType::registerType(ptr.constData(), voidptr_destructor, voidptr_constructor); diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index 8d81b34..5c21ebc 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -338,7 +338,7 @@ QString QDeclarativeImportsPrivate::resolvedUri(const QString &dir_arg, QDeclara qSort(paths.begin(), paths.end(), greaterThan); // Ensure subdirs preceed their parents. QString stableRelativePath = dir; - foreach( QString path, paths) { + foreach(const QString &path, paths) { if (dir.startsWith(path)) { stableRelativePath = dir.mid(path.length()+1); break; diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index 0657f49..0b3b35f 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -543,7 +543,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node) QString typemodifier; if(node->typeModifier) typemodifier = node->typeModifier->asString(); - if (typemodifier == QString()) { + if (typemodifier.isEmpty()) { type = Object::DynamicProperty::Custom; } else if(typemodifier == QLatin1String("list")) { type = Object::DynamicProperty::CustomList; diff --git a/src/declarative/qml/qmetaobjectbuilder.cpp b/src/declarative/qml/qmetaobjectbuilder.cpp index 6e4d7b8..0954248 100644 --- a/src/declarative/qml/qmetaobjectbuilder.cpp +++ b/src/declarative/qml/qmetaobjectbuilder.cpp @@ -1142,7 +1142,7 @@ static QByteArray buildParameterNames if (!parameterNames.isEmpty()) { QByteArray names; bool first = true; - foreach (QByteArray name, parameterNames) { + foreach (const QByteArray &name, parameterNames) { if (first) first = false; else diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 1f66f0f..0162beb 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -570,7 +570,7 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser QList<QDeclarativeCustomParserProperty> props = node.properties(); for(int jj = 0; jj < props.count(); ++jj) { const QDeclarativeCustomParserProperty &nodeProp = props.at(jj); - if (nodeProp.name() == "") { + if (nodeProp.name().isEmpty()) { error(nodeProp, QDeclarativeListModel::tr("ListElement: cannot contain nested elements")); return false; } @@ -658,7 +658,7 @@ QByteArray QDeclarativeListModelParser::compile(const QList<QDeclarativeCustomPa for(int ii = 0; ii < customProps.count(); ++ii) { const QDeclarativeCustomParserProperty &prop = customProps.at(ii); - if(prop.name() != "") { // isn't default property + if(!prop.name().isEmpty()) { // isn't default property error(prop, QDeclarativeListModel::tr("ListModel: undefined property '%1'").arg(QString::fromUtf8(prop.name()))); return QByteArray(); } diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp index fc90baa..6d9563e 100644 --- a/src/declarative/util/qdeclarativestategroup.cpp +++ b/src/declarative/util/qdeclarativestategroup.cpp @@ -272,7 +272,7 @@ void QDeclarativeStateGroup::componentComplete() return; } else if (!d->currentState.isEmpty()) { QString cs = d->currentState; - d->currentState = QString(); + d->currentState.clear(); d->setCurrentStateInternal(cs, true); } } @@ -314,7 +314,7 @@ bool QDeclarativeStateGroupPrivate::updateAutoState() } } if (revert) { - bool rv = currentState != QString(); + bool rv = !currentState.isEmpty(); q->setState(QString()); return rv; } else { |