From 8e87197c2afa19df1fb15cb9b6b3cc17c3d4c0d6 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 1 Apr 2010 15:29:26 +1000 Subject: Optimization: Improve allocation strategy for QDeclarativeDeclarativeData This improves the declarative/creation/itemtree_qml benchmark by 6% --- src/corelib/kernel/qobject.cpp | 8 ++-- src/corelib/kernel/qobject_p.h | 5 +-- src/declarative/qml/qdeclarativecompiler.cpp | 45 ++++++++++++++-------- .../qml/qdeclarativedeclarativedata_p.h | 8 +++- src/declarative/qml/qdeclarativeengine.cpp | 14 +++++++ src/declarative/qml/qdeclarativeinstruction.cpp | 2 + src/declarative/qml/qdeclarativeinstruction_p.h | 7 ++++ src/declarative/qml/qdeclarativemetatype.cpp | 10 +++++ src/declarative/qml/qdeclarativemetatype_p.h | 4 ++ src/declarative/qml/qdeclarativevme.cpp | 22 ++++++++++- 10 files changed, 101 insertions(+), 24 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index dbc6be2..dfd6a08 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -125,8 +125,10 @@ extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *) } } +void (*QDeclarativeData::destroyed)(QDeclarativeData *, QObject *) = 0; +void (*QDeclarativeData::parentChanged)(QDeclarativeData *, QObject *, QObject *) = 0; + QObjectData::~QObjectData() {} -QDeclarativeData::~QDeclarativeData() {} QObjectPrivate::QObjectPrivate(int version) : threadData(0), connectionLists(0), senders(0), currentSender(0), currentChildBeingDeleted(0) @@ -876,7 +878,7 @@ QObject::~QObject() } if (d->declarativeData) - d->declarativeData->destroyed(this); + QDeclarativeData::destroyed(d->declarativeData, this); { QMutex *signalSlotMutex = 0; @@ -2025,7 +2027,7 @@ void QObjectPrivate::setParent_helper(QObject *o) } } if (!wasDeleted && declarativeData) - declarativeData->parentChanged(q, o); + QDeclarativeData::parentChanged(declarativeData, q, o); } /*! diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index 3b59abb..e5d904c 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -87,9 +87,8 @@ enum { QObjectPrivateVersion = QT_VERSION }; class Q_CORE_EXPORT QDeclarativeData { public: - virtual ~QDeclarativeData(); - virtual void destroyed(QObject *) = 0; - virtual void parentChanged(QObject *, QObject *) = 0; + static void (*destroyed)(QDeclarativeData *, QObject *); + static void (*parentChanged)(QDeclarativeData *, QObject *, QObject *); }; class Q_CORE_EXPORT QObjectPrivate : public QObjectData diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 56af5f5..27fecfb 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -881,23 +881,38 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj) } // Create the object - QDeclarativeInstruction create; - create.type = QDeclarativeInstruction::CreateObject; - create.line = obj->location.start.line; - create.create.column = obj->location.start.column; - create.create.data = -1; - if (!obj->custom.isEmpty()) - create.create.data = output->indexForByteArray(obj->custom); - create.create.type = obj->type; - if (!output->types.at(create.create.type).type && - !obj->bindingBitmask.isEmpty()) { - Q_ASSERT(obj->bindingBitmask.size() % 4 == 0); - create.create.bindingBits = - output->indexForByteArray(obj->bindingBitmask); + if (obj->custom.isEmpty() && output->types.at(obj->type).type && + obj != compileState.root) { + + QDeclarativeInstruction create; + create.type = QDeclarativeInstruction::CreateSimpleObject; + create.line = obj->location.start.line; + create.createSimple.create = output->types.at(obj->type).type->createFunction(); + create.createSimple.typeSize = output->types.at(obj->type).type->createSize(); + create.createSimple.column = obj->location.start.column; + output->bytecode << create; + } else { - create.create.bindingBits = -1; + + QDeclarativeInstruction create; + create.type = QDeclarativeInstruction::CreateObject; + create.line = obj->location.start.line; + create.create.column = obj->location.start.column; + create.create.data = -1; + if (!obj->custom.isEmpty()) + create.create.data = output->indexForByteArray(obj->custom); + create.create.type = obj->type; + if (!output->types.at(create.create.type).type && + !obj->bindingBitmask.isEmpty()) { + Q_ASSERT(obj->bindingBitmask.size() % 4 == 0); + create.create.bindingBits = + output->indexForByteArray(obj->bindingBitmask); + } else { + create.create.bindingBits = -1; + } + output->bytecode << create; + } - output->bytecode << create; // Setup the synthesized meta object if necessary if (!obj->metadata.isEmpty()) { diff --git a/src/declarative/qml/qdeclarativedeclarativedata_p.h b/src/declarative/qml/qdeclarativedeclarativedata_p.h index d1d063a..dfc3113 100644 --- a/src/declarative/qml/qdeclarativedeclarativedata_p.h +++ b/src/declarative/qml/qdeclarativedeclarativedata_p.h @@ -64,6 +64,10 @@ class QDeclarativeAbstractBinding; class QDeclarativeContext; class QDeclarativePropertyCache; class QDeclarativeContextData; +// This class is structured in such a way, that simply zero'ing it is the +// default state for elemental object allocations. This is crucial in the +// workings of the QDeclarativeInstruction::CreateSimpleObject instruction. +// Don't change anything here without first considering that case! class Q_AUTOTEST_EXPORT QDeclarativeDeclarativeData : public QDeclarativeData { public: @@ -73,8 +77,8 @@ public: bindingBits(0), lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0), attachedProperties(0), propertyCache(0), guards(0) {} - virtual void destroyed(QObject *); - virtual void parentChanged(QObject *, QObject *); + void destroyed(QObject *); + void parentChanged(QObject *, QObject *); void setImplicitDestructible() { if (!explicitIndestructibleSet) indestructible = false; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 3e570e5..65dd72b 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -346,6 +346,17 @@ Q_GLOBAL_STATIC(QDeclarativeEngineDebugServer, qmlEngineDebugServer); typedef QMap StringStringMap; Q_GLOBAL_STATIC(StringStringMap, qmlEnginePluginsWithRegisteredTypes); // stores the uri + +static void QDeclarativeDeclarativeData_destroyed(QDeclarativeData *d, QObject *o) +{ + static_cast(d)->destroyed(o); +} + +static void QDeclarativeDeclarativeData_parentChanged(QDeclarativeData *d, QObject *o, QObject *p) +{ + static_cast(d)->parentChanged(o, p); +} + void QDeclarativeEnginePrivate::init() { Q_Q(QDeclarativeEngine); @@ -353,6 +364,9 @@ void QDeclarativeEnginePrivate::init() qRegisterMetaType("QDeclarativeScriptString"); qRegisterMetaType("QScriptValue"); + QDeclarativeData::destroyed = QDeclarativeDeclarativeData_destroyed; + QDeclarativeData::parentChanged = QDeclarativeDeclarativeData_parentChanged; + contextClass = new QDeclarativeContextScriptClass(q); objectClass = new QDeclarativeObjectScriptClass(q); valueTypeClass = new QDeclarativeValueTypeScriptClass(q); diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp index 9083ab3..36e5a2d 100644 --- a/src/declarative/qml/qdeclarativeinstruction.cpp +++ b/src/declarative/qml/qdeclarativeinstruction.cpp @@ -60,6 +60,8 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx) break; case QDeclarativeInstruction::CreateObject: qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE\t\t\t" << instr->create.type << "\t\t\t" << types.at(instr->create.type).className; + case QDeclarativeInstruction::CreateSimpleObject: + qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE_SIMPLE\t\t" << instr->createSimple.typeSize; break; case QDeclarativeInstruction::SetId: qWarning().nospace() << idx << "\t\t" << line << "\t" << "SETID\t\t\t" << instr->setId.value << "\t\t\t" << primitives.at(instr->setId.value); diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h index 877179d..1f3c964 100644 --- a/src/declarative/qml/qdeclarativeinstruction_p.h +++ b/src/declarative/qml/qdeclarativeinstruction_p.h @@ -74,6 +74,7 @@ public: // top of the stack. Init, /* init */ CreateObject, /* create */ + CreateSimpleObject, /* createSimple */ SetId, /* setId */ SetDefault, CreateComponent, /* createComponent */ @@ -175,6 +176,11 @@ public: int bindingBits; ushort column; }; + struct CreateSimpleInstruction { + void (*create)(void *); + int typeSize; + ushort column; + }; struct StoreMetaInstruction { int data; int aliasData; @@ -305,6 +311,7 @@ public: union { InitInstruction init; CreateInstruction create; + CreateSimpleInstruction createSimple; StoreMetaInstruction storeMeta; SetIdInstruction setId; AssignValueSourceInstruction assignValueSource; diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp index c512d97..6f99f95 100644 --- a/src/declarative/qml/qdeclarativemetatype.cpp +++ b/src/declarative/qml/qdeclarativemetatype.cpp @@ -313,6 +313,16 @@ QDeclarativeCustomParser *QDeclarativeType::customParser() const return d->m_customParser; } +QDeclarativeType::CreateFunc QDeclarativeType::createFunction() const +{ + return d->m_newFunc; +} + +int QDeclarativeType::createSize() const +{ + return d->m_allocationSize; +} + bool QDeclarativeType::isCreatable() const { return d->m_newFunc != 0; diff --git a/src/declarative/qml/qdeclarativemetatype_p.h b/src/declarative/qml/qdeclarativemetatype_p.h index b3ec5e3..96e3c74 100644 --- a/src/declarative/qml/qdeclarativemetatype_p.h +++ b/src/declarative/qml/qdeclarativemetatype_p.h @@ -115,6 +115,10 @@ public: QObject *create() const; void create(QObject **, void **, size_t) const; + typedef void (*CreateFunc)(void *); + CreateFunc createFunction() const; + int createSize() const; + QDeclarativeCustomParser *customParser() const; bool isCreatable() const; diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index 2338bc3..6498e6c 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -236,13 +236,33 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, } } else { QDeclarative_setParent_noEvent(o, parent); - // o->setParent(parent); } } stack.push(o); } break; + case QDeclarativeInstruction::CreateSimpleObject: + { + QObject *o = (QObject *)operator new(instr.createSimple.typeSize + + sizeof(QDeclarativeDeclarativeData)); + ::bzero(o, instr.createSimple.typeSize + sizeof(QDeclarativeDeclarativeData)); + instr.createSimple.create(o); + + QDeclarativeDeclarativeData *ddata = + (QDeclarativeDeclarativeData *)(((const char *)o) + instr.createSimple.typeSize); + ddata->lineNumber = instr.line; + ddata->columnNumber = instr.createSimple.column; + + QObjectPrivate::get(o)->declarativeData = ddata; + ctxt->addObject(o); + QObject *parent = stack.top(); + QDeclarative_setParent_noEvent(o, parent); + + stack.push(o); + } + break; + case QDeclarativeInstruction::SetId: { QObject *target = stack.top(); -- cgit v0.12 From b8b4613800abfe1bc8861011c7152d6d242414e1 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 1 Apr 2010 15:59:59 +1000 Subject: Optimization: Minor object allocation speedup --- src/declarative/qml/qdeclarativevme.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index 6498e6c..0bdc4d5 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -255,7 +255,13 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, ddata->columnNumber = instr.createSimple.column; QObjectPrivate::get(o)->declarativeData = ddata; - ctxt->addObject(o); + + ddata->nextContextObject = ctxt->contextObjects; + if (ddata->nextContextObject) + ddata->nextContextObject->prevContextObject = &ddata->nextContextObject; + ddata->prevContextObject = &ctxt->contextObjects; + ctxt->contextObjects = ddata; + QObject *parent = stack.top(); QDeclarative_setParent_noEvent(o, parent); -- cgit v0.12 From 8907d7cc427e5f1022c6f25944a123e65391c4f2 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 1 Apr 2010 17:11:36 +1000 Subject: Crash: Assign context in CreateSimpleObject too --- src/declarative/qml/qdeclarativevme.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index 0bdc4d5..487ec0c 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -255,13 +255,13 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, ddata->columnNumber = instr.createSimple.column; QObjectPrivate::get(o)->declarativeData = ddata; - - ddata->nextContextObject = ctxt->contextObjects; + ddata->context = ddata->outerContext = ctxt; + ddata->nextContextObject = ctxt->contextObjects; if (ddata->nextContextObject) - ddata->nextContextObject->prevContextObject = &ddata->nextContextObject; - ddata->prevContextObject = &ctxt->contextObjects; - ctxt->contextObjects = ddata; - + ddata->nextContextObject->prevContextObject = &ddata->nextContextObject; + ddata->prevContextObject = &ctxt->contextObjects; + ctxt->contextObjects = ddata; + QObject *parent = stack.top(); QDeclarative_setParent_noEvent(o, parent); -- cgit v0.12 From 739c1c6a4322c0d48afd2a24e3dc2156fee577e1 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 1 Apr 2010 17:17:37 +1000 Subject: Optimization: Only allocate QScriptValue if we need too --- src/declarative/qml/qdeclarativedeclarativedata_p.h | 6 ++++-- src/declarative/qml/qdeclarativeengine.cpp | 7 ++++--- src/declarative/qml/qdeclarativeobjectscriptclass.cpp | 10 +++++----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/declarative/qml/qdeclarativedeclarativedata_p.h b/src/declarative/qml/qdeclarativedeclarativedata_p.h index dfc3113..aea775b 100644 --- a/src/declarative/qml/qdeclarativedeclarativedata_p.h +++ b/src/declarative/qml/qdeclarativedeclarativedata_p.h @@ -75,7 +75,7 @@ public: : ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false), context(0), outerContext(0), bindings(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0), bindingBits(0), lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0), - attachedProperties(0), propertyCache(0), guards(0) {} + attachedProperties(0), scriptValue(0), propertyCache(0), guards(0) {} void destroyed(QObject *); void parentChanged(QObject *, QObject *); @@ -113,7 +113,9 @@ public: QHash *attachedProperties; - QScriptValue scriptValue; + // ### Can we make this QScriptValuePrivate so we incur no additional allocation + // cost? + QScriptValue *scriptValue; QDeclarativePropertyCache *propertyCache; QDeclarativeGuard *guards; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 65dd72b..cf5fc3b 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -862,15 +862,16 @@ void QDeclarativeDeclarativeData::destroyed(QObject *object) if (ownContext) context->destroy(); + if (scriptValue) + delete scriptValue; + if (ownMemory) delete this; - else - this->~QDeclarativeDeclarativeData(); } void QDeclarativeDeclarativeData::parentChanged(QObject *, QObject *parent) { - if (!parent && scriptValue.isValid()) scriptValue = QScriptValue(); + if (!parent && scriptValue) { delete scriptValue; scriptValue = 0; } } bool QDeclarativeDeclarativeData::hasBindingBit(int bit) const diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 84c9bef..1424508 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -109,11 +109,11 @@ QScriptValue QDeclarativeObjectScriptClass::newQObject(QObject *object, int type return scriptEngine->undefinedValue(); } else if (!ddata->indestructible && !object->parent()) { return newObject(scriptEngine, this, new ObjectData(object, type)); - } else if (!ddata->scriptValue.isValid()) { - ddata->scriptValue = newObject(scriptEngine, this, new ObjectData(object, type)); - return ddata->scriptValue; - } else if (ddata->scriptValue.engine() == QDeclarativeEnginePrivate::getScriptEngine(engine)) { - return ddata->scriptValue; + } else if (!ddata->scriptValue) { + ddata->scriptValue = new QScriptValue(newObject(scriptEngine, this, new ObjectData(object, type))); + return *ddata->scriptValue; + } else if (ddata->scriptValue->engine() == QDeclarativeEnginePrivate::getScriptEngine(engine)) { + return *ddata->scriptValue; } else { return newObject(scriptEngine, this, new ObjectData(object, type)); } -- cgit v0.12 From 71a328397720af7229fd6ee48acaa19f7339a8de Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 7 Apr 2010 09:54:22 +1000 Subject: Don't crash if a target isn't specified for AnchorChanges. --- src/declarative/util/qdeclarativestateoperations.cpp | 12 ++++++++++++ .../qdeclarativestates/data/anchorChangesCrash.qml | 14 ++++++++++++++ .../qdeclarativestates/tst_qdeclarativestates.cpp | 15 +++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativestates/data/anchorChangesCrash.qml diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp index 2cc1fcc..410a269 100644 --- a/src/declarative/util/qdeclarativestateoperations.cpp +++ b/src/declarative/util/qdeclarativestateoperations.cpp @@ -1090,6 +1090,9 @@ bool QDeclarativeAnchorChanges::changesBindings() void QDeclarativeAnchorChanges::saveOriginals() { Q_D(QDeclarativeAnchorChanges); + if (!d->target) + return; + d->origLeft = d->target->anchors()->left(); d->origRight = d->target->anchors()->right(); d->origHCenter = d->target->anchors()->horizontalCenter(); @@ -1146,6 +1149,9 @@ void QDeclarativeAnchorChanges::copyOriginals(QDeclarativeActionEvent *other) void QDeclarativeAnchorChanges::clearBindings() { Q_D(QDeclarativeAnchorChanges); + if (!d->target) + return; + d->fromX = d->target->x(); d->fromY = d->target->y(); d->fromWidth = d->target->width(); @@ -1242,6 +1248,9 @@ void QDeclarativeAnchorChanges::rewind() void QDeclarativeAnchorChanges::saveCurrentValues() { Q_D(QDeclarativeAnchorChanges); + if (!d->target) + return; + d->rewindLeft = d->target->anchors()->left(); d->rewindRight = d->target->anchors()->right(); d->rewindHCenter = d->target->anchors()->horizontalCenter(); @@ -1259,6 +1268,9 @@ void QDeclarativeAnchorChanges::saveCurrentValues() void QDeclarativeAnchorChanges::saveTargetValues() { Q_D(QDeclarativeAnchorChanges); + if (!d->target) + return; + d->toX = d->target->x(); d->toY = d->target->y(); d->toWidth = d->target->width(); diff --git a/tests/auto/declarative/qdeclarativestates/data/anchorChangesCrash.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChangesCrash.qml new file mode 100644 index 0000000..861ef8f --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/anchorChangesCrash.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +Rectangle { + id: container + width: 400 + height: 400 + + states: State { + name: "reanchored" + AnchorChanges { + anchors.top: container.top + } + } +} diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index 2ab21a4..e7c595a 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -94,6 +94,7 @@ private slots: void anchorChanges3(); void anchorChanges4(); void anchorChanges5(); + void anchorChangesCrash(); void script(); void restoreEntryValues(); void explicitChanges(); @@ -716,6 +717,20 @@ void tst_qdeclarativestates::anchorChanges5() delete rect; } +//QTBUG-9609 +void tst_qdeclarativestates::anchorChangesCrash() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChangesCrash.qml"); + QDeclarativeRectangle *rect = qobject_cast(rectComponent.create()); + QVERIFY(rect != 0); + + rect->setState("reanchored"); + + delete rect; +} + void tst_qdeclarativestates::script() { QDeclarativeEngine engine; -- cgit v0.12 From 01cd0bdf7e08f537b1e9b46e70653761145f8720 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 7 Apr 2010 10:11:03 +1000 Subject: Honor the startDragThreshold in MouseArea drag. Task-number: QTBUG-9381 --- src/declarative/graphicsitems/qdeclarativemousearea.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 6126a6f..f64201b 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -439,7 +439,7 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) } } - if (d->dragX) { + if (d->dragX && d->dragged) { qreal x = (curLocalPos.x() - startLocalPos.x()) + d->startX; if (x < drag()->xmin()) x = drag()->xmin(); @@ -447,7 +447,7 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) x = drag()->xmax(); drag()->target()->setX(x); } - if (d->dragY) { + if (d->dragY && d->dragged) { qreal y = (curLocalPos.y() - startLocalPos.y()) + d->startY; if (y < drag()->ymin()) y = drag()->ymin(); -- cgit v0.12 From 56ba9096ad78302214a200b0eea7033f3880b0b7 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 31 Mar 2010 15:31:47 +1000 Subject: Expand test. --- .../qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/declarative/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp b/tests/auto/declarative/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp index 7b1293e..e475d42 100644 --- a/tests/auto/declarative/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp +++ b/tests/auto/declarative/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp @@ -71,11 +71,16 @@ void tst_qdeclarativestyledtext::textOutput_data() QTest::newRow("missing ") << "text" << "text"; QTest::newRow("bad nest") << "text italic" << "text italic"; QTest::newRow("font color") << "red text" << "red text"; + QTest::newRow("font color: single quote") << "red text" << "red text"; QTest::newRow("font size") << "text" << "text"; QTest::newRow("font empty") << "text" << "text"; QTest::newRow("font bad 1") << "text" << "text"; QTest::newRow("font bad 2") << "text" << ""; QTest::newRow("extra close") << "text" << "text"; + QTest::newRow("extra space") << "text" << "text"; + QTest::newRow("entities") << "<b>this & that</b>" << "this & that"; + QTest::newRow("newline") << "text
more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") ; + QTest::newRow("self-closing newline") << "text
more text" << QLatin1String("text") + QChar(QChar::LineSeparator) + QLatin1String("more text") ; QTest::newRow("empty") << "" << ""; } -- cgit v0.12 From c08d826ed1afc8e4c1289b8daebca9dc0e17fbc2 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 7 Apr 2010 11:10:27 +1000 Subject: Initialize drag movement correctly if drag.target is set after mouse move. Task-number: QTBUG-9638 --- src/declarative/graphicsitems/qdeclarativemousearea.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index b89c427..06ecb61 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -412,8 +412,8 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) if (d->drag && d->drag->target()) { if (!d->moved) { - if (d->dragX) d->startX = drag()->target()->x(); - if (d->dragY) d->startY = drag()->target()->y(); + d->startX = drag()->target()->x(); + d->startY = drag()->target()->y(); } QPointF startLocalPos; @@ -455,8 +455,8 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) y = drag()->ymax(); drag()->target()->setY(y); } + d->moved = true; } - d->moved = true; QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress); emit positionChanged(&me); } -- cgit v0.12 From 173c1194f3fc35ba7249c30e3e99bd975dcdcc64 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 7 Apr 2010 11:28:02 +1000 Subject: Document MouseEvent.accepted. Task-number: QTBUG-9639 --- src/declarative/graphicsitems/qdeclarativeevents.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativeevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp index 6118ea8..a181071 100644 --- a/src/declarative/graphicsitems/qdeclarativeevents.cpp +++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp @@ -133,6 +133,17 @@ Item { These properties hold the position of the mouse event. */ + +/*! + \qmlproperty bool MouseEvent::accepted + + Setting \a accepted to true prevents the mouse event from being + propagated to items below this item. + + Generally, if the item acts on the mouse event then it should be accepted + so that items lower in the stacking order do not also respond to the same event. +*/ + /*! \qmlproperty enum MouseEvent::button -- cgit v0.12 From 9c4140af1cbc650905de698daa4ab0183efba477 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 7 Apr 2010 11:56:07 +1000 Subject: Allow MouseArea.Drag.target to be reset. Task-number: QTBUG-9637 --- .../graphicsitems/qdeclarativemousearea.cpp | 8 ++++ .../graphicsitems/qdeclarativemousearea_p.h | 3 +- .../qdeclarativemousearea/data/dragreset.qml | 28 ++++++++++++++ .../tst_qdeclarativemousearea.cpp | 45 +++++++++++++++++++--- 4 files changed, 77 insertions(+), 7 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativemousearea/data/dragreset.qml diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 06ecb61..c95bd29 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -71,6 +71,14 @@ void QDeclarativeDrag::setTarget(QGraphicsObject *t) emit targetChanged(); } +void QDeclarativeDrag::resetTarget() +{ + if (!_target) + return; + _target = 0; + emit targetChanged(); +} + QDeclarativeDrag::Axis QDeclarativeDrag::axis() const { return _axis; diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h index db49b57..58faac1 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h @@ -55,7 +55,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeDrag : public QObject Q_OBJECT Q_ENUMS(Axis) - Q_PROPERTY(QGraphicsObject *target READ target WRITE setTarget NOTIFY targetChanged) + Q_PROPERTY(QGraphicsObject *target READ target WRITE setTarget NOTIFY targetChanged RESET resetTarget) Q_PROPERTY(Axis axis READ axis WRITE setAxis NOTIFY axisChanged) Q_PROPERTY(qreal minimumX READ xmin WRITE setXmin NOTIFY minimumXChanged) Q_PROPERTY(qreal maximumX READ xmax WRITE setXmax NOTIFY maximumXChanged) @@ -69,6 +69,7 @@ public: QGraphicsObject *target() const; void setTarget(QGraphicsObject *); + void resetTarget(); enum Axis { XAxis=0x01, YAxis=0x02, XandYAxis=0x03 }; Axis axis() const; diff --git a/tests/auto/declarative/qdeclarativemousearea/data/dragreset.qml b/tests/auto/declarative/qdeclarativemousearea/data/dragreset.qml new file mode 100644 index 0000000..4bfb9c3 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemousearea/data/dragreset.qml @@ -0,0 +1,28 @@ +import Qt 4.6 +Rectangle { + id: whiteRect + width: 200 + height: 200 + color: "white" + Rectangle { + id: blackRect + objectName: "blackrect" + color: "black" + y: 50 + x: 50 + width: 100 + height: 100 + opacity: (whiteRect.width-blackRect.x+whiteRect.height-blackRect.y-199)/200 + Text { text: blackRect.opacity} + MouseArea { + objectName: "mouseregion" + anchors.fill: parent + drag.target: haveTarget ? blackRect : undefined + drag.axis: Drag.XandYAxis + drag.minimumX: 0 + drag.maximumX: whiteRect.width-blackRect.width + drag.minimumY: 0 + drag.maximumY: whiteRect.height-blackRect.height + } + } + } diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp index 9b664e5..dfe46e4 100644 --- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp +++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp @@ -44,20 +44,23 @@ #include #include #include +#include class tst_QDeclarativeMouseArea: public QObject { Q_OBJECT private slots: void dragProperties(); + void resetDrag(); void updateMouseAreaPosOnClick(); private: - QDeclarativeView *createView(const QString &filename); + QDeclarativeView *createView(); }; void tst_QDeclarativeMouseArea::dragProperties() { - QDeclarativeView *canvas = createView(SRCDIR "/data/dragproperties.qml"); + QDeclarativeView *canvas = createView(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragproperties.qml")); canvas->show(); canvas->setFocus(); QVERIFY(canvas->rootObject() != 0); @@ -127,19 +130,49 @@ void tst_QDeclarativeMouseArea::dragProperties() delete canvas; } -QDeclarativeView *tst_QDeclarativeMouseArea::createView(const QString &filename) +void tst_QDeclarativeMouseArea::resetDrag() +{ + QDeclarativeView *canvas = createView(); + + canvas->rootContext()->setContextProperty("haveTarget", QVariant(true)); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragreset.qml")); + canvas->show(); + canvas->setFocus(); + QVERIFY(canvas->rootObject() != 0); + + QDeclarativeMouseArea *mouseRegion = canvas->rootObject()->findChild("mouseregion"); + QDeclarativeDrag *drag = mouseRegion->drag(); + QVERIFY(mouseRegion != 0); + QVERIFY(drag != 0); + + // target + QDeclarativeItem *blackRect = canvas->rootObject()->findChild("blackrect"); + QVERIFY(blackRect != 0); + QVERIFY(blackRect == drag->target()); + QDeclarativeItem *rootItem = qobject_cast(canvas->rootObject()); + QVERIFY(rootItem != 0); + QSignalSpy targetSpy(drag, SIGNAL(targetChanged())); + QVERIFY(drag->target() != 0); + canvas->rootContext()->setContextProperty("haveTarget", QVariant(false)); + QCOMPARE(targetSpy.count(),1); + QVERIFY(drag->target() == 0); + + delete canvas; +} + + +QDeclarativeView *tst_QDeclarativeMouseArea::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(filename)); - return canvas; } void tst_QDeclarativeMouseArea::updateMouseAreaPosOnClick() { - QDeclarativeView *canvas = createView(SRCDIR "/data/updateMousePosOnClick.qml"); + QDeclarativeView *canvas = createView(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/updateMousePosOnClick.qml")); canvas->show(); canvas->setFocus(); QVERIFY(canvas->rootObject() != 0); -- cgit v0.12 From 32fdd579afc2933ccc5fc658553cf18cf2057ff2 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 7 Apr 2010 12:30:34 +1000 Subject: Compile Apply the ~QObject QDeclarativeData logic to ~QWidget --- src/gui/kernel/qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index e88026c..9353d10 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1478,7 +1478,7 @@ QWidget::~QWidget() QObjectPrivate::clearGuards(this); if (d->declarativeData) { - d->declarativeData->destroyed(this); + QDeclarativeData::destroyed(d->declarativeData, this); d->declarativeData = 0; // don't activate again in ~QObject } -- cgit v0.12 From 973cfce37fcdd1ce330f237eaa76930db55a73f6 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 7 Apr 2010 11:53:16 +1000 Subject: Add QListModelInterface::modelReset() signal and emit this in XmlListModel when all data has changed. --- src/declarative/3rdparty/qlistmodelinterface.cpp | 6 +++ src/declarative/3rdparty/qlistmodelinterface_p.h | 1 + .../graphicsitems/qdeclarativevisualitemmodel.cpp | 2 + src/declarative/util/qdeclarativexmllistmodel.cpp | 25 +++++----- src/declarative/util/qdeclarativexmllistmodel_p.h | 1 + .../tst_qdeclarativexmllistmodel.cpp | 54 ++++++++-------------- 6 files changed, 43 insertions(+), 46 deletions(-) diff --git a/src/declarative/3rdparty/qlistmodelinterface.cpp b/src/declarative/3rdparty/qlistmodelinterface.cpp index 98d6a5b..20501a0 100644 --- a/src/declarative/3rdparty/qlistmodelinterface.cpp +++ b/src/declarative/3rdparty/qlistmodelinterface.cpp @@ -106,4 +106,10 @@ QT_BEGIN_NAMESPACE \a roles changed. */ +/*! \fn void QListModelInterface::modelReset() + Emit this signal when all of the model data has changed. + This is more efficient than forcing the receivier to handle multiple + inserted and removed signals etc. +*/ + QT_END_NAMESPACE diff --git a/src/declarative/3rdparty/qlistmodelinterface_p.h b/src/declarative/3rdparty/qlistmodelinterface_p.h index 07592ad..da91d12 100644 --- a/src/declarative/3rdparty/qlistmodelinterface_p.h +++ b/src/declarative/3rdparty/qlistmodelinterface_p.h @@ -72,6 +72,7 @@ class Q_DECLARATIVE_EXPORT QListModelInterface : public QObject void itemsRemoved(int index, int count); void itemsMoved(int from, int to, int count); void itemsChanged(int index, int count, const QList &roles); + void modelReset(); protected: QListModelInterface(QObjectPrivate &dd, QObject *parent) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 2938f51..172362c 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -662,6 +662,7 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model) this, SLOT(_q_itemsRemoved(int,int))); QObject::disconnect(d->m_listModelInterface, SIGNAL(itemsMoved(int,int,int)), this, SLOT(_q_itemsMoved(int,int,int))); + QObject::disconnect(d->m_listModelInterface, SIGNAL(modelReset()), this, SLOT(_q_modelReset())); d->m_listModelInterface = 0; } else if (d->m_abstractItemModel) { QObject::disconnect(d->m_abstractItemModel, SIGNAL(rowsInserted(const QModelIndex &,int,int)), @@ -705,6 +706,7 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model) this, SLOT(_q_itemsRemoved(int,int))); QObject::connect(d->m_listModelInterface, SIGNAL(itemsMoved(int,int,int)), this, SLOT(_q_itemsMoved(int,int,int))); + QObject::connect(d->m_listModelInterface, SIGNAL(modelReset()), this, SLOT(_q_modelReset())); d->m_metaDataCacheable = true; if (d->m_delegate && d->m_listModelInterface->count()) emit itemsInserted(0, d->m_listModelInterface->count()); diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index b33af06..11c7305 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -878,21 +878,22 @@ void QDeclarativeXmlListModel::queryCompleted(const QDeclarativeXmlQueryResult & } } if (!hasKeys) { - if (!(origCount == 0 && d->size == 0)) { - emit itemsRemoved(0, origCount); - emit itemsInserted(0, d->size); - emit countChanged(); - } + if (!(origCount == 0 && d->size == 0)) + emit modelReset(); } else { + if (result.removed.count() == 1 && result.removed[0].first == 0 + && result.removed[0].second == origCount) { + emit modelReset(); + } else { + for (int i=0; istatus); diff --git a/src/declarative/util/qdeclarativexmllistmodel_p.h b/src/declarative/util/qdeclarativexmllistmodel_p.h index 7b85476..fd410a7 100644 --- a/src/declarative/util/qdeclarativexmllistmodel_p.h +++ b/src/declarative/util/qdeclarativexmllistmodel_p.h @@ -124,6 +124,7 @@ Q_SIGNALS: void xmlChanged(); void queryChanged(); void namespaceDeclarationsChanged(); + void modelReset(); public Q_SLOTS: // ### need to use/expose Expiry to guess when to call this? diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp index 74da79e..ba0f9a7 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp +++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp @@ -378,17 +378,16 @@ void tst_qdeclarativexmllistmodel::reload() QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int))); QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int))); QSignalSpy spyCount(model, SIGNAL(countChanged())); + QSignalSpy spyReset(model, SIGNAL(modelReset())); model->reload(); - QTRY_COMPARE(spyCount.count(), 1); - QTRY_COMPARE(spyInsert.count(), 1); - QTRY_COMPARE(spyRemove.count(), 1); - - QCOMPARE(spyInsert[0][0].toInt(), 0); - QCOMPARE(spyInsert[0][1].toInt(), 9); + QTRY_COMPARE(spyReset.count(), 1); + QCOMPARE(spyCount.count(), 0); + QCOMPARE(spyInsert.count(), 0); + QCOMPARE(spyRemove.count(), 0); - QCOMPARE(spyRemove[0][0].toInt(), 0); - QCOMPARE(spyRemove[0][1].toInt(), 9); + QCOMPARE(model->data(0, model->roles().first()).toString(), QString("Polly")); + QCOMPARE(model->data(model->count()-1, model->roles().first()).toString(), QString("Tiny")); delete model; } @@ -416,15 +415,15 @@ void tst_qdeclarativexmllistmodel::useKeys() QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int))); QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int))); QSignalSpy spyCount(model, SIGNAL(countChanged())); + QSignalSpy spyReset(model, SIGNAL(modelReset())); model->setXml(newXml); - if (oldCount != newData.count()) { - QTRY_COMPARE(model->count(), newData.count()); - QCOMPARE(spyCount.count(), 1); + if (insertRanges.isEmpty() && removeRanges.isEmpty()) { + QTRY_COMPARE(spyReset.count(), 1); } else { QTRY_VERIFY(spyInsert.count() > 0 || spyRemove.count() > 0); - QCOMPARE(spyCount.count(), 0); + QCOMPARE(spyCount.count() == 0, oldCount == newData.count()); } QList roles = model->roles(); @@ -513,21 +512,14 @@ void tst_qdeclarativexmllistmodel::useKeys_data() << makeItemXmlAndData("", &modelData) << modelData << QList() - << (QList() << qMakePair(0, 3)); + << QList(); QTest::newRow("replace item") << makeItemXmlAndData("name=A,age=25,sport=Football") << 1 << makeItemXmlAndData("name=ZZZ,age=25,sport=Football", &modelData) << modelData - << (QList() << qMakePair(0, 1)) - << (QList() << qMakePair(0, 1)); - - QTest::newRow("add and remove simultaneously, in different spots") - << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf") << 4 - << makeItemXmlAndData("name=B,age=35,sport=Athletics;name=E,age=65,sport=Fencing", &modelData) - << modelData - << (QList() << qMakePair(1, 1)) - << (QList() << qMakePair(0, 1) << qMakePair(2,2)); + << QList() + << QList(); QTest::newRow("insert at start, remove at end i.e. rss feed") << makeItemXmlAndData("name=C,age=45,sport=Curling;name=D,age=55,sport=Golf;name=E,age=65,sport=Fencing") << 3 @@ -547,8 +539,8 @@ void tst_qdeclarativexmllistmodel::useKeys_data() << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35") << 2 << makeItemXmlAndData("name=C,age=45,sport=Curling;name=D,age=55,sport=Golf", &modelData) << modelData - << (QList() << qMakePair(0, 2)) - << (QList() << qMakePair(0, 2)); + << QList() + << QList(); } void tst_qdeclarativexmllistmodel::noKeysValueChanges() @@ -608,20 +600,14 @@ void tst_qdeclarativexmllistmodel::keysChanged() QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int))); QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int))); QSignalSpy spyCount(model, SIGNAL(countChanged())); + QSignalSpy spyReset(model, SIGNAL(modelReset())); QVERIFY(QMetaObject::invokeMethod(model, "disableNameKey")); model->setXml(xml); - QTRY_VERIFY(spyInsert.count() > 0 && spyRemove.count() > 0); - - QCOMPARE(spyInsert.count(), 1); - QCOMPARE(spyInsert[0][0].toInt(), 0); - QCOMPARE(spyInsert[0][1].toInt(), 2); - - QCOMPARE(spyRemove.count(), 1); - QCOMPARE(spyRemove[0][0].toInt(), 0); - QCOMPARE(spyRemove[0][1].toInt(), 2); - + QTRY_COMPARE(spyReset.count(), 1); + QCOMPARE(spyInsert.count(), 0); + QCOMPARE(spyRemove.count(), 0); QCOMPARE(spyCount.count(), 0); delete model; -- cgit v0.12 From 062e30769c2b04a5d8d0906c39a2bcb35defd3a2 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 7 Apr 2010 13:00:08 +1000 Subject: Allow iteration over the Item.children property QTBUG-9645 --- src/gui/graphicsview/qgraphicsitem.cpp | 20 +++++++++++-- src/gui/graphicsview/qgraphicsitem_p.h | 5 +++- .../qdeclarativeitem/data/childrenProperty.qml | 14 +++++++++ .../qdeclarativeitem/data/resourcesProperty.qml | 21 ++++++++++++++ .../qdeclarativeitem/tst_qdeclarativeitem.cpp | 33 ++++++++++++++++++++++ 5 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeitem/data/childrenProperty.qml create mode 100644 tests/auto/declarative/qdeclarativeitem/data/resourcesProperty.qml diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index f106b3d..3245aec 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -7614,11 +7614,26 @@ void QGraphicsObject::updateMicroFocus() QGraphicsItem::updateMicroFocus(); } -void QGraphicsItemPrivate::append(QDeclarativeListProperty *list, QGraphicsObject *item) +void QGraphicsItemPrivate::children_append(QDeclarativeListProperty *list, QGraphicsObject *item) { QGraphicsItemPrivate::get(item)->setParentItemHelper(static_cast(list->object), /*newParentVariant=*/0, /*thisPointerVariant=*/0); } +int QGraphicsItemPrivate::children_count(QDeclarativeListProperty *list) +{ + QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast(list->object)); + return d->children.count(); +} + +QGraphicsObject *QGraphicsItemPrivate::children_at(QDeclarativeListProperty *list, int index) +{ + QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast(list->object)); + if (index >= 0 && index < d->children.count()) + return d->children.at(index)->toGraphicsObject(); + else + return 0; +} + /*! Returns a list of this item's children. @@ -7631,7 +7646,8 @@ QDeclarativeListProperty QGraphicsItemPrivate::childrenList() Q_Q(QGraphicsItem); if (isObject) { QGraphicsObject *that = static_cast(q); - return QDeclarativeListProperty(that, &children, QGraphicsItemPrivate::append); + return QDeclarativeListProperty(that, &children, children_append, + children_count, children_at); } else { //QGraphicsItem is not supported for this property return QDeclarativeListProperty(); diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 73b8f04..922581d 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -480,9 +480,12 @@ public: void resetFocusProxy(); virtual void subFocusItemChange(); + static void children_append(QDeclarativeListProperty *list, QGraphicsObject *item); + static int children_count(QDeclarativeListProperty *list); + static QGraphicsObject *children_at(QDeclarativeListProperty *list, int); + inline QTransform transformToParent() const; inline void ensureSortedChildren(); - static void append(QDeclarativeListProperty *list, QGraphicsObject *item); static inline bool insertionOrder(QGraphicsItem *a, QGraphicsItem *b); void ensureSequentialSiblingIndex(); inline void sendScenePosChange(); diff --git a/tests/auto/declarative/qdeclarativeitem/data/childrenProperty.qml b/tests/auto/declarative/qdeclarativeitem/data/childrenProperty.qml new file mode 100644 index 0000000..dcd4061 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeitem/data/childrenProperty.qml @@ -0,0 +1,14 @@ +import Qt 4.6 + +Item { + id: root + + property bool test1: root.children.length == 3 + property bool test2: root.children[0] == item1 + property bool test3: root.children[1] == item2 + property bool test4: root.children[2] == item3 + property bool test5: root.children[3] == null + + children: [ Item { id: item1 }, Item { id: item2 }, Item { id: item3 } ] +} + diff --git a/tests/auto/declarative/qdeclarativeitem/data/resourcesProperty.qml b/tests/auto/declarative/qdeclarativeitem/data/resourcesProperty.qml new file mode 100644 index 0000000..fa299be --- /dev/null +++ b/tests/auto/declarative/qdeclarativeitem/data/resourcesProperty.qml @@ -0,0 +1,21 @@ +import Qt 4.6 + +Item { + id: root + + property bool test1 + property bool test2 + property bool test3 + property bool test4 + property bool test5 + + Component.onCompleted: { + test1 = (root.resources.length >= 3) + test2 = root.resources[0] == item1 + test3 = root.resources[1] == item2 + test4 = root.resources[2] == item3 + test5 = root.resources[10] == null + } + + resources: [ Item { id: item1 }, Item { id: item2 }, Item { id: item3 } ] +} diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index 46f3517..a6171ae 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -64,6 +64,9 @@ private slots: void transforms(); void transforms_data(); + void childrenProperty(); + void resourcesProperty(); + private: template T *findItem(QGraphicsObject *parent, const QString &objectName); @@ -429,6 +432,36 @@ void tst_QDeclarativeItem::transforms() QCOMPARE(item->sceneMatrix(), matrix); } +void tst_QDeclarativeItem::childrenProperty() +{ + QDeclarativeComponent component(&engine, SRCDIR "/data/childrenProperty.qml"); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test4").toBool(), true); + QCOMPARE(o->property("test5").toBool(), true); + delete o; +} + +void tst_QDeclarativeItem::resourcesProperty() +{ + QDeclarativeComponent component(&engine, SRCDIR "/data/resourcesProperty.qml"); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test4").toBool(), true); + QCOMPARE(o->property("test5").toBool(), true); + delete o; +} + void tst_QDeclarativeItem::propertyChanges() { QDeclarativeView *canvas = new QDeclarativeView(0); -- cgit v0.12 From fd2c621c0f291cbfea5bd0c85e19f2cc6ae07bed Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 7 Apr 2010 13:15:02 +1000 Subject: Keep track of the item count to avoid calling model->count() during batched changes --- .../graphicsitems/qdeclarativegridview.cpp | 35 ++++++++++++++------ .../graphicsitems/qdeclarativelistview.cpp | 38 +++++++++++++++------- .../graphicsitems/qdeclarativevisualitemmodel.cpp | 4 +++ 3 files changed, 55 insertions(+), 22 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 8247f17..3ad18cf 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -102,7 +102,7 @@ public: QDeclarativeGridViewPrivate() : currentItem(0), flow(QDeclarativeGridView::LeftToRight) , visibleIndex(0) , currentIndex(-1) - , cellWidth(100), cellHeight(100), columns(1), requestedIndex(-1) + , cellWidth(100), cellHeight(100), columns(1), itemCount(0), requestedIndex(-1) , highlightRangeStart(0), highlightRangeEnd(0), highlightRange(QDeclarativeGridView::NoHighlightRange) , highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightXAnimator(0), highlightYAnimator(0) @@ -315,6 +315,7 @@ public: int cellHeight; int columns; int requestedIndex; + int itemCount; qreal highlightRangeStart; qreal highlightRangeEnd; QDeclarativeGridView::HighlightRangeMode highlightRange; @@ -358,6 +359,7 @@ void QDeclarativeGridViewPrivate::clear() currentItem = 0; createHighlight(); trackedItem = 0; + itemCount = 0; } FxGridItem *QDeclarativeGridViewPrivate::createItem(int modelIndex) @@ -403,6 +405,7 @@ void QDeclarativeGridViewPrivate::refill(qreal from, qreal to, bool doBuffer) if (!isValid() || !q->isComponentComplete()) return; + itemCount = model->count(); qreal bufferFrom = from - buffer; qreal bufferTo = to + buffer; qreal fillFrom = from; @@ -546,6 +549,10 @@ void QDeclarativeGridViewPrivate::layout() { Q_Q(QDeclarativeGridView); layoutScheduled = false; + if (!isValid()) { + clear(); + return; + } if (visibleItems.count()) { qreal rowPos = visibleItems.first()->rowPos(); qreal colPos = visibleItems.first()->colPos(); @@ -1780,13 +1787,15 @@ void QDeclarativeGridView::componentComplete() { Q_D(QDeclarativeGridView); QDeclarativeFlickable::componentComplete(); - d->updateGrid(); - refill(); - if (d->currentIndex < 0) - d->updateCurrent(0); - else - d->updateCurrent(d->currentIndex); - d->fixupPosition(); + if (d->isValid()) { + d->updateGrid(); + refill(); + if (d->currentIndex < 0) + d->updateCurrent(0); + else + d->updateCurrent(d->currentIndex); + d->fixupPosition(); + } } void QDeclarativeGridView::trackedPositionChanged() @@ -1859,6 +1868,7 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) } else if (d->currentIndex < 0) { d->updateCurrent(0); } + d->itemCount += count; emit countChanged(); return; } @@ -1889,6 +1899,7 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) emit currentIndexChanged(); } d->scheduleLayout(); + d->itemCount += count; emit countChanged(); return; } @@ -1976,6 +1987,7 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) for (int j = 0; j < added.count(); ++j) added.at(j)->attached->emitAdd(); + d->itemCount += count; emit countChanged(); } @@ -1984,6 +1996,8 @@ void QDeclarativeGridView::itemsRemoved(int modelIndex, int count) Q_D(QDeclarativeGridView); if (!isComponentComplete()) return; + + d->itemCount -= count; bool currentRemoved = d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count; bool removedVisible = false; @@ -2031,7 +2045,8 @@ void QDeclarativeGridView::itemsRemoved(int modelIndex, int count) d->releaseItem(d->currentItem); d->currentItem = 0; d->currentIndex = -1; - d->updateCurrent(qMin(modelIndex, d->model->count()-1)); + if (d->itemCount) + d->updateCurrent(qMin(modelIndex, d->itemCount-1)); } // update visibleIndex @@ -2046,7 +2061,7 @@ void QDeclarativeGridView::itemsRemoved(int modelIndex, int count) if (removedVisible && d->visibleItems.isEmpty()) { d->timeline.clear(); d->setPosition(0); - if (d->model->count() == 0) + if (d->itemCount == 0) update(); } diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index e85d60f..31d97f3 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -152,7 +152,7 @@ public: : currentItem(0), orient(QDeclarativeListView::Vertical) , visiblePos(0), visibleIndex(0) , averageSize(100.0), currentIndex(-1), requestedIndex(-1) - , highlightRangeStart(0), highlightRangeEnd(0) + , itemCount(0), highlightRangeStart(0), highlightRangeEnd(0) , highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0) , sectionCriteria(0), spacing(0.0) @@ -447,6 +447,7 @@ public: qreal averageSize; int currentIndex; int requestedIndex; + int itemCount; qreal highlightRangeStart; qreal highlightRangeEnd; QDeclarativeComponent *highlightComponent; @@ -501,6 +502,7 @@ void QDeclarativeListViewPrivate::init() void QDeclarativeListViewPrivate::clear() { + timeline.clear(); for (int i = 0; i < visibleItems.count(); ++i) releaseItem(visibleItems.at(i)); visibleItems.clear(); @@ -516,6 +518,8 @@ void QDeclarativeListViewPrivate::clear() trackedItem = 0; minExtentDirty = true; maxExtentDirty = true; + setPosition(0); + itemCount = 0; } FxListItem *QDeclarativeListViewPrivate::createItem(int modelIndex) @@ -594,6 +598,7 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer) Q_Q(QDeclarativeListView); if (!isValid() || !q->isComponentComplete()) return; + itemCount = model->count(); qreal bufferFrom = from - buffer; qreal bufferTo = to + buffer; qreal fillFrom = from; @@ -698,6 +703,10 @@ void QDeclarativeListViewPrivate::layout() { Q_Q(QDeclarativeListView); layoutScheduled = false; + if (!isValid()) { + clear(); + return; + } updateSections(); if (!visibleItems.isEmpty()) { int oldEnd = visibleItems.last()->endPosition(); @@ -711,8 +720,6 @@ void QDeclarativeListViewPrivate::layout() if (currentItem && currentIndex > lastVisibleIndex()) currentItem->setPosition(currentItem->position() + (visibleItems.last()->endPosition() - oldEnd)); } - if (!isValid()) - return; q->refill(); minExtentDirty = true; maxExtentDirty = true; @@ -2314,13 +2321,15 @@ void QDeclarativeListView::componentComplete() { Q_D(QDeclarativeListView); QDeclarativeFlickable::componentComplete(); - refill(); - d->moveReason = QDeclarativeListViewPrivate::SetIndex; - if (d->currentIndex < 0) - d->updateCurrent(0); - else - d->updateCurrent(d->currentIndex); - d->fixupPosition(); + if (d->isValid()) { + refill(); + d->moveReason = QDeclarativeListViewPrivate::SetIndex; + if (d->currentIndex < 0) + d->updateCurrent(0); + else + d->updateCurrent(d->currentIndex); + d->fixupPosition(); + } } void QDeclarativeListView::refill() @@ -2401,6 +2410,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) } else if (d->currentIndex < 0) { d->updateCurrent(0); } + d->itemCount += count; emit countChanged(); return; } @@ -2432,6 +2442,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) emit currentIndexChanged(); } d->scheduleLayout(); + d->itemCount += count; emit countChanged(); return; } @@ -2524,6 +2535,7 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) for (int j = 0; j < added.count(); ++j) added.at(j)->attached->emitAdd(); + d->itemCount += count; emit countChanged(); } @@ -2534,6 +2546,7 @@ void QDeclarativeListView::itemsRemoved(int modelIndex, int count) return; d->moveReason = QDeclarativeListViewPrivate::Other; d->updateUnrequestedIndexes(); + d->itemCount -= count; FxListItem *firstVisible = d->firstVisibleItem(); int preRemovedSize = 0; @@ -2586,7 +2599,8 @@ void QDeclarativeListView::itemsRemoved(int modelIndex, int count) d->releaseItem(d->currentItem); d->currentItem = 0; d->currentIndex = -1; - d->updateCurrent(qMin(modelIndex, d->model->count()-1)); + if (d->itemCount) + d->updateCurrent(qMin(modelIndex, d->itemCount-1)); } // update visibleIndex @@ -2602,7 +2616,7 @@ void QDeclarativeListView::itemsRemoved(int modelIndex, int count) d->visiblePos = d->header ? d->header->size() : 0; d->timeline.clear(); d->setPosition(0); - if (d->model->count() == 0) + if (d->itemCount == 0) update(); } diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 2938f51..dfd9c0c 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -1152,6 +1152,8 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count, void QDeclarativeVisualDataModel::_q_itemsInserted(int index, int count) { Q_D(QDeclarativeVisualDataModel); + if (!count) + return; // XXX - highly inefficient QHash items; for (QHash::Iterator iter = d->m_cache.begin(); @@ -1179,6 +1181,8 @@ void QDeclarativeVisualDataModel::_q_itemsInserted(int index, int count) void QDeclarativeVisualDataModel::_q_itemsRemoved(int index, int count) { Q_D(QDeclarativeVisualDataModel); + if (!count) + return; // XXX - highly inefficient QHash items; for (QHash::Iterator iter = d->m_cache.begin(); -- cgit v0.12 From f2d08b168a116dd048ec1a38dd3b710de08a4a8e Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 7 Apr 2010 13:56:54 +1000 Subject: Cleanup minehunt example Make it more touchscreen friendly Use QML coding conventions Task-number: QTBUG-9361 --- demos/declarative/minehunt/minehunt.qml | 274 +++++++++++++------------------- 1 file changed, 114 insertions(+), 160 deletions(-) diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 2ca6c4c..2798b4f 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -3,188 +3,142 @@ import "MinehuntCore" 1.0 Item { id: field - width: 370 - height: 480 - - property int clickx : 0 - property int clicky : 0 - - resources: [ - Component { - id: tile - Flipable { - id: flipable - width: 40 - height: 40 - property int angle: 0; - transform: Rotation { - origin.x: 20 - origin.y: 20 - axis.x: 1 - axis.z: 0 - angle: flipable.angle; + property int clickx: 0 + property int clicky: 0 + + width: 450; height: 450 + + Component { + id: tile + + Flipable { + id: flipable + property int angle: 0 + + width: 40; height: 40 + transform: Rotation { origin.x: 20; origin.y: 20; axis.x: 1; axis.z: 0; angle: flipable.angle } + + front: Image { + source: "MinehuntCore/pics/front.png"; width: 40; height: 40 + + Image { + anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter + source: "MinehuntCore/pics/flag.png"; opacity: modelData.hasFlag + + Behavior on opacity { NumberAnimation { property: "opacity"; duration: 250 } } } - front: Image { - source: "MinehuntCore/pics/front.png" - width: 40 - height: 40 - Image { - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - source: "MinehuntCore/pics/flag.png" - opacity: modelData.hasFlag - Behavior on opacity { - NumberAnimation { - property: "opacity" - duration: 250 - } - } - } + } + + back: Image { + source: "MinehuntCore/pics/back.png" + width: 40; height: 40 + + Text { + anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter + text: modelData.hint; color: "white"; font.bold: true + opacity: !modelData.hasMine && modelData.hint > 0 } - back: Image { - source: "MinehuntCore/pics/back.png" - width: 40 - height: 40 - Text { - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - text: modelData.hint - color: "white" - font.bold: true - opacity: !modelData.hasMine && modelData.hint > 0 - } - Image { - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - source: "MinehuntCore/pics/bomb.png" - opacity: modelData.hasMine - } - Explosion { - id: expl - } + + Image { + anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter + source: "MinehuntCore/pics/bomb.png"; opacity: modelData.hasMine } - states: [ - State { - name: "back" - when: modelData.flipped - PropertyChanges { target: flipable; angle: 180 } - } - ] - transitions: [ - Transition { - SequentialAnimation { - PauseAnimation { - duration: { - var ret; - if(flipable.parent != null) - ret = Math.abs(flipable.parent.x-field.clickx) - + Math.abs(flipable.parent.y-field.clicky); - else - ret = 0; - if (ret > 0) { - if (modelData.hasMine && modelData.flipped) { - ret*3; - } else { - ret; - } - } else { - 0; - } + + Explosion { id: expl } + } + + states: State { + name: "back"; when: modelData.flipped + PropertyChanges { target: flipable; angle: 180 } + } + + transitions: Transition { + SequentialAnimation { + PauseAnimation { + duration: { + var ret + if (flipable.parent != null) + ret = Math.abs(flipable.parent.x - field.clickx) + + Math.abs(flipable.parent.y - field.clicky) + else + ret = 0 + if (ret > 0) { + if (modelData.hasMine && modelData.flipped) { + ret * 3 + } else { + ret } + } else { + 0 } - NumberAnimation { - easing.type: "InOutQuad" - properties: "angle" - } - ScriptAction{ - script: if(modelData.hasMine && modelData.flipped){expl.explode = true;} - } - } - } - ] - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.LeftButton | Qt.RightButton - onPressed: { - field.clickx = flipable.parent.x; - field.clicky = flipable.parent.y; - var row = Math.floor(index/9); - var col = index - (Math.floor(index/9) * 9); - if (mouse.button==undefined || mouse.button==Qt.RightButton) { - flag(row,col); - } else { - flip(row,col); } } + NumberAnimation { easing.type: "InOutQuad"; properties: "angle" } + ScriptAction { script: if (modelData.hasMine && modelData.flipped) { expl.explode = true } } } } + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + field.clickx = flipable.parent.x + field.clicky = flipable.parent.y + var row = Math.floor(index / 9) + var col = index - (Math.floor(index / 9) * 9) + if (mouse.button == undefined || mouse.button == Qt.RightButton) + flag(row, col) + else + flip(row, col) + } + onPressAndHold: { + field.clickx = flipable.parent.x + field.clicky = flipable.parent.y + var row = Math.floor(index / 9) + var col = index - (Math.floor(index / 9) * 9) + flag(row, col) + } + } } - ] - Image { - source: "MinehuntCore/pics/No-Ones-Laughing-3.jpg" - fillMode: Image.Tile } - Repeater { - id: repeater - model: tiles - x: 1 - y: 1 - Component { - Loader { - sourceComponent: tile - x: (index - (Math.floor(index/9) * 9)) * 41 - y: Math.floor(index/9) * 41 - } + + Image { source: "MinehuntCore/pics/No-Ones-Laughing-3.jpg"; anchors.fill: parent; fillMode: Image.Tile } + + Grid { + anchors.horizontalCenter: parent.horizontalCenter + columns: 9; spacing: 1 + + Repeater { + id: repeater + model: tiles + Component { Loader { sourceComponent: tile } } } } + Row { id: gamedata - // width: 370 - // height: 100 - y: 400 - x: 20 - spacing: 20 + x: 20; spacing: 20 + anchors.bottom: field.bottom; anchors.bottomMargin: 15 + Column { spacing: 2 - width: childrenRect.width - Image { - // x: 100 - // y: 20 - source: "MinehuntCore/pics/bomb-color.png" - } - Text { - // x: 100 - // y: 60 - anchors.horizontalCenter: parent.horizontalCenter - color: "white" - text: numMines - } + Image { source: "MinehuntCore/pics/bomb-color.png" } + Text { anchors.horizontalCenter: parent.horizontalCenter; color: "white"; text: numMines } } + Column { spacing: 2 - width: childrenRect.width - Image { - // x: 140 - // y: 20 - source: "MinehuntCore/pics/flag-color.png" - } - Text { - // x: 140 - // y: 60 - anchors.horizontalCenter: parent.horizontalCenter - color: "white" - text: numFlags - } + Image { source: "MinehuntCore/pics/flag-color.png" } + Text { anchors.horizontalCenter: parent.horizontalCenter; color: "white"; text: numFlags } } } + Image { - y: 390 - anchors.right: field.right - anchors.rightMargin: 20 - source: isPlaying ? 'MinehuntCore/pics/face-smile.png' : hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png' - MouseArea { - anchors.fill: parent - onPressed: { reset() } + anchors.bottom: field.bottom; anchors.bottomMargin: 15 + anchors.right: field.right; anchors.rightMargin: 20 + source: isPlaying ? 'MinehuntCore/pics/face-smile.png' + : hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png' + + MouseArea { anchors.fill: parent; onPressed: reset() } } - } } -- cgit v0.12 From c380aeefbfa2cd1aa2d1d21f45101bfb058a40de Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 7 Apr 2010 14:01:07 +1000 Subject: Disallow creation of attached objects Keys and KeyNavigation Also adds qmlRegisterUncreatableType<>() to allow registration of named types that cannot be created. Task-number: QTBUG-9575 --- .../graphicsitems/qdeclarativeitemsmodule.cpp | 5 ++-- src/declarative/qml/qdeclarative.h | 32 ++++++++++++++++++++ src/declarative/util/qdeclarativeutilmodule.cpp | 34 +--------------------- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 7989a27..35a4d00 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -101,8 +101,6 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType("Qt",4,6,"GridView"); qmlRegisterType("Qt",4,6,"Image"); qmlRegisterType("Qt",4,6,"Item"); - qmlRegisterType("Qt",4,6,"KeyNavigation"); - qmlRegisterType("Qt",4,6,"Keys"); qmlRegisterType("Qt",4,6,"LayoutItem"); qmlRegisterType("Qt",4,6,"ListView"); qmlRegisterType("Qt",4,6,"Loader"); @@ -151,4 +149,7 @@ void QDeclarativeItemModule::defineModule() #ifdef QT_WEBKIT_LIB qmlRegisterType(); #endif + + qmlRegisterUncreatableType("Qt",4,6,"KeyNavigation"); + qmlRegisterUncreatableType("Qt",4,6,"Keys"); } diff --git a/src/declarative/qml/qdeclarative.h b/src/declarative/qml/qdeclarative.h index 7c7f6e5..6e36d4f 100644 --- a/src/declarative/qml/qdeclarative.h +++ b/src/declarative/qml/qdeclarative.h @@ -119,6 +119,38 @@ int qmlRegisterType() } template +int qmlRegisterUncreatableType(const char *uri, int versionMajor, int versionMinor, const char *qmlName) +{ + QByteArray name(T::staticMetaObject.className()); + + QByteArray pointerName(name + '*'); + QByteArray listName("QDeclarativeListProperty<" + name + ">"); + + QDeclarativePrivate::RegisterType type = { + 0, + + qRegisterMetaType(pointerName.constData()), + qRegisterMetaType >(listName.constData()), + 0, 0, + + uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject, + + QDeclarativePrivate::attachedPropertiesFunc(), + QDeclarativePrivate::attachedPropertiesMetaObject(), + + QDeclarativePrivate::StaticCastSelector::cast(), + QDeclarativePrivate::StaticCastSelector::cast(), + QDeclarativePrivate::StaticCastSelector::cast(), + + 0, 0, + + 0 + }; + + return QDeclarativePrivate::registerType(type); +} + +template int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName) { QByteArray name(T::staticMetaObject.className()); diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp index d4c72bd..218a90b 100644 --- a/src/declarative/util/qdeclarativeutilmodule.cpp +++ b/src/declarative/util/qdeclarativeutilmodule.cpp @@ -71,38 +71,6 @@ #include "private/qdeclarativexmllistmodel_p.h" #endif -template -int qmlRegisterTypeEnums(const char *qmlName) -{ - QByteArray name(T::staticMetaObject.className()); - - QByteArray pointerName(name + '*'); - QByteArray listName("QDeclarativeListProperty<" + name + ">"); - - QDeclarativePrivate::RegisterType type = { - 0, - - qRegisterMetaType(pointerName.constData()), - qRegisterMetaType >(listName.constData()), - 0, 0, - - "Qt", 4, 6, qmlName, &T::staticMetaObject, - - QDeclarativePrivate::attachedPropertiesFunc(), - QDeclarativePrivate::attachedPropertiesMetaObject(), - - QDeclarativePrivate::StaticCastSelector::cast(), - QDeclarativePrivate::StaticCastSelector::cast(), - QDeclarativePrivate::StaticCastSelector::cast(), - - 0, 0, - - 0 - }; - - return QDeclarativePrivate::registerType(type); -} - void QDeclarativeUtilModule::defineModule() { qmlRegisterType("Qt",4,6,"AnchorAnimation"); @@ -142,7 +110,7 @@ void QDeclarativeUtilModule::defineModule() qmlRegisterType(); qmlRegisterType(); - qmlRegisterTypeEnums("Animation"); + qmlRegisterUncreatableType("Qt",4,6,"Animation"); qmlRegisterCustomType("Qt", 4,6, "ListModel", "QDeclarativeListModel", new QDeclarativeListModelParser); -- cgit v0.12 From 60c9d955918dde759ac038ff73c7767d62add3b7 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 7 Apr 2010 14:08:19 +1000 Subject: Fix warning --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 3ad18cf..e44a26d 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -102,7 +102,7 @@ public: QDeclarativeGridViewPrivate() : currentItem(0), flow(QDeclarativeGridView::LeftToRight) , visibleIndex(0) , currentIndex(-1) - , cellWidth(100), cellHeight(100), columns(1), itemCount(0), requestedIndex(-1) + , cellWidth(100), cellHeight(100), columns(1), requestedIndex(-1), itemCount(0) , highlightRangeStart(0), highlightRangeEnd(0), highlightRange(QDeclarativeGridView::NoHighlightRange) , highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightXAnimator(0), highlightYAnimator(0) -- cgit v0.12 From b3beb6ded506f1701b68642d981c63295bc6c6a2 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 7 Apr 2010 13:27:23 +1000 Subject: Disallow nested elements in ListModel QTBUG-6082 --- src/declarative/qml/qdeclarativecustomparser.cpp | 3 +++ src/declarative/util/qdeclarativelistmodel.cpp | 7 ++++++- .../qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp | 8 +++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qdeclarativecustomparser.cpp b/src/declarative/qml/qdeclarativecustomparser.cpp index 8b6ee7c..1a97315 100644 --- a/src/declarative/qml/qdeclarativecustomparser.cpp +++ b/src/declarative/qml/qdeclarativecustomparser.cpp @@ -108,6 +108,9 @@ QDeclarativeCustomParserNodePrivate::fromObject(QDeclarativeParser::Object *root rootNode.d->properties << fromProperty(p); } + if (root->defaultProperty) + rootNode.d->properties << fromProperty(root->defaultProperty); + return rootNode; } diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index ec23bb2..28bd852 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -622,6 +622,11 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser QDeclarativeCustomParserNode node = qvariant_cast(value); + if (node.name() != "ListElement") { + error(node, QDeclarativeListModel::tr("ListElement: cannot contain nested elements")); + return false; + } + { ListInstruction li; li.type = ListInstruction::Push; @@ -633,7 +638,7 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser for(int jj = 0; jj < props.count(); ++jj) { const QDeclarativeCustomParserProperty &nodeProp = props.at(jj); if (nodeProp.name() == "") { - error(nodeProp, QDeclarativeListModel::tr("ListElement: cannot use default property")); + error(nodeProp, QDeclarativeListModel::tr("ListElement: cannot contain nested elements")); return false; } if (nodeProp.name() == "id") { diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index d02f54f..8214723 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -528,7 +528,11 @@ void tst_QDeclarativeListModel::error_data() QTest::newRow("default properties not allowed in ListElement") << "import Qt 4.6\nListModel { ListElement { Item { } } }" - << "QTBUG-6082 ListElement should not allow child objects"; + << "ListElement: cannot contain nested elements"; + + QTest::newRow("QML elements not allowed in ListElement") + << "import Qt 4.6\nListModel { ListElement { a: Item { } } }" + << "ListElement: cannot contain nested elements"; } void tst_QDeclarativeListModel::error() @@ -543,8 +547,6 @@ void tst_QDeclarativeListModel::error() if (error.isEmpty()) { QVERIFY(!component.isError()); } else { - if (error.startsWith(QLatin1String("QTBUG-"))) - QEXPECT_FAIL("",error.toLatin1(),Abort); QVERIFY(component.isError()); QList errors = component.errors(); QCOMPARE(errors.count(),1); -- cgit v0.12 From ec50ac021ba0908bfaeb5fbf1838ffb59ad829d5 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 7 Apr 2010 14:25:54 +1000 Subject: Cleanup (remove QDeclarativeScriptClass) QDeclarativeScriptClass only existed to make compiling against 4.6 and 4.7 easier. --- .../qml/qdeclarativecontextscriptclass.cpp | 4 +- .../qml/qdeclarativecontextscriptclass_p.h | 6 +- src/declarative/qml/qdeclarativeengine.cpp | 14 ---- .../qml/qdeclarativelistscriptclass.cpp | 4 +- .../qml/qdeclarativelistscriptclass_p.h | 6 +- .../qml/qdeclarativeobjectscriptclass.cpp | 19 ++--- .../qml/qdeclarativeobjectscriptclass_p.h | 8 +- src/declarative/qml/qdeclarativescriptclass_p.h | 89 ---------------------- .../qml/qdeclarativetypenamescriptclass.cpp | 4 +- .../qml/qdeclarativetypenamescriptclass_p.h | 7 +- .../qml/qdeclarativevaluetypescriptclass.cpp | 8 +- .../qml/qdeclarativevaluetypescriptclass_p.h | 6 +- src/declarative/qml/qml.pri | 1 - 13 files changed, 34 insertions(+), 142 deletions(-) delete mode 100644 src/declarative/qml/qdeclarativescriptclass_p.h diff --git a/src/declarative/qml/qdeclarativecontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp index 8566744..6d31c22 100644 --- a/src/declarative/qml/qdeclarativecontextscriptclass.cpp +++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp @@ -79,7 +79,7 @@ struct ContextData : public QScriptDeclarativeClass::Object { via QtScript. */ QDeclarativeContextScriptClass::QDeclarativeContextScriptClass(QDeclarativeEngine *bindEngine) -: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine), +: QScriptDeclarativeClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine), lastScopeObject(0), lastContext(0), lastData(0), lastPropertyIndex(-1) { } @@ -223,7 +223,7 @@ QDeclarativeContextScriptClass::queryProperty(QDeclarativeContextData *bindConte return 0; } -QDeclarativeContextScriptClass::ScriptValue +QDeclarativeContextScriptClass::Value QDeclarativeContextScriptClass::property(Object *object, const Identifier &name) { Q_UNUSED(object); diff --git a/src/declarative/qml/qdeclarativecontextscriptclass_p.h b/src/declarative/qml/qdeclarativecontextscriptclass_p.h index b89f0cd..1936d38 100644 --- a/src/declarative/qml/qdeclarativecontextscriptclass_p.h +++ b/src/declarative/qml/qdeclarativecontextscriptclass_p.h @@ -54,14 +54,14 @@ // #include "private/qdeclarativetypenamecache_p.h" -#include "private/qdeclarativescriptclass_p.h" +#include QT_BEGIN_NAMESPACE class QDeclarativeEngine; class QDeclarativeContext; class QDeclarativeContextData; -class QDeclarativeContextScriptClass : public QDeclarativeScriptClass +class QDeclarativeContextScriptClass : public QScriptDeclarativeClass { public: QDeclarativeContextScriptClass(QDeclarativeEngine *); @@ -76,7 +76,7 @@ public: protected: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual ScriptValue property(Object *, const Identifier &); + virtual Value property(Object *, const Identifier &); virtual void setProperty(Object *, const Identifier &name, const QScriptValue &); private: diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index f7d1df3..e8b6913 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -61,7 +61,6 @@ #include "private/qdeclarativeglobal_p.h" #include "private/qdeclarativeworkerscript_p.h" #include "private/qdeclarativecomponent_p.h" -#include "private/qdeclarativescriptclass_p.h" #include "qdeclarativenetworkaccessmanagerfactory.h" #include "qdeclarativeimageprovider.h" #include "private/qdeclarativedirparser_p.h" @@ -1365,19 +1364,6 @@ QVariant QDeclarativeEnginePrivate::scriptValueToVariant(const QScriptValue &val } } -QDeclarativeScriptClass::QDeclarativeScriptClass(QScriptEngine *engine) -: QScriptDeclarativeClass(engine) -{ -} - -QVariant QDeclarativeScriptClass::toVariant(QDeclarativeEngine *engine, const QScriptValue &val) -{ - QDeclarativeEnginePrivate *ep = - static_cast(QObjectPrivate::get(engine)); - - return ep->scriptValueToVariant(val); -} - // XXX this beyonds in QUrl::toLocalFile() // WARNING, there is a copy of this function in qdeclarativecompositetypemanager.cpp static QString toLocalFileOrQrc(const QUrl& url) diff --git a/src/declarative/qml/qdeclarativelistscriptclass.cpp b/src/declarative/qml/qdeclarativelistscriptclass.cpp index 3958dd5..d27427e 100644 --- a/src/declarative/qml/qdeclarativelistscriptclass.cpp +++ b/src/declarative/qml/qdeclarativelistscriptclass.cpp @@ -54,7 +54,7 @@ struct ListData : public QScriptDeclarativeClass::Object { }; QDeclarativeListScriptClass::QDeclarativeListScriptClass(QDeclarativeEngine *e) -: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(e)), engine(e) +: QScriptDeclarativeClass(QDeclarativeEnginePrivate::getScriptEngine(e)), engine(e) { QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); Q_UNUSED(scriptEngine); @@ -114,7 +114,7 @@ QDeclarativeListScriptClass::queryProperty(Object *object, const Identifier &nam } } -QDeclarativeListScriptClass::ScriptValue QDeclarativeListScriptClass::property(Object *obj, const Identifier &name) +QDeclarativeListScriptClass::Value QDeclarativeListScriptClass::property(Object *obj, const Identifier &name) { QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); diff --git a/src/declarative/qml/qdeclarativelistscriptclass_p.h b/src/declarative/qml/qdeclarativelistscriptclass_p.h index 68c680d..89984a1 100644 --- a/src/declarative/qml/qdeclarativelistscriptclass_p.h +++ b/src/declarative/qml/qdeclarativelistscriptclass_p.h @@ -53,13 +53,13 @@ // We mean it. // -#include +#include #include "qdeclarativelist.h" QT_BEGIN_NAMESPACE class QDeclarativeEngine; -class QDeclarativeListScriptClass : public QDeclarativeScriptClass +class QDeclarativeListScriptClass : public QScriptDeclarativeClass { public: QDeclarativeListScriptClass(QDeclarativeEngine *); @@ -71,7 +71,7 @@ public: protected: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual ScriptValue property(Object *, const Identifier &); + virtual Value property(Object *, const Identifier &); virtual QVariant toVariant(Object *, bool *ok); private: diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 759a506..10b9fab 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -78,11 +78,8 @@ struct ObjectData : public QScriptDeclarativeClass::Object { QtScript for QML. */ QDeclarativeObjectScriptClass::QDeclarativeObjectScriptClass(QDeclarativeEngine *bindEngine) -: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), -#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE) - methods(bindEngine), -#endif - lastData(0), engine(bindEngine) +: QScriptDeclarativeClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), + methods(bindEngine), lastData(0), engine(bindEngine) { QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); @@ -191,13 +188,13 @@ QDeclarativeObjectScriptClass::queryProperty(QObject *obj, const Identifier &nam return 0; } -QDeclarativeObjectScriptClass::ScriptValue +QDeclarativeObjectScriptClass::Value QDeclarativeObjectScriptClass::property(Object *object, const Identifier &name) { return property(toQObject(object), name); } -QDeclarativeObjectScriptClass::ScriptValue +QDeclarativeObjectScriptClass::Value QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name) { QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); @@ -357,7 +354,7 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj, QMetaObject::metacall(obj, QMetaObject::ResetProperty, lastData->coreIndex, a); } else { // ### Can well known types be optimized? - QVariant v = QDeclarativeScriptClass::toVariant(engine, value); + QVariant v = enginePriv->scriptValueToVariant(value); QDeclarativePropertyPrivate::write(obj, *lastData, v, evalContext); } } @@ -557,7 +554,7 @@ QDeclarativeObjectMethodScriptClass::queryProperty(Object *, const Identifier &n } -QDeclarativeObjectScriptClass::ScriptValue +QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass::property(Object *, const Identifier &name) { QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); @@ -687,7 +684,7 @@ void MetaCallArgument::fromScriptValue(int callType, QDeclarativeEngine *engine, *((QObject **)&data) = value.toQObject(); type = callType; } else if (callType == qMetaTypeId()) { - new (&data) QVariant(QDeclarativeScriptClass::toVariant(engine, value)); + new (&data) QVariant(QDeclarativeEnginePrivate::get(engine)->scriptValueToVariant(value)); type = callType; } else if (callType == qMetaTypeId >()) { new (&data) QList(); // We don't support passing in QList @@ -696,7 +693,7 @@ void MetaCallArgument::fromScriptValue(int callType, QDeclarativeEngine *engine, new (&data) QVariant(); type = -1; - QVariant v = QDeclarativeScriptClass::toVariant(engine, value); + QVariant v = QDeclarativeEnginePrivate::get(engine)->scriptValueToVariant(value); if (v.userType() == callType) { *((QVariant *)&data) = v; } else if (v.canConvert((QVariant::Type)callType)) { diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h index 8941ae0..8a2f7c7 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h +++ b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h @@ -56,7 +56,7 @@ #include "private/qdeclarativepropertycache_p.h" #include "private/qdeclarativetypenamecache_p.h" -#include +#include #include QT_BEGIN_NAMESPACE @@ -93,7 +93,7 @@ private: }; #endif -class Q_AUTOTEST_EXPORT QDeclarativeObjectScriptClass : public QDeclarativeScriptClass +class Q_AUTOTEST_EXPORT QDeclarativeObjectScriptClass : public QScriptDeclarativeClass { public: QDeclarativeObjectScriptClass(QDeclarativeEngine *); @@ -115,7 +115,7 @@ public: QDeclarativeContextData *evalContext, QueryHints hints = 0); - ScriptValue property(QObject *, const Identifier &); + Value property(QObject *, const Identifier &); void setProperty(QObject *, const Identifier &name, const QScriptValue &, QDeclarativeContextData *evalContext = 0); @@ -126,7 +126,7 @@ protected: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual ScriptValue property(Object *, const Identifier &); + virtual Value property(Object *, const Identifier &); virtual void setProperty(Object *, const Identifier &name, const QScriptValue &); virtual bool isQObject() const; virtual QObject *toQObject(Object *, bool *ok = 0); diff --git a/src/declarative/qml/qdeclarativescriptclass_p.h b/src/declarative/qml/qdeclarativescriptclass_p.h deleted file mode 100644 index d8733db..0000000 --- a/src/declarative/qml/qdeclarativescriptclass_p.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module 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 Technology Preview License Agreement accompanying -** this package. -** -** 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.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVESCRIPTCLASS_P_H -#define QDECLARATIVESCRIPTCLASS_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include - -QT_BEGIN_NAMESPACE - -class QDeclarativeEngine; -class QDeclarativeScriptClass : public QScriptDeclarativeClass -{ -public: - QDeclarativeScriptClass(QScriptEngine *); - - static QVariant toVariant(QDeclarativeEngine *, const QScriptValue &); - -#if (QT_VERSION <= QT_VERSION_CHECK(4, 6, 2)) && !defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE) - struct Value : public QScriptValue { - Value() : QScriptValue() {} - Value(QScriptEngine *engine, int v) : QScriptValue(engine, v) {} - Value(QScriptEngine *engine, uint v) : QScriptValue(engine, v) {} - Value(QScriptEngine *engine, bool v) : QScriptValue(engine, v) {} - Value(QScriptEngine *engine, double v) : QScriptValue(engine, v) {} - Value(QScriptEngine *engine, float v) : QScriptValue(engine, v) {} - Value(QScriptEngine *engine, const QString &v) : QScriptValue(engine, v) {} - Value(QScriptEngine *, const QScriptValue &v) : QScriptValue(v) {} - }; - - typedef QScriptValue ScriptValue; -#else - typedef Value ScriptValue; -#endif -}; - -QT_END_NAMESPACE - -#endif // QDECLARATIVESCRIPTCLASS_P_H diff --git a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp index 9cac3e1..324b3de 100644 --- a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp +++ b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp @@ -62,7 +62,7 @@ struct TypeNameData : public QScriptDeclarativeClass::Object { }; QDeclarativeTypeNameScriptClass::QDeclarativeTypeNameScriptClass(QDeclarativeEngine *bindEngine) -: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), +: QScriptDeclarativeClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine), object(0), type(0) { } @@ -139,7 +139,7 @@ QDeclarativeTypeNameScriptClass::queryProperty(Object *obj, const Identifier &na return 0; } -QDeclarativeTypeNameScriptClass::ScriptValue +QDeclarativeTypeNameScriptClass::Value QDeclarativeTypeNameScriptClass::property(Object *obj, const Identifier &name) { QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); diff --git a/src/declarative/qml/qdeclarativetypenamescriptclass_p.h b/src/declarative/qml/qdeclarativetypenamescriptclass_p.h index 8e07f02..310e14e 100644 --- a/src/declarative/qml/qdeclarativetypenamescriptclass_p.h +++ b/src/declarative/qml/qdeclarativetypenamescriptclass_p.h @@ -54,16 +54,15 @@ // #include "private/qdeclarativeengine_p.h" +#include #include -#include - QT_BEGIN_NAMESPACE class QDeclarativeEngine; class QDeclarativeType; class QDeclarativeTypeNameCache; -class QDeclarativeTypeNameScriptClass : public QDeclarativeScriptClass +class QDeclarativeTypeNameScriptClass : public QScriptDeclarativeClass { public: QDeclarativeTypeNameScriptClass(QDeclarativeEngine *); @@ -77,7 +76,7 @@ protected: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual ScriptValue property(Object *, const Identifier &); + virtual Value property(Object *, const Identifier &); virtual void setProperty(Object *, const Identifier &name, const QScriptValue &); private: diff --git a/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp b/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp index f7902b9..fdb71c6 100644 --- a/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp +++ b/src/declarative/qml/qdeclarativevaluetypescriptclass.cpp @@ -55,7 +55,7 @@ struct QDeclarativeValueTypeReference : public QScriptDeclarativeClass::Object { }; QDeclarativeValueTypeScriptClass::QDeclarativeValueTypeScriptClass(QDeclarativeEngine *bindEngine) -: QDeclarativeScriptClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine) +: QScriptDeclarativeClass(QDeclarativeEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine) { } @@ -100,7 +100,7 @@ QDeclarativeValueTypeScriptClass::queryProperty(Object *obj, const Identifier &n return rv; } -QDeclarativeValueTypeScriptClass::ScriptValue QDeclarativeValueTypeScriptClass::property(Object *obj, const Identifier &) +QDeclarativeValueTypeScriptClass::Value QDeclarativeValueTypeScriptClass::property(Object *obj, const Identifier &) { QDeclarativeValueTypeReference *ref = static_cast(obj); @@ -113,7 +113,7 @@ QDeclarativeValueTypeScriptClass::ScriptValue QDeclarativeValueTypeScriptClass:: } void QDeclarativeValueTypeScriptClass::setProperty(Object *obj, const Identifier &, - const QScriptValue &value) + const QScriptValue &value) { QDeclarativeValueTypeReference *ref = static_cast(obj); @@ -122,7 +122,7 @@ void QDeclarativeValueTypeScriptClass::setProperty(Object *obj, const Identifier if (delBinding) delBinding->destroy(); - QVariant v = QDeclarativeScriptClass::toVariant(engine, value); + QVariant v = QDeclarativeEnginePrivate::get(engine)->scriptValueToVariant(value); ref->type->read(ref->object, ref->property); QMetaProperty p = ref->type->metaObject()->property(m_lastIndex); diff --git a/src/declarative/qml/qdeclarativevaluetypescriptclass_p.h b/src/declarative/qml/qdeclarativevaluetypescriptclass_p.h index 31bd415..2bbb61f 100644 --- a/src/declarative/qml/qdeclarativevaluetypescriptclass_p.h +++ b/src/declarative/qml/qdeclarativevaluetypescriptclass_p.h @@ -54,13 +54,13 @@ // -#include +#include QT_BEGIN_NAMESPACE class QDeclarativeEngine; class QDeclarativeValueType; -class QDeclarativeValueTypeScriptClass : public QDeclarativeScriptClass +class QDeclarativeValueTypeScriptClass : public QScriptDeclarativeClass { public: QDeclarativeValueTypeScriptClass(QDeclarativeEngine *); @@ -70,7 +70,7 @@ public: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual ScriptValue property(Object *, const Identifier &); + virtual Value property(Object *, const Identifier &); virtual void setProperty(Object *, const Identifier &name, const QScriptValue &); virtual QVariant toVariant(Object *, bool *ok = 0); diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index e2f0c67..1087f44 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -121,7 +121,6 @@ HEADERS += \ $$PWD/qdeclarativetypenamescriptclass_p.h \ $$PWD/qdeclarativelistscriptclass_p.h \ $$PWD/qdeclarativeworkerscript_p.h \ - $$PWD/qdeclarativescriptclass_p.h \ $$PWD/qdeclarativeguard_p.h \ $$PWD/qdeclarativeimageprovider.h \ $$PWD/qdeclarativenetworkaccessmanagerfactory.h \ -- cgit v0.12 From 0bd3c6b059986e92ecca1c926afd123074187f49 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 7 Apr 2010 13:12:06 +1000 Subject: Make sure Loader doesn't leak when component has errors. --- src/declarative/graphicsitems/qdeclarativeloader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 2aab36f..409c228 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -276,9 +276,6 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded() Q_Q(QDeclarativeLoader); if (component) { - QDeclarativeContext *ctxt = new QDeclarativeContext(qmlContext(q)); - ctxt->setContextObject(q); - if (!component->errors().isEmpty()) { qWarning() << component->errors(); emit q->sourceChanged(); @@ -287,6 +284,9 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded() return; } + QDeclarativeContext *ctxt = new QDeclarativeContext(qmlContext(q)); + ctxt->setContextObject(q); + QDeclarativeComponent *c = component; QObject *obj = component->create(ctxt); if (component != c) { -- cgit v0.12 From 0bfcb67886df2c446b38c4ca0ec8309a32493d00 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 7 Apr 2010 13:26:59 +1000 Subject: Make sure tests cleanup after themselves. --- .../qdeclarativeloader/tst_qdeclarativeloader.cpp | 18 ++++++++-- .../tst_qdeclarativerepeater.cpp | 10 ++++++ .../tst_qdeclarativetextinput.cpp | 42 ++++++++++++++++++++++ 3 files changed, 67 insertions(+), 3 deletions(-) diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index 05d968c..abdd210 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -133,7 +133,7 @@ void tst_QDeclarativeLoader::component() QVERIFY(c); QCOMPARE(loader->sourceComponent(), c); - delete loader; + delete item; } void tst_QDeclarativeLoader::invalidUrl() @@ -196,7 +196,7 @@ void tst_QDeclarativeLoader::clear() QCOMPARE(loader->status(), QDeclarativeLoader::Null); QCOMPARE(static_cast(loader)->children().count(), 0); - delete loader; + delete item; } } @@ -242,7 +242,7 @@ void tst_QDeclarativeLoader::componentToUrl() QCOMPARE(loader->width(), 120.0); QCOMPARE(loader->height(), 60.0); - delete loader; + delete item; } void tst_QDeclarativeLoader::sizeLoaderToItem() @@ -275,6 +275,8 @@ void tst_QDeclarativeLoader::sizeLoaderToItem() QCOMPARE(spy.count(),1); loader->setResizeMode(QDeclarativeLoader::NoResize); QCOMPARE(spy.count(),1); + + delete loader; } void tst_QDeclarativeLoader::sizeItemToLoader() @@ -303,6 +305,8 @@ void tst_QDeclarativeLoader::sizeItemToLoader() rect->setHeight(45); QCOMPARE(loader->width(), 160.0); QCOMPARE(loader->height(), 45.0); + + delete loader; } void tst_QDeclarativeLoader::noResize() @@ -317,6 +321,8 @@ void tst_QDeclarativeLoader::noResize() QVERIFY(rect); QCOMPARE(rect->width(), 120.0); QCOMPARE(rect->height(), 60.0); + + delete loader; } void tst_QDeclarativeLoader::sizeLoaderToGraphicsWidget() @@ -344,6 +350,8 @@ void tst_QDeclarativeLoader::sizeLoaderToGraphicsWidget() loader->setHeight(30); QCOMPARE(widget->size().width(), 180.0); QCOMPARE(widget->size().height(), 30.0); + + delete loader; } void tst_QDeclarativeLoader::sizeGraphicsWidgetToLoader() @@ -374,6 +382,8 @@ void tst_QDeclarativeLoader::sizeGraphicsWidgetToLoader() widget->resize(QSizeF(160,45)); QCOMPARE(loader->width(), 160.0); QCOMPARE(loader->height(), 45.0); + + delete loader; } void tst_QDeclarativeLoader::noResizeGraphicsWidget() @@ -391,6 +401,8 @@ void tst_QDeclarativeLoader::noResizeGraphicsWidget() QVERIFY(widget); QCOMPARE(widget->size().width(), 250.0); QCOMPARE(widget->size().height(), 250.0); + + delete loader; } void tst_QDeclarativeLoader::networkRequestUrl() diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp index 09c4879..419f5ea 100644 --- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -181,6 +181,7 @@ void tst_QDeclarativeRepeater::numberModel() QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); QVERIFY(testObject->error() == false); + delete testObject; delete canvas; } @@ -204,6 +205,9 @@ void tst_QDeclarativeRepeater::objectList() QVERIFY(repeater != 0); QCOMPARE(repeater->property("errors").toInt(), 0);//If this fails either they are out of order or can't find the object's data QCOMPARE(repeater->property("instantiated").toInt(), 100); + + qDeleteAll(data); + delete canvas; } /* @@ -293,6 +297,9 @@ void tst_QDeclarativeRepeater::dataModel() testModel.removeItem(2); QCOMPARE(container->childItems().count(), 4); + + delete testObject; + delete canvas; } void tst_QDeclarativeRepeater::itemModel() @@ -323,6 +330,7 @@ void tst_QDeclarativeRepeater::itemModel() QVERIFY(qobject_cast(container->childItems().at(2))->objectName() == "item3"); QVERIFY(container->childItems().at(3) == repeater); + delete testObject; delete canvas; } @@ -352,6 +360,8 @@ void tst_QDeclarativeRepeater::properties() QCOMPARE(delegateSpy.count(),1); repeater->setDelegate(&rectComponent); QCOMPARE(delegateSpy.count(),1); + + delete rootObject; } QDeclarativeView *tst_QDeclarativeRepeater::createView() diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index b6f55dd..2b0b151 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -112,6 +112,8 @@ void tst_qdeclarativetextinput::text() QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->text(), QString("")); + + delete textinputObject; } for (int i = 0; i < standard.size(); i++) @@ -123,6 +125,8 @@ void tst_qdeclarativetextinput::text() QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->text(), standard.at(i)); + + delete textinputObject; } } @@ -137,6 +141,8 @@ void tst_qdeclarativetextinput::width() QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->width(), 1.);//1 for the cursor + + delete textinputObject; } for (int i = 0; i < standard.size(); i++) @@ -152,6 +158,8 @@ void tst_qdeclarativetextinput::width() QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->width(), qreal(metricWidth) + 1.);//1 for the cursor + + delete textinputObject; } } @@ -168,6 +176,8 @@ void tst_qdeclarativetextinput::font() QCOMPARE(textinputObject->font().pointSize(), 40); QCOMPARE(textinputObject->font().bold(), false); QCOMPARE(textinputObject->font().italic(), false); + + delete textinputObject; } { @@ -179,6 +189,8 @@ void tst_qdeclarativetextinput::font() QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->font().bold(), true); QCOMPARE(textinputObject->font().italic(), false); + + delete textinputObject; } { @@ -190,6 +202,8 @@ void tst_qdeclarativetextinput::font() QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->font().italic(), true); QCOMPARE(textinputObject->font().bold(), false); + + delete textinputObject; } { @@ -202,6 +216,8 @@ void tst_qdeclarativetextinput::font() QCOMPARE(textinputObject->font().family(), QString("Helvetica")); QCOMPARE(textinputObject->font().bold(), false); QCOMPARE(textinputObject->font().italic(), false); + + delete textinputObject; } { @@ -212,6 +228,8 @@ void tst_qdeclarativetextinput::font() QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->font().family(), QString("")); + + delete textinputObject; } } @@ -226,6 +244,8 @@ void tst_qdeclarativetextinput::color() QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->color(), QColor(colorStrings.at(i))); + + delete textinputObject; } //test selection color @@ -237,6 +257,8 @@ void tst_qdeclarativetextinput::color() QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->selectionColor(), QColor(colorStrings.at(i))); + + delete textinputObject; } //test selected text color @@ -248,6 +270,8 @@ void tst_qdeclarativetextinput::color() QDeclarativeTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->selectedTextColor(), QColor(colorStrings.at(i))); + + delete textinputObject; } { @@ -262,6 +286,8 @@ void tst_qdeclarativetextinput::color() QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->color(), testColor); + + delete textinputObject; } } @@ -344,6 +370,8 @@ void tst_qdeclarativetextinput::selection() QVERIFY(textinputObject->selectedText().size() == 10); textinputObject->setSelectionEnd(100); QVERIFY(textinputObject->selectedText().size() == 10); + + delete textinputObject; } void tst_qdeclarativetextinput::maxLength() @@ -371,6 +399,8 @@ void tst_qdeclarativetextinput::maxLength() QTest::keyPress(canvas, Qt::Key_A); QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); } + + delete canvas; } void tst_qdeclarativetextinput::masks() @@ -393,6 +423,8 @@ void tst_qdeclarativetextinput::masks() QTest::keyPress(canvas, Qt::Key_A); QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); } + + delete canvas; } void tst_qdeclarativetextinput::validators() @@ -485,6 +517,8 @@ void tst_qdeclarativetextinput::validators() QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); QCOMPARE(strInput->text(), QLatin1String("aaaa")); QCOMPARE(strInput->hasAcceptableInput(), true); + + delete canvas; } void tst_qdeclarativetextinput::inputMethodHints() @@ -499,6 +533,8 @@ void tst_qdeclarativetextinput::inputMethodHints() QVERIFY(textinputObject->inputMethodHints() & Qt::ImhNoPredictiveText); textinputObject->setInputMethodHints(Qt::ImhUppercaseOnly); QVERIFY(textinputObject->inputMethodHints() & Qt::ImhUppercaseOnly); + + delete canvas; } /* @@ -536,6 +572,8 @@ void tst_qdeclarativetextinput::navigation() QVERIFY(input->hasFocus() == false); simulateKey(canvas, Qt::Key_Left); QVERIFY(input->hasFocus() == true); + + delete canvas; } void tst_qdeclarativetextinput::cursorDelegate() @@ -563,6 +601,8 @@ void tst_qdeclarativetextinput::cursorDelegate() //Test Delegate gets deleted textInputObject->setCursorDelegate(0); QVERIFY(!textInputObject->findChild("cursorInstance")); + + delete view; } void tst_qdeclarativetextinput::readOnly() @@ -585,6 +625,8 @@ void tst_qdeclarativetextinput::readOnly() simulateKey(canvas, Qt::Key_Space); simulateKey(canvas, Qt::Key_Escape); QCOMPARE(input->text(), initial); + + delete canvas; } void tst_qdeclarativetextinput::simulateKey(QDeclarativeView *view, int key) -- cgit v0.12 From fa730e0d0ba38ca7db09b6eb95bb656bdc67a8b0 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 7 Apr 2010 14:27:21 +1000 Subject: Visual test updates. --- .../colorAnimation/colorAnimation-visual.qml | 41 + .../animation/colorAnimation/colorAnimation.qml | 41 - .../colorAnimation/data/colorAnimation-visual.qml | 951 +++++++++++++++++++++ .../colorAnimation/data/colorAnimation.qml | 951 --------------------- .../qmlvisual/animation/easing/pics/qtlogo.png | Bin 2738 -> 0 bytes .../data/parallelAnimation-visual.qml | 463 ++++++++++ .../parallelAnimation/data/parallelAnimation.qml | 463 ---------- .../parallelAnimation/parallelAnimation-visual.qml | 51 ++ .../parallelAnimation/parallelAnimation.qml | 43 - .../propertyAction/data/propertyAction-visual.qml | 939 ++++++++++++++++++++ .../propertyAction/data/propertyAction.qml | 939 -------------------- .../propertyAction/propertyAction-visual.qml | 41 + .../animation/propertyAction/propertyAction.qml | 34 - .../scriptAction/data/scriptAction-visual.qml | 535 ++++++++++++ .../animation/scriptAction/data/scriptAction.qml | 535 ------------ .../animation/scriptAction/scriptAction-visual.qml | 40 + .../animation/scriptAction/scriptAction.qml | 35 - .../declarative/qmlvisual/fillmode/fillmode.qml | 5 + tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp | 14 +- 19 files changed, 3077 insertions(+), 3044 deletions(-) create mode 100644 tests/auto/declarative/qmlvisual/animation/colorAnimation/colorAnimation-visual.qml delete mode 100644 tests/auto/declarative/qmlvisual/animation/colorAnimation/colorAnimation.qml create mode 100644 tests/auto/declarative/qmlvisual/animation/colorAnimation/data/colorAnimation-visual.qml delete mode 100644 tests/auto/declarative/qmlvisual/animation/colorAnimation/data/colorAnimation.qml delete mode 100644 tests/auto/declarative/qmlvisual/animation/easing/pics/qtlogo.png create mode 100644 tests/auto/declarative/qmlvisual/animation/parallelAnimation/data/parallelAnimation-visual.qml delete mode 100644 tests/auto/declarative/qmlvisual/animation/parallelAnimation/data/parallelAnimation.qml create mode 100644 tests/auto/declarative/qmlvisual/animation/parallelAnimation/parallelAnimation-visual.qml delete mode 100644 tests/auto/declarative/qmlvisual/animation/parallelAnimation/parallelAnimation.qml create mode 100644 tests/auto/declarative/qmlvisual/animation/propertyAction/data/propertyAction-visual.qml delete mode 100644 tests/auto/declarative/qmlvisual/animation/propertyAction/data/propertyAction.qml create mode 100644 tests/auto/declarative/qmlvisual/animation/propertyAction/propertyAction-visual.qml delete mode 100644 tests/auto/declarative/qmlvisual/animation/propertyAction/propertyAction.qml create mode 100644 tests/auto/declarative/qmlvisual/animation/scriptAction/data/scriptAction-visual.qml delete mode 100644 tests/auto/declarative/qmlvisual/animation/scriptAction/data/scriptAction.qml create mode 100644 tests/auto/declarative/qmlvisual/animation/scriptAction/scriptAction-visual.qml delete mode 100644 tests/auto/declarative/qmlvisual/animation/scriptAction/scriptAction.qml diff --git a/tests/auto/declarative/qmlvisual/animation/colorAnimation/colorAnimation-visual.qml b/tests/auto/declarative/qmlvisual/animation/colorAnimation/colorAnimation-visual.qml new file mode 100644 index 0000000..f205ae8 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/colorAnimation/colorAnimation-visual.qml @@ -0,0 +1,41 @@ +import Qt 4.6 + +Rectangle { + id: mainrect + width: 200; height: 200 + state: "first" + states: [ + State { + name: "first" + PropertyChanges { + target: mainrect + color: "red" + } + }, + State { + name: "second" + PropertyChanges { + target: mainrect + color: "blue" + } + } + ] + transitions: [ + Transition { + from: "first" + to: "second" + reversible: true + SequentialAnimation { + ColorAnimation { + duration: 2000 + target: mainrect + property: "color" + } + } + } + ] + MouseArea { + anchors.fill: parent + onClicked: { mainrect.state = 'second' } + } +} diff --git a/tests/auto/declarative/qmlvisual/animation/colorAnimation/colorAnimation.qml b/tests/auto/declarative/qmlvisual/animation/colorAnimation/colorAnimation.qml deleted file mode 100644 index f205ae8..0000000 --- a/tests/auto/declarative/qmlvisual/animation/colorAnimation/colorAnimation.qml +++ /dev/null @@ -1,41 +0,0 @@ -import Qt 4.6 - -Rectangle { - id: mainrect - width: 200; height: 200 - state: "first" - states: [ - State { - name: "first" - PropertyChanges { - target: mainrect - color: "red" - } - }, - State { - name: "second" - PropertyChanges { - target: mainrect - color: "blue" - } - } - ] - transitions: [ - Transition { - from: "first" - to: "second" - reversible: true - SequentialAnimation { - ColorAnimation { - duration: 2000 - target: mainrect - property: "color" - } - } - } - ] - MouseArea { - anchors.fill: parent - onClicked: { mainrect.state = 'second' } - } -} diff --git a/tests/auto/declarative/qmlvisual/animation/colorAnimation/data/colorAnimation-visual.qml b/tests/auto/declarative/qmlvisual/animation/colorAnimation/data/colorAnimation-visual.qml new file mode 100644 index 0000000..4d0959a --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/colorAnimation/data/colorAnimation-visual.qml @@ -0,0 +1,951 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 32 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 48 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 64 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 80 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 96 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 112 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 128 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 144 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 160 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 176 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 192 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 208 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 224 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 240 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 256 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 272 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 288 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 304 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 320 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 336 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 352 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 368 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 384 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 400 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 416 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 432 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 448 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 464 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 480 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 496 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 512 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 93; y: 136 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 528 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 544 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 560 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 576 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 592 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 93; y: 136 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 608 + hash: "acc736435c9f84aa82941ba561bc5dbc" + } + Frame { + msec: 624 + hash: "e5bda0daf98288ce18db6ce06eda3ba0" + } + Frame { + msec: 640 + hash: "d35008f75b8c992f80fb16ba7203649d" + } + Frame { + msec: 656 + hash: "14f43e0784ddf42ea8550db88c501bf1" + } + Frame { + msec: 672 + hash: "02276e158b5391480b1bdeaadf1fb903" + } + Frame { + msec: 688 + hash: "35d9513eb97a2c482b7cd197de910934" + } + Frame { + msec: 704 + hash: "faf0fd681e60bb2489099f5df772b6cd" + } + Frame { + msec: 720 + hash: "a863d3e346f94785a3a392fdc91526eb" + } + Frame { + msec: 736 + hash: "fdf328d3f6eb8410da59a91345e41a44" + } + Frame { + msec: 752 + hash: "83514a3b10d5be8f6c3b128d0f3e0b1c" + } + Frame { + msec: 768 + hash: "ead0eae76cd00189075964671effbaea" + } + Frame { + msec: 784 + hash: "24d2457fcd51490fda23071bf9929d12" + } + Frame { + msec: 800 + hash: "1478683446cf543dacbe31d0b76a98a6" + } + Frame { + msec: 816 + hash: "99f7da1f31fe920f6c02add4042ae925" + } + Frame { + msec: 832 + hash: "22def892006cf66667770b0f17baf6c0" + } + Frame { + msec: 848 + hash: "6a36d5a77099bfd58baf285478ff04e4" + } + Frame { + msec: 864 + hash: "6258150666b59b20ab476724c07fc20c" + } + Frame { + msec: 880 + hash: "f1636315bc950a6dd400d9c7ed263b88" + } + Frame { + msec: 896 + hash: "18447ea8dc2e8da956788e5b3cf3790a" + } + Frame { + msec: 912 + hash: "1d2a6e65997a73e9e670356c8e8b63b2" + } + Frame { + msec: 928 + hash: "bed0242c0f9ef229d1392835286d5782" + } + Frame { + msec: 944 + hash: "88923c190e9e5beadef8a409c06df9d6" + } + Frame { + msec: 960 + image: "colorAnimation.0.png" + } + Frame { + msec: 976 + hash: "85b1821cc50f2a9f3ed6944f792b7a2f" + } + Frame { + msec: 992 + hash: "395195716d76bc0be7b2033ed37a7a1c" + } + Frame { + msec: 1008 + hash: "243dbffcf416926242bbcb7348974c4c" + } + Frame { + msec: 1024 + hash: "a755068679616d8ac65c2aa7431f2a19" + } + Frame { + msec: 1040 + hash: "e8249b35a47eb492cbdf2d91cc8426f0" + } + Frame { + msec: 1056 + hash: "15f3da1c0e6f0779b96859d51171dd27" + } + Frame { + msec: 1072 + hash: "258c0c756aac3de743b43051f2aace6b" + } + Frame { + msec: 1088 + hash: "a58b9fdf301d72b2cc5c93934cc8927b" + } + Frame { + msec: 1104 + hash: "a9181d30870d472521f8904818ce520f" + } + Frame { + msec: 1120 + hash: "7f9e94069ccf3897c26a71bd7becd903" + } + Frame { + msec: 1136 + hash: "bdf305c2f46cdb86dbf57b1e0cc5a65b" + } + Frame { + msec: 1152 + hash: "fe5b6865d7e4fc7d1d42c1e74f8666f7" + } + Frame { + msec: 1168 + hash: "734f0de45a6e34c9eab7ef606196f96a" + } + Frame { + msec: 1184 + hash: "02a361c4534fdf7f286dc3e6dc23275c" + } + Frame { + msec: 1200 + hash: "e649155ad69999c14b92f6561e4d1185" + } + Frame { + msec: 1216 + hash: "01af177084fab755d622973f64b92018" + } + Frame { + msec: 1232 + hash: "097cc4a082dfab995d213a3a73883c97" + } + Frame { + msec: 1248 + hash: "d7b4239a3280b1eb8e885e3f422df8e9" + } + Frame { + msec: 1264 + hash: "59893977994e34e83f91e7ce3ad65d6d" + } + Frame { + msec: 1280 + hash: "b68e3fbb5cdcd6bd96df7dec558db42b" + } + Frame { + msec: 1296 + hash: "94ad0580648f36a1e18a9ea7e249b04d" + } + Frame { + msec: 1312 + hash: "750a4c01d2f5806a89a1c6cc6a9b9a68" + } + Frame { + msec: 1328 + hash: "4f109f50f388f1bfa4bc6b03b3e6e514" + } + Frame { + msec: 1344 + hash: "c6168d5cf27a533e8ee636637667be47" + } + Frame { + msec: 1360 + hash: "f8120547bed987aa34c00da5a01a4d1e" + } + Frame { + msec: 1376 + hash: "cbff526136fa2c128c8b898fbbef9e5c" + } + Frame { + msec: 1392 + hash: "f29e52398fab1a239a63df4c32f2fc69" + } + Frame { + msec: 1408 + hash: "7178bfe86fd2fd513218b33760460f8d" + } + Frame { + msec: 1424 + hash: "ca83285bc8ac633403896fe976896eb0" + } + Frame { + msec: 1440 + hash: "96ba486c09cc69d5aa38c46c00df1181" + } + Frame { + msec: 1456 + hash: "b88eab335842787869f4a14824c19dd8" + } + Frame { + msec: 1472 + hash: "065aa59012729e1e1a246a2083142690" + } + Frame { + msec: 1488 + hash: "dd0e98c8398861002c5f178c5f9f612d" + } + Frame { + msec: 1504 + hash: "04192c2b545948048eccf4d81bbde198" + } + Frame { + msec: 1520 + hash: "bb7502c7208281ef9fd41714ab88a1a8" + } + Frame { + msec: 1536 + hash: "5397195471890d08b703dca101e5bc7c" + } + Frame { + msec: 1552 + hash: "4c678cdbebb2ffd2cbf012ca77800cde" + } + Frame { + msec: 1568 + hash: "0d7a34ecd0c7f52b2c015037bf1902c6" + } + Frame { + msec: 1584 + hash: "fd9d5048be749ac4369fda2d018b43ae" + } + Frame { + msec: 1600 + hash: "93ee03795cd57ae6f7fe3a020b039ad4" + } + Frame { + msec: 1616 + hash: "5e1118963f219c39761ca7fbf564a9ca" + } + Frame { + msec: 1632 + hash: "8f40038741903150136170503649d941" + } + Frame { + msec: 1648 + hash: "b087b7d0aa6224821f8e18718ff5e77d" + } + Frame { + msec: 1664 + hash: "aa46b04a3c67dc772265ed2901955565" + } + Frame { + msec: 1680 + hash: "ac024bf2aeb4becdf31a09fe0a6db8f3" + } + Frame { + msec: 1696 + hash: "13745a174e4d06e2108a5bf125ba50cc" + } + Frame { + msec: 1712 + hash: "bd972f0d8e230eca0b3fea1b8c960c08" + } + Frame { + msec: 1728 + hash: "cbdbec802a58e7ced0cf45b3ab0bc0ba" + } + Frame { + msec: 1744 + hash: "5128584c50305c7d218b81b8367fa3d5" + } + Frame { + msec: 1760 + hash: "a71461d3593f3685620668916de870bd" + } + Frame { + msec: 1776 + hash: "74ebac8f32cf044b58d9883dbcd9a722" + } + Frame { + msec: 1792 + hash: "fedc5b638f339b90fe59b478721e65b7" + } + Frame { + msec: 1808 + hash: "8593a81be812edf54ec94da8ae9c1314" + } + Frame { + msec: 1824 + hash: "4e9b083075bc5e9287a8abc982778b56" + } + Frame { + msec: 1840 + hash: "1d6f02aa99afa47d77fc49ab894b365a" + } + Frame { + msec: 1856 + hash: "a204feec783b3b05de4c209c21745826" + } + Frame { + msec: 1872 + hash: "665a2a8ff00b9663157802767f504754" + } + Frame { + msec: 1888 + hash: "624fb09ebe60cb87d767faf8d2420b1e" + } + Frame { + msec: 1904 + hash: "e5af0cdc33f3275a25abb09e9165f310" + } + Frame { + msec: 1920 + image: "colorAnimation.1.png" + } + Frame { + msec: 1936 + hash: "e7aa6374c73832e57ceb2427a1e258aa" + } + Frame { + msec: 1952 + hash: "b5abd0dff1ab076faac7cc226e83f5d0" + } + Frame { + msec: 1968 + hash: "b759acc35bccff8efc2e6fe276ddc0f7" + } + Frame { + msec: 1984 + hash: "ce52e18c1f7732768779863b45314ff5" + } + Frame { + msec: 2000 + hash: "99d30652559dd6931e0c95543eeaa149" + } + Frame { + msec: 2016 + hash: "ffbd9a00e05e085b89296d19d5caec57" + } + Frame { + msec: 2032 + hash: "9c9d658b9c25602816b8066bf19105db" + } + Frame { + msec: 2048 + hash: "2b7fd058e6601e22a30bb7106b1c683b" + } + Frame { + msec: 2064 + hash: "f4c7e26b19ee0a3e7c9688685eb7bd05" + } + Frame { + msec: 2080 + hash: "0dc6d593bceff56b7f81f2a49d37fefb" + } + Frame { + msec: 2096 + hash: "9bfd7ad5091ccbdde43c593e133a7b10" + } + Frame { + msec: 2112 + hash: "2703b617937914a90ea42ebf249d79ee" + } + Frame { + msec: 2128 + hash: "b77e2983138254016c4cca53100f46fa" + } + Frame { + msec: 2144 + hash: "60c4dd24187d1281081479e586f02b37" + } + Frame { + msec: 2160 + hash: "62f2511abd99ef1231c9fa4b91d4abfe" + } + Frame { + msec: 2176 + hash: "e309b3353fd174e883d309571caddc98" + } + Frame { + msec: 2192 + hash: "1e2d6a134c7b12dde551b148ef4f088c" + } + Frame { + msec: 2208 + hash: "e5dc5450604a491cc24a0dcf5c278b58" + } + Frame { + msec: 2224 + hash: "c8dae97c10e1962c1e6a51ab3ab8579e" + } + Frame { + msec: 2240 + hash: "4e1b7e06f55fb084080689b474f1fe1d" + } + Frame { + msec: 2256 + hash: "b4639c907fa937bf15fac62421170cd8" + } + Frame { + msec: 2272 + hash: "c250208a0caeb5f6cb4d3aac3d7d350b" + } + Frame { + msec: 2288 + hash: "a73351eabecf0d71149efe31f197413e" + } + Frame { + msec: 2304 + hash: "479425f1b7aff79e4dfb7fca534af018" + } + Frame { + msec: 2320 + hash: "046d0f0040a52d1f26ba9f7c5de06ef4" + } + Frame { + msec: 2336 + hash: "655778bf13c6080903150b0eb43a7edc" + } + Frame { + msec: 2352 + hash: "72da0bbe81514870655fdd3354adac60" + } + Frame { + msec: 2368 + hash: "defe0bdf675c65fff55aaaced1e4dae7" + } + Frame { + msec: 2384 + hash: "c988628b6c3d3780e9a865c7694926cd" + } + Frame { + msec: 2400 + hash: "5ab17563655231089edd986ff13d6012" + } + Frame { + msec: 2416 + hash: "c1adff1d2e5800ed466d1691d3b17382" + } + Frame { + msec: 2432 + hash: "70129ba01fbb19592b9dc0d0a3b3e7df" + } + Frame { + msec: 2448 + hash: "0000829ef7ed908bf430d42904d59cc2" + } + Frame { + msec: 2464 + hash: "843d2927f50ab87b4a86b7a6aaeed91f" + } + Frame { + msec: 2480 + hash: "da86d21756025e7de8050586d5e2a1f8" + } + Frame { + msec: 2496 + hash: "48dd1bd6580133b0793fee327ea4f1e6" + } + Frame { + msec: 2512 + hash: "f0618193dcd0ba2837249515a1898b1c" + } + Frame { + msec: 2528 + hash: "a530184e57251065286c0cbba7301e9c" + } + Frame { + msec: 2544 + hash: "64a1d7203973d65dd342793007a61c58" + } + Frame { + msec: 2560 + hash: "5b830dfc6ba442772de87d75d5a578de" + } + Frame { + msec: 2576 + hash: "5563b056b0409b65f60dd16dd0dd890e" + } + Frame { + msec: 2592 + hash: "b8bcf9ad2ca8720c11563a23d8280804" + } + Frame { + msec: 2608 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2624 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2640 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2656 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2672 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2688 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2704 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2720 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2736 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2752 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2768 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2784 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2800 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2816 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2832 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2848 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2864 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2880 + image: "colorAnimation.2.png" + } + Frame { + msec: 2896 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2912 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2928 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2944 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2960 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2976 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 2992 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3008 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3024 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3040 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3056 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3072 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3088 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3104 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3120 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3136 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3152 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3168 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3184 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3200 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3216 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3232 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3248 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3264 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3280 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3296 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3312 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3328 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3344 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3360 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3376 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3392 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3408 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3424 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3440 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3456 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3472 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3488 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3504 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3520 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3536 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3552 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3568 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3584 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3600 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3616 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3632 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Key { + type: 6 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 3648 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3664 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } + Frame { + msec: 3680 + hash: "8c0fcda4f8956394c53fc4ba18caa850" + } +} diff --git a/tests/auto/declarative/qmlvisual/animation/colorAnimation/data/colorAnimation.qml b/tests/auto/declarative/qmlvisual/animation/colorAnimation/data/colorAnimation.qml deleted file mode 100644 index 4d0959a..0000000 --- a/tests/auto/declarative/qmlvisual/animation/colorAnimation/data/colorAnimation.qml +++ /dev/null @@ -1,951 +0,0 @@ -import Qt.VisualTest 4.6 - -VisualTest { - Frame { - msec: 0 - } - Frame { - msec: 16 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 32 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 48 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 64 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 80 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 96 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 112 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 128 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 144 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 160 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 176 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 192 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 208 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 224 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 240 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 256 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 272 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 288 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 304 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 320 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 336 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 352 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 368 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 384 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 400 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 416 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 432 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 448 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 464 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 480 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 496 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 512 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Mouse { - type: 2 - button: 1 - buttons: 1 - x: 93; y: 136 - modifiers: 0 - sendToViewport: true - } - Frame { - msec: 528 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 544 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 560 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 576 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 592 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Mouse { - type: 3 - button: 1 - buttons: 0 - x: 93; y: 136 - modifiers: 0 - sendToViewport: true - } - Frame { - msec: 608 - hash: "acc736435c9f84aa82941ba561bc5dbc" - } - Frame { - msec: 624 - hash: "e5bda0daf98288ce18db6ce06eda3ba0" - } - Frame { - msec: 640 - hash: "d35008f75b8c992f80fb16ba7203649d" - } - Frame { - msec: 656 - hash: "14f43e0784ddf42ea8550db88c501bf1" - } - Frame { - msec: 672 - hash: "02276e158b5391480b1bdeaadf1fb903" - } - Frame { - msec: 688 - hash: "35d9513eb97a2c482b7cd197de910934" - } - Frame { - msec: 704 - hash: "faf0fd681e60bb2489099f5df772b6cd" - } - Frame { - msec: 720 - hash: "a863d3e346f94785a3a392fdc91526eb" - } - Frame { - msec: 736 - hash: "fdf328d3f6eb8410da59a91345e41a44" - } - Frame { - msec: 752 - hash: "83514a3b10d5be8f6c3b128d0f3e0b1c" - } - Frame { - msec: 768 - hash: "ead0eae76cd00189075964671effbaea" - } - Frame { - msec: 784 - hash: "24d2457fcd51490fda23071bf9929d12" - } - Frame { - msec: 800 - hash: "1478683446cf543dacbe31d0b76a98a6" - } - Frame { - msec: 816 - hash: "99f7da1f31fe920f6c02add4042ae925" - } - Frame { - msec: 832 - hash: "22def892006cf66667770b0f17baf6c0" - } - Frame { - msec: 848 - hash: "6a36d5a77099bfd58baf285478ff04e4" - } - Frame { - msec: 864 - hash: "6258150666b59b20ab476724c07fc20c" - } - Frame { - msec: 880 - hash: "f1636315bc950a6dd400d9c7ed263b88" - } - Frame { - msec: 896 - hash: "18447ea8dc2e8da956788e5b3cf3790a" - } - Frame { - msec: 912 - hash: "1d2a6e65997a73e9e670356c8e8b63b2" - } - Frame { - msec: 928 - hash: "bed0242c0f9ef229d1392835286d5782" - } - Frame { - msec: 944 - hash: "88923c190e9e5beadef8a409c06df9d6" - } - Frame { - msec: 960 - image: "colorAnimation.0.png" - } - Frame { - msec: 976 - hash: "85b1821cc50f2a9f3ed6944f792b7a2f" - } - Frame { - msec: 992 - hash: "395195716d76bc0be7b2033ed37a7a1c" - } - Frame { - msec: 1008 - hash: "243dbffcf416926242bbcb7348974c4c" - } - Frame { - msec: 1024 - hash: "a755068679616d8ac65c2aa7431f2a19" - } - Frame { - msec: 1040 - hash: "e8249b35a47eb492cbdf2d91cc8426f0" - } - Frame { - msec: 1056 - hash: "15f3da1c0e6f0779b96859d51171dd27" - } - Frame { - msec: 1072 - hash: "258c0c756aac3de743b43051f2aace6b" - } - Frame { - msec: 1088 - hash: "a58b9fdf301d72b2cc5c93934cc8927b" - } - Frame { - msec: 1104 - hash: "a9181d30870d472521f8904818ce520f" - } - Frame { - msec: 1120 - hash: "7f9e94069ccf3897c26a71bd7becd903" - } - Frame { - msec: 1136 - hash: "bdf305c2f46cdb86dbf57b1e0cc5a65b" - } - Frame { - msec: 1152 - hash: "fe5b6865d7e4fc7d1d42c1e74f8666f7" - } - Frame { - msec: 1168 - hash: "734f0de45a6e34c9eab7ef606196f96a" - } - Frame { - msec: 1184 - hash: "02a361c4534fdf7f286dc3e6dc23275c" - } - Frame { - msec: 1200 - hash: "e649155ad69999c14b92f6561e4d1185" - } - Frame { - msec: 1216 - hash: "01af177084fab755d622973f64b92018" - } - Frame { - msec: 1232 - hash: "097cc4a082dfab995d213a3a73883c97" - } - Frame { - msec: 1248 - hash: "d7b4239a3280b1eb8e885e3f422df8e9" - } - Frame { - msec: 1264 - hash: "59893977994e34e83f91e7ce3ad65d6d" - } - Frame { - msec: 1280 - hash: "b68e3fbb5cdcd6bd96df7dec558db42b" - } - Frame { - msec: 1296 - hash: "94ad0580648f36a1e18a9ea7e249b04d" - } - Frame { - msec: 1312 - hash: "750a4c01d2f5806a89a1c6cc6a9b9a68" - } - Frame { - msec: 1328 - hash: "4f109f50f388f1bfa4bc6b03b3e6e514" - } - Frame { - msec: 1344 - hash: "c6168d5cf27a533e8ee636637667be47" - } - Frame { - msec: 1360 - hash: "f8120547bed987aa34c00da5a01a4d1e" - } - Frame { - msec: 1376 - hash: "cbff526136fa2c128c8b898fbbef9e5c" - } - Frame { - msec: 1392 - hash: "f29e52398fab1a239a63df4c32f2fc69" - } - Frame { - msec: 1408 - hash: "7178bfe86fd2fd513218b33760460f8d" - } - Frame { - msec: 1424 - hash: "ca83285bc8ac633403896fe976896eb0" - } - Frame { - msec: 1440 - hash: "96ba486c09cc69d5aa38c46c00df1181" - } - Frame { - msec: 1456 - hash: "b88eab335842787869f4a14824c19dd8" - } - Frame { - msec: 1472 - hash: "065aa59012729e1e1a246a2083142690" - } - Frame { - msec: 1488 - hash: "dd0e98c8398861002c5f178c5f9f612d" - } - Frame { - msec: 1504 - hash: "04192c2b545948048eccf4d81bbde198" - } - Frame { - msec: 1520 - hash: "bb7502c7208281ef9fd41714ab88a1a8" - } - Frame { - msec: 1536 - hash: "5397195471890d08b703dca101e5bc7c" - } - Frame { - msec: 1552 - hash: "4c678cdbebb2ffd2cbf012ca77800cde" - } - Frame { - msec: 1568 - hash: "0d7a34ecd0c7f52b2c015037bf1902c6" - } - Frame { - msec: 1584 - hash: "fd9d5048be749ac4369fda2d018b43ae" - } - Frame { - msec: 1600 - hash: "93ee03795cd57ae6f7fe3a020b039ad4" - } - Frame { - msec: 1616 - hash: "5e1118963f219c39761ca7fbf564a9ca" - } - Frame { - msec: 1632 - hash: "8f40038741903150136170503649d941" - } - Frame { - msec: 1648 - hash: "b087b7d0aa6224821f8e18718ff5e77d" - } - Frame { - msec: 1664 - hash: "aa46b04a3c67dc772265ed2901955565" - } - Frame { - msec: 1680 - hash: "ac024bf2aeb4becdf31a09fe0a6db8f3" - } - Frame { - msec: 1696 - hash: "13745a174e4d06e2108a5bf125ba50cc" - } - Frame { - msec: 1712 - hash: "bd972f0d8e230eca0b3fea1b8c960c08" - } - Frame { - msec: 1728 - hash: "cbdbec802a58e7ced0cf45b3ab0bc0ba" - } - Frame { - msec: 1744 - hash: "5128584c50305c7d218b81b8367fa3d5" - } - Frame { - msec: 1760 - hash: "a71461d3593f3685620668916de870bd" - } - Frame { - msec: 1776 - hash: "74ebac8f32cf044b58d9883dbcd9a722" - } - Frame { - msec: 1792 - hash: "fedc5b638f339b90fe59b478721e65b7" - } - Frame { - msec: 1808 - hash: "8593a81be812edf54ec94da8ae9c1314" - } - Frame { - msec: 1824 - hash: "4e9b083075bc5e9287a8abc982778b56" - } - Frame { - msec: 1840 - hash: "1d6f02aa99afa47d77fc49ab894b365a" - } - Frame { - msec: 1856 - hash: "a204feec783b3b05de4c209c21745826" - } - Frame { - msec: 1872 - hash: "665a2a8ff00b9663157802767f504754" - } - Frame { - msec: 1888 - hash: "624fb09ebe60cb87d767faf8d2420b1e" - } - Frame { - msec: 1904 - hash: "e5af0cdc33f3275a25abb09e9165f310" - } - Frame { - msec: 1920 - image: "colorAnimation.1.png" - } - Frame { - msec: 1936 - hash: "e7aa6374c73832e57ceb2427a1e258aa" - } - Frame { - msec: 1952 - hash: "b5abd0dff1ab076faac7cc226e83f5d0" - } - Frame { - msec: 1968 - hash: "b759acc35bccff8efc2e6fe276ddc0f7" - } - Frame { - msec: 1984 - hash: "ce52e18c1f7732768779863b45314ff5" - } - Frame { - msec: 2000 - hash: "99d30652559dd6931e0c95543eeaa149" - } - Frame { - msec: 2016 - hash: "ffbd9a00e05e085b89296d19d5caec57" - } - Frame { - msec: 2032 - hash: "9c9d658b9c25602816b8066bf19105db" - } - Frame { - msec: 2048 - hash: "2b7fd058e6601e22a30bb7106b1c683b" - } - Frame { - msec: 2064 - hash: "f4c7e26b19ee0a3e7c9688685eb7bd05" - } - Frame { - msec: 2080 - hash: "0dc6d593bceff56b7f81f2a49d37fefb" - } - Frame { - msec: 2096 - hash: "9bfd7ad5091ccbdde43c593e133a7b10" - } - Frame { - msec: 2112 - hash: "2703b617937914a90ea42ebf249d79ee" - } - Frame { - msec: 2128 - hash: "b77e2983138254016c4cca53100f46fa" - } - Frame { - msec: 2144 - hash: "60c4dd24187d1281081479e586f02b37" - } - Frame { - msec: 2160 - hash: "62f2511abd99ef1231c9fa4b91d4abfe" - } - Frame { - msec: 2176 - hash: "e309b3353fd174e883d309571caddc98" - } - Frame { - msec: 2192 - hash: "1e2d6a134c7b12dde551b148ef4f088c" - } - Frame { - msec: 2208 - hash: "e5dc5450604a491cc24a0dcf5c278b58" - } - Frame { - msec: 2224 - hash: "c8dae97c10e1962c1e6a51ab3ab8579e" - } - Frame { - msec: 2240 - hash: "4e1b7e06f55fb084080689b474f1fe1d" - } - Frame { - msec: 2256 - hash: "b4639c907fa937bf15fac62421170cd8" - } - Frame { - msec: 2272 - hash: "c250208a0caeb5f6cb4d3aac3d7d350b" - } - Frame { - msec: 2288 - hash: "a73351eabecf0d71149efe31f197413e" - } - Frame { - msec: 2304 - hash: "479425f1b7aff79e4dfb7fca534af018" - } - Frame { - msec: 2320 - hash: "046d0f0040a52d1f26ba9f7c5de06ef4" - } - Frame { - msec: 2336 - hash: "655778bf13c6080903150b0eb43a7edc" - } - Frame { - msec: 2352 - hash: "72da0bbe81514870655fdd3354adac60" - } - Frame { - msec: 2368 - hash: "defe0bdf675c65fff55aaaced1e4dae7" - } - Frame { - msec: 2384 - hash: "c988628b6c3d3780e9a865c7694926cd" - } - Frame { - msec: 2400 - hash: "5ab17563655231089edd986ff13d6012" - } - Frame { - msec: 2416 - hash: "c1adff1d2e5800ed466d1691d3b17382" - } - Frame { - msec: 2432 - hash: "70129ba01fbb19592b9dc0d0a3b3e7df" - } - Frame { - msec: 2448 - hash: "0000829ef7ed908bf430d42904d59cc2" - } - Frame { - msec: 2464 - hash: "843d2927f50ab87b4a86b7a6aaeed91f" - } - Frame { - msec: 2480 - hash: "da86d21756025e7de8050586d5e2a1f8" - } - Frame { - msec: 2496 - hash: "48dd1bd6580133b0793fee327ea4f1e6" - } - Frame { - msec: 2512 - hash: "f0618193dcd0ba2837249515a1898b1c" - } - Frame { - msec: 2528 - hash: "a530184e57251065286c0cbba7301e9c" - } - Frame { - msec: 2544 - hash: "64a1d7203973d65dd342793007a61c58" - } - Frame { - msec: 2560 - hash: "5b830dfc6ba442772de87d75d5a578de" - } - Frame { - msec: 2576 - hash: "5563b056b0409b65f60dd16dd0dd890e" - } - Frame { - msec: 2592 - hash: "b8bcf9ad2ca8720c11563a23d8280804" - } - Frame { - msec: 2608 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2624 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2640 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2656 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2672 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2688 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2704 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2720 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2736 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2752 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2768 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2784 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2800 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2816 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2832 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2848 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2864 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2880 - image: "colorAnimation.2.png" - } - Frame { - msec: 2896 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2912 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2928 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2944 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2960 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2976 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 2992 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3008 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3024 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3040 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3056 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3072 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3088 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3104 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3120 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3136 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3152 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3168 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3184 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3200 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3216 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3232 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3248 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3264 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3280 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3296 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3312 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3328 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3344 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3360 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3376 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3392 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3408 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3424 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3440 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3456 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3472 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3488 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3504 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3520 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3536 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3552 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3568 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3584 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3600 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3616 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3632 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Key { - type: 6 - key: 16777249 - modifiers: 67108864 - text: "" - autorep: false - count: 1 - } - Frame { - msec: 3648 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3664 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } - Frame { - msec: 3680 - hash: "8c0fcda4f8956394c53fc4ba18caa850" - } -} diff --git a/tests/auto/declarative/qmlvisual/animation/easing/pics/qtlogo.png b/tests/auto/declarative/qmlvisual/animation/easing/pics/qtlogo.png deleted file mode 100644 index 399bd0b..0000000 Binary files a/tests/auto/declarative/qmlvisual/animation/easing/pics/qtlogo.png and /dev/null differ diff --git a/tests/auto/declarative/qmlvisual/animation/parallelAnimation/data/parallelAnimation-visual.qml b/tests/auto/declarative/qmlvisual/animation/parallelAnimation/data/parallelAnimation-visual.qml new file mode 100644 index 0000000..5f5b8fc --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/parallelAnimation/data/parallelAnimation-visual.qml @@ -0,0 +1,463 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 32 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 48 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 64 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 80 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 96 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 112 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 128 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 144 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 160 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 176 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 192 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 208 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 224 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 240 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 256 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 272 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 288 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 304 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 320 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 336 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 352 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 368 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 384 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 400 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 416 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 432 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 448 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 464 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 480 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 496 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 512 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 528 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 544 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 560 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 576 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 592 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 608 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 624 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 640 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 656 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 672 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 688 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 704 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 720 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 736 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 752 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 137; y: 74 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 768 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 784 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 800 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 816 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 832 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 848 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 864 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 137; y: 74 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 880 + hash: "4faa7727bafeea0771f2db62f0141ac9" + } + Frame { + msec: 896 + hash: "0fada111cb977c4de8c7499e44714f38" + } + Frame { + msec: 912 + hash: "1817e010332117dcddc1a1b1a2caf52d" + } + Frame { + msec: 928 + hash: "e4add6bf93479c9bca571419fe2fabf9" + } + Frame { + msec: 944 + hash: "d8812e206d2cbf434d58db6a35439a44" + } + Frame { + msec: 960 + image: "parallelAnimation.0.png" + } + Frame { + msec: 976 + hash: "a238178c584aaf2563d29bff927d5bab" + } + Frame { + msec: 992 + hash: "f583e9fe8feda02e796a61c5fed7b0eb" + } + Frame { + msec: 1008 + hash: "b3a1a4fd85912831e551a8c07da1a561" + } + Frame { + msec: 1024 + hash: "f7c111ee4a04af6c1da958f8b56c28ee" + } + Frame { + msec: 1040 + hash: "f53fa374817d81ee44fb98e64e464b36" + } + Frame { + msec: 1056 + hash: "547ddef13cbcaaf57bb1f4e2bb7bc822" + } + Frame { + msec: 1072 + hash: "8b10ccfef926103a6d67d68eee250f83" + } + Frame { + msec: 1088 + hash: "008bbb50dc659e6f5eea15290680edd7" + } + Frame { + msec: 1104 + hash: "0217e3230d3df44363a023d0d7defc5f" + } + Frame { + msec: 1120 + hash: "ab9907a92452de6878f4c346febe705c" + } + Frame { + msec: 1136 + hash: "7bce31f347a7f0598d2d64026c702f3e" + } + Frame { + msec: 1152 + hash: "032080184907bc5b01db7675802d7dbe" + } + Frame { + msec: 1168 + hash: "2cba43a2e5febcc44bfd1379b9cb2591" + } + Frame { + msec: 1184 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1200 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1216 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1232 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1248 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1264 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1280 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1296 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1312 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1328 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1344 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1360 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1376 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1392 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1408 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1424 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1440 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1456 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1472 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1488 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1504 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Key { + type: 6 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 1520 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1536 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1552 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1568 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1584 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1600 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1616 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1632 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1648 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1664 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1680 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1696 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1712 + hash: "b901a51b5605621adff7b34c61f8f320" + } + Frame { + msec: 1728 + hash: "b901a51b5605621adff7b34c61f8f320" + } +} diff --git a/tests/auto/declarative/qmlvisual/animation/parallelAnimation/data/parallelAnimation.qml b/tests/auto/declarative/qmlvisual/animation/parallelAnimation/data/parallelAnimation.qml deleted file mode 100644 index 5f5b8fc..0000000 --- a/tests/auto/declarative/qmlvisual/animation/parallelAnimation/data/parallelAnimation.qml +++ /dev/null @@ -1,463 +0,0 @@ -import Qt.VisualTest 4.6 - -VisualTest { - Frame { - msec: 0 - } - Frame { - msec: 16 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 32 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 48 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 64 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 80 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 96 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 112 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 128 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 144 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 160 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 176 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 192 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 208 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 224 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 240 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 256 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 272 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 288 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 304 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 320 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 336 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 352 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 368 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 384 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 400 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 416 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 432 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 448 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 464 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 480 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 496 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 512 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 528 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 544 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 560 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 576 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 592 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 608 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 624 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 640 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 656 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 672 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 688 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 704 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 720 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 736 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 752 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Mouse { - type: 2 - button: 1 - buttons: 1 - x: 137; y: 74 - modifiers: 0 - sendToViewport: true - } - Frame { - msec: 768 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 784 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 800 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 816 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 832 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 848 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 864 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Mouse { - type: 3 - button: 1 - buttons: 0 - x: 137; y: 74 - modifiers: 0 - sendToViewport: true - } - Frame { - msec: 880 - hash: "4faa7727bafeea0771f2db62f0141ac9" - } - Frame { - msec: 896 - hash: "0fada111cb977c4de8c7499e44714f38" - } - Frame { - msec: 912 - hash: "1817e010332117dcddc1a1b1a2caf52d" - } - Frame { - msec: 928 - hash: "e4add6bf93479c9bca571419fe2fabf9" - } - Frame { - msec: 944 - hash: "d8812e206d2cbf434d58db6a35439a44" - } - Frame { - msec: 960 - image: "parallelAnimation.0.png" - } - Frame { - msec: 976 - hash: "a238178c584aaf2563d29bff927d5bab" - } - Frame { - msec: 992 - hash: "f583e9fe8feda02e796a61c5fed7b0eb" - } - Frame { - msec: 1008 - hash: "b3a1a4fd85912831e551a8c07da1a561" - } - Frame { - msec: 1024 - hash: "f7c111ee4a04af6c1da958f8b56c28ee" - } - Frame { - msec: 1040 - hash: "f53fa374817d81ee44fb98e64e464b36" - } - Frame { - msec: 1056 - hash: "547ddef13cbcaaf57bb1f4e2bb7bc822" - } - Frame { - msec: 1072 - hash: "8b10ccfef926103a6d67d68eee250f83" - } - Frame { - msec: 1088 - hash: "008bbb50dc659e6f5eea15290680edd7" - } - Frame { - msec: 1104 - hash: "0217e3230d3df44363a023d0d7defc5f" - } - Frame { - msec: 1120 - hash: "ab9907a92452de6878f4c346febe705c" - } - Frame { - msec: 1136 - hash: "7bce31f347a7f0598d2d64026c702f3e" - } - Frame { - msec: 1152 - hash: "032080184907bc5b01db7675802d7dbe" - } - Frame { - msec: 1168 - hash: "2cba43a2e5febcc44bfd1379b9cb2591" - } - Frame { - msec: 1184 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1200 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1216 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1232 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1248 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1264 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1280 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1296 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1312 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1328 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1344 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1360 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1376 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1392 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1408 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1424 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1440 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1456 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1472 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1488 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1504 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Key { - type: 6 - key: 16777249 - modifiers: 67108864 - text: "" - autorep: false - count: 1 - } - Frame { - msec: 1520 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1536 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1552 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1568 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1584 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1600 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1616 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1632 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1648 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1664 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1680 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1696 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1712 - hash: "b901a51b5605621adff7b34c61f8f320" - } - Frame { - msec: 1728 - hash: "b901a51b5605621adff7b34c61f8f320" - } -} diff --git a/tests/auto/declarative/qmlvisual/animation/parallelAnimation/parallelAnimation-visual.qml b/tests/auto/declarative/qmlvisual/animation/parallelAnimation/parallelAnimation-visual.qml new file mode 100644 index 0000000..ba606f4 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/parallelAnimation/parallelAnimation-visual.qml @@ -0,0 +1,51 @@ +import Qt 4.6 + +/* + This test verifies that a single animation animating two properties is visually the same as two + animations in a parallel group animating the same properties. Visually, you should see a red + rectangle at 0,0 stretching from the top of the window to the bottom. This rect will be moved to + the right side of the window while turning purple. If the bottom half is visually different + than the top half, there is a problem. +*/ + +Rectangle { + width: 400; height: 200 + Rectangle { + id: redRect + width: 100; height: 100 + color: "red" + } + Rectangle { + id: redRect2 + width: 100; height: 100 + y: 100 + color: "red" + } + + MouseArea { + anchors.fill: parent + onClicked: parent.state = "state1" + } + + states: State { + name: "state1" + PropertyChanges { + target: redRect + x: 300 + color: "purple" + } + PropertyChanges { + target: redRect2 + x: 300 + color: "purple" + } + } + + transitions: Transition { + PropertyAnimation { targets: redRect; properties: "x,color"; duration: 300 } + ParallelAnimation { + NumberAnimation { targets: redRect2; properties: "x"; duration: 300 } + ColorAnimation { targets: redRect2; properties: "color"; duration: 300 } + } + } +} diff --git a/tests/auto/declarative/qmlvisual/animation/parallelAnimation/parallelAnimation.qml b/tests/auto/declarative/qmlvisual/animation/parallelAnimation/parallelAnimation.qml deleted file mode 100644 index 1980b91..0000000 --- a/tests/auto/declarative/qmlvisual/animation/parallelAnimation/parallelAnimation.qml +++ /dev/null @@ -1,43 +0,0 @@ -import Qt 4.6 - -Rectangle { - width: 400; height: 200 - Rectangle { - id: redRect - width: 100; height: 100 - color: "red" - } - Rectangle { - id: redRect2 - width: 100; height: 100 - y: 100 - color: "red" - } - - MouseArea { - anchors.fill: parent - onClicked: parent.state = "state1" - } - - states: State { - name: "state1" - PropertyChanges { - target: redRect - x: 300 - color: "purple" - } - PropertyChanges { - target: redRect2 - x: 300 - color: "purple" - } - } - - transitions: Transition { - PropertyAnimation { targets: redRect; properties: "x,color"; duration: 300 } - ParallelAnimation { - NumberAnimation { targets: redRect2; properties: "x"; duration: 300 } - ColorAnimation { targets: redRect2; properties: "color"; duration: 300 } - } - } -} diff --git a/tests/auto/declarative/qmlvisual/animation/propertyAction/data/propertyAction-visual.qml b/tests/auto/declarative/qmlvisual/animation/propertyAction/data/propertyAction-visual.qml new file mode 100644 index 0000000..7c8c233 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/propertyAction/data/propertyAction-visual.qml @@ -0,0 +1,939 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 32 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 48 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 64 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 80 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 96 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 112 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 128 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 144 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 160 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 176 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 192 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 208 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 224 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 240 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 256 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 272 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 288 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 304 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 320 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 336 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 352 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 368 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 384 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 400 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 416 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 432 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 448 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 464 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 480 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 496 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 512 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 528 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 544 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 560 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 576 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 592 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 608 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 624 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 640 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 656 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 672 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 688 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 704 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 720 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 736 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 752 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 768 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 784 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 800 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 816 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 832 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 848 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 864 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 880 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 896 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 912 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 928 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 944 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 960 + image: "propertyAction.0.png" + } + Frame { + msec: 976 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 992 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1008 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1024 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1040 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1056 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1072 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1088 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1104 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1120 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1136 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1152 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1168 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1184 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1200 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1216 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1232 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1248 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1264 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1280 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1296 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1312 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1328 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1344 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1360 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1376 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1392 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1408 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1424 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1440 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1456 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1472 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1488 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1504 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1520 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1536 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1552 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1568 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1584 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1600 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 109; y: 247 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1616 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1632 + hash: "c91921dba899d7a86de3cd013773889f" + } + Frame { + msec: 1648 + hash: "888c0fc86155e10b5fc577ef6ec5755a" + } + Frame { + msec: 1664 + hash: "7fd61a8910bf7b0d2bf57653a268c5d8" + } + Frame { + msec: 1680 + hash: "f42f5073f90a423adf011d0e168c8a9b" + } + Frame { + msec: 1696 + hash: "a3d89deb6cfa2bbbaa1d7d5b5e5b48d5" + } + Frame { + msec: 1712 + hash: "f10e997d7a17c18251a32d58b018105a" + } + Frame { + msec: 1728 + hash: "09ffb57d5f67edfa34d6aad36a002554" + } + Frame { + msec: 1744 + hash: "01f3a2f5b9815f1397a907b099339360" + } + Frame { + msec: 1760 + hash: "58c0910c49748edd2ef8472960179472" + } + Frame { + msec: 1776 + hash: "cc82c5f7f93c5bc1af1c6c509268566a" + } + Frame { + msec: 1792 + hash: "3ef272c6439b85fbc166375d1b98403c" + } + Frame { + msec: 1808 + hash: "98c576f0900e4b8752d1f951bb6bf391" + } + Frame { + msec: 1824 + hash: "4d66dd64d8736ef50163e08723873478" + } + Frame { + msec: 1840 + hash: "9a5d8455b6763456185625811253e0b1" + } + Frame { + msec: 1856 + hash: "77e85731efa786a2492aae19a87523c6" + } + Frame { + msec: 1872 + hash: "f3199d0c860f1236e0b9472bef8785bc" + } + Frame { + msec: 1888 + hash: "f3199d0c860f1236e0b9472bef8785bc" + } + Frame { + msec: 1904 + hash: "32ccdab249268b01d9f1658a736052f1" + } + Frame { + msec: 1920 + image: "propertyAction.1.png" + } + Frame { + msec: 1936 + hash: "db3010ef552146df938c237f6c92bff5" + } + Frame { + msec: 1952 + hash: "101e8595d0301e88376ec52ba9361f84" + } + Frame { + msec: 1968 + hash: "119d548c59baa7e47266d2ceca663288" + } + Frame { + msec: 1984 + hash: "f141fafe102a0b9a2bf33e8c3fc800ff" + } + Frame { + msec: 2000 + hash: "b01f9ca8d4fbff17b3d48c70898a044d" + } + Frame { + msec: 2016 + hash: "cf67954a2d1b22e8d2cfdc26419bafb8" + } + Frame { + msec: 2032 + hash: "7680b2b5a63dea13d733947297e01355" + } + Frame { + msec: 2048 + hash: "af1c017acf6b3c8cff86c9ceb60db3cb" + } + Frame { + msec: 2064 + hash: "0b23ec51f71fddae5e2238ab5754f1db" + } + Frame { + msec: 2080 + hash: "976643961ecbdc86335180ba812b874e" + } + Frame { + msec: 2096 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2112 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2128 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2144 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2160 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2176 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2192 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2208 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2224 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2240 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2256 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2272 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2288 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2304 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2320 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2336 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2352 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2368 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2384 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2400 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2416 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2432 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2448 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2464 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2480 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2496 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2512 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2528 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2544 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2560 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2576 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2592 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2608 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2624 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2640 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2656 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2672 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2688 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2704 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2720 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2736 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2752 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 109; y: 247 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2768 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2784 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2800 + hash: "ab924ae435262e76381c2e4af5d64342" + } + Frame { + msec: 2816 + hash: "d60758fc12471a19d31c85f058f2ded7" + } + Frame { + msec: 2832 + hash: "c62e2956f8eb5d2c8cd76ba05c5929d5" + } + Frame { + msec: 2848 + hash: "f2967ee7e035a9ff258116a2706529f8" + } + Frame { + msec: 2864 + hash: "885c4705c6c29f69c56c44abc1251d75" + } + Frame { + msec: 2880 + image: "propertyAction.2.png" + } + Frame { + msec: 2896 + hash: "f4af6871e522511f95bc4c5abfc2a562" + } + Frame { + msec: 2912 + hash: "b27e1e7e0d90468525309528ccfe2823" + } + Frame { + msec: 2928 + hash: "78e7d84a4466258b40315fe61b7ca15c" + } + Frame { + msec: 2944 + hash: "471013d921d8d6e7468fd6aba0b75c71" + } + Frame { + msec: 2960 + hash: "856048da893c9136ac5740bc89b64128" + } + Frame { + msec: 2976 + hash: "32ccdab249268b01d9f1658a736052f1" + } + Frame { + msec: 2992 + hash: "2264fa3acd979f104633c1301a0efd8f" + } + Frame { + msec: 3008 + hash: "f3199d0c860f1236e0b9472bef8785bc" + } + Frame { + msec: 3024 + hash: "ad899d1ecaa43a5541be7b70413caee5" + } + Frame { + msec: 3040 + hash: "4e652524c992f5ee1b987275ca509728" + } + Frame { + msec: 3056 + hash: "a44b3dec2a016694bc8553a51b29d46c" + } + Frame { + msec: 3072 + hash: "7fbe20346bc3c28c345e0797b55599f3" + } + Frame { + msec: 3088 + hash: "bcff18ad433bb4f08126ee66efb037d1" + } + Frame { + msec: 3104 + hash: "836666c64f73c38e87de95944ff2fe72" + } + Frame { + msec: 3120 + hash: "4379982d23db239b1741b5d72c53e160" + } + Frame { + msec: 3136 + hash: "0ed9476337214e1493c1510b8a4c90f8" + } + Frame { + msec: 3152 + hash: "dab637406577a1924c7dbb30680e1af3" + } + Frame { + msec: 3168 + hash: "dcc79277fdb8966e5a3f2ed1b2fc4292" + } + Frame { + msec: 3184 + hash: "5f207d1dfad4907f200d76104881bf56" + } + Frame { + msec: 3200 + hash: "3434fc7f81e859722585dae97c557864" + } + Frame { + msec: 3216 + hash: "7c775b9be8c5293d4962324574267c22" + } + Frame { + msec: 3232 + hash: "da0ff6955c2e4cd86421bdb9053f56e6" + } + Frame { + msec: 3248 + hash: "a1297d525a3ad41abbbb7c2f15efd4fb" + } + Frame { + msec: 3264 + hash: "5326b220995b2a1eaa308ad10fd353fa" + } + Frame { + msec: 3280 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3296 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3312 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3328 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3344 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Key { + type: 6 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 3360 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3376 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3392 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3408 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3424 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3440 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3456 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3472 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3488 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3504 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3520 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3536 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3552 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3568 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3584 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3600 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3616 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 3632 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } +} diff --git a/tests/auto/declarative/qmlvisual/animation/propertyAction/data/propertyAction.qml b/tests/auto/declarative/qmlvisual/animation/propertyAction/data/propertyAction.qml deleted file mode 100644 index 7c8c233..0000000 --- a/tests/auto/declarative/qmlvisual/animation/propertyAction/data/propertyAction.qml +++ /dev/null @@ -1,939 +0,0 @@ -import Qt.VisualTest 4.6 - -VisualTest { - Frame { - msec: 0 - } - Frame { - msec: 16 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 32 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 48 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 64 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 80 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 96 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 112 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 128 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 144 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 160 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 176 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 192 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 208 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 224 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 240 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 256 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 272 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 288 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 304 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 320 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 336 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 352 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 368 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 384 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 400 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 416 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 432 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 448 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 464 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 480 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 496 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 512 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 528 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 544 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 560 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 576 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 592 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 608 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 624 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 640 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 656 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 672 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 688 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 704 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 720 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 736 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 752 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 768 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 784 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 800 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 816 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 832 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 848 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 864 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 880 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 896 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 912 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 928 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 944 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 960 - image: "propertyAction.0.png" - } - Frame { - msec: 976 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 992 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1008 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1024 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1040 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1056 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1072 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1088 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1104 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1120 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1136 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1152 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1168 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1184 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1200 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1216 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1232 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1248 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1264 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1280 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1296 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1312 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1328 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1344 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1360 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1376 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1392 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1408 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1424 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1440 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1456 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1472 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1488 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1504 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1520 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1536 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1552 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1568 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1584 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1600 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Mouse { - type: 2 - button: 1 - buttons: 1 - x: 109; y: 247 - modifiers: 0 - sendToViewport: true - } - Frame { - msec: 1616 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1632 - hash: "c91921dba899d7a86de3cd013773889f" - } - Frame { - msec: 1648 - hash: "888c0fc86155e10b5fc577ef6ec5755a" - } - Frame { - msec: 1664 - hash: "7fd61a8910bf7b0d2bf57653a268c5d8" - } - Frame { - msec: 1680 - hash: "f42f5073f90a423adf011d0e168c8a9b" - } - Frame { - msec: 1696 - hash: "a3d89deb6cfa2bbbaa1d7d5b5e5b48d5" - } - Frame { - msec: 1712 - hash: "f10e997d7a17c18251a32d58b018105a" - } - Frame { - msec: 1728 - hash: "09ffb57d5f67edfa34d6aad36a002554" - } - Frame { - msec: 1744 - hash: "01f3a2f5b9815f1397a907b099339360" - } - Frame { - msec: 1760 - hash: "58c0910c49748edd2ef8472960179472" - } - Frame { - msec: 1776 - hash: "cc82c5f7f93c5bc1af1c6c509268566a" - } - Frame { - msec: 1792 - hash: "3ef272c6439b85fbc166375d1b98403c" - } - Frame { - msec: 1808 - hash: "98c576f0900e4b8752d1f951bb6bf391" - } - Frame { - msec: 1824 - hash: "4d66dd64d8736ef50163e08723873478" - } - Frame { - msec: 1840 - hash: "9a5d8455b6763456185625811253e0b1" - } - Frame { - msec: 1856 - hash: "77e85731efa786a2492aae19a87523c6" - } - Frame { - msec: 1872 - hash: "f3199d0c860f1236e0b9472bef8785bc" - } - Frame { - msec: 1888 - hash: "f3199d0c860f1236e0b9472bef8785bc" - } - Frame { - msec: 1904 - hash: "32ccdab249268b01d9f1658a736052f1" - } - Frame { - msec: 1920 - image: "propertyAction.1.png" - } - Frame { - msec: 1936 - hash: "db3010ef552146df938c237f6c92bff5" - } - Frame { - msec: 1952 - hash: "101e8595d0301e88376ec52ba9361f84" - } - Frame { - msec: 1968 - hash: "119d548c59baa7e47266d2ceca663288" - } - Frame { - msec: 1984 - hash: "f141fafe102a0b9a2bf33e8c3fc800ff" - } - Frame { - msec: 2000 - hash: "b01f9ca8d4fbff17b3d48c70898a044d" - } - Frame { - msec: 2016 - hash: "cf67954a2d1b22e8d2cfdc26419bafb8" - } - Frame { - msec: 2032 - hash: "7680b2b5a63dea13d733947297e01355" - } - Frame { - msec: 2048 - hash: "af1c017acf6b3c8cff86c9ceb60db3cb" - } - Frame { - msec: 2064 - hash: "0b23ec51f71fddae5e2238ab5754f1db" - } - Frame { - msec: 2080 - hash: "976643961ecbdc86335180ba812b874e" - } - Frame { - msec: 2096 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2112 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2128 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2144 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2160 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2176 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2192 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2208 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2224 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2240 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2256 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2272 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2288 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2304 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2320 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2336 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2352 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2368 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2384 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2400 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2416 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2432 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2448 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2464 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2480 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2496 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2512 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2528 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2544 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2560 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2576 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2592 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2608 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2624 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2640 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2656 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2672 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2688 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2704 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2720 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2736 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2752 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Mouse { - type: 3 - button: 1 - buttons: 0 - x: 109; y: 247 - modifiers: 0 - sendToViewport: true - } - Frame { - msec: 2768 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2784 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2800 - hash: "ab924ae435262e76381c2e4af5d64342" - } - Frame { - msec: 2816 - hash: "d60758fc12471a19d31c85f058f2ded7" - } - Frame { - msec: 2832 - hash: "c62e2956f8eb5d2c8cd76ba05c5929d5" - } - Frame { - msec: 2848 - hash: "f2967ee7e035a9ff258116a2706529f8" - } - Frame { - msec: 2864 - hash: "885c4705c6c29f69c56c44abc1251d75" - } - Frame { - msec: 2880 - image: "propertyAction.2.png" - } - Frame { - msec: 2896 - hash: "f4af6871e522511f95bc4c5abfc2a562" - } - Frame { - msec: 2912 - hash: "b27e1e7e0d90468525309528ccfe2823" - } - Frame { - msec: 2928 - hash: "78e7d84a4466258b40315fe61b7ca15c" - } - Frame { - msec: 2944 - hash: "471013d921d8d6e7468fd6aba0b75c71" - } - Frame { - msec: 2960 - hash: "856048da893c9136ac5740bc89b64128" - } - Frame { - msec: 2976 - hash: "32ccdab249268b01d9f1658a736052f1" - } - Frame { - msec: 2992 - hash: "2264fa3acd979f104633c1301a0efd8f" - } - Frame { - msec: 3008 - hash: "f3199d0c860f1236e0b9472bef8785bc" - } - Frame { - msec: 3024 - hash: "ad899d1ecaa43a5541be7b70413caee5" - } - Frame { - msec: 3040 - hash: "4e652524c992f5ee1b987275ca509728" - } - Frame { - msec: 3056 - hash: "a44b3dec2a016694bc8553a51b29d46c" - } - Frame { - msec: 3072 - hash: "7fbe20346bc3c28c345e0797b55599f3" - } - Frame { - msec: 3088 - hash: "bcff18ad433bb4f08126ee66efb037d1" - } - Frame { - msec: 3104 - hash: "836666c64f73c38e87de95944ff2fe72" - } - Frame { - msec: 3120 - hash: "4379982d23db239b1741b5d72c53e160" - } - Frame { - msec: 3136 - hash: "0ed9476337214e1493c1510b8a4c90f8" - } - Frame { - msec: 3152 - hash: "dab637406577a1924c7dbb30680e1af3" - } - Frame { - msec: 3168 - hash: "dcc79277fdb8966e5a3f2ed1b2fc4292" - } - Frame { - msec: 3184 - hash: "5f207d1dfad4907f200d76104881bf56" - } - Frame { - msec: 3200 - hash: "3434fc7f81e859722585dae97c557864" - } - Frame { - msec: 3216 - hash: "7c775b9be8c5293d4962324574267c22" - } - Frame { - msec: 3232 - hash: "da0ff6955c2e4cd86421bdb9053f56e6" - } - Frame { - msec: 3248 - hash: "a1297d525a3ad41abbbb7c2f15efd4fb" - } - Frame { - msec: 3264 - hash: "5326b220995b2a1eaa308ad10fd353fa" - } - Frame { - msec: 3280 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3296 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3312 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3328 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3344 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Key { - type: 6 - key: 16777249 - modifiers: 67108864 - text: "" - autorep: false - count: 1 - } - Frame { - msec: 3360 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3376 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3392 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3408 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3424 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3440 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3456 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3472 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3488 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3504 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3520 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3536 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3552 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3568 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3584 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3600 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3616 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 3632 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } -} diff --git a/tests/auto/declarative/qmlvisual/animation/propertyAction/propertyAction-visual.qml b/tests/auto/declarative/qmlvisual/animation/propertyAction/propertyAction-visual.qml new file mode 100644 index 0000000..5651b87 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/propertyAction/propertyAction-visual.qml @@ -0,0 +1,41 @@ +import Qt 4.6 + +/* +This test starts with a red rectangle at 0,0. It should animate a color change to blue, +then jump 50 pixels right, and then animate moving 50 pixels down. Afer this it should +do an exact visual reversal (animate up 50 pixels, jump left 50 pixels, and then animate +a change back to red). +*/ + +Rectangle { + width: 400; height: 400 + Rectangle { + id: myRect + width: 100; height: 100 + color: "red" + } + MouseArea { + id: clickable + anchors.fill: parent + } + + states: State { + name: "state1" + when: clickable.pressed + PropertyChanges { + target: myRect + x: 50; y: 50 + color: "blue" + } + } + + transitions: Transition { + to: "state1" + reversible: true + SequentialAnimation { + ColorAnimation {} + PropertyAction { properties: "x" } + NumberAnimation { properties: "y"; easing.type: "InOutQuad" } + } + } +} diff --git a/tests/auto/declarative/qmlvisual/animation/propertyAction/propertyAction.qml b/tests/auto/declarative/qmlvisual/animation/propertyAction/propertyAction.qml deleted file mode 100644 index e18e770..0000000 --- a/tests/auto/declarative/qmlvisual/animation/propertyAction/propertyAction.qml +++ /dev/null @@ -1,34 +0,0 @@ -import Qt 4.6 - -Rectangle { - width: 400; height: 400 - Rectangle { - id: myRect - width: 100; height: 100 - color: "red" - } - MouseArea { - id: clickable - anchors.fill: parent - } - - states: State { - name: "state1" - when: clickable.pressed - PropertyChanges { - target: myRect - x: 50; y: 50 - color: "blue" - } - } - - transitions: Transition { - to: "state1" - reversible: true - SequentialAnimation { - ColorAnimation {} - PropertyAction { properties: "x" } - NumberAnimation { properties: "y"; easing.type: "InOutQuad" } - } - } -} diff --git a/tests/auto/declarative/qmlvisual/animation/scriptAction/data/scriptAction-visual.qml b/tests/auto/declarative/qmlvisual/animation/scriptAction/data/scriptAction-visual.qml new file mode 100644 index 0000000..01da490 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/scriptAction/data/scriptAction-visual.qml @@ -0,0 +1,535 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 32 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 48 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 64 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 80 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 96 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 112 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 128 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 144 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 160 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 176 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 192 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 208 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 224 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 240 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 256 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 272 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 288 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 304 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 320 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 336 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 352 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 368 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 384 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 400 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 416 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 432 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 448 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 464 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 480 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 496 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 512 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 528 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 544 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 560 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 576 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 592 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 608 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 624 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 640 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 656 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 672 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 688 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 704 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 720 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 736 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 752 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 768 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 784 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 800 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 816 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 832 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 848 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 864 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 880 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 896 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 912 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 928 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 944 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 960 + image: "scriptAction.0.png" + } + Frame { + msec: 976 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 992 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1008 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1024 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1040 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1056 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1072 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1088 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 146; y: 259 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1104 + hash: "55b713dcb7c810bf126e06cc97d26d24" + } + Frame { + msec: 1120 + hash: "9850cd8ed4643900409d1a87ef0bc4cf" + } + Frame { + msec: 1136 + hash: "1cf03396b01e931e4e7e8e7e57e19c5f" + } + Frame { + msec: 1152 + hash: "25fe648b85ec2d82621853dcbdbf695a" + } + Frame { + msec: 1168 + hash: "1ca701e56fe387d5849f6933eb53aee9" + } + Frame { + msec: 1184 + hash: "b39ecb792659a053a8985e2a849d6d51" + } + Frame { + msec: 1200 + hash: "9a783432a054beec81cc5687f75a36dc" + } + Frame { + msec: 1216 + hash: "edbd222d7ba6c6f819ded45fe316d461" + } + Frame { + msec: 1232 + hash: "eaf20159c4b90f90872bbd514d3a0cec" + } + Frame { + msec: 1248 + hash: "964807dd9b91e765577a773ef1ce2593" + } + Frame { + msec: 1264 + hash: "16e12026ab14657b0f36b8315684455d" + } + Frame { + msec: 1280 + hash: "d001a6b2fec3c66baaa45d9ff93b3f63" + } + Frame { + msec: 1296 + hash: "fef11eb5f635bc11cd9679b7213b3b92" + } + Frame { + msec: 1312 + hash: "0a0cd5f5004048d88712cfe6943470c0" + } + Frame { + msec: 1328 + hash: "0d83178afdae5feaa9915d56c24373ad" + } + Frame { + msec: 1344 + hash: "0a9e6e0b7b23ce93dc4e1f886cf9c7d1" + } + Frame { + msec: 1360 + hash: "f3199d0c860f1236e0b9472bef8785bc" + } + Frame { + msec: 1376 + hash: "f3199d0c860f1236e0b9472bef8785bc" + } + Frame { + msec: 1392 + hash: "32ccdab249268b01d9f1658a736052f1" + } + Frame { + msec: 1408 + hash: "dc98f32a1a2d6e74998123b5232107b0" + } + Frame { + msec: 1424 + hash: "db3010ef552146df938c237f6c92bff5" + } + Frame { + msec: 1440 + hash: "101e8595d0301e88376ec52ba9361f84" + } + Frame { + msec: 1456 + hash: "119d548c59baa7e47266d2ceca663288" + } + Frame { + msec: 1472 + hash: "f141fafe102a0b9a2bf33e8c3fc800ff" + } + Frame { + msec: 1488 + hash: "b01f9ca8d4fbff17b3d48c70898a044d" + } + Frame { + msec: 1504 + hash: "cf67954a2d1b22e8d2cfdc26419bafb8" + } + Frame { + msec: 1520 + hash: "7680b2b5a63dea13d733947297e01355" + } + Frame { + msec: 1536 + hash: "af1c017acf6b3c8cff86c9ceb60db3cb" + } + Frame { + msec: 1552 + hash: "0b23ec51f71fddae5e2238ab5754f1db" + } + Frame { + msec: 1568 + hash: "976643961ecbdc86335180ba812b874e" + } + Frame { + msec: 1584 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1600 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1616 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1632 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1648 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1664 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1680 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1696 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1712 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1728 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1744 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1760 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1776 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1792 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1808 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1824 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1840 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1856 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1872 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Key { + type: 6 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 1888 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1904 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1920 + image: "scriptAction.1.png" + } + Frame { + msec: 1936 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1952 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1968 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 1984 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2000 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2016 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2032 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } + Frame { + msec: 2048 + hash: "aeed60899abb6c486a5b1df81f9a0224" + } +} diff --git a/tests/auto/declarative/qmlvisual/animation/scriptAction/data/scriptAction.qml b/tests/auto/declarative/qmlvisual/animation/scriptAction/data/scriptAction.qml deleted file mode 100644 index 01da490..0000000 --- a/tests/auto/declarative/qmlvisual/animation/scriptAction/data/scriptAction.qml +++ /dev/null @@ -1,535 +0,0 @@ -import Qt.VisualTest 4.6 - -VisualTest { - Frame { - msec: 0 - } - Frame { - msec: 16 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 32 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 48 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 64 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 80 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 96 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 112 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 128 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 144 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 160 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 176 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 192 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 208 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 224 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 240 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 256 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 272 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 288 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 304 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 320 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 336 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 352 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 368 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 384 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 400 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 416 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 432 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 448 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 464 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 480 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 496 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 512 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 528 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 544 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 560 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 576 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 592 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 608 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 624 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 640 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 656 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 672 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 688 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 704 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 720 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 736 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 752 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 768 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 784 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 800 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 816 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 832 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 848 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 864 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 880 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 896 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 912 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 928 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 944 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 960 - image: "scriptAction.0.png" - } - Frame { - msec: 976 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 992 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1008 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1024 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1040 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1056 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1072 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1088 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Mouse { - type: 2 - button: 1 - buttons: 1 - x: 146; y: 259 - modifiers: 0 - sendToViewport: true - } - Frame { - msec: 1104 - hash: "55b713dcb7c810bf126e06cc97d26d24" - } - Frame { - msec: 1120 - hash: "9850cd8ed4643900409d1a87ef0bc4cf" - } - Frame { - msec: 1136 - hash: "1cf03396b01e931e4e7e8e7e57e19c5f" - } - Frame { - msec: 1152 - hash: "25fe648b85ec2d82621853dcbdbf695a" - } - Frame { - msec: 1168 - hash: "1ca701e56fe387d5849f6933eb53aee9" - } - Frame { - msec: 1184 - hash: "b39ecb792659a053a8985e2a849d6d51" - } - Frame { - msec: 1200 - hash: "9a783432a054beec81cc5687f75a36dc" - } - Frame { - msec: 1216 - hash: "edbd222d7ba6c6f819ded45fe316d461" - } - Frame { - msec: 1232 - hash: "eaf20159c4b90f90872bbd514d3a0cec" - } - Frame { - msec: 1248 - hash: "964807dd9b91e765577a773ef1ce2593" - } - Frame { - msec: 1264 - hash: "16e12026ab14657b0f36b8315684455d" - } - Frame { - msec: 1280 - hash: "d001a6b2fec3c66baaa45d9ff93b3f63" - } - Frame { - msec: 1296 - hash: "fef11eb5f635bc11cd9679b7213b3b92" - } - Frame { - msec: 1312 - hash: "0a0cd5f5004048d88712cfe6943470c0" - } - Frame { - msec: 1328 - hash: "0d83178afdae5feaa9915d56c24373ad" - } - Frame { - msec: 1344 - hash: "0a9e6e0b7b23ce93dc4e1f886cf9c7d1" - } - Frame { - msec: 1360 - hash: "f3199d0c860f1236e0b9472bef8785bc" - } - Frame { - msec: 1376 - hash: "f3199d0c860f1236e0b9472bef8785bc" - } - Frame { - msec: 1392 - hash: "32ccdab249268b01d9f1658a736052f1" - } - Frame { - msec: 1408 - hash: "dc98f32a1a2d6e74998123b5232107b0" - } - Frame { - msec: 1424 - hash: "db3010ef552146df938c237f6c92bff5" - } - Frame { - msec: 1440 - hash: "101e8595d0301e88376ec52ba9361f84" - } - Frame { - msec: 1456 - hash: "119d548c59baa7e47266d2ceca663288" - } - Frame { - msec: 1472 - hash: "f141fafe102a0b9a2bf33e8c3fc800ff" - } - Frame { - msec: 1488 - hash: "b01f9ca8d4fbff17b3d48c70898a044d" - } - Frame { - msec: 1504 - hash: "cf67954a2d1b22e8d2cfdc26419bafb8" - } - Frame { - msec: 1520 - hash: "7680b2b5a63dea13d733947297e01355" - } - Frame { - msec: 1536 - hash: "af1c017acf6b3c8cff86c9ceb60db3cb" - } - Frame { - msec: 1552 - hash: "0b23ec51f71fddae5e2238ab5754f1db" - } - Frame { - msec: 1568 - hash: "976643961ecbdc86335180ba812b874e" - } - Frame { - msec: 1584 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1600 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1616 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1632 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1648 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1664 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1680 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1696 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1712 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1728 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1744 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1760 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1776 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1792 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1808 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1824 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1840 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1856 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1872 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Key { - type: 6 - key: 16777249 - modifiers: 67108864 - text: "" - autorep: false - count: 1 - } - Frame { - msec: 1888 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1904 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1920 - image: "scriptAction.1.png" - } - Frame { - msec: 1936 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1952 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1968 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 1984 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2000 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2016 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2032 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } - Frame { - msec: 2048 - hash: "aeed60899abb6c486a5b1df81f9a0224" - } -} diff --git a/tests/auto/declarative/qmlvisual/animation/scriptAction/scriptAction-visual.qml b/tests/auto/declarative/qmlvisual/animation/scriptAction/scriptAction-visual.qml new file mode 100644 index 0000000..dc2fcee --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/scriptAction/scriptAction-visual.qml @@ -0,0 +1,40 @@ +import Qt 4.6 + +/* +This test starts with a red rectangle at 0,0. It should animate moving 50 pixels right, +then immediately change blue, and then animate moving 50 pixels down. +*/ + +Rectangle { + width: 400; height: 400 + Rectangle { + id: myRect + width: 100; height: 100 + color: "red" + } + MouseArea { + id: clickable + anchors.fill: parent + } + + states: State { + name: "state1" + when: clickable.pressed + PropertyChanges { + target: myRect + x: 50; y: 50 + } + StateChangeScript { + name: "setColor" + script: myRect.color = "blue" + } + } + + transitions: Transition { + SequentialAnimation { + NumberAnimation { properties: "x"; easing.type: "InOutQuad" } + ScriptAction { scriptName: "setColor" } + NumberAnimation { properties: "y"; easing.type: "InOutQuad" } + } + } +} diff --git a/tests/auto/declarative/qmlvisual/animation/scriptAction/scriptAction.qml b/tests/auto/declarative/qmlvisual/animation/scriptAction/scriptAction.qml deleted file mode 100644 index fc9ccc8..0000000 --- a/tests/auto/declarative/qmlvisual/animation/scriptAction/scriptAction.qml +++ /dev/null @@ -1,35 +0,0 @@ -import Qt 4.6 - -Rectangle { - width: 400; height: 400 - Rectangle { - id: myRect - width: 100; height: 100 - color: "red" - } - MouseArea { - id: clickable - anchors.fill: parent - } - - states: State { - name: "state1" - when: clickable.pressed - PropertyChanges { - target: myRect - x: 50; y: 50 - } - StateChangeScript { - name: "setColor" - script: myRect.color = "blue" - } - } - - transitions: Transition { - SequentialAnimation { - NumberAnimation { properties: "x"; easing.type: "InOutQuad" } - ScriptAction { scriptName: "setColor" } - NumberAnimation { properties: "y"; easing.type: "InOutQuad" } - } - } -} diff --git a/tests/auto/declarative/qmlvisual/fillmode/fillmode.qml b/tests/auto/declarative/qmlvisual/fillmode/fillmode.qml index 8450bf2..7c3b486 100644 --- a/tests/auto/declarative/qmlvisual/fillmode/fillmode.qml +++ b/tests/auto/declarative/qmlvisual/fillmode/fillmode.qml @@ -1,5 +1,10 @@ import Qt 4.6 +/* + This is a static display test of the various Image fill modes. See the png file in the data + subdirectory to see what the image should look like. +*/ + Rectangle { id: screen; width: 750; height: 600; color: "gray" property string source: "face.png" diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp index 91f8486..05c2ebd 100644 --- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp +++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp @@ -101,11 +101,19 @@ void tst_qmlvisual::visual_data() files << findQmlFiles(QDir(QT_TEST_SOURCE_DIR)); else { //these are tests we think are stable and useful enough to be run by the CI system - files << QT_TEST_SOURCE_DIR "/qdeclarativemousearea/mousearea-visual.qml"; - files << QT_TEST_SOURCE_DIR "/qdeclarativemousearea/drag.qml"; - files << QT_TEST_SOURCE_DIR "/animation/pauseAnimation/pauseAnimation-visual.qml"; + files << QT_TEST_SOURCE_DIR "/animation/bindinganimation/bindinganimation.qml"; + files << QT_TEST_SOURCE_DIR "/animation/colorAnimation/colorAnimation-visual.qml"; + files << QT_TEST_SOURCE_DIR "/animation/easing/easing.qml"; + files << QT_TEST_SOURCE_DIR "/animation/loop/loop.qml"; + files << QT_TEST_SOURCE_DIR "/animation/parallelAnimation/parallelAnimation-visual.qml"; files << QT_TEST_SOURCE_DIR "/animation/parentAnimation/parentAnimation-visual.qml"; + files << QT_TEST_SOURCE_DIR "/animation/pauseAnimation/pauseAnimation-visual.qml"; + files << QT_TEST_SOURCE_DIR "/animation/propertyAction/propertyAction-visual.qml"; files << QT_TEST_SOURCE_DIR "/animation/reanchor/reanchor.qml"; + files << QT_TEST_SOURCE_DIR "/animation/scriptAction/scriptAction-visual.qml"; + files << QT_TEST_SOURCE_DIR "/qdeclarativemousearea/mousearea-visual.qml"; + files << QT_TEST_SOURCE_DIR "/qdeclarativemousearea/drag.qml"; + files << QT_TEST_SOURCE_DIR "/fillmode/fillmode.qml"; } foreach (const QString &file, files) { -- cgit v0.12 From 7f1eac149d76f33770f54b20fe7cd27a4e4b09d4 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 7 Apr 2010 16:11:44 +1000 Subject: Build on Windows. --- src/declarative/qml/qdeclarativevme.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index 0117880..2d1a549 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -246,7 +246,12 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, { QObject *o = (QObject *)operator new(instr.createSimple.typeSize + sizeof(QDeclarativeDeclarativeData)); - ::bzero(o, instr.createSimple.typeSize + sizeof(QDeclarativeDeclarativeData)); +#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) + ::memset(o, 0, instr.createSimple.typeSize + sizeof(QDeclarativeDeclarativeData)); +#else + // faster than memset + ::bzero(o, instr.createSimple.typeSize + sizeof(QDeclarativeDeclarativeData)); +#endif instr.createSimple.create(o); QDeclarativeDeclarativeData *ddata = -- cgit v0.12 From 2c40b2faac1d9bd941310c0c0e1e0d0fa0033ab5 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 8 Apr 2010 09:48:43 +1000 Subject: Update Repeater docs. --- .../graphicsitems/qdeclarativerepeater.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index e836788..95f6276 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -62,10 +62,10 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() /*! \qmlclass Repeater QDeclarativeRepeater - \since 4.7 + \since 4.7 \inherits Item - \brief The Repeater item allows you to repeat a component based on a model. + \brief The Repeater item allows you to repeat an Item-based component using a model. The Repeater item is used when you want to create a large number of similar items. For each entry in the model, an item is instantiated @@ -102,15 +102,24 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() The repeater instance continues to own all items it instantiates, even if they are otherwise manipulated. It is illegal to manually remove an item created by the Repeater. + + \note Repeater is Item-based, and cannot be used to repeat non-Item-derived objects. + For example, it cannot be used to repeat QtObjects. + \badcode + Item { + //XXX illegal. Can't repeat QtObject as it doesn't derive from Item. + Repeater { + model: 10 + QtObject {} + } + } + \endcode */ /*! \internal \class QDeclarativeRepeater \qmlclass Repeater - - XXX Repeater is very conservative in how it instatiates/deletes items. Also - new model entries will not be created and old ones will not be removed. */ /*! -- cgit v0.12 From 962c1e995992d72a1b947d46fb14ae006582bc6e Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 10:12:31 +1000 Subject: needs focus --- examples/declarative/gestures/experimental-gestures.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/declarative/gestures/experimental-gestures.qml b/examples/declarative/gestures/experimental-gestures.qml index 914d403..5f904aa 100644 --- a/examples/declarative/gestures/experimental-gestures.qml +++ b/examples/declarative/gestures/experimental-gestures.qml @@ -8,6 +8,7 @@ Rectangle { GestureArea { anchors.fill: parent + focus: true // Only some of the many gesture properties are shown. See Gesture documentation. -- cgit v0.12 From 9d9161446bfad883c298d54a122e822c5e273a9c Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 10:21:46 +1000 Subject: Support QList properties We already supported returning QList from methods, but there wasn't really much that could be done with the return value. This closes the loop on QList support by allowing them to be properties, and used as models. --- src/declarative/qml/qdeclarativebinding.cpp | 24 +++++-- src/declarative/qml/qdeclarativeengine.cpp | 34 +++++++--- src/declarative/qml/qdeclarativeengine_p.h | 2 +- src/declarative/qml/qdeclarativeexpression.cpp | 66 +++++++------------ src/declarative/qml/qdeclarativeexpression_p.h | 4 +- .../qml/qdeclarativeobjectscriptclass.cpp | 22 +++---- src/declarative/qml/qdeclarativeproperty.cpp | 15 +++++ src/declarative/util/qdeclarativelistaccessor.cpp | 6 ++ src/declarative/util/qdeclarativelistaccessor_p.h | 2 +- .../data/qlistOfQObjects.1.qml | 16 +++++ .../data/qlistOfQObjects.2.qml | 17 +++++ .../data/qlistOfQObjects.3.qml | 21 ++++++ .../data/qlistOfQObjects.4.qml | 22 +++++++ .../data/qlistOfQObjects.5.qml | 35 ++++++++++ .../declarative/qdeclarativeecmascript/testtypes.h | 6 ++ .../tst_qdeclarativeecmascript.cpp | 75 ++++++++++++++++++++++ 16 files changed, 297 insertions(+), 70 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.1.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.2.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.3.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.4.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.5.qml diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 71cf3cb..bed1956 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -148,8 +148,26 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) idx, a); } else { + QDeclarativeEnginePrivate *ep = (data->context() && data->context()->engine)? + QDeclarativeEnginePrivate::get(data->context()->engine):0; + bool isUndefined = false; - QVariant value = this->value(&isUndefined); + QVariant value; + + if (data->property.propertyTypeCategory() == QDeclarativeProperty::List) { + QScriptValue scriptValue = d->scriptValue(0, &isUndefined); + value = ep->scriptValueToVariant(scriptValue, qMetaTypeId >()); + } else { + QScriptValue scriptValue = d->scriptValue(0, &isUndefined); + value = ep->scriptValueToVariant(scriptValue); + if (value.userType() == QMetaType::QObjectStar && !qvariant_cast(value)) { + // If the object is null, we extract the predicted type. While this isn't + // 100% reliable, in many cases it gives us better error messages if we + // assign this null-object to an incompatible property + int type = ep->objectClass->objectType(scriptValue); + value = QVariant(type, (void *)0); + } + } if (isUndefined && !data->error.isValid() && data->property.isResettable()) { @@ -187,9 +205,7 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) } if (data->error.isValid()) { - QDeclarativeEnginePrivate *p = (data->context() && data->context()->engine)? - QDeclarativeEnginePrivate::get(data->context()->engine):0; - if (!data->addError(p)) + if (!data->addError(ep)) qWarning().nospace() << qPrintable(this->error().toString()); } else { data->removeError(); diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index e8b6913..3c66efb 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1324,7 +1324,6 @@ QScriptValue QDeclarativeEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine return qScriptValueFromValue(engine, qVariantFromValue(finalColor)); } - QScriptValue QDeclarativeEnginePrivate::scriptValueFromVariant(const QVariant &val) { if (val.userType() == qMetaTypeId()) { @@ -1335,6 +1334,14 @@ QScriptValue QDeclarativeEnginePrivate::scriptValueFromVariant(const QVariant &v } else { return scriptEngine.nullValue(); } + } else if (val.userType() == qMetaTypeId >()) { + const QList &list = *(QList*)val.constData(); + QScriptValue rv = scriptEngine.newArray(list.count()); + for (int ii = 0; ii < list.count(); ++ii) { + QObject *object = list.at(ii); + rv.setProperty(ii, objectClass->newQObject(object)); + } + return rv; } bool objOk; @@ -1346,22 +1353,31 @@ QScriptValue QDeclarativeEnginePrivate::scriptValueFromVariant(const QVariant &v } } -QVariant QDeclarativeEnginePrivate::scriptValueToVariant(const QScriptValue &val) +QVariant QDeclarativeEnginePrivate::scriptValueToVariant(const QScriptValue &val, int hint) { QScriptDeclarativeClass *dc = QScriptDeclarativeClass::scriptClass(val); if (dc == objectClass) return QVariant::fromValue(objectClass->toQObject(val)); + else if (dc == valueTypeClass) + return valueTypeClass->toVariant(val); else if (dc == contextClass) return QVariant(); - QScriptDeclarativeClass *sc = QScriptDeclarativeClass::scriptClass(val); - if (!sc) { - return val.toVariant(); - } else if (sc == valueTypeClass) { - return valueTypeClass->toVariant(val); - } else { - return QVariant(); + // Convert to a QList if val is an array and we were explicitly hinted, or + // if the first element is a QObject* + if ((hint == qMetaTypeId >() && val.isArray()) || + (val.isArray() && QScriptDeclarativeClass::scriptClass(val.property(0)) == objectClass)) { + QList list; + int length = val.property(QLatin1String("length")).toInt32(); + for (int ii = 0; ii < length; ++ii) { + QScriptValue arrayItem = val.property(ii); + QObject *d = arrayItem.toQObject(); + list << d; + } + return QVariant::fromValue(list); } + + return val.toVariant(); } // XXX this beyonds in QUrl::toLocalFile() diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 45089d0..3f22d61 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -308,7 +308,7 @@ public: QHash m_sharedScriptImports; QScriptValue scriptValueFromVariant(const QVariant &); - QVariant scriptValueToVariant(const QScriptValue &); + QVariant scriptValueToVariant(const QScriptValue &, int hint = QVariant::Invalid); void sendQuit (); diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp index a250f21..e0aee52 100644 --- a/src/declarative/qml/qdeclarativeexpression.cpp +++ b/src/declarative/qml/qdeclarativeexpression.cpp @@ -351,7 +351,7 @@ void QDeclarativeExpressionPrivate::exceptionToError(QScriptEngine *scriptEngine } } -QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUndefined) +QScriptValue QDeclarativeExpressionPrivate::eval(QObject *secondaryScope, bool *isUndefined) { QDeclarativeExpressionData *data = this->data; QDeclarativeEngine *engine = data->context()->engine; @@ -376,7 +376,7 @@ QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bo const QString code = rewriteBinding(data->expression, &ok); if (!ok) { scriptEngine->popContext(); - return QVariant(); + return QScriptValue(); } data->expressionFunction = scriptEngine->evaluate(code, data->url, data->line); } @@ -413,54 +413,20 @@ QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bo if (scriptEngine->hasUncaughtException()) { exceptionToError(scriptEngine, data->error); scriptEngine->clearExceptions(); - return QVariant(); + return QScriptValue(); } else { data->error = QDeclarativeError(); + return svalue; } - - QVariant rv; - - if (svalue.isArray()) { - int length = svalue.property(QLatin1String("length")).toInt32(); - if (length && svalue.property(0).isObject()) { - QList list; - for (int ii = 0; ii < length; ++ii) { - QScriptValue arrayItem = svalue.property(ii); - QObject *d = arrayItem.toQObject(); - list << d; - } - rv = QVariant::fromValue(list); - } - } else if (svalue.isObject() && - ep->objectClass->scriptClass(svalue) == ep->objectClass) { - QObject *o = svalue.toQObject(); - int type = QMetaType::QObjectStar; - // If the object is null, we extract the predicted type. While this isn't - // 100% reliable, in many cases it gives us better error messages if we - // assign this null-object to an incompatible property - if (!o) type = ep->objectClass->objectType(svalue); - - return QVariant(type, &o); - } - - if (rv.isNull()) - rv = svalue.toVariant(); - - return rv; } -QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isUndefined) +QScriptValue QDeclarativeExpressionPrivate::scriptValue(QObject *secondaryScope, bool *isUndefined) { Q_Q(QDeclarativeExpression); - - QVariant rv; - if (!q->engine()) { - qWarning("QDeclarativeExpression: Attempted to evaluate an expression in an invalid context"); - return rv; - } + Q_ASSERT(q->engine()); if (data->expression.isEmpty()) - return rv; + return QScriptValue(); QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(q->engine()); @@ -476,7 +442,7 @@ QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isU QDeclarativeExpressionData *localData = data; localData->addref(); - rv = evalQtScript(secondaryScope, isUndefined); + QScriptValue value = eval(secondaryScope, isUndefined); ep->currentExpression = lastCurrentExpression; ep->captureProperties = lastCaptureProperties; @@ -494,7 +460,21 @@ QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isU lastCapturedProperties.copyAndClear(ep->capturedProperties); - return rv; + return value; +} + +QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isUndefined) +{ + Q_Q(QDeclarativeExpression); + + if (!q->engine()) { + qWarning("QDeclarativeExpression: Attempted to evaluate an expression in an invalid context"); + return QVariant(); + } + + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(q->engine()); + + return ep->scriptValueToVariant(scriptValue(secondaryScope, isUndefined)); } /*! diff --git a/src/declarative/qml/qdeclarativeexpression_p.h b/src/declarative/qml/qdeclarativeexpression_p.h index 9a90fb6..1a0e4dd 100644 --- a/src/declarative/qml/qdeclarativeexpression_p.h +++ b/src/declarative/qml/qdeclarativeexpression_p.h @@ -150,7 +150,9 @@ public: QDeclarativeExpressionData *data; QVariant value(QObject *secondaryScope = 0, bool *isUndefined = 0); - QVariant evalQtScript(QObject *secondaryScope, bool *isUndefined = 0); + QScriptValue scriptValue(QObject *secondaryScope = 0, bool *isUndefined = 0); + + QScriptValue eval(QObject *secondaryScope, bool *isUndefined = 0); void updateGuards(const QPODVector &properties); void clearGuards(); diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 10b9fab..0e230e8 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -222,15 +222,10 @@ QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name) if (lastData->flags & QDeclarativePropertyCache::Data::IsVMEFunction) { return Value(scriptEngine, ((QDeclarativeVMEMetaObject *)(obj->metaObject()))->vmeMethod(lastData->coreIndex)); } else { -#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE) // Uncomment to use QtScript method call logic // QScriptValue sobj = scriptEngine->newQObject(obj); // return Value(scriptEngine, sobj.property(toString(name))); return Value(scriptEngine, methods.newMethod(obj, lastData)); -#else - QScriptValue sobj = scriptEngine->newQObject(obj); - return Value(scriptEngine, sobj.property(toString(name))); -#endif } } else { if (enginePriv->captureProperties && !(lastData->flags & QDeclarativePropertyCache::Data::IsConstant)) { @@ -295,7 +290,6 @@ QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name) QVariant var = obj->metaObject()->property(lastData->coreIndex).read(obj); return Value(scriptEngine, enginePriv->scriptValueFromVariant(var)); } - } } @@ -456,8 +450,6 @@ bool QDeclarativeObjectScriptClass::compare(Object *o1, Object *o2) return d1 == d2 || d1->object == d2->object; } -#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE) - struct MethodData : public QScriptDeclarativeClass::Object { MethodData(QObject *o, const QDeclarativePropertyCache::Data &d) : object(o), data(d) {} @@ -687,7 +679,17 @@ void MetaCallArgument::fromScriptValue(int callType, QDeclarativeEngine *engine, new (&data) QVariant(QDeclarativeEnginePrivate::get(engine)->scriptValueToVariant(value)); type = callType; } else if (callType == qMetaTypeId >()) { - new (&data) QList(); // We don't support passing in QList + QList *list = new (&data) QList(); + if (value.isArray()) { + int length = value.property(QLatin1String("length")).toInt32(); + for (int ii = 0; ii < length; ++ii) { + QScriptValue arrayItem = value.property(ii); + QObject *d = arrayItem.toQObject(); + list->append(d); + } + } else if (QObject *d = value.toQObject()) { + list->append(d); + } type = callType; } else { new (&data) QVariant(); @@ -800,7 +802,5 @@ QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass:: return Value(); } -#endif - QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index affb6b9..d33f29e 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -1045,6 +1045,21 @@ bool QDeclarativePropertyPrivate::write(QObject *object, const QDeclarativePrope prop.append(&prop, (void *)o); } + } else if (propertyType == qMetaTypeId >()) { + + QList list; + + if (value.userType() == qMetaTypeId >()) { + list = qvariant_cast >(value); + } else { + QObject *o = enginePriv?enginePriv->toQObject(value):QDeclarativeMetaType::toQObject(value); + if (o) + list.append(o); + } + + void *args[] = { &list, 0, &status, &flags }; + QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, args); + } else { Q_ASSERT(variantType != propertyType); diff --git a/src/declarative/util/qdeclarativelistaccessor.cpp b/src/declarative/util/qdeclarativelistaccessor.cpp index 4ac587f..f91b2fb 100644 --- a/src/declarative/util/qdeclarativelistaccessor.cpp +++ b/src/declarative/util/qdeclarativelistaccessor.cpp @@ -84,6 +84,8 @@ void QDeclarativeListAccessor::setList(const QVariant &v, QDeclarativeEngine *en QObject *data = enginePrivate?enginePrivate->toQObject(v):QDeclarativeMetaType::toQObject(v); d = QVariant::fromValue(data); m_type = Instance; + } else if (d.userType() == qMetaTypeId >()) { + m_type = ObjectList; } else if (d.userType() == qMetaTypeId()) { m_type = ListProperty; } else { @@ -98,6 +100,8 @@ int QDeclarativeListAccessor::count() const return qvariant_cast(d).count(); case VariantList: return qvariant_cast(d).count(); + case ObjectList: + return qvariant_cast >(d).count(); case ListProperty: return ((QDeclarativeListReference *)d.constData())->count(); case Instance: @@ -118,6 +122,8 @@ QVariant QDeclarativeListAccessor::at(int idx) const return QVariant::fromValue(qvariant_cast(d).at(idx)); case VariantList: return qvariant_cast(d).at(idx); + case ObjectList: + return QVariant::fromValue(qvariant_cast >(d).at(idx)); case ListProperty: return QVariant::fromValue(((QDeclarativeListReference *)d.constData())->at(idx)); case Instance: diff --git a/src/declarative/util/qdeclarativelistaccessor_p.h b/src/declarative/util/qdeclarativelistaccessor_p.h index d8bb8af..10d944a 100644 --- a/src/declarative/util/qdeclarativelistaccessor_p.h +++ b/src/declarative/util/qdeclarativelistaccessor_p.h @@ -65,7 +65,7 @@ public: int count() const; QVariant at(int) const; - enum Type { Invalid, StringList, VariantList, ListProperty, Instance, Integer }; + enum Type { Invalid, StringList, VariantList, ObjectList, ListProperty, Instance, Integer }; Type type() const { return m_type; } private: diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.1.qml new file mode 100644 index 0000000..9c289be --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.1.qml @@ -0,0 +1,16 @@ +import Qt.test 1.0 +import Qt 4.6 + +MyQmlObject { + id: root + + property bool test1 + property bool test2 + + qlistProperty: root + + Component.onCompleted: { + test1 = (qlistProperty.length == 1) + test2 = (qlistProperty[0] == root) + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.2.qml new file mode 100644 index 0000000..8041f5c --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.2.qml @@ -0,0 +1,17 @@ +import Qt.test 1.0 +import Qt 4.6 + +MyQmlObject { + id: root + + property bool test1 + property bool test2 + + Component.onCompleted: { + qlistProperty = root + + test1 = (qlistProperty.length == 1) + test2 = (qlistProperty[0] == root) + } +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.3.qml new file mode 100644 index 0000000..df44e48 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.3.qml @@ -0,0 +1,21 @@ +import Qt.test 1.0 +import Qt 4.6 + +MyQmlObject { + id: root + + property bool test1 + property bool test2 + property bool test3 + property bool test4 + + objectProperty: QtObject { id: obj } + qlistProperty: [ root, obj ] + + Component.onCompleted: { + test1 = (qlistProperty.length == 2) + test2 = (qlistProperty[0] == root) + test3 = (qlistProperty[1] == obj) + test4 = (qlistProperty[2] == null) + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.4.qml new file mode 100644 index 0000000..33c3576 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.4.qml @@ -0,0 +1,22 @@ +import Qt.test 1.0 +import Qt 4.6 + +MyQmlObject { + id: root + + property bool test1 + property bool test2 + property bool test3 + property bool test4 + + objectProperty: QtObject { id: obj } + + Component.onCompleted: { + qlistProperty = [ root, obj ] + + test1 = (qlistProperty.length == 2) + test2 = (qlistProperty[0] == root) + test3 = (qlistProperty[1] == obj) + test4 = (qlistProperty[2] == null) + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.5.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.5.qml new file mode 100644 index 0000000..3fd497c --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.5.qml @@ -0,0 +1,35 @@ +import Qt.test 1.0 +import Qt 4.6 + +MyQmlObject { + id: root + + property bool test1 + property bool test2 + property bool test3 + property bool test4 + property bool test5 + property bool test6 + property bool test7 + property bool test8 + + objectProperty: QtObject { id: obj } + + Component.onCompleted: { + qlistProperty = [ root, obj ] + + test1 = (qlistProperty.length == 2) + test2 = (qlistProperty[0] == root) + test3 = (qlistProperty[1] == obj) + test4 = (qlistProperty[2] == null) + + var a = qlistProperty; + a.reverse(); + qlistProperty = a + + test5 = (qlistProperty.length == 2) + test7 = (qlistProperty[0] == obj) + test6 = (qlistProperty[1] == root) + test8 = (qlistProperty[2] == null) + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index faad8b7..d8ec452 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -91,6 +91,7 @@ class MyQmlObject : public QObject Q_PROPERTY(QDeclarativeListProperty objectListProperty READ objectListProperty CONSTANT) Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty) Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp) + Q_PROPERTY(QList qlistProperty READ qlistProperty WRITE setQListProperty) public: MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13) {} @@ -142,6 +143,9 @@ public: QRegExp regExp() { return m_regExp; } void setRegExp(const QRegExp ®Exp) { m_regExp = regExp; } + QList qlistProperty() const { return m_objectQList2; } + void setQListProperty(const QList &v) { m_objectQList2 = v; } + signals: void basicSignal(); void argumentSignal(int a, QString b, qreal c); @@ -167,6 +171,8 @@ private: int m_value; int m_resetProperty; QRegExp m_regExp; + + QList m_objectQList2; }; QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES) diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 77dd4b8..a2625da 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -130,6 +130,7 @@ private slots: void qlistqobjectMethods(); void strictlyEquals(); void compiled(); + void qlistOfQObjects(); void bug1(); void dynamicCreationCrash(); @@ -2065,6 +2066,80 @@ void tst_qdeclarativeecmascript::compiled() delete object; } +// Test manipulating QList properties +void tst_qdeclarativeecmascript::qlistOfQObjects() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("qlistOfQObjects.1.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toBool(), true); + QCOMPARE(object->property("test2").toBool(), true); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("qlistOfQObjects.2.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toBool(), true); + QCOMPARE(object->property("test2").toBool(), true); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("qlistOfQObjects.3.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toBool(), true); + QCOMPARE(object->property("test2").toBool(), true); + QCOMPARE(object->property("test3").toBool(), true); + QCOMPARE(object->property("test4").toBool(), true); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("qlistOfQObjects.4.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toBool(), true); + QCOMPARE(object->property("test2").toBool(), true); + QCOMPARE(object->property("test3").toBool(), true); + QCOMPARE(object->property("test4").toBool(), true); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("qlistOfQObjects.5.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toBool(), true); + QCOMPARE(object->property("test2").toBool(), true); + QCOMPARE(object->property("test3").toBool(), true); + QCOMPARE(object->property("test4").toBool(), true); + QCOMPARE(object->property("test5").toBool(), true); + QCOMPARE(object->property("test6").toBool(), true); + QCOMPARE(object->property("test7").toBool(), true); + QCOMPARE(object->property("test8").toBool(), true); + + delete object; + } +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" -- cgit v0.12 From fac110fd9313972f001bf8b52b0254cc2d67ef66 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 8 Apr 2010 10:49:46 +1000 Subject: Fix setting of pointSize and pixelSize in different items. Also ensure warning is issued regardless of the order both pointSize and pixelSize are set in the same item. Task-number: QTBUG-9665 --- src/declarative/qml/qdeclarativevaluetype.cpp | 18 +++++++++++----- src/declarative/qml/qdeclarativevaluetype_p.h | 3 ++- .../qdeclarativevaluetypes/data/font_write.4.qml | 7 +++++++ .../qdeclarativevaluetypes/data/font_write.5.qml | 14 +++++++++++++ .../tst_qdeclarativevaluetypes.cpp | 24 ++++++++++++++++++++++ 5 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativevaluetypes/data/font_write.4.qml create mode 100644 tests/auto/declarative/qdeclarativevaluetypes/data/font_write.5.qml diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp index 839e0dd..49e7b79 100644 --- a/src/declarative/qml/qdeclarativevaluetype.cpp +++ b/src/declarative/qml/qdeclarativevaluetype.cpp @@ -619,7 +619,7 @@ void QDeclarativeEasingValueType::setPeriod(qreal period) } QDeclarativeFontValueType::QDeclarativeFontValueType(QObject *parent) -: QDeclarativeValueType(parent), hasPixelSize(false) +: QDeclarativeValueType(parent), pixelSizeSet(false), pointSizeSet(false) { } @@ -627,6 +627,8 @@ void QDeclarativeFontValueType::read(QObject *obj, int idx) { void *a[] = { &font, 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); + pixelSizeSet = false; + pointSizeSet = false; } void QDeclarativeFontValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags) @@ -724,13 +726,17 @@ qreal QDeclarativeFontValueType::pointSize() const void QDeclarativeFontValueType::setPointSize(qreal size) { - if (hasPixelSize) { + if (pixelSizeSet) { qWarning() << "Both point size and pixel size set. Using pixel size."; return; } - if (size >= 0.0) + if (size >= 0.0) { + pointSizeSet = true; font.setPointSizeF(size); + } else { + pointSizeSet = false; + } } int QDeclarativeFontValueType::pixelSize() const @@ -741,10 +747,12 @@ int QDeclarativeFontValueType::pixelSize() const void QDeclarativeFontValueType::setPixelSize(int size) { if (size >=0) { + if (pointSizeSet) + qWarning() << "Both point size and pixel size set. Using pixel size."; font.setPixelSize(size); - hasPixelSize = true; + pixelSizeSet = true; } else { - hasPixelSize = false; + pixelSizeSet = false; } } diff --git a/src/declarative/qml/qdeclarativevaluetype_p.h b/src/declarative/qml/qdeclarativevaluetype_p.h index 1fe8bd2..763177d 100644 --- a/src/declarative/qml/qdeclarativevaluetype_p.h +++ b/src/declarative/qml/qdeclarativevaluetype_p.h @@ -399,7 +399,8 @@ public: private: QFont font; - bool hasPixelSize; + bool pixelSizeSet; + bool pointSizeSet; }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.4.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.4.qml new file mode 100644 index 0000000..2ec69d7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.4.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + font.pointSize: 19 + font.pixelSize: 10 +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.5.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.5.qml new file mode 100644 index 0000000..4c12f21 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.5.qml @@ -0,0 +1,14 @@ +import Qt 4.6 +import Test 1.0 + +Item { + MyTypeObject { + objectName: "object1" + font.pixelSize: 19 + } + MyTypeObject { + objectName: "object2" + font.pointSize: 14 + } +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index 4e254eb..fb487f0 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -352,6 +352,30 @@ void tst_qdeclarativevaluetypes::font() delete object; } + { + QDeclarativeComponent component(&engine, TEST_FILE("font_write.4.qml")); + QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. "); + MyTypeObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->font().pixelSize(), 10); + + delete object; + } + { + QDeclarativeComponent component(&engine, TEST_FILE("font_write.5.qml")); + QObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + MyTypeObject *object1 = object->findChild("object1"); + QVERIFY(object1 != 0); + MyTypeObject *object2 = object->findChild("object2"); + QVERIFY(object2 != 0); + + QCOMPARE(object1->font().pixelSize(), 19); + QCOMPARE(object2->font().pointSize(), 14); + + delete object; + } } // Test bindings can write to value types -- cgit v0.12 From 2f163cda817a3318c293e9a9b9e66fb20f4c990c Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 11:12:16 +1000 Subject: Test actual error messages. Fix error messages. Test module-not-available error. --- .../qml/qdeclarativecompositetypemanager.cpp | 6 +- .../tst_qdeclarativelanguage.cpp | 186 ++++++++++++++------- 2 files changed, 133 insertions(+), 59 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp index 55723ea..61978a4 100644 --- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp +++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp @@ -633,10 +633,12 @@ int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData // - type with unknown namespace (UnknownNamespace.SomeType {}) QDeclarativeError error; error.setUrl(unit->imports.baseUrl()); + QString userTypeName = QString::fromUtf8(typeName); + userTypeName.replace('/','.'); if (typeNamespace) - error.setDescription(tr("Namespace %1 cannot be used as a type").arg(QString::fromUtf8(typeName))); + error.setDescription(tr("Namespace %1 cannot be used as a type").arg(userTypeName)); else - error.setDescription(tr("%1 is not a type").arg(QString::fromUtf8(typeName))); + error.setDescription(tr("%1 is not a type").arg(userTypeName)); if (!parserRef->refObjects.isEmpty()) { QDeclarativeParser::Object *obj = parserRef->refObjects.first(); error.setLine(obj->location.start.line); diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 722e161..8990fb4 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -136,7 +136,7 @@ private slots: private: QDeclarativeEngine engine; - void testType(const QString& qml, const QString& type); + void testType(const QString& qml, const QString& type, const QString& error); }; #define VERIFY_ERRORS(errorfile) \ @@ -1069,7 +1069,7 @@ void tst_qdeclarativelanguage::declaredPropertyValues() } // Check that first child of qml is of given type. Empty type insists on error. -void tst_qdeclarativelanguage::testType(const QString& qml, const QString& type) +void tst_qdeclarativelanguage::testType(const QString& qml, const QString& type, const QString& expectederror) { QDeclarativeComponent component(&engine); component.setData(qml.toUtf8(), TEST_FILE("empty.qml")); // just a file for relative local imports @@ -1078,6 +1078,13 @@ void tst_qdeclarativelanguage::testType(const QString& qml, const QString& type) if (type.isEmpty()) { QVERIFY(component.isError()); + QString actualerror; + foreach (const QDeclarativeError e, component.errors()) { + if (!actualerror.isEmpty()) + actualerror.append("; "); + actualerror.append(e.description()); + } + QCOMPARE(actualerror,expectederror); } else { VERIFY_ERRORS(0); QObject *object = component.create(); @@ -1097,156 +1104,199 @@ void tst_qdeclarativelanguage::importsBuiltin_data() QTest::addColumn("qml"); QTest::addColumn("type"); + QTest::addColumn("error"); // import built-ins QTest::newRow("missing import") << "Test {}" - << ""; + << "" + << "Test is not a type"; QTest::newRow("not in version 0.0") << "import com.nokia.Test 0.0\n" "Test {}" - << ""; + << "" + << "Test is not a type"; + QTest::newRow("version not installed") + << "import com.nokia.Test 99.0\n" + "Test {}" + << "" + << "module \"com.nokia.Test\" version 99.0 is not installed"; QTest::newRow("in version 0.0") << "import com.nokia.Test 0.0\n" "TestTP {}" - << "TestType"; + << "TestType" + << ""; QTest::newRow("qualified in version 0.0") << "import com.nokia.Test 0.0 as T\n" "T.TestTP {}" - << "TestType"; + << "TestType" + << ""; QTest::newRow("in version 1.0") << "import com.nokia.Test 1.0\n" "Test {}" - << "TestType"; + << "TestType" + << ""; QTest::newRow("qualified wrong") << "import com.nokia.Test 1.0 as T\n" // QT-610 "Test {}" - << ""; + << "" + << "Test is not a type"; QTest::newRow("qualified right") << "import com.nokia.Test 1.0 as T\n" "T.Test {}" - << "TestType"; + << "TestType" + << ""; QTest::newRow("qualified right but not in version 0.0") << "import com.nokia.Test 0.0 as T\n" "T.Test {}" - << ""; + << "" + << "T.Test is not a type"; QTest::newRow("in version 1.1") << "import com.nokia.Test 1.1\n" "Test {}" - << "TestType"; + << "TestType" + << ""; QTest::newRow("in version 1.3") << "import com.nokia.Test 1.3\n" "Test {}" - << "TestType"; + << "TestType" + << ""; QTest::newRow("in version 1.5") << "import com.nokia.Test 1.5\n" "Test {}" - << "TestType"; + << "TestType" + << ""; QTest::newRow("changed in version 1.8") << "import com.nokia.Test 1.8\n" "Test {}" - << "TestType2"; + << "TestType2" + << ""; QTest::newRow("in version 1.12") << "import com.nokia.Test 1.12\n" "Test {}" - << "TestType2"; + << "TestType2" + << ""; QTest::newRow("old in version 1.9") << "import com.nokia.Test 1.9\n" "OldTest {}" - << "TestType"; + << "TestType" + << ""; QTest::newRow("old in version 1.11") << "import com.nokia.Test 1.11\n" "OldTest {}" - << "TestType"; + << "TestType" + << ""; QTest::newRow("multiversion 1") << "import com.nokia.Test 1.11\n" "import com.nokia.Test 1.12\n" "Test {}" - << "TestType2"; + << "TestType2" + << ""; QTest::newRow("multiversion 2") << "import com.nokia.Test 1.11\n" "import com.nokia.Test 1.12\n" "OldTest {}" - << "TestType"; + << "TestType" + << ""; QTest::newRow("qualified multiversion 3") << "import com.nokia.Test 1.0 as T0\n" "import com.nokia.Test 1.8 as T8\n" "T0.Test {}" - << "TestType"; + << "TestType" + << ""; QTest::newRow("qualified multiversion 4") << "import com.nokia.Test 1.0 as T0\n" "import com.nokia.Test 1.8 as T8\n" "T8.Test {}" - << "TestType2"; + << "TestType2" + << ""; } void tst_qdeclarativelanguage::importsBuiltin() { QFETCH(QString, qml); QFETCH(QString, type); - testType(qml,type); + QFETCH(QString, error); + testType(qml,type,error); } void tst_qdeclarativelanguage::importsLocal_data() { QTest::addColumn("qml"); QTest::addColumn("type"); + QTest::addColumn("error"); // import locals QTest::newRow("local import") << "import \"subdir\"\n" // QT-613 "Test {}" - << "QDeclarativeRectangle"; + << "QDeclarativeRectangle" + << ""; QTest::newRow("local import second") << "import Qt 4.6\nimport \"subdir\"\n" "Test {}" - << "QDeclarativeRectangle"; + << "QDeclarativeRectangle" + << ""; QTest::newRow("local import subsubdir") << "import Qt 4.6\nimport \"subdir/subsubdir\"\n" "SubTest {}" - << "QDeclarativeRectangle"; + << "QDeclarativeRectangle" + << ""; QTest::newRow("local import QTBUG-7721 A") << "subdir.Test {}" // no longer allowed (QTBUG-7721) - << ""; + << "" + << "subdir.Test is not a type"; QTest::newRow("local import QTBUG-7721 B") << "import \"subdir\" as X\n" "X.subsubdir.SubTest {}" // no longer allowed (QTBUG-7721) - << ""; + << "" + << "X.subsubdir.SubTest is not a type"; QTest::newRow("local import as") << "import \"subdir\" as T\n" "T.Test {}" - << "QDeclarativeRectangle"; + << "QDeclarativeRectangle" + << ""; QTest::newRow("wrong local import as") << "import \"subdir\" as T\n" "Test {}" - << ""; + << "" + << "Test is not a type"; QTest::newRow("library precedence over local import") << "import \"subdir\"\n" "import com.nokia.Test 1.0\n" "Test {}" - << "TestType"; + << "TestType" + << ""; } void tst_qdeclarativelanguage::importsLocal() { QFETCH(QString, qml); QFETCH(QString, type); - testType(qml,type); + QFETCH(QString, error); + testType(qml,type,error); } void tst_qdeclarativelanguage::importsRemote_data() { QTest::addColumn("qml"); QTest::addColumn("type"); + QTest::addColumn("error"); QString serverdir = "http://127.0.0.1:14445/qtest/declarative/qmllanguage"; - QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QDeclarativeRectangle"; - QTest::newRow("remote import with subdir") << "import \""+serverdir+"\"\nTestSubDir {}" << "QDeclarativeText"; - QTest::newRow("remote import with local") << "import \""+serverdir+"\"\nTestLocal {}" << "QDeclarativeImage"; - QTest::newRow("wrong remote import with undeclared local") << "import \""+serverdir+"\"\nWrongTestLocal {}" << ""; - QTest::newRow("wrong remote import of internal local") << "import \""+serverdir+"\"\nLocalInternal {}" << ""; - QTest::newRow("wrong remote import of undeclared local") << "import \""+serverdir+"\"\nUndeclaredLocal {}" << ""; + QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QDeclarativeRectangle" + << ""; + QTest::newRow("remote import with subdir") << "import \""+serverdir+"\"\nTestSubDir {}" << "QDeclarativeText" + << ""; + QTest::newRow("remote import with local") << "import \""+serverdir+"\"\nTestLocal {}" << "QDeclarativeImage" + << ""; + QTest::newRow("wrong remote import with undeclared local") << "import \""+serverdir+"\"\nWrongTestLocal {}" << "" + << "WrongTestLocal is not a type"; + QTest::newRow("wrong remote import of internal local") << "import \""+serverdir+"\"\nLocalInternal {}" << "" + << "LocalInternal is not a type"; + QTest::newRow("wrong remote import of undeclared local") << "import \""+serverdir+"\"\nUndeclaredLocal {}" << "" + << "UndeclaredLocal is not a type"; } #include "testhttpserver.h" @@ -1255,11 +1305,12 @@ void tst_qdeclarativelanguage::importsRemote() { QFETCH(QString, qml); QFETCH(QString, type); + QFETCH(QString, error); TestHTTPServer server(14445); server.serveDirectory(SRCDIR); - testType(qml,type); + testType(qml,type,error); } void tst_qdeclarativelanguage::importsInstalled_data() @@ -1268,43 +1319,52 @@ void tst_qdeclarativelanguage::importsInstalled_data() QTest::addColumn("qml"); QTest::addColumn("type"); + QTest::addColumn("error"); // import installed QTest::newRow("installed import 0") << "import com.nokia.installedtest 0.0\n" "InstalledTestTP {}" - << "QDeclarativeRectangle"; + << "QDeclarativeRectangle" + << ""; QTest::newRow("installed import 0 as TP") << "import com.nokia.installedtest 0.0 as TP\n" "TP.InstalledTestTP {}" - << "QDeclarativeRectangle"; + << "QDeclarativeRectangle" + << ""; QTest::newRow("installed import 1") << "import com.nokia.installedtest 1.0\n" "InstalledTest {}" - << "QDeclarativeRectangle"; + << "QDeclarativeRectangle" + << ""; QTest::newRow("installed import 2") << "import com.nokia.installedtest 1.3\n" "InstalledTest {}" - << "QDeclarativeRectangle"; + << "QDeclarativeRectangle" + << ""; QTest::newRow("installed import 3") << "import com.nokia.installedtest 1.4\n" "InstalledTest {}" - << "QDeclarativeText"; + << "QDeclarativeText" + << ""; QTest::newRow("installed import 4") << "import com.nokia.installedtest 1.10\n" "InstalledTest {}" - << "QDeclarativeText"; + << "QDeclarativeText" + << ""; QTest::newRow("installed import visibility") // QT-614 << "import com.nokia.installedtest 1.4\n" "PrivateType {}" - << ""; + << "" + << "PrivateType is not a type"; } void tst_qdeclarativelanguage::importsInstalled() { QFETCH(QString, qml); QFETCH(QString, type); - testType(qml,type); + QFETCH(QString, error); + testType(qml,type,error); } @@ -1312,65 +1372,77 @@ void tst_qdeclarativelanguage::importsOrder_data() { QTest::addColumn("qml"); QTest::addColumn("type"); + QTest::addColumn("error"); QTest::newRow("installed import overrides 1") << "import com.nokia.installedtest 1.0\n" "import com.nokia.installedtest 1.4\n" "InstalledTest {}" - << "QDeclarativeText"; + << "QDeclarativeText" + << ""; QTest::newRow("installed import overrides 2") << "import com.nokia.installedtest 1.4\n" "import com.nokia.installedtest 1.0\n" "InstalledTest {}" - << "QDeclarativeRectangle"; + << "QDeclarativeRectangle" + << ""; QTest::newRow("installed import re-overrides 1") << "import com.nokia.installedtest 1.4\n" "import com.nokia.installedtest 1.0\n" "import com.nokia.installedtest 1.4\n" "InstalledTest {}" - << "QDeclarativeText"; + << "QDeclarativeText" + << ""; QTest::newRow("installed import re-overrides 2") << "import com.nokia.installedtest 1.4\n" "import com.nokia.installedtest 1.0\n" "import com.nokia.installedtest 1.4\n" "import com.nokia.installedtest 1.0\n" "InstalledTest {}" - << "QDeclarativeRectangle"; + << "QDeclarativeRectangle" + << ""; QTest::newRow("installed import versus builtin 1") << "import com.nokia.installedtest 1.5\n" "import Qt 4.6\n" "Rectangle {}" - << "QDeclarativeRectangle"; + << "QDeclarativeRectangle" + << ""; QTest::newRow("installed import versus builtin 2") << "import Qt 4.6\n" "import com.nokia.installedtest 1.5\n" "Rectangle {}" - << "QDeclarativeText"; + << "QDeclarativeText" + << ""; QTest::newRow("namespaces cannot be overridden by types 1") << "import Qt 4.6 as Rectangle\n" "import com.nokia.installedtest 1.5\n" "Rectangle {}" - << ""; + << "" + << "Namespace Rectangle cannot be used as a type"; QTest::newRow("namespaces cannot be overridden by types 2") << "import Qt 4.6 as Rectangle\n" "import com.nokia.installedtest 1.5\n" "Rectangle.Image {}" - << "QDeclarativeImage"; + << "QDeclarativeImage" + << ""; QTest::newRow("local last 1") << "LocalLast {}" - << "QDeclarativeText"; + << "QDeclarativeText" + << ""; QTest::newRow("local last 2") << "import com.nokia.installedtest 1.0\n" "LocalLast {}" - << "QDeclarativeRectangle"; // i.e. from com.nokia.installedtest, not data/LocalLast.qml + << "QDeclarativeRectangle" + << ""; // i.e. from com.nokia.installedtest, not data/LocalLast.qml } void tst_qdeclarativelanguage::importsOrder() { QFETCH(QString, qml); QFETCH(QString, type); - testType(qml,type); + QFETCH(QString, error); + testType(qml,type,error); } void tst_qdeclarativelanguage::qmlAttachedPropertiesObjectMethod() -- cgit v0.12 From 80cd83d3b09b2271d183a51d2e6453924c535dce Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 8 Apr 2010 11:13:33 +1000 Subject: Document behavior of conflicting when clauses. Task-number: QTBUG-9371 --- src/declarative/util/qdeclarativestate.cpp | 18 +++++++++++++---- .../qdeclarativestates/data/whenOrdering.qml | 11 +++++++++++ .../qdeclarativestates/tst_qdeclarativestates.cpp | 23 ++++++++++++++++++++++ 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativestates/data/whenOrdering.qml diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index 5e6c35e..e4c968e 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -121,14 +121,13 @@ QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObje /*! \qmlclass State QDeclarativeState - \since 4.7 + \since 4.7 \brief The State element defines configurations of objects and properties. A state is specified as a set of batched changes from the default configuration. - Note that setting the state of an object from within another state of the same object is - inadvisible. Not only would this have the same effect as going directly to the second state - it may cause the program to crash. + \note setting the state of an object from within another state of the same object is + not allowed. \sa {qmlstates}{States}, {state-transitions}{Transitions} */ @@ -191,6 +190,17 @@ bool QDeclarativeState::isWhenKnown() const This should be set to an expression that evaluates to true when you want the state to be applied. + + If multiple states in a group have \c when clauses that evaluate to true at the same time, + the first matching state will be applied. For example, in the following snippet + \c state1 will always be selected rather than \c state2 when sharedCondition becomes + \c true. + \qml + states: [ + State { name: "state1"; when: sharedCondition }, + State { name: "state2"; when: sharedCondition } + ] + \endqml */ QDeclarativeBinding *QDeclarativeState::when() const { diff --git a/tests/auto/declarative/qdeclarativestates/data/whenOrdering.qml b/tests/auto/declarative/qdeclarativestates/data/whenOrdering.qml new file mode 100644 index 0000000..7369c63 --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/whenOrdering.qml @@ -0,0 +1,11 @@ +import Qt 4.6 + +Rectangle { + property bool condition1: false + property bool condition2: false + + states: [ + State { name: "state1"; when: condition1 }, + State { name: "state2"; when: condition2 } + ] +} diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index e7c595a..f0b6759 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -108,6 +108,7 @@ private slots: void nonExistantProperty(); void reset(); void illegalObjectCreation(); + void whenOrdering(); }; void tst_qdeclarativestates::initTestCase() @@ -993,6 +994,28 @@ void tst_qdeclarativestates::illegalObjectCreation() QCOMPARE(error.description().toUtf8().constData(), "PropertyChanges does not support creating state-specific objects."); } +void tst_qdeclarativestates::whenOrdering() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/whenOrdering.qml"); + QDeclarativeRectangle *rect = qobject_cast(c.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->state(), QLatin1String("")); + rect->setProperty("condition2", true); + QCOMPARE(rect->state(), QLatin1String("state2")); + rect->setProperty("condition1", true); + QCOMPARE(rect->state(), QLatin1String("state1")); + rect->setProperty("condition2", false); + QCOMPARE(rect->state(), QLatin1String("state1")); + rect->setProperty("condition2", true); + QCOMPARE(rect->state(), QLatin1String("state1")); + rect->setProperty("condition1", false); + rect->setProperty("condition2", false); + QCOMPARE(rect->state(), QLatin1String("")); +} + QTEST_MAIN(tst_qdeclarativestates) #include "tst_qdeclarativestates.moc" -- cgit v0.12 From 198377b456c494272e9a73a872478c5d5ae94af4 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 8 Apr 2010 11:16:49 +1000 Subject: Don't emit clicked() after pressAndHold() Task-number: QTBUG-9676 --- .../graphicsitems/qdeclarativemousearea.cpp | 2 +- .../qdeclarativemousearea/data/clickandhold.qml | 13 +++++++++ .../tst_qdeclarativemousearea.cpp | 31 ++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativemousearea/data/clickandhold.qml diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index c95bd29..a6cc75e 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -651,7 +651,7 @@ bool QDeclarativeMouseArea::setPressed(bool p) emit positionChanged(&me); } else { emit released(&me); - if (isclick) + if (isclick && !d->longPress) emit clicked(&me); } diff --git a/tests/auto/declarative/qdeclarativemousearea/data/clickandhold.qml b/tests/auto/declarative/qdeclarativemousearea/data/clickandhold.qml new file mode 100644 index 0000000..e800f98 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemousearea/data/clickandhold.qml @@ -0,0 +1,13 @@ +import Qt 4.6 + +Item { + id: root + property bool clicked: false + property bool held: false + + MouseArea { + width: 200; height: 200 + onClicked: { root.clicked = true } + onPressAndHold: { root.held = true } + } +} diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp index dfe46e4..bdb8eca 100644 --- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp +++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp @@ -53,6 +53,7 @@ private slots: void dragProperties(); void resetDrag(); void updateMouseAreaPosOnClick(); + void noOnClickedWithPressAndHold(); private: QDeclarativeView *createView(); }; @@ -202,6 +203,36 @@ void tst_QDeclarativeMouseArea::updateMouseAreaPosOnClick() delete canvas; } +void tst_QDeclarativeMouseArea::noOnClickedWithPressAndHold() +{ + QDeclarativeView *canvas = createView(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/clickandhold.qml")); + canvas->show(); + canvas->setFocus(); + QVERIFY(canvas->rootObject() != 0); + + QGraphicsScene *scene = canvas->scene(); + QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress); + pressEvent.setScenePos(QPointF(100, 100)); + pressEvent.setButton(Qt::LeftButton); + pressEvent.setButtons(Qt::LeftButton); + QApplication::sendEvent(scene, &pressEvent); + + QVERIFY(!canvas->rootObject()->property("clicked").toBool()); + QVERIFY(!canvas->rootObject()->property("held").toBool()); + + QTest::qWait(1000); + + QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMousePress); + releaseEvent.setScenePos(QPointF(100, 100)); + releaseEvent.setButton(Qt::LeftButton); + releaseEvent.setButtons(Qt::LeftButton); + QApplication::sendEvent(scene, &releaseEvent); + + QVERIFY(!canvas->rootObject()->property("clicked").toBool()); + QVERIFY(canvas->rootObject()->property("held").toBool()); +} + QTEST_MAIN(tst_QDeclarativeMouseArea) #include "tst_qdeclarativemousearea.moc" -- cgit v0.12 From e74bd7d0b1a2ed47f41fba47caa542ca5b29880e Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 11:19:35 +1000 Subject: Revert "Support QList properties" This reverts commit 9d9161446bfad883c298d54a122e822c5e273a9c. This was a bad idea. It complicates the "property var" are not really JavaScript var problem. Some of the patch is valid, and it will be applied separately. --- src/declarative/qml/qdeclarativebinding.cpp | 24 ++----- src/declarative/qml/qdeclarativeengine.cpp | 34 +++------- src/declarative/qml/qdeclarativeengine_p.h | 2 +- src/declarative/qml/qdeclarativeexpression.cpp | 66 ++++++++++++------- src/declarative/qml/qdeclarativeexpression_p.h | 4 +- .../qml/qdeclarativeobjectscriptclass.cpp | 22 +++---- src/declarative/qml/qdeclarativeproperty.cpp | 15 ----- src/declarative/util/qdeclarativelistaccessor.cpp | 6 -- src/declarative/util/qdeclarativelistaccessor_p.h | 2 +- .../data/qlistOfQObjects.1.qml | 16 ----- .../data/qlistOfQObjects.2.qml | 17 ----- .../data/qlistOfQObjects.3.qml | 21 ------ .../data/qlistOfQObjects.4.qml | 22 ------- .../data/qlistOfQObjects.5.qml | 35 ---------- .../declarative/qdeclarativeecmascript/testtypes.h | 6 -- .../tst_qdeclarativeecmascript.cpp | 75 ---------------------- 16 files changed, 70 insertions(+), 297 deletions(-) delete mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.1.qml delete mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.2.qml delete mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.3.qml delete mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.4.qml delete mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.5.qml diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index bed1956..71cf3cb 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -148,26 +148,8 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) idx, a); } else { - QDeclarativeEnginePrivate *ep = (data->context() && data->context()->engine)? - QDeclarativeEnginePrivate::get(data->context()->engine):0; - bool isUndefined = false; - QVariant value; - - if (data->property.propertyTypeCategory() == QDeclarativeProperty::List) { - QScriptValue scriptValue = d->scriptValue(0, &isUndefined); - value = ep->scriptValueToVariant(scriptValue, qMetaTypeId >()); - } else { - QScriptValue scriptValue = d->scriptValue(0, &isUndefined); - value = ep->scriptValueToVariant(scriptValue); - if (value.userType() == QMetaType::QObjectStar && !qvariant_cast(value)) { - // If the object is null, we extract the predicted type. While this isn't - // 100% reliable, in many cases it gives us better error messages if we - // assign this null-object to an incompatible property - int type = ep->objectClass->objectType(scriptValue); - value = QVariant(type, (void *)0); - } - } + QVariant value = this->value(&isUndefined); if (isUndefined && !data->error.isValid() && data->property.isResettable()) { @@ -205,7 +187,9 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) } if (data->error.isValid()) { - if (!data->addError(ep)) + QDeclarativeEnginePrivate *p = (data->context() && data->context()->engine)? + QDeclarativeEnginePrivate::get(data->context()->engine):0; + if (!data->addError(p)) qWarning().nospace() << qPrintable(this->error().toString()); } else { data->removeError(); diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 3c66efb..e8b6913 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1324,6 +1324,7 @@ QScriptValue QDeclarativeEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine return qScriptValueFromValue(engine, qVariantFromValue(finalColor)); } + QScriptValue QDeclarativeEnginePrivate::scriptValueFromVariant(const QVariant &val) { if (val.userType() == qMetaTypeId()) { @@ -1334,14 +1335,6 @@ QScriptValue QDeclarativeEnginePrivate::scriptValueFromVariant(const QVariant &v } else { return scriptEngine.nullValue(); } - } else if (val.userType() == qMetaTypeId >()) { - const QList &list = *(QList*)val.constData(); - QScriptValue rv = scriptEngine.newArray(list.count()); - for (int ii = 0; ii < list.count(); ++ii) { - QObject *object = list.at(ii); - rv.setProperty(ii, objectClass->newQObject(object)); - } - return rv; } bool objOk; @@ -1353,31 +1346,22 @@ QScriptValue QDeclarativeEnginePrivate::scriptValueFromVariant(const QVariant &v } } -QVariant QDeclarativeEnginePrivate::scriptValueToVariant(const QScriptValue &val, int hint) +QVariant QDeclarativeEnginePrivate::scriptValueToVariant(const QScriptValue &val) { QScriptDeclarativeClass *dc = QScriptDeclarativeClass::scriptClass(val); if (dc == objectClass) return QVariant::fromValue(objectClass->toQObject(val)); - else if (dc == valueTypeClass) - return valueTypeClass->toVariant(val); else if (dc == contextClass) return QVariant(); - // Convert to a QList if val is an array and we were explicitly hinted, or - // if the first element is a QObject* - if ((hint == qMetaTypeId >() && val.isArray()) || - (val.isArray() && QScriptDeclarativeClass::scriptClass(val.property(0)) == objectClass)) { - QList list; - int length = val.property(QLatin1String("length")).toInt32(); - for (int ii = 0; ii < length; ++ii) { - QScriptValue arrayItem = val.property(ii); - QObject *d = arrayItem.toQObject(); - list << d; - } - return QVariant::fromValue(list); + QScriptDeclarativeClass *sc = QScriptDeclarativeClass::scriptClass(val); + if (!sc) { + return val.toVariant(); + } else if (sc == valueTypeClass) { + return valueTypeClass->toVariant(val); + } else { + return QVariant(); } - - return val.toVariant(); } // XXX this beyonds in QUrl::toLocalFile() diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 3f22d61..45089d0 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -308,7 +308,7 @@ public: QHash m_sharedScriptImports; QScriptValue scriptValueFromVariant(const QVariant &); - QVariant scriptValueToVariant(const QScriptValue &, int hint = QVariant::Invalid); + QVariant scriptValueToVariant(const QScriptValue &); void sendQuit (); diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp index e0aee52..a250f21 100644 --- a/src/declarative/qml/qdeclarativeexpression.cpp +++ b/src/declarative/qml/qdeclarativeexpression.cpp @@ -351,7 +351,7 @@ void QDeclarativeExpressionPrivate::exceptionToError(QScriptEngine *scriptEngine } } -QScriptValue QDeclarativeExpressionPrivate::eval(QObject *secondaryScope, bool *isUndefined) +QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUndefined) { QDeclarativeExpressionData *data = this->data; QDeclarativeEngine *engine = data->context()->engine; @@ -376,7 +376,7 @@ QScriptValue QDeclarativeExpressionPrivate::eval(QObject *secondaryScope, bool * const QString code = rewriteBinding(data->expression, &ok); if (!ok) { scriptEngine->popContext(); - return QScriptValue(); + return QVariant(); } data->expressionFunction = scriptEngine->evaluate(code, data->url, data->line); } @@ -413,20 +413,54 @@ QScriptValue QDeclarativeExpressionPrivate::eval(QObject *secondaryScope, bool * if (scriptEngine->hasUncaughtException()) { exceptionToError(scriptEngine, data->error); scriptEngine->clearExceptions(); - return QScriptValue(); + return QVariant(); } else { data->error = QDeclarativeError(); - return svalue; } + + QVariant rv; + + if (svalue.isArray()) { + int length = svalue.property(QLatin1String("length")).toInt32(); + if (length && svalue.property(0).isObject()) { + QList list; + for (int ii = 0; ii < length; ++ii) { + QScriptValue arrayItem = svalue.property(ii); + QObject *d = arrayItem.toQObject(); + list << d; + } + rv = QVariant::fromValue(list); + } + } else if (svalue.isObject() && + ep->objectClass->scriptClass(svalue) == ep->objectClass) { + QObject *o = svalue.toQObject(); + int type = QMetaType::QObjectStar; + // If the object is null, we extract the predicted type. While this isn't + // 100% reliable, in many cases it gives us better error messages if we + // assign this null-object to an incompatible property + if (!o) type = ep->objectClass->objectType(svalue); + + return QVariant(type, &o); + } + + if (rv.isNull()) + rv = svalue.toVariant(); + + return rv; } -QScriptValue QDeclarativeExpressionPrivate::scriptValue(QObject *secondaryScope, bool *isUndefined) +QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isUndefined) { Q_Q(QDeclarativeExpression); - Q_ASSERT(q->engine()); + + QVariant rv; + if (!q->engine()) { + qWarning("QDeclarativeExpression: Attempted to evaluate an expression in an invalid context"); + return rv; + } if (data->expression.isEmpty()) - return QScriptValue(); + return rv; QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(q->engine()); @@ -442,7 +476,7 @@ QScriptValue QDeclarativeExpressionPrivate::scriptValue(QObject *secondaryScope, QDeclarativeExpressionData *localData = data; localData->addref(); - QScriptValue value = eval(secondaryScope, isUndefined); + rv = evalQtScript(secondaryScope, isUndefined); ep->currentExpression = lastCurrentExpression; ep->captureProperties = lastCaptureProperties; @@ -460,21 +494,7 @@ QScriptValue QDeclarativeExpressionPrivate::scriptValue(QObject *secondaryScope, lastCapturedProperties.copyAndClear(ep->capturedProperties); - return value; -} - -QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isUndefined) -{ - Q_Q(QDeclarativeExpression); - - if (!q->engine()) { - qWarning("QDeclarativeExpression: Attempted to evaluate an expression in an invalid context"); - return QVariant(); - } - - QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(q->engine()); - - return ep->scriptValueToVariant(scriptValue(secondaryScope, isUndefined)); + return rv; } /*! diff --git a/src/declarative/qml/qdeclarativeexpression_p.h b/src/declarative/qml/qdeclarativeexpression_p.h index 1a0e4dd..9a90fb6 100644 --- a/src/declarative/qml/qdeclarativeexpression_p.h +++ b/src/declarative/qml/qdeclarativeexpression_p.h @@ -150,9 +150,7 @@ public: QDeclarativeExpressionData *data; QVariant value(QObject *secondaryScope = 0, bool *isUndefined = 0); - QScriptValue scriptValue(QObject *secondaryScope = 0, bool *isUndefined = 0); - - QScriptValue eval(QObject *secondaryScope, bool *isUndefined = 0); + QVariant evalQtScript(QObject *secondaryScope, bool *isUndefined = 0); void updateGuards(const QPODVector &properties); void clearGuards(); diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 0e230e8..10b9fab 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -222,10 +222,15 @@ QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name) if (lastData->flags & QDeclarativePropertyCache::Data::IsVMEFunction) { return Value(scriptEngine, ((QDeclarativeVMEMetaObject *)(obj->metaObject()))->vmeMethod(lastData->coreIndex)); } else { +#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE) // Uncomment to use QtScript method call logic // QScriptValue sobj = scriptEngine->newQObject(obj); // return Value(scriptEngine, sobj.property(toString(name))); return Value(scriptEngine, methods.newMethod(obj, lastData)); +#else + QScriptValue sobj = scriptEngine->newQObject(obj); + return Value(scriptEngine, sobj.property(toString(name))); +#endif } } else { if (enginePriv->captureProperties && !(lastData->flags & QDeclarativePropertyCache::Data::IsConstant)) { @@ -290,6 +295,7 @@ QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name) QVariant var = obj->metaObject()->property(lastData->coreIndex).read(obj); return Value(scriptEngine, enginePriv->scriptValueFromVariant(var)); } + } } @@ -450,6 +456,8 @@ bool QDeclarativeObjectScriptClass::compare(Object *o1, Object *o2) return d1 == d2 || d1->object == d2->object; } +#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE) + struct MethodData : public QScriptDeclarativeClass::Object { MethodData(QObject *o, const QDeclarativePropertyCache::Data &d) : object(o), data(d) {} @@ -679,17 +687,7 @@ void MetaCallArgument::fromScriptValue(int callType, QDeclarativeEngine *engine, new (&data) QVariant(QDeclarativeEnginePrivate::get(engine)->scriptValueToVariant(value)); type = callType; } else if (callType == qMetaTypeId >()) { - QList *list = new (&data) QList(); - if (value.isArray()) { - int length = value.property(QLatin1String("length")).toInt32(); - for (int ii = 0; ii < length; ++ii) { - QScriptValue arrayItem = value.property(ii); - QObject *d = arrayItem.toQObject(); - list->append(d); - } - } else if (QObject *d = value.toQObject()) { - list->append(d); - } + new (&data) QList(); // We don't support passing in QList type = callType; } else { new (&data) QVariant(); @@ -802,5 +800,7 @@ QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass:: return Value(); } +#endif + QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index d33f29e..affb6b9 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -1045,21 +1045,6 @@ bool QDeclarativePropertyPrivate::write(QObject *object, const QDeclarativePrope prop.append(&prop, (void *)o); } - } else if (propertyType == qMetaTypeId >()) { - - QList list; - - if (value.userType() == qMetaTypeId >()) { - list = qvariant_cast >(value); - } else { - QObject *o = enginePriv?enginePriv->toQObject(value):QDeclarativeMetaType::toQObject(value); - if (o) - list.append(o); - } - - void *args[] = { &list, 0, &status, &flags }; - QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, args); - } else { Q_ASSERT(variantType != propertyType); diff --git a/src/declarative/util/qdeclarativelistaccessor.cpp b/src/declarative/util/qdeclarativelistaccessor.cpp index f91b2fb..4ac587f 100644 --- a/src/declarative/util/qdeclarativelistaccessor.cpp +++ b/src/declarative/util/qdeclarativelistaccessor.cpp @@ -84,8 +84,6 @@ void QDeclarativeListAccessor::setList(const QVariant &v, QDeclarativeEngine *en QObject *data = enginePrivate?enginePrivate->toQObject(v):QDeclarativeMetaType::toQObject(v); d = QVariant::fromValue(data); m_type = Instance; - } else if (d.userType() == qMetaTypeId >()) { - m_type = ObjectList; } else if (d.userType() == qMetaTypeId()) { m_type = ListProperty; } else { @@ -100,8 +98,6 @@ int QDeclarativeListAccessor::count() const return qvariant_cast(d).count(); case VariantList: return qvariant_cast(d).count(); - case ObjectList: - return qvariant_cast >(d).count(); case ListProperty: return ((QDeclarativeListReference *)d.constData())->count(); case Instance: @@ -122,8 +118,6 @@ QVariant QDeclarativeListAccessor::at(int idx) const return QVariant::fromValue(qvariant_cast(d).at(idx)); case VariantList: return qvariant_cast(d).at(idx); - case ObjectList: - return QVariant::fromValue(qvariant_cast >(d).at(idx)); case ListProperty: return QVariant::fromValue(((QDeclarativeListReference *)d.constData())->at(idx)); case Instance: diff --git a/src/declarative/util/qdeclarativelistaccessor_p.h b/src/declarative/util/qdeclarativelistaccessor_p.h index 10d944a..d8bb8af 100644 --- a/src/declarative/util/qdeclarativelistaccessor_p.h +++ b/src/declarative/util/qdeclarativelistaccessor_p.h @@ -65,7 +65,7 @@ public: int count() const; QVariant at(int) const; - enum Type { Invalid, StringList, VariantList, ObjectList, ListProperty, Instance, Integer }; + enum Type { Invalid, StringList, VariantList, ListProperty, Instance, Integer }; Type type() const { return m_type; } private: diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.1.qml deleted file mode 100644 index 9c289be..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.1.qml +++ /dev/null @@ -1,16 +0,0 @@ -import Qt.test 1.0 -import Qt 4.6 - -MyQmlObject { - id: root - - property bool test1 - property bool test2 - - qlistProperty: root - - Component.onCompleted: { - test1 = (qlistProperty.length == 1) - test2 = (qlistProperty[0] == root) - } -} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.2.qml deleted file mode 100644 index 8041f5c..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.2.qml +++ /dev/null @@ -1,17 +0,0 @@ -import Qt.test 1.0 -import Qt 4.6 - -MyQmlObject { - id: root - - property bool test1 - property bool test2 - - Component.onCompleted: { - qlistProperty = root - - test1 = (qlistProperty.length == 1) - test2 = (qlistProperty[0] == root) - } -} - diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.3.qml deleted file mode 100644 index df44e48..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.3.qml +++ /dev/null @@ -1,21 +0,0 @@ -import Qt.test 1.0 -import Qt 4.6 - -MyQmlObject { - id: root - - property bool test1 - property bool test2 - property bool test3 - property bool test4 - - objectProperty: QtObject { id: obj } - qlistProperty: [ root, obj ] - - Component.onCompleted: { - test1 = (qlistProperty.length == 2) - test2 = (qlistProperty[0] == root) - test3 = (qlistProperty[1] == obj) - test4 = (qlistProperty[2] == null) - } -} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.4.qml deleted file mode 100644 index 33c3576..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.4.qml +++ /dev/null @@ -1,22 +0,0 @@ -import Qt.test 1.0 -import Qt 4.6 - -MyQmlObject { - id: root - - property bool test1 - property bool test2 - property bool test3 - property bool test4 - - objectProperty: QtObject { id: obj } - - Component.onCompleted: { - qlistProperty = [ root, obj ] - - test1 = (qlistProperty.length == 2) - test2 = (qlistProperty[0] == root) - test3 = (qlistProperty[1] == obj) - test4 = (qlistProperty[2] == null) - } -} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.5.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.5.qml deleted file mode 100644 index 3fd497c..0000000 --- a/tests/auto/declarative/qdeclarativeecmascript/data/qlistOfQObjects.5.qml +++ /dev/null @@ -1,35 +0,0 @@ -import Qt.test 1.0 -import Qt 4.6 - -MyQmlObject { - id: root - - property bool test1 - property bool test2 - property bool test3 - property bool test4 - property bool test5 - property bool test6 - property bool test7 - property bool test8 - - objectProperty: QtObject { id: obj } - - Component.onCompleted: { - qlistProperty = [ root, obj ] - - test1 = (qlistProperty.length == 2) - test2 = (qlistProperty[0] == root) - test3 = (qlistProperty[1] == obj) - test4 = (qlistProperty[2] == null) - - var a = qlistProperty; - a.reverse(); - qlistProperty = a - - test5 = (qlistProperty.length == 2) - test7 = (qlistProperty[0] == obj) - test6 = (qlistProperty[1] == root) - test8 = (qlistProperty[2] == null) - } -} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index d8ec452..faad8b7 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -91,7 +91,6 @@ class MyQmlObject : public QObject Q_PROPERTY(QDeclarativeListProperty objectListProperty READ objectListProperty CONSTANT) Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty) Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp) - Q_PROPERTY(QList qlistProperty READ qlistProperty WRITE setQListProperty) public: MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13) {} @@ -143,9 +142,6 @@ public: QRegExp regExp() { return m_regExp; } void setRegExp(const QRegExp ®Exp) { m_regExp = regExp; } - QList qlistProperty() const { return m_objectQList2; } - void setQListProperty(const QList &v) { m_objectQList2 = v; } - signals: void basicSignal(); void argumentSignal(int a, QString b, qreal c); @@ -171,8 +167,6 @@ private: int m_value; int m_resetProperty; QRegExp m_regExp; - - QList m_objectQList2; }; QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES) diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index a2625da..77dd4b8 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -130,7 +130,6 @@ private slots: void qlistqobjectMethods(); void strictlyEquals(); void compiled(); - void qlistOfQObjects(); void bug1(); void dynamicCreationCrash(); @@ -2066,80 +2065,6 @@ void tst_qdeclarativeecmascript::compiled() delete object; } -// Test manipulating QList properties -void tst_qdeclarativeecmascript::qlistOfQObjects() -{ - { - QDeclarativeComponent component(&engine, TEST_FILE("qlistOfQObjects.1.qml")); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toBool(), true); - QCOMPARE(object->property("test2").toBool(), true); - - delete object; - } - - { - QDeclarativeComponent component(&engine, TEST_FILE("qlistOfQObjects.2.qml")); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toBool(), true); - QCOMPARE(object->property("test2").toBool(), true); - - delete object; - } - - { - QDeclarativeComponent component(&engine, TEST_FILE("qlistOfQObjects.3.qml")); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toBool(), true); - QCOMPARE(object->property("test2").toBool(), true); - QCOMPARE(object->property("test3").toBool(), true); - QCOMPARE(object->property("test4").toBool(), true); - - delete object; - } - - { - QDeclarativeComponent component(&engine, TEST_FILE("qlistOfQObjects.4.qml")); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toBool(), true); - QCOMPARE(object->property("test2").toBool(), true); - QCOMPARE(object->property("test3").toBool(), true); - QCOMPARE(object->property("test4").toBool(), true); - - delete object; - } - - { - QDeclarativeComponent component(&engine, TEST_FILE("qlistOfQObjects.5.qml")); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toBool(), true); - QCOMPARE(object->property("test2").toBool(), true); - QCOMPARE(object->property("test3").toBool(), true); - QCOMPARE(object->property("test4").toBool(), true); - QCOMPARE(object->property("test5").toBool(), true); - QCOMPARE(object->property("test6").toBool(), true); - QCOMPARE(object->property("test7").toBool(), true); - QCOMPARE(object->property("test8").toBool(), true); - - delete object; - } -} - QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" -- cgit v0.12 From cb22daf607a99bf01a8e3263599f0dd8ee018707 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 8 Apr 2010 11:38:47 +1000 Subject: Remove flickr-desktop --- demos/declarative/flickr/common/ImageDetails.qml | 160 ------------------ demos/declarative/flickr/common/MediaButton.qml | 41 ----- demos/declarative/flickr/common/MediaLineEdit.qml | 104 ------------ demos/declarative/flickr/flickr-90.qml | 11 ++ demos/declarative/flickr/flickr-desktop.qml | 194 ---------------------- demos/declarative/flickr/flickr-mobile-90.qml | 11 -- demos/declarative/flickr/flickr-mobile.qml | 82 --------- demos/declarative/flickr/flickr.qml | 82 +++++++++ 8 files changed, 93 insertions(+), 592 deletions(-) delete mode 100644 demos/declarative/flickr/common/ImageDetails.qml delete mode 100644 demos/declarative/flickr/common/MediaButton.qml delete mode 100644 demos/declarative/flickr/common/MediaLineEdit.qml create mode 100644 demos/declarative/flickr/flickr-90.qml delete mode 100644 demos/declarative/flickr/flickr-desktop.qml delete mode 100644 demos/declarative/flickr/flickr-mobile-90.qml delete mode 100644 demos/declarative/flickr/flickr-mobile.qml create mode 100644 demos/declarative/flickr/flickr.qml diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml deleted file mode 100644 index 862eeb1..0000000 --- a/demos/declarative/flickr/common/ImageDetails.qml +++ /dev/null @@ -1,160 +0,0 @@ -import Qt 4.6 -import org.webkit 1.0 - -Flipable { - id: container - - property var frontContainer: containerFront - property string photoTitle: "" - property string photoDescription: "" - property string photoTags: "" - property int photoWidth - property int photoHeight - property string photoType - property string photoAuthor - property string photoDate - property string photoUrl - property int rating: 2 - property var prevScale: 1.0 - - signal closed - - transform: Rotation { - id: detailsRotation - origin.y: container.height / 2; - origin.x: container.width / 2; - axis.y: 1; axis.z: 0 - } - - front: Item { - id: containerFront; anchors.fill: container - - Rectangle { - anchors.fill: parent - color: "black"; opacity: 0.4 - border.color: "white"; border.width: 2 - } - - MediaButton { - id: backButton; x: 630; y: 370; text: "Back" - onClicked: { container.closed() } - } - - MediaButton { - id: moreButton; x: 530; y: 370; text: "View..." - onClicked: { container.state='Back' } - } - - Text { id: titleText; style: Text.Raised; styleColor: "black"; color: "white"; elide: Text.ElideRight - x: 220; y: 30; width: parent.width - 240; text: container.photoTitle; font.pointSize: 22 } - - LikeOMeter { x: 40; y: 250; rating: container.rating } - - Flickable { id: flickable; x: 220; width: 480; height: 210; y: 130; clip: true - contentWidth: 480; contentHeight: descriptionText.height - - WebView { id: descriptionText; width: parent.width - html: "" + container.photoDescription } - } - - Text { id: size; color: "white"; width: 300; x: 40; y: 300 - text: "Size: " + container.photoWidth + 'x' + container.photoHeight } - Text { id: type; color: "white"; width: 300; x: 40; anchors.top: size.bottom - text: "Type: " + container.photoType } - - Text { id: author; color: "white"; width: 300; x: 220; y: 80 - text: "Author: " + container.photoAuthor } - Text { id: date; color: "white"; width: 300; x: 220; anchors.top: author.bottom - text: "Published: " + container.photoDate } - Text { id: tagsLabel; color: "white"; x: 220; anchors.top: date.bottom; - text: container.photoTags == "" ? "" : "Tags: " } - Text { id: tags; color: "white"; width: parent.width-x-20; - anchors.left: tagsLabel.right; anchors.top: date.bottom; - elide: Text.ElideRight; text: container.photoTags } - - ScrollBar { id: scrollBar; x: 720; y: flickable.y; width: 7; height: flickable.height; opacity: 0; - flickableArea: flickable; clip: true } - } - - back: Item { - anchors.fill: container - - Rectangle { anchors.fill: parent; color: "black"; opacity: 0.4; border.color: "white"; border.width: 2 } - - Progress { anchors.centerIn: parent; width: 200; height: 18; progress: bigImage.progress; visible: bigImage.status!=1 } - Flickable { - id: flick; width: container.width - 10; height: container.height - 10 - x: 5; y: 5; clip: true; - contentWidth: imageContainer.width; contentHeight: imageContainer.height - - Item { - id: imageContainer - width: Math.max(bigImage.width * bigImage.scale, flick.width); - height: Math.max(bigImage.height * bigImage.scale, flick.height); - - Image { - id: bigImage; source: container.photoUrl; scale: slider.value - anchors.centerIn: parent; - smooth: !flick.moving - onStatusChanged : { - // Default scale shows the entire image. - if (status == 1 && width != 0) { - slider.minimum = Math.min(flick.width / width, flick.height / height); - prevScale = Math.min(slider.minimum, 1); - slider.value = prevScale; - } - } - } - } - } - - MediaButton { - id: backButton2; x: 630; y: 370; text: "Back"; onClicked: { container.state = '' } - } - Text { - text: "Image Unavailable" - visible: bigImage.status == 'Error' - anchors.centerIn: parent; color: "white"; font.bold: true - } - - Slider { - id: slider; x: 25; y: 374; visible: { bigImage.status == 1 && maximum > minimum } - onValueChanged: { - if (bigImage.width * value > flick.width) { - var xoff = (flick.width/2 + flick.contentX) * value / prevScale; - flick.contentX = xoff - flick.width/2; - } - if (bigImage.height * value > flick.height) { - var yoff = (flick.height/2 + flick.contentY) * value / prevScale; - flick.contentY = yoff - flick.height/2; - } - prevScale = value; - } - } - } - - states: [ - State { - name: "Back" - PropertyChanges { target: detailsRotation; angle: 180 } - } - ] - - transitions: [ - Transition { - SequentialAnimation { - PropertyAction { - target: bigImage - property: "smooth" - value: false - } - NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 500 } - PropertyAction { - target: bigImage - property: "smooth" - value: !flick.moving - } - } - } - ] -} diff --git a/demos/declarative/flickr/common/MediaButton.qml b/demos/declarative/flickr/common/MediaButton.qml deleted file mode 100644 index 86ac948..0000000 --- a/demos/declarative/flickr/common/MediaButton.qml +++ /dev/null @@ -1,41 +0,0 @@ -import Qt 4.6 - -Item { - id: container - - signal clicked - - property string text - - Image { - id: buttonImage - source: "pics/button.png" - } - Image { - id: pressed - source: "pics/button-pressed.png" - opacity: 0 - } - MouseArea { - id: mouseRegion - anchors.fill: buttonImage - onClicked: { container.clicked(); } - } - Text { - font.bold: true - color: "white" - anchors.centerIn: buttonImage - text: container.text - } - width: buttonImage.width - states: [ - State { - name: "Pressed" - when: mouseRegion.pressed == true - PropertyChanges { - target: pressed - opacity: 1 - } - } - ] -} diff --git a/demos/declarative/flickr/common/MediaLineEdit.qml b/demos/declarative/flickr/common/MediaLineEdit.qml deleted file mode 100644 index 9559f6a..0000000 --- a/demos/declarative/flickr/common/MediaLineEdit.qml +++ /dev/null @@ -1,104 +0,0 @@ -import Qt 4.6 - -Item { - id: container - - property string label - property string text - - width: Math.max(94,labeltext.width + editor.width + 20) - height: buttonImage.height - - states: [ - State { - name: "Edit" - PropertyChanges { - target: labeltext - text: container.label + ": " - } - PropertyChanges { - target: labeltext - x: 10 - } - PropertyChanges { - target: editor - cursorVisible: true - width: 100 - } - PropertyChanges { - target: container - focus: true - } - StateChangeScript { - script:editor.selectAll() - } - }, - State { - // When returning to default state, typed text is propagated - StateChangeScript { - script: container.text = editor.text - } - } - ] - transitions: [ - Transition { - NumberAnimation { properties: "x,width"; duration: 500; easing.type: "InOutQuad" } - } - ] - - - BorderImage { - id: buttonImage - source: "pics/button.sci" - anchors.left: container.left - anchors.right: container.right - } - - BorderImage { - id: pressed - source: "pics/button-pressed.sci" - opacity: 0 - anchors.left: container.left - anchors.right: container.right - } - - MouseArea { - id: mouseRegion - anchors.fill: buttonImage - onClicked: { container.state = container.state=="Edit" ? "" : "Edit" } - states: [ - State { - when: mouseRegion.pressed == true - PropertyChanges { - target: pressed - opacity: 1 - } - } - ] - } - - Text { - id: labeltext - font.bold: true - color: "white" - anchors.verticalCenter: container.verticalCenter - x: (container.width - width)/2 - text: container.label + "..." - } - - TextInput { - id: editor - font.bold: true - color: "white" - selectionColor: "green" - width: 0 - clip: true - anchors.left: labeltext.right - anchors.verticalCenter: container.verticalCenter - } - Keys.forwardTo: [(returnKey), (editor)] - Item { - id: returnKey - Keys.onReturnPressed: "container.state = ''" - } -} diff --git a/demos/declarative/flickr/flickr-90.qml b/demos/declarative/flickr/flickr-90.qml new file mode 100644 index 0000000..1d1ac40 --- /dev/null +++ b/demos/declarative/flickr/flickr-90.qml @@ -0,0 +1,11 @@ +import Qt 4.6 + +Item { + width: 480; height: 320 + + Loader { + y: 320; rotation: -90 + transformOrigin: Item.TopLeft + source: "flickr.qml" + } +} diff --git a/demos/declarative/flickr/flickr-desktop.qml b/demos/declarative/flickr/flickr-desktop.qml deleted file mode 100644 index 63b6ea2..0000000 --- a/demos/declarative/flickr/flickr-desktop.qml +++ /dev/null @@ -1,194 +0,0 @@ -import Qt 4.6 - -import "common" - -Item { - id: mainWindow; width: 800; height: 450 - - property bool showPathView : false - - resources: [ - Component { - id: photoDelegate - Item { - id: wrapper; width: 85; height: 85 - scale: wrapper.PathView.scale ? wrapper.PathView.scale : 1 - z: wrapper.PathView.z ? wrapper.PathView.z : 0 - - transform: Rotation { - id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2 - axis.y: 1; axis.z: 0 - angle: wrapper.PathView.angle ? wrapper.PathView.angle : 0 - } - - Connections { - target: imageDetails - onClosed: { - if (wrapper.state == 'Details') { - wrapper.state = ''; - imageDetails.photoUrl = ""; - } - } - } - - function photoClicked() { - imageDetails.photoTitle = title; - imageDetails.photoDescription = description; - imageDetails.photoTags = tags; - imageDetails.photoWidth = photoWidth; - imageDetails.photoHeight = photoHeight; - imageDetails.photoType = photoType; - imageDetails.photoAuthor = photoAuthor; - imageDetails.photoDate = photoDate; - imageDetails.photoUrl = url; - imageDetails.rating = 0; - wrapper.state = "Details"; - } - - Rectangle { - id: whiteRect; anchors.fill: parent; color: "white"; radius: 5 - - Loading { x: 26; y: 26; visible: thumb.status!=1 } - Image { id: thumb; source: imagePath; x: 5; y: 5 } - - Item { - id: shadows - Image { source: "common/pics/shadow-right.png"; x: whiteRect.width; height: whiteRect.height } - Image { source: "common/pics/shadow-bottom.png"; y: whiteRect.height; width: whiteRect.width } - Image { id: corner; source: "common/pics/shadow-corner.png"; x: whiteRect.width; y: whiteRect.height } - } - } - - MouseArea { anchors.fill: wrapper; onClicked: { photoClicked() } } - - states: [ - State { - name: "Details" - PropertyChanges { target: imageDetails; z: 2 } - ParentChange { target: wrapper; parent: imageDetails.frontContainer } - PropertyChanges { target: wrapper; x: 45; y: 35; scale: 1; z: 1000 } - PropertyChanges { target: itemRotation; angle: 0 } - PropertyChanges { target: shadows; opacity: 0 } - PropertyChanges { target: imageDetails; y: 20 } - PropertyChanges { target: photoGridView; y: -480 } - PropertyChanges { target: photoPathView; y: -480 } - PropertyChanges { target: viewModeButton; opacity: 0 } - PropertyChanges { target: tagsEdit; opacity: 0 } - PropertyChanges { target: fetchButton; opacity: 0 } - PropertyChanges { target: categoryText; y: "-50" } - } - ] - - transitions: [ - Transition { - from: "*"; to: "Details" - SequentialAnimation { - ParentAnimation { - NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing.type: "InOutQuad" } - } - } - }, - Transition { - from: "Details"; to: "*" - SequentialAnimation { - ParentAnimation { - NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing.type: "InOutQuad" } - } - PropertyAction { targets: wrapper; properties: "z" } - } - } - ] - - } - } - ] - - Item { - id: background - - anchors.fill: parent - - Image { source: "common/pics/background.png"; anchors.fill: parent } - RssModel { id: rssModel; tags : tagsEdit.text } - Loading { anchors.centerIn: parent; visible: rssModel.status == 2 } - - GridView { - id: photoGridView; model: rssModel; delegate: photoDelegate; cacheBuffer: 100 - cellWidth: 105; cellHeight: 105; x:32; y: 80; width: 800; height: 330; z: 1 - } - - PathView { - id: photoPathView; model: rssModel; delegate: photoDelegate - y: -380; width: 800; height: 330; pathItemCount: 10; z: 1 - path: Path { - startX: -50; startY: 40; - - PathAttribute { name: "scale"; value: 1 } - PathAttribute { name: "angle"; value: -45 } - - PathCubic { - x: 400; y: 220 - control1X: 140; control1Y: 40 - control2X: 210; control2Y: 220 - } - - PathAttribute { name: "scale"; value: 1.2 } - PathAttribute { name: "z"; value: 1 } - PathAttribute { name: "angle"; value: 0 } - - PathCubic { - x: 850; y: 40 - control2X: 660; control2Y: 40 - control1X: 590; control1Y: 220 - } - - PathAttribute { name: "scale"; value: 1 } - PathAttribute { name: "angle"; value: 45 } - } - - } - - ImageDetails { id: imageDetails; width: 750; x: 25; y: 500; height: 410 } - - MediaButton { - id: viewModeButton; x: 680; y: 410; text: "View Mode" - onClicked: { if (mainWindow.showPathView == true) mainWindow.showPathView = false; else mainWindow.showPathView = true } - } - - MediaButton { - id: fetchButton - text: "Update" - anchors.right: viewModeButton.left; anchors.rightMargin: 5 - anchors.top: viewModeButton.top - onClicked: { rssModel.reload(); } - } - - MediaLineEdit { - id: tagsEdit; - label: "Tags" - anchors.right: fetchButton.left; anchors.rightMargin: 5 - anchors.top: viewModeButton.top - } - - states: State { - name: "PathView" - when: mainWindow.showPathView == true - PropertyChanges { target: photoPathView; y: 80 } - PropertyChanges { target: photoGridView; y: -380 } - } - - transitions: [ - Transition { - from: "*"; to: "*" - NumberAnimation { properties: "y"; duration: 1000; easing.type: "OutBounce"; easing.amplitude: 0.5 } - } - ] - } - - Text { - id: categoryText; anchors.horizontalCenter: parent.horizontalCenter; y: 15; - text: "Flickr - " + - (rssModel.tags=="" ? "Uploads from everyone" : "Recent Uploads tagged " + rssModel.tags) - font.pointSize: 20; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black" - } -} diff --git a/demos/declarative/flickr/flickr-mobile-90.qml b/demos/declarative/flickr/flickr-mobile-90.qml deleted file mode 100644 index 9fec242..0000000 --- a/demos/declarative/flickr/flickr-mobile-90.qml +++ /dev/null @@ -1,11 +0,0 @@ -import Qt 4.6 - -Item { - width: 480; height: 320 - - Loader { - y: 320; rotation: -90 - transformOrigin: Item.TopLeft - source: "flickr-mobile.qml" - } -} diff --git a/demos/declarative/flickr/flickr-mobile.qml b/demos/declarative/flickr/flickr-mobile.qml deleted file mode 100644 index 21e4c49..0000000 --- a/demos/declarative/flickr/flickr-mobile.qml +++ /dev/null @@ -1,82 +0,0 @@ -import Qt 4.6 -import "common" as Common -import "mobile" as Mobile - -Item { - id: screen; width: 320; height: 480 - property bool inListView : false - - Rectangle { - id: background - anchors.fill: parent; color: "#343434"; - - Image { source: "mobile/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } - - Common.RssModel { id: rssModel } - Common.Loading { anchors.centerIn: parent; visible: rssModel.status == 2 } - - Item { - id: views - x: 2; width: parent.width - 4 - anchors.top: titleBar.bottom; anchors.bottom: toolBar.top - - Mobile.GridDelegate { id: gridDelegate } - GridView { - id: photoGridView; model: rssModel; delegate: gridDelegate; cacheBuffer: 100 - cellWidth: 79; cellHeight: 79; width: parent.width; height: parent.height - 1; z: 6 - } - - Mobile.ListDelegate { id: listDelegate } - ListView { - id: photoListView; model: rssModel; delegate: listDelegate; z: 6 - width: parent.width; height: parent.height; x: -(parent.width * 1.5); cacheBuffer: 100; - } - states: State { - name: "ListView"; when: screen.inListView == true - PropertyChanges { target: photoListView; x: 0 } - PropertyChanges { target: photoGridView; x: -(parent.width * 1.5) } - } - - transitions: Transition { - NumberAnimation { properties: "x"; duration: 500; easing.type: "InOutQuad" } - } - } - - Mobile.ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height; z:1 } - Mobile.TitleBar { id: titleBar; z: 5; width: parent.width; height: 40; opacity: 0.9 } - - Mobile.ToolBar { - id: toolBar; z: 5 - height: 40; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9 - button1Label: "Update"; button2Label: "View mode" - onButton1Clicked: rssModel.reload() - onButton2Clicked: if (screen.inListView == true) screen.inListView = false; else screen.inListView = true - } - - Connections { - target: imageDetails - onClosed: { - if (background.state == "DetailedView") { - background.state = ''; - imageDetails.photoUrl = ""; - } - } - } - - states: State { - name: "DetailedView" - PropertyChanges { target: views; x: -parent.width } - PropertyChanges { target: toolBar; button1Label: "More..." } - PropertyChanges { - target: toolBar - onButton1Clicked: if (imageDetails.state=='') imageDetails.state='Back'; else imageDetails.state='' - } - PropertyChanges { target: toolBar; button2Label: "Back" } - PropertyChanges { target: toolBar; onButton2Clicked: imageDetails.closed() } - } - - transitions: Transition { - NumberAnimation { properties: "x"; duration: 500; easing.type: "InOutQuad" } - } - } -} diff --git a/demos/declarative/flickr/flickr.qml b/demos/declarative/flickr/flickr.qml new file mode 100644 index 0000000..21e4c49 --- /dev/null +++ b/demos/declarative/flickr/flickr.qml @@ -0,0 +1,82 @@ +import Qt 4.6 +import "common" as Common +import "mobile" as Mobile + +Item { + id: screen; width: 320; height: 480 + property bool inListView : false + + Rectangle { + id: background + anchors.fill: parent; color: "#343434"; + + Image { source: "mobile/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 } + + Common.RssModel { id: rssModel } + Common.Loading { anchors.centerIn: parent; visible: rssModel.status == 2 } + + Item { + id: views + x: 2; width: parent.width - 4 + anchors.top: titleBar.bottom; anchors.bottom: toolBar.top + + Mobile.GridDelegate { id: gridDelegate } + GridView { + id: photoGridView; model: rssModel; delegate: gridDelegate; cacheBuffer: 100 + cellWidth: 79; cellHeight: 79; width: parent.width; height: parent.height - 1; z: 6 + } + + Mobile.ListDelegate { id: listDelegate } + ListView { + id: photoListView; model: rssModel; delegate: listDelegate; z: 6 + width: parent.width; height: parent.height; x: -(parent.width * 1.5); cacheBuffer: 100; + } + states: State { + name: "ListView"; when: screen.inListView == true + PropertyChanges { target: photoListView; x: 0 } + PropertyChanges { target: photoGridView; x: -(parent.width * 1.5) } + } + + transitions: Transition { + NumberAnimation { properties: "x"; duration: 500; easing.type: "InOutQuad" } + } + } + + Mobile.ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height; z:1 } + Mobile.TitleBar { id: titleBar; z: 5; width: parent.width; height: 40; opacity: 0.9 } + + Mobile.ToolBar { + id: toolBar; z: 5 + height: 40; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9 + button1Label: "Update"; button2Label: "View mode" + onButton1Clicked: rssModel.reload() + onButton2Clicked: if (screen.inListView == true) screen.inListView = false; else screen.inListView = true + } + + Connections { + target: imageDetails + onClosed: { + if (background.state == "DetailedView") { + background.state = ''; + imageDetails.photoUrl = ""; + } + } + } + + states: State { + name: "DetailedView" + PropertyChanges { target: views; x: -parent.width } + PropertyChanges { target: toolBar; button1Label: "More..." } + PropertyChanges { + target: toolBar + onButton1Clicked: if (imageDetails.state=='') imageDetails.state='Back'; else imageDetails.state='' + } + PropertyChanges { target: toolBar; button2Label: "Back" } + PropertyChanges { target: toolBar; onButton2Clicked: imageDetails.closed() } + } + + transitions: Transition { + NumberAnimation { properties: "x"; duration: 500; easing.type: "InOutQuad" } + } + } +} -- cgit v0.12 From a51eb694a9a43227733dbfc4373779d84d435144 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 12:21:44 +1000 Subject: Give error if attempt to import from a version that is not installed. (was done for builtins/plugins, but now also for qmldir-specified content) Task-number: QTBUG-9627 --- src/declarative/qml/qdeclarativeengine.cpp | 12 ++++++++++++ .../qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 11 ++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index e8b6913..f5fe140 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1620,6 +1620,18 @@ public: url.chop(1); } + if (vmaj > -1 && vmin > -1 && !qmldircomponents.isEmpty()) { + QList::ConstIterator it = qmldircomponents.begin(); + for (; it != qmldircomponents.end(); ++it) { + if (it->majorVersion > vmaj || (it->majorVersion == vmaj && it->minorVersion >= vmin)) + break; + } + if (it == qmldircomponents.end()) { + *errorString = QDeclarativeEngine::tr("module \"%1\" version %2.%3 is not installed").arg(uri_arg).arg(vmaj).arg(vmin); + return false; + } + } + s->uris.prepend(uri); s->urls.prepend(url); s->majversions.prepend(vmaj); diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 8990fb4..dcd72d2 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -1347,11 +1347,16 @@ void tst_qdeclarativelanguage::importsInstalled_data() "InstalledTest {}" << "QDeclarativeText" << ""; - QTest::newRow("installed import 4") + QTest::newRow("installed import minor version not available") // QTBUG-9627 << "import com.nokia.installedtest 1.10\n" "InstalledTest {}" - << "QDeclarativeText" - << ""; + << "" + << "module \"com.nokia.installedtest\" version 1.10 is not installed"; + QTest::newRow("installed import major version not available") // QTBUG-9627 + << "import com.nokia.installedtest 9.0\n" + "InstalledTest {}" + << "" + << "module \"com.nokia.installedtest\" version 9.0 is not installed"; QTest::newRow("installed import visibility") // QT-614 << "import com.nokia.installedtest 1.4\n" "PrivateType {}" -- cgit v0.12 From 5d9f5b0ba76bee4b148e13fd880d87d167e6c68d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 8 Apr 2010 12:31:33 +1000 Subject: Prevent Behavior from being triggered on initialization. Task-number: QTBUG-6332 --- .../qml/qdeclarativecompiledbindings.cpp | 22 ++++++++++------------ .../qdeclarativebehaviors/data/startup.qml | 17 +++++++++++++++++ .../tst_qdeclarativebehaviors.cpp | 16 ++++++++++++++++ 3 files changed, 43 insertions(+), 12 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativebehaviors/data/startup.qml diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index 53143d5..07b0798 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -137,7 +137,7 @@ public: Subscription *subscriptions; QScriptDeclarativeClass::PersistentIdentifier *identifiers; - void run(Binding *); + void run(Binding *, QDeclarativePropertyPrivate::WriteFlags flags); const char *programData; Binding *m_bindings; @@ -147,7 +147,7 @@ public: void init(); void run(int instr, QDeclarativeContextData *context, - QDeclarativeDelayedError *error, QObject *scope, QObject *output); + QDeclarativeDelayedError *error, QObject *scope, QObject *output, QDeclarativePropertyPrivate::WriteFlags storeFlags); inline void unsubscribe(int subIndex); @@ -246,9 +246,9 @@ int QDeclarativeCompiledBindingsPrivate::Binding::propertyIndex() return property & 0xFFFF; } -void QDeclarativeCompiledBindingsPrivate::Binding::update(QDeclarativePropertyPrivate::WriteFlags) +void QDeclarativeCompiledBindingsPrivate::Binding::update(QDeclarativePropertyPrivate::WriteFlags flags) { - parent->run(this); + parent->run(this, flags); } void QDeclarativeCompiledBindingsPrivate::Binding::destroy() @@ -270,13 +270,13 @@ int QDeclarativeCompiledBindings::qt_metacall(QMetaObject::Call c, int id, void quint32 count = *reeval; ++reeval; for (quint32 ii = 0; ii < count; ++ii) { - d->run(d->m_bindings + reeval[ii]); + d->run(d->m_bindings + reeval[ii], QDeclarativePropertyPrivate::DontRemoveBinding); } } return -1; } -void QDeclarativeCompiledBindingsPrivate::run(Binding *binding) +void QDeclarativeCompiledBindingsPrivate::run(Binding *binding, QDeclarativePropertyPrivate::WriteFlags flags) { Q_Q(QDeclarativeCompiledBindings); @@ -319,12 +319,11 @@ void QDeclarativeCompiledBindingsPrivate::run(Binding *binding) vt->read(binding->target, binding->property & 0xFFFF); QObject *target = vt; - run(binding->index, context, binding, binding->scope, target); + run(binding->index, context, binding, binding->scope, target, flags); - vt->write(binding->target, binding->property & 0xFFFF, - QDeclarativePropertyPrivate::DontRemoveBinding); + vt->write(binding->target, binding->property & 0xFFFF, flags); } else { - run(binding->index, context, binding, binding->scope, binding->target); + run(binding->index, context, binding, binding->scope, binding->target, flags); } binding->updating = false; } @@ -1085,14 +1084,13 @@ static void dumpInstruction(const Instr *instr) void QDeclarativeCompiledBindingsPrivate::run(int instrIndex, QDeclarativeContextData *context, QDeclarativeDelayedError *error, - QObject *scope, QObject *output) + QObject *scope, QObject *output, QDeclarativePropertyPrivate::WriteFlags storeFlags) { Q_Q(QDeclarativeCompiledBindings); error->removeError(); Register registers[32]; - int storeFlags = 0; QDeclarativeEnginePrivate *engine = QDeclarativeEnginePrivate::get(context->engine); Program *program = (Program *)programData; diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/startup.qml b/tests/auto/declarative/qdeclarativebehaviors/data/startup.qml new file mode 100644 index 0000000..f3ff620 --- /dev/null +++ b/tests/auto/declarative/qdeclarativebehaviors/data/startup.qml @@ -0,0 +1,17 @@ +import Qt 4.7 + +Rectangle { + width: 400 + height: 400 + + Rectangle { + objectName: "innerRect" + height: 100; width: 100; color: "green" + property real targetX: 100 + + x: targetX + Behavior on x { + NumberAnimation {} + } + } +} diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index 26c8231..4c9c9ca 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -68,6 +68,7 @@ private slots: void reassignedAnimation(); void disabled(); void dontStart(); + void startup(); }; void tst_qdeclarativebehaviors::simpleBehavior() @@ -326,6 +327,21 @@ void tst_qdeclarativebehaviors::dontStart() delete rect; } +void tst_qdeclarativebehaviors::startup() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/startup.qml")); + QDeclarativeRectangle *rect = qobject_cast(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *innerRect = rect->findChild("innerRect"); + QVERIFY(innerRect); + + QCOMPARE(innerRect->x(), qreal(100)); //should be set immediately + + delete rect; +} + QTEST_MAIN(tst_qdeclarativebehaviors) #include "tst_qdeclarativebehaviors.moc" -- cgit v0.12 From 71f9283df3caabadcfb04e2ab6f57305cd73c0d1 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 8 Apr 2010 13:04:13 +1000 Subject: Replace Text::wrap property with Text::wrapMode enumeration. wrap remains for a little while, and will produce a warning. --- examples/declarative/listview/recipes.qml | 6 ++- examples/declarative/tabwidget/tabs.qml | 6 +-- examples/declarative/webview/alerts.qml | 2 +- examples/declarative/xmldata/daringfireball.qml | 2 +- examples/declarative/xmldata/yahoonews.qml | 2 +- src/declarative/QmlChanges.txt | 1 + src/declarative/graphicsitems/qdeclarativetext.cpp | 54 ++++++++++++++-------- src/declarative/graphicsitems/qdeclarativetext_p.h | 15 +++++- .../graphicsitems/qdeclarativetext_p_p.h | 6 +-- .../util/qdeclarativepropertychanges.cpp | 2 +- .../declarative/qdeclarativestates/data/reset.qml | 2 +- .../qdeclarativetext/tst_qdeclarativetext.cpp | 8 ++-- .../qmlvisual/qdeclarativetext/font/plaintext.qml | 8 ++-- .../qmlvisual/qdeclarativetext/font/richtext.qml | 8 ++-- 14 files changed, 76 insertions(+), 46 deletions(-) diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml index b76a9ab..59f4e59 100644 --- a/examples/declarative/listview/recipes.qml +++ b/examples/declarative/listview/recipes.qml @@ -60,7 +60,9 @@ Rectangle { opacity: wrapper.detailsOpacity } Text { - text: ingredients; wrap: true; width: parent.width + text: ingredients + wrapMode: Text.WordWrap + width: parent.width opacity: wrapper.detailsOpacity } } @@ -82,7 +84,7 @@ Rectangle { id: flick anchors.top: methodTitle.bottom; anchors.bottom: parent.bottom width: parent.width; contentHeight: methodText.height; clip: true - Text { id: methodText; text: method; wrap: true; width: details.width } + Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width } } Image { anchors.right: flick.right; anchors.top: flick.top diff --git a/examples/declarative/tabwidget/tabs.qml b/examples/declarative/tabwidget/tabs.qml index 1d11b03..3d7ee6d 100644 --- a/examples/declarative/tabwidget/tabs.qml +++ b/examples/declarative/tabwidget/tabs.qml @@ -13,7 +13,7 @@ TabWidget { Text { anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter text: "Roses are red"; font.pixelSize: 20 - wrap: true; width: parent.width - 20 + wrapMode: Text.WordWrap; width: parent.width - 20 } } } @@ -27,7 +27,7 @@ TabWidget { Text { anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter text: "Flower stems are green"; font.pixelSize: 20 - wrap: true; width: parent.width - 20 + wrapMode: Text.WordWrap; width: parent.width - 20 } } } @@ -41,7 +41,7 @@ TabWidget { Text { anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter text: "Violets are blue"; font.pixelSize: 20 - wrap: true; width: parent.width - 20 + wrapMode: Text.WordWrap; width: parent.width - 20 } } } diff --git a/examples/declarative/webview/alerts.qml b/examples/declarative/webview/alerts.qml index ab2e860..2549226 100644 --- a/examples/declarative/webview/alerts.qml +++ b/examples/declarative/webview/alerts.qml @@ -51,7 +51,7 @@ WebView { color: "white" font.pixelSize: 20 width: webView.width*0.75 - wrap: true + wrapMode: Text.WordWrap horizontalAlignment: "AlignHCenter" } } diff --git a/examples/declarative/xmldata/daringfireball.qml b/examples/declarative/xmldata/daringfireball.qml index 456f309..25eb1ac 100644 --- a/examples/declarative/xmldata/daringfireball.qml +++ b/examples/declarative/xmldata/daringfireball.qml @@ -32,7 +32,7 @@ Rectangle { x: 10 text: content anchors.top: titleText.bottom - width: 580; wrap: true + width: 580; wrapMode: Text.WordWrap onLinkActivated: { console.log('link clicked: ' + link) } } } diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml index f7c269c..d69982e 100644 --- a/examples/declarative/xmldata/yahoonews.qml +++ b/examples/declarative/xmldata/yahoonews.qml @@ -45,7 +45,7 @@ Rectangle { id: descriptionText text: description width: 560 - wrap: true + wrapMode: Text.WordWrap font.family: "Helvetica" anchors.top: titleText.bottom anchors.topMargin: 5 diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index c86bdc6..d3737b0 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -1,6 +1,7 @@ ============================================================================= The changes below are pre Qt 4.7.0 beta +Text: wrap property is replaced by wrapMode enumeration. Removed Q-prefix from validators (IntValidator, DoubleValidator, and RegExpValidator) PathView: offset property now uses range 0-1.0 rather than 0-100 ListView, GridView::positionViewAtIndex() gained a 'mode' parameter diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index a4f3068..c950e31 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -42,6 +42,7 @@ #include "private/qdeclarativetext_p.h" #include "private/qdeclarativetext_p_p.h" #include +#include #include #include @@ -70,7 +71,7 @@ QT_BEGIN_NAMESPACE \image declarative-text.png If height and width are not explicitly set, Text will attempt to determine how - much room is needed and set it accordingly. Unless \c wrap is set, it will always + much room is needed and set it accordingly. Unless \c wrapMode is set, it will always prefer width to height (all text will be placed on a single line). The \c elide property can alternatively be used to fit a single line of @@ -98,7 +99,7 @@ QT_BEGIN_NAMESPACE \image text.png If height and width are not explicitly set, Text will attempt to determine how - much room is needed and set it accordingly. Unless \c wrap is set, it will always + much room is needed and set it accordingly. Unless \c wrapMode is set, it will always prefer width to height (all text will be placed on a single line). The \c elide property can alternatively be used to fit a line of plain text to a set width. @@ -319,37 +320,52 @@ void QDeclarativeText::setVAlign(VAlignment align) } /*! - \qmlproperty bool Text::wrap + \qmlproperty enumeration Text::wrapMode Set this property to wrap the text to the Text item's width. The text will only - wrap if an explicit width has been set. + wrap if an explicit width has been set. wrapMode can be one of: - Wrapping is done on word boundaries (i.e. it is a "word-wrap"). If the text cannot be + \list + \o NoWrap - no wrapping will be performed. + \o WordWrap - wrapping is done on word boundaries. If the text cannot be word-wrapped to the specified width it will be partially drawn outside of the item's bounds. If this is undesirable then enable clipping on the item (Item::clip). + \endlist - Wrapping is off by default. + The default is NoWrap. */ -//### Future may provide choice of wrap modes, such as QTextOption::WrapAtWordBoundaryOrAnywhere -bool QDeclarativeText::wrap() const +QDeclarativeText::WrapMode QDeclarativeText::wrapMode() const { Q_D(const QDeclarativeText); - return d->wrap; + return d->wrapMode; } -void QDeclarativeText::setWrap(bool w) +void QDeclarativeText::setWrapMode(WrapMode mode) { Q_D(QDeclarativeText); - if (w == d->wrap) + if (mode == d->wrapMode) return; - d->wrap = w; + d->wrapMode = mode; d->updateLayout(); d->markImgDirty(); - emit wrapChanged(d->wrap); + emit wrapModeChanged(); +} + +bool QDeclarativeText::wrap() const +{ + Q_D(const QDeclarativeText); + return d->wrapMode != NoWrap; +} + +void QDeclarativeText::setWrap(bool w) +{ + qmlInfo(this) << "\"wrap\" property is deprecated and will soon be removed. Use wrapMode"; + setWrapMode(WordWrap); } + /*! \qmlproperty enumeration Text::textFormat @@ -437,7 +453,7 @@ void QDeclarativeText::setTextFormat(TextFormat format) Set this property to elide parts of the text fit to the Text item's width. The text will only elide if an explicit width has been set. - This property cannot be used with wrap enabled or with rich text. + This property cannot be used with wrapping enabled or with rich text. Eliding can be \c ElideNone (the default), \c ElideLeft, \c ElideMiddle, or \c ElideRight. @@ -471,7 +487,7 @@ void QDeclarativeText::geometryChanged(const QRectF &newGeometry, { Q_D(QDeclarativeText); if (newGeometry.width() != oldGeometry.width()) { - if (d->wrap || d->elideMode != QDeclarativeText::ElideNone) { + if (d->wrapMode != QDeclarativeText::NoWrap || d->elideMode != QDeclarativeText::ElideNone) { //re-elide if needed if (d->singleline && d->elideMode != QDeclarativeText::ElideNone && isComponentComplete() && widthValid()) { @@ -538,12 +554,12 @@ void QDeclarativeTextPrivate::updateSize() singleline = false; // richtext can't elide or be optimized for single-line case doc->setDefaultFont(font); QTextOption option((Qt::Alignment)int(hAlign | vAlign)); - if (wrap) + if (wrapMode == QDeclarativeText::WordWrap) option.setWrapMode(QTextOption::WordWrap); else option.setWrapMode(QTextOption::NoWrap); doc->setDefaultTextOption(option); - if (wrap && !q->heightValid() && q->widthValid()) + if (wrapMode != QDeclarativeText::NoWrap && !q->heightValid() && q->widthValid()) doc->setTextWidth(q->width()); else doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) @@ -623,7 +639,7 @@ QSize QDeclarativeTextPrivate::setupTextLayout(QTextLayout *layout) qreal lineWidth = 0; //set manual width - if ((wrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid()) + if ((wrapMode != QDeclarativeText::NoWrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid()) lineWidth = q->width(); layout->beginLayout(); @@ -633,7 +649,7 @@ QSize QDeclarativeTextPrivate::setupTextLayout(QTextLayout *layout) if (!line.isValid()) break; - if ((wrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid()) + if ((wrapMode != QDeclarativeText::NoWrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid()) line.setLineWidth(lineWidth); } layout->endLayout(); diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h index cbea8f3..7a09b2f 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h @@ -42,6 +42,7 @@ #ifndef QDECLARATIVETEXT_H #define QDECLARATIVETEXT_H +#include #include "qdeclarativeitem.h" QT_BEGIN_HEADER @@ -58,6 +59,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeText : public QDeclarativeItem Q_ENUMS(TextStyle) Q_ENUMS(TextFormat) Q_ENUMS(TextElideMode) + Q_ENUMS(WrapMode) Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) @@ -66,7 +68,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeText : public QDeclarativeItem Q_PROPERTY(QColor styleColor READ styleColor WRITE setStyleColor NOTIFY styleColorChanged) Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) - Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapChanged) //### there are several wrap modes in Qt + Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) + Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapModeChanged) Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged) Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode NOTIFY elideModeChanged) //### elideMode? @@ -93,6 +96,12 @@ public: ElideMiddle = Qt::ElideMiddle, ElideNone = Qt::ElideNone }; + enum WrapMode { NoWrap = QTextOption::NoWrap, + WordWrap = QTextOption::WordWrap +// WrapAnywhere = QTextOption::WrapAnywhere, +// WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere + }; + QString text() const; void setText(const QString &); @@ -116,6 +125,8 @@ public: bool wrap() const; void setWrap(bool w); + WrapMode wrapMode() const; + void setWrapMode(WrapMode w); TextFormat textFormat() const; void setTextFormat(TextFormat format); @@ -136,7 +147,7 @@ Q_SIGNALS: void styleColorChanged(const QColor &color); void horizontalAlignmentChanged(HAlignment alignment); void verticalAlignmentChanged(VAlignment alignment); - void wrapChanged(bool wrap); + void wrapModeChanged(); void textFormatChanged(TextFormat textFormat); void elideModeChanged(TextElideMode mode); diff --git a/src/declarative/graphicsitems/qdeclarativetext_p_p.h b/src/declarative/graphicsitems/qdeclarativetext_p_p.h index 85a65ce..cc5a9f2 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p_p.h @@ -72,8 +72,8 @@ public: QDeclarativeTextPrivate() : color((QRgb)0), style(QDeclarativeText::Normal), hAlign(QDeclarativeText::AlignLeft), vAlign(QDeclarativeText::AlignTop), elideMode(QDeclarativeText::ElideNone), - imgDirty(true), dirty(true), wrap(false), richText(false), singleline(false), cache(true), doc(0), - format(QDeclarativeText::AutoText) + imgDirty(true), dirty(true), richText(false), singleline(false), cache(true), doc(0), + format(QDeclarativeText::AutoText), wrapMode(QDeclarativeText::NoWrap) { #if defined(QML_NO_TEXT_CACHE) cache = false; @@ -115,7 +115,6 @@ public: QDeclarativeText::TextElideMode elideMode; bool imgDirty:1; bool dirty:1; - bool wrap:1; bool richText:1; bool singleline:1; bool cache:1; @@ -123,6 +122,7 @@ public: QTextLayout layout; QSize cachedLayoutSize; QDeclarativeText::TextFormat format; + QDeclarativeText::WrapMode wrapMode; }; QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index e7228cc..0ed97bf 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -111,7 +111,7 @@ QT_BEGIN_NAMESPACE Text { id: theText width: 50 - wrap: true + wrapMode: Text.WordWrap text: "a text string that is longer than 50 pixels" } diff --git a/tests/auto/declarative/qdeclarativestates/data/reset.qml b/tests/auto/declarative/qdeclarativestates/data/reset.qml index 8e9b13a..7da80b3 100644 --- a/tests/auto/declarative/qdeclarativestates/data/reset.qml +++ b/tests/auto/declarative/qdeclarativestates/data/reset.qml @@ -6,7 +6,7 @@ Rectangle { Text { id: theText width: 40 - wrap: true + wrapMode: Text.WordWrap text: "a text string that is longer than 40 pixels" } diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index bbbbd83..bf7d110 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -251,18 +251,18 @@ void tst_qdeclarativetext::wrap() // for specified width and wrap set true { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; wrap: true; width: 300 }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; wrapMode: Text.WordWrap; width: 300 }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); textHeight = textObject->height(); QVERIFY(textObject != 0); - QVERIFY(textObject->wrap() == true); + QVERIFY(textObject->wrapMode() == QDeclarativeText::WordWrap); QCOMPARE(textObject->width(), 300.); } for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nText { wrap: true; width: 30; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.6\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); @@ -278,7 +278,7 @@ void tst_qdeclarativetext::wrap() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nText { wrap: true; width: 30; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.6\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast(textComponent.create()); diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml index a3aa929..c44088b 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml @@ -61,7 +61,7 @@ Rectangle { text: s.text; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignBottom; width: 800; height: 20 } Text { - text: s.text; font.pixelSize: 18; style: Text.Outline; styleColor: "white"; wrap: true; width: 200 + text: s.text; font.pixelSize: 18; style: Text.Outline; styleColor: "white"; wrapMode: Text.WordWrap; width: 200 } Text { text: s.text; elide: Text.ElideLeft; width: 200 @@ -73,13 +73,13 @@ Rectangle { text: s.text; elide: Text.ElideRight; width: 200 } Text { - text: s.text; elide: Text.ElideLeft; width: 200; wrap: true + text: s.text; elide: Text.ElideLeft; width: 200; wrapMode: Text.WordWrap } Text { - text: s.text; elide: Text.ElideMiddle; width: 200; wrap: true + text: s.text; elide: Text.ElideMiddle; width: 200; wrapMode: Text.WordWrap } Text { - text: s.text; elide: Text.ElideRight; width: 200; wrap: true + text: s.text; elide: Text.ElideRight; width: 200; wrapMode: Text.WordWrap } } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml index 35aa232..b5d05da 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml @@ -61,7 +61,7 @@ Rectangle { text: s.text; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignBottom; width: 800; height: 20 } Text { - text: s.text; font.pixelSize: 18; style: Text.Outline; styleColor: "white"; wrap: true; width: 200 + text: s.text; font.pixelSize: 18; style: Text.Outline; styleColor: "white"; wrapMode: Text.WordWrap; width: 200 } Text { text: s.text; elide: Text.ElideLeft; width: 200 @@ -73,13 +73,13 @@ Rectangle { text: s.text; elide: Text.ElideRight; width: 200 } Text { - text: s.text; elide: Text.ElideLeft; width: 200; wrap: true + text: s.text; elide: Text.ElideLeft; width: 200; wrapMode: Text.WordWrap } Text { - text: s.text; elide: Text.ElideMiddle; width: 200; wrap: true + text: s.text; elide: Text.ElideMiddle; width: 200; wrapMode: Text.WordWrap } Text { - text: s.text; elide: Text.ElideRight; width: 200; wrap: true + text: s.text; elide: Text.ElideRight; width: 200; wrapMode: Text.WordWrap } } } -- cgit v0.12 From 0c5f0dcf5749a64449ed444a496a9b9876133abe Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 13:07:50 +1000 Subject: Pass again, now that version must exist in order to be imported. --- .../auto/declarative/qdeclarativedom/data/importlib/sublib/qmldir | 3 ++- tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/auto/declarative/qdeclarativedom/data/importlib/sublib/qmldir b/tests/auto/declarative/qdeclarativedom/data/importlib/sublib/qmldir index 5bdd17b..98d6b74 100644 --- a/tests/auto/declarative/qdeclarativedom/data/importlib/sublib/qmldir +++ b/tests/auto/declarative/qdeclarativedom/data/importlib/sublib/qmldir @@ -1 +1,2 @@ -Foo Foo.qml +Foo 1.1 Foo.qml +Foo 1.0 Foo.qml diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index 79b0c36..e8bbb86 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -333,8 +333,8 @@ void tst_qdeclarativedom::testValueInterceptor() void tst_qdeclarativedom::loadImports() { QByteArray qml = "import Qt 4.6\n" - "import importlib.sublib 4.7\n" - "import importlib.sublib 4.6 as NewFoo\n" + "import importlib.sublib 1.1\n" + "import importlib.sublib 1.0 as NewFoo\n" "import 'import'\n" "import 'import' as X\n" "Item {}"; @@ -356,13 +356,13 @@ void tst_qdeclarativedom::loadImports() QCOMPARE(import.type(), QDeclarativeDomImport::Library); QCOMPARE(import.uri(), QLatin1String("importlib.sublib")); QCOMPARE(import.qualifier(), QString()); - QCOMPARE(import.version(), QLatin1String("4.7")); + QCOMPARE(import.version(), QLatin1String("1.1")); import = document.imports().at(2); QCOMPARE(import.type(), QDeclarativeDomImport::Library); QCOMPARE(import.uri(), QLatin1String("importlib.sublib")); QCOMPARE(import.qualifier(), QLatin1String("NewFoo")); - QCOMPARE(import.version(), QLatin1String("4.6")); + QCOMPARE(import.version(), QLatin1String("1.0")); import = document.imports().at(3); QCOMPARE(import.type(), QDeclarativeDomImport::File); -- cgit v0.12 From ccb6235ae842b7e63997210e5169cc00f4e0e5e8 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 13:09:49 +1000 Subject: Remove usage of Script where not actually testing the obsolete construct. --- .../qdeclarativeecmascript/data/listProperties.qml | 13 +- .../qdeclarativelanguage/data/i18nScript.qml | 9 +- .../qdeclarativexmlhttprequest/data/attr.qml | 68 ++++----- .../qdeclarativexmlhttprequest/data/cdata.qml | 136 ++++++++--------- .../qdeclarativexmlhttprequest/data/document.qml | 40 +++-- .../qdeclarativexmlhttprequest/data/element.qml | 168 ++++++++++----------- .../qdeclarativexmlhttprequest/data/text.qml | 134 ++++++++-------- tests/auto/declarative/sql/tst_sql.cpp | 4 +- 8 files changed, 279 insertions(+), 293 deletions(-) diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/listProperties.qml b/tests/auto/declarative/qdeclarativeecmascript/data/listProperties.qml index 810f9b6..216e916 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/listProperties.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/listProperties.qml @@ -9,15 +9,12 @@ MyQmlObject { QtObject { property int a: 11 } ] - Script { - function calcTest1() { - var rv = 0; - for (var ii = 0; ii < root.objectListProperty.length; ++ii) { - rv += root.objectListProperty[ii].a; - } - return rv; + function calcTest1() { + var rv = 0; + for (var ii = 0; ii < root.objectListProperty.length; ++ii) { + rv += root.objectListProperty[ii].a; } - + return rv; } property int test1: calcTest1(); diff --git a/tests/auto/declarative/qdeclarativelanguage/data/i18nScript.qml b/tests/auto/declarative/qdeclarativelanguage/data/i18nScript.qml index 942ed90..e77cb52 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/i18nScript.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/i18nScript.qml @@ -1,12 +1,9 @@ import Test 1.0 MyTypeObject { - Script { - function val() { - var áâãäå = 20 - return "Test áâãäå: " + áâãäå - } - + function val() { + var áâãäå = 20 + return "Test áâãäå: " + áâãäå } stringProperty: val() } diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/attr.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/attr.qml index 9049fc7..0b4badc 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/attr.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/attr.qml @@ -4,55 +4,53 @@ QtObject { property bool xmlTest: false property bool dataOK: false - Script { - function checkAttr(documentElement, attr) - { - if (attr == null) - return; + function checkAttr(documentElement, attr) + { + if (attr == null) + return; - if (attr.name != "attr") - return; + if (attr.name != "attr") + return; - if (attr.value != "myvalue") - return; + if (attr.value != "myvalue") + return; - if (attr.ownerElement.tagName != documentElement.tagName) - return; + if (attr.ownerElement.tagName != documentElement.tagName) + return; - if (attr.nodeName != "attr") - return; + if (attr.nodeName != "attr") + return; - if (attr.nodeValue != "myvalue") - return; + if (attr.nodeValue != "myvalue") + return; - if (attr.nodeType != 2) - return; + if (attr.nodeType != 2) + return; - if (attr.childNodes.length != 0) - return; + if (attr.childNodes.length != 0) + return; - if (attr.firstChild != null) - return; + if (attr.firstChild != null) + return; - if (attr.lastChild != null) - return; + if (attr.lastChild != null) + return; - if (attr.previousSibling != null) - return; + if (attr.previousSibling != null) + return; - if (attr.nextSibling != null) - return; + if (attr.nextSibling != null) + return; - if (attr.attributes != null) - return; + if (attr.attributes != null) + return; - xmlTest = true; - } + xmlTest = true; + } - function checkXML(document) - { - checkAttr(document.documentElement, document.documentElement.attributes[0]); - } + function checkXML(document) + { + checkAttr(document.documentElement, document.documentElement.attributes[0]); } Component.onCompleted: { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/cdata.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/cdata.qml index b2d0209..928e514 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/cdata.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/cdata.qml @@ -4,108 +4,106 @@ QtObject { property bool xmlTest: false property bool dataOK: false - Script { - function checkCData(text, whitespacetext) - { - // This is essentially a copy of text.qml/checkText() + function checkCData(text, whitespacetext) + { + // This is essentially a copy of text.qml/checkText() - if (text == null) - return; + if (text == null) + return; - if (text.nodeName != "#cdata-section") - return; + if (text.nodeName != "#cdata-section") + return; - if (text.nodeValue != "Hello world!") - return; + if (text.nodeValue != "Hello world!") + return; - if (text.nodeType != 4) - return; + if (text.nodeType != 4) + return; - if (text.parentNode.nodeName != "item") - return; + if (text.parentNode.nodeName != "item") + return; - if (text.childNodes.length != 0) - return; + if (text.childNodes.length != 0) + return; - if (text.firstChild != null) - return; + if (text.firstChild != null) + return; - if (text.lastChild != null) - return; + if (text.lastChild != null) + return; - if (text.previousSibling != null) - return; + if (text.previousSibling != null) + return; - if (text.nextSibling != null) - return; + if (text.nextSibling != null) + return; - if (text.attributes != null) - return; + if (text.attributes != null) + return; - if (text.wholeText != "Hello world!") - return; + if (text.wholeText != "Hello world!") + return; - if (text.data != "Hello world!") - return; + if (text.data != "Hello world!") + return; - if (text.length != 12) - return; + if (text.length != 12) + return; - if (text.isElementContentWhitespace != false) - return; + if (text.isElementContentWhitespace != false) + return; - if (whitespacetext.nodeName != "#cdata-section") - return; + if (whitespacetext.nodeName != "#cdata-section") + return; - if (whitespacetext.nodeValue != " ") - return; + if (whitespacetext.nodeValue != " ") + return; - if (whitespacetext.nodeType != 4) - return; + if (whitespacetext.nodeType != 4) + return; - if (whitespacetext.parentNode.nodeName != "item") - return; + if (whitespacetext.parentNode.nodeName != "item") + return; - if (whitespacetext.childNodes.length != 0) - return; + if (whitespacetext.childNodes.length != 0) + return; - if (whitespacetext.firstChild != null) - return; + if (whitespacetext.firstChild != null) + return; - if (whitespacetext.lastChild != null) - return; + if (whitespacetext.lastChild != null) + return; - if (whitespacetext.previousSibling != null) - return; + if (whitespacetext.previousSibling != null) + return; - if (whitespacetext.nextSibling != null) - return; + if (whitespacetext.nextSibling != null) + return; - if (whitespacetext.attributes != null) - return; + if (whitespacetext.attributes != null) + return; - if (whitespacetext.wholeText != " ") - return; + if (whitespacetext.wholeText != " ") + return; - if (whitespacetext.data != " ") - return; + if (whitespacetext.data != " ") + return; - if (whitespacetext.length != 3) - return; + if (whitespacetext.length != 3) + return; - if (whitespacetext.isElementContentWhitespace != true) - return; + if (whitespacetext.isElementContentWhitespace != true) + return; - xmlTest = true; - } + xmlTest = true; + } - function checkXML(document) - { - checkCData(document.documentElement.childNodes[0].childNodes[0], - document.documentElement.childNodes[1].childNodes[0]); + function checkXML(document) + { + checkCData(document.documentElement.childNodes[0].childNodes[0], + document.documentElement.childNodes[1].childNodes[0]); - } } Component.onCompleted: { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/document.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/document.qml index e372361..682ea9f 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/document.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/document.qml @@ -4,34 +4,32 @@ QtObject { property bool xmlTest: false property bool dataOK: false - Script { - function checkXML(document) - { - if (document.xmlVersion != "1.0") - return; + function checkXML(document) + { + if (document.xmlVersion != "1.0") + return; - if (document.xmlEncoding != "UTF-8") - return; + if (document.xmlEncoding != "UTF-8") + return; - if (document.xmlStandalone != true) - return; + if (document.xmlStandalone != true) + return; - if (document.documentElement == null) - return; + if (document.documentElement == null) + return; - if (document.nodeName != "#document") - return; + if (document.nodeName != "#document") + return; - if (document.nodeValue != null) - return; + if (document.nodeValue != null) + return; - if (document.parentNode != null) - return; + if (document.parentNode != null) + return; - // ### Test other node properties - // ### test encoding (what is a valid qt encoding?) - xmlTest = true; - } + // ### Test other node properties + // ### test encoding (what is a valid qt encoding?) + xmlTest = true; } Component.onCompleted: { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/element.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/element.qml index 78c0374..200214f 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/element.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/element.qml @@ -4,122 +4,120 @@ QtObject { property bool xmlTest: false property bool dataOK: false - Script { - function checkElement(e, person, fruit) - { - if (e.tagName != "root") - return; + function checkElement(e, person, fruit) + { + if (e.tagName != "root") + return; - if (e.nodeName != "root") - return; + if (e.nodeName != "root") + return; - if (e.nodeValue != null) - return; + if (e.nodeValue != null) + return; - if (e.nodeType != 1) - return; + if (e.nodeType != 1) + return; - var childTagNames = [ "person", "fruit" ]; + var childTagNames = [ "person", "fruit" ]; - if (e.childNodes.length != childTagNames.length) - return; + if (e.childNodes.length != childTagNames.length) + return; - for (var ii = 0; ii < childTagNames.length; ++ii) { - if (e.childNodes[ii].tagName != childTagNames[ii]) - return; - } - - if (e.childNodes[childTagNames.length + 1] != null) + for (var ii = 0; ii < childTagNames.length; ++ii) { + if (e.childNodes[ii].tagName != childTagNames[ii]) return; + } - // Check writing fails - e.childNodes[0] = null; - if (e.childNodes[0] == null) - return; + if (e.childNodes[childTagNames.length + 1] != null) + return; - e.childNodes[10] = 10; - if (e.childNodes[10] != null) - return; + // Check writing fails + e.childNodes[0] = null; + if (e.childNodes[0] == null) + return; - if (e.firstChild.tagName != e.childNodes[0].tagName) - return; + e.childNodes[10] = 10; + if (e.childNodes[10] != null) + return; - if (e.lastChild.tagName != e.childNodes[1].tagName) - return; + if (e.firstChild.tagName != e.childNodes[0].tagName) + return; - if (e.previousSibling != null) - return; + if (e.lastChild.tagName != e.childNodes[1].tagName) + return; - if (e.nextSibling != null) - return; + if (e.previousSibling != null) + return; - if (e.attributes == null) - return; + if (e.nextSibling != null) + return; - if (e.attributes.length != 2) - return; + if (e.attributes == null) + return; - var attr1 = e.attributes["attr"]; - if (attr1.nodeValue != "value") - return; + if (e.attributes.length != 2) + return; - var attrIdx = e.attributes[0]; - if (attrIdx.nodeValue != "value") - return; + var attr1 = e.attributes["attr"]; + if (attr1.nodeValue != "value") + return; - var attr2 = e.attributes["attr2"]; - if (attr2.nodeValue != "value2") - return; + var attrIdx = e.attributes[0]; + if (attrIdx.nodeValue != "value") + return; - var attr3 = e.attributes["attr3"]; - if (attr3 != null) - return; + var attr2 = e.attributes["attr2"]; + if (attr2.nodeValue != "value2") + return; - var attrIdx2 = e.attributes[11]; - if (attrIdx2 != null) - return; + var attr3 = e.attributes["attr3"]; + if (attr3 != null) + return; - // Check writing fails - e.attributes[0] = null; - if (e.attributes[0] == null) - return; + var attrIdx2 = e.attributes[11]; + if (attrIdx2 != null) + return; - e.attributes["attr"] = null; - if (e.attributes["attr"] == null) - return; + // Check writing fails + e.attributes[0] = null; + if (e.attributes[0] == null) + return; - e.attributes["attr3"] = 10; - if (e.attributes["attr3"] != null) - return; + e.attributes["attr"] = null; + if (e.attributes["attr"] == null) + return; - // Check person and fruit sub elements - if (person.parentNode.nodeName != "root") - return; + e.attributes["attr3"] = 10; + if (e.attributes["attr3"] != null) + return; - if (person.previousSibling != null) - return; + // Check person and fruit sub elements + if (person.parentNode.nodeName != "root") + return; - if (person.nextSibling.nodeName != "fruit") - return; + if (person.previousSibling != null) + return; - if (fruit.parentNode.nodeName != "root") - return; + if (person.nextSibling.nodeName != "fruit") + return; - if (fruit.previousSibling.nodeName != "person") - return; + if (fruit.parentNode.nodeName != "root") + return; - if (fruit.nextSibling != null) - return; + if (fruit.previousSibling.nodeName != "person") + return; - xmlTest = true; - } + if (fruit.nextSibling != null) + return; - function checkXML(document) - { - checkElement(document.documentElement, - document.documentElement.childNodes[0], - document.documentElement.childNodes[1]); - } + xmlTest = true; + } + + function checkXML(document) + { + checkElement(document.documentElement, + document.documentElement.childNodes[0], + document.documentElement.childNodes[1]); } Component.onCompleted: { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/text.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/text.qml index 4615a07..0eb31d5 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/text.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/text.qml @@ -4,105 +4,103 @@ QtObject { property bool xmlTest: false property bool dataOK: false - Script { - function checkText(text, whitespacetext) - { - if (text == null) - return; + function checkText(text, whitespacetext) + { + if (text == null) + return; - if (text.nodeName != "#text") - return; + if (text.nodeName != "#text") + return; - if (text.nodeValue != "Hello world!") - return; + if (text.nodeValue != "Hello world!") + return; - if (text.nodeType != 3) - return; + if (text.nodeType != 3) + return; - if (text.parentNode.nodeName != "item") - return; + if (text.parentNode.nodeName != "item") + return; - if (text.childNodes.length != 0) - return; + if (text.childNodes.length != 0) + return; - if (text.firstChild != null) - return; + if (text.firstChild != null) + return; - if (text.lastChild != null) - return; + if (text.lastChild != null) + return; - if (text.previousSibling != null) - return; + if (text.previousSibling != null) + return; - if (text.nextSibling != null) - return; + if (text.nextSibling != null) + return; - if (text.attributes != null) - return; + if (text.attributes != null) + return; - if (text.wholeText != "Hello world!") - return; + if (text.wholeText != "Hello world!") + return; - if (text.data != "Hello world!") - return; + if (text.data != "Hello world!") + return; - if (text.length != 12) - return; + if (text.length != 12) + return; - if (text.isElementContentWhitespace != false) - return; + if (text.isElementContentWhitespace != false) + return; - if (whitespacetext.nodeName != "#text") - return; + if (whitespacetext.nodeName != "#text") + return; - if (whitespacetext.nodeValue != " ") - return; + if (whitespacetext.nodeValue != " ") + return; - if (whitespacetext.nodeType != 3) - return; + if (whitespacetext.nodeType != 3) + return; - if (whitespacetext.parentNode.nodeName != "item") - return; + if (whitespacetext.parentNode.nodeName != "item") + return; - if (whitespacetext.childNodes.length != 0) - return; + if (whitespacetext.childNodes.length != 0) + return; - if (whitespacetext.firstChild != null) - return; + if (whitespacetext.firstChild != null) + return; - if (whitespacetext.lastChild != null) - return; + if (whitespacetext.lastChild != null) + return; - if (whitespacetext.previousSibling != null) - return; + if (whitespacetext.previousSibling != null) + return; - if (whitespacetext.nextSibling != null) - return; + if (whitespacetext.nextSibling != null) + return; - if (whitespacetext.attributes != null) - return; + if (whitespacetext.attributes != null) + return; - if (whitespacetext.wholeText != " ") - return; + if (whitespacetext.wholeText != " ") + return; - if (whitespacetext.data != " ") - return; + if (whitespacetext.data != " ") + return; - if (whitespacetext.length != 3) - return; + if (whitespacetext.length != 3) + return; - if (whitespacetext.isElementContentWhitespace != true) - return; + if (whitespacetext.isElementContentWhitespace != true) + return; - xmlTest = true; - } + xmlTest = true; + } - function checkXML(document) - { - checkText(document.documentElement.childNodes[0].childNodes[0], - document.documentElement.childNodes[1].childNodes[0]); + function checkXML(document) + { + checkText(document.documentElement.childNodes[0].childNodes[0], + document.documentElement.childNodes[1].childNodes[0]); - } } Component.onCompleted: { diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp index e8a5e0c..1bab2d2 100644 --- a/tests/auto/declarative/sql/tst_sql.cpp +++ b/tests/auto/declarative/sql/tst_sql.cpp @@ -197,11 +197,13 @@ void tst_sql::testQml() QString qml= "import Qt 4.6\n" - "Text { Script { source: \""+jsfile+"\" } text: test() }"; + "import \""+jsfile+"\" as JS\n" + "Text { text: JS.test() }"; engine->setOfflineStoragePath(dbDir()); QDeclarativeComponent component(engine); component.setData(qml.toUtf8(), QUrl::fromLocalFile(SRCDIR "/empty.qml")); // just a file for relative local imports + QVERIFY(!component.isError()); QDeclarativeText *text = qobject_cast(component.create()); QVERIFY(text != 0); QCOMPARE(text->text(),QString("passed")); -- cgit v0.12 From 6b72c03fdf3470f405e4d6f4c821ccf2cda99b4e Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 13:13:41 +1000 Subject: Remove usage of Script where not actually testing the obsolete construct. --- tests/auto/declarative/parserstress/tst_parserstress.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp index 6ff5515..ee246fa 100644 --- a/tests/auto/declarative/parserstress/tst_parserstress.cpp +++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp @@ -121,10 +121,8 @@ void tst_parserstress::ecmascript() qml+= dataStr + "\n"; qml+= " return 1;\n"; qml+= " }\n"; - qml+= " Script {\n"; - qml+= " function stress() {\n"; + qml+= " function stress() {\n"; qml+= dataStr; - qml+= " }\n"; qml+= " }\n"; qml+= "}\n"; -- cgit v0.12 From dcce90c4d9c8d010d7fc45c33048ff00e468b89c Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 8 Apr 2010 13:09:57 +1000 Subject: Revert "Add QListModelInterface::modelReset() signal and emit this in" This reverts commit 973cfce37fcdd1ce330f237eaa76930db55a73f6. Need more consideration before adding modelReset(). For example if item insertion/removal is supposed to trigger animations through added/removed signals, they won't be triggered if only the modelReset() signal is emitted. Also if we add modelReset(), it should also be implemented for ListModel to make sure it is implemented by all subclasses of QListModelInterface and to test the impact of this on the view classes. --- src/declarative/3rdparty/qlistmodelinterface.cpp | 6 --- src/declarative/3rdparty/qlistmodelinterface_p.h | 1 - .../graphicsitems/qdeclarativevisualitemmodel.cpp | 2 - src/declarative/util/qdeclarativexmllistmodel.cpp | 25 +++++----- src/declarative/util/qdeclarativexmllistmodel_p.h | 1 - .../tst_qdeclarativexmllistmodel.cpp | 54 ++++++++++++++-------- 6 files changed, 46 insertions(+), 43 deletions(-) diff --git a/src/declarative/3rdparty/qlistmodelinterface.cpp b/src/declarative/3rdparty/qlistmodelinterface.cpp index 20501a0..98d6a5b 100644 --- a/src/declarative/3rdparty/qlistmodelinterface.cpp +++ b/src/declarative/3rdparty/qlistmodelinterface.cpp @@ -106,10 +106,4 @@ QT_BEGIN_NAMESPACE \a roles changed. */ -/*! \fn void QListModelInterface::modelReset() - Emit this signal when all of the model data has changed. - This is more efficient than forcing the receivier to handle multiple - inserted and removed signals etc. -*/ - QT_END_NAMESPACE diff --git a/src/declarative/3rdparty/qlistmodelinterface_p.h b/src/declarative/3rdparty/qlistmodelinterface_p.h index da91d12..07592ad 100644 --- a/src/declarative/3rdparty/qlistmodelinterface_p.h +++ b/src/declarative/3rdparty/qlistmodelinterface_p.h @@ -72,7 +72,6 @@ class Q_DECLARATIVE_EXPORT QListModelInterface : public QObject void itemsRemoved(int index, int count); void itemsMoved(int from, int to, int count); void itemsChanged(int index, int count, const QList &roles); - void modelReset(); protected: QListModelInterface(QObjectPrivate &dd, QObject *parent) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 174459b..dfd9c0c 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -662,7 +662,6 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model) this, SLOT(_q_itemsRemoved(int,int))); QObject::disconnect(d->m_listModelInterface, SIGNAL(itemsMoved(int,int,int)), this, SLOT(_q_itemsMoved(int,int,int))); - QObject::disconnect(d->m_listModelInterface, SIGNAL(modelReset()), this, SLOT(_q_modelReset())); d->m_listModelInterface = 0; } else if (d->m_abstractItemModel) { QObject::disconnect(d->m_abstractItemModel, SIGNAL(rowsInserted(const QModelIndex &,int,int)), @@ -706,7 +705,6 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model) this, SLOT(_q_itemsRemoved(int,int))); QObject::connect(d->m_listModelInterface, SIGNAL(itemsMoved(int,int,int)), this, SLOT(_q_itemsMoved(int,int,int))); - QObject::connect(d->m_listModelInterface, SIGNAL(modelReset()), this, SLOT(_q_modelReset())); d->m_metaDataCacheable = true; if (d->m_delegate && d->m_listModelInterface->count()) emit itemsInserted(0, d->m_listModelInterface->count()); diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 11c7305..b33af06 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -878,22 +878,21 @@ void QDeclarativeXmlListModel::queryCompleted(const QDeclarativeXmlQueryResult & } } if (!hasKeys) { - if (!(origCount == 0 && d->size == 0)) - emit modelReset(); + if (!(origCount == 0 && d->size == 0)) { + emit itemsRemoved(0, origCount); + emit itemsInserted(0, d->size); + emit countChanged(); + } } else { - if (result.removed.count() == 1 && result.removed[0].first == 0 - && result.removed[0].second == origCount) { - emit modelReset(); - } else { - for (int i=0; istatus); diff --git a/src/declarative/util/qdeclarativexmllistmodel_p.h b/src/declarative/util/qdeclarativexmllistmodel_p.h index fd410a7..7b85476 100644 --- a/src/declarative/util/qdeclarativexmllistmodel_p.h +++ b/src/declarative/util/qdeclarativexmllistmodel_p.h @@ -124,7 +124,6 @@ Q_SIGNALS: void xmlChanged(); void queryChanged(); void namespaceDeclarationsChanged(); - void modelReset(); public Q_SLOTS: // ### need to use/expose Expiry to guess when to call this? diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp index ba0f9a7..74da79e 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp +++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp @@ -378,16 +378,17 @@ void tst_qdeclarativexmllistmodel::reload() QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int))); QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int))); QSignalSpy spyCount(model, SIGNAL(countChanged())); - QSignalSpy spyReset(model, SIGNAL(modelReset())); model->reload(); - QTRY_COMPARE(spyReset.count(), 1); - QCOMPARE(spyCount.count(), 0); - QCOMPARE(spyInsert.count(), 0); - QCOMPARE(spyRemove.count(), 0); + QTRY_COMPARE(spyCount.count(), 1); + QTRY_COMPARE(spyInsert.count(), 1); + QTRY_COMPARE(spyRemove.count(), 1); + + QCOMPARE(spyInsert[0][0].toInt(), 0); + QCOMPARE(spyInsert[0][1].toInt(), 9); - QCOMPARE(model->data(0, model->roles().first()).toString(), QString("Polly")); - QCOMPARE(model->data(model->count()-1, model->roles().first()).toString(), QString("Tiny")); + QCOMPARE(spyRemove[0][0].toInt(), 0); + QCOMPARE(spyRemove[0][1].toInt(), 9); delete model; } @@ -415,15 +416,15 @@ void tst_qdeclarativexmllistmodel::useKeys() QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int))); QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int))); QSignalSpy spyCount(model, SIGNAL(countChanged())); - QSignalSpy spyReset(model, SIGNAL(modelReset())); model->setXml(newXml); - if (insertRanges.isEmpty() && removeRanges.isEmpty()) { - QTRY_COMPARE(spyReset.count(), 1); + if (oldCount != newData.count()) { + QTRY_COMPARE(model->count(), newData.count()); + QCOMPARE(spyCount.count(), 1); } else { QTRY_VERIFY(spyInsert.count() > 0 || spyRemove.count() > 0); - QCOMPARE(spyCount.count() == 0, oldCount == newData.count()); + QCOMPARE(spyCount.count(), 0); } QList roles = model->roles(); @@ -512,14 +513,21 @@ void tst_qdeclarativexmllistmodel::useKeys_data() << makeItemXmlAndData("", &modelData) << modelData << QList() - << QList(); + << (QList() << qMakePair(0, 3)); QTest::newRow("replace item") << makeItemXmlAndData("name=A,age=25,sport=Football") << 1 << makeItemXmlAndData("name=ZZZ,age=25,sport=Football", &modelData) << modelData - << QList() - << QList(); + << (QList() << qMakePair(0, 1)) + << (QList() << qMakePair(0, 1)); + + QTest::newRow("add and remove simultaneously, in different spots") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf") << 4 + << makeItemXmlAndData("name=B,age=35,sport=Athletics;name=E,age=65,sport=Fencing", &modelData) + << modelData + << (QList() << qMakePair(1, 1)) + << (QList() << qMakePair(0, 1) << qMakePair(2,2)); QTest::newRow("insert at start, remove at end i.e. rss feed") << makeItemXmlAndData("name=C,age=45,sport=Curling;name=D,age=55,sport=Golf;name=E,age=65,sport=Fencing") << 3 @@ -539,8 +547,8 @@ void tst_qdeclarativexmllistmodel::useKeys_data() << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35") << 2 << makeItemXmlAndData("name=C,age=45,sport=Curling;name=D,age=55,sport=Golf", &modelData) << modelData - << QList() - << QList(); + << (QList() << qMakePair(0, 2)) + << (QList() << qMakePair(0, 2)); } void tst_qdeclarativexmllistmodel::noKeysValueChanges() @@ -600,14 +608,20 @@ void tst_qdeclarativexmllistmodel::keysChanged() QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int))); QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int))); QSignalSpy spyCount(model, SIGNAL(countChanged())); - QSignalSpy spyReset(model, SIGNAL(modelReset())); QVERIFY(QMetaObject::invokeMethod(model, "disableNameKey")); model->setXml(xml); - QTRY_COMPARE(spyReset.count(), 1); - QCOMPARE(spyInsert.count(), 0); - QCOMPARE(spyRemove.count(), 0); + QTRY_VERIFY(spyInsert.count() > 0 && spyRemove.count() > 0); + + QCOMPARE(spyInsert.count(), 1); + QCOMPARE(spyInsert[0][0].toInt(), 0); + QCOMPARE(spyInsert[0][1].toInt(), 2); + + QCOMPARE(spyRemove.count(), 1); + QCOMPARE(spyRemove[0][0].toInt(), 0); + QCOMPARE(spyRemove[0][1].toInt(), 2); + QCOMPARE(spyCount.count(), 0); delete model; -- cgit v0.12 From e956369606363c1ecce4287567b210dbde66e676 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 13:28:22 +1000 Subject: Remove error-tests of obsolete Script element. --- .../qdeclarativelanguage/data/script.1.errors.txt | 1 - .../auto/declarative/qdeclarativelanguage/data/script.1.qml | 4 ---- .../qdeclarativelanguage/data/script.10.errors.txt | 1 - .../declarative/qdeclarativelanguage/data/script.10.qml | 9 --------- .../qdeclarativelanguage/data/script.11.errors.txt | 1 - .../declarative/qdeclarativelanguage/data/script.11.qml | 7 ------- .../qdeclarativelanguage/data/script.12.errors.txt | 1 - .../declarative/qdeclarativelanguage/data/script.12.qml | 6 ------ .../qdeclarativelanguage/data/script.2.errors.txt | 1 - .../auto/declarative/qdeclarativelanguage/data/script.2.qml | 7 ------- .../qdeclarativelanguage/data/script.3.errors.txt | 1 - .../auto/declarative/qdeclarativelanguage/data/script.3.qml | 7 ------- .../qdeclarativelanguage/data/script.4.errors.txt | 1 - .../auto/declarative/qdeclarativelanguage/data/script.4.qml | 8 -------- .../qdeclarativelanguage/data/script.5.errors.txt | 1 - .../auto/declarative/qdeclarativelanguage/data/script.5.qml | 9 --------- .../qdeclarativelanguage/data/script.6.errors.txt | 1 - .../auto/declarative/qdeclarativelanguage/data/script.6.qml | 11 ----------- .../qdeclarativelanguage/data/script.7.errors.txt | 1 - .../auto/declarative/qdeclarativelanguage/data/script.7.qml | 11 ----------- .../qdeclarativelanguage/data/script.8.errors.txt | 1 - .../auto/declarative/qdeclarativelanguage/data/script.8.qml | 9 --------- .../qdeclarativelanguage/data/script.9.errors.txt | 1 - .../auto/declarative/qdeclarativelanguage/data/script.9.qml | 7 ------- .../qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 13 ------------- 25 files changed, 120 deletions(-) delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.1.errors.txt delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.1.qml delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.10.errors.txt delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.10.qml delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.11.errors.txt delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.11.qml delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.12.errors.txt delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.12.qml delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.2.errors.txt delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.2.qml delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.3.errors.txt delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.3.qml delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.4.errors.txt delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.4.qml delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.5.errors.txt delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.5.qml delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.6.errors.txt delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.6.qml delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.7.errors.txt delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.7.qml delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.8.qml delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.9.errors.txt delete mode 100644 tests/auto/declarative/qdeclarativelanguage/data/script.9.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.1.errors.txt deleted file mode 100644 index 50518cc..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.1.errors.txt +++ /dev/null @@ -1 +0,0 @@ -3:1:Invalid use of Script block diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.1.qml deleted file mode 100644 index 8dac8b7..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.1.qml +++ /dev/null @@ -1,4 +0,0 @@ -import Qt 4.6 - -Script { -} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.10.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.10.errors.txt deleted file mode 100644 index 13f47d1..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.10.errors.txt +++ /dev/null @@ -1 +0,0 @@ -6:9:Component elements may not contain script blocks diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.10.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.10.qml deleted file mode 100644 index 516e878..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.10.qml +++ /dev/null @@ -1,9 +0,0 @@ -import Qt 4.6 - -Item { - Component { - Item {} - Script {} - } -} - diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.11.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.11.errors.txt deleted file mode 100644 index a664203..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.11.errors.txt +++ /dev/null @@ -1 +0,0 @@ -5:9:Invalid Script block diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.11.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.11.qml deleted file mode 100644 index 6d2d598..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.11.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Qt 4.6 - -QtObject { - Script { - QtObject {} - } -} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.12.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.12.errors.txt deleted file mode 100644 index f8297f5..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.12.errors.txt +++ /dev/null @@ -1 +0,0 @@ -4:5:JavaScript declaration outside Script element diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.12.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.12.qml deleted file mode 100644 index 9ecb5d9..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.12.qml +++ /dev/null @@ -1,6 +0,0 @@ -import Qt 4.6 - -QtObject { - var a -} - diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.2.errors.txt deleted file mode 100644 index 8fb3bbd..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.2.errors.txt +++ /dev/null @@ -1 +0,0 @@ -5:9:Properties cannot be set on Script block diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.2.qml deleted file mode 100644 index dce1a41..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.2.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Qt 4.6 - -QtObject { - Script { - id: myScript - } -} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.3.errors.txt deleted file mode 100644 index 8fb3bbd..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.3.errors.txt +++ /dev/null @@ -1 +0,0 @@ -5:9:Properties cannot be set on Script block diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.3.qml deleted file mode 100644 index 8621a9a..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.3.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Qt 4.6 - -QtObject { - Script { - hello: world - } -} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.4.errors.txt deleted file mode 100644 index 49a507f..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.4.errors.txt +++ /dev/null @@ -1 +0,0 @@ -5:9:Invalid Script source value diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.4.qml deleted file mode 100644 index d89817c..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.4.qml +++ /dev/null @@ -1,8 +0,0 @@ -import Qt 4.6 - -QtObject { - Script { - source: 10 - } -} - diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.5.errors.txt deleted file mode 100644 index 49a507f..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.5.errors.txt +++ /dev/null @@ -1 +0,0 @@ -5:9:Invalid Script source value diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.5.qml deleted file mode 100644 index 8986b3b..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.5.qml +++ /dev/null @@ -1,9 +0,0 @@ -import Qt 4.6 - -QtObject { - Script { - source: "hello" + ".js" - } -} - - diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.6.errors.txt deleted file mode 100644 index 4e53b6b..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.6.errors.txt +++ /dev/null @@ -1 +0,0 @@ -5:9:Invalid Script block. Specify either the source property or inline script diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.6.qml deleted file mode 100644 index 07e9d78..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.6.qml +++ /dev/null @@ -1,11 +0,0 @@ -import Qt 4.6 - -QtObject { - Script { - source: "test.js" - function helloWorld() {} - } -} - - - diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.7.errors.txt deleted file mode 100644 index dc15ddf..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.7.errors.txt +++ /dev/null @@ -1 +0,0 @@ -5:9:Variable declarations not allow in inline Script blocks diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.7.qml deleted file mode 100644 index fa905e6..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.7.qml +++ /dev/null @@ -1,11 +0,0 @@ -import Qt 4.6 - -QtObject { - Script { - var a = 10; - } -} - - - - diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt deleted file mode 100644 index 450fc16..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt +++ /dev/null @@ -1 +0,0 @@ -6:9:Property value set multiple times diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.8.qml deleted file mode 100644 index f600c88..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.8.qml +++ /dev/null @@ -1,9 +0,0 @@ -import Qt 4.6 - -QtObject { - Script { - source: "test.js" - source: "test2.js" - } -} - diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.9.errors.txt deleted file mode 100644 index 41e8d46..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.9.errors.txt +++ /dev/null @@ -1 +0,0 @@ -5:9:Component elements may not contain script blocks diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.9.qml deleted file mode 100644 index 79aa504..0000000 --- a/tests/auto/declarative/qdeclarativelanguage/data/script.9.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Qt 4.6 - -Item { - Component { - Script {} - } -} diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index dcd72d2..0e0bfda 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -283,19 +283,6 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("property.6") << "property.6.qml" << "property.6.errors.txt" << false; QTest::newRow("property.7") << "property.7.qml" << "property.7.errors.txt" << false; - QTest::newRow("Script.1") << "script.1.qml" << "script.1.errors.txt" << false; - QTest::newRow("Script.2") << "script.2.qml" << "script.2.errors.txt" << false; - QTest::newRow("Script.3") << "script.3.qml" << "script.3.errors.txt" << false; - QTest::newRow("Script.4") << "script.4.qml" << "script.4.errors.txt" << false; - QTest::newRow("Script.5") << "script.5.qml" << "script.5.errors.txt" << false; - QTest::newRow("Script.6") << "script.6.qml" << "script.6.errors.txt" << false; - QTest::newRow("Script.7") << "script.7.qml" << "script.7.errors.txt" << false; - QTest::newRow("Script.8") << "script.8.qml" << "script.8.errors.txt" << false; - QTest::newRow("Script.9") << "script.9.qml" << "script.9.errors.txt" << false; - QTest::newRow("Script.10") << "script.10.qml" << "script.10.errors.txt" << false; - QTest::newRow("Script.11") << "script.11.qml" << "script.11.errors.txt" << false; - QTest::newRow("Script.12") << "script.12.qml" << "script.12.errors.txt" << false; - QTest::newRow("Component.1") << "component.1.qml" << "component.1.errors.txt" << false; QTest::newRow("Component.2") << "component.2.qml" << "component.2.errors.txt" << false; QTest::newRow("Component.3") << "component.3.qml" << "component.3.errors.txt" << false; -- cgit v0.12 From 9fed46c4420a594965b3bff1648cae8fe4e404f5 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 13:45:34 +1000 Subject: Fix location of error message. --- src/declarative/qml/qdeclarativescriptparser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index cba5bb9..b4938bb 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -488,8 +488,8 @@ bool ProcessAST::visit(AST::UiImport *node) } else if (import.type == QDeclarativeScriptParser::Import::Script) { QDeclarativeError error; error.setDescription(QCoreApplication::translate("QDeclarativeParser","Script import requires a qualifier")); - error.setLine(node->importIdToken.startLine); - error.setColumn(node->importIdToken.startColumn); + error.setLine(node->fileNameToken.startLine); + error.setColumn(node->fileNameToken.startColumn); _parser->_errors << error; return false; } -- cgit v0.12 From 4e4fb93e1735ec0cb869a258babcd802dbab84dc Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 13:46:05 +1000 Subject: Test import of a script requires qualifier. --- .../declarative/qdeclarativelanguage/data/importscript.1.errors.txt | 1 + tests/auto/declarative/qdeclarativelanguage/data/importscript.1.qml | 3 +++ .../auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 2 ++ 3 files changed, 6 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/importscript.1.errors.txt create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/importscript.1.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importscript.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importscript.1.errors.txt new file mode 100644 index 0000000..ebc936d --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importscript.1.errors.txt @@ -0,0 +1 @@ +1:8:Script import requires a qualifier diff --git a/tests/auto/declarative/qdeclarativelanguage/data/importscript.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/importscript.1.qml new file mode 100644 index 0000000..2b2ab6b --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/importscript.1.qml @@ -0,0 +1,3 @@ +import "test.js" + +Item { } diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 0e0bfda..bf10a01 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -283,6 +283,8 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("property.6") << "property.6.qml" << "property.6.errors.txt" << false; QTest::newRow("property.7") << "property.7.qml" << "property.7.errors.txt" << false; + QTest::newRow("importScript.1") << "importscript.1.qml" << "importscript.1.errors.txt" << false; + QTest::newRow("Component.1") << "component.1.qml" << "component.1.errors.txt" << false; QTest::newRow("Component.2") << "component.2.qml" << "component.2.errors.txt" << false; QTest::newRow("Component.3") << "component.3.qml" << "component.3.errors.txt" << false; -- cgit v0.12 From 380922ee0b36d6c8c948f149d3653265306fad41 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 13:57:40 +1000 Subject: Remove usage of Script where not actually testing the obsolete construct. --- .../auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml index 05459f4..785c250 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml @@ -1,12 +1,11 @@ import Test 1.0 import Qt 4.6 +import "deletedObject.js" as JS MyTypeObject { property var object - Script { source: "deletedObject.js" } - object: MyTypeObject {} - Component.onCompleted: startup() - onRunScript: afterDelete() + Component.onCompleted: JS.startup() + onRunScript: JS.afterDelete() } -- cgit v0.12 From 7a092995df36cf5ae380bbebb2828ad468072efc Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 13:58:04 +1000 Subject: Initialize QDeclarativeData even when not using a QDeclarativeEngine Caused crashes in various test cases --- src/declarative/qml/qdeclarativedeclarativedata_p.h | 12 +++++++++++- src/declarative/qml/qdeclarativeengine.cpp | 7 +++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/declarative/qml/qdeclarativedeclarativedata_p.h b/src/declarative/qml/qdeclarativedeclarativedata_p.h index 87c5c9c..5b12629 100644 --- a/src/declarative/qml/qdeclarativedeclarativedata_p.h +++ b/src/declarative/qml/qdeclarativedeclarativedata_p.h @@ -75,7 +75,17 @@ public: : ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false), context(0), outerContext(0), bindings(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0), bindingBits(0), lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0), - attachedProperties(0), scriptValue(0), propertyCache(0), guards(0) {} + attachedProperties(0), scriptValue(0), propertyCache(0), guards(0) { + init(); + } + + static inline void init() { + QDeclarativeData::destroyed = destroyed; + QDeclarativeData::parentChanged = parentChanged; + } + + static void destroyed(QDeclarativeData *, QObject *); + static void parentChanged(QDeclarativeData *, QObject *, QObject *); void destroyed(QObject *); void parentChanged(QObject *, QObject *); diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index f5fe140..44437ea 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -346,12 +346,12 @@ typedef QMap StringStringMap; Q_GLOBAL_STATIC(StringStringMap, qmlEnginePluginsWithRegisteredTypes); // stores the uri -static void QDeclarativeDeclarativeData_destroyed(QDeclarativeData *d, QObject *o) +void QDeclarativeDeclarativeData::destroyed(QDeclarativeData *d, QObject *o) { static_cast(d)->destroyed(o); } -static void QDeclarativeDeclarativeData_parentChanged(QDeclarativeData *d, QObject *o, QObject *p) +void QDeclarativeDeclarativeData::parentChanged(QDeclarativeData *d, QObject *o, QObject *p) { static_cast(d)->parentChanged(o, p); } @@ -363,8 +363,7 @@ void QDeclarativeEnginePrivate::init() qRegisterMetaType("QDeclarativeScriptString"); qRegisterMetaType("QScriptValue"); - QDeclarativeData::destroyed = QDeclarativeDeclarativeData_destroyed; - QDeclarativeData::parentChanged = QDeclarativeDeclarativeData_parentChanged; + QDeclarativeDeclarativeData::init(); contextClass = new QDeclarativeContextScriptClass(q); objectClass = new QDeclarativeObjectScriptClass(q); -- cgit v0.12 From 948263bf4bdfec1383f22fc0db50bafca2f8b5c8 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 14:01:18 +1000 Subject: Correctly handle shutdown order in the presence of QWidgets The QWidget destructor is largely a copy of the QObject destructor. QML shutdown occurs in a slightly different order in this case. --- src/declarative/qml/qdeclarativecontext_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativecontext_p.h b/src/declarative/qml/qdeclarativecontext_p.h index 6c5a1f7..eee72b6 100644 --- a/src/declarative/qml/qdeclarativecontext_p.h +++ b/src/declarative/qml/qdeclarativecontext_p.h @@ -174,7 +174,7 @@ public: inline ContextGuard &operator=(QObject *obj) { QDeclarativeGuard::operator=(obj); return *this; } virtual void objectDestroyed(QObject *) { - if (!QObjectPrivate::get(context->contextObject)->wasDeleted) bindings.notify(); + if (context->contextObject && !QObjectPrivate::get(context->contextObject)->wasDeleted) bindings.notify(); } QDeclarativeContextData *context; QDeclarativeNotifier bindings; -- cgit v0.12 From 23e57fcf957bf6337591656ea0071df1b0bd9651 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 14:13:41 +1000 Subject: unwarn --- tests/auto/declarative/qdeclarativevaluetypes/testtypes.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h index 0ad8449..64e4980 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h +++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h @@ -134,6 +134,7 @@ QML_DECLARE_TYPE(MyTypeObject); class MyConstantValueSource : public QObject, public QDeclarativePropertyValueSource { Q_OBJECT + Q_INTERFACES(QDeclarativePropertyValueSource) public: virtual void setTarget(const QDeclarativeProperty &p) { p.write(3345); } }; @@ -142,6 +143,7 @@ QML_DECLARE_TYPE(MyConstantValueSource); class MyOffsetValueInterceptor : public QObject, public QDeclarativePropertyValueInterceptor { Q_OBJECT + Q_INTERFACES(QDeclarativePropertyValueInterceptor) public: virtual void setTarget(const QDeclarativeProperty &p) { prop = p; } virtual void write(const QVariant &value) { QDeclarativePropertyPrivate::write(prop, value.toInt() + 13, QDeclarativePropertyPrivate::BypassInterceptor); } -- cgit v0.12 From 76f5e9e7d1eea8d688d5459b7b7b2bfa3f9057ed Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 14:19:28 +1000 Subject: Don't optimized extended type construction --- src/declarative/qml/qdeclarativecompiler.cpp | 2 +- src/declarative/qml/qdeclarativemetatype.cpp | 7 +++++++ src/declarative/qml/qdeclarativemetatype_p.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index b12d6f4..f20ffa6 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -882,7 +882,7 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj) // Create the object if (obj->custom.isEmpty() && output->types.at(obj->type).type && - obj != compileState.root) { + !output->types.at(obj->type).type->isExtendedType() && obj != compileState.root) { QDeclarativeInstruction create; create.type = QDeclarativeInstruction::CreateSimpleObject; diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp index 56cc219..7b71608 100644 --- a/src/declarative/qml/qdeclarativemetatype.cpp +++ b/src/declarative/qml/qdeclarativemetatype.cpp @@ -328,6 +328,13 @@ bool QDeclarativeType::isCreatable() const return d->m_newFunc != 0; } +bool QDeclarativeType::isExtendedType() const +{ + d->init(); + + return !d->m_metaObjects.isEmpty(); +} + bool QDeclarativeType::isInterface() const { return d->m_isInterface; diff --git a/src/declarative/qml/qdeclarativemetatype_p.h b/src/declarative/qml/qdeclarativemetatype_p.h index 96e3c74..70b7c90 100644 --- a/src/declarative/qml/qdeclarativemetatype_p.h +++ b/src/declarative/qml/qdeclarativemetatype_p.h @@ -122,6 +122,7 @@ public: QDeclarativeCustomParser *customParser() const; bool isCreatable() const; + bool isExtendedType() const; bool isInterface() const; int typeId() const; -- cgit v0.12 From 4e86f05efe32275117f686d6ae3b39eb0a7621af Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 8 Apr 2010 13:21:11 +1000 Subject: Replace "import Qt 4.6" with "import Qt 4.7" --- demos/declarative/calculator/CalcButton.qml | 2 +- demos/declarative/calculator/calculator.qml | 2 +- demos/declarative/flickr/common/LikeOMeter.qml | 2 +- demos/declarative/flickr/common/Loading.qml | 2 +- demos/declarative/flickr/common/Progress.qml | 2 +- demos/declarative/flickr/common/RssModel.qml | 2 +- demos/declarative/flickr/common/ScrollBar.qml | 2 +- demos/declarative/flickr/common/Slider.qml | 2 +- demos/declarative/flickr/common/Star.qml | 2 +- demos/declarative/flickr/flickr-90.qml | 2 +- demos/declarative/flickr/flickr.qml | 2 +- demos/declarative/flickr/mobile/Button.qml | 2 +- demos/declarative/flickr/mobile/GridDelegate.qml | 2 +- demos/declarative/flickr/mobile/ImageDetails.qml | 2 +- demos/declarative/flickr/mobile/ListDelegate.qml | 2 +- demos/declarative/flickr/mobile/TitleBar.qml | 2 +- demos/declarative/flickr/mobile/ToolBar.qml | 2 +- demos/declarative/minehunt/MinehuntCore/Explosion.qml | 2 +- demos/declarative/minehunt/minehunt.qml | 2 +- .../declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml | 2 +- .../declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml | 2 +- demos/declarative/photoviewer/PhotoViewerCore/Button.qml | 2 +- .../declarative/photoviewer/PhotoViewerCore/EditableButton.qml | 2 +- .../declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml | 2 +- demos/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml | 2 +- demos/declarative/photoviewer/PhotoViewerCore/RssModel.qml | 2 +- demos/declarative/photoviewer/PhotoViewerCore/Tag.qml | 2 +- demos/declarative/photoviewer/photoviewer.qml | 2 +- demos/declarative/samegame/SamegameCore/BoomBlock.qml | 2 +- demos/declarative/samegame/SamegameCore/Button.qml | 2 +- demos/declarative/samegame/SamegameCore/Dialog.qml | 2 +- demos/declarative/samegame/samegame.qml | 2 +- demos/declarative/snake/content/Button.qml | 2 +- demos/declarative/snake/content/Cookie.qml | 2 +- demos/declarative/snake/content/HighScoreModel.qml | 2 +- demos/declarative/snake/content/Link.qml | 2 +- demos/declarative/snake/content/Skull.qml | 2 +- demos/declarative/snake/snake.qml | 2 +- demos/declarative/twitter/TwitterCore/AuthView.qml | 2 +- demos/declarative/twitter/TwitterCore/Button.qml | 2 +- demos/declarative/twitter/TwitterCore/FatDelegate.qml | 2 +- demos/declarative/twitter/TwitterCore/HomeTitleBar.qml | 2 +- demos/declarative/twitter/TwitterCore/Loading.qml | 2 +- demos/declarative/twitter/TwitterCore/MultiTitleBar.qml | 2 +- demos/declarative/twitter/TwitterCore/RssModel.qml | 2 +- demos/declarative/twitter/TwitterCore/TitleBar.qml | 2 +- demos/declarative/twitter/TwitterCore/ToolBar.qml | 2 +- demos/declarative/twitter/TwitterCore/UserModel.qml | 2 +- demos/declarative/twitter/twitter.qml | 2 +- demos/declarative/webbrowser/content/FlickableWebView.qml | 2 +- demos/declarative/webbrowser/content/RectSoftShadow.qml | 2 +- .../webbrowser/content/RetractingWebBrowserHeader.qml | 2 +- demos/declarative/webbrowser/content/fieldtext/FieldText.qml | 2 +- demos/declarative/webbrowser/webbrowser.qml | 2 +- doc/src/declarative/dynamicobjects.qdoc | 2 +- doc/src/declarative/globalobject.qdoc | 2 +- doc/src/declarative/modules.qdoc | 4 ++-- doc/src/declarative/qdeclarativedocument.qdoc | 8 ++++---- doc/src/declarative/qdeclarativei18n.qdoc | 2 +- doc/src/declarative/qtbinding.qdoc | 10 +++++----- doc/src/declarative/scope.qdoc | 10 +++++----- examples/declarative/animations/color-animation.qml | 2 +- examples/declarative/animations/easing.qml | 2 +- examples/declarative/animations/property-animation.qml | 2 +- examples/declarative/aspectratio/face_fit.qml | 2 +- examples/declarative/aspectratio/face_fit_animated.qml | 2 +- examples/declarative/aspectratio/scale_and_crop.qml | 2 +- examples/declarative/aspectratio/scale_and_crop_simple.qml | 2 +- examples/declarative/aspectratio/scale_and_sidecrop.qml | 2 +- examples/declarative/aspectratio/scale_to_fit.qml | 2 +- examples/declarative/aspectratio/scale_to_fit_simple.qml | 2 +- examples/declarative/behaviors/SideRect.qml | 2 +- examples/declarative/behaviors/behavior-example.qml | 2 +- examples/declarative/border-image/animated.qml | 2 +- examples/declarative/border-image/borders.qml | 2 +- examples/declarative/border-image/content/MyBorderImage.qml | 2 +- examples/declarative/clocks/clocks.qml | 2 +- examples/declarative/clocks/content/Clock.qml | 2 +- examples/declarative/connections/connections-example.qml | 2 +- examples/declarative/connections/content/Button.qml | 2 +- examples/declarative/dial/content/Dial.qml | 2 +- examples/declarative/dial/dial-example.qml | 2 +- examples/declarative/dynamic/dynamic.qml | 4 ++-- examples/declarative/dynamic/qml/Button.qml | 2 +- examples/declarative/dynamic/qml/GenericItem.qml | 2 +- examples/declarative/dynamic/qml/PaletteItem.qml | 2 +- examples/declarative/dynamic/qml/PerspectiveItem.qml | 2 +- examples/declarative/dynamic/qml/Sun.qml | 2 +- examples/declarative/effects/effects.qml | 2 +- examples/declarative/fillmode/fillmode.qml | 2 +- examples/declarative/flipable/content/Card.qml | 2 +- examples/declarative/flipable/flipable-example.qml | 2 +- examples/declarative/focus/Core/ContextMenu.qml | 2 +- examples/declarative/focus/Core/GridMenu.qml | 2 +- examples/declarative/focus/Core/ListViewDelegate.qml | 2 +- examples/declarative/focus/Core/ListViews.qml | 2 +- examples/declarative/focus/focus.qml | 2 +- examples/declarative/fonts/banner.qml | 2 +- examples/declarative/fonts/fonts.qml | 2 +- examples/declarative/fonts/hello.qml | 2 +- examples/declarative/gridview/gridview-example.qml | 2 +- examples/declarative/imageprovider/imageprovider-example.qml | 2 +- examples/declarative/images/images.qml | 2 +- examples/declarative/layouts/Button.qml | 2 +- examples/declarative/layouts/layouts.qml | 2 +- examples/declarative/layouts/positioners.qml | 2 +- examples/declarative/listmodel-threaded/timedisplay.qml | 2 +- examples/declarative/listview/content/ClickAutoRepeating.qml | 2 +- examples/declarative/listview/content/MediaButton.qml | 2 +- examples/declarative/listview/dummydata/MyPetsModel.qml | 2 +- examples/declarative/listview/dummydata/Recipes.qml | 2 +- examples/declarative/listview/dynamic.qml | 2 +- examples/declarative/listview/highlight.qml | 2 +- examples/declarative/listview/itemlist.qml | 2 +- examples/declarative/listview/listview-example.qml | 2 +- examples/declarative/listview/recipes.qml | 2 +- examples/declarative/listview/sections.qml | 2 +- examples/declarative/mousearea/mouse.qml | 2 +- examples/declarative/objectlistmodel/view.qml | 2 +- examples/declarative/package/Delegate.qml | 2 +- examples/declarative/package/view.qml | 2 +- examples/declarative/parallax/parallax.qml | 2 +- examples/declarative/parallax/qml/ParallaxView.qml | 2 +- examples/declarative/parallax/qml/Smiley.qml | 2 +- examples/declarative/plugins/com/nokia/TimeExample/Clock.qml | 2 +- examples/declarative/progressbar/content/ProgressBar.qml | 2 +- examples/declarative/progressbar/progressbars.qml | 2 +- examples/declarative/proxywidgets/proxywidgets.qml | 2 +- examples/declarative/scrollbar/ScrollBar.qml | 2 +- examples/declarative/scrollbar/display.qml | 2 +- examples/declarative/searchbox/SearchBox.qml | 2 +- examples/declarative/searchbox/main.qml | 2 +- examples/declarative/slideswitch/content/Switch.qml | 2 +- examples/declarative/slideswitch/slideswitch.qml | 2 +- examples/declarative/sql/hello.qml | 2 +- examples/declarative/states/states.qml | 2 +- examples/declarative/states/transitions.qml | 2 +- examples/declarative/tabwidget/TabWidget.qml | 2 +- examples/declarative/tabwidget/tabs.qml | 2 +- examples/declarative/tic-tac-toe/content/Button.qml | 2 +- examples/declarative/tic-tac-toe/content/TicTac.qml | 2 +- examples/declarative/tic-tac-toe/tic-tac-toe.qml | 2 +- examples/declarative/tutorials/helloworld/Cell.qml | 2 +- examples/declarative/tutorials/helloworld/tutorial1.qml | 2 +- examples/declarative/tutorials/helloworld/tutorial2.qml | 2 +- examples/declarative/tutorials/helloworld/tutorial3.qml | 2 +- examples/declarative/tutorials/samegame/samegame1/Block.qml | 2 +- examples/declarative/tutorials/samegame/samegame1/Button.qml | 2 +- examples/declarative/tutorials/samegame/samegame1/samegame.qml | 2 +- examples/declarative/tutorials/samegame/samegame2/Block.qml | 2 +- examples/declarative/tutorials/samegame/samegame2/Button.qml | 2 +- examples/declarative/tutorials/samegame/samegame2/samegame.qml | 2 +- examples/declarative/tutorials/samegame/samegame3/Block.qml | 2 +- examples/declarative/tutorials/samegame/samegame3/Button.qml | 2 +- examples/declarative/tutorials/samegame/samegame3/Dialog.qml | 2 +- examples/declarative/tutorials/samegame/samegame3/samegame.qml | 2 +- .../tutorials/samegame/samegame4/content/BoomBlock.qml | 2 +- .../tutorials/samegame/samegame4/content/Button.qml | 2 +- .../tutorials/samegame/samegame4/content/Dialog.qml | 2 +- examples/declarative/tutorials/samegame/samegame4/samegame.qml | 2 +- examples/declarative/tvtennis/tvtennis.qml | 2 +- examples/declarative/velocity/Day.qml | 2 +- examples/declarative/velocity/velocity.qml | 2 +- examples/declarative/webview/alerts.qml | 2 +- examples/declarative/webview/autosize.qml | 2 +- examples/declarative/webview/content/FieldText.qml | 2 +- examples/declarative/webview/content/Mapping/Map.qml | 2 +- examples/declarative/webview/content/SpinSquare.qml | 2 +- examples/declarative/webview/googleMaps.qml | 2 +- examples/declarative/webview/inline-html.qml | 2 +- examples/declarative/webview/newwindows.qml | 2 +- examples/declarative/webview/transparent.qml | 2 +- examples/declarative/workerscript/workerscript.qml | 2 +- examples/declarative/xmldata/daringfireball.qml | 2 +- examples/declarative/xmldata/yahoonews.qml | 2 +- examples/declarative/xmlhttprequest/test.qml | 2 +- .../graphicsitems/qdeclarativegraphicsobjectcontainer.cpp | 2 +- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 2 +- src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 2 +- src/declarative/qml/qdeclarativeengine.cpp | 2 +- src/declarative/qml/qdeclarativeworkerscript.cpp | 2 +- src/declarative/util/qdeclarativepropertychanges.cpp | 2 +- src/declarative/util/qdeclarativesmoothedanimation.cpp | 2 +- 183 files changed, 196 insertions(+), 196 deletions(-) diff --git a/demos/declarative/calculator/CalcButton.qml b/demos/declarative/calculator/CalcButton.qml index 6210e46..a125346 100644 --- a/demos/declarative/calculator/CalcButton.qml +++ b/demos/declarative/calculator/CalcButton.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { property alias operation: label.text diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml index 1644968..b8e506e 100644 --- a/demos/declarative/calculator/calculator.qml +++ b/demos/declarative/calculator/calculator.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "calculator.js" as CalcEngine Rectangle { diff --git a/demos/declarative/flickr/common/LikeOMeter.qml b/demos/declarative/flickr/common/LikeOMeter.qml index 5ee048b..17e3998 100644 --- a/demos/declarative/flickr/common/LikeOMeter.qml +++ b/demos/declarative/flickr/common/LikeOMeter.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: container diff --git a/demos/declarative/flickr/common/Loading.qml b/demos/declarative/flickr/common/Loading.qml index 4c41717..8daed48 100644 --- a/demos/declarative/flickr/common/Loading.qml +++ b/demos/declarative/flickr/common/Loading.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Image { id: loading; source: "pics/loading.png" diff --git a/demos/declarative/flickr/common/Progress.qml b/demos/declarative/flickr/common/Progress.qml index fd9be10..33c6180 100644 --- a/demos/declarative/flickr/common/Progress.qml +++ b/demos/declarative/flickr/common/Progress.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { property var progress: 0 diff --git a/demos/declarative/flickr/common/RssModel.qml b/demos/declarative/flickr/common/RssModel.qml index ed9fd5c..d0960db 100644 --- a/demos/declarative/flickr/common/RssModel.qml +++ b/demos/declarative/flickr/common/RssModel.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 XmlListModel { property string tags : "" diff --git a/demos/declarative/flickr/common/ScrollBar.qml b/demos/declarative/flickr/common/ScrollBar.qml index feebcb0..4296eca 100644 --- a/demos/declarative/flickr/common/ScrollBar.qml +++ b/demos/declarative/flickr/common/ScrollBar.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: container diff --git a/demos/declarative/flickr/common/Slider.qml b/demos/declarative/flickr/common/Slider.qml index 05a87e7..4da370e 100644 --- a/demos/declarative/flickr/common/Slider.qml +++ b/demos/declarative/flickr/common/Slider.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: slider; width: 400; height: 16 diff --git a/demos/declarative/flickr/common/Star.qml b/demos/declarative/flickr/common/Star.qml index 748a5ec..fcca742 100644 --- a/demos/declarative/flickr/common/Star.qml +++ b/demos/declarative/flickr/common/Star.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: container diff --git a/demos/declarative/flickr/flickr-90.qml b/demos/declarative/flickr/flickr-90.qml index 1d1ac40..d1830bf 100644 --- a/demos/declarative/flickr/flickr-90.qml +++ b/demos/declarative/flickr/flickr-90.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { width: 480; height: 320 diff --git a/demos/declarative/flickr/flickr.qml b/demos/declarative/flickr/flickr.qml index 21e4c49..aa550d2 100644 --- a/demos/declarative/flickr/flickr.qml +++ b/demos/declarative/flickr/flickr.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "common" as Common import "mobile" as Mobile diff --git a/demos/declarative/flickr/mobile/Button.qml b/demos/declarative/flickr/mobile/Button.qml index 4ba6b19..74b5aea 100644 --- a/demos/declarative/flickr/mobile/Button.qml +++ b/demos/declarative/flickr/mobile/Button.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: container diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml index b54585b..5ab7b87 100644 --- a/demos/declarative/flickr/mobile/GridDelegate.qml +++ b/demos/declarative/flickr/mobile/GridDelegate.qml @@ -1,4 +1,4 @@ - import Qt 4.6 + import Qt 4.7 Component { id: photoDelegate diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index 2f4df8a..d86fd2d 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "../common" as Common Flipable { diff --git a/demos/declarative/flickr/mobile/ListDelegate.qml b/demos/declarative/flickr/mobile/ListDelegate.qml index 381664b..28ec3d1 100644 --- a/demos/declarative/flickr/mobile/ListDelegate.qml +++ b/demos/declarative/flickr/mobile/ListDelegate.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Component { Item { diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml index e92ba59..72b779f 100644 --- a/demos/declarative/flickr/mobile/TitleBar.qml +++ b/demos/declarative/flickr/mobile/TitleBar.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: titleBar diff --git a/demos/declarative/flickr/mobile/ToolBar.qml b/demos/declarative/flickr/mobile/ToolBar.qml index f96c767..b29ca16 100644 --- a/demos/declarative/flickr/mobile/ToolBar.qml +++ b/demos/declarative/flickr/mobile/ToolBar.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: toolbar diff --git a/demos/declarative/minehunt/MinehuntCore/Explosion.qml b/demos/declarative/minehunt/MinehuntCore/Explosion.qml index 172fcc0..526cd34 100644 --- a/demos/declarative/minehunt/MinehuntCore/Explosion.qml +++ b/demos/declarative/minehunt/MinehuntCore/Explosion.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import Qt.labs.particles 1.0 Item { diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 2798b4f..299e722 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "MinehuntCore" 1.0 Item { diff --git a/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml index fb68cfc..b494651 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Component { id: albumDelegate diff --git a/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml b/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml index 361659c..1cad8c9 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/BusyIndicator.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Image { id: container diff --git a/demos/declarative/photoviewer/PhotoViewerCore/Button.qml b/demos/declarative/photoviewer/PhotoViewerCore/Button.qml index cdf86af..fd1fae9 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/Button.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/Button.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: container diff --git a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml index 5ea79a1..e435425 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: container diff --git a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml index 107aff1..391f433 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/PhotoDelegate.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "script/script.js" as Script Package { diff --git a/demos/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml b/demos/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml index bd6b30f..d09532e 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/ProgressBar.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: container diff --git a/demos/declarative/photoviewer/PhotoViewerCore/RssModel.qml b/demos/declarative/photoviewer/PhotoViewerCore/RssModel.qml index ddbc02b..53d9819 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/RssModel.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/RssModel.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 XmlListModel { property string tags : "" diff --git a/demos/declarative/photoviewer/PhotoViewerCore/Tag.qml b/demos/declarative/photoviewer/PhotoViewerCore/Tag.qml index bf02fac..2722ac3 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/Tag.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/Tag.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Flipable { id: flipable diff --git a/demos/declarative/photoviewer/photoviewer.qml b/demos/declarative/photoviewer/photoviewer.qml index 662ea12..569e1ba 100644 --- a/demos/declarative/photoviewer/photoviewer.qml +++ b/demos/declarative/photoviewer/photoviewer.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "PhotoViewerCore" 1.0 Rectangle { diff --git a/demos/declarative/samegame/SamegameCore/BoomBlock.qml b/demos/declarative/samegame/SamegameCore/BoomBlock.qml index b14531d..838b346 100644 --- a/demos/declarative/samegame/SamegameCore/BoomBlock.qml +++ b/demos/declarative/samegame/SamegameCore/BoomBlock.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import Qt.labs.particles 1.0 Item { id:block diff --git a/demos/declarative/samegame/SamegameCore/Button.qml b/demos/declarative/samegame/SamegameCore/Button.qml index 6629302..9c7986b 100644 --- a/demos/declarative/samegame/SamegameCore/Button.qml +++ b/demos/declarative/samegame/SamegameCore/Button.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: container diff --git a/demos/declarative/samegame/SamegameCore/Dialog.qml b/demos/declarative/samegame/SamegameCore/Dialog.qml index 6d5d6b5..7f1189e 100644 --- a/demos/declarative/samegame/SamegameCore/Dialog.qml +++ b/demos/declarative/samegame/SamegameCore/Dialog.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: page diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index 6c58d49..9c3e26d 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "SamegameCore" 1.0 import "SamegameCore/samegame.js" as Logic diff --git a/demos/declarative/snake/content/Button.qml b/demos/declarative/snake/content/Button.qml index 6629302..9c7986b 100644 --- a/demos/declarative/snake/content/Button.qml +++ b/demos/declarative/snake/content/Button.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: container diff --git a/demos/declarative/snake/content/Cookie.qml b/demos/declarative/snake/content/Cookie.qml index b64987e..9fbbdf9 100644 --- a/demos/declarative/snake/content/Cookie.qml +++ b/demos/declarative/snake/content/Cookie.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import Qt.labs.particles 1.0 Item { diff --git a/demos/declarative/snake/content/HighScoreModel.qml b/demos/declarative/snake/content/HighScoreModel.qml index 076e3ff..e04f524 100644 --- a/demos/declarative/snake/content/HighScoreModel.qml +++ b/demos/declarative/snake/content/HighScoreModel.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 // Models a high score table. // diff --git a/demos/declarative/snake/content/Link.qml b/demos/declarative/snake/content/Link.qml index 4171247..8186dfd 100644 --- a/demos/declarative/snake/content/Link.qml +++ b/demos/declarative/snake/content/Link.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import Qt.labs.particles 1.0 Item { id:link diff --git a/demos/declarative/snake/content/Skull.qml b/demos/declarative/snake/content/Skull.qml index 821996a..2af8b2f 100644 --- a/demos/declarative/snake/content/Skull.qml +++ b/demos/declarative/snake/content/Skull.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Image { property bool spawned: false diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 68c2b78..014f04e 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "content" as Content import "content/snake.js" as Logic diff --git a/demos/declarative/twitter/TwitterCore/AuthView.qml b/demos/declarative/twitter/TwitterCore/AuthView.qml index bcf4646..9d9341a 100644 --- a/demos/declarative/twitter/TwitterCore/AuthView.qml +++ b/demos/declarative/twitter/TwitterCore/AuthView.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: wrapper diff --git a/demos/declarative/twitter/TwitterCore/Button.qml b/demos/declarative/twitter/TwitterCore/Button.qml index 4cba8c3..93f6b21 100644 --- a/demos/declarative/twitter/TwitterCore/Button.qml +++ b/demos/declarative/twitter/TwitterCore/Button.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: container diff --git a/demos/declarative/twitter/TwitterCore/FatDelegate.qml b/demos/declarative/twitter/TwitterCore/FatDelegate.qml index 0f013e6..3eabd9d 100644 --- a/demos/declarative/twitter/TwitterCore/FatDelegate.qml +++ b/demos/declarative/twitter/TwitterCore/FatDelegate.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Component { id: listDelegate diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml index a206c87..0835315 100644 --- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: titleBar diff --git a/demos/declarative/twitter/TwitterCore/Loading.qml b/demos/declarative/twitter/TwitterCore/Loading.qml index 957de0f..94b77f2 100644 --- a/demos/declarative/twitter/TwitterCore/Loading.qml +++ b/demos/declarative/twitter/TwitterCore/Loading.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Image { id: loading; source: "images/loading.png" diff --git a/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml index e0205b8..8c27e2b 100644 --- a/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/MultiTitleBar.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { height: homeBar.height diff --git a/demos/declarative/twitter/TwitterCore/RssModel.qml b/demos/declarative/twitter/TwitterCore/RssModel.qml index 9d88bb7..5015e18 100644 --- a/demos/declarative/twitter/TwitterCore/RssModel.qml +++ b/demos/declarative/twitter/TwitterCore/RssModel.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: wrapper property var model: xmlModel diff --git a/demos/declarative/twitter/TwitterCore/TitleBar.qml b/demos/declarative/twitter/TwitterCore/TitleBar.qml index 149aa82..1125519 100644 --- a/demos/declarative/twitter/TwitterCore/TitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/TitleBar.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: titleBar diff --git a/demos/declarative/twitter/TwitterCore/ToolBar.qml b/demos/declarative/twitter/TwitterCore/ToolBar.qml index f96c767..b29ca16 100644 --- a/demos/declarative/twitter/TwitterCore/ToolBar.qml +++ b/demos/declarative/twitter/TwitterCore/ToolBar.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: toolbar diff --git a/demos/declarative/twitter/TwitterCore/UserModel.qml b/demos/declarative/twitter/TwitterCore/UserModel.qml index c146b84..449e96c 100644 --- a/demos/declarative/twitter/TwitterCore/UserModel.qml +++ b/demos/declarative/twitter/TwitterCore/UserModel.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 //This "model" gets the user information about the searched user. Mainly for the icon. //Copied from RssModel diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index 94d53f1..c5e5002 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "TwitterCore" 1.0 as Twitter Item { diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml index 759cff6..81904c6 100644 --- a/demos/declarative/webbrowser/content/FlickableWebView.qml +++ b/demos/declarative/webbrowser/content/FlickableWebView.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import org.webkit 1.0 Flickable { diff --git a/demos/declarative/webbrowser/content/RectSoftShadow.qml b/demos/declarative/webbrowser/content/RectSoftShadow.qml index 5b6d4ec..53d098c 100644 --- a/demos/declarative/webbrowser/content/RectSoftShadow.qml +++ b/demos/declarative/webbrowser/content/RectSoftShadow.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { BorderImage { diff --git a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml index 46dbc98..f5bfadf 100644 --- a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml +++ b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "fieldtext" diff --git a/demos/declarative/webbrowser/content/fieldtext/FieldText.qml b/demos/declarative/webbrowser/content/fieldtext/FieldText.qml index 1da9219..d1d003f 100644 --- a/demos/declarative/webbrowser/content/fieldtext/FieldText.qml +++ b/demos/declarative/webbrowser/content/fieldtext/FieldText.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: fieldText diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml index b6cccb0..fbbe7b2 100644 --- a/demos/declarative/webbrowser/webbrowser.qml +++ b/demos/declarative/webbrowser/webbrowser.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import org.webkit 1.0 import "content" diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc index b2e3f90..63f697d 100644 --- a/doc/src/declarative/dynamicobjects.qdoc +++ b/doc/src/declarative/dynamicobjects.qdoc @@ -122,7 +122,7 @@ If the QML does not exist until runtime, you can create a QML item from a string of QML using the createQmlObject function, as in the following example: \code - newObject = createQmlObject('import Qt 4.6; Rectangle { color: "red"; width: 20; height: 20 }', + newObject = createQmlObject('import Qt 4.7; Rectangle { color: "red"; width: 20; height: 20 }', targetItem, "dynamicSnippet1"); \endcode The first argument is the string of QML to create. Just like in a new file, you will need to diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 231e75a..71ab67d 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -266,7 +266,7 @@ of their use. Example (where targetItem is the id of an existing QML item): \code - newObject = createQmlObject('import Qt 4.6; Rectangle {color: "red"; width: 20; height: 20}', + newObject = createQmlObject('import Qt 4.7; Rectangle {color: "red"; width: 20; height: 20}', targetItem, "dynamicSnippet1"); \endcode diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc index d476d6f..68e58fb 100644 --- a/doc/src/declarative/modules.qdoc +++ b/doc/src/declarative/modules.qdoc @@ -150,7 +150,7 @@ types to be referenced, or purely for readability. To import a module into a namespace: \code -import Qt 4.6 as TheQtLibrary +import Qt 4.7 as TheQtLibrary \endcode Types from Qt 4.6 may then be used, but only by qualifying them with the namespace: @@ -163,7 +163,7 @@ Multiple modules can be imported into the same namespace in the same way that mu modules can be imported into the global namespace: \code -import Qt 4.6 as Nokia +import Qt 4.7 as Nokia import Ovi 1.0 as Nokia \endcode diff --git a/doc/src/declarative/qdeclarativedocument.qdoc b/doc/src/declarative/qdeclarativedocument.qdoc index a210c98..bf95a29 100644 --- a/doc/src/declarative/qdeclarativedocument.qdoc +++ b/doc/src/declarative/qdeclarativedocument.qdoc @@ -49,7 +49,7 @@ stored on a disk or network resource, but can also be constructed directly from Here is a simple QML document: \code -import Qt 4.6 +import Qt 4.7 Rectangle { width: 240; height: 320; @@ -103,7 +103,7 @@ instantiated four times, each with a different value for its \c text property.
\endraw \code -import Qt 4.6 +import Qt 4.7 BorderImage { property alias text: textElement.text @@ -152,7 +152,7 @@ These final two examples are behaviorally identical to the original document. \row \o \code -import Qt 4.6 +import Qt 4.7 Rectangle { width: 240; height: 320; @@ -170,7 +170,7 @@ Rectangle { \endcode \o \code -import Qt 4.6 +import Qt 4.7 Rectangle { width: 240; height: 320; diff --git a/doc/src/declarative/qdeclarativei18n.qdoc b/doc/src/declarative/qdeclarativei18n.qdoc index 598c567..0a48dd9 100644 --- a/doc/src/declarative/qdeclarativei18n.qdoc +++ b/doc/src/declarative/qdeclarativei18n.qdoc @@ -72,7 +72,7 @@ that needs to be translated is enclosed in a call to \c qsTr(). hello.qml: \qml -import Qt 4.6 +import Qt 4.7 Rectangle { width: 200; height: 200 diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index 577e69a..181c504 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -108,7 +108,7 @@ QObject *window = component.create(windowContext); \o \code // main.qml -import Qt 4.6 +import Qt 4.7 Rectangle { color: backgroundColor @@ -198,7 +198,7 @@ the window text will update accordingly. \code // main.qml -import Qt 4.6 +import Qt 4.7 Rectangle { width: 240 @@ -287,7 +287,7 @@ int main(int argc, char **argv) \o \code // main.qml -import Qt 4.6 +import Qt 4.7 Rectangle { MouseArea { @@ -311,7 +311,7 @@ is to have a "running" property. This leads to much nicer QML code: \o \code // main.qml -import Qt 4.6 +import Qt 4.7 Rectangle { MouseArea { @@ -390,7 +390,7 @@ MyApplication::MyApplication() \endcode \code // main.qml -import Qt 4.6 +import Qt 4.7 Image { source: "images/background.png" diff --git a/doc/src/declarative/scope.qdoc b/doc/src/declarative/scope.qdoc index 964f7d5..65553cf 100644 --- a/doc/src/declarative/scope.qdoc +++ b/doc/src/declarative/scope.qdoc @@ -126,7 +126,7 @@ following example shows a simple QML file that accesses some enumeration values and calls an imported JavaScript function. \code -import Qt 4.6 +import Qt 4.7 import "code.js" as Code ListView { @@ -267,7 +267,7 @@ is used, the \c title property may resolve differently. \code // TitlePage.qml -import Qt 4.6 +import Qt 4.7 Item { property string title @@ -283,7 +283,7 @@ Item { } // TitleText.qml -import Qt 4.6 +import Qt 4.7 Text { property int size text: "" + title + "" @@ -299,7 +299,7 @@ to use property interfaces, like this: \code // TitlePage.qml -import Qt 4.6 +import Qt 4.7 Item { id: root property string title @@ -318,7 +318,7 @@ Item { } // TitleText.qml -import Qt 4.6 +import Qt 4.7 Text { property string title property int size diff --git a/examples/declarative/animations/color-animation.qml b/examples/declarative/animations/color-animation.qml index d8361ba..3616a31 100644 --- a/examples/declarative/animations/color-animation.qml +++ b/examples/declarative/animations/color-animation.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import Qt.labs.particles 1.0 Item { diff --git a/examples/declarative/animations/easing.qml b/examples/declarative/animations/easing.qml index 8f2655e..bed4b5f9 100644 --- a/examples/declarative/animations/easing.qml +++ b/examples/declarative/animations/easing.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: window diff --git a/examples/declarative/animations/property-animation.qml b/examples/declarative/animations/property-animation.qml index fd5eb3c..5afe8ef 100644 --- a/examples/declarative/animations/property-animation.qml +++ b/examples/declarative/animations/property-animation.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: window diff --git a/examples/declarative/aspectratio/face_fit.qml b/examples/declarative/aspectratio/face_fit.qml index 6a031a4..52cd4c2 100644 --- a/examples/declarative/aspectratio/face_fit.qml +++ b/examples/declarative/aspectratio/face_fit.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 // Here, we implement a hybrid of the "scale to fit" and "scale and crop" // behaviours which will crop up to 25% from *one* dimension if necessary diff --git a/examples/declarative/aspectratio/face_fit_animated.qml b/examples/declarative/aspectratio/face_fit_animated.qml index 79e99e9..97f4791 100644 --- a/examples/declarative/aspectratio/face_fit_animated.qml +++ b/examples/declarative/aspectratio/face_fit_animated.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 // Here, we extend the "face_fit" example with animation to show how truly // diverse and usage-specific behaviours are made possible by NOT putting a diff --git a/examples/declarative/aspectratio/scale_and_crop.qml b/examples/declarative/aspectratio/scale_and_crop.qml index 2e2b6ed..a438104 100644 --- a/examples/declarative/aspectratio/scale_and_crop.qml +++ b/examples/declarative/aspectratio/scale_and_crop.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 // Here, we implement "Scale and Crop" behaviour. // diff --git a/examples/declarative/aspectratio/scale_and_crop_simple.qml b/examples/declarative/aspectratio/scale_and_crop_simple.qml index e720ce7..1160ec5 100644 --- a/examples/declarative/aspectratio/scale_and_crop_simple.qml +++ b/examples/declarative/aspectratio/scale_and_crop_simple.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 // Here, we implement "Scale to Fit" behaviour, using the // fillMode property. diff --git a/examples/declarative/aspectratio/scale_and_sidecrop.qml b/examples/declarative/aspectratio/scale_and_sidecrop.qml index 8230e49..5593ab8 100644 --- a/examples/declarative/aspectratio/scale_and_sidecrop.qml +++ b/examples/declarative/aspectratio/scale_and_sidecrop.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 // Here, we implement a variant of "Scale and Crop" behaviour, where we // crop the sides if necessary to fully fit vertically, but not the reverse. diff --git a/examples/declarative/aspectratio/scale_to_fit.qml b/examples/declarative/aspectratio/scale_to_fit.qml index eae4d16..724a36e 100644 --- a/examples/declarative/aspectratio/scale_to_fit.qml +++ b/examples/declarative/aspectratio/scale_to_fit.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 // Here, we implement "Scale to Fit" behaviour "manually", rather // than using the preserveAspect property. diff --git a/examples/declarative/aspectratio/scale_to_fit_simple.qml b/examples/declarative/aspectratio/scale_to_fit_simple.qml index 7389581..0e960b4 100644 --- a/examples/declarative/aspectratio/scale_to_fit_simple.qml +++ b/examples/declarative/aspectratio/scale_to_fit_simple.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 // Here, we implement "Scale to Fit" behaviour, using the // fillMode property. diff --git a/examples/declarative/behaviors/SideRect.qml b/examples/declarative/behaviors/SideRect.qml index 7caac45..d06f73c 100644 --- a/examples/declarative/behaviors/SideRect.qml +++ b/examples/declarative/behaviors/SideRect.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: myRect diff --git a/examples/declarative/behaviors/behavior-example.qml b/examples/declarative/behaviors/behavior-example.qml index 8da1ada..b21f4f0 100644 --- a/examples/declarative/behaviors/behavior-example.qml +++ b/examples/declarative/behaviors/behavior-example.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { color: "#343434" diff --git a/examples/declarative/border-image/animated.qml b/examples/declarative/border-image/animated.qml index 29c02b3..730aeca 100644 --- a/examples/declarative/border-image/animated.qml +++ b/examples/declarative/border-image/animated.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "content" Rectangle { diff --git a/examples/declarative/border-image/borders.qml b/examples/declarative/border-image/borders.qml index 9879416..8956128 100644 --- a/examples/declarative/border-image/borders.qml +++ b/examples/declarative/border-image/borders.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: page diff --git a/examples/declarative/border-image/content/MyBorderImage.qml b/examples/declarative/border-image/content/MyBorderImage.qml index f0c3cfc..f65f093 100644 --- a/examples/declarative/border-image/content/MyBorderImage.qml +++ b/examples/declarative/border-image/content/MyBorderImage.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { property alias horizontalMode: image.horizontalTileMode diff --git a/examples/declarative/clocks/clocks.qml b/examples/declarative/clocks/clocks.qml index c5aa1dc..22cf820 100644 --- a/examples/declarative/clocks/clocks.qml +++ b/examples/declarative/clocks/clocks.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "content" Rectangle { diff --git a/examples/declarative/clocks/content/Clock.qml b/examples/declarative/clocks/content/Clock.qml index 90c6be8..a315ccc 100644 --- a/examples/declarative/clocks/content/Clock.qml +++ b/examples/declarative/clocks/content/Clock.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: clock diff --git a/examples/declarative/connections/connections-example.qml b/examples/declarative/connections/connections-example.qml index c35bda5..0b4ca45 100644 --- a/examples/declarative/connections/connections-example.qml +++ b/examples/declarative/connections/connections-example.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "content" Rectangle { diff --git a/examples/declarative/connections/content/Button.qml b/examples/declarative/connections/content/Button.qml index 0e33c78..f95afbb 100644 --- a/examples/declarative/connections/content/Button.qml +++ b/examples/declarative/connections/content/Button.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: button diff --git a/examples/declarative/dial/content/Dial.qml b/examples/declarative/dial/content/Dial.qml index ad4717a..7fd638a 100644 --- a/examples/declarative/dial/content/Dial.qml +++ b/examples/declarative/dial/content/Dial.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: root diff --git a/examples/declarative/dial/dial-example.qml b/examples/declarative/dial/dial-example.qml index 3aed70e..1ca958a 100644 --- a/examples/declarative/dial/dial-example.qml +++ b/examples/declarative/dial/dial-example.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "content" Rectangle { diff --git a/examples/declarative/dynamic/dynamic.qml b/examples/declarative/dynamic/dynamic.qml index 7de4d38..7331b3f 100644 --- a/examples/declarative/dynamic/dynamic.qml +++ b/examples/declarative/dynamic/dynamic.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import Qt.labs.particles 1.0 import "qml" @@ -110,7 +110,7 @@ Item { focusOnPress: true font.pixelSize: 14 - text: "import Qt 4.6\nImage {\n id: smile;\n x: 500*Math.random();\n y: 200*Math.random(); \n source: 'images/face-smile.png';\n NumberAnimation on opacity { \n to: 0; duration: 1500;\n }\n Component.onCompleted: smile.destroy(1500);\n}" + text: "import Qt 4.7\nImage {\n id: smile;\n x: 500*Math.random();\n y: 200*Math.random(); \n source: 'images/face-smile.png';\n NumberAnimation on opacity { \n to: 0; duration: 1500;\n }\n Component.onCompleted: smile.destroy(1500);\n}" } Button { text: "Create" diff --git a/examples/declarative/dynamic/qml/Button.qml b/examples/declarative/dynamic/qml/Button.qml index 757e295..946da21 100644 --- a/examples/declarative/dynamic/qml/Button.qml +++ b/examples/declarative/dynamic/qml/Button.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: container diff --git a/examples/declarative/dynamic/qml/GenericItem.qml b/examples/declarative/dynamic/qml/GenericItem.qml index 10e3dba..faac06d 100644 --- a/examples/declarative/dynamic/qml/GenericItem.qml +++ b/examples/declarative/dynamic/qml/GenericItem.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item{ property bool created: false diff --git a/examples/declarative/dynamic/qml/PaletteItem.qml b/examples/declarative/dynamic/qml/PaletteItem.qml index 08bdc40..e8f2ed4 100644 --- a/examples/declarative/dynamic/qml/PaletteItem.qml +++ b/examples/declarative/dynamic/qml/PaletteItem.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "itemCreation.js" as Code GenericItem { diff --git a/examples/declarative/dynamic/qml/PerspectiveItem.qml b/examples/declarative/dynamic/qml/PerspectiveItem.qml index a0dfad3..3cbe64a 100644 --- a/examples/declarative/dynamic/qml/PerspectiveItem.qml +++ b/examples/declarative/dynamic/qml/PerspectiveItem.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Image { id: tree diff --git a/examples/declarative/dynamic/qml/Sun.qml b/examples/declarative/dynamic/qml/Sun.qml index 81b6e9b..3627964 100644 --- a/examples/declarative/dynamic/qml/Sun.qml +++ b/examples/declarative/dynamic/qml/Sun.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Image { id: sun diff --git a/examples/declarative/effects/effects.qml b/examples/declarative/effects/effects.qml index 2280a2a..d325e11 100644 --- a/examples/declarative/effects/effects.qml +++ b/examples/declarative/effects/effects.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { color: "white" diff --git a/examples/declarative/fillmode/fillmode.qml b/examples/declarative/fillmode/fillmode.qml index 3f2020c..249674b 100644 --- a/examples/declarative/fillmode/fillmode.qml +++ b/examples/declarative/fillmode/fillmode.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Image { width: 400 diff --git a/examples/declarative/flipable/content/Card.qml b/examples/declarative/flipable/content/Card.qml index 6b8fa69..2577d89 100644 --- a/examples/declarative/flipable/content/Card.qml +++ b/examples/declarative/flipable/content/Card.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Flipable { id: container diff --git a/examples/declarative/flipable/flipable-example.qml b/examples/declarative/flipable/flipable-example.qml index eebc721..171353f 100644 --- a/examples/declarative/flipable/flipable-example.qml +++ b/examples/declarative/flipable/flipable-example.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "content" Rectangle { diff --git a/examples/declarative/focus/Core/ContextMenu.qml b/examples/declarative/focus/Core/ContextMenu.qml index bd6d8a2..56a1b3e 100644 --- a/examples/declarative/focus/Core/ContextMenu.qml +++ b/examples/declarative/focus/Core/ContextMenu.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 FocusScope { id: container diff --git a/examples/declarative/focus/Core/GridMenu.qml b/examples/declarative/focus/Core/GridMenu.qml index 03d837a..75f6be0 100644 --- a/examples/declarative/focus/Core/GridMenu.qml +++ b/examples/declarative/focus/Core/GridMenu.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 FocusScope { property alias interactive: gridView.interactive diff --git a/examples/declarative/focus/Core/ListViewDelegate.qml b/examples/declarative/focus/Core/ListViewDelegate.qml index b7e067a..35c04cf 100644 --- a/examples/declarative/focus/Core/ListViewDelegate.qml +++ b/examples/declarative/focus/Core/ListViewDelegate.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Component { Item { diff --git a/examples/declarative/focus/Core/ListViews.qml b/examples/declarative/focus/Core/ListViews.qml index 3cc4836..b28cc1c 100644 --- a/examples/declarative/focus/Core/ListViews.qml +++ b/examples/declarative/focus/Core/ListViews.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 FocusScope { clip: true diff --git a/examples/declarative/focus/focus.qml b/examples/declarative/focus/focus.qml index a8dc3c8..b9a11a6 100644 --- a/examples/declarative/focus/focus.qml +++ b/examples/declarative/focus/focus.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "Core" 1.0 Rectangle { diff --git a/examples/declarative/fonts/banner.qml b/examples/declarative/fonts/banner.qml index 957246f..b7f5344 100644 --- a/examples/declarative/fonts/banner.qml +++ b/examples/declarative/fonts/banner.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: screen diff --git a/examples/declarative/fonts/fonts.qml b/examples/declarative/fonts/fonts.qml index e928df4..49c3d0a 100644 --- a/examples/declarative/fonts/fonts.qml +++ b/examples/declarative/fonts/fonts.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { property string myText: "The quick brown fox jumps over the lazy dog." diff --git a/examples/declarative/fonts/hello.qml b/examples/declarative/fonts/hello.qml index e15a0f0..9d926fb 100644 --- a/examples/declarative/fonts/hello.qml +++ b/examples/declarative/fonts/hello.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: screen; width: 800; height: 480; color: "black" diff --git a/examples/declarative/gridview/gridview-example.qml b/examples/declarative/gridview/gridview-example.qml index 93931c7..fd5f430 100644 --- a/examples/declarative/gridview/gridview-example.qml +++ b/examples/declarative/gridview/gridview-example.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 300; height: 400; color: "white" diff --git a/examples/declarative/imageprovider/imageprovider-example.qml b/examples/declarative/imageprovider/imageprovider-example.qml index a895821..9d22576 100644 --- a/examples/declarative/imageprovider/imageprovider-example.qml +++ b/examples/declarative/imageprovider/imageprovider-example.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "ImageProviderCore" //![0] ListView { diff --git a/examples/declarative/images/images.qml b/examples/declarative/images/images.qml index 35ce1ab..7980088 100644 --- a/examples/declarative/images/images.qml +++ b/examples/declarative/images/images.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { color: "white" diff --git a/examples/declarative/layouts/Button.qml b/examples/declarative/layouts/Button.qml index 7cbf68a..0f08893 100644 --- a/examples/declarative/layouts/Button.qml +++ b/examples/declarative/layouts/Button.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { border.color: "black"; color: "steelblue"; radius: 5; width: pix.width + textelement.width + 13; height: pix.height + 10; id: page property string text diff --git a/examples/declarative/layouts/layouts.qml b/examples/declarative/layouts/layouts.qml index 4b2a3f8..231605e 100644 --- a/examples/declarative/layouts/layouts.qml +++ b/examples/declarative/layouts/layouts.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import Qt.widgets 4.6 Item { id: resizable diff --git a/examples/declarative/layouts/positioners.qml b/examples/declarative/layouts/positioners.qml index bce53bd..ef225d0 100644 --- a/examples/declarative/layouts/positioners.qml +++ b/examples/declarative/layouts/positioners.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: page diff --git a/examples/declarative/listmodel-threaded/timedisplay.qml b/examples/declarative/listmodel-threaded/timedisplay.qml index e8d8fe2..848192e 100644 --- a/examples/declarative/listmodel-threaded/timedisplay.qml +++ b/examples/declarative/listmodel-threaded/timedisplay.qml @@ -1,5 +1,5 @@ // ![0] -import Qt 4.6 +import Qt 4.7 ListView { width: 200 diff --git a/examples/declarative/listview/content/ClickAutoRepeating.qml b/examples/declarative/listview/content/ClickAutoRepeating.qml index cbf1f3b..f65c2b3 100644 --- a/examples/declarative/listview/content/ClickAutoRepeating.qml +++ b/examples/declarative/listview/content/ClickAutoRepeating.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: page diff --git a/examples/declarative/listview/content/MediaButton.qml b/examples/declarative/listview/content/MediaButton.qml index e9065c1..ec69000 100644 --- a/examples/declarative/listview/content/MediaButton.qml +++ b/examples/declarative/listview/content/MediaButton.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { property var text diff --git a/examples/declarative/listview/dummydata/MyPetsModel.qml b/examples/declarative/listview/dummydata/MyPetsModel.qml index 1ac37bb..f15dda3 100644 --- a/examples/declarative/listview/dummydata/MyPetsModel.qml +++ b/examples/declarative/listview/dummydata/MyPetsModel.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 // ListModel allows free form list models to be defined and populated. diff --git a/examples/declarative/listview/dummydata/Recipes.qml b/examples/declarative/listview/dummydata/Recipes.qml index 68e94ac..f707c82 100644 --- a/examples/declarative/listview/dummydata/Recipes.qml +++ b/examples/declarative/listview/dummydata/Recipes.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 ListModel { id: recipesModel diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml index 81550d7..32483fa 100644 --- a/examples/declarative/listview/dynamic.qml +++ b/examples/declarative/listview/dynamic.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "content" import "../scrollbar" diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml index 5e4911d..5493f99 100644 --- a/examples/declarative/listview/highlight.qml +++ b/examples/declarative/listview/highlight.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 400; height: 300; color: "white" diff --git a/examples/declarative/listview/itemlist.qml b/examples/declarative/listview/itemlist.qml index 41aa860..2f4aa31 100644 --- a/examples/declarative/listview/itemlist.qml +++ b/examples/declarative/listview/itemlist.qml @@ -1,7 +1,7 @@ // This example demonstrates placing items in a view using // a VisualItemModel -import Qt 4.6 +import Qt 4.7 Rectangle { color: "lightgray" diff --git a/examples/declarative/listview/listview-example.qml b/examples/declarative/listview/listview-example.qml index 92acce1..d648b60 100644 --- a/examples/declarative/listview/listview-example.qml +++ b/examples/declarative/listview/listview-example.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 600; height: 300; color: "white" diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml index 59f4e59..66c4109 100644 --- a/examples/declarative/listview/recipes.qml +++ b/examples/declarative/listview/recipes.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "content" // This example illustrates expanding a list item to show a more detailed view diff --git a/examples/declarative/listview/sections.qml b/examples/declarative/listview/sections.qml index 877026b..7c132a4 100644 --- a/examples/declarative/listview/sections.qml +++ b/examples/declarative/listview/sections.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 //! [0] Rectangle { diff --git a/examples/declarative/mousearea/mouse.qml b/examples/declarative/mousearea/mouse.qml index 9191f8a..efbfb53 100644 --- a/examples/declarative/mousearea/mouse.qml +++ b/examples/declarative/mousearea/mouse.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { color: "white" diff --git a/examples/declarative/objectlistmodel/view.qml b/examples/declarative/objectlistmodel/view.qml index 5f5e415..908e388 100644 --- a/examples/declarative/objectlistmodel/view.qml +++ b/examples/declarative/objectlistmodel/view.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 ListView { width: 100 diff --git a/examples/declarative/package/Delegate.qml b/examples/declarative/package/Delegate.qml index f35314f..785fde6 100644 --- a/examples/declarative/package/Delegate.qml +++ b/examples/declarative/package/Delegate.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 //![0] Package { diff --git a/examples/declarative/package/view.qml b/examples/declarative/package/view.qml index 07bba0c..67f896b 100644 --- a/examples/declarative/package/view.qml +++ b/examples/declarative/package/view.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { width: 400 diff --git a/examples/declarative/parallax/parallax.qml b/examples/declarative/parallax/parallax.qml index 6193f27..cb0437d 100644 --- a/examples/declarative/parallax/parallax.qml +++ b/examples/declarative/parallax/parallax.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "../clocks/content" import "qml" diff --git a/examples/declarative/parallax/qml/ParallaxView.qml b/examples/declarative/parallax/qml/ParallaxView.qml index 08193ae..8f5f290 100644 --- a/examples/declarative/parallax/qml/ParallaxView.qml +++ b/examples/declarative/parallax/qml/ParallaxView.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: root diff --git a/examples/declarative/parallax/qml/Smiley.qml b/examples/declarative/parallax/qml/Smiley.qml index c13b879..b1e1ae8 100644 --- a/examples/declarative/parallax/qml/Smiley.qml +++ b/examples/declarative/parallax/qml/Smiley.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: window diff --git a/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml b/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml index 622fcf9..3ebbeab 100644 --- a/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml +++ b/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: clock diff --git a/examples/declarative/progressbar/content/ProgressBar.qml b/examples/declarative/progressbar/content/ProgressBar.qml index aafb12e..d82d89d 100644 --- a/examples/declarative/progressbar/content/ProgressBar.qml +++ b/examples/declarative/progressbar/content/ProgressBar.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: progressbar diff --git a/examples/declarative/progressbar/progressbars.qml b/examples/declarative/progressbar/progressbars.qml index c8022b0..e10c9f0 100644 --- a/examples/declarative/progressbar/progressbars.qml +++ b/examples/declarative/progressbar/progressbars.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "content" Rectangle { diff --git a/examples/declarative/proxywidgets/proxywidgets.qml b/examples/declarative/proxywidgets/proxywidgets.qml index 023de71..6fa0c40 100644 --- a/examples/declarative/proxywidgets/proxywidgets.qml +++ b/examples/declarative/proxywidgets/proxywidgets.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "ProxyWidgets" 1.0 Rectangle { diff --git a/examples/declarative/scrollbar/ScrollBar.qml b/examples/declarative/scrollbar/ScrollBar.qml index 802b537..d2f52d5 100644 --- a/examples/declarative/scrollbar/ScrollBar.qml +++ b/examples/declarative/scrollbar/ScrollBar.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: scrollBar diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml index 84763d2..421cb7f 100644 --- a/examples/declarative/scrollbar/display.qml +++ b/examples/declarative/scrollbar/display.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 640 diff --git a/examples/declarative/searchbox/SearchBox.qml b/examples/declarative/searchbox/SearchBox.qml index 524b652..be85023 100644 --- a/examples/declarative/searchbox/SearchBox.qml +++ b/examples/declarative/searchbox/SearchBox.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 FocusScope { id: focusScope diff --git a/examples/declarative/searchbox/main.qml b/examples/declarative/searchbox/main.qml index 9b33be3..eb95a23 100644 --- a/examples/declarative/searchbox/main.qml +++ b/examples/declarative/searchbox/main.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 500; height: 250; color: "#edecec" diff --git a/examples/declarative/slideswitch/content/Switch.qml b/examples/declarative/slideswitch/content/Switch.qml index 758aee6..e16198d 100644 --- a/examples/declarative/slideswitch/content/Switch.qml +++ b/examples/declarative/slideswitch/content/Switch.qml @@ -1,5 +1,5 @@ //![0] -import Qt 4.6 +import Qt 4.7 Item { id: toggleswitch diff --git a/examples/declarative/slideswitch/slideswitch.qml b/examples/declarative/slideswitch/slideswitch.qml index 396749f..51c3c77 100644 --- a/examples/declarative/slideswitch/slideswitch.qml +++ b/examples/declarative/slideswitch/slideswitch.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "content" Rectangle { diff --git a/examples/declarative/sql/hello.qml b/examples/declarative/sql/hello.qml index 29e084c..a9f77ca 100644 --- a/examples/declarative/sql/hello.qml +++ b/examples/declarative/sql/hello.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Text { function findGreetings() { diff --git a/examples/declarative/states/states.qml b/examples/declarative/states/states.qml index 89f2421..c35cd63 100644 --- a/examples/declarative/states/states.qml +++ b/examples/declarative/states/states.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: page diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml index 8ad61ad..3cb5543 100644 --- a/examples/declarative/states/transitions.qml +++ b/examples/declarative/states/transitions.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: page diff --git a/examples/declarative/tabwidget/TabWidget.qml b/examples/declarative/tabwidget/TabWidget.qml index f0f7164..e6b40fd 100644 --- a/examples/declarative/tabwidget/TabWidget.qml +++ b/examples/declarative/tabwidget/TabWidget.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: tabWidget diff --git a/examples/declarative/tabwidget/tabs.qml b/examples/declarative/tabwidget/tabs.qml index 3d7ee6d..e1bbdef 100644 --- a/examples/declarative/tabwidget/tabs.qml +++ b/examples/declarative/tabwidget/tabs.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 TabWidget { id: tabs diff --git a/examples/declarative/tic-tac-toe/content/Button.qml b/examples/declarative/tic-tac-toe/content/Button.qml index cfc2f04..05d3f8d 100644 --- a/examples/declarative/tic-tac-toe/content/Button.qml +++ b/examples/declarative/tic-tac-toe/content/Button.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: container diff --git a/examples/declarative/tic-tac-toe/content/TicTac.qml b/examples/declarative/tic-tac-toe/content/TicTac.qml index ccb7b78..d247943 100644 --- a/examples/declarative/tic-tac-toe/content/TicTac.qml +++ b/examples/declarative/tic-tac-toe/content/TicTac.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { signal clicked diff --git a/examples/declarative/tic-tac-toe/tic-tac-toe.qml b/examples/declarative/tic-tac-toe/tic-tac-toe.qml index 4bb1e3f..1857a28 100644 --- a/examples/declarative/tic-tac-toe/tic-tac-toe.qml +++ b/examples/declarative/tic-tac-toe/tic-tac-toe.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "content" import "tic-tac-toe.js" as Logic diff --git a/examples/declarative/tutorials/helloworld/Cell.qml b/examples/declarative/tutorials/helloworld/Cell.qml index 9249ffe..1e52a67 100644 --- a/examples/declarative/tutorials/helloworld/Cell.qml +++ b/examples/declarative/tutorials/helloworld/Cell.qml @@ -1,5 +1,5 @@ //![0] -import Qt 4.6 +import Qt 4.7 //![1] Item { diff --git a/examples/declarative/tutorials/helloworld/tutorial1.qml b/examples/declarative/tutorials/helloworld/tutorial1.qml index 93d3c34..5e27b45 100644 --- a/examples/declarative/tutorials/helloworld/tutorial1.qml +++ b/examples/declarative/tutorials/helloworld/tutorial1.qml @@ -1,6 +1,6 @@ //![0] //![3] -import Qt 4.6 +import Qt 4.7 //![3] //![1] diff --git a/examples/declarative/tutorials/helloworld/tutorial2.qml b/examples/declarative/tutorials/helloworld/tutorial2.qml index 38447e2..085efa4 100644 --- a/examples/declarative/tutorials/helloworld/tutorial2.qml +++ b/examples/declarative/tutorials/helloworld/tutorial2.qml @@ -1,5 +1,5 @@ //![0] -import Qt 4.6 +import Qt 4.7 Rectangle { id: page diff --git a/examples/declarative/tutorials/helloworld/tutorial3.qml b/examples/declarative/tutorials/helloworld/tutorial3.qml index d851c49..4bf4970 100644 --- a/examples/declarative/tutorials/helloworld/tutorial3.qml +++ b/examples/declarative/tutorials/helloworld/tutorial3.qml @@ -1,5 +1,5 @@ //![0] -import Qt 4.6 +import Qt 4.7 Rectangle { id: page diff --git a/examples/declarative/tutorials/samegame/samegame1/Block.qml b/examples/declarative/tutorials/samegame/samegame1/Block.qml index f133b17..7cf819b 100644 --- a/examples/declarative/tutorials/samegame/samegame1/Block.qml +++ b/examples/declarative/tutorials/samegame/samegame1/Block.qml @@ -1,5 +1,5 @@ //![0] -import Qt 4.6 +import Qt 4.7 Item { id:block diff --git a/examples/declarative/tutorials/samegame/samegame1/Button.qml b/examples/declarative/tutorials/samegame/samegame1/Button.qml index 5e28da7..8eee2ad 100644 --- a/examples/declarative/tutorials/samegame/samegame1/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame1/Button.qml @@ -1,5 +1,5 @@ //![0] -import Qt 4.6 +import Qt 4.7 Rectangle { id: container diff --git a/examples/declarative/tutorials/samegame/samegame1/samegame.qml b/examples/declarative/tutorials/samegame/samegame1/samegame.qml index 006b926..23a25f3 100644 --- a/examples/declarative/tutorials/samegame/samegame1/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame1/samegame.qml @@ -1,5 +1,5 @@ //![0] -import Qt 4.6 +import Qt 4.7 Rectangle { id: screen diff --git a/examples/declarative/tutorials/samegame/samegame2/Block.qml b/examples/declarative/tutorials/samegame/samegame2/Block.qml index e4b3354..44ff5d7 100644 --- a/examples/declarative/tutorials/samegame/samegame2/Block.qml +++ b/examples/declarative/tutorials/samegame/samegame2/Block.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id:block diff --git a/examples/declarative/tutorials/samegame/samegame2/Button.qml b/examples/declarative/tutorials/samegame/samegame2/Button.qml index a7853d4..64a8a5a 100644 --- a/examples/declarative/tutorials/samegame/samegame2/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame2/Button.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: container diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.qml b/examples/declarative/tutorials/samegame/samegame2/samegame.qml index 89d8035..a8a58ba 100644 --- a/examples/declarative/tutorials/samegame/samegame2/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame2/samegame.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 //![2] import "samegame.js" as SameGame //![2] diff --git a/examples/declarative/tutorials/samegame/samegame3/Block.qml b/examples/declarative/tutorials/samegame/samegame3/Block.qml index 7620104..bb48ac8 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Block.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Block.qml @@ -1,5 +1,5 @@ //![0] -import Qt 4.6 +import Qt 4.7 Item { id:block diff --git a/examples/declarative/tutorials/samegame/samegame3/Button.qml b/examples/declarative/tutorials/samegame/samegame3/Button.qml index a7853d4..64a8a5a 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Button.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: container diff --git a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml index 966f85a..69bae7c 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml @@ -1,5 +1,5 @@ //![0] -import Qt 4.6 +import Qt 4.7 Rectangle { id: page diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.qml b/examples/declarative/tutorials/samegame/samegame3/samegame.qml index db25e24..cd9dca5 100644 --- a/examples/declarative/tutorials/samegame/samegame3/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame3/samegame.qml @@ -1,5 +1,5 @@ //![0] -import Qt 4.6 +import Qt 4.7 import "samegame.js" as SameGame Rectangle { diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml index e50aae0..b598b3f 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import Qt.labs.particles 1.0 Item { id:block diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml index a7853d4..64a8a5a 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: container diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml index fc83e39..49fd5f6 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: page diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame.qml b/examples/declarative/tutorials/samegame/samegame4/samegame.qml index 090496d..3c66fbf 100644 --- a/examples/declarative/tutorials/samegame/samegame4/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame4/samegame.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import "content" import "content/samegame.js" as SameGame diff --git a/examples/declarative/tvtennis/tvtennis.qml b/examples/declarative/tvtennis/tvtennis.qml index fcb285d..7c98c69 100644 --- a/examples/declarative/tvtennis/tvtennis.qml +++ b/examples/declarative/tvtennis/tvtennis.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import Qt.multimedia 4.7 Rectangle { diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index f4c24a5..8c33299 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { property alias day: dayText.text diff --git a/examples/declarative/velocity/velocity.qml b/examples/declarative/velocity/velocity.qml index 0d1881e..a091c4e 100644 --- a/examples/declarative/velocity/velocity.qml +++ b/examples/declarative/velocity/velocity.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { color: "lightSteelBlue" diff --git a/examples/declarative/webview/alerts.qml b/examples/declarative/webview/alerts.qml index 2549226..2ba4300 100644 --- a/examples/declarative/webview/alerts.qml +++ b/examples/declarative/webview/alerts.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import org.webkit 1.0 WebView { diff --git a/examples/declarative/webview/autosize.qml b/examples/declarative/webview/autosize.qml index 3c00ee6..c4a502e 100644 --- a/examples/declarative/webview/autosize.qml +++ b/examples/declarative/webview/autosize.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import org.webkit 1.0 // The WebView size is determined by the width, height, diff --git a/examples/declarative/webview/content/FieldText.qml b/examples/declarative/webview/content/FieldText.qml index 1da9219..d1d003f 100644 --- a/examples/declarative/webview/content/FieldText.qml +++ b/examples/declarative/webview/content/FieldText.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { id: fieldText diff --git a/examples/declarative/webview/content/Mapping/Map.qml b/examples/declarative/webview/content/Mapping/Map.qml index 38c42dd..5d3ba81 100644 --- a/examples/declarative/webview/content/Mapping/Map.qml +++ b/examples/declarative/webview/content/Mapping/Map.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import org.webkit 1.0 Item { diff --git a/examples/declarative/webview/content/SpinSquare.qml b/examples/declarative/webview/content/SpinSquare.qml index 62c0ce2..ccd68df 100644 --- a/examples/declarative/webview/content/SpinSquare.qml +++ b/examples/declarative/webview/content/SpinSquare.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { property var period : 250 diff --git a/examples/declarative/webview/googleMaps.qml b/examples/declarative/webview/googleMaps.qml index a0926f5..4702dea 100644 --- a/examples/declarative/webview/googleMaps.qml +++ b/examples/declarative/webview/googleMaps.qml @@ -5,7 +5,7 @@ // API, but users from QML don't need to understand the implementation in // order to create a Map. -import Qt 4.6 +import Qt 4.7 import org.webkit 1.0 import "content/Mapping" diff --git a/examples/declarative/webview/inline-html.qml b/examples/declarative/webview/inline-html.qml index 41dfec3..eec7fc6 100644 --- a/examples/declarative/webview/inline-html.qml +++ b/examples/declarative/webview/inline-html.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import org.webkit 1.0 // Inline HTML with loose formatting can be diff --git a/examples/declarative/webview/newwindows.qml b/examples/declarative/webview/newwindows.qml index c62aba6..2e4a72e 100644 --- a/examples/declarative/webview/newwindows.qml +++ b/examples/declarative/webview/newwindows.qml @@ -3,7 +3,7 @@ // Note that to open windows from JavaScript, you will need to // allow it on WebView with settings.javascriptCanOpenWindows: true -import Qt 4.6 +import Qt 4.7 import org.webkit 1.0 Grid { diff --git a/examples/declarative/webview/transparent.qml b/examples/declarative/webview/transparent.qml index 5530819..a0676f4 100644 --- a/examples/declarative/webview/transparent.qml +++ b/examples/declarative/webview/transparent.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 import org.webkit 1.0 // The WebView background is transparent diff --git a/examples/declarative/workerscript/workerscript.qml b/examples/declarative/workerscript/workerscript.qml index 0566f1f..1c7a920 100644 --- a/examples/declarative/workerscript/workerscript.qml +++ b/examples/declarative/workerscript/workerscript.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 480; height: 320; diff --git a/examples/declarative/xmldata/daringfireball.qml b/examples/declarative/xmldata/daringfireball.qml index 25eb1ac..c5732c0 100644 --- a/examples/declarative/xmldata/daringfireball.qml +++ b/examples/declarative/xmldata/daringfireball.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { color: "white" diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml index d69982e..e6cb373 100644 --- a/examples/declarative/xmldata/yahoonews.qml +++ b/examples/declarative/xmldata/yahoonews.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { gradient: Gradient { diff --git a/examples/declarative/xmlhttprequest/test.qml b/examples/declarative/xmlhttprequest/test.qml index 15ac54b..ef9d5f3 100644 --- a/examples/declarative/xmlhttprequest/test.qml +++ b/examples/declarative/xmlhttprequest/test.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 800; height: 600 diff --git a/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp b/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp index c846431..f5beebd 100644 --- a/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp +++ b/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp @@ -108,7 +108,7 @@ public: Example: \code - import Qt 4.6 + import Qt 4.7 import MyApp 2.1 as Widgets Rectangle{ id: rect diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 29e43f9..4b311af 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -449,7 +449,7 @@ void QDeclarativeTextInput::setFocusOnPress(bool b) input of integers between 11 and 31 into the text input: \code - import Qt 4.6 + import Qt 4.7 TextInput{ validator: IntValidator{bottom: 11; top: 31;} focus: true diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index dfd9c0c..15348ed 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -830,7 +830,7 @@ void QDeclarativeVisualDataModel::setDelegate(QDeclarativeComponent *delegate) \code // view.qml - import Qt 4.6 + import Qt 4.7 ListView { width: 200 diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 44437ea..ee0bd18 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -408,7 +408,7 @@ QDeclarativeWorkerScriptEngine *QDeclarativeEnginePrivate::getWorkerScriptEngine \code QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\nText { text: \"Hello world!\" }", QUrl()); + component.setData("import Qt 4.7\nText { text: \"Hello world!\" }", QUrl()); QDeclarativeItem *item = qobject_cast(component.create()); //add item to view, etc diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index ddb0ece..caf680e 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -508,7 +508,7 @@ void QDeclarativeWorkerScriptEngine::run() Here is an example: \qml - import Qt 4.6 + import Qt 4.7 Rectangle { width: 300 diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index 0ed97bf..ecbd71e 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -103,7 +103,7 @@ QT_BEGIN_NAMESPACE natural width (which is the whole string on one line). \qml - import Qt 4.6 + import Qt 4.7 Rectangle { width: 640 diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp index 3411642..a30e577 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation.cpp +++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp @@ -270,7 +270,7 @@ void QSmoothedAnimation::init() The follow example shows one rectangle tracking the position of another. \code -import Qt 4.6 +import Qt 4.7 Rectangle { width: 800; height: 600; color: "blue" -- cgit v0.12 From 224189f1531bc9e2e25b9ea72038e240bd3550a9 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 8 Apr 2010 13:53:42 +1000 Subject: Fix test. --- .../declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp index c747bfc..a1aceb7 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp +++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp @@ -526,6 +526,7 @@ void tst_qdeclarativeinstruction::dump() << "-------------------------------------------------------------------------------" << "0\t\t0\tINIT\t\t\t0\t3\t-1\t-1" << "1\t\t1\tCREATE\t\t\t0\t\t\t\"Test\"" + << "1\t\t1\tCREATE_SIMPLE\t\t-1" << "2\t\t2\tSETID\t\t\t0\t\t\t\"testId\"" << "3\t\t3\tSET_DEFAULT" << "4\t\t4\tCREATE_COMPONENT\t3" -- cgit v0.12 From 31ec693cd6ae4cf5a2533092f45ba9bb154ba152 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 14:22:01 +1000 Subject: Ignore current spurious warnings. Task-number: QT-3245 --- .../qdeclarativeanchors/tst_qdeclarativeanchors.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index 16ae7fc..9eaa400 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -372,6 +372,16 @@ void tst_qdeclarativeanchors::crash1() QUrl source(QUrl::fromLocalFile(SRCDIR "/data/crash1.qml")); QString expect = "QML Text (" + source.toString() + ":4:5" + ") Possible anchor loop detected on fill."; + + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); + + // QT-3245 ... anchor loop detection needs improving. + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); QDeclarativeView *view = new QDeclarativeView(source); -- cgit v0.12 From a8247ce85808614f6ec921a37bae9fb0d447252b Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 14:27:04 +1000 Subject: Autotest for 76f5e9e7d1eea8d688d5459b7b7b2bfa3f9057ed --- .../qdeclarativeecmascript/data/extensionObjects.qml | 9 +++++++++ .../qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/extensionObjects.qml b/tests/auto/declarative/qdeclarativeecmascript/data/extensionObjects.qml index a902312..566f5ed 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/extensionObjects.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/extensionObjects.qml @@ -1,4 +1,5 @@ import Qt.test 1.0 +import Qt 4.6 MyExtendedObject { @@ -7,4 +8,12 @@ MyExtendedObject coreProperty: extendedProperty extendedProperty: 9 + + property QtObject nested: MyExtendedObject { + baseProperty: baseExtendedProperty + baseExtendedProperty: 13 + + coreProperty: extendedProperty + extendedProperty: 9 + } } diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 77dd4b8..8e73afa 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -543,11 +543,20 @@ void tst_qdeclarativeecmascript::extensionObjects() QVERIFY(object != 0); QCOMPARE(object->baseProperty(), 13); QCOMPARE(object->coreProperty(), 9); - object->setProperty("extendedProperty", QVariant(11)); object->setProperty("baseExtendedProperty", QVariant(92)); QCOMPARE(object->coreProperty(), 11); QCOMPARE(object->baseProperty(), 92); + + MyExtendedObject *nested = qobject_cast(qvariant_cast(object->property("nested"))); + QVERIFY(nested); + QCOMPARE(nested->baseProperty(), 13); + QCOMPARE(nested->coreProperty(), 9); + nested->setProperty("extendedProperty", QVariant(11)); + nested->setProperty("baseExtendedProperty", QVariant(92)); + QCOMPARE(nested->coreProperty(), 11); + QCOMPARE(nested->baseProperty(), 92); + } void tst_qdeclarativeecmascript::attachedProperties() -- cgit v0.12 From 0b354c8a2f2a0b76434546ff3e4f6a0d94a05b4b Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 14:50:30 +1000 Subject: Do not create a QScriptValue for an object being deleted --- src/declarative/qml/qdeclarativeobjectscriptclass.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 10b9fab..32ba2c3 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -100,6 +100,9 @@ QScriptValue QDeclarativeObjectScriptClass::newQObject(QObject *object, int type if (!object) return newObject(scriptEngine, this, new ObjectData(object, type)); + if (QObjectPrivate::get(object)->wasDeleted) + return scriptEngine->undefinedValue(); + QDeclarativeDeclarativeData *ddata = QDeclarativeDeclarativeData::get(object, true); if (!ddata) { -- cgit v0.12 From bcb8c932aa10cd207850a8bfcdd12d90d440f18a Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Wed, 31 Mar 2010 10:18:23 +1000 Subject: Refactor in smoothedanimation, removed unneeded code --- src/declarative/util/qdeclarativesmoothedanimation.cpp | 6 +----- src/declarative/util/qdeclarativesmoothedanimation_p.h | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp index a30e577..21a8be2 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation.cpp +++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp @@ -343,17 +343,14 @@ void QDeclarativeSmoothedAnimation::transition(QDeclarativeStateActions &actions QSet anims; for (int i = 0; i < d->actions->size(); i++) { QSmoothedAnimation *ease; - qreal trackVelocity; bool needsRestart; if (!d->activeAnimations.contains((*d->actions)[i].property)) { ease = new QSmoothedAnimation(); d->wrapperGroup->addAnimation(ease); d->activeAnimations.insert((*d->actions)[i].property, ease); - trackVelocity = 0.0; needsRestart = false; } else { ease = d->activeAnimations.value((*d->actions)[i].property); - trackVelocity = ease->trackVelocity; needsRestart = true; } @@ -366,8 +363,7 @@ void QDeclarativeSmoothedAnimation::transition(QDeclarativeStateActions &actions ease->velocity = d->anim->velocity; ease->userDuration = d->anim->userDuration; - ease->trackVelocity = trackVelocity; - ease->initialVelocity = trackVelocity; + ease->initialVelocity = ease->trackVelocity; if (needsRestart) ease->init(); diff --git a/src/declarative/util/qdeclarativesmoothedanimation_p.h b/src/declarative/util/qdeclarativesmoothedanimation_p.h index df53104..17aafa4 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation_p.h +++ b/src/declarative/util/qdeclarativesmoothedanimation_p.h @@ -83,7 +83,6 @@ public: int maximumEasingTime() const; void setMaximumEasingTime(int); -public: virtual void transition(QDeclarativeStateActions &actions, QDeclarativeProperties &modified, TransitionDirection direction); -- cgit v0.12 From 20f614ccfa7657da7e9d585de34c578cef659920 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Wed, 31 Mar 2010 18:31:08 +1000 Subject: Fix doc of qml's SmoothedAnimation --- .../util/qdeclarativesmoothedanimation.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp index 21a8be2..f21b0c7 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation.cpp +++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp @@ -248,13 +248,14 @@ void QSmoothedAnimation::init() /*! \qmlclass SmoothedAnimation QDeclarativeSmoothedAnimation \since 4.7 + \inherits NumberAnimation \brief The SmoothedAnimation element allows a property to smoothly track a value. - The SmoothedAnimation smoothly animates a property's value to a set target value + The SmoothedAnimation animates a property's value to a set target value using an ease in/out quad easing curve. If the animation is restarted with a different target value, the easing curves used to animate to the old - and the new target values are spliced together to avoid any obvious visual - glitches. + and the new target values are smoothly spliced together to avoid any obvious + visual glitches by maintaining the current velocity. The property animation is configured by setting the velocity at which the animation should occur, or the duration that the animation should take. @@ -454,14 +455,14 @@ void QDeclarativeSmoothedAnimation::setVelocity(qreal v) } /*! -\qmlproperty qreal SmoothedAnimation::maximumEasingTime + \qmlproperty qreal SmoothedAnimation::maximumEasingTime -This property specifies the maximum time, in msecs, an "eases" during the follow should take. -Setting this property causes the velocity to "level out" after at a time. Setting -a negative value reverts to the normal mode of easing over the entire animation -duration. + This property specifies the maximum time, in msecs, an "eases" during the follow should take. + Setting this property causes the velocity to "level out" after at a time. Setting + a negative value reverts to the normal mode of easing over the entire animation + duration. -The default value is -1. + The default value is -1. */ int QDeclarativeSmoothedAnimation::maximumEasingTime() const { -- cgit v0.12 From 74595d1d6156603fc29090a96e0f0d066756bbe6 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Thu, 8 Apr 2010 11:31:57 +1000 Subject: Tracking the velocity when restarting SmoothedAnimation --- src/declarative/util/qdeclarativesmoothedanimation.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp index f21b0c7..48a7583 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation.cpp +++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp @@ -69,6 +69,7 @@ QSmoothedAnimation::QSmoothedAnimation(QObject *parent) void QSmoothedAnimation::restart() { + initialVelocity = trackVelocity; if (state() != QAbstractAnimation::Running) start(); else @@ -224,6 +225,7 @@ void QSmoothedAnimation::init() QDeclarativePropertyPrivate::write(target, to, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); + stop(); return; case QDeclarativeSmoothedAnimation::Immediate: initialVelocity = 0; -- cgit v0.12 From 62fb142331fe8780a38a3ec84cf0e9d5eada316e Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Thu, 8 Apr 2010 13:42:58 +1000 Subject: Add SmoothedFollow element to qml The SmoothedFollow is the same as the old EaseFollow, so it's not an animation, but its main use case is to be used as a property value source to automatically follow the 'to' property, as in the example below. Rectangle { color: "green" width: 60; height: 60; SmoothedFollow on x { to: rect1.x - 5; velocity: 200 } SmoothedFollow on y { to: rect1.y - 5; velocity: 200 } } This element shares the internal implementation with SmoothedAnimation, both providing the same easing function, but with SmoothedFollow it's easier to set a start value to animate intially and then start to follow, while SmoothedAnimation is still convenient for using inside Behaviors and Transitions. Reviewed-by: Michael Brasser --- .../util/qdeclarativesmoothedfollow.cpp | 299 +++++++++++++++++++++ .../util/qdeclarativesmoothedfollow_p.h | 113 ++++++++ src/declarative/util/qdeclarativeutilmodule.cpp | 2 + src/declarative/util/util.pri | 2 + tests/auto/declarative/declarative.pro | 3 +- .../data/smoothedfollow1.qml | 3 + .../data/smoothedfollow2.qml | 5 + .../data/smoothedfollow3.qml | 6 + .../data/smoothedfollowDisabled.qml | 13 + .../data/smoothedfollowValueSource.qml | 13 + .../qdeclarativesmoothedfollow.pro | 8 + .../tst_qdeclarativesmoothedfollow.cpp | 189 +++++++++++++ .../smoothedfollow.qml | 40 +++ 13 files changed, 695 insertions(+), 1 deletion(-) create mode 100644 src/declarative/util/qdeclarativesmoothedfollow.cpp create mode 100644 src/declarative/util/qdeclarativesmoothedfollow_p.h create mode 100644 tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow1.qml create mode 100644 tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow2.qml create mode 100644 tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow3.qml create mode 100644 tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollowDisabled.qml create mode 100644 tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollowValueSource.qml create mode 100644 tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro create mode 100644 tests/auto/declarative/qdeclarativesmoothedfollow/tst_qdeclarativesmoothedfollow.cpp create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml diff --git a/src/declarative/util/qdeclarativesmoothedfollow.cpp b/src/declarative/util/qdeclarativesmoothedfollow.cpp new file mode 100644 index 0000000..63c9618 --- /dev/null +++ b/src/declarative/util/qdeclarativesmoothedfollow.cpp @@ -0,0 +1,299 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativesmoothedfollow_p.h" +#include "qdeclarativesmoothedanimation_p_p.h" + +#include +#include + +#include "qdeclarativeglobal_p.h" + + +QT_BEGIN_NAMESPACE + +class QDeclarativeSmoothedFollowPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QDeclarativeSmoothedFollow) +public: + QDeclarativeSmoothedFollowPrivate(); + + bool enabled; + QSmoothedAnimation *anim; +}; + +/*! + \qmlclass SmoothedFollow QDeclarativeSmoothedFollow + \since 4.7 + \inherits NumberAnimation + \brief The SmoothedFollow element allows a property to smoothly track a value. + + The SmoothedFollow animates a property's value to a set target value + using an ease in/out quad easing curve. If the animation is restarted + with a different target value, the easing curves used to animate to the old + and the new target values are smoothly spliced together to avoid any obvious + visual glitches by maintaining the current velocity. + + The property animation is configured by setting the velocity at which the + animation should occur, or the duration that the animation should take. + If both a velocity and a duration are specified, the one that results in + the quickest animation is chosen for each change in the target value. + + For example, animating from 0 to 800 will take 4 seconds if a velocity + of 200 is set, will take 8 seconds with a duration of 8000 set, and will + take 4 seconds with both a velocity of 200 and a duration of 8000 set. + Animating from 0 to 20000 will take 10 seconds if a velocity of 200 is set, + will take 8 seconds with a duration of 8000 set, and will take 8 seconds + with both a velocity of 200 and a duration of 8000 set. + + The follow example shows one rectangle tracking the position of another. +\code +import Qt 4.6 + +Rectangle { + width: 800; height: 600; color: "blue" + + Rectangle { + color: "green" + width: 60; height: 60; + SmoothedFollow on x { to: rect1.x - 5; velocity: 200 } + SmoothedFollow on y { to: rect1.y - 5; velocity: 200 } + } + + Rectangle { + id: rect1 + color: "red" + width: 50; height: 50; + } + + focus: true + Keys.onRightPressed: rect1.x = rect1.x + 100 + Keys.onLeftPressed: rect1.x = rect1.x - 100 + Keys.onUpPressed: rect1.y = rect1.y - 100 + Keys.onDownPressed: rect1.y = rect1.y + 100 +} +\endcode + + The default velocity of SmoothedFollow is 200 units/second. Note that if the range of the + value being animated is small, then the velocity will need to be adjusted + appropriately. For example, the opacity of an item ranges from 0 - 1.0. + To enable a smooth animation in this range the velocity will need to be + set to a value such as 0.5 units/second. Animating from 0 to 1.0 with a velocity + of 0.5 will take 2000 ms to complete. + + \sa SpringFollow +*/ + +QDeclarativeSmoothedFollow::QDeclarativeSmoothedFollow(QObject *parent) + : QObject(*(new QDeclarativeSmoothedFollowPrivate), parent) +{ +} + +QDeclarativeSmoothedFollow::~QDeclarativeSmoothedFollow() +{ +} + +QDeclarativeSmoothedFollowPrivate::QDeclarativeSmoothedFollowPrivate() + : enabled(true), anim(new QSmoothedAnimation) +{ + Q_Q(QDeclarativeSmoothedFollow); + QDeclarative_setParent_noEvent(anim, q); +} + +/*! + \qmlproperty enumeration SmoothedFollow::reversingMode + + Sets how the SmoothedFollow behaves if an animation direction is reversed. + + If reversing mode is \c Eased, the animation will smoothly decelerate, and + then reverse direction. If the reversing mode is \c Immediate, the + animation will immediately begin accelerating in the reverse direction, + begining with a velocity of 0. If the reversing mode is \c Sync, the + property is immediately set to the target value. +*/ +QDeclarativeSmoothedFollow::ReversingMode QDeclarativeSmoothedFollow::reversingMode() const +{ + Q_D(const QDeclarativeSmoothedFollow); + return (ReversingMode) d->anim->reversingMode; +} + +void QDeclarativeSmoothedFollow::setReversingMode(ReversingMode m) +{ + Q_D(QDeclarativeSmoothedFollow); + if (d->anim->reversingMode == (QDeclarativeSmoothedAnimation::ReversingMode) m) + return; + + d->anim->reversingMode = (QDeclarativeSmoothedAnimation::ReversingMode) m; + emit reversingModeChanged(); +} + +/*! + \qmlproperty int SmoothedFollow::duration + + This property holds the animation duration, in msecs, used when tracking the source. + + Setting this to -1 (the default) disables the duration value. +*/ +int QDeclarativeSmoothedFollow::duration() const +{ + Q_D(const QDeclarativeSmoothedFollow); + return d->anim->userDuration; +} + +void QDeclarativeSmoothedFollow::setDuration(int duration) +{ + Q_D(QDeclarativeSmoothedFollow); + if (duration == d->anim->duration()) + return; + + d->anim->userDuration = duration; + emit durationChanged(); +} + +qreal QDeclarativeSmoothedFollow::velocity() const +{ + Q_D(const QDeclarativeSmoothedFollow); + return d->anim->velocity; +} + +/*! + \qmlproperty qreal SmoothedFollow::velocity + + This property holds the average velocity allowed when tracking the 'to' value. + + The default velocity of SmoothedFollow is 200 units/second. + + Setting this to -1 disables the velocity value. +*/ +void QDeclarativeSmoothedFollow::setVelocity(qreal v) +{ + Q_D(QDeclarativeSmoothedFollow); + if (d->anim->velocity == v) + return; + + d->anim->velocity = v; + emit velocityChanged(); +} + +/*! + \qmlproperty qreal SmoothedFollow::maximumEasingTime + + This property specifies the maximum time, in msecs, an "eases" during the follow should take. + Setting this property causes the velocity to "level out" after at a time. Setting + a negative value reverts to the normal mode of easing over the entire animation + duration. + + The default value is -1. +*/ +int QDeclarativeSmoothedFollow::maximumEasingTime() const +{ + Q_D(const QDeclarativeSmoothedFollow); + return d->anim->maximumEasingTime; +} + +void QDeclarativeSmoothedFollow::setMaximumEasingTime(int v) +{ + Q_D(QDeclarativeSmoothedFollow); + d->anim->maximumEasingTime = v; + emit maximumEasingTimeChanged(); +} + +/*! + \qmlproperty real SmoothedFollow::to + This property holds the ending value. + If not set, then the value defined in the end state of the transition or Behavior. +*/ +qreal QDeclarativeSmoothedFollow::to() const +{ + Q_D(const QDeclarativeSmoothedFollow); + return d->anim->to; +} + +void QDeclarativeSmoothedFollow::setTo(qreal t) +{ + Q_D(QDeclarativeSmoothedFollow); + + if (qIsNaN(t)) + return; + + if (d->anim->to == t) + return; + + d->anim->to = t; + + if (d->enabled) + d->anim->restart(); +} + +/*! + \qmlproperty bool SmoothedFollow::enabled + This property whether this animation should automatically restart when + the 'to' property is upated. + + The default value of this property is 'true'. +*/ +bool QDeclarativeSmoothedFollow::enabled() const +{ + Q_D(const QDeclarativeSmoothedFollow); + return d->enabled; +} + +void QDeclarativeSmoothedFollow::setEnabled(bool e) +{ + Q_D(QDeclarativeSmoothedFollow); + if (d->enabled == e) + return; + d->enabled = e; + + if (d->enabled) + d->anim->restart(); + else + d->anim->stop(); + emit enabledChanged(); +} + +void QDeclarativeSmoothedFollow::setTarget(const QDeclarativeProperty &t) +{ + Q_D(QDeclarativeSmoothedFollow); + d->anim->target = t; +} + +QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativesmoothedfollow_p.h b/src/declarative/util/qdeclarativesmoothedfollow_p.h new file mode 100644 index 0000000..d860052 --- /dev/null +++ b/src/declarative/util/qdeclarativesmoothedfollow_p.h @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module 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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVESMOOTHEDFOLLOW_H +#define QDECLARATIVESMOOTHEDFOLLOW_H + +#include +#include + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeProperty; +class QDeclarativeSmoothedFollowPrivate; +class Q_DECLARATIVE_EXPORT QDeclarativeSmoothedFollow : public QObject, + public QDeclarativePropertyValueSource +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QDeclarativeSmoothedFollow) + Q_INTERFACES(QDeclarativePropertyValueSource) + Q_ENUMS(ReversingMode) + + Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) + Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity NOTIFY velocityChanged) + Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) + Q_PROPERTY(ReversingMode reversingMode READ reversingMode WRITE setReversingMode NOTIFY reversingModeChanged) + Q_PROPERTY(qreal maximumEasingTime READ maximumEasingTime WRITE setMaximumEasingTime NOTIFY maximumEasingTimeChanged) + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) + +public: + enum ReversingMode { Eased, Immediate, Sync }; + + QDeclarativeSmoothedFollow(QObject *parent = 0); + ~QDeclarativeSmoothedFollow(); + + qreal to() const; + void setTo(qreal); + + ReversingMode reversingMode() const; + void setReversingMode(ReversingMode); + + int duration() const; + void setDuration(int); + + qreal velocity() const; + void setVelocity(qreal); + + int maximumEasingTime() const; + void setMaximumEasingTime(int); + + bool enabled() const; + void setEnabled(bool); + + virtual void setTarget(const QDeclarativeProperty &); + +Q_SIGNALS: + void velocityChanged(); + void durationChanged(); + void reversingModeChanged(); + void maximumEasingTimeChanged(); + void enabledChanged(); +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QDeclarativeSmoothedFollow); + +QT_END_HEADER + +#endif // QDECLARATIVESMOOTHEDFOLLOW_H diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp index 218a90b..b9f1abb 100644 --- a/src/declarative/util/qdeclarativeutilmodule.cpp +++ b/src/declarative/util/qdeclarativeutilmodule.cpp @@ -46,6 +46,7 @@ #include "private/qdeclarativebind_p.h" #include "private/qdeclarativeconnections_p.h" #include "private/qdeclarativesmoothedanimation_p.h" +#include "private/qdeclarativesmoothedfollow_p.h" #include "private/qdeclarativefontloader_p.h" #include "private/qdeclarativelistaccessor_p.h" #include "private/qdeclarativelistmodel_p.h" @@ -80,6 +81,7 @@ void QDeclarativeUtilModule::defineModule() qmlRegisterType("Qt",4,6,"ColorAnimation"); qmlRegisterType("Qt",4,6,"Connections"); qmlRegisterType("Qt",4,6,"SmoothedAnimation"); + qmlRegisterType("Qt",4,6,"SmoothedFollow"); qmlRegisterType("Qt",4,6,"FontLoader"); qmlRegisterType("Qt",4,6,"ListElement"); qmlRegisterType("Qt",4,6,"NumberAnimation"); diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri index 4163596..f20bba1 100644 --- a/src/declarative/util/util.pri +++ b/src/declarative/util/util.pri @@ -9,6 +9,7 @@ SOURCES += \ $$PWD/qdeclarativesystempalette.cpp \ $$PWD/qdeclarativespringfollow.cpp \ $$PWD/qdeclarativesmoothedanimation.cpp \ + $$PWD/qdeclarativesmoothedfollow.cpp \ $$PWD/qdeclarativestate.cpp\ $$PWD/qdeclarativetransitionmanager.cpp \ $$PWD/qdeclarativestateoperations.cpp \ @@ -38,6 +39,7 @@ HEADERS += \ $$PWD/qdeclarativesystempalette_p.h \ $$PWD/qdeclarativespringfollow_p.h \ $$PWD/qdeclarativesmoothedanimation_p.h \ + $$PWD/qdeclarativesmoothedfollow_p.h \ $$PWD/qdeclarativesmoothedanimation_p_p.h \ $$PWD/qdeclarativestate_p.h\ $$PWD/qdeclarativestateoperations_p.h \ diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 2d88058..11d7c13 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -41,13 +41,14 @@ SUBDIRS += \ qdeclarativelanguage \ # Cover qdeclarativelistreference \ # Cover qdeclarativelistmodel \ # Cover - qdeclarativeproperty \ # Cover + qdeclarativeproperty \ # Cover qdeclarativemetatype \ # Cover qdeclarativemoduleplugin \ # Cover qdeclarativepixmapcache \ # Cover qdeclarativepropertymap \ # Cover qdeclarativeqt \ # Cover qdeclarativesmoothedanimation \ # Cover + qdeclarativesmoothedfollow\ # Cover qdeclarativespringfollow \ # Cover qdeclarativestates \ # Cover qdeclarativesystempalette \ # Cover diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow1.qml b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow1.qml new file mode 100644 index 0000000..c162e7a --- /dev/null +++ b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow1.qml @@ -0,0 +1,3 @@ +import Qt 4.6 + +SmoothedFollow {} diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow2.qml b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow2.qml new file mode 100644 index 0000000..d45001f --- /dev/null +++ b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow2.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +SmoothedFollow { + to: 10; duration: 300; reversingMode: SmoothedFollow.Immediate +} diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow3.qml b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow3.qml new file mode 100644 index 0000000..c09fb8e --- /dev/null +++ b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollow3.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +SmoothedFollow { + to: 10; velocity: 250; reversingMode: SmoothedFollow.Sync + maximumEasingTime: 150 +} diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollowDisabled.qml b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollowDisabled.qml new file mode 100644 index 0000000..131f674 --- /dev/null +++ b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollowDisabled.qml @@ -0,0 +1,13 @@ +import Qt 4.6 + +Rectangle { + width: 300; height: 300; + Rectangle { + objectName: "theRect" + color: "red" + width: 60; height: 60; + x: 100; y: 100; + SmoothedFollow on x { id: animX; objectName: "animX"; to: 200; enabled: true; duration: 200 } + SmoothedFollow on y { id: animY; objectName: "animY"; to: 200; enabled: false; duration: 200 } + } +} diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollowValueSource.qml b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollowValueSource.qml new file mode 100644 index 0000000..514537c --- /dev/null +++ b/tests/auto/declarative/qdeclarativesmoothedfollow/data/smoothedfollowValueSource.qml @@ -0,0 +1,13 @@ +import Qt 4.6 + +Rectangle { + width: 300; height: 300; + Rectangle { + objectName: "theRect" + color: "red" + width: 60; height: 60; + x: 100; y: 100; + SmoothedFollow on x { objectName: "easeX"; to: 200; velocity: 500 } + SmoothedFollow on y { objectName: "easeY"; to: 200; duration: 250; velocity: 500 } + } +} diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro b/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro new file mode 100644 index 0000000..f8e97a0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativesmoothedfollow.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/tst_qdeclarativesmoothedfollow.cpp b/tests/auto/declarative/qdeclarativesmoothedfollow/tst_qdeclarativesmoothedfollow.cpp new file mode 100644 index 0000000..ac750d9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativesmoothedfollow/tst_qdeclarativesmoothedfollow.cpp @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite 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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include +#include + +#include +#include +#include +#include "../../../shared/util.h" + +class tst_qdeclarativesmoothedfollow : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativesmoothedfollow(); + +private slots: + void defaultValues(); + void values(); + void disabled(); + void valueSource(); + void followTo(); + +private: + QDeclarativeEngine engine; +}; + +tst_qdeclarativesmoothedfollow::tst_qdeclarativesmoothedfollow() +{ +} + +void tst_qdeclarativesmoothedfollow::defaultValues() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedfollow1.qml")); + QDeclarativeSmoothedFollow *obj = qobject_cast(c.create()); + + QVERIFY(obj != 0); + + QCOMPARE(obj->to(), 0.); + QCOMPARE(obj->velocity(), 200.); + QCOMPARE(obj->duration(), -1); + QCOMPARE(obj->maximumEasingTime(), -1); + QCOMPARE(obj->reversingMode(), QDeclarativeSmoothedFollow::Eased); + + delete obj; +} + +void tst_qdeclarativesmoothedfollow::values() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedfollow2.qml")); + QDeclarativeSmoothedFollow *obj = qobject_cast(c.create()); + + QVERIFY(obj != 0); + + QCOMPARE(obj->to(), 10.); + QCOMPARE(obj->velocity(), 200.); + QCOMPARE(obj->duration(), 300); + QCOMPARE(obj->maximumEasingTime(), -1); + QCOMPARE(obj->reversingMode(), QDeclarativeSmoothedFollow::Immediate); + + delete obj; +} + +void tst_qdeclarativesmoothedfollow::disabled() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedfollow3.qml")); + QDeclarativeSmoothedFollow *obj = qobject_cast(c.create()); + + QVERIFY(obj != 0); + + QCOMPARE(obj->to(), 10.); + QCOMPARE(obj->velocity(), 250.); + QCOMPARE(obj->maximumEasingTime(), 150); + QCOMPARE(obj->reversingMode(), QDeclarativeSmoothedFollow::Sync); + + delete obj; +} + +void tst_qdeclarativesmoothedfollow::valueSource() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedfollowValueSource.qml")); + + QDeclarativeRectangle *rect = qobject_cast(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *theRect = rect->findChild("theRect"); + QVERIFY(theRect); + + QDeclarativeSmoothedFollow *easeX = rect->findChild("easeX"); + QVERIFY(easeX); + QVERIFY(easeX->enabled()); + + QDeclarativeSmoothedFollow *easeY = rect->findChild("easeY"); + QVERIFY(easeY); + QVERIFY(easeY->enabled()); + + // XXX get the proper duration + QTest::qWait(200); + + QTRY_COMPARE(theRect->x(), easeX->to()); + QTRY_COMPARE(theRect->y(), easeY->to()); + + QTRY_COMPARE(theRect->x(), qreal(200)); + QTRY_COMPARE(theRect->y(), qreal(200)); +} + +void tst_qdeclarativesmoothedfollow::followTo() +{ + QDeclarativeView canvas; + canvas.setFixedSize(240,320); + + canvas.setSource(QUrl::fromLocalFile(SRCDIR "/data/smoothedfollowDisabled.qml")); + canvas.show(); + canvas.setFocus(); + QVERIFY(canvas.rootObject() != 0); + + QDeclarativeRectangle *rect = canvas.rootObject()->findChild("theRect"); + QVERIFY(rect != 0); + + QDeclarativeSmoothedFollow *animX = canvas.rootObject()->findChild("animX"); + QVERIFY(animX != 0); + QDeclarativeSmoothedFollow *animY = canvas.rootObject()->findChild("animY"); + QVERIFY(animY != 0); + + QVERIFY(animX->enabled()); + QVERIFY(!animY->enabled()); + + // animX should track 'to' + animX->setTo(50.0); + // animY should not track this 'to' change + animY->setTo(50.0); + + // XXX get the proper duration + QTest::qWait(250); + + QTRY_COMPARE(rect->x(), animX->to()); + + QCOMPARE(rect->x(), 50.0); + QCOMPARE(rect->y(), 100.0); +} + +QTEST_MAIN(tst_qdeclarativesmoothedfollow) + +#include "tst_qdeclarativesmoothedfollow.moc" diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml new file mode 100644 index 0000000..5dee0c6 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml @@ -0,0 +1,40 @@ +import Qt 4.6 + +Rectangle { + width: 800; height: 240; color: "gray" + + Rectangle { + id: rect + width: 50; height: 20; y: 30; color: "black" + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { from: 50; to: 700; duration: 2000 } + NumberAnimation { from: 700; to: 50; duration: 2000 } + } + } + + Rectangle { + width: 50; height: 20; y: 60; color: "red" + SmoothedFollow on x { to: rect.x; velocity: 400; enabled: true } + } + + Rectangle { + width: 50; height: 20; y: 90; color: "yellow" + SmoothedFollow on x { to: rect.x; velocity: 300; reversingMode: SmoothedAnimation.Immediate; enabled: true } + } + + Rectangle { + width: 50; height: 20; y: 120; color: "green" + SmoothedFollow on x { to: rect.x; reversingMode: SmoothedAnimation.Sync; enabled: true } + } + + Rectangle { + width: 50; height: 20; y: 150; color: "purple" + SmoothedFollow on x { to: rect.x; maximumEasingTime: 200; enabled: true } + } + + Rectangle { + width: 50; height: 20; y: 180; color: "blue" + SmoothedFollow on x { to: rect.x; duration: 300; enabled: true } + } +} -- cgit v0.12 From cabf4f41a51599b3527cd848af14966986430566 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Thu, 8 Apr 2010 14:53:29 +1000 Subject: Fix tst_qdeclarativesmoothedanimation::behavior Added an 'id' to the animations inside Behaviors to avoid deferred creation. --- .../qdeclarativesmoothedanimation/data/smoothedanimationBehavior.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationBehavior.qml b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationBehavior.qml index eb06344..ec35067 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationBehavior.qml +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationBehavior.qml @@ -17,7 +17,8 @@ Rectangle { color: "green" width: 60; height: 60; x: rect1.x; y: rect1.y; - Behavior on x { SmoothedAnimation { objectName: "easeX"; velocity: 400 } } - Behavior on y { SmoothedAnimation { objectName: "easeY"; velocity: 400 } } + // id are needed for SmoothedAnimation in order to avoid deferred creation + Behavior on x { SmoothedAnimation { id: anim1; objectName: "easeX"; velocity: 400 } } + Behavior on y { SmoothedAnimation { id: anim2; objectName: "easeY"; velocity: 400 } } } } -- cgit v0.12 From 9fd2d52881356fb214213f139a2f25081fc848e4 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 15:07:54 +1000 Subject: Fix AnimatedImage for remote image test. Fix and test sourceSize property. --- .../graphicsitems/qdeclarativeanimatedimage.cpp | 2 +- .../graphicsitems/qdeclarativeanimatedimage_p.h | 5 +++++ .../graphicsitems/qdeclarativeimagebase_p.h | 2 +- .../data/stickmanerror1.qml | 6 ++++++ .../data/stickmanscaled.qml | 7 +++++++ .../tst_qdeclarativeanimatedimage.cpp | 24 ++++++++++++++++++++++ 6 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanerror1.qml create mode 100644 tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanscaled.qml diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index f14f773..cc062f0 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -312,7 +312,7 @@ void QDeclarativeAnimatedImage::playingStatusChanged() void QDeclarativeAnimatedImage::componentComplete() { Q_D(QDeclarativeAnimatedImage); - QDeclarativeImage::componentComplete(); + QDeclarativeItem::componentComplete(); // NOT QDeclarativeImage if (!d->reply) { setCurrentFrame(d->preset_currentframe); d->preset_currentframe = 0; diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h index 6ab66b3..9d8087c 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h @@ -61,6 +61,10 @@ class Q_DECLARATIVE_EXPORT QDeclarativeAnimatedImage : public QDeclarativeImage Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY frameChanged) Q_PROPERTY(int frameCount READ frameCount) + + // read-only for AnimatedImage + Q_PROPERTY(QSize sourceSize READ sourceSize NOTIFY sourceSizeChanged) + public: QDeclarativeAnimatedImage(QDeclarativeItem *parent=0); ~QDeclarativeAnimatedImage(); @@ -83,6 +87,7 @@ Q_SIGNALS: void playingChanged(); void pausedChanged(); void frameChanged(); + void sourceSizeChanged(); private Q_SLOTS: void movieUpdate(); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h index 6c84456..49b1c58 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h @@ -73,7 +73,7 @@ public: bool asynchronous() const; void setAsynchronous(bool); - void setSourceSize(const QSize&); + virtual void setSourceSize(const QSize&); QSize sourceSize() const; Q_SIGNALS: diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanerror1.qml b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanerror1.qml new file mode 100644 index 0000000..5b0bdcb --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanerror1.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +AnimatedImage { + sourceSize: "240x180" + source: "stickman.gif" +} diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanscaled.qml b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanscaled.qml new file mode 100644 index 0000000..f4d277a --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanscaled.qml @@ -0,0 +1,7 @@ +import Qt 4.6 + +AnimatedImage { + width: 240 + height: 180 + source: "stickman.gif" +} diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp index 31efc64..39ce9eb 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp +++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp @@ -72,6 +72,8 @@ private slots: void frameCount(); void remote(); void remote_data(); + void sourceSize(); + void sourceSizeReadOnly(); void invalidSource(); }; @@ -155,10 +157,32 @@ void tst_qdeclarativeanimatedimage::remote() TRY_WAIT(anim->isPaused()); QCOMPARE(anim->currentFrame(), 2); } + QVERIFY(anim->status() != QDeclarativeAnimatedImage::Error); delete anim; } +void tst_qdeclarativeanimatedimage::sourceSize() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanscaled.qml")); + QDeclarativeAnimatedImage *anim = qobject_cast(component.create()); + QVERIFY(anim); + QCOMPARE(anim->width(),240.0); + QCOMPARE(anim->height(),180.0); + QCOMPARE(anim->sourceSize(),QSize(160,120)); + + delete anim; +} + +void tst_qdeclarativeanimatedimage::sourceSizeReadOnly() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanerror1.qml")); + QVERIFY(component.isError()); + QCOMPARE(component.errors().at(0).description(), QString("Invalid property assignment: \"sourceSize\" is a read-only property")); +} + void tst_qdeclarativeanimatedimage::remote_data() { QTest::addColumn("fileName"); -- cgit v0.12 From 23ca795df373ef41d2b3020c9ea7c38714aaa67b Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 15:24:13 +1000 Subject: Test readonly valuetypes. Fails for field. Task-number: QTBUG-9685 --- .../data/sizereadonly_read.qml | 8 ++++++ .../data/sizereadonly_writeerror.qml | 6 +++++ .../data/sizereadonly_writeerror2.qml | 7 ++++++ .../declarative/qdeclarativevaluetypes/testtypes.h | 1 + .../tst_qdeclarativevaluetypes.cpp | 29 ++++++++++++++++++++++ 5 files changed, 51 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml create mode 100644 tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror.qml create mode 100644 tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror2.qml diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml new file mode 100644 index 0000000..7abe359 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + property int s_width: sizereadonly.width + property int s_height: sizereadonly.height + property var copy: sizereadonly +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror.qml new file mode 100644 index 0000000..3254557 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + sizereadonly: "13x88" +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror2.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror2.qml new file mode 100644 index 0000000..656d718 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror2.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + sizereadonly.width: if (true) 13 + sizereadonly.height: if (true) 88 +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h index 64e4980..9057b4f 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h +++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h @@ -63,6 +63,7 @@ class MyTypeObject : public QObject Q_PROPERTY(QPointF pointf READ pointf WRITE setPointf NOTIFY changed) Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY changed) Q_PROPERTY(QSizeF sizef READ sizef WRITE setSizef NOTIFY changed) + Q_PROPERTY(QSize sizereadonly READ size NOTIFY changed) Q_PROPERTY(QRect rect READ rect WRITE setRect NOTIFY changed) Q_PROPERTY(QRectF rectf READ rectf WRITE setRectf NOTIFY changed) Q_PROPERTY(QVector3D vector READ vector WRITE setVector NOTIFY changed) diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index fb487f0..c74199f 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -59,6 +59,7 @@ private slots: void pointf(); void size(); void sizef(); + void sizereadonly(); void rect(); void rectf(); void vector3d(); @@ -193,6 +194,34 @@ void tst_qdeclarativevaluetypes::sizef() } } +void tst_qdeclarativevaluetypes::sizereadonly() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_read.qml")); + MyTypeObject *object = qobject_cast(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("s_width").toInt(), 1912); + QCOMPARE(object->property("s_height").toInt(), 1913); + QCOMPARE(object->property("copy"), QVariant(QSize(1912, 1913))); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_writeerror.qml")); + QVERIFY(component.isError()); + QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property")); + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_writeerror2.qml")); + QEXPECT_FAIL("", "QTBUG-9685", Abort); + QVERIFY(component.isError()); + QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property")); + } +} + void tst_qdeclarativevaluetypes::rect() { { -- cgit v0.12 From 45d345d8196096b1403298592616c0faedae69b5 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 16:06:33 +1000 Subject: Missing file --- .../declarative/tic-tac-toe/content/tic-tac-toe.js | 145 +++++++++++++++++++++ examples/declarative/tic-tac-toe/tic-tac-toe.qml | 2 +- 2 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 examples/declarative/tic-tac-toe/content/tic-tac-toe.js diff --git a/examples/declarative/tic-tac-toe/content/tic-tac-toe.js b/examples/declarative/tic-tac-toe/content/tic-tac-toe.js new file mode 100644 index 0000000..f8d6d9f --- /dev/null +++ b/examples/declarative/tic-tac-toe/content/tic-tac-toe.js @@ -0,0 +1,145 @@ +function winner(board) +{ + for (var i=0; i<3; ++i) { + if (board.children[i].state!="" + && board.children[i].state==board.children[i+3].state + && board.children[i].state==board.children[i+6].state) + return true + + if (board.children[i*3].state!="" + && board.children[i*3].state==board.children[i*3+1].state + && board.children[i*3].state==board.children[i*3+2].state) + return true + } + + if (board.children[0].state!="" + && board.children[0].state==board.children[4].state!="" + && board.children[0].state==board.children[8].state!="") + return true + + if (board.children[2].state!="" + && board.children[2].state==board.children[4].state!="" + && board.children[2].state==board.children[6].state!="") + return true + + return false +} + +function restart() +{ + // No moves left - start again + for (var i=0; i<9; ++i) + board.children[i].state = "" +} + +function makeMove(pos,player) +{ + board.children[pos].state = player + if (winner(board)) { + win(player + " wins") + return true + } else { + return false + } +} + +function computerTurn() +{ + var r = Math.random(); + if(r < game.difficulty){ + smartAI(); + }else{ + randAI(); + } +} + +function smartAI() +{ + function boardCopy(a){ + var ret = new Object; + ret.children = new Array(9); + for(var i = 0; i<9; i++){ + ret.children[i] = new Object; + ret.children[i].state = a.children[i].state; + } + return ret; + } + for(var i=0; i<9; i++){ + var simpleBoard = boardCopy(board); + if (board.children[i].state == "") { + simpleBoard.children[i].state = "O"; + if(winner(simpleBoard)){ + makeMove(i,"O") + return + } + } + } + for(var i=0; i<9; i++){ + var simpleBoard = boardCopy(board); + if (board.children[i].state == "") { + simpleBoard.children[i].state = "X"; + if(winner(simpleBoard)){ + makeMove(i,"O") + return + } + } + } + function thwart(a,b,c){//If they are at a, try b or c + if (board.children[a].state == "X") { + if (board.children[b].state == "") { + makeMove(b,"O") + return true + }else if (board.children[c].state == "") { + makeMove(c,"O") + return true + } + } + return false; + } + if(thwart(4,0,2)) return; + if(thwart(0,4,3)) return; + if(thwart(2,4,1)) return; + if(thwart(6,4,7)) return; + if(thwart(8,4,5)) return; + if(thwart(1,4,2)) return; + if(thwart(3,4,0)) return; + if(thwart(5,4,8)) return; + if(thwart(7,4,6)) return; + for(var i =0; i<9; i++){//Backup + if (board.children[i].state == "") { + makeMove(i,"O") + return + } + } + restart(); +} + +function randAI() +{ + var open = 0; + for (var i=0; i<9; ++i) + if (board.children[i].state == "") { + open += 1; + } + if(open == 0){ + restart(); + return; + } + var openA = new Array(open);//JS doesn't have lists I can append to (i think) + var acc = 0; + for (var i=0; i<9; ++i) + if (board.children[i].state == "") { + openA[acc] = i; + acc += 1; + } + var choice = openA[Math.floor(Math.random() * open)]; + makeMove(choice, "O"); +} + +function win(s) +{ + msg.text = s + msg.opacity = 1 + endtimer.running = true +} + diff --git a/examples/declarative/tic-tac-toe/tic-tac-toe.qml b/examples/declarative/tic-tac-toe/tic-tac-toe.qml index 1857a28..ca66a46 100644 --- a/examples/declarative/tic-tac-toe/tic-tac-toe.qml +++ b/examples/declarative/tic-tac-toe/tic-tac-toe.qml @@ -1,6 +1,6 @@ import Qt 4.7 import "content" -import "tic-tac-toe.js" as Logic +import "content/tic-tac-toe.js" as Logic Item { id: game -- cgit v0.12 From 942a605a52dbbd6dfa824e3b76e37576c7d79f6e Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 8 Apr 2010 15:56:30 +1000 Subject: Improve velocity example --- examples/declarative/velocity/Day.qml | 125 ++++++++++++++++------------- examples/declarative/velocity/cork.jpg | Bin 88766 -> 149337 bytes examples/declarative/velocity/sticky.png | Bin 15319 -> 0 bytes examples/declarative/velocity/velocity.qml | 94 ++++------------------ 4 files changed, 84 insertions(+), 135 deletions(-) delete mode 100644 examples/declarative/velocity/sticky.png diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index 8c33299..efaaf7a 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -1,78 +1,89 @@ import Qt 4.7 -Rectangle { - property alias day: dayText.text - property var stickies +Component { + Item { + property var stickies - id: page - width: 400; height: 500; radius: 7 - border.color: "black" + id: page + width: 840; height: 480 - Image { x: 10; y: 10; source: "cork.jpg" } + Image { source: "cork.jpg" } - Text { - id: dayText; x: 20; y: 20 - height: 40; width: 370 - font.pointSize: 14; font.bold: true - style: Text.Outline; styleColor: "#dedede" - } - - Repeater { - model: page.stickies + Text { + text: name; x: 15; y: 8; height: 40; width: 370 + font.pixelSize: 18; font.bold: true; color: "white" + style: Text.Outline; styleColor: "black" + } - Item { - id: stickyPage - x: Math.random() * 200 + 100 - y: Math.random() * 300 + 50 - SpringFollow on rotation { - source: -flickable.horizontalVelocity / 100 - spring: 2.0; damping: 0.1 - } + Repeater { + model: notes Item { - id: sticky - scale: 0.5 - Image { - id: stickyImage; source: "sticky.png"; transformOrigin: Item.TopLeft - smooth: true; y: -20; x: 8 + -width * 0.6 / 2; scale: 0.6 - } + property int randomX: Math.random() * 500 + 100 + property int randomY: Math.random() * 200 + 50 + + id: stickyPage + x: randomX; y: randomY - TextEdit { - id: myText; smooth: true; font.pointSize: 28 - readOnly: false; x: -104; y: 36; wrap: true - rotation: -8; text: noteText; width: 195; height: 172 + SpringFollow on rotation { + source: -flickable.horizontalVelocity / 100 + spring: 2.0; damping: 0.15 } Item { - y: -20 - x: stickyImage.x - width: stickyImage.width * stickyImage.scale - height: stickyImage.height * stickyImage.scale - MouseArea { - id: mouse - onClicked: { myText.focus = true } - anchors.fill: parent - drag.target: stickyPage; drag.axis: MouseArea.XandYAxis; drag.minimumY: 0; drag.maximumY: 500 - drag.minimumX: 0; drag.maximumX: 400 + id: sticky + scale: 0.7 + Image { + id: stickyImage + source: "note-yellow.png"; transformOrigin: Item.TopLeft + smooth: true; y: -20; x: 8 + -width * 0.6 / 2; scale: 0.6 + } + + TextEdit { + id: myText; smooth: true; font.pixelSize: 24 + readOnly: false; x: -104; y: 36 + rotation: -8; text: noteText; width: 215; height: 200 + } + + Item { + y: -20 + x: stickyImage.x + width: stickyImage.width * stickyImage.scale + height: stickyImage.height * stickyImage.scale + MouseArea { + id: mouse + onClicked: { myText.focus = true } + anchors.fill: parent + drag.target: stickyPage; drag.axis: MouseArea.XandYAxis; drag.minimumY: 0; drag.maximumY: page.height - 80 + drag.minimumX: 100; drag.maximumX: page.width - 140 + } } } - } - Image { - source: "tack.png"; transformOrigin: Item.TopLeft - x: -width / 2; y: -height * 0.7 / 2; scale: 0.7 - } + Image { + source: "tack.png"; transformOrigin: Item.TopLeft + x: -width / 2; y: -height * 0.5 / 2; scale: 0.7 + } - states: State { - name: "pressed" - when: mouse.pressed - PropertyChanges { target: sticky; rotation: 8; scale: 1 } - PropertyChanges { target: page; z: 8 } - } + states: State { + name: "pressed" + when: mouse.pressed + PropertyChanges { target: sticky; rotation: 8; scale: 1 } + PropertyChanges { target: page; z: 8 } + } - transitions: Transition { - NumberAnimation { properties: "rotation,scale"; duration: 200 } + transitions: Transition { + NumberAnimation { properties: "rotation,scale"; duration: 200 } + } } } } } + + + + + + + + diff --git a/examples/declarative/velocity/cork.jpg b/examples/declarative/velocity/cork.jpg index d4d706c..160bc00 100644 Binary files a/examples/declarative/velocity/cork.jpg and b/examples/declarative/velocity/cork.jpg differ diff --git a/examples/declarative/velocity/sticky.png b/examples/declarative/velocity/sticky.png deleted file mode 100644 index 73df3cd..0000000 Binary files a/examples/declarative/velocity/sticky.png and /dev/null differ diff --git a/examples/declarative/velocity/velocity.qml b/examples/declarative/velocity/velocity.qml index a091c4e..20821d6 100644 --- a/examples/declarative/velocity/velocity.qml +++ b/examples/declarative/velocity/velocity.qml @@ -1,108 +1,46 @@ import Qt 4.7 Rectangle { - color: "lightSteelBlue" - width: 800; height: 600 + width: 800; height: 480; color: "#464646" ListModel { id: list ListElement { name: "Sunday" - dayColor: "#808080" - notes: [ - ListElement { - noteText: "Lunch" - }, - ListElement { - noteText: "Party" - } - ] + notes: [ ListElement { noteText: "Lunch" }, ListElement { noteText: "Birthday Party" } ] } ListElement { name: "Monday" - dayColor: "blue" - notes: [ - ListElement { - noteText: "Pickup kids" - }, - ListElement { - noteText: "Checkout kinetic" - }, - ListElement { - noteText: "Read email" - } - ] + notes: [ ListElement { noteText: "Pickup kids from\nschool\n4.30pm" }, + ListElement { noteText: "Checkout Qt" }, ListElement { noteText: "Read email" } ] } ListElement { name: "Tuesday" - dayColor: "yellow" - notes: [ - ListElement { - noteText: "Walk dog" - }, - ListElement { - noteText: "Buy newspaper" - } - ] + notes: [ ListElement { noteText: "Walk dog" }, ListElement { noteText: "Buy newspaper" } ] } ListElement { - name: "Wednesday" - dayColor: "purple" - notes: [ - ListElement { - noteText: "Cook dinner" - }, - ListElement { - noteText: "Eat dinner" - } - ] + name: "Wednesday"; notes: [ ListElement { noteText: "Cook dinner" } ] } ListElement { name: "Thursday" - dayColor: "blue" - notes: [ - ListElement { - noteText: "5:30pm Meeting" - }, - ListElement { - noteText: "Weed garden" - } - ] + notes: [ ListElement { noteText: "Meeting\n5.30pm" }, ListElement { noteText: "Weed garden" } ] } ListElement { name: "Friday" - dayColor: "green" - notes: [ - ListElement { - noteText: "Still work" - }, - ListElement { - noteText: "Drink" - } - ] + notes: [ ListElement { noteText: "More work" }, ListElement { noteText: "Grocery shopping" } ] } ListElement { name: "Saturday" - dayColor: "orange" - notes: [ - ListElement { - noteText: "Drink" - }, - ListElement { - noteText: "Drink" - } - ] + notes: [ ListElement { noteText: "Drink" }, ListElement { noteText: "Download Qt\nPlay with QML" } ] } } - Flickable { + + ListView { id: flickable - anchors.fill: parent; contentWidth: lay.width - Row { - id: lay - Repeater { - model: list - Component { Day { day: name; color: dayColor; stickies: notes } } - } - } + anchors.fill: parent; focus: true + model: list; delegate: Day { } + highlightRangeMode: ListView.StrictlyEnforceRange + orientation: ListView.Horizontal + snapMode: ListView.SnapOneItem } } -- cgit v0.12 From df1788b4dbbb2826ae63f26bdf166342595343f4 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 16:13:31 +1000 Subject: Cleanup handling of errors in bindings and scripts QML used to silently ignore a log of errors - such as a failed assignment to a QObject property. These errors are now all reported as exceptions in JavaScript. Other questionable activities, like assigning a JavaScript array to a "property var" property which appeared to work, thanks to QtScript's transparent conversion of arrays to a QVariantList, are now blocked entirely. QTBUG-9152 QTBUG-9382 QTBUG-9341 QTBUG-6886 --- src/declarative/qml/qdeclarativebinding.cpp | 44 +++++++++++--- src/declarative/qml/qdeclarativecompiler.cpp | 2 +- .../qml/qdeclarativecontextscriptclass.cpp | 2 +- src/declarative/qml/qdeclarativeengine.cpp | 32 +++++++--- src/declarative/qml/qdeclarativeengine_p.h | 2 +- src/declarative/qml/qdeclarativeexpression.cpp | 71 ++++++++-------------- src/declarative/qml/qdeclarativeexpression_p.h | 10 ++- .../qml/qdeclarativeobjectscriptclass.cpp | 68 +++++++++++++-------- .../qml/qdeclarativeobjectscriptclass_p.h | 2 +- src/declarative/qml/qdeclarativeparser.cpp | 2 +- src/declarative/qml/qdeclarativeparser_p.h | 1 + src/declarative/qml/qdeclarativescriptparser.cpp | 1 + .../qml/qdeclarativetypenamescriptclass.cpp | 2 +- src/declarative/qml/qdeclarativevmemetaobject.cpp | 3 +- src/declarative/qml/qdeclarativevmemetaobject_p.h | 2 +- .../qdeclarativeecmascript/data/functionErrors.qml | 10 +++ .../data/propertyAssignmentErrors.qml | 28 +++++++++ .../tst_qdeclarativeecmascript.cpp | 42 +++++++++++++ 18 files changed, 228 insertions(+), 96 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/functionErrors.qml create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 71cf3cb..9a7a242 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -148,14 +148,46 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) idx, a); } else { + QDeclarativeEnginePrivate *ep = (data->context() && data->context()->engine)? + QDeclarativeEnginePrivate::get(data->context()->engine):0; + bool isUndefined = false; - QVariant value = this->value(&isUndefined); + QVariant value; + + QScriptValue scriptValue = d->scriptValue(0, &isUndefined); + if (data->property.propertyTypeCategory() == QDeclarativeProperty::List) { + value = ep->scriptValueToVariant(scriptValue, qMetaTypeId >()); + } else { + value = ep->scriptValueToVariant(scriptValue, data->property.propertyType()); + if (value.userType() == QMetaType::QObjectStar && !qvariant_cast(value)) { + // If the object is null, we extract the predicted type. While this isn't + // 100% reliable, in many cases it gives us better error messages if we + // assign this null-object to an incompatible property + int type = ep->objectClass->objectType(scriptValue); + value = QVariant(type, (void *)0); + } + } + + if (data->error.isValid()) { + + } else if (!scriptValue.isVariant() && value.userType() == QMetaType::QVariantList && + data->property.propertyType() == qMetaTypeId()) { + + // This case catches QtScript's automatic conversion to QVariantList for arrays + QUrl url = QUrl(data->url); + int line = data->line; + if (url.isEmpty()) url = QUrl(QLatin1String("")); + + data->error.setUrl(url); + data->error.setLine(line); + data->error.setColumn(-1); + data->error.setDescription(QLatin1String("Unable to assign JavaScript array to QML variant property")); - if (isUndefined && !data->error.isValid() && data->property.isResettable()) { + } else if (isUndefined && data->property.isResettable()) { data->property.reset(); - } else if (isUndefined && !data->error.isValid()) { + } else if (isUndefined) { QUrl url = QUrl(data->url); int line = data->line; @@ -166,7 +198,7 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) data->error.setColumn(-1); data->error.setDescription(QLatin1String("Unable to assign [undefined] to ") + QLatin1String(QMetaType::typeName(data->property.propertyType()))); - } else if (!isUndefined && data->property.object() && + } else if (data->property.object() && !QDeclarativePropertyPrivate::write(data->property, value, flags)) { QUrl url = QUrl(data->url); @@ -187,9 +219,7 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) } if (data->error.isValid()) { - QDeclarativeEnginePrivate *p = (data->context() && data->context()->engine)? - QDeclarativeEnginePrivate::get(data->context()->engine):0; - if (!data->addError(p)) + if (!data->addError(ep)) qWarning().nospace() << qPrintable(this->error().toString()); } else { data->removeError(); diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index f20ffa6..e34cd66 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -2520,7 +2520,7 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn ((QDeclarativeVMEMetaData *)dynamicData.data())->methodCount++; QDeclarativeVMEMetaData::MethodData methodData = - { s.parameterNames.count(), 0, funcScript.length(), 0 }; + { s.parameterNames.count(), 0, funcScript.length(), s.location.start.line }; dynamicData.append((char *)&methodData, sizeof(methodData)); } diff --git a/src/declarative/qml/qdeclarativecontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp index 6d31c22..461fab5 100644 --- a/src/declarative/qml/qdeclarativecontextscriptclass.cpp +++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp @@ -295,7 +295,7 @@ void QDeclarativeContextScriptClass::setProperty(Object *object, const Identifie QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); - ep->objectClass->setProperty(lastScopeObject, name, value, bindContext); + ep->objectClass->setProperty(lastScopeObject, name, value, context(), bindContext); } QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index ee0bd18..1bcadf2 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1323,7 +1323,6 @@ QScriptValue QDeclarativeEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine return qScriptValueFromValue(engine, qVariantFromValue(finalColor)); } - QScriptValue QDeclarativeEnginePrivate::scriptValueFromVariant(const QVariant &val) { if (val.userType() == qMetaTypeId()) { @@ -1334,6 +1333,14 @@ QScriptValue QDeclarativeEnginePrivate::scriptValueFromVariant(const QVariant &v } else { return scriptEngine.nullValue(); } + } else if (val.userType() == qMetaTypeId >()) { + const QList &list = *(QList*)val.constData(); + QScriptValue rv = scriptEngine.newArray(list.count()); + for (int ii = 0; ii < list.count(); ++ii) { + QObject *object = list.at(ii); + rv.setProperty(ii, objectClass->newQObject(object)); + } + return rv; } bool objOk; @@ -1345,22 +1352,29 @@ QScriptValue QDeclarativeEnginePrivate::scriptValueFromVariant(const QVariant &v } } -QVariant QDeclarativeEnginePrivate::scriptValueToVariant(const QScriptValue &val) +QVariant QDeclarativeEnginePrivate::scriptValueToVariant(const QScriptValue &val, int hint) { QScriptDeclarativeClass *dc = QScriptDeclarativeClass::scriptClass(val); if (dc == objectClass) return QVariant::fromValue(objectClass->toQObject(val)); + else if (dc == valueTypeClass) + return valueTypeClass->toVariant(val); else if (dc == contextClass) return QVariant(); - QScriptDeclarativeClass *sc = QScriptDeclarativeClass::scriptClass(val); - if (!sc) { - return val.toVariant(); - } else if (sc == valueTypeClass) { - return valueTypeClass->toVariant(val); - } else { - return QVariant(); + // Convert to a QList only if val is an array and we were explicitly hinted + if (hint == qMetaTypeId >() && val.isArray()) { + QList list; + int length = val.property(QLatin1String("length")).toInt32(); + for (int ii = 0; ii < length; ++ii) { + QScriptValue arrayItem = val.property(ii); + QObject *d = arrayItem.toQObject(); + list << d; + } + return QVariant::fromValue(list); } + + return val.toVariant(); } // XXX this beyonds in QUrl::toLocalFile() diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 45089d0..3f22d61 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -308,7 +308,7 @@ public: QHash m_sharedScriptImports; QScriptValue scriptValueFromVariant(const QVariant &); - QVariant scriptValueToVariant(const QScriptValue &); + QVariant scriptValueToVariant(const QScriptValue &, int hint = QVariant::Invalid); void sendQuit (); diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp index a250f21..7493690 100644 --- a/src/declarative/qml/qdeclarativeexpression.cpp +++ b/src/declarative/qml/qdeclarativeexpression.cpp @@ -175,7 +175,8 @@ void QDeclarativeExpressionPrivate::init(QDeclarativeContextData *ctxt, void *ex } QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContextData *context, QObject *object, - const QString &program, QScriptValue *contextObject) + const QString &program, const QString &fileName, + int lineNumber, QScriptValue *contextObject) { QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context->engine); QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(&ep->scriptEngine); @@ -186,7 +187,7 @@ QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContex scriptContext->pushScope(ep->contextClass->newContext(context, object)); } scriptContext->pushScope(ep->globalClass->globalObject()); - QScriptValue rv = ep->scriptEngine.evaluate(program); + QScriptValue rv = ep->scriptEngine.evaluate(program, fileName, lineNumber); ep->scriptEngine.popContext(); return rv; } @@ -351,7 +352,7 @@ void QDeclarativeExpressionPrivate::exceptionToError(QScriptEngine *scriptEngine } } -QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUndefined) +QScriptValue QDeclarativeExpressionPrivate::eval(QObject *secondaryScope, bool *isUndefined) { QDeclarativeExpressionData *data = this->data; QDeclarativeEngine *engine = data->context()->engine; @@ -376,7 +377,7 @@ QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bo const QString code = rewriteBinding(data->expression, &ok); if (!ok) { scriptEngine->popContext(); - return QVariant(); + return QScriptValue(); } data->expressionFunction = scriptEngine->evaluate(code, data->url, data->line); } @@ -413,54 +414,20 @@ QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bo if (scriptEngine->hasUncaughtException()) { exceptionToError(scriptEngine, data->error); scriptEngine->clearExceptions(); - return QVariant(); + return QScriptValue(); } else { data->error = QDeclarativeError(); + return svalue; } - - QVariant rv; - - if (svalue.isArray()) { - int length = svalue.property(QLatin1String("length")).toInt32(); - if (length && svalue.property(0).isObject()) { - QList list; - for (int ii = 0; ii < length; ++ii) { - QScriptValue arrayItem = svalue.property(ii); - QObject *d = arrayItem.toQObject(); - list << d; - } - rv = QVariant::fromValue(list); - } - } else if (svalue.isObject() && - ep->objectClass->scriptClass(svalue) == ep->objectClass) { - QObject *o = svalue.toQObject(); - int type = QMetaType::QObjectStar; - // If the object is null, we extract the predicted type. While this isn't - // 100% reliable, in many cases it gives us better error messages if we - // assign this null-object to an incompatible property - if (!o) type = ep->objectClass->objectType(svalue); - - return QVariant(type, &o); - } - - if (rv.isNull()) - rv = svalue.toVariant(); - - return rv; } -QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isUndefined) +QScriptValue QDeclarativeExpressionPrivate::scriptValue(QObject *secondaryScope, bool *isUndefined) { Q_Q(QDeclarativeExpression); - - QVariant rv; - if (!q->engine()) { - qWarning("QDeclarativeExpression: Attempted to evaluate an expression in an invalid context"); - return rv; - } + Q_ASSERT(q->engine()); if (data->expression.isEmpty()) - return rv; + return QScriptValue(); QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(q->engine()); @@ -476,7 +443,7 @@ QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isU QDeclarativeExpressionData *localData = data; localData->addref(); - rv = evalQtScript(secondaryScope, isUndefined); + QScriptValue value = eval(secondaryScope, isUndefined); ep->currentExpression = lastCurrentExpression; ep->captureProperties = lastCaptureProperties; @@ -494,7 +461,21 @@ QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isU lastCapturedProperties.copyAndClear(ep->capturedProperties); - return rv; + return value; +} + +QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isUndefined) +{ + Q_Q(QDeclarativeExpression); + + if (!q->engine()) { + qWarning("QDeclarativeExpression: Attempted to evaluate an expression in an invalid context"); + return QVariant(); + } + + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(q->engine()); + + return ep->scriptValueToVariant(scriptValue(secondaryScope, isUndefined)); } /*! diff --git a/src/declarative/qml/qdeclarativeexpression_p.h b/src/declarative/qml/qdeclarativeexpression_p.h index 9a90fb6..d39aa2c 100644 --- a/src/declarative/qml/qdeclarativeexpression_p.h +++ b/src/declarative/qml/qdeclarativeexpression_p.h @@ -150,7 +150,9 @@ public: QDeclarativeExpressionData *data; QVariant value(QObject *secondaryScope = 0, bool *isUndefined = 0); - QVariant evalQtScript(QObject *secondaryScope, bool *isUndefined = 0); + QScriptValue scriptValue(QObject *secondaryScope = 0, bool *isUndefined = 0); + + QScriptValue eval(QObject *secondaryScope, bool *isUndefined = 0); void updateGuards(const QPODVector &properties); void clearGuards(); @@ -165,8 +167,10 @@ public: virtual void emitValueChanged(); static void exceptionToError(QScriptEngine *, QDeclarativeError &); - static QScriptValue evalInObjectScope(QDeclarativeContextData *, QObject *, const QString &, QScriptValue * = 0); - static QScriptValue evalInObjectScope(QDeclarativeContextData *, QObject *, const QScriptProgram &, QScriptValue * = 0); + static QScriptValue evalInObjectScope(QDeclarativeContextData *, QObject *, const QString &, const QString &, + int, QScriptValue *); + static QScriptValue evalInObjectScope(QDeclarativeContextData *, QObject *, const QScriptProgram &, + QScriptValue *); }; QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 32ba2c3..8f37a1e 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -52,6 +52,7 @@ #include #include +#include Q_DECLARE_METATYPE(QScriptValue); @@ -225,15 +226,10 @@ QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name) if (lastData->flags & QDeclarativePropertyCache::Data::IsVMEFunction) { return Value(scriptEngine, ((QDeclarativeVMEMetaObject *)(obj->metaObject()))->vmeMethod(lastData->coreIndex)); } else { -#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE) // Uncomment to use QtScript method call logic // QScriptValue sobj = scriptEngine->newQObject(obj); // return Value(scriptEngine, sobj.property(toString(name))); return Value(scriptEngine, methods.newMethod(obj, lastData)); -#else - QScriptValue sobj = scriptEngine->newQObject(obj); - return Value(scriptEngine, sobj.property(toString(name))); -#endif } } else { if (enginePriv->captureProperties && !(lastData->flags & QDeclarativePropertyCache::Data::IsConstant)) { @@ -298,7 +294,6 @@ QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name) QVariant var = obj->metaObject()->property(lastData->coreIndex).read(obj); return Value(scriptEngine, enginePriv->scriptValueFromVariant(var)); } - } } @@ -306,40 +301,40 @@ void QDeclarativeObjectScriptClass::setProperty(Object *object, const Identifier &name, const QScriptValue &value) { - return setProperty(toQObject(object), name, value); + return setProperty(toQObject(object), name, value, context()); } void QDeclarativeObjectScriptClass::setProperty(QObject *obj, - const Identifier &name, - const QScriptValue &value, - QDeclarativeContextData *evalContext) + const Identifier &name, + const QScriptValue &value, + QScriptContext *context, + QDeclarativeContextData *evalContext) { Q_UNUSED(name); Q_ASSERT(obj); Q_ASSERT(lastData); + Q_ASSERT(context); if (!lastData->isValid()) { QString error = QLatin1String("Cannot assign to non-existent property \"") + toString(name) + QLatin1Char('\"'); - if (context()) - context()->throwError(error); + context->throwError(error); return; } if (!(lastData->flags & QDeclarativePropertyCache::Data::IsWritable)) { QString error = QLatin1String("Cannot assign to read-only property \"") + toString(name) + QLatin1Char('\"'); - if (context()) - context()->throwError(error); + context->throwError(error); return; } QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); - if (!evalContext && context()) { + if (!evalContext) { // Global object, QScriptContext activation object, QDeclarativeContext object - QScriptValue scopeNode = scopeChainValue(context(), -3); + QScriptValue scopeNode = scopeChainValue(context, -3); if (scopeNode.isValid()) { Q_ASSERT(scriptClass(scopeNode) == enginePriv->contextClass); @@ -355,10 +350,29 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj, if (value.isUndefined() && lastData->flags & QDeclarativePropertyCache::Data::IsResettable) { void *a[] = { 0 }; QMetaObject::metacall(obj, QMetaObject::ResetProperty, lastData->coreIndex, a); + } else if (value.isUndefined()) { + QString error = QLatin1String("Cannot assign [undefined] to ") + + QLatin1String(QMetaType::typeName(lastData->propType)); + context->throwError(error); } else { - // ### Can well known types be optimized? - QVariant v = enginePriv->scriptValueToVariant(value); - QDeclarativePropertyPrivate::write(obj, *lastData, v, evalContext); + QVariant v = enginePriv->scriptValueToVariant(value, lastData->propType); + + if (!value.isVariant() && v.userType() == QMetaType::QVariantList && + lastData->propType == qMetaTypeId()) { + + QString error = QLatin1String("Cannot assign JavaScript array to QML variant property"); + context->throwError(error); + } else if (!QDeclarativePropertyPrivate::write(obj, *lastData, v, evalContext)) { + const char *valueType = 0; + if (v.userType() == QVariant::Invalid) valueType = "null"; + else valueType = QMetaType::typeName(v.userType()); + + QString error = QLatin1String("Cannot assign ") + + QLatin1String(valueType) + + QLatin1String(" to ") + + QLatin1String(QMetaType::typeName(lastData->propType)); + context->throwError(error); + } } } @@ -459,8 +473,6 @@ bool QDeclarativeObjectScriptClass::compare(Object *o1, Object *o2) return d1 == d2 || d1->object == d2->object; } -#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE) - struct MethodData : public QScriptDeclarativeClass::Object { MethodData(QObject *o, const QDeclarativePropertyCache::Data &d) : object(o), data(d) {} @@ -690,7 +702,17 @@ void MetaCallArgument::fromScriptValue(int callType, QDeclarativeEngine *engine, new (&data) QVariant(QDeclarativeEnginePrivate::get(engine)->scriptValueToVariant(value)); type = callType; } else if (callType == qMetaTypeId >()) { - new (&data) QList(); // We don't support passing in QList + QList *list = new (&data) QList(); + if (value.isArray()) { + int length = value.property(QLatin1String("length")).toInt32(); + for (int ii = 0; ii < length; ++ii) { + QScriptValue arrayItem = value.property(ii); + QObject *d = arrayItem.toQObject(); + list->append(d); + } + } else if (QObject *d = value.toQObject()) { + list->append(d); + } type = callType; } else { new (&data) QVariant(); @@ -803,7 +825,5 @@ QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass:: return Value(); } -#endif - QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h index 8a2f7c7..5a59ef8 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h +++ b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h @@ -118,7 +118,7 @@ public: Value property(QObject *, const Identifier &); void setProperty(QObject *, const Identifier &name, const QScriptValue &, - QDeclarativeContextData *evalContext = 0); + QScriptContext *context, QDeclarativeContextData *evalContext = 0); virtual QStringList propertyNames(Object *); virtual bool compare(Object *, Object *); diff --git a/src/declarative/qml/qdeclarativeparser.cpp b/src/declarative/qml/qdeclarativeparser.cpp index 69186b6..d1f209a 100644 --- a/src/declarative/qml/qdeclarativeparser.cpp +++ b/src/declarative/qml/qdeclarativeparser.cpp @@ -200,7 +200,7 @@ QDeclarativeParser::Object::DynamicSlot::DynamicSlot() } QDeclarativeParser::Object::DynamicSlot::DynamicSlot(const DynamicSlot &o) -: name(o.name), body(o.body), parameterNames(o.parameterNames) +: name(o.name), body(o.body), parameterNames(o.parameterNames), location(o.location) { } diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h index 57df04c..00fc65b 100644 --- a/src/declarative/qml/qdeclarativeparser_p.h +++ b/src/declarative/qml/qdeclarativeparser_p.h @@ -227,6 +227,7 @@ namespace QDeclarativeParser QByteArray name; QString body; QList parameterNames; + LocationSpan location; }; // The list of dynamic properties diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index b4938bb..507ff5b 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -828,6 +828,7 @@ bool ProcessAST::visit(AST::UiSourceElement *node) if (AST::FunctionDeclaration *funDecl = AST::cast(node->sourceElement)) { Object::DynamicSlot slot; + slot.location = location(funDecl->firstSourceLocation(), funDecl->lastSourceLocation()); AST::FormalParameterList *f = funDecl->formals; while (f) { diff --git a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp index 324b3de..2a3417a 100644 --- a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp +++ b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp @@ -159,7 +159,7 @@ void QDeclarativeTypeNameScriptClass::setProperty(Object *o, const Identifier &n Q_ASSERT(!type); QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); - ep->objectClass->setProperty(((TypeNameData *)o)->object, n, v); + ep->objectClass->setProperty(((TypeNameData *)o)->object, n, v, context()); } QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp index 2644ecf..2e2a8e8 100644 --- a/src/declarative/qml/qdeclarativevmemetaobject.cpp +++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp @@ -671,7 +671,8 @@ QScriptValue QDeclarativeVMEMetaObject::method(int index) // XXX We should evaluate all methods in a single big script block to // improve the call time between dynamic methods defined on the same // object - methods[index] = QDeclarativeExpressionPrivate::evalInObjectScope(ctxt, object, code); + methods[index] = QDeclarativeExpressionPrivate::evalInObjectScope(ctxt, object, code, ctxt->url.toString(), + data->lineNumber, 0); } return methods[index]; diff --git a/src/declarative/qml/qdeclarativevmemetaobject_p.h b/src/declarative/qml/qdeclarativevmemetaobject_p.h index f13dd34..76390c9 100644 --- a/src/declarative/qml/qdeclarativevmemetaobject_p.h +++ b/src/declarative/qml/qdeclarativevmemetaobject_p.h @@ -94,7 +94,7 @@ struct QDeclarativeVMEMetaData int parameterCount; int bodyOffset; int bodyLength; - int scriptProgram; + int lineNumber; }; PropertyData *propertyData() const { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/functionErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/functionErrors.qml new file mode 100644 index 0000000..4aca111 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/functionErrors.qml @@ -0,0 +1,10 @@ +import Qt 4.6 + +QtObject { + function myFunction() { + a = 10; + } + + Component.onCompleted: myFunction(); +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml new file mode 100644 index 0000000..483179a --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml @@ -0,0 +1,28 @@ +import Qt 4.6 + +QtObject { + id: root + + property int a + property var b + + Component.onCompleted: { + try { + root.a = undefined; + } catch(e) { + console.log (e.fileName + ":" + e.lineNumber + ":" + e); + } + + try { + root.b = [ 10, root ] + } catch(e) { + console.log (e.fileName + ":" + e.lineNumber + ":" + e); + } + + try { + root.a = "Hello"; + } catch(e) { + console.log (e.fileName + ":" + e.lineNumber + ":" + e); + } + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 8e73afa..32d407f 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -108,6 +108,8 @@ private slots: void selfDeletingBinding(); void extendedObjectPropertyLookup(); void scriptErrors(); + void functionErrors(); + void propertyAssignmentErrors(); void signalTriggeredBindings(); void listProperties(); void exceptionClearsOnReeval(); @@ -995,6 +997,46 @@ void tst_qdeclarativeecmascript::scriptErrors() } /* +Test file/lineNumbers for inline functions. +*/ +void tst_qdeclarativeecmascript::functionErrors() +{ + QDeclarativeComponent component(&engine, TEST_FILE("functionErrors.qml")); + QString url = component.url().toString(); + + QString warning = url + ":5: Error: Invalid write to global property \"a\""; + + QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); + + QObject *object = component.create(); + QVERIFY(object != 0); + delete object; +} + +/* +Test various errors that can occur when assigning a property from script +*/ +void tst_qdeclarativeecmascript::propertyAssignmentErrors() +{ + QDeclarativeComponent component(&engine, TEST_FILE("propertyAssignmentErrors.qml")); + + QString url = component.url().toString(); + + QString warning1 = url + ":11:Error: Cannot assign [undefined] to int"; + QString warning2 = url + ":17:Error: Cannot assign JavaScript array to QML variant property"; + QString warning3 = url + ":23:Error: Cannot assign QString to int"; + + QTest::ignoreMessage(QtDebugMsg, warning1.toLatin1().constData()); + QTest::ignoreMessage(QtDebugMsg, warning2.toLatin1().constData()); + QTest::ignoreMessage(QtDebugMsg, warning3.toLatin1().constData()); + + QObject *object = component.create(); + QVERIFY(object != 0); + + delete object; +} + +/* Test bindings still work when the reeval is triggered from within a signal script. */ -- cgit v0.12 From 5e9fd297dc7fdc0a96809d3533e6fada4a31fb62 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 8 Apr 2010 16:26:11 +1000 Subject: Add running of examples to quality gate. Fix broken examples too. --- demos/declarative/photoviewer/photoviewer.qml | 2 +- demos/declarative/samegame/samegame.qml | 2 +- examples/declarative/focus/Core/qmldir | 2 +- examples/declarative/focus/focus.qml | 2 +- tests/auto/declarative/declarative.pro | 3 ++- tests/auto/declarative/examples/tst_examples.cpp | 4 ++-- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/demos/declarative/photoviewer/photoviewer.qml b/demos/declarative/photoviewer/photoviewer.qml index 569e1ba..4094294 100644 --- a/demos/declarative/photoviewer/photoviewer.qml +++ b/demos/declarative/photoviewer/photoviewer.qml @@ -1,5 +1,5 @@ import Qt 4.7 -import "PhotoViewerCore" 1.0 +import "PhotoViewerCore" Rectangle { id: mainWindow diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index 9c3e26d..94f5c24 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -1,5 +1,5 @@ import Qt 4.7 -import "SamegameCore" 1.0 +import "SamegameCore" import "SamegameCore/samegame.js" as Logic Rectangle { diff --git a/examples/declarative/focus/Core/qmldir b/examples/declarative/focus/Core/qmldir index 0460d9c..e25d63c 100644 --- a/examples/declarative/focus/Core/qmldir +++ b/examples/declarative/focus/Core/qmldir @@ -1,4 +1,4 @@ ContextMenu ContextMenu.qml GridMenu GridMenu.qml -ListViews Listviews.qml +ListViews ListViews.qml ListViewDelegate ListViewDelegate.qml diff --git a/examples/declarative/focus/focus.qml b/examples/declarative/focus/focus.qml index b9a11a6..d9b6549 100644 --- a/examples/declarative/focus/focus.qml +++ b/examples/declarative/focus/focus.qml @@ -1,5 +1,5 @@ import Qt 4.7 -import "Core" 1.0 +import "Core" Rectangle { id: window; width: 800; height: 480; color: "#3E606F" diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 11d7c13..5441311 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -1,5 +1,6 @@ TEMPLATE = subdirs SUBDIRS += \ + examples \ graphicswidgets \ # Cover parserstress \ # Cover qmetaobjectbuilder \ # Cover @@ -62,7 +63,7 @@ SUBDIRS += \ qdeclarativeimageprovider \ # Cover qdeclarativestyledtext \ # Cover sql \ # Cover - qmlvisual + qmlvisual # Cover contains(QT_CONFIG, webkit) { SUBDIRS += \ diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 678dd59..dbd1f92 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -185,10 +185,10 @@ void tst_examples::examples() QFileInfo fi(file); QFileInfo dir(fi.path()); - QString script = "data/"+dir.baseName()+"/"+fi.baseName(); + QString script = SRCDIR "/data/"+dir.baseName()+"/"+fi.baseName(); QFileInfo testdata(script+".qml"); QStringList arguments; - arguments << "-script" << (testdata.exists() ? script : QLatin1String("data/dummytest")) + arguments << "-script" << (testdata.exists() ? script : QLatin1String(SRCDIR "/data/dummytest")) << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" << file; QProcess p; -- cgit v0.12 From deb4c5d3253c35875f77a8c70b3a0b0e491e6b86 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 16:26:23 +1000 Subject: Fix qdeclarativeecmascript::arrayExpression() test --- src/declarative/qml/qdeclarativeexpression.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp index 7493690..2a3e557 100644 --- a/src/declarative/qml/qdeclarativeexpression.cpp +++ b/src/declarative/qml/qdeclarativeexpression.cpp @@ -475,7 +475,7 @@ QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isU QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(q->engine()); - return ep->scriptValueToVariant(scriptValue(secondaryScope, isUndefined)); + return ep->scriptValueToVariant(scriptValue(secondaryScope, isUndefined), qMetaTypeId >()); } /*! -- cgit v0.12 From 47044566c499a702da6cb372044b6402e218835d Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 16:28:22 +1000 Subject: Make script and binding assignments identical for list properties --- src/declarative/qml/qdeclarativeobjectscriptclass.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 8f37a1e..ec84da9 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -355,7 +355,11 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj, QLatin1String(QMetaType::typeName(lastData->propType)); context->throwError(error); } else { - QVariant v = enginePriv->scriptValueToVariant(value, lastData->propType); + QVariant v; + if (lastData->flags & QDeclarativePropertyCache::Data::IsQList) + v = enginePriv->scriptValueToVariant(value, qMetaTypeId >()); + else + v = enginePriv->scriptValueToVariant(value, lastData->propType); if (!value.isVariant() && v.userType() == QMetaType::QVariantList && lastData->propType == qMetaTypeId()) { -- cgit v0.12 From 02d0f442177d7f232dc98ac9ee58c70c3e09c086 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Thu, 8 Apr 2010 15:27:55 +1000 Subject: Renamed 'source' property from SpringFollow to 'to' --- .../samegame/SamegameCore/BoomBlock.qml | 4 +- .../snippets/declarative/listview/highlight.qml | 2 +- .../declarative/aspectratio/face_fit_animated.qml | 4 +- examples/declarative/clocks/content/Clock.qml | 6 +-- examples/declarative/dial/content/Dial.qml | 2 +- examples/declarative/listview/highlight.qml | 2 +- .../plugins/com/nokia/TimeExample/Clock.qml | 4 +- .../samegame/samegame4/content/BoomBlock.qml | 4 +- examples/declarative/tvtennis/tvtennis.qml | 6 +-- examples/declarative/velocity/Day.qml | 3 +- src/declarative/util/qdeclarativespringfollow.cpp | 47 +++++++++++----------- src/declarative/util/qdeclarativespringfollow_p.h | 14 +++++-- .../qdeclarativedom/tst_qdeclarativedom.cpp | 2 +- .../qmlvisual/qdeclarativespringfollow/clock.qml | 6 +-- .../qmlvisual/qdeclarativespringfollow/follow.qml | 10 ++--- .../data/samegame/BoomBlock.qml | 4 +- 16 files changed, 64 insertions(+), 56 deletions(-) diff --git a/demos/declarative/samegame/SamegameCore/BoomBlock.qml b/demos/declarative/samegame/SamegameCore/BoomBlock.qml index 838b346..db43182 100644 --- a/demos/declarative/samegame/SamegameCore/BoomBlock.qml +++ b/demos/declarative/samegame/SamegameCore/BoomBlock.qml @@ -8,8 +8,8 @@ Item { id:block property int targetX: 0 property int targetY: 0 - SpringFollow on x { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } - SpringFollow on y { source: targetY; spring: 2; damping: 0.2 } + SpringFollow on x { enabled: spawned; to: targetX; spring: 2; damping: 0.2 } + SpringFollow on y { to: targetY; spring: 2; damping: 0.2 } Image { id: img source: { diff --git a/doc/src/snippets/declarative/listview/highlight.qml b/doc/src/snippets/declarative/listview/highlight.qml index 6a9d215..fe5cc53 100644 --- a/doc/src/snippets/declarative/listview/highlight.qml +++ b/doc/src/snippets/declarative/listview/highlight.qml @@ -45,7 +45,7 @@ Rectangle { width: 180; height: 40 color: "lightsteelblue"; radius: 5 SpringFollow on y { - source: list.currentItem.y + to: list.currentItem.y spring: 3 damping: 0.2 } diff --git a/examples/declarative/aspectratio/face_fit_animated.qml b/examples/declarative/aspectratio/face_fit_animated.qml index 97f4791..63fc9c6 100644 --- a/examples/declarative/aspectratio/face_fit_animated.qml +++ b/examples/declarative/aspectratio/face_fit_animated.qml @@ -19,8 +19,8 @@ Rectangle { x: (parent.width-width*scale)/2 y: (parent.height-height*scale)/2 SpringFollow on scale { - source: Math.max(Math.min(face.parent.width/face.width*1.333,face.parent.height/face.height), - Math.min(face.parent.width/face.width,face.parent.height/face.height*1.333)) + to: Math.max(Math.min(face.parent.width/face.width*1.333,face.parent.height/face.height), + Math.min(face.parent.width/face.width,face.parent.height/face.height*1.333)) spring: 1 damping: 0.05 } diff --git a/examples/declarative/clocks/content/Clock.qml b/examples/declarative/clocks/content/Clock.qml index a315ccc..c853174 100644 --- a/examples/declarative/clocks/content/Clock.qml +++ b/examples/declarative/clocks/content/Clock.qml @@ -36,7 +36,7 @@ Item { origin.x: 7.5; origin.y: 73; angle: 0 SpringFollow on angle { spring: 2; damping: 0.2; modulus: 360 - source: (clock.hours * 30) + (clock.minutes * 0.5) + to: (clock.hours * 30) + (clock.minutes * 0.5) } } } @@ -50,7 +50,7 @@ Item { origin.x: 6.5; origin.y: 83; angle: 0 SpringFollow on angle { spring: 2; damping: 0.2; modulus: 360 - source: clock.minutes * 6 + to: clock.minutes * 6 } } } @@ -64,7 +64,7 @@ Item { origin.x: 2.5; origin.y: 80; angle: 0 SpringFollow on angle { spring: 5; damping: 0.25; modulus: 360 - source: clock.seconds * 6 + to: clock.seconds * 6 } } } diff --git a/examples/declarative/dial/content/Dial.qml b/examples/declarative/dial/content/Dial.qml index 7fd638a..f9ab3e3 100644 --- a/examples/declarative/dial/content/Dial.qml +++ b/examples/declarative/dial/content/Dial.qml @@ -29,7 +29,7 @@ Item { SpringFollow on angle { spring: 1.4 damping: .15 - source: Math.min(Math.max(-130, root.value*2.6 - 130), 133) + to: Math.min(Math.max(-130, root.value*2.6 - 130), 133) } } } diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml index 5493f99..2b54dd8 100644 --- a/examples/declarative/listview/highlight.qml +++ b/examples/declarative/listview/highlight.qml @@ -44,7 +44,7 @@ Rectangle { id: petHighlight Rectangle { width: 200; height: 50; color: "#FFFF88" - SpringFollow on y { source: list1.currentItem.y; spring: 3; damping: 0.1 } + SpringFollow on y { to: list1.currentItem.y; spring: 3; damping: 0.1 } } } ListView { diff --git a/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml b/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml index 3ebbeab..ce1dd69 100644 --- a/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml +++ b/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml @@ -20,7 +20,7 @@ Rectangle { origin.x: 7.5; origin.y: 73; angle: 0 SpringFollow on angle { spring: 2; damping: 0.2; modulus: 360 - source: (clock.hours * 30) + (clock.minutes * 0.5) + to: (clock.hours * 30) + (clock.minutes * 0.5) } } } @@ -34,7 +34,7 @@ Rectangle { origin.x: 6.5; origin.y: 83; angle: 0 SpringFollow on angle { spring: 2; damping: 0.2; modulus: 360 - source: clock.minutes * 6 + to: clock.minutes * 6 } } } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml index b598b3f..243df75 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml @@ -9,8 +9,8 @@ Item { id:block property int targetX: 0 property int targetY: 0 - SpringFollow on x { source: targetX; spring: 2; damping: 0.2; enabled: spawned } - SpringFollow on y { source: targetY; spring: 2; damping: 0.2 } + SpringFollow on x { to: targetX; spring: 2; damping: 0.2; enabled: spawned } + SpringFollow on y { to: targetY; spring: 2; damping: 0.2 } //![1] //![2] diff --git a/examples/declarative/tvtennis/tvtennis.qml b/examples/declarative/tvtennis/tvtennis.qml index 7c98c69..240183f 100644 --- a/examples/declarative/tvtennis/tvtennis.qml +++ b/examples/declarative/tvtennis/tvtennis.qml @@ -31,7 +31,7 @@ Rectangle { } // Make y follow the target y coordinate, with a velocity of 200 - SpringFollow on y { source: ball.targetY; velocity: 200 } + SpringFollow on y { to: ball.targetY; velocity: 200 } // Detect the ball hitting the top or bottom of the view and bounce it onYChanged: { @@ -52,7 +52,7 @@ Rectangle { color: "Lime" x: 2; width: 20; height: 90 SpringFollow on y { - source: ball.y - 45; velocity: 300 + to: ball.y - 45; velocity: 300 enabled: ball.direction == 'left' } } @@ -61,7 +61,7 @@ Rectangle { color: "Lime" x: page.width - 22; width: 20; height: 90 SpringFollow on y { - source: ball.y-45; velocity: 300 + to: ball.y-45; velocity: 300 enabled: ball.direction == 'right' } } diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index efaaf7a..fd937d0 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -17,7 +17,6 @@ Component { Repeater { model: notes - Item { property int randomX: Math.random() * 500 + 100 property int randomY: Math.random() * 200 + 50 @@ -26,7 +25,7 @@ Component { x: randomX; y: randomY SpringFollow on rotation { - source: -flickable.horizontalVelocity / 100 + to: -flickable.horizontalVelocity / 100 spring: 2.0; damping: 0.15 } diff --git a/src/declarative/util/qdeclarativespringfollow.cpp b/src/declarative/util/qdeclarativespringfollow.cpp index c42261d..7921735 100644 --- a/src/declarative/util/qdeclarativespringfollow.cpp +++ b/src/declarative/util/qdeclarativespringfollow.cpp @@ -59,13 +59,13 @@ class QDeclarativeSpringFollowPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QDeclarativeSpringFollow) public: QDeclarativeSpringFollowPrivate() - : currentValue(0), sourceValue(0), maxVelocity(0), lastTime(0) + : currentValue(0), to(0), maxVelocity(0), lastTime(0) , mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.01) , modulus(0.0), useMass(false), haveModulus(false), enabled(true), mode(Track), clock(this) {} QDeclarativeProperty property; qreal currentValue; - qreal sourceValue; + qreal to; qreal maxVelocity; qreal velocityms; int lastTime; @@ -102,7 +102,7 @@ void QDeclarativeSpringFollowPrivate::tick(int time) int elapsed = time - lastTime; if (!elapsed) return; - qreal srcVal = sourceValue; + qreal srcVal = to; if (haveModulus) { currentValue = fmod(currentValue, modulus); srcVal = fmod(srcVal, modulus); @@ -158,16 +158,16 @@ void QDeclarativeSpringFollowPrivate::tick(int time) currentValue += moveBy; if (haveModulus) currentValue = fmod(currentValue, modulus); - if (currentValue > sourceValue) { - currentValue = sourceValue; + if (currentValue > to) { + currentValue = to; clock.stop(); } } else { currentValue -= moveBy; if (haveModulus && currentValue < 0.0) currentValue = fmod(currentValue, modulus) + modulus; - if (currentValue < sourceValue) { - currentValue = sourceValue; + if (currentValue < to) { + currentValue = to; clock.stop(); } } @@ -196,9 +196,9 @@ void QDeclarativeSpringFollowPrivate::start() Q_Q(QDeclarativeSpringFollow); if (mode == QDeclarativeSpringFollowPrivate::Track) { - currentValue = sourceValue; + currentValue = to; property.write(currentValue); - } else if (sourceValue != currentValue && clock.state() != QAbstractAnimation::Running) { + } else if (to != currentValue && clock.state() != QAbstractAnimation::Running) { lastTime = 0; currentValue = property.read().toReal(); clock.start(); // infinity?? @@ -239,7 +239,7 @@ void QDeclarativeSpringFollowPrivate::stop() x: rect1.width width: 20; height: 20 color: "#ff0000" - SpringFollow on y { source: rect1.y; velocity: 200 } + SpringFollow on y { to: rect1.y; velocity: 200 } } \endcode */ @@ -260,26 +260,26 @@ void QDeclarativeSpringFollow::setTarget(const QDeclarativeProperty &property) d->currentValue = property.read().toReal(); } -qreal QDeclarativeSpringFollow::sourceValue() const +qreal QDeclarativeSpringFollow::to() const { Q_D(const QDeclarativeSpringFollow); - return d->sourceValue; + return d->to; } /*! - \qmlproperty qreal SpringFollow::source - This property holds the source value which will be tracked. + \qmlproperty qreal SpringFollow::to + This property holds the target value which will be tracked. Bind to a property in order to track its changes. */ -void QDeclarativeSpringFollow::setSourceValue(qreal value) +void QDeclarativeSpringFollow::setTo(qreal value) { Q_D(QDeclarativeSpringFollow); - if (d->clock.state() == QAbstractAnimation::Running && d->sourceValue == value) + if (d->clock.state() == QAbstractAnimation::Running && d->to == value) return; - d->sourceValue = value; + d->to = value; d->start(); } @@ -307,7 +307,7 @@ void QDeclarativeSpringFollow::setVelocity(qreal velocity) This property holds the spring constant The spring constant describes how strongly the target is pulled towards the - source. Setting spring to 0 turns off spring tracking. Useful values 0 - 5.0 + source. Setting spring to 0 turns off spring tracking. Useful values 0 - 5.0 When a spring constant is set and the velocity property is greater than 0, velocity limits the maximum speed. @@ -417,13 +417,10 @@ void QDeclarativeSpringFollow::setMass(qreal mass) } /*! - \qmlproperty qreal SpringFollow::value - The current value. -*/ - -/*! \qmlproperty bool SpringFollow::enabled This property holds whether the target will track the source. + + The default value of this property is 'true'. */ bool QDeclarativeSpringFollow::enabled() const { @@ -454,6 +451,10 @@ bool QDeclarativeSpringFollow::inSync() const return d->enabled && d->clock.state() != QAbstractAnimation::Running; } +/*! + \qmlproperty qreal SpringFollow::value + The current value. +*/ qreal QDeclarativeSpringFollow::value() const { Q_D(const QDeclarativeSpringFollow); diff --git a/src/declarative/util/qdeclarativespringfollow_p.h b/src/declarative/util/qdeclarativespringfollow_p.h index 2ac0d82..b829c57 100644 --- a/src/declarative/util/qdeclarativespringfollow_p.h +++ b/src/declarative/util/qdeclarativespringfollow_p.h @@ -59,7 +59,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeSpringFollow : public QObject, Q_DECLARE_PRIVATE(QDeclarativeSpringFollow) Q_INTERFACES(QDeclarativePropertyValueSource) - Q_PROPERTY(qreal source READ sourceValue WRITE setSourceValue) + Q_PROPERTY(qreal to READ to WRITE setTo) Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity) Q_PROPERTY(qreal spring READ spring WRITE setSpring) Q_PROPERTY(qreal damping READ damping WRITE setDamping) @@ -76,22 +76,30 @@ public: virtual void setTarget(const QDeclarativeProperty &); - qreal sourceValue() const; - void setSourceValue(qreal value); + qreal to() const; + void setTo(qreal value); + qreal velocity() const; void setVelocity(qreal velocity); + qreal spring() const; void setSpring(qreal spring); + qreal damping() const; void setDamping(qreal damping); + qreal epsilon() const; void setEpsilon(qreal epsilon); + qreal mass() const; void setMass(qreal modulus); + qreal modulus() const; void setModulus(qreal modulus); + bool enabled() const; void setEnabled(bool enabled); + bool inSync() const; qreal value() const; diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index e8bbb86..cd732b6 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -274,7 +274,7 @@ void tst_qdeclarativedom::loadComposite() void tst_qdeclarativedom::testValueSource() { QByteArray qml = "import Qt 4.6\n" - "Rectangle { SpringFollow on height { spring: 1.4; damping: .15; source: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; + "Rectangle { SpringFollow on height { spring: 1.4; damping: .15; to: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; QDeclarativeEngine freshEngine; QDeclarativeDomDocument document; diff --git a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml index 21bbc7f..fbab4b7 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml @@ -25,7 +25,7 @@ Rectangle { origin.x: 7.5; origin.y: 73; angle: 0 SpringFollow on angle { spring: 2; damping: 0.2; modulus: 360 - source: (clock.hours * 30) + (clock.minutes * 0.5) + to: (clock.hours * 30) + (clock.minutes * 0.5) } } } @@ -39,7 +39,7 @@ Rectangle { origin.x: 6.5; origin.y: 83; angle: 0 SpringFollow on angle { spring: 2; damping: 0.2; modulus: 360 - source: clock.minutes * 6 + to: clock.minutes * 6 } } } @@ -53,7 +53,7 @@ Rectangle { origin.x: 2.5; origin.y: 80; angle: 0 SpringFollow on angle { spring: 5; damping: 0.25; modulus: 360 - source: clock.seconds * 6 + to: clock.seconds * 6 } } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/follow.qml b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/follow.qml index 1659bb7..5368349 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/follow.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/follow.qml @@ -26,7 +26,7 @@ Rectangle { color: "#ff0000" x: rect.width; width: rect.width; height: 20 y: 200 - SpringFollow on y { source: rect.y; velocity: 200 } + SpringFollow on y { to: rect.y; velocity: 200 } } // Spring @@ -34,13 +34,13 @@ Rectangle { color: "#ff0000" x: rect.width * 2; width: rect.width/2; height: 20 y: 200 - SpringFollow on y { source: rect.y; spring: 1.0; damping: 0.2 } + SpringFollow on y { to: rect.y; spring: 1.0; damping: 0.2 } } Rectangle { color: "#880000" x: rect.width * 2.5; width: rect.width/2; height: 20 y: 200 - SpringFollow on y { source: rect.y; spring: 1.0; damping: 0.2; mass: 3.0 } // "heavier" object + SpringFollow on y { to: rect.y; spring: 1.0; damping: 0.2; mass: 3.0 } // "heavier" object } // Follow mouse @@ -52,8 +52,8 @@ Rectangle { width: 20; height: 20 radius: 10 color: "#0000ff" - SpringFollow on x { id: f1; source: mouseRegion.mouseX-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } - SpringFollow on y { id: f2; source: mouseRegion.mouseY-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } + SpringFollow on x { id: f1; to: mouseRegion.mouseX-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } + SpringFollow on y { id: f2; to: mouseRegion.mouseY-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } states: [ State { name: "following" diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml index b14531d..9b88b53 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml @@ -8,8 +8,8 @@ Item { id:block property int targetX: 0 property int targetY: 0 - SpringFollow on x { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } - SpringFollow on y { source: targetY; spring: 2; damping: 0.2 } + SpringFollow on x { enabled: spawned; to: targetX; spring: 2; damping: 0.2 } + SpringFollow on y { to: targetY; spring: 2; damping: 0.2 } Image { id: img source: { -- cgit v0.12 From 0bbd10c6e7c9ab37aa4355df7be46f4c3d9a443c Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Thu, 8 Apr 2010 16:24:19 +1000 Subject: Update QmlChanges for SmoothedFollow --- src/declarative/QmlChanges.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index d3737b0..079aacb 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -33,12 +33,20 @@ syntax has been introduced: Item { Behavior on x {}; NumberAnimation on y {} } Only the syntax has changed, the behavior is identical. +EaseFollow renamed to SmoothedFollow +--------------------------------------- +This element shares the internal implementation with SmoothedAnimation, +both providing the same easing function, but with SmoothedFollow it's +easier to set a start value to animate intially and then start to follow, +while SmoothedAnimation is still convenient for using inside Behaviors +and Transitions. + -EaseFollow changed to SmoothedAnimation +Add SmoothedAnimation element --------------------------------------- -EaseFollow was renamed to SmoothedAnimation and now it inherits from -NumberAnimaton and as a consequence SmoothedAnimation can be used inside -Behaviors, as PropertySourceValues or in state transitions, like any other animation. +SmoothedAnimation inherits from NumberAnimaton and as a +consequence SmoothedAnimation can be used inside Behaviors, +as PropertySourceValues or in state transitions, like any other animation. The old EaseFollow properties changed to comply with the other declarative animations ('source' changed to 'to'), so now 'to' changes are not -- cgit v0.12 From 3ccc0990807662c7de2b31b8fe89eaca2ca1af75 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 8 Apr 2010 16:49:12 +1000 Subject: Missing file --- examples/declarative/velocity/note-yellow.png | Bin 0 -> 54559 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 examples/declarative/velocity/note-yellow.png diff --git a/examples/declarative/velocity/note-yellow.png b/examples/declarative/velocity/note-yellow.png new file mode 100644 index 0000000..8ddecc8 Binary files /dev/null and b/examples/declarative/velocity/note-yellow.png differ -- cgit v0.12 From a7dded2849ba2abc60ee12d506c8361e41d347e6 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Thu, 8 Apr 2010 16:51:07 +1000 Subject: Fix samegame4 tutorial code --- .../tutorials/samegame/samegame4/content/samegame.js | 11 +---------- .../declarative/tutorials/samegame/samegame4/samegame.qml | 4 ++-- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index 2a0d718..478c662 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -22,11 +22,6 @@ function timeStr(msecs) { return ret; } -function getTileSize() -{ - return tileSize; -} - function initBoard() { for(var i = 0; i Date: Thu, 8 Apr 2010 16:57:52 +1000 Subject: Fix warning in declarative/examples/velocity --- examples/declarative/velocity/Day.qml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index fd937d0..724fcc8 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -53,8 +53,12 @@ Component { id: mouse onClicked: { myText.focus = true } anchors.fill: parent - drag.target: stickyPage; drag.axis: MouseArea.XandYAxis; drag.minimumY: 0; drag.maximumY: page.height - 80 - drag.minimumX: 100; drag.maximumX: page.width - 140 + drag.target: stickyPage + drag.axis: "XandYAxis" + drag.minimumY: 0 + drag.maximumY: page.height - 80 + drag.minimumX: 100 + drag.maximumX: page.width - 140 } } } -- cgit v0.12 From 3baf285917e2ea3183866768807f2495010602ab Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 16:55:57 +1000 Subject: Improve static assignment to QVariant's in the int and double case --- src/declarative/qml/qdeclarativecompiler.cpp | 19 +++++++++++-- src/declarative/qml/qdeclarativeinstruction.cpp | 6 ++++ src/declarative/qml/qdeclarativeinstruction_p.h | 2 ++ .../qml/qdeclarativestringconverters.cpp | 4 --- src/declarative/qml/qdeclarativevme.cpp | 20 ++++++++++++++ .../tst_qdeclarativeinstruction.cpp | 20 ++++++++++++++ .../data/assignLiteralToVariant.qml | 14 ++++++++++ .../tst_qdeclarativelanguage.cpp | 32 ++++++++++++++++++++++ 8 files changed, 110 insertions(+), 7 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index e34cd66..d2b2024 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -342,9 +342,22 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop, switch(type) { case -1: { - instr.type = QDeclarativeInstruction::StoreVariant; - instr.storeString.propertyIndex = prop.propertyIndex(); - instr.storeString.value = output->indexForString(string); + if (v->value.isNumber()) { + double n = v->value.asNumber(); + if (double(int(n)) == n) { + instr.type = QDeclarativeInstruction::StoreVariantInteger; + instr.storeInteger.propertyIndex = prop.propertyIndex(); + instr.storeInteger.value = int(n); + } else { + instr.type = QDeclarativeInstruction::StoreVariantDouble; + instr.storeDouble.propertyIndex = prop.propertyIndex(); + instr.storeDouble.value = n; + } + } else { + instr.type = QDeclarativeInstruction::StoreVariant; + instr.storeString.propertyIndex = prop.propertyIndex(); + instr.storeString.value = output->indexForString(string); + } } break; case QVariant::String: diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp index 1f8b8af..d88d06a 100644 --- a/src/declarative/qml/qdeclarativeinstruction.cpp +++ b/src/declarative/qml/qdeclarativeinstruction.cpp @@ -130,6 +130,12 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx) case QDeclarativeInstruction::StoreVariant: qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value); break; + case QDeclarativeInstruction::StoreVariantInteger: + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_INTEGER\t\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value; + break; + case QDeclarativeInstruction::StoreVariantDouble: + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value; + break; case QDeclarativeInstruction::StoreObject: qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT\t\t" << instr->storeObject.propertyIndex; break; diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h index 1f3c964..e8287c0 100644 --- a/src/declarative/qml/qdeclarativeinstruction_p.h +++ b/src/declarative/qml/qdeclarativeinstruction_p.h @@ -114,6 +114,8 @@ public: StoreRectF, /* storeRect */ StoreVector3D, /* storeVector3D */ StoreVariant, /* storeString */ + StoreVariantInteger, /* storeInteger */ + StoreVariantDouble, /* storeDouble */ StoreObject, /* storeObject */ StoreVariantObject, /* storeObject */ StoreInterface, /* storeObject */ diff --git a/src/declarative/qml/qdeclarativestringconverters.cpp b/src/declarative/qml/qdeclarativestringconverters.cpp index 5c88b9a..c0f8338 100644 --- a/src/declarative/qml/qdeclarativestringconverters.cpp +++ b/src/declarative/qml/qdeclarativestringconverters.cpp @@ -82,10 +82,6 @@ QVariant QDeclarativeStringConverters::variantFromString(const QString &s) { if (s.isEmpty()) return QVariant(s); - if (s.startsWith(QLatin1Char('\'')) && s.endsWith(QLatin1Char('\''))) { - QString data = s.mid(1, s.length() - 2); - return QVariant(data); - } bool ok = false; QRectF r = rectFFromString(s, &ok); if (ok) return QVariant(r); diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index 2d1a549..0addfabd 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -345,6 +345,26 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, } break; + case QDeclarativeInstruction::StoreVariantInteger: + { + QObject *target = stack.top(); + QVariant v(instr.storeInteger.value); + void *a[] = { &v, 0, &status, &flags }; + QMetaObject::metacall(target, QMetaObject::WriteProperty, + instr.storeString.propertyIndex, a); + } + break; + + case QDeclarativeInstruction::StoreVariantDouble: + { + QObject *target = stack.top(); + QVariant v(instr.storeDouble.value); + void *a[] = { &v, 0, &status, &flags }; + QMetaObject::metacall(target, QMetaObject::WriteProperty, + instr.storeString.propertyIndex, a); + } + break; + case QDeclarativeInstruction::StoreString: { QObject *target = stack.top(); diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp index a1aceb7..f4df130 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp +++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp @@ -520,6 +520,24 @@ void tst_qdeclarativeinstruction::dump() data->bytecode << i; } + { + QDeclarativeInstruction i; + i.line = 51; + i.type = QDeclarativeInstruction::StoreVariantInteger; + i.storeInteger.value = 11; + i.storeInteger.propertyIndex = 32; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 52; + i.type = QDeclarativeInstruction::StoreVariantDouble; + i.storeDouble.value = 33.7; + i.storeDouble.propertyIndex = 19; + data->bytecode << i; + } + QStringList expect; expect << "Index\tLine\tOperation\t\tData1\tData2\tData3\tComments" @@ -575,6 +593,8 @@ void tst_qdeclarativeinstruction::dump() << "47\t\tNA\tDEFER\t\t\t7" << "48\t\t48\tSTORE_IMPORTED_SCRIPT\t2" << "49\t\t50\tXXX UNKOWN INSTRUCTION\t1234" + << "50\t\t51\tSTORE_VARIANT_INTEGER\t\t32\t11" + << "51\t\t52\tSTORE_VARIANT_DOUBLE\t\t19\t33.7" << "-------------------------------------------------------------------------------"; messages = QStringList(); diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml new file mode 100644 index 0000000..a1d33ef --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml @@ -0,0 +1,14 @@ +import Qt 4.6 + +QtObject { + property var test1: 1 + property var test2: 1.7 + property var test3: "Hello world!" + property var test4: "#FF008800" + property var test5: "10,10,10x10" + property var test6: "10,10" + property var test7: "10x10" + property var test8: "100,100,100" + property var test9: String("#FF008800") +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index bf10a01..bfb56ba 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -87,6 +87,7 @@ private slots: void assignBasicTypes(); void assignTypeExtremes(); void assignCompositeToType(); + void assignLiteralToVariant(); void customParserTypes(); void rootAsQmlComponent(); void inlineQmlComponents(); @@ -479,6 +480,37 @@ void tst_qdeclarativelanguage::assignCompositeToType() QVERIFY(object != 0); } +// Test that literals are stored correctly in variant properties +void tst_qdeclarativelanguage::assignLiteralToVariant() +{ + QDeclarativeComponent component(&engine, TEST_FILE("assignLiteralToVariant.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").userType(), (int)QVariant::Int); + QCOMPARE(object->property("test2").userType(), (int)QMetaType::Double); + QCOMPARE(object->property("test3").userType(), (int)QVariant::String); + QCOMPARE(object->property("test4").userType(), (int)QVariant::Color); + QCOMPARE(object->property("test5").userType(), (int)QVariant::RectF); + QCOMPARE(object->property("test6").userType(), (int)QVariant::PointF); + QCOMPARE(object->property("test7").userType(), (int)QVariant::SizeF); + QCOMPARE(object->property("test8").userType(), (int)QVariant::Vector3D); + QCOMPARE(object->property("test9").userType(), (int)QVariant::String); + + QVERIFY(object->property("test1") == QVariant(1)); + QVERIFY(object->property("test2") == QVariant((double)1.7)); + QVERIFY(object->property("test3") == QVariant(QString(QLatin1String("Hello world!")))); + QVERIFY(object->property("test4") == QVariant(QColor::fromRgb(0xFF008800))); + QVERIFY(object->property("test5") == QVariant(QRectF(10, 10, 10, 10))); + QVERIFY(object->property("test6") == QVariant(QPointF(10, 10))); + QVERIFY(object->property("test7") == QVariant(QSizeF(10, 10))); + QVERIFY(object->property("test8") == QVariant(QVector3D(100, 100, 100))); + QVERIFY(object->property("test9") == QVariant(QString(QLatin1String("#FF008800")))); + + delete object; +} + // Tests that custom parser types can be instantiated void tst_qdeclarativelanguage::customParserTypes() { -- cgit v0.12 From be8a7153d613586d69ac528153a6b8ccbe931aa6 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 17:21:40 +1000 Subject: Make string -> int conversion consistent in bindings QTBUG-9538 --- .../qml/qdeclarativestringconverters.cpp | 4 ++ .../data/numberAssignment.qml | 18 ++++++ .../qdeclarativeecmascript/testtypes.cpp | 1 + .../declarative/qdeclarativeecmascript/testtypes.h | 65 ++++++++++++++++++++++ .../tst_qdeclarativeecmascript.cpp | 27 +++++++++ 5 files changed, 115 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/numberAssignment.qml diff --git a/src/declarative/qml/qdeclarativestringconverters.cpp b/src/declarative/qml/qdeclarativestringconverters.cpp index c0f8338..bbcc00b 100644 --- a/src/declarative/qml/qdeclarativestringconverters.cpp +++ b/src/declarative/qml/qdeclarativestringconverters.cpp @@ -100,6 +100,10 @@ QVariant QDeclarativeStringConverters::variantFromString(const QString &s) QVariant QDeclarativeStringConverters::variantFromString(const QString &s, int preferredType, bool *ok) { switch (preferredType) { + case QMetaType::Int: + return QVariant(int(qRound(s.toDouble(ok)))); + case QMetaType::UInt: + return QVariant(uint(qRound(s.toDouble(ok)))); case QMetaType::QColor: return QVariant::fromValue(colorFromString(s, ok)); case QMetaType::QDate: diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/numberAssignment.qml b/tests/auto/declarative/qdeclarativeecmascript/data/numberAssignment.qml new file mode 100644 index 0000000..30a77e8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/numberAssignment.qml @@ -0,0 +1,18 @@ +import Qt.test 1.0 + +NumberAssignment { + test1: if (1) 6.7 + test2: if (1) "6.7" + test3: if (1) 6 + test4: if (1) "6" + + test5: if (1) 6.7 + test6: if (1) "6.7" + test7: if (1) 6 + test8: if (1) "6" + + test9: if (1) 6.7 + test10: if (1) "6.7" + test11: if (1) 6 + test12: if (1) "6" +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp index a3bcb6a..0d07055 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp @@ -80,6 +80,7 @@ void registerTypes() qmlRegisterExtendedType("Qt.test", 1,0, "MyBaseExtendedObject"); qmlRegisterExtendedType("Qt.test", 1,0, "MyExtendedObject"); qmlRegisterType("Qt.test", 1,0, "MyTypeObject"); + qmlRegisterType("Qt.test", 1,0, "NumberAssignment"); } #include "testtypes.moc" diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index faad8b7..4424419 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -600,6 +600,71 @@ private: QVariantList m_actuals; }; +class NumberAssignment : public QObject +{ + Q_OBJECT +public: + Q_PROPERTY(qreal test1 READ test1 WRITE setTest1); + qreal _test1; + qreal test1() const { return _test1; } + void setTest1(qreal v) { _test1 = v; } + + Q_PROPERTY(qreal test2 READ test2 WRITE setTest2); + qreal _test2; + qreal test2() const { return _test2; } + void setTest2(qreal v) { _test2 = v; } + + Q_PROPERTY(qreal test3 READ test3 WRITE setTest3); + qreal _test3; + qreal test3() const { return _test3; } + void setTest3(qreal v) { _test3 = v; } + + Q_PROPERTY(qreal test4 READ test4 WRITE setTest4); + qreal _test4; + qreal test4() const { return _test4; } + void setTest4(qreal v) { _test4 = v; } + + Q_PROPERTY(int test5 READ test5 WRITE setTest5); + int _test5; + int test5() const { return _test5; } + void setTest5(int v) { _test5 = v; } + + Q_PROPERTY(int test6 READ test6 WRITE setTest6); + int _test6; + int test6() const { return _test6; } + void setTest6(int v) { _test6 = v; } + + Q_PROPERTY(int test7 READ test7 WRITE setTest7); + int _test7; + int test7() const { return _test7; } + void setTest7(int v) { _test7 = v; } + + Q_PROPERTY(int test8 READ test8 WRITE setTest8); + int _test8; + int test8() const { return _test8; } + void setTest8(int v) { _test8 = v; } + + Q_PROPERTY(unsigned int test9 READ test9 WRITE setTest9); + unsigned int _test9; + unsigned int test9() const { return _test9; } + void setTest9(unsigned int v) { _test9 = v; } + + Q_PROPERTY(unsigned int test10 READ test10 WRITE setTest10); + unsigned int _test10; + unsigned int test10() const { return _test10; } + void setTest10(unsigned int v) { _test10 = v; } + + Q_PROPERTY(unsigned int test11 READ test11 WRITE setTest11); + unsigned int _test11; + unsigned int test11() const { return _test11; } + void setTest11(unsigned int v) { _test11 = v; } + + Q_PROPERTY(unsigned int test12 READ test12 WRITE setTest12); + unsigned int _test12; + unsigned int test12() const { return _test12; } + void setTest12(unsigned int v) { _test12 = v; } +}; + void registerTypes(); #endif // TESTTYPES_H diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 32d407f..0e2b497 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -132,6 +132,7 @@ private slots: void qlistqobjectMethods(); void strictlyEquals(); void compiled(); + void numberAssignment(); void bug1(); void dynamicCreationCrash(); @@ -2116,6 +2117,32 @@ void tst_qdeclarativeecmascript::compiled() delete object; } +// Test that numbers assigned in bindings as strings work consistently +void tst_qdeclarativeecmascript::numberAssignment() +{ + QDeclarativeComponent component(&engine, TEST_FILE("numberAssignment.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QVERIFY(object->property("test1") == QVariant((qreal)6.7)); + QVERIFY(object->property("test2") == QVariant((qreal)6.7)); + QVERIFY(object->property("test3") == QVariant((qreal)6)); + QVERIFY(object->property("test4") == QVariant((qreal)6)); + + QVERIFY(object->property("test5") == QVariant((int)7)); + QVERIFY(object->property("test6") == QVariant((int)7)); + QVERIFY(object->property("test7") == QVariant((int)6)); + QVERIFY(object->property("test8") == QVariant((int)6)); + + QVERIFY(object->property("test9") == QVariant((unsigned int)7)); + QVERIFY(object->property("test10") == QVariant((unsigned int)7)); + QVERIFY(object->property("test11") == QVariant((unsigned int)6)); + QVERIFY(object->property("test12") == QVariant((unsigned int)6)); + + delete object; +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" -- cgit v0.12 From 3ceffd7287a269ec5ea9dab712ee9120a539e0e1 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 8 Apr 2010 17:34:37 +1000 Subject: Improve example code - rename variables, remove redundant ids. --- .../tutorials/samegame/samegame1/Button.qml | 6 +- .../tutorials/samegame/samegame1/samegame.qml | 2 +- .../tutorials/samegame/samegame2/Button.qml | 6 +- .../tutorials/samegame/samegame2/samegame.js | 32 +++--- .../tutorials/samegame/samegame2/samegame.qml | 2 +- .../tutorials/samegame/samegame3/Button.qml | 6 +- .../tutorials/samegame/samegame3/Dialog.qml | 8 +- .../tutorials/samegame/samegame3/samegame.js | 108 +++++++++---------- .../tutorials/samegame/samegame3/samegame.qml | 2 +- .../samegame/samegame4/content/Button.qml | 6 +- .../samegame/samegame4/content/Dialog.qml | 8 +- .../samegame/samegame4/content/samegame.js | 118 ++++++++++----------- .../tutorials/samegame/samegame4/samegame.qml | 8 +- 13 files changed, 156 insertions(+), 156 deletions(-) diff --git a/examples/declarative/tutorials/samegame/samegame1/Button.qml b/examples/declarative/tutorials/samegame/samegame1/Button.qml index 5e28da7..b77804c 100644 --- a/examples/declarative/tutorials/samegame/samegame1/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame1/Button.qml @@ -8,12 +8,12 @@ Rectangle { property string text: "Button" color: activePalette.button; smooth: true - width: txtItem.width + 20; height: txtItem.height + 6 + width: buttonLabel.width + 20; height: buttonLabel.height + 6 border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8; gradient: Gradient { GradientStop { - id: topGrad; position: 0.0 + position: 0.0 color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } } GradientStop { position: 1.0; color: activePalette.button } } @@ -21,7 +21,7 @@ Rectangle { MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() } Text { - id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText + id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText } } //![0] diff --git a/examples/declarative/tutorials/samegame/samegame1/samegame.qml b/examples/declarative/tutorials/samegame/samegame1/samegame.qml index 006b926..6e3a513 100644 --- a/examples/declarative/tutorials/samegame/samegame1/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame1/samegame.qml @@ -24,7 +24,7 @@ Rectangle { anchors.bottom: screen.bottom Button { - id: btnA; text: "New Game"; onClicked: console.log("Starting a new game..."); + text: "New Game"; onClicked: console.log("Starting a new game..."); anchors.left: parent.left; anchors.leftMargin: 3 anchors.verticalCenter: parent.verticalCenter } diff --git a/examples/declarative/tutorials/samegame/samegame2/Button.qml b/examples/declarative/tutorials/samegame/samegame2/Button.qml index a7853d4..4a1b2d3 100644 --- a/examples/declarative/tutorials/samegame/samegame2/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame2/Button.qml @@ -7,12 +7,12 @@ Rectangle { property string text: "Button" color: activePalette.button; smooth: true - width: txtItem.width + 20; height: txtItem.height + 6 + width: buttonLabel.width + 20; height: buttonLabel.height + 6 border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8; gradient: Gradient { GradientStop { - id: topGrad; position: 0.0 + position: 0.0 color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } } GradientStop { position: 1.0; color: activePalette.button } } @@ -20,6 +20,6 @@ Rectangle { MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() } Text { - id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText + id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText } } diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.js b/examples/declarative/tutorials/samegame/samegame2/samegame.js index 0ec3a8b..d7cbd8d 100644 --- a/examples/declarative/tutorials/samegame/samegame2/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame2/samegame.js @@ -1,16 +1,16 @@ //![0] //Note that X/Y referred to here are in game coordinates -var maxX = 10;//Nums are for tileSize 40 -var maxY = 15; +var maxColumn = 10;//Nums are for tileSize 40 +var maxRow = 15; var tileSize = 40; -var maxIndex = maxX*maxY; +var maxIndex = maxColumn*maxRow; var board = new Array(maxIndex); var tileSrc = "Block.qml"; var component; //Index function used instead of a 2D array -function index(xIdx,yIdx) { - return xIdx + (yIdx * maxX); +function index(column,row) { + return column + (row * maxColumn); } function initBoard() @@ -22,21 +22,21 @@ function initBoard() } //Calculate board size - maxX = Math.floor(background.width/tileSize); - maxY = Math.floor(background.height/tileSize); - maxIndex = maxY*maxX; + maxColumn = Math.floor(background.width/tileSize); + maxRow = Math.floor(background.height/tileSize); + maxIndex = maxRow*maxColumn; //Initialize Board board = new Array(maxIndex); - for(var xIdx=0; xIdx= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + var column = Math.floor(x/gameCanvas.tileSize); + var row = Math.floor(y/gameCanvas.tileSize); + if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) return; - if(board[index(xIdx, yIdx)] == null) + if(board[index(column, row)] == null) return; //If it's a valid tile, remove it and all connected (does nothing if it's not connected) - floodFill(xIdx,yIdx, -1); + floodFill(column,row, -1); if(fillFound <= 0) return; gameCanvas.score += (fillFound - 1) * (fillFound - 1); @@ -85,67 +85,67 @@ function handleClick(x,y) } //![1] -function floodFill(xIdx,yIdx,type) +function floodFill(column,row,type) { - if(board[index(xIdx, yIdx)] == null) + if(board[index(column, row)] == null) return; var first = false; if(type == -1){ first = true; - type = board[index(xIdx,yIdx)].type; + type = board[index(column,row)].type; //Flood fill initialization fillFound = 0; floodBoard = new Array(maxIndex); } - if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) return; - if(floodBoard[index(xIdx, yIdx)] == 1 || (!first && type != board[index(xIdx,yIdx)].type)) + if(floodBoard[index(column, row)] == 1 || (!first && type != board[index(column,row)].type)) return; - floodBoard[index(xIdx, yIdx)] = 1; - floodFill(xIdx+1,yIdx,type); - floodFill(xIdx-1,yIdx,type); - floodFill(xIdx,yIdx+1,type); - floodFill(xIdx,yIdx-1,type); + floodBoard[index(column, row)] = 1; + floodFill(column+1,row,type); + floodFill(column-1,row,type); + floodFill(column,row+1,type); + floodFill(column,row-1,type); if(first==true && fillFound == 0) return;//Can't remove single tiles - board[index(xIdx,yIdx)].opacity = 0; - board[index(xIdx,yIdx)] = null; + board[index(column,row)].opacity = 0; + board[index(column,row)] = null; fillFound += 1; } function shuffleDown() { //Fall down - for(var xIdx=0; xIdx=0; yIdx--){ - if(board[index(xIdx,yIdx)] == null){ + for(var row=maxRow-1; row>=0; row--){ + if(board[index(column,row)] == null){ fallDist += 1; }else{ if(fallDist > 0){ - var obj = board[index(xIdx,yIdx)]; + var obj = board[index(column,row)]; obj.y += fallDist * gameCanvas.tileSize; - board[index(xIdx,yIdx+fallDist)] = obj; - board[index(xIdx,yIdx)] = null; + board[index(column,row+fallDist)] = obj; + board[index(column,row)] = null; } } } } //Fall to the left var fallDist = 0; - for(var xIdx=0; xIdx 0){ - for(var yIdx=0; yIdx=0; xIdx--) - if(board[index(xIdx, maxY - 1)] != null) + for(var column=maxColumn-1; column>=0; column--) + if(board[index(column, maxRow - 1)] != null) deservesBonus = false; if(deservesBonus) gameCanvas.score += 500; //Checks for game over - if(deservesBonus || !(floodMoveCheck(0,maxY-1, -1))) + if(deservesBonus || !(floodMoveCheck(0,maxRow-1, -1))) dialog.show("Game Over. Your score is " + gameCanvas.score); } //![2] //only floods up and right, to see if it can find adjacent same-typed tiles -function floodMoveCheck(xIdx, yIdx, type) +function floodMoveCheck(column, row, type) { - if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) return false; - if(board[index(xIdx, yIdx)] == null) + if(board[index(column, row)] == null) return false; - var myType = board[index(xIdx, yIdx)].type; + var myType = board[index(column, row)].type; if(type == myType) return true; - return floodMoveCheck(xIdx + 1, yIdx, myType) || - floodMoveCheck(xIdx, yIdx - 1, board[index(xIdx,yIdx)].type); + return floodMoveCheck(column + 1, row, myType) || + floodMoveCheck(column, row - 1, board[index(column,row)].type); } diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.qml b/examples/declarative/tutorials/samegame/samegame3/samegame.qml index db25e24..60b2f9a 100644 --- a/examples/declarative/tutorials/samegame/samegame3/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame3/samegame.qml @@ -45,7 +45,7 @@ Rectangle { anchors.bottom: screen.bottom Button { - id: btnA; text: "New Game"; onClicked: SameGame.initBoard(); + text: "New Game"; onClicked: SameGame.initBoard(); anchors.left: parent.left; anchors.leftMargin: 3 anchors.verticalCenter: parent.verticalCenter } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml index a7853d4..4a1b2d3 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml @@ -7,12 +7,12 @@ Rectangle { property string text: "Button" color: activePalette.button; smooth: true - width: txtItem.width + 20; height: txtItem.height + 6 + width: buttonLabel.width + 20; height: buttonLabel.height + 6 border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8; gradient: Gradient { GradientStop { - id: topGrad; position: 0.0 + position: 0.0 color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } } GradientStop { position: 1.0; color: activePalette.button } } @@ -20,6 +20,6 @@ Rectangle { MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() } Text { - id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText + id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText } } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml index fc83e39..1b1b3a2 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml @@ -7,15 +7,15 @@ Rectangle { page.opacity = 0; } function show(txt) { - myText.text = txt; + dialogText.text = txt; page.opacity = 1; } signal closed(); - color: "white"; border.width: 1; width: myText.width + 20; height: 60; + color: "white"; border.width: 1; width: dialogText.width + 20; height: 60; opacity: 0 Behavior on opacity { NumberAnimation { duration: 1000 } } - Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } - MouseArea { id: mouseArea; anchors.fill: parent; onClicked: forceClose(); } + Text { id: dialogText; anchors.centerIn: parent; text: "Hello World!" } + MouseArea { anchors.fill: parent; onClicked: forceClose(); } } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index 2a0d718..a05e3a3 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -1,8 +1,8 @@ /* This script file handles the game logic */ //Note that X/Y referred to here are in game coordinates -var maxX = 10;//Nums are for gameCanvas.tileSize 40 -var maxY = 15; -var maxIndex = maxX*maxY; +var maxColumn = 10;//Nums are for gameCanvas.tileSize 40 +var maxRow = 15; +var maxIndex = maxColumn*maxRow; var board = new Array(maxIndex); var tileSrc = "content/BoomBlock.qml"; //var scoresURL = "http://qtfx-nokia.trolltech.com.au/samegame/scores.php"; @@ -11,8 +11,8 @@ var timer; var component = createComponent(tileSrc); //Index function used instead of a 2D array -function index(xIdx,yIdx) { - return xIdx + (yIdx * maxX); +function index(column,row) { + return column + (row * maxColumn); } function timeStr(msecs) { @@ -36,22 +36,22 @@ function initBoard() } //Calculate board size - maxX = Math.floor(gameCanvas.width/gameCanvas.tileSize); - maxY = Math.floor(gameCanvas.height/gameCanvas.tileSize); - maxIndex = maxY*maxX; + maxColumn = Math.floor(gameCanvas.width/gameCanvas.tileSize); + maxRow = Math.floor(gameCanvas.height/gameCanvas.tileSize); + maxIndex = maxRow*maxColumn; //Close dialogs - scoreName.forceClose(); + nameInputDialog.forceClose(); dialog.forceClose(); var a = new Date(); //Initialize Board board = new Array(maxIndex); gameCanvas.score = 0; - for(var xIdx=0; xIdx= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + var column = Math.floor(x/gameCanvas.tileSize); + var row = Math.floor(y/gameCanvas.tileSize); + if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) return; - if(board[index(xIdx, yIdx)] == null) + if(board[index(column, row)] == null) return; //If it's a valid tile, remove it and all connected (does nothing if it's not connected) - floodFill(xIdx,yIdx, -1); + floodFill(column,row, -1); if(fillFound <= 0) return; gameCanvas.score += (fillFound - 1) * (fillFound - 1); @@ -79,67 +79,67 @@ function handleClick(x,y) victoryCheck(); } -function floodFill(xIdx,yIdx,type) +function floodFill(column,row,type) { - if(board[index(xIdx, yIdx)] == null) + if(board[index(column, row)] == null) return; var first = false; if(type == -1){ first = true; - type = board[index(xIdx,yIdx)].type; + type = board[index(column,row)].type; //Flood fill initialization fillFound = 0; floodBoard = new Array(maxIndex); } - if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) return; - if(floodBoard[index(xIdx, yIdx)] == 1 || (!first && type != board[index(xIdx,yIdx)].type)) + if(floodBoard[index(column, row)] == 1 || (!first && type != board[index(column,row)].type)) return; - floodBoard[index(xIdx, yIdx)] = 1; - floodFill(xIdx+1,yIdx,type); - floodFill(xIdx-1,yIdx,type); - floodFill(xIdx,yIdx+1,type); - floodFill(xIdx,yIdx-1,type); + floodBoard[index(column, row)] = 1; + floodFill(column+1,row,type); + floodFill(column-1,row,type); + floodFill(column,row+1,type); + floodFill(column,row-1,type); if(first==true && fillFound == 0) return;//Can't remove single tiles - board[index(xIdx,yIdx)].dying = true; - board[index(xIdx,yIdx)] = null; + board[index(column,row)].dying = true; + board[index(column,row)] = null; fillFound += 1; } function shuffleDown() { //Fall down - for(var xIdx=0; xIdx=0; yIdx--){ - if(board[index(xIdx,yIdx)] == null){ + for(var row=maxRow-1; row>=0; row--){ + if(board[index(column,row)] == null){ fallDist += 1; }else{ if(fallDist > 0){ - var obj = board[index(xIdx,yIdx)]; + var obj = board[index(column,row)]; obj.targetY += fallDist * gameCanvas.tileSize; - board[index(xIdx,yIdx+fallDist)] = obj; - board[index(xIdx,yIdx)] = null; + board[index(column,row+fallDist)] = obj; + board[index(column,row)] = null; } } } } //Fall to the left fallDist = 0; - for(xIdx=0; xIdx 0){ - for(yIdx=0; yIdx=0; xIdx--) - if(board[index(xIdx, maxY - 1)] != null) + for(var column=maxColumn-1; column>=0; column--) + if(board[index(column, maxRow - 1)] != null) deservesBonus = false; if(deservesBonus) gameCanvas.score += 500; //Checks for game over - if(deservesBonus || !(floodMoveCheck(0,maxY-1, -1))){ + if(deservesBonus || !(floodMoveCheck(0,maxRow-1, -1))){ timer = new Date() - timer; - scoreName.show("You won! Please enter your name: "); + nameInputDialog.show("You won! Please enter your name: "); //dialog.show("Game Over. Your score is " + gameCanvas.score); } } //only floods up and right, to see if it can find adjacent same-typed tiles -function floodMoveCheck(xIdx, yIdx, type) +function floodMoveCheck(column, row, type) { - if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) return false; - if(board[index(xIdx, yIdx)] == null) + if(board[index(column, row)] == null) return false; - var myType = board[index(xIdx, yIdx)].type; + var myType = board[index(column, row)].type; if(type == myType) return true; - return floodMoveCheck(xIdx + 1, yIdx, myType) || - floodMoveCheck(xIdx, yIdx - 1, board[index(xIdx,yIdx)].type); + return floodMoveCheck(column + 1, row, myType) || + floodMoveCheck(column, row - 1, board[index(column,row)].type); } -function createBlock(xIdx,yIdx){ +function createBlock(column,row){ // Note that we don't wait for the component to become ready. This will // only work if the block QML is a local file. Otherwise the component will // not be ready immediately. There is a statusChanged signal on the @@ -191,13 +191,13 @@ function createBlock(xIdx,yIdx){ } dynamicObject.type = Math.floor(Math.random() * 3); dynamicObject.parent = gameCanvas; - dynamicObject.x = xIdx*gameCanvas.tileSize; - dynamicObject.targetX = xIdx*gameCanvas.tileSize; - dynamicObject.targetY = yIdx*gameCanvas.tileSize; + dynamicObject.x = column*gameCanvas.tileSize; + dynamicObject.targetX = column*gameCanvas.tileSize; + dynamicObject.targetY = row*gameCanvas.tileSize; dynamicObject.width = gameCanvas.tileSize; dynamicObject.height = gameCanvas.tileSize; dynamicObject.spawned = true; - board[index(xIdx,yIdx)] = dynamicObject; + board[index(column,row)] = dynamicObject; }else{//isError or isLoading print("error loading block component"); print(component.errorsString()); @@ -213,7 +213,7 @@ function saveHighScore(name) { //OfflineStorage var db = openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores",100); var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)"; - var data = [name, gameCanvas.score, maxX+"x"+maxY ,Math.floor(timer/1000)]; + var data = [name, gameCanvas.score, maxColumn+"x"+maxRow ,Math.floor(timer/1000)]; db.transaction( function(tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); @@ -236,7 +236,7 @@ function saveHighScore(name) { function sendHighScore(name) { var postman = new XMLHttpRequest() var postData = "name="+name+"&score="+gameCanvas.score - +"&gridSize="+maxX+"x"+maxY +"&time="+Math.floor(timer/1000); + +"&gridSize="+maxColumn+"x"+maxRow +"&time="+Math.floor(timer/1000); postman.open("POST", scoresURL, true); postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); postman.onreadystatechange = function() { diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame.qml b/examples/declarative/tutorials/samegame/samegame4/samegame.qml index 090496d..8cc2137 100644 --- a/examples/declarative/tutorials/samegame/samegame4/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame4/samegame.qml @@ -36,7 +36,7 @@ Rectangle { //![0] Dialog { - id: scoreName; anchors.centerIn: parent; z: 22; + id: nameInputDialog; anchors.centerIn: parent; z: 22; Text { id: spacer opacity: 0 @@ -45,9 +45,9 @@ Rectangle { TextInput { id: editor onAccepted: { - if(scoreName.opacity==1&&editor.text!="") + if(nameInputDialog.opacity==1&&editor.text!="") saveHighScore(editor.text); - scoreName.forceClose(); + nameInputDialog.forceClose(); } anchors.verticalCenter: parent.verticalCenter width: 72; focus: true @@ -63,7 +63,7 @@ Rectangle { anchors.bottom: screen.bottom Button { - id: btnA; text: "New Game"; onClicked: {SameGame.initBoard();} + text: "New Game"; onClicked: SameGame.initBoard(); anchors.left: parent.left; anchors.leftMargin: 3 anchors.verticalCenter: parent.verticalCenter } -- cgit v0.12 From 5d31f4a2175e69a7a56dea1d682c163dc8a1512c Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 8 Apr 2010 17:47:32 +1000 Subject: Fix call to saveHighScores() and restore game timer. --- .../declarative/tutorials/samegame/samegame4/content/samegame.js | 3 ++- .../declarative/tutorials/samegame/samegame4/highscores/scores.php | 5 +---- examples/declarative/tutorials/samegame/samegame4/samegame.qml | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index f88b428..a905f7d 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -48,6 +48,8 @@ function initBoard() createBlock(column,row); } } + + timer = new Date(); } var fillFound;//Set after a floodFill call to the number of tiles found @@ -150,7 +152,6 @@ function victoryCheck() if(deservesBonus || !(floodMoveCheck(0,maxRow-1, -1))){ timer = new Date() - timer; nameInputDialog.show("You won! Please enter your name: "); - //dialog.show("Game Over. Your score is " + gameCanvas.score); } } diff --git a/examples/declarative/tutorials/samegame/samegame4/highscores/scores.php b/examples/declarative/tutorials/samegame/samegame4/highscores/scores.php index 3cceb2d..daf480e 100755 --- a/examples/declarative/tutorials/samegame/samegame4/highscores/scores.php +++ b/examples/declarative/tutorials/samegame/samegame4/highscores/scores.php @@ -8,10 +8,7 @@ $time = $_POST["time"]; if($name == "") $name = "Anonymous"; - //if($grid != "10x10"){ - //Need a standard, so as to reject others? - //} - $file = fopen("score_data.xml", "a"); #It's XML. Happy? + $file = fopen("score_data.xml", "a"); $ret = fwrite($file, "". $score . "" . $name . "" . $grid . "" . $time . "\n"); diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame.qml b/examples/declarative/tutorials/samegame/samegame4/samegame.qml index 59e0cef..fe35e3b 100644 --- a/examples/declarative/tutorials/samegame/samegame4/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame4/samegame.qml @@ -46,7 +46,7 @@ Rectangle { id: editor onAccepted: { if(nameInputDialog.opacity==1&&editor.text!="") - saveHighScore(editor.text); + SameGame.saveHighScore(editor.text); nameInputDialog.forceClose(); } anchors.verticalCenter: parent.verticalCenter -- cgit v0.12 From 3e299066d0270100331973ff202209c94cf362de Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 18:09:09 +1000 Subject: Fix crash on null object assignment --- src/declarative/qml/qdeclarativebinding.cpp | 3 ++- .../qdeclarativeecmascript/data/nullObjectBinding.qml | 8 ++++++++ .../qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/nullObjectBinding.qml diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 9a7a242..b397177 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -164,7 +164,8 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) // 100% reliable, in many cases it gives us better error messages if we // assign this null-object to an incompatible property int type = ep->objectClass->objectType(scriptValue); - value = QVariant(type, (void *)0); + QObject *o = 0; + value = QVariant(type, (void *)&o); } } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/nullObjectBinding.qml b/tests/auto/declarative/qdeclarativeecmascript/data/nullObjectBinding.qml new file mode 100644 index 0000000..1bf0b81 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/nullObjectBinding.qml @@ -0,0 +1,8 @@ +import Qt 4.6 + +QtObject { + property QtObject test + test: if (1) model + property ListModel model +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 0e2b497..f675801 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -137,6 +137,7 @@ private slots: void bug1(); void dynamicCreationCrash(); void regExpBug(); + void nullObjectBinding(); void callQtInvokables(); private: @@ -2143,6 +2144,20 @@ void tst_qdeclarativeecmascript::numberAssignment() delete object; } +// Test that assigning a null object works +// Regressed with: df1788b4dbbb2826ae63f26bdf166342595343f4 +void tst_qdeclarativeecmascript::nullObjectBinding() +{ + QDeclarativeComponent component(&engine, TEST_FILE("nullObjectBinding.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QVERIFY(object->property("test") == QVariant::fromValue((QObject *)0)); + + delete object; +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" -- cgit v0.12 From 978c56d47a6436fab9ab239bc81cdbf245b9ab10 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 8 Apr 2010 18:24:48 +1000 Subject: Don't crash when QML engine is deleted --- src/declarative/qml/qdeclarativebinding.cpp | 5 ++--- .../qdeclarativeecmascript/data/deletedEngine.qml | 11 +++++++++++ .../tst_qdeclarativeecmascript.cpp | 23 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/deletedEngine.qml diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index b397177..6a99855 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -126,7 +126,7 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) QDeclarativeBindingData *data = d->bindingData(); - if (!data->enabled) + if (!data->enabled || !data->context() || !data->context()->engine) return; data->addref(); @@ -148,8 +148,7 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) idx, a); } else { - QDeclarativeEnginePrivate *ep = (data->context() && data->context()->engine)? - QDeclarativeEnginePrivate::get(data->context()->engine):0; + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(data->context()->engine); bool isUndefined = false; QVariant value; diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deletedEngine.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deletedEngine.qml new file mode 100644 index 0000000..6c538fe --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deletedEngine.qml @@ -0,0 +1,11 @@ +import Qt 4.6 + +QtObject { + function calculate() { + return b * 13; + } + + property int a: calculate() + property int b: 3 +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index f675801..72f14f9 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -138,6 +138,7 @@ private slots: void dynamicCreationCrash(); void regExpBug(); void nullObjectBinding(); + void deletedEngine(); void callQtInvokables(); private: @@ -2158,6 +2159,28 @@ void tst_qdeclarativeecmascript::nullObjectBinding() delete object; } +// Test that bindings don't evaluate once the engine has been destroyed +void tst_qdeclarativeecmascript::deletedEngine() +{ + QDeclarativeEngine *engine = new QDeclarativeEngine; + QDeclarativeComponent component(engine, TEST_FILE("deletedEngine.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("a").toInt(), 39); + object->setProperty("b", QVariant(9)); + QCOMPARE(object->property("a").toInt(), 117); + + delete engine; + + QCOMPARE(object->property("a").toInt(), 117); + object->setProperty("b", QVariant(10)); + QCOMPARE(object->property("a").toInt(), 117); + + delete object; +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" -- cgit v0.12 From c7674473ced40e0bf02459f0119bc3eb12bbf9b5 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 8 Apr 2010 19:19:16 +1000 Subject: Add tab navigation to twitter example authentication screen. --- demos/declarative/twitter/TwitterCore/AuthView.qml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/demos/declarative/twitter/TwitterCore/AuthView.qml b/demos/declarative/twitter/TwitterCore/AuthView.qml index 9d9341a..7986e74 100644 --- a/demos/declarative/twitter/TwitterCore/AuthView.qml +++ b/demos/declarative/twitter/TwitterCore/AuthView.qml @@ -24,7 +24,8 @@ Item { font.pixelSize: 16; font.bold: true color: "#151515"; selectionColor: "green" - KeyNavigation.down: passIn + KeyNavigation.tab: passIn + KeyNavigation.backtab: guest focus: true } } @@ -49,8 +50,8 @@ Item { font.pixelSize: 16; font.bold: true color: "#151515"; selectionColor: "green" - KeyNavigation.down: login - KeyNavigation.up: nameIn + KeyNavigation.tab: login + KeyNavigation.backtab: nameIn } } } @@ -69,7 +70,8 @@ Item { } text: "Log in" KeyNavigation.right: guest - KeyNavigation.up: passIn + KeyNavigation.tab: guest + KeyNavigation.backtab: passIn Keys.onReturnPressed: login.doLogin(); Keys.onSelectPressed: login.doLogin(); Keys.onSpacePressed: login.doLogin(); @@ -88,7 +90,8 @@ Item { } text: "Guest" KeyNavigation.left: login - KeyNavigation.up: passIn + KeyNavigation.tab: nameIn + KeyNavigation.backtab: login Keys.onReturnPressed: guest.doGuest(); Keys.onSelectPressed: guest.doGuest(); Keys.onSpacePressed: guest.doGuest(); -- cgit v0.12 From 5eb8e749bdd60ce93737b96f8f736796dfa77281 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 8 Apr 2010 19:29:43 +1000 Subject: Warn if the minehunt C++ plugin is not compiled. --- demos/declarative/minehunt/minehunt.qml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 299e722..4e384c0 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -141,4 +141,11 @@ Item { MouseArea { anchors.fill: parent; onPressed: reset() } } + Text { + anchors.fill: parent; wrap: true + text: "Minehunt will not run properly if the C++ plugin is not compiled.\nPlease see README." + color: "white"; font.bold: true; font.pixelSize: 14 + visible: tiles == undefined + } + } -- cgit v0.12 From 3d320b5a2659022cd9b487d3685fd19bcc4d598c Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 8 Apr 2010 12:51:38 +0200 Subject: Enable setting the imports directory via qt.conf Task-number: QTBUG-9701 --- doc/src/deployment/qt-conf.qdoc | 1 + src/corelib/global/qlibraryinfo.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/doc/src/deployment/qt-conf.qdoc b/doc/src/deployment/qt-conf.qdoc index b195889..298f539 100644 --- a/doc/src/deployment/qt-conf.qdoc +++ b/doc/src/deployment/qt-conf.qdoc @@ -87,6 +87,7 @@ \row \o Libraries \o \c lib \row \o Binaries \o \c bin \row \o Plugins \o \c plugins + \row \o Imports \o \c imports \row \o Data \o \c . \row \o Translations \o \c translations \row \o Settings \o \c . diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 9490225..3515777 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -329,6 +329,10 @@ QLibraryInfo::location(LibraryLocation loc) key = QLatin1String("Plugins"); defaultValue = QLatin1String("plugins"); break; + case ImportsPath: + key = QLatin1String("Imports"); + defaultValue = QLatin1String("imports"); + break; case DataPath: key = QLatin1String("Data"); break; -- cgit v0.12 From dc2429a34e8d0168ef33f48ec0da35631be49243 Mon Sep 17 00:00:00 2001 From: mae Date: Thu, 8 Apr 2010 14:54:31 +0200 Subject: Fix compile warnings --- src/declarative/qml/qdeclarativecompositetypemanager.cpp | 2 +- src/declarative/util/qdeclarativexmllistmodel.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp index 61978a4..ccf10c6 100644 --- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp +++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp @@ -634,7 +634,7 @@ int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData QDeclarativeError error; error.setUrl(unit->imports.baseUrl()); QString userTypeName = QString::fromUtf8(typeName); - userTypeName.replace('/','.'); + userTypeName.replace(QLatin1Char('/'),QLatin1Char('.')); if (typeNamespace) error.setDescription(tr("Namespace %1 cannot be used as a type").arg(userTypeName)); else diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index b33af06..7f8b962 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -160,7 +160,7 @@ public: for (int i=0; icount(); i++) { if (!roleObjects->at(i)->isValid()) { - job.roleQueries << ""; + job.roleQueries << QString(); continue; } job.roleQueries << roleObjects->at(i)->query(); -- cgit v0.12 From c3a54c47048b7123f51f2a1078e156d259445221 Mon Sep 17 00:00:00 2001 From: mae Date: Thu, 8 Apr 2010 14:54:42 +0200 Subject: Tune plugin import mechanism In shadow build environments, we cannot enforce that shared library objects for plugins are located in the same directory as the qmldir file. This makes it hard for Creator to support mixed projects (qml/c++). In order to gain more flexibility, the patch introduces a pluginPathList to QDeclarativeEngine, which completes the existing importsPathList. The pluginPathList defaults to ["."], which indicates the directory where the qmldir file is located in. The qml viewer tool gains a command line option -P to add to the pluginPathList. For consistency, the -L option ("Library") has been renamed to -I ("Import"). QDeclarativeEngine::importExtension() has been renamed to QDeclarativeEngine::importPlugin(). The documentation has been adjusted accordingly. Done with erikv. Reviewed-by: erikv --- doc/src/declarative/modules.qdoc | 33 ++++--- src/declarative/qml/qdeclarativeengine.cpp | 144 ++++++++++++++++++++++------- src/declarative/qml/qdeclarativeengine.h | 6 +- src/declarative/qml/qdeclarativeengine_p.h | 5 +- tools/qml/main.cpp | 35 ++++++- tools/qml/qmlruntime.cpp | 5 + tools/qml/qmlruntime.h | 1 + 7 files changed, 175 insertions(+), 54 deletions(-) diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc index 68e58fb..0e332d4 100644 --- a/doc/src/declarative/modules.qdoc +++ b/doc/src/declarative/modules.qdoc @@ -86,7 +86,7 @@ The second exception is explained in more detail in the section below on Namespa \section2 The Import Path Installed modules are searched for on the import path. -The \c -L option to the \l {Qt Declarative UI Runtime}{qml} runtime adds paths to the import path. +The \c -I option to the \l {Qt Declarative UI Runtime}{qml} runtime adds paths to the import path. From C++, the path is available via \l QDeclarativeEngine::importPathList() and can be prepended to using \l QDeclarativeEngine::addImportPath(). @@ -114,19 +114,7 @@ Installed files do not need to import the module of which they are a part, as th to the other QML files in the module as relative (local) files, but if the module is imported from a remote location, those files must nevertheless be listed in the \c qmldir file. Types which you do not wish to export to users of your module -may be marked with the \c internal keyword: - -\code -internal -\endcode - -\c plugin [] lines are used to add \l{QDeclarativeExtensionPlugin}{QML C++ plugins} -to the module. is the -name of the library. is an optional argument specifying the full path to the directory -containing the plugin file; if it is omitted then the directory is assumed to be the same as -the directory of the \c qmldir file. Note that is not usually the same as the file name -of the plugin binary, which is platform dependent; e.g. the library MyAppTypes would produce -a libMyAppTypes.so on Linux and MyAppTypes.dll on Windows. +may be marked with the \c internal keyword: \c internal . The same type can be provided by different files in different versions, in which case later earlier versions (eg. 1.2) must precede earlier versions (eg. 1.0), @@ -141,6 +129,23 @@ of installed software, since a versioned import \e only imports types for that v leaving other identifiers available, even if the actual installed version might otherwise provide those identifiers. +\c plugin [] lines are used to add \l{QDeclarativeExtensionPlugin}{QML C++ plugins} +to the module. + + is the name of the library. It is usually not the same as the file name +of the plugin binary, which is platform dependent; e.g. the library MyAppTypes would produce +a libMyAppTypes.so on Linux and MyAppTypes.dll on Windows. +By default the engine searches for the plugin library in the directory containing the \c qmldir +file. The \c -P option to the \l {Qt Declarative UI Runtime}{qml} runtime adds paths to the +plugin search path. +From C++, the path is available via \l QDeclarativeEngine::pluginPathList() and can be prepended to +using \l QDeclarativeEngine::addPluginPath(). + + is an optional argument specifying either an absolute path to the directory containing the +plugin file, or a relative path from the directory containing the \c qmldir file to the directory +containing the plugin file. + + \section2 Namespaces - Named Imports When importing content it by default imports types into the global namespace. diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 1bcadf2..68ce953 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -188,6 +188,8 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) fileImportPath += builtinPath; #endif + filePluginPath += QLatin1String("."); + } QUrl QDeclarativeScriptEngine::resolvedUrl(QScriptContext *context, const QUrl& url) @@ -1497,19 +1499,13 @@ public: foreach (const QDeclarativeDirParser::Plugin &plugin, qmldirParser.plugins()) { - QDir pluginDir = dir.absoluteFilePath(plugin.path); - - // hack for resources, should probably go away - if (absoluteFilePath.startsWith(QLatin1Char(':'))) - pluginDir = QDir(QCoreApplication::applicationDirPath()); - QString resolvedFilePath = QDeclarativeEnginePrivate::get(engine) - ->resolvePlugin(pluginDir, + ->resolvePlugin(dir, plugin.path, plugin.name); if (!resolvedFilePath.isEmpty()) { - engine->importExtension(resolvedFilePath, uri); + engine->importPlugin(resolvedFilePath, uri); } } } @@ -1804,8 +1800,8 @@ QUrl QDeclarativeEnginePrivate::Imports::baseUrl() const } /*! - Adds \a path as a directory where installed QML components are - defined in a URL-based directory structure. + Adds \a path as a directory where the engine searches for + installed modules in a URL-based directory structure. The newly added \a path will be first in the importPathList(). @@ -1828,7 +1824,7 @@ void QDeclarativeEngine::addImportPath(const QString& path) /*! Returns the list of directories where the engine searches for - installed modules. + installed modules in a URL-based directory structure. For example, if \c /opt/MyApp/lib/imports is in the path, then QML that imports \c com.mycompany.Feature will cause the QDeclarativeEngine to look @@ -1849,7 +1845,7 @@ QStringList QDeclarativeEngine::importPathList() const /*! Sets the list of directories where the engine searches for - installed modules. + installed modules in a URL-based directory structure. By default, the list contains the paths specified in the \c QML_IMPORT_PATH environment variable, then the builtin \c ImportsPath from QLibraryInfo. @@ -1862,15 +1858,73 @@ void QDeclarativeEngine::setImportPathList(const QStringList &paths) d->fileImportPath = paths; } + +/*! + Adds \a path as a directory where the engine searches for + native plugins for imported modules (referenced in the \c qmldir file). + + By default, the list contains only \c ., i.e. the engine searches + in the directory of the \c qmldir file itself. + + The newly added \a path will be first in the pluginPathList(). + + \sa setPluginPathList() +*/ +void QDeclarativeEngine::addPluginPath(const QString& path) +{ + if (qmlImportTrace()) + qDebug() << "QDeclarativeEngine::addPluginPath" << path; + Q_D(QDeclarativeEngine); + QUrl url = QUrl(path); + if (url.isRelative() || url.scheme() == QString::fromLocal8Bit("file")) { + QDir dir = QDir(path); + d->filePluginPath.prepend(dir.canonicalPath()); + } else { + d->filePluginPath.prepend(path); + } +} + + +/*! + Returns the list of directories where the engine searches for + native plugins for imported modules (referenced in the \c qmldir file). + + By default, the list contains only \c ., i.e. the engine searches + in the directory of the \c qmldir file itself. + + \sa addPluginPath() setPluginPathList() +*/ +QStringList QDeclarativeEngine::pluginPathList() const +{ + Q_D(const QDeclarativeEngine); + return d->filePluginPath; +} + +/*! + Sets the list of directories where the engine searches for + native plugins for imported modules (referenced in the \c qmldir file). + + By default, the list contains only \c ., i.e. the engine searches + in the directory of the \c qmldir file itself. + + \sa pluginPathList() addPluginPath() + */ +void QDeclarativeEngine::setPluginPathList(const QStringList &paths) +{ + Q_D(QDeclarativeEngine); + d->filePluginPath = paths; +} + + /*! - Imports the extension named \a fileName from the \a uri provided. - Returns true if the extension was successfully imported. + Imports the plugin named \a filePath with the \a uri provided. + Returns true if the plugin was successfully imported; otherwise returns false. */ -bool QDeclarativeEngine::importExtension(const QString &fileName, const QString &uri) +bool QDeclarativeEngine::importPlugin(const QString &filePath, const QString &uri) { if (qmlImportTrace()) - qDebug() << "QDeclarativeEngine::importExtension" << uri << "from" << fileName; - QFileInfo fileInfo(fileName); + qDebug() << "QDeclarativeEngine::importPlugin" << uri << "from" << filePath; + QFileInfo fileInfo(filePath); const QString absoluteFilePath = fileInfo.absoluteFilePath(); QDeclarativeEnginePrivate *d = QDeclarativeEnginePrivate::get(this); @@ -1943,27 +1997,53 @@ QString QDeclarativeEngine::offlineStoragePath() const /*! \internal - Returns the result of the merge of \a baseName with \a dir, \a suffixes, and \a prefix. + Returns the result of the merge of \a baseName with \a path, \a suffixes, and \a prefix. The \a prefix must contain the dot. + + \a qmldirPath is the location of the qmldir file. */ -QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString &baseName, +QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, const QString &baseName, const QStringList &suffixes, const QString &prefix) { - foreach (const QString &suffix, suffixes) { - QString pluginFileName = prefix; + QStringList searchPaths = filePluginPath; + bool qmldirPluginPathIsRelative = QDir::isRelativePath(qmldirPluginPath); + if (!qmldirPluginPathIsRelative) + searchPaths.prepend(qmldirPluginPath); + + foreach (const QString &pluginPath, searchPaths) { + + QString resolvedPath; - pluginFileName += baseName; - pluginFileName += suffix; + if (pluginPath == QLatin1String(".")) { + if (qmldirPluginPathIsRelative) + resolvedPath = qmldirPath.absoluteFilePath(qmldirPluginPath); + else + resolvedPath = qmldirPath.absolutePath(); + } else { + resolvedPath = pluginPath; + } + + // hack for resources, should probably go away + if (resolvedPath.startsWith(QLatin1Char(':'))) + resolvedPath = QCoreApplication::applicationDirPath(); - QFileInfo fileInfo(dir, pluginFileName); + QDir dir(resolvedPath); + foreach (const QString &suffix, suffixes) { + QString pluginFileName = prefix; - if (fileInfo.exists()) - return fileInfo.absoluteFilePath(); + pluginFileName += baseName; + pluginFileName += suffix; + + QFileInfo fileInfo(dir, pluginFileName); + + if (fileInfo.exists()) + return fileInfo.absoluteFilePath(); + } } if (qmlImportTrace()) - qDebug() << "QDeclarativeEngine::resolvePlugin: Could not resolve plugin" << baseName << "in" << dir.absolutePath(); + qDebug() << "QDeclarativeEngine::resolvePlugin: Could not resolve plugin" << baseName << "in" << qmldirPath.absolutePath(); return QString(); } @@ -1984,17 +2064,17 @@ QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString Version number on unix are ignored. */ -QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString &baseName) +QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, const QString &baseName) { #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) - return resolvePlugin(dir, baseName, + return resolvePlugin(qmldirPath, qmldirPluginPath, baseName, QStringList() # ifdef QT_DEBUG << QLatin1String("d.dll") // try a qmake-style debug build first # endif << QLatin1String(".dll")); #elif defined(Q_OS_SYMBIAN) - return resolvePlugin(dir, baseName, + return resolvePlugin(qmldirPath, qmldirPluginPath, baseName, QStringList() << QLatin1String(".dll") << QLatin1String(".qtplugin")); @@ -2002,7 +2082,7 @@ QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString # if defined(Q_OS_DARWIN) - return resolvePlugin(dir, baseName, + return resolvePlugin(qmldirPath, qmldirPluginPath, baseName, QStringList() # ifdef QT_DEBUG << QLatin1String("_debug.dylib") // try a qmake-style debug build first @@ -2036,7 +2116,7 @@ QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString // Examples of valid library names: // libfoo.so - return resolvePlugin(dir, baseName, validSuffixList, QLatin1String("lib")); + return resolvePlugin(qmldirPath, qmldirPluginPath, baseName, validSuffixList, QLatin1String("lib")); # endif #endif diff --git a/src/declarative/qml/qdeclarativeengine.h b/src/declarative/qml/qdeclarativeengine.h index b861c1b..fcaddcf 100644 --- a/src/declarative/qml/qdeclarativeengine.h +++ b/src/declarative/qml/qdeclarativeengine.h @@ -81,7 +81,11 @@ public: void setImportPathList(const QStringList &paths); void addImportPath(const QString& dir); - bool importExtension(const QString &fileName, const QString &uri); + QStringList pluginPathList() const; + void setPluginPathList(const QStringList &paths); + void addPluginPath(const QString& dir); + + bool importPlugin(const QString &filePath, const QString &uri); void setNetworkAccessManagerFactory(QDeclarativeNetworkAccessManagerFactory *); QDeclarativeNetworkAccessManagerFactory *networkAccessManagerFactory() const; diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 3f22d61..6bcd0d1 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -231,6 +231,7 @@ public: QDeclarativeCompositeTypeManager typeManager; QStringList fileImportPath; + QStringList filePluginPath; QString offlineStoragePath; mutable quint32 uniqueId; @@ -274,10 +275,10 @@ public: QSet initializedPlugins; - QString resolvePlugin(const QDir &dir, const QString &baseName, + QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, const QString &baseName, const QStringList &suffixes, const QString &prefix = QString()); - QString resolvePlugin(const QDir &dir, const QString &baseName); + QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath, const QString &baseName); bool addToImport(Imports*, const QDeclarativeDirComponents &qmldircomponentsnetwork, diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 5099e49..01b3912 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -101,8 +101,9 @@ void usage() qWarning(" -dragthreshold .................... set mouse drag threshold size"); qWarning(" -netcache ......................... set disk cache to size bytes"); qWarning(" -translation ........... set the language to run in"); - qWarning(" -L ........................... prepend to the library search path,"); + qWarning(" -I ........................... prepend to the module import search path,"); qWarning(" display path if is empty"); + qWarning(" -P ........................... prepend to the plugin search path"); qWarning(" -opengl .................................. use a QGLWidget for the viewport"); qWarning(" -script ........................... set the script to use"); qWarning(" -scriptopts |help ............... set the script options to use"); @@ -167,7 +168,8 @@ int main(int argc, char ** argv) QString dither = "none"; QString recordfile; QStringList recordargs; - QStringList libraries; + QStringList imports; + QStringList plugins; QString skin; QString script; QString scriptopts; @@ -239,14 +241,19 @@ int main(int argc, char ** argv) useGL = true; } else if (arg == "-qmlbrowser") { useNativeFileBrowser = false; - } else if (arg == "-L") { + } else if (arg == "-I" || arg == "-L") { + if (arg == "-L") + fprintf(stderr, "-L option provided for compatibility only, use -I instead"); if (lastArg) { QDeclarativeEngine tmpEngine; QString paths = tmpEngine.importPathList().join(QLatin1String(":")); fprintf(stderr, "Current search path: %s\n", paths.toLocal8Bit().constData()); return 0; } - libraries << QString(argv[++i]); + imports << QString(argv[++i]); + } else if (arg == "-P") { + if (lastArg) usage(); + plugins << QString(argv[++i]); } else if (arg == "-script") { if (lastArg) usage(); script = QString(argv[++i]); @@ -320,9 +327,12 @@ int main(int argc, char ** argv) viewer.addLibraryPath(QCoreApplication::applicationDirPath()); - foreach (QString lib, libraries) + foreach (QString lib, imports) viewer.addLibraryPath(lib); + foreach (QString plugin, plugins) + viewer.addPluginPath(plugin); + viewer.setNetworkCacheSize(cache); viewer.setRecordFile(recordfile); if (resizeview) @@ -349,6 +359,21 @@ int main(int argc, char ** argv) viewer.setUseNativeFileBrowser(useNativeFileBrowser); if (fullScreen && maximized) qWarning() << "Both -fullscreen and -maximized specified. Using -fullscreen."; + + if (fileName.isEmpty()) { + QFile qmlapp(QLatin1String("qmlapp")); + if (qmlapp.exists() && qmlapp.open(QFile::ReadOnly)) { + QString content = QString::fromUtf8(qmlapp.readAll()); + qmlapp.close(); + + int newline = content.indexOf(QLatin1Char('\n')); + if (newline >= 0) + fileName = content.left(newline); + else + fileName = content; + } + } + if (!fileName.isEmpty()) { viewer.open(fileName); fullScreen ? viewer.showFullScreen() : maximized ? viewer.showMaximized() : viewer.show(); diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 1ab528e..c4ebd80 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -870,6 +870,11 @@ void QDeclarativeViewer::addLibraryPath(const QString& lib) canvas->engine()->addImportPath(lib); } +void QDeclarativeViewer::addPluginPath(const QString& plugin) +{ + canvas->engine()->addPluginPath(plugin); +} + void QDeclarativeViewer::reload() { openQml(currentFileOrUrl); diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index 01777bd..6f1e425 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -96,6 +96,7 @@ public: void setDeviceKeys(bool); void setNetworkCacheSize(int size); void addLibraryPath(const QString& lib); + void addPluginPath(const QString& plugin); void setUseGL(bool use); void setUseNativeFileBrowser(bool); -- cgit v0.12 From fa8c4a6b548f16a2ee9ba296fa8374995ed7afb8 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 9 Apr 2010 09:13:30 +1000 Subject: Update test following property name change. --- .../declarative/qdeclarativespringfollow/data/springfollow2.qml | 2 +- .../declarative/qdeclarativespringfollow/data/springfollow3.qml | 2 +- .../qdeclarativespringfollow/tst_qdeclarativespringfollow.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/auto/declarative/qdeclarativespringfollow/data/springfollow2.qml b/tests/auto/declarative/qdeclarativespringfollow/data/springfollow2.qml index 7c81fb5..ffbf7d5 100644 --- a/tests/auto/declarative/qdeclarativespringfollow/data/springfollow2.qml +++ b/tests/auto/declarative/qdeclarativespringfollow/data/springfollow2.qml @@ -1,7 +1,7 @@ import Qt 4.6 SpringFollow { - source: 1.44; velocity: 0.9 + to: 1.44; velocity: 0.9 spring: 1.0; damping: 0.5 epsilon: 0.25; modulus: 360.0 mass: 2.0; enabled: true diff --git a/tests/auto/declarative/qdeclarativespringfollow/data/springfollow3.qml b/tests/auto/declarative/qdeclarativespringfollow/data/springfollow3.qml index 6fec55b..9a8f6f3 100644 --- a/tests/auto/declarative/qdeclarativespringfollow/data/springfollow3.qml +++ b/tests/auto/declarative/qdeclarativespringfollow/data/springfollow3.qml @@ -1,7 +1,7 @@ import Qt 4.6 SpringFollow { - source: 1.44; velocity: 0.9 + to: 1.44; velocity: 0.9 spring: 1.0; damping: 0.5 epsilon: 0.25; modulus: 360.0 mass: 2.0; enabled: false diff --git a/tests/auto/declarative/qdeclarativespringfollow/tst_qdeclarativespringfollow.cpp b/tests/auto/declarative/qdeclarativespringfollow/tst_qdeclarativespringfollow.cpp index 7a60e78..8a07d6b 100644 --- a/tests/auto/declarative/qdeclarativespringfollow/tst_qdeclarativespringfollow.cpp +++ b/tests/auto/declarative/qdeclarativespringfollow/tst_qdeclarativespringfollow.cpp @@ -72,7 +72,7 @@ void tst_qdeclarativespringfollow::defaultValues() QVERIFY(obj != 0); - QCOMPARE(obj->sourceValue(), 0.); + QCOMPARE(obj->to(), 0.); QCOMPARE(obj->velocity(), 0.); QCOMPARE(obj->spring(), 0.); QCOMPARE(obj->damping(), 0.); @@ -94,7 +94,7 @@ void tst_qdeclarativespringfollow::values() QVERIFY(obj != 0); - QCOMPARE(obj->sourceValue(), 1.44); + QCOMPARE(obj->to(), 1.44); QCOMPARE(obj->velocity(), 0.9); QCOMPARE(obj->spring(), 1.0); QCOMPARE(obj->damping(), 0.5); @@ -117,7 +117,7 @@ void tst_qdeclarativespringfollow::disabled() QVERIFY(obj != 0); - QCOMPARE(obj->sourceValue(), 1.44); + QCOMPARE(obj->to(), 1.44); QCOMPARE(obj->velocity(), 0.9); QCOMPARE(obj->spring(), 1.0); QCOMPARE(obj->damping(), 0.5); -- cgit v0.12 From 407501ab9984f6d32d387928bdc2e48c91efc031 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 9 Apr 2010 09:17:32 +1000 Subject: Fix test. --- tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index cd732b6..1cbe2ac 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -297,7 +297,7 @@ void tst_qdeclarativedom::testValueSource() QVERIFY(springValue.isLiteral()); QVERIFY(springValue.toLiteral().literal() == "1.4"); - const QDeclarativeDomValue sourceValue = valueSourceObject.property("source").value(); + const QDeclarativeDomValue sourceValue = valueSourceObject.property("to").value(); QVERIFY(!sourceValue.isInvalid()); QVERIFY(sourceValue.isBinding()); QVERIFY(sourceValue.toBinding().binding() == "Math.min(Math.max(-130, value*2.2 - 130), 133)"); -- cgit v0.12 From a7d29653c73347f90d8c9628321b9ec7cadb9ce7 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 9 Apr 2010 09:20:25 +1000 Subject: Update visual test. We've updated our handling of drag threshold in MouseArea. --- .../qmlvisual/qdeclarativemousearea/data/drag.0.png | Bin 1563 -> 1578 bytes .../qmlvisual/qdeclarativemousearea/data/drag.1.png | Bin 1570 -> 1585 bytes .../qmlvisual/qdeclarativemousearea/data/drag.2.png | Bin 1553 -> 1568 bytes .../qmlvisual/qdeclarativemousearea/data/drag.3.png | Bin 1563 -> 1578 bytes .../qmlvisual/qdeclarativemousearea/data/drag.4.png | Bin 1569 -> 1584 bytes .../qmlvisual/qdeclarativemousearea/data/drag.5.png | Bin 1569 -> 1584 bytes .../qmlvisual/qdeclarativemousearea/data/drag.6.png | Bin 1566 -> 1581 bytes .../qmlvisual/qdeclarativemousearea/data/drag.7.png | Bin 1566 -> 1581 bytes .../qmlvisual/qdeclarativemousearea/data/drag.qml | 8 ++++---- 9 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.0.png b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.0.png index cf36d60..5b7b426 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.0.png and b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.0.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.1.png b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.1.png index 6069df8..7c27310 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.1.png and b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.1.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.2.png b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.2.png index b8bd5f3..cbfdb23 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.2.png and b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.2.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.3.png b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.3.png index cf36d60..5b7b426 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.3.png and b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.3.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.4.png b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.4.png index 831d6b4..5af705e 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.4.png and b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.4.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.5.png b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.5.png index f7079dc..af4395e 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.5.png and b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.5.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.6.png b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.6.png index a5f4451..cd12bc9 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.6.png and b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.6.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.7.png b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.7.png index e1261d0..471c86b 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.7.png and b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.7.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.qml b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.qml index 5a131e9..f3071e4 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/data/drag.qml @@ -486,7 +486,7 @@ VisualTest { } Frame { msec: 1840 - hash: "b6b4b2c7acddd23609caa9727911b981" + hash: "668cc6d9d699b947a7c0f3ff4b26853f" } Mouse { type: 5 @@ -498,7 +498,7 @@ VisualTest { } Frame { msec: 1856 - hash: "b6b4b2c7acddd23609caa9727911b981" + hash: "668cc6d9d699b947a7c0f3ff4b26853f" } Mouse { type: 5 @@ -510,7 +510,7 @@ VisualTest { } Frame { msec: 1872 - hash: "022610222cfbcf9e9a8991cdb60c7bbb" + hash: "668cc6d9d699b947a7c0f3ff4b26853f" } Mouse { type: 5 @@ -522,7 +522,7 @@ VisualTest { } Frame { msec: 1888 - hash: "9b5201a3201a102b20592d81218b5e74" + hash: "668cc6d9d699b947a7c0f3ff4b26853f" } Mouse { type: 5 -- cgit v0.12 From 139b84198b6bd0454becc9d5ae1a64a1e22f1fe2 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 9 Apr 2010 09:47:49 +1000 Subject: Add highlightMoveDuration to views. Task-number: QTBUG-7568 --- doc/src/declarative/elements.qdoc | 10 ++++- .../graphicsitems/qdeclarativegridview.cpp | 37 +++++++++++++++- .../graphicsitems/qdeclarativegridview_p.h | 5 +++ .../graphicsitems/qdeclarativelistview.cpp | 49 +++++++++++++++++++++- .../graphicsitems/qdeclarativelistview_p.h | 10 +++++ .../graphicsitems/qdeclarativepathview.cpp | 29 ++++++++++++- .../graphicsitems/qdeclarativepathview_p.h | 5 +++ .../graphicsitems/qdeclarativepathview_p_p.h | 4 +- 8 files changed, 139 insertions(+), 10 deletions(-) diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 1bb739d..4946346 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -88,11 +88,17 @@ The following table lists the QML elements provided by the Qt Declarative module \o \list \o \l Binding -\o \l ListModel, \l ListElement +\o \l ListModel +\list +\o \l ListElement +\endlist \o \l VisualItemModel \o \l VisualDataModel \o \l Package -\o \l XmlListModel and XmlRole +\o \l XmlListModel +\list +\o \l XmlRole +\endlist \endlist \o diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index e44a26d..283052a 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -106,6 +106,7 @@ public: , highlightRangeStart(0), highlightRangeEnd(0), highlightRange(QDeclarativeGridView::NoHighlightRange) , highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightXAnimator(0), highlightYAnimator(0) + , highlightMoveDuration(150) , bufferMode(NoBuffer), snapMode(QDeclarativeGridView::NoSnap) , ownModel(false), wrap(false), autoHighlight(true) , fixCurrentVisibility(false), lazyRelease(false), layoutScheduled(false) @@ -327,6 +328,7 @@ public: int buffer; QSmoothedAnimation *highlightXAnimator; QSmoothedAnimation *highlightYAnimator; + int highlightMoveDuration; enum BufferMode { NoBuffer = 0x00, BufferBefore = 0x01, BufferAfter = 0x02 }; BufferMode bufferMode; QDeclarativeGridView::SnapMode snapMode; @@ -669,10 +671,10 @@ void QDeclarativeGridViewPrivate::createHighlight() highlight = new FxGridItem(item, q); highlightXAnimator = new QSmoothedAnimation(q); highlightXAnimator->target = QDeclarativeProperty(highlight->item, QLatin1String("x")); - highlightXAnimator->userDuration = 150; + highlightXAnimator->userDuration = highlightMoveDuration; highlightYAnimator = new QSmoothedAnimation(q); highlightYAnimator->target = QDeclarativeProperty(highlight->item, QLatin1String("y")); - highlightYAnimator->userDuration = 150; + highlightYAnimator->userDuration = highlightMoveDuration; highlightXAnimator->restart(); highlightYAnimator->restart(); changed = true; @@ -1204,6 +1206,37 @@ void QDeclarativeGridView::setHighlightFollowsCurrentItem(bool autoHighlight) } /*! + \qmlproperty int GridView::highlightMoveDuration + This property holds the move animation duration of the highlight delegate. + + highlightFollowsCurrentItem must be true for this property + to have effect. + + The default value for the duration is 150ms. + + \sa highlightFollowsCurrentItem +*/ +int QDeclarativeGridView::highlightMoveDuration() const +{ + Q_D(const QDeclarativeGridView); + return d->highlightMoveDuration; +} + +void QDeclarativeGridView::setHighlightMoveDuration(int duration) +{ + Q_D(QDeclarativeGridView); + if (d->highlightMoveDuration != duration) { + d->highlightMoveDuration = duration; + if (d->highlightYAnimator) { + d->highlightXAnimator->userDuration = d->highlightMoveDuration; + d->highlightYAnimator->userDuration = d->highlightMoveDuration; + } + emit highlightMoveDurationChanged(); + } +} + + +/*! \qmlproperty real GridView::preferredHighlightBegin \qmlproperty real GridView::preferredHighlightEnd \qmlproperty enumeration GridView::highlightRangeMode diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index f73f632..5baa1dd 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -66,6 +66,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeGridView : public QDeclarativeFlickable Q_PROPERTY(QDeclarativeComponent *highlight READ highlight WRITE setHighlight NOTIFY highlightChanged) Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightItemChanged) Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem) + Q_PROPERTY(int highlightMoveDuration READ highlightMoveDuration WRITE setHighlightMoveDuration NOTIFY highlightMoveDurationChanged) Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged) Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged) @@ -106,6 +107,9 @@ public: bool highlightFollowsCurrentItem() const; void setHighlightFollowsCurrentItem(bool); + int highlightMoveDuration() const; + void setHighlightMoveDuration(int); + enum HighlightRangeMode { NoHighlightRange, ApplyRange, StrictlyEnforceRange }; HighlightRangeMode highlightRangeMode() const; void setHighlightRangeMode(HighlightRangeMode mode); @@ -161,6 +165,7 @@ Q_SIGNALS: void preferredHighlightBeginChanged(); void preferredHighlightEndChanged(); void highlightRangeModeChanged(); + void highlightMoveDurationChanged(); void modelChanged(); void delegateChanged(); void flowChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 31d97f3..b4506ef 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -156,7 +156,8 @@ public: , highlightComponent(0), highlight(0), trackedItem(0) , moveReason(Other), buffer(0), highlightPosAnimator(0), highlightSizeAnimator(0) , sectionCriteria(0), spacing(0.0) - , highlightMoveSpeed(400), highlightResizeSpeed(400), highlightRange(QDeclarativeListView::NoHighlightRange) + , highlightMoveSpeed(400), highlightMoveDuration(-1) + , highlightResizeSpeed(400), highlightResizeDuration(-1), highlightRange(QDeclarativeListView::NoHighlightRange) , snapMode(QDeclarativeListView::NoSnap), overshootDist(0.0) , footerComponent(0), footer(0), headerComponent(0), header(0) , bufferMode(NoBuffer) @@ -464,7 +465,9 @@ public: QDeclarativeItem *sectionCache[sectionCacheSize]; qreal spacing; qreal highlightMoveSpeed; + int highlightMoveDuration; qreal highlightResizeSpeed; + int highlightResizeDuration; QDeclarativeListView::HighlightRangeMode highlightRange; QDeclarativeListView::SnapMode snapMode; qreal overshootDist; @@ -835,10 +838,12 @@ void QDeclarativeListViewPrivate::createHighlight() highlightPosAnimator = new QSmoothedAnimation(q); highlightPosAnimator->target = QDeclarativeProperty(highlight->item, posProp); highlightPosAnimator->velocity = highlightMoveSpeed; + highlightPosAnimator->userDuration = highlightMoveDuration; highlightPosAnimator->restart(); const QLatin1String sizeProp(orient == QDeclarativeListView::Vertical ? "height" : "width"); highlightSizeAnimator = new QSmoothedAnimation(q); highlightSizeAnimator->velocity = highlightResizeSpeed; + highlightSizeAnimator->userDuration = highlightResizeDuration; highlightSizeAnimator->target = QDeclarativeProperty(highlight->item, sizeProp); highlightSizeAnimator->restart(); changed = true; @@ -1867,13 +1872,19 @@ QString QDeclarativeListView::currentSection() const /*! \qmlproperty real ListView::highlightMoveSpeed + \qmlproperty int ListView::highlightMoveDuration \qmlproperty real ListView::highlightResizeSpeed + \qmlproperty int ListView::highlightResizeDuration These properties hold the move and resize animation speed of the highlight delegate. highlightFollowsCurrentItem must be true for these properties to have effect. - The default value for these properties is 400 pixels/second. + The default value for the speed properties is 400 pixels/second. + The default value for the duration properties is -1, i.e. the + highlight will take as much time as necessary to move at the set speed. + + These properties have the same characteristics as a SmoothedAnimation. \sa highlightFollowsCurrentItem */ @@ -1894,6 +1905,23 @@ void QDeclarativeListView::setHighlightMoveSpeed(qreal speed) } } +int QDeclarativeListView::highlightMoveDuration() const +{ + Q_D(const QDeclarativeListView); + return d->highlightMoveDuration; +} + +void QDeclarativeListView::setHighlightMoveDuration(int duration) +{ + Q_D(QDeclarativeListView);\ + if (d->highlightMoveDuration != duration) { + d->highlightMoveDuration = duration; + if (d->highlightPosAnimator) + d->highlightPosAnimator->userDuration = d->highlightMoveDuration; + emit highlightMoveDurationChanged(); + } +} + qreal QDeclarativeListView::highlightResizeSpeed() const { Q_D(const QDeclarativeListView);\ @@ -1911,6 +1939,23 @@ void QDeclarativeListView::setHighlightResizeSpeed(qreal speed) } } +int QDeclarativeListView::highlightResizeDuration() const +{ + Q_D(const QDeclarativeListView); + return d->highlightResizeDuration; +} + +void QDeclarativeListView::setHighlightResizeDuration(int duration) +{ + Q_D(QDeclarativeListView);\ + if (d->highlightResizeDuration != duration) { + d->highlightResizeDuration = duration; + if (d->highlightSizeAnimator) + d->highlightSizeAnimator->userDuration = d->highlightResizeDuration; + emit highlightResizeDurationChanged(); + } +} + /*! \qmlproperty enumeration ListView::snapMode diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index 5810979..9c0b7dd 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -101,7 +101,9 @@ class Q_DECLARATIVE_EXPORT QDeclarativeListView : public QDeclarativeFlickable Q_PROPERTY(QDeclarativeItem *highlightItem READ highlightItem NOTIFY highlightItemChanged) Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem NOTIFY highlightFollowsCurrentItemChanged) Q_PROPERTY(qreal highlightMoveSpeed READ highlightMoveSpeed WRITE setHighlightMoveSpeed NOTIFY highlightMoveSpeedChanged) + Q_PROPERTY(int highlightMoveDuration READ highlightMoveDuration WRITE setHighlightMoveDuration NOTIFY highlightMoveDurationChanged) Q_PROPERTY(qreal highlightResizeSpeed READ highlightResizeSpeed WRITE setHighlightResizeSpeed NOTIFY highlightResizeSpeedChanged) + Q_PROPERTY(int highlightResizeDuration READ highlightResizeDuration WRITE setHighlightResizeDuration NOTIFY highlightResizeDurationChanged) Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged) Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged) @@ -176,9 +178,15 @@ public: qreal highlightMoveSpeed() const; void setHighlightMoveSpeed(qreal); + int highlightMoveDuration() const; + void setHighlightMoveDuration(int); + qreal highlightResizeSpeed() const; void setHighlightResizeSpeed(qreal); + int highlightResizeDuration() const; + void setHighlightResizeDuration(int); + enum SnapMode { NoSnap, SnapToItem, SnapOneItem }; SnapMode snapMode() const; void setSnapMode(SnapMode mode); @@ -208,7 +216,9 @@ Q_SIGNALS: void currentIndexChanged(); void currentSectionChanged(); void highlightMoveSpeedChanged(); + void highlightMoveDurationChanged(); void highlightResizeSpeedChanged(); + void highlightResizeDurationChanged(); void highlightChanged(); void highlightItemChanged(); void modelChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 813b525..5fcac49 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -221,7 +221,7 @@ void QDeclarativePathViewPrivate::updateHighlight() tl.reset(moveHighlight); moveHighlight.setValue(highlightPosition); - const int duration = 300; + const int duration = highlightMoveDuration; if (target - highlightPosition > model->count()/2) { highlightUp = false; @@ -691,6 +691,31 @@ void QDeclarativePathView::setHighlightRangeMode(HighlightRangeMode mode) emit highlightRangeModeChanged(); } + +/*! + \qmlproperty int PathView::highlightMoveDuration + This property holds the move animation duration of the highlight delegate. + + If the highlightRangeMode is StrictlyEnforceRange then this property + determines the speed that the items move along the path. + + The default value for the duration is 300ms. +*/ +int QDeclarativePathView::highlightMoveDuration() const +{ + Q_D(const QDeclarativePathView); + return d->highlightMoveDuration; +} + +void QDeclarativePathView::setHighlightMoveDuration(int duration) +{ + Q_D(QDeclarativePathView); + if (d->highlightMoveDuration == duration) + return; + d->highlightMoveDuration = duration; + emit highlightMoveDurationChanged(); +} + /*! \qmlproperty real PathView::dragMargin This property holds the maximum distance from the path that initiate mouse dragging. @@ -1316,7 +1341,7 @@ void QDeclarativePathViewPrivate::snapToCurrent() tl.reset(moveOffset); moveOffset.setValue(offset); - const int duration = 300; + const int duration = highlightMoveDuration; if (targetOffset - offset > model->count()/2) { qreal distance = model->count() - targetOffset + offset; diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h index 69770cd..7240578 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h @@ -68,6 +68,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativePathView : public QDeclarativeItem Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin NOTIFY preferredHighlightBeginChanged) Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd NOTIFY preferredHighlightEndChanged) Q_PROPERTY(HighlightRangeMode highlightRangeMode READ highlightRangeMode WRITE setHighlightRangeMode NOTIFY highlightRangeModeChanged) + Q_PROPERTY(int highlightMoveDuration READ highlightMoveDuration WRITE setHighlightMoveDuration NOTIFY highlightMoveDurationChanged) Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin NOTIFY dragMarginChanged) Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged) @@ -109,6 +110,9 @@ public: qreal preferredHighlightEnd() const; void setPreferredHighlightEnd(qreal); + int highlightMoveDuration() const; + void setHighlightMoveDuration(int); + qreal dragMargin() const; void setDragMargin(qreal margin); @@ -145,6 +149,7 @@ Q_SIGNALS: void interactiveChanged(); void highlightChanged(); void highlightItemChanged(); + void highlightMoveDurationChanged(); protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h index 11712fd..303486f 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h @@ -85,7 +85,7 @@ public: , highlightPosition(0) , highlightRangeStart(0), highlightRangeEnd(0) , highlightRangeMode(QDeclarativePathView::StrictlyEnforceRange) - , highlightMoveSpeed(1.0) + , highlightMoveDuration(300) { } @@ -160,7 +160,7 @@ public: qreal highlightRangeStart; qreal highlightRangeEnd; QDeclarativePathView::HighlightRangeMode highlightRangeMode; - qreal highlightMoveSpeed; + int highlightMoveDuration; }; QT_END_NAMESPACE -- cgit v0.12 From 8f1cb90d810fcff31447b4fbcef59b1bf289aa67 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 9 Apr 2010 09:52:05 +1000 Subject: Calculate GridView columns regardless of whether we have a populated model Task-number: QTBUG-9692 --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 283052a..f832f12 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1820,8 +1820,8 @@ void QDeclarativeGridView::componentComplete() { Q_D(QDeclarativeGridView); QDeclarativeFlickable::componentComplete(); + d->updateGrid(); if (d->isValid()) { - d->updateGrid(); refill(); if (d->currentIndex < 0) d->updateCurrent(0); -- cgit v0.12 From 04664c6ed9a86d146c91ef57990d8ffdf3afa59d Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 9 Apr 2010 10:19:39 +1000 Subject: Verbose failure output --- tests/auto/declarative/examples/tst_examples.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index dbd1f92..8fd5ac0 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -194,6 +194,8 @@ void tst_examples::examples() QProcess p; p.start(qmlruntime, arguments); QVERIFY(p.waitForFinished()); + if (p.exitStatus() != QProcess::NormalExit || p.exitCode() != 0) + qWarning() << p.readAllStandardOutput() << p.readAllStandardError(); QCOMPARE(p.exitStatus(), QProcess::NormalExit); QCOMPARE(p.exitCode(), 0); } -- cgit v0.12 From 41893d3259a477e424667c5400617aae3a7a45a1 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 9 Apr 2010 10:39:17 +1000 Subject: self-doc --- examples/declarative/gestures/experimental-gestures.qml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/declarative/gestures/experimental-gestures.qml b/examples/declarative/gestures/experimental-gestures.qml index 5f904aa..cb190ea 100644 --- a/examples/declarative/gestures/experimental-gestures.qml +++ b/examples/declarative/gestures/experimental-gestures.qml @@ -5,6 +5,14 @@ import Qt.labs.gestures 1.0 Rectangle { id: rect + width: 320 + height: 180 + + Text { + anchors.centerIn: parent + text: "Tap / TapAndHold / Pan / Pinch / Swipe\nOnly works on platforms with Touch support." + horizontalAlignment: Text.Center + } GestureArea { anchors.fill: parent -- cgit v0.12 From 9615dfeca337c9f40d96485d2dd248eb8cefd563 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Fri, 9 Apr 2010 03:00:06 +0200 Subject: Make the TextInput element nicer. It has scrolling. The TextInput has support for scrolling now so it's quite usable. You can deactivate the auto scrolling with a property if you want to do crazy animation while scrolling. This commit also fixed several bugs with the current implementation especially regarding aligments : selection was broken, moving the cursor also -> fixed. I have also added a tiny fix when the TextInput lost the focus -> the selection is cleared. Task-number:QT-2745 Reviewed-by:Michael Brasser --- .../graphicsitems/qdeclarativetextinput.cpp | 99 ++++++++++++++++++---- .../graphicsitems/qdeclarativetextinput_p.h | 6 ++ .../graphicsitems/qdeclarativetextinput_p_p.h | 11 ++- .../tst_qdeclarativetextinput.cpp | 24 ++++++ 4 files changed, 121 insertions(+), 19 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 4b311af..1b8b84b 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -429,6 +429,29 @@ void QDeclarativeTextInput::setFocusOnPress(bool b) } /*! + \qmlproperty bool TextInput::autoScroll + + Whether the TextInput should scroll when the text is longer than the width. By default this is + set to true. +*/ +bool QDeclarativeTextInput::autoScroll() const +{ + Q_D(const QDeclarativeTextInput); + return d->autoScroll; +} + +void QDeclarativeTextInput::setAutoScroll(bool b) +{ + Q_D(QDeclarativeTextInput); + if (d->autoScroll == b) + return; + + d->autoScroll = b; + + emit autoScrollChanged(d->autoScroll); +} + +/*! \qmlproperty Validator TextInput::validator Allows you to set a validator on the TextInput. When a validator is set @@ -645,6 +668,8 @@ void QDeclarativeTextInputPrivate::focusChanged(bool hasFocus) Q_Q(QDeclarativeTextInput); focused = hasFocus; q->setCursorVisible(hasFocus); + if (!hasFocus) + control->deselect(); QDeclarativeItemPrivate::focusChanged(hasFocus); } @@ -679,7 +704,15 @@ void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) } setFocus(true); } - d->control->processEvent(event); + bool mark = event->modifiers() & Qt::ShiftModifier; + int cursor = d->xToPos(event->pos().x()); + d->control->moveCursor(cursor, mark); +} + +void QDeclarativeTextInput::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativeTextInput); + d->control->moveCursor(d->xToPos(event->pos().x()), true); } /*! @@ -704,6 +737,7 @@ bool QDeclarativeTextInput::event(QEvent* ev) case QEvent::KeyPress: case QEvent::KeyRelease://###Should the control be doing anything with release? case QEvent::GraphicsSceneMousePress: + case QEvent::GraphicsSceneMouseMove: case QEvent::GraphicsSceneMouseRelease: break; default: @@ -733,28 +767,56 @@ void QDeclarativeTextInput::drawContents(QPainter *p, const QRect &r) int flags = QLineControl::DrawText; if(!isReadOnly() && d->cursorVisible && !d->cursorItem) flags |= QLineControl::DrawCursor; - if (d->control->hasSelectedText()){ + if (d->control->hasSelectedText()) flags |= QLineControl::DrawSelections; - } - QPoint offset = QPoint(0,0); - if(d->hAlign != AlignLeft){ - QFontMetrics fm = QFontMetrics(d->font); - //###Is this using bearing appropriately? - int minLB = qMax(0, -fm.minLeftBearing()); - int minRB = qMax(0, -fm.minRightBearing()); - int widthUsed = qRound(d->control->naturalTextWidth()) + 1 + minRB; - int hOffset = 0; + QFontMetrics fm = QFontMetrics(d->font); + int cix = qRound(d->control->cursorToX()); + QRect br(boundingRect().toRect()); + //###Is this using bearing appropriately? + int minLB = qMax(0, -fm.minLeftBearing()); + int minRB = qMax(0, -fm.minRightBearing()); + int widthUsed = qRound(d->control->naturalTextWidth()) + 1 + minRB; + if (d->autoScroll) { + if ((minLB + widthUsed) <= br.width()) { + // text fits in br; use hscroll for alignment + switch (d->hAlign & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) { + case Qt::AlignRight: + d->hscroll = widthUsed - br.width() + 1; + break; + case Qt::AlignHCenter: + d->hscroll = (widthUsed - br.width()) / 2; + break; + default: + // Left + d->hscroll = 0; + break; + } + d->hscroll -= minLB; + } else if (cix - d->hscroll >= br.width()) { + // text doesn't fit, cursor is to the right of br (scroll right) + d->hscroll = cix - br.width() + 1; + } else if (cix - d->hscroll < 0 && d->hscroll < widthUsed) { + // text doesn't fit, cursor is to the left of br (scroll left) + d->hscroll = cix; + } else if (widthUsed - d->hscroll < br.width()) { + // text doesn't fit, text document is to the left of br; align + // right + d->hscroll = widthUsed - br.width() + 1; + } + // the y offset is there to keep the baseline constant in case we have script changes in the text. + offset = br.topLeft() - QPoint(d->hscroll, d->control->ascent() - fm.ascent()); + } else { if(d->hAlign == AlignRight){ - hOffset = width() - widthUsed; + d->hscroll = width() - widthUsed; }else if(d->hAlign == AlignHCenter){ - hOffset = (width() - widthUsed) / 2; + d->hscroll = (width() - widthUsed) / 2; } - hOffset -= minLB; - offset = QPoint(hOffset, 0); + d->hscroll -= minLB; + offset = QPoint(d->hscroll, 0); } - QRect clipRect = r; - d->control->draw(p, offset, clipRect, flags); + + d->control->draw(p, offset, r, flags); p->restore(); } @@ -892,10 +954,11 @@ void QDeclarativeTextInput::q_textChanged() void QDeclarativeTextInput::updateRect(const QRect &r) { + Q_D(QDeclarativeTextInput); if(r == QRect()) clearCache(); else - dirtyCache(r); + dirtyCache(QRect(r.x() - d->hscroll, r.y(), r.width(), r.height())); update(); } diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 64aff7d..6e61580 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -86,6 +86,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTextInput : public QDeclarativePaintedIte Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged) Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode NOTIFY echoModeChanged) Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress NOTIFY focusOnPressChanged) + Q_PROPERTY(bool autoScroll READ autoScroll WRITE setAutoScroll NOTIFY autoScrollChanged) public: QDeclarativeTextInput(QDeclarativeItem* parent=0); @@ -163,6 +164,9 @@ public: bool focusOnPress() const; void setFocusOnPress(bool); + bool autoScroll() const; + void setAutoScroll(bool); + bool hasAcceptableInput() const; void drawContents(QPainter *p,const QRect &r); @@ -189,12 +193,14 @@ Q_SIGNALS: void inputMaskChanged(const QString &inputMask); void echoModeChanged(EchoMode echoMode); void focusOnPressChanged(bool focusOnPress); + void autoScrollChanged(bool autoScroll); protected: virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void keyPressEvent(QKeyEvent* ev); bool event(QEvent *e); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h index 9e44b15..26cf78c 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h @@ -72,7 +72,7 @@ public: color((QRgb)0), style(QDeclarativeText::Normal), styleColor((QRgb)0), hAlign(QDeclarativeTextInput::AlignLeft), hscroll(0), oldScroll(0), focused(false), focusOnPress(true), - cursorVisible(false) + cursorVisible(false), autoScroll(true) { } @@ -81,6 +81,14 @@ public: delete control; } + int xToPos(int x, QTextLine::CursorPosition betweenOrOn = QTextLine::CursorBetweenCharacters) const + { + Q_Q(const QDeclarativeTextInput); + QRect cr = q->boundingRect().toRect(); + x-= cr.x() - hscroll; + return control->xToPos(x, betweenOrOn); + } + void init(); void startCreatingCursor(); void focusChanged(bool hasFocus); @@ -107,6 +115,7 @@ public: bool focused; bool focusOnPress; bool cursorVisible; + bool autoScroll; }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 2b0b151..dd74c09 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -73,6 +73,7 @@ private slots: void sendRequestSoftwareInputPanelEvent(); void setHAlignClearCache(); + void focusOutClearSelection(); private: void simulateKey(QDeclarativeView *, int key); @@ -725,6 +726,29 @@ void tst_qdeclarativetextinput::setHAlignClearCache() QCOMPARE(input.nbPaint, 2); } +void tst_qdeclarativetextinput::focusOutClearSelection() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + QDeclarativeTextInput input; + QDeclarativeTextInput input2; + input.setText(QLatin1String("Hello world")); + input.setFocus(true); + scene.addItem(&input2); + scene.addItem(&input); + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + input.setSelectionStart(2); + input.setSelectionEnd(5); + //The selection should work + QTRY_COMPARE(input.selectedText(), QLatin1String("llo")); + input2.setFocus(true); + QApplication::processEvents(); + //The input lost the focus selection should be cleared + QTRY_COMPARE(input.selectedText(), QLatin1String("")); +} + QTEST_MAIN(tst_qdeclarativetextinput) #include "tst_qdeclarativetextinput.moc" -- cgit v0.12 From 5405740678314389e6e5477a3ed76819a60aeb37 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 9 Apr 2010 11:41:18 +1000 Subject: Ensure GridView content position is stable when moving items. Task-number: QTBUG-9697 --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 2 ++ .../declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index f832f12..9be025a 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -2166,6 +2166,8 @@ void QDeclarativeGridView::itemsMoved(int from, int to, int count) if (!movedItem) movedItem = d->createItem(item->index); it = d->visibleItems.insert(it, movedItem); + if (it == d->visibleItems.begin() && firstItem) + movedItem->setPosition(firstItem->colPos(), firstItem->rowPos()); ++it; --remaining; } else { diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index dd594774..7add9c6 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -578,6 +578,11 @@ void tst_QDeclarativeGridView::moved() QCOMPARE(number->text(), model.number(i)); } + // ensure content position is stable + gridview->setContentY(0); + model.moveItem(10, 0); + QVERIFY(gridview->contentY() == 0); + delete canvas; } -- cgit v0.12 From ca266d0037713c05d19dd6db9ba04f0c01811676 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 9 Apr 2010 09:42:21 +1000 Subject: Doc fixes --- doc/src/declarative/javascriptblocks.qdoc | 2 +- doc/src/declarative/network.qdoc | 1 - doc/src/declarative/qdeclarativedocument.qdoc | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc index c198295..3544bc9 100644 --- a/doc/src/declarative/javascriptblocks.qdoc +++ b/doc/src/declarative/javascriptblocks.qdoc @@ -163,7 +163,7 @@ component instance) "startup". While it is tempting to just include the startup script as \e {global code} in an external script file, this can have severe limitations as the QML environment may not have been fully established. For example, some objects might not have been created or some \l {Property Binding}s may not have been run. -\l {QML Script Restrictions} covers the exact limitations of global script code. +\l {QML JavaScript Restrictions} covers the exact limitations of global script code. The QML \l Component element provides an \e attached \c onCompleted property that can be used to trigger the execution of script code at startup after the diff --git a/doc/src/declarative/network.qdoc b/doc/src/declarative/network.qdoc index f1d4db1..0a26c68 100644 --- a/doc/src/declarative/network.qdoc +++ b/doc/src/declarative/network.qdoc @@ -64,7 +64,6 @@ Image { Network transparency is supported throughout QML, for example: \list -\o Scripts - the \c source property of \l Script is a URL \o Fonts - the \c source property of FontLoader is a URL \o WebViews - the \c url property of WebView (obviously!) \endlist diff --git a/doc/src/declarative/qdeclarativedocument.qdoc b/doc/src/declarative/qdeclarativedocument.qdoc index bf95a29..cf3aae2 100644 --- a/doc/src/declarative/qdeclarativedocument.qdoc +++ b/doc/src/declarative/qdeclarativedocument.qdoc @@ -83,7 +83,7 @@ modifies the document prior to presentation to the QML runtime. \c import statem do not "include" code in the document, but instead instruct the QML runtime on how to resolve type references found in the document. Any type reference present in a QML document - such as \c Rectangle and \c ListView - including those made within an -\l {JavaScript Block} or \l {Property Binding}s, are \e resolved based exclusively on the +\l {Inline JavaScript}{JavaScript block} or \l {Property Binding}s, are \e resolved based exclusively on the import statements. QML does not import any modules by default, so at least one \c import statement must be present or no elements will be available! -- cgit v0.12 From 8ba89fea4df4045490d7b557dabb753e7f7ae836 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 9 Apr 2010 10:47:00 +1000 Subject: More tutorial improvments --- doc/src/declarative/advtutorial.qdoc | 26 ++--- .../tutorials/samegame/samegame2/samegame.js | 33 +++--- .../tutorials/samegame/samegame2/samegame.qml | 2 +- .../tutorials/samegame/samegame3/Dialog.qml | 2 +- .../tutorials/samegame/samegame3/samegame.js | 54 +++++----- .../tutorials/samegame/samegame3/samegame.qml | 8 +- .../samegame/samegame4/content/Dialog.qml | 2 +- .../samegame/samegame4/content/samegame.js | 117 ++++++++++----------- .../tutorials/samegame/samegame4/samegame.qml | 8 +- 9 files changed, 121 insertions(+), 131 deletions(-) diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 598f47b..4d3bfa8 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -160,18 +160,20 @@ we cannot use \l Repeater to define the blocks. Instead, we will create the blocks in JavaScript. Here is the JavaScript code for generating the blocks, contained in a new -file, \c samegame.js: +file, \c samegame.js. The code is explained below. \snippet declarative/tutorials/samegame/samegame2/samegame.js 0 -The main function here is \c initBoard(). It creates an array to store all the game -blocks, then calls \c createBlock() to create enough blocks to fill the game canvas. +The \c startNewGame() function deletes the blocks created in the previous game and +calculates the number of rows and columns of blocks required to fill the game window for the new game. +Then, it creates an array to store all the game +blocks, and calls \c createBlock() to create enough blocks to fill the game window. -The \c createBlock() function creates a block using the \c Block.qml file +The \c createBlock() function creates a block from the \c Block.qml file and moves the new block to its position on the game canvas. This involves several steps: \list -\o \l {createComponent(url file)} is called to generate an element from \c Block.qml. +\o \l {createComponent(url file)}{createComponent()} is called to generate an element from \c Block.qml. If the component is ready, we can call \c createObject() to create an instance of the \c Block item. (If a component is loaded remotely - over HTTP for example - then we would have to wait for the component to finish loading before calling \c createObject()). @@ -193,13 +195,13 @@ the JavaScript file as a \l{Modules#QML Modules}{module}: \snippet declarative/tutorials/samegame/samegame2/samegame.qml 2 This allows us to refer to any functions within \c samegame.js using "SameGame" -as a prefix: for example, \c SameGame.initBoard() or \c SameGame.createBlock(). -This means we can now connect the New Game button's \c onClicked handler to the \c initBoard() +as a prefix: for example, \c SameGame.startNewGame() or \c SameGame.createBlock(). +This means we can now connect the New Game button's \c onClicked handler to the \c startNewGame() function, like this: \snippet declarative/tutorials/samegame/samegame2/samegame.qml 1 -So, when you click the New Game button, \c initBoard() is called and generates a field of blocks, like this: +So, when you click the New Game button, \c startNewGame() is called and generates a field of blocks, like this: \image declarative-adv-tutorial2.png @@ -247,7 +249,7 @@ To make it easier for the JavaScript code to interface with the QML elements, we The \c gameCanvas item is the exact size of the board, and has a \c score property and a \l MouseArea for input. The blocks are now created as its children, and its dimensions are used to determine the board size so that the application scales to the available screen size. -Since its size is bound to a multiple of \c tileSize, \c tileSize needs to be moved out of \c samegame.js and into \c samegame.qml as a QML property. +Since its size is bound to a multiple of \c blockSize, \c blockSize needs to be moved out of \c samegame.js and into \c samegame.qml as a QML property. Note that it can still be accessed from the script. The \l MouseArea simply calls \c{handleClick()} in \c samegame.js, which determines whether the player's click should cause any blocks to be removed, and updates \c gameCanvas.score with the current score if necessary. Here is the \c handleClick() function: @@ -258,7 +260,7 @@ Note that if \c score was a global variable in the \c{samegame.js} file you woul \section3 Updating the score -When the player clicks a block and triggers \c handleClick(), \c handleClick() also calls victoryCheck() to update the score and to check whether the player has completed the game. Here is the \c victoryCheck() code: +When the player clicks a block and triggers \c handleClick(), \c handleClick() also calls \c victoryCheck() to update the score and to check whether the player has completed the game. Here is the \c victoryCheck() code: \snippet declarative/tutorials/samegame/samegame3/samegame.js 2 @@ -287,7 +289,7 @@ Here is a screenshot of what has been accomplished so far: \image declarative-adv-tutorial3.png -Here is the QML code as it is now in \c samegame.qml: +This is what \c samegame.qml looks like now: \snippet declarative/tutorials/samegame/samegame3/samegame.qml 0 @@ -439,7 +441,7 @@ By following this tutorial you've seen how you can write a fully functional appl \o Build your application with \l {{QML Elements}}{QML elements} \o Add application logic \l{Integrating JavaScript}{with JavaScript code} \o Add animations with \l {Behavior}{Behaviors} and \l{QML States}{states} -\o Store persistent application data through online and offline methods +\o Store persistent application data using the \l{Offline Storage API} or \l XMLHttpRequest \endlist There is so much more to learn about QML that we haven't been able to cover in this tutorial. Check out all the diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.js b/examples/declarative/tutorials/samegame/samegame2/samegame.js index d7cbd8d..3f12561 100644 --- a/examples/declarative/tutorials/samegame/samegame2/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame2/samegame.js @@ -1,11 +1,9 @@ //![0] -//Note that X/Y referred to here are in game coordinates -var maxColumn = 10;//Nums are for tileSize 40 +var blockSize = 40; +var maxColumn = 10; var maxRow = 15; -var tileSize = 40; var maxIndex = maxColumn*maxRow; var board = new Array(maxIndex); -var tileSrc = "Block.qml"; var component; //Index function used instead of a 2D array @@ -13,17 +11,17 @@ function index(column,row) { return column + (row * maxColumn); } -function initBoard() +function startNewGame() { - //Delete old blocks + //Delete blocks from previous game for(var i = 0; i= maxColumn || column < 0 || row >= maxRow || row < 0) return; if(board[index(column, row)] == null) return; - //If it's a valid tile, remove it and all connected (does nothing if it's not connected) + //If it's a valid block, remove it and all connected (does nothing if it's not connected) floodFill(column,row, -1); if(fillFound <= 0) return; @@ -108,7 +105,7 @@ function floodFill(column,row,type) floodFill(column,row+1,type); floodFill(column,row-1,type); if(first==true && fillFound == 0) - return;//Can't remove single tiles + return;//Can't remove single blocks board[index(column,row)].opacity = 0; board[index(column,row)] = null; fillFound += 1; @@ -125,7 +122,7 @@ function shuffleDown() }else{ if(fallDist > 0){ var obj = board[index(column,row)]; - obj.y += fallDist * gameCanvas.tileSize; + obj.y += fallDist * gameCanvas.blockSize; board[index(column,row+fallDist)] = obj; board[index(column,row)] = null; } @@ -143,7 +140,7 @@ function shuffleDown() var obj = board[index(column,row)]; if(obj == null) continue; - obj.x -= fallDist * gameCanvas.tileSize; + obj.x -= fallDist * gameCanvas.blockSize; board[index(column-fallDist,row)] = obj; board[index(column,row)] = null; } @@ -155,20 +152,21 @@ function shuffleDown() //![2] function victoryCheck() { - //awards bonuses for no tiles left + //Award bonus points if no blocks left var deservesBonus = true; for(var column=maxColumn-1; column>=0; column--) if(board[index(column, maxRow - 1)] != null) deservesBonus = false; if(deservesBonus) gameCanvas.score += 500; - //Checks for game over + + //Check whether game has finished if(deservesBonus || !(floodMoveCheck(0,maxRow-1, -1))) dialog.show("Game Over. Your score is " + gameCanvas.score); } //![2] -//only floods up and right, to see if it can find adjacent same-typed tiles +//only floods up and right, to see if it can find adjacent same-typed blocks function floodMoveCheck(column, row, type) { if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.qml b/examples/declarative/tutorials/samegame/samegame3/samegame.qml index 9623932..cdf99d7 100644 --- a/examples/declarative/tutorials/samegame/samegame3/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame3/samegame.qml @@ -21,11 +21,11 @@ Rectangle { Item { id: gameCanvas property int score: 0 - property int tileSize: 40 + property int blockSize: 40 z: 20; anchors.centerIn: parent - width: parent.width - (parent.width % tileSize); - height: parent.height - (parent.height % tileSize); + width: parent.width - (parent.width % blockSize); + height: parent.height - (parent.height % blockSize); MouseArea { anchors.fill: parent; onClicked: SameGame.handleClick(mouse.x,mouse.y); @@ -45,7 +45,7 @@ Rectangle { anchors.bottom: screen.bottom Button { - text: "New Game"; onClicked: SameGame.initBoard(); + text: "New Game"; onClicked: SameGame.startNewGame(); anchors.left: parent.left; anchors.leftMargin: 3 anchors.verticalCenter: parent.verticalCenter } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml index 0716bb3..15f5b19 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml @@ -11,7 +11,7 @@ Rectangle { page.opacity = 1; } signal closed(); - color: "white"; border.width: 1; width: dialogText.width + 20; height: 60; + color: "white"; border.width: 1; width: dialogText.width + 20; height: dialogText.height + 20; opacity: 0 Behavior on opacity { NumberAnimation { duration: 1000 } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index a905f7d..0b1c6d6 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -1,38 +1,28 @@ /* This script file handles the game logic */ -//Note that X/Y referred to here are in game coordinates -var maxColumn = 10;//Nums are for gameCanvas.tileSize 40 +var maxColumn = 10; var maxRow = 15; var maxIndex = maxColumn*maxRow; var board = new Array(maxIndex); -var tileSrc = "content/BoomBlock.qml"; -//var scoresURL = "http://qtfx-nokia.trolltech.com.au/samegame/scores.php"; +var component; var scoresURL = ""; -var timer; -var component = createComponent(tileSrc); +var gameDuration; //Index function used instead of a 2D array function index(column,row) { return column + (row * maxColumn); } -function timeStr(msecs) { - var secs = Math.floor(msecs/1000); - var m = Math.floor(secs/60); - var ret = "" + m + "m " + (secs%60) + "s"; - return ret; -} - -function initBoard() +function startNewGame() { for(var i = 0; i= maxColumn || column < 0 || row >= maxRow || row < 0) return; if(board[index(column, row)] == null) return; - //If it's a valid tile, remove it and all connected (does nothing if it's not connected) + //If it's a valid block, remove it and all connected (does nothing if it's not connected) floodFill(column,row, -1); if(fillFound <= 0) return; @@ -95,7 +116,7 @@ function floodFill(column,row,type) floodFill(column,row+1,type); floodFill(column,row-1,type); if(first==true && fillFound == 0) - return;//Can't remove single tiles + return;//Can't remove single blocks board[index(column,row)].dying = true; board[index(column,row)] = null; fillFound += 1; @@ -112,7 +133,7 @@ function shuffleDown() }else{ if(fallDist > 0){ var obj = board[index(column,row)]; - obj.targetY += fallDist * gameCanvas.tileSize; + obj.targetY += fallDist * gameCanvas.blockSize; board[index(column,row+fallDist)] = obj; board[index(column,row)] = null; } @@ -130,7 +151,7 @@ function shuffleDown() obj = board[index(column,row)]; if(obj == null) continue; - obj.targetX -= fallDist * gameCanvas.tileSize; + obj.targetX -= fallDist * gameCanvas.blockSize; board[index(column-fallDist,row)] = obj; board[index(column,row)] = null; } @@ -141,21 +162,22 @@ function shuffleDown() function victoryCheck() { - //awards bonuses for no tiles left + //Award bonus points if no blocks left var deservesBonus = true; for(var column=maxColumn-1; column>=0; column--) if(board[index(column, maxRow - 1)] != null) deservesBonus = false; if(deservesBonus) gameCanvas.score += 500; - //Checks for game over + + //Check whether game has finished if(deservesBonus || !(floodMoveCheck(0,maxRow-1, -1))){ - timer = new Date() - timer; + gameDuration = new Date() - gameDuration; nameInputDialog.show("You won! Please enter your name: "); } } -//only floods up and right, to see if it can find adjacent same-typed tiles +//only floods up and right, to see if it can find adjacent same-typed blocks function floodMoveCheck(column, row, type) { if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) @@ -169,35 +191,6 @@ function floodMoveCheck(column, row, type) floodMoveCheck(column, row - 1, board[index(column,row)].type); } -function createBlock(column,row){ - // Note that we don't wait for the component to become ready. This will - // only work if the block QML is a local file. Otherwise the component will - // not be ready immediately. There is a statusChanged signal on the - // component you could use if you want to wait to load remote files. - if(component.isReady){ - var dynamicObject = component.createObject(); - if(dynamicObject == null){ - print("error creating block"); - print(component.errorsString()); - return false; - } - dynamicObject.type = Math.floor(Math.random() * 3); - dynamicObject.parent = gameCanvas; - dynamicObject.x = column*gameCanvas.tileSize; - dynamicObject.targetX = column*gameCanvas.tileSize; - dynamicObject.targetY = row*gameCanvas.tileSize; - dynamicObject.width = gameCanvas.tileSize; - dynamicObject.height = gameCanvas.tileSize; - dynamicObject.spawned = true; - board[index(column,row)] = dynamicObject; - }else{//isError or isLoading - print("error loading block component"); - print(component.errorsString()); - return false; - } - return true; -} - //![2] function saveHighScore(name) { if(scoresURL!="") @@ -205,7 +198,7 @@ function saveHighScore(name) { //OfflineStorage var db = openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores",100); var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)"; - var data = [name, gameCanvas.score, maxColumn+"x"+maxRow ,Math.floor(timer/1000)]; + var data = [name, gameCanvas.score, maxColumn+"x"+maxRow ,Math.floor(gameDuration/1000)]; db.transaction( function(tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); @@ -228,7 +221,7 @@ function saveHighScore(name) { function sendHighScore(name) { var postman = new XMLHttpRequest() var postData = "name="+name+"&score="+gameCanvas.score - +"&gridSize="+maxColumn+"x"+maxRow +"&time="+Math.floor(timer/1000); + +"&gridSize="+maxColumn+"x"+maxRow +"&time="+Math.floor(gameDuration/1000); postman.open("POST", scoresURL, true); postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); postman.onreadystatechange = function() { diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame.qml b/examples/declarative/tutorials/samegame/samegame4/samegame.qml index fe35e3b..5d5c81f 100644 --- a/examples/declarative/tutorials/samegame/samegame4/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame4/samegame.qml @@ -20,11 +20,11 @@ Rectangle { Item { id: gameCanvas property int score: 0 - property int tileSize: 40 + property int blockSize: 40 z: 20; anchors.centerIn: parent - width: parent.width - (parent.width % tileSize); - height: parent.height - (parent.height % tileSize); + width: parent.width - (parent.width % blockSize); + height: parent.height - (parent.height % blockSize); MouseArea { anchors.fill: parent; onClicked: SameGame.handleClick(mouse.x,mouse.y); @@ -63,7 +63,7 @@ Rectangle { anchors.bottom: screen.bottom Button { - text: "New Game"; onClicked: SameGame.initBoard(); + text: "New Game"; onClicked: SameGame.startNewGame(); anchors.left: parent.left; anchors.leftMargin: 3 anchors.verticalCenter: parent.verticalCenter } -- cgit v0.12 From 60af93993f3465781d894b01d48d31bebfb29708 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 9 Apr 2010 12:00:56 +1000 Subject: Straighten board lines --- .../declarative/tic-tac-toe/content/pics/board.png | Bin 11208 -> 1423 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/declarative/tic-tac-toe/content/pics/board.png b/examples/declarative/tic-tac-toe/content/pics/board.png index e7a7324..29118a9 100644 Binary files a/examples/declarative/tic-tac-toe/content/pics/board.png and b/examples/declarative/tic-tac-toe/content/pics/board.png differ -- cgit v0.12 From 25f17fb8e566fca0838545941d3e0281698ec355 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Fri, 9 Apr 2010 05:19:23 +0200 Subject: Some cleanup in widgets module. Deletion of GraphicsObjectContainer. This commit deletes the uneeded classes/declarations since we have now an inline support for QGraphicsObject based classes. QGraphicsLayout bindings works the same way because the layout property has been added to QGraphicsWidget. The only feature that is missing for now (because of the deletion of GraphicsObjectContainer) is the anchoring support. We will probably take a look on how to support this feature properly with no wrapper. Task-number:QTBUG-9456 Reviewed-by:Michael Brasser --- examples/declarative/layouts/layouts.qml | 35 ++- src/declarative/graphicsitems/graphicsitems.pri | 2 - .../qdeclarativegraphicsobjectcontainer.cpp | 269 --------------------- .../qdeclarativegraphicsobjectcontainer_p.h | 89 ------- .../graphicsitems/qdeclarativeitemsmodule.cpp | 2 - src/imports/widgets/graphicslayouts_p.h | 3 +- src/imports/widgets/graphicswidgets.cpp | 40 --- src/imports/widgets/graphicswidgets_p.h | 68 ------ src/imports/widgets/widgets.cpp | 70 +----- src/imports/widgets/widgets.pro | 1 - 10 files changed, 18 insertions(+), 561 deletions(-) delete mode 100644 src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp delete mode 100644 src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h delete mode 100644 src/imports/widgets/graphicswidgets.cpp delete mode 100644 src/imports/widgets/graphicswidgets_p.h diff --git a/examples/declarative/layouts/layouts.qml b/examples/declarative/layouts/layouts.qml index 231605e..1d34afd 100644 --- a/examples/declarative/layouts/layouts.qml +++ b/examples/declarative/layouts/layouts.qml @@ -4,27 +4,22 @@ Item { id: resizable width:400 height:400 + QGraphicsWidget { + size.width:parent.width + size.height:parent.height - GraphicsObjectContainer { - anchors.fill:parent - - QGraphicsWidget { - size.width:parent.width - size.height:parent.height - - layout: QGraphicsLinearLayout { - LayoutItem { - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "100x100" - Rectangle { color: "yellow"; anchors.fill: parent } - } - LayoutItem { - minimumSize: "100x100" - maximumSize: "400x400" - preferredSize: "200x200" - Rectangle { color: "green"; anchors.fill: parent } - } + layout: QGraphicsLinearLayout { + LayoutItem { + minimumSize: "100x100" + maximumSize: "300x300" + preferredSize: "100x100" + Rectangle { color: "yellow"; anchors.fill: parent } + } + LayoutItem { + minimumSize: "100x100" + maximumSize: "400x400" + preferredSize: "200x200" + Rectangle { color: "green"; anchors.fill: parent } } } } diff --git a/src/declarative/graphicsitems/graphicsitems.pri b/src/declarative/graphicsitems/graphicsitems.pri index af76a67..eab41e3 100644 --- a/src/declarative/graphicsitems/graphicsitems.pri +++ b/src/declarative/graphicsitems/graphicsitems.pri @@ -48,7 +48,6 @@ HEADERS += \ $$PWD/qdeclarativetext_p_p.h \ $$PWD/qdeclarativevisualitemmodel_p.h \ $$PWD/qdeclarativelistview_p.h \ - $$PWD/qdeclarativegraphicsobjectcontainer_p.h \ $$PWD/qdeclarativelayoutitem_p.h \ $$PWD/qdeclarativeitemchangelistener_p.h \ $$PWD/qdeclarativeeffects.cpp @@ -82,5 +81,4 @@ SOURCES += \ $$PWD/qdeclarativetextedit.cpp \ $$PWD/qdeclarativevisualitemmodel.cpp \ $$PWD/qdeclarativelistview.cpp \ - $$PWD/qdeclarativegraphicsobjectcontainer.cpp \ $$PWD/qdeclarativelayoutitem.cpp diff --git a/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp b/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp deleted file mode 100644 index f5beebd..0000000 --- a/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module 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 Technology Preview License Agreement accompanying -** this package. -** -** 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.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "private/qdeclarativegraphicsobjectcontainer_p.h" - -#include "private/qdeclarativeitem_p.h" - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QDeclarativeGraphicsObjectContainerPrivate : public QDeclarativeItemPrivate -{ - Q_DECLARE_PUBLIC(QDeclarativeGraphicsObjectContainer) - -public: - QDeclarativeGraphicsObjectContainerPrivate() : QDeclarativeItemPrivate(), graphicsObject(0), syncedResize(false) - { } - - void _q_updateSize(); - - void setFiltering(bool on) - { - Q_Q(QDeclarativeGraphicsObjectContainer); - if (graphicsObject && graphicsObject->isWidget()) { - if (!on) { - graphicsObject->removeEventFilter(q); - QObject::disconnect(q, SIGNAL(widthChanged()), q, SLOT(_q_updateSize())); - QObject::disconnect(q, SIGNAL(heightChanged()), q, SLOT(_q_updateSize())); - } else { - graphicsObject->installEventFilter(q); - QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(_q_updateSize())); - QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(_q_updateSize())); - } - } - } - - - QGraphicsObject *graphicsObject; - bool syncedResize; -}; - - -/*! - \qmlclass GraphicsObjectContainer QDeclarativeGraphicsObjectContainer - \since 4.7 - \brief The GraphicsObjectContainer element allows you to add QGraphicsObjects into Fluid UI elements. - - While any QObject based class can be exposed to QML, QDeclarativeItem - provides a lot of important functionality, including anchors and proper - management of child items. GraphicsObjectContainer helps provide these - functions to other QGraphicsObjects, so that they can be used unaltered in - a QML scene. QGraphicsObjects, which are not QDeclarativeItems, and which are - placed in a QML scene outside of a GraphicsObjectContainer, will not appear - on screen at all. - - A GraphicsObjectContainer can have one element inside it, and it must be a - QGraphicsObject or subclass which has been exposed to the QML engine. - The graphics object inside the GraphicsObjectContainer can then be used - like any other item in QML with the exception of not being reparentable - and not having the standard properties of QML items (such as anchors). - - As the contained object is positioned relative to the container, anchors - affecting the container item will affect the onscreen position of the - contained item. If synchronizedResizing is set to true, then anchors - affecting the container item's size will also affect the contained item's - size. - - Example: - \code - import Qt 4.7 - import MyApp 2.1 as Widgets - Rectangle{ - id: rect - property alias widgetPropertyThree: widget.myThirdProperty; - GraphicsObjectContainer{ - synchronizedResizing: true - anchors.margins: 10 - anchors.fill: parent - Widgets.MyWidget{ - myProperty: "A Value" - myOtherProperty: rect.color - } - } - } - \endcode -*/ - -/*! - \internal - \class QDeclarativeGraphicsObjectContainer - \brief The QDeclarativeGraphicsObjectContainer class allows you to add QGraphicsObjects into Fluid UI applications. -*/ - -QDeclarativeGraphicsObjectContainer::QDeclarativeGraphicsObjectContainer(QDeclarativeItem *parent) -: QDeclarativeItem(*new QDeclarativeGraphicsObjectContainerPrivate, parent) -{ -} - -QDeclarativeGraphicsObjectContainer::~QDeclarativeGraphicsObjectContainer() -{ -} - -QGraphicsObject *QDeclarativeGraphicsObjectContainer::graphicsObject() const -{ - Q_D(const QDeclarativeGraphicsObjectContainer); - return d->graphicsObject; -} - -/*! - \qmlproperty QGraphicsObject GraphicsObjectContainer::graphicsObject - The QGraphicsObject associated with this element. -*/ -void QDeclarativeGraphicsObjectContainer::setGraphicsObject(QGraphicsObject *object) -{ - Q_D(QDeclarativeGraphicsObjectContainer); - if (object == d->graphicsObject) - return; - - //### remove previously set item? - - d->setFiltering(false); - - d->graphicsObject = object; - - if (d->graphicsObject) { - d->graphicsObject->setParentItem(this); - - if (d->syncedResize && d->graphicsObject->isWidget()) { - QGraphicsWidget *gw = static_cast(d->graphicsObject); - QSizeF gwSize = gw->size(); //### should we use sizeHint? - QSizeF newSize = gwSize; - if (heightValid()) - newSize.setHeight(height()); - if (widthValid()) - newSize.setWidth(width()); - if (gwSize != newSize) - gw->resize(newSize); - - gwSize = gw->size(); - setImplicitWidth(gwSize.width()); - setImplicitHeight(gwSize.height()); - - d->setFiltering(true); - } - } -} - -QVariant QDeclarativeGraphicsObjectContainer::itemChange(GraphicsItemChange change, const QVariant &value) -{ - Q_D(QDeclarativeGraphicsObjectContainer); - if (change == ItemSceneHasChanged) { - QGraphicsObject *o = d->graphicsObject; - d->graphicsObject = 0; - setGraphicsObject(o); - } - return QDeclarativeItem::itemChange(change, value); -} - -bool QDeclarativeGraphicsObjectContainer::eventFilter(QObject *watched, QEvent *e) -{ - Q_D(QDeclarativeGraphicsObjectContainer); - if (watched == d->graphicsObject && e->type() == QEvent::GraphicsSceneResize) { - if (d->graphicsObject && d->graphicsObject->isWidget() && d->syncedResize) { - QSizeF newSize = static_cast(d->graphicsObject)->size(); - setImplicitWidth(newSize.width()); - setImplicitHeight(newSize.height()); - } - } - return QDeclarativeItem::eventFilter(watched, e); -} - -/*! - \qmlproperty bool GraphicsObjectContainer::synchronizedResizing - - This property determines whether or not the container and graphics object will synchronize their - sizes. - - \note This property only applies when wrapping a QGraphicsWidget. - - If synchronizedResizing is enabled, the container and widget will - synchronize their sizes as follows. - \list - \o If a size has been set on the container, the widget will be resized to the container. - Any changes in the container's size will be reflected in the widget. - - \o \e Otherwise, the container will initially be sized to the preferred size of the widget. - Any changes to the container's size will be reflected in the widget, and any changes to the - widget's size will be reflected in the container. - \endlist -*/ -bool QDeclarativeGraphicsObjectContainer::synchronizedResizing() const -{ - Q_D(const QDeclarativeGraphicsObjectContainer); - return d->syncedResize; -} - -void QDeclarativeGraphicsObjectContainer::setSynchronizedResizing(bool on) -{ - Q_D(QDeclarativeGraphicsObjectContainer); - if (on == d->syncedResize) - return; - - d->syncedResize = on; - d->setFiltering(on); -} - -void QDeclarativeGraphicsObjectContainerPrivate::_q_updateSize() -{ - if (!graphicsObject || !graphicsObject->isWidget() || !syncedResize) - return; - - QGraphicsWidget *gw = static_cast(graphicsObject); - const QSizeF newSize(width(), height()); - gw->resize(newSize); - - //### will respecting the widgets min/max ever get us in trouble? (all other items always - // size to exactly what you tell them) - /*QSizeF constrainedSize = newSize.expandedTo(gw->minimumSize()).boundedTo(gw->maximumSize()); - gw->resize(constrainedSize); - if (constrainedSize != newSize) { - setImplicitWidth(constrainedSize.width()); - setImplicitHeight(constrainedSize.height()); - }*/ -} - -#include - -QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h b/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h deleted file mode 100644 index 20c5bcf..0000000 --- a/src/declarative/graphicsitems/qdeclarativegraphicsobjectcontainer_p.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module 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 Technology Preview License Agreement accompanying -** this package. -** -** 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.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEGRAPHICSOBJECTCONTAINER_H -#define QDECLARATIVEGRAPHICSOBJECTCONTAINER_H - -#include "qdeclarativeitem.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QGraphicsObject; -class QDeclarativeGraphicsObjectContainerPrivate; - -class Q_DECLARATIVE_EXPORT QDeclarativeGraphicsObjectContainer : public QDeclarativeItem -{ - Q_OBJECT - - Q_CLASSINFO("DefaultProperty", "graphicsObject") - Q_PROPERTY(QGraphicsObject *graphicsObject READ graphicsObject WRITE setGraphicsObject) - Q_PROPERTY(bool synchronizedResizing READ synchronizedResizing WRITE setSynchronizedResizing) - -public: - QDeclarativeGraphicsObjectContainer(QDeclarativeItem *parent = 0); - ~QDeclarativeGraphicsObjectContainer(); - - QGraphicsObject *graphicsObject() const; - void setGraphicsObject(QGraphicsObject *); - - bool synchronizedResizing() const; - void setSynchronizedResizing(bool on); - -protected: - QVariant itemChange(GraphicsItemChange change, const QVariant &value); - bool eventFilter(QObject *watched, QEvent *e); - -private: - Q_PRIVATE_SLOT(d_func(), void _q_updateSize()) - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeGraphicsObjectContainer) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeGraphicsObjectContainer) - -QT_END_HEADER - -#endif // QDECLARATIVEGRAPHICSOBJECTCONTAINER_H diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 35a4d00..7664af1 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -57,7 +57,6 @@ #include "private/qdeclarativeflipable_p.h" #include "private/qdeclarativefocuspanel_p.h" #include "private/qdeclarativefocusscope_p.h" -#include "private/qdeclarativegraphicsobjectcontainer_p.h" #include "private/qdeclarativegridview_p.h" #include "private/qdeclarativeimage_p.h" #include "private/qdeclarativeitem_p.h" @@ -96,7 +95,6 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType("Qt",4,6,"FocusScope"); qmlRegisterType("Qt",4,6,"Gradient"); qmlRegisterType("Qt",4,6,"GradientStop"); - qmlRegisterType("Qt",4,6,"GraphicsObjectContainer"); qmlRegisterType("Qt",4,6,"Grid"); qmlRegisterType("Qt",4,6,"GridView"); qmlRegisterType("Qt",4,6,"Image"); diff --git a/src/imports/widgets/graphicslayouts_p.h b/src/imports/widgets/graphicslayouts_p.h index f9b9ae8..1c3dfe5 100644 --- a/src/imports/widgets/graphicslayouts_p.h +++ b/src/imports/widgets/graphicslayouts_p.h @@ -42,10 +42,9 @@ #ifndef GRAPHICSLAYOUTS_H #define GRAPHICSLAYOUTS_H -#include "graphicswidgets_p.h" - #include #include +#include QT_BEGIN_HEADER diff --git a/src/imports/widgets/graphicswidgets.cpp b/src/imports/widgets/graphicswidgets.cpp deleted file mode 100644 index 062e516..0000000 --- a/src/imports/widgets/graphicswidgets.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module 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 Technology Preview License Agreement accompanying -** this package. -** -** 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.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ diff --git a/src/imports/widgets/graphicswidgets_p.h b/src/imports/widgets/graphicswidgets_p.h deleted file mode 100644 index 2c2b707..0000000 --- a/src/imports/widgets/graphicswidgets_p.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module 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 Technology Preview License Agreement accompanying -** this package. -** -** 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.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef GRAPHICSWIDGETS_H -#define GRAPHICSWIDGETS_H - -#include - -#include -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QGraphicsView) -QML_DECLARE_TYPE_HASMETATYPE(QGraphicsScene) -QML_DECLARE_TYPE(QGraphicsWidget) -QML_DECLARE_TYPE(QGraphicsObject) -QML_DECLARE_INTERFACE_HASMETATYPE(QGraphicsItem) - -QT_END_HEADER - -#endif // GRAPHICSWIDGETS_H diff --git a/src/imports/widgets/widgets.cpp b/src/imports/widgets/widgets.cpp index bc18e8a..f26969a 100644 --- a/src/imports/widgets/widgets.cpp +++ b/src/imports/widgets/widgets.cpp @@ -41,75 +41,12 @@ #include #include +#include #include "graphicslayouts_p.h" -#include "graphicswidgets_p.h" QT_BEGIN_NAMESPACE -class QGraphicsViewDeclarativeUI : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QGraphicsScene *scene READ scene WRITE setScene) - Q_CLASSINFO("DefaultProperty", "scene") -public: - QGraphicsViewDeclarativeUI(QObject *other) : QObject(other) {} - - QGraphicsScene *scene() const { return static_cast(parent())->scene(); } - void setScene(QGraphicsScene *scene) - { - static_cast(parent())->setScene(scene); - } -}; - -class QGraphicsSceneDeclarativeUI : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QDeclarativeListProperty children READ children) - Q_CLASSINFO("DefaultProperty", "children") -public: - QGraphicsSceneDeclarativeUI(QObject *other) : QObject(other) {} - - QDeclarativeListProperty children() { return QDeclarativeListProperty(this->parent(), 0, children_append); } - -private: - static void children_append(QDeclarativeListProperty *prop, QObject *o) { - if (QGraphicsObject *go = qobject_cast(o)) - static_cast(prop->object)->addItem(go); - } -}; - -class QGraphicsWidgetDeclarativeUI : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QDeclarativeListProperty children READ children) - Q_PROPERTY(QGraphicsLayout *layout READ layout WRITE setLayout) - Q_CLASSINFO("DefaultProperty", "children") -public: - QGraphicsWidgetDeclarativeUI(QObject *other) : QObject(other) {} - - QDeclarativeListProperty children() { return QDeclarativeListProperty(this, 0, children_append); } - - QGraphicsLayout *layout() const { return static_cast(parent())->layout(); } - void setLayout(QGraphicsLayout *lo) - { - static_cast(parent())->setLayout(lo); - } - -private: - void setItemParent(QGraphicsItem *wid) - { - wid->setParentItem(static_cast(parent())); - } - - static void children_append(QDeclarativeListProperty *prop, QGraphicsItem *i) { - static_cast(prop->object)->setItemParent(i); - } -}; - class QWidgetsQmlModule : public QDeclarativeExtensionPlugin { Q_OBJECT @@ -123,10 +60,7 @@ public: qmlRegisterType(uri,4,6,"QGraphicsLinearLayoutStretchItem"); qmlRegisterType(uri,4,6,"QGraphicsLinearLayout"); qmlRegisterType(uri,4,6,"QGraphicsGridLayout"); - qmlRegisterExtendedType(uri,4,6,"QGraphicsView"); - qmlRegisterExtendedType(uri,4,6,"QGraphicsScene"); - qmlRegisterExtendedType(uri,4,6,"QGraphicsWidget"); - qmlRegisterInterface("QGraphicsItem"); + qmlRegisterType(uri,4,6,"QGraphicsWidget"); } }; diff --git a/src/imports/widgets/widgets.pro b/src/imports/widgets/widgets.pro index 408f878..f26e4b9 100644 --- a/src/imports/widgets/widgets.pro +++ b/src/imports/widgets/widgets.pro @@ -9,7 +9,6 @@ SOURCES += \ widgets.cpp HEADERS += \ - graphicswidgets_p.h \ graphicslayouts_p.h QTDIR_build:DESTDIR = $$QT_BUILD_TREE/imports/$$TARGETPATH -- cgit v0.12 From 45ca7aff2c04c302906a1af0d9d671bb9cb452f0 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Apr 2010 13:31:25 +1000 Subject: Use variant instead of var in QML In QML "var"s are not the same as JavaScript vars - they are QVariants instead. However, as they behave in a similar enough fashion to native JavaScript it can be confusing to developers when they are called "var". --- src/declarative/qml/qdeclarativebinding.cpp | 13 ------------- src/declarative/qml/qdeclarativeobjectscriptclass.cpp | 7 +------ src/declarative/qml/qdeclarativescriptparser.cpp | 11 +++++++++-- .../data/propertyAssignmentErrors.qml | 6 ------ .../qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 4 +--- 5 files changed, 11 insertions(+), 30 deletions(-) diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 6a99855..91eb915 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -170,19 +170,6 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) if (data->error.isValid()) { - } else if (!scriptValue.isVariant() && value.userType() == QMetaType::QVariantList && - data->property.propertyType() == qMetaTypeId()) { - - // This case catches QtScript's automatic conversion to QVariantList for arrays - QUrl url = QUrl(data->url); - int line = data->line; - if (url.isEmpty()) url = QUrl(QLatin1String("")); - - data->error.setUrl(url); - data->error.setLine(line); - data->error.setColumn(-1); - data->error.setDescription(QLatin1String("Unable to assign JavaScript array to QML variant property")); - } else if (isUndefined && data->property.isResettable()) { data->property.reset(); diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index ec84da9..4601aaa 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -361,12 +361,7 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj, else v = enginePriv->scriptValueToVariant(value, lastData->propType); - if (!value.isVariant() && v.userType() == QMetaType::QVariantList && - lastData->propType == qMetaTypeId()) { - - QString error = QLatin1String("Cannot assign JavaScript array to QML variant property"); - context->throwError(error); - } else if (!QDeclarativePropertyPrivate::write(obj, *lastData, v, evalContext)) { + if (!QDeclarativePropertyPrivate::write(obj, *lastData, v, evalContext)) { const char *valueType = 0; if (v.userType() == QVariant::Invalid) valueType = "null"; else valueType = QMetaType::typeName(v.userType()); diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index 507ff5b..92a10aa 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -535,7 +535,8 @@ bool ProcessAST::visit(AST::UiPublicMember *node) // { "time", Object::DynamicProperty::Time, "QTime" }, // { "date", Object::DynamicProperty::Date, "QDate" }, { "date", Object::DynamicProperty::DateTime, "QDateTime" }, - { "var", Object::DynamicProperty::Variant, "QVariant" } + { "var", Object::DynamicProperty::Variant, "QVariant" }, + { "variant", Object::DynamicProperty::Variant, "QVariant" } }; const int propTypeNameToTypesCount = sizeof(propTypeNameToTypes) / sizeof(propTypeNameToTypes[0]); @@ -563,7 +564,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node) _parser->_errors << error; return false; } - + signal.parameterTypes << qtType; signal.parameterNames << p->name->asString().toUtf8(); p = p->finish(); @@ -646,6 +647,11 @@ bool ProcessAST::visit(AST::UiPublicMember *node) property.location = location(node->firstSourceLocation(), node->lastSourceLocation()); + if (memberType == QByteArray("var")) + qWarning().nospace() << qPrintable(_parser->_scriptFile) << ":" << property.location.start.line << ":" + << property.location.start.column << ": var type has been replaced by variant. " + << "Support will be removed entirely shortly."; + if (node->expression) { // default value property.defaultValue = new Property; property.defaultValue->parent = _stateStack.top().object; @@ -909,6 +915,7 @@ bool QDeclarativeScriptParser::parse(const QByteArray &qmldata, const QUrl &url) clear(); const QString fileName = url.toString(); + _scriptFile = fileName; QTextStream stream(qmldata, QIODevice::ReadOnly); stream.setCodec("UTF-8"); diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml index 483179a..416dbce 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml @@ -14,12 +14,6 @@ QtObject { } try { - root.b = [ 10, root ] - } catch(e) { - console.log (e.fileName + ":" + e.lineNumber + ":" + e); - } - - try { root.a = "Hello"; } catch(e) { console.log (e.fileName + ":" + e.lineNumber + ":" + e); diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 72f14f9..c6bb276 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -1026,12 +1026,10 @@ void tst_qdeclarativeecmascript::propertyAssignmentErrors() QString url = component.url().toString(); QString warning1 = url + ":11:Error: Cannot assign [undefined] to int"; - QString warning2 = url + ":17:Error: Cannot assign JavaScript array to QML variant property"; - QString warning3 = url + ":23:Error: Cannot assign QString to int"; + QString warning2 = url + ":17:Error: Cannot assign QString to int"; QTest::ignoreMessage(QtDebugMsg, warning1.toLatin1().constData()); QTest::ignoreMessage(QtDebugMsg, warning2.toLatin1().constData()); - QTest::ignoreMessage(QtDebugMsg, warning3.toLatin1().constData()); QObject *object = component.create(); QVERIFY(object != 0); -- cgit v0.12 From e0dcdbd2984299665b9b784b201289219b9978d3 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 9 Apr 2010 13:37:00 +1000 Subject: Better reporting of extension plugin loading errors. --- src/declarative/qml/qdeclarativeengine.cpp | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 68ce953..8905713 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1479,13 +1479,17 @@ public: QSet qmlDirFilesForWhichPluginsHaveBeenLoaded; - QDeclarativeDirComponents importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine) { + QDeclarativeDirComponents importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine, QString *errorString) { QFile file(absoluteFilePath); QString filecontent; if (file.open(QFile::ReadOnly)) { filecontent = QString::fromUtf8(file.readAll()); if (qmlImportTrace()) qDebug() << "QDeclarativeEngine::add: loaded" << absoluteFilePath; + } else { + if (errorString) + *errorString = QDeclarativeEngine::tr("module \"%1\" definition \"%2\" not readable").arg(uri).arg(absoluteFilePath); + return QDeclarativeDirComponents(); } QDir dir = QFileInfo(file).dir(); @@ -1505,7 +1509,15 @@ public: plugin.name); if (!resolvedFilePath.isEmpty()) { - engine->importPlugin(resolvedFilePath, uri); + if (!engine->importPlugin(resolvedFilePath, uri)) { + if (errorString) + *errorString = QDeclarativeEngine::tr("plugin \"%1\" cannot be loaded for module \"%2\"").arg(resolvedFilePath).arg(uri); + return QDeclarativeDirComponents(); + } + } else { + if (errorString) + *errorString = QDeclarativeEngine::tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name); + return QDeclarativeDirComponents(); } } } @@ -1570,7 +1582,9 @@ public: url = QUrl::fromLocalFile(fi.absolutePath()).toString(); uri = resolvedUri(dir, engine); - qmldircomponents = importExtension(absoluteFilePath, uri, engine); + qmldircomponents = importExtension(absoluteFilePath, uri, engine, errorString); + if (qmldircomponents.isEmpty()) // error (or empty) + return false; break; } } @@ -1601,12 +1615,14 @@ public: return false; // local import dirs must exist } uri = resolvedUri(toLocalFileOrQrc(base.resolved(QUrl(uri))), engine); - qmldircomponents = importExtension(localFileOrQrc, - uri, - engine); - if (uri.endsWith(QLatin1Char('/'))) uri.chop(1); + if (QFile::exists(localFileOrQrc)) { + qmldircomponents = importExtension(localFileOrQrc, + uri,engine,errorString); + if (qmldircomponents.isEmpty()) // error (or empty) + return false; + } } else { if (prefix.isEmpty()) { // directory must at least exist for valid import -- cgit v0.12 From 51a8ca0c1fe9d5cce6b430632446a2d3c42989c8 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Apr 2010 13:38:04 +1000 Subject: Replace "property var " with "property variant " in QML code --- demos/declarative/flickr/common/Progress.qml | 2 +- demos/declarative/flickr/common/ScrollBar.qml | 2 +- demos/declarative/flickr/mobile/ImageDetails.qml | 4 ++-- demos/declarative/snake/snake.qml | 2 +- demos/declarative/twitter/TwitterCore/RssModel.qml | 2 +- demos/declarative/twitter/TwitterCore/UserModel.qml | 2 +- demos/declarative/twitter/twitter.qml | 2 +- examples/declarative/clocks/content/Clock.qml | 8 ++++---- examples/declarative/dynamic/qml/Button.qml | 2 +- examples/declarative/listview/content/MediaButton.qml | 2 +- .../plugins/com/nokia/TimeExample/Clock.qml | 6 +++--- examples/declarative/scrollbar/ScrollBar.qml | 2 +- examples/declarative/tvtennis/tvtennis.qml | 2 +- examples/declarative/velocity/Day.qml | 2 +- examples/declarative/webview/content/SpinSquare.qml | 4 ++-- .../data/NestedTypeTransientErrors.qml | 2 +- .../qdeclarativeecmascript/data/compiled.qml | 6 +++--- .../qdeclarativeecmascript/data/deletedObject.qml | 2 +- .../data/idShortcutInvalidates.1.qml | 2 +- .../data/idShortcutInvalidates.qml | 2 +- .../qdeclarativeecmascript/data/listToVariant.qml | 2 +- .../data/objectsCompareAsEqual.qml | 2 +- .../data/propertyAssignmentErrors.qml | 2 +- .../data/signalParameterTypes.qml | 4 ++-- .../qdeclarativeecmascript/data/transientErrors.qml | 4 ++-- .../qdeclarativegridview/data/gridview1.qml | 2 +- .../declarative/qdeclarativeinfo/data/NestedObject.qml | 2 +- .../qdeclarativeinfo/data/nestedQmlObject.qml | 4 ++-- .../declarative/qdeclarativeinfo/data/qmlObject.qml | 2 +- .../declarative/qdeclarativelanguage/data/Alias2.qml | 2 +- .../declarative/qdeclarativelanguage/data/Alias3.qml | 2 +- .../qdeclarativelanguage/data/HelperAlias.qml | 2 +- .../declarative/qdeclarativelanguage/data/alias.3.qml | 2 +- .../declarative/qdeclarativelanguage/data/alias.5.qml | 2 +- .../declarative/qdeclarativelanguage/data/alias.8.qml | 2 +- .../declarative/qdeclarativelanguage/data/alias.9.qml | 2 +- .../data/assignLiteralToVariant.qml | 18 +++++++++--------- .../data/assignObjectToVariant.qml | 2 +- .../data/componentCompositeType.qml | 2 +- .../qdeclarativelanguage/data/dynamicProperties.qml | 2 +- .../qdeclarativelanguage/data/idProperty.qml | 2 +- .../data/invalidGroupedProperty.1.qml | 2 +- .../qdeclarativelanguage/data/readOnly.3.qml | 2 +- .../declarative/qdeclarativelistmodel/data/model.qml | 4 ++-- .../qdeclarativelistreference/data/variantToList.qml | 2 +- tests/auto/declarative/qdeclarativeqt/data/darker.qml | 12 ++++++------ .../declarative/qdeclarativeqt/data/formatting.qml | 4 ++-- tests/auto/declarative/qdeclarativeqt/data/lighter.qml | 12 ++++++------ tests/auto/declarative/qdeclarativeqt/data/point.qml | 8 ++++---- tests/auto/declarative/qdeclarativeqt/data/rect.qml | 10 +++++----- tests/auto/declarative/qdeclarativeqt/data/size.qml | 10 +++++----- tests/auto/declarative/qdeclarativeqt/data/vector.qml | 8 ++++---- .../qdeclarativetextedit/data/navigation.qml | 2 +- .../declarative/qdeclarativetextedit/data/readOnly.qml | 2 +- .../qdeclarativetextinput/data/navigation.qml | 2 +- .../qdeclarativetextinput/data/readOnly.qml | 2 +- .../qdeclarativetextinput/data/validators.qml | 6 +++--- .../data/autoBindingRemoval.3.qml | 2 +- .../qdeclarativevaluetypes/data/bindingVariantCopy.qml | 2 +- .../qdeclarativevaluetypes/data/deletedObject.qml | 2 +- .../qdeclarativevaluetypes/data/font_read.qml | 2 +- .../qdeclarativevaluetypes/data/point_read.qml | 2 +- .../qdeclarativevaluetypes/data/pointf_read.qml | 2 +- .../qdeclarativevaluetypes/data/rect_read.qml | 2 +- .../qdeclarativevaluetypes/data/rectf_read.qml | 2 +- .../qdeclarativevaluetypes/data/scriptVariantCopy.qml | 2 +- .../qdeclarativevaluetypes/data/size_read.qml | 2 +- .../qdeclarativevaluetypes/data/sizef_read.qml | 2 +- .../qdeclarativevaluetypes/data/sizereadonly_read.qml | 2 +- .../qdeclarativevaluetypes/data/vector3d_read.qml | 2 +- .../qdeclarativeworkerscript/data/worker.qml | 2 +- .../qmlvisual/qdeclarativespringfollow/clock.qml | 6 +++--- .../declarative/qmlvisual/webview/embedding/egg.qml | 4 ++-- .../data/synthesized_properties.2.qml | 2 +- tools/qml/content/Browser.qml | 4 ++-- 75 files changed, 127 insertions(+), 127 deletions(-) diff --git a/demos/declarative/flickr/common/Progress.qml b/demos/declarative/flickr/common/Progress.qml index 33c6180..f4d25a4 100644 --- a/demos/declarative/flickr/common/Progress.qml +++ b/demos/declarative/flickr/common/Progress.qml @@ -1,7 +1,7 @@ import Qt 4.7 Item { - property var progress: 0 + property variant progress: 0 Rectangle { anchors.fill: parent; smooth: true diff --git a/demos/declarative/flickr/common/ScrollBar.qml b/demos/declarative/flickr/common/ScrollBar.qml index 4296eca..4022d23 100644 --- a/demos/declarative/flickr/common/ScrollBar.qml +++ b/demos/declarative/flickr/common/ScrollBar.qml @@ -3,7 +3,7 @@ import Qt 4.7 Item { id: container - property var flickableArea + property variant flickableArea Rectangle { radius: 5 diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml index d86fd2d..58b0b83 100644 --- a/demos/declarative/flickr/mobile/ImageDetails.qml +++ b/demos/declarative/flickr/mobile/ImageDetails.qml @@ -4,7 +4,7 @@ import "../common" as Common Flipable { id: container - property var frontContainer: containerFront + property variant frontContainer: containerFront property string photoTitle: "" property string photoTags: "" property int photoWidth @@ -14,7 +14,7 @@ Flipable { property string photoDate property string photoUrl property int rating: 2 - property var prevScale: 1.0 + property variant prevScale: 1.0 signal closed diff --git a/demos/declarative/snake/snake.qml b/demos/declarative/snake/snake.qml index 014f04e..47bced4 100644 --- a/demos/declarative/snake/snake.qml +++ b/demos/declarative/snake/snake.qml @@ -24,7 +24,7 @@ Rectangle { property int direction property int headDirection - property var head; + property variant head; Content.HighScoreModel { id: highScores diff --git a/demos/declarative/twitter/TwitterCore/RssModel.qml b/demos/declarative/twitter/TwitterCore/RssModel.qml index 5015e18..dca8499 100644 --- a/demos/declarative/twitter/TwitterCore/RssModel.qml +++ b/demos/declarative/twitter/TwitterCore/RssModel.qml @@ -1,7 +1,7 @@ import Qt 4.7 Item { id: wrapper - property var model: xmlModel + property variant model: xmlModel property string tags : "" property string authName : "" property string authPass : "" diff --git a/demos/declarative/twitter/TwitterCore/UserModel.qml b/demos/declarative/twitter/TwitterCore/UserModel.qml index 449e96c..8a8eb7b 100644 --- a/demos/declarative/twitter/TwitterCore/UserModel.qml +++ b/demos/declarative/twitter/TwitterCore/UserModel.qml @@ -4,7 +4,7 @@ import Qt 4.7 //Copied from RssModel Item { id: wrapper - property var model: xmlModel + property variant model: xmlModel property string user : "" property int status: xmlModel.status function reload() { xmlModel.reload(); } diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index c5e5002..84926cd 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -4,7 +4,7 @@ import "TwitterCore" 1.0 as Twitter Item { id: screen; width: 320; height: 480 property bool userView : false - property var tmpStr + property variant tmpStr function setMode(m){ screen.userView = m; if(m == false){ diff --git a/examples/declarative/clocks/content/Clock.qml b/examples/declarative/clocks/content/Clock.qml index c853174..036df46 100644 --- a/examples/declarative/clocks/content/Clock.qml +++ b/examples/declarative/clocks/content/Clock.qml @@ -5,10 +5,10 @@ Item { width: 200; height: 230 property alias city: cityLabel.text - property var hours - property var minutes - property var seconds - property var shift : 0 + property variant hours + property variant minutes + property variant seconds + property variant shift : 0 property bool night: false function timeChanged() { diff --git a/examples/declarative/dynamic/qml/Button.qml b/examples/declarative/dynamic/qml/Button.qml index 946da21..53588bb 100644 --- a/examples/declarative/dynamic/qml/Button.qml +++ b/examples/declarative/dynamic/qml/Button.qml @@ -3,7 +3,7 @@ import Qt 4.7 Rectangle { id: container - property var text + property variant text signal clicked SystemPalette { id: activePalette } diff --git a/examples/declarative/listview/content/MediaButton.qml b/examples/declarative/listview/content/MediaButton.qml index ec69000..a625b4c 100644 --- a/examples/declarative/listview/content/MediaButton.qml +++ b/examples/declarative/listview/content/MediaButton.qml @@ -1,7 +1,7 @@ import Qt 4.7 Item { - property var text + property variant text signal clicked id: container diff --git a/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml b/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml index ce1dd69..0048372 100644 --- a/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml +++ b/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml @@ -5,9 +5,9 @@ Rectangle { width: 200; height: 200; color: "gray" property alias city: cityLabel.text - property var hours - property var minutes - property var shift : 0 + property variant hours + property variant minutes + property variant shift : 0 Image { id: background; source: "clock.png" } diff --git a/examples/declarative/scrollbar/ScrollBar.qml b/examples/declarative/scrollbar/ScrollBar.qml index d2f52d5..2186b35 100644 --- a/examples/declarative/scrollbar/ScrollBar.qml +++ b/examples/declarative/scrollbar/ScrollBar.qml @@ -9,7 +9,7 @@ Item { // orientation can be either 'Vertical' or 'Horizontal' property real position property real pageSize - property var orientation : "Vertical" + property variant orientation : "Vertical" // A light, semi-transparent background Rectangle { diff --git a/examples/declarative/tvtennis/tvtennis.qml b/examples/declarative/tvtennis/tvtennis.qml index 240183f..9d107ad 100644 --- a/examples/declarative/tvtennis/tvtennis.qml +++ b/examples/declarative/tvtennis/tvtennis.qml @@ -10,7 +10,7 @@ Rectangle { Rectangle { // Add a property for the target y coordinate property int targetY : page.height - 10 - property var direction : "right" + property variant direction : "right" id: ball color: "Lime" diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index 724fcc8..a39ec94 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -2,7 +2,7 @@ import Qt 4.7 Component { Item { - property var stickies + property variant stickies id: page width: 840; height: 480 diff --git a/examples/declarative/webview/content/SpinSquare.qml b/examples/declarative/webview/content/SpinSquare.qml index ccd68df..dba48d4 100644 --- a/examples/declarative/webview/content/SpinSquare.qml +++ b/examples/declarative/webview/content/SpinSquare.qml @@ -1,8 +1,8 @@ import Qt 4.7 Item { - property var period : 250 - property var color : "black" + property variant period : 250 + property variant color : "black" id: root Item { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml index 7c32e56..28252df 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml @@ -3,7 +3,7 @@ import Qt 4.6 QtObject { property int b: obj.prop.a - property var prop; + property variant prop; prop: QtObject { property int a: 10 } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml b/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml index 2fec9da..1c88700 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml @@ -38,7 +38,7 @@ QtObject { property int d: 176 property string e: "Hello" property string f: "World" - property var g: 6.7 - property var h: "!" - property var i: true + property variant g: 6.7 + property variant h: "!" + property variant i: true } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml index 6bc3a17..29eba42 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml @@ -2,7 +2,7 @@ import Qt 4.6 import Qt.test 1.0 QtObject { - property var obj + property variant obj obj: MyQmlObject { id: myObject value: 92 diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml index 2db0fc6..93054f8 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml @@ -4,7 +4,7 @@ import Qt 4.6 MyQmlObject { objectProperty: if(1) otherObject - property var obj + property variant obj obj: QtObject { id: otherObject diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml index f66428d..5ae8b14 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml @@ -4,7 +4,7 @@ import Qt 4.6 MyQmlObject { objectProperty: otherObject - property var obj + property variant obj obj: QtObject { id: otherObject diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml b/tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml index 47f4e50..e6d31c7 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml @@ -1,5 +1,5 @@ import Qt 4.6 QtObject { - property var test: children + property variant test: children } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml b/tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml index 18e488a..edcd340 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml @@ -3,7 +3,7 @@ import Qt 4.6 Item { id: root - property var item: child + property variant item: child Item { id: child } property bool test1: child == child diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml index 416dbce..c66f071 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/propertyAssignmentErrors.qml @@ -4,7 +4,7 @@ QtObject { id: root property int a - property var b + property variant b Component.onCompleted: { try { diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/signalParameterTypes.qml b/tests/auto/declarative/qdeclarativeecmascript/data/signalParameterTypes.qml index 6fc8b02..ffbe317 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/signalParameterTypes.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/signalParameterTypes.qml @@ -6,9 +6,9 @@ MyQmlObject property int intProperty property real realProperty property color colorProperty - property var variantProperty + property variant variantProperty - signal mySignal(int a, real b, color c, var d) + signal mySignal(int a, real b, color c, variant d) onMySignal: { intProperty = a; realProperty = b; colorProperty = c; variantProperty = d; } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml index fa7e01c..bd23544 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml @@ -1,9 +1,9 @@ import Qt 4.6 QtObject { - property var obj: nested + property variant obj: nested - property var obj2 + property variant obj2 obj2: NestedTypeTransientErrors { id: nested } diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml index ba6b807..a061ae2 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml @@ -3,7 +3,7 @@ import Qt 4.6 Rectangle { id: root property int added: -1 - property var removed + property variant removed width: 240 height: 320 diff --git a/tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml b/tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml index cd5b426..548e498 100644 --- a/tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml +++ b/tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml @@ -1,7 +1,7 @@ import Qt 4.6 QtObject { - property var nested + property variant nested nested: QtObject {} } diff --git a/tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml b/tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml index a2ce78a..eac0b73 100644 --- a/tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml +++ b/tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml @@ -1,8 +1,8 @@ import Qt 4.6 QtObject { - property var nested + property variant nested nested: NestedObject { } - property var nested2: nested.nested + property variant nested2: nested.nested } diff --git a/tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml b/tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml index ce05f89..176636a 100644 --- a/tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml +++ b/tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml @@ -1,7 +1,7 @@ import Qt 4.6 QtObject { - property var nested + property variant nested nested: QtObject { } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml b/tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml index 6362b2d..f62c860 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml @@ -2,7 +2,7 @@ import Test 1.0 import Qt 4.6 QtObject { - property var other + property variant other other: MyTypeObject { id: obj } property alias enumAlias: obj.enumProperty; } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml b/tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml index d1e78f8..9050c3a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml @@ -3,7 +3,7 @@ import Qt 4.6 QtObject { property alias obj : otherObj - property var child + property variant child child: QtObject { id: otherObj property int myValue: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml b/tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml index dc3b382..df8c851 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml @@ -2,7 +2,7 @@ import Test 1.0 import Qt 4.6 QtObject { - property var child + property variant child child: QtObject { id: obj } property alias objAlias: obj; } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml index e059937..0b968c2 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml @@ -1,7 +1,7 @@ import Qt 4.6 QtObject { - property var other + property variant other other: Alias { id: myAliasObject } property alias value: myAliasObject.aliasValue diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml index 4316d0d..125c518 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml @@ -4,7 +4,7 @@ import Test 1.0 QtObject { property alias otherAlias: otherObject - property var other + property variant other other: MyQmlObject { id: otherObject value: 10 diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml index 2b9ad85..629dd2a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml @@ -1,7 +1,7 @@ import Qt 4.6 QtObject { - property var other + property variant other other: Alias3 { id: myAliasObject } property int value: myAliasObject.obj.myValue diff --git a/tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml index a2a41a1..7c072e1 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml @@ -1,7 +1,7 @@ import Qt 4.6 QtObject { - property var other + property variant other other: Alias4 { id: myAliasObject } property int value: myAliasObject.obj.myValue diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml index a1d33ef..91fd833 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml @@ -1,14 +1,14 @@ import Qt 4.6 QtObject { - property var test1: 1 - property var test2: 1.7 - property var test3: "Hello world!" - property var test4: "#FF008800" - property var test5: "10,10,10x10" - property var test6: "10,10" - property var test7: "10x10" - property var test8: "100,100,100" - property var test9: String("#FF008800") + property variant test1: 1 + property variant test2: 1.7 + property variant test3: "Hello world!" + property variant test4: "#FF008800" + property variant test5: "10,10,10x10" + property variant test6: "10,10" + property variant test7: "10x10" + property variant test8: "100,100,100" + property variant test9: String("#FF008800") } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml index 0ff9370..774762a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml @@ -2,6 +2,6 @@ import Test 1.0 import Qt 4.6 QtObject { - property var a; + property variant a; a: MyQmlObject {} } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml b/tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml index 0a7249a..e745e91 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml @@ -1,7 +1,7 @@ import Qt 4.6 QtObject { - property var test + property variant test test: ComponentComposite {} } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml index bedab8c..6411609 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml @@ -9,5 +9,5 @@ QtObject { property color colorProperty: "red" property url urlProperty: "main.qml" property date dateProperty: "1945-09-02" - property var varProperty: "Hello World!" + property variant varProperty: "Hello World!" } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/idProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/idProperty.qml index 90c1483..bf048ea 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/idProperty.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/idProperty.qml @@ -1,6 +1,6 @@ import Test 1.0 MyContainer { - property var object : myObjectId + property variant object : myObjectId MyTypeObject { id: "myObjectId" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml index 1167e39..9012aa6 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml @@ -1,6 +1,6 @@ import Qt 4.6 QtObject { - property var o; + property variant o; o.blah: 10 } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml index cd86a48..a4a976e 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml @@ -2,7 +2,7 @@ import Test 1.0 import Qt 4.6 QtObject { - property var child + property variant child child: HelperAlias { objAlias: QtObject {} } } diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/model.qml b/tests/auto/declarative/qdeclarativelistmodel/data/model.qml index ebd4ebf..4019948 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/data/model.qml +++ b/tests/auto/declarative/qdeclarativelistmodel/data/model.qml @@ -2,9 +2,9 @@ import Qt 4.6 Item { id: item - property var model + property variant model property bool done: false - property var result + property variant result function evalExpressionViaWorker(commands) { done = false diff --git a/tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml b/tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml index 0c2d0aa..d64be0f 100644 --- a/tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml +++ b/tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml @@ -4,7 +4,7 @@ QtObject { property list myList; myList: QtObject {} - property var value: myList + property variant value: myList property int test: value.length } diff --git a/tests/auto/declarative/qdeclarativeqt/data/darker.qml b/tests/auto/declarative/qdeclarativeqt/data/darker.qml index 2df067e..b265a0e 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/darker.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/darker.qml @@ -1,11 +1,11 @@ import Qt 4.6 QtObject { - property var test1: Qt.darker(Qt.rgba(1, 0.8, 0.3)) - property var test2: Qt.darker() - property var test3: Qt.darker(Qt.rgba(1, 0.8, 0.3), 10) - property var test4: Qt.darker("red"); - property var test5: Qt.darker("perfectred"); // Non-existant color - property var test6: Qt.darker(10); + property variant test1: Qt.darker(Qt.rgba(1, 0.8, 0.3)) + property variant test2: Qt.darker() + property variant test3: Qt.darker(Qt.rgba(1, 0.8, 0.3), 10) + property variant test4: Qt.darker("red"); + property variant test5: Qt.darker("perfectred"); // Non-existant color + property variant test6: Qt.darker(10); } diff --git a/tests/auto/declarative/qdeclarativeqt/data/formatting.qml b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml index e62749a..4cf0602 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/formatting.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml @@ -6,13 +6,13 @@ QtObject { property string test2: Qt.formatDate(date1, Qt.DefaultLocaleLongDate) property string test3: Qt.formatDate(date1, "ddd MMMM d yy") - property var time1: new Date(0,0,0,14,15,38,200) + property variant time1: new Date(0,0,0,14,15,38,200) property string test4: Qt.formatTime(time1) property string test5: Qt.formatTime(time1, Qt.DefaultLocaleLongDate) property string test6: Qt.formatTime(time1, "H:m:s a") property string test7: Qt.formatTime(time1, "hh:mm:ss.zzz") - property var dateTime1: new Date(1978,2,4,9,13,54) + property variant dateTime1: new Date(1978,2,4,9,13,54) property string test8: Qt.formatDateTime(dateTime1) property string test9: Qt.formatDateTime(dateTime1, Qt.DefaultLocaleLongDate) property string test10: Qt.formatDateTime(dateTime1, "M/d/yy H:m:s a") diff --git a/tests/auto/declarative/qdeclarativeqt/data/lighter.qml b/tests/auto/declarative/qdeclarativeqt/data/lighter.qml index 4e0c431..2d2b835 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/lighter.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/lighter.qml @@ -1,10 +1,10 @@ import Qt 4.6 QtObject { - property var test1: Qt.lighter(Qt.rgba(1, 0.8, 0.3)) - property var test2: Qt.lighter() - property var test3: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 10) - property var test4: Qt.lighter("red"); - property var test5: Qt.lighter("perfectred"); // Non-existant color - property var test6: Qt.lighter(10); + property variant test1: Qt.lighter(Qt.rgba(1, 0.8, 0.3)) + property variant test2: Qt.lighter() + property variant test3: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 10) + property variant test4: Qt.lighter("red"); + property variant test5: Qt.lighter("perfectred"); // Non-existant color + property variant test6: Qt.lighter(10); } diff --git a/tests/auto/declarative/qdeclarativeqt/data/point.qml b/tests/auto/declarative/qdeclarativeqt/data/point.qml index c383beb..1054ac9 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/point.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/point.qml @@ -1,9 +1,9 @@ import Qt 4.6 QtObject { - property var test1: Qt.point(19, 34); - property var test2: Qt.point(-3, 109.2); - property var test3: Qt.point(-3); - property var test4: Qt.point(-3, 109.2, 1); + property variant test1: Qt.point(19, 34); + property variant test2: Qt.point(-3, 109.2); + property variant test3: Qt.point(-3); + property variant test4: Qt.point(-3, 109.2, 1); } diff --git a/tests/auto/declarative/qdeclarativeqt/data/rect.qml b/tests/auto/declarative/qdeclarativeqt/data/rect.qml index 82b6428..e008656 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/rect.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/rect.qml @@ -1,9 +1,9 @@ import Qt 4.6 QtObject { - property var test1: Qt.rect(10, 13, 100, 109) - property var test2: Qt.rect(-10, 13, 100, 109.6) - property var test3: Qt.rect(10, 13); - property var test4: Qt.rect(10, 13, 100, 109, 10) - property var test5: Qt.rect(10, 13, 100, -109) + property variant test1: Qt.rect(10, 13, 100, 109) + property variant test2: Qt.rect(-10, 13, 100, 109.6) + property variant test3: Qt.rect(10, 13); + property variant test4: Qt.rect(10, 13, 100, 109, 10) + property variant test5: Qt.rect(10, 13, 100, -109) } diff --git a/tests/auto/declarative/qdeclarativeqt/data/size.qml b/tests/auto/declarative/qdeclarativeqt/data/size.qml index 05b0317..93577f2 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/size.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/size.qml @@ -1,11 +1,11 @@ import Qt 4.6 QtObject { - property var test1: Qt.size(19, 34); - property var test2: Qt.size(3, 109.2); - property var test3: Qt.size(-3, 10); - property var test4: Qt.size(3); - property var test5: Qt.size(3, 109.2, 1); + property variant test1: Qt.size(19, 34); + property variant test2: Qt.size(3, 109.2); + property variant test3: Qt.size(-3, 10); + property variant test4: Qt.size(3); + property variant test5: Qt.size(3, 109.2, 1); } diff --git a/tests/auto/declarative/qdeclarativeqt/data/vector.qml b/tests/auto/declarative/qdeclarativeqt/data/vector.qml index a471c7a..16716db 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/vector.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/vector.qml @@ -1,8 +1,8 @@ import Qt 4.6 QtObject { - property var test1: Qt.vector3d(1, 0, 0.9); - property var test2: Qt.vector3d(102, -10, -982.1); - property var test3: Qt.vector3d(102, -10); - property var test4: Qt.vector3d(102, -10, -982.1, 10); + property variant test1: Qt.vector3d(1, 0, 0.9); + property variant test2: Qt.vector3d(102, -10, -982.1); + property variant test3: Qt.vector3d(102, -10); + property variant test4: Qt.vector3d(102, -10, -982.1, 10); } diff --git a/tests/auto/declarative/qdeclarativetextedit/data/navigation.qml b/tests/auto/declarative/qdeclarativetextedit/data/navigation.qml index 8d7dbbc..1aed8d8 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/navigation.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/navigation.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rectangle { - property var myInput: input + property variant myInput: input width: 800; height: 600; color: "blue" diff --git a/tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml b/tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml index 103a627..69a6479 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rectangle { - property var myInput: input + property variant myInput: input width: 800; height: 600; color: "blue" diff --git a/tests/auto/declarative/qdeclarativetextinput/data/navigation.qml b/tests/auto/declarative/qdeclarativetextinput/data/navigation.qml index 493db5b..04f06da 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/navigation.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/navigation.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rectangle { - property var myInput: input + property variant myInput: input width: 800; height: 600; color: "blue" diff --git a/tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml b/tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml index c47371a..41e8b59 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rectangle { - property var myInput: input + property variant myInput: input width: 800; height: 600; color: "blue" diff --git a/tests/auto/declarative/qdeclarativetextinput/data/validators.qml b/tests/auto/declarative/qdeclarativetextinput/data/validators.qml index 531a232..4b1ba27 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/validators.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/validators.qml @@ -1,9 +1,9 @@ import Qt 4.7 Item { - property var intInput: intInput - property var dblInput: dblInput - property var strInput: strInput + property variant intInput: intInput + property variant dblInput: dblInput + property variant strInput: strInput width: 800; height: 600; diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.3.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.3.qml index c82b533..d431b4a 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.3.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.3.qml @@ -1,7 +1,7 @@ import Test 1.0 MyTypeObject { - property var value + property variant value rect: value diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingVariantCopy.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingVariantCopy.qml index 691a56c..3a48c8b 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingVariantCopy.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingVariantCopy.qml @@ -1,7 +1,7 @@ import Test 1.0 MyTypeObject { - property var object + property variant object object: MyTypeObject { rect.x: 19 rect.y: 33 diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml index 785c250..7c22775 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml @@ -3,7 +3,7 @@ import Qt 4.6 import "deletedObject.js" as JS MyTypeObject { - property var object + property variant object object: MyTypeObject {} Component.onCompleted: JS.startup() diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/font_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_read.qml index e1d1ce0..d73bb13 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/font_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/font_read.qml @@ -13,6 +13,6 @@ MyTypeObject { property int f_capitalization: font.capitalization property real f_letterSpacing: font.letterSpacing property real f_wordSpacing: font.wordSpacing; - property var copy: font + property variant copy: font } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/point_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/point_read.qml index 3e67de6..4bb6c53 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/point_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/point_read.qml @@ -3,5 +3,5 @@ import Test 1.0 MyTypeObject { property int p_x: point.x property int p_y: point.y - property var copy: point + property variant copy: point } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_read.qml index d845a5b..0eab6da 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_read.qml @@ -3,6 +3,6 @@ import Test 1.0 MyTypeObject { property real p_x: pointf.x property real p_y: pointf.y - property var copy: pointf + property variant copy: pointf } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/rect_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rect_read.qml index 5364431..c3b37a7 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/rect_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/rect_read.qml @@ -5,6 +5,6 @@ MyTypeObject { property int r_y: rect.y property int r_width: rect.width property int r_height: rect.height - property var copy: rect + property variant copy: rect } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_read.qml index aeb9f41..6ff3ce3 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_read.qml @@ -5,6 +5,6 @@ MyTypeObject { property real r_y: rectf.y property real r_width: rectf.width property real r_height: rectf.height - property var copy: rectf + property variant copy: rectf } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/scriptVariantCopy.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/scriptVariantCopy.qml index 29157e8..42fccfa 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/scriptVariantCopy.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/scriptVariantCopy.qml @@ -1,7 +1,7 @@ import Test 1.0 MyTypeObject { - property var object + property variant object object: MyTypeObject { rect.x: 19 rect.y: 33 diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/size_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/size_read.qml index 86dba03..a49fd9f 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/size_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/size_read.qml @@ -3,6 +3,6 @@ import Test 1.0 MyTypeObject { property int s_width: size.width property int s_height: size.height - property var copy: size + property variant copy: size } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_read.qml index c6f34e4..96cd425 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_read.qml @@ -3,7 +3,7 @@ import Test 1.0 MyTypeObject { property real s_width: sizef.width property real s_height: sizef.height - property var copy: sizef + property variant copy: sizef } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml index 7abe359..7f708a0 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml @@ -3,6 +3,6 @@ import Test 1.0 MyTypeObject { property int s_width: sizereadonly.width property int s_height: sizereadonly.height - property var copy: sizereadonly + property variant copy: sizereadonly } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_read.qml index abdf9f0..f1e876d 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_read.qml @@ -4,6 +4,6 @@ MyTypeObject { property real v_x: vector.x property real v_y: vector.y property real v_z: vector.z - property var copy: vector + property variant copy: vector } diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml index 1fce155..ca989f8 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml @@ -4,7 +4,7 @@ WorkerScript { id: worker source: "script.js" - property var response + property variant response signal done() diff --git a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml index fbab4b7..0ddcca4 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativespringfollow/clock.qml @@ -5,9 +5,9 @@ Rectangle { color: "gray" width: 200; height: 200 - property var hours: 10 - property var minutes: 28 - property var seconds: 0 + property variant hours: 10 + property variant minutes: 28 + property variant seconds: 0 Timer { interval: 1000; running: true; repeat: true; triggeredOnStart: true diff --git a/tests/auto/declarative/qmlvisual/webview/embedding/egg.qml b/tests/auto/declarative/qmlvisual/webview/embedding/egg.qml index fe1bb70..711a747 100644 --- a/tests/auto/declarative/qmlvisual/webview/embedding/egg.qml +++ b/tests/auto/declarative/qmlvisual/webview/embedding/egg.qml @@ -1,8 +1,8 @@ import Qt 4.6 Item { - property var period : 250 - property var color : "black" + property variant period : 250 + property variant color : "black" id: root Item { diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml index 27c5646..972f405 100644 --- a/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml @@ -9,7 +9,7 @@ QtObject { property url f property color g property date h - property var i + property variant i property variant j } diff --git a/tools/qml/content/Browser.qml b/tools/qml/content/Browser.qml index 391ded8..8882d5a 100644 --- a/tools/qml/content/Browser.qml +++ b/tools/qml/content/Browser.qml @@ -3,8 +3,8 @@ import Qt 4.6 Rectangle { id: root property bool keyPressed: false - property var folders: folders1 - property var view: view1 + property variant folders: folders1 + property variant view: view1 width: 320 height: 480 color: palette.window -- cgit v0.12 From da56d7c25ce344128d827cfa2ed26f9eea437e4d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 9 Apr 2010 13:42:22 +1000 Subject: Fix url resolution in PropertyChanges. Make sure bindings in PropertyChanges resolve urls correctly. Also refactor the code so that PropertyChanges will always use the standard url resolution support provided by QDeclarativeProperty. Task-number: QTBUG-9571 --- .../util/qdeclarativepropertychanges.cpp | 13 +++------ src/declarative/util/qdeclarativestate.cpp | 12 ++++++++ src/declarative/util/qdeclarativestate_p.h | 2 ++ .../data/Implementation/MyType.qml | 32 +++++++++++++++++++++ .../data/Implementation/images/qt-logo.png | Bin 0 -> 5149 bytes .../qdeclarativestates/data/urlResolution.qml | 12 ++++++++ .../qdeclarativestates/tst_qdeclarativestates.cpp | 23 +++++++++++++++ 7 files changed, 85 insertions(+), 9 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativestates/data/Implementation/MyType.qml create mode 100644 tests/auto/declarative/qdeclarativestates/data/Implementation/images/qt-logo.png create mode 100644 tests/auto/declarative/qdeclarativestates/data/urlResolution.qml diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index ecbd71e..9c3ee9f 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -377,7 +377,7 @@ QDeclarativeProperty QDeclarativePropertyChangesPrivate::property(const QByteArray &property) { Q_Q(QDeclarativePropertyChanges); - QDeclarativeProperty prop(object, QString::fromUtf8(property)); + QDeclarativeProperty prop(object, QString::fromUtf8(property), qmlContext(q)); if (!prop.isValid()) { qmlInfo(q) << QDeclarativePropertyChanges::tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(property)); return QDeclarativeProperty(); @@ -400,16 +400,11 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions() QByteArray property = d->properties.at(ii).first; - QDeclarativeAction a(d->object, QString::fromLatin1(property), - d->properties.at(ii).second); + QDeclarativeAction a(d->object, QString::fromUtf8(property), + qmlContext(this), d->properties.at(ii).second); if (a.property.isValid()) { a.restore = restoreEntryValues(); - - if (a.property.propertyType() == QVariant::Url && - (a.toValue.userType() == QVariant::String || a.toValue.userType() == QVariant::ByteArray) && !a.toValue.isNull()) - a.toValue.setValue(qmlContext(this)->resolvedUrl(QUrl(a.toValue.toString()))); - list << a; } } @@ -436,7 +431,7 @@ QDeclarativePropertyChanges::ActionList QDeclarativePropertyChanges::actions() a.property = prop; a.fromValue = a.property.read(); a.specifiedObject = d->object; - a.specifiedProperty = QString::fromLatin1(property); + a.specifiedProperty = QString::fromUtf8(property); if (d->isExplicit) { a.toValue = d->expressions.at(ii).second->value(); diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index e4c968e..78813fa 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -74,6 +74,18 @@ QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyN fromValue = property.read(); } +QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyName, + QDeclarativeContext *context, const QVariant &value) +: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), + property(target, propertyName, context), toValue(value), + fromBinding(0), toBinding(0), event(0), + specifiedObject(target), specifiedProperty(propertyName) +{ + if (property.isValid()) + fromValue = property.read(); +} + + QDeclarativeActionEvent::~QDeclarativeActionEvent() { } diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h index ee2b7e8..472897e 100644 --- a/src/declarative/util/qdeclarativestate_p.h +++ b/src/declarative/util/qdeclarativestate_p.h @@ -61,6 +61,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeAction public: QDeclarativeAction(); QDeclarativeAction(QObject *, const QString &, const QVariant &); + QDeclarativeAction(QObject *, const QString &, + QDeclarativeContext *, const QVariant &); bool restore:1; bool actionDone:1; diff --git a/tests/auto/declarative/qdeclarativestates/data/Implementation/MyType.qml b/tests/auto/declarative/qdeclarativestates/data/Implementation/MyType.qml new file mode 100644 index 0000000..1872de8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/Implementation/MyType.qml @@ -0,0 +1,32 @@ +import Qt 4.7 + +Item { + Column { + anchors.centerIn: parent + Image { id: image1; objectName: "image1" } + Image { id: image2; objectName: "image2" } + Image { id: image3; objectName: "image3" } + } + + states: State { + name: "SetImageState" + PropertyChanges { + target: image1 + source: "images/qt-logo.png" + } + PropertyChanges { + target: image2 + source: "images/" + "qt-logo.png" + } + PropertyChanges { + target: image3 + source: "images/" + (true ? "qt-logo.png" : "") + } + } + + MouseArea { + anchors.fill: parent + onClicked: parent.state = "SetImageState" + } + +} diff --git a/tests/auto/declarative/qdeclarativestates/data/Implementation/images/qt-logo.png b/tests/auto/declarative/qdeclarativestates/data/Implementation/images/qt-logo.png new file mode 100644 index 0000000..14ddf2a Binary files /dev/null and b/tests/auto/declarative/qdeclarativestates/data/Implementation/images/qt-logo.png differ diff --git a/tests/auto/declarative/qdeclarativestates/data/urlResolution.qml b/tests/auto/declarative/qdeclarativestates/data/urlResolution.qml new file mode 100644 index 0000000..8995b56 --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/urlResolution.qml @@ -0,0 +1,12 @@ +import Qt 4.7 +import "Implementation" + +Rectangle { + width: 100 + height: 200 + + MyType { + objectName: "MyType" + anchors.fill: parent + } +} diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index f0b6759..578bcb4 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -109,6 +110,7 @@ private slots: void reset(); void illegalObjectCreation(); void whenOrdering(); + void urlResolution(); }; void tst_qdeclarativestates::initTestCase() @@ -1016,6 +1018,27 @@ void tst_qdeclarativestates::whenOrdering() QCOMPARE(rect->state(), QLatin1String("")); } +void tst_qdeclarativestates::urlResolution() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/urlResolution.qml"); + QDeclarativeRectangle *rect = qobject_cast(c.create()); + QVERIFY(rect != 0); + + QDeclarativeItem *myType = rect->findChild("MyType"); + QDeclarativeImage *image1 = rect->findChild("image1"); + QDeclarativeImage *image2 = rect->findChild("image2"); + QDeclarativeImage *image3 = rect->findChild("image3"); + QVERIFY(myType != 0 && image1 != 0 && image2 != 0 && image3 != 0); + + myType->setState("SetImageState"); + QUrl resolved = QUrl::fromLocalFile(SRCDIR "/data/Implementation/images/qt-logo.png"); + QCOMPARE(image1->source(), resolved); + QCOMPARE(image2->source(), resolved); + QCOMPARE(image3->source(), resolved); +} + QTEST_MAIN(tst_qdeclarativestates) #include "tst_qdeclarativestates.moc" -- cgit v0.12 From fb9f0c5c996f2ba27c43657c49f100daf4729e05 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Fri, 9 Apr 2010 13:53:30 +1000 Subject: Text.wrap is deprecated --- demos/declarative/minehunt/minehunt.qml | 33 +++++++++++----------- .../twitter/TwitterCore/FatDelegate.qml | 2 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 4e384c0..98955e2 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -86,19 +86,20 @@ Item { field.clicky = flipable.parent.y var row = Math.floor(index / 9) var col = index - (Math.floor(index / 9) * 9) - if (mouse.button == undefined || mouse.button == Qt.RightButton) + if (mouse.button == undefined || mouse.button == Qt.RightButton) { flag(row, col) - else - flip(row, col) - } - onPressAndHold: { - field.clickx = flipable.parent.x - field.clicky = flipable.parent.y - var row = Math.floor(index / 9) - var col = index - (Math.floor(index / 9) * 9) - flag(row, col) - } + } else { + flip(row, col) } + } + onPressAndHold: { + field.clickx = flipable.parent.x + field.clicky = flipable.parent.y + var row = Math.floor(index / 9) + var col = index - (Math.floor(index / 9) * 9) + flag(row, col) + } + } } } @@ -136,13 +137,13 @@ Item { Image { anchors.bottom: field.bottom; anchors.bottomMargin: 15 anchors.right: field.right; anchors.rightMargin: 20 - source: isPlaying ? 'MinehuntCore/pics/face-smile.png' - : hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png' + source: isPlaying ? 'MinehuntCore/pics/face-smile.png' : + hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png' - MouseArea { anchors.fill: parent; onPressed: reset() } - } + MouseArea { anchors.fill: parent; onPressed: reset() } + } Text { - anchors.fill: parent; wrap: true + anchors.fill: parent; wrapMode: Text.WordWrap text: "Minehunt will not run properly if the C++ plugin is not compiled.\nPlease see README." color: "white"; font.bold: true; font.pixelSize: 14 visible: tiles == undefined diff --git a/demos/declarative/twitter/TwitterCore/FatDelegate.qml b/demos/declarative/twitter/TwitterCore/FatDelegate.qml index 3eabd9d..e999bb4 100644 --- a/demos/declarative/twitter/TwitterCore/FatDelegate.qml +++ b/demos/declarative/twitter/TwitterCore/FatDelegate.qml @@ -37,7 +37,7 @@ Component { + ''+userScreenName + " from " +source + "
" + addTags(statusText) + ""; textFormat: Qt.RichText - color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true + color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap anchors.left: whiteRect.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 onLinkActivated: handleLink(link) } -- cgit v0.12 From 430c50648c78e1e8e3b2747779069fe2a0f14ed9 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Fri, 9 Apr 2010 05:58:27 +0200 Subject: Fix test after deletion of GraphicsObjectContainer. Reviewed-by:TrustMe --- .../qdeclarativelayouts/data/layouts.qml | 43 ++++++++++------------ 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml b/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml index 1792500..5c2178f 100644 --- a/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml +++ b/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml @@ -5,29 +5,26 @@ Item { id: resizable width:300 height:300 - - GraphicsObjectContainer { - anchors.fill: parent - synchronizedResizing: true - - QGraphicsWidget { - - layout: QGraphicsLinearLayout { - spacing: 0 - LayoutItem { - objectName: "left" - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "100x100" - Rectangle { objectName: "yellowRect"; color: "yellow"; anchors.fill: parent } - } - LayoutItem { - objectName: "right" - minimumSize: "100x100" - maximumSize: "400x400" - preferredSize: "200x200" - Rectangle { objectName: "greenRect"; color: "green"; anchors.fill: parent } - } + QGraphicsWidget { + x : resizable.x + y : resizable.y + width : resizable.width + height : resizable.height + layout: QGraphicsLinearLayout { + spacing: 0 + LayoutItem { + objectName: "left" + minimumSize: "100x100" + maximumSize: "300x300" + preferredSize: "100x100" + Rectangle { objectName: "yellowRect"; color: "yellow"; anchors.fill: parent } + } + LayoutItem { + objectName: "right" + minimumSize: "100x100" + maximumSize: "400x400" + preferredSize: "200x200" + Rectangle { objectName: "greenRect"; color: "green"; anchors.fill: parent } } } } -- cgit v0.12 From efc80769f3274d31e06308717d06a70a4249cced Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Apr 2010 13:59:42 +1000 Subject: Replace "var" with "variant" in tests --- .../qdeclarativecontext/tst_qdeclarativecontext.cpp | 16 ++++++++-------- .../declarative/qdeclarativedom/tst_qdeclarativedom.cpp | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp index be20ba1..ae62363 100644 --- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp +++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp @@ -228,7 +228,7 @@ private: #define TEST_CONTEXT_PROPERTY(ctxt, name, value) \ { \ QDeclarativeComponent component(&engine); \ - component.setData("import Qt 4.6; QtObject { property var test: " #name " }", QUrl()); \ + component.setData("import Qt 4.6; QtObject { property variant test: " #name " }", QUrl()); \ \ QObject *obj = component.create(ctxt); \ \ @@ -278,7 +278,7 @@ void tst_qdeclarativecontext::setContextProperty() // Changes in context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: a }", QUrl()); + component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -290,7 +290,7 @@ void tst_qdeclarativecontext::setContextProperty() } { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: b }", QUrl()); + component.setData("import Qt 4.6; QtObject { property variant test: b }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -304,7 +304,7 @@ void tst_qdeclarativecontext::setContextProperty() } { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: e.a }", QUrl()); + component.setData("import Qt 4.6; QtObject { property variant test: e.a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -318,7 +318,7 @@ void tst_qdeclarativecontext::setContextProperty() // New context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: a }", QUrl()); + component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -332,7 +332,7 @@ void tst_qdeclarativecontext::setContextProperty() // Setting an object-variant context property { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property var obj: root; }", QUrl()); + component.setData("import Qt 4.6; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property variant obj: root; }", QUrl()); QDeclarativeContext ctxt(engine.rootContext()); ctxt.setContextProperty("ctxtProp", QVariant()); @@ -380,7 +380,7 @@ void tst_qdeclarativecontext::setContextObject() // Changes in context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: a }", QUrl()); + component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt); @@ -412,7 +412,7 @@ void tst_qdeclarativecontext::destruction() void tst_qdeclarativecontext::idAsContextProperty() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var a; a: QtObject { id: myObject } }", QUrl()); + component.setData("import Qt 4.6; QtObject { property variant a; a: QtObject { id: myObject } }", QUrl()); QObject *obj = component.create(); QVERIFY(obj); diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index 1cbe2ac..d391941 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -450,7 +450,7 @@ void tst_qdeclarativedom::loadDynamicProperty() " property url f\n" " property color g\n" " property date h\n" - " property var i\n" + " property variant i\n" " property QtObject j\n" "}"; @@ -483,8 +483,8 @@ void tst_qdeclarativedom::loadDynamicProperty() DP_TEST(5, f, QVariant::Url, 128, 14, "url"); DP_TEST(6, g, QVariant::Color, 147, 16, "color"); DP_TEST(7, h, QVariant::DateTime, 168, 15, "date"); - DP_TEST(8, i, qMetaTypeId(), 188, 14, "var"); - DP_TEST(9, j, -1, 207, 19, "QtObject"); + DP_TEST(8, i, qMetaTypeId(), 188, 18, "variant"); + DP_TEST(9, j, -1, 211, 19, "QtObject"); } { -- cgit v0.12 From 1f0d3ac7038e9169634d8e923bac6380124faa47 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 9 Apr 2010 15:17:07 +1000 Subject: unwarn --- src/declarative/qml/qdeclarativescriptparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index 92a10aa..ac49332 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -647,7 +647,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node) property.location = location(node->firstSourceLocation(), node->lastSourceLocation()); - if (memberType == QByteArray("var")) + if (memberType == QLatin1String("var")) qWarning().nospace() << qPrintable(_parser->_scriptFile) << ":" << property.location.start.line << ":" << property.location.start.column << ": var type has been replaced by variant. " << "Support will be removed entirely shortly."; -- cgit v0.12 From ce69639de67ae74caedb545c9c94aaae6512243f Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 9 Apr 2010 15:17:19 +1000 Subject: Remove use of obsolete "Script" element. --- .../twitter/TwitterCore/FatDelegate.qml | 28 +++++++++--------- .../twitter/TwitterCore/HomeTitleBar.qml | 34 ++++++++++------------ demos/declarative/twitter/TwitterCore/TitleBar.qml | 14 ++++----- demos/declarative/twitter/twitter.qml | 9 +++--- 4 files changed, 39 insertions(+), 46 deletions(-) diff --git a/demos/declarative/twitter/TwitterCore/FatDelegate.qml b/demos/declarative/twitter/TwitterCore/FatDelegate.qml index e999bb4..62ee11a 100644 --- a/demos/declarative/twitter/TwitterCore/FatDelegate.qml +++ b/demos/declarative/twitter/TwitterCore/FatDelegate.qml @@ -4,21 +4,19 @@ Component { id: listDelegate Item { id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 58){txt.height+8}else{58}//50+4+4 - Script { - function handleLink(link){ - if(link.slice(0,3) == 'app'){ - setUser(link.slice(7)); - screen.setMode(true); - }else if(link.slice(0,4) == 'http'){ - Qt.openUrlExternally(link); - } - } - function addTags(str){ - var ret = str.replace(/@[a-zA-Z0-9_]+/g, '$&');//click to jump to user? - var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '$&');//surrounds http links with html link tags - return ret2; + function handleLink(link){ + if(link.slice(0,3) == 'app'){ + screen.setUser(link.slice(7)); + screen.setMode(true); + }else if(link.slice(0,4) == 'http'){ + Qt.openUrlExternally(link); } } + function addTags(str){ + var ret = str.replace(/@[a-zA-Z0-9_]+/g, '$&');//click to jump to user? + var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '$&');//surrounds http links with html link tags + return ret2; + } Item { id: moveMe; height: parent.height Rectangle { @@ -35,11 +33,11 @@ Component { Text { id:txt; y:4; x: 56 text: '' + ''+userScreenName + " from " +source - + "
" + addTags(statusText) + ""; + + "
" + wrapper.addTags(statusText) + ""; textFormat: Qt.RichText color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap anchors.left: whiteRect.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6 - onLinkActivated: handleLink(link) + onLinkActivated: wrapper.handleLink(link) } } } diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml index 0835315..45f3157 100644 --- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml @@ -11,25 +11,23 @@ Item { id: container width: (parent.width * 2) - 55 ; height: parent.height - Script { - function accept() { - if(rssModel.authName == '' || rssModel.authPass == '') - return false;//Can't login like that + function accept() { + if(rssModel.authName == '' || rssModel.authPass == '') + return false;//Can't login like that - var postData = "status=" + editor.text; - var postman = new XMLHttpRequest(); - postman.open("POST", "http://twitter.com/statuses/update.xml", true, rssModel.authName, rssModel.authPass); - postman.onreadystatechange = function() { - if (postman.readyState == postman.DONE) { - titleBar.update(); - } + var postData = "status=" + editor.text; + var postman = new XMLHttpRequest(); + postman.open("POST", "http://twitter.com/statuses/update.xml", true, rssModel.authName, rssModel.authPass); + postman.onreadystatechange = function() { + if (postman.readyState == postman.DONE) { + titleBar.update(); } - postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - postman.send(postData); - - editor.text = "" - titleBar.state = "" } + postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + postman.send(postData); + + editor.text = "" + titleBar.state = "" } Rectangle { @@ -59,7 +57,7 @@ Item { Button { id: tagButton; x: titleBar.width - 90; width: 85; height: 32; text: "New Post..." anchors.verticalCenter: parent.verticalCenter; - onClicked: if (titleBar.state == "Posting") accept(); else titleBar.state = "Posting" + onClicked: if (titleBar.state == "Posting") container.accept(); else titleBar.state = "Posting" } Text { @@ -96,7 +94,7 @@ Item { Keys.forwardTo: [(returnKey), (editor)] Item { id: returnKey - Keys.onReturnPressed: accept() + Keys.onReturnPressed: container.accept() Keys.onEscapePressed: titleBar.state = "" } } diff --git a/demos/declarative/twitter/TwitterCore/TitleBar.qml b/demos/declarative/twitter/TwitterCore/TitleBar.qml index 1125519..87ceec5 100644 --- a/demos/declarative/twitter/TwitterCore/TitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/TitleBar.qml @@ -11,12 +11,10 @@ Item { id: container width: (parent.width * 2) - 55 ; height: parent.height - Script { - function accept() { - titleBar.state = "" - background.state = "" - rssModel.tags = editor.text - } + function accept() { + titleBar.state = "" + background.state = "" + rssModel.tags = editor.text } Text { @@ -33,7 +31,7 @@ Item { Button { id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..." - onClicked: if (titleBar.state == "Tags") accept(); else titleBar.state = "Tags" + onClicked: if (titleBar.state == "Tags") container.accept(); else titleBar.state = "Tags" anchors.verticalCenter: parent.verticalCenter } @@ -58,7 +56,7 @@ Item { Item { id: returnKey - Keys.onReturnPressed: accept() + Keys.onReturnPressed: container.accept() Keys.onEscapePressed: titleBar.state = "" } } diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index 84926cd..537c3fb 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -15,12 +15,11 @@ Item { toolBar.button2Label = "Return home"; } } + function setUser(str){hack.running = true; tmpStr = str} + function reallySetUser(){rssModel.tags = tmpStr;} + //Workaround for bug 260266 - Timer{ interval: 1; running: false; repeat: false; onTriggered: reallySetUser(); id:hack } - Script { - function setUser(str){hack.running = true; tmpStr = str} - function reallySetUser(){rssModel.tags = tmpStr;} - } + Timer{ interval: 1; running: false; repeat: false; onTriggered: screen.reallySetUser(); id:hack } //TODO: better way to return to the auth screen Keys.onEscapePressed: rssModel.authName='' -- cgit v0.12 From 95ad31adca64f639712fa378d25aa3e552b3dc72 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 9 Apr 2010 15:18:08 +1000 Subject: TextEdit::wrap changed to TextEdit::wrapMode enumeration --- .../twitter/TwitterCore/HomeTitleBar.qml | 2 +- demos/declarative/twitter/twitter.qml | 2 +- src/declarative/QmlChanges.txt | 1 + src/declarative/graphicsitems/qdeclarativetext.cpp | 2 +- .../graphicsitems/qdeclarativetextedit.cpp | 45 +++++++++++++++------- .../graphicsitems/qdeclarativetextedit_p.h | 14 ++++++- .../graphicsitems/qdeclarativetextedit_p_p.h | 21 +++++----- .../qdeclarativefocusscope/data/test5.qml | 4 +- .../tst_qdeclarativetextedit.cpp | 6 +-- .../qmlvisual/qdeclarativetextedit/wrap.qml | 4 +- 10 files changed, 66 insertions(+), 35 deletions(-) diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml index 0835315..55b7e62 100644 --- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml @@ -90,7 +90,7 @@ Item { width: parent.width - 12 height: parent.height - 8 font.pointSize: 10 - wrap: true + wrapMode: TextEdit.WordWrap color: "#151515"; selectionColor: "green" } Keys.forwardTo: [(returnKey), (editor)] diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml index 84926cd..583bf7f 100644 --- a/demos/declarative/twitter/twitter.qml +++ b/demos/declarative/twitter/twitter.qml @@ -35,7 +35,7 @@ Item { Text { width: 180 text: "Could not access twitter using this screen name and password pair."; - color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrap: true + color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap visible: rssModel.status==XmlListModel.Error; anchors.centerIn: parent } diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 079aacb..d5910e3 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -1,6 +1,7 @@ ============================================================================= The changes below are pre Qt 4.7.0 beta +TextEdit: wrap property is replaced by wrapMode enumeration. Text: wrap property is replaced by wrapMode enumeration. Removed Q-prefix from validators (IntValidator, DoubleValidator, and RegExpValidator) PathView: offset property now uses range 0-1.0 rather than 0-100 diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index c950e31..1f53b75 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -362,7 +362,7 @@ bool QDeclarativeText::wrap() const void QDeclarativeText::setWrap(bool w) { qmlInfo(this) << "\"wrap\" property is deprecated and will soon be removed. Use wrapMode"; - setWrapMode(WordWrap); + setWrapMode(w ? WordWrap : NoWrap); } diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 7374bc8..1db5ffe 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -44,6 +44,7 @@ #include "private/qdeclarativeevents_p_p.h" #include +#include #include #include @@ -360,29 +361,47 @@ void QDeclarativeTextEdit::setVAlign(QDeclarativeTextEdit::VAlignment alignment) emit verticalAlignmentChanged(d->vAlign); } -bool QDeclarativeTextEdit::wrap() const -{ - Q_D(const QDeclarativeTextEdit); - return d->wrap; -} - /*! - \qmlproperty bool TextEdit::wrap + \qmlproperty enumeration TextEdit::wrapMode Set this property to wrap the text to the TextEdit item's width. The text will only wrap if an explicit width has been set. - Wrapping is done on word boundaries (i.e. it is a "word-wrap"). Wrapping is off by default. + \list + \o NoWrap - no wrapping will be performed. + \o WordWrap - wrapping is done on word boundaries. + \endlist + + The default is NoWrap. */ -void QDeclarativeTextEdit::setWrap(bool w) +QDeclarativeTextEdit::WrapMode QDeclarativeTextEdit::wrapMode() const +{ + Q_D(const QDeclarativeTextEdit); + return d->wrapMode; +} + +void QDeclarativeTextEdit::setWrapMode(WrapMode mode) { Q_D(QDeclarativeTextEdit); - if (w == d->wrap) + if (mode == d->wrapMode) return; - d->wrap = w; + d->wrapMode = mode; d->updateDefaultTextOption(); updateSize(); - emit wrapChanged(d->wrap); + emit wrapModeChanged(); +} + +bool QDeclarativeTextEdit::wrap() const +{ + Q_D(const QDeclarativeTextEdit); + return d->wrapMode != QDeclarativeTextEdit::NoWrap; +} + +void QDeclarativeTextEdit::setWrap(bool w) +{ + + qmlInfo(this) << "\"wrap\" property is deprecated and will soon be removed. Use wrapMode"; + setWrapMode(w ? WordWrap : NoWrap); } /*! @@ -1021,7 +1040,7 @@ void QDeclarativeTextEditPrivate::updateDefaultTextOption() QTextOption::WrapMode oldWrapMode = opt.wrapMode(); - if (wrap) + if (wrapMode == QDeclarativeTextEdit::WordWrap) opt.setWrapMode(QTextOption::WordWrap); else opt.setWrapMode(QTextOption::NoWrap); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 0e91e73..3ac2b42 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -64,6 +64,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem Q_ENUMS(VAlignment) Q_ENUMS(HAlignment) Q_ENUMS(TextFormat) + Q_ENUMS(WrapMode) Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) @@ -72,7 +73,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) - Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapChanged) //### other wrap modes + Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapChanged) //### deprecated + Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged) @@ -107,6 +109,12 @@ public: AutoText = Qt::AutoText }; + enum WrapMode { NoWrap = QTextOption::NoWrap, + WordWrap = QTextOption::WordWrap +// WrapAnywhere = QTextOption::WrapAnywhere, +// WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere + }; + QString text() const; void setText(const QString &); @@ -133,6 +141,8 @@ public: bool wrap() const; void setWrap(bool w); + WrapMode wrapMode() const; + void setWrapMode(WrapMode w); bool isCursorVisible() const; void setCursorVisible(bool on); @@ -185,7 +195,7 @@ Q_SIGNALS: void fontChanged(const QFont &font); void horizontalAlignmentChanged(HAlignment alignment); void verticalAlignmentChanged(VAlignment alignment); - void wrapChanged(bool isWrapped); + void wrapModeChanged(); void textFormatChanged(TextFormat textFormat); void readOnlyChanged(bool isReadOnly); void cursorVisibleChanged(bool isCursorVisible); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h index 310db48..8d4b611 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h @@ -68,10 +68,11 @@ class QDeclarativeTextEditPrivate : public QDeclarativePaintedItemPrivate public: QDeclarativeTextEditPrivate() - : color("black"), imgDirty(true), hAlign(QDeclarativeTextEdit::AlignLeft), vAlign(QDeclarativeTextEdit::AlignTop), - dirty(false), wrap(false), richText(false), cursorVisible(false), focusOnPress(true), + : color("black"), hAlign(QDeclarativeTextEdit::AlignLeft), vAlign(QDeclarativeTextEdit::AlignTop), + imgDirty(true), dirty(false), richText(false), cursorVisible(false), focusOnPress(true), persistentSelection(true), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), - cursorComponent(0), cursor(0), format(QDeclarativeTextEdit::AutoText), document(0) + cursorComponent(0), cursor(0), format(QDeclarativeTextEdit::AutoText), document(0), + wrapMode(QDeclarativeTextEdit::NoWrap) { } @@ -89,17 +90,16 @@ public: QColor selectedTextColor; QString style; QColor styleColor; - bool imgDirty; QPixmap imgCache; QPixmap imgStyleCache; QDeclarativeTextEdit::HAlignment hAlign; QDeclarativeTextEdit::VAlignment vAlign; - bool dirty; - bool wrap; - bool richText; - bool cursorVisible; - bool focusOnPress; - bool persistentSelection; + bool imgDirty : 1; + bool dirty : 1; + bool richText : 1; + bool cursorVisible : 1; + bool focusOnPress : 1; + bool persistentSelection : 1; qreal textMargin; int lastSelectionStart; int lastSelectionEnd; @@ -108,6 +108,7 @@ public: QDeclarativeTextEdit::TextFormat format; QTextDocument *document; QTextControl *control; + QDeclarativeTextEdit::WrapMode wrapMode; }; QT_END_NAMESPACE diff --git a/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml b/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml index 0b75ec4..da452cf 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml +++ b/tests/auto/declarative/qdeclarativefocusscope/data/test5.qml @@ -38,7 +38,7 @@ Rectangle { Keys.onReturnPressed: console.log("Top Left"); KeyNavigation.right: item2 focus: true - wrap: true + wrapMode: TextEdit.WordWrap text: "Box 1" } @@ -79,6 +79,6 @@ Rectangle { Keys.onReturnPressed: console.log("Bottom Left"); KeyNavigation.up: myScope - wrap: true + wrapMode: TextEdit.WordWrap } } diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index b1935df..d578f68 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -235,7 +235,7 @@ void tst_qdeclarativetextedit::wrap() // for specified width and wrap set true { QDeclarativeComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\"; wrap: true; width: 300 }", QUrl()); + texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\"; wrapMode: TextEdit.WordWrap; width: 300 }", QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -244,7 +244,7 @@ void tst_qdeclarativetextedit::wrap() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.6\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); @@ -255,7 +255,7 @@ void tst_qdeclarativetextedit::wrap() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.6\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast(texteditComponent.create()); diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml index f9fe025..af69994 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml @@ -6,14 +6,14 @@ Item { TextEdit { width: 200 height: 200 - wrap: true + wrapMode: TextEdit.WordWrap focus: true } //With QTBUG-6273 only the bottom one would be wrapped TextEdit { width: 200 height: 200 - wrap: true + wrapMode: TextEdit.WordWrap text: "This is a test that text edit wraps correctly." y:200 } -- cgit v0.12 From 4a40a67827c8f259876e906a5a9afd2159ca9028 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 9 Apr 2010 15:58:35 +1000 Subject: Enable other wrapping modes. WrapAnywhere - Text can be wrapped at any point on a line, even if it occurs in the middle of a word. WrapAtWordBoundaryOrAnywhere - If possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word. --- .../declarative/twitter/TwitterCore/HomeTitleBar.qml | 2 +- src/declarative/graphicsitems/qdeclarativetext.cpp | 12 ++++++++---- src/declarative/graphicsitems/qdeclarativetext_p.h | 6 +++--- .../graphicsitems/qdeclarativetextedit.cpp | 9 ++++----- .../graphicsitems/qdeclarativetextedit_p.h | 6 +++--- .../qmlvisual/qdeclarativetext/font/plaintext.qml | 6 ++++++ .../qmlvisual/qdeclarativetext/font/richtext.qml | 6 ++++++ .../qmlvisual/qdeclarativetextedit/wrap.qml | 19 ++++++++++++++++--- 8 files changed, 47 insertions(+), 19 deletions(-) diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml index 992c7e2..c1ae3e5 100644 --- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml @@ -88,7 +88,7 @@ Item { width: parent.width - 12 height: parent.height - 8 font.pointSize: 10 - wrapMode: TextEdit.WordWrap + wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere color: "#151515"; selectionColor: "green" } Keys.forwardTo: [(returnKey), (editor)] diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 1f53b75..1730ee4 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -330,6 +330,9 @@ void QDeclarativeText::setVAlign(VAlignment align) \o WordWrap - wrapping is done on word boundaries. If the text cannot be word-wrapped to the specified width it will be partially drawn outside of the item's bounds. If this is undesirable then enable clipping on the item (Item::clip). + \o WrapAnywhere - Text can be wrapped at any point on a line, even if it occurs in the middle of a word. + \o WrapAtWordBoundaryOrAnywhere - If possible, wrapping occurs at a word boundary; otherwise it + will occur at the appropriate point on the line, even in the middle of a word. \endlist The default is NoWrap. @@ -554,10 +557,7 @@ void QDeclarativeTextPrivate::updateSize() singleline = false; // richtext can't elide or be optimized for single-line case doc->setDefaultFont(font); QTextOption option((Qt::Alignment)int(hAlign | vAlign)); - if (wrapMode == QDeclarativeText::WordWrap) - option.setWrapMode(QTextOption::WordWrap); - else - option.setWrapMode(QTextOption::NoWrap); + option.setWrapMode(QTextOption::WrapMode(wrapMode)); doc->setDefaultTextOption(option); if (wrapMode != QDeclarativeText::NoWrap && !q->heightValid() && q->widthValid()) doc->setTextWidth(q->width()); @@ -642,6 +642,10 @@ QSize QDeclarativeTextPrivate::setupTextLayout(QTextLayout *layout) if ((wrapMode != QDeclarativeText::NoWrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid()) lineWidth = q->width(); + QTextOption textOption = layout->textOption(); + textOption.setWrapMode(QTextOption::WrapMode(wrapMode)); + layout->setTextOption(textOption); + layout->beginLayout(); while (1) { diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h index 7a09b2f..871c833 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h @@ -97,9 +97,9 @@ public: ElideNone = Qt::ElideNone }; enum WrapMode { NoWrap = QTextOption::NoWrap, - WordWrap = QTextOption::WordWrap -// WrapAnywhere = QTextOption::WrapAnywhere, -// WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere + WordWrap = QTextOption::WordWrap, + WrapAnywhere = QTextOption::WrapAnywhere, + WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere }; QString text() const; diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 1db5ffe..6f1f6ac 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -370,6 +370,9 @@ void QDeclarativeTextEdit::setVAlign(QDeclarativeTextEdit::VAlignment alignment) \list \o NoWrap - no wrapping will be performed. \o WordWrap - wrapping is done on word boundaries. + \o WrapAnywhere - Text can be wrapped at any point on a line, even if it occurs in the middle of a word. + \o WrapAtWordBoundaryOrAnywhere - If possible, wrapping occurs at a word boundary; otherwise it + will occur at the appropriate point on the line, even in the middle of a word. \endlist The default is NoWrap. @@ -1039,11 +1042,7 @@ void QDeclarativeTextEditPrivate::updateDefaultTextOption() opt.setAlignment((Qt::Alignment)(int)(hAlign | vAlign)); QTextOption::WrapMode oldWrapMode = opt.wrapMode(); - - if (wrapMode == QDeclarativeTextEdit::WordWrap) - opt.setWrapMode(QTextOption::WordWrap); - else - opt.setWrapMode(QTextOption::NoWrap); + opt.setWrapMode(QTextOption::WrapMode(wrapMode)); if (oldWrapMode == opt.wrapMode() && oldAlignment == opt.alignment()) return; diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 3ac2b42..605b620 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -110,9 +110,9 @@ public: }; enum WrapMode { NoWrap = QTextOption::NoWrap, - WordWrap = QTextOption::WordWrap -// WrapAnywhere = QTextOption::WrapAnywhere, -// WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere + WordWrap = QTextOption::WordWrap, + WrapAnywhere = QTextOption::WrapAnywhere, + WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere }; QString text() const; diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml index c44088b..90b5411 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml @@ -81,5 +81,11 @@ Rectangle { Text { text: s.text; elide: Text.ElideRight; width: 200; wrapMode: Text.WordWrap } + Text { + text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.WrapAnywhere + } + Text { + text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.WrapAtWordBoundaryOrAnywhere + } } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml index b5d05da..0dba47c 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml @@ -81,5 +81,11 @@ Rectangle { Text { text: s.text; elide: Text.ElideRight; width: 200; wrapMode: Text.WordWrap } + Text { + text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.WrapAnywhere + } + Text { + text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.WrapAtWordBoundaryOrAnywhere + } } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml index af69994..b2a0754 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml @@ -5,17 +5,30 @@ Item { width: 200 TextEdit { width: 200 - height: 200 + height: 100 wrapMode: TextEdit.WordWrap focus: true } //With QTBUG-6273 only the bottom one would be wrapped TextEdit { width: 200 - height: 200 + height: 100 wrapMode: TextEdit.WordWrap text: "This is a test that text edit wraps correctly." + y:100 + } + TextEdit { + width: 150 + height: 100 + wrapMode: TextEdit.WrapAnywhere + text: "This is a test that text edit wraps correctly. thisisaverylongstringwithnospaces" y:200 } - + TextEdit { + width: 150 + height: 100 + wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere + text: "This is a test that text edit wraps correctly. thisisaverylongstringwithnospaces" + y:300 + } } -- cgit v0.12 From ec389436a74a7b619924bd47942e92203b1fb213 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 9 Apr 2010 13:05:13 +1000 Subject: Example code style improvements --- .../tutorials/samegame/samegame1/Button.qml | 3 +- .../tutorials/samegame/samegame2/Button.qml | 3 +- .../tutorials/samegame/samegame2/samegame.js | 42 ++--- .../tutorials/samegame/samegame3/Button.qml | 3 +- .../tutorials/samegame/samegame3/samegame.js | 153 ++++++++-------- .../samegame/samegame4/content/Button.qml | 3 +- .../samegame/samegame4/content/samegame.js | 194 ++++++++++----------- 7 files changed, 195 insertions(+), 206 deletions(-) diff --git a/examples/declarative/tutorials/samegame/samegame1/Button.qml b/examples/declarative/tutorials/samegame/samegame1/Button.qml index 6798c32..8ad7c0f 100644 --- a/examples/declarative/tutorials/samegame/samegame1/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame1/Button.qml @@ -14,7 +14,8 @@ Rectangle { gradient: Gradient { GradientStop { position: 0.0 - color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } } + color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } + } GradientStop { position: 1.0; color: activePalette.button } } diff --git a/examples/declarative/tutorials/samegame/samegame2/Button.qml b/examples/declarative/tutorials/samegame/samegame2/Button.qml index 04d1d1f..cf4c61b 100644 --- a/examples/declarative/tutorials/samegame/samegame2/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame2/Button.qml @@ -13,7 +13,8 @@ Rectangle { gradient: Gradient { GradientStop { position: 0.0 - color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } } + color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } + } GradientStop { position: 1.0; color: activePalette.button } } diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.js b/examples/declarative/tutorials/samegame/samegame2/samegame.js index 3f12561..9809c1d 100644 --- a/examples/declarative/tutorials/samegame/samegame2/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame2/samegame.js @@ -2,59 +2,58 @@ var blockSize = 40; var maxColumn = 10; var maxRow = 15; -var maxIndex = maxColumn*maxRow; +var maxIndex = maxColumn * maxRow; var board = new Array(maxIndex); var component; //Index function used instead of a 2D array -function index(column,row) { +function index(column, row) { return column + (row * maxColumn); } -function startNewGame() -{ +function startNewGame() { //Delete blocks from previous game - for(var i = 0; i= maxColumn || column < 0 || row >= maxRow || row < 0) +function handleClick(xPos, yPos) { + var column = Math.floor(xPos / gameCanvas.blockSize); + var row = Math.floor(yPos / gameCanvas.blockSize); + if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) return; - if(board[index(column, row)] == null) + if (board[index(column, row)] == null) return; //If it's a valid block, remove it and all connected (does nothing if it's not connected) - floodFill(column,row, -1); - if(fillFound <= 0) + floodFill(column, row, -1); + if (fillFound <= 0) return; gameCanvas.score += (fillFound - 1) * (fillFound - 1); shuffleDown(); @@ -82,67 +81,65 @@ function handleClick(xPos,yPos) } //![1] -function floodFill(column,row,type) -{ - if(board[index(column, row)] == null) +function floodFill(column, row, type) { + if (board[index(column, row)] == null) return; var first = false; - if(type == -1){ + if (type == -1) { first = true; - type = board[index(column,row)].type; - + type = board[index(column, row)].type; + //Flood fill initialization fillFound = 0; floodBoard = new Array(maxIndex); } - if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) + if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) return; - if(floodBoard[index(column, row)] == 1 || (!first && type != board[index(column,row)].type)) + if (floodBoard[index(column, row)] == 1 || (!first && type != board[index(column, row)].type)) return; floodBoard[index(column, row)] = 1; - floodFill(column+1,row,type); - floodFill(column-1,row,type); - floodFill(column,row+1,type); - floodFill(column,row-1,type); - if(first==true && fillFound == 0) - return;//Can't remove single blocks - board[index(column,row)].opacity = 0; - board[index(column,row)] = null; + floodFill(column + 1, row, type); + floodFill(column - 1, row, type); + floodFill(column, row + 1, type); + floodFill(column, row - 1, type); + if (first == true && fillFound == 0) + return; //Can't remove single blocks + board[index(column, row)].opacity = 0; + board[index(column, row)] = null; fillFound += 1; } -function shuffleDown() -{ +function shuffleDown() { //Fall down - for(var column=0; column=0; row--){ - if(board[index(column,row)] == null){ + for (var row = maxRow - 1; row >= 0; row--) { + if (board[index(column, row)] == null) { fallDist += 1; - }else{ - if(fallDist > 0){ - var obj = board[index(column,row)]; + } else { + if (fallDist > 0) { + var obj = board[index(column, row)]; obj.y += fallDist * gameCanvas.blockSize; - board[index(column,row+fallDist)] = obj; - board[index(column,row)] = null; + board[index(column, row + fallDist)] = obj; + board[index(column, row)] = null; } } } } //Fall to the left var fallDist = 0; - for(var column=0; column 0){ - for(var row=0; row 0) { + for (var row = 0; row < maxRow; row++) { + var obj = board[index(column, row)]; + if (obj == null) continue; obj.x -= fallDist * gameCanvas.blockSize; - board[index(column-fallDist,row)] = obj; - board[index(column,row)] = null; + board[index(column - fallDist, row)] = obj; + board[index(column, row)] = null; } } } @@ -150,32 +147,30 @@ function shuffleDown() } //![2] -function victoryCheck() -{ +function victoryCheck() { //Award bonus points if no blocks left var deservesBonus = true; - for(var column=maxColumn-1; column>=0; column--) - if(board[index(column, maxRow - 1)] != null) - deservesBonus = false; - if(deservesBonus) + for (var column = maxColumn - 1; column >= 0; column--) + if (board[index(column, maxRow - 1)] != null) + deservesBonus = false; + if (deservesBonus) gameCanvas.score += 500; //Check whether game has finished - if(deservesBonus || !(floodMoveCheck(0,maxRow-1, -1))) + if (deservesBonus || !(floodMoveCheck(0, maxRow - 1, -1))) dialog.show("Game Over. Your score is " + gameCanvas.score); } //![2] //only floods up and right, to see if it can find adjacent same-typed blocks -function floodMoveCheck(column, row, type) -{ - if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) +function floodMoveCheck(column, row, type) { + if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) return false; - if(board[index(column, row)] == null) + if (board[index(column, row)] == null) return false; var myType = board[index(column, row)].type; - if(type == myType) + if (type == myType) return true; - return floodMoveCheck(column + 1, row, myType) || - floodMoveCheck(column, row - 1, board[index(column,row)].type); + return floodMoveCheck(column + 1, row, myType) || floodMoveCheck(column, row - 1, board[index(column, row)].type); } + diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml index 04d1d1f..cf4c61b 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml @@ -13,7 +13,8 @@ Rectangle { gradient: Gradient { GradientStop { position: 0.0 - color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } } + color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } + } GradientStop { position: 1.0; color: activePalette.button } } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index 0b1c6d6..47985de 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -1,29 +1,28 @@ /* This script file handles the game logic */ var maxColumn = 10; var maxRow = 15; -var maxIndex = maxColumn*maxRow; +var maxIndex = maxColumn * maxRow; var board = new Array(maxIndex); var component; var scoresURL = ""; var gameDuration; //Index function used instead of a 2D array -function index(column,row) { +function index(column, row) { return column + (row * maxColumn); } -function startNewGame() -{ - for(var i = 0; i= maxColumn || column < 0 || row >= maxRow || row < 0) +var fillFound; +//Set after a floodFill call to the number of blocks found +var floodBoard; +//Set to 1 if the floodFill reaches off that node +function handleClick(xPos, yPos) { + var column = Math.floor(xPos / gameCanvas.blockSize); + var row = Math.floor(yPos / gameCanvas.blockSize); + if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) return; - if(board[index(column, row)] == null) + if (board[index(column, row)] == null) return; //If it's a valid block, remove it and all connected (does nothing if it's not connected) - floodFill(column,row, -1); - if(fillFound <= 0) + floodFill(column, row, -1); + if (fillFound <= 0) return; gameCanvas.score += (fillFound - 1) * (fillFound - 1); shuffleDown(); victoryCheck(); } -function floodFill(column,row,type) -{ - if(board[index(column, row)] == null) +function floodFill(column, row, type) { + if (board[index(column, row)] == null) return; var first = false; - if(type == -1){ + if (type == -1) { first = true; - type = board[index(column,row)].type; + type = board[index(column, row)].type; //Flood fill initialization fillFound = 0; floodBoard = new Array(maxIndex); } - if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) + if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) return; - if(floodBoard[index(column, row)] == 1 || (!first && type != board[index(column,row)].type)) + if (floodBoard[index(column, row)] == 1 || (!first && type != board[index(column, row)].type)) return; floodBoard[index(column, row)] = 1; - floodFill(column+1,row,type); - floodFill(column-1,row,type); - floodFill(column,row+1,type); - floodFill(column,row-1,type); - if(first==true && fillFound == 0) - return;//Can't remove single blocks - board[index(column,row)].dying = true; - board[index(column,row)] = null; + floodFill(column + 1, row, type); + floodFill(column - 1, row, type); + floodFill(column, row + 1, type); + floodFill(column, row - 1, type); + if (first == true && fillFound == 0) + return; //Can't remove single blocks + board[index(column, row)].dying = true; + board[index(column, row)] = null; fillFound += 1; } -function shuffleDown() -{ +function shuffleDown() { //Fall down - for(var column=0; column=0; row--){ - if(board[index(column,row)] == null){ + for (var row = maxRow - 1; row >= 0; row--) { + if (board[index(column, row)] == null) { fallDist += 1; - }else{ - if(fallDist > 0){ - var obj = board[index(column,row)]; + } else { + if (fallDist > 0) { + var obj = board[index(column, row)]; obj.targetY += fallDist * gameCanvas.blockSize; - board[index(column,row+fallDist)] = obj; - board[index(column,row)] = null; + board[index(column, row + fallDist)] = obj; + board[index(column, row)] = null; } } } } //Fall to the left fallDist = 0; - for(column=0; column 0){ - for(row=0; row 0) { + for (row = 0; row < maxRow; row++) { + obj = board[index(column, row)]; + if (obj == null) continue; obj.targetX -= fallDist * gameCanvas.blockSize; - board[index(column-fallDist,row)] = obj; - board[index(column,row)] = null; + board[index(column - fallDist, row)] = obj; + board[index(column, row)] = null; } } } } } -function victoryCheck() -{ +function victoryCheck() { //Award bonus points if no blocks left var deservesBonus = true; - for(var column=maxColumn-1; column>=0; column--) - if(board[index(column, maxRow - 1)] != null) - deservesBonus = false; - if(deservesBonus) + for (var column = maxColumn - 1; column >= 0; column--) + if (board[index(column, maxRow - 1)] != null) + deservesBonus = false; + if (deservesBonus) gameCanvas.score += 500; //Check whether game has finished - if(deservesBonus || !(floodMoveCheck(0,maxRow-1, -1))){ + if (deservesBonus || !(floodMoveCheck(0, maxRow - 1, -1))) { gameDuration = new Date() - gameDuration; nameInputDialog.show("You won! Please enter your name: "); } } //only floods up and right, to see if it can find adjacent same-typed blocks -function floodMoveCheck(column, row, type) -{ - if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) +function floodMoveCheck(column, row, type) { + if (column >= maxColumn || column < 0 || row >= maxRow || row < 0) return false; - if(board[index(column, row)] == null) + if (board[index(column, row)] == null) return false; var myType = board[index(column, row)].type; - if(type == myType) + if (type == myType) return true; - return floodMoveCheck(column + 1, row, myType) || - floodMoveCheck(column, row - 1, board[index(column,row)].type); + return floodMoveCheck(column + 1, row, myType) || floodMoveCheck(column, row - 1, board[index(column, row)].type); } //![2] function saveHighScore(name) { - if(scoresURL!="") + if (scoresURL != "") sendHighScore(name); - //OfflineStorage - var db = openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores",100); + + var db = openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores", 100); var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)"; - var data = [name, gameCanvas.score, maxColumn+"x"+maxRow ,Math.floor(gameDuration/1000)]; - db.transaction( - function(tx) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); - tx.executeSql(dataStr, data); - - var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "12x17" ORDER BY score desc LIMIT 10'); - var r = "\nHIGH SCORES for a standard sized grid\n\n" - for(var i = 0; i < rs.rows.length; i++){ - r += (i+1)+". " + rs.rows.item(i).name +' got ' - + rs.rows.item(i).score + ' points in ' - + rs.rows.item(i).time + ' seconds.\n'; - } - dialog.show(r); + var data = [name, gameCanvas.score, maxColumn + "x" + maxRow, Math.floor(gameDuration / 1000)]; + db.transaction(function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); + tx.executeSql(dataStr, data); + + var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "12x17" ORDER BY score desc LIMIT 10'); + var r = "\nHIGH SCORES for a standard sized grid\n\n" + for (var i = 0; i < rs.rows.length; i++) { + r += (i + 1) + ". " + rs.rows.item(i).name + ' got ' + rs.rows.item(i).score + ' points in ' + rs.rows.item(i).time + ' seconds.\n'; } - ); + dialog.show(r); + }); } //![2] //![1] function sendHighScore(name) { var postman = new XMLHttpRequest() - var postData = "name="+name+"&score="+gameCanvas.score - +"&gridSize="+maxColumn+"x"+maxRow +"&time="+Math.floor(gameDuration/1000); + var postData = "name=" + name + "&score=" + gameCanvas.score + "&gridSize=" + maxColumn + "x" + maxRow + "&time=" + Math.floor(gameDuration / 1000); postman.open("POST", scoresURL, true); postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - postman.onreadystatechange = function() { + postman.onreadystatechange = function() { if (postman.readyState == postman.DONE) { dialog.show("Your score has been uploaded."); } @@ -232,3 +221,4 @@ function sendHighScore(name) { postman.send(postData); } //![1] + -- cgit v0.12 From 79e4a9e9f47cc218c13cabba43c0f806d72cc84a Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 9 Apr 2010 14:18:39 +1000 Subject: Fix example Task-number: QTBUG-8514 --- doc/src/declarative/qdeclarativemodels.qdoc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index e80824d..5fd2799 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -309,13 +309,21 @@ There are no data roles. 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 +Item { + width: 200 + height: 250 + + Component { + id: itemDelegate + Text { text: "I am item number: " + index } + } + + ListView { + anchors.fill: parent + model: 5 + delegate: itemDelegate + } + } \endcode -- cgit v0.12 From f8b02638aac881619442423b0e633740cc39ecf2 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 9 Apr 2010 15:57:14 +1000 Subject: Doc fixes --- doc/src/declarative/dynamicobjects.qdoc | 16 ++++++---------- doc/src/declarative/modules.qdoc | 2 +- doc/src/declarative/qdeclarativemodels.qdoc | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc index 63f697d..4cb5198 100644 --- a/doc/src/declarative/dynamicobjects.qdoc +++ b/doc/src/declarative/dynamicobjects.qdoc @@ -62,15 +62,11 @@ item which you want to manage dynamic instances of, and creating an item from a string of QML is intended for when the QML itself is generated at runtime. If you have a component specified in a QML file, you can dynamically load it with -the createComponent function on the \l{QML Global Object}. +the \l {createComponent(url file)}{createComponent()} function on the \l{QML Global Object}. This function takes the URL of the QML file as its only argument and returns a component object which can be used to create and load that QML file. -You can also create a component by placing your QML inside a Component element. -Referencing that component element by id will be the same as referencing the variable -which you save the result of createComponent into. - -Once you have a component you can use its createObject method to create an instance of +Once you have a component you can use its \c createObject() method to create an instance of the component. Example QML script is below. Remember that QML files that might be loaded over the network cannot be expected to be ready immediately. \code @@ -116,10 +112,10 @@ the component. Example QML script is below. Remember that QML files that might b After creating the item, remember to set its parent to an item within the scene. Otherwise your dynamically created item will not appear in the scene. When using files with relative paths, the path should -be relative to the file where createComponent is executed. +be relative to the file where \c createComponent() is executed. If the QML does not exist until runtime, you can create a QML item from -a string of QML using the createQmlObject function, as in the following example: +a string of QML using the \l{createQmlObject(string qml, object parent, string filepath)}{createQmlObject()} function, as in the following example: \code newObject = createQmlObject('import Qt 4.7; Rectangle { color: "red"; width: 20; height: 20 }', @@ -139,9 +135,9 @@ will not have an id in QML. A restriction which you need to manage with dynamically created items, is that the creation context must outlive the -created item. The creation context is the QDeclarativeContext in which createComponent +created item. The creation context is the QDeclarativeContext in which \c createComponent() was called, or the context in which the Component element, or the item used as the -second argument to createQmlObject, was specified. If the creation +second argument to \c createQmlObject(), was specified. If the creation context is destroyed before the dynamic item is, then bindings in the dynamic item will fail to work. diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc index 0e332d4..0c69930 100644 --- a/doc/src/declarative/modules.qdoc +++ b/doc/src/declarative/modules.qdoc @@ -158,7 +158,7 @@ To import a module into a namespace: import Qt 4.7 as TheQtLibrary \endcode -Types from Qt 4.6 may then be used, but only by qualifying them with the namespace: +Types from the Qt 4.7 module may then be used, but only by qualifying them with the namespace: \code TheQtLibrary.Rectangle { ... } diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 5fd2799..d8b2a5d 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -54,7 +54,7 @@ delegate may bind to. The roles are exposed as properties of the \e model context property, though this property is set as a default property of the delegate so, unless there is a naming clash with a property in the delegate, the roles are usually accessed unqualified. The -example below would have a clash between he \e color role of the model and +example below would have a clash between the \e color role of the model and the \e color property of the Rectangle. The clash is avoided by referencing the \e color property of the model by its full name: \e model.color. -- cgit v0.12 From 6f796adeb7ba44791ca4faf144defac15b560fd0 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 9 Apr 2010 16:00:42 +1000 Subject: Release ListModel's worker agent on deletion. --- src/declarative/util/qdeclarativelistmodel.cpp | 3 +++ src/declarative/util/qdeclarativelistmodelworkeragent_p.h | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 28bd852..37bbb14 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -264,6 +264,9 @@ QDeclarativeListModel::QDeclarativeListModel(bool workerCopy, QObject *parent) QDeclarativeListModel::~QDeclarativeListModel() { + if (m_agent) + m_agent->release(); + delete m_nested; delete m_flat; } diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent_p.h b/src/declarative/util/qdeclarativelistmodelworkeragent_p.h index b6a643b..53d30c2 100644 --- a/src/declarative/util/qdeclarativelistmodelworkeragent_p.h +++ b/src/declarative/util/qdeclarativelistmodelworkeragent_p.h @@ -66,7 +66,6 @@ QT_MODULE(Declarative) class QDeclarativeListModel; -// Currently this will leak as no-one releases it in the worker thread class QDeclarativeListModelWorkerAgent : public QObject { Q_OBJECT -- cgit v0.12 From 79832f2156745ee2c6608ce7425fb2350b56f18d Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 9 Apr 2010 16:01:26 +1000 Subject: Make sure WorkerScript thread is stopped on deletion. This also fixes the leaking of the worker agent in ListModel. --- src/declarative/qml/qdeclarativeworkerscript.cpp | 13 +++++++++++++ .../qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp | 3 --- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index caf680e..9e137b5 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -107,6 +107,10 @@ class QDeclarativeWorkerScriptEnginePrivate : public QObject { Q_OBJECT public: + enum WorkerEventTypes { + WorkerDestroyEvent = QEvent::User + 100 + }; + QDeclarativeWorkerScriptEnginePrivate(QDeclarativeEngine *eng); struct ScriptEngine : public QDeclarativeScriptEngine @@ -159,6 +163,9 @@ public: static QScriptValue onMessage(QScriptContext *ctxt, QScriptEngine *engine); static QScriptValue sendMessage(QScriptContext *ctxt, QScriptEngine *engine); +signals: + void stopThread(); + protected: virtual bool event(QEvent *); @@ -246,6 +253,9 @@ bool QDeclarativeWorkerScriptEnginePrivate::event(QEvent *event) WorkerLoadEvent *workerEvent = static_cast(event); processLoad(workerEvent->workerId(), workerEvent->url()); return true; + } else if (event->type() == (QEvent::Type)WorkerDestroyEvent) { + emit stopThread(); + return true; } else { return QObject::event(event); } @@ -429,6 +439,7 @@ QDeclarativeWorkerScriptEngine::QDeclarativeWorkerScriptEngine(QDeclarativeEngin : QThread(parent), d(new QDeclarativeWorkerScriptEnginePrivate(parent)) { d->m_lock.lock(); + connect(d, SIGNAL(stopThread()), this, SLOT(quit()), Qt::DirectConnection); start(QThread::LowPriority); d->m_wait.wait(&d->m_lock); d->moveToThread(this); @@ -440,8 +451,10 @@ QDeclarativeWorkerScriptEngine::~QDeclarativeWorkerScriptEngine() d->m_lock.lock(); qDeleteAll(d->workers); d->workers.clear(); + QCoreApplication::postEvent(d, new QEvent((QEvent::Type)QDeclarativeWorkerScriptEnginePrivate::WorkerDestroyEvent)); d->m_lock.unlock(); + wait(); d->deleteLater(); } diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 8214723..5962a42 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -337,7 +337,6 @@ void tst_QDeclarativeListModel::dynamic_worker() } delete item; - QTest::ignoreMessage(QtWarningMsg, "QThread: Destroyed while thread is still running"); qApp->processEvents(); } @@ -367,7 +366,6 @@ void tst_QDeclarativeListModel::convertNestedToFlat_fail() QCOMPARE(model.count(), 2); delete item; - QTest::ignoreMessage(QtWarningMsg, "QThread: Destroyed while thread is still running"); qApp->processEvents(); } @@ -427,7 +425,6 @@ void tst_QDeclarativeListModel::convertNestedToFlat_ok() QCOMPARE(model.count(), count+1); delete item; - QTest::ignoreMessage(QtWarningMsg, "QThread: Destroyed while thread is still running"); qApp->processEvents(); } -- cgit v0.12 From c7ff857e0e93ca7dd555daf59e7508ee244bd876 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 9 Apr 2010 16:05:41 +1000 Subject: Small doc fix. --- src/declarative/graphicsitems/qdeclarativetext.cpp | 10 +++++----- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 1730ee4..69e3543 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -398,18 +398,18 @@ void QDeclarativeText::setWrap(bool w) \o \qml Column { - TextEdit { + Text { font.pointSize: 24 text: "Hello World!" } - TextEdit { + Text { font.pointSize: 24 - textFormat: "RichText" + textFormat: Text.RichText text: "Hello World!" } - TextEdit { + Text { font.pointSize: 24 - textFormat: "PlainText" + textFormat: Text.PlainText text: "Hello World!" } } diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 6f1f6ac..25d7e2a 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -171,12 +171,12 @@ Column { } TextEdit { font.pointSize: 24 - textFormat: "RichText" + textFormat: TextEdit.RichText text: "Hello World!" } TextEdit { font.pointSize: 24 - textFormat: "PlainText" + textFormat: TextEdit.PlainText text: "Hello World!" } } -- cgit v0.12 From 44efb487bbd2a9e4de416d566839cdffff1d69e2 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Apr 2010 16:20:38 +1000 Subject: List properties aren't read-only --- src/declarative/qml/qdeclarativeobjectscriptclass.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index 4601aaa..e89075f 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -323,7 +323,8 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj, return; } - if (!(lastData->flags & QDeclarativePropertyCache::Data::IsWritable)) { + if (!(lastData->flags & QDeclarativePropertyCache::Data::IsWritable) && + !(lastData->flags & QDeclarativePropertyCache::Data::IsQList)) { QString error = QLatin1String("Cannot assign to read-only property \"") + toString(name) + QLatin1Char('\"'); context->throwError(error); -- cgit v0.12 From da8dda3a3b66fed6d5da878f3b4617aa0b5f3953 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Apr 2010 16:37:48 +1000 Subject: Remove QT_VERSION checks in QML We only support Qt 4.7 now. --- .../graphicsitems/qdeclarativeitemsmodule.cpp | 2 -- .../graphicsitems/qdeclarativetextinput_p.h | 2 -- .../qml/qdeclarativecompositetypemanager.cpp | 7 ------ src/declarative/qml/qdeclarativeengine.cpp | 2 -- .../qml/qdeclarativeobjectscriptclass_p.h | 4 ---- src/declarative/qml/qdeclarativevaluetype.cpp | 28 ---------------------- src/declarative/qml/qdeclarativevaluetype_p.h | 4 ---- src/declarative/util/qdeclarativepixmapcache.cpp | 7 ------ 8 files changed, 56 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 7664af1..8e5b863 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -112,10 +112,8 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType("Qt",4,6,"PathQuad"); qmlRegisterType("Qt",4,6,"PathView"); qmlRegisterType("Qt",4,6,"IntValidator"); -#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) qmlRegisterType("Qt",4,7,"DoubleValidator"); qmlRegisterType("Qt",4,7,"RegExpValidator"); -#endif qmlRegisterType("Qt",4,6,"Rectangle"); qmlRegisterType("Qt",4,6,"Repeater"); qmlRegisterType("Qt",4,6,"Rotation"); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 6e61580..9a3fa75 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -226,10 +226,8 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QDeclarativeTextInput) QML_DECLARE_TYPE(QValidator) QML_DECLARE_TYPE(QIntValidator) -#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) QML_DECLARE_TYPE(QDoubleValidator) QML_DECLARE_TYPE(QRegExpValidator) -#endif QT_END_HEADER diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp index ccf10c6..05e8d22 100644 --- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp +++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp @@ -55,13 +55,6 @@ QT_BEGIN_NAMESPACE -#if (QT_VERSION < QT_VERSION_CHECK(4, 7, 0)) -inline uint qHash(const QUrl &uri) -{ - return qHash(uri.toEncoded(QUrl::FormattingOption(0x100))); -} -#endif - QDeclarativeCompositeTypeData::QDeclarativeCompositeTypeData() : status(Invalid), errorType(NoError), component(0), compiledComponent(0) { diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 8905713..944abce 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -182,11 +182,9 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) fileImportPath.append(canonicalPath); } } -#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) QString builtinPath = QLibraryInfo::location(QLibraryInfo::ImportsPath); if (!builtinPath.isEmpty()) fileImportPath += builtinPath; -#endif filePluginPath += QLatin1String("."); diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h index 5a59ef8..4b27e53 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h +++ b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h @@ -66,7 +66,6 @@ class QScriptContext; class QScriptEngine; class QDeclarativeContextData; -#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE) class Q_AUTOTEST_EXPORT QDeclarativeObjectMethodScriptClass : public QScriptDeclarativeClass { public: @@ -91,7 +90,6 @@ private: QDeclarativeEngine *engine; }; -#endif class Q_AUTOTEST_EXPORT QDeclarativeObjectScriptClass : public QScriptDeclarativeClass { @@ -132,10 +130,8 @@ protected: virtual QObject *toQObject(Object *, bool *ok = 0); private: -#if (QT_VERSION > QT_VERSION_CHECK(4, 6, 2)) || defined(QT_HAVE_QSCRIPTDECLARATIVECLASS_VALUE) friend class QDeclarativeObjectMethodScriptClass; QDeclarativeObjectMethodScriptClass methods; -#endif QDeclarativeTypeNameCache::Data *lastTNData; QDeclarativePropertyCache::Data *lastData; diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp index 49e7b79..261c84a 100644 --- a/src/declarative/qml/qdeclarativevaluetype.cpp +++ b/src/declarative/qml/qdeclarativevaluetype.cpp @@ -47,10 +47,6 @@ QT_BEGIN_NAMESPACE -#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) -Q_DECLARE_METATYPE(QEasingCurve); -#endif - template int qmlRegisterValueTypeEnums(const char *qmlName) { @@ -82,29 +78,18 @@ QDeclarativeValueTypeFactory::QDeclarativeValueTypeFactory() // ### Optimize for (unsigned int ii = 0; ii < (QVariant::UserType - 1); ++ii) valueTypes[ii] = valueType(ii); -#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) - easingType = qMetaTypeId(); - easingValueType = valueType(easingType); -#endif } QDeclarativeValueTypeFactory::~QDeclarativeValueTypeFactory() { for (unsigned int ii = 0; ii < (QVariant::UserType - 1); ++ii) delete valueTypes[ii]; -#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) - delete easingValueType; -#endif } bool QDeclarativeValueTypeFactory::isValueType(int idx) { if ((uint)idx < QVariant::UserType) return true; -#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) - if (idx == qMetaTypeId()) - return true; -#endif return false; } @@ -116,9 +101,6 @@ void QDeclarativeValueTypeFactory::registerValueTypes() QDeclarativeValueType *QDeclarativeValueTypeFactory::operator[](int idx) const { -#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) - if (idx == easingType) return easingValueType; -#endif return valueTypes[idx]; } @@ -140,17 +122,11 @@ QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t) return new QDeclarativeRectFValueType; case QVariant::Vector3D: return new QDeclarativeVector3DValueType; -#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) case QVariant::EasingCurve: return new QDeclarativeEasingValueType; -#endif case QVariant::Font: return new QDeclarativeFontValueType; default: -#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) - if (t == qMetaTypeId()) - return new QDeclarativeEasingValueType; -#endif return 0; } } @@ -566,11 +542,7 @@ void QDeclarativeEasingValueType::write(QObject *obj, int idx, QDeclarativePrope QVariant QDeclarativeEasingValueType::value() { -#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) return QVariant(easing); -#else - return QVariant::fromValue(easing); -#endif } void QDeclarativeEasingValueType::setValue(QVariant value) diff --git a/src/declarative/qml/qdeclarativevaluetype_p.h b/src/declarative/qml/qdeclarativevaluetype_p.h index 763177d..5bfc27d 100644 --- a/src/declarative/qml/qdeclarativevaluetype_p.h +++ b/src/declarative/qml/qdeclarativevaluetype_p.h @@ -90,10 +90,6 @@ public: private: QDeclarativeValueType *valueTypes[QVariant::UserType - 1]; -#if (QT_VERSION < QT_VERSION_CHECK(4,7,0)) - int easingType; - QDeclarativeValueType *easingValueType; -#endif }; class Q_AUTOTEST_EXPORT QDeclarativePointFValueType : public QDeclarativeValueType diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index e57d3c2..5e60819 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -65,13 +65,6 @@ static const int maxImageRequestCount = 8; QT_BEGIN_NAMESPACE -#if (QT_VERSION < QT_VERSION_CHECK(4, 7, 0)) -inline uint qHash(const QUrl &uri) -{ - return qHash(uri.toEncoded(QUrl::FormattingOption(0x100))); -} -#endif - static QString toLocalFileOrQrc(const QUrl& url) { QString r = url.toLocalFile(); -- cgit v0.12 From 06c286b74274166a47df20dc425f76051fb03d4d Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Apr 2010 17:18:54 +1000 Subject: Fix crash in QML library imports QTBUG-9705 --- src/declarative/qml/qdeclarativecontext.cpp | 1 + .../qdeclarativeecmascript/data/libraryScriptAssert.js | 6 ++++++ .../qdeclarativeecmascript/data/libraryScriptAssert.qml | 7 +++++++ .../qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 12 ++++++++++++ 4 files changed, 26 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/libraryScriptAssert.js create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/libraryScriptAssert.qml diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 55c2f7c..9307bcc 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -623,6 +623,7 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object if (iter == enginePriv->m_sharedScriptImports.end()) { QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine); + scriptContext->pushScope(enginePriv->contextClass->newContext(0, 0)); scriptContext->pushScope(enginePriv->globalClass->globalObject()); QScriptValue scope = scriptEngine->newObject(); diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/libraryScriptAssert.js b/tests/auto/declarative/qdeclarativeecmascript/data/libraryScriptAssert.js new file mode 100644 index 0000000..3ffdb33 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/libraryScriptAssert.js @@ -0,0 +1,6 @@ +.pragma library + +function test(target) +{ + var a = target.a; +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/libraryScriptAssert.qml b/tests/auto/declarative/qdeclarativeecmascript/data/libraryScriptAssert.qml new file mode 100644 index 0000000..9e8408f --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/libraryScriptAssert.qml @@ -0,0 +1,7 @@ +import Qt 4.6 +import "libraryScriptAssert.js" as Test + +QtObject { + id: root + Component.onCompleted: Test.test(root); +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index c6bb276..d886e83 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -139,6 +139,7 @@ private slots: void regExpBug(); void nullObjectBinding(); void deletedEngine(); + void libraryScriptAssert(); void callQtInvokables(); private: @@ -2179,6 +2180,17 @@ void tst_qdeclarativeecmascript::deletedEngine() delete object; } +// Test the crashing part of QTBUG-9705 +void tst_qdeclarativeecmascript::libraryScriptAssert() +{ + QDeclarativeComponent component(&engine, TEST_FILE("libraryScriptAssert.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + delete object; +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" -- cgit v0.12 From 3d90e35abae15f133ad2a71874f6926773c96449 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Apr 2010 17:59:07 +1000 Subject: Add a Qt.isQtObject() method QTBUG-9705 --- doc/src/declarative/globalobject.qdoc | 3 +++ src/declarative/qml/qdeclarativeengine.cpp | 9 +++++++++ src/declarative/qml/qdeclarativeengine_p.h | 1 + .../auto/declarative/qdeclarativeqt/data/isQtObject.qml | 14 ++++++++++++++ .../declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp | 16 ++++++++++++++++ 5 files changed, 43 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 71ab67d..97f5d91 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -203,6 +203,9 @@ This function causes the QML engine to emit the quit signal, which in This function returns \c url resolved relative to the URL of the caller. +\section3 Qt.isQtObject(object) +Returns true if \c object is a valid reference to a Qt or QML object, otherwise false. + \section1 Dynamic Object Creation The following functions on the global object allow you to dynamically create QML items from files or strings. See \l{Dynamic Object Management} for an overview diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 944abce..e459d0f 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -225,6 +225,7 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr // XXX used to add Qt.Sound class. //types + qtObject.setProperty(QLatin1String("isQtObject"), newFunction(QDeclarativeEnginePrivate::isQtObject, 1)); qtObject.setProperty(QLatin1String("rgba"), newFunction(QDeclarativeEnginePrivate::rgba, 4)); qtObject.setProperty(QLatin1String("hsla"), newFunction(QDeclarativeEnginePrivate::hsla, 4)); qtObject.setProperty(QLatin1String("rect"), newFunction(QDeclarativeEnginePrivate::rect, 4)); @@ -1027,6 +1028,14 @@ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QS return activeEnginePriv->objectClass->newQObject(obj, QMetaType::QObjectStar); } +QScriptValue QDeclarativeEnginePrivate::isQtObject(QScriptContext *ctxt, QScriptEngine *engine) +{ + if (ctxt->argumentCount() == 0) + return QScriptValue(engine, false); + + return QScriptValue(engine, 0 != ctxt->argument(0).toQObject()); +} + QScriptValue QDeclarativeEnginePrivate::vector(QScriptContext *ctxt, QScriptEngine *engine) { if(ctxt->argumentCount() != 3) diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 6bcd0d1..7766ad6 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -317,6 +317,7 @@ public: static QScriptValue createComponent(QScriptContext*, QScriptEngine*); static QScriptValue createQmlObject(QScriptContext*, QScriptEngine*); + static QScriptValue isQtObject(QScriptContext*, QScriptEngine*); static QScriptValue vector(QScriptContext*, QScriptEngine*); static QScriptValue rgba(QScriptContext*, QScriptEngine*); static QScriptValue hsla(QScriptContext*, QScriptEngine*); diff --git a/tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml b/tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml new file mode 100644 index 0000000..d986492 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml @@ -0,0 +1,14 @@ +import Qt 4.6 + +QtObject { + id: root + + property QtObject nullObject + + property bool test1: Qt.isQtObject(root) + property bool test2: Qt.isQtObject(nullObject) + property bool test3: Qt.isQtObject(10) + property bool test4: Qt.isQtObject(null) + property bool test5: Qt.isQtObject({ a: 10, b: 11 }) +} + diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index 48d5235..98f1200 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -73,6 +73,7 @@ private slots: void createQmlObject(); void consoleLog(); void formatting(); + void isQtObject(); private: QDeclarativeEngine engine; @@ -392,6 +393,21 @@ void tst_qdeclarativeqt::formatting() delete object; } +void tst_qdeclarativeqt::isQtObject() +{ + QDeclarativeComponent component(&engine, TEST_FILE("isQtObject.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toBool(), true); + QCOMPARE(object->property("test2").toBool(), false); + QCOMPARE(object->property("test3").toBool(), false); + QCOMPARE(object->property("test4").toBool(), false); + QCOMPARE(object->property("test5").toBool(), false); + + delete object; +} + QTEST_MAIN(tst_qdeclarativeqt) #include "tst_qdeclarativeqt.moc" -- cgit v0.12 From cf6f2eb2ccd1675d890904d12c9717e4570b123b Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Apr 2010 18:19:06 +1000 Subject: Allow undefined to be assigned to QVariant properties QTBUG-9704 --- src/declarative/qml/qdeclarativebinding.cpp | 4 ++++ .../qml/qdeclarativeobjectscriptclass.cpp | 2 ++ .../data/variantsAssignedUndefined.qml | 9 +++++++++ .../tst_qdeclarativeecmascript.cpp | 20 ++++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativeecmascript/data/variantsAssignedUndefined.qml diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 91eb915..e172a8b 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -174,6 +174,10 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) data->property.reset(); + } else if (isUndefined && data->property.propertyType() == qMetaTypeId()) { + + QDeclarativePropertyPrivate::write(data->property, QVariant(), flags); + } else if (isUndefined) { QUrl url = QUrl(data->url); diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index e89075f..e1e33ab 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -351,6 +351,8 @@ void QDeclarativeObjectScriptClass::setProperty(QObject *obj, if (value.isUndefined() && lastData->flags & QDeclarativePropertyCache::Data::IsResettable) { void *a[] = { 0 }; QMetaObject::metacall(obj, QMetaObject::ResetProperty, lastData->coreIndex, a); + } else if (value.isUndefined() && lastData->propType == qMetaTypeId()) { + QDeclarativePropertyPrivate::write(obj, *lastData, QVariant(), evalContext); } else if (value.isUndefined()) { QString error = QLatin1String("Cannot assign [undefined] to ") + QLatin1String(QMetaType::typeName(lastData->propType)); diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/variantsAssignedUndefined.qml b/tests/auto/declarative/qdeclarativeecmascript/data/variantsAssignedUndefined.qml new file mode 100644 index 0000000..5488e1a --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/variantsAssignedUndefined.qml @@ -0,0 +1,9 @@ +import Qt 4.6 + +QtObject { + property bool runTest: false + onRunTestChanged: test1 = undefined + + property variant test1: 10 + property variant test2: (runTest == false)?11:undefined +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index d886e83..c9fb116 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -140,6 +140,7 @@ private slots: void nullObjectBinding(); void deletedEngine(); void libraryScriptAssert(); + void variantsAssignedUndefined(); void callQtInvokables(); private: @@ -2191,6 +2192,25 @@ void tst_qdeclarativeecmascript::libraryScriptAssert() delete object; } +void tst_qdeclarativeecmascript::variantsAssignedUndefined() +{ + QDeclarativeComponent component(&engine, TEST_FILE("variantsAssignedUndefined.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toInt(), 10); + QCOMPARE(object->property("test2").toInt(), 11); + + object->setProperty("runTest", true); + + QCOMPARE(object->property("test1"), QVariant()); + QCOMPARE(object->property("test2"), QVariant()); + + + delete object; +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" -- cgit v0.12 From 2c8785e698d68edde74e6db2a3dd1715e17baee8 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Apr 2010 18:39:08 +1000 Subject: Disallow writes to read-only value type properties QTBUG-9685 --- src/declarative/qml/qdeclarativecompiler.cpp | 4 ++++ .../data/sizereadonly_writeerror3.qml | 7 +++++++ .../data/sizereadonly_writeerror4.qml | 10 ++++++++++ .../tst_qdeclarativevaluetypes.cpp | 18 +++++++++++++++++- 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror3.qml create mode 100644 tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror4.qml diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index d2b2024..bd664fe 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -1866,6 +1866,10 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr } } + if (!obj->metaObject()->property(prop->index).isWritable()) { + COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler", "Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name))); + } + COMPILE_CHECK(buildValueTypeProperty(ep->valueTypes[prop->type], prop->value, obj, ctxt.incr())); obj->addValueTypeProperty(prop); diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror3.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror3.qml new file mode 100644 index 0000000..b8e3f0d --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror3.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + sizereadonly.width: 13 + sizereadonly.height: 88 +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror4.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror4.qml new file mode 100644 index 0000000..8ae2ef8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror4.qml @@ -0,0 +1,10 @@ +import Test 1.0 +import Qt 4.6 + +MyTypeObject { + Component.onCompleted: { + sizereadonly.width = 13; + } +} + + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index c74199f..e653abf 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -216,10 +216,26 @@ void tst_qdeclarativevaluetypes::sizereadonly() { QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_writeerror2.qml")); - QEXPECT_FAIL("", "QTBUG-9685", Abort); QVERIFY(component.isError()); QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property")); } + + { + QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_writeerror3.qml")); + QVERIFY(component.isError()); + QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property")); + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_writeerror4.qml")); + + QObject *object = component.create(); + QVERIFY(object); + + QCOMPARE(object->property("sizereadonly").toSize(), QSize(1912, 1913)); + + delete object; + } } void tst_qdeclarativevaluetypes::rect() -- cgit v0.12 From 6170493cac58b30635c5037341bbcb059ee6d193 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Apr 2010 18:43:25 +1000 Subject: Cleanup --- src/declarative/qml/qdeclarativecompiler.cpp | 181 ++++++++++++++------------- src/declarative/qml/qdeclarativecompiler_p.h | 2 + 2 files changed, 95 insertions(+), 88 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index bd664fe..fad7779 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -146,7 +146,7 @@ bool QDeclarativeCompiler::isSignalPropertyName(const QByteArray &name) For example: \code - COMPILE_EXCEPTION(property, QCoreApplication::translate("QDeclarativeCompiler","Error for property \"%1\"").arg(QString::fromUtf8(property->name))); + COMPILE_EXCEPTION(property, tr("Error for property \"%1\"").arg(QString::fromUtf8(property->name))); \endcode */ #define COMPILE_EXCEPTION(token, desc) \ @@ -184,7 +184,7 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop, QString string = v->value.asScript(); if (!prop.isWritable()) - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name()))); + COMPILE_EXCEPTION(v, tr("Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name()))); if (prop.isEnumType()) { int value; @@ -193,7 +193,7 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop, } else value = prop.enumerator().keyToValue(string.toUtf8().constData()); if (value == -1) - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: unknown enumeration")); + COMPILE_EXCEPTION(v, tr("Invalid property assignment: unknown enumeration")); return true; } int type = prop.userType(); @@ -201,65 +201,65 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop, case -1: break; case QVariant::String: - if (!v->value.isString()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: string expected")); + if (!v->value.isString()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: string expected")); break; case QVariant::Url: - if (!v->value.isString()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: url expected")); + if (!v->value.isString()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: url expected")); break; case QVariant::UInt: { bool ok; string.toUInt(&ok); - if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: unsigned int expected")); + if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: unsigned int expected")); } break; case QVariant::Int: { bool ok; string.toInt(&ok); - if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: int expected")); + if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: int expected")); } break; case QMetaType::Float: { bool ok; string.toFloat(&ok); - if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: float expected")); + if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: float expected")); } break; case QVariant::Double: { bool ok; string.toDouble(&ok); - if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: double expected")); + if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: double expected")); } break; case QVariant::Color: { bool ok; QDeclarativeStringConverters::colorFromString(string, &ok); - if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: color expected")); + if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: color expected")); } break; case QVariant::Date: { bool ok; QDeclarativeStringConverters::dateFromString(string, &ok); - if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: date expected")); + if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: date expected")); } break; case QVariant::Time: { bool ok; QDeclarativeStringConverters::timeFromString(string, &ok); - if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: time expected")); + if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: time expected")); } break; case QVariant::DateTime: { bool ok; QDeclarativeStringConverters::dateTimeFromString(string, &ok); - if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: datetime expected")); + if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: datetime expected")); } break; case QVariant::Point: @@ -267,7 +267,7 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop, { bool ok; QPointF point = QDeclarativeStringConverters::pointFFromString(string, &ok); - if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: point expected")); + if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: point expected")); } break; case QVariant::Size: @@ -275,7 +275,7 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop, { bool ok; QSizeF size = QDeclarativeStringConverters::sizeFFromString(string, &ok); - if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: size expected")); + if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: size expected")); } break; case QVariant::Rect: @@ -283,19 +283,19 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop, { bool ok; QRectF rect = QDeclarativeStringConverters::rectFFromString(string, &ok); - if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: rect expected")); + if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: rect expected")); } break; case QVariant::Bool: { - if (!v->value.isBoolean()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: boolean expected")); + if (!v->value.isBoolean()) COMPILE_EXCEPTION(v, tr("Invalid property assignment: boolean expected")); } break; case QVariant::Vector3D: { bool ok; QDeclarativeStringConverters::vector3DFromString(string, &ok); - if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: 3D vector expected")); + if (!ok) COMPILE_EXCEPTION(v, tr("Invalid property assignment: 3D vector expected")); } break; default: @@ -304,7 +304,7 @@ bool QDeclarativeCompiler::testLiteralAssignment(const QMetaProperty &prop, QDeclarativeMetaType::StringConverter converter = QDeclarativeMetaType::customStringConverter(t); if (!converter) - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: unsupported type \"%1\"").arg(QString::fromLatin1(QVariant::typeToName(prop.type())))); + COMPILE_EXCEPTION(v, tr("Invalid property assignment: unsupported type \"%1\"").arg(QString::fromLatin1(QVariant::typeToName(prop.type())))); } break; } @@ -573,7 +573,7 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, if (tref.type) { ref.type = tref.type; if (!ref.type->isCreatable()) - COMPILE_EXCEPTION(parserRef->refObjects.first(), QCoreApplication::translate("QDeclarativeCompiler", "Element is not creatable.")); + COMPILE_EXCEPTION(parserRef->refObjects.first(), tr( "Element is not creatable.")); } else if (tref.unit) { ref.component = tref.unit->toComponent(engine); @@ -1176,23 +1176,23 @@ bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj, Property *idProp = 0; if (obj->properties.count() > 1 || (obj->properties.count() == 1 && obj->properties.begin().key() != "id")) - COMPILE_EXCEPTION(*obj->properties.begin(), QCoreApplication::translate("QDeclarativeCompiler","Component elements may not contain properties other than id")); + COMPILE_EXCEPTION(*obj->properties.begin(), tr("Component elements may not contain properties other than id")); if (!obj->scriptBlockObjects.isEmpty()) - COMPILE_EXCEPTION(obj->scriptBlockObjects.first(), QCoreApplication::translate("QDeclarativeCompiler","Component elements may not contain script blocks")); + COMPILE_EXCEPTION(obj->scriptBlockObjects.first(), tr("Component elements may not contain script blocks")); if (obj->properties.count()) idProp = *obj->properties.begin(); if (idProp) { if (idProp->value || idProp->values.count() > 1 || idProp->values.at(0)->object) - COMPILE_EXCEPTION(idProp, QCoreApplication::translate("QDeclarativeCompiler","Invalid component id specification")); + COMPILE_EXCEPTION(idProp, tr("Invalid component id specification")); COMPILE_CHECK(checkValidId(idProp->values.first(), idProp->values.first()->primitive())); QString idVal = idProp->values.first()->primitive(); if (compileState.ids.contains(idVal)) - COMPILE_EXCEPTION(idProp, QCoreApplication::translate("QDeclarativeCompiler","id is not unique")); + COMPILE_EXCEPTION(idProp, tr("id is not unique")); obj->id = idVal; addId(idVal, obj); @@ -1202,14 +1202,14 @@ bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj, if (obj->defaultProperty && (obj->defaultProperty->value || obj->defaultProperty->values.count() > 1 || (obj->defaultProperty->values.count() == 1 && !obj->defaultProperty->values.first()->object))) - COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Invalid component body specification")); + COMPILE_EXCEPTION(obj, tr("Invalid component body specification")); Object *root = 0; if (obj->defaultProperty && obj->defaultProperty->values.count()) root = obj->defaultProperty->values.first()->object; if (!root) - COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Cannot create empty component specification")); + COMPILE_EXCEPTION(obj, tr("Cannot create empty component specification")); // Build the component tree COMPILE_CHECK(buildComponentFromRoot(root, ctxt)); @@ -1228,11 +1228,11 @@ bool QDeclarativeCompiler::buildScript(QDeclarativeParser::Object *obj, QDeclara Property *source = *script->properties.begin(); if (script->defaultProperty) - COMPILE_EXCEPTION(source, QCoreApplication::translate("QDeclarativeCompiler","Invalid Script block. Specify either the source property or inline script")); + COMPILE_EXCEPTION(source, tr("Invalid Script block. Specify either the source property or inline script")); if (source->value || source->values.count() != 1 || source->values.at(0)->object || !source->values.at(0)->value.isStringList()) - COMPILE_EXCEPTION(source, QCoreApplication::translate("QDeclarativeCompiler","Invalid Script source value")); + COMPILE_EXCEPTION(source, tr("Invalid Script source value")); QStringList sources = source->values.at(0)->value.asStringList(); @@ -1257,7 +1257,7 @@ bool QDeclarativeCompiler::buildScript(QDeclarativeParser::Object *obj, QDeclara } } else if (!script->properties.isEmpty()) { - COMPILE_EXCEPTION(*script->properties.begin(), QCoreApplication::translate("QDeclarativeCompiler","Properties cannot be set on Script block")); + COMPILE_EXCEPTION(*script->properties.begin(), tr("Properties cannot be set on Script block")); } else if (script->defaultProperty) { QString scriptCode; @@ -1271,7 +1271,7 @@ bool QDeclarativeCompiler::buildScript(QDeclarativeParser::Object *obj, QDeclara if (lineNumber == 1) lineNumber = v->location.start.line; if (v->object || !v->value.isString()) - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid Script block")); + COMPILE_EXCEPTION(v, tr("Invalid Script block")); if (ii == 0) { currentLocation = v->location.start; @@ -1415,7 +1415,7 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl } else { if (prop->value || prop->values.count() != 1) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Incorrectly specified signal assignment")); + COMPILE_EXCEPTION(prop, tr("Incorrectly specified signal assignment")); prop->index = sigIdx; obj->addSignalProperty(prop); @@ -1428,7 +1428,7 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl QString script = prop->values.at(0)->value.asScript().trimmed(); if (script.isEmpty()) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Empty signal assignment")); + COMPILE_EXCEPTION(prop, tr("Empty signal assignment")); compileState.signalExpressions.insert(prop->values.at(0), ctxt); } @@ -1466,7 +1466,7 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop, const BindingContext &ctxt) { if (prop->isEmpty()) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Empty property assignment")); + COMPILE_EXCEPTION(prop, tr("Empty property assignment")); const QMetaObject *metaObject = obj->metaObject(); Q_ASSERT(metaObject); @@ -1478,7 +1478,7 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop, // Attached properties cannot be used on sub-objects. Sub-objects // always exist in a binding sub-context, which is what we test // for here. - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Attached properties cannot be used here")); + COMPILE_EXCEPTION(prop, tr("Attached properties cannot be used here")); } QDeclarativeType *type = 0; @@ -1493,11 +1493,11 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop, ctxt)); return true; } else if (!type || !type->attachedPropertiesType()) { - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Non-existent attached object")); + COMPILE_EXCEPTION(prop, tr("Non-existent attached object")); } if (!prop->value) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid attached object assignment")); + COMPILE_EXCEPTION(prop, tr("Invalid attached object assignment")); Q_ASSERT(type->attachedPropertiesFunction()); prop->index = type->index(); @@ -1550,9 +1550,9 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop, } else if (prop->index == -1) { if (prop->isDefault) { - COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QDeclarativeCompiler","Cannot assign to non-existent default property")); + COMPILE_EXCEPTION(prop->values.first(), tr("Cannot assign to non-existent default property")); } else { - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name))); + COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name))); } } else if (prop->value) { @@ -1583,12 +1583,12 @@ QDeclarativeCompiler::buildPropertyInNamespace(QDeclarativeEnginePrivate::Import const BindingContext &ctxt) { if (!nsProp->value) - COMPILE_EXCEPTION(nsProp, QCoreApplication::translate("QDeclarativeCompiler","Invalid use of namespace")); + COMPILE_EXCEPTION(nsProp, tr("Invalid use of namespace")); foreach (Property *prop, nsProp->value->properties) { if (!isAttachedPropertyName(prop->name)) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Not an attached property name")); + COMPILE_EXCEPTION(prop, tr("Not an attached property name")); // Setup attached property data @@ -1597,10 +1597,10 @@ QDeclarativeCompiler::buildPropertyInNamespace(QDeclarativeEnginePrivate::Import &type, 0, 0, 0); if (!type || !type->attachedPropertiesType()) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Non-existent attached object")); + COMPILE_EXCEPTION(prop, tr("Non-existent attached object")); if (!prop->value) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid attached object assignment")); + COMPILE_EXCEPTION(prop, tr("Invalid attached object assignment")); Q_ASSERT(type->attachedPropertiesFunction()); prop->index = type->index(); @@ -1771,7 +1771,7 @@ bool QDeclarativeCompiler::buildIdProperty(QDeclarativeParser::Property *prop, if (prop->value || prop->values.count() > 1 || prop->values.at(0)->object) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid use of id property")); + COMPILE_EXCEPTION(prop, tr("Invalid use of id property")); QDeclarativeParser::Value *idValue = prop->values.at(0); QString val = idValue->primitive(); @@ -1779,7 +1779,7 @@ bool QDeclarativeCompiler::buildIdProperty(QDeclarativeParser::Property *prop, COMPILE_CHECK(checkValidId(idValue, val)); if (compileState.ids.contains(val)) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","id is not unique")); + COMPILE_EXCEPTION(prop, tr("id is not unique")); prop->values.at(0)->type = Value::Id; @@ -1860,21 +1860,21 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr if (prop->values.count()) { if (prop->values.at(0)->location < prop->value->location) { - COMPILE_EXCEPTION(prop->value, QCoreApplication::translate("QDeclarativeCompiler", "Property has already been assigned a value")); + COMPILE_EXCEPTION(prop->value, tr( "Property has already been assigned a value")); } else { - COMPILE_EXCEPTION(prop->values.at(0), QCoreApplication::translate("QDeclarativeCompiler", "Property has already been assigned a value")); + COMPILE_EXCEPTION(prop->values.at(0), tr( "Property has already been assigned a value")); } } if (!obj->metaObject()->property(prop->index).isWritable()) { - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler", "Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name))); + COMPILE_EXCEPTION(prop, tr( "Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name))); } COMPILE_CHECK(buildValueTypeProperty(ep->valueTypes[prop->type], prop->value, obj, ctxt.incr())); obj->addValueTypeProperty(prop); } else { - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid grouped property access")); + COMPILE_EXCEPTION(prop, tr("Invalid grouped property access")); } } else { @@ -1882,10 +1882,10 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr prop->value->metatype = QDeclarativeEnginePrivate::get(engine)->metaObjectForType(prop->type); if (!prop->value->metatype) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid grouped property access")); + COMPILE_EXCEPTION(prop, tr("Invalid grouped property access")); if (prop->values.count()) - COMPILE_EXCEPTION(prop->values.at(0), QCoreApplication::translate("QDeclarativeCompiler", "Cannot assign a value directly to a grouped property")); + COMPILE_EXCEPTION(prop->values.at(0), tr( "Cannot assign a value directly to a grouped property")); obj->addGroupedProperty(prop); @@ -1901,28 +1901,28 @@ bool QDeclarativeCompiler::buildValueTypeProperty(QObject *type, const BindingContext &ctxt) { if (obj->defaultProperty) - COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Invalid property use")); + COMPILE_EXCEPTION(obj, tr("Invalid property use")); obj->metatype = type->metaObject(); foreach (Property *prop, obj->properties) { int idx = type->metaObject()->indexOfProperty(prop->name.constData()); if (idx == -1) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name))); + COMPILE_EXCEPTION(prop, tr("Cannot assign to non-existent property \"%1\"").arg(QString::fromUtf8(prop->name))); QMetaProperty p = type->metaObject()->property(idx); prop->index = idx; prop->type = p.userType(); prop->isValueTypeSubProperty = true; if (prop->value) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Property assignment expected")); + COMPILE_EXCEPTION(prop, tr("Property assignment expected")); if (prop->values.count() > 1) { - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Single property assignment expected")); + COMPILE_EXCEPTION(prop, tr("Single property assignment expected")); } else if (prop->values.count()) { Value *value = prop->values.at(0); if (value->object) { - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Unexpected object assignment")); + COMPILE_EXCEPTION(prop, tr("Unexpected object assignment")); } else if (value->value.isScript()) { // ### Check for writability BindingReference reference; @@ -1979,19 +1979,19 @@ bool QDeclarativeCompiler::buildListProperty(QDeclarativeParser::Property *prop, // at runtime. if (!listTypeIsInterface) { if (!canCoerce(listType, v->object)) { - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Cannot assign object to list")); + COMPILE_EXCEPTION(v, tr("Cannot assign object to list")); } } } else if (v->value.isScript()) { if (assignedBinding) - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Can only assign one binding to lists")); + COMPILE_EXCEPTION(v, tr("Can only assign one binding to lists")); assignedBinding = true; COMPILE_CHECK(buildBinding(v, prop, ctxt)); v->type = Value::PropertyBinding; } else { - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Cannot assign primitives to lists")); + COMPILE_EXCEPTION(v, tr("Cannot assign primitives to lists")); } } @@ -2004,10 +2004,10 @@ bool QDeclarativeCompiler::buildScriptStringProperty(QDeclarativeParser::Propert const BindingContext &ctxt) { if (prop->values.count() > 1) - COMPILE_EXCEPTION(prop->values.at(1), QCoreApplication::translate("QDeclarativeCompiler", "Cannot assign multiple values to a script property")); + COMPILE_EXCEPTION(prop->values.at(1), tr( "Cannot assign multiple values to a script property")); if (prop->values.at(0)->object || !prop->values.at(0)->value.isScript()) - COMPILE_EXCEPTION(prop->values.at(0), QCoreApplication::translate("QDeclarativeCompiler", "Invalid property assignment: script expected")); + COMPILE_EXCEPTION(prop->values.at(0), tr( "Invalid property assignment: script expected")); obj->addScriptStringProperty(prop, ctxt.stack); @@ -2054,7 +2054,7 @@ bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeParser::Pro Q_ASSERT(v->object->type != -1); if (!obj->metaObject()->property(prop->index).isWritable()) - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name))); + COMPILE_EXCEPTION(v, tr("Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name))); if (QDeclarativeMetaType::isInterface(prop->type)) { @@ -2113,7 +2113,7 @@ bool QDeclarativeCompiler::buildPropertyObjectAssignment(QDeclarativeParser::Pro v->object = component; COMPILE_CHECK(buildPropertyObjectAssignment(prop, obj, v, ctxt)); } else { - COMPILE_EXCEPTION(v->object, QCoreApplication::translate("QDeclarativeCompiler","Cannot assign object to property")); + COMPILE_EXCEPTION(v->object, tr("Cannot assign object to property")); } } @@ -2136,7 +2136,7 @@ bool QDeclarativeCompiler::buildPropertyOnAssignment(QDeclarativeParser::Propert Q_ASSERT(v->object->type != -1); if (!obj->metaObject()->property(prop->index).isWritable()) - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name))); + COMPILE_EXCEPTION(v, tr("Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name))); // Normally buildObject() will set this up, but we need the static @@ -2163,7 +2163,7 @@ bool QDeclarativeCompiler::buildPropertyOnAssignment(QDeclarativeParser::Propert buildDynamicMeta(baseObj, ForceCreation); v->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor; } else { - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","\"%1\" cannot operate on \"%2\"").arg(QString::fromUtf8(v->object->typeName)).arg(QString::fromUtf8(prop->name.constData()))); + COMPILE_EXCEPTION(v, tr("\"%1\" cannot operate on \"%2\"").arg(QString::fromUtf8(v->object->typeName)).arg(QString::fromUtf8(prop->name.constData()))); } return true; @@ -2211,7 +2211,7 @@ bool QDeclarativeCompiler::testQualifiedEnumAssignment(const QMetaProperty &prop return true; if (!prop.isWritable()) - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name()))); + COMPILE_EXCEPTION(v, tr("Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name()))); QString string = v->value.asString(); if (!string.at(0).isUpper()) @@ -2280,32 +2280,32 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) if (prop.isDefaultProperty) { if (seenDefaultProperty) - COMPILE_EXCEPTION(&prop, QCoreApplication::translate("QDeclarativeCompiler","Duplicate default property")); + COMPILE_EXCEPTION(&prop, tr("Duplicate default property")); seenDefaultProperty = true; } if (propNames.contains(prop.name)) - COMPILE_EXCEPTION(&prop, QCoreApplication::translate("QDeclarativeCompiler","Duplicate property name")); + COMPILE_EXCEPTION(&prop, tr("Duplicate property name")); if (QString::fromUtf8(prop.name).at(0).isUpper()) - COMPILE_EXCEPTION(&prop, QCoreApplication::translate("QDeclarativeCompiler","Property names cannot begin with an upper case letter")); + COMPILE_EXCEPTION(&prop, tr("Property names cannot begin with an upper case letter")); propNames.insert(prop.name); } for (int ii = 0; ii < obj->dynamicSignals.count(); ++ii) { QByteArray name = obj->dynamicSignals.at(ii).name; if (methodNames.contains(name)) - COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Duplicate signal name")); + COMPILE_EXCEPTION(obj, tr("Duplicate signal name")); if (QString::fromUtf8(name).at(0).isUpper()) - COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Signal names cannot begin with an upper case letter")); + COMPILE_EXCEPTION(obj, tr("Signal names cannot begin with an upper case letter")); methodNames.insert(name); } for (int ii = 0; ii < obj->dynamicSlots.count(); ++ii) { QByteArray name = obj->dynamicSlots.at(ii).name; if (methodNames.contains(name)) - COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Duplicate method name")); + COMPILE_EXCEPTION(obj, tr("Duplicate method name")); if (QString::fromUtf8(name).at(0).isUpper()) - COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","Method names cannot begin with an upper case letter")); + COMPILE_EXCEPTION(obj, tr("Method names cannot begin with an upper case letter")); methodNames.insert(name); } @@ -2326,11 +2326,11 @@ bool QDeclarativeCompiler::mergeDynamicMetaProperties(QDeclarativeParser::Object } else { property = obj->getProperty(p.name); if (!property->values.isEmpty()) - COMPILE_EXCEPTION(property, QCoreApplication::translate("QDeclarativeCompiler","Property value set multiple times")); + COMPILE_EXCEPTION(property, tr("Property value set multiple times")); } if (property->value) - COMPILE_EXCEPTION(property, QCoreApplication::translate("QDeclarativeCompiler","Invalid property nesting")); + COMPILE_EXCEPTION(property, tr("Invalid property nesting")); for (int ii = 0; ii < p.defaultValue->values.count(); ++ii) { Value *v = p.defaultValue->values.at(ii); @@ -2383,7 +2383,7 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn if (-1 != propIdx) { QMetaProperty prop = obj->metaObject()->property(propIdx); if (prop.isFinal()) - COMPILE_EXCEPTION(&p, QCoreApplication::translate("QDeclarativeCompiler","Cannot override FINAL property")); + COMPILE_EXCEPTION(&p, tr("Cannot override FINAL property")); } if (p.isDefaultProperty && @@ -2408,7 +2408,7 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(engine); if (!priv->resolveType(unit->imports, p.customType, &qmltype, &url, 0, 0, 0)) - COMPILE_EXCEPTION(&p, QCoreApplication::translate("QDeclarativeCompiler","Invalid property type")); + COMPILE_EXCEPTION(&p, tr("Invalid property type")); if (!qmltype) { QDeclarativeCompositeTypeData *tdata = priv->typeManager.get(url); @@ -2567,24 +2567,24 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn bool QDeclarativeCompiler::checkValidId(QDeclarativeParser::Value *v, const QString &val) { if (val.isEmpty()) - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "Invalid empty ID")); + COMPILE_EXCEPTION(v, tr( "Invalid empty ID")); if (val.at(0).isLetter() && !val.at(0).isLower()) - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "IDs cannot start with an uppercase letter")); + COMPILE_EXCEPTION(v, tr( "IDs cannot start with an uppercase letter")); QChar u(QLatin1Char('_')); for (int ii = 0; ii < val.count(); ++ii) { if (ii == 0 && !val.at(ii).isLetter() && val.at(ii) != u) { - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "IDs must start with a letter or underscore")); + COMPILE_EXCEPTION(v, tr( "IDs must start with a letter or underscore")); } else if (ii != 0 && !val.at(ii).isLetterOrNumber() && val.at(ii) != u) { - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "IDs must contain only letters, numbers, and underscores")); + COMPILE_EXCEPTION(v, tr( "IDs must contain only letters, numbers, and underscores")); } } if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(val)) - COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "ID illegally masks global JavaScript property")); + COMPILE_EXCEPTION(v, tr( "ID illegally masks global JavaScript property")); return true; } @@ -2615,24 +2615,24 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder, const Object::DynamicProperty &prop) { if (!prop.defaultValue) - COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","No property alias location")); + COMPILE_EXCEPTION(obj, tr("No property alias location")); if (prop.defaultValue->values.count() != 1 || prop.defaultValue->values.at(0)->object || !prop.defaultValue->values.at(0)->value.isScript()) - COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QDeclarativeCompiler","Invalid alias location")); + COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location")); QDeclarativeJS::AST::Node *node = prop.defaultValue->values.at(0)->value.asAST(); if (!node) - COMPILE_EXCEPTION(obj, QCoreApplication::translate("QDeclarativeCompiler","No property alias location")); // ### Can this happen? + COMPILE_EXCEPTION(obj, tr("No property alias location")); // ### Can this happen? QStringList alias = astNodeToStringList(node); if (alias.count() != 1 && alias.count() != 2) - COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QDeclarativeCompiler","Invalid alias reference. An alias reference must be specified as or .")); + COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias reference. An alias reference must be specified as or .")); if (!compileState.ids.contains(alias.at(0))) - COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QDeclarativeCompiler","Invalid alias reference. Unable to find id \"%1\"").arg(alias.at(0))); + COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias reference. Unable to find id \"%1\"").arg(alias.at(0))); Object *idObject = compileState.ids[alias.at(0)]; @@ -2645,7 +2645,7 @@ bool QDeclarativeCompiler::compileAlias(QMetaObjectBuilder &builder, propIdx = idObject->metaObject()->indexOfProperty(alias.at(1).toUtf8().constData()); if (-1 == propIdx) - COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QDeclarativeCompiler","Invalid alias location")); + COMPILE_EXCEPTION(prop.defaultValue, tr("Invalid alias location")); QMetaProperty aliasProperty = idObject->metaObject()->property(propIdx); writable = aliasProperty.isWritable(); @@ -2699,7 +2699,7 @@ bool QDeclarativeCompiler::buildBinding(QDeclarativeParser::Value *value, QMetaProperty mp = prop->parent->metaObject()->property(prop->index); if (!mp.isWritable() && !QDeclarativeMetaType::isList(prop->type)) - COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name))); + COMPILE_EXCEPTION(prop, tr("Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name))); BindingReference reference; reference.expression = value->value; @@ -2976,4 +2976,9 @@ QStringList QDeclarativeCompiler::deferredProperties(QDeclarativeParser::Object return rv; } +QString QDeclarativeCompiler::tr(const char *str) +{ + return QCoreApplication::translate("QDeclarativeCompiler", str); +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index 11364bb..0e47774 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -281,6 +281,8 @@ private: void addId(const QString &, QDeclarativeParser::Object *); + QString tr(const char *); + void dumpStats(); struct BindingReference { -- cgit v0.12 From bfc6a32c2a203766a6debdf19a265a4f0e198403 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 8 Apr 2010 12:19:01 +0200 Subject: Add Mac OS X bundle description for qml runtime Also, it's now Qml.app instead of qml.app. An icon is still missing. Reviewed-by: con --- tools/qml/Info_mac.plist | 16 ++++++++++++++++ tools/qml/qml.pro | 4 ++++ 2 files changed, 20 insertions(+) create mode 100644 tools/qml/Info_mac.plist diff --git a/tools/qml/Info_mac.plist b/tools/qml/Info_mac.plist new file mode 100644 index 0000000..ce4ebe3 --- /dev/null +++ b/tools/qml/Info_mac.plist @@ -0,0 +1,16 @@ + + + + + CFBundleIdentifier + com.nokia.qt.qml + CFBundlePackageType + APPL + CFBundleGetInfoString + Created by Qt/QMake + CFBundleSignature + @TYPEINFO@ + CFBundleExecutable + @EXECUTABLE@ + + diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index ba283b6..13b01f2 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -58,3 +58,7 @@ symbian { LIBS += -lesock -lcommdb -lconnmon -linsock TARGET.CAPABILITY = "All -TCB" } +mac { + QMAKE_INFO_PLIST=Info_mac.plist + TARGET=Qml +} -- cgit v0.12 From 04de70b0510365d32bc8fab9101dc51c01536ba9 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Mon, 12 Apr 2010 02:00:00 +0200 Subject: Fix graphicswidget auto-test. Reviewed-by:Michael Brasser --- .../graphicswidgets/data/graphicswidgets.qml | 85 ++++++++++------------ .../graphicswidgets/tst_graphicswidgets.cpp | 7 +- 2 files changed, 40 insertions(+), 52 deletions(-) diff --git a/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml b/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml index c00173d..714ae7c 100644 --- a/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml +++ b/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml @@ -1,58 +1,49 @@ import Qt 4.6 import Qt.widgets 4.6 -QGraphicsView { - objectName: "GView" - size: "800x600" - - QGraphicsScene { - objectName: "GScene" - sceneRect: "0,0,500x300" - +QGraphicsWidget { + layout: QGraphicsLinearLayout { + orientation: Qt.Horizontal QGraphicsWidget { layout: QGraphicsLinearLayout { - orientation: Qt.Horizontal - QGraphicsWidget { - layout: QGraphicsLinearLayout { - spacing: 10; orientation: Qt.Vertical - LayoutItem { - QGraphicsLinearLayout.stretchFactor: 1 - objectName: "left" - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "100x100" - Rectangle { objectName: "yellowRect"; color: "yellow"; anchors.fill: parent } - } - LayoutItem { - QGraphicsLinearLayout.stretchFactor: 10 - objectName: "left" - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "100x100" - Rectangle { objectName: "yellowRect"; color: "blue"; anchors.fill: parent } - } - } + spacing: 10; orientation: Qt.Vertical + LayoutItem { + QGraphicsLinearLayout.stretchFactor: 1 + objectName: "left" + minimumSize: "100x100" + maximumSize: "300x300" + preferredSize: "100x100" + Rectangle { objectName: "yellowRect"; color: "yellow"; anchors.fill: parent } } - QGraphicsWidget { - layout: QGraphicsLinearLayout { - spacing: 10; orientation: Qt.Vertical - LayoutItem { - objectName: "left" - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "100x100" - Rectangle { objectName: "yellowRect"; color: "red"; anchors.fill: parent } - } - LayoutItem { - objectName: "left" - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "100x100" - Rectangle { objectName: "yellowRect"; color: "green"; anchors.fill: parent } - } - } + LayoutItem { + QGraphicsLinearLayout.stretchFactor: 10 + objectName: "left" + minimumSize: "100x100" + maximumSize: "300x300" + preferredSize: "100x100" + Rectangle { objectName: "yellowRect"; color: "blue"; anchors.fill: parent } + } + } + } + QGraphicsWidget { + layout: QGraphicsLinearLayout { + spacing: 10; orientation: Qt.Vertical + LayoutItem { + objectName: "left" + minimumSize: "100x100" + maximumSize: "300x300" + preferredSize: "100x100" + Rectangle { objectName: "yellowRect"; color: "red"; anchors.fill: parent } + } + LayoutItem { + objectName: "left" + minimumSize: "100x100" + maximumSize: "300x300" + preferredSize: "100x100" + Rectangle { objectName: "yellowRect"; color: "green"; anchors.fill: parent } } } } } } + diff --git a/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp b/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp index a85ceed..f1a71d5 100644 --- a/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp +++ b/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include class tst_graphicswidgets : public QObject @@ -63,12 +63,9 @@ void tst_graphicswidgets::widgets() { QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/graphicswidgets.qml")); - QGraphicsView *obj = qobject_cast(c.create()); + QGraphicsWidget *obj = qobject_cast(c.create()); QVERIFY(obj != 0); - QVERIFY(obj->scene() != 0); - QList list; - QVERIFY(obj->scene()->children() != list); delete obj; } -- cgit v0.12 From bf68ae221cc5b14612b638c6a162d8c5d0e3cf2c Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Apr 2010 10:26:27 +1000 Subject: Doc --- doc/src/declarative/extending.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index b6aa9da..e1c6469 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -655,7 +655,7 @@ declaring a new property, and the corresponding C++ type. \row \o url \o QUrl \row \o color \o QColor \row \o date \o QDateTime -\row \o var \o QVariant +\row \o variant \o QVariant \endtable QML supports two methods for adding a new property to a type: a new property @@ -852,7 +852,7 @@ Here are three examples of signal declarations: Item { signal clicked signal hovered() - signal performAction(string action, var actionArgument) + signal performAction(string action, variant actionArgument) } \endcode -- cgit v0.12 From 0eb289bada4edb57de83d690c904a9c77c23caa2 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Apr 2010 10:34:27 +1000 Subject: Revert "Better reporting of extension plugin loading errors." This reverts commit e0dcdbd2984299665b9b784b201289219b9978d3. --- src/declarative/qml/qdeclarativeengine.cpp | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index e459d0f..a3a43e6 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1486,17 +1486,13 @@ public: QSet qmlDirFilesForWhichPluginsHaveBeenLoaded; - QDeclarativeDirComponents importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine, QString *errorString) { + QDeclarativeDirComponents importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine) { QFile file(absoluteFilePath); QString filecontent; if (file.open(QFile::ReadOnly)) { filecontent = QString::fromUtf8(file.readAll()); if (qmlImportTrace()) qDebug() << "QDeclarativeEngine::add: loaded" << absoluteFilePath; - } else { - if (errorString) - *errorString = QDeclarativeEngine::tr("module \"%1\" definition \"%2\" not readable").arg(uri).arg(absoluteFilePath); - return QDeclarativeDirComponents(); } QDir dir = QFileInfo(file).dir(); @@ -1516,15 +1512,7 @@ public: plugin.name); if (!resolvedFilePath.isEmpty()) { - if (!engine->importPlugin(resolvedFilePath, uri)) { - if (errorString) - *errorString = QDeclarativeEngine::tr("plugin \"%1\" cannot be loaded for module \"%2\"").arg(resolvedFilePath).arg(uri); - return QDeclarativeDirComponents(); - } - } else { - if (errorString) - *errorString = QDeclarativeEngine::tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name); - return QDeclarativeDirComponents(); + engine->importPlugin(resolvedFilePath, uri); } } } @@ -1589,9 +1577,7 @@ public: url = QUrl::fromLocalFile(fi.absolutePath()).toString(); uri = resolvedUri(dir, engine); - qmldircomponents = importExtension(absoluteFilePath, uri, engine, errorString); - if (qmldircomponents.isEmpty()) // error (or empty) - return false; + qmldircomponents = importExtension(absoluteFilePath, uri, engine); break; } } @@ -1622,14 +1608,12 @@ public: return false; // local import dirs must exist } uri = resolvedUri(toLocalFileOrQrc(base.resolved(QUrl(uri))), engine); + qmldircomponents = importExtension(localFileOrQrc, + uri, + engine); + if (uri.endsWith(QLatin1Char('/'))) uri.chop(1); - if (QFile::exists(localFileOrQrc)) { - qmldircomponents = importExtension(localFileOrQrc, - uri,engine,errorString); - if (qmldircomponents.isEmpty()) // error (or empty) - return false; - } } else { if (prefix.isEmpty()) { // directory must at least exist for valid import -- cgit v0.12 From 2096a93fffa4b8986ea0bd6d93aa1457b8f359e2 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Mon, 12 Apr 2010 11:02:13 +1000 Subject: Adds missing qml file to qdeclarativeflipable autotest --- .../declarative/qdeclarativeflipable/data/flipable-abort.qml | 10 ++++++++++ .../qdeclarativeflipable/tst_qdeclarativeflipable.cpp | 4 ++++ 2 files changed, 14 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativeflipable/data/flipable-abort.qml diff --git a/tests/auto/declarative/qdeclarativeflipable/data/flipable-abort.qml b/tests/auto/declarative/qdeclarativeflipable/data/flipable-abort.qml new file mode 100644 index 0000000..f6f2014 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeflipable/data/flipable-abort.qml @@ -0,0 +1,10 @@ +import Qt 4.6 + +Rectangle { + Flipable { + id: flipable + } + Rectangle { + visible: flipable.side == Flipable.Front + } +} diff --git a/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp b/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp index 4beee9a..7e5c3dd 100644 --- a/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp +++ b/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp @@ -117,6 +117,8 @@ void tst_qdeclarativeflipable::QTBUG_9161_crash() { QDeclarativeView *canvas = new QDeclarativeView; canvas->setSource(QUrl(SRCDIR "/data/crash.qml")); + QGraphicsObject *root = canvas->rootObject(); + QVERIFY(root != 0); canvas->show(); delete canvas; } @@ -125,6 +127,8 @@ void tst_qdeclarativeflipable::QTBUG_8474_qgv_abort() { QDeclarativeView *canvas = new QDeclarativeView; canvas->setSource(QUrl(SRCDIR "/data/flipable-abort.qml")); + QGraphicsObject *root = canvas->rootObject(); + QVERIFY(root != 0); canvas->show(); delete canvas; } -- cgit v0.12 From bb491c3b9ee2034e14d05a74f3ff926ffd2cd39b Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 12 Apr 2010 11:25:06 +1000 Subject: Start documenting coding conventions Task-number: QT-2845 --- doc/src/declarative/codingconventions.qdoc | 131 +++++++++++++++++++++ doc/src/declarative/declarativeui.qdoc | 9 +- doc/src/declarative/javascriptblocks.qdoc | 72 +++++------ .../codingconventions/dotproperties.qml | 28 +++++ .../codingconventions/javascript-imports.qml | 7 ++ .../declarative/codingconventions/javascript.qml | 33 ++++++ .../declarative/codingconventions/lists.qml | 22 ++++ .../declarative/codingconventions/myscript.js | 9 ++ .../declarative/codingconventions/photo.qml | 37 ++++++ 9 files changed, 308 insertions(+), 40 deletions(-) create mode 100644 doc/src/declarative/codingconventions.qdoc create mode 100644 doc/src/snippets/declarative/codingconventions/dotproperties.qml create mode 100644 doc/src/snippets/declarative/codingconventions/javascript-imports.qml create mode 100644 doc/src/snippets/declarative/codingconventions/javascript.qml create mode 100644 doc/src/snippets/declarative/codingconventions/lists.qml create mode 100644 doc/src/snippets/declarative/codingconventions/myscript.js create mode 100644 doc/src/snippets/declarative/codingconventions/photo.qml diff --git a/doc/src/declarative/codingconventions.qdoc b/doc/src/declarative/codingconventions.qdoc new file mode 100644 index 0000000..ad2480f --- /dev/null +++ b/doc/src/declarative/codingconventions.qdoc @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page codingconventions.html +\title QML Coding Conventions + +This document contains the QML coding conventions that we follow in our documentation and examples and recommend that others follow. + +This page assumes that you are already familiar with the QML language. +If you need an introduction to the language, please read \l {Introduction to the QML language}{the QML introduction} first. + + +\section1 QML objects + +Through our documentation and examples, QML objects are always structured in the following order: + +\list +\o id +\o property declarations +\o signal declarations +\o javascript functions +\o object properties +\o child objects +\o states +\o transitions +\endlist + +For better lisibility, we separate these different parts with an empty line. + + +For example, a hypothetical \e photo QML object would look like this: + +\snippet doc/src/snippets/declarative/codingconventions/photo.qml 0 + + +\section1 Grouped properties + +If using multiple properties from a group of properties, +we use the \e {group notation} rather than the \e {dot notation} to improve lisibility. + +For example, this: + +\snippet doc/src/snippets/declarative/codingconventions/dotproperties.qml 0 + +can be written like this: + +\snippet doc/src/snippets/declarative/codingconventions/dotproperties.qml 1 + + +\section1 Lists + +If a list contains only one element, we generally omit the square brackets. + +For example, it is very common for a component to only have one state. + +In this case, instead of: + +\snippet doc/src/snippets/declarative/codingconventions/lists.qml 0 + +we will write this: + +\snippet doc/src/snippets/declarative/codingconventions/lists.qml 1 + + +\section1 Javascript + +If the script is a single expression, we recommend writing it inline: + +\snippet doc/src/snippets/declarative/codingconventions/javascript.qml 0 + +If the script is only a couple of lines long, we generally use a block: + +\snippet doc/src/snippets/declarative/codingconventions/javascript.qml 1 + +If the script is more than a couple of lines long or can be used by different objects, we recommend creating a function and calling it like this: + +\snippet doc/src/snippets/declarative/codingconventions/javascript.qml 2 + +For long scripts, we will put the functions in their own javascript file and import it like this: + +\snippet doc/src/snippets/declarative/codingconventions/javascript-imports.qml 0 + +*/ + + + + + + + + + diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index f310484..a4f4bc7 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -47,10 +47,10 @@ highly dynamic, custom user interfaces. Qt Declarative UI provides a declarative framework for building highly dynamic, custom -user interfaces. Declarative UI helps programmers and designers collaborate to build -the animation rich, fluid user interfaces that are becoming common in portable -consumer devices, such as mobile phones, media players, set-top boxes and netbooks. -The Qt Declarative module provides an engine for interpreting the declarative QML +user interfaces. Declarative UI helps programmers and designers collaborate to build +the animation rich, fluid user interfaces that are becoming common in portable +consumer 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}{QML elements} that can be used from QML. @@ -106,5 +106,6 @@ completely new applications. QML is fully \l {Extending QML in C++}{extensible \o \l {QML Security} \o \l {QtDeclarative Module} \o \l {Debugging QML} +\o \l {QML Coding Conventions} \endlist */ diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc index 3544bc9..d2926f7 100644 --- a/doc/src/declarative/javascriptblocks.qdoc +++ b/doc/src/declarative/javascriptblocks.qdoc @@ -41,25 +41,25 @@ /*! \page qdeclarativejavascript.html -\title Integrating JavaScript +\title Integrating JavaScript -QML encourages building UIs declaratively, using \l {Property Binding} and the +QML encourages building UIs declaratively, using \l {Property Binding} and the composition of existing \l {QML Elements}. To allow the implementation of more advanced behavior, QML integrates tightly with imperative JavaScript code. The JavaScript environment provided by QML is stricter than that in a webbrowser. In QML you cannot add, or modify, members of the JavaScript global object. It is possible to do this accidentally by using a variable without declaring it. In -QML this will throw an exception, so all local variables should be explicitly +QML this will throw an exception, so all local variables should be explicitly declared. -In addition to the standard JavaScript properties, the \l {QML Global Object} +In addition to the standard JavaScript properties, the \l {QML Global Object} includes a number of helper methods that simplify building UIs and interacting with the QML environment. \section1 Inline JavaScript -Small JavaScript functions can be written inline with other QML declarations. +Small JavaScript functions can be written inline with other QML declarations. These inline functions are added as methods to the QML element that contains them. @@ -73,21 +73,21 @@ Item { return a * factorial(a - 1); } - MouseRegion { + MouseArea { anchors.fill: parent onClicked: print(factorial(10)) } } \endcode -As methods, inline functions on the root element in a QML component can be +As methods, inline functions on the root element in a QML component can be invoked by callers outside the component. If this is not desired, the method can be added to a non-root element or, preferably, written in an external JavaScript file. \section1 Separate JavaScript files -Large blocks of JavaScript should be written in separate files. Like element +Large blocks of JavaScript should be written in separate files. Like element types, external JavaScript files are \c {import}'ed into QML files. The \c {factorial()} method used in the \l {Inline JavaScript} section could @@ -96,35 +96,35 @@ be refactored into an external file, and accessed like this. \code import "factorial.js" as MathFunctions Item { - MouseRegion { + MouseArea { anchors.fill: parent onClicked: print(MathFunctions.factorial(10)) } } \endcode -Both relative and absolute JavaScript URLs can be imported. In the case of a -relative URL, the location is resolved relative to the location of the -\l {QML Document} that contains the import. If the script file is not accessible, -an error will occur. If the JavaScript needs to be fetched from a network -resource, the QML document will remain in the -\l {QDeclarativeComponent::status()}{waiting state} until the script has been +Both relative and absolute JavaScript URLs can be imported. In the case of a +relative URL, the location is resolved relative to the location of the +\l {QML Document} that contains the import. If the script file is not accessible, +an error will occur. If the JavaScript needs to be fetched from a network +resource, the QML document will remain in the +\l {QDeclarativeComponent::status()}{waiting state} until the script has been downloaded. -Imported JavaScript files are always qualified using the "as" keyword. The +Imported JavaScript files are always qualified using the "as" keyword. The qualifier for JavaScript files must be unique, so there is always a one-to-one mapping between qualifiers and JavaScript files. \section2 Code-Behind Implementation Files -Most JavaScript files imported into a QML file are stateful, logic implementations -for the QML file importing them. In these cases, for QML component instances to -behave correctly each instance requires a separate copy of the JavaScript objects +Most JavaScript files imported into a QML file are stateful, logic implementations +for the QML file importing them. In these cases, for QML component instances to +behave correctly each instance requires a separate copy of the JavaScript objects and state. The default behavior when importing JavaScript files is to provide a unique, isolated -copy for each QML component instance. The code runs in the same scope as the QML -component instance and consequently can can access and manipulate the objects and +copy for each QML component instance. The code runs in the same scope as the QML +component instance and consequently can can access and manipulate the objects and properties declared. \section2 Stateless JavaScript libraries @@ -133,8 +133,8 @@ Some JavaScript files act more like libraries - they provide a set of stateless helper functions that take input and compute output, but never manipulate QML component instances directly. -As it would be wasteful for each QML component instance to have a unique copy of -these libraries, the JavaScript programmer can indicate a particular file is a +As it would be wasteful for each QML component instance to have a unique copy of +these libraries, the JavaScript programmer can indicate a particular file is a stateless library through the use of a pragma, as shown in the following example. \code @@ -161,7 +161,7 @@ parameters. It is occasionally necessary to run some imperative code at application (or component instance) "startup". While it is tempting to just include the startup script as \e {global code} in an external script file, this can have severe limitations -as the QML environment may not have been fully established. For example, some objects +as the QML environment may not have been fully established. For example, some objects might not have been created or some \l {Property Binding}s may not have been run. \l {QML JavaScript Restrictions} covers the exact limitations of global script code. @@ -181,25 +181,25 @@ Rectangle { } \endcode -Any element in a QML file - including nested elements and nested QML component -instances - can use this attached property. If there is more than one onCompleted +Any element in a QML file - including nested elements and nested QML component +instances - can use this attached property. If there is more than one onCompleted handler to execute at startup, they are run sequentially in an undefined order. -\section1 QML JavaScript Restrictions +\section1 QML JavaScript Restrictions QML executes standard JavaScript code, with the following restrictions: \list \o JavaScript code cannot modify the global object. -In QML, the global object is constant - existing properties cannot be modified or +In QML, the global object is constant - existing properties cannot be modified or deleted, and no new properties may be created. -Most JavaScript programs do not intentionally modify the global object. However, +Most JavaScript programs do not intentionally modify the global object. However, JavaScript's automatic creation of undeclared variables is an implicit modification of the global object, and is prohibited in QML. -Assuming that the \c a variable does not exist in the scope chain, the following code +Assuming that the \c a variable does not exist in the scope chain, the following code is illegal in QML. \code @@ -217,18 +217,18 @@ for (var ii = 1; ii < 10; ++ii) a = a * ii; console.log("Result: " + a); \endcode -Any attempt to modify the global object - either implicitly or explicitly - will -cause an exception. If uncaught, this will result in an warning being printed, +Any attempt to modify the global object - either implicitly or explicitly - will +cause an exception. If uncaught, this will result in an warning being printed, that includes the file and line number of the offending code. \o Global code is run in a reduced scope During startup, if a QML file includes an external JavaScript file with "global" code, it is executed in a scope that contains only the external file itself and -the global object. That is, it will not have access to the QML objects and +the global object. That is, it will not have access to the QML objects and properties it \l {QML Scope}{normally would}. -Global code that only accesses script local variable is permitted. This is an +Global code that only accesses script local variable is permitted. This is an example of valid global code. \code @@ -242,8 +242,8 @@ Global code that accesses QML objects will not run correctly. var initialPosition = { rootObject.x, rootObject.y } \endcode -This restriction exists as the QML environment is not yet fully established. -To run code after the environment setup has completed, refer to +This restriction exists as the QML environment is not yet fully established. +To run code after the environment setup has completed, refer to \l {Running JavaScript at Startup}. \endlist diff --git a/doc/src/snippets/declarative/codingconventions/dotproperties.qml b/doc/src/snippets/declarative/codingconventions/dotproperties.qml new file mode 100644 index 0000000..211cac1 --- /dev/null +++ b/doc/src/snippets/declarative/codingconventions/dotproperties.qml @@ -0,0 +1,28 @@ +import Qt 4.6 + +Item { + +//! [0] +Rectangle { + anchors.left: parent.left; anchors.top: parent.top; anchors.right: parent.right; anchors.leftMargin: 20 +} + +Text { + text: "hello" + font.bold: true; font.italic: true; font.pixelSize: 20; font.capitalization: Font.AllUppercase +} + +//! [0] + +//! [1] +Rectangle { + anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: 20 } +} + +Text { + text: "hello" + font { bold: true; italic: true; pixelSize: 20; capitalization: Font.AllUppercase } +} +//! [1] + +} diff --git a/doc/src/snippets/declarative/codingconventions/javascript-imports.qml b/doc/src/snippets/declarative/codingconventions/javascript-imports.qml new file mode 100644 index 0000000..a216e1c --- /dev/null +++ b/doc/src/snippets/declarative/codingconventions/javascript-imports.qml @@ -0,0 +1,7 @@ +import Qt 4.6 + +//![0] +import "myscript.js" as Script + +Rectangle { color: "blue"; width: Script.calculateWidth(parent) } +//![0] diff --git a/doc/src/snippets/declarative/codingconventions/javascript.qml b/doc/src/snippets/declarative/codingconventions/javascript.qml new file mode 100644 index 0000000..ccb299b --- /dev/null +++ b/doc/src/snippets/declarative/codingconventions/javascript.qml @@ -0,0 +1,33 @@ +import Qt 4.6 + +Rectangle { + +//![0] +Rectangle { color: "blue"; width: parent.width / 3 } +//![0] + +//![1] +Rectangle { + color: "blue" + width: { + var w = parent.width / 3 + console.debug(w) + return w + } +} +//![1] + +//![2] +function calculateWidth(object) +{ + var w = object.width / 3 + // ... + // more javascript code + // ... + console.debug(w) + return w +} + +Rectangle { color: "blue"; width: calculateWidth(parent) } +//![2] +} diff --git a/doc/src/snippets/declarative/codingconventions/lists.qml b/doc/src/snippets/declarative/codingconventions/lists.qml new file mode 100644 index 0000000..a08b61c --- /dev/null +++ b/doc/src/snippets/declarative/codingconventions/lists.qml @@ -0,0 +1,22 @@ +import Qt 4.6 + +Item { + Item { +//! [0] +states: [ + State { + name: "open" + PropertyChanges { target: container; width: 200 } + } +] +//! [0] + } + Item { +//! [1] + states: State { + name: "open" + PropertyChanges { target: container; width: 200 } +} +//! [1] + } +} diff --git a/doc/src/snippets/declarative/codingconventions/myscript.js b/doc/src/snippets/declarative/codingconventions/myscript.js new file mode 100644 index 0000000..cfa6462 --- /dev/null +++ b/doc/src/snippets/declarative/codingconventions/myscript.js @@ -0,0 +1,9 @@ +function calculateWidth(parent) +{ + var w = parent.width / 3 + // ... + // more javascript code + // ... + console.debug(w) + return w +} diff --git a/doc/src/snippets/declarative/codingconventions/photo.qml b/doc/src/snippets/declarative/codingconventions/photo.qml new file mode 100644 index 0000000..3a59e1f --- /dev/null +++ b/doc/src/snippets/declarative/codingconventions/photo.qml @@ -0,0 +1,37 @@ +import Qt 4.6 + +//! [0] +Rectangle { + id: photo // id on the first line makes it easy to find an object + + property bool thumbnail: false // property declarations + property alias image: photoImage.source + + signal clicked // signal declarations + + function doSomething(x) { // javascript functions + return x + photoImage.width + } + + x: 20; y: 20; width: 200; height: 150 // object properties + color: "gray" // try to group related properties together + + Rectangle { // child objects + id: border + anchors.centerIn: parent; color: "white" + + Image { id: photoImage; anchors.centerIn: parent } + } + + states: State { // states + name: "selected" + PropertyChanges { target: border; color: "red" } + } + + transitions: Transition { // transitions + from: ""; to: "selected" + ColorAnimation { target: border; duration: 200 } + } +} +//! [0] + -- cgit v0.12 From 095695cb15f595a8dd91a6f76418a51a195d9fb7 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 12 Apr 2010 11:45:11 +1000 Subject: doc fixes --- doc/src/declarative/codingconventions.qdoc | 4 ++-- doc/src/snippets/declarative/codingconventions/lists.qml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/declarative/codingconventions.qdoc b/doc/src/declarative/codingconventions.qdoc index ad2480f..e1e7871 100644 --- a/doc/src/declarative/codingconventions.qdoc +++ b/doc/src/declarative/codingconventions.qdoc @@ -64,7 +64,7 @@ Through our documentation and examples, QML objects are always structured in the \o transitions \endlist -For better lisibility, we separate these different parts with an empty line. +For better readability, we separate these different parts with an empty line. For example, a hypothetical \e photo QML object would look like this: @@ -75,7 +75,7 @@ For example, a hypothetical \e photo QML object would look like this: \section1 Grouped properties If using multiple properties from a group of properties, -we use the \e {group notation} rather than the \e {dot notation} to improve lisibility. +we use the \e {group notation} rather than the \e {dot notation} to improve readability. For example, this: diff --git a/doc/src/snippets/declarative/codingconventions/lists.qml b/doc/src/snippets/declarative/codingconventions/lists.qml index a08b61c..b8cc8a3 100644 --- a/doc/src/snippets/declarative/codingconventions/lists.qml +++ b/doc/src/snippets/declarative/codingconventions/lists.qml @@ -13,7 +13,7 @@ states: [ } Item { //! [1] - states: State { +states: State { name: "open" PropertyChanges { target: container; width: 200 } } -- cgit v0.12 From 56dcdee39b99b52a321802274723f8823e3ab408 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Apr 2010 11:47:17 +1000 Subject: Fix crash on QScriptProgram destruction --- src/script/api/qscriptprogram.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/script/api/qscriptprogram.cpp b/src/script/api/qscriptprogram.cpp index 8d4de11..02beba4 100644 --- a/src/script/api/qscriptprogram.cpp +++ b/src/script/api/qscriptprogram.cpp @@ -63,6 +63,10 @@ QScriptProgramPrivate::QScriptProgramPrivate(const QString &src, QScriptProgramPrivate::~QScriptProgramPrivate() { + if (engine) { + QScript::APIShim shim(engine); + _executable.clear(); + } } QScriptProgramPrivate *QScriptProgramPrivate::get(const QScriptProgram &q) -- cgit v0.12 From e87169f3f2f7ddbc167075921c3a80cf805197dc Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Apr 2010 12:01:24 +1000 Subject: Exclude proxywidgets from examples autotest --- tests/auto/declarative/examples/tst_examples.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 8fd5ac0..e2fa029 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -79,6 +79,7 @@ tst_examples::tst_examples() // Add directories you want excluded here excludedDirs << "examples/declarative/extending"; excludedDirs << "examples/declarative/plugins"; + excludedDirs << "examples/declarative/proxywidgets"; } /* -- cgit v0.12 From 23c60d17534cc2d5d980aa14d5dae5327de83032 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Apr 2010 12:03:43 +1000 Subject: Exclude gestures from examples autotest --- tests/auto/declarative/examples/tst_examples.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index e2fa029..61ac2d1 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -80,6 +80,7 @@ tst_examples::tst_examples() excludedDirs << "examples/declarative/extending"; excludedDirs << "examples/declarative/plugins"; excludedDirs << "examples/declarative/proxywidgets"; + excludedDirs << "examples/declarative/gestures"; } /* -- cgit v0.12 From 0bce55e480e627239ea973c3abf58d90c2d1d478 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Apr 2010 13:15:25 +1000 Subject: Read Maemo orientation at startup QT-2695 --- tools/qml/deviceorientation_maemo.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tools/qml/deviceorientation_maemo.cpp b/tools/qml/deviceorientation_maemo.cpp index fa2c6e5..af90b02 100644 --- a/tools/qml/deviceorientation_maemo.cpp +++ b/tools/qml/deviceorientation_maemo.cpp @@ -50,6 +50,10 @@ public: MaemoOrientation() : DeviceOrientation(),m_current(Portrait), m_lastSeen(Portrait), m_lastSeenCount(0) { + m_current = get(); + if (m_current == UnknownOrientation) + m_current = Portrait; + startTimer(100); } @@ -57,14 +61,7 @@ public: return m_current; } - void setOrientation(Orientation orient) { - //XXX maybe better to just ignore - if (orient != m_current) { - m_current = orient; - emit orientationChanged(); - } - } - + void setOrientation(Orientation orient) { } protected: virtual void timerEvent(QTimerEvent *) -- cgit v0.12 From b6a50a14189da153e93aef581c30863608399714 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Apr 2010 13:16:37 +1000 Subject: Warning --- tools/qml/deviceorientation_maemo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qml/deviceorientation_maemo.cpp b/tools/qml/deviceorientation_maemo.cpp index af90b02..9f12f3d 100644 --- a/tools/qml/deviceorientation_maemo.cpp +++ b/tools/qml/deviceorientation_maemo.cpp @@ -61,7 +61,7 @@ public: return m_current; } - void setOrientation(Orientation orient) { } + void setOrientation(Orientation) { } protected: virtual void timerEvent(QTimerEvent *) -- cgit v0.12 From 20a00436174faf746be14f5c36908710eeb44101 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 12 Apr 2010 14:40:52 +1000 Subject: Doc fixes --- doc/src/declarative/advtutorial.qdoc | 14 ++++++-------- doc/src/declarative/javascriptblocks.qdoc | 19 +++++++++---------- doc/src/declarative/qdeclarativesecurity.qdoc | 4 ++-- src/declarative/util/qdeclarativelistmodel.cpp | 15 +++++++++++++++ 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 4d3bfa8..4807fd2 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -175,12 +175,10 @@ and moves the new block to its position on the game canvas. This involves severa \list \o \l {createComponent(url file)}{createComponent()} is called to generate an element from \c Block.qml. If the component is ready, we can call \c createObject() to create an instance of the \c Block item. - (If a component is loaded remotely - over HTTP for example - then we would have to wait for the - component to finish loading before calling \c createObject()). \o If \c createObject() returned null (i.e. if there was an error while loading the object), print the error information. \o Place the block in its position on the board and set its width and height. - Also, store in the blocks array for future reference. + Also, store it in the blocks array for future reference. \o Finally, print error information to the console if the component could not be loaded for some reason (for example, if the file is missing). \endlist @@ -242,17 +240,17 @@ As this is a tutorial about QML, not game design, we will only discuss \c handle \section3 Enabling mouse click interaction -To make it easier for the JavaScript code to interface with the QML elements, we have added an Item called \c gameCanvas to \c samegame.qml. It replaces the background as the item which contains the blocks, and accepts mouse input from the user. Here is the item code: +To make it easier for the JavaScript code to interface with the QML elements, we have added an Item called \c gameCanvas to \c samegame.qml. It replaces the background as the item which contains the blocks. It also accepts mouse input from the user. Here is the item code: \snippet declarative/tutorials/samegame/samegame3/samegame.qml 1 -The \c gameCanvas item is the exact size of the board, and has a \c score property and a \l MouseArea for input. +The \c gameCanvas item is the exact size of the board, and has a \c score property and a \l MouseArea to handle mouse clicks. The blocks are now created as its children, and its dimensions are used to determine the board size so that the application scales to the available screen size. -Since its size is bound to a multiple of \c blockSize, \c blockSize needs to be moved out of \c samegame.js and into \c samegame.qml as a QML property. +Since its size is bound to a multiple of \c blockSize, \c blockSize was moved out of \c samegame.js and into \c samegame.qml as a QML property. Note that it can still be accessed from the script. -The \l MouseArea simply calls \c{handleClick()} in \c samegame.js, which determines whether the player's click should cause any blocks to be removed, and updates \c gameCanvas.score with the current score if necessary. Here is the \c handleClick() function: +When clicked, the \l MouseArea calls \c{handleClick()} in \c samegame.js, which determines whether the player's click should cause any blocks to be removed, and updates \c gameCanvas.score with the current score if necessary. Here is the \c handleClick() function: \snippet declarative/tutorials/samegame/samegame3/samegame.js 1 @@ -441,7 +439,7 @@ By following this tutorial you've seen how you can write a fully functional appl \o Build your application with \l {{QML Elements}}{QML elements} \o Add application logic \l{Integrating JavaScript}{with JavaScript code} \o Add animations with \l {Behavior}{Behaviors} and \l{QML States}{states} -\o Store persistent application data using the \l{Offline Storage API} or \l XMLHttpRequest +\o Store persistent application data using, for example, the \l{Offline Storage API} or \l XMLHttpRequest \endlist There is so much more to learn about QML that we haven't been able to cover in this tutorial. Check out all the diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc index 3544bc9..5fc3938 100644 --- a/doc/src/declarative/javascriptblocks.qdoc +++ b/doc/src/declarative/javascriptblocks.qdoc @@ -87,11 +87,12 @@ JavaScript file. \section1 Separate JavaScript files -Large blocks of JavaScript should be written in separate files. Like element -types, external JavaScript files are \c {import}'ed into QML files. +Large blocks of JavaScript should be written in separate files. These files +can be imported into QML files using an \c import statement, in the same way +that \l {Modules}{modules} are imported. -The \c {factorial()} method used in the \l {Inline JavaScript} section could -be refactored into an external file, and accessed like this. +For example, the \c {factorial()} method in the above example for \l {Inline JavaScript} +could be moved into an external file named \c factorial.js, and accessed like this: \code import "factorial.js" as MathFunctions @@ -107,8 +108,8 @@ Both relative and absolute JavaScript URLs can be imported. In the case of a relative URL, the location is resolved relative to the location of the \l {QML Document} that contains the import. If the script file is not accessible, an error will occur. If the JavaScript needs to be fetched from a network -resource, the QML document will remain in the -\l {QDeclarativeComponent::status()}{waiting state} until the script has been +resource, the QML document stays in the +\l {QDeclarativeComponent::status()}{"Loading" status} until the script has been downloaded. Imported JavaScript files are always qualified using the "as" keyword. The @@ -167,9 +168,7 @@ might not have been created or some \l {Property Binding}s may not have been run The QML \l Component element provides an \e attached \c onCompleted property that can be used to trigger the execution of script code at startup after the -QML environment has been completely established. - -The following QML code shows how to use the \c Component::onCompleted property. +QML environment has been completely established. For example: \code Rectangle { @@ -182,7 +181,7 @@ Rectangle { \endcode Any element in a QML file - including nested elements and nested QML component -instances - can use this attached property. If there is more than one onCompleted +instances - can use this attached property. If there is more than one \c onCompleted() handler to execute at startup, they are run sequentially in an undefined order. \section1 QML JavaScript Restrictions diff --git a/doc/src/declarative/qdeclarativesecurity.qdoc b/doc/src/declarative/qdeclarativesecurity.qdoc index 56216dd..ab75a57 100644 --- a/doc/src/declarative/qdeclarativesecurity.qdoc +++ b/doc/src/declarative/qdeclarativesecurity.qdoc @@ -72,7 +72,7 @@ A non-exhaustive list of the ways you could shoot yourself in the foot is: \list \i Using \c import to import QML or JavaScropt you do not control. BAD \i Using \l Loader to import QML you do not control. BAD - \i Using XMLHttpRequest to load data you do not control and executing it. BAD + \i Using \l{XMLHttpRequest()}{XMLHttpRequest} to load data you do not control and executing it. BAD \endlist However, the above does not mean that you have no use for the network transparency of QML. @@ -81,7 +81,7 @@ There are many good and useful things you \e can do: \list \i Create \l Image elements with source URLs of any online images. GOOD \i Use XmlListModel to present online content. GOOD - \i Use XMLHttpRequest to interact with online services. GOOD + \i Use \l{XMLHttpRequest()}{XMLHttpRequest} to interact with online services. GOOD \endlist The only reason this page is necessary at all is that JavaScript, when run in a \e{web browser}, diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 37bbb14..e3680f2 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -248,6 +248,20 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM */ +/* + A ListModel internally uses either a NestedListModel or FlatListModel. + + A NestedListModel can contain lists of ListElements (which + when retrieved from get() is accessible as a list model within the list + model) whereas a FlatListModel cannot. + + ListModel uses a NestedListModel to begin with, and if the model is later + used from a WorkerScript, it changes to use a FlatListModel instead. This + is because ModelNode (which abstracts the nested list model data) needs + access to the declarative engine and script engine, which cannot be + safely used from outside of the main thread. +*/ + QDeclarativeListModel::QDeclarativeListModel(QObject *parent) : QListModelInterface(parent), m_agent(0), m_nested(new NestedListModel(this)), m_flat(0), m_isWorkerCopy(false) { @@ -1351,6 +1365,7 @@ ModelObject::ModelObject() void ModelObject::setValue(const QByteArray &name, const QVariant &val) { _mo->setValue(name, val); + setProperty(name.constData(), val); } -- cgit v0.12 From 87db39b013658bcd262d52f6f9e04934991d6ad1 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 12 Apr 2010 13:33:40 +1000 Subject: coding conventions --- doc/src/snippets/declarative/border-image.qml | 30 +++++++++++++-------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/doc/src/snippets/declarative/border-image.qml b/doc/src/snippets/declarative/border-image.qml index c4215cd..12245dd 100644 --- a/doc/src/snippets/declarative/border-image.qml +++ b/doc/src/snippets/declarative/border-image.qml @@ -9,23 +9,21 @@ Rectangle { anchors.centerIn: parent spacing: 50 //! [0] - BorderImage { - width: 180; height: 180 - border.left: 30; border.top: 30 - border.right: 30; border.bottom: 30 - horizontalTileMode: BorderImage.Stretch - verticalTileMode: BorderImage.Stretch - source: "content/colors.png" - } +BorderImage { + width: 180; height: 180 + border { left: 30; top: 30; right: 30; bottom: 30 } + horizontalTileMode: BorderImage.Stretch + verticalTileMode: BorderImage.Stretch + source: "content/colors.png" +} - BorderImage { - width: 180; height: 180 - border.left: 30; border.top: 30 - border.right: 30; border.bottom: 30 - horizontalTileMode: BorderImage.Round - verticalTileMode: BorderImage.Round - source: "content/colors.png" - } +BorderImage { + width: 180; height: 180 + border { left: 30; top: 30; right: 30; bottom: 30 } + horizontalTileMode: BorderImage.Round + verticalTileMode: BorderImage.Round + source: "content/colors.png" +} //! [0] } } -- cgit v0.12 From b3854b33242b0ce38d194cebb2d3a86b85e0df4b Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 12 Apr 2010 14:19:36 +1000 Subject: Improve font value type documentation. --- src/declarative/graphicsitems/qdeclarativetext.cpp | 112 ++++++++++++++++++++- .../graphicsitems/qdeclarativetextedit.cpp | 105 ++++++++++++++++++- .../graphicsitems/qdeclarativetextinput.cpp | 104 ++++++++++++++++++- 3 files changed, 316 insertions(+), 5 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 69e3543..f31f5aa 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -122,14 +122,116 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate() /*! \qmlproperty string Text::font.family + + Sets the family name of the font. + + The family name is case insensitive and may optionally include a foundry name, e.g. "Helvetica [Cronyx]". + If the family is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen. + If the family isn't available a family will be set using the font matching algorithm. +*/ + +/*! \qmlproperty bool Text::font.bold + + Sets the font's weight to bold. +*/ + +/*! + \qmlproperty enumeration Text::font.weight + + Sets the font's weight. + + The weight can be one of: + \list + \o Light + \o Normal - the default + \o DemiBold + \o Bold + \o Black + \endlist + + \qml + Text { text: "Hello"; font.weight: Font.DemiBold } + \endqml +*/ + +/*! \qmlproperty bool Text::font.italic + + Sets the style of the text to italic. +*/ + +/*! \qmlproperty bool Text::font.underline + + Set the style of the text to underline. +*/ + +/*! + \qmlproperty bool Text::font.outline + + Set the style of the text to outline. +*/ + +/*! + \qmlproperty bool Text::font.strikeout + + Set the style of the text to strikeout. +*/ + +/*! \qmlproperty real Text::font.pointSize + + Sets the font size in points. The point size must be greater than zero. +*/ + +/*! \qmlproperty int Text::font.pixelSize - Set the Text's font attributes. + Sets the font size in pixels. + + Using this function makes the font device dependent. + Use \c pointSize to set the size of the font in a device independent manner. */ + +/*! + \qmlproperty real Text::font.letterSpacing + + Sets the letter spacing for the font. + + Letter spacing changes the default spacing between individual letters in the font. + A value of 100 will keep the spacing unchanged; a value of 200 will enlarge the spacing after a character by + the width of the character itself. +*/ + +/*! + \qmlproperty real Text::font.wordSpacing + + Sets the word spacing for the font. + + Word spacing changes the default spacing between individual words. + A positive value increases the word spacing by a corresponding amount of pixels, + while a negative value decreases the inter-word spacing accordingly. +*/ + +/*! + \qmlproperty enumeration Text::font.capitalization + + Sets the capitalization for the text. + + \list + \o MixedCase - This is the normal text rendering option where no capitalization change is applied. + \o AllUppercase - This alters the text to be rendered in all uppercase type. + \o AllLowercase - This alters the text to be rendered in all lowercase type. + \o SmallCaps - This alters the text to be rendered in small-caps type. + \o Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character. + \endlist + + \qml + Text { text: "Hello"; font.capitalization: Font.AllLowercase } + \endqml +*/ + QFont QDeclarativeText::font() const { Q_D(const QDeclarativeText); @@ -458,7 +560,13 @@ void QDeclarativeText::setTextFormat(TextFormat format) This property cannot be used with wrapping enabled or with rich text. - Eliding can be \c ElideNone (the default), \c ElideLeft, \c ElideMiddle, or \c ElideRight. + Eliding can be: + \list + \o ElideNone - the default + \o ElideLeft + \o ElideMiddle + \o ElideRight + \endlist If the text is a multi-length string, and the mode is not \c ElideNone, the first string that fits will be used, otherwise the last will be elided. diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 25d7e2a..1fec484 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -118,13 +118,114 @@ QString QDeclarativeTextEdit::text() const /*! \qmlproperty string TextEdit::font.family + + Sets the family name of the font. + + The family name is case insensitive and may optionally include a foundry name, e.g. "Helvetica [Cronyx]". + If the family is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen. + If the family isn't available a family will be set using the font matching algorithm. +*/ + +/*! \qmlproperty bool TextEdit::font.bold + + Sets the font's weight to bold. +*/ + +/*! + \qmlproperty enumeration TextEdit::font.weight + + Sets the font's weight. + + The weight can be one of: + \list + \o Light + \o Normal - the default + \o DemiBold + \o Bold + \o Black + \endlist + + \qml + TextEdit { text: "Hello"; font.weight: Font.DemiBold } + \endqml +*/ + +/*! \qmlproperty bool TextEdit::font.italic + + Sets the style of the text to italic. +*/ + +/*! \qmlproperty bool TextEdit::font.underline + + Set the style of the text to underline. +*/ + +/*! + \qmlproperty bool TextEdit::font.outline + + Set the style of the text to outline. +*/ + +/*! + \qmlproperty bool TextEdit::font.strikeout + + Set the style of the text to strikeout. +*/ + +/*! \qmlproperty real TextEdit::font.pointSize + + Sets the font size in points. The point size must be greater than zero. +*/ + +/*! \qmlproperty int TextEdit::font.pixelSize - Set the TextEdit's font attributes. + Sets the font size in pixels. + + Using this function makes the font device dependent. + Use \c pointSize to set the size of the font in a device independent manner. +*/ + +/*! + \qmlproperty real TextEdit::font.letterSpacing + + Sets the letter spacing for the font. + + Letter spacing changes the default spacing between individual letters in the font. + A value of 100 will keep the spacing unchanged; a value of 200 will enlarge the spacing after a character by + the width of the character itself. +*/ + +/*! + \qmlproperty real TextEdit::font.wordSpacing + + Sets the word spacing for the font. + + Word spacing changes the default spacing between individual words. + A positive value increases the word spacing by a corresponding amount of pixels, + while a negative value decreases the inter-word spacing accordingly. +*/ + +/*! + \qmlproperty enumeration TextEdit::font.capitalization + + Sets the capitalization for the text. + + \list + \o MixedCase - This is the normal text rendering option where no capitalization change is applied. + \o AllUppercase - This alters the text to be rendered in all uppercase type. + \o AllLowercase - This alters the text to be rendered in all lowercase type. + \o SmallCaps - This alters the text to be rendered in small-caps type. + \o Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character. + \endlist + + \qml + TextEdit { text: "Hello"; font.capitalization: Font.AllLowercase } + \endqml */ /*! @@ -688,7 +789,7 @@ void QDeclarativeTextEdit::componentComplete() */ void QDeclarativeTextEdit::setReadOnly(bool r) { - Q_D(QDeclarativeTextEdit); + Q_D(QDeclarativeTextEdit); if (r == isReadOnly()) return; diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 1b8b84b..187b035 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -97,14 +97,116 @@ void QDeclarativeTextInput::setText(const QString &s) /*! \qmlproperty string TextInput::font.family + + Sets the family name of the font. + + The family name is case insensitive and may optionally include a foundry name, e.g. "Helvetica [Cronyx]". + If the family is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen. + If the family isn't available a family will be set using the font matching algorithm. +*/ + +/*! \qmlproperty bool TextInput::font.bold + + Sets the font's weight to bold. +*/ + +/*! + \qmlproperty enumeration TextInput::font.weight + + Sets the font's weight. + + The weight can be one of: + \list + \o Light + \o Normal - the default + \o DemiBold + \o Bold + \o Black + \endlist + + \qml + TextInput { text: "Hello"; font.weight: Font.DemiBold } + \endqml +*/ + +/*! \qmlproperty bool TextInput::font.italic + + Sets the style of the text to italic. +*/ + +/*! \qmlproperty bool TextInput::font.underline + + Set the style of the text to underline. +*/ + +/*! + \qmlproperty bool TextInput::font.outline + + Set the style of the text to outline. +*/ + +/*! + \qmlproperty bool TextInput::font.strikeout + + Set the style of the text to strikeout. +*/ + +/*! \qmlproperty real TextInput::font.pointSize + + Sets the font size in points. The point size must be greater than zero. +*/ + +/*! \qmlproperty int TextInput::font.pixelSize - Set the TextInput's font attributes. + Sets the font size in pixels. + + Using this function makes the font device dependent. + Use \c pointSize to set the size of the font in a device independent manner. +*/ + +/*! + \qmlproperty real TextInput::font.letterSpacing + + Sets the letter spacing for the font. + + Letter spacing changes the default spacing between individual letters in the font. + A value of 100 will keep the spacing unchanged; a value of 200 will enlarge the spacing after a character by + the width of the character itself. */ + +/*! + \qmlproperty real TextInput::font.wordSpacing + + Sets the word spacing for the font. + + Word spacing changes the default spacing between individual words. + A positive value increases the word spacing by a corresponding amount of pixels, + while a negative value decreases the inter-word spacing accordingly. +*/ + +/*! + \qmlproperty enumeration TextInput::font.capitalization + + Sets the capitalization for the text. + + \list + \o MixedCase - This is the normal text rendering option where no capitalization change is applied. + \o AllUppercase - This alters the text to be rendered in all uppercase type. + \o AllLowercase - This alters the text to be rendered in all lowercase type. + \o SmallCaps - This alters the text to be rendered in small-caps type. + \o Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character. + \endlist + + \qml + TextInput { text: "Hello"; font.capitalization: Font.AllLowercase } + \endqml +*/ + QFont QDeclarativeTextInput::font() const { Q_D(const QDeclarativeTextInput); -- cgit v0.12 From 4d7733adc414fa55b4b5596249197344806b8ab0 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Mon, 12 Apr 2010 15:24:00 +1000 Subject: Make bindings dump more useful --- .../qml/qdeclarativecompiledbindings.cpp | 115 ++++++++++++--------- 1 file changed, 69 insertions(+), 46 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index 07b0798..0c824fc 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -60,6 +60,7 @@ QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(qmlExperimental, QML_EXPERIMENTAL); DEFINE_BOOL_CONFIG_OPTION(qmlDisableOptimizer, QML_DISABLE_OPTIMIZER); DEFINE_BOOL_CONFIG_OPTION(qmlDisableFastProperties, QML_DISABLE_FAST_PROPERTIES); +DEFINE_BOOL_CONFIG_OPTION(bindingsDump, QML_BINDINGS_DUMP); Q_GLOBAL_STATIC(QDeclarativeFastProperties, fastProperties); @@ -333,6 +334,7 @@ namespace { struct Instr { enum { Noop, + BindingId, // id Subscribe, // subscribe SubscribeId, // subscribe @@ -403,6 +405,12 @@ struct Instr { } common; struct { quint8 type; + quint8 packing; + quint16 column; + quint32 line; + } id; + struct { + quint8 type; quint8 packing[3]; quint16 subscriptions; quint16 identifiers; @@ -942,142 +950,145 @@ static void dumpInstruction(const Instr *instr) { switch (instr->common.type) { case Instr::Noop: - qWarning().nospace() << "Noop"; + qWarning().nospace() << "\t" << "Noop"; + break; + case Instr::BindingId: + qWarning().nospace() << instr->id.line << ":" << instr->id.column << ":"; break; case Instr::Subscribe: - qWarning().nospace() << "Subscribe" << "\t\t" << instr->subscribe.offset << "\t" << instr->subscribe.reg << "\t" << instr->subscribe.index; + qWarning().nospace() << "\t" << "Subscribe" << "\t\t" << instr->subscribe.offset << "\t" << instr->subscribe.reg << "\t" << instr->subscribe.index; break; case Instr::SubscribeId: - qWarning().nospace() << "SubscribeId" << "\t\t" << instr->subscribe.offset << "\t" << instr->subscribe.reg << "\t" << instr->subscribe.index; + qWarning().nospace() << "\t" << "SubscribeId" << "\t\t" << instr->subscribe.offset << "\t" << instr->subscribe.reg << "\t" << instr->subscribe.index; break; case Instr::FetchAndSubscribe: - qWarning().nospace() << "FetchAndSubscribe" << "\t" << instr->fetchAndSubscribe.output << "\t" << instr->fetchAndSubscribe.objectReg << "\t" << instr->fetchAndSubscribe.subscription; + qWarning().nospace() << "\t" << "FetchAndSubscribe" << "\t" << instr->fetchAndSubscribe.output << "\t" << instr->fetchAndSubscribe.objectReg << "\t" << instr->fetchAndSubscribe.subscription; break; case Instr::LoadId: - qWarning().nospace() << "LoadId" << "\t\t\t" << instr->load.index << "\t" << instr->load.reg; + qWarning().nospace() << "\t" << "LoadId" << "\t\t\t" << instr->load.index << "\t" << instr->load.reg; break; case Instr::LoadScope: - qWarning().nospace() << "LoadScope" << "\t\t" << instr->load.index << "\t" << instr->load.reg; + qWarning().nospace() << "\t" << "LoadScope" << "\t\t" << instr->load.index << "\t" << instr->load.reg; break; case Instr::LoadRoot: - qWarning().nospace() << "LoadRoot" << "\t\t" << instr->load.index << "\t" << instr->load.reg; + qWarning().nospace() << "\t" << "LoadRoot" << "\t\t" << instr->load.index << "\t" << instr->load.reg; break; case Instr::LoadAttached: - qWarning().nospace() << "LoadAttached" << "\t\t" << instr->attached.output << "\t" << instr->attached.reg << "\t" << instr->attached.index; + qWarning().nospace() << "\t" << "LoadAttached" << "\t\t" << instr->attached.output << "\t" << instr->attached.reg << "\t" << instr->attached.index; break; case Instr::ConvertIntToReal: - qWarning().nospace() << "ConvertIntToReal" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src; + qWarning().nospace() << "\t" << "ConvertIntToReal" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src; break; case Instr::ConvertRealToInt: - qWarning().nospace() << "ConvertRealToInt" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src; + qWarning().nospace() << "\t" << "ConvertRealToInt" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src; break; case Instr::Real: - qWarning().nospace() << "Real" << "\t\t\t" << instr->real_value.reg << "\t" << instr->real_value.value; + qWarning().nospace() << "\t" << "Real" << "\t\t\t" << instr->real_value.reg << "\t" << instr->real_value.value; break; case Instr::Int: - qWarning().nospace() << "Int" << "\t\t\t" << instr->int_value.reg << "\t" << instr->int_value.value; + qWarning().nospace() << "\t" << "Int" << "\t\t\t" << instr->int_value.reg << "\t" << instr->int_value.value; break; case Instr::Bool: - qWarning().nospace() << "Bool" << "\t\t\t" << instr->bool_value.reg << "\t" << instr->bool_value.value; + qWarning().nospace() << "\t" << "Bool" << "\t\t\t" << instr->bool_value.reg << "\t" << instr->bool_value.value; break; case Instr::String: - qWarning().nospace() << "String" << "\t\t\t" << instr->string_value.reg << "\t" << instr->string_value.offset << "\t" << instr->string_value.length; + qWarning().nospace() << "\t" << "String" << "\t\t\t" << instr->string_value.reg << "\t" << instr->string_value.offset << "\t" << instr->string_value.length; break; case Instr::AddReal: - qWarning().nospace() << "AddReal" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; + qWarning().nospace() << "\t" << "AddReal" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; break; case Instr::AddInt: - qWarning().nospace() << "AddInt" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; + qWarning().nospace() << "\t" << "AddInt" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; break; case Instr::AddString: - qWarning().nospace() << "AddString" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; + qWarning().nospace() << "\t" << "AddString" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; break; case Instr::MinusReal: - qWarning().nospace() << "MinusReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; + qWarning().nospace() << "\t" << "MinusReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; break; case Instr::MinusInt: - qWarning().nospace() << "MinusInt" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; + qWarning().nospace() << "\t" << "MinusInt" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; break; case Instr::CompareReal: - qWarning().nospace() << "CompareReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; + qWarning().nospace() << "\t" << "CompareReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; break; case Instr::CompareString: - qWarning().nospace() << "CompareString" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; + qWarning().nospace() << "\t" << "CompareString" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; break; case Instr::NotCompareReal: - qWarning().nospace() << "NotCompareReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; + qWarning().nospace() << "\t" << "NotCompareReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; break; case Instr::NotCompareString: - qWarning().nospace() << "NotCompareString" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; + qWarning().nospace() << "\t" << "NotCompareString" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; break; case Instr::GreaterThanReal: - qWarning().nospace() << "GreaterThanReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; + qWarning().nospace() << "\t" << "GreaterThanReal" << "\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; break; case Instr::MaxReal: - qWarning().nospace() << "MaxReal" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; + qWarning().nospace() << "\t" << "MaxReal" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; break; case Instr::MinReal: - qWarning().nospace() << "MinReal" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; + qWarning().nospace() << "\t" << "MinReal" << "\t\t\t" << instr->binaryop.output << "\t" << instr->binaryop.src1 << "\t" << instr->binaryop.src2; break; case Instr::NewString: - qWarning().nospace() << "NewString" << "\t\t" << instr->construct.reg; + qWarning().nospace() << "\t" << "NewString" << "\t\t" << instr->construct.reg; break; case Instr::NewUrl: - qWarning().nospace() << "NewUrl" << "\t\t\t" << instr->construct.reg; + qWarning().nospace() << "\t" << "NewUrl" << "\t\t\t" << instr->construct.reg; break; case Instr::CleanupString: - qWarning().nospace() << "CleanupString" << "\t\t" << instr->cleanup.reg; + qWarning().nospace() << "\t" << "CleanupString" << "\t\t" << instr->cleanup.reg; break; case Instr::CleanupUrl: - qWarning().nospace() << "CleanupUrl" << "\t\t" << instr->cleanup.reg; + qWarning().nospace() << "\t" << "CleanupUrl" << "\t\t" << instr->cleanup.reg; break; case Instr::Fetch: - qWarning().nospace() << "Fetch" << "\t\t\t" << instr->fetch.output << "\t" << instr->fetch.index << "\t" << instr->fetch.objectReg; + qWarning().nospace() << "\t" << "Fetch" << "\t\t\t" << instr->fetch.output << "\t" << instr->fetch.index << "\t" << instr->fetch.objectReg; break; case Instr::Store: - qWarning().nospace() << "Store" << "\t\t\t" << instr->store.output << "\t" << instr->store.index << "\t" << instr->store.reg; + qWarning().nospace() << "\t" << "Store" << "\t\t\t" << instr->store.output << "\t" << instr->store.index << "\t" << instr->store.reg; break; case Instr::Copy: - qWarning().nospace() << "Copy" << "\t\t\t" << instr->copy.reg << "\t" << instr->copy.src; + qWarning().nospace() << "\t" << "Copy" << "\t\t\t" << instr->copy.reg << "\t" << instr->copy.src; break; case Instr::Skip: - qWarning().nospace() << "Skip" << "\t\t\t" << instr->skip.reg << "\t" << instr->skip.count; + qWarning().nospace() << "\t" << "Skip" << "\t\t\t" << instr->skip.reg << "\t" << instr->skip.count; break; case Instr::Done: - qWarning().nospace() << "Done"; + qWarning().nospace() << "\t" << "Done"; break; case Instr::InitString: - qWarning().nospace() << "InitString" << "\t\t" << instr->initstring.offset << "\t" << instr->initstring.dataIdx; + qWarning().nospace() << "\t" << "InitString" << "\t\t" << instr->initstring.offset << "\t" << instr->initstring.dataIdx; break; case Instr::FindGeneric: - qWarning().nospace() << "FindGeneric" << "\t\t" << instr->find.reg << "\t" << instr->find.name; + qWarning().nospace() << "\t" << "FindGeneric" << "\t\t" << instr->find.reg << "\t" << instr->find.name; break; case Instr::FindGenericTerminal: - qWarning().nospace() << "FindGenericTerminal" << "\t" << instr->find.reg << "\t" << instr->find.name; + qWarning().nospace() << "\t" << "FindGenericTerminal" << "\t" << instr->find.reg << "\t" << instr->find.name; break; case Instr::FindProperty: - qWarning().nospace() << "FindProperty" << "\t\t" << instr->find.reg << "\t" << instr->find.src << "\t" << instr->find.name; + qWarning().nospace() << "\t" << "FindProperty" << "\t\t" << instr->find.reg << "\t" << instr->find.src << "\t" << instr->find.name; break; case Instr::FindPropertyTerminal: - qWarning().nospace() << "FindPropertyTerminal" << "\t" << instr->find.reg << "\t" << instr->find.src << "\t" << instr->find.name; + qWarning().nospace() << "\t" << "FindPropertyTerminal" << "\t" << instr->find.reg << "\t" << instr->find.src << "\t" << instr->find.name; break; case Instr::CleanupGeneric: - qWarning().nospace() << "CleanupGeneric" << "\t\t" << instr->cleanup.reg; + qWarning().nospace() << "\t" << "CleanupGeneric" << "\t\t" << instr->cleanup.reg; break; case Instr::ConvertGenericToReal: - qWarning().nospace() << "ConvertGenericToReal" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src; + qWarning().nospace() << "\t" << "ConvertGenericToReal" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src; break; case Instr::ConvertGenericToBool: - qWarning().nospace() << "ConvertGenericToBool" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src; + qWarning().nospace() << "\t" << "ConvertGenericToBool" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src; break; case Instr::ConvertGenericToString: - qWarning().nospace() << "ConvertGenericToString" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src; + qWarning().nospace() << "\t" << "ConvertGenericToString" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src; break; case Instr::ConvertGenericToUrl: - qWarning().nospace() << "ConvertGenericToUrl" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src; + qWarning().nospace() << "\t" << "ConvertGenericToUrl" << "\t" << instr->unaryop.output << "\t" << instr->unaryop.src; break; default: - qWarning().nospace() << "Unknown"; + qWarning().nospace() << "\t" << "Unknown"; break; } } @@ -1110,6 +1121,7 @@ void QDeclarativeCompiledBindingsPrivate::run(int instrIndex, switch (instr->common.type) { case Instr::Noop: + case Instr::BindingId: break; case Instr::SubscribeId: @@ -1593,6 +1605,17 @@ bool QDeclarativeBindingCompilerPrivate::compile(QDeclarativeJS::AST::Node *node if (destination->type == -1) return false; + if (bindingsDump()) { + QDeclarativeJS::AST::ExpressionNode *n = node->expressionCast(); + if (n) { + Instr id; + id.common.type = Instr::BindingId; + id.id.column = n->firstSourceLocation().startColumn; + id.id.line = n->firstSourceLocation().startLine; + bytecode << id; + } + } + Result type; if (!parseExpression(node, type)) -- cgit v0.12 From a1f2ebcda0ff7904613a0e1ab02e6e9fdfa5b494 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 12 Apr 2010 14:39:44 +1000 Subject: Fix PathView crash. Task-number: QTBUG-9753 --- src/declarative/graphicsitems/qdeclarativepathview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 5fcac49..06e3540 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -1155,7 +1155,7 @@ void QDeclarativePathView::refill() d->updateItem(d->highlightItem, d->highlightRangeStart); if (QDeclarativePathViewAttached *att = d->attached(d->highlightItem)) att->setOnPath(true); - } else if (d->moveReason != QDeclarativePathViewPrivate::SetIndex) { + } else if (d->highlightItem && d->moveReason != QDeclarativePathViewPrivate::SetIndex) { d->updateItem(d->highlightItem, d->currentItemOffset); if (QDeclarativePathViewAttached *att = d->attached(d->highlightItem)) att->setOnPath(currentVisible); -- cgit v0.12 From 2a89e792eb2b772b8119fc3c0b4b0fba73987d72 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 12 Apr 2010 16:23:50 +1000 Subject: Fix test on QWS. --- tests/auto/declarative/examples/tst_examples.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 61ac2d1..6d7e578 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -193,6 +193,10 @@ void tst_examples::examples() arguments << "-script" << (testdata.exists() ? script : QLatin1String(SRCDIR "/data/dummytest")) << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" << file; +#ifdef Q_WS_QWS + arguments << "-qws"; +#endif + QProcess p; p.start(qmlruntime, arguments); QVERIFY(p.waitForFinished()); -- cgit v0.12 From 785e784492a369d5624a10d3fad327e09ccb4a25 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 12 Apr 2010 16:29:45 +1000 Subject: Fix test --- .../qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp index 74da79e..7edf7e9 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp +++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp @@ -336,7 +336,9 @@ void tst_qdeclarativexmllistmodel::source_data() QTest::addColumn("status"); QTest::newRow("valid") << QUrl::fromLocalFile(SRCDIR "/data/model2.xml") << 2 << QDeclarativeXmlListModel::Ready; - QTest::newRow("invalid") << QUrl("http://blah.blah/blah.xml") << 0 << QDeclarativeXmlListModel::Error; + + // XXX This test fails on the rare occasion due to networking, fix the test for Error status signal (323) + //QTest::newRow("invalid") << QUrl("http://blah.blah/blah.xml") << 0 << QDeclarativeXmlListModel::Error; // empty file QTemporaryFile *temp = new QTemporaryFile(this); -- cgit v0.12 From 29bcbcd2cacc9c9dee36fe77b6a297e42bedf6d4 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 12 Apr 2010 16:32:44 +1000 Subject: Test fix. --- .../declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp b/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp index 7e5c3dd..4155edb 100644 --- a/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp +++ b/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp @@ -116,7 +116,7 @@ void tst_qdeclarativeflipable::setFrontAndBack() void tst_qdeclarativeflipable::QTBUG_9161_crash() { QDeclarativeView *canvas = new QDeclarativeView; - canvas->setSource(QUrl(SRCDIR "/data/crash.qml")); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/crash.qml")); QGraphicsObject *root = canvas->rootObject(); QVERIFY(root != 0); canvas->show(); @@ -126,7 +126,7 @@ void tst_qdeclarativeflipable::QTBUG_9161_crash() void tst_qdeclarativeflipable::QTBUG_8474_qgv_abort() { QDeclarativeView *canvas = new QDeclarativeView; - canvas->setSource(QUrl(SRCDIR "/data/flipable-abort.qml")); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/flipable-abort.qml")); QGraphicsObject *root = canvas->rootObject(); QVERIFY(root != 0); canvas->show(); -- cgit v0.12 From 4e406c67576848d92a1a051aa7ed4541ac1c2dba Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 12 Apr 2010 16:05:11 +1000 Subject: Move documentation code to snippet. --- doc/src/snippets/declarative/workerscript.qml | 24 ++++++++++ src/declarative/qml/qdeclarativeworkerscript.cpp | 56 +++++++----------------- 2 files changed, 39 insertions(+), 41 deletions(-) create mode 100644 doc/src/snippets/declarative/workerscript.qml diff --git a/doc/src/snippets/declarative/workerscript.qml b/doc/src/snippets/declarative/workerscript.qml new file mode 100644 index 0000000..838e7e5 --- /dev/null +++ b/doc/src/snippets/declarative/workerscript.qml @@ -0,0 +1,24 @@ +//![0] +import Qt 4.7 + +Rectangle { + width: 300; height: 300 + + Text { + id: myText + text: 'Click anywhere' + } + + WorkerScript { + id: myWorker + source: "script.js" + + onMessage: myText.text = messageObject.reply + } + + MouseArea { + anchors.fill: parent + onClicked: myWorker.sendMessage({ 'x': mouse.x, 'y': mouse.y }) + } +} +//![0] diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index 9e137b5..138d979 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -113,14 +113,14 @@ public: QDeclarativeWorkerScriptEnginePrivate(QDeclarativeEngine *eng); - struct ScriptEngine : public QDeclarativeScriptEngine + struct ScriptEngine : public QDeclarativeScriptEngine { ScriptEngine(QDeclarativeWorkerScriptEnginePrivate *parent) : QDeclarativeScriptEngine(0), p(parent), accessManager(0) {} ~ScriptEngine() { delete accessManager; } QDeclarativeWorkerScriptEnginePrivate *p; QNetworkAccessManager *accessManager; - virtual QNetworkAccessManager *networkAccessManager() { + virtual QNetworkAccessManager *networkAccessManager() { if (!accessManager) { if (p->qmlengine && p->qmlengine->networkAccessManagerFactory()) { accessManager = p->qmlengine->networkAccessManagerFactory()->create(this); @@ -189,7 +189,7 @@ QScriptValue QDeclarativeWorkerScriptEnginePrivate::onMessage(QScriptContext *ct if (!script) return engine->undefinedValue(); - if (ctxt->argumentCount() >= 1) + if (ctxt->argumentCount() >= 1) script->callback = ctxt->argument(0); return script->callback; @@ -205,13 +205,13 @@ QScriptValue QDeclarativeWorkerScriptEnginePrivate::sendMessage(QScriptContext * int id = ctxt->thisObject().data().toVariant().toInt(); WorkerScript *script = p->workers.value(id); - if (!script) + if (!script) return engine->undefinedValue(); QMutexLocker(&p->m_lock); - if (script->owner) - QCoreApplication::postEvent(script->owner, + if (script->owner) + QCoreApplication::postEvent(script->owner, new WorkerDataEvent(0, scriptValueToVariant(ctxt->argument(0)))); return engine->undefinedValue(); @@ -233,7 +233,7 @@ QScriptValue QDeclarativeWorkerScriptEnginePrivate::getWorker(int id) QScriptValue api = workerEngine->newObject(); api.setData(script->id); - api.setProperty(QLatin1String("onMessage"), workerEngine->newFunction(onMessage), + api.setProperty(QLatin1String("onMessage"), workerEngine->newFunction(onMessage), QScriptValue::PropertyGetter | QScriptValue::PropertySetter); api.setProperty(QLatin1String("sendMessage"), workerEngine->newFunction(sendMessage)); @@ -372,7 +372,7 @@ QScriptValue QDeclarativeWorkerScriptEnginePrivate::variantToScriptValue(const Q QVariantList list = qvariant_cast(value); QScriptValue rv = engine->newArray(list.count()); - for (quint32 ii = 0; ii < quint32(list.count()); ++ii) + for (quint32 ii = 0; ii < quint32(list.count()); ++ii) rv.setProperty(ii, variantToScriptValue(list.at(ii), engine)); return rv; @@ -382,7 +382,7 @@ QScriptValue QDeclarativeWorkerScriptEnginePrivate::variantToScriptValue(const Q QScriptValue rv = engine->newObject(); - for (QVariantHash::ConstIterator iter = hash.begin(); iter != hash.end(); ++iter) + for (QVariantHash::ConstIterator iter = hash.begin(); iter != hash.end(); ++iter) rv.setProperty(iter.key(), variantToScriptValue(iter.value(), engine)); return rv; @@ -517,36 +517,10 @@ void QDeclarativeWorkerScriptEngine::run() Messages can be passed between the new thread and the parent thread using sendMessage() and the onMessage() handler. - - Here is an example: - - \qml - import Qt 4.7 - - Rectangle { - width: 300 - height: 300 - - Text { - id: myText - text: 'Click anywhere' - } - - WorkerScript { - id: myWorker - source: "script.js" - onMessage: { - myText.text = messageObject.reply - } - } + Here is an example: - MouseArea { - anchors.fill: parent - onClicked: myWorker.sendMessage( {'x': mouse.x, 'y': mouse.y} ); - } - } - \endqml + \snippet doc/src/snippets/declarative/workerscript.qml 0 The above worker script specifies a javascript file, "script.js", that handles the operations to be performed in the new thread: @@ -554,10 +528,10 @@ void QDeclarativeWorkerScriptEngine::run() \qml WorkerScript.onMessage = function(message) { // ... long-running operations and calculations are done here - WorkerScript.sendMessage( {'reply': 'Mouse is at ' + message.x + ',' + message.y} ); + WorkerScript.sendMessage({ 'reply': 'Mouse is at ' + message.x + ',' + message.y }) } \endqml - + When the user clicks anywhere within the rectangle, \c sendMessage() is called, triggering the \tt WorkerScript.onMessage() handler in \tt source.js. This in turn sends a reply message that is then received @@ -591,7 +565,7 @@ void QDeclarativeWorkerScript::setSource(const QUrl &source) m_source = source; - if (m_engine) + if (m_engine) m_engine->executeUrl(m_scriptId, m_source); emit sourceChanged(); @@ -645,7 +619,7 @@ bool QDeclarativeWorkerScript::event(QEvent *event) if (engine) { QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); WorkerDataEvent *workerEvent = static_cast(event); - QScriptValue value = + QScriptValue value = QDeclarativeWorkerScriptEnginePrivate::variantToScriptValue(workerEvent->data(), scriptEngine); emit message(value); } -- cgit v0.12 From 2a0d90e2ebd1690a74803286f1611986fa35dd0a Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 12 Apr 2010 16:06:40 +1000 Subject: import Qt 4.6 -> import Qt 4.7 --- doc/src/snippets/declarative/border-image.qml | 2 +- doc/src/snippets/declarative/codingconventions/dotproperties.qml | 2 +- doc/src/snippets/declarative/codingconventions/javascript-imports.qml | 2 +- doc/src/snippets/declarative/codingconventions/javascript.qml | 2 +- doc/src/snippets/declarative/codingconventions/lists.qml | 2 +- doc/src/snippets/declarative/codingconventions/photo.qml | 2 +- doc/src/snippets/declarative/comments.qml | 2 +- doc/src/snippets/declarative/drag.qml | 2 +- doc/src/snippets/declarative/flipable.qml | 2 +- doc/src/snippets/declarative/gradient.qml | 2 +- doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml | 2 +- doc/src/snippets/declarative/gridview/gridview.qml | 2 +- doc/src/snippets/declarative/listview/dummydata/ContactModel.qml | 2 +- doc/src/snippets/declarative/listview/highlight.qml | 2 +- doc/src/snippets/declarative/listview/listview.qml | 2 +- doc/src/snippets/declarative/mouseregion.qml | 2 +- doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml | 2 +- doc/src/snippets/declarative/pathview/pathattributes.qml | 2 +- doc/src/snippets/declarative/pathview/pathview.qml | 2 +- doc/src/snippets/declarative/repeater-index.qml | 2 +- doc/src/snippets/declarative/repeater.qml | 2 +- doc/src/snippets/declarative/rotation.qml | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/doc/src/snippets/declarative/border-image.qml b/doc/src/snippets/declarative/border-image.qml index 12245dd..9c4247e 100644 --- a/doc/src/snippets/declarative/border-image.qml +++ b/doc/src/snippets/declarative/border-image.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { id: page diff --git a/doc/src/snippets/declarative/codingconventions/dotproperties.qml b/doc/src/snippets/declarative/codingconventions/dotproperties.qml index 211cac1..942b0b1 100644 --- a/doc/src/snippets/declarative/codingconventions/dotproperties.qml +++ b/doc/src/snippets/declarative/codingconventions/dotproperties.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { diff --git a/doc/src/snippets/declarative/codingconventions/javascript-imports.qml b/doc/src/snippets/declarative/codingconventions/javascript-imports.qml index a216e1c..417366c 100644 --- a/doc/src/snippets/declarative/codingconventions/javascript-imports.qml +++ b/doc/src/snippets/declarative/codingconventions/javascript-imports.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 //![0] import "myscript.js" as Script diff --git a/doc/src/snippets/declarative/codingconventions/javascript.qml b/doc/src/snippets/declarative/codingconventions/javascript.qml index ccb299b..64b5a40 100644 --- a/doc/src/snippets/declarative/codingconventions/javascript.qml +++ b/doc/src/snippets/declarative/codingconventions/javascript.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { diff --git a/doc/src/snippets/declarative/codingconventions/lists.qml b/doc/src/snippets/declarative/codingconventions/lists.qml index b8cc8a3..63e8100 100644 --- a/doc/src/snippets/declarative/codingconventions/lists.qml +++ b/doc/src/snippets/declarative/codingconventions/lists.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Item { Item { diff --git a/doc/src/snippets/declarative/codingconventions/photo.qml b/doc/src/snippets/declarative/codingconventions/photo.qml index 3a59e1f..c28c2c9 100644 --- a/doc/src/snippets/declarative/codingconventions/photo.qml +++ b/doc/src/snippets/declarative/codingconventions/photo.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 //! [0] Rectangle { diff --git a/doc/src/snippets/declarative/comments.qml b/doc/src/snippets/declarative/comments.qml index 806be29..ab1bbc9 100644 --- a/doc/src/snippets/declarative/comments.qml +++ b/doc/src/snippets/declarative/comments.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Text { text: "Hello world!" //a basic greeting diff --git a/doc/src/snippets/declarative/drag.qml b/doc/src/snippets/declarative/drag.qml index 8e5b599..9465efb 100644 --- a/doc/src/snippets/declarative/drag.qml +++ b/doc/src/snippets/declarative/drag.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 //! [0] Rectangle { diff --git a/doc/src/snippets/declarative/flipable.qml b/doc/src/snippets/declarative/flipable.qml index c837ebc..ae74345 100644 --- a/doc/src/snippets/declarative/flipable.qml +++ b/doc/src/snippets/declarative/flipable.qml @@ -1,5 +1,5 @@ //! [0] -import Qt 4.6 +import Qt 4.7 Flipable { id: flipable diff --git a/doc/src/snippets/declarative/gradient.qml b/doc/src/snippets/declarative/gradient.qml index 281360e..168398d 100644 --- a/doc/src/snippets/declarative/gradient.qml +++ b/doc/src/snippets/declarative/gradient.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 100; height: 100 diff --git a/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml b/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml index 3cf9ba7..90f139d 100644 --- a/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml +++ b/doc/src/snippets/declarative/gridview/dummydata/ContactModel.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 ListModel { id: contactModel diff --git a/doc/src/snippets/declarative/gridview/gridview.qml b/doc/src/snippets/declarative/gridview/gridview.qml index 1a2021c..1d3df97 100644 --- a/doc/src/snippets/declarative/gridview/gridview.qml +++ b/doc/src/snippets/declarative/gridview/gridview.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 //! [3] Rectangle { diff --git a/doc/src/snippets/declarative/listview/dummydata/ContactModel.qml b/doc/src/snippets/declarative/listview/dummydata/ContactModel.qml index 6832308..20687cf 100644 --- a/doc/src/snippets/declarative/listview/dummydata/ContactModel.qml +++ b/doc/src/snippets/declarative/listview/dummydata/ContactModel.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 ListModel { id: contactModel diff --git a/doc/src/snippets/declarative/listview/highlight.qml b/doc/src/snippets/declarative/listview/highlight.qml index fe5cc53..794b3f2 100644 --- a/doc/src/snippets/declarative/listview/highlight.qml +++ b/doc/src/snippets/declarative/listview/highlight.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 180; height: 200; color: "white" diff --git a/doc/src/snippets/declarative/listview/listview.qml b/doc/src/snippets/declarative/listview/listview.qml index be0f3ad..61bf126 100644 --- a/doc/src/snippets/declarative/listview/listview.qml +++ b/doc/src/snippets/declarative/listview/listview.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 //! [3] Rectangle { diff --git a/doc/src/snippets/declarative/mouseregion.qml b/doc/src/snippets/declarative/mouseregion.qml index fc6c8f0..a464069 100644 --- a/doc/src/snippets/declarative/mouseregion.qml +++ b/doc/src/snippets/declarative/mouseregion.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 200; height: 100 Row { diff --git a/doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml b/doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml index 1334cf4..4004076 100644 --- a/doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml +++ b/doc/src/snippets/declarative/pathview/dummydata/MenuModel.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 ListModel { id: menuModel diff --git a/doc/src/snippets/declarative/pathview/pathattributes.qml b/doc/src/snippets/declarative/pathview/pathattributes.qml index 99d0de2..ba860c2 100644 --- a/doc/src/snippets/declarative/pathview/pathattributes.qml +++ b/doc/src/snippets/declarative/pathview/pathattributes.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 240; height: 200; color: 'white' diff --git a/doc/src/snippets/declarative/pathview/pathview.qml b/doc/src/snippets/declarative/pathview/pathview.qml index e316578..3686398 100644 --- a/doc/src/snippets/declarative/pathview/pathview.qml +++ b/doc/src/snippets/declarative/pathview/pathview.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 240; height: 200; color: 'white' diff --git a/doc/src/snippets/declarative/repeater-index.qml b/doc/src/snippets/declarative/repeater-index.qml index 9063967..709eaf2 100644 --- a/doc/src/snippets/declarative/repeater-index.qml +++ b/doc/src/snippets/declarative/repeater-index.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 50; height: childrenRect.height; color: "white" diff --git a/doc/src/snippets/declarative/repeater.qml b/doc/src/snippets/declarative/repeater.qml index f8ac856..02a8208 100644 --- a/doc/src/snippets/declarative/repeater.qml +++ b/doc/src/snippets/declarative/repeater.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 220; height: 20; color: "white" diff --git a/doc/src/snippets/declarative/rotation.qml b/doc/src/snippets/declarative/rotation.qml index 4a67dcb..f2fd78c 100644 --- a/doc/src/snippets/declarative/rotation.qml +++ b/doc/src/snippets/declarative/rotation.qml @@ -1,4 +1,4 @@ -import Qt 4.6 +import Qt 4.7 Rectangle { width: 360; height: 80 -- cgit v0.12 From 9753f6098e0e5b3d80ac748559aecc2e66dcfc7a Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 12 Apr 2010 17:12:44 +1000 Subject: Remove GraphicsObjectContainer from the documentation. --- doc/src/declarative/elements.qdoc | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc index 4946346..ce3a6e3 100644 --- a/doc/src/declarative/elements.qdoc +++ b/doc/src/declarative/elements.qdoc @@ -146,7 +146,6 @@ The following table lists the QML elements provided by the Qt Declarative module \o \l Loader \o \l Repeater \o \l SystemPalette -\o \l GraphicsObjectContainer \o \l LayoutItem \endlist -- cgit v0.12 From efc80209fb5e6ac9d0343b3c9f6d5a1548cf5556 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 6 Apr 2010 15:36:17 +0200 Subject: Add some TextInput properties and methods Adds the properties -passwordCharacter -displayText And the method -moveCursorSelection(int pos) These just provide a QML way to access existing QLineControl functionality, and are necessary to create desktop style LineEdits (the existing TextInput QML API was designed with a focus on touch input LineEdits) Includes tests and documentation. Task-number: QT-321 Reviewed-by: Aaron Kennedy --- .../graphicsitems/qdeclarativetextinput.cpp | 83 +- .../graphicsitems/qdeclarativetextinput_p.h | 15 +- .../qdeclarativetextinput/data/echoMode.qml | 11 + .../tst_qdeclarativetextinput.cpp | 39 + .../qmlvisual/qdeclarativetextinput/LineEdit.qml | 67 + .../qdeclarativetextinput/data-X11/echoMode.0.png | Bin 999 -> 716 bytes .../qdeclarativetextinput/data-X11/echoMode.1.png | Bin 1880 -> 1352 bytes .../qdeclarativetextinput/data-X11/echoMode.2.png | Bin 2962 -> 2047 bytes .../qdeclarativetextinput/data-X11/echoMode.qml | 376 +- .../data-X11/usingLineEdit.0.png | Bin 0 -> 3137 bytes .../data-X11/usingLineEdit.1.png | Bin 0 -> 3195 bytes .../data-X11/usingLineEdit.10.png | Bin 0 -> 3853 bytes .../data-X11/usingLineEdit.2.png | Bin 0 -> 3171 bytes .../data-X11/usingLineEdit.3.png | Bin 0 -> 3228 bytes .../data-X11/usingLineEdit.4.png | Bin 0 -> 3198 bytes .../data-X11/usingLineEdit.5.png | Bin 0 -> 3310 bytes .../data-X11/usingLineEdit.6.png | Bin 0 -> 3233 bytes .../data-X11/usingLineEdit.7.png | Bin 0 -> 3607 bytes .../data-X11/usingLineEdit.8.png | Bin 0 -> 3657 bytes .../data-X11/usingLineEdit.9.png | Bin 0 -> 3262 bytes .../data-X11/usingLineEdit.qml | 4335 ++++++++++++++++++++ .../qmlvisual/qdeclarativetextinput/echoMode.qml | 2 +- .../qdeclarativetextinput/usingLineEdit.qml | 10 + 23 files changed, 4745 insertions(+), 193 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/LineEdit.qml create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.0.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.1.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.10.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.2.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.3.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.4.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.5.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.6.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.7.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.8.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.9.png create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.qml create mode 100644 tests/auto/declarative/qmlvisual/qdeclarativetextinput/usingLineEdit.qml diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 29e43f9..e6d0948 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -634,7 +634,18 @@ void QDeclarativeTextInput::moveCursor() d->cursorItem->setX(d->control->cursorToX() - d->hscroll); } -int QDeclarativeTextInput::xToPos(int x) +/* + \qmlmethod int xToPosition(int x) + + This function returns the character position at + x pixels from the left of the textInput. Position 0 is before the + first character, position 1 is after the first character but before the second, + and so on until position text.length, which is after all characters. + + This means that for all x values before the first character this function returns 0, + and for all x values after the last character this function returns text.length. +*/ +int QDeclarativeTextInput::xToPosition(int x) { Q_D(const QDeclarativeTextInput); return d->control->xToPos(x - d->hscroll); @@ -645,6 +656,8 @@ void QDeclarativeTextInputPrivate::focusChanged(bool hasFocus) Q_Q(QDeclarativeTextInput); focused = hasFocus; q->setCursorVisible(hasFocus); + if(q->echoMode() == QDeclarativeTextInput::PasswordEchoOnEdit && !hasFocus) + control->updatePasswordEchoEditing(false);//QLineControl sets it on key events, but doesn't deal with focus events QDeclarativeItemPrivate::focusChanged(hasFocus); } @@ -809,6 +822,72 @@ void QDeclarativeTextInput::selectAll() filtering at the beginning of the animation and reenable it at the conclusion. */ +/* + \qmlproperty string TextInput::passwordCharacter + + This is the character displayed when echoMode is set to Password or + PasswordEchoOnEdit. By default it is an asterisk. + + Attempting to set this to more than one character will set it to + the first character in the string. Attempting to set this to less + than one character will fail. +*/ +QString QDeclarativeTextInput::passwordCharacter() const +{ + Q_D(const QDeclarativeTextInput); + return QString(d->control->passwordCharacter()); +} + +void QDeclarativeTextInput::setPasswordCharacter(const QString &str) +{ + Q_D(QDeclarativeTextInput); + if(str.length() < 1) + return; + emit passwordCharacterChanged(); + d->control->setPasswordCharacter(str.constData()[0]); +} + +/* + \qmlproperty string TextInput::displayText + + This is the actual text displayed in the TextInput. When + echoMode is set to TextInput::Normal this will be exactly + the same as the TextInput::text property. When echoMode + is set to something else, this property will contain the text + the user sees, while the text property will contain the + entered text. +*/ +QString QDeclarativeTextInput::displayText() const +{ + Q_D(const QDeclarativeTextInput); + return d->control->displayText(); +} + +/* + \qmlmethod void moveCursorSelection(int pos) + + This method allows you to move the cursor while modifying the selection accordingly. + To simply move the cursor, set the cursorPosition property. + + When this method is called it additionally sets either the + selectionStart or the selectionEnd (whichever was at the previous cursor position) + to the specified position. This allows you to easily extend and contract the selected + text range. + + Example: The sequence of calls + cursorPosition = 5 + moveCursorSelection(9) + moveCursorSelection(7) + would move the cursor to position 5, extend the selection end from 5 to 9 + and then retract the selection end from 9 to 7, leaving the text from position 5 to 7 + selected (the 6th and 7th characters). +*/ +void QDeclarativeTextInput::moveCursorSelection(int pos) +{ + Q_D(QDeclarativeTextInput); + d->control->moveCursor(pos, true); +} + void QDeclarativeTextInputPrivate::init() { Q_Q(QDeclarativeTextInput); @@ -824,6 +903,8 @@ void QDeclarativeTextInputPrivate::init() q->connect(control, SIGNAL(selectionChanged()), q, SLOT(selectionChanged())); q->connect(control, SIGNAL(textChanged(const QString &)), + q, SIGNAL(displayTextChanged(const QString &))); + q->connect(control, SIGNAL(textChanged(const QString &)), q, SLOT(q_textChanged())); q->connect(control, SIGNAL(accepted()), q, SIGNAL(accepted())); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 64aff7d..e453f5d 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -86,6 +86,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTextInput : public QDeclarativePaintedIte Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged) Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode NOTIFY echoModeChanged) Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress NOTIFY focusOnPressChanged) + Q_PROPERTY(QString passwordCharacter READ passwordCharacter WRITE setPasswordCharacter NOTIFY passwordCharacterChanged) + Q_PROPERTY(QString displayText READ displayText NOTIFY displayTextChanged) public: QDeclarativeTextInput(QDeclarativeItem* parent=0); @@ -104,9 +106,9 @@ public: AlignHCenter = Qt::AlignHCenter }; - //### Should we have this function, x based properties, - //### or copy TextEdit with x instead of QTextCursor? - Q_INVOKABLE int xToPos(int x); + //Auxilliary functions needed to control the TextInput from QML + Q_INVOKABLE int xToPosition(int x); + Q_INVOKABLE void moveCursorSelection(int pos); QString text() const; void setText(const QString &); @@ -157,6 +159,11 @@ public: EchoMode echoMode() const; void setEchoMode(EchoMode echo); + QString passwordCharacter() const; + void setPasswordCharacter(const QString &str); + + QString displayText() const; + QDeclarativeComponent* cursorDelegate() const; void setCursorDelegate(QDeclarativeComponent*); @@ -188,6 +195,8 @@ Q_SIGNALS: void validatorChanged(); void inputMaskChanged(const QString &inputMask); void echoModeChanged(EchoMode echoMode); + void passwordCharacterChanged(); + void displayTextChanged(const QString &text); void focusOnPressChanged(bool focusOnPress); protected: diff --git a/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml b/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml new file mode 100644 index 0000000..5773cc2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml @@ -0,0 +1,11 @@ +import Qt 4.7 + +Rectangle { + property var myInput: input + + width: 400; height: 200; color: "green" + + TextInput { id: input; focus: true + text: "ABCDefgh" + } +} diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index b6f55dd..26d4cb1 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -74,6 +74,7 @@ private slots: void sendRequestSoftwareInputPanelEvent(); void setHAlignClearCache(); + void echoMode(); private: void simulateKey(QDeclarativeView *, int key); QDeclarativeView *createView(const QString &filename); @@ -587,6 +588,44 @@ void tst_qdeclarativetextinput::readOnly() QCOMPARE(input->text(), initial); } +void tst_qdeclarativetextinput::echoMode() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/echoMode.qml"); + canvas->show(); + canvas->setFocus(); + + QVERIFY(canvas->rootObject() != 0); + + QDeclarativeTextInput *input = qobject_cast(qvariant_cast(canvas->rootObject()->property("myInput"))); + + QVERIFY(input != 0); + QTRY_VERIFY(input->hasFocus() == true); + QString initial = input->text(); + QCOMPARE(initial, QLatin1String("ABCDefgh")); + QCOMPARE(input->echoMode(), QDeclarativeTextInput::Normal); + QCOMPARE(input->displayText(), input->text()); + input->setEchoMode(QDeclarativeTextInput::NoEcho); + QCOMPARE(input->text(), initial); + QCOMPARE(input->displayText(), QLatin1String("")); + QCOMPARE(input->passwordCharacter(), QLatin1String("*")); + input->setEchoMode(QDeclarativeTextInput::Password); + QCOMPARE(input->text(), initial); + QCOMPARE(input->displayText(), QLatin1String("********")); + input->setPasswordCharacter(QChar('Q')); + QCOMPARE(input->passwordCharacter(), QLatin1String("Q")); + QCOMPARE(input->text(), initial); + QCOMPARE(input->displayText(), QLatin1String("QQQQQQQQ")); + input->setEchoMode(QDeclarativeTextInput::PasswordEchoOnEdit); + QCOMPARE(input->text(), initial); + QCOMPARE(input->displayText(), QLatin1String("QQQQQQQQ")); + QTest::keyPress(canvas, Qt::Key_A);//Clearing previous entry is part of PasswordEchoOnEdit + QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); + QCOMPARE(input->text(), QLatin1String("a")); + QCOMPARE(input->displayText(), QLatin1String("a")); + input->setFocus(false); + QCOMPARE(input->displayText(), QLatin1String("Q")); +} + void tst_qdeclarativetextinput::simulateKey(QDeclarativeView *view, int key) { QKeyEvent press(QKeyEvent::KeyPress, key, 0); diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/LineEdit.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/LineEdit.qml new file mode 100644 index 0000000..31f24ec --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/LineEdit.qml @@ -0,0 +1,67 @@ +import Qt 4.7 + +Item { + id:lineedit + property alias text: textInp.text + + width: textInp.width + 11 + height: 13 + 11 + + Rectangle{ + color: 'lightsteelblue' + anchors.fill: parent + } + clip: true + Component.onCompleted: textInp.cursorPosition = 0; + TextInput{ + id:textInp + cursorDelegate: Item{ + Rectangle{ + visible: parent.parent.focus + color: "#009BCE" + height: 13 + width: 2 + y: 1 + } + } + property int leftMargin: 6 + property int rightMargin: 6 + x: leftMargin + y: 5 + //Below function implements all scrolling logic + onCursorPositionChanged: { + if(cursorRect.x < leftMargin - textInp.x){//Cursor went off the front + textInp.x = leftMargin - Math.max(0, cursorRect.x); + }else if(cursorRect.x > parent.width - leftMargin - rightMargin - textInp.x){//Cusor went off the end + textInp.x = leftMargin - Math.max(0, cursorRect.x - (parent.width - leftMargin - rightMargin)); + } + } + + text:"" + horizontalAlignment: TextInput.AlignLeft + font.pixelSize:15 + } + MouseArea{ + //Implements all line edit mouse handling + id: mainMouseArea + anchors.fill: parent; + function translateX(x){ + return x - textInp.x + } + onPressed: { + textInp.focus = true; + textInp.cursorPosition = textInp.xToPosition(translateX(mouse.x)); + } + onPositionChanged: { + textInp.moveCursorSelection(textInp.xToPosition(translateX(mouse.x))); + } + onReleased: { + } + onDoubleClicked: { + textInp.selectionStart=0; + textInp.selectionEnd=textInp.text.length; + } + z: textInp.z + 1 + } + +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.0.png index 2b45a06..f30ee4f 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.0.png and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.0.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.1.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.1.png index 1f5bae0..7ae3b94 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.1.png and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.1.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.2.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.2.png index cb2b5a4..636afe8 100644 Binary files a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.2.png and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.2.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.qml index dd7b291..b779c21 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/echoMode.qml @@ -6,11 +6,11 @@ VisualTest { } Frame { msec: 16 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 32 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Key { type: 6 @@ -22,83 +22,83 @@ VisualTest { } Frame { msec: 48 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 64 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 80 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 96 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 112 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 128 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 144 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 160 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 176 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 192 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 208 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 224 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 240 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 256 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 272 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 288 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 304 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 320 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 336 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Frame { msec: 352 - hash: "b73bd9c2fef8812591fff9f43b73da13" + hash: "48400809c3862dae64b0cd00d51057a4" } Key { type: 6 @@ -110,23 +110,23 @@ VisualTest { } Frame { msec: 368 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "4acf112eda369b7eb351e0e522cefa05" } Frame { msec: 384 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "4acf112eda369b7eb351e0e522cefa05" } Frame { msec: 400 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "4acf112eda369b7eb351e0e522cefa05" } Frame { msec: 416 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "4acf112eda369b7eb351e0e522cefa05" } Frame { msec: 432 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "4acf112eda369b7eb351e0e522cefa05" } Key { type: 7 @@ -138,27 +138,27 @@ VisualTest { } Frame { msec: 448 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "4acf112eda369b7eb351e0e522cefa05" } Frame { msec: 464 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "4acf112eda369b7eb351e0e522cefa05" } Frame { msec: 480 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "4acf112eda369b7eb351e0e522cefa05" } Frame { msec: 496 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "4acf112eda369b7eb351e0e522cefa05" } Frame { msec: 512 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "4acf112eda369b7eb351e0e522cefa05" } Frame { msec: 528 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "4acf112eda369b7eb351e0e522cefa05" } Key { type: 7 @@ -170,43 +170,43 @@ VisualTest { } Frame { msec: 544 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "238dc96885dadb763bfc1500d8b7c5b2" } Frame { msec: 560 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "238dc96885dadb763bfc1500d8b7c5b2" } Frame { msec: 576 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "238dc96885dadb763bfc1500d8b7c5b2" } Frame { msec: 592 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "238dc96885dadb763bfc1500d8b7c5b2" } Frame { msec: 608 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "238dc96885dadb763bfc1500d8b7c5b2" } Frame { msec: 624 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "238dc96885dadb763bfc1500d8b7c5b2" } Frame { msec: 640 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "238dc96885dadb763bfc1500d8b7c5b2" } Frame { msec: 656 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "238dc96885dadb763bfc1500d8b7c5b2" } Frame { msec: 672 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "238dc96885dadb763bfc1500d8b7c5b2" } Frame { msec: 688 - hash: "e8b6bdc7d552bb13c5dc2f50b8cf1125" + hash: "238dc96885dadb763bfc1500d8b7c5b2" } Key { type: 6 @@ -218,23 +218,23 @@ VisualTest { } Frame { msec: 704 - hash: "fbc09d695e0b47aae6e977c13f535bfd" + hash: "2da540e72d88932b61a261d791fc34b0" } Frame { msec: 720 - hash: "fbc09d695e0b47aae6e977c13f535bfd" + hash: "2da540e72d88932b61a261d791fc34b0" } Frame { msec: 736 - hash: "fbc09d695e0b47aae6e977c13f535bfd" + hash: "2da540e72d88932b61a261d791fc34b0" } Frame { msec: 752 - hash: "fbc09d695e0b47aae6e977c13f535bfd" + hash: "2da540e72d88932b61a261d791fc34b0" } Frame { msec: 768 - hash: "fbc09d695e0b47aae6e977c13f535bfd" + hash: "2da540e72d88932b61a261d791fc34b0" } Key { type: 7 @@ -246,23 +246,23 @@ VisualTest { } Frame { msec: 784 - hash: "fbc09d695e0b47aae6e977c13f535bfd" + hash: "2da540e72d88932b61a261d791fc34b0" } Frame { msec: 800 - hash: "fbc09d695e0b47aae6e977c13f535bfd" + hash: "2da540e72d88932b61a261d791fc34b0" } Frame { msec: 816 - hash: "fbc09d695e0b47aae6e977c13f535bfd" + hash: "2da540e72d88932b61a261d791fc34b0" } Frame { msec: 832 - hash: "fbc09d695e0b47aae6e977c13f535bfd" + hash: "2da540e72d88932b61a261d791fc34b0" } Frame { msec: 848 - hash: "fbc09d695e0b47aae6e977c13f535bfd" + hash: "2da540e72d88932b61a261d791fc34b0" } Key { type: 6 @@ -274,15 +274,15 @@ VisualTest { } Frame { msec: 864 - hash: "a4b81c526a5bf8902fde9b8721980977" + hash: "25ade09747f07a9bdd07f5885a72dc55" } Frame { msec: 880 - hash: "a4b81c526a5bf8902fde9b8721980977" + hash: "25ade09747f07a9bdd07f5885a72dc55" } Frame { msec: 896 - hash: "a4b81c526a5bf8902fde9b8721980977" + hash: "25ade09747f07a9bdd07f5885a72dc55" } Key { type: 7 @@ -294,15 +294,15 @@ VisualTest { } Frame { msec: 912 - hash: "a4b81c526a5bf8902fde9b8721980977" + hash: "25ade09747f07a9bdd07f5885a72dc55" } Frame { msec: 928 - hash: "a4b81c526a5bf8902fde9b8721980977" + hash: "25ade09747f07a9bdd07f5885a72dc55" } Frame { msec: 944 - hash: "a4b81c526a5bf8902fde9b8721980977" + hash: "25ade09747f07a9bdd07f5885a72dc55" } Frame { msec: 960 @@ -310,7 +310,7 @@ VisualTest { } Frame { msec: 976 - hash: "a4b81c526a5bf8902fde9b8721980977" + hash: "25ade09747f07a9bdd07f5885a72dc55" } Key { type: 6 @@ -322,19 +322,19 @@ VisualTest { } Frame { msec: 992 - hash: "d072aebc2314a149a856634786b208a0" + hash: "0a60e76e96846f9f4e909f7a01ede377" } Frame { msec: 1008 - hash: "d072aebc2314a149a856634786b208a0" + hash: "0a60e76e96846f9f4e909f7a01ede377" } Frame { msec: 1024 - hash: "d072aebc2314a149a856634786b208a0" + hash: "0a60e76e96846f9f4e909f7a01ede377" } Frame { msec: 1040 - hash: "d072aebc2314a149a856634786b208a0" + hash: "6f28f435e552cbbf6376f2443ed3843c" } Key { type: 7 @@ -346,51 +346,51 @@ VisualTest { } Frame { msec: 1056 - hash: "d072aebc2314a149a856634786b208a0" + hash: "6f28f435e552cbbf6376f2443ed3843c" } Frame { msec: 1072 - hash: "d072aebc2314a149a856634786b208a0" + hash: "6f28f435e552cbbf6376f2443ed3843c" } Frame { msec: 1088 - hash: "d072aebc2314a149a856634786b208a0" + hash: "6f28f435e552cbbf6376f2443ed3843c" } Frame { msec: 1104 - hash: "d072aebc2314a149a856634786b208a0" + hash: "6f28f435e552cbbf6376f2443ed3843c" } Frame { msec: 1120 - hash: "d072aebc2314a149a856634786b208a0" + hash: "6f28f435e552cbbf6376f2443ed3843c" } Frame { msec: 1136 - hash: "d072aebc2314a149a856634786b208a0" + hash: "6f28f435e552cbbf6376f2443ed3843c" } Frame { msec: 1152 - hash: "d072aebc2314a149a856634786b208a0" + hash: "6f28f435e552cbbf6376f2443ed3843c" } Frame { msec: 1168 - hash: "d072aebc2314a149a856634786b208a0" + hash: "6f28f435e552cbbf6376f2443ed3843c" } Frame { msec: 1184 - hash: "d072aebc2314a149a856634786b208a0" + hash: "6f28f435e552cbbf6376f2443ed3843c" } Frame { msec: 1200 - hash: "d072aebc2314a149a856634786b208a0" + hash: "6f28f435e552cbbf6376f2443ed3843c" } Frame { msec: 1216 - hash: "d072aebc2314a149a856634786b208a0" + hash: "6f28f435e552cbbf6376f2443ed3843c" } Frame { msec: 1232 - hash: "d072aebc2314a149a856634786b208a0" + hash: "6f28f435e552cbbf6376f2443ed3843c" } Key { type: 6 @@ -402,15 +402,15 @@ VisualTest { } Frame { msec: 1248 - hash: "94defec2865529f185d02cfcbfe166cc" + hash: "16a353e711a8fb654b5fe3097ba29296" } Frame { msec: 1264 - hash: "94defec2865529f185d02cfcbfe166cc" + hash: "16a353e711a8fb654b5fe3097ba29296" } Frame { msec: 1280 - hash: "94defec2865529f185d02cfcbfe166cc" + hash: "16a353e711a8fb654b5fe3097ba29296" } Key { type: 7 @@ -422,15 +422,15 @@ VisualTest { } Frame { msec: 1296 - hash: "94defec2865529f185d02cfcbfe166cc" + hash: "16a353e711a8fb654b5fe3097ba29296" } Frame { msec: 1312 - hash: "94defec2865529f185d02cfcbfe166cc" + hash: "16a353e711a8fb654b5fe3097ba29296" } Frame { msec: 1328 - hash: "94defec2865529f185d02cfcbfe166cc" + hash: "16a353e711a8fb654b5fe3097ba29296" } Key { type: 6 @@ -442,39 +442,39 @@ VisualTest { } Frame { msec: 1344 - hash: "f625a2a82879df96141000e6931d4487" + hash: "fcdbf8ef17e1a7aa6e0e1d952b25d47d" } Frame { msec: 1360 - hash: "f625a2a82879df96141000e6931d4487" + hash: "fcdbf8ef17e1a7aa6e0e1d952b25d47d" } Frame { msec: 1376 - hash: "f625a2a82879df96141000e6931d4487" + hash: "fcdbf8ef17e1a7aa6e0e1d952b25d47d" } Frame { msec: 1392 - hash: "f625a2a82879df96141000e6931d4487" + hash: "fcdbf8ef17e1a7aa6e0e1d952b25d47d" } Frame { msec: 1408 - hash: "f625a2a82879df96141000e6931d4487" + hash: "fcdbf8ef17e1a7aa6e0e1d952b25d47d" } Frame { msec: 1424 - hash: "f625a2a82879df96141000e6931d4487" + hash: "fcdbf8ef17e1a7aa6e0e1d952b25d47d" } Frame { msec: 1440 - hash: "f625a2a82879df96141000e6931d4487" + hash: "fcdbf8ef17e1a7aa6e0e1d952b25d47d" } Frame { msec: 1456 - hash: "f625a2a82879df96141000e6931d4487" + hash: "fcdbf8ef17e1a7aa6e0e1d952b25d47d" } Frame { msec: 1472 - hash: "f625a2a82879df96141000e6931d4487" + hash: "fcdbf8ef17e1a7aa6e0e1d952b25d47d" } Key { type: 7 @@ -486,7 +486,7 @@ VisualTest { } Frame { msec: 1488 - hash: "f625a2a82879df96141000e6931d4487" + hash: "fcdbf8ef17e1a7aa6e0e1d952b25d47d" } Key { type: 6 @@ -498,19 +498,19 @@ VisualTest { } Frame { msec: 1504 - hash: "1cf29837a4ea63bbb06c15382680d1b6" + hash: "fe0e4e097f655e0b330ed6fcfce669c2" } Frame { msec: 1520 - hash: "1cf29837a4ea63bbb06c15382680d1b6" + hash: "fe0e4e097f655e0b330ed6fcfce669c2" } Frame { msec: 1536 - hash: "1cf29837a4ea63bbb06c15382680d1b6" + hash: "522f11cbb8da0cca25af91d3f6d5240b" } Frame { msec: 1552 - hash: "1cf29837a4ea63bbb06c15382680d1b6" + hash: "522f11cbb8da0cca25af91d3f6d5240b" } Key { type: 7 @@ -522,27 +522,27 @@ VisualTest { } Frame { msec: 1568 - hash: "1cf29837a4ea63bbb06c15382680d1b6" + hash: "522f11cbb8da0cca25af91d3f6d5240b" } Frame { msec: 1584 - hash: "1cf29837a4ea63bbb06c15382680d1b6" + hash: "522f11cbb8da0cca25af91d3f6d5240b" } Frame { msec: 1600 - hash: "1cf29837a4ea63bbb06c15382680d1b6" + hash: "522f11cbb8da0cca25af91d3f6d5240b" } Frame { msec: 1616 - hash: "1cf29837a4ea63bbb06c15382680d1b6" + hash: "522f11cbb8da0cca25af91d3f6d5240b" } Frame { msec: 1632 - hash: "1cf29837a4ea63bbb06c15382680d1b6" + hash: "522f11cbb8da0cca25af91d3f6d5240b" } Frame { msec: 1648 - hash: "1cf29837a4ea63bbb06c15382680d1b6" + hash: "522f11cbb8da0cca25af91d3f6d5240b" } Key { type: 6 @@ -554,23 +554,23 @@ VisualTest { } Frame { msec: 1664 - hash: "6eabb6d168ecc9ac604dcf2db0075380" + hash: "f459ca172e643d6e22c38067f8ced305" } Frame { msec: 1680 - hash: "6eabb6d168ecc9ac604dcf2db0075380" + hash: "f459ca172e643d6e22c38067f8ced305" } Frame { msec: 1696 - hash: "6eabb6d168ecc9ac604dcf2db0075380" + hash: "f459ca172e643d6e22c38067f8ced305" } Frame { msec: 1712 - hash: "6eabb6d168ecc9ac604dcf2db0075380" + hash: "f459ca172e643d6e22c38067f8ced305" } Frame { msec: 1728 - hash: "6eabb6d168ecc9ac604dcf2db0075380" + hash: "f459ca172e643d6e22c38067f8ced305" } Key { type: 6 @@ -582,7 +582,7 @@ VisualTest { } Frame { msec: 1744 - hash: "6eabb6d168ecc9ac604dcf2db0075380" + hash: "0016ecff508885d3a199b27baa9b7ecf" } Key { type: 7 @@ -594,15 +594,15 @@ VisualTest { } Frame { msec: 1760 - hash: "6eabb6d168ecc9ac604dcf2db0075380" + hash: "0016ecff508885d3a199b27baa9b7ecf" } Frame { msec: 1776 - hash: "6eabb6d168ecc9ac604dcf2db0075380" + hash: "0016ecff508885d3a199b27baa9b7ecf" } Frame { msec: 1792 - hash: "6eabb6d168ecc9ac604dcf2db0075380" + hash: "0016ecff508885d3a199b27baa9b7ecf" } Key { type: 7 @@ -614,19 +614,19 @@ VisualTest { } Frame { msec: 1808 - hash: "6eabb6d168ecc9ac604dcf2db0075380" + hash: "0016ecff508885d3a199b27baa9b7ecf" } Frame { msec: 1824 - hash: "6eabb6d168ecc9ac604dcf2db0075380" + hash: "0016ecff508885d3a199b27baa9b7ecf" } Frame { msec: 1840 - hash: "6eabb6d168ecc9ac604dcf2db0075380" + hash: "0016ecff508885d3a199b27baa9b7ecf" } Frame { msec: 1856 - hash: "6eabb6d168ecc9ac604dcf2db0075380" + hash: "0016ecff508885d3a199b27baa9b7ecf" } Key { type: 6 @@ -638,15 +638,15 @@ VisualTest { } Frame { msec: 1872 - hash: "cb2dc1c4fc4e213841b873561f404a4f" + hash: "05c631afb9df51c23b1f714a7de92788" } Frame { msec: 1888 - hash: "cb2dc1c4fc4e213841b873561f404a4f" + hash: "05c631afb9df51c23b1f714a7de92788" } Frame { msec: 1904 - hash: "cb2dc1c4fc4e213841b873561f404a4f" + hash: "05c631afb9df51c23b1f714a7de92788" } Frame { msec: 1920 @@ -662,27 +662,27 @@ VisualTest { } Frame { msec: 1936 - hash: "cb2dc1c4fc4e213841b873561f404a4f" + hash: "05c631afb9df51c23b1f714a7de92788" } Frame { msec: 1952 - hash: "cb2dc1c4fc4e213841b873561f404a4f" + hash: "05c631afb9df51c23b1f714a7de92788" } Frame { msec: 1968 - hash: "cb2dc1c4fc4e213841b873561f404a4f" + hash: "05c631afb9df51c23b1f714a7de92788" } Frame { msec: 1984 - hash: "cb2dc1c4fc4e213841b873561f404a4f" + hash: "05c631afb9df51c23b1f714a7de92788" } Frame { msec: 2000 - hash: "cb2dc1c4fc4e213841b873561f404a4f" + hash: "05c631afb9df51c23b1f714a7de92788" } Frame { msec: 2016 - hash: "cb2dc1c4fc4e213841b873561f404a4f" + hash: "05c631afb9df51c23b1f714a7de92788" } Key { type: 6 @@ -694,11 +694,11 @@ VisualTest { } Frame { msec: 2032 - hash: "c2aff1ebdee69cca7dc67a102fce5e8e" + hash: "95ad72a49b991225e2ed5ae9c2a7b4e5" } Frame { msec: 2048 - hash: "c2aff1ebdee69cca7dc67a102fce5e8e" + hash: "95ad72a49b991225e2ed5ae9c2a7b4e5" } Key { type: 7 @@ -710,11 +710,11 @@ VisualTest { } Frame { msec: 2064 - hash: "c2aff1ebdee69cca7dc67a102fce5e8e" + hash: "95ad72a49b991225e2ed5ae9c2a7b4e5" } Frame { msec: 2080 - hash: "c2aff1ebdee69cca7dc67a102fce5e8e" + hash: "95ad72a49b991225e2ed5ae9c2a7b4e5" } Key { type: 6 @@ -726,19 +726,19 @@ VisualTest { } Frame { msec: 2096 - hash: "c82441813af6ff577687f29f6a09da38" + hash: "7f2366b163c110a50259936c150d8287" } Frame { msec: 2112 - hash: "c82441813af6ff577687f29f6a09da38" + hash: "7f2366b163c110a50259936c150d8287" } Frame { msec: 2128 - hash: "c82441813af6ff577687f29f6a09da38" + hash: "7f2366b163c110a50259936c150d8287" } Frame { msec: 2144 - hash: "c82441813af6ff577687f29f6a09da38" + hash: "7f2366b163c110a50259936c150d8287" } Key { type: 6 @@ -758,19 +758,19 @@ VisualTest { } Frame { msec: 2160 - hash: "d7da9862980b99e97a1fcd1b5c4c976f" + hash: "b5110b1a7aa74f7b4ed72f573f10b1fe" } Frame { msec: 2176 - hash: "d7da9862980b99e97a1fcd1b5c4c976f" + hash: "b5110b1a7aa74f7b4ed72f573f10b1fe" } Frame { msec: 2192 - hash: "d7da9862980b99e97a1fcd1b5c4c976f" + hash: "b5110b1a7aa74f7b4ed72f573f10b1fe" } Frame { msec: 2208 - hash: "d7da9862980b99e97a1fcd1b5c4c976f" + hash: "b5110b1a7aa74f7b4ed72f573f10b1fe" } Key { type: 6 @@ -782,7 +782,7 @@ VisualTest { } Frame { msec: 2224 - hash: "d7da9862980b99e97a1fcd1b5c4c976f" + hash: "30cdfb276e7a234c72d89a03e6a10dc5" } Key { type: 7 @@ -794,23 +794,23 @@ VisualTest { } Frame { msec: 2240 - hash: "d7da9862980b99e97a1fcd1b5c4c976f" + hash: "30cdfb276e7a234c72d89a03e6a10dc5" } Frame { msec: 2256 - hash: "d7da9862980b99e97a1fcd1b5c4c976f" + hash: "30cdfb276e7a234c72d89a03e6a10dc5" } Frame { msec: 2272 - hash: "d7da9862980b99e97a1fcd1b5c4c976f" + hash: "30cdfb276e7a234c72d89a03e6a10dc5" } Frame { msec: 2288 - hash: "d7da9862980b99e97a1fcd1b5c4c976f" + hash: "30cdfb276e7a234c72d89a03e6a10dc5" } Frame { msec: 2304 - hash: "d7da9862980b99e97a1fcd1b5c4c976f" + hash: "30cdfb276e7a234c72d89a03e6a10dc5" } Key { type: 7 @@ -822,11 +822,11 @@ VisualTest { } Frame { msec: 2320 - hash: "d7da9862980b99e97a1fcd1b5c4c976f" + hash: "30cdfb276e7a234c72d89a03e6a10dc5" } Frame { msec: 2336 - hash: "d7da9862980b99e97a1fcd1b5c4c976f" + hash: "30cdfb276e7a234c72d89a03e6a10dc5" } Key { type: 6 @@ -838,27 +838,27 @@ VisualTest { } Frame { msec: 2352 - hash: "8f36e26d8685fe55e7a1dd294188f649" + hash: "c0f7406f3718ab0120c79ff119d6986c" } Frame { msec: 2368 - hash: "8f36e26d8685fe55e7a1dd294188f649" + hash: "c0f7406f3718ab0120c79ff119d6986c" } Frame { msec: 2384 - hash: "8f36e26d8685fe55e7a1dd294188f649" + hash: "c0f7406f3718ab0120c79ff119d6986c" } Frame { msec: 2400 - hash: "8f36e26d8685fe55e7a1dd294188f649" + hash: "c0f7406f3718ab0120c79ff119d6986c" } Frame { msec: 2416 - hash: "8f36e26d8685fe55e7a1dd294188f649" + hash: "c0f7406f3718ab0120c79ff119d6986c" } Frame { msec: 2432 - hash: "8f36e26d8685fe55e7a1dd294188f649" + hash: "c0f7406f3718ab0120c79ff119d6986c" } Key { type: 7 @@ -870,19 +870,19 @@ VisualTest { } Frame { msec: 2448 - hash: "8f36e26d8685fe55e7a1dd294188f649" + hash: "c0f7406f3718ab0120c79ff119d6986c" } Frame { msec: 2464 - hash: "8f36e26d8685fe55e7a1dd294188f649" + hash: "c0f7406f3718ab0120c79ff119d6986c" } Frame { msec: 2480 - hash: "8f36e26d8685fe55e7a1dd294188f649" + hash: "c0f7406f3718ab0120c79ff119d6986c" } Frame { msec: 2496 - hash: "8f36e26d8685fe55e7a1dd294188f649" + hash: "c0f7406f3718ab0120c79ff119d6986c" } Key { type: 6 @@ -894,15 +894,15 @@ VisualTest { } Frame { msec: 2512 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "870d7866b8e289b4843b62c856d769d4" } Frame { msec: 2528 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "870d7866b8e289b4843b62c856d769d4" } Frame { msec: 2544 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Key { type: 7 @@ -914,83 +914,83 @@ VisualTest { } Frame { msec: 2560 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2576 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2592 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2608 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2624 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2640 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2656 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2672 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2688 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2704 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2720 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2736 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2752 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2768 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2784 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2800 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2816 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2832 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2848 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2864 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2880 @@ -998,46 +998,46 @@ VisualTest { } Frame { msec: 2896 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2912 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2928 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2944 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2960 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2976 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 2992 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 3008 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 3024 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "84e1cbf26e6b571603e0b9e69579af8b" } Frame { msec: 3040 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "870d7866b8e289b4843b62c856d769d4" } Frame { msec: 3056 - hash: "316f2ba46d059755576e6822dc77afb2" + hash: "870d7866b8e289b4843b62c856d769d4" } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.0.png new file mode 100644 index 0000000..b064e79 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.0.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.1.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.1.png new file mode 100644 index 0000000..7dd1bd8 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.1.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.10.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.10.png new file mode 100644 index 0000000..d8e55e2 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.10.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.2.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.2.png new file mode 100644 index 0000000..f9f1744 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.2.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.3.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.3.png new file mode 100644 index 0000000..70ae713 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.3.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.4.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.4.png new file mode 100644 index 0000000..9ce28db Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.4.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.5.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.5.png new file mode 100644 index 0000000..2ef2ac0 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.5.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.6.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.6.png new file mode 100644 index 0000000..2a614f8 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.6.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.7.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.7.png new file mode 100644 index 0000000..f916c97 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.7.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.8.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.8.png new file mode 100644 index 0000000..56bf00b Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.8.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.9.png b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.9.png new file mode 100644 index 0000000..97847d9 Binary files /dev/null and b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.9.png differ diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.qml new file mode 100644 index 0000000..645b447 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/data-X11/usingLineEdit.qml @@ -0,0 +1,4335 @@ +import Qt.VisualTest 4.6 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 32 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 48 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 64 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 80 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 96 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 112 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 128 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 144 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 160 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 176 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 192 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 208 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 224 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 240 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 256 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 272 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 288 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 304 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 320 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 336 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 352 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 368 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 384 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 400 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 416 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 432 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 448 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 464 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 480 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 496 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 512 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 528 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 544 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 560 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 576 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 592 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 608 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 624 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 640 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 656 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 672 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 688 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 704 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 720 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 736 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 752 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 768 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 784 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 800 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 816 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 832 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 848 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 864 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 880 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 896 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 912 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Frame { + msec: 928 + hash: "a6d33b1212bb4d1241734bfff167d1a5" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 85; y: 11 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 944 + hash: "c83faf1ed7b59715046e1abef04fa546" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 85; y: 11 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 960 + image: "usingLineEdit.0.png" + } + Mouse { + type: 4 + button: 1 + buttons: 1 + x: 85; y: 11 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 976 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 992 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1008 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1024 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1040 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1056 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 85; y: 11 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1072 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1088 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1104 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1120 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1136 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1152 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1168 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1184 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1200 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1216 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1232 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1248 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1264 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1280 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1296 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1312 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1328 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1344 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1360 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Key { + type: 6 + key: 16777249 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 1376 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1392 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1408 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1424 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1440 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1456 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1472 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1488 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1504 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1520 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1536 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1552 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1568 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1584 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1600 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1616 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1632 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1648 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1664 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1680 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1696 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1712 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1728 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1744 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1760 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1776 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1792 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1808 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1824 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1840 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1856 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1872 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1888 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1904 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1920 + image: "usingLineEdit.1.png" + } + Frame { + msec: 1936 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1952 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1968 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 1984 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Key { + type: 6 + key: 67 + modifiers: 67108864 + text: "03" + autorep: false + count: 1 + } + Frame { + msec: 2000 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2016 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2032 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2048 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2064 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2080 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2096 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2112 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Key { + type: 7 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Key { + type: 7 + key: 67 + modifiers: 0 + text: "63" + autorep: false + count: 1 + } + Frame { + msec: 2128 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2144 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2160 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2176 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2192 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2208 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2224 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2240 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2256 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2272 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2288 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2304 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2320 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2336 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2352 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2368 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2384 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2400 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2416 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2432 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2448 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2464 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Frame { + msec: 2480 + hash: "3b899cd28b58c3f94946286a0ddcab89" + } + Key { + type: 6 + key: 16777233 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 2496 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2512 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2528 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2544 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2560 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2576 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Key { + type: 7 + key: 16777233 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 2592 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2608 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2624 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2640 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2656 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2672 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2688 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2704 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2720 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2736 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2752 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2768 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2784 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Key { + type: 6 + key: 16777249 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 2800 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2816 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2832 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2848 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2864 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2880 + image: "usingLineEdit.2.png" + } + Frame { + msec: 2896 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2912 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2928 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2944 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2960 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2976 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 2992 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 3008 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 3024 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 3040 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 3056 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 3072 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 3088 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 3104 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 3120 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 3136 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 3152 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 3168 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 3184 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 3200 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Frame { + msec: 3216 + hash: "f2a573f227a3eb84f60418d0f3e81fb3" + } + Key { + type: 6 + key: 86 + modifiers: 67108864 + text: "16" + autorep: false + count: 1 + } + Frame { + msec: 3232 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3248 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3264 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3280 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3296 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3312 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3328 + hash: "202ad01bacfb48341efdd85197df6964" + } + Key { + type: 7 + key: 86 + modifiers: 67108864 + text: "16" + autorep: false + count: 1 + } + Frame { + msec: 3344 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3360 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3376 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3392 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3408 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3424 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3440 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3456 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3472 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3488 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3504 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3520 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3536 + hash: "202ad01bacfb48341efdd85197df6964" + } + Frame { + msec: 3552 + hash: "202ad01bacfb48341efdd85197df6964" + } + Key { + type: 6 + key: 86 + modifiers: 67108864 + text: "16" + autorep: false + count: 1 + } + Frame { + msec: 3568 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3584 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3600 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3616 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3632 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3648 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3664 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3680 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Key { + type: 7 + key: 86 + modifiers: 67108864 + text: "16" + autorep: false + count: 1 + } + Frame { + msec: 3696 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3712 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3728 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3744 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3760 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3776 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3792 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3808 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3824 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3840 + image: "usingLineEdit.3.png" + } + Frame { + msec: 3856 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3872 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3888 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3904 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3920 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3936 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3952 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3968 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 3984 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4000 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4016 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4032 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4048 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4064 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4080 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4096 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4112 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4128 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4144 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4160 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4176 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4192 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Key { + type: 7 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 4208 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4224 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4240 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4256 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4272 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4288 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4304 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4320 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4336 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4352 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4368 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4384 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4400 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4416 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4432 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4448 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4464 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4480 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4496 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4512 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4528 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4544 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4560 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4576 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4592 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4608 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4624 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4640 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4656 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4672 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4688 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Frame { + msec: 4704 + hash: "eac37a53473ad7f378a2a1bb37fa6b58" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 69; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4720 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4736 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4752 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4768 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4784 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4800 + image: "usingLineEdit.4.png" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 69; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 4816 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4832 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4848 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4864 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4880 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4896 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4912 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4928 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4944 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4960 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4976 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 4992 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5008 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5024 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5040 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5056 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5072 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5088 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5104 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5120 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5136 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5152 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5168 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5184 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5200 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5216 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5232 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5248 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5264 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5280 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5296 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5312 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5328 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5344 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Frame { + msec: 5360 + hash: "c65ff28e032b18223c65f8810b39d603" + } + Key { + type: 6 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 5376 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5392 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5408 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5424 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5440 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5456 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5472 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5488 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5504 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5520 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5536 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5552 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5568 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5584 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5600 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Frame { + msec: 5616 + hash: "8c755780c2d281aba23c507bcebfd5db" + } + Key { + type: 7 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Key { + type: 6 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 5632 + hash: "baa42bc9d5e16c3e7af81e126d37655a" + } + Frame { + msec: 5648 + hash: "baa42bc9d5e16c3e7af81e126d37655a" + } + Key { + type: 7 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Key { + type: 6 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 5664 + hash: "aa876e6d6ff0f169bcc3cf25be5e7a81" + } + Frame { + msec: 5680 + hash: "aa876e6d6ff0f169bcc3cf25be5e7a81" + } + Key { + type: 7 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Key { + type: 6 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 5696 + hash: "8ec4c1a8ae28af44dcabf338fc056717" + } + Frame { + msec: 5712 + hash: "8ec4c1a8ae28af44dcabf338fc056717" + } + Key { + type: 7 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Key { + type: 6 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 5728 + hash: "ec0da333c0bc090eec0ded5e4d18bd6e" + } + Frame { + msec: 5744 + hash: "ec0da333c0bc090eec0ded5e4d18bd6e" + } + Key { + type: 7 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Key { + type: 6 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 5760 + image: "usingLineEdit.5.png" + } + Frame { + msec: 5776 + hash: "325ba5789a6150ec0fef81fa5b005c09" + } + Key { + type: 7 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Key { + type: 6 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 5792 + hash: "023dd8fe428b1ed0f4c994f7e67ac3cd" + } + Frame { + msec: 5808 + hash: "023dd8fe428b1ed0f4c994f7e67ac3cd" + } + Key { + type: 7 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Key { + type: 6 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 5824 + hash: "f661f599f576ae883f25422b20408138" + } + Frame { + msec: 5840 + hash: "f661f599f576ae883f25422b20408138" + } + Key { + type: 7 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 5856 + hash: "f661f599f576ae883f25422b20408138" + } + Key { + type: 6 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 5872 + hash: "8e7ad34802a0ced493e88b779c73cc47" + } + Frame { + msec: 5888 + hash: "8e7ad34802a0ced493e88b779c73cc47" + } + Key { + type: 7 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Key { + type: 6 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 5904 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Key { + type: 7 + key: 16777236 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 5920 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Frame { + msec: 5936 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Frame { + msec: 5952 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Frame { + msec: 5968 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Frame { + msec: 5984 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Frame { + msec: 6000 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Frame { + msec: 6016 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Frame { + msec: 6032 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Frame { + msec: 6048 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Key { + type: 6 + key: 16777249 + modifiers: 0 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 6064 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Frame { + msec: 6080 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Frame { + msec: 6096 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Frame { + msec: 6112 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Frame { + msec: 6128 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Frame { + msec: 6144 + hash: "943c7ec51fbe8db38fcd3086990fa4e0" + } + Key { + type: 6 + key: 16777234 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 6160 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6176 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6192 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6208 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6224 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6240 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6256 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6272 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6288 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6304 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6320 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6336 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6352 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6368 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6384 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Frame { + msec: 6400 + hash: "bd2e37c4ac90a6389f7f4e1e1360b31b" + } + Key { + type: 7 + key: 16777234 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Key { + type: 6 + key: 16777234 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 6416 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6432 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Key { + type: 7 + key: 16777234 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Key { + type: 6 + key: 16777234 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 6448 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6464 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Key { + type: 7 + key: 16777234 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Key { + type: 6 + key: 16777234 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Key { + type: 7 + key: 16777234 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 6480 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6496 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6512 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6528 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6544 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6560 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6576 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6592 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6608 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6624 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6640 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6656 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6672 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6688 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6704 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6720 + image: "usingLineEdit.6.png" + } + Frame { + msec: 6736 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6752 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6768 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6784 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Key { + type: 6 + key: 16777234 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 6800 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Key { + type: 7 + key: 16777234 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 6816 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6832 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6848 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6864 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6880 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6896 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6912 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6928 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Frame { + msec: 6944 + hash: "608bba00320e20da05aa2a6bbcba6e19" + } + Key { + type: 6 + key: 16777236 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 6960 + hash: "40456a6d22e09e1817b07f3898676524" + } + Frame { + msec: 6976 + hash: "40456a6d22e09e1817b07f3898676524" + } + Frame { + msec: 6992 + hash: "40456a6d22e09e1817b07f3898676524" + } + Frame { + msec: 7008 + hash: "40456a6d22e09e1817b07f3898676524" + } + Key { + type: 7 + key: 16777236 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 7024 + hash: "40456a6d22e09e1817b07f3898676524" + } + Frame { + msec: 7040 + hash: "40456a6d22e09e1817b07f3898676524" + } + Frame { + msec: 7056 + hash: "40456a6d22e09e1817b07f3898676524" + } + Frame { + msec: 7072 + hash: "40456a6d22e09e1817b07f3898676524" + } + Frame { + msec: 7088 + hash: "40456a6d22e09e1817b07f3898676524" + } + Key { + type: 6 + key: 16777236 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 7104 + hash: "dada78341b65c1efb2816e16a8cbe8b5" + } + Frame { + msec: 7120 + hash: "dada78341b65c1efb2816e16a8cbe8b5" + } + Frame { + msec: 7136 + hash: "dada78341b65c1efb2816e16a8cbe8b5" + } + Frame { + msec: 7152 + hash: "dada78341b65c1efb2816e16a8cbe8b5" + } + Key { + type: 7 + key: 16777236 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 7168 + hash: "dada78341b65c1efb2816e16a8cbe8b5" + } + Frame { + msec: 7184 + hash: "dada78341b65c1efb2816e16a8cbe8b5" + } + Frame { + msec: 7200 + hash: "dada78341b65c1efb2816e16a8cbe8b5" + } + Frame { + msec: 7216 + hash: "dada78341b65c1efb2816e16a8cbe8b5" + } + Frame { + msec: 7232 + hash: "dada78341b65c1efb2816e16a8cbe8b5" + } + Frame { + msec: 7248 + hash: "dada78341b65c1efb2816e16a8cbe8b5" + } + Frame { + msec: 7264 + hash: "dada78341b65c1efb2816e16a8cbe8b5" + } + Key { + type: 6 + key: 16777236 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 7280 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7296 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7312 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7328 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7344 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Key { + type: 7 + key: 16777236 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 7360 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7376 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7392 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7408 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7424 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7440 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7456 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7472 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7488 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7504 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7520 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Key { + type: 7 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 7536 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7552 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7568 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7584 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7600 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7616 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7632 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7648 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7664 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7680 + image: "usingLineEdit.7.png" + } + Frame { + msec: 7696 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7712 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7728 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7744 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7760 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7776 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7792 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7808 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7824 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7840 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7856 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7872 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7888 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7904 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7920 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7936 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7952 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7968 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 7984 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8000 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8016 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8032 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8048 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8064 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8080 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8096 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8112 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8128 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8144 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8160 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8176 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8192 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8208 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8224 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8240 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8256 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8272 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8288 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8304 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8320 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8336 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8352 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8368 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8384 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8400 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8416 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8432 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8448 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8464 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8480 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Frame { + msec: 8496 + hash: "f249bfae1934844abfd5fc158a9c89cf" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 61; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8512 + hash: "e594125fb367adee5b6acdb1268c86cd" + } + Frame { + msec: 8528 + hash: "e594125fb367adee5b6acdb1268c86cd" + } + Frame { + msec: 8544 + hash: "e594125fb367adee5b6acdb1268c86cd" + } + Frame { + msec: 8560 + hash: "e594125fb367adee5b6acdb1268c86cd" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 60; y: 38 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 58; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8576 + hash: "e594125fb367adee5b6acdb1268c86cd" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 46; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8592 + hash: "7d4116a8689b6995702a042d974ef74b" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 41; y: 38 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 40; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8608 + hash: "cb9221f27ac24e4b6b103ca53acad3b3" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 32; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8624 + hash: "074bc6abd9a67db829ae5d6c5f187fb6" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 31; y: 38 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 30; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8640 + image: "usingLineEdit.8.png" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 29; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8656 + hash: "074bc6abd9a67db829ae5d6c5f187fb6" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 28; y: 38 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 27; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8672 + hash: "074bc6abd9a67db829ae5d6c5f187fb6" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 26; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8688 + hash: "7e403c56d5652321a7701529fc6b8098" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 25; y: 38 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 24; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8704 + hash: "7e403c56d5652321a7701529fc6b8098" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 23; y: 38 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 22; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8720 + hash: "7e403c56d5652321a7701529fc6b8098" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 20; y: 38 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 19; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8736 + hash: "7e403c56d5652321a7701529fc6b8098" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 18; y: 38 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 17; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8752 + hash: "2435f2526b3ccc12b7b573872b40e5f1" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 16; y: 38 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 15; y: 37 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8768 + hash: "2435f2526b3ccc12b7b573872b40e5f1" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 14; y: 37 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 13; y: 37 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8784 + hash: "2435f2526b3ccc12b7b573872b40e5f1" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 12; y: 37 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 11; y: 37 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8800 + hash: "2435f2526b3ccc12b7b573872b40e5f1" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 10; y: 37 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 8; y: 37 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8816 + hash: "f5a185b954e8b181222cc50075d8ebb6" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 6; y: 37 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 5; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8832 + hash: "93a00b37c5027650791d1ff589408d0d" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 3; y: 36 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 2; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8848 + hash: "0b29f6006be3604ef862db7d31f9a434" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 0; y: 36 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -1; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8864 + hash: "8390b63b71e1452cb93c576a3f2395e1" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -2; y: 36 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -3; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8880 + hash: "72298910946a4e1a9ccc4520d99e9420" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -5; y: 36 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -6; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8896 + hash: "17d349b0ed29d6aa57bf8fda9a55abf8" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -7; y: 36 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -9; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8912 + hash: "01e8a877d51f5564aaf2f11e7aadbc4a" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -10; y: 36 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -11; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8928 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -12; y: 36 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -13; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8944 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -14; y: 36 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -15; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8960 + hash: "bc8f49abd277f5f15d422341de212183" + } + Frame { + msec: 8976 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -16; y: 36 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -17; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 8992 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -18; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9008 + hash: "bc8f49abd277f5f15d422341de212183" + } + Frame { + msec: 9024 + hash: "bc8f49abd277f5f15d422341de212183" + } + Frame { + msec: 9040 + hash: "bc8f49abd277f5f15d422341de212183" + } + Frame { + msec: 9056 + hash: "bc8f49abd277f5f15d422341de212183" + } + Frame { + msec: 9072 + hash: "bc8f49abd277f5f15d422341de212183" + } + Frame { + msec: 9088 + hash: "bc8f49abd277f5f15d422341de212183" + } + Frame { + msec: 9104 + hash: "bc8f49abd277f5f15d422341de212183" + } + Frame { + msec: 9120 + hash: "bc8f49abd277f5f15d422341de212183" + } + Frame { + msec: 9136 + hash: "bc8f49abd277f5f15d422341de212183" + } + Frame { + msec: 9152 + hash: "bc8f49abd277f5f15d422341de212183" + } + Frame { + msec: 9168 + hash: "bc8f49abd277f5f15d422341de212183" + } + Frame { + msec: 9184 + hash: "bc8f49abd277f5f15d422341de212183" + } + Frame { + msec: 9200 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -17; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9216 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -16; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9232 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -14; y: 35 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -13; y: 35 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9248 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -11; y: 35 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -10; y: 34 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9264 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -8; y: 34 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -7; y: 34 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9280 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -6; y: 33 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -5; y: 33 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9296 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -3; y: 32 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: -1; y: 32 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9312 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 1; y: 31 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 3; y: 31 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9328 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 4; y: 31 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 6; y: 30 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9344 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 7; y: 30 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 8; y: 30 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9360 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 10; y: 30 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 11; y: 30 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9376 + hash: "bc8f49abd277f5f15d422341de212183" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 12; y: 30 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 14; y: 30 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9392 + hash: "12e705f08ff90fd8ddb1937e5a7e23a0" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 15; y: 30 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 17; y: 30 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9408 + hash: "12e705f08ff90fd8ddb1937e5a7e23a0" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 21; y: 30 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 24; y: 30 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9424 + hash: "4daae0f05ff1b7ef68ed1d839b113dc4" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 27; y: 31 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 30; y: 31 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9440 + hash: "a1186544d7f5576e6ccbbd7938c1c374" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 33; y: 32 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 35; y: 32 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9456 + hash: "6ce09c9a06135d2280e4f7bc1c81b70e" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 38; y: 32 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 39; y: 33 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9472 + hash: "6ce09c9a06135d2280e4f7bc1c81b70e" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 43; y: 33 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 45; y: 33 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9488 + hash: "035b177c3cacd8cdef807d5673de4607" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 48; y: 33 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 50; y: 33 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9504 + hash: "7b7e3c4600f3af7bd0f45799661db993" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 51; y: 33 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 53; y: 33 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9520 + hash: "7b7e3c4600f3af7bd0f45799661db993" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 55; y: 33 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9536 + hash: "7b7e3c4600f3af7bd0f45799661db993" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 56; y: 33 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 58; y: 33 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9552 + hash: "859950e1cf496ef830a30b3a0ec801ac" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 61; y: 33 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 64; y: 33 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9568 + hash: "859950e1cf496ef830a30b3a0ec801ac" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 67; y: 33 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 70; y: 33 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9584 + hash: "be7343825b6adcb16f49e20ee2bdf19f" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 73; y: 33 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 74; y: 34 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9600 + image: "usingLineEdit.9.png" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 76; y: 34 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9616 + hash: "597923ce1046fbf4b728545c54c97fa5" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 77; y: 34 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 78; y: 34 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9632 + hash: "597923ce1046fbf4b728545c54c97fa5" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 79; y: 34 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 80; y: 35 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9648 + hash: "597923ce1046fbf4b728545c54c97fa5" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 81; y: 35 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 84; y: 35 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9664 + hash: "2fc5c42f94350f28ae0117bc7f6daff1" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 85; y: 36 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 88; y: 36 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9680 + hash: "4b4ec69d583151f1a64052d696966f9c" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 89; y: 37 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 91; y: 37 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9696 + hash: "0882a25ac1c2b534367736d825a73630" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 92; y: 37 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 94; y: 37 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9712 + hash: "d5b6acc155f827c05b0c4c289a2e3eec" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 95; y: 37 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 96; y: 37 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9728 + hash: "a05b3f2f9f22249ab694ac45e1de7b85" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 98; y: 38 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 100; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9744 + hash: "5b0e034813f8543627f370efdcf3591e" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 102; y: 38 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 104; y: 38 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9760 + hash: "5b8d80b9d7e2a8c1a24c28e127d0f7e5" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 105; y: 39 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 108; y: 39 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9776 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 109; y: 39 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 110; y: 39 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9792 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 111; y: 39 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9808 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 112; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9824 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 113; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9840 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 114; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9856 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 9872 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 115; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9888 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 116; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9904 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 117; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9920 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 118; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9936 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 9952 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 119; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9968 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 120; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 9984 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 121; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 10000 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10016 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 122; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 10032 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10048 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10064 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10080 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10096 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10112 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10128 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10144 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10160 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10176 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10192 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10208 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10224 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10240 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 122; y: 40 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 10256 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10272 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10288 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10304 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10320 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10336 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10352 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10368 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10384 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10400 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10416 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10432 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10448 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10464 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10480 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10496 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10512 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10528 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10544 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10560 + image: "usingLineEdit.10.png" + } + Frame { + msec: 10576 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10592 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10608 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10624 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10640 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10656 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10672 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10688 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10704 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10720 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10736 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10752 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10768 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10784 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10800 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10816 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10832 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10848 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10864 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10880 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10896 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10912 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10928 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10944 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10960 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10976 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 10992 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11008 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11024 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11040 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11056 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11072 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11088 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11104 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11120 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11136 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11152 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11168 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11184 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11200 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11216 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11232 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11248 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } + Frame { + msec: 11264 + hash: "66715d4a4f83d0e5905adbc4c459b0fb" + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/echoMode.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/echoMode.qml index b0b50e4..ed8bc2c 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/echoMode.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/echoMode.qml @@ -4,7 +4,7 @@ Item{ height: 50; width: 200 Column{ //Not an exhaustive echo mode test, that's in QLineEdit (since the functionality is in QLineControl) - TextInput{ id: main; focus: true; echoMode: TextInput.Password } + TextInput{ id: main; focus: true; echoMode: TextInput.Password; passwordCharacter: '.' } Text{ text: main.text } } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextinput/usingLineEdit.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/usingLineEdit.qml new file mode 100644 index 0000000..2465866 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextinput/usingLineEdit.qml @@ -0,0 +1,10 @@ +import Qt 4.7 + +Rectangle{ + width: 600 + height: 200 + Column{ + LineEdit{text: 'Hello world'} + LineEdit{text: 'Hello underwhelmingly verbose world'; width: 80; height: 24;} + } +} -- cgit v0.12 From adb27f56d46fde3ccbd110186f1781ee0b3f98d0 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 12 Apr 2010 17:47:16 +1000 Subject: Doc: update Rectangle smooth painting screenshot. --- doc/src/declarative/pics/rect-smooth.png | Bin 32162 -> 24241 bytes .../graphicsitems/qdeclarativerectangle.cpp | 1 + 2 files changed, 1 insertion(+) diff --git a/doc/src/declarative/pics/rect-smooth.png b/doc/src/declarative/pics/rect-smooth.png index abbb0a9..7ffd8ab 100644 Binary files a/doc/src/declarative/pics/rect-smooth.png and b/doc/src/declarative/pics/rect-smooth.png differ diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 3f7548f..54c8ab2 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -464,6 +464,7 @@ void QDeclarativeRectangle::drawRect(QPainter &p) filtering at the beginning of the animation and reenable it at the conclusion. \image rect-smooth.png + On this image, smooth is turned off on the top half and on on the bottom half. */ QRectF QDeclarativeRectangle::boundingRect() const -- cgit v0.12 From 94c9d486f266a4c99e389e900c9e157c077b7c7e Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Mon, 12 Apr 2010 17:46:10 +1000 Subject: Fix declarative examples autotest, avoid using native separators Reviewed-by: Joona Petrell --- tests/auto/declarative/examples/tst_examples.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 6d7e578..25cd1ee 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -90,7 +90,7 @@ to have them tested by the examples() test. void tst_examples::namingConvention(const QDir &d) { for (int ii = 0; ii < excludedDirs.count(); ++ii) { - QString s = QDir::toNativeSeparators(excludedDirs.at(ii)); + QString s = excludedDirs.at(ii); if (d.absolutePath().endsWith(s)) return; } @@ -131,7 +131,7 @@ void tst_examples::namingConvention() QStringList tst_examples::findQmlFiles(const QDir &d) { for (int ii = 0; ii < excludedDirs.count(); ++ii) { - QString s = QDir::toNativeSeparators(excludedDirs.at(ii)); + QString s = excludedDirs.at(ii); if (d.absolutePath().endsWith(s)) return QStringList(); } -- cgit v0.12 From db25af420b394e35883dedcbfd28fd02a8a573bd Mon Sep 17 00:00:00 2001 From: mae Date: Mon, 12 Apr 2010 13:38:32 +0200 Subject: More error output for QML_IMPORT_TRACE=1 --- src/declarative/qml/qdeclarativeengine.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index a3a43e6..f1adc16 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1947,6 +1947,13 @@ bool QDeclarativeEngine::importPlugin(const QString &filePath, const QString &ur if (!engineInitialized || !typesRegistered) { QPluginLoader loader(absoluteFilePath); + if (!loader.load()) { + if (qmlImportTrace()) { + qDebug() << "QDeclarativeEngine::importPlugin: " << loader.errorString(); + } + return false; + } + if (QDeclarativeExtensionInterface *iface = qobject_cast(loader.instance())) { const QByteArray bytes = uri.toUtf8(); @@ -1965,6 +1972,8 @@ bool QDeclarativeEngine::importPlugin(const QString &filePath, const QString &ur iface->initializeEngine(this, moduleId); } } else { + if (qmlImportTrace()) + qDebug() << "QDeclarativeEngine::importPlugin: no DeclarativeExtensionInterface error"; return false; } } -- cgit v0.12 From 0a226e31605ae9c1843e23adbe6be393f6cd8cac Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 12 Apr 2010 14:37:36 +0200 Subject: Don't test XmlListModel examples on platforms without QtXmlPatterns --- tests/auto/declarative/examples/tst_examples.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 25cd1ee..3d717bc 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -81,6 +81,12 @@ tst_examples::tst_examples() excludedDirs << "examples/declarative/plugins"; excludedDirs << "examples/declarative/proxywidgets"; excludedDirs << "examples/declarative/gestures"; +#ifdef QT_NO_XMLPATTERNS + excludedDirs << "examples/declarative/xmldata"; + excludedDirs << "demos/declarative/twitter"; + excludedDirs << "demos/declarative/flickr"; + excludedDirs << "demos/declarative/photoviewer"; +#endif } /* -- cgit v0.12 From ff0020481398e7c109973949260a42711c4cdcdc Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Tue, 13 Apr 2010 08:26:12 +1000 Subject: doc fixes --- src/declarative/graphicsitems/qdeclarativetext.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index f31f5aa..b65212b 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -275,7 +275,7 @@ void QDeclarativeText::setText(const QString &n) /*! \qmlproperty string Text::text - The text to display. Text supports both plain and rich text strings. + The text to display. Text supports both plain and rich text strings. The item will try to automatically determine whether the text should be treated as rich text. This determination is made using Qt::mightBeRichText(). @@ -322,14 +322,20 @@ QColor QDeclarativeText::color() const Set an additional text style. - Supported text styles are \c Normal, \c Outline, \c Raised and \c Sunken. + Supported text styles are: + \list + \o Normal - the default + \o Outline + \o Raised + \o Sunken + \endlist \qml Row { Text { font.pointSize: 24; text: "Normal" } - Text { font.pointSize: 24; text: "Raised"; style: Text.Raised; styleColor: "#AAAAAA" } - Text { font.pointSize: 24; text: "Outline"; style: Text.Outline; styleColor: "red" } - Text { font.pointSize: 24; text: "Sunken"; style: Text.Sunken; styleColor: "#AAAAAA" } + Text { font.pointSize: 24; text: "Raised"; style: Text.Raised; styleColor: "#AAAAAA" } + Text { font.pointSize: 24; text: "Outline";style: Text.Outline; styleColor: "red" } + Text { font.pointSize: 24; text: "Sunken"; style: Text.Sunken; styleColor: "#AAAAAA" } } \endqml @@ -371,6 +377,10 @@ void QDeclarativeText::setStyleColor(const QColor &color) \c styleColor is used as the outline color for outlined text, and as the shadow color for raised or sunken text. If no style has been set, it is not used at all. + + \qml + Text { font.pointSize: 18; text: "hello"; style: Text.Raised; styleColor: "gray" } + \endqml */ QColor QDeclarativeText::styleColor() const { -- cgit v0.12