diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-11-18 03:04:13 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-11-18 03:04:13 (GMT) |
commit | 9614a2775df27602b1d1bb0946feb4bb593cbf39 (patch) | |
tree | a917125de320ed2ea6a0b52bd0041edc256ee2ba /src | |
parent | 178d8c9cb87c5578e5175b5a405d470919644c4d (diff) | |
parent | 26bbfd3c1afd34cd10f4d111b05b13e2f052cd6a (diff) | |
download | Qt-9614a2775df27602b1d1bb0946feb4bb593cbf39.zip Qt-9614a2775df27602b1d1bb0946feb4bb593cbf39.tar.gz Qt-9614a2775df27602b1d1bb0946feb4bb593cbf39.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsitem.h | 17 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsrepeater.cpp | 4 | ||||
-rw-r--r-- | src/declarative/qml/qmetaobjectbuilder.cpp | 5 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompileddata.cpp | 6 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompiler_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlinstruction.cpp | 111 | ||||
-rw-r--r-- | src/declarative/qml/qmlinstruction_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlrefcount_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlvmemetaobject.cpp | 12 | ||||
-rw-r--r-- | src/declarative/util/qmllistaccessor.cpp | 128 | ||||
-rw-r--r-- | src/declarative/util/qmllistaccessor_p.h | 5 | ||||
-rw-r--r-- | src/declarative/util/qmlpropertychanges.cpp | 14 | ||||
-rw-r--r-- | src/declarative/util/qmlstate.cpp | 4 | ||||
-rw-r--r-- | src/declarative/util/qmlstate_p.h | 5 | ||||
-rw-r--r-- | src/declarative/util/qmlstateoperations.cpp | 153 | ||||
-rw-r--r-- | src/declarative/util/qmlstateoperations_p.h | 4 | ||||
-rw-r--r-- | src/declarative/util/qmltransitionmanager.cpp | 4 |
17 files changed, 355 insertions, 123 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.h b/src/declarative/graphicsitems/qmlgraphicsitem.h index 11d6e2e..d092896 100644 --- a/src/declarative/graphicsitems/qmlgraphicsitem.h +++ b/src/declarative/graphicsitems/qmlgraphicsitem.h @@ -157,6 +157,14 @@ public: bool keepMouseGrab() const; void setKeepMouseGrab(bool); + QmlGraphicsAnchorLine left() const; + QmlGraphicsAnchorLine right() const; + QmlGraphicsAnchorLine horizontalCenter() const; + QmlGraphicsAnchorLine top() const; + QmlGraphicsAnchorLine bottom() const; + QmlGraphicsAnchorLine verticalCenter() const; + QmlGraphicsAnchorLine baseline() const; + Q_SIGNALS: void widthChanged(); void heightChanged(); @@ -193,15 +201,6 @@ protected: QmlGraphicsItem(QmlGraphicsItemPrivate &dd, QmlGraphicsItem *parent = 0); private: - // ### public? - QmlGraphicsAnchorLine left() const; - QmlGraphicsAnchorLine right() const; - QmlGraphicsAnchorLine horizontalCenter() const; - QmlGraphicsAnchorLine top() const; - QmlGraphicsAnchorLine bottom() const; - QmlGraphicsAnchorLine verticalCenter() const; - QmlGraphicsAnchorLine baseline() const; - friend class QmlStatePrivate; friend class QmlGraphicsAnchors; Q_DISABLE_COPY(QmlGraphicsItem) diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp index 48758a7..7aed760 100644 --- a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp @@ -266,8 +266,10 @@ void QmlGraphicsRepeater::clear() { Q_D(QmlGraphicsRepeater); if (d->model) { - foreach (QmlGraphicsItem *item, d->deletables) + foreach (QmlGraphicsItem *item, d->deletables) { + item->setParentItem(this); d->model->release(item); + } } d->deletables.clear(); } diff --git a/src/declarative/qml/qmetaobjectbuilder.cpp b/src/declarative/qml/qmetaobjectbuilder.cpp index c2f5659..c421c76 100644 --- a/src/declarative/qml/qmetaobjectbuilder.cpp +++ b/src/declarative/qml/qmetaobjectbuilder.cpp @@ -921,9 +921,10 @@ void QMetaObjectBuilder::removeMethod(int index) d->methods.removeAt(index); for (int prop = 0; prop < d->properties.size(); ++prop) { // Adjust the indices of property notify signal references. - if (d->properties[prop].notifySignal == index) + if (d->properties[prop].notifySignal == index) { d->properties[prop].notifySignal = -1; - else if (d->properties[prop].notifySignal > index) + d->properties[prop].setFlag(Notify, false); + } else if (d->properties[prop].notifySignal > index) (d->properties[prop].notifySignal)--; } } diff --git a/src/declarative/qml/qmlcompileddata.cpp b/src/declarative/qml/qmlcompileddata.cpp index f587053..44d2745 100644 --- a/src/declarative/qml/qmlcompileddata.cpp +++ b/src/declarative/qml/qmlcompileddata.cpp @@ -197,12 +197,12 @@ void QmlCompiledData::dumpInstructions() { if (!name.isEmpty()) qWarning() << name; - qWarning() << "Index\tLine\tOperation\t\tData1\tData2\t\tComments"; - qWarning() << "-------------------------------------------------------------------------------"; + qWarning().nospace() << "Index\tLine\tOperation\t\tData1\tData2\tData3\tComments"; + qWarning().nospace() << "-------------------------------------------------------------------------------"; for (int ii = 0; ii < bytecode.count(); ++ii) { dump(&bytecode[ii], ii); } - qWarning() << "-------------------------------------------------------------------------------"; + qWarning().nospace() << "-------------------------------------------------------------------------------"; } diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h index 8f28ac9..9597753 100644 --- a/src/declarative/qml/qmlcompiler_p.h +++ b/src/declarative/qml/qmlcompiler_p.h @@ -73,7 +73,7 @@ class QmlComponent; class QmlContext; class QScriptProgram; -class QmlCompiledData : public QmlRefCount +class Q_AUTOTEST_EXPORT QmlCompiledData : public QmlRefCount { public: QmlCompiledData(); diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp index dd075a8..6bab1c4 100644 --- a/src/declarative/qml/qmlinstruction.cpp +++ b/src/declarative/qml/qmlinstruction.cpp @@ -54,145 +54,162 @@ void QmlCompiledData::dump(QmlInstruction *instr, int idx) switch(instr->type) { case QmlInstruction::Init: - qWarning() << idx << "\t" << line << "\t" << "INIT"; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "INIT"; break; case QmlInstruction::CreateObject: - qWarning() << idx << "\t" << line << "\t" << "CREATE\t\t\t" << instr->create.type << "\t\t\t" << types.at(instr->create.type).className; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE\t\t\t" << instr->create.type << "\t\t\t" << types.at(instr->create.type).className; break; case QmlInstruction::SetId: - qWarning() << idx << "\t" << line << "\t" << "SETID\t\t\t" << instr->setId.value << "\t\t\t\t" << primitives.at(instr->setId.value); + qWarning().nospace() << idx << "\t\t" << line << "\t" << "SETID\t\t\t" << instr->setId.value << "\t\t\t" << primitives.at(instr->setId.value); break; case QmlInstruction::SetDefault: - qWarning() << idx << "\t" << line << "\t" << "SET_DEFAULT"; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "SET_DEFAULT"; break; case QmlInstruction::CreateComponent: - qWarning() << idx << "\t" << line << "\t" << "CREATE_COMPONENT\t" << instr->createComponent.count; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE_COMPONENT\t" << instr->createComponent.count; break; case QmlInstruction::StoreMetaObject: - qWarning() << idx << "\t" << line << "\t" << "STORE_META\t\t" << instr->storeMeta.data << "\t"; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_META\t\t" << instr->storeMeta.data; break; + case QmlInstruction::StoreFloat: - qWarning() << idx << "\t" << line << "\t" << "STORE_FLOAT\t\t" << instr->storeFloat.propertyIndex << "\t" << instr->storeFloat.value; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_FLOAT\t\t" << instr->storeFloat.propertyIndex << "\t" << instr->storeFloat.value; break; case QmlInstruction::StoreDouble: - qWarning() << idx << "\t" << line << "\t" << "STORE_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value; break; case QmlInstruction::StoreInteger: - qWarning() << idx << "\t" << line << "\t" << "STORE_INTEGER\t\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_INTEGER\t\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value; break; case QmlInstruction::StoreBool: - qWarning() << idx << "\t" << line << "\t" << "STORE_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value; break; case QmlInstruction::StoreString: - qWarning() << idx << "\t" << line << "\t" << "STORE_STRING\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value); + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_STRING\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value); break; case QmlInstruction::StoreUrl: - qWarning() << idx << "\t" << line << "\t" << "STORE_URL\t\t" << instr->storeUrl.propertyIndex << "\t" << instr->storeUrl.value << "\t\t" << primitives.at(instr->storeUrl.value); + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_URL\t\t" << instr->storeUrl.propertyIndex << "\t" << instr->storeUrl.value << "\t\t" << primitives.at(instr->storeUrl.value); break; case QmlInstruction::StoreColor: - qWarning() << idx << "\t" << line << "\t" << "STORE_COLOR\t\t" << instr->storeColor.propertyIndex << "\t" << QString::number(instr->storeColor.value, 16); + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_COLOR\t\t" << instr->storeColor.propertyIndex << "\t\t\t" << QString::number(instr->storeColor.value, 16); break; case QmlInstruction::StoreDate: - qWarning() << idx << "\t" << line << "\t" << "STORE_DATE\t\t" << instr->storeDate.propertyIndex << "\t" << instr->storeDate.value; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DATE\t\t" << instr->storeDate.propertyIndex << "\t" << instr->storeDate.value; break; case QmlInstruction::StoreTime: - qWarning() << idx << "\t" << line << "\t" << "STORE_TIME\t\t" << instr->storeTime.propertyIndex << "\t" << instr->storeTime.valueIndex; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_TIME\t\t" << instr->storeTime.propertyIndex << "\t" << instr->storeTime.valueIndex; break; case QmlInstruction::StoreDateTime: - qWarning() << idx << "\t" << line << "\t" << "STORE_DATETIME\t\t" << instr->storeDateTime.propertyIndex << "\t" << instr->storeDateTime.valueIndex; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DATETIME\t\t" << instr->storeDateTime.propertyIndex << "\t" << instr->storeDateTime.valueIndex; break; case QmlInstruction::StorePoint: - qWarning() << idx << "\t" << line << "\t" << "STORE_POINT\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_POINT\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; break; case QmlInstruction::StorePointF: - qWarning() << idx << "\t" << line << "\t" << "STORE_POINTF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_POINTF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; break; case QmlInstruction::StoreSize: - qWarning() << idx << "\t" << line << "\t" << "STORE_SIZE\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIZE\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; break; case QmlInstruction::StoreSizeF: - qWarning() << idx << "\t" << line << "\t" << "STORE_SIZEF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIZEF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; break; case QmlInstruction::StoreRect: - qWarning() << idx << "\t" << line << "\t" << "STORE_RECT\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_RECT\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex; break; case QmlInstruction::StoreRectF: - qWarning() << idx << "\t" << line << "\t" << "STORE_RECTF\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_RECTF\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex; break; case QmlInstruction::StoreVector3D: - qWarning() << idx << "\t" << line << "\t" << "STORE_VECTOR3D\t\t" << instr->storeVector3D.propertyIndex << "\t" << instr->storeVector3D.valueIndex; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VECTOR3D\t\t" << instr->storeVector3D.propertyIndex << "\t" << instr->storeVector3D.valueIndex; break; case QmlInstruction::StoreVariant: - qWarning() << idx << "\t" << line << "\t" << "STORE_VARIANT\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value); + 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 QmlInstruction::StoreObject: - qWarning() << idx << "\t" << line << "\t" << "STORE_OBJECT\t\t" << instr->storeObject.propertyIndex; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT\t\t" << instr->storeObject.propertyIndex; break; case QmlInstruction::StoreVariantObject: - qWarning() << idx << "\t" << line << "\t" << "STORE_VARIANT_OBJECT\t" << instr->storeObject.propertyIndex; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_OBJECT\t" << instr->storeObject.propertyIndex; break; case QmlInstruction::StoreInterface: - qWarning() << idx << "\t" << line << "\t" << "STORE_INTERFACE\t\t" << instr->storeObject.propertyIndex; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_INTERFACE\t\t" << instr->storeObject.propertyIndex; break; + case QmlInstruction::StoreSignal: - qWarning() << idx << "\t" << line << "\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value << "\t\t" << primitives.at(instr->storeSignal.value); + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value << "\t\t" << primitives.at(instr->storeSignal.value); + break; + case QmlInstruction::StoreScript: + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SCRIPT\t\t" << instr->storeScript.value << "\t" << instr->storeScript.fileName << "\t" << instr->storeScript.lineNumber; break; + case QmlInstruction::StoreScriptString: + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SCRIPT_STRING\t" << instr->storeScriptString.propertyIndex << "\t" << instr->storeScriptString.value << "\t" << instr->storeScriptString.scope; + break; + case QmlInstruction::AssignSignalObject: - qWarning() << idx << "\t" << line << "\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal << "\t\t\t" << datas.at(instr->assignSignalObject.signal); + qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal << "\t\t\t" << datas.at(instr->assignSignalObject.signal); break; case QmlInstruction::AssignCustomType: - qWarning() << idx << "\t" << line << "\t" << "ASSIGN_CUSTOMTYPE\t\t" << instr->assignCustomType.propertyIndex << "\t" << instr->assignCustomType.valueIndex; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_CUSTOMTYPE\t" << instr->assignCustomType.propertyIndex << "\t" << instr->assignCustomType.valueIndex; break; + case QmlInstruction::StoreBinding: - qWarning() << idx << "\t" << line << "\t" << "STORE_COMPILED_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t\t" << instr->assignBinding.context; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_COMPILED_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context; + break; + case QmlInstruction::StoreIdOptBinding: + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_ID_OPT_BINDING\t" << instr->assignIdOptBinding.property << "\t" << instr->assignIdOptBinding.id; + break; + case QmlInstruction::StoreObjPropBinding: + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJ_PROP_BINDING\t" << instr->assignObjPropBinding.property << "\t" << instr->assignObjPropBinding.contextIdx << "\t" << instr->assignObjPropBinding.context << "\t" << instr->assignObjPropBinding.notifyIdx; break; case QmlInstruction::StoreValueSource: - qWarning() << idx << "\t" << line << "\t" << "STORE_VALUE_SOURCE\t" << instr->assignValueSource.property << "\t" << instr->assignValueSource.castValue; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VALUE_SOURCE\t" << instr->assignValueSource.property << "\t" << instr->assignValueSource.castValue; break; case QmlInstruction::StoreValueInterceptor: - qWarning() << idx << "\t" << line << "\t" << "STORE_VALUE_INTERCEPTOR\t" << instr->assignValueInterceptor.property << "\t" << instr->assignValueInterceptor.castValue; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VALUE_INTERCEPTOR\t" << instr->assignValueInterceptor.property << "\t" << instr->assignValueInterceptor.castValue; break; + case QmlInstruction::BeginObject: - qWarning() << idx << "\t" << line << "\t" << "BEGIN\t\t\t" << instr->begin.castValue; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "BEGIN\t\t\t" << instr->begin.castValue; break; case QmlInstruction::StoreObjectQmlList: - qWarning() << idx << "\t" << line << "\t" << "STORE_OBJECT_QMLLIST"; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT_QMLLIST"; break; case QmlInstruction::StoreObjectQList: - qWarning() << idx << "\t" << line << "\t" << "STORE_OBJECT_QLIST"; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT_QLIST"; break; case QmlInstruction::AssignObjectList: - qWarning() << idx << "\t" << line << "\t" << "ASSIGN_OBJECT_LIST\t"; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_OBJECT_LIST"; break; case QmlInstruction::FetchAttached: - qWarning() << idx << "\t" << line << "\t" << "FETCH_ATTACHED\t\t" << instr->fetchAttached.id; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_ATTACHED\t\t" << instr->fetchAttached.id; break; case QmlInstruction::FetchQmlList: - qWarning() << idx << "\t" << line << "\t" << "FETCH_QMLLIST\t\t" << instr->fetchQmlList.property << "\t" << instr->fetchQmlList.type; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_QMLLIST\t\t" << instr->fetchQmlList.property << "\t" << instr->fetchQmlList.type; break; case QmlInstruction::FetchQList: - qWarning() << idx << "\t" << line << "\t" << "FETCH_QLIST\t\t" << instr->fetch.property; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_QLIST\t\t" << instr->fetch.property; break; case QmlInstruction::FetchObject: - qWarning() << idx << "\t" << line << "\t" << "FETCH\t\t\t" << instr->fetch.property; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH\t\t\t" << instr->fetch.property; break; case QmlInstruction::FetchValueType: - qWarning() << idx << "\t" << line << "\t" << "FETCH_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type; break; case QmlInstruction::PopFetchedObject: - qWarning() << idx << "\t" << line << "\t" << "POP"; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP"; break; case QmlInstruction::PopQList: - qWarning() << idx << "\t" << line << "\t" << "POP_QLIST"; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP_QLIST"; break; case QmlInstruction::PopValueType: - qWarning() << idx << "\t" << line << "\t" << "POP_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type; break; case QmlInstruction::Defer: - qWarning() << idx << "\t" << line << "\t" << "DEFER" << "\t\t" << instr->defer.deferCount; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "DEFER" << "\t\t\t" << instr->defer.deferCount; break; default: - qWarning() << idx << "\t" << line << "\t" << "XXX UNKOWN INSTRUCTION" << "\t" << instr->type; + qWarning().nospace() << idx << "\t\t" << line << "\t" << "XXX UNKOWN INSTRUCTION" << "\t" << instr->type; break; } } diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h index 15e4fdf..50d4b62 100644 --- a/src/declarative/qml/qmlinstruction_p.h +++ b/src/declarative/qml/qmlinstruction_p.h @@ -194,7 +194,7 @@ public: int property; int owner; int castValue; - } assignValueInterceptor; //### merge with above + } assignValueInterceptor; struct { int property; int value; diff --git a/src/declarative/qml/qmlrefcount_p.h b/src/declarative/qml/qmlrefcount_p.h index cd6afd3..7448042 100644 --- a/src/declarative/qml/qmlrefcount_p.h +++ b/src/declarative/qml/qmlrefcount_p.h @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QmlRefCount +class Q_AUTOTEST_EXPORT QmlRefCount { public: QmlRefCount(); diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qmlvmemetaobject.cpp index ed28d78..3f5dd475 100644 --- a/src/declarative/qml/qmlvmemetaobject.cpp +++ b/src/declarative/qml/qmlvmemetaobject.cpp @@ -108,15 +108,7 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) QPair<int, QmlPropertyValueInterceptor*> pair = interceptors.value(id); int valueIndex = pair.first; QmlPropertyValueInterceptor *vi = pair.second; - QVariant::Type type = QVariant::Invalid; - if (id >= propOffset) { - id -= propOffset; - if (id < metaData->propertyCount) { - type = data[id].type(); - } - } else { - type = property(id).type(); - } + QVariant::Type type = property(id).type(); if (type != QVariant::Invalid) { if (valueIndex != -1) { @@ -129,6 +121,8 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) valueType->setValue(QVariant(type, a[0])); QMetaProperty valueProp = valueType->metaObject()->property(valueIndex); vi->write(valueProp.read(valueType)); + + if (!ep) delete valueType; return -1; } else { vi->write(QVariant(type, a[0])); diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qmllistaccessor.cpp index 2c01081..910f2a5 100644 --- a/src/declarative/util/qmllistaccessor.cpp +++ b/src/declarative/util/qmllistaccessor.cpp @@ -149,6 +149,134 @@ QVariant QmlListAccessor::at(int idx) const return QVariant(); } +void QmlListAccessor::append(const QVariant &value) +{ + switch(m_type) { + case Invalid: + break; + case StringList: + { + const QString &str = value.toString(); + qvariant_cast<QStringList>(d).append(str); + break; + } + case VariantList: + { + qvariant_cast<QVariantList>(d).append(value); + break; + } + case QmlList: + { + QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData(); + li->append(const_cast<void *>(value.constData())); //XXX + break; + } + case QList: + QmlMetaType::append(d, value); + break; + case Instance: + case Integer: + //do nothing + break; + } +} + +void QmlListAccessor::insert(int index, const QVariant &value) +{ + switch(m_type) { + case Invalid: + break; + case StringList: + { + const QString &str = value.toString(); + qvariant_cast<QStringList>(d).insert(index, str); + break; + } + case VariantList: + { + qvariant_cast<QVariantList>(d).insert(index, value); + break; + } + case QmlList: + { + QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData(); + li->insert(index, const_cast<void *>(value.constData())); //XXX + break; + } + case QList: + //XXX needs implementation + qWarning() << "insert function not yet implemented for QLists"; + break; + case Instance: + //XXX do nothing? + if (index == 0) + setList(value); + break; + case Integer: + break; + } +} + +void QmlListAccessor::removeAt(int index) +{ + switch(m_type) { + case Invalid: + break; + case StringList: + qvariant_cast<QStringList>(d).removeAt(index); + break; + case VariantList: + qvariant_cast<QVariantList>(d).removeAt(index); + break; + case QmlList: + { + QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData(); + li->removeAt(index); + break; + } + case QList: + //XXX needs implementation + qWarning() << "removeAt function not yet implemented for QLists"; + break; + case Instance: + //XXX do nothing? + if (index == 0) + setList(QVariant()); + break; + case Integer: + break; + } +} + +void QmlListAccessor::clear() +{ + switch(m_type) { + case Invalid: + break; + case StringList: + qvariant_cast<QStringList>(d).clear(); + break; + case VariantList: + qvariant_cast<QVariantList>(d).clear(); + break; + case QmlList: + { + QmlPrivate::ListInterface *li = *(QmlPrivate::ListInterface **)d.constData(); + li->clear(); + break; + } + case QList: + QmlMetaType::clear(d); + break; + case Instance: + //XXX what should we do here? + setList(QVariant()); + break; + case Integer: + d = 0; + } +} + bool QmlListAccessor::isValid() const { return m_type != Invalid; diff --git a/src/declarative/util/qmllistaccessor_p.h b/src/declarative/util/qmllistaccessor_p.h index 7b34d75..2697606 100644 --- a/src/declarative/util/qmllistaccessor_p.h +++ b/src/declarative/util/qmllistaccessor_p.h @@ -65,6 +65,11 @@ public: int count() const; QVariant at(int) const; + virtual void append(const QVariant &); + virtual void insert(int, const QVariant &); + virtual void removeAt(int); + virtual void clear(); + enum Type { Invalid, StringList, VariantList, QmlList, QList, Instance, Integer }; Type type() const { return m_type; } diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp index a1e92b5..28c8e4f 100644 --- a/src/declarative/util/qmlpropertychanges.cpp +++ b/src/declarative/util/qmlpropertychanges.cpp @@ -83,7 +83,8 @@ QT_BEGIN_NAMESPACE class QmlReplaceSignalHandler : public ActionEvent { public: - QmlReplaceSignalHandler() : expression(0), reverseExpression(0), ownedExpression(0) {} + QmlReplaceSignalHandler() : expression(0), reverseExpression(0), + rewindExpression(0), ownedExpression(0) {} ~QmlReplaceSignalHandler() { delete ownedExpression; } @@ -93,6 +94,7 @@ public: QmlMetaProperty property; QmlExpression *expression; QmlExpression *reverseExpression; + QmlExpression *rewindExpression; QGuard<QmlExpression> ownedExpression; virtual void execute() { @@ -104,7 +106,15 @@ public: ownedExpression = property.setSignalExpression(reverseExpression); } - virtual void saveOriginals() { reverseExpression = property.signalExpression(); } + virtual void saveOriginals() { + saveCurrentValues(); + reverseExpression = rewindExpression; + } + + virtual void rewind() { + ownedExpression = property.setSignalExpression(rewindExpression); + } + virtual void saveCurrentValues() { rewindExpression = property.signalExpression(); } virtual bool override(ActionEvent*other) { if (other == this) diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp index 1f5dbad..c05c539 100644 --- a/src/declarative/util/qmlstate.cpp +++ b/src/declarative/util/qmlstate.cpp @@ -362,6 +362,8 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever } if (!found || action.event != d->revertList.at(jj).event) action.event->saveOriginals(); + else if (action.event->isRewindable()) + action.event->saveCurrentValues(); } else { action.fromBinding = action.property.binding(); @@ -422,6 +424,8 @@ void QmlState::apply(QmlStateGroup *group, QmlTransition *trans, QmlState *rever a.specifiedProperty = d->revertList.at(ii).specifiedProperty; a.event = d->revertList.at(ii).event; a.reverseEvent = d->revertList.at(ii).reverseEvent; + if (a.event && a.event->isRewindable()) + a.event->saveCurrentValues(); applyList << a; // Store these special reverts in the reverting list d->reverting << d->revertList.at(ii).property; diff --git a/src/declarative/util/qmlstate_p.h b/src/declarative/util/qmlstate_p.h index 50c5401..856af8a 100644 --- a/src/declarative/util/qmlstate_p.h +++ b/src/declarative/util/qmlstate_p.h @@ -43,7 +43,6 @@ #define QMLSTATE_H #include <QtCore/qobject.h> -#include <QtCore/QSequentialAnimationGroup> #include <qml.h> QT_BEGIN_HEADER @@ -91,6 +90,10 @@ public: virtual void reverse(); virtual void saveOriginals() {} + virtual bool isRewindable() { return isReversable(); } + virtual void rewind() {} + virtual void saveCurrentValues() {} + //virtual bool hasExtraActions(); virtual QList<Action> extraActions(); diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index 2d32fdb..e2933b2 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -57,12 +57,15 @@ class QmlParentChangePrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QmlParentChange) public: - QmlParentChangePrivate() : target(0), parent(0), origParent(0), origStackBefore(0) {} + QmlParentChangePrivate() : target(0), parent(0), origParent(0), origStackBefore(0), + rewindParent(0), rewindStackBefore(0) {} QmlGraphicsItem *target; QmlGraphicsItem *parent; QGuard<QmlGraphicsItem> origParent; QGuard<QmlGraphicsItem> origStackBefore; + QmlGraphicsItem *rewindParent; + QmlGraphicsItem *rewindStackBefore; void doChange(QmlGraphicsItem *targetParent, QmlGraphicsItem *stackBefore = 0); }; @@ -222,31 +225,9 @@ public: void QmlParentChange::saveOriginals() { Q_D(QmlParentChange); - if (!d->target) { - d->origParent = 0; - d->origStackBefore = 0; - return; - } - - d->origParent = d->target->parentItem(); - - if (!d->origParent) { - d->origStackBefore = 0; - return; - } - - //try to determine the item's original stack position so we can restore it - int siblingIndex = ((AccessibleFxItem*)d->target)->siblingIndex() + 1; - QList<QGraphicsItem*> children = d->origParent->childItems(); - for (int i = 0; i < children.count(); ++i) { - QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem*>(children.at(i)); - if (!child) - continue; - if (((AccessibleFxItem*)child)->siblingIndex() == siblingIndex) { - d->origStackBefore = child; - break; - } - } + saveCurrentValues(); + d->origParent = d->rewindParent; + d->origStackBefore = d->rewindStackBefore; } void QmlParentChange::execute() @@ -281,6 +262,42 @@ bool QmlParentChange::override(ActionEvent*other) return false; } +void QmlParentChange::saveCurrentValues() +{ + Q_D(QmlParentChange); + if (!d->target) { + d->rewindParent = 0; + d->rewindStackBefore = 0; + return; + } + + d->rewindParent = d->target->parentItem(); + + if (!d->rewindParent) { + d->rewindStackBefore = 0; + return; + } + + //try to determine the item's original stack position so we can restore it + int siblingIndex = ((AccessibleFxItem*)d->target)->siblingIndex() + 1; + QList<QGraphicsItem*> children = d->rewindParent->childItems(); + for (int i = 0; i < children.count(); ++i) { + QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem*>(children.at(i)); + if (!child) + continue; + if (((AccessibleFxItem*)child)->siblingIndex() == siblingIndex) { + d->rewindStackBefore = child; + break; + } + } +} + +void QmlParentChange::rewind() +{ + Q_D(QmlParentChange); + d->doChange(d->rewindParent, d->rewindStackBefore); +} + class QmlStateChangeScriptPrivate : public QObjectPrivate { public: @@ -399,10 +416,19 @@ public: QmlGraphicsAnchorLine origBottom; QmlGraphicsAnchorLine origVCenter; QmlGraphicsAnchorLine origBaseline; - qreal origX; - qreal origY; - qreal origWidth; - qreal origHeight; + + QmlGraphicsAnchorLine rewindLeft; + QmlGraphicsAnchorLine rewindRight; + QmlGraphicsAnchorLine rewindHCenter; + QmlGraphicsAnchorLine rewindTop; + QmlGraphicsAnchorLine rewindBottom; + QmlGraphicsAnchorLine rewindVCenter; + QmlGraphicsAnchorLine rewindBaseline; + + qreal fromX; + qreal fromY; + qreal fromWidth; + qreal fromHeight; }; /*! @@ -449,6 +475,8 @@ void QmlAnchorChanges::setReset(const QString &reset) Q_D(QmlAnchorChanges); d->resetString = reset; d->resetList = d->resetString.split(QLatin1Char(',')); + for (int i = 0; i < d->resetList.count(); ++i) + d->resetList[i] = d->resetList.at(i).trimmed(); } /*! @@ -613,19 +641,19 @@ QList<Action> QmlAnchorChanges::extraActions() // we shouldn't set explicit width if there wasn't one before. if (d->target) { Action a; - a.fromValue = d->origX; + a.fromValue = d->fromX; a.property = QmlMetaProperty(d->target, QLatin1String("x")); extra << a; - a.fromValue = d->origY; + a.fromValue = d->fromY; a.property = QmlMetaProperty(d->target, QLatin1String("y")); extra << a; - a.fromValue = d->origWidth; + a.fromValue = d->fromWidth; a.property = QmlMetaProperty(d->target, QLatin1String("width")); extra << a; - a.fromValue = d->origHeight; + a.fromValue = d->fromHeight; a.property = QmlMetaProperty(d->target, QLatin1String("height")); extra << a; } @@ -648,15 +676,17 @@ void QmlAnchorChanges::saveOriginals() d->origBottom = d->target->anchors()->bottom(); d->origVCenter = d->target->anchors()->verticalCenter(); d->origBaseline = d->target->anchors()->baseline(); + + saveCurrentValues(); } void QmlAnchorChanges::clearForwardBindings() { Q_D(QmlAnchorChanges); - d->origX = d->target->x(); - d->origY = d->target->y(); - d->origWidth = d->target->width(); - d->origHeight = d->target->height(); + d->fromX = d->target->x(); + d->fromY = d->target->y(); + d->fromWidth = d->target->width(); + d->fromHeight = d->target->height(); //reset any anchors that have been specified if (d->resetList.contains(QLatin1String("left"))) @@ -694,10 +724,10 @@ void QmlAnchorChanges::clearForwardBindings() void QmlAnchorChanges::clearReverseBindings() { Q_D(QmlAnchorChanges); - d->origX = d->target->x(); - d->origY = d->target->y(); - d->origWidth = d->target->width(); - d->origHeight = d->target->height(); + d->fromX = d->target->x(); + d->fromY = d->target->y(); + d->fromWidth = d->target->width(); + d->fromHeight = d->target->height(); //reset any anchors that were set in the state if (d->left.anchorLine != QmlGraphicsAnchorLine::Invalid) @@ -738,11 +768,46 @@ bool QmlAnchorChanges::override(ActionEvent*other) return false; if (static_cast<ActionEvent*>(this) == other) return true; - //### can we do any other meaningful comparison? Do we need to attempt to merge the two - // somehow if they have the same target and some of the same anchors? + if (static_cast<QmlAnchorChanges*>(other)->object() == object()) + return true; return false; } +void QmlAnchorChanges::rewind() +{ + Q_D(QmlAnchorChanges); + if (!d->target) + return; + + //restore previous anchors + if (d->rewindLeft.anchorLine != QmlGraphicsAnchorLine::Invalid) + d->target->anchors()->setLeft(d->rewindLeft); + if (d->rewindRight.anchorLine != QmlGraphicsAnchorLine::Invalid) + d->target->anchors()->setRight(d->rewindRight); + if (d->rewindHCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) + d->target->anchors()->setHorizontalCenter(d->rewindHCenter); + if (d->rewindTop.anchorLine != QmlGraphicsAnchorLine::Invalid) + d->target->anchors()->setTop(d->rewindTop); + if (d->rewindBottom.anchorLine != QmlGraphicsAnchorLine::Invalid) + d->target->anchors()->setBottom(d->rewindBottom); + if (d->rewindVCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) + d->target->anchors()->setVerticalCenter(d->rewindVCenter); + if (d->rewindBaseline.anchorLine != QmlGraphicsAnchorLine::Invalid) + d->target->anchors()->setBaseline(d->rewindBaseline); +} + +void QmlAnchorChanges::saveCurrentValues() +{ + Q_D(QmlAnchorChanges); + d->rewindLeft = d->target->anchors()->left(); + d->rewindRight = d->target->anchors()->right(); + d->rewindHCenter = d->target->anchors()->horizontalCenter(); + d->rewindTop = d->target->anchors()->top(); + d->rewindBottom = d->target->anchors()->bottom(); + d->rewindVCenter = d->target->anchors()->verticalCenter(); + d->rewindBaseline = d->target->anchors()->baseline(); +} + #include "qmlstateoperations.moc" #include "moc_qmlstateoperations_p.cpp" diff --git a/src/declarative/util/qmlstateoperations_p.h b/src/declarative/util/qmlstateoperations_p.h index a9488dc..589fe20 100644 --- a/src/declarative/util/qmlstateoperations_p.h +++ b/src/declarative/util/qmlstateoperations_p.h @@ -79,6 +79,8 @@ public: virtual void reverse(); virtual QString typeName() const; virtual bool override(ActionEvent*other); + virtual void rewind(); + virtual void saveCurrentValues(); }; class QmlStateChangeScriptPrivate; @@ -166,6 +168,8 @@ public: virtual void saveOriginals(); virtual void clearForwardBindings(); virtual void clearReverseBindings(); + virtual void rewind(); + virtual void saveCurrentValues(); }; QT_END_NAMESPACE diff --git a/src/declarative/util/qmltransitionmanager.cpp b/src/declarative/util/qmltransitionmanager.cpp index bae7e81..d1db9ec 100644 --- a/src/declarative/util/qmltransitionmanager.cpp +++ b/src/declarative/util/qmltransitionmanager.cpp @@ -173,11 +173,11 @@ void QmlTransitionManager::transition(const QList<Action> &list, if (action.event->isReversable()) { if (action.reverseEvent) { //reverse the reverse action.event->clearForwardBindings(); - action.event->execute(); + action.event->rewind(); action.event->clearReverseBindings(); } else { action.event->clearReverseBindings(); - action.event->reverse(); + action.event->rewind(); action.event->clearForwardBindings(); } } |