diff options
-rw-r--r-- | demos/declarative/flickr/flickr2.qml | 129 | ||||
-rw-r--r-- | src/declarative/fx/qfxpathview.cpp | 12 | ||||
-rw-r--r-- | src/declarative/qml/script/qmlbasicscript.cpp | 1 | ||||
-rw-r--r-- | src/declarative/qml/script/qmlbasicscript_p.h | 1 |
4 files changed, 65 insertions, 78 deletions
diff --git a/demos/declarative/flickr/flickr2.qml b/demos/declarative/flickr/flickr2.qml index 3b1208c..f5f569e 100644 --- a/demos/declarative/flickr/flickr2.qml +++ b/demos/declarative/flickr/flickr2.qml @@ -29,11 +29,15 @@ Item { delegate: Package { Item { - id: Wrapper; width: 85; height: 85 - scale: Wrapper.PathView.scale; z: Wrapper.PathView.z + id: Wrapper; width: 85; height: 85; scale: {1.0} + z: RightBox.PathView.z + property real angle: 0 * 0 transform: [ - Rotation3D { id: Rotation; axis.startX: 30; axis.endX: 30; axis.endY: 60; angle: Wrapper.PathView.angle } + Rotation3D { + id: Rotation; axis.startX: 30; axis.endX: 30; axis.endY: 60 + angle: Wrapper.angle + } ] Connection { @@ -111,7 +115,7 @@ Item { Item { Package.name: "rightBox" - id: RightBox; x: 200; width: 85; height: 85 + id: RightBox; width: 85; height: 85 } Item { @@ -120,73 +124,58 @@ Item { } Item { - id: MyItem - states: [ - State { - name: "left" - when: MainWindow.showPathView == true - SetProperty { - target: Wrapper - property: "moveToParent" - value: LeftBox - } - }, - State { - name: "right" - when: MainWindow.showPathView == false - SetProperty { - target: Wrapper - property: "moveToParent" - value: RightBox + id: MyItem + state: MainWindow.showPathView ? "right" : "left" + states: [ + State { + name: "left" + SetProperty { target: Wrapper; property: "moveToParent"; value: LeftBox } + }, + State { + name: "right" + SetProperty { target: Wrapper; property: "scale"; value: RightBox.PathView.scale } + SetProperty { target: Wrapper; property: "scale"; binding: "RightBox.PathView.scale" } + SetProperty { target: Wrapper; property: "angle"; value: RightBox.PathView.angle } + SetProperty { target: Wrapper; property: "angle"; binding: "RightBox.PathView.angle" } + SetProperty { target: Wrapper; property: "moveToParent"; value: RightBox } } - } - ] - transitions: [ - Transition { - fromState: "left" - toState: "right" - SequentialAnimation { - SetPropertyAction { - target: Wrapper - property: "moveToParent" - } - ParallelAnimation { - NumericAnimation { - target: Wrapper - properties: "x,y" - to: 0 - easing: "easeOutQuad" - duration: 350 + ] + transitions: [ + Transition { + toState: "right" + SequentialAnimation { + SetPropertyAction { target: Wrapper; property: "moveToParent" } + ParallelAnimation { + NumericAnimation { + target: Wrapper + properties: "x,y" + to: 0 + easing: "easeOutQuad" + duration: 350 + } + NumericAnimation { target: Wrapper; properties: "scale,angle"; duration: 350 } } } - } - }, - Transition { - fromState: "right" - toState: "left" - SequentialAnimation { - PauseAnimation { - duration: Math.floor(index/7)*100 - } - SetPropertyAction { - target: Wrapper - property: "moveToParent" - } - ParallelAnimation { - NumericAnimation { - target: Wrapper - properties: "x,y" - to: 0 - easing: "easeOutQuad" - duration: 250 + }, + Transition { + toState: "left" + SequentialAnimation { + PauseAnimation { duration: Math.floor(index/7)*100 } + SetPropertyAction { target: Wrapper; property: "moveToParent" } + ParallelAnimation { + NumericAnimation { + target: Wrapper + properties: "x,y" + to: 0 + easing: "easeOutQuad" + duration: 250 + } + NumericAnimation { target: Wrapper; properties: "scale,angle"; duration: 250 } } } } - } - ] - state: "right" - } - + ] + } } } @@ -209,12 +198,12 @@ Item { path: Path { startX: -150; startY: 40; + PathAttribute { name: "scale"; value: 0.9 } + PathAttribute { name: "angle"; value: -45 } PathPercent { value: 0 } PathLine { x: -50; y: 40 } PathPercent { value: 0.001 } - PathAttribute { name: "scale"; value: 1 } - PathAttribute { name: "angle"; value: -45 } PathCubic { x: 400; y: 220 @@ -232,14 +221,12 @@ Item { control1X: 590; control1Y: 220 } - PathAttribute { name: "scale"; value: 1 } - PathAttribute { name: "angle"; value: -45 } - PathPercent { value: 0.999 } PathLine { x: 950; y: 40 } PathPercent { value: 1.0 } + PathAttribute { name: "scale"; value: 0.9 } + PathAttribute { name: "angle"; value: -45 } } - } ImageDetails { id: ImageDetails; width: 750; x: 25; y: 500; height: 410 } diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp index 2b39d6e..77d5fa2 100644 --- a/src/declarative/fx/qfxpathview.cpp +++ b/src/declarative/fx/qfxpathview.cpp @@ -157,7 +157,6 @@ void QFxPathView::setModel(const QVariant &model) disconnect(d->model, SIGNAL(itemCreated(int, QFxItem*)), this, SLOT(itemCreated(int,QFxItem*))); for (int i=0; i<d->items.count(); i++){ QFxItem *p = d->items[i]; - attachedProperties.remove(p); d->model->release(p); } d->items.clear(); @@ -557,7 +556,6 @@ void QFxPathViewPrivate::regenerate() Q_Q(QFxPathView); for (int i=0; i<items.count(); i++){ QFxItem *p = items[i]; - q->attachedProperties.remove(p); model->release(p); } items.clear(); @@ -631,7 +629,6 @@ void QFxPathView::refill() while(wrapIndex-- >= 0){ QFxItem* p = d->items.takeFirst(); d->updateItem(p, 0.0); - attachedProperties.remove(p); d->model->release(p); d->firstIndex++; d->firstIndex %= d->model->count(); @@ -645,7 +642,6 @@ void QFxPathView::refill() while(wrapIndex++ < d->items.count()-1){ QFxItem* p = d->items.takeLast(); d->updateItem(p, 1.0); - attachedProperties.remove(p); d->model->release(p); d->firstIndex--; if (d->firstIndex < 0) @@ -704,7 +700,6 @@ void QFxPathView::itemsRemoved(int modelIndex, int count) if (d->pathItems == -1) { for (int i = 0; i < count; ++i) { QFxItem* p = d->items.takeAt(modelIndex); - attachedProperties.remove(p); d->model->release(p); } d->snapToCurrent(); @@ -876,8 +871,11 @@ void QFxPathViewPrivate::snapToCurrent() QHash<QObject*, QObject*> QFxPathView::attachedProperties; QObject *QFxPathView::qmlAttachedProperties(QObject *obj) { - QFxPathViewAttached *rv = new QFxPathViewAttached(obj); - attachedProperties.insert(obj, rv); + QObject *rv = attachedProperties.value(obj); + if (!rv) { + rv = new QFxPathViewAttached(obj); + attachedProperties.insert(obj, rv); + } return rv; } diff --git a/src/declarative/qml/script/qmlbasicscript.cpp b/src/declarative/qml/script/qmlbasicscript.cpp index 603e6ba..ee537e4 100644 --- a/src/declarative/qml/script/qmlbasicscript.cpp +++ b/src/declarative/qml/script/qmlbasicscript.cpp @@ -789,6 +789,7 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c state = Incremental; } + qWarning("ReferenceError: %s is not defined", id); } else { // instr.type == ScriptInstruction::Fetch QVariant o = stack.pop(); diff --git a/src/declarative/qml/script/qmlbasicscript_p.h b/src/declarative/qml/script/qmlbasicscript_p.h index bcb7d00..fb9951e 100644 --- a/src/declarative/qml/script/qmlbasicscript_p.h +++ b/src/declarative/qml/script/qmlbasicscript_p.h @@ -39,6 +39,7 @@ public: }; int coreType; + bool isValid() const { return type != Invalid; } bool isCore() const { return type == Core; } bool isExplicit() const { return type == Explicit; } void clear(); |