summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-08-06 08:56:09 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-08-06 08:56:09 (GMT)
commit1b599a66e5c22dacd002f33ddaa00a6010e230b2 (patch)
treed21e8c5ba974c3fa47cee7fc3f7fb1ede1e39127
parente3a9cb19d6f83e7e87a4909e0b0761ccd557c372 (diff)
parent59e3430662cfdc3820115a2ff4c0b44829b3d1d4 (diff)
downloadQt-1b599a66e5c22dacd002f33ddaa00a6010e230b2.zip
Qt-1b599a66e5c22dacd002f33ddaa00a6010e230b2.tar.gz
Qt-1b599a66e5c22dacd002f33ddaa00a6010e230b2.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Fix broken example code Top-level QML item should not have special focus handling. Fix index page Remove some warnings
-rw-r--r--doc/src/declarative/declarativeui.qdoc11
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp11
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp15
-rw-r--r--src/declarative/util/qdeclarativepropertymap.cpp19
-rw-r--r--tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp2
5 files changed, 30 insertions, 28 deletions
diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc
index 217e372..1fc9d69 100644
--- a/doc/src/declarative/declarativeui.qdoc
+++ b/doc/src/declarative/declarativeui.qdoc
@@ -41,11 +41,10 @@ and netbooks. Qt Quick consists of the QtDeclarative C++ module, QML, and
the integration of both of these into the Qt Creator IDE. Using the QtDeclarative
C++ module, you can load and interact with QML files from your Qt application.
-QML is an extension to \l
-{http://www.ecma-international.org/publications/standards/Ecma-262.htm}
-{JavaScript}, that provides a mechanism to declaratively build an
-object tree of \l {QML Elements}{QML elements}. QML improves the
-integration between JavaScript and Qt's existing QObject based type
+QML provides mechanisms to declaratively build an object tree using
+\l {QML Elements}{QML elements}. QML improves the integration between
+{http://www.ecma-international.org/publications/standards/Ecma-262.htm}{JavaScript}
+and Qt's existing QObject based type
system, adds support for automatic \l {Property Binding}{property
bindings} and provides \l {Network Transparency}{network transparency}
at the language level.
@@ -87,11 +86,11 @@ application or to build completely new applications. QML is fully \l
\o \l {qdeclarativemodules.html}{Modules}
\o \l {Extending types from QML}
\o \l {qdeclarativedynamicobjects.html}{Dynamic Object Creation}
-\o \l {qmlruntime.html}{The Qt Declarative Runtime}
\endlist
\section1 Using QML with C++
\list
+\o \l {qmlruntime.html}{The Qt Declarative Runtime}
\o \l {Using QML in C++ Applications}
\o \l {Integrating QML with existing Qt UI code}
\o \l {Tutorial: Writing QML extensions with C++}
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
diff --git a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
index b138f61..ec8f048 100644
--- a/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
+++ b/tests/auto/declarative/qdeclarativefocusscope/tst_qdeclarativefocusscope.cpp
@@ -336,7 +336,7 @@ void tst_qdeclarativefocusscope::noParentFocus()
view->setSource(QUrl::fromLocalFile(SRCDIR "/data/chain.qml"));
QVERIFY(view->rootObject());
- QVERIFY(view->rootObject()->property("focus1") == true);
+ QVERIFY(view->rootObject()->property("focus1") == false);
QVERIFY(view->rootObject()->property("focus2") == false);
QVERIFY(view->rootObject()->property("focus3") == true);
QVERIFY(view->rootObject()->property("focus4") == true);