summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/declarative/elements.qdoc2
-rw-r--r--examples/declarative/progressbar/content/ProgressBar.qml3
-rw-r--r--src/declarative/QmlChanges.txt33
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp3
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp47
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp10
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.h1
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem_p.h6
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp58
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp1
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview_p_p.h2
-rw-r--r--src/declarative/qml/qdeclarativeproperty.h5
-rw-r--r--src/declarative/qml/qdeclarativeworkerscript.cpp6
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp19
-rw-r--r--src/declarative/util/qdeclarativeanimation_p.h10
-rw-r--r--src/declarative/util/qdeclarativeanimation_p_p.h5
-rw-r--r--src/declarative/util/qdeclarativebehavior.cpp3
-rw-r--r--src/declarative/util/qdeclarativeeasefollow.cpp537
-rw-r--r--src/declarative/util/qdeclarativepixmapcache.cpp18
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation.cpp483
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation_p.h (renamed from src/declarative/util/qdeclarativeeasefollow_p.h)48
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation_p_p.h134
-rw-r--r--src/declarative/util/qdeclarativespringfollow.cpp2
-rw-r--r--src/declarative/util/qdeclarativetransition.cpp6
-rw-r--r--src/declarative/util/qdeclarativeutilmodule.cpp4
-rw-r--r--src/declarative/util/qdeclarativeview.cpp1
-rw-r--r--src/declarative/util/util.pri5
-rw-r--r--src/script/bridge/qscriptdeclarativeclass.cpp12
-rw-r--r--tests/auto/declarative/declarative.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeeasefollow/data/easefollow1.qml3
-rw-r--r--tests/auto/declarative/qdeclarativeeasefollow/data/easefollow2.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeeasefollow/data/easefollow3.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeeasefollow/tst_qdeclarativeeasefollow.cpp122
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/strictlyEquals.qml17
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp21
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp11
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml2
-rw-r--r--tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation1.qml3
-rw-r--r--tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation2.qml5
-rw-r--r--tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation3.qml6
-rw-r--r--tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationBehavior.qml23
-rw-r--r--tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationValueSource.qml13
-rw-r--r--tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro (renamed from tests/auto/declarative/qdeclarativeeasefollow/qdeclarativeeasefollow.pro)2
-rw-r--r--tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp207
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview2.qml9
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.0.png (renamed from tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.0.png)bin1305 -> 1305 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.1.png (renamed from tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.1.png)bin1306 -> 1306 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.2.png (renamed from tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.2.png)bin1305 -> 1305 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.3.png (renamed from tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.3.png)bin1303 -> 1303 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.4.png (renamed from tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.4.png)bin1303 -> 1303 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.5.png (renamed from tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.5.png)bin1305 -> 1305 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.6.png (renamed from tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.6.png)bin1306 -> 1306 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.qml (renamed from tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.qml)0
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedanimation.qml (renamed from tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/easefollow.qml)15
-rw-r--r--tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp3
-rw-r--r--tools/qml/qmlruntime.cpp33
58 files changed, 1139 insertions, 849 deletions
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index 8091f95..fcfc7d6 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -77,11 +77,11 @@ The following table lists the QML elements provided by the Qt Declarative module
\o \l PauseAnimation
\o \l ParentAnimation
\o \l AnchorAnimation
+\o \l SmoothedAnimation
\o \l PropertyAction
\o \l ScriptAction
\o \l Transition
\o \l SpringFollow
-\o \l EaseFollow
\o \l Behavior
\endlist
diff --git a/examples/declarative/progressbar/content/ProgressBar.qml b/examples/declarative/progressbar/content/ProgressBar.qml
index 65c80b2..aafb12e 100644
--- a/examples/declarative/progressbar/content/ProgressBar.qml
+++ b/examples/declarative/progressbar/content/ProgressBar.qml
@@ -21,7 +21,8 @@ Item {
id: highlight; radius: 1
anchors.left: parent.left; anchors.top: parent.top; anchors.bottom: parent.bottom
anchors.leftMargin: 3; anchors.topMargin: 3; anchors.bottomMargin: 3
- EaseFollow on width { source: highlight.widthDest; velocity: 1200 }
+ width: highlight.widthDest
+ Behavior on width { SmoothedAnimation { velocity: 1200 } }
gradient: Gradient {
GradientStop { id: g1; position: 0.0 }
GradientStop { id: g2; position: 1.0 }
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt
index 847f1f5..c86bdc6 100644
--- a/src/declarative/QmlChanges.txt
+++ b/src/declarative/QmlChanges.txt
@@ -32,6 +32,39 @@ syntax has been introduced:
Item { Behavior on x {}; NumberAnimation on y {} }
Only the syntax has changed, the behavior is identical.
+
+EaseFollow changed to SmoothedAnimation
+---------------------------------------
+EaseFollow was renamed to SmoothedAnimation and now it inherits from
+NumberAnimaton and as a consequence SmoothedAnimation can be used inside
+Behaviors, as PropertySourceValues or in state transitions, like any other animation.
+
+The old EaseFollow properties changed to comply with the other declarative
+animations ('source' changed to 'to'), so now 'to' changes are not
+automatically 'followed' anymore.
+
+If you want to follow an hypothetical rect1, you should do now:
+
+     Rectangle {
+         color: "green"
+         width: 60; height: 60;
+         x: rect1.x - 5; y: rect1.y - 5;
+         Behavior on x { SmoothedAnimation { velocity: 200 } }
+         Behavior on y { SmoothedAnimation { velocity: 200 } }
+     }
+
+instead of the old automatic source changed tracking:
+
+     Rectangle {
+         color: "green"
+         width: 60; height: 60;
+         EaseFollow on x { source: rect1.x - 5; velocity: 200 }
+         EaseFollow on y { source: rect1.y - 5; velocity: 200 }
+    }
+
+This is a syntax and behavior change.
+
+
Script element removed
----------------------
Inline Script{} blocks have been deprecated, and will soon be removed entirely.
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index 98502fd..fb22429 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -137,7 +137,8 @@ QDeclarativeFlickablePrivate::QDeclarativeFlickablePrivate()
void QDeclarativeFlickablePrivate::init()
{
Q_Q(QDeclarativeFlickable);
- viewport->setParent(q);
+ QDeclarative_setParent_noEvent(viewport, q);
+ viewport->setParentItem(q);
static int timelineUpdatedIdx = -1;
static int timelineCompletedIdx = -1;
static int flickableTickedIdx = -1;
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 17f74db..12ede34 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -44,7 +44,7 @@
#include "qdeclarativevisualitemmodel_p.h"
#include "qdeclarativeflickable_p_p.h"
-#include <qdeclarativeeasefollow_p.h>
+#include "qdeclarativesmoothedanimation_p_p.h"
#include <qdeclarativeguard_p.h>
#include <qlistmodelinterface_p.h>
@@ -324,8 +324,8 @@ public:
enum MovementReason { Other, SetIndex, Mouse };
MovementReason moveReason;
int buffer;
- QDeclarativeEaseFollow *highlightXAnimator;
- QDeclarativeEaseFollow *highlightYAnimator;
+ QSmoothedAnimation *highlightXAnimator;
+ QSmoothedAnimation *highlightYAnimator;
enum BufferMode { NoBuffer = 0x00, BufferBefore = 0x01, BufferAfter = 0x02 };
BufferMode bufferMode;
QDeclarativeGridView::SnapMode snapMode;
@@ -372,7 +372,7 @@ FxGridItem *QDeclarativeGridViewPrivate::createItem(int modelIndex)
listItem->item->setZValue(1);
// complete
model->completeItem();
- listItem->item->setParent(q->viewport());
+ listItem->item->setParentItem(q->viewport());
unrequestedItems.remove(listItem->item);
}
requestedIndex = -1;
@@ -644,7 +644,7 @@ void QDeclarativeGridViewPrivate::createHighlight()
QDeclarativeContext *highlightContext = new QDeclarativeContext(qmlContext(q));
QObject *nobj = highlightComponent->create(highlightContext);
if (nobj) {
- highlightContext->setParent(nobj);
+ QDeclarative_setParent_noEvent(highlightContext, nobj);
item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item)
delete nobj;
@@ -653,19 +653,21 @@ void QDeclarativeGridViewPrivate::createHighlight()
}
} else {
item = new QDeclarativeItem;
- item->setParent(q->viewport());
+ QDeclarative_setParent_noEvent(item, q->viewport());
+ item->setParentItem(q->viewport());
}
if (item) {
- item->setParent(q->viewport());
+ QDeclarative_setParent_noEvent(item, q->viewport());
+ item->setParentItem(q->viewport());
highlight = new FxGridItem(item, q);
- highlightXAnimator = new QDeclarativeEaseFollow(q);
- highlightXAnimator->setTarget(QDeclarativeProperty(highlight->item, QLatin1String("x")));
- highlightXAnimator->setDuration(150);
- highlightXAnimator->setEnabled(autoHighlight);
- highlightYAnimator = new QDeclarativeEaseFollow(q);
- highlightYAnimator->setTarget(QDeclarativeProperty(highlight->item, QLatin1String("y")));
- highlightYAnimator->setDuration(150);
- highlightYAnimator->setEnabled(autoHighlight);
+ highlightXAnimator = new QSmoothedAnimation(q);
+ highlightXAnimator->target = QDeclarativeProperty(highlight->item, QLatin1String("x"));
+ highlightXAnimator->userDuration = 150;
+ highlightYAnimator = new QSmoothedAnimation(q);
+ highlightYAnimator->target = QDeclarativeProperty(highlight->item, QLatin1String("y"));
+ highlightYAnimator->userDuration = 150;
+ highlightXAnimator->restart();
+ highlightYAnimator->restart();
changed = true;
}
}
@@ -679,10 +681,12 @@ void QDeclarativeGridViewPrivate::updateHighlight()
createHighlight();
if (currentItem && autoHighlight && highlight && !moving) {
// auto-update highlight
- highlightXAnimator->setSourceValue(currentItem->item->x());
- highlightYAnimator->setSourceValue(currentItem->item->y());
+ highlightXAnimator->to = currentItem->item->x();
+ highlightYAnimator->to = currentItem->item->y();
highlight->item->setWidth(currentItem->item->width());
highlight->item->setHeight(currentItem->item->height());
+ highlightXAnimator->restart();
+ highlightYAnimator->restart();
}
updateTrackedItem();
}
@@ -1188,10 +1192,6 @@ void QDeclarativeGridView::setHighlightFollowsCurrentItem(bool autoHighlight)
Q_D(QDeclarativeGridView);
if (d->autoHighlight != autoHighlight) {
d->autoHighlight = autoHighlight;
- if (d->highlightXAnimator) {
- d->highlightXAnimator->setEnabled(d->autoHighlight);
- d->highlightYAnimator->setEnabled(d->autoHighlight);
- }
d->updateHighlight();
}
}
@@ -1482,9 +1482,9 @@ void QDeclarativeGridView::viewportMoved()
d->updateCurrent(idx);
if (d->currentItem && d->currentItem->colPos() != d->highlight->colPos() && d->autoHighlight) {
if (d->flow == LeftToRight)
- d->highlightXAnimator->setSourceValue(d->currentItem->item->x());
+ d->highlightXAnimator->to = d->currentItem->item->x();
else
- d->highlightYAnimator->setSourceValue(d->currentItem->item->y());
+ d->highlightYAnimator->to = d->currentItem->item->y();
}
}
}
@@ -2180,7 +2180,6 @@ void QDeclarativeGridView::modelReset()
void QDeclarativeGridView::createdItem(int index, QDeclarativeItem *item)
{
Q_D(QDeclarativeGridView);
- item->setParentItem(this);
if (d->requestedIndex != index) {
item->setParentItem(this);
d->unrequestedItems.insert(item, index);
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index e8f3652..29490e3 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -1442,14 +1442,6 @@ void QDeclarativeItem::setParentItem(QDeclarativeItem *parent)
}
/*!
- \fn void QDeclarativeItem::setParent(QDeclarativeItem *parent)
- \overload
- Sets both the parent object and parent item to \a parent. This
- function avoids the programming error of calling setParent()
- when you mean setParentItem().
-*/
-
-/*!
Returns the QDeclarativeItem parent of this item.
*/
QDeclarativeItem *QDeclarativeItem::parentItem() const
@@ -1651,7 +1643,7 @@ QRectF QDeclarativeItem::childrenRect()
Q_D(QDeclarativeItem);
if (!d->_contents) {
d->_contents = new QDeclarativeContents;
- d->_contents->setParent(this);
+ QDeclarative_setParent_noEvent(d->_contents, this);
d->_contents->setItem(this);
}
return d->_contents->rectF();
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.h b/src/declarative/graphicsitems/qdeclarativeitem.h
index 712e854..917e480 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem.h
@@ -107,7 +107,6 @@ public:
QDeclarativeItem *parentItem() const;
void setParentItem(QDeclarativeItem *parent);
- void setParent(QDeclarativeItem *parent) { setParentItem(parent); }
QDeclarativeListProperty<QObject> data();
QDeclarativeListProperty<QObject> resources();
diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h
index 10c0c25..2607137 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h
@@ -63,6 +63,7 @@
#include <private/qdeclarativestate_p.h>
#include <private/qdeclarativenullablevalue_p_p.h>
#include <private/qdeclarativenotifier_p.h>
+#include <private/qdeclarativeglobal_p.h>
#include <qdeclarative.h>
#include <qdeclarativecontext.h>
@@ -129,9 +130,10 @@ public:
void init(QDeclarativeItem *parent)
{
Q_Q(QDeclarativeItem);
-
- if (parent)
+ if (parent) {
+ QDeclarative_setParent_noEvent(q, parent);
q->setParentItem(parent);
+ }
_baselineOffset.invalidate();
mouseSetsFocus = false;
}
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 85fcc27..cbf8eac 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -44,7 +44,7 @@
#include "qdeclarativeflickable_p_p.h"
#include "qdeclarativevisualitemmodel_p.h"
-#include <qdeclarativeeasefollow_p.h>
+#include "qdeclarativesmoothedanimation_p_p.h"
#include <qdeclarativeexpression.h>
#include <qdeclarativeengine.h>
#include <qdeclarativeguard_p.h>
@@ -455,8 +455,8 @@ public:
enum MovementReason { Other, SetIndex, Mouse };
MovementReason moveReason;
int buffer;
- QDeclarativeEaseFollow *highlightPosAnimator;
- QDeclarativeEaseFollow *highlightSizeAnimator;
+ QSmoothedAnimation *highlightPosAnimator;
+ QSmoothedAnimation *highlightSizeAnimator;
QDeclarativeViewSection *sectionCriteria;
QString currentSection;
static const int sectionCacheSize = 3;
@@ -541,7 +541,7 @@ FxListItem *QDeclarativeListViewPrivate::createItem(int modelIndex)
listItem->item->setZValue(1);
// complete
model->completeItem();
- listItem->item->setParent(q->viewport());
+ listItem->item->setParentItem(q->viewport());
QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item));
itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
if (sectionCriteria && sectionCriteria->delegate()) {
@@ -803,7 +803,7 @@ void QDeclarativeListViewPrivate::createHighlight()
QDeclarativeContext *highlightContext = new QDeclarativeContext(qmlContext(q));
QObject *nobj = highlightComponent->create(highlightContext);
if (nobj) {
- highlightContext->setParent(nobj);
+ QDeclarative_setParent_noEvent(highlightContext, nobj);
item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item)
delete nobj;
@@ -814,7 +814,8 @@ void QDeclarativeListViewPrivate::createHighlight()
item = new QDeclarativeItem;
}
if (item) {
- item->setParent(q->viewport());
+ QDeclarative_setParent_noEvent(item, q->viewport());
+ item->setParentItem(q->viewport());
highlight = new FxListItem(item, q);
if (currentItem && autoHighlight) {
if (orient == QDeclarativeListView::Vertical) {
@@ -824,15 +825,15 @@ void QDeclarativeListViewPrivate::createHighlight()
}
}
const QLatin1String posProp(orient == QDeclarativeListView::Vertical ? "y" : "x");
- highlightPosAnimator = new QDeclarativeEaseFollow(q);
- highlightPosAnimator->setTarget(QDeclarativeProperty(highlight->item, posProp));
- highlightPosAnimator->setVelocity(highlightMoveSpeed);
- highlightPosAnimator->setEnabled(autoHighlight);
+ highlightPosAnimator = new QSmoothedAnimation(q);
+ highlightPosAnimator->target = QDeclarativeProperty(highlight->item, posProp);
+ highlightPosAnimator->velocity = highlightMoveSpeed;
+ highlightPosAnimator->restart();
const QLatin1String sizeProp(orient == QDeclarativeListView::Vertical ? "height" : "width");
- highlightSizeAnimator = new QDeclarativeEaseFollow(q);
- highlightSizeAnimator->setVelocity(highlightResizeSpeed);
- highlightSizeAnimator->setTarget(QDeclarativeProperty(highlight->item, sizeProp));
- highlightSizeAnimator->setEnabled(autoHighlight);
+ highlightSizeAnimator = new QSmoothedAnimation(q);
+ highlightSizeAnimator->velocity = highlightResizeSpeed;
+ highlightSizeAnimator->target = QDeclarativeProperty(highlight->item, sizeProp);
+ highlightSizeAnimator->restart();
changed = true;
}
}
@@ -846,8 +847,8 @@ void QDeclarativeListViewPrivate::updateHighlight()
createHighlight();
if (currentItem && autoHighlight && highlight && !moving) {
// auto-update highlight
- highlightPosAnimator->setSourceValue(currentItem->position());
- highlightSizeAnimator->setSourceValue(currentItem->size());
+ highlightPosAnimator->to = currentItem->position();
+ highlightSizeAnimator->to = currentItem->size();
if (orient == QDeclarativeListView::Vertical) {
if (highlight->item->width() == 0)
highlight->item->setWidth(currentItem->item->width());
@@ -855,6 +856,8 @@ void QDeclarativeListViewPrivate::updateHighlight()
if (highlight->item->height() == 0)
highlight->item->setHeight(currentItem->item->height());
}
+ highlightPosAnimator->restart();
+ highlightSizeAnimator->restart();
}
updateTrackedItem();
}
@@ -880,13 +883,14 @@ void QDeclarativeListViewPrivate::createSection(FxListItem *listItem)
context->setContextProperty(QLatin1String("section"), listItem->attached->m_section);
QObject *nobj = sectionCriteria->delegate()->create(context);
if (nobj) {
- context->setParent(nobj);
+ QDeclarative_setParent_noEvent(context, nobj);
listItem->section = qobject_cast<QDeclarativeItem *>(nobj);
if (!listItem->section) {
delete nobj;
} else {
listItem->section->setZValue(1);
- listItem->section->setParent(q->viewport());
+ QDeclarative_setParent_noEvent(listItem->section, q->viewport());
+ listItem->section->setParentItem(q->viewport());
}
} else {
delete context;
@@ -1002,7 +1006,7 @@ void QDeclarativeListViewPrivate::updateFooter()
QDeclarativeContext *context = new QDeclarativeContext(qmlContext(q));
QObject *nobj = footerComponent->create(context);
if (nobj) {
- context->setParent(nobj);
+ QDeclarative_setParent_noEvent(context, nobj);
item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item)
delete nobj;
@@ -1010,7 +1014,8 @@ void QDeclarativeListViewPrivate::updateFooter()
delete context;
}
if (item) {
- item->setParent(q->viewport());
+ QDeclarative_setParent_noEvent(item, q->viewport());
+ item->setParentItem(q->viewport());
item->setZValue(1);
footer = new FxListItem(item, q);
}
@@ -1039,7 +1044,7 @@ void QDeclarativeListViewPrivate::updateHeader()
QDeclarativeContext *context = new QDeclarativeContext(qmlContext(q));
QObject *nobj = headerComponent->create(context);
if (nobj) {
- context->setParent(nobj);
+ QDeclarative_setParent_noEvent(context, nobj);
item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item)
delete nobj;
@@ -1047,7 +1052,8 @@ void QDeclarativeListViewPrivate::updateHeader()
delete context;
}
if (item) {
- item->setParent(q->viewport());
+ QDeclarative_setParent_noEvent(item, q->viewport());
+ item->setParentItem(q->viewport());
item->setZValue(1);
header = new FxListItem(item, q);
if (visibleItems.isEmpty())
@@ -1600,10 +1606,6 @@ void QDeclarativeListView::setHighlightFollowsCurrentItem(bool autoHighlight)
Q_D(QDeclarativeListView);
if (d->autoHighlight != autoHighlight) {
d->autoHighlight = autoHighlight;
- if (d->highlightPosAnimator) {
- d->highlightPosAnimator->setEnabled(d->autoHighlight);
- d->highlightSizeAnimator->setEnabled(d->autoHighlight);
- }
d->updateHighlight();
emit highlightFollowsCurrentItemChanged();
}
@@ -1863,7 +1865,7 @@ void QDeclarativeListView::setHighlightMoveSpeed(qreal speed)
if (d->highlightMoveSpeed != speed) {
d->highlightMoveSpeed = speed;
if (d->highlightPosAnimator)
- d->highlightPosAnimator->setVelocity(d->highlightMoveSpeed);
+ d->highlightPosAnimator->velocity = d->highlightMoveSpeed;
emit highlightMoveSpeedChanged();
}
}
@@ -1880,7 +1882,7 @@ void QDeclarativeListView::setHighlightResizeSpeed(qreal speed)
if (d->highlightResizeSpeed != speed) {
d->highlightResizeSpeed = speed;
if (d->highlightSizeAnimator)
- d->highlightSizeAnimator->setVelocity(d->highlightResizeSpeed);
+ d->highlightSizeAnimator->velocity = d->highlightResizeSpeed;
emit highlightResizeSpeedChanged();
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index 0d62afa..2f1511e 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -301,12 +301,8 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
item = qobject_cast<QGraphicsObject *>(obj);
if (item) {
QDeclarative_setParent_noEvent(ctxt, obj);
- if (QDeclarativeItem* qmlItem = qobject_cast<QDeclarativeItem *>(item)) {
- qmlItem->setParentItem(q);
- } else {
- item->setParentItem(q);
- item->setParent(q);
- }
+ QDeclarative_setParent_noEvent(item, q);
+ item->setParentItem(q);
// item->setFocus(true);
initResize();
} else {
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index 26242bc..dde3366 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -639,7 +639,6 @@ bool QDeclarativeMouseArea::setPressed(bool p)
d->pressed = p;
QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress);
if (d->pressed) {
- emit positionChanged(&me);
emit pressed(&me);
} else {
emit released(&me);
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index dd1edd6..71f85ae 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -44,7 +44,6 @@
#include <qdeclarativestate_p.h>
#include <qdeclarativeopenmetaobject_p.h>
-#include <qdeclarativeeasefollow_p.h>
#include <QDebug>
#include <QEvent>
#include <qlistmodelinterface_p.h>
@@ -188,7 +187,7 @@ void QDeclarativePathViewPrivate::createHighlight()
QDeclarativeContext *highlightContext = new QDeclarativeContext(qmlContext(q));
QObject *nobj = highlightComponent->create(highlightContext);
if (nobj) {
- highlightContext->setParent(nobj);
+ QDeclarative_setParent_noEvent(highlightContext, nobj);
item = qobject_cast<QDeclarativeItem *>(nobj);
if (!item)
delete nobj;
@@ -199,7 +198,8 @@ void QDeclarativePathViewPrivate::createHighlight()
item = new QDeclarativeItem;
}
if (item) {
- item->setParent(q);
+ QDeclarative_setParent_noEvent(item, q);
+ item->setParentItem(q);
highlightItem = item;
changed = true;
}
@@ -1193,7 +1193,7 @@ void QDeclarativePathView::itemsRemoved(int modelIndex, int count)
emit countChanged();
}
-void QDeclarativePathView::itemsMoved(int from, int to, int count)
+void QDeclarativePathView::itemsMoved(int /*from*/, int /*to*/, int /*count*/)
{
Q_D(QDeclarativePathView);
if (!d->isValid() || !isComponentComplete())
diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
index 26ec4e5..6470893 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
@@ -79,9 +79,9 @@ public:
, stealMouse(false), ownModel(false), interactive(true), haveHighlightRange(true)
, autoHighlight(true), highlightUp(false), dragMargin(0), deceleration(100)
, moveOffset(this, &QDeclarativePathViewPrivate::setOffset)
- , moveHighlight(this, &QDeclarativePathViewPrivate::setHighlightPosition)
, firstIndex(-1), pathItems(-1), requestedIndex(-1)
, moveReason(Other), attType(0), highlightComponent(0), highlightItem(0)
+ , moveHighlight(this, &QDeclarativePathViewPrivate::setHighlightPosition)
, highlightPosition(0)
, highlightRangeStart(0), highlightRangeEnd(0)
, highlightRangeMode(QDeclarativePathView::StrictlyEnforceRange)
diff --git a/src/declarative/qml/qdeclarativeproperty.h b/src/declarative/qml/qdeclarativeproperty.h
index 73bccf3..8f6ea48 100644
--- a/src/declarative/qml/qdeclarativeproperty.h
+++ b/src/declarative/qml/qdeclarativeproperty.h
@@ -131,6 +131,11 @@ private:
};
typedef QList<QDeclarativeProperty> QDeclarativeProperties;
+inline uint qHash (const QDeclarativeProperty &key)
+{
+ return qHash(key.object()) + qHash(key.name());
+}
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp
index a7ed358..628681f 100644
--- a/src/declarative/qml/qdeclarativeworkerscript.cpp
+++ b/src/declarative/qml/qdeclarativeworkerscript.cpp
@@ -437,8 +437,12 @@ QDeclarativeWorkerScriptEngine::QDeclarativeWorkerScriptEngine(QDeclarativeEngin
QDeclarativeWorkerScriptEngine::~QDeclarativeWorkerScriptEngine()
{
+ d->m_lock.lock();
qDeleteAll(d->workers);
- delete d; d = 0;
+ d->workers.clear();
+ d->m_lock.unlock();
+
+ d->deleteLater();
}
QDeclarativeWorkerScriptEnginePrivate::WorkerScript::WorkerScript()
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index bad142c..ba1444e 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -1078,15 +1078,26 @@ void QDeclarativePropertyAction::transition(QDeclarativeStateActions &actions,
QDeclarativeNumberAnimation::QDeclarativeNumberAnimation(QObject *parent)
: QDeclarativePropertyAnimation(parent)
{
- Q_D(QDeclarativePropertyAnimation);
- d->interpolatorType = QMetaType::QReal;
- d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
+ init();
+}
+
+QDeclarativeNumberAnimation::QDeclarativeNumberAnimation(QDeclarativePropertyAnimationPrivate &dd, QObject *parent)
+: QDeclarativePropertyAnimation(dd, parent)
+{
+ init();
}
QDeclarativeNumberAnimation::~QDeclarativeNumberAnimation()
{
}
+void QDeclarativeNumberAnimation::init()
+{
+ Q_D(QDeclarativePropertyAnimation);
+ d->interpolatorType = QMetaType::QReal;
+ d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
+}
+
/*!
\qmlproperty real NumberAnimation::from
This property holds the starting value.
@@ -2237,8 +2248,10 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions
}
d->va->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped);
d->va->setFromSourcedValue(&data->fromSourced);
+ d->actions = &data->actions;
} else {
delete data;
+ d->actions = 0;
}
}
diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h
index 816520e..f620786 100644
--- a/src/declarative/util/qdeclarativeanimation_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p.h
@@ -251,8 +251,8 @@ public:
QDeclarativePropertyAnimation(QObject *parent=0);
virtual ~QDeclarativePropertyAnimation();
- int duration() const;
- void setDuration(int);
+ virtual int duration() const;
+ virtual void setDuration(int);
QVariant from() const;
void setFrom(const QVariant &);
@@ -326,6 +326,12 @@ public:
qreal to() const;
void setTo(qreal);
+
+protected:
+ QDeclarativeNumberAnimation(QDeclarativePropertyAnimationPrivate &dd, QObject *parent);
+
+private:
+ void init();
};
class Q_AUTOTEST_EXPORT QDeclarativeVector3dAnimation : public QDeclarativePropertyAnimation
diff --git a/src/declarative/util/qdeclarativeanimation_p_p.h b/src/declarative/util/qdeclarativeanimation_p_p.h
index 2a66c8a..8bcbeff 100644
--- a/src/declarative/util/qdeclarativeanimation_p_p.h
+++ b/src/declarative/util/qdeclarativeanimation_p_p.h
@@ -304,7 +304,7 @@ class QDeclarativePropertyAnimationPrivate : public QDeclarativeAbstractAnimatio
public:
QDeclarativePropertyAnimationPrivate()
: QDeclarativeAbstractAnimationPrivate(), target(0), fromSourced(false), fromIsDefined(false), toIsDefined(false),
- rangeIsSet(false), defaultToInterpolatorType(0), interpolatorType(0), interpolator(0), va(0) {}
+ rangeIsSet(false), defaultToInterpolatorType(0), interpolatorType(0), interpolator(0), va(0), actions(0) {}
void init();
@@ -330,6 +330,9 @@ public:
QDeclarativeBulkValueAnimator *va;
+ // for animations that dont use the QDeclarativeBulkValueAnimator
+ QDeclarativeStateActions *actions;
+
static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress);
static void convertVariant(QVariant &variant, int type);
};
diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp
index 7181777..87d6836 100644
--- a/src/declarative/util/qdeclarativebehavior.cpp
+++ b/src/declarative/util/qdeclarativebehavior.cpp
@@ -163,7 +163,8 @@ void QDeclarativeBehavior::write(const QVariant &value)
d->currentValue = d->property.read();
- d->animation->qtAnimation()->stop();
+ if (d->animation->qtAnimation()->duration() != -1)
+ d->animation->qtAnimation()->stop();
QDeclarativeStateOperation::ActionList actions;
QDeclarativeAction action;
diff --git a/src/declarative/util/qdeclarativeeasefollow.cpp b/src/declarative/util/qdeclarativeeasefollow.cpp
deleted file mode 100644
index ee181dd..0000000
--- a/src/declarative/util/qdeclarativeeasefollow.cpp
+++ /dev/null
@@ -1,537 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativeeasefollow_p.h"
-
-#include "qdeclarativeanimation_p_p.h"
-
-#include <qdeclarativeproperty.h>
-
-#include <QtCore/qdebug.h>
-
-#include <math.h>
-
-QT_BEGIN_NAMESPACE
-
-
-
-class QDeclarativeEaseFollowPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QDeclarativeEaseFollow)
-public:
- QDeclarativeEaseFollowPrivate()
- : source(0), velocity(200), duration(-1), maximumEasingTime(-1),
- reversingMode(QDeclarativeEaseFollow::Eased), initialVelocity(0),
- initialValue(0), invert(false), enabled(true), trackVelocity(0), clockOffset(0),
- lastTick(0), clock(this)
- {}
-
- qreal source;
- qreal velocity;
- qreal duration;
- qreal maximumEasingTime;
- QDeclarativeEaseFollow::ReversingMode reversingMode;
-
- qreal initialVelocity;
- qreal initialValue;
- bool invert;
- bool enabled;
-
- qreal trackVelocity;
-
- QDeclarativeProperty target;
-
- int clockOffset;
- int lastTick;
- void tick(int);
- void clockStart();
- void clockStop();
- QTickAnimationProxy<QDeclarativeEaseFollowPrivate, &QDeclarativeEaseFollowPrivate::tick> clock;
-
- void restart();
-
- // Parameters for use in tick()
- qreal a; // Acceleration
- qreal d; // Deceleration
- qreal tf; // Total time
- qreal tp; // Time at which peak velocity occurs
- qreal td; // Time at which decelleration begins
- qreal vp; // Velocity at tp
- qreal sp; // Displacement at tp
- qreal sd; // Displacement at td
- qreal vi; // "Normalized" initialvelocity
- bool recalc();
-};
-
-bool QDeclarativeEaseFollowPrivate::recalc()
-{
- qreal s = source - initialValue;
- vi = initialVelocity;
-
- s = (invert?-1.0:1.0) * s;
- vi = (invert?-1.0:1.0) * vi;
-
- if (duration > 0 && velocity > 0) {
- tf = s / velocity;
- if (tf > (duration / 1000.)) tf = (duration / 1000.);
- } else if (duration > 0) {
- tf = duration / 1000.;
- } else if (velocity > 0) {
- tf = s / velocity;
- } else {
- return false;
- }
-
- if (maximumEasingTime == 0) {
- a = 0;
- d = 0;
- tp = 0;
- td = tf;
- vp = velocity;
- sp = 0;
- sd = s;
- } else if (maximumEasingTime != -1 && tf > (maximumEasingTime / 1000.)) {
-
- qreal met = maximumEasingTime / 1000.;
- td = tf - met;
-
- qreal c1 = td;
- qreal c2 = (tf - td) * vi - tf * velocity;
- qreal c3 = -0.5 * (tf - td) * vi * vi;
-
- qreal vp1 = (-c2 + sqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1);
- // qreal vp2 = (-c2 - sqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1);
-
- vp = vp1;
- a = vp / met;
- d = a;
- tp = (vp - vi) / a;
- sp = vi * tp + 0.5 * a * tp * tp;
- sd = sp + (td - tp) * vp;
- } else {
-
- qreal c1 = 0.25 * tf * tf;
- qreal c2 = 0.5 * vi * tf - s;
- qreal c3 = -0.25 * vi * vi;
-
- qreal a1 = (-c2 + sqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1);
- //qreal a2 = (-c2 - sqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1);
-
- qreal tp1 = 0.5 * tf - 0.5 * vi / a1;
- //qreal tp2 = 0.5 * tf - 0.5 * vi / a2;
- qreal vp1 = a1 * tp1 + vi;
- //qreal vp2 = a2 * tp2 + vi;
-
- qreal sp1 = 0.5 * a1 * tp1 * tp1 + vi * tp1;
- //qreal sp2 = 0.5 * a2 * tp2 * tp2 + vi * tp2;
-
- a = a1;
- d = a1;
- tp = tp1;
- td = tp1;
- vp = vp1;
- sp = sp1;
- sd = sp1;
- }
-
- /*
- qWarning() << "a:" << a << "tf:" << tf << "tp:" << tp << "vp:"
- << vp << "sp:" << sp << "vi:" << vi << "invert:" << invert;
- */
- return true;
-}
-
-void QDeclarativeEaseFollowPrivate::clockStart()
-{
- if (clock.state() == QAbstractAnimation::Running) {
- clockOffset = lastTick;
- return;
- } else {
- clockOffset = 0;
- lastTick = 0;
- clock.start();
- }
-}
-
-void QDeclarativeEaseFollowPrivate::clockStop()
-{
- clockOffset = 0;
- lastTick = 0;
- clock.stop();
-}
-
-void QDeclarativeEaseFollowPrivate::tick(int t)
-{
- lastTick = t;
- t -= clockOffset;
-
- qreal time_seconds = qreal(t) / 1000.;
-
- qreal out = 0;
- if (time_seconds < tp) {
-
- trackVelocity = vi + time_seconds * a;
- trackVelocity = (invert?-1.0:1.0) * trackVelocity;
-
- qreal value = 0.5 * a * time_seconds * time_seconds + vi * time_seconds;
- value = (invert?-1.0:1.0) * value;
- target.write(initialValue + value);
- out = initialValue + value;
- } else if (time_seconds < td) {
-
- time_seconds -= tp;
- trackVelocity = (invert?-1.0:1.0) * vp;
- qreal value = sp + time_seconds * vp;
- value = (invert?-1.0:1.0) * value;
-
- target.write(initialValue + value);
-
- out = initialValue + value;
- } else if (time_seconds < tf) {
-
- time_seconds -= td;
-
- trackVelocity = vp - time_seconds * a;
- trackVelocity = (invert?-1.0:1.0) * trackVelocity;
-
- qreal value = sd - 0.5 * d * time_seconds * time_seconds + vp * time_seconds;
- value = (invert?-1.0:1.0) * value;
-
- target.write(initialValue + value);
-
- out = initialValue + value;
- } else {
-
- clock.stop();
-
- trackVelocity = 0;
- target.write(source);
- }
-
- //qWarning() << out << trackVelocity << t << a;
-}
-
-/*!
- \qmlclass EaseFollow QDeclarativeEaseFollow
- \since 4.7
- \brief The EaseFollow element allows a property to smoothly track a value.
-
- The EaseFollow smoothly animates a property's value to a set target value
- using an ease in/out quad easing curve. If the target value changes while
- the animation is in progress, the easing curves used to animate to the old
- and the new target values are spliced together to avoid any obvious visual
- glitches.
-
- The property animation is configured by setting the velocity at which the
- animation should occur, or the duration that the animation should take.
- If both a velocity and a duration are specified, the one that results in
- the quickest animation is chosen for each change in the target value.
-
- For example, animating from 0 to 800 will take 4 seconds if a velocity
- of 200 is set, will take 8 seconds with a duration of 8000 set, and will
- take 4 seconds with both a velocity of 200 and a duration of 8000 set.
- Animating from 0 to 20000 will take 10 seconds if a velocity of 200 is set,
- will take 8 seconds with a duration of 8000 set, and will take 8 seconds
- with both a velocity of 200 and a duration of 8000 set.
-
- The follow example shows one rectangle tracking the position of another.
-\code
-import Qt 4.6
-
-Rectangle {
- width: 800; height: 600; color: "blue"
-
- Rectangle {
- color: "green"
- width: 60; height: 60;
- x: -5; y: -5;
- EaseFollow on x { source: rect1.x - 5; velocity: 200 }
- EaseFollow on y { source: rect1.y - 5; velocity: 200 }
- }
-
- Rectangle {
- id: rect1
- color: "red"
- width: 50; height: 50;
- }
-
- focus: true
- Keys.onRightPressed: rect1.x = rect1.x + 100
- Keys.onLeftPressed: rect1.x = rect1.x - 100
- Keys.onUpPressed: rect1.y = rect1.y - 100
- Keys.onDownPressed: rect1.y = rect1.y + 100
-}
-\endcode
-
- The default velocity of EaseFollow is 200 units/second. Note that if the range of the
- value being animated is small, then the velocity will need to be adjusted
- appropriately. For example, the opacity of an item ranges from 0 - 1.0.
- To enable a smooth animation in this range the velocity will need to be
- set to a value such as 0.5 units/second. Animating from 0 to 1.0 with a velocity
- of 0.5 will take 2000 ms to complete.
-
- \sa SpringFollow
-*/
-
-QDeclarativeEaseFollow::QDeclarativeEaseFollow(QObject *parent)
-: QObject(*(new QDeclarativeEaseFollowPrivate), parent)
-{
-}
-
-QDeclarativeEaseFollow::~QDeclarativeEaseFollow()
-{
-}
-
-/*!
- \qmlproperty qreal EaseFollow::source
- This property holds the source value which will be tracked.
-
- Bind to a property in order to track its changes.
-*/
-qreal QDeclarativeEaseFollow::sourceValue() const
-{
- Q_D(const QDeclarativeEaseFollow);
- return d->source;
-}
-
-/*!
- \qmlproperty enumeration EaseFollow::reversingMode
-
- Sets how the EaseFollow behaves if an animation direction is reversed.
-
- If reversing mode is \c Eased, the animation will smoothly decelerate, and
- then reverse direction. If the reversing mode is \c Immediate, the
- animation will immediately begin accelerating in the reverse direction,
- begining with a velocity of 0. If the reversing mode is \c Sync, the
- property is immediately set to the target value.
-*/
-QDeclarativeEaseFollow::ReversingMode QDeclarativeEaseFollow::reversingMode() const
-{
- Q_D(const QDeclarativeEaseFollow);
- return d->reversingMode;
-}
-
-void QDeclarativeEaseFollow::setReversingMode(ReversingMode m)
-{
- Q_D(QDeclarativeEaseFollow);
- if (d->reversingMode == m)
- return;
-
- d->reversingMode = m;
- emit reversingModeChanged();
-}
-
-void QDeclarativeEaseFollowPrivate::restart()
-{
- if (!enabled || velocity == 0) {
- clockStop();
- return;
- }
-
- initialValue = target.read().toReal();
-
- if (source == initialValue) {
- clockStop();
- return;
- }
-
- bool hasReversed = trackVelocity != 0. &&
- ((trackVelocity > 0) == ((initialValue - source) > 0));
-
- if (hasReversed) {
- switch (reversingMode) {
- default:
- case QDeclarativeEaseFollow::Eased:
- break;
- case QDeclarativeEaseFollow::Sync:
- target.write(source);
- return;
- case QDeclarativeEaseFollow::Immediate:
- initialVelocity = 0;
- clockStop();
- break;
- }
- }
-
- trackVelocity = initialVelocity;
-
- invert = (source < initialValue);
-
- if (!recalc()) {
- target.write(source);
- clockStop();
- return;
- }
-
- clockStart();
-}
-
-void QDeclarativeEaseFollow::setSourceValue(qreal s)
-{
- Q_D(QDeclarativeEaseFollow);
-
- if (d->clock.state() == QAbstractAnimation::Running && d->source == s)
- return;
-
- d->source = s;
- d->initialVelocity = d->trackVelocity;
- d->restart();
-
- emit sourceChanged();
-}
-
-/*!
- \qmlproperty qreal EaseFollow::duration
-
- This property holds the animation duration used when tracking the source.
-
- Setting this to -1 (the default) disables the duration value.
-*/
-qreal QDeclarativeEaseFollow::duration() const
-{
- Q_D(const QDeclarativeEaseFollow);
- return d->duration;
-}
-
-void QDeclarativeEaseFollow::setDuration(qreal v)
-{
- Q_D(QDeclarativeEaseFollow);
- if (d->duration == v)
- return;
-
- d->duration = v;
- d->trackVelocity = 0;
-
- if (d->clock.state() == QAbstractAnimation::Running)
- d->restart();
-
- emit durationChanged();
-}
-
-qreal QDeclarativeEaseFollow::velocity() const
-{
- Q_D(const QDeclarativeEaseFollow);
- return d->velocity;
-}
-
-/*!
- \qmlproperty qreal EaseFollow::velocity
-
- This property holds the average velocity allowed when tracking the source.
-
- The default velocity of EaseFollow is 200 units/second.
-
- Setting this to -1 disables the velocity value.
-*/
-void QDeclarativeEaseFollow::setVelocity(qreal v)
-{
- Q_D(QDeclarativeEaseFollow);
- if (d->velocity == v)
- return;
-
- d->velocity = v;
- d->trackVelocity = 0;
-
- if (d->clock.state() == QAbstractAnimation::Running)
- d->restart();
-
- emit velocityChanged();
-}
-
-/*!
- \qmlproperty bool EaseFollow::enabled
- This property holds whether the target will track the source.
-*/
-bool QDeclarativeEaseFollow::enabled() const
-{
- Q_D(const QDeclarativeEaseFollow);
- return d->enabled;
-}
-
-void QDeclarativeEaseFollow::setEnabled(bool enabled)
-{
- Q_D(QDeclarativeEaseFollow);
- if (d->enabled == enabled)
- return;
-
- d->enabled = enabled;
- if (enabled)
- d->restart();
- else
- d->clockStop();
-
- emit enabledChanged();
-}
-
-void QDeclarativeEaseFollow::setTarget(const QDeclarativeProperty &t)
-{
- Q_D(QDeclarativeEaseFollow);
- d->target = t;
-}
-
-/*!
-\qmlproperty qreal EaseFollow::maximumEasingTime
-
-This property specifies the maximum time an "eases" during the follow should take.
-Setting this property causes the velocity to "level out" after at a time. Setting
-a negative value reverts to the normal mode of easing over the entire animation
-duration.
-
-The default value is -1.
-*/
-qreal QDeclarativeEaseFollow::maximumEasingTime() const
-{
- Q_D(const QDeclarativeEaseFollow);
- return d->maximumEasingTime;
-}
-
-void QDeclarativeEaseFollow::setMaximumEasingTime(qreal v)
-{
- Q_D(QDeclarativeEaseFollow);
- d->maximumEasingTime = v;
-
- if (d->clock.state() == QAbstractAnimation::Running)
- d->restart();
-
- emit maximumEasingTimeChanged();
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp
index a9c30f8..1da929e 100644
--- a/src/declarative/util/qdeclarativepixmapcache.cpp
+++ b/src/declarative/util/qdeclarativepixmapcache.cpp
@@ -114,7 +114,7 @@ private:
QList<QDeclarativePixmapReply*> cancelled;
QDeclarativeEngine *engine;
QDeclarativeImageRequestHandler *handler;
- QWaitCondition started;
+ QObject *eventLoopQuitHack;
QMutex mutex;
static QHash<QDeclarativeEngine *,QDeclarativeImageReader*> readers;
@@ -370,6 +370,9 @@ void QDeclarativeImageRequestHandler::networkRequestDone()
QDeclarativeImageReader::QDeclarativeImageReader(QDeclarativeEngine *eng)
: QThread(eng), engine(eng), handler(0)
{
+ eventLoopQuitHack = new QObject;
+ eventLoopQuitHack->moveToThread(this);
+ connect(eventLoopQuitHack, SIGNAL(destroyed(QObject*)), SLOT(quit()), Qt::DirectConnection);
start(QThread::IdlePriority);
}
@@ -379,15 +382,8 @@ QDeclarativeImageReader::~QDeclarativeImageReader()
readers.remove(engine);
readerMutex.unlock();
- if (isRunning()) {
- quit();
- while (!wait(100)) {
- // It is possible to for the quit to happen before exec()
- // Need to wait until the event loop starts so that we
- // can stop it. Particularly likely with an idle thread.
- quit();
- }
- }
+ eventLoopQuitHack->deleteLater();
+ wait();
}
QDeclarativeImageReader *QDeclarativeImageReader::instance(QDeclarativeEngine *engine)
@@ -396,7 +392,6 @@ QDeclarativeImageReader *QDeclarativeImageReader::instance(QDeclarativeEngine *e
QDeclarativeImageReader *reader = readers.value(engine);
if (!reader) {
reader = new QDeclarativeImageReader(engine);
- reader->started.wait(&readerMutex);
readers.insert(engine, reader);
}
readerMutex.unlock();
@@ -433,7 +428,6 @@ void QDeclarativeImageReader::run()
{
readerMutex.lock();
handler = new QDeclarativeImageRequestHandler(this, engine);
- started.wakeAll();
readerMutex.unlock();
exec();
diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp
new file mode 100644
index 0000000..b3a9b9a
--- /dev/null
+++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp
@@ -0,0 +1,483 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdeclarativesmoothedanimation_p.h"
+#include "qdeclarativesmoothedanimation_p_p.h"
+
+#include "qdeclarativeanimation_p_p.h"
+
+#include <qdeclarativeproperty.h>
+#include "qdeclarativeproperty_p.h"
+
+#include "qdeclarativeglobal_p.h"
+
+#include <QtCore/qdebug.h>
+
+#include <math.h>
+
+#define DELAY_STOP_TIMER_INTERVAL 32
+
+QT_BEGIN_NAMESPACE
+
+QSmoothedAnimation::QSmoothedAnimation(QObject *parent)
+ : QAbstractAnimation(parent), to(0), velocity(200), userDuration(-1), maximumEasingTime(-1),
+ reversingMode(QDeclarativeSmoothedAnimation::Eased), initialVelocity(0),
+ trackVelocity(0), initialValue(0), invert(false), finalDuration(-1), lastTime(0)
+{
+ delayedStopTimer.setInterval(DELAY_STOP_TIMER_INTERVAL);
+ delayedStopTimer.setSingleShot(true);
+ connect(&delayedStopTimer, SIGNAL(timeout()), this, SLOT(stop()));
+}
+
+void QSmoothedAnimation::restart()
+{
+ if (state() != QAbstractAnimation::Running)
+ start();
+ else
+ init();
+}
+
+void QSmoothedAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State /*oldState*/)
+{
+ if (newState == QAbstractAnimation::Running)
+ init();
+}
+
+void QSmoothedAnimation::delayedStop()
+{
+ if (!delayedStopTimer.isActive())
+ delayedStopTimer.start();
+}
+
+int QSmoothedAnimation::duration() const
+{
+ return -1;
+}
+
+bool QSmoothedAnimation::recalc()
+{
+ s = to - initialValue;
+ vi = initialVelocity;
+
+ s = (invert? -1.0: 1.0) * s;
+
+ if (userDuration > 0 && velocity > 0) {
+ tf = s / velocity;
+ if (tf > (userDuration / 1000.)) tf = (userDuration / 1000.);
+ } else if (userDuration > 0) {
+ tf = userDuration / 1000.;
+ } else if (velocity > 0) {
+ tf = s / velocity;
+ } else {
+ return false;
+ }
+
+ finalDuration = ceil(tf * 1000.0);
+
+ if (maximumEasingTime == 0) {
+ a = 0;
+ d = 0;
+ tp = 0;
+ td = tf;
+ vp = velocity;
+ sp = 0;
+ sd = s;
+ } else if (maximumEasingTime != -1 && tf > (maximumEasingTime / 1000.)) {
+ qreal met = maximumEasingTime / 1000.;
+ td = tf - met;
+
+ qreal c1 = td;
+ qreal c2 = (tf - td) * vi - tf * velocity;
+ qreal c3 = -0.5 * (tf - td) * vi * vi;
+
+ qreal vp1 = (-c2 + sqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1);
+
+ vp = vp1;
+ a = vp / met;
+ d = a;
+ tp = (vp - vi) / a;
+ sp = vi * tp + 0.5 * a * tp * tp;
+ sd = sp + (td - tp) * vp;
+ } else {
+ qreal c1 = 0.25 * tf * tf;
+ qreal c2 = 0.5 * vi * tf - s;
+ qreal c3 = -0.25 * vi * vi;
+
+ qreal a1 = (-c2 + sqrt(c2 * c2 - 4 * c1 * c3)) / (2. * c1);
+
+ qreal tp1 = 0.5 * tf - 0.5 * vi / a1;
+ qreal vp1 = a1 * tp1 + vi;
+
+ qreal sp1 = 0.5 * a1 * tp1 * tp1 + vi * tp1;
+
+ a = a1;
+ d = a1;
+ tp = tp1;
+ td = tp1;
+ vp = vp1;
+ sp = sp1;
+ sd = sp1;
+ }
+ return true;
+}
+
+qreal QSmoothedAnimation::easeFollow(qreal time_seconds)
+{
+ qreal value;
+ if (time_seconds < tp) {
+ trackVelocity = vi + time_seconds * a;
+ value = 0.5 * a * time_seconds * time_seconds + vi * time_seconds;
+ } else if (time_seconds < td) {
+ time_seconds -= tp;
+ trackVelocity = vp;
+ value = sp + time_seconds * vp;
+ } else if (time_seconds < tf) {
+ time_seconds -= td;
+ trackVelocity = vp - time_seconds * a;
+ value = sd - 0.5 * d * time_seconds * time_seconds + vp * time_seconds;
+ } else {
+ trackVelocity = 0;
+ value = s;
+ delayedStop();
+ }
+
+ // to normalize 's' between [0..1], divide 'value' by 's'
+ return value;
+}
+
+void QSmoothedAnimation::updateCurrentTime(int t)
+{
+ qreal time_seconds = qreal(t - lastTime) / 1000.;
+
+ qreal value = easeFollow(time_seconds);
+ value *= (invert? -1.0: 1.0);
+ QDeclarativePropertyPrivate::write(target, initialValue + value,
+ QDeclarativePropertyPrivate::BypassInterceptor
+ | QDeclarativePropertyPrivate::DontRemoveBinding);
+}
+
+void QSmoothedAnimation::init()
+{
+ if (velocity == 0) {
+ stop();
+ return;
+ }
+
+ if (delayedStopTimer.isActive())
+ delayedStopTimer.stop();
+
+ initialValue = target.read().toReal();
+ lastTime = this->currentTime();
+
+ if (to == initialValue) {
+ stop();
+ return;
+ }
+
+ bool hasReversed = trackVelocity != 0. &&
+ ((trackVelocity > 0) == ((initialValue - to) > 0));
+
+ if (hasReversed) {
+ switch (reversingMode) {
+ default:
+ case QDeclarativeSmoothedAnimation::Eased:
+ break;
+ case QDeclarativeSmoothedAnimation::Sync:
+ QDeclarativePropertyPrivate::write(target, to,
+ QDeclarativePropertyPrivate::BypassInterceptor
+ | QDeclarativePropertyPrivate::DontRemoveBinding);
+ return;
+ case QDeclarativeSmoothedAnimation::Immediate:
+ initialVelocity = 0;
+ delayedStop();
+ break;
+ }
+ }
+
+ trackVelocity = initialVelocity;
+
+ invert = (to < initialValue);
+
+ if (!recalc()) {
+ QDeclarativePropertyPrivate::write(target, to,
+ QDeclarativePropertyPrivate::BypassInterceptor
+ | QDeclarativePropertyPrivate::DontRemoveBinding);
+ stop();
+ return;
+ }
+}
+
+/*!
+ \qmlclass SmoothedAnimation QDeclarativeSmoothedAnimation
+ \since 4.7
+ \brief The SmoothedAnimation element allows a property to smoothly track a value.
+
+ The SmoothedAnimation smoothly animates a property's value to a set target value
+ using an ease in/out quad easing curve. If the animation is restarted
+ with a different target value, the easing curves used to animate to the old
+ and the new target values are spliced together to avoid any obvious visual
+ glitches.
+
+ The property animation is configured by setting the velocity at which the
+ animation should occur, or the duration that the animation should take.
+ If both a velocity and a duration are specified, the one that results in
+ the quickest animation is chosen for each change in the target value.
+
+ For example, animating from 0 to 800 will take 4 seconds if a velocity
+ of 200 is set, will take 8 seconds with a duration of 8000 set, and will
+ take 4 seconds with both a velocity of 200 and a duration of 8000 set.
+ Animating from 0 to 20000 will take 10 seconds if a velocity of 200 is set,
+ will take 8 seconds with a duration of 8000 set, and will take 8 seconds
+ with both a velocity of 200 and a duration of 8000 set.
+
+ The follow example shows one rectangle tracking the position of another.
+\code
+import Qt 4.6
+
+Rectangle {
+ width: 800; height: 600; color: "blue"
+
+ Rectangle {
+ color: "green"
+ width: 60; height: 60;
+ x: rect1.x - 5; y: rect1.y - 5;
+ Behavior on x { SmoothedAnimation { velocity: 200 } }
+ Behavior on y { SmoothedAnimation { velocity: 200 } }
+ }
+
+ Rectangle {
+ id: rect1
+ color: "red"
+ width: 50; height: 50;
+ }
+
+ focus: true
+ Keys.onRightPressed: rect1.x = rect1.x + 100
+ Keys.onLeftPressed: rect1.x = rect1.x - 100
+ Keys.onUpPressed: rect1.y = rect1.y - 100
+ Keys.onDownPressed: rect1.y = rect1.y + 100
+}
+\endcode
+
+ The default velocity of SmoothedAnimation is 200 units/second. Note that if the range of the
+ value being animated is small, then the velocity will need to be adjusted
+ appropriately. For example, the opacity of an item ranges from 0 - 1.0.
+ To enable a smooth animation in this range the velocity will need to be
+ set to a value such as 0.5 units/second. Animating from 0 to 1.0 with a velocity
+ of 0.5 will take 2000 ms to complete.
+
+ \sa SpringFollow
+*/
+
+QDeclarativeSmoothedAnimation::QDeclarativeSmoothedAnimation(QObject *parent)
+: QDeclarativeNumberAnimation(*(new QDeclarativeSmoothedAnimationPrivate), parent)
+{
+}
+
+QDeclarativeSmoothedAnimation::~QDeclarativeSmoothedAnimation()
+{
+}
+
+QDeclarativeSmoothedAnimationPrivate::QDeclarativeSmoothedAnimationPrivate()
+ : wrapperGroup(new QParallelAnimationGroup), anim(new QSmoothedAnimation)
+{
+ Q_Q(QDeclarativeSmoothedAnimation);
+ QDeclarative_setParent_noEvent(wrapperGroup, q);
+ QDeclarative_setParent_noEvent(anim, q);
+}
+
+QAbstractAnimation* QDeclarativeSmoothedAnimation::qtAnimation()
+{
+ Q_D(QDeclarativeSmoothedAnimation);
+ return d->wrapperGroup;
+}
+
+void QDeclarativeSmoothedAnimation::transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
+ TransitionDirection direction)
+{
+ Q_D(QDeclarativeSmoothedAnimation);
+ QDeclarativeNumberAnimation::transition(actions, modified, direction);
+
+ if (!d->actions)
+ return;
+
+ QSet<QAbstractAnimation*> anims;
+ for (int i = 0; i < d->actions->size(); i++) {
+ QSmoothedAnimation *ease;
+ qreal trackVelocity;
+ bool needsRestart;
+ if (!d->activeAnimations.contains((*d->actions)[i].property)) {
+ ease = new QSmoothedAnimation();
+ d->wrapperGroup->addAnimation(ease);
+ d->activeAnimations.insert((*d->actions)[i].property, ease);
+ trackVelocity = 0.0;
+ needsRestart = false;
+ } else {
+ ease = d->activeAnimations.value((*d->actions)[i].property);
+ trackVelocity = ease->trackVelocity;
+ needsRestart = true;
+ }
+
+ ease->target = (*d->actions)[i].property;
+ ease->to = (*d->actions)[i].toValue.toReal();
+
+ // copying public members from main value holder animation
+ ease->maximumEasingTime = d->anim->maximumEasingTime;
+ ease->reversingMode = d->anim->reversingMode;
+ ease->velocity = d->anim->velocity;
+ ease->userDuration = d->anim->userDuration;
+
+ ease->trackVelocity = trackVelocity;
+ ease->initialVelocity = trackVelocity;
+
+ if (needsRestart)
+ ease->init();
+ anims.insert(ease);
+ }
+
+ for (int i = d->wrapperGroup->animationCount() - 1; i >= 0 ; --i) {
+ if (!anims.contains(d->wrapperGroup->animationAt(i))) {
+ QSmoothedAnimation *ease = static_cast<QSmoothedAnimation*>(d->wrapperGroup->animationAt(i));
+ d->activeAnimations.remove(ease->target);
+ d->wrapperGroup->takeAnimation(i);
+ delete ease;
+ }
+ }
+}
+
+/*!
+ \qmlproperty enumeration SmoothedAnimation::reversingMode
+
+ Sets how the SmoothedAnimation behaves if an animation direction is reversed.
+
+ If reversing mode is \c Eased, the animation will smoothly decelerate, and
+ then reverse direction. If the reversing mode is \c Immediate, the
+ animation will immediately begin accelerating in the reverse direction,
+ begining with a velocity of 0. If the reversing mode is \c Sync, the
+ property is immediately set to the target value.
+*/
+QDeclarativeSmoothedAnimation::ReversingMode QDeclarativeSmoothedAnimation::reversingMode() const
+{
+ Q_D(const QDeclarativeSmoothedAnimation);
+ return (QDeclarativeSmoothedAnimation::ReversingMode) d->anim->reversingMode;
+}
+
+void QDeclarativeSmoothedAnimation::setReversingMode(ReversingMode m)
+{
+ Q_D(QDeclarativeSmoothedAnimation);
+ if (d->anim->reversingMode == m)
+ return;
+
+ d->anim->reversingMode = m;
+ emit reversingModeChanged();
+}
+
+/*!
+ \qmlproperty int SmoothedAnimation::duration
+
+ This property holds the animation duration, in msecs, used when tracking the source.
+
+ Setting this to -1 (the default) disables the duration value.
+*/
+int QDeclarativeSmoothedAnimation::duration() const
+{
+ Q_D(const QDeclarativeSmoothedAnimation);
+ return d->anim->userDuration;
+}
+
+void QDeclarativeSmoothedAnimation::setDuration(int duration)
+{
+ Q_D(QDeclarativeSmoothedAnimation);
+ if (duration != -1)
+ QDeclarativeNumberAnimation::setDuration(duration);
+ d->anim->userDuration = duration;
+}
+
+qreal QDeclarativeSmoothedAnimation::velocity() const
+{
+ Q_D(const QDeclarativeSmoothedAnimation);
+ return d->anim->velocity;
+}
+
+/*!
+ \qmlproperty qreal SmoothedAnimation::velocity
+
+ This property holds the average velocity allowed when tracking the 'to' value.
+
+ The default velocity of SmoothedAnimation is 200 units/second.
+
+ Setting this to -1 disables the velocity value.
+*/
+void QDeclarativeSmoothedAnimation::setVelocity(qreal v)
+{
+ Q_D(QDeclarativeSmoothedAnimation);
+ if (d->anim->velocity == v)
+ return;
+
+ d->anim->velocity = v;
+ emit velocityChanged();
+}
+
+/*!
+\qmlproperty qreal SmoothedAnimation::maximumEasingTime
+
+This property specifies the maximum time, in msecs, an "eases" during the follow should take.
+Setting this property causes the velocity to "level out" after at a time. Setting
+a negative value reverts to the normal mode of easing over the entire animation
+duration.
+
+The default value is -1.
+*/
+int QDeclarativeSmoothedAnimation::maximumEasingTime() const
+{
+ Q_D(const QDeclarativeSmoothedAnimation);
+ return d->anim->maximumEasingTime;
+}
+
+void QDeclarativeSmoothedAnimation::setMaximumEasingTime(int v)
+{
+ Q_D(QDeclarativeSmoothedAnimation);
+ d->anim->maximumEasingTime = v;
+ emit maximumEasingTimeChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativeeasefollow_p.h b/src/declarative/util/qdeclarativesmoothedanimation_p.h
index 83d1eff..50ed00c 100644
--- a/src/declarative/util/qdeclarativeeasefollow_p.h
+++ b/src/declarative/util/qdeclarativesmoothedanimation_p.h
@@ -39,11 +39,11 @@
**
****************************************************************************/
-#ifndef QDECLARATIVEEASEFOLLOW_H
-#define QDECLARATIVEEASEFOLLOW_H
+#ifndef QDECLARATIVESMOOTHEDANIMATION_H
+#define QDECLARATIVESMOOTHEDANIMATION_H
#include <qdeclarative.h>
-#include <qdeclarativepropertyvaluesource.h>
+#include "qdeclarativeanimation_p.h"
#include <QtCore/qobject.h>
@@ -54,61 +54,51 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QDeclarativeProperty;
-class QDeclarativeEaseFollowPrivate;
-class Q_DECLARATIVE_EXPORT QDeclarativeEaseFollow : public QObject,
- public QDeclarativePropertyValueSource
+class QDeclarativeSmoothedAnimationPrivate;
+class Q_DECLARATIVE_EXPORT QDeclarativeSmoothedAnimation : public QDeclarativeNumberAnimation
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QDeclarativeEaseFollow)
- Q_INTERFACES(QDeclarativePropertyValueSource)
+ Q_DECLARE_PRIVATE(QDeclarativeSmoothedAnimation)
Q_ENUMS(ReversingMode)
- Q_PROPERTY(qreal source READ sourceValue WRITE setSourceValue NOTIFY sourceChanged)
Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity NOTIFY velocityChanged)
- Q_PROPERTY(qreal duration READ duration WRITE setDuration NOTIFY durationChanged)
Q_PROPERTY(ReversingMode reversingMode READ reversingMode WRITE setReversingMode NOTIFY reversingModeChanged)
- Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
Q_PROPERTY(qreal maximumEasingTime READ maximumEasingTime WRITE setMaximumEasingTime NOTIFY maximumEasingTimeChanged)
public:
enum ReversingMode { Eased, Immediate, Sync };
- QDeclarativeEaseFollow(QObject *parent = 0);
- ~QDeclarativeEaseFollow();
+ QDeclarativeSmoothedAnimation(QObject *parent = 0);
+ ~QDeclarativeSmoothedAnimation();
ReversingMode reversingMode() const;
void setReversingMode(ReversingMode);
- qreal sourceValue() const;
- void setSourceValue(qreal);
+ virtual int duration() const;
+ virtual void setDuration(int);
qreal velocity() const;
void setVelocity(qreal);
- qreal duration() const;
- void setDuration(qreal);
+ int maximumEasingTime() const;
+ void setMaximumEasingTime(int);
- bool enabled() const;
- void setEnabled(bool enabled);
-
- qreal maximumEasingTime() const;
- void setMaximumEasingTime(qreal);
-
- virtual void setTarget(const QDeclarativeProperty &);
+public:
+ virtual void transition(QDeclarativeStateActions &actions,
+ QDeclarativeProperties &modified,
+ TransitionDirection direction);
+ QAbstractAnimation* qtAnimation();
Q_SIGNALS:
- void sourceChanged();
void velocityChanged();
- void durationChanged();
void reversingModeChanged();
- void enabledChanged();
void maximumEasingTimeChanged();
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QDeclarativeEaseFollow);
+QML_DECLARE_TYPE(QDeclarativeSmoothedAnimation);
QT_END_HEADER
-#endif // QDECLARATIVEEASEFOLLOW_H
+#endif // QDECLARATIVESMOOTHEDANIMATION_H
diff --git a/src/declarative/util/qdeclarativesmoothedanimation_p_p.h b/src/declarative/util/qdeclarativesmoothedanimation_p_p.h
new file mode 100644
index 0000000..bdceeb3
--- /dev/null
+++ b/src/declarative/util/qdeclarativesmoothedanimation_p_p.h
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QDECLARATIVESMOOTHEDANIMATION_P_H
+#define QDECLARATIVESMOOTHEDANIMATION_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qdeclarativesmoothedanimation_p.h"
+#include "qdeclarativeanimation_p.h"
+
+#include "qdeclarativeanimation_p_p.h"
+
+#include <qparallelanimationgroup.h>
+
+#include <private/qobject_p.h>
+#include <QTimer>
+
+QT_BEGIN_NAMESPACE
+
+class QSmoothedAnimation : public QAbstractAnimation
+{
+public:
+ QSmoothedAnimation(QObject *parent=0);
+
+ qreal to;
+ qreal velocity;
+ int userDuration;
+
+ int maximumEasingTime;
+ QDeclarativeSmoothedAnimation::ReversingMode reversingMode;
+
+ qreal initialVelocity;
+ qreal trackVelocity;
+
+ QDeclarativeProperty target;
+
+ int duration() const;
+ void restart();
+ void init();
+
+protected:
+ virtual void updateCurrentTime(int);
+ virtual void updateState(QAbstractAnimation::State, QAbstractAnimation::State);
+
+private:
+ qreal easeFollow(qreal);
+ qreal initialValue;
+
+ bool invert;
+
+ int finalDuration;
+
+ // Parameters for use in updateCurrentTime()
+ qreal a; // Acceleration
+ qreal d; // Deceleration
+ qreal tf; // Total time
+ qreal tp; // Time at which peak velocity occurs
+ qreal td; // Time at which decelleration begins
+ qreal vp; // Velocity at tp
+ qreal sp; // Displacement at tp
+ qreal sd; // Displacement at td
+ qreal vi; // "Normalized" initialvelocity
+ qreal s; // Total s
+
+ int lastTime;
+
+ bool recalc();
+ void delayedStop();
+
+ QTimer delayedStopTimer;
+};
+
+class QDeclarativeSmoothedAnimationPrivate : public QDeclarativePropertyAnimationPrivate
+{
+ Q_DECLARE_PUBLIC(QDeclarativeSmoothedAnimation)
+public:
+ QDeclarativeSmoothedAnimationPrivate();
+
+ QParallelAnimationGroup *wrapperGroup;
+ QSmoothedAnimation *anim;
+ QHash<QDeclarativeProperty, QSmoothedAnimation*> activeAnimations;
+};
+
+QT_END_NAMESPACE
+
+#endif // QDECLARATIVESMOOTHEDANIMATION_P_H
diff --git a/src/declarative/util/qdeclarativespringfollow.cpp b/src/declarative/util/qdeclarativespringfollow.cpp
index 76d7c98..063c3df 100644
--- a/src/declarative/util/qdeclarativespringfollow.cpp
+++ b/src/declarative/util/qdeclarativespringfollow.cpp
@@ -242,8 +242,6 @@ void QDeclarativeSpringFollowPrivate::stop()
SpringFollow on y { source: rect1.y; velocity: 200 }
}
\endcode
-
- \sa EaseFollow
*/
QDeclarativeSpringFollow::QDeclarativeSpringFollow(QObject *parent)
diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp
index 4326a55..1e8be7f 100644
--- a/src/declarative/util/qdeclarativetransition.cpp
+++ b/src/declarative/util/qdeclarativetransition.cpp
@@ -116,9 +116,9 @@ void QDeclarativeTransitionPrivate::append_animation(QDeclarativeListProperty<QD
void ParallelAnimationWrapper::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
{
QParallelAnimationGroup::updateState(newState, oldState);
- if (newState == Stopped &&
- ((direction() == QAbstractAnimation::Forward && currentLoopTime() == duration()) ||
- (direction() == QAbstractAnimation::Backward && currentLoopTime() == 0)))
+ if (newState == Stopped && (duration() == -1
+ || (direction() == QAbstractAnimation::Forward && currentLoopTime() == duration())
+ || (direction() == QAbstractAnimation::Backward && currentLoopTime() == 0)))
{
trans->complete();
}
diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp
index 2a02ffe..7f2f64a 100644
--- a/src/declarative/util/qdeclarativeutilmodule.cpp
+++ b/src/declarative/util/qdeclarativeutilmodule.cpp
@@ -45,7 +45,7 @@
#include "qdeclarativebehavior_p.h"
#include "qdeclarativebind_p.h"
#include "qdeclarativeconnections_p.h"
-#include "qdeclarativeeasefollow_p.h"
+#include "qdeclarativesmoothedanimation_p.h"
#include "qdeclarativefontloader_p.h"
#include "qdeclarativelistaccessor_p.h"
#include "qdeclarativelistmodel_p.h"
@@ -111,7 +111,7 @@ void QDeclarativeUtilModule::defineModule()
qmlRegisterType<QDeclarativeBind>("Qt",4,6,"Binding");
qmlRegisterType<QDeclarativeColorAnimation>("Qt",4,6,"ColorAnimation");
qmlRegisterType<QDeclarativeConnections>("Qt",4,6,"Connections");
- qmlRegisterType<QDeclarativeEaseFollow>("Qt",4,6,"EaseFollow");
+ qmlRegisterType<QDeclarativeSmoothedAnimation>("Qt",4,6,"SmoothedAnimation");
qmlRegisterType<QDeclarativeFontLoader>("Qt",4,6,"FontLoader");
qmlRegisterType<QDeclarativeListElement>("Qt",4,6,"ListElement");
qmlRegisterType<QDeclarativeNumberAnimation>("Qt",4,6,"NumberAnimation");
diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp
index 138fe3c..22a7873 100644
--- a/src/declarative/util/qdeclarativeview.cpp
+++ b/src/declarative/util/qdeclarativeview.cpp
@@ -157,6 +157,7 @@ void QDeclarativeViewPrivate::execute()
{
delete root;
delete component;
+ initialSize = QSize();
component = new QDeclarativeComponent(&engine, source, q);
if (!component->isLoading()) {
diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri
index f537806..4163596 100644
--- a/src/declarative/util/util.pri
+++ b/src/declarative/util/util.pri
@@ -8,7 +8,7 @@ SOURCES += \
$$PWD/qdeclarativeanimation.cpp \
$$PWD/qdeclarativesystempalette.cpp \
$$PWD/qdeclarativespringfollow.cpp \
- $$PWD/qdeclarativeeasefollow.cpp \
+ $$PWD/qdeclarativesmoothedanimation.cpp \
$$PWD/qdeclarativestate.cpp\
$$PWD/qdeclarativetransitionmanager.cpp \
$$PWD/qdeclarativestateoperations.cpp \
@@ -37,7 +37,8 @@ HEADERS += \
$$PWD/qdeclarativeanimation_p_p.h \
$$PWD/qdeclarativesystempalette_p.h \
$$PWD/qdeclarativespringfollow_p.h \
- $$PWD/qdeclarativeeasefollow_p.h \
+ $$PWD/qdeclarativesmoothedanimation_p.h \
+ $$PWD/qdeclarativesmoothedanimation_p_p.h \
$$PWD/qdeclarativestate_p.h\
$$PWD/qdeclarativestateoperations_p.h \
$$PWD/qdeclarativepropertychanges_p.h \
diff --git a/src/script/bridge/qscriptdeclarativeclass.cpp b/src/script/bridge/qscriptdeclarativeclass.cpp
index acfb2a4..0f450ca 100644
--- a/src/script/bridge/qscriptdeclarativeclass.cpp
+++ b/src/script/bridge/qscriptdeclarativeclass.cpp
@@ -70,9 +70,12 @@ QScriptDeclarativeClass::Value::Value(QScriptContext *ctxt, uint value)
new (this) JSC::JSValue(QScriptEnginePrivate::frameForContext(ctxt), value);
}
-QScriptDeclarativeClass::Value::Value(QScriptContext *ctxt, bool value)
+QScriptDeclarativeClass::Value::Value(QScriptContext *, bool value)
{
- new (this) JSC::JSValue(QScriptEnginePrivate::frameForContext(ctxt), value);
+ if (value)
+ new (this) JSC::JSValue(JSC::JSValue::JSTrue);
+ else
+ new (this) JSC::JSValue(JSC::JSValue::JSFalse);
}
QScriptDeclarativeClass::Value::Value(QScriptContext *ctxt, double value)
@@ -107,7 +110,10 @@ QScriptDeclarativeClass::Value::Value(QScriptEngine *eng, uint value)
QScriptDeclarativeClass::Value::Value(QScriptEngine *eng, bool value)
{
- new (this) JSC::JSValue(QScriptEnginePrivate::get(eng)->currentFrame, value);
+ if (value)
+ new (this) JSC::JSValue(JSC::JSValue::JSTrue);
+ else
+ new (this) JSC::JSValue(JSC::JSValue::JSFalse);
}
QScriptDeclarativeClass::Value::Value(QScriptEngine *eng, double value)
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index 6c5a75f..bebc54e 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -13,7 +13,6 @@ SUBDIRS += \
qdeclarativedebugclient \ # Cover
qdeclarativedebugservice \ # Cover
qdeclarativedom \ # Cover
- qdeclarativeeasefollow \ # Cover
qdeclarativeecmascript \ # Cover
qdeclarativeengine \ # Cover
qdeclarativeerror \ # Cover
@@ -47,6 +46,7 @@ SUBDIRS += \
qdeclarativepixmapcache \ # Cover
qdeclarativepropertymap \ # Cover
qdeclarativeqt \ # Cover
+ qdeclarativesmoothedanimation \ # Cover
qdeclarativespringfollow \ # Cover
qdeclarativestates \ # Cover
qdeclarativesystempalette \ # Cover
diff --git a/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow1.qml b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow1.qml
deleted file mode 100644
index 0cc19eb..0000000
--- a/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow1.qml
+++ /dev/null
@@ -1,3 +0,0 @@
-import Qt 4.6
-
-EaseFollow {}
diff --git a/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow2.qml b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow2.qml
deleted file mode 100644
index b65964e..0000000
--- a/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow2.qml
+++ /dev/null
@@ -1,5 +0,0 @@
-import Qt 4.6
-
-EaseFollow {
- source: 10; duration: 300; enabled: true; reversingMode: EaseFollow.Immediate
-}
diff --git a/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow3.qml b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow3.qml
deleted file mode 100644
index f8886e9..0000000
--- a/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow3.qml
+++ /dev/null
@@ -1,6 +0,0 @@
-import Qt 4.6
-
-EaseFollow {
- source: 10; velocity: 250; enabled: false; reversingMode: EaseFollow.Sync
- maximumEasingTime: 150
-}
diff --git a/tests/auto/declarative/qdeclarativeeasefollow/tst_qdeclarativeeasefollow.cpp b/tests/auto/declarative/qdeclarativeeasefollow/tst_qdeclarativeeasefollow.cpp
deleted file mode 100644
index 036eec0..0000000
--- a/tests/auto/declarative/qdeclarativeeasefollow/tst_qdeclarativeeasefollow.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <qtest.h>
-#include <QtDeclarative/qdeclarativeengine.h>
-#include <QtDeclarative/qdeclarativecomponent.h>
-#include <private/qdeclarativeeasefollow_p.h>
-#include <private/qdeclarativevaluetype_p.h>
-#include "../../../shared/util.h"
-
-class tst_qdeclarativeeasefollow : public QObject
-{
- Q_OBJECT
-public:
- tst_qdeclarativeeasefollow();
-
-private slots:
- void defaultValues();
- void values();
- void disabled();
-
-private:
- QDeclarativeEngine engine;
-};
-
-tst_qdeclarativeeasefollow::tst_qdeclarativeeasefollow()
-{
-}
-
-void tst_qdeclarativeeasefollow::defaultValues()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/easefollow1.qml"));
- QDeclarativeEaseFollow *obj = qobject_cast<QDeclarativeEaseFollow*>(c.create());
-
- QVERIFY(obj != 0);
-
- QCOMPARE(obj->sourceValue(), 0.);
- QCOMPARE(obj->velocity(), 200.);
- QCOMPARE(obj->enabled(), true);
- QCOMPARE(obj->duration(), -1.);
- QCOMPARE(obj->maximumEasingTime(), -1.);
- QCOMPARE(obj->reversingMode(), QDeclarativeEaseFollow::Eased);
-
- delete obj;
-}
-
-void tst_qdeclarativeeasefollow::values()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/easefollow2.qml"));
- QDeclarativeEaseFollow *obj = qobject_cast<QDeclarativeEaseFollow*>(c.create());
-
- QVERIFY(obj != 0);
-
- QCOMPARE(obj->sourceValue(), 10.);
- QCOMPARE(obj->velocity(), 200.);
- QCOMPARE(obj->enabled(), true);
- QCOMPARE(obj->duration(), 300.);
- QCOMPARE(obj->maximumEasingTime(), -1.);
- QCOMPARE(obj->reversingMode(), QDeclarativeEaseFollow::Immediate);
-
- delete obj;
-}
-
-void tst_qdeclarativeeasefollow::disabled()
-{
- QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/easefollow3.qml"));
- QDeclarativeEaseFollow *obj = qobject_cast<QDeclarativeEaseFollow*>(c.create());
-
- QVERIFY(obj != 0);
-
- QCOMPARE(obj->sourceValue(), 10.);
- QCOMPARE(obj->velocity(), 250.);
- QCOMPARE(obj->enabled(), false);
- QCOMPARE(obj->maximumEasingTime(), 150.);
- QCOMPARE(obj->reversingMode(), QDeclarativeEaseFollow::Sync);
-
- delete obj;
-}
-
-QTEST_MAIN(tst_qdeclarativeeasefollow)
-
-#include "tst_qdeclarativeeasefollow.moc"
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/strictlyEquals.qml b/tests/auto/declarative/qdeclarativeecmascript/data/strictlyEquals.qml
new file mode 100644
index 0000000..b9e455d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/strictlyEquals.qml
@@ -0,0 +1,17 @@
+import Qt 4.6
+
+QtObject {
+ property bool test1: (a === true)
+ property bool test2: !(a === false)
+ property bool test3: (b === 11.2)
+ property bool test4: !(b === 9)
+ property bool test5: (c === 9)
+ property bool test6: !(c === 13)
+ property bool test7: (d === "Hello world")
+ property bool test8: !(d === "Hi")
+
+ property bool a: true
+ property real b: 11.2
+ property int c: 9
+ property string d: "Hello world"
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 2791722c..b218d30 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -128,6 +128,7 @@ private slots:
void scriptDisconnect();
void ownership();
void qlistqobjectMethods();
+ void strictlyEquals();
void bug1();
void dynamicCreationCrash();
@@ -2005,6 +2006,26 @@ void tst_qdeclarativeecmascript::qlistqobjectMethods()
delete object;
}
+// QTBUG-9205
+void tst_qdeclarativeecmascript::strictlyEquals()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("strictlyEquals.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+ QCOMPARE(object->property("test3").toBool(), true);
+ QCOMPARE(object->property("test4").toBool(), true);
+ QCOMPARE(object->property("test5").toBool(), true);
+ QCOMPARE(object->property("test6").toBool(), true);
+ QCOMPARE(object->property("test7").toBool(), true);
+ QCOMPARE(object->property("test8").toBool(), true);
+
+ delete object;
+}
+
QTEST_MAIN(tst_qdeclarativeecmascript)
#include "tst_qdeclarativeecmascript.moc"
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index fcb453c..12000d0 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -193,7 +193,7 @@ void tst_QDeclarativeListModel::dynamic_data()
QTest::newRow("clear1") << "{append({'foo':456});clear();count}" << 0 << "";
QTest::newRow("clear2") << "{append({'foo':123});append({'foo':456});clear();count}" << 0 << "";
- QTest::newRow("clear2") << "{append({'foo':123});clear();get(0).foo}" << 0 << "QML ListModel (unknown location) get: index 0 out of range";
+ QTest::newRow("clear3") << "{append({'foo':123});clear();get(0).foo}" << 0 << "QML ListModel (unknown location) get: index 0 out of range";
QTest::newRow("remove1") << "{append({'foo':123});remove(0);count}" << 0 << "";
QTest::newRow("remove2a") << "{append({'foo':123});append({'foo':456});remove(0);count}" << 1 << "";
@@ -290,8 +290,6 @@ void tst_QDeclarativeListModel::dynamic_worker_data()
void tst_QDeclarativeListModel::dynamic_worker()
{
- QSKIP("", SkipAll);
-
QFETCH(QString, script);
QFETCH(int, result);
QFETCH(QString, warning);
@@ -324,6 +322,7 @@ void tst_QDeclarativeListModel::dynamic_worker()
// changes are reflected in the list model in the main thread
if (QByteArray(QTest::currentDataTag()).startsWith("nested"))
QTest::ignoreMessage(QtWarningMsg, "QML ListModel (unknown location) Cannot add nested list values when modifying or after modification from a worker script");
+
QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker",
Q_ARG(QVariant, operations.mid(0, operations.length()-1))));
waitForWorker(item);
@@ -342,7 +341,6 @@ void tst_QDeclarativeListModel::dynamic_worker()
void tst_QDeclarativeListModel::convertNestedToFlat_fail()
{
- QSKIP("", SkipAll);
// If a model has nested data, it cannot be used at all from a worker script
QFETCH(QString, script);
@@ -368,7 +366,7 @@ void tst_QDeclarativeListModel::convertNestedToFlat_fail()
delete item;
QTest::ignoreMessage(QtWarningMsg, "QThread: Destroyed while thread is still running");
- qApp->processEvents();
+ qApp->processEvents();
}
void tst_QDeclarativeListModel::convertNestedToFlat_fail_data()
@@ -387,7 +385,6 @@ void tst_QDeclarativeListModel::convertNestedToFlat_fail_data()
void tst_QDeclarativeListModel::convertNestedToFlat_ok()
{
- QSKIP("", SkipAll);
// If a model only has plain data, it can be modified from a worker script. However,
// once the model is used from a worker script, it no longer accepts nested data
@@ -429,7 +426,7 @@ void tst_QDeclarativeListModel::convertNestedToFlat_ok()
delete item;
QTest::ignoreMessage(QtWarningMsg, "QThread: Destroyed while thread is still running");
- qApp->processEvents();
+ qApp->processEvents();
}
void tst_QDeclarativeListModel::convertNestedToFlat_ok_data()
diff --git a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml
index cc64c3f..40fc436 100644
--- a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml
+++ b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml
@@ -98,7 +98,7 @@ Rectangle {
},
Component {
id: invalidHl
- EaseFollow {}
+ SmoothedAnimation {}
}
]
ListView {
diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation1.qml b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation1.qml
new file mode 100644
index 0000000..cfece41
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation1.qml
@@ -0,0 +1,3 @@
+import Qt 4.6
+
+SmoothedAnimation {}
diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation2.qml b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation2.qml
new file mode 100644
index 0000000..74a110d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation2.qml
@@ -0,0 +1,5 @@
+import Qt 4.6
+
+SmoothedAnimation {
+ to: 10; duration: 300; reversingMode: SmoothedAnimation.Immediate
+}
diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation3.qml b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation3.qml
new file mode 100644
index 0000000..3111e82
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimation3.qml
@@ -0,0 +1,6 @@
+import Qt 4.6
+
+SmoothedAnimation {
+ to: 10; velocity: 250; reversingMode: SmoothedAnimation.Sync
+ maximumEasingTime: 150
+}
diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationBehavior.qml b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationBehavior.qml
new file mode 100644
index 0000000..eb06344
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationBehavior.qml
@@ -0,0 +1,23 @@
+import Qt 4.6
+
+Rectangle {
+ width: 400; height: 400; color: "blue"
+
+ Rectangle {
+ id: rect1
+ color: "red"
+ width: 60; height: 60;
+ x: 100; y: 100;
+ SmoothedAnimation on x { to: 200; velocity: 500 }
+ SmoothedAnimation on y { to: 200; velocity: 500 }
+ }
+
+ Rectangle {
+ objectName: "theRect"
+ color: "green"
+ width: 60; height: 60;
+ x: rect1.x; y: rect1.y;
+ Behavior on x { SmoothedAnimation { objectName: "easeX"; velocity: 400 } }
+ Behavior on y { SmoothedAnimation { objectName: "easeY"; velocity: 400 } }
+ }
+ }
diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationValueSource.qml b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationValueSource.qml
new file mode 100644
index 0000000..9ae744c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativesmoothedanimation/data/smoothedanimationValueSource.qml
@@ -0,0 +1,13 @@
+import Qt 4.6
+
+Rectangle {
+ width: 300; height: 300;
+ Rectangle {
+ objectName: "theRect"
+ color: "red"
+ width: 60; height: 60;
+ x: 100; y: 100;
+ SmoothedAnimation on x { objectName: "easeX"; to: 200; velocity: 500 }
+ SmoothedAnimation on y { objectName: "easeY"; to: 200; duration: 250; velocity: 500 }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeeasefollow/qdeclarativeeasefollow.pro b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro
index 71df4f4..b41b23a 100644
--- a/tests/auto/declarative/qdeclarativeeasefollow/qdeclarativeeasefollow.pro
+++ b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro
@@ -2,7 +2,7 @@ load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative gui
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativeeasefollow.cpp
+SOURCES += tst_qdeclarativesmoothedanimation.cpp
# Define SRCDIR equal to test's source directory
DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp b/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp
new file mode 100644
index 0000000..7cf318a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp
@@ -0,0 +1,207 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtDeclarative/qdeclarativeengine.h>
+#include <QtDeclarative/qdeclarativecomponent.h>
+#include <private/qdeclarativesmoothedanimation_p.h>
+#include <private/qdeclarativerectangle_p.h>
+#include <private/qdeclarativevaluetype_p.h>
+#include "../../../shared/util.h"
+
+class tst_qdeclarativesmoothedanimation : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qdeclarativesmoothedanimation();
+
+private slots:
+ void defaultValues();
+ void values();
+ void disabled();
+ void simpleAnimation();
+ void valueSource();
+ void behavior();
+
+private:
+ QDeclarativeEngine engine;
+};
+
+tst_qdeclarativesmoothedanimation::tst_qdeclarativesmoothedanimation()
+{
+}
+
+void tst_qdeclarativesmoothedanimation::defaultValues()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimation1.qml"));
+ QDeclarativeSmoothedAnimation *obj = qobject_cast<QDeclarativeSmoothedAnimation*>(c.create());
+
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->to(), 0.);
+ QCOMPARE(obj->velocity(), 200.);
+ QCOMPARE(obj->duration(), -1);
+ QCOMPARE(obj->maximumEasingTime(), -1);
+ QCOMPARE(obj->reversingMode(), QDeclarativeSmoothedAnimation::Eased);
+
+ delete obj;
+}
+
+void tst_qdeclarativesmoothedanimation::values()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimation2.qml"));
+ QDeclarativeSmoothedAnimation *obj = qobject_cast<QDeclarativeSmoothedAnimation*>(c.create());
+
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->to(), 10.);
+ QCOMPARE(obj->velocity(), 200.);
+ QCOMPARE(obj->duration(), 300);
+ QCOMPARE(obj->maximumEasingTime(), -1);
+ QCOMPARE(obj->reversingMode(), QDeclarativeSmoothedAnimation::Immediate);
+
+ delete obj;
+}
+
+void tst_qdeclarativesmoothedanimation::disabled()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimation3.qml"));
+ QDeclarativeSmoothedAnimation *obj = qobject_cast<QDeclarativeSmoothedAnimation*>(c.create());
+
+ QVERIFY(obj != 0);
+
+ QCOMPARE(obj->to(), 10.);
+ QCOMPARE(obj->velocity(), 250.);
+ QCOMPARE(obj->maximumEasingTime(), 150);
+ QCOMPARE(obj->reversingMode(), QDeclarativeSmoothedAnimation::Sync);
+
+ delete obj;
+}
+
+void tst_qdeclarativesmoothedanimation::simpleAnimation()
+{
+ QDeclarativeRectangle rect;
+ QDeclarativeSmoothedAnimation animation;
+ animation.setTarget(&rect);
+ animation.setProperty("x");
+ animation.setTo(200);
+ animation.setDuration(250);
+ QVERIFY(animation.target() == &rect);
+ QVERIFY(animation.property() == "x");
+ QVERIFY(animation.to() == 200);
+ animation.start();
+ QVERIFY(animation.isRunning());
+ QTest::qWait(animation.duration());
+ QTRY_COMPARE(rect.x(), qreal(200));
+
+ rect.setX(0);
+ animation.start();
+ animation.pause();
+ QVERIFY(animation.isRunning());
+ QVERIFY(animation.isPaused());
+ animation.setCurrentTime(125);
+ QVERIFY(animation.currentTime() == 125);
+ QCOMPARE(rect.x(), qreal(100));
+}
+
+void tst_qdeclarativesmoothedanimation::valueSource()
+{
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimationValueSource.qml"));
+
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QDeclarativeRectangle *theRect = rect->findChild<QDeclarativeRectangle*>("theRect");
+ QVERIFY(theRect);
+
+ QDeclarativeSmoothedAnimation *easeX = rect->findChild<QDeclarativeSmoothedAnimation*>("easeX");
+ QVERIFY(easeX);
+ QVERIFY(easeX->isRunning());
+
+ QDeclarativeSmoothedAnimation *easeY = rect->findChild<QDeclarativeSmoothedAnimation*>("easeY");
+ QVERIFY(easeY);
+ QVERIFY(easeY->isRunning());
+
+ // XXX get the proper duration
+ QTest::qWait(100);
+
+ QTRY_VERIFY(!easeX->isRunning());
+ QTRY_VERIFY(!easeY->isRunning());
+
+ QTRY_COMPARE(theRect->x(), qreal(200));
+ QTRY_COMPARE(theRect->y(), qreal(200));
+}
+
+void tst_qdeclarativesmoothedanimation::behavior()
+{
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimationBehavior.qml"));
+
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect);
+
+ QDeclarativeRectangle *theRect = rect->findChild<QDeclarativeRectangle*>("theRect");
+ QVERIFY(theRect);
+
+ QDeclarativeSmoothedAnimation *easeX = rect->findChild<QDeclarativeSmoothedAnimation*>("easeX");
+ QVERIFY(easeX);
+
+ QDeclarativeSmoothedAnimation *easeY = rect->findChild<QDeclarativeSmoothedAnimation*>("easeY");
+ QVERIFY(easeY);
+
+ // XXX get the proper duration
+ QTest::qWait(400);
+
+ QTRY_VERIFY(!easeX->isRunning());
+ QTRY_VERIFY(!easeY->isRunning());
+
+ QTRY_COMPARE(theRect->x(), qreal(200));
+ QTRY_COMPARE(theRect->y(), qreal(200));
+}
+
+QTEST_MAIN(tst_qdeclarativesmoothedanimation)
+
+#include "tst_qdeclarativesmoothedanimation.moc"
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview2.qml b/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview2.qml
index f4fb863..d8512eb 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview2.qml
+++ b/tests/auto/declarative/qmlvisual/qdeclarativegridview/gridview2.qml
@@ -48,9 +48,12 @@ Rectangle {
flickableData: [
Rectangle {
color: "transparent"; border.color: "white"; border.width: 8; z: 3000
- height: 100; width: 100; x: 4; y: 4
- EaseFollow on x { source: gridView.currentItem.x; velocity: 500 }
- EaseFollow on y { source: gridView.currentItem.y; velocity: 500 }
+ height: 100; width: 100
+ x: gridView.currentItem.x
+ y: gridView.currentItem.y
+
+ Behavior on x { SmoothedAnimation { velocity: 500 } }
+ Behavior on y { SmoothedAnimation { velocity: 500 } }
}
]
}
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.0.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.0.png
index 21b6afb..21b6afb 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.0.png
+++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.0.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.1.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.1.png
index bb8a02b..bb8a02b 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.1.png
+++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.1.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.2.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.2.png
index da60237..da60237 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.2.png
+++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.2.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.3.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.3.png
index 3e943e8..3e943e8 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.3.png
+++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.3.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.4.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.4.png
index 4fbaf26..4fbaf26 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.4.png
+++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.4.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.5.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.5.png
index c10d196..c10d196 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.5.png
+++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.5.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.6.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.6.png
index a672c06..a672c06 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.6.png
+++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.6.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.qml b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.qml
index 029a2fc..029a2fc 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/data/easefollow.qml
+++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/easefollow.qml
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/easefollow.qml b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedanimation.qml
index 121328b..ee94857 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativeeasefollow/easefollow.qml
+++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedanimation.qml
@@ -15,26 +15,31 @@ Rectangle {
Rectangle {
width: 50; height: 20; y: 60; color: "red"
- EaseFollow on x { source: rect.x; velocity: 400 }
+ x: rect.x
+ Behavior on x { SmoothedAnimation { velocity: 400 } }
}
Rectangle {
width: 50; height: 20; y: 90; color: "yellow"
- EaseFollow on x { source: rect.x; velocity: 300; reversingMode: EaseFollow.Immediate }
+ x: rect.x
+ Behavior on x { SmoothedAnimation { velocity: 300; reversingMode: SmoothedAnimation.Immediate } }
}
Rectangle {
width: 50; height: 20; y: 120; color: "green"
- EaseFollow on x { source: rect.x; reversingMode: EaseFollow.Sync }
+ x: rect.x
+ Behavior on x { SmoothedAnimation { reversingMode: SmoothedAnimation.Sync } }
}
Rectangle {
width: 50; height: 20; y: 150; color: "purple"
- EaseFollow on x { source: rect.x; maximumEasingTime: 200 }
+ x: rect.x
+ Behavior on x { SmoothedAnimation { maximumEasingTime: 200 } }
}
Rectangle {
width: 50; height: 20; y: 180; color: "blue"
- EaseFollow on x { source: rect.x; duration: 300 }
+ x: rect.x
+ Behavior on x { SmoothedAnimation { duration: 300 } }
}
}
diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
index 8f1a406..2794ab8 100644
--- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
+++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
@@ -106,7 +106,6 @@ void tst_qmlvisual::visual_data()
files << QT_TEST_SOURCE_DIR "/animation/reanchor/reanchor.qml";
}
-
foreach (const QString &file, files) {
QString testdata = toTestScript(file);
if (testdata.isEmpty())
@@ -141,6 +140,8 @@ QString tst_qmlvisual::toTestScript(const QString &file, Mode mode)
int index = file.lastIndexOf(QDir::separator());
if (index == -1)
+ index = file.lastIndexOf('/');
+ if (index == -1)
return QString();
const char* platformsuffix=0; // platforms with different fonts
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index d4ceb0b..44cab97 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -995,8 +995,22 @@ void QDeclarativeViewer::statusChanged()
if (canvas->status() == QDeclarativeView::Error && tester)
tester->executefailure();
- if (canvas->status() == QDeclarativeView::Ready)
- resize(sizeHint());
+ if (canvas->status() == QDeclarativeView::Ready) {
+ if (!skin) {
+ canvas->updateGeometry();
+ if (mb)
+ mb->updateGeometry();
+ if (!isFullScreen() && !isMaximized())
+ resize(sizeHint());
+ } else {
+ if (scaleSkin)
+ canvas->resize(canvas->sizeHint());
+ else {
+ canvas->setFixedSize(skin->standardScreenSize());
+ canvas->resize(skin->standardScreenSize());
+ }
+ }
+ }
}
void QDeclarativeViewer::launch(const QString& file_or_url)
@@ -1077,21 +1091,6 @@ void QDeclarativeViewer::openQml(const QString& file_or_url)
qWarning() << "Wall startup time:" << t.elapsed();
- if (!skin) {
- canvas->updateGeometry();
- if (mb)
- mb->updateGeometry();
- if (!isFullScreen() && !isMaximized())
- resize(sizeHint());
- } else {
- if (scaleSkin)
- canvas->resize(canvas->sizeHint());
- else {
- canvas->setFixedSize(skin->standardScreenSize());
- canvas->resize(skin->standardScreenSize());
- }
- }
-
#ifdef QTOPIA
show();
#endif