diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-08-09 08:26:47 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-08-09 08:26:47 (GMT) |
commit | cfe96b7c99cb12a666111c7861aba74d535adc89 (patch) | |
tree | eda2c872b4446b8b4796162ea46c86a4ba171cc9 /src/declarative | |
parent | 86eec3f6f98b387bf6a815c1a8e916965928b317 (diff) | |
parent | 1d09376c4eec88ba94f00a4b045fc425c5f51346 (diff) | |
download | Qt-cfe96b7c99cb12a666111c7861aba74d535adc89.zip Qt-cfe96b7c99cb12a666111c7861aba74d535adc89.tar.gz Qt-cfe96b7c99cb12a666111c7861aba74d535adc89.tar.bz2 |
Merge remote branch 'origin/4.7' into oslo-staging-2/4.7
Conflicts:
doc/src/index.qdoc
src/dbus/qdbusconnection.cpp
src/gui/s60framework/qs60mainapplication.cpp
src/gui/s60framework/qs60mainappui.cpp
src/network/access/qnetworkrequest.cpp
src/network/bearer/qnetworkconfiguration.h
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitem.cpp | 11 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativecompiler.cpp | 15 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativepropertymap.cpp | 19 |
3 files changed, 24 insertions, 21 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 5b74129..ff05997 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -3196,8 +3196,7 @@ bool QDeclarativeItem::hasActiveFocus() const { Q_D(const QDeclarativeItem); return focusItem() == this || - (d->flags & QGraphicsItem::ItemIsFocusScope && focusItem() != 0) || - (!parentItem() && focusItem() != 0); + (d->flags & QGraphicsItem::ItemIsFocusScope && focusItem() != 0); } /*! @@ -3217,10 +3216,8 @@ bool QDeclarativeItem::hasActiveFocus() const } \endqml - For the purposes of this property, the top level item in the scene - is assumed to act like a focus scope, and to always have active focus - when the scene has focus. On a practical level, that means the following - QML will give active focus to \c input on startup. + For the purposes of this property, the scene as a whole is assumed to act like a focus scope. + On a practical level, that means the following QML will give active focus to \c input on startup. \qml Rectangle { @@ -3246,7 +3243,7 @@ bool QDeclarativeItem::hasFocus() const p = p->parentItem(); } - return hasActiveFocus() ? true : (!QGraphicsItem::parentItem() ? true : false); + return hasActiveFocus(); } /*! \internal */ diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index ba757fc..2b4a4a5 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -2215,10 +2215,11 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) if (propNames.contains(prop.name)) COMPILE_EXCEPTION(&prop, tr("Duplicate property name")); - if (QString::fromUtf8(prop.name).at(0).isUpper()) + QString propName = QString::fromUtf8(prop.name); + if (propName.at(0).isUpper()) COMPILE_EXCEPTION(&prop, tr("Property names cannot begin with an upper case letter")); - if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(prop.name)) + if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(propName)) COMPILE_EXCEPTION(&prop, tr("Illegal property name")); propNames.insert(prop.name); @@ -2228,9 +2229,10 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) QByteArray name = obj->dynamicSignals.at(ii).name; if (methodNames.contains(name)) COMPILE_EXCEPTION(obj, tr("Duplicate signal name")); - if (QString::fromUtf8(name).at(0).isUpper()) + QString nameStr = QString::fromUtf8(name); + if (nameStr.at(0).isUpper()) COMPILE_EXCEPTION(obj, tr("Signal names cannot begin with an upper case letter")); - if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(name)) + if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(nameStr)) COMPILE_EXCEPTION(obj, tr("Illegal signal name")); methodNames.insert(name); } @@ -2238,9 +2240,10 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) QByteArray name = obj->dynamicSlots.at(ii).name; if (methodNames.contains(name)) COMPILE_EXCEPTION(obj, tr("Duplicate method name")); - if (QString::fromUtf8(name).at(0).isUpper()) + QString nameStr = QString::fromUtf8(name); + if (nameStr.at(0).isUpper()) COMPILE_EXCEPTION(obj, tr("Method names cannot begin with an upper case letter")); - if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(name)) + if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(nameStr)) COMPILE_EXCEPTION(obj, tr("Illegal method name")); methodNames.insert(name); } diff --git a/src/declarative/util/qdeclarativepropertymap.cpp b/src/declarative/util/qdeclarativepropertymap.cpp index 919727f..6b43040 100644 --- a/src/declarative/util/qdeclarativepropertymap.cpp +++ b/src/declarative/util/qdeclarativepropertymap.cpp @@ -104,22 +104,25 @@ void QDeclarativePropertyMapMetaObject::propertyCreated(int, QMetaPropertyBuilde The following example shows how you might declare data in C++ and then access it in QML. - Setup in C++: + In the C++ file: \code - //create our data + // create our data QDeclarativePropertyMap ownerData; ownerData.insert("name", QVariant(QString("John Smith"))); ownerData.insert("phone", QVariant(QString("555-5555"))); - //expose it to the UI layer - QDeclarativeContext *ctxt = view->rootContext(); - ctxt->setProperty("owner", &data); + // expose it to the UI layer + QDeclarativeView view; + QDeclarativeContext *ctxt = view.rootContext(); + ctxt->setContextProperty("owner", &ownerData); + + view.setSource(QUrl::fromLocalFile("main.qml")); + view.show(); \endcode - Then, in QML: + Then, in \c main.qml: \code - Text { text: owner.name } - Text { text: owner.phone } + Text { text: owner.name + " " + owner.phone } \endcode The binding is dynamic - whenever a key's value is updated, anything bound to that |