From 86cd2fa6836c90ed329eb1f0507eeb311810c194 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 12 Oct 2009 10:31:59 +1000 Subject: unwarn --- src/declarative/util/qmltimer.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qmltimer.cpp index fdc57ff..3fbe15c 100644 --- a/src/declarative/util/qmltimer.cpp +++ b/src/declarative/util/qmltimer.cpp @@ -207,7 +207,6 @@ void QmlTimer::setTriggeredOnStart(bool triggeredOnStart) */ void QmlTimer::start() { - Q_D(QmlTimer); setRunning(true); } @@ -220,7 +219,6 @@ void QmlTimer::start() */ void QmlTimer::stop() { - Q_D(QmlTimer); setRunning(false); } -- cgit v0.12 From 4a49c007c8344c8baa62b66afd3c9c672cb2611f Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 12 Oct 2009 11:23:48 +1000 Subject: update --- src/declarative/QmlChanges.txt | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index ee5acd4..0df0613 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -1,10 +1,9 @@ QML API Review ============== -The QML API is being reviewed from 17 to 4 September 2009. This -file documents the changes. Note that the changes are incremental, -so a rename A->B for example may be follow by another subseqent -rename B->C, if later reviews override earlier reviews. +The QML API is being reviewed. This file documents the changes. +Note that the changes are incremental, so a rename A->B for example may be followed +by another subsequent rename B->C, if later reviews override earlier reviews. API Changes =========== @@ -95,21 +94,13 @@ ListView: removed currentItemMode. Replaced by highligh range. ListView: removed snapPos. Other Changes: +ids must be lowercase: Text { id: foo }, not Text { id: Foo } Drag: axis becomes an enum with values "XAxis", "YAxis", "XandYAxis" Image: scaleGrid property removed. New item called BorderImage instead. KeyActions: changed to a Keys attached property on any item. KeyProxy: changed to a Keys.forwardTo property on any item. - -Pending Changes -=============== - -Renamed elements: - -Renamed properties: - -Removed Properties: -PropertyAction::property -PropertyAction::target (if possible) - -Additions: -Connection: add "slot" property +Script: now an intrinsic type in the language + - cannot be assigned to properties + - good: Item { Script { ... } } + - bad: Item { resources: Script { ... } } +Script: delay-loaded of the QML file until their source has been loaded (this only effects QML files loaded across the network.) -- cgit v0.12 From 6a4f57c100e8c27bbe8ad3975bd99383063dafa1 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 12 Oct 2009 11:27:26 +1000 Subject: update --- src/declarative/QmlChanges.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 0df0613..6a6c394 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -104,3 +104,4 @@ Script: now an intrinsic type in the language - good: Item { Script { ... } } - bad: Item { resources: Script { ... } } Script: delay-loaded of the QML file until their source has been loaded (this only effects QML files loaded across the network.) +Scope: declared properties shadow a property of the same name (was previously the reverse) -- cgit v0.12 From 6be94173f3f209d785e5787df8440d20ff0f2709 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Oct 2009 13:00:08 +1000 Subject: Use utf8 instead of latin1 where appropriate --- src/declarative/debugger/qmldebug.cpp | 2 +- src/declarative/debugger/qmldebugservice.cpp | 2 +- src/declarative/extra/qbindablemap.cpp | 8 ++++---- src/declarative/fx/qfxpathview.cpp | 2 +- src/declarative/fx/qfxvisualitemmodel.cpp | 14 +++++++------- src/declarative/fx/qfxwebview.cpp | 7 +++---- src/declarative/qml/qmlbasicscript.cpp | 2 +- src/declarative/qml/qmlcompiler.cpp | 14 +++++++------- src/declarative/qml/qmlcompositetypemanager.cpp | 8 ++++---- src/declarative/qml/qmlengine.cpp | 8 ++++---- src/declarative/qml/qmlenginedebug.cpp | 4 ++-- src/declarative/qml/qmlexpression.cpp | 2 +- src/declarative/qml/qmlinfo.cpp | 2 +- src/declarative/qml/qmlintegercache.cpp | 2 +- src/declarative/qml/qmlmetaproperty.cpp | 10 +++++----- src/declarative/qml/qmlobjectscriptclass.cpp | 2 +- src/declarative/qml/qmlpropertycache.cpp | 10 +++++----- src/declarative/qml/qmlscriptparser.cpp | 6 +++--- src/declarative/qml/qmlvme.cpp | 2 +- src/declarative/util/qmlanimation.cpp | 12 ++++++------ src/declarative/util/qmlconnection.cpp | 4 ++-- src/declarative/util/qmllistmodel.cpp | 8 ++++---- 22 files changed, 65 insertions(+), 66 deletions(-) diff --git a/src/declarative/debugger/qmldebug.cpp b/src/declarative/debugger/qmldebug.cpp index a515c1d..1ef7503 100644 --- a/src/declarative/debugger/qmldebug.cpp +++ b/src/declarative/debugger/qmldebug.cpp @@ -276,7 +276,7 @@ QmlDebugPropertyWatch *QmlEngineDebug::addWatch(const QmlDebugPropertyReference QByteArray message; QDataStream ds(&message, QIODevice::WriteOnly); - ds << QByteArray("WATCH_PROPERTY") << queryId << property.objectDebugId() << property.name().toLatin1(); + ds << QByteArray("WATCH_PROPERTY") << queryId << property.objectDebugId() << property.name().toUtf8(); d->client->sendMessage(message); } else { watch->m_state = QmlDebugWatch::Dead; diff --git a/src/declarative/debugger/qmldebugservice.cpp b/src/declarative/debugger/qmldebugservice.cpp index b83a4b1..6913def 100644 --- a/src/declarative/debugger/qmldebugservice.cpp +++ b/src/declarative/debugger/qmldebugservice.cpp @@ -353,7 +353,7 @@ QString QmlDebugService::objectToString(QObject *obj) if(objectName.isEmpty()) objectName = QLatin1String(""); - QString rv = QLatin1String(obj->metaObject()->className()) + + QString rv = QString::fromUtf8(obj->metaObject()->className()) + QLatin1String(": ") + objectName; return rv; diff --git a/src/declarative/extra/qbindablemap.cpp b/src/declarative/extra/qbindablemap.cpp index c8c8ced..5254e2a 100644 --- a/src/declarative/extra/qbindablemap.cpp +++ b/src/declarative/extra/qbindablemap.cpp @@ -58,7 +58,7 @@ public: protected: virtual void propertyWrite(int index) { - map->emitChanged(QLatin1String(name(index))); + map->emitChanged(QString::fromUtf8(name(index))); } private: @@ -130,7 +130,7 @@ QBindableMap::~QBindableMap() void QBindableMap::clearValue(const QString &key) { //m_keys.remove(); //### - m_mo->setValue(key.toLatin1(), QVariant()); + m_mo->setValue(key.toUtf8(), QVariant()); //emit changed(key); } @@ -142,7 +142,7 @@ void QBindableMap::clearValue(const QString &key) */ QVariant QBindableMap::value(const QString &key) const { - return m_mo->value(key.toLatin1()); + return m_mo->value(key.toUtf8()); } /*! @@ -154,7 +154,7 @@ void QBindableMap::setValue(const QString &key, QVariant value) { if (!m_keys.contains(key)) m_keys.append(key); - m_mo->setValue(key.toLatin1(), value); + m_mo->setValue(key.toUtf8(), value); //emit changed(key); } diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index b127f39..c580e98 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -607,7 +607,7 @@ void QFxPathViewPrivate::updateItem(QFxItem *item, qreal percent) { if (QObject *obj = QFxPathView::qmlAttachedProperties(item)) { foreach(const QString &attr, path->attributes()) - static_cast(obj)->setValue(attr.toLatin1(), path->attributeAt(attr, percent)); + static_cast(obj)->setValue(attr.toUtf8(), path->attributeAt(attr, percent)); } QPointF pf = path->pointAt(percent); item->setX(pf.x() - item->width()*item->scale()/2); diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp index 943f909..3a9e5d4 100644 --- a/src/declarative/fx/qfxvisualitemmodel.cpp +++ b/src/declarative/fx/qfxvisualitemmodel.cpp @@ -264,7 +264,7 @@ public: for (QHash::const_iterator it = m_abstractItemModel->roleNames().begin(); it != m_abstractItemModel->roleNames().end(); ++it) { m_roles.append(it.key()); - m_roleNames.insert(QLatin1String(*it), it.key()); + m_roleNames.insert(QString::fromUtf8(*it), it.key()); } if (m_roles.count() == 1) m_roleNames.insert(QLatin1String("modelData"), m_roles.at(0)); @@ -416,11 +416,11 @@ int QFxVisualDataModelDataMetaObject::createProperty(const char *name, const cha if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) { model->ensureRoles(); - if (model->m_roleNames.contains(QLatin1String(name))) + if (model->m_roleNames.contains(QString::fromUtf8(name))) return QmlOpenMetaObject::createProperty(name, type); } else { model->ensureRoles(); - const QLatin1String sname(name); + QString sname = QString::fromUtf8(name); if (model->m_roleNames.contains(sname)) return QmlOpenMetaObject::createProperty(name, type); } @@ -438,7 +438,7 @@ QFxVisualDataModelDataMetaObject::propertyCreated(int, QMetaPropertyBuilder &pro Q_ASSERT(data->m_model); QFxVisualDataModelPrivate *model = QFxVisualDataModelPrivate::get(data->m_model); - QString name = QLatin1String(prop.name()); + QString name = QString::fromUtf8(prop.name()); if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) { if (name == QLatin1String("modelData")) { if (model->m_listAccessor->type() == QmlListAccessor::Instance) { @@ -532,7 +532,7 @@ QFxVisualDataModelPartsMetaObject::propertyCreated(int, QMetaPropertyBuilder &pr QFxVisualDataModel *m = new QFxVisualDataModel; m->setParent(object()); - m->setPart(QLatin1String(prop.name())); + m->setPart(QString::fromUtf8(prop.name())); m->setModel(QVariant::fromValue(static_cast(object())->model)); QVariant var = QVariant::fromValue((QObject *)m); @@ -706,7 +706,7 @@ QFxItem *QFxVisualDataModel::item(int index, bool complete) { Q_D(QFxVisualDataModel); if (d->m_visualItemModel) - return d->m_visualItemModel->item(index, d->m_part.toLatin1(), complete); + return d->m_visualItemModel->item(index, d->m_part.toUtf8(), complete); return item(index, QByteArray(), complete); } @@ -790,7 +790,7 @@ QFxItem *QFxVisualDataModel::item(int index, const QByteArray &viewId, bool comp if (!item) { QmlPackage *package = qobject_cast(nobj); if (package) { - QObject *o = package->part(QLatin1String(viewId)); + QObject *o = package->part(QString::fromUtf8(viewId)); item = qobject_cast(o); if (item) d->m_packaged.insertMulti(item, package); diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index a06e294..f7030ca 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -1325,9 +1325,8 @@ public Q_SLOTS: void qmlLoaded() { if (component->isError()) { - // XXX Could instead give these errors to the WebView to handle. - foreach (QmlError err, component->errors()) - qWarning(err.toString().toLatin1()); + // ### Could instead give these errors to the WebView to handle. + qWarning() << component->errors(); return; } item = qobject_cast(component->create(qmlContext(webview))); @@ -1335,7 +1334,7 @@ public Q_SLOTS: QString jsObjName; for (int i=0; isetProperty(propertyNames[i].toLatin1(),propertyValues[i]); + item->setProperty(propertyNames[i].toUtf8(),propertyValues[i]); if (propertyNames[i] == QLatin1String("objectname")) jsObjName = propertyValues[i]; } diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp index f8ef2e7..a0d749f 100644 --- a/src/declarative/qml/qmlbasicscript.cpp +++ b/src/declarative/qml/qmlbasicscript.cpp @@ -369,7 +369,7 @@ bool QmlBasicScript::compile(const Expression &expression) { if (!expression.expression.asAST()) return false; - QByteArray expr = expression.expression.asScript().toLatin1(); + QByteArray expr = expression.expression.asScript().toUtf8(); const char *src = expr.constData(); QmlBasicScriptCompiler bsc; diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index f33731c..48d3360 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -195,14 +195,14 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop, QString string = v->value.asScript(); if (!prop.isWritable()) - COMPILE_EXCEPTION(v, "Invalid property assignment:" << QLatin1String(prop.name()) << "is a read-only property"); + COMPILE_EXCEPTION(v, "Invalid property assignment:" << QString::fromUtf8(prop.name()) << "is a read-only property"); if (prop.isEnumType()) { int value; if (prop.isFlagType()) { - value = prop.enumerator().keysToValue(string.toLatin1().constData()); + value = prop.enumerator().keysToValue(string.toUtf8().constData()); } else - value = prop.enumerator().keyToValue(string.toLatin1().constData()); + value = prop.enumerator().keyToValue(string.toUtf8().constData()); if (value == -1) COMPILE_EXCEPTION(v, "Invalid property assignment: unknown enumeration"); return true; @@ -336,9 +336,9 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop, if (prop.isEnumType()) { int value; if (prop.isFlagType()) { - value = prop.enumerator().keysToValue(string.toLatin1().constData()); + value = prop.enumerator().keysToValue(string.toUtf8().constData()); } else - value = prop.enumerator().keyToValue(string.toLatin1().constData()); + value = prop.enumerator().keyToValue(string.toUtf8().constData()); instr.type = QmlInstruction::StoreInteger; instr.storeInteger.propertyIndex = prop.propertyIndex(); @@ -595,7 +595,7 @@ bool QmlCompiler::compile(QmlEngine *engine, ref.ref = tref.unit; ref.ref->addref(); } - ref.className = parserRef->name.toLatin1(); + ref.className = parserRef->name.toUtf8(); out->types << ref; } @@ -2520,7 +2520,7 @@ QStringList QmlCompiler::deferredProperties(QmlParser::Object *obj) return QStringList(); QMetaClassInfo classInfo = mo->classInfo(idx); - QStringList rv = QString(QLatin1String(classInfo.value())).split(QLatin1Char(',')); + QStringList rv = QString::fromUtf8(classInfo.value()).split(QLatin1Char(',')); return rv; } diff --git a/src/declarative/qml/qmlcompositetypemanager.cpp b/src/declarative/qml/qmlcompositetypemanager.cpp index 71b4ef0..13bd02c 100644 --- a/src/declarative/qml/qmlcompositetypemanager.cpp +++ b/src/declarative/qml/qmlcompositetypemanager.cpp @@ -119,7 +119,7 @@ QmlCompositeTypeData::toCompiledComponent(QmlEngine *engine) compiledComponent = new QmlCompiledData; compiledComponent->url = imports.baseUrl(); - compiledComponent->name = compiledComponent->url.toString().toLatin1(); // ### + compiledComponent->name = compiledComponent->url.toString().toUtf8(); QmlCompiler compiler; if (!compiler.compile(engine, this, compiledComponent)) { @@ -443,7 +443,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit) int waiting = 0; for (int ii = 0; ii < types.count(); ++ii) { QmlScriptParser::TypeReference *parserRef = types.at(ii); - QByteArray typeName = parserRef->name.toLatin1(); + QByteArray typeName = parserRef->name.toUtf8(); QmlCompositeTypeData::TypeReference ref; @@ -458,7 +458,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit) if (typeNamespace) { QmlError error; error.setUrl(unit->imports.baseUrl()); - error.setDescription(tr("Namespace %1 cannot be used as a type").arg(QLatin1String(typeName))); + error.setDescription(tr("Namespace %1 cannot be used as a type").arg(QString::fromUtf8(typeName))); if (!parserRef->refObjects.isEmpty()) { QmlParser::Object *obj = parserRef->refObjects.first(); error.setLine(obj->location.start.line); @@ -500,7 +500,7 @@ void QmlCompositeTypeManager::compile(QmlCompositeTypeData *unit) { QmlError error; error.setUrl(unit->imports.baseUrl()); - error.setDescription(tr("Type %1 unavailable").arg(QLatin1String(typeName))); + error.setDescription(tr("Type %1 unavailable").arg(QString::fromUtf8(typeName))); if (!parserRef->refObjects.isEmpty()) { QmlParser::Object *obj = parserRef->refObjects.first(); error.setLine(obj->location.start.line); diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index ccdf6cf..c644ccc 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -970,7 +970,7 @@ struct QmlEnginePrivate::ImportedNamespace { int vmin = minversions.at(i); if (isBuiltin.at(i)) { - QByteArray qt = urls.at(i).toLatin1(); + QByteArray qt = urls.at(i).toUtf8(); qt += "/"; qt += type; QmlType *t = QmlMetaType::qmlType(qt,vmaj,vmin); @@ -982,7 +982,7 @@ struct QmlEnginePrivate::ImportedNamespace { return true; } } else { - QUrl url = QUrl(urls.at(i) + QLatin1String("/" + type + ".qml")); + QUrl url = QUrl(urls.at(i) + QLatin1String("/") + QString::fromUtf8(type) + QLatin1String(".qml")); if (vmaj || vmin) { // Check version file - XXX cache these in QmlEngine! QFile qmldir(QUrl(urls.at(i)+QLatin1String("/qmldir")).toLocalFile()); @@ -1101,7 +1101,7 @@ public: if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return)) return true; if (s->urls.count() == 1 && !s->isBuiltin[0] && !s->isLibrary[0] && url_return) { - *url_return = QUrl(s->urls[0]+QLatin1String("/")).resolved(QUrl(QLatin1String(unqualifiedtype + ".qml"))); + *url_return = QUrl(s->urls[0]+QLatin1String("/")).resolved(QUrl(QString::fromUtf8(unqualifiedtype) + QLatin1String(".qml"))); return true; } } @@ -1323,7 +1323,7 @@ bool QmlEnginePrivate::addToImport(Imports* imports, const QString& uri, const Q */ bool QmlEnginePrivate::resolveType(const Imports& imports, const QByteArray& type, QmlType** type_return, QUrl* url_return, int *vmaj, int *vmin, ImportedNamespace** ns_return) const { - ImportedNamespace* ns = imports.d->findNamespace(QLatin1String(type)); + ImportedNamespace* ns = imports.d->findNamespace(QString::fromUtf8(type)); if (ns) { if (qmlImportTrace()) qDebug() << "QmlEngine::resolveType" << type << "is namespace for" << ns->urls; diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp index 16129ee..e20616a 100644 --- a/src/declarative/qml/qmlenginedebug.cpp +++ b/src/declarative/qml/qmlenginedebug.cpp @@ -325,8 +325,8 @@ void QmlEngineDebugServer::propertyChanged(int id, int objectId, const QByteArra QString objectName = o->objectName(); if (objectName.isEmpty()) objectName = QLatin1String(""); - v = QLatin1String(o->metaObject()->className()) + - QLatin1String(": ") + objectName; + v = QString::fromUtf8(o->metaObject()->className()) + + QLatin1String(": ") + objectName; } if (v.isNull()) v = value.toString(); diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index 0de64d9..76ca2c1 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -212,7 +212,7 @@ QString QmlExpression::expression() const { Q_D(const QmlExpression); if (d->data->sse.isValid()) - return QLatin1String(d->data->sse.expression()); + return QString::fromUtf8(d->data->sse.expression()); else return d->data->expression; } diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp index bae1682..e3c0225 100644 --- a/src/declarative/qml/qmlinfo.cpp +++ b/src/declarative/qml/qmlinfo.cpp @@ -95,7 +95,7 @@ QmlInfo::QmlInfo(QObject *object) location += QLatin1String(":"); location += QString::number(ddata->columnNumber); location += QLatin1String(")"); - *this << location.toLatin1().constData(); + *this << qPrintable(location); } else { *this << "(unknown location):"; } diff --git a/src/declarative/qml/qmlintegercache.cpp b/src/declarative/qml/qmlintegercache.cpp index 564faaa..89a18a1 100644 --- a/src/declarative/qml/qmlintegercache.cpp +++ b/src/declarative/qml/qmlintegercache.cpp @@ -87,7 +87,7 @@ QmlIntegerCache *QmlIntegerCache::createForEnums(QmlType *type, QmlEngine *engin QMetaEnum enumerator = mo->enumerator(ii); for (int jj = 0; jj < enumerator.keyCount(); ++jj) { - QString name = QLatin1String(enumerator.key(jj)); + QString name = QString::fromUtf8(enumerator.key(jj)); int value = enumerator.value(jj); if (!name.at(0).isUpper()) diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 8643301..ce4836e 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -174,7 +174,7 @@ void QmlMetaPropertyPrivate::initProperty(QObject *obj, const QString &name) if (typeData) { QmlType *t = 0; - enginePrivate->resolveType(typeData->imports, name.toLatin1(), &t, 0, 0, 0, 0); + enginePrivate->resolveType(typeData->imports, name.toUtf8(), &t, 0, 0, 0, 0); if (t && t->attachedPropertiesFunction()) { attachedFunc = t->index(); } @@ -467,7 +467,7 @@ QStringList QmlMetaProperty::properties(QObject *obj) const QMetaObject *mo = obj->metaObject(); for (int ii = 0; ii < mo->propertyCount(); ++ii) { QMetaProperty prop = mo->property(ii); - rv << QLatin1String(prop.name()); + rv << QString::fromUtf8(prop.name()); } return rv; @@ -487,7 +487,7 @@ QString QmlMetaProperty::name() const else valueType = QmlValueTypeFactory::valueType(d->core.propType); Q_ASSERT(valueType); - rv += QLatin1String(valueType->metaObject()->property(d->valueTypeCoreIdx).name()); + rv += QString::fromUtf8(valueType->metaObject()->property(d->valueTypeCoreIdx).name()); if (!ep) delete valueType; @@ -654,7 +654,7 @@ QMetaMethod QmlMetaPropertyPrivate::findSignal(QObject *obj, const QString &name int methods = mo->methodCount(); for (int ii = methods - 1; ii >= 0; --ii) { QMetaMethod method = mo->method(ii); - QString methodName = QLatin1String(method.signature()); + QString methodName = QString::fromUtf8(method.signature()); int idx = methodName.indexOf(QLatin1Char('(')); methodName = methodName.left(idx); @@ -837,7 +837,7 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data u = value.toUrl(); found = true; } else if (vt == QVariant::ByteArray) { - u = QUrl(QLatin1String(value.toByteArray())); + u = QUrl(QString::fromUtf8(value.toByteArray())); found = true; } else if (vt == QVariant::String) { u = QUrl(value.toString()); diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp index 41573a2..80f2786 100644 --- a/src/declarative/qml/qmlobjectscriptclass.cpp +++ b/src/declarative/qml/qmlobjectscriptclass.cpp @@ -267,7 +267,7 @@ QScriptValue QmlObjectScriptClass::tostring(QScriptContext *context, QScriptEngi if(obj){ QString objectName = obj->objectName(); - ret += QLatin1String(obj->metaObject()->className()); + ret += QString::fromUtf8(obj->metaObject()->className()); ret += QLatin1String("(0x"); ret += QString::number((quintptr)obj,16); diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp index 63ce00c..e00126f 100644 --- a/src/declarative/qml/qmlpropertycache.cpp +++ b/src/declarative/qml/qmlpropertycache.cpp @@ -52,7 +52,7 @@ void QmlPropertyCache::Data::load(const QMetaProperty &p) propType = qMetaTypeId(); coreIndex = p.propertyIndex(); notifyIndex = p.notifySignalIndex(); - name = QLatin1String(p.name()); + name = QString::fromUtf8(p.name()); if (p.isConstant()) flags |= Data::IsConstant; @@ -76,7 +76,7 @@ void QmlPropertyCache::Data::load(const QMetaProperty &p) void QmlPropertyCache::Data::load(const QMetaMethod &m) { - name = QLatin1String(m.signature()); + name = QString::fromUtf8(m.signature()); int parenIdx = name.indexOf(QLatin1Char('(')); Q_ASSERT(parenIdx != -1); name = name.left(parenIdx); @@ -120,7 +120,7 @@ QmlPropertyCache::Data QmlPropertyCache::create(const QMetaObject *metaObject, int methodCount = metaObject->methodCount(); for (int ii = methodCount - 1; ii >= 0; --ii) { QMetaMethod m = metaObject->method(ii); - QString methodName = QLatin1String(m.signature()); + QString methodName = QString::fromUtf8(m.signature()); int parenIdx = methodName.indexOf(QLatin1Char('(')); Q_ASSERT(parenIdx != -1); @@ -151,7 +151,7 @@ QmlPropertyCache *QmlPropertyCache::create(QmlEngine *engine, const QMetaObject cache->indexCache.resize(propCount); for (int ii = propCount - 1; ii >= 0; --ii) { QMetaProperty p = metaObject->property(ii); - QString propName = QLatin1String(p.name()); + QString propName = QString::fromUtf8(p.name()); RData *data = new RData; data->identifier = enginePriv->objectClass->createPersistentIdentifier(propName); @@ -172,7 +172,7 @@ QmlPropertyCache *QmlPropertyCache::create(QmlEngine *engine, const QMetaObject int methodCount = metaObject->methodCount(); for (int ii = methodCount - 1; ii >= 0; --ii) { QMetaMethod m = metaObject->method(ii); - QString methodName = QLatin1String(m.signature()); + QString methodName = QString::fromUtf8(m.signature()); int parenIdx = methodName.indexOf(QLatin1Char('(')); Q_ASSERT(parenIdx != -1); diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index 1c7bf83..57e40b6 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -87,12 +87,12 @@ class ProcessAST: protected AST::Visitor const State &state = top(); if (state.property) { State s(state.property->getValue(), - state.property->getValue()->getProperty(name.toLatin1())); + state.property->getValue()->getProperty(name.toUtf8())); s.property->location = location; push(s); } else { State s(state.object, - state.object->getProperty(name.toLatin1())); + state.object->getProperty(name.toUtf8())); s.property->location = location; push(s); @@ -312,7 +312,7 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName, // XXX this doesn't do anything (_scope never builds up) _scope.append(resolvableObjectType); - obj->typeName = qualifiedNameId().toLatin1(); + obj->typeName = qualifiedNameId().toUtf8(); _scope.removeLast(); obj->location = location; diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index d4921b6..675f5ae 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -515,7 +515,7 @@ QObject *QmlVME::run(QStack &stack, QmlContext *ctxt, int sigIdx = instr.assignSignalObject.signal; const QByteArray &pr = datas.at(sigIdx); - QmlMetaProperty prop(target, QLatin1String(pr)); + QmlMetaProperty prop(target, QString::fromUtf8(pr)); if (prop.type() & QmlMetaProperty::SignalProperty) { QMetaMethod method = QmlMetaType::defaultMethod(assign); diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 247e64c..ed5018d 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -73,7 +73,7 @@ QEasingCurve stringToCurve(const QString &curve) QString easeName = curve.trimmed(); if (!easeName.endsWith(QLatin1Char(')'))) { qWarning("QEasingCurve: Unmatched perenthesis in easing function '%s'", - curve.toLatin1().constData()); + qPrintable(curve)); return easingCurve; } @@ -83,7 +83,7 @@ QEasingCurve stringToCurve(const QString &curve) normalizedCurve = easeName.left(idx); if (!normalizedCurve.startsWith(QLatin1String("ease"))) { qWarning("QEasingCurve: Easing function '%s' must start with 'ease'", - curve.toLatin1().constData()); + qPrintable(curve)); } props = prop_str.split(QLatin1Char(',')); @@ -95,10 +95,10 @@ QEasingCurve stringToCurve(const QString &curve) static int index = QEasingCurve::staticMetaObject.indexOfEnumerator("Type"); static QMetaEnum me = QEasingCurve::staticMetaObject.enumerator(index); - int value = me.keyToValue(normalizedCurve.toLatin1().constData()); + int value = me.keyToValue(normalizedCurve.toUtf8().constData()); if (value < 0) { qWarning("QEasingCurve: Unknown easing curve '%s'", - curve.toLatin1().constData()); + qPrintable(curve)); value = 0; } easingCurve.setType((QEasingCurve::Type)value); @@ -109,7 +109,7 @@ QEasingCurve stringToCurve(const QString &curve) if (sep == -1) { qWarning("QEasingCurve: Improperly specified property in easing function '%s'", - curve.toLatin1().constData()); + qPrintable(curve)); return easingCurve; } @@ -119,7 +119,7 @@ QEasingCurve stringToCurve(const QString &curve) if (propName.isEmpty() || !isOk) { qWarning("QEasingCurve: Improperly specified property in easing function '%s'", - curve.toLatin1().constData()); + qPrintable(curve)); return easingCurve; } diff --git a/src/declarative/util/qmlconnection.cpp b/src/declarative/util/qmlconnection.cpp index c77d0f6..2a7cf6c 100644 --- a/src/declarative/util/qmlconnection.cpp +++ b/src/declarative/util/qmlconnection.cpp @@ -163,7 +163,7 @@ void QmlConnection::connectIfValid() if (lparen >= 0 && d->signal.length() > lparen+2) { QStringList l = d->signal.mid(lparen+1,d->signal.length()-lparen-2).split(QLatin1Char(',')); foreach (const QString &s, l) { - sigparams.append(s.toLatin1()); + sigparams.append(s.toUtf8()); } } QString signalname = d->signal.left(lparen); @@ -172,7 +172,7 @@ void QmlConnection::connectIfValid() int methods = mo->methodCount(); for (int ii = 0; ii < methods; ++ii) { QMetaMethod method = mo->method(ii); - QString methodName = QLatin1String(method.signature()); + QString methodName = QString::fromUtf8(method.signature()); int idx = methodName.indexOf(QLatin1Char('(')); methodName = methodName.left(idx); if (methodName == signalname && (lparen<0 || method.parameterNames() == sigparams)) { diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index 062ab48..4dc9bc5 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -233,7 +233,7 @@ struct ModelNode QHash::iterator it; for (it = properties.begin(); it != properties.end(); ++it) { if (!(*it)->values.isEmpty()) - objectCache->setValue(it.key().toLatin1(), (*it)->values.first()); + objectCache->setValue(it.key().toUtf8(), (*it)->values.first()); } } return objectCache; @@ -252,7 +252,7 @@ struct ModelNode properties.insert(prop,n); } if (objectCache) - objectCache->setValue(prop.toLatin1(), val); + objectCache->setValue(prop.toUtf8(), val); } QmlListModel *modelCache; @@ -709,7 +709,7 @@ bool QmlListModelParser::compileProperty(const QmlCustomParserProperty &prop, QL qvariant_cast(value); int ref = data.count(); - QByteArray d = variant.asScript().toLatin1(); + QByteArray d = variant.asScript().toUtf8(); d.append('\0'); data.append(d); @@ -799,7 +799,7 @@ void QmlListModelParser::setCustomData(QObject *obj, const QByteArray &d) { ModelNode *n = nodes.top(); ModelNode *n2 = new ModelNode; - n->properties.insert(QLatin1String(data + instr.dataIdx), n2); + n->properties.insert(QString::fromUtf8(data + instr.dataIdx), n2); nodes.push(n2); } break; -- cgit v0.12 From 7dba87c897d8723cc61093c1457cb5a7340f3b61 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 12 Oct 2009 13:05:43 +1000 Subject: Fix warnings. --- src/declarative/qml/qmlcompiler.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 12e8101..670e442 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -809,7 +809,7 @@ void QmlCompiler::genObject(QmlParser::Object *obj) if (!obj->metadata.isEmpty()) { QmlInstruction meta; meta.type = QmlInstruction::StoreMetaObject; - meta.line = -1; + meta.line = 0; meta.storeMeta.data = output->indexForByteArray(obj->metadata); meta.storeMeta.aliasData = output->indexForByteArray(obj->synthdata); meta.storeMeta.propertyCache = output->propertyCaches.count(); @@ -822,7 +822,7 @@ void QmlCompiler::genObject(QmlParser::Object *obj) if (!obj->id.isEmpty()) { QmlInstruction id; id.type = QmlInstruction::SetId; - id.line = -1; + id.line = 0; id.setId.value = output->indexForString(obj->id); id.setId.index = obj->idIndex; output->bytecode << id; @@ -832,7 +832,7 @@ void QmlCompiler::genObject(QmlParser::Object *obj) for (int ii = 0; ii < obj->scriptBlocks.count(); ++ii) { QmlInstruction script; script.type = QmlInstruction::StoreScript; - script.line = -1; // ### + script.line = 0; // ### script.storeScript.value = output->indexForString(obj->scriptBlocks.at(ii)); output->bytecode << script; } @@ -997,7 +997,7 @@ void QmlCompiler::genComponent(QmlParser::Object *obj) if (!obj->id.isEmpty()) { QmlInstruction id; id.type = QmlInstruction::SetId; - id.line = -1; + id.line = 0; id.setId.value = output->indexForString(obj->id); id.setId.index = obj->idIndex; output->bytecode << id; -- cgit v0.12 From 55e4d0591a2b18e08519144a416d1fea9a625cd8 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Oct 2009 13:13:08 +1000 Subject: Use utf8 instead of latin1 where appropriate --- src/declarative/qml/qmlxmlhttprequest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qmlxmlhttprequest.cpp b/src/declarative/qml/qmlxmlhttprequest.cpp index 0bc927c..5117a00 100644 --- a/src/declarative/qml/qmlxmlhttprequest.cpp +++ b/src/declarative/qml/qmlxmlhttprequest.cpp @@ -1105,7 +1105,7 @@ void QmlXMLHttpRequest::downloadProgress(qint64 bytes) m_status = m_network->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); m_statusText = - QLatin1String(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray()); + QString::fromUtf8(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray()); // ### We assume if this is called the headers are now available if (m_state < HeadersReceived) { @@ -1127,7 +1127,7 @@ void QmlXMLHttpRequest::error(QNetworkReply::NetworkError error) m_status = m_network->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); m_statusText = - QLatin1String(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray()); + QString::fromUtf8(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray()); m_responseEntityBody = QByteArray(); m_errorFlag = true; @@ -1146,7 +1146,7 @@ void QmlXMLHttpRequest::finished() m_status = m_network->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); m_statusText = - QLatin1String(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray()); + QString::fromUtf8(m_network->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray()); if (m_state < HeadersReceived) { m_state = HeadersReceived; -- cgit v0.12 From 1ea93870fce7ff032053775fb19d42e950dd5ccb Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Oct 2009 13:58:42 +1000 Subject: Composite types should assign to object properties Fixes QT-956 --- src/declarative/qml/qmlcompileddata.cpp | 4 ++-- src/declarative/qml/qmlcompiler.cpp | 16 +++++++++++----- src/declarative/qml/qmlcompiler_p.h | 3 ++- src/declarative/qml/qmlengine.cpp | 6 +++--- src/declarative/qml/qmlmetaproperty.cpp | 13 +++++++++++-- src/declarative/qml/qmlmetaproperty_p.h | 2 ++ .../declarative/qmllanguage/data/CompositeType.qml | 4 ++++ .../declarative/qmllanguage/data/CompositeType2.qml | 5 +++++ .../declarative/qmllanguage/data/CompositeType3.qml | 5 +++++ .../declarative/qmllanguage/data/CompositeType4.qml | 6 ++++++ .../qmllanguage/data/assignCompositeToType.qml | 18 ++++++++++++++++++ tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp | 10 ++++++++++ 12 files changed, 79 insertions(+), 13 deletions(-) create mode 100644 tests/auto/declarative/qmllanguage/data/CompositeType.qml create mode 100644 tests/auto/declarative/qmllanguage/data/CompositeType2.qml create mode 100644 tests/auto/declarative/qmllanguage/data/CompositeType3.qml create mode 100644 tests/auto/declarative/qmllanguage/data/CompositeType4.qml create mode 100644 tests/auto/declarative/qmllanguage/data/assignCompositeToType.qml diff --git a/src/declarative/qml/qmlcompileddata.cpp b/src/declarative/qml/qmlcompileddata.cpp index 8c3c355..7032a3b 100644 --- a/src/declarative/qml/qmlcompileddata.cpp +++ b/src/declarative/qml/qmlcompileddata.cpp @@ -150,7 +150,7 @@ int QmlCompiledData::indexForLocation(const QmlParser::LocationSpan &l) } QmlCompiledData::QmlCompiledData() -: importCache(0) +: importCache(0), root(0) { } @@ -189,7 +189,7 @@ const QMetaObject *QmlCompiledData::TypeReference::metaObject() const return type->metaObject(); } else { Q_ASSERT(component); - return &static_cast(QObjectPrivate::get(component))->cc->root; + return static_cast(QObjectPrivate::get(component))->cc->root; } } diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 48d3360..6d1df6d 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -647,7 +647,13 @@ void QmlCompiler::compileTree(Object *tree) output->importCache = output->imports.cache(engine); Q_ASSERT(tree->metatype); - static_cast(output->root) = *tree->metaObject(); + + if (tree->metadata.isEmpty()) { + output->root = tree->metatype; + } else { + static_cast(output->rootData) = *tree->metaObject(); + output->root = &output->rootData; + } if (!tree->metadata.isEmpty()) QmlEnginePrivate::get(engine)->registerCompositeType(output); } @@ -1905,7 +1911,7 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop, if (propertyMetaObject) { const QMetaObject *c = v->object->metatype; while(c) { - isAssignable |= (c == propertyMetaObject); + isAssignable |= (QmlMetaPropertyPrivate::equal(c, propertyMetaObject)); c = c->superClass(); } } @@ -2101,7 +2107,7 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode) Q_ASSERT(tdata->status == QmlCompositeTypeData::Complete); QmlCompiledData *data = tdata->toCompiledComponent(engine); - customTypeName = data->root.className(); + customTypeName = data->root->className(); } else { customTypeName = qmltype->typeName(); } @@ -2473,7 +2479,7 @@ bool QmlCompiler::canCoerce(int to, QmlParser::Object *from) const QMetaObject *fromMo = from->metaObject(); while (fromMo) { - if (fromMo == toMo) + if (QmlMetaPropertyPrivate::equal(fromMo, toMo)) return true; fromMo = fromMo->superClass(); } @@ -2492,7 +2498,7 @@ bool QmlCompiler::canCoerce(int to, int from) QmlEnginePrivate::get(engine)->rawMetaObjectForType(from); while (fromMo) { - if (fromMo == toMo) + if (QmlMetaPropertyPrivate::equal(fromMo, toMo)) return true; fromMo = fromMo->superClass(); } diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h index 3a35d58..ecf3344 100644 --- a/src/declarative/qml/qmlcompiler_p.h +++ b/src/declarative/qml/qmlcompiler_p.h @@ -104,7 +104,8 @@ public: int type; }; - QAbstractDynamicMetaObject root; + const QMetaObject *root; + QAbstractDynamicMetaObject rootData; QList primitives; QList floatData; QList intData; diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index c644ccc..245ddc0 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -1379,7 +1379,7 @@ static void *voidptr_constructor(const void *v) void QmlEnginePrivate::registerCompositeType(QmlCompiledData *data) { - QByteArray name = data->root.className(); + QByteArray name = data->root->className(); QByteArray ptr = name + "*"; QByteArray lst = "QmlList<" + ptr + ">*"; @@ -1417,7 +1417,7 @@ const QMetaObject *QmlEnginePrivate::rawMetaObjectForType(int t) const { QHash::ConstIterator iter = m_compositeTypes.find(t); if (iter != m_compositeTypes.end()) { - return &(*iter)->root; + return (*iter)->root; } else { return QmlMetaType::rawMetaObjectForType(t); } @@ -1427,7 +1427,7 @@ const QMetaObject *QmlEnginePrivate::metaObjectForType(int t) const { QHash::ConstIterator iter = m_compositeTypes.find(t); if (iter != m_compositeTypes.end()) { - return &(*iter)->root; + return (*iter)->root; } else { return QmlMetaType::metaObjectForType(t); } diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index ce4836e..34c98bf 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -874,7 +874,7 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data const QMetaObject *propMo = QmlMetaType::rawMetaObjectForType(t); while (valMo) { - if (valMo == propMo) + if (equal(valMo, propMo)) break; valMo = valMo->superClass(); } @@ -928,7 +928,7 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data const QMetaObject *objMo = obj->metaObject(); bool found = false; while(!found && objMo) { - if (objMo == mo) + if (equal(objMo, mo)) found = true; else objMo = objMo->superClass(); @@ -1211,4 +1211,13 @@ QmlMetaProperty QmlMetaProperty::createProperty(QObject *obj, return prop; } +/*! + Returns true if lhs and rhs refer to the same metaobject data +*/ +bool QmlMetaPropertyPrivate::equal(const QMetaObject *lhs, const QMetaObject *rhs) +{ + return lhs == rhs || (1 && lhs && rhs && lhs->d.stringdata == rhs->d.stringdata); +} + + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlmetaproperty_p.h b/src/declarative/qml/qmlmetaproperty_p.h index b74aa2d..7288266 100644 --- a/src/declarative/qml/qmlmetaproperty_p.h +++ b/src/declarative/qml/qmlmetaproperty_p.h @@ -106,6 +106,8 @@ public: static quint32 saveValueType(int, int); static quint32 saveProperty(int); + + static bool equal(const QMetaObject *, const QMetaObject *); }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qmllanguage/data/CompositeType.qml b/tests/auto/declarative/qmllanguage/data/CompositeType.qml new file mode 100644 index 0000000..8c5094b --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/CompositeType.qml @@ -0,0 +1,4 @@ +import Qt 4.6 + +Object { +} diff --git a/tests/auto/declarative/qmllanguage/data/CompositeType2.qml b/tests/auto/declarative/qmllanguage/data/CompositeType2.qml new file mode 100644 index 0000000..86210e9 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/CompositeType2.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyQmlObject { +} + diff --git a/tests/auto/declarative/qmllanguage/data/CompositeType3.qml b/tests/auto/declarative/qmllanguage/data/CompositeType3.qml new file mode 100644 index 0000000..bb5469a --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/CompositeType3.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +Object { + property int a +} diff --git a/tests/auto/declarative/qmllanguage/data/CompositeType4.qml b/tests/auto/declarative/qmllanguage/data/CompositeType4.qml new file mode 100644 index 0000000..a6a8168 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/CompositeType4.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyQmlObject { + property int a +} + diff --git a/tests/auto/declarative/qmllanguage/data/assignCompositeToType.qml b/tests/auto/declarative/qmllanguage/data/assignCompositeToType.qml new file mode 100644 index 0000000..ec2867d --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/assignCompositeToType.qml @@ -0,0 +1,18 @@ +import Qt 4.6 +import Test 1.0 + +Object { + property Object myProperty + property Object myProperty2 + property Object myProperty3 + property Object myProperty4 + property MyQmlObject myProperty5 + property MyQmlObject myProperty6 + + myProperty: CompositeType {} + myProperty2: CompositeType2 {} + myProperty3: CompositeType3 {} + myProperty4: CompositeType4 {} + myProperty5: CompositeType2 {} + myProperty6: CompositeType4 {} +} diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp index ff78e6d..94998c7 100644 --- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp +++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp @@ -39,6 +39,7 @@ private slots: void assignQmlComponent(); void assignBasicTypes(); void assignTypeExtremes(); + void assignCompositeToType(); void customParserTypes(); void rootAsQmlComponent(); void inlineQmlComponents(); @@ -323,6 +324,15 @@ void tst_qmllanguage::assignTypeExtremes() QCOMPARE(object->intProperty(), -0x77359400); } +// Test that a composite type can assign to a property of its base type +void tst_qmllanguage::assignCompositeToType() +{ + QmlComponent component(&engine, TEST_FILE("assignCompositeToType.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); +} + // Tests that custom parser types can be instantiated void tst_qmllanguage::customParserTypes() { -- cgit v0.12 From 9094a6588de3a7264ec4647a24b94253a7609823 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 12 Oct 2009 14:07:22 +1000 Subject: More doc on data models. --- doc/src/declarative/qmlmodels.qdoc | 108 +++++++++++++++++++++++++++++++++---- 1 file changed, 99 insertions(+), 9 deletions(-) diff --git a/doc/src/declarative/qmlmodels.qdoc b/doc/src/declarative/qmlmodels.qdoc index eca81cd..4cc0e8b 100644 --- a/doc/src/declarative/qmlmodels.qdoc +++ b/doc/src/declarative/qmlmodels.qdoc @@ -71,14 +71,87 @@ or C++ (via QmlContext::setContextProperty(), for example). \section1 QML Data Models -\list -\o ListModel is a simple hierarchy of elements specified in QML. The +\section2 ListModel + +ListModel is a simple hierarchy of elements specified in QML. The available roles are specified by the \l ListElement properties. -\o XmlListModel allows construction of a model from an XML data source. The roles + +\code +ListModel { + id: fruitModel + ListElement { + name: "Apple" + cost: 2.45 + } + ListElement { + name: "Orange" + cost: 3.25 + } + ListElement { + name: "Banana" + cost: 1.95 + } +} +\endcode + +The above model has two roles, \e name and \e cost. These can be bound +bound to by a ListView delegate, for example: + +\code +Component { + id: fruitDelegate + Row { + Text { text: "Fruit: " + name } + Text { text: "Cost: $" + cost } + } +} +ListView { + model: fruitModel + delegate: fruitDelegate +} +\endcode + + +\section2 XmlListModel + +XmlListModel allows construction of a model from an XML data source. The roles are specified via the \l XmlRole element. -\o VisualItemModel allows QML items to be provided as a model. This model contains + +The following model has three roles, \e title, \e link and \e description: +\code +XmlListModel { + id: feedModel + source: "http://rss.news.yahoo.com/rss/oceania" + query: "/rss/channel/item" + XmlRole { name: "title"; query: "title/string()" } + XmlRole { name: "link"; query: "link/string()" } + XmlRole { name: "description"; query: "description/string()" } +} +\endcode + + +\section2 VisualItemModel + +VisualItemModel allows QML items to be provided as a model. This model contains both the data and delegate (its child items). This model does not provide any roles. -\endlist + +\code + VisualItemModel { + id: itemModel + Rectangle { height: 30; width: 80; color: "red" } + Rectangle { height: 30; width: 80; color: "green" } + Rectangle { height: 30; width: 80; color: "blue" } + } + + ListView { + anchors.fill: parent + model: itemModel + } +\endcode + +Note that in the above example there is no delegate required. +The items of the model itself provide the visual elements that +will be positioned by the view. \section1 C++ Data Models @@ -92,11 +165,28 @@ both the data and delegate (its child items). This model does not provide any r \section1 Other Data Models -\list -\o An Integer specifies a model containing the integer number of elements. + +\section2 An Integer + +An Integer specifies a model containing the integer number of elements. There are no data roles. -\o An Object Instance specifies a model with a single Object element. The + +The following example creates a ListView with five elements: +\code +Component { + id: itemDelegate + Text { text: "I am item number: " + index } +} +ListView { + model: 5 + delegate: itemDelegate +} +\endcode + + +\section2 An Object Instance + +An Object Instance specifies a model with a single Object element. The properties of the object are provided as roles. -\endlist */ -- cgit v0.12 From 24653fc546fe8150ebca1c44c36fe17c36527cc7 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Oct 2009 14:15:08 +1000 Subject: Test that Component {} is allowed as the root element --- src/declarative/qml/qmlcompiler.cpp | 6 ++++-- tests/auto/declarative/qmllanguage/data/ComponentComposite.qml | 5 +++++ .../declarative/qmllanguage/data/componentCompositeType.qml | 8 ++++++++ tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp | 10 ++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qmllanguage/data/ComponentComposite.qml create mode 100644 tests/auto/declarative/qmllanguage/data/componentCompositeType.qml diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 6d1df6d..023903d 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -672,7 +672,7 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt) obj->className = tr.className; // This object is a "Component" element - if (obj->metatype == &QmlComponent::staticMetaObject) { + if (tr.type && obj->metatype == &QmlComponent::staticMetaObject) { COMPILE_CHECK(buildComponent(obj, ctxt)); return true; } @@ -786,7 +786,9 @@ bool QmlCompiler::buildObject(Object *obj, const BindingContext &ctxt) void QmlCompiler::genObject(QmlParser::Object *obj) { - if (obj->metatype == &QmlComponent::staticMetaObject) { + const QmlCompiledData::TypeReference &tr = + output->types.at(obj->type); + if (tr.type && obj->metatype == &QmlComponent::staticMetaObject) { genComponent(obj); return; } diff --git a/tests/auto/declarative/qmllanguage/data/ComponentComposite.qml b/tests/auto/declarative/qmllanguage/data/ComponentComposite.qml new file mode 100644 index 0000000..f8726ef --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/ComponentComposite.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +Component { + Object {} +} diff --git a/tests/auto/declarative/qmllanguage/data/componentCompositeType.qml b/tests/auto/declarative/qmllanguage/data/componentCompositeType.qml new file mode 100644 index 0000000..3a1b191 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/componentCompositeType.qml @@ -0,0 +1,8 @@ +import Qt 4.6 + +Object { + property var test + + test: ComponentComposite {} +} + diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp index 94998c7..a991144 100644 --- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp +++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp @@ -57,6 +57,7 @@ private slots: void valueTypes(); void cppnamespace(); void aliasProperties(); + void componentCompositeType(); void importsBuiltin_data(); void importsBuiltin(); @@ -657,6 +658,15 @@ void tst_qmllanguage::aliasProperties() } } +// Test that the root element in a composite type can be a Component +void tst_qmllanguage::componentCompositeType() +{ + QmlComponent component(&engine, TEST_FILE("componentCompositeType.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); +} + class TestType : public QObject { Q_OBJECT public: -- cgit v0.12 From 9c60045b13dec0faf858b922ed6121c0b06483c5 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Oct 2009 15:02:42 +1000 Subject: Doc --- doc/src/declarative/extending.qdoc | 62 ++- doc/src/declarative/qmlforcpp.qdoc | 713 --------------------------------- doc/src/declarative/qtdeclarative.qdoc | 1 - 3 files changed, 59 insertions(+), 717 deletions(-) delete mode 100644 doc/src/declarative/qmlforcpp.qdoc diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index bc18108..db35961 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -511,6 +511,18 @@ to be used in bindings should have a NOTIFY signal instead. \l {Extending QML - Binding Example} shows the BirthdayParty example updated to include NOTIFY signals for use in binding. +\section1 Binding and Script Properties + +While generally no changes are needed to a C++ class to use property +binding, sometimes more advanced interaction between the binding engine and +an object is desirable. To facilitate this, there is a special exception +in the bind engine for allowing an object to access the binding directly. + +If a binding is assigned to a property with a type of QmlBinding +pointer (ie. \c {QmlBinding *}), each time the binding value changes, +a QmlBinding instance is assigned to that property. The QmlBinding instance +allows the object to read the binding and to evaluate the binding's current value. + \section1 Extension Objects \snippet examples/declarative/extending/extended/example.qml 0 @@ -522,15 +534,59 @@ When integrating existing classes and technology into QML, their APIs will often need to be tweaked to fit better into the declarative environment. Although the best results are usually obtained by modifying the original classes directly, if this is either not possible or is complicated by some other -concerns extension objects allow limited extension possibilities without +concerns, extension objects allow limited extension possibilities without direct modifications. -Extension objects can only add properties. +Extension objects are used to add additional properties to an existing type. +Extension objects can only add properties, not signals or methods. An extended +type definition allows the programmer to supply an additional type - known as the +extension type - when registering the target class whose properties are +transparently merged with the original target class when used from within QML. + +An extension class is a regular QObject, with a constructor that takes a QObject +pointer. When needed (extension classes are delay created until the first extended +property is accessed) the extension class is created and the target object is +passed in as the parent. When an extended property on the original is accessed, +the appropriate property on the extension object is used instead. + +When an extended type is installed, one of the +\code + #define QML_DEFINE_EXTENDED_TYPE(URI, VMAJ, VFROM, VTO, QmlName,T, ExtendedT) + #define QML_DEFINE_EXTENDED_NOCREATE_TYPE(T, ExtendedT) +\endcode +macros should be used instead of the regular \c QML_DEFINE_TYPE or +\c QML_DEFINE_NOCREATE_TYPE. The arguments are identical to the corresponding +non-extension object macro, except for the ExtendedT parameter which is the type +of the extension object. \section1 Optimization -*/ +Often to develop high performance elements it is helpful to know more about the +status of the QML engine. For example, it might be beneficial to delay +initializing some costly data structures until after all the properties have been +set. +The QML engine defines an interface class called QmlParserStatus, which contains a +number of virtual methods that are invoked at various stages during component +instantiation. To receive these notifications, an element implementation inherits +QmlParserStatus and notifies the Qt meta system using the Q_INTERFACES() macro. + +For example, + +\code +class Example : public QObject, public QmlParserStatus +{ + Q_OBJECT + Q_INTERFACES(QmlParserStatus) +public: + virtual void componentComplete() + { + qDebug() << "Woohoo! Now to do my costly initialization"; + } +}; +\endcode + +*/ /*! \page qml-extending-types.html diff --git a/doc/src/declarative/qmlforcpp.qdoc b/doc/src/declarative/qmlforcpp.qdoc deleted file mode 100644 index 5378571..0000000 --- a/doc/src/declarative/qmlforcpp.qdoc +++ /dev/null @@ -1,713 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qmlforcpp.html - \target qmlforcpp - \title QML for C++ Programmers - - This page describes the QML format and how to use and extend it from C++. - - The QML syntax declaratively describes how to construct an in memory - object tree. QML is usually used to describe a visual scene graph - but it is not conceptually limited to this: the QML format is an abstract - description of \bold any object tree. - - QML also includes property bindings. Bindings are ECMAScript expressions - of a properties value. Whenever the value of the expression changes - - either for the first time at startup or subsequently thereafter - the - property is automatically updated with the new value. - - \tableofcontents - - \section1 Loading and using QML Files - - QmlComponent is used to load a QML file and to create object instances. - - In QML a component is the unit of instantiation, and the most basic unit - of scope. A component is like a template for how to construct an object - tree. One component can create multiple instances of this tree, but the - template remains constant. - - The following code uses the C++ interface to create 100 red rectangles - based on a simple declarative component description. - - \code - QmlEngine engine; - QmlComponent redRectangle(&engine, "Rectangle { color: \"red\"; width: 100; height: 100 }"); - for (int ii = 0; ii < 100; ++ii) { - QObject *rectangle = redRectangle.create(); - // ... do something with the rectangle ... - } - \endcode - - Each independent file describes a QML component, but it is also possible to - create sub-components within a QML file as will be shown later. - - \section1 QML Format 101 - - This is some sample QML code. - - \code - Image { - id: myRect - x: 10 - y: 10 - width: 100 - height: 100 - source: "background.png" - - Text { - height: 50 - width: 100 - color: "white" - font.fontSize: 16 - text: "Hello world!" - } - } - \endcode - - The QML snippet shown above instantiates one \c Image instance and one - \c Text instance and sets properties on both. \bold Everything in QML - ultimately comes down to either instantiating an object instance, or - assigning a property a value. QML relies heavily on Qt's meta object system - and can only instantiate classes that derive from QObject. - - In the above example, each property is placed on its own line. You can - also place multiple properties on one line by separating them with a - semi-colon. The code below is equivalent to the example above. - - \code - Image { - id: myRect - x: 10; y: 10; width: 100; height: 100 - source: "background.png" - Text { height: 50; width: 100; color: "white"; font.fontSize: 16; text: "Hello world!" } - } - \endcode - - QML can set properties that are more complex than just simple types like - integers and strings. Properties can be object pointers or Qt interface - pointers or even lists of object or Qt interface pointers! QML is typesafe, - and will ensure that only the valid types are assigned to properties. - - Assigning an object to a property is as simple as assigning a basic - integer. Attempting to assign an object to a property when type coercian - fails will produce an error. The following shows an example of valid and of - invalid QML and the corresponding C++ classes. - - \table - \row \o - \code - class Image : public QObject - { - ... - Q_PROPERTY(ImageFilter *filter READ filter WRITE setFilter) - }; - - class ImageFilter : public QObject - { - ... - }; - \endcode - \o \code - // OK - Image { - filter: ImageFilter {} - } - - // NOT OK: Image cannot be cast into ImageFilter - Image { - filter: Image {} - } - \endcode - \endtable - - Classes can also define an optional default property. The default property - is used for assignment if no explicit property has been specified. - Any object property can be the default, even complex properties like lists - of objects. The default property of the \c Rect class is the \c children - property, a list of \c Item's. In the following example, as both \c Image - and \c Text inherit from \c Item the \c Image and \c Text instances are - added to the parent's \c children property. - - \code - Rectangle { - Image {} - Text {} - } - \endcode - - Properties that return read-only object pointers can be used recursively. - This can be used, for example, to group properties together. The - \c Text element has a \c font property that returns an object with a number - of sub-properties such as \c family, \c bold, \c italic and \c size. - QML makes it easy to interact with these grouped properties, as the - following shows - everything you would expect to work, just does. - - \table - \row \o - \code - class Text : public ... - { - ... - Q_PROPERTY(Font *font READ font); - }; - class Font : public QObject - { - ... - Q_PROPERTY(QString family READ family WRITE setFamily); - Q_PROPERTY(bool bold READ bold WRITE setBold); - Q_PROPERTY(bool italic READ italic WRITE setItalic); - Q_PROPERTY(int size READ size WRITE setSize); - }; - \endcode - \o - \code - Text { - font.family: "helvetica" - font.pointSize: 12 - font { - bold: true - italic: true - } - } - \endcode - \endtable - - \section1 Defining QML Types - - The QML engine has no intrinsic knowledge of any class types. Instead - the programmer must define the C++ types, their corresponding QML - name, library namespace, and version availability. - - \code - #define QML_DECLARE_TYPE(T) - #define QML_DEFINE_TYPE(URI,VMAJ,VFROM,VTO,QmlName,T) - \endcode - - Adding these macros to your library or executable automatically makes the - C++ type \a T available from the declarative markup language under the - name \a QmlName. Of course there's nothing stopping you using the same - name for both the C++ and the QML name! - Any type can be added to the QML engine using these macros. The only - requirements are that \a T inherits QObject, is not abstract, - and that it has a default constructor. - - \section1 Property Binding - - Assigning constant values and trees to properties will only get you so - far. Property binding allows a property's value to be dependant on the - value of other properties and data. Whenever these dependencies change, - the property's value is automatically updated. - - Property bindings are ECMAScript expressions and can be applied to any - object property. C++ classes don't have to do anything special to get - binding support other than define appropriate properties. When a non-literal - property assignment appears in a QML file, it is automatically treated as a - property binding. - - Here's a simple example that stacks a red, blue and green rectangle. - Bindings are used to ensure that the height of each is kept equal to it's - parent's. Were the root rectangle's height property to change, the child - rectangles height would be updated automatically. - - \code - Rectangle { - color: "red" - width: 100 - Rectangle { - color: "blue" - width: 50 - height: parent.height - Rectangle { - color: "green" - width: 25 - height: parent.height - } - } - } - \endcode - - Binding expressions execute in a context. A context behaves as a scope and - defines how the expression resolves property and variable names. Although - the two expressions in the last example are the same, the value of \c parent - resolves differently because each executes in a different context. Although - QML generally takes care of everything for the programmer, a thorough - understanding of bind contexts is important in some of the more complex QML - structures. - - Every expression is executed in a bind context, encapsulated by the - QmlContext C++ class. As covered in the class documentation, a - bind context contains a map of names to values, and a list of default - objects. When resolving a name, the name to value map is searched first. - If the name cannot be found, the default object's are iterated in turn and - the context attempts to resolve the name as a property of one of the default - objects. - - There are generally two contexts involved in the execution of a binding. - The first is the "object context" - a bind context associated with the - closest instantiated object and containing just one default object, and - that's instantiated object itself. The effect of the object - context is pretty simple - names in the binding expression resolve to - properties on the object first. It is important to note - particularly in - the case of grouped properties - the object context is that of the - instantiated object, the consequences of which are shown below. - - \code - // OK // NOT OK - Text { Text { - font { font { - bold: font.italic bold: italic - } } - } } - \endcode - - The second context is the "component context". Each QML component (and - consequently each QML file) is created in its own unique binding context. - Like the object context, the component context contains just one default - object - but in this case it is the component's root object. An example - will illustrate best - the resultant text will read "background.png". - - \code - Image { - source: "background.png" - Text { - text: source - } - } - \endcode - - If the name is not found in either of these contexts, the context heirarchy - is searched parent-by-parent until the name is either found, or the - heirarchy is exhausted. - - The first property binding example shown involved fixing the height of three - rectangles. It did this by fixing the height of each rectangle to its - parent, rather than fixing them all to a single common point. Here's the - example rewritten to do just that. - - \code - Rectangle { - color: "red" - width: 100 - Rectangle { - color: "blue" - width: 50 - height: parent.height - Rectangle { - color: "green" - width: 25 - height: parent.parent.height - } - } - } - \endcode - - Clearly this sort of fragile relationship is undesirable and unmanageable - - moving the green rectangle to be a sibling of the blue or introducing a - further rectangle between the two would break the example. - - To address this problem, QML includes a way to directly reference any object - within a component (or parent component for that matter), called "ids". - Developers assign an object an id, and can then reference it directly by - name. Developers assign an object an id by setting the special \c id - property. Every object automatically has this magical property (if the - object also has an actual property called \c id, that gets set too). As - an id allows an object to be referenced directly, it must be unique within - a component. By convention, id's should start with an uppercase letter. - - \code - Rectangle { - id: root - color: "red" - width: greenRect.width + 75 - height: root.height - Rectangle { - color: "blue" - width: greenRect.width + 25 - Rectangle { - id: greenRect - color: "green" - width: 25 - height: root.height - } - } - } - \endcode - - To relate id's back to QmlContext, id's exist as properties on the - component context. - - Bind expressions can reference any object property. The QML bind engine - relies on the presence of the NOTIFY signal in the Q_PROPERTY declaration - on a class to alert it that a property's value has changed. If this is - omitted, the bind expression can still access the property's value, but - the expression will not be updated if the value changes. The following is - an example of a QML friendly property declaration. - - \code - class Example : public QObject - { - Q_OBJECT - Q_PROPERTY(int sample READ sample WRITE setSample NOTIFY sampleChanged) - public: - int sample() const; - void setSample(int); - signals: - void sampleChanged(int); - }; - \endcode - - While generally no changes are needed to a C++ class to use property - binding, sometimes more advanced interaction between the binding engine and - an object is desirable. To facilitate this, there is a special exception - in the bind engine for allowing an object to access the binding directly. - - If a binding is assigned to a property with a type of QmlBindableValue - pointer (ie. QmlBindableValue *), each time the binding value changes, - a QmlBindableValue instance is assigned to that property. The - QmlBindableValue instance allows the object to read the binding and to - evaluate the binding's current value. - - \section1 Signal Properties - - In addition to reading and writing regular properties, QML allows you to - easily associate ECMAScript with signals. Consider the following example, - in which Button is a made-up type with a clicked() signal. - - \code - Button { - text: "Hello world!" - onClicked: print(text) - } - \endcode - - Clicking on the button causes "Hello world!" to be printed to the console - (or lost forever if you're running Windows). - - Like properties, signals automatically become available in QML without - any additional work. As illustrated signals are mapped into QML as special - "signal properties", using the name "on" where the first - character of the signal's name is uppercased. If more than one signal of - the same name is exist on a class, only the first is available (see the - \l Connection element for more general signal connections). - - An important observation to make here is the lack of braces. While both - property bindings and signal properties involve executing ECMAScript code, - property bindings dynamically update the property value (hence the braces), - whereas with signal properties the constant script "value" is actually - assigned to the signal property. Trying to bind a value to a signal - property will not work! - - Signal parameters are also available to the executing script, as shown - below, as long as you remember to name the parameters of your signal - in C++ (see QMetaMethod::parameterNames()). - - \table - \row \o - \code - Example { - onDoSomething: for(var ii = 0; ii < count; ++ii) - print(message) - } - \endcode - \o - \code - class Example : public QObject - { - Q_OBJECT - signals: - void doSomething(int count, const QString &message); - }; - \endcode - \endtable - - Just like property bindings, signal scripts are executed in a context. The - signal script context is identical in scope to the "object context" under - property binding, with the exception that it has the signal parameters - bound in. - - In addition to scripts, it is possible to assign objects to signal properties. - This automatically connects the signal to the object's default method. A - default method is defined just like a default property, though the special - "DefaultMethod" class info. - - \code - Q_CLASSINFO("DefaultMethod", "myMethod(int)"); - \endcode - - This is useful in achieving several use cases, like that below which moves - the button when it is clicked. - - \code - Button { - id: myButton - onClicked: NumberAnimation { - target: myButton - property: "x" - to: 100 - } - } - \endcode - - If the class itself actually defines a property called "on", this will - be assigned the string value and the signal handling behaviour will be - disabled. - - \section1 Attached Properties - - Attached properties allow unrelated types to annotate another type with some - additional properties. Some APIs or operations are inherintly imperative, - and attached properties help out when translating these APIs into the - declarative QML language. - - Qt's QGridLayout is one such example. - - \code - QGridLayout { - QLabel { - QGridLayout.row: 0 - QGridLayout.column: 0 - text: "Name:" - } - QLineEdit { - QGridLayout.row: 0 - QGridLayout.column: 1 - } - - QLabel { - QGridLayout.row: 1 - QGridLayout.column: 0 - text: "Occupation:" - } - QLineEdit { - QGridLayout.row: 1 - QGridLayout.column: 1 - } - } - \endcode - - Attached properties are identified by the use of a type name, in the - case shown \c QGridLayout, as a grouped property specifier. To prevent - ambiguity with actual class instantiations, attached properties must - always be specified to include a period but can otherwise be used just like - regular properties. - - C++ types provide attached properties by declaring the public function \c qmlAttachedProperties like this example. - - \table - \row \o - \code - static QObject *Type::qmlAttachedProperties(QObject *); - \endcode - \o - \code - class Example : public QObject - { - Q_OBJECT - public: - static QObject *qmlAttachedProperties(QObject *); - }; - \endcode - \endtable - - When an attached property is accessed, the QML engine will call this method - to create an attachment object, passing in the object instance that the - attached property applies to. The attachment object should define all - the attached properties, and is generally parented to the provided object - instance to avoid memory leaks. The QML engine does not saves this object, - so it is not necessary for the attached property function to ensure that - multiple calls for the same instance object return the same attached object. - - While conceptually simple, implementing an attachment object is not quite - so easy. The \c qmlAttachedProperties function is static - attachment - objects are not associated with any particular instance. How the values - of the attached properties apply to the behaviour they are controlling is - entirely implementation dependent. An additional consequence of this is - that \bold any object can attach \bold any attached property. The following is - perfectly valid, although the attached property has no actual effect: - - \code - FancyGridLayout { - Item { - Button { - QGridLayout.row: 1 - } - } - } - \endcode - - The property has no effect because the (made-up) FancyGridLayout type defines the meaning - of the \c row attached property only to apply to its direct children. It - is possible that other types may have attached properties that affect - objects that aren't their direct children. - - Attached properties are an advanced feature that should be used with - caution. - - \note We may implement a convenience wrapper that makes using attached - properties easier for the common "attach to children" case. - - \section1 Property Value Sources - - Intrinsically, the QML engine can assign a property either a static value, - such as a number or an object tree, or a property binding. It is possible for - advanced users to extend the engine to assign other "types" of values to - properties. These "types" are known as property value sources. - - Consider the following example. - - \code - Rectangle { - x: NumberAnimation { running: true; repeat; true; from: 0; to: 100; } - } - \endcode - - Here the \c x property of the rectangle will be animated from 0 to 100. - To support this, the NumberAnimation class inherits the - QmlPropertyValueSource class. If a type inherits this class and is assigned - to a property for which type assignment would otherwise fail (ie. the - property itself doesn't have a type of QmlPropertyValueSource *), the QML - engine will automatically set the property as the target of the value - source. - - \section1 Parser Status - - Generally using QML is a breeze - you implement your classes in C++, add - the appropriate properties, signals and slots and off you go. The QML - engine takes care of instantiating your classes and setting the properties - and everything works fine. - - However, sometimes it is helpful to know a little more about the status of - the QML parser. For example, it might be beneficial from a performance - standpoint to delay initializing some data structures until all the - properties have been set. - - To assist with this, the QML engine defines an interface class called - QmlParserStatus. The interface defines a number of virtual methods that are - invoked at various stages of the component instantiation. To receive - these notifications, all a class has to do is to inherit the interface, and - notify the Qt meta system using the Q_INTERFACES() macro. For example, - - \code - class Example : public QObject, public QmlParserStatus - { - Q_OBJECT - Q_INTERFACES(QmlParserStatus) - public: - virtual void componentComplete() - { - qDebug() << "Woohoo! Now to do my costly initialization"; - } - }; - \endcode - - \section1 Extended Type Definitions - - QML requires that types have the appropriate properties and signals to - work well within the declarative environment. In the case of existing - types, it is sometimes necessary to add signals, properties or slots to a - target class to make it more QML friendly but the original type cannot be - modified. For these cases, the QML engine supports extended type - definitions. - - An extended type definition allows the programmer to supply an additional - type - known as the extension type - when registering the target class - whose properties, signals and slots are transparently merged with the - original target class when used from within QML. - - An extension class is a regular QObject, with a constructor that takes a - QObject pointer. When needed (extension classes are delay created - until the first extension attribute is accessed) the extension - class is created and the target object is passed in as the parent. When - an extension attribute on the original is accessed, the appropriate signal, - property or slots on the extension object is used instead. - - When an extended type is installed, the - \code - #define QML_DEFINE_EXTENDED_TYPE(T,QmlName,ExtendedTypeName) - \endcode - macro should be used instead of the regular \c QML_DEFINE_TYPE. - - This example shows the addition of a read-only \c textLength property to - QLabel being implemented as an extension. - - \table - \row - \o - \code - class QLabelExtension : public QObject - { - Q_OBJECT - Q_PROPERTY(int textLength READ textLength) - public: - QWidgetExtension(QObject *parent) : QObject(parent) {} - int textLength() const { - return static_cast(parent())->text().count(); - } - }; - QML_DEFINE_EXTENDED_TYPE(QLabel,QLabel,QLabelExtension); - \endcode - \o - \code - QLabel { - id: label1 - text: "Hello World!" - } - QLabel { - text: "label1 text length: " + label1.textLength - } - \endcode - \endtable - - Attributes defined through extensions are inherited, just like attributes - defined on a normal class. Any types that inherit from \c QLabel, will - also have the \c textLength property. Derived types can include additional - extensions which are merged together, but only a single extension can be - specified for each single C++ class. - - Extended type definitions can even be used to add an attached properties - function to a type - just declare the \c qmlAttachedProperties function on - the extension object. - -*/ - diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 1a13049..aeaa76e 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -67,7 +67,6 @@ \o \l {tutorials-declarative-contacts.html}{Tutorial: 'Introduction to QML'} \o \l {advtutorial.html}{Advanced Tutorial: 'Same Game'} \o \l {qmlexamples}{Examples} - \o \l {qmlforcpp}{QML For C++ Programmers} \endlist Core QML Features: -- cgit v0.12 From a5c919183d9f52f3198b1b307ea75dab33ee4e1b Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Oct 2009 15:04:08 +1000 Subject: Doc --- doc/src/declarative/qtdeclarative.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index aeaa76e..f7968b3 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -45,7 +45,7 @@ \ingroup modules \brief The Qt Declarative module provides a declarative framework for building - highly dynamic and fluid applications. + highly dynamic, custom UIs Qt Declarative is targetted at the sorts of user interface (and the sorts of hardware) in embedded devices such as phones, media -- cgit v0.12 From 3f86ef45fbde6a49dd3e6a8904d15cc0983d130d Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Oct 2009 15:14:47 +1000 Subject: Doc --- doc/src/declarative/cppitem.qdoc | 170 --------------------------------- doc/src/declarative/qtdeclarative.qdoc | 1 - doc/src/declarative/qtprogrammers.qdoc | 3 +- 3 files changed, 1 insertion(+), 173 deletions(-) delete mode 100644 doc/src/declarative/cppitem.qdoc diff --git a/doc/src/declarative/cppitem.qdoc b/doc/src/declarative/cppitem.qdoc deleted file mode 100644 index c5ef4c4..0000000 --- a/doc/src/declarative/cppitem.qdoc +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! -\page cppitem.html -\target cppitem -\title C++ Components for QML - -\section1 Making a C++ object available in QML - -In QML, the item types and properties correspond to Qt objects and properties. Thus, any Qt object -can potentially be used as an item in QML. More specifically, to make an object available in QML, -it should: -\list -\o Be a subclass of QObject. -\o Provide a default constructor. -\o Declare Q_PROPERTYs. -\o Be registered via the QML_DECLARE_TYPE and QML_DEFINE_TYPE macros. -\endlist - -\section2 Declaring Q_PROPERTYs -\target properties - -Properties of QObject subclasses are available as properties in QML. -Like any QObject, these properties are defined by the Q_PROPERTY -macro in the header file. - -Properties should have a NOTIFY function if they can change dynamically and -if any useful response could be made to them changing in another object. Almost -all properties will thus need a NOTIFY function. - -\code - Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged); - qreal scale() const; - void setScale(qreal); - ... - signals: void scaleChanged(); -\endcode - -The property types currently supported by QML are: -\list -\o int -\o qreal -\o QString -\o QColor -\o QDate, QTime, and QDateTime -\o QSize and QSizeF -\o QPoint and QPointF -\o QRect and QRectF -\o QPixmap -\o QIcon -\o enums registered with Q_ENUMS -\o flags registered with Q_FLAGS -\o QVariant -\o QObject* (or subclass) -\endlist - -Custom property types that provide string-to-type conversion can be used as well, by: -\list -\o Registering them as a metatype (Q_DECLARE_METATYPE() and qRegisterMetaType()) -\o Registering a string-to-type convertor function (QML::addCustomStringConvertor()). -\endlist - -\section2 Registering your type -\target register - -In order for your type to be usable in QML, you must register it: - -\code -QML_DECLARE_TYPE(TypeName); -QML_DEFINE_TYPE(ModuleUri,ModuleMajorVersion,ModuleMinorVersionFrom,ModuleMinorVersionTo,QmlName,TypeName); -\endcode - -These macros make the C++ \e TypeName available from the declarative markup language under the name \e QmlName. -Of course there's nothing stopping you using the same name for both the C++ and the QML name! - -For example: -\code -QML_DECLARE_TYPE(MyCircle); -QML_DEFINE_TYPE(MyLib,1,0,5,Circle,MyCircle); -\endcode -would make the \e MyCircle class accessable though the \c Circle type in QML whenever MyLib 1.0 to 1.5 is imported. - - -\section1 Creating a new type of QML item in C++ - -You can create a new type of QML item by: -\list 1 -\o Creating a subclass of QFxItem, -\o Adding Q_PROPERTYs appropriate for your item (see \l {properties}{Properties}), -\o Reimplementing the relevant paint functions, -\o Registering the type with the QML_DECLARE_TYPE and QML_DEFINE_TYPE macros (see \l {register}{Register}). -\endlist - -\section2 Creating a subclass of QFxItem - -To add a new type, you first must add a new C++ class derived from QFxItem. -You may of course extend existing QFxItem subclasses. - -One existing subclass is QFxPaintedItem, which provides -a simple cached-image painting model. - -\section2 Reimplementing paint functions - -\warning This section is out of date. Use the normal QGraphicsItem::paint function. - -Two alternative painters are available, offering -different levels of performance and functionality: -QPainter, GLPainter. - -You can choose to subclass QFxPaintedItem rather than QFxItem, -and then implement the virtual method: - -\code - void drawContents(QPainter *painter, const QRect &rect); -\endcode - -This paints into an offscreen pixmap which is then painted to the display (transformed, -etc. as needed). The cost of this offscreen pixmap should be carefully considered, as -should the specific performance of the painting done in the paint function. - -If you require more control, subclass QFxItem instead. -QFxItem subclasses must implement both simple software canvas painting -and GL painting: -\list -\o \c QFxItem::paintContents(QPainter &) for the simple software canvas, -\o \c QFxItem::paintGLContents(GLPainter &) for OpenGL. -\endlist - -See the documentation of those functions for detailed subclassing notes. - -*/ diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index f7968b3..aa0ff7f 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -90,6 +90,5 @@ \list \o \l {Extending QML} \o \l {qtbinding}{QML/C++ Data Binding} - \o \l {cppitem}{C++ Components} \endlist */ diff --git a/doc/src/declarative/qtprogrammers.qdoc b/doc/src/declarative/qtprogrammers.qdoc index 00c2d48..ea27d7e 100644 --- a/doc/src/declarative/qtprogrammers.qdoc +++ b/doc/src/declarative/qtprogrammers.qdoc @@ -65,8 +65,7 @@ QML provides direct access to the following concepts from Qt: \o Qt models - used directly in data binding (QAbstractItemModel and next generation QListModelInterface) \endlist -Qt knowledge is \e required for \l {cppitem}{writing elements in C++}. - +Qt knowledge is \e required for \l {Extending QML}. \section1 QML Items compared with QWidgets -- cgit v0.12 From 0241f0e132ef9724876d62cf3a4c29e7fa10cd6d Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Oct 2009 15:34:30 +1000 Subject: Doc --- src/declarative/extra/qfxparticles.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/declarative/extra/qfxparticles.cpp b/src/declarative/extra/qfxparticles.cpp index b4a04a9..36fdd79 100644 --- a/src/declarative/extra/qfxparticles.cpp +++ b/src/declarative/extra/qfxparticles.cpp @@ -111,6 +111,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,ParticleMotion,QFxParticleMotion \class QFxParticleMotion \ingroup group_effects \brief The QFxParticleMotion class is the base class for particle motion. + \internal This class causes the particles to remain static. */ -- cgit v0.12 From ce37daea42e85a62bebff56fabe7103cd54df288 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Oct 2009 15:47:36 +1000 Subject: Doc --- doc/src/declarative/binding.qdoc | 8 +++++--- doc/src/declarative/qtdeclarative.qdoc | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/src/declarative/binding.qdoc b/doc/src/declarative/binding.qdoc index 4f9bdc8..79ba6ac 100644 --- a/doc/src/declarative/binding.qdoc +++ b/doc/src/declarative/binding.qdoc @@ -41,10 +41,12 @@ /*! \page binding.html -\title Data Binding in QML -\target binding +\title Property Binding -Data binding provides a declarative way of specifying the data associated with objects, as well as the relationship between data of different objects. For example, you could bind the text of a label to the value of a slider: as the value of the slider changed, the label would be automatically updated with the new value. +Property binding is a declarative way of specifying the value of a property. Binding allows +a property's value to be expressed as an ECMAScript expression that defines the value relative +to other property values or data accessible in the application. The property value is +automatically kept up to date if the other properties or data values change. Bindings are created in QML when an expression is assigned to a property. For example, the following produces two rectangles of equal size (\c rect2 is bound to the size of \c rect1): \code diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index aa0ff7f..d60f4ed 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -71,7 +71,7 @@ Core QML Features: \list - \o \l {binding}{Data Binding} + \o \l {Property Binding} \o \l {qmlmodels}{Data Models} \o \l {anchor-layout}{Anchor-based Layout} \o \l {qmlanimation}{Animation} -- cgit v0.12 From b30731cea6f99ed3f2d358399f57fe3eb5739c17 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Oct 2009 16:11:56 +1000 Subject: Pass all WriteProperty args --- src/declarative/qml/qmlmetaproperty.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 34c98bf..79022e7 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -847,9 +847,9 @@ void QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data if (found) { if (context && u.isRelative() && !u.isEmpty()) u = context->baseUrl().resolved(u); - void *a[1]; - a[0] = &u; - QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); + int status = -1; + void *argv[] = { &u, 0, &status, &flags }; + QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, argv); } } else if (vt == t) { -- cgit v0.12 From 949e21cdafeec0c0e4ac632ebbf21767479f04e5 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 12 Oct 2009 16:29:55 +1000 Subject: use aliases when possible --- examples/declarative/border-image/MyBorderImage.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/declarative/border-image/MyBorderImage.qml b/examples/declarative/border-image/MyBorderImage.qml index d64bfb2..9eb1270 100644 --- a/examples/declarative/border-image/MyBorderImage.qml +++ b/examples/declarative/border-image/MyBorderImage.qml @@ -1,9 +1,10 @@ import Qt 4.6 Item { - property var horizontalMode : BorderImage.Stretch - property var verticalMode : BorderImage.Stretch + property alias horizontalMode: image.horizontalTileMode + property alias verticalMode: image.verticalTileMode property alias source: image.source + property int minWidth property int minHeight property int maxWidth @@ -12,6 +13,7 @@ Item { id: container width: 240; height: 240 + BorderImage { id: image; x: container.width / 2 - width / 2; y: container.height / 2 - height / 2 @@ -27,8 +29,6 @@ Item { NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing: "easeInOutQuad" } } - horizontalTileMode: container.horizontalMode - verticalTileMode: container.verticalMode border.top: container.margin border.left: container.margin border.bottom: container.margin -- cgit v0.12 From a6b0e516f6206133647317c3c54d9bfc8c040162 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 12 Oct 2009 17:12:31 +1000 Subject: I18n tests --- tests/auto/declarative/qmllanguage/data/I18n.qml | 6 ++++++ .../data/I18n\303\201\303\242\303\243\303\244\303\245.qml" | 4 ++++ .../qmllanguage/data/i18nDeclaredPropertyNames.qml | 6 ++++++ .../declarative/qmllanguage/data/i18nDeclaredPropertyUse.qml | 5 +++++ tests/auto/declarative/qmllanguage/data/i18nScript.qml | 12 ++++++++++++ tests/auto/declarative/qmllanguage/data/i18nStrings.qml | 5 +++++ tests/auto/declarative/qmllanguage/data/i18nType.qml | 5 +++++ 7 files changed, 43 insertions(+) create mode 100644 tests/auto/declarative/qmllanguage/data/I18n.qml create mode 100644 "tests/auto/declarative/qmllanguage/data/I18n\303\201\303\242\303\243\303\244\303\245.qml" create mode 100644 tests/auto/declarative/qmllanguage/data/i18nDeclaredPropertyNames.qml create mode 100644 tests/auto/declarative/qmllanguage/data/i18nDeclaredPropertyUse.qml create mode 100644 tests/auto/declarative/qmllanguage/data/i18nScript.qml create mode 100644 tests/auto/declarative/qmllanguage/data/i18nStrings.qml create mode 100644 tests/auto/declarative/qmllanguage/data/i18nType.qml diff --git a/tests/auto/declarative/qmllanguage/data/I18n.qml b/tests/auto/declarative/qmllanguage/data/I18n.qml new file mode 100644 index 0000000..dbbd4bd --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/I18n.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +Text { + property int áâãäå: 10 + text: "Test áâãäå: " + áâãäå +} diff --git "a/tests/auto/declarative/qmllanguage/data/I18n\303\201\303\242\303\243\303\244\303\245.qml" "b/tests/auto/declarative/qmllanguage/data/I18n\303\201\303\242\303\243\303\244\303\245.qml" new file mode 100644 index 0000000..6a841d1 --- /dev/null +++ "b/tests/auto/declarative/qmllanguage/data/I18n\303\201\303\242\303\243\303\244\303\245.qml" @@ -0,0 +1,4 @@ +import Qt 4.6 + +Text { +} diff --git a/tests/auto/declarative/qmllanguage/data/i18nDeclaredPropertyNames.qml b/tests/auto/declarative/qmllanguage/data/i18nDeclaredPropertyNames.qml new file mode 100644 index 0000000..dbbd4bd --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/i18nDeclaredPropertyNames.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +Text { + property int áâãäå: 10 + text: "Test áâãäå: " + áâãäå +} diff --git a/tests/auto/declarative/qmllanguage/data/i18nDeclaredPropertyUse.qml b/tests/auto/declarative/qmllanguage/data/i18nDeclaredPropertyUse.qml new file mode 100644 index 0000000..240d7c1 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/i18nDeclaredPropertyUse.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +I18n { + áâãäå: 15 +} diff --git a/tests/auto/declarative/qmllanguage/data/i18nScript.qml b/tests/auto/declarative/qmllanguage/data/i18nScript.qml new file mode 100644 index 0000000..6d07b03 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/i18nScript.qml @@ -0,0 +1,12 @@ +import Qt 4.6 + +Text { + Script { + function val() { + var áâãäå = 10 + return "Test áâãäå: " + áâãäå + } + + } + text: val() +} diff --git a/tests/auto/declarative/qmllanguage/data/i18nStrings.qml b/tests/auto/declarative/qmllanguage/data/i18nStrings.qml new file mode 100644 index 0000000..062191f --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/i18nStrings.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +Text { + text: "Test áâãäå (5 accented 'a' letters)" +} diff --git a/tests/auto/declarative/qmllanguage/data/i18nType.qml b/tests/auto/declarative/qmllanguage/data/i18nType.qml new file mode 100644 index 0000000..1a73096 --- /dev/null +++ b/tests/auto/declarative/qmllanguage/data/i18nType.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +I18nÁâãäå { + text: "TEST" +} -- cgit v0.12 From 3a83d69ee744216bc72c1b67ad752a9640bb3605 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 12 Oct 2009 17:13:09 +1000 Subject: Allow Unicode identifiers. --- src/declarative/qml/parser/qmljslexer.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/parser/qmljslexer.cpp b/src/declarative/qml/parser/qmljslexer.cpp index f71b92f..54f8d78 100644 --- a/src/declarative/qml/parser/qmljslexer.cpp +++ b/src/declarative/qml/parser/qmljslexer.cpp @@ -867,11 +867,16 @@ bool Lexer::isLineTerminator() const bool Lexer::isIdentLetter(ushort c) { - /* TODO: allow other legitimate unicode chars */ - return ((c >= 'a' && c <= 'z') + // ASCII-biased, since all reserved words are ASCII, aand hence the + // bulk of content to be parsed. + if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '$' - || c == '_'); + || c == '_') + return true; + if (c < 128) + return false; + return QChar(c).isLetterOrNumber(); } bool Lexer::isDecimalDigit(ushort c) -- cgit v0.12 From 8d22b82d3883518b83bfb49dcc6e3506d0a8731e Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Oct 2009 18:32:26 +1000 Subject: Doc --- doc/src/declarative/anatomy.qdoc | 74 +++++++++++++++++++++ doc/src/declarative/binding.qdoc | 33 ---------- doc/src/declarative/ecmascriptblocks.qdoc | 74 +++++++++++++++++++++ doc/src/declarative/network.qdoc | 53 +++++++++++++++ doc/src/declarative/propertybinding.qdoc | 103 ++++++++++++++++++++++++++++++ doc/src/declarative/qtdeclarative.qdoc | 5 +- doc/src/declarative/scope.qdoc | 49 ++++++++++++++ 7 files changed, 357 insertions(+), 34 deletions(-) create mode 100644 doc/src/declarative/anatomy.qdoc create mode 100644 doc/src/declarative/ecmascriptblocks.qdoc create mode 100644 doc/src/declarative/network.qdoc create mode 100644 doc/src/declarative/propertybinding.qdoc create mode 100644 doc/src/declarative/scope.qdoc diff --git a/doc/src/declarative/anatomy.qdoc b/doc/src/declarative/anatomy.qdoc new file mode 100644 index 0000000..f816464 --- /dev/null +++ b/doc/src/declarative/anatomy.qdoc @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qmldocumentanatomy.html +\title Anatomy of a QML Document + +A QML document is a block of QML source code. QML documents generally correspond to files +stored on a disk or network resource, but can be constructed directly from text data. + +Syntactically a QML document is self contained; QML does \e not have a preprocessor that +modifies the document prior to presentation to the QML runtime. Type references made within +a QML document, including within a \l {ECMAScript Block} contained by the document, are +resolved based exclusively on the import statements present in the document. + +A simple QML document looks like this: + +\code +import Qt 4.6 + +Rectangle { + Component { + id: contactDelegate + Text { + text: modelData.firstName + " " + modelData.lastName + } + } + + ListView { + model: contactModel + delegate: contactDelegate + } +} +\endcode + +*/ diff --git a/doc/src/declarative/binding.qdoc b/doc/src/declarative/binding.qdoc index 79ba6ac..94465a1 100644 --- a/doc/src/declarative/binding.qdoc +++ b/doc/src/declarative/binding.qdoc @@ -40,39 +40,6 @@ ****************************************************************************/ /*! -\page binding.html -\title Property Binding - -Property binding is a declarative way of specifying the value of a property. Binding allows -a property's value to be expressed as an ECMAScript expression that defines the value relative -to other property values or data accessible in the application. The property value is -automatically kept up to date if the other properties or data values change. - -Bindings are created in QML when an expression is assigned to a property. For example, the following produces two rectangles of equal size (\c rect2 is bound to the size of \c rect1): -\code -Rectangle { id: rect1; width: 100; height: 100 } -Rectangle { id: rect2; width: rect1.width; height: rect1.height } -\endcode - -There is also a special \l Binding element, which is typically used to bind from the UI to the underlying UI model (see \l {Passing Data Between C++ and QML} for an example of this). The bindings above could be expressed using the \l Binding element as: - -\code -Binding { target: rect2; property: "width"; value: rect1.width } -Binding { target: rect2; property: "height"; value: rect1.height } -\endcode - -In addition to binding directly to a property, you can also bind to the results of expressions involving properties. For example: -\code -Text { text: contact.firstname + ' ' + contact.lastname } -Image { source: if (contact.gender == "female") {"pics/female.png"} else {"pics/male.png"} } -\endcode - -Relevant items can also be bound to the contents of a model - see \l ListView for an example of this. - -Data can be bound to C++ objects - see \l {QML/C++ Data Binding}. -*/ - -/*! \page qtbinding.html \target qtbinding \title QML/C++ Data Binding diff --git a/doc/src/declarative/ecmascriptblocks.qdoc b/doc/src/declarative/ecmascriptblocks.qdoc new file mode 100644 index 0000000..4dde19d --- /dev/null +++ b/doc/src/declarative/ecmascriptblocks.qdoc @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qmlecmascript.html +\title ECMAScript Blocks + +QML encourages building UIs declaratively, using \l {Property Binding} and existing +\l {QML Elements}. When imperative code is required to implementing more advanced +behavior, the \l Script element can be used to add ECMAScript code directly to a +QML file, or to include an external ECMAScript file. + +The \l Script element is a QML language \e intrinsic. It can be used anywhere in a +QML file. \e except as the root element of a file or sub-component. The included +ECMAScript is evaluated in a scope chain. The \l {QML Scope} documentation covers +the specifics of scoping in QML. + +\section1 Inline ECMAScript + +\code +Rectangle { + Script { + function factorial(var a) { + a = Integer(a); + if (a <= 0) + return 1; + else + return a * factorial(a - 1); + } + } +} +\endcode + +\section1 Including a ECMAScript File + +*/ diff --git a/doc/src/declarative/network.qdoc b/doc/src/declarative/network.qdoc new file mode 100644 index 0000000..3d75706 --- /dev/null +++ b/doc/src/declarative/network.qdoc @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qmlnetwork.html +\title Network Transparency + +\list +\o Documents and script blocks can be fetched transparently over the network (blocking) +\o Images, fonts can be fetched transparently over the network (non-blocking) +\o Configuring the network access manager +\o Relative URL resolution from ECMAScript/QML +\endlist + +*/ diff --git a/doc/src/declarative/propertybinding.qdoc b/doc/src/declarative/propertybinding.qdoc new file mode 100644 index 0000000..4cf08d8 --- /dev/null +++ b/doc/src/declarative/propertybinding.qdoc @@ -0,0 +1,103 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page propertybinding.html +\title Property Binding + +Property binding is a declarative way of specifying the value of a property. Binding allows +a property's value to be expressed as an ECMAScript expression that defines the value relative +to other property values or data accessible in the application. The property value is +automatically kept up to date if the other properties or data values change. + +Property bindings are created implicitly in QML whenever an property is assigned an ECMAScript +expression. The following QML uses two property bindings to connect the size of the rectangle +to that of \c otherItem. + +\code +Rectangle { + width: otherItem.width + height: otherItem.height +} +\endcode + +QML extends a standards compliant ECMAScript engine, so any valid ECMAScript expression can be +used as a property binding. Bindings can access object properties, make function calls and even +use builtin ECMAScript objects like \e {Date} and \e {Math}. Assigning a constant value to a +property can even be thought of as a binding - afterall, a constant is a valid ECMAScript +expression! Here are some examples of more complex bindings: + +\code +Rectangle { + Script { + function calculateMyWidth() { + return Math.max(otherItem.width, thirdItem.width); + } + } + + anchors.centerIn: parent + width: Math.min(otherItem.width, 10) + height: calculateMyWidth() + color: { if (width > 10) "blue"; else "red" } +} +\endcode + +Being ECMAScript expressions, bindings are evaluated in a scope chain. The \l {QML Scope} +documentation covers the specifics of scoping in QML. + +\list +\o When does a binding not get updated? +\o Scope +\o Assigning a constant/other binding clears existing binding +\o Loops +\o Using model data +\endlist + +\section1 Binding Element + +The implicit binding syntax shown previously is easy to use and works perfectly for most uses +of bindings. In some advanced cases, it is necessary to create bindings explicitly using the +\l Binding element. + +One such example is included in the \l {Passing Data Between C++ and QML} documentation. +\sa {QML/C++ Data Binding} +*/ + diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index d60f4ed..fa5c0e6 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -71,7 +71,10 @@ Core QML Features: \list + \o \l {Anatomy of a QML Document} \o \l {Property Binding} + \o \l {ECMAScript Blocks} + \o \l {Network Transparency} \o \l {qmlmodels}{Data Models} \o \l {anchor-layout}{Anchor-based Layout} \o \l {qmlanimation}{Animation} @@ -83,7 +86,7 @@ QML Reference: \list \o \l {QML Format Reference} - \o \l {elements}{QML Elements} + \o \l {QML Elements} \endlist C++ Reference: diff --git a/doc/src/declarative/scope.qdoc b/doc/src/declarative/scope.qdoc new file mode 100644 index 0000000..c35f3e3 --- /dev/null +++ b/doc/src/declarative/scope.qdoc @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qmlscope.html +\title QML Scope + +QML is a \e {dynamically scoped} language. \l {Property Binding}s and \l {ECMAScript Blocks} +are executed + +*/ -- cgit v0.12 From 1813e81d0c04c447ee4d6d6fb286317b218c9696 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Oct 2009 19:16:27 +1000 Subject: Doc --- doc/src/declarative/qtdeclarative.qdoc | 104 ++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 47 deletions(-) diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index fa5c0e6..549330b 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -40,58 +40,68 @@ ****************************************************************************/ /*! - \module QtDeclarative - \title QtDeclarative Module - \ingroup modules +\module QtDeclarative +\title QtDeclarative Module +\ingroup modules - \brief The Qt Declarative module provides a declarative framework for building - highly dynamic, custom UIs +\brief The Qt Declarative module provides a declarative framework for building +highly dynamic, custom UIs - Qt Declarative is targetted at the sorts of user - interface (and the sorts of hardware) in embedded devices such as phones, media - players, and set-top boxes. It is also appropriate for highly custom desktop - user interfaces, or special elements in more traditional desktop - user interfaces. +Qt Declarative aids programmers and designers in building the animation rich, +highly fluid user interfaces that are becoming common in portable consumer +electronics devices, such as mobile phones, media players, set-top boxes and +netbooks. The Qt Declarative module provides an engine for interpreting the +declarative QML language, and a rich set of \l {QML Elements} that can be used +from QML. - Building fluid applications is done declaratively, rather than procedurally. - That is, you specify \e what the UI should look like and how it should behave - in an declarative format called QML, rather than specifying step-by-step \e how to - build it in a language like C++ or JavaScript. Specifying a UI declaratively - does not just include the layout of the interface items, but also the way each - individual item looks and behaves and the overall flow of the application. +QML is an extension to \l {http://www.ecma-international.org/publications/standards/Ecma-262.htm} +{ECMAScript}, that provides a mechanism to declaratively build an object tree +of \l {QML Elements}. QML improves the integration between ECMAScript and Qt's +existing QObject based type system, adds support for automatic +\l {Property Binding}s and provides \l {Network Transparency} at the language +level. - Getting Started: - \list - \o \l {Introduction to the QML language} - \o \l {tutorial}{Tutorial: 'Hello World'} - \o \l {tutorials-declarative-contacts.html}{Tutorial: 'Introduction to QML'} - \o \l {advtutorial.html}{Advanced Tutorial: 'Same Game'} - \o \l {qmlexamples}{Examples} - \endlist +The \l {QML Elements} are a sophisticated set of graphical and behavioral building +blocks. \l {QML Elements} are combined together in QML files to build components +ranging in complexity from simple pushbuttons and sliders, to complete +internet-enabled applications like a \l {http://www.flickr.com}{flickr} photo browser. - Core QML Features: - \list - \o \l {Anatomy of a QML Document} - \o \l {Property Binding} - \o \l {ECMAScript Blocks} - \o \l {Network Transparency} - \o \l {qmlmodels}{Data Models} - \o \l {anchor-layout}{Anchor-based Layout} - \o \l {qmlanimation}{Animation} - \o \l {qmlmodules}{Modules} - \o \l {qmlfocus}{Keyboard Focus} - \o \l {Extending types from QML} - \endlist +Qt Declarative builds on \l {QML for Qt programmers}{Qt's existing strengths}. +QML can be be used to incrementally extend an existing application or to build +completely new applications. QML is fully \l {Extending QML}{extensible from C++}. - QML Reference: - \list - \o \l {QML Format Reference} - \o \l {QML Elements} - \endlist +\section1 Getting Started: +\list +\o \l {Introduction to the QML language} +\o \l {tutorial}{Tutorial: 'Hello World'} +\o \l {tutorials-declarative-contacts.html}{Tutorial: 'Introduction to QML'} +\o \l {advtutorial.html}{Advanced Tutorial: 'Same Game'} +\o \l {qmlexamples}{Examples} +\endlist - C++ Reference: - \list - \o \l {Extending QML} - \o \l {qtbinding}{QML/C++ Data Binding} - \endlist +\section1 Core QML Features: +\list +\o \l {Anatomy of a QML Document} +\o \l {Property Binding} +\o \l {ECMAScript Blocks} +\o \l {Network Transparency} +\o \l {qmlmodels}{Data Models} +\o \l {anchor-layout}{Anchor-based Layout} +\o \l {qmlanimation}{Animation} +\o \l {qmlmodules}{Modules} +\o \l {qmlfocus}{Keyboard Focus} +\o \l {Extending types from QML} +\endlist + +\section1 QML Reference: +\list +\o \l {QML Format Reference} +\o \l {QML Elements} +\endlist + +\section1 C++ Reference: +\list +\o \l {Extending QML} +\o \l {qtbinding}{QML/C++ Data Binding} +\endlist */ -- cgit v0.12 From 65dfb60a64d31baa555e6c52ccf3aad4309a9db3 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Oct 2009 19:21:24 +1000 Subject: Doc --- doc/src/declarative/examples.qdoc | 1 - doc/src/declarative/qtdeclarative.qdoc | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 5408098..7a03685 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -41,7 +41,6 @@ /*! \page qmlexamples.html -\target qmlexamples \title QML Examples A \l {qmlviewer}{viewer} application is included that allows you to quickly explore many of the diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 549330b..56f3252 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -76,7 +76,7 @@ completely new applications. QML is fully \l {Extending QML}{extensible from C+ \o \l {tutorial}{Tutorial: 'Hello World'} \o \l {tutorials-declarative-contacts.html}{Tutorial: 'Introduction to QML'} \o \l {advtutorial.html}{Advanced Tutorial: 'Same Game'} -\o \l {qmlexamples}{Examples} +\o \l {QML Examples} \endlist \section1 Core QML Features: -- cgit v0.12