summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsborderimage.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsimage.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitem.cpp7
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitem.h3
-rw-r--r--src/declarative/graphicsitems/qmlgraphicswebview.cpp9
-rw-r--r--src/declarative/qml/qmetaobjectbuilder.cpp5
-rw-r--r--src/declarative/qml/qmlcompileddata.cpp6
-rw-r--r--src/declarative/qml/qmlcompiler_p.h2
-rw-r--r--src/declarative/qml/qmlengine.cpp15
-rw-r--r--src/declarative/qml/qmlinstruction.cpp111
-rw-r--r--src/declarative/qml/qmlinstruction_p.h2
-rw-r--r--src/declarative/qml/qmlrefcount_p.h2
-rw-r--r--src/declarative/qml/qmlsqldatabase.cpp7
-rw-r--r--src/declarative/util/qmlanimation.cpp50
-rw-r--r--src/declarative/util/qmlanimation_p.h2
-rw-r--r--src/declarative/util/qmlanimation_p_p.h2
-rw-r--r--src/declarative/util/qmllistmodel.cpp22
-rw-r--r--src/declarative/util/qmlpropertychanges.cpp14
-rw-r--r--src/declarative/util/qmlstate.cpp4
-rw-r--r--src/declarative/util/qmlstate_p.h5
-rw-r--r--src/declarative/util/qmlstateoperations.cpp147
-rw-r--r--src/declarative/util/qmlstateoperations_p.h4
-rw-r--r--src/declarative/util/qmltransitionmanager.cpp4
23 files changed, 271 insertions, 156 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
index 04e79f9..e1039f4 100644
--- a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
@@ -58,8 +58,6 @@ QML_DEFINE_TYPE(Qt,4,6,BorderImage,QmlGraphicsBorderImage)
\snippet snippets/declarative/border-image.qml 0
\image BorderImage.png
-
- \sa examples/declarative/border-image
*/
/*!
diff --git a/src/declarative/graphicsitems/qmlgraphicsimage.cpp b/src/declarative/graphicsitems/qmlgraphicsimage.cpp
index 89b50a1..42fd910 100644
--- a/src/declarative/graphicsitems/qmlgraphicsimage.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsimage.cpp
@@ -182,8 +182,6 @@ void QmlGraphicsImagePrivate::setPixmap(const QPixmap &pixmap)
\endlist
\image declarative-image_fillMode.gif
- \sa examples/declarative/fillmode
- \sa examples/declarative/aspectratio
*/
QmlGraphicsImage::FillMode QmlGraphicsImage::fillMode() const
{
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.cpp b/src/declarative/graphicsitems/qmlgraphicsitem.cpp
index ca45f62..fb6afb1 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitem.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsitem.cpp
@@ -1428,6 +1428,11 @@ QmlGraphicsKeysAttached *QmlGraphicsKeysAttached::qmlAttachedProperties(QObject
*/
/*!
+ \fn void QmlGraphicsItem::childrenChanged()
+ \internal
+*/
+
+/*!
\fn void QmlGraphicsItem::focusChanged()
\internal
*/
@@ -2692,6 +2697,8 @@ QVariant QmlGraphicsItem::itemChange(GraphicsItemChange change,
{
if (change == ItemParentHasChanged) {
emit parentChanged();
+ } else if (change == ItemChildAddedChange || change == ItemChildRemovedChange) {
+ emit childrenChanged();
}
return QGraphicsItem::itemChange(change, value);
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.h b/src/declarative/graphicsitems/qmlgraphicsitem.h
index 2ac43b5..11d6e2e 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitem.h
+++ b/src/declarative/graphicsitems/qmlgraphicsitem.h
@@ -69,7 +69,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsItem : public QGraphicsObject, public QmlP
Q_PROPERTY(QmlGraphicsItem * parent READ parentItem WRITE setParentItem NOTIFY parentChanged DESIGNABLE false FINAL)
Q_PROPERTY(QmlList<QObject *> *data READ data DESIGNABLE false)
- Q_PROPERTY(QmlList<QmlGraphicsItem *>* children READ fxChildren DESIGNABLE false)
+ Q_PROPERTY(QmlList<QmlGraphicsItem *>* children READ fxChildren DESIGNABLE false NOTIFY childrenChanged)
Q_PROPERTY(QmlList<QObject *>* resources READ resources DESIGNABLE false)
Q_PROPERTY(QmlList<QmlState *>* states READ states DESIGNABLE false)
Q_PROPERTY(QmlList<QmlTransition *>* transitions READ transitions DESIGNABLE false)
@@ -160,6 +160,7 @@ public:
Q_SIGNALS:
void widthChanged();
void heightChanged();
+ void childrenChanged();
void childrenRectChanged();
void baselineOffsetChanged();
void stateChanged(const QString &);
diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp
index 00fdd6d..c8bb504 100644
--- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp
@@ -368,8 +368,13 @@ void QmlGraphicsWebView::setPreferredHeight(int ih)
}
/*!
- Evaluates the \a scriptSource JavaScript inside the main frame
- context and returns the result of the last executed statement.
+ \qmlmethod bool WebView::evaluateJavaScript(string)
+
+ Evaluates the \a scriptSource JavaScript inside the context of the
+ main web frame, and returns the result of the last executed statement.
+
+ Note that this JavaScript does \e not have any access to QML objects
+ except as made available as windowObjects.
*/
QVariant QmlGraphicsWebView::evaluateJavaScript(const QString &scriptSource)
{
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/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 9abd216..86472de 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -107,11 +107,6 @@ struct StaticQtMetaObject : public QObject
{ return &static_cast<StaticQtMetaObject*> (0)->staticQtMetaObject; }
};
-static QString userLocalDataPath(const QString& app)
-{
- return QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/") + app;
-}
-
QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
: rootContext(0), currentExpression(0),
isDebugging(false), contextClass(0), objectClass(0), valueTypeClass(0), globalClass(0),
@@ -125,7 +120,9 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
scriptEngine.newQMetaObject(StaticQtMetaObject::get());
scriptEngine.globalObject().setProperty(QLatin1String("Qt"), qtObject);
- offlineStoragePath = userLocalDataPath(QLatin1String("QML/OfflineStorage"));
+ offlineStoragePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation)
+ + QDir::separator() + QLatin1String("QML")
+ + QDir::separator() + QLatin1String("OfflineStorage");
qt_add_qmlxmlhttprequest(&scriptEngine);
qt_add_qmlsqldatabase(&scriptEngine);
@@ -1256,8 +1253,12 @@ void QmlEngine::addImportPath(const QString& path)
QmlGraphicsWebView and the SQL databases created with openDatabase()
are stored here.
- The default is QML/OfflineStorage/ in the platform-standard
+ The default is QML/OfflineStorage in the platform-standard
user application data directory.
+
+ Note that the path may not currently exist on the filesystem, so
+ callers wanting to \e create new files at this location should create
+ it first - see QDir::mkpath().
*/
void QmlEngine::setOfflineStoragePath(const QString& dir)
{
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/qmlsqldatabase.cpp b/src/declarative/qml/qmlsqldatabase.cpp
index c7d2e12..6e32fb7 100644
--- a/src/declarative/qml/qmlsqldatabase.cpp
+++ b/src/declarative/qml/qmlsqldatabase.cpp
@@ -248,10 +248,10 @@ static QScriptValue qmlsqldatabase_executeSql(QScriptContext *context, QScriptEn
QSqlQuery query(db);
bool err = false;
if (query.prepare(sql)) {
- if (values.isArray()) {
+ if (values.isObject()) {
for (QScriptValueIterator it(values); it.hasNext();) {
it.next();
- query.addBindValue(it.value().toVariant());
+ query.bindValue(it.name(),it.value().toVariant());
}
} else {
query.bindValue(0,values.toVariant());
@@ -337,7 +337,8 @@ static QScriptValue qmlsqldatabase_open(QScriptContext *context, QScriptEngine *
database = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), dbid);
}
if (!database.isOpen()) {
- QString basename = QmlEnginePrivate::get(engine)->offlineStoragePath + QLatin1String("/Databases/");
+ QString basename = QmlEnginePrivate::get(engine)->offlineStoragePath
+ + QDir::separator() + QLatin1String("Databases") + QDir::separator();
QDir().mkpath(basename);
basename += dbid;
database.setDatabaseName(basename+QLatin1String(".sqlite"));
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index d78f0a1..780bc82 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -62,7 +62,7 @@
QT_BEGIN_NAMESPACE
-QEasingCurve stringToCurve(const QString &curve)
+static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
{
QEasingCurve easingCurve;
@@ -73,8 +73,7 @@ QEasingCurve stringToCurve(const QString &curve)
if (hasParams) {
QString easeName = curve.trimmed();
if (!easeName.endsWith(QLatin1Char(')'))) {
- qWarning("QEasingCurve: Unmatched perenthesis in easing function '%s'",
- qPrintable(curve));
+ qmlInfo(obj) << obj->tr("Unmatched parenthesis in easing function \"%1\"").arg(curve);
return easingCurve;
}
@@ -83,8 +82,8 @@ QEasingCurve stringToCurve(const QString &curve)
easeName.mid(idx + 1, easeName.length() - 1 - idx - 1);
normalizedCurve = easeName.left(idx);
if (!normalizedCurve.startsWith(QLatin1String("ease"))) {
- qWarning("QEasingCurve: Easing function '%s' must start with 'ease'",
- qPrintable(curve));
+ qmlInfo(obj) << obj->tr("Easing function \"%1\" must start with \"ease\"").arg(curve);
+ return easingCurve;
}
props = prop_str.split(QLatin1Char(','));
@@ -98,9 +97,8 @@ QEasingCurve stringToCurve(const QString &curve)
int value = me.keyToValue(normalizedCurve.toUtf8().constData());
if (value < 0) {
- qWarning("QEasingCurve: Unknown easing curve '%s'",
- qPrintable(curve));
- value = 0;
+ qmlInfo(obj) << obj->tr("Unknown easing curve \"%1\"").arg(curve);
+ return easingCurve;
}
easingCurve.setType((QEasingCurve::Type)value);
@@ -109,9 +107,8 @@ QEasingCurve stringToCurve(const QString &curve)
int sep = str.indexOf(QLatin1Char(':'));
if (sep == -1) {
- qWarning("QEasingCurve: Improperly specified property in easing function '%s'",
- qPrintable(curve));
- return easingCurve;
+ qmlInfo(obj) << obj->tr("Improperly specified parameter in easing function \"%1\"").arg(curve);
+ continue;
}
QString propName = str.left(sep).trimmed();
@@ -119,9 +116,8 @@ QEasingCurve stringToCurve(const QString &curve)
qreal propValue = str.mid(sep + 1).trimmed().toDouble(&isOk);
if (propName.isEmpty() || !isOk) {
- qWarning("QEasingCurve: Improperly specified property in easing function '%s'",
- qPrintable(curve));
- return easingCurve;
+ qmlInfo(obj) << obj->tr("Improperly specified parameter in easing function \"%1\"").arg(curve);
+ continue;
}
if (propName == QLatin1String("amplitude")) {
@@ -130,10 +126,12 @@ QEasingCurve stringToCurve(const QString &curve)
easingCurve.setPeriod(propValue);
} else if (propName == QLatin1String("overshoot")) {
easingCurve.setOvershoot(propValue);
+ } else {
+ qmlInfo(obj) << obj->tr("Unknown easing parameter \"%1\"").arg(propName);
+ continue;
}
}
}
-
return easingCurve;
}
@@ -219,16 +217,14 @@ void QmlAbstractAnimationPrivate::commence()
}
}
-//### make static?
-QmlMetaProperty QmlAbstractAnimationPrivate::createProperty(QObject *obj, const QString &str)
+QmlMetaProperty QmlAbstractAnimationPrivate::createProperty(QObject *obj, const QString &str, QObject *infoObj)
{
- Q_Q(QmlAbstractAnimation);
QmlMetaProperty prop = QmlMetaProperty::createProperty(obj, str);
if (!prop.isValid()) {
- qmlInfo(q) << QmlAbstractAnimation::tr("Cannot animate non-existant property \"%1\"").arg(str);
+ qmlInfo(infoObj) << QmlAbstractAnimation::tr("Cannot animate non-existant property \"%1\"").arg(str);
return QmlMetaProperty();
} else if (!prop.isWritable()) {
- qmlInfo(q) << QmlAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str);
+ qmlInfo(infoObj) << QmlAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str);
return QmlMetaProperty();
}
return prop;
@@ -436,7 +432,7 @@ void QmlAbstractAnimation::setTarget(QObject *o)
d->target = o;
if (d->target && !d->propertyName.isEmpty()) {
- d->userProperty = d->createProperty(d->target, d->propertyName);
+ d->userProperty = d->createProperty(d->target, d->propertyName, this);
} else {
d->userProperty.invalidate();
}
@@ -458,7 +454,7 @@ void QmlAbstractAnimation::setProperty(const QString &n)
d->propertyName = n;
if (d->target && !d->propertyName.isEmpty()) {
- d->userProperty = d->createProperty(d->target, d->propertyName);
+ d->userProperty = d->createProperty(d->target, d->propertyName, this);
} else {
d->userProperty.invalidate();
}
@@ -652,7 +648,7 @@ int QmlPauseAnimation::duration() const
void QmlPauseAnimation::setDuration(int duration)
{
if (duration < 0) {
- qWarning("QmlPauseAnimation: Cannot set a duration of < 0");
+ qmlInfo(this) << tr("Cannot set a duration of < 0");
return;
}
@@ -1029,7 +1025,7 @@ void QmlPropertyAction::transition(QmlStateActions &actions,
if (hasTarget && d->value.isValid()) {
Action myAction;
- myAction.property = d->createProperty(target(), d->propertyName);
+ myAction.property = d->createProperty(target(), d->propertyName, this);
if (myAction.property.isValid()) {
myAction.toValue = d->value;
data->actions << myAction;
@@ -1630,7 +1626,7 @@ int QmlPropertyAnimation::duration() const
void QmlPropertyAnimation::setDuration(int duration)
{
if (duration < 0) {
- qWarning("QmlPropertyAnimation: Cannot set a duration of < 0");
+ qmlInfo(this) << tr("Cannot set a duration of < 0");
return;
}
@@ -1872,7 +1868,7 @@ void QmlPropertyAnimation::setEasing(const QString &e)
return;
d->easing = e;
- d->va->setEasingCurve(stringToCurve(d->easing));
+ d->va->setEasingCurve(stringToCurve(d->easing, this));
emit easingChanged(e);
}
@@ -2114,7 +2110,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions,
//an explicit animation has been specified
if (hasTarget && d->toIsDefined) {
Action myAction;
- myAction.property = d->createProperty(target(), d->propertyName);
+ myAction.property = d->createProperty(target(), d->propertyName, this);
if (myAction.property.isValid()) {
if (d->fromIsDefined) {
d->convertVariant(d->from, d->interpolatorType ? d->interpolatorType : myAction.property.propertyType());
diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h
index f126dee..87b6703 100644
--- a/src/declarative/util/qmlanimation_p.h
+++ b/src/declarative/util/qmlanimation_p.h
@@ -136,7 +136,7 @@ private Q_SLOTS:
};
class QmlPauseAnimationPrivate;
-class QmlPauseAnimation : public QmlAbstractAnimation
+class Q_AUTOTEST_EXPORT QmlPauseAnimation : public QmlAbstractAnimation
{
Q_OBJECT
Q_DECLARE_PRIVATE(QmlPauseAnimation)
diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h
index e50415f..27c0cd7 100644
--- a/src/declarative/util/qmlanimation_p_p.h
+++ b/src/declarative/util/qmlanimation_p_p.h
@@ -208,7 +208,7 @@ public:
QmlMetaProperty property;
QmlAnimationGroup *group;
- QmlMetaProperty createProperty(QObject *obj, const QString &str);
+ static QmlMetaProperty createProperty(QObject *obj, const QString &str, QObject *infoObj);
};
class QmlPauseAnimationPrivate : public QmlAbstractAnimationPrivate
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index 9e91147..a3c5c59 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -483,6 +483,10 @@ void QmlListModel::remove(int index)
*/
void QmlListModel::insert(int index, const QScriptValue& valuemap)
{
+ if (!valuemap.isObject() || valuemap.isArray()) {
+ qmlInfo(this) << tr("insert: value is not an object");
+ return;
+ }
if (!_root)
_root = new ModelNode;
if (index >= _root->values.count() || index<0) {
@@ -517,8 +521,10 @@ void QmlListModel::move(int from, int to, int n)
{
if (n==0 || from==to)
return;
- if (from+n > count() || to+n > count() || from < 0 || to < 0)
+ if (from+n > count() || to+n > count() || from < 0 || to < 0 || n < 0) {
qmlInfo(this) << tr("move: out of range");
+ return;
+ }
int origfrom=from; // preserve actual move, so any animations are correct
int origto=to;
int orign=n;
@@ -564,7 +570,7 @@ void QmlListModel::move(int from, int to, int n)
*/
void QmlListModel::append(const QScriptValue& valuemap)
{
- if (!valuemap.isObject()) {
+ if (!valuemap.isObject() || valuemap.isArray()) {
qmlInfo(this) << tr("append: value is not an object");
return;
}
@@ -636,9 +642,11 @@ QScriptValue QmlListModel::get(int index) const
*/
void QmlListModel::set(int index, const QScriptValue& valuemap)
{
- if (!_root)
- _root = new ModelNode;
- if ( index > _root->values.count()) {
+ if (!valuemap.isObject() || valuemap.isArray()) {
+ qmlInfo(this) << tr("set: value is not an object");
+ return;
+ }
+ if ( !_root || index > _root->values.count()) {
qmlInfo(this) << tr("set: index %1 out of range").arg(index);
return;
}
@@ -677,9 +685,7 @@ void QmlListModel::set(int index, const QScriptValue& valuemap)
*/
void QmlListModel::set(int index, const QString& property, const QVariant& value)
{
- if (!_root)
- _root = new ModelNode;
- if ( index >= _root->values.count()) {
+ if ( !_root || index >= _root->values.count()) {
qmlInfo(this) << tr("set: index %1 out of range").arg(index);
return;
}
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..0d977de 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;
};
/*!
@@ -613,19 +639,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 +674,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 +722,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)
@@ -743,6 +771,41 @@ bool QmlAnchorChanges::override(ActionEvent*other)
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();
}
}