summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-02-23 23:43:06 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-02-23 23:43:06 (GMT)
commit206b55e618945e7cfb428cfa7a7decbb3dc9f2e4 (patch)
tree600546d7cb8d2f9a18bbc98d29257d026a1e4888
parent2f1372b7a77d9e24d4a6f6925fe876b4e3a1b01a (diff)
parentd19f691a5646725c69b232e2adde8c2f961eb571 (diff)
downloadQt-206b55e618945e7cfb428cfa7a7decbb3dc9f2e4.zip
Qt-206b55e618945e7cfb428cfa7a7decbb3dc9f2e4.tar.gz
Qt-206b55e618945e7cfb428cfa7a7decbb3dc9f2e4.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
-rw-r--r--demos/declarative/calculator/calculator.qml4
-rw-r--r--demos/declarative/flickr/common/ImageDetails.qml2
-rw-r--r--demos/declarative/flickr/common/MediaLineEdit.qml2
-rw-r--r--demos/declarative/flickr/common/Star.qml2
-rw-r--r--demos/declarative/flickr/flickr-desktop.qml6
-rw-r--r--demos/declarative/flickr/flickr-mobile.qml4
-rw-r--r--demos/declarative/flickr/mobile/GridDelegate.qml6
-rw-r--r--demos/declarative/flickr/mobile/ImageDetails.qml2
-rw-r--r--demos/declarative/flickr/mobile/TitleBar.qml2
-rw-r--r--demos/declarative/minehunt/main.cpp4
-rw-r--r--demos/declarative/minehunt/minehunt.qml2
-rw-r--r--demos/declarative/twitter/content/HomeTitleBar.qml2
-rw-r--r--demos/declarative/twitter/content/MultiTitleBar.qml2
-rw-r--r--demos/declarative/twitter/content/TitleBar.qml2
-rw-r--r--demos/declarative/twitter/twitter.qml2
-rw-r--r--demos/declarative/webbrowser/content/FlickableWebView.qml6
-rw-r--r--demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml2
-rw-r--r--demos/declarative/webbrowser/webbrowser.qml4
-rw-r--r--doc/src/declarative/animation.qdoc12
-rw-r--r--examples/declarative/animations/easing.qml86
-rw-r--r--examples/declarative/animations/property-animation.qml8
-rw-r--r--examples/declarative/behaviours/test.qml6
-rw-r--r--examples/declarative/border-image/content/MyBorderImage.qml8
-rw-r--r--examples/declarative/connections/connections.qml2
-rw-r--r--examples/declarative/fonts/hello.qml2
-rw-r--r--examples/declarative/imageprovider/main.cpp3
-rw-r--r--examples/declarative/layouts/Button.qml2
-rw-r--r--examples/declarative/layouts/positioners.qml16
-rw-r--r--examples/declarative/objectlistmodel/main.cpp3
-rw-r--r--examples/declarative/parallax/qml/Smiley.qml8
-rw-r--r--examples/declarative/plugins/com/nokia/TimeExample/Clock.qml (renamed from examples/declarative/plugins/files/Clock.qml)0
-rw-r--r--examples/declarative/plugins/com/nokia/TimeExample/center.png (renamed from examples/declarative/plugins/files/center.png)bin765 -> 765 bytes
-rw-r--r--examples/declarative/plugins/com/nokia/TimeExample/clock.png (renamed from examples/declarative/plugins/files/clock.png)bin20653 -> 20653 bytes
-rw-r--r--examples/declarative/plugins/com/nokia/TimeExample/hour.png (renamed from examples/declarative/plugins/files/hour.png)bin625 -> 625 bytes
-rw-r--r--examples/declarative/plugins/com/nokia/TimeExample/minute.png (renamed from examples/declarative/plugins/files/minute.png)bin625 -> 625 bytes
-rw-r--r--examples/declarative/plugins/com/nokia/TimeExample/qmldir2
-rw-r--r--examples/declarative/plugins/plugin.cpp14
-rw-r--r--examples/declarative/plugins/plugins.pro22
-rw-r--r--examples/declarative/plugins/plugins.qml1
-rw-r--r--examples/declarative/slideswitch/content/Switch.qml2
-rw-r--r--examples/declarative/states/transitions.qml8
-rw-r--r--examples/declarative/tutorials/helloworld/tutorial3.qml2
-rw-r--r--examples/declarative/xmldata/yahoonews.qml2
-rw-r--r--src/corelib/kernel/qmetatype.cpp26
-rw-r--r--src/corelib/kernel/qmetatype.h8
-rw-r--r--src/corelib/kernel/qvariant.cpp55
-rw-r--r--src/corelib/kernel/qvariant.h12
-rw-r--r--src/corelib/tools/qeasingcurve.cpp69
-rw-r--r--src/corelib/tools/qeasingcurve.h11
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsgridview.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsparticles.cpp67
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsparticles_p.h55
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspositioners.cpp27
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspositioners_p.h19
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp3
-rw-r--r--src/declarative/graphicsitems/qmlgraphicswebview.cpp20
-rw-r--r--src/declarative/graphicsitems/qmlgraphicswebview_p.h15
-rw-r--r--src/declarative/qml/qml.pri10
-rw-r--r--src/declarative/qml/qmlcompiler.cpp12
-rw-r--r--src/declarative/qml/qmldirparser.cpp220
-rw-r--r--src/declarative/qml/qmldirparser_p.h125
-rw-r--r--src/declarative/qml/qmlengine.cpp256
-rw-r--r--src/declarative/qml/qmlengine.h1
-rw-r--r--src/declarative/qml/qmlengine_p.h10
-rw-r--r--src/declarative/qml/qmlextensioninterface.h67
-rw-r--r--src/declarative/qml/qmlextensionplugin.cpp87
-rw-r--r--src/declarative/qml/qmlextensionplugin.h (renamed from src/declarative/qml/qmlmoduleplugin.h)36
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp10
-rw-r--r--src/declarative/qml/qmlmetaproperty_p.h3
-rw-r--r--src/declarative/qml/qmlmoduleplugin.cpp111
-rw-r--r--src/declarative/qml/qmlpropertycache.cpp22
-rw-r--r--src/declarative/qml/qmlpropertycache_p.h7
-rw-r--r--src/declarative/qml/qmlvaluetype.cpp70
-rw-r--r--src/declarative/qml/qmlvaluetype_p.h57
-rw-r--r--src/declarative/qml/qmlworkerscript.cpp2
-rw-r--r--src/declarative/util/qmlanimation.cpp163
-rw-r--r--src/declarative/util/qmlanimation_p.h9
-rw-r--r--src/declarative/util/qmlanimation_p_p.h2
-rw-r--r--src/declarative/util/qmlview.cpp154
-rw-r--r--src/declarative/util/qmlview.h6
-rw-r--r--src/multimedia/qml/qml.cpp10
-rw-r--r--src/multimedia/qml/qml.h4
-rw-r--r--src/plugins/qmlmodules/multimedia/multimedia.cpp16
-rw-r--r--tests/auto/declarative/layouts/tst_layouts.cpp1
-rw-r--r--tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp106
-rw-r--r--tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp45
-rw-r--r--tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp35
-rw-r--r--tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp5
-rw-r--r--tests/auto/declarative/qmlgraphicslistview/data/listview.qml2
-rw-r--r--tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp55
-rw-r--r--tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp1
-rw-r--r--tests/auto/declarative/qmlgraphicsparticles/data/particlemotion.qml33
-rw-r--r--tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp89
-rw-r--r--tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp18
-rw-r--r--tests/auto/declarative/qmlgraphicspositioners/data/propertychanges.qml39
-rw-r--r--tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp78
-rw-r--r--tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp26
-rw-r--r--tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp7
-rw-r--r--tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp7
-rw-r--r--tests/auto/declarative/qmlgraphicswebview/data/propertychanges.qml33
-rw-r--r--tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp109
-rw-r--r--tests/auto/declarative/qmlvaluetypes/data/enums.1.qml6
-rw-r--r--tests/auto/declarative/qmlvaluetypes/data/enums.2.qml6
-rw-r--r--tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp21
-rw-r--r--tests/auto/declarative/visual/Package_Views/packageviews.qml2
-rw-r--r--tests/auto/declarative/visual/animation/easing/easing.qml84
-rw-r--r--tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml4
-rw-r--r--tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml2
-rw-r--r--tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml4
-rw-r--r--tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml8
-rw-r--r--tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml4
-rw-r--r--tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml4
-rw-r--r--tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml4
-rw-r--r--tests/auto/declarative/visual/qmlspringfollow/follow.qml4
-rw-r--r--tests/auto/qeasingcurve/tst_qeasingcurve.cpp115
-rw-r--r--tests/benchmarks/declarative/binding/binding.pro6
-rw-r--r--tests/benchmarks/declarative/creation/creation.pro9
-rw-r--r--tests/benchmarks/declarative/creation/tst_creation.cpp6
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro10
-rw-r--r--tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro9
-rw-r--r--tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp6
-rw-r--r--tests/benchmarks/declarative/qmltime/qmltime.cpp11
-rw-r--r--tests/benchmarks/declarative/qmltime/qmltime.pro15
-rw-r--r--tests/benchmarks/declarative/script/script.pro11
-rw-r--r--tests/benchmarks/declarative/script/tst_script.cpp6
-rw-r--r--tools/qmlviewer/qmlviewer.cpp6
-rw-r--r--tools/qmlviewer/qmlviewer.pro2
127 files changed, 2302 insertions, 876 deletions
diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml
index 54af7ad..66705e2 100644
--- a/demos/declarative/calculator/calculator.qml
+++ b/demos/declarative/calculator/calculator.qml
@@ -118,7 +118,7 @@ Rectangle {
}
transitions: Transition {
- NumberAnimation { properties: "x,y,width"; easing: "easeOutBounce"; duration: 500 }
- NumberAnimation { properties: "opacity"; easing: "easeInOutQuad"; duration: 500 }
+ NumberAnimation { properties: "x,y,width"; easing.type: "OutBounce"; duration: 500 }
+ NumberAnimation { properties: "opacity"; easing.type: "InOutQuad"; duration: 500 }
}
}
diff --git a/demos/declarative/flickr/common/ImageDetails.qml b/demos/declarative/flickr/common/ImageDetails.qml
index 19cad06..ab94d7a 100644
--- a/demos/declarative/flickr/common/ImageDetails.qml
+++ b/demos/declarative/flickr/common/ImageDetails.qml
@@ -149,7 +149,7 @@ Flipable {
property: "smooth"
value: false
}
- NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 500 }
+ NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 500 }
PropertyAction {
target: bigImage
property: "smooth"
diff --git a/demos/declarative/flickr/common/MediaLineEdit.qml b/demos/declarative/flickr/common/MediaLineEdit.qml
index 3dfd1f3..9559f6a 100644
--- a/demos/declarative/flickr/common/MediaLineEdit.qml
+++ b/demos/declarative/flickr/common/MediaLineEdit.qml
@@ -42,7 +42,7 @@ Item {
]
transitions: [
Transition {
- NumberAnimation { properties: "x,width"; duration: 500; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x,width"; duration: 500; easing.type: "InOutQuad" }
}
]
diff --git a/demos/declarative/flickr/common/Star.qml b/demos/declarative/flickr/common/Star.qml
index 8cd47b4..748a5ec 100644
--- a/demos/declarative/flickr/common/Star.qml
+++ b/demos/declarative/flickr/common/Star.qml
@@ -38,7 +38,7 @@ Item {
Transition {
NumberAnimation {
properties: "opacity,scale,x,y"
- easing: "easeOutBounce"
+ easing.type: "OutBounce"
}
}
]
diff --git a/demos/declarative/flickr/flickr-desktop.qml b/demos/declarative/flickr/flickr-desktop.qml
index 1ca3cdc..3a86347 100644
--- a/demos/declarative/flickr/flickr-desktop.qml
+++ b/demos/declarative/flickr/flickr-desktop.qml
@@ -86,14 +86,14 @@ Item {
from: "*"; to: "Details"
SequentialAnimation {
ParentAction { }
- NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing.type: "InOutQuad" }
}
},
Transition {
from: "Details"; to: "*"
SequentialAnimation {
ParentAction { }
- NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x,y,scale,opacity,angle"; duration: 500; easing.type: "InOutQuad" }
PropertyAction { targets: wrapper; properties: "z" }
}
}
@@ -180,7 +180,7 @@ Item {
transitions: [
Transition {
from: "*"; to: "*"
- NumberAnimation { properties: "y"; duration: 1000; easing: "easeOutBounce(amplitude:0.5)" }
+ NumberAnimation { properties: "y"; duration: 1000; easing.type: "OutBounce"; easing.amplitude: 0.5 }
}
]
}
diff --git a/demos/declarative/flickr/flickr-mobile.qml b/demos/declarative/flickr/flickr-mobile.qml
index 0a89c4f..77ccd08 100644
--- a/demos/declarative/flickr/flickr-mobile.qml
+++ b/demos/declarative/flickr/flickr-mobile.qml
@@ -38,7 +38,7 @@ Item {
}
transitions: Transition {
- NumberAnimation { properties: "x"; duration: 500; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x"; duration: 500; easing.type: "InOutQuad" }
}
}
@@ -76,7 +76,7 @@ Item {
}
transitions: Transition {
- NumberAnimation { properties: "x"; duration: 500; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x"; duration: 500; easing.type: "InOutQuad" }
}
}
}
diff --git a/demos/declarative/flickr/mobile/GridDelegate.qml b/demos/declarative/flickr/mobile/GridDelegate.qml
index 0f5b69c..5722f10 100644
--- a/demos/declarative/flickr/mobile/GridDelegate.qml
+++ b/demos/declarative/flickr/mobile/GridDelegate.qml
@@ -23,7 +23,7 @@
Item {
anchors.centerIn: parent
scale: 0.0
- scale: Behavior { NumberAnimation { easing: "easeInOutQuad"} }
+ scale: Behavior { NumberAnimation { easing.type: "InOutQuad"} }
id: scaleMe
Rectangle { height: 79; width: 79; id: blackRect; anchors.centerIn: parent; color: "black"; smooth: true }
@@ -55,13 +55,13 @@
Transition {
from: "Show"; to: "Details"
ParentAction { }
- NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x,y"; duration: 500; easing.type: "InOutQuad" }
},
Transition {
from: "Details"; to: "Show"
SequentialAnimation {
ParentAction { }
- NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x,y"; duration: 500; easing.type: "InOutQuad" }
PropertyAction { targets: wrapper; properties: "z" }
}
}
diff --git a/demos/declarative/flickr/mobile/ImageDetails.qml b/demos/declarative/flickr/mobile/ImageDetails.qml
index 1963bf5..415764e 100644
--- a/demos/declarative/flickr/mobile/ImageDetails.qml
+++ b/demos/declarative/flickr/mobile/ImageDetails.qml
@@ -117,7 +117,7 @@ Flipable {
transitions: Transition {
SequentialAnimation {
PropertyAction { target: bigImage; property: "smooth"; value: false }
- NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 500 }
+ NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 500 }
PropertyAction { target: bigImage; property: "smooth"; value: !flickable.moving }
}
}
diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml
index 07b9762..0a06771 100644
--- a/demos/declarative/flickr/mobile/TitleBar.qml
+++ b/demos/declarative/flickr/mobile/TitleBar.qml
@@ -71,6 +71,6 @@ Item {
}
transitions: Transition {
- NumberAnimation { properties: "x"; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x"; easing.type: "InOutQuad" }
}
}
diff --git a/demos/declarative/minehunt/main.cpp b/demos/declarative/minehunt/main.cpp
index 0b862e3..a897919 100644
--- a/demos/declarative/minehunt/main.cpp
+++ b/demos/declarative/minehunt/main.cpp
@@ -167,13 +167,11 @@ MyWidget::MyWidget(int width, int height, QWidget *parent, Qt::WindowFlags flags
canvas->setFixedSize(width, height);
vbox->addWidget(canvas);
- canvas->setSource(QUrl::fromLocalFile(fileName));
-
QmlContext *ctxt = canvas->rootContext();
ctxt->addDefaultObject(this);
ctxt->setContextProperty("tiles", QVariant::fromValue<QList<Tile*>*>(&_tiles));//QTBUG-5675
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(fileName));
}
MyWidget::~MyWidget()
diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml
index 92555c2..617a6ed 100644
--- a/demos/declarative/minehunt/minehunt.qml
+++ b/demos/declarative/minehunt/minehunt.qml
@@ -92,7 +92,7 @@ Item {
}
}
NumberAnimation {
- easing: "easeInOutQuad"
+ easing.type: "InOutQuad"
properties: "angle"
}
ScriptAction{
diff --git a/demos/declarative/twitter/content/HomeTitleBar.qml b/demos/declarative/twitter/content/HomeTitleBar.qml
index 8054f2e..a206c87 100644
--- a/demos/declarative/twitter/content/HomeTitleBar.qml
+++ b/demos/declarative/twitter/content/HomeTitleBar.qml
@@ -115,7 +115,7 @@ Item {
transitions: [
Transition {
from: "*"; to: "*"
- NumberAnimation { properties: "x,y,width,height"; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x,y,width,height"; easing.type: "InOutQuad" }
}
]
}
diff --git a/demos/declarative/twitter/content/MultiTitleBar.qml b/demos/declarative/twitter/content/MultiTitleBar.qml
index ef7de65..e0205b8 100644
--- a/demos/declarative/twitter/content/MultiTitleBar.qml
+++ b/demos/declarative/twitter/content/MultiTitleBar.qml
@@ -18,7 +18,7 @@ Item {
}
]
transitions: [
- Transition { NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" } }
+ Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: "InOutQuad" } }
]
}
diff --git a/demos/declarative/twitter/content/TitleBar.qml b/demos/declarative/twitter/content/TitleBar.qml
index 42a6115..149aa82 100644
--- a/demos/declarative/twitter/content/TitleBar.qml
+++ b/demos/declarative/twitter/content/TitleBar.qml
@@ -72,6 +72,6 @@ Item {
}
transitions: Transition {
- NumberAnimation { properties: "x"; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x"; easing.type: "InOutQuad" }
}
}
diff --git a/demos/declarative/twitter/twitter.qml b/demos/declarative/twitter/twitter.qml
index d2abf28..b091b03 100644
--- a/demos/declarative/twitter/twitter.qml
+++ b/demos/declarative/twitter/twitter.qml
@@ -89,7 +89,7 @@ Item {
}
]
transitions: [
- Transition { NumberAnimation { properties: "x,y"; duration: 500; easing: "easeInOutQuad" } }
+ Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: "InOutQuad" } }
]
}
}
diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml
index 7c46d4c..b60a95f 100644
--- a/demos/declarative/webbrowser/content/FlickableWebView.qml
+++ b/demos/declarative/webbrowser/content/FlickableWebView.qml
@@ -104,14 +104,14 @@ Flickable {
property: "scale"
from: 1
to: 0 // set before calling
- easing: "easeLinear"
+ easing.type: "Linear"
duration: 200
}
NumberAnimation {
id: flickVX
target: flickable
property: "viewportX"
- easing: "easeLinear"
+ easing.type: "Linear"
duration: 200
from: 0 // set before calling
to: 0 // set before calling
@@ -120,7 +120,7 @@ Flickable {
id: flickVY
target: flickable
property: "viewportY"
- easing: "easeLinear"
+ easing.type: "Linear"
duration: 200
from: 0 // set before calling
to: 0 // set before calling
diff --git a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml
index e58ab0a..f905150 100644
--- a/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml
+++ b/demos/declarative/webbrowser/content/RetractingWebBrowserHeader.qml
@@ -98,7 +98,7 @@ Image {
NumberAnimation {
targets: header
properties: "progressOff"
- easing: "easeInOutQuad"
+ easing.type: "InOutQuad"
duration: 300
}
}
diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml
index 934593c..faafd5d 100644
--- a/demos/declarative/webbrowser/webbrowser.qml
+++ b/demos/declarative/webbrowser/webbrowser.qml
@@ -98,7 +98,7 @@ Item {
Transition {
NumberAnimation {
properties: "opacity"
- easing: "easeInOutQuad"
+ easing.type: "InOutQuad"
duration: 300
}
}
@@ -154,7 +154,7 @@ Item {
Transition {
NumberAnimation {
properties: "opacity"
- easing: "easeInOutQuad"
+ easing.type: "InOutQuad"
duration: 320
}
}
diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc
index d80c3fa..892535e 100644
--- a/doc/src/declarative/animation.qdoc
+++ b/doc/src/declarative/animation.qdoc
@@ -72,9 +72,9 @@ Rectangle {
y: 0
y: SequentialAnimation {
repeat: true
- NumberAnimation { to: 200-img.height; easing: "easeOutBounce"; duration: 2000 }
+ NumberAnimation { to: 200-img.height; easing.type: "OutBounce"; duration: 2000 }
PauseAnimation { duration: 1000 }
- NumberAnimation { to: 0; easing: "easeOutQuad"; duration: 1000 }
+ NumberAnimation { to: 0; easing.type: "OutQuad"; duration: 1000 }
}
}
}
@@ -135,7 +135,7 @@ transitions: [
Transition {
NumberAnimation {
properties: "x,y"
- easing: "easeOutBounce"
+ easing.type: "OutBounce"
duration: 200
}
}
@@ -156,7 +156,7 @@ Transition {
SequentialAnimation {
NumberAnimation {
duration: 1000
- easing: "easeOutBounce"
+ easing.type: "OutBounce"
// animate myItem's x and y if they have changed in the state
target: myItem
properties: "x,y"
@@ -198,7 +198,7 @@ Transition {
ParallelAnimation {
NumberAnimation {
duration: 1000
- easing: "easeOutBounce"
+ easing.type: "OutBounce"
targets: box1
properties: "x,y"
}
@@ -226,7 +226,7 @@ Rectangle {
id: redRect
color: "red"
width: 100; height: 100
- x: Behavior { NumberAnimation { duration: 300; easing: "InOutQuad" } }
+ x: Behavior { NumberAnimation { duration: 300; easing.type: "InOutQuad" } }
}
\endqml
diff --git a/examples/declarative/animations/easing.qml b/examples/declarative/animations/easing.qml
index 9b5bcc6..a7ba1c5 100644
--- a/examples/declarative/animations/easing.qml
+++ b/examples/declarative/animations/easing.qml
@@ -6,47 +6,47 @@ Rectangle {
ListModel {
id: easingTypes
- ListElement { type: "easeLinear"; ballColor: "DarkRed" }
- ListElement { type: "easeInQuad"; ballColor: "IndianRed" }
- ListElement { type: "easeOutQuad"; ballColor: "Salmon" }
- ListElement { type: "easeInOutQuad"; ballColor: "Tomato" }
- ListElement { type: "easeOutInQuad"; ballColor: "DarkOrange" }
- ListElement { type: "easeInCubic"; ballColor: "Gold" }
- ListElement { type: "easeOutCubic"; ballColor: "Yellow" }
- ListElement { type: "easeInOutCubic"; ballColor: "PeachPuff" }
- ListElement { type: "easeOutInCubic"; ballColor: "Thistle" }
- ListElement { type: "easeInQuart"; ballColor: "Orchid" }
- ListElement { type: "easeOutQuart"; ballColor: "Purple" }
- ListElement { type: "easeInOutQuart"; ballColor: "SlateBlue" }
- ListElement { type: "easeOutInQuart"; ballColor: "Chartreuse" }
- ListElement { type: "easeInQuint"; ballColor: "LimeGreen" }
- ListElement { type: "easeOutQuint"; ballColor: "SeaGreen" }
- ListElement { type: "easeInOutQuint"; ballColor: "DarkGreen" }
- ListElement { type: "easeOutInQuint"; ballColor: "Olive" }
- ListElement { type: "easeInSine"; ballColor: "DarkSeaGreen" }
- ListElement { type: "easeOutSine"; ballColor: "Teal" }
- ListElement { type: "easeInOutSine"; ballColor: "Turquoise" }
- ListElement { type: "easeOutInSine"; ballColor: "SteelBlue" }
- ListElement { type: "easeInExpo"; ballColor: "SkyBlue" }
- ListElement { type: "easeOutExpo"; ballColor: "RoyalBlue" }
- ListElement { type: "easeInOutExpo"; ballColor: "MediumBlue" }
- ListElement { type: "easeOutInExpo"; ballColor: "MidnightBlue" }
- ListElement { type: "easeInCirc"; ballColor: "CornSilk" }
- ListElement { type: "easeOutCirc"; ballColor: "Bisque" }
- ListElement { type: "easeInOutCirc"; ballColor: "RosyBrown" }
- ListElement { type: "easeOutInCirc"; ballColor: "SandyBrown" }
- ListElement { type: "easeInElastic"; ballColor: "DarkGoldenRod" }
- ListElement { type: "easeOutElastic"; ballColor: "Chocolate" }
- ListElement { type: "easeInOutElastic"; ballColor: "SaddleBrown" }
- ListElement { type: "easeOutInElastic"; ballColor: "Brown" }
- ListElement { type: "easeInBack"; ballColor: "Maroon" }
- ListElement { type: "easeOutBack"; ballColor: "LavenderBlush" }
- ListElement { type: "easeInOutBack"; ballColor: "MistyRose" }
- ListElement { type: "easeOutInBack"; ballColor: "Gainsboro" }
- ListElement { type: "easeOutBounce"; ballColor: "Silver" }
- ListElement { type: "easeInBounce"; ballColor: "DimGray" }
- ListElement { type: "easeInOutBounce"; ballColor: "SlateGray" }
- ListElement { type: "easeOutInBounce"; ballColor: "DarkSlateGray" }
+ ListElement { type: "Linear"; ballColor: "DarkRed" }
+ ListElement { type: "InQuad"; ballColor: "IndianRed" }
+ ListElement { type: "OutQuad"; ballColor: "Salmon" }
+ ListElement { type: "InOutQuad"; ballColor: "Tomato" }
+ ListElement { type: "OutInQuad"; ballColor: "DarkOrange" }
+ ListElement { type: "InCubic"; ballColor: "Gold" }
+ ListElement { type: "OutCubic"; ballColor: "Yellow" }
+ ListElement { type: "InOutCubic"; ballColor: "PeachPuff" }
+ ListElement { type: "OutInCubic"; ballColor: "Thistle" }
+ ListElement { type: "InQuart"; ballColor: "Orchid" }
+ ListElement { type: "OutQuart"; ballColor: "Purple" }
+ ListElement { type: "InOutQuart"; ballColor: "SlateBlue" }
+ ListElement { type: "OutInQuart"; ballColor: "Chartreuse" }
+ ListElement { type: "InQuint"; ballColor: "LimeGreen" }
+ ListElement { type: "OutQuint"; ballColor: "SeaGreen" }
+ ListElement { type: "InOutQuint"; ballColor: "DarkGreen" }
+ ListElement { type: "OutInQuint"; ballColor: "Olive" }
+ ListElement { type: "InSine"; ballColor: "DarkSeaGreen" }
+ ListElement { type: "OutSine"; ballColor: "Teal" }
+ ListElement { type: "InOutSine"; ballColor: "Turquoise" }
+ ListElement { type: "OutInSine"; ballColor: "SteelBlue" }
+ ListElement { type: "InExpo"; ballColor: "SkyBlue" }
+ ListElement { type: "OutExpo"; ballColor: "RoyalBlue" }
+ ListElement { type: "InOutExpo"; ballColor: "MediumBlue" }
+ ListElement { type: "OutInExpo"; ballColor: "MidnightBlue" }
+ ListElement { type: "InCirc"; ballColor: "CornSilk" }
+ ListElement { type: "OutCirc"; ballColor: "Bisque" }
+ ListElement { type: "InOutCirc"; ballColor: "RosyBrown" }
+ ListElement { type: "OutInCirc"; ballColor: "SandyBrown" }
+ ListElement { type: "InElastic"; ballColor: "DarkGoldenRod" }
+ ListElement { type: "OutElastic"; ballColor: "Chocolate" }
+ ListElement { type: "InOutElastic"; ballColor: "SaddleBrown" }
+ ListElement { type: "OutInElastic"; ballColor: "Brown" }
+ ListElement { type: "InBack"; ballColor: "Maroon" }
+ ListElement { type: "OutBack"; ballColor: "LavenderBlush" }
+ ListElement { type: "InOutBack"; ballColor: "MistyRose" }
+ ListElement { type: "OutInBack"; ballColor: "Gainsboro" }
+ ListElement { type: "OutBounce"; ballColor: "Silver" }
+ ListElement { type: "InBounce"; ballColor: "DimGray" }
+ ListElement { type: "InOutBounce"; ballColor: "SlateGray" }
+ ListElement { type: "OutInBounce"; ballColor: "DarkSlateGray" }
}
Component {
@@ -80,8 +80,8 @@ Rectangle {
transitions: Transition {
ParallelAnimation {
- NumberAnimation { properties: "x"; easing: type; duration: 1000 }
- ColorAnimation { properties: "color"; easing: type; duration: 1000 }
+ NumberAnimation { properties: "x"; easing.type: type; duration: 1000 }
+ ColorAnimation { properties: "color"; easing.type: type; duration: 1000 }
}
}
}
diff --git a/examples/declarative/animations/property-animation.qml b/examples/declarative/animations/property-animation.qml
index 9f76ee5..537ee26 100644
--- a/examples/declarative/animations/property-animation.qml
+++ b/examples/declarative/animations/property-animation.qml
@@ -45,16 +45,16 @@ Item {
y: SequentialAnimation {
repeat: true
- // Move from minHeight to maxHeight in 300ms, using the easeOutExpo easing function
+ // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function
NumberAnimation {
from: smiley.minHeight; to: smiley.maxHeight
- easing: "easeOutExpo"; duration: 300
+ easing.type: "OutExpo"; duration: 300
}
- // Then move back to minHeight in 1 second, using the easeOutBounce easing function
+ // Then move back to minHeight in 1 second, using the OutBounce easing function
NumberAnimation {
from: smiley.maxHeight; to: smiley.minHeight
- easing: "easeOutBounce"; duration: 1000
+ easing.type: "OutBounce"; duration: 1000
}
// Then pause for 500ms
diff --git a/examples/declarative/behaviours/test.qml b/examples/declarative/behaviours/test.qml
index fc3f4bf..8fffd59 100644
--- a/examples/declarative/behaviours/test.qml
+++ b/examples/declarative/behaviours/test.qml
@@ -64,7 +64,8 @@ Rectangle {
property: "y"
from: 0
to: 10
- easing: "easeOutBounce(amplitude:30)"
+ easing.type: "OutBounce"
+ easing.amplitude: 30
duration: 250
}
NumberAnimation {
@@ -72,7 +73,8 @@ Rectangle {
property: "y"
from: 10
to: 0
- easing: "easeOutBounce(amplitude:30)"
+ easing.type: "OutBounce"
+ easing.amplitude: 30
duration: 250
}
}
diff --git a/examples/declarative/border-image/content/MyBorderImage.qml b/examples/declarative/border-image/content/MyBorderImage.qml
index a57acc7..ca886e9 100644
--- a/examples/declarative/border-image/content/MyBorderImage.qml
+++ b/examples/declarative/border-image/content/MyBorderImage.qml
@@ -19,14 +19,14 @@ Item {
width: SequentialAnimation {
repeat: true
- NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing: "easeInOutQuad"}
- NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing: "easeInOutQuad" }
+ NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing.type: "InOutQuad"}
+ NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing.type: "InOutQuad" }
}
height: SequentialAnimation {
repeat: true
- NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing: "easeInOutQuad"}
- NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing: "easeInOutQuad" }
+ NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing.type: "InOutQuad"}
+ NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing.type: "InOutQuad" }
}
border.top: container.margin
diff --git a/examples/declarative/connections/connections.qml b/examples/declarative/connections/connections.qml
index 07f71bb..ef2cb54 100644
--- a/examples/declarative/connections/connections.qml
+++ b/examples/declarative/connections/connections.qml
@@ -14,7 +14,7 @@ Rectangle {
Image {
id: image; source: "content/bg1.jpg"; anchors.centerIn: parent; transformOrigin: Item.Center
- rotation: Behavior { NumberAnimation { easing: "easeOutCubic"; duration: 300 } }
+ rotation: Behavior { NumberAnimation { easing.type: "OutCubic"; duration: 300 } }
}
Button {
diff --git a/examples/declarative/fonts/hello.qml b/examples/declarative/fonts/hello.qml
index c682477..fcc9580 100644
--- a/examples/declarative/fonts/hello.qml
+++ b/examples/declarative/fonts/hello.qml
@@ -11,7 +11,7 @@ Rectangle {
font.letterSpacing: SequentialAnimation {
repeat: true;
- NumberAnimation { from: 100; to: 300; easing: "easeInQuad"; duration: 3000 }
+ NumberAnimation { from: 100; to: 300; easing.type: "InQuad"; duration: 3000 }
ScriptAction { script: {
container.y = (screen.height / 4) + (Math.random() * screen.height / 2)
container.x = (screen.width / 4) + (Math.random() * screen.width / 2)
diff --git a/examples/declarative/imageprovider/main.cpp b/examples/declarative/imageprovider/main.cpp
index 9526105..eaaded2 100644
--- a/examples/declarative/imageprovider/main.cpp
+++ b/examples/declarative/imageprovider/main.cpp
@@ -75,7 +75,6 @@ int main(int argc, char ** argv)
QApplication app(argc, argv);
QmlView view;
- view.setSource(QUrl("qrc:view.qml"));
view.engine()->addImageProvider("colors", new ColorImageProvider);
@@ -91,7 +90,7 @@ int main(int argc, char ** argv)
QmlContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
- view.execute();
+ view.setSource(QUrl("qrc:view.qml"));
view.show();
return app.exec();
diff --git a/examples/declarative/layouts/Button.qml b/examples/declarative/layouts/Button.qml
index 0bdb9fc..7cbf68a 100644
--- a/examples/declarative/layouts/Button.qml
+++ b/examples/declarative/layouts/Button.qml
@@ -17,6 +17,6 @@ Rectangle { border.color: "black"; color: "steelblue"; radius: 5; width: pix.wid
transitions:
Transition{
- NumberAnimation { properties:"x,left"; easing:"easeInOutQuad"; duration:200 }
+ NumberAnimation { properties:"x,left"; easing.type:"InOutQuad"; duration:200 }
}
}
diff --git a/examples/declarative/layouts/positioners.qml b/examples/declarative/layouts/positioners.qml
index fefd964..7146702 100644
--- a/examples/declarative/layouts/positioners.qml
+++ b/examples/declarative/layouts/positioners.qml
@@ -11,12 +11,12 @@ Rectangle {
y: 0
move: Transition {
NumberAnimation {
- properties: "y"; easing: "easeOutBounce"
+ properties: "y"; easing.type: "OutBounce"
}
}
add: Transition {
NumberAnimation {
- properties: "y"; easing: "easeOutQuad"
+ properties: "y"; easing.type: "OutQuad"
}
}
Rectangle { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 }
@@ -35,12 +35,12 @@ Rectangle {
y: 300
move: Transition {
NumberAnimation {
- properties: "x"; easing: "easeOutBounce"
+ properties: "x"; easing.type: "OutBounce"
}
}
add: Transition {
NumberAnimation {
- properties: "x"; easing: "easeOutQuad"
+ properties: "x"; easing.type: "OutQuad"
}
}
Rectangle { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 }
@@ -101,13 +101,13 @@ Rectangle {
move: Transition {
NumberAnimation {
- properties: "x,y"; easing: "easeOutBounce"
+ properties: "x,y"; easing.type: "OutBounce"
}
}
add: Transition {
NumberAnimation {
- properties: "x,y"; easing: "easeOutBounce"
+ properties: "x,y"; easing.type: "OutBounce"
}
}
@@ -136,13 +136,13 @@ Rectangle {
move: Transition {
NumberAnimation {
- properties: "x,y"; easing: "easeOutBounce"
+ properties: "x,y"; easing.type: "OutBounce"
}
}
add: Transition {
NumberAnimation {
- properties: "x,y"; easing: "easeOutBounce"
+ properties: "x,y"; easing.type: "OutBounce"
}
}
Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 }
diff --git a/examples/declarative/objectlistmodel/main.cpp b/examples/declarative/objectlistmodel/main.cpp
index 9e38bea..7ea742b 100644
--- a/examples/declarative/objectlistmodel/main.cpp
+++ b/examples/declarative/objectlistmodel/main.cpp
@@ -59,7 +59,6 @@ int main(int argc, char ** argv)
QApplication app(argc, argv);
QmlView view;
- view.setSource(QUrl("qrc:view.qml"));
QList<QObject*> dataList;
dataList.append(new DataObject("Item 1", "red"));
@@ -70,7 +69,7 @@ int main(int argc, char ** argv)
QmlContext *ctxt = view.rootContext();
ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
- view.execute();
+ view.setSource(QUrl("qrc:view.qml"));
view.show();
return app.exec();
diff --git a/examples/declarative/parallax/qml/Smiley.qml b/examples/declarative/parallax/qml/Smiley.qml
index fc5b4fe..81eadda 100644
--- a/examples/declarative/parallax/qml/Smiley.qml
+++ b/examples/declarative/parallax/qml/Smiley.qml
@@ -27,16 +27,16 @@ Item {
y: SequentialAnimation {
repeat: true
- // Move from minHeight to maxHeight in 300ms, using the easeOutExpo easing function
+ // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function
NumberAnimation {
from: smiley.minHeight; to: smiley.maxHeight
- easing: "easeOutExpo"; duration: 300
+ easing.type: "OutExpo"; duration: 300
}
- // Then move back to minHeight in 1 second, using the easeOutBounce easing function
+ // Then move back to minHeight in 1 second, using the OutBounce easing function
NumberAnimation {
from: smiley.maxHeight; to: smiley.minHeight
- easing: "easeOutBounce"; duration: 1000
+ easing.type: "OutBounce"; duration: 1000
}
// Then pause for 500ms
diff --git a/examples/declarative/plugins/files/Clock.qml b/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml
index 01ec686..01ec686 100644
--- a/examples/declarative/plugins/files/Clock.qml
+++ b/examples/declarative/plugins/com/nokia/TimeExample/Clock.qml
diff --git a/examples/declarative/plugins/files/center.png b/examples/declarative/plugins/com/nokia/TimeExample/center.png
index 7fbd802..7fbd802 100644
--- a/examples/declarative/plugins/files/center.png
+++ b/examples/declarative/plugins/com/nokia/TimeExample/center.png
Binary files differ
diff --git a/examples/declarative/plugins/files/clock.png b/examples/declarative/plugins/com/nokia/TimeExample/clock.png
index 462edac..462edac 100644
--- a/examples/declarative/plugins/files/clock.png
+++ b/examples/declarative/plugins/com/nokia/TimeExample/clock.png
Binary files differ
diff --git a/examples/declarative/plugins/files/hour.png b/examples/declarative/plugins/com/nokia/TimeExample/hour.png
index f8061a1..f8061a1 100644
--- a/examples/declarative/plugins/files/hour.png
+++ b/examples/declarative/plugins/com/nokia/TimeExample/hour.png
Binary files differ
diff --git a/examples/declarative/plugins/files/minute.png b/examples/declarative/plugins/com/nokia/TimeExample/minute.png
index 1297ec7..1297ec7 100644
--- a/examples/declarative/plugins/files/minute.png
+++ b/examples/declarative/plugins/com/nokia/TimeExample/minute.png
Binary files differ
diff --git a/examples/declarative/plugins/com/nokia/TimeExample/qmldir b/examples/declarative/plugins/com/nokia/TimeExample/qmldir
new file mode 100644
index 0000000..e9ef115
--- /dev/null
+++ b/examples/declarative/plugins/com/nokia/TimeExample/qmldir
@@ -0,0 +1,2 @@
+Clock 1.0 Clock.qml
+plugin qtimeexampleqmlplugin
diff --git a/examples/declarative/plugins/plugin.cpp b/examples/declarative/plugins/plugin.cpp
index 820d4eb..8e21263 100644
--- a/examples/declarative/plugins/plugin.cpp
+++ b/examples/declarative/plugins/plugin.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include <QtDeclarative/qmlmoduleplugin.h>
+#include <QtDeclarative/QmlExtensionPlugin>
#include <QtDeclarative/qml.h>
#include <qdebug.h>
#include <qdatetime.h>
@@ -140,19 +140,15 @@ MinuteTimer *Time::timer=0;
QML_DECLARE_TYPE(Time);
-class QExampleQmlPlugin : public QmlModulePlugin
+class QExampleQmlPlugin : public QmlExtensionPlugin
{
Q_OBJECT
public:
- QStringList keys() const
- {
- return QStringList() << QLatin1String("com.nokia.TimeExample");
- }
-
- void defineModule(const QString& uri)
+ void initialize(QmlEngine *engine, const char *uri)
{
+ Q_UNUSED(engine);
Q_ASSERT(uri == QLatin1String("com.nokia.TimeExample"));
- qmlRegisterType<Time>("com.nokia.TimeExample", 1, 0, "Time", "Time");
+ qmlRegisterType<Time>(uri, 1, 0, "Time", "Time");
}
};
diff --git a/examples/declarative/plugins/plugins.pro b/examples/declarative/plugins/plugins.pro
index 84ab8da..c9c9f7e 100644
--- a/examples/declarative/plugins/plugins.pro
+++ b/examples/declarative/plugins/plugins.pro
@@ -1,15 +1,27 @@
TEMPLATE = lib
+DESTDIR = com/nokia/TimeExample
TARGET = qtimeexampleqmlplugin
CONFIG += qt plugin
QT += declarative
+VERSION = 1.0.0
SOURCES += plugin.cpp
-target.path += $$[QT_INSTALL_PLUGINS]/qmlmodules
-sources.files += files/Clock.qml files/qmldir files/background.png files/center.png files/clock-night.png files/clock.png files/hour.png files/minute.png
-sources.path += $$[QT_INSTALL_DATA]/qml/com/nokia/TimeExample
-INSTALLS += target sources
+qmlsources.files += \
+ com/nokia/TimeExample/qmldir \
+ com/nokia/TimeExample/center.png \
+ com/nokia/TimeExample/clock.png \
+ com/nokia/TimeExample/Clock.qml \
+ com/nokia/TimeExample/hour.png \
+ com/nokia/TimeExample/minute.png
+qmlsources.path += $$[QT_INSTALL_EXAMPLES]/declarative/plugins/com/nokia/TimeExample
-VERSION=1.0.0
+sources.files += plugins.pro plugin.cpp plugins.qml
+sources.path += $$[QT_INSTALL_EXAMPLES]/declarative/plugins
+target.path += $$[QT_INSTALL_EXAMPLES]/declarative/plugins/com/nokia/TimeExample
+
+INSTALLS += qmlsources sources target
+
+symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/declarative/plugins/plugins.qml b/examples/declarative/plugins/plugins.qml
index dbeb001..44b552b 100644
--- a/examples/declarative/plugins/plugins.qml
+++ b/examples/declarative/plugins/plugins.qml
@@ -1,5 +1,4 @@
import com.nokia.TimeExample 1.0 // import types from the plugin
-import 'files' // import types from the 'files' directory
Clock { // this class is defined in QML (files/Clock.qml)
diff --git a/examples/declarative/slideswitch/content/Switch.qml b/examples/declarative/slideswitch/content/Switch.qml
index 930f471..758aee6 100644
--- a/examples/declarative/slideswitch/content/Switch.qml
+++ b/examples/declarative/slideswitch/content/Switch.qml
@@ -66,7 +66,7 @@ Item {
//![7]
transitions: Transition {
- NumberAnimation { properties: "x"; easing: "easeInOutQuad"; duration: 200 }
+ NumberAnimation { properties: "x"; easing.type: "InOutQuad"; duration: 200 }
}
//![7]
}
diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml
index 48d5f60..8ad61ad 100644
--- a/examples/declarative/states/transitions.qml
+++ b/examples/declarative/states/transitions.qml
@@ -51,16 +51,16 @@ Rectangle {
// transitions define how the properties change.
transitions: [
// When transitioning to 'Position1' move x,y over a duration of 1 second,
- // with easeOutBounce easing function.
+ // with OutBounce easing function.
Transition {
from: "*"; to: "Position1"
- NumberAnimation { properties: "x,y"; easing: "easeOutBounce"; duration: 1000 }
+ NumberAnimation { properties: "x,y"; easing.type: "OutBounce"; duration: 1000 }
},
// When transitioning to 'Position2' move x,y over a duration of 2 seconds,
- // with easeInOutQuad easing function.
+ // with InOutQuad easing function.
Transition {
from: "*"; to: "Position2"
- NumberAnimation { properties: "x,y"; easing: "easeInOutQuad"; duration: 2000 }
+ NumberAnimation { properties: "x,y"; easing.type: "InOutQuad"; duration: 2000 }
},
// For any other state changes move x,y linearly over duration of 200ms.
Transition {
diff --git a/examples/declarative/tutorials/helloworld/tutorial3.qml b/examples/declarative/tutorials/helloworld/tutorial3.qml
index 9eaa009..b8a4f77 100644
--- a/examples/declarative/tutorials/helloworld/tutorial3.qml
+++ b/examples/declarative/tutorials/helloworld/tutorial3.qml
@@ -28,7 +28,7 @@ Rectangle {
transitions: Transition {
from: ""; to: "down"; reversible: true
ParallelAnimation {
- NumberAnimation { properties: "y,rotation"; duration: 500; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "y,rotation"; duration: 500; easing.type: "InOutQuad" }
ColorAnimation { duration: 500 }
}
}
diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml
index b80e29c..f7c269c 100644
--- a/examples/declarative/xmldata/yahoonews.qml
+++ b/examples/declarative/xmldata/yahoonews.qml
@@ -61,7 +61,7 @@ Rectangle {
transitions: Transition {
from: "*"; to: "Details"; reversible: true
SequentialAnimation {
- NumberAnimation { duration: 200; properties: "height"; easing: "easeOutQuad" }
+ NumberAnimation { duration: 200; properties: "height"; easing.type: "OutQuad" }
NumberAnimation { duration: 200; properties: "opacity" }
}
}
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 870baab..9e187d4 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -48,6 +48,7 @@
#include "qstringlist.h"
#include "qvector.h"
#include "qlocale.h"
+#include "qeasingcurve.h"
#ifdef QT_BOOTSTRAPPED
# ifndef QT_NO_GEOM_VARIANT
@@ -176,6 +177,7 @@ QT_BEGIN_NAMESPACE
\value QVector3D QVector3D
\value QVector4D QVector4D
\value QQuaternion QQuaternion
+ \value QEasingCurve QEasingCurve
\value User Base value for user types
@@ -256,6 +258,7 @@ static const struct { const char * typeName; int type; } types[] = {
{"QPointF", QMetaType::QPointF},
{"QRegExp", QMetaType::QRegExp},
{"QVariantHash", QMetaType::QVariantHash},
+ {"QEasingCurve", QMetaType::QEasingCurve},
/* All GUI types */
{"QColorGroup", 63},
@@ -666,6 +669,11 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data)
stream << *static_cast<const NS(QRegExp)*>(data);
break;
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QEasingCurve:
+ stream << *static_cast<const NS(QEasingCurve)*>(data);
+ break;
+#endif
#ifdef QT3_SUPPORT
case QMetaType::QColorGroup:
#endif
@@ -863,6 +871,11 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
stream >> *static_cast< NS(QRegExp)*>(data);
break;
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QEasingCurve:
+ stream >> *static_cast< NS(QEasingCurve)*>(data);
+ break;
+#endif
#ifdef QT3_SUPPORT
case QMetaType::QColorGroup:
#endif
@@ -1007,6 +1020,10 @@ void *QMetaType::construct(int type, const void *copy)
case QMetaType::QRegExp:
return new NS(QRegExp)(*static_cast<const NS(QRegExp)*>(copy));
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QEasingCurve:
+ return new NS(QEasingCurve)(*static_cast<const NS(QEasingCurve)*>(copy));
+#endif
case QMetaType::Void:
return 0;
default:
@@ -1098,6 +1115,10 @@ void *QMetaType::construct(int type, const void *copy)
case QMetaType::QRegExp:
return new NS(QRegExp);
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QEasingCurve:
+ return new NS(QEasingCurve);
+#endif
case QMetaType::Void:
return 0;
default:
@@ -1253,6 +1274,11 @@ void QMetaType::destroy(int type, void *data)
delete static_cast< NS(QRegExp)* >(data);
break;
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QMetaType::QEasingCurve:
+ delete static_cast< NS(QEasingCurve)* >(data);
+ break;
+#endif
case QMetaType::Void:
break;
default: {
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index c23caed..33126e8 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -69,7 +69,7 @@ public:
QBitArray = 13, QDate = 14, QTime = 15, QDateTime = 16, QUrl = 17,
QLocale = 18, QRect = 19, QRectF = 20, QSize = 21, QSizeF = 22,
QLine = 23, QLineF = 24, QPoint = 25, QPointF = 26, QRegExp = 27,
- QVariantHash = 28, LastCoreType = 28 /* QVariantHash */,
+ QVariantHash = 28, QEasingCurve = 29, LastCoreType = QEasingCurve,
FirstGuiType = 63 /* QColorGroup */,
#ifdef QT3_SUPPORT
@@ -81,12 +81,12 @@ public:
QTextLength = 78, QTextFormat = 79, QMatrix = 80, QTransform = 81,
QMatrix4x4 = 82, QVector2D = 83, QVector3D = 84, QVector4D = 85,
QQuaternion = 86,
- LastGuiType = 86 /* QQuaternion */,
+ LastGuiType = QQuaternion,
FirstCoreExtType = 128 /* VoidStar */,
VoidStar = 128, Long = 129, Short = 130, Char = 131, ULong = 132,
UShort = 133, UChar = 134, Float = 135, QObjectStar = 136, QWidgetStar = 137,
- LastCoreExtType = 137 /* QWidgetStar */,
+ LastCoreExtType = QWidgetStar,
// This logic must match the one in qglobal.h
#if defined(QT_COORD_TYPE)
@@ -290,6 +290,7 @@ class QPointF;
#ifndef QT_NO_REGEXP
class QRegExp;
#endif
+class QEasingCurve;
class QWidget;
class QObject;
@@ -359,6 +360,7 @@ Q_DECLARE_BUILTIN_METATYPE(QPointF, QPointF)
#ifndef QT_NO_REGEXP
Q_DECLARE_BUILTIN_METATYPE(QRegExp, QRegExp)
#endif
+Q_DECLARE_BUILTIN_METATYPE(QEasingCurve, QEasingCurve)
#ifdef QT3_SUPPORT
Q_DECLARE_BUILTIN_METATYPE(QColorGroup, QColorGroup)
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index e1b5825..384a3cd 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -46,6 +46,7 @@
#include "qdebug.h"
#include "qmap.h"
#include "qdatetime.h"
+#include "qeasingcurve.h"
#include "qlist.h"
#include "qstring.h"
#include "qstringlist.h"
@@ -146,6 +147,11 @@ static void construct(QVariant::Private *x, const void *copy)
v_construct<QRegExp>(x, copy);
break;
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QVariant::EasingCurve:
+ v_construct<QEasingCurve>(x, copy);
+ break;
+#endif
case QVariant::Int:
x->data.i = copy ? *static_cast<const int *>(copy) : 0;
break;
@@ -259,6 +265,11 @@ static void clear(QVariant::Private *d)
v_clear<QRegExp>(d);
break;
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QVariant::EasingCurve:
+ v_clear<QEasingCurve>(d);
+ break;
+#endif
case QVariant::LongLong:
case QVariant::ULongLong:
case QVariant::Double:
@@ -317,6 +328,9 @@ static bool isNull(const QVariant::Private *d)
case QVariant::PointF:
return v_cast<QPointF>(d)->isNull();
#endif
+#ifndef QT_BOOTSTRAPPED
+ case QVariant::EasingCurve:
+#endif
case QVariant::Url:
case QVariant::Locale:
case QVariant::RegExp:
@@ -435,6 +449,10 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
return *v_cast<QTime>(a) == *v_cast<QTime>(b);
case QVariant::DateTime:
return *v_cast<QDateTime>(a) == *v_cast<QDateTime>(b);
+#ifndef QT_BOOTSTRAPPED
+ case QVariant::EasingCurve:
+ return *v_cast<QEasingCurve>(a) == *v_cast<QEasingCurve>(b);
+#endif
case QVariant::ByteArray:
return *v_cast<QByteArray>(a) == *v_cast<QByteArray>(b);
case QVariant::BitArray:
@@ -1097,6 +1115,11 @@ static void streamDebug(QDebug dbg, const QVariant &v)
case QVariant::DateTime:
dbg.nospace() << v.toDateTime();
break;
+#ifndef QT_BOOTSTRAPPED
+ case QVariant::EasingCurve:
+ dbg.nospace() << v.toEasingCurve();
+ break;
+#endif
case QVariant::ByteArray:
dbg.nospace() << v.toByteArray();
break;
@@ -1265,6 +1288,7 @@ const QVariant::Handler *QVariant::handler = &qt_kernel_variant_handler;
\value Date a QDate
\value DateTime a QDateTime
\value Double a double
+ \value EasingCurve a QEasingCurve
\value Font a QFont
\value Hash a QVariantHash
\value Icon a QIcon
@@ -1483,6 +1507,12 @@ QVariant::QVariant(const char *val)
*/
/*!
+ \fn QVariant::QVariant(const QEasingCurve &val)
+
+ Constructs a new variant with an easing curve value, \a val.
+*/
+
+/*!
\fn QVariant::QVariant(const QByteArray &val)
Constructs a new variant with a bytearray value, \a val.
@@ -1681,6 +1711,10 @@ QVariant::QVariant(const QTime &val)
{ d.is_null = false; d.type = Time; v_construct<QTime>(&d, val); }
QVariant::QVariant(const QDateTime &val)
{ d.is_null = false; d.type = DateTime; v_construct<QDateTime>(&d, val); }
+#ifndef QT_BOOTSTRAPPED
+QVariant::QVariant(const QEasingCurve &val)
+{ d.is_null = false; d.type = EasingCurve; v_construct<QEasingCurve>(&d, val); }
+#endif
QVariant::QVariant(const QList<QVariant> &list)
{ d.is_null = false; d.type = List; v_construct<QVariantList>(&d, list); }
QVariant::QVariant(const QMap<QString, QVariant> &map)
@@ -1870,7 +1904,7 @@ QVariant::Type QVariant::nameToType(const char *name)
}
#ifndef QT_NO_DATASTREAM
-enum { MapFromThreeCount = 35 };
+enum { MapFromThreeCount = 36 };
static const ushort map_from_three[MapFromThreeCount] =
{
QVariant::Invalid,
@@ -1902,6 +1936,7 @@ static const ushort map_from_three[MapFromThreeCount] =
QVariant::Date,
QVariant::Time,
QVariant::DateTime,
+ QVariant::EasingCurve,
QVariant::ByteArray,
QVariant::BitArray,
QVariant::KeySequence,
@@ -2165,6 +2200,21 @@ QDateTime QVariant::toDateTime() const
}
/*!
+ \fn QEasingCurve QVariant::toEasingCurve() const
+
+ Returns the variant as a QEasingCurve if the variant has type() \l
+ EasingCurve; otherwise returns a default easing curve.
+
+ \sa canConvert(), convert()
+*/
+#ifndef QT_BOOTSTRAPPED
+QEasingCurve QVariant::toEasingCurve() const
+{
+ return qVariantToHelper<QEasingCurve>(d, EasingCurve, handler);
+}
+#endif
+
+/*!
\fn QByteArray QVariant::toByteArray() const
Returns the variant as a QByteArray if the variant has type() \l
@@ -2605,8 +2655,9 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
/*QRegExp*/ 0,
-/*QHash*/ 0
+/*QHash*/ 0,
+/*QEasingCurve*/ 0
};
/*!
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 1a9e43a..9628dbf 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -60,6 +60,7 @@ class QBitArray;
class QDataStream;
class QDate;
class QDateTime;
+class QEasingCurve;
class QLine;
class QLineF;
class QLocale;
@@ -128,9 +129,10 @@ class Q_CORE_EXPORT QVariant
LineF = 24,
Point = 25,
PointF = 26,
- RegExp = 27,
+ RegExp = 27,
Hash = 28,
- LastCoreType = Hash,
+ EasingCurve = 29,
+ LastCoreType = EasingCurve,
// value 62 is internally reserved
#ifdef QT3_SUPPORT
@@ -219,6 +221,9 @@ class Q_CORE_EXPORT QVariant
#ifndef QT_NO_REGEXP
QVariant(const QRegExp &regExp);
#endif
+#ifndef QT_BOOTSTRAPPED
+ QVariant(const QEasingCurve &easing);
+#endif
QVariant(Qt::GlobalColor color);
QVariant& operator=(const QVariant &other);
@@ -280,6 +285,9 @@ class Q_CORE_EXPORT QVariant
#ifndef QT_NO_REGEXP
QRegExp toRegExp() const;
#endif
+#ifndef QT_BOOTSTRAPPED
+ QEasingCurve toEasingCurve() const;
+#endif
#ifdef QT3_SUPPORT
inline QT3_SUPPORT int &asInt();
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index b6a2df4..89edb2d 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -600,11 +600,11 @@ QEasingCurve::QEasingCurve(Type type)
Construct a copy of \a other.
*/
QEasingCurve::QEasingCurve(const QEasingCurve &other)
-: d_ptr(new QEasingCurvePrivate)
+ : d_ptr(new QEasingCurvePrivate)
{
// ### non-atomic, requires malloc on shallow copy
*d_ptr = *other.d_ptr;
- if(other.d_ptr->config)
+ if (other.d_ptr->config)
d_ptr->config = other.d_ptr->config->copy();
}
@@ -629,7 +629,7 @@ QEasingCurve &QEasingCurve::operator=(const QEasingCurve &other)
}
*d_ptr = *other.d_ptr;
- if(other.d_ptr->config)
+ if (other.d_ptr->config)
d_ptr->config = other.d_ptr->config->copy();
return *this;
@@ -845,6 +845,67 @@ QDebug operator<<(QDebug debug, const QEasingCurve &item)
}
return debug;
}
-#endif
+#endif // QT_NO_DEBUG_STREAM
+
+#ifndef QT_NO_DATASTREAM
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing)
+ \relates QEasingCurve
+
+ Writes the given \a easing curve to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator<<(QDataStream &stream, const QEasingCurve &easing)
+{
+ stream << easing.d_ptr->type;
+ stream << quint64(intptr_t(easing.d_ptr->func));
+
+ bool hasConfig = easing.d_ptr->config;
+ stream << hasConfig;
+ if (hasConfig) {
+ stream << easing.d_ptr->config->_p;
+ stream << easing.d_ptr->config->_a;
+ stream << easing.d_ptr->config->_o;
+ }
+ return stream;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing)
+ \relates QQuaternion
+
+ Reads an easing curve from the given \a stream into the given \a quaternion
+ and returns a reference to the stream.
+
+ \sa {Format of the QDataStream Operators}
+*/
+
+QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing)
+{
+ QEasingCurve::Type type;
+ int int_type;
+ stream >> int_type;
+ type = static_cast<QEasingCurve::Type>(int_type);
+ easing.setType(type);
+
+ quint64 ptr_func;
+ stream >> ptr_func;
+ easing.d_ptr->func = QEasingCurve::EasingFunction(intptr_t(ptr_func));
+
+ bool hasConfig;
+ stream >> hasConfig;
+ if (hasConfig) {
+ QEasingCurveFunction *config = curveToFunctionObject(type);
+ stream >> config->_p;
+ stream >> config->_a;
+ stream >> config->_o;
+ easing.d_ptr->config = config;
+ }
+ return stream;
+}
+#endif // QT_NO_DATASTREAM
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h
index ae8822e..173fba4 100644
--- a/src/corelib/tools/qeasingcurve.h
+++ b/src/corelib/tools/qeasingcurve.h
@@ -100,13 +100,24 @@ public:
qreal valueForProgress(qreal progress) const;
private:
QEasingCurvePrivate *d_ptr;
+#ifndef QT_NO_DEBUG_STREAM
friend Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item);
+#endif
+#ifndef QT_NO_DATASTREAM
+ friend Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve&);
+ friend Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &);
+#endif
};
#ifndef QT_NO_DEBUG_STREAM
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QEasingCurve &item);
#endif
+#ifndef QT_NO_DATASTREAM
+Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QEasingCurve&);
+Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QEasingCurve &);
+#endif
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
index bf370ae..ab87c03 100644
--- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
@@ -977,7 +977,7 @@ void QmlGraphicsGridView::setHighlight(QmlComponent *highlight)
Component {
id: myHighlight
Rectangle {
- id: wrapper; color: "lightsteelblue"; radius: 4; width: 320; height: 60 >
+ id: wrapper; color: "lightsteelblue"; radius: 4; width: 320; height: 60
y: SpringFollow { source: Wrapper.GridView.view.currentItem.y; spring: 3; damping: 0.2 }
x: SpringFollow { source: Wrapper.GridView.view.currentItem.x; spring: 3; damping: 0.2 }
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsparticles.cpp b/src/declarative/graphicsitems/qmlgraphicsparticles.cpp
index 08fce74..e23f6f0 100644
--- a/src/declarative/graphicsitems/qmlgraphicsparticles.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsparticles.cpp
@@ -188,13 +188,13 @@ void QmlGraphicsParticleMotionLinear::advance(QmlGraphicsParticle &p, int interv
*/
/*!
- \qmlproperty int ParticleMotionGravity::xattractor
- \qmlproperty int ParticleMotionGravity::yattractor
+ \qmlproperty qreal ParticleMotionGravity::xattractor
+ \qmlproperty qreal ParticleMotionGravity::yattractor
These properties hold the x and y coordinates of the point attracting the particles.
*/
/*!
- \qmlproperty int ParticleMotionGravity::acceleration
+ \qmlproperty qreal ParticleMotionGravity::acceleration
This property holds the acceleration to apply to the particles.
*/
@@ -213,6 +213,31 @@ void QmlGraphicsParticleMotionLinear::advance(QmlGraphicsParticle &p, int interv
\brief the acceleration to apply to the particles.
*/
+void QmlGraphicsParticleMotionGravity::setXAttractor(qreal x)
+{
+ if (qFuzzyCompare(x, _xAttr))
+ return;
+ _xAttr = x;
+ emit xattractorChanged();
+}
+
+void QmlGraphicsParticleMotionGravity::setYAttractor(qreal y)
+{
+ if (qFuzzyCompare(y, _yAttr))
+ return;
+ _yAttr = y;
+ emit yattractorChanged();
+}
+
+void QmlGraphicsParticleMotionGravity::setAcceleration(qreal accel)
+{
+ qreal scaledAccel = accel/1000000.0;
+ if (qFuzzyCompare(scaledAccel, _accel))
+ return;
+ _accel = scaledAccel;
+ emit accelerationChanged();
+}
+
void QmlGraphicsParticleMotionGravity::advance(QmlGraphicsParticle &p, int interval)
{
qreal xdiff = p.x - _xAttr;
@@ -276,14 +301,14 @@ Rectangle {
*/
/*!
- \qmlproperty int QmlGraphicsParticleMotionWander::xvariance
- \qmlproperty int QmlGraphicsParticleMotionWander::yvariance
+ \qmlproperty qreal QmlGraphicsParticleMotionWander::xvariance
+ \qmlproperty qreal QmlGraphicsParticleMotionWander::yvariance
These properties set the amount to wander in the x and y directions.
*/
/*!
- \qmlproperty int QmlGraphicsParticleMotionWander::pace
+ \qmlproperty qreal QmlGraphicsParticleMotionWander::pace
This property holds how quickly the paricles will move from side to side.
*/
@@ -335,6 +360,33 @@ void QmlGraphicsParticleMotionWander::destroy(QmlGraphicsParticle &p)
delete (Data*)p.data;
}
+void QmlGraphicsParticleMotionWander::setXVariance(qreal var)
+{
+ qreal scaledVar = var / 1000.0;
+ if (qFuzzyCompare(scaledVar, _xvariance))
+ return;
+ _xvariance = scaledVar;
+ emit xvarianceChanged();
+}
+
+void QmlGraphicsParticleMotionWander::setYVariance(qreal var)
+{
+ qreal scaledVar = var / 1000.0;
+ if (qFuzzyCompare(scaledVar, _yvariance))
+ return;
+ _yvariance = scaledVar;
+ emit yvarianceChanged();
+}
+
+void QmlGraphicsParticleMotionWander::setPace(qreal pace)
+{
+ qreal scaledPace = pace / 1000.0;
+ if (qFuzzyCompare(scaledPace, _pace))
+ return;
+ _pace = scaledPace;
+ emit paceChanged();
+}
+
//---------------------------------------------------------------------------
class QmlGraphicsParticlesPainter : public QmlGraphicsItem
{
@@ -1125,7 +1177,10 @@ QmlGraphicsParticleMotion *QmlGraphicsParticles::motion() const
void QmlGraphicsParticles::setMotion(QmlGraphicsParticleMotion *motion)
{
Q_D(QmlGraphicsParticles);
+ if (motion == d->motion)
+ return;
d->motion = motion;
+ emit motionChanged();
}
/*!
diff --git a/src/declarative/graphicsitems/qmlgraphicsparticles_p.h b/src/declarative/graphicsitems/qmlgraphicsparticles_p.h
index 7f0f9cd..8e66335 100644
--- a/src/declarative/graphicsitems/qmlgraphicsparticles_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicsparticles_p.h
@@ -77,27 +77,32 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsParticleMotionGravity : public QmlGraphics
{
Q_OBJECT
- Q_PROPERTY(int xattractor READ xAttractor WRITE setXAttractor)
- Q_PROPERTY(int yattractor READ yAttractor WRITE setYAttractor)
- Q_PROPERTY(int acceleration READ acceleration WRITE setAcceleration)
+ Q_PROPERTY(qreal xattractor READ xAttractor WRITE setXAttractor NOTIFY xattractorChanged)
+ Q_PROPERTY(qreal yattractor READ yAttractor WRITE setYAttractor NOTIFY yattractorChanged)
+ Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged)
public:
QmlGraphicsParticleMotionGravity(QObject *parent=0)
- : QmlGraphicsParticleMotion(parent), _xAttr(0), _yAttr(0), _accel(0.00005) {}
+ : QmlGraphicsParticleMotion(parent), _xAttr(0.0), _yAttr(0.0), _accel(0.00005) {}
- int xAttractor() const { return _xAttr; }
- void setXAttractor(int x) { _xAttr = x; }
+ qreal xAttractor() const { return _xAttr; }
+ void setXAttractor(qreal x);
- int yAttractor() const { return _yAttr; }
- void setYAttractor(int y) { _yAttr = y; }
+ qreal yAttractor() const { return _yAttr; }
+ void setYAttractor(qreal y);
- int acceleration() const { return int(_accel * 1000000); }
- void setAcceleration(int accel) { _accel = qreal(accel)/1000000.0; }
+ qreal acceleration() const { return _accel * 1000000; }
+ void setAcceleration(qreal accel);
virtual void advance(QmlGraphicsParticle &, int interval);
+Q_SIGNALS:
+ void xattractorChanged();
+ void yattractorChanged();
+ void accelerationChanged();
+
private:
- int _xAttr;
- int _yAttr;
+ qreal _xAttr;
+ qreal _yAttr;
qreal _accel;
};
@@ -121,18 +126,23 @@ public:
qreal y_var;
};
- Q_PROPERTY(int xvariance READ xVariance WRITE setXVariance)
- int xVariance() const { return int(_xvariance * 1000); }
- void setXVariance(int var) { _xvariance = var / 1000.0; }
+ Q_PROPERTY(qreal xvariance READ xVariance WRITE setXVariance NOTIFY xvarianceChanged)
+ qreal xVariance() const { return _xvariance * 1000.0; }
+ void setXVariance(qreal var);
- Q_PROPERTY(int yvariance READ yVariance WRITE setYVariance)
- int yVariance() const { return int(_yvariance * 1000); }
- void setYVariance(int var) { _yvariance = var / 1000.0; }
+ Q_PROPERTY(qreal yvariance READ yVariance WRITE setYVariance NOTIFY yvarianceChanged)
+ qreal yVariance() const { return _yvariance * 1000.0; }
+ void setYVariance(qreal var);
- Q_PROPERTY(int pace READ pace WRITE setPace)
- int pace() const { return int(_pace * 1000); }
- void setPace(int pace) { _pace = pace / 1000.0; }
+ Q_PROPERTY(qreal pace READ pace WRITE setPace NOTIFY paceChanged)
+ qreal pace() const { return _pace * 1000.0; }
+ void setPace(qreal pace);
+Q_SIGNALS:
+ void xvarianceChanged();
+ void yvarianceChanged();
+ void paceChanged();
+
private:
QmlGraphicsParticles *particles;
qreal _xvariance;
@@ -157,7 +167,7 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsParticles : public QmlGraphicsItem
Q_PROPERTY(qreal angleDeviation READ angleDeviation WRITE setAngleDeviation NOTIFY angleDeviationChanged)
Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity NOTIFY velocityChanged)
Q_PROPERTY(qreal velocityDeviation READ velocityDeviation WRITE setVelocityDeviation NOTIFY velocityDeviationChanged)
- Q_PROPERTY(QmlGraphicsParticleMotion *motion READ motion WRITE setMotion)
+ Q_PROPERTY(QmlGraphicsParticleMotion *motion READ motion WRITE setMotion NOTIFY motionChanged)
Q_CLASSINFO("DefaultProperty", "motion")
public:
@@ -225,6 +235,7 @@ Q_SIGNALS:
void velocityChanged();
void velocityDeviationChanged();
void emittingChanged();
+ void motionChanged();
private Q_SLOTS:
void imageLoaded();
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
index 8adf239..805c912 100644
--- a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
@@ -138,7 +138,10 @@ QmlTransition *QmlGraphicsBasePositioner::move() const
void QmlGraphicsBasePositioner::setMove(QmlTransition *mt)
{
Q_D(QmlGraphicsBasePositioner);
+ if (mt == d->moveTransition)
+ return;
d->moveTransition = mt;
+ emit moveChanged();
}
QmlTransition *QmlGraphicsBasePositioner::add() const
@@ -150,7 +153,11 @@ QmlTransition *QmlGraphicsBasePositioner::add() const
void QmlGraphicsBasePositioner::setAdd(QmlTransition *add)
{
Q_D(QmlGraphicsBasePositioner);
+ if (add == d->addTransition)
+ return;
+
d->addTransition = add;
+ emit addChanged();
}
void QmlGraphicsBasePositioner::componentComplete()
@@ -362,7 +369,7 @@ Column {
move: Transition {
NumberAnimation {
properties: "y"
- ease: "easeOutBounce"
+ easing: "easeOutBounce"
}
}
}
@@ -647,6 +654,24 @@ QmlGraphicsGrid::QmlGraphicsGrid(QmlGraphicsItem *parent) :
many rows some rows will be of zero width.
*/
+void QmlGraphicsGrid::setColumns(const int columns)
+{
+ if (columns == _columns)
+ return;
+ _columns = columns;
+ prePositioning();
+ emit columnsChanged();
+}
+
+void QmlGraphicsGrid::setRows(const int rows)
+{
+ if (rows == _rows)
+ return;
+ _rows = rows;
+ prePositioning();
+ emit rowsChanged();
+}
+
void QmlGraphicsGrid::doPositioning()
{
int c=_columns,r=_rows;//Actual number of rows/columns
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners_p.h b/src/declarative/graphicsitems/qmlgraphicspositioners_p.h
index 1fb687a..2f905e5 100644
--- a/src/declarative/graphicsitems/qmlgraphicspositioners_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicspositioners_p.h
@@ -62,8 +62,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsBasePositioner : public QmlGraphicsItem
Q_OBJECT
Q_PROPERTY(int spacing READ spacing WRITE setSpacing NOTIFY spacingChanged)
- Q_PROPERTY(QmlTransition *move READ move WRITE setMove)
- Q_PROPERTY(QmlTransition *add READ add WRITE setAdd)
+ Q_PROPERTY(QmlTransition *move READ move WRITE setMove NOTIFY moveChanged)
+ Q_PROPERTY(QmlTransition *add READ add WRITE setAdd NOTIFY addChanged)
public:
enum PositionerType { None = 0x0, Horizontal = 0x1, Vertical = 0x2, Both = 0x3 };
QmlGraphicsBasePositioner(PositionerType, QmlGraphicsItem *parent);
@@ -86,6 +86,8 @@ protected:
Q_SIGNALS:
void spacingChanged();
+ void moveChanged();
+ void addChanged();
protected Q_SLOTS:
virtual void doPositioning()=0;
@@ -134,16 +136,21 @@ private:
class Q_DECLARATIVE_EXPORT QmlGraphicsGrid : public QmlGraphicsBasePositioner
{
Q_OBJECT
- Q_PROPERTY(int rows READ rows WRITE setRows)
- Q_PROPERTY(int columns READ columns WRITE setcolumns)
+ Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowChanged)
+ Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged)
public:
QmlGraphicsGrid(QmlGraphicsItem *parent=0);
int rows() const {return _rows;}
- void setRows(const int rows){_rows = rows;}
+ void setRows(const int rows);
int columns() const {return _columns;}
- void setcolumns(const int columns){_columns = columns;}
+ void setColumns(const int columns);
+
+Q_SIGNALS:
+ void rowsChanged();
+ void columnsChanged();
+
protected Q_SLOTS:
virtual void doPositioning();
diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
index 9c11f25..bf3df03 100644
--- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp
@@ -801,11 +801,10 @@ void QmlGraphicsVisualDataModel::setDelegate(QmlComponent *delegate)
QApplication app(argc, argv);
QmlView view;
- view.setSource(QUrl("qrc:view.qml"));
MyModel model(view.rootContext());
- view.execute();
+ view.setSource(QUrl("qrc:view.qml"));
view.show();
return app.exec();
diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp
index 0c21f75..f9bbb22 100644
--- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp
@@ -483,6 +483,8 @@ void QmlGraphicsWebView::setRenderingEnabled(bool enabled)
if (d->rendering == enabled)
return;
d->rendering = enabled;
+ emit renderingEnabledChanged();
+
setCacheFrozen(!enabled);
if (enabled)
clearCache();
@@ -596,7 +598,10 @@ int QmlGraphicsWebView::pressGrabTime() const
void QmlGraphicsWebView::setPressGrabTime(int ms)
{
Q_D(QmlGraphicsWebView);
+ if (d->pressTime == ms)
+ return;
d->pressTime = ms;
+ emit pressGrabTimeChanged();
}
void QmlGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent *event)
@@ -1024,6 +1029,7 @@ void QmlGraphicsWebView::setHtml(const QString &html, const QUrl &baseUrl)
d->pending_url = baseUrl;
d->pending_string = html;
}
+ emit htmlChanged();
}
void QmlGraphicsWebView::setContent(const QByteArray &data, const QString &mimeType, const QUrl &baseUrl)
@@ -1116,8 +1122,10 @@ QmlComponent *QmlGraphicsWebView::newWindowComponent() const
void QmlGraphicsWebView::setNewWindowComponent(QmlComponent *newWindow)
{
Q_D(QmlGraphicsWebView);
- delete d->newWindowComponent;
+ if (newWindow == d->newWindowComponent)
+ return;
d->newWindowComponent = newWindow;
+ emit newWindowComponentChanged();
}
@@ -1137,8 +1145,16 @@ QmlGraphicsItem *QmlGraphicsWebView::newWindowParent() const
void QmlGraphicsWebView::setNewWindowParent(QmlGraphicsItem *parent)
{
Q_D(QmlGraphicsWebView);
- delete d->newWindowParent;
+ if (parent == d->newWindowParent)
+ return;
+ if (d->newWindowParent && parent) {
+ QList<QGraphicsItem *> children = d->newWindowParent->childItems();
+ for (int i = 0; i < children.count(); ++i) {
+ children.at(i)->setParentItem(parent);
+ }
+ }
d->newWindowParent = parent;
+ emit newWindowParentChanged();
}
/*!
diff --git a/src/declarative/graphicsitems/qmlgraphicswebview_p.h b/src/declarative/graphicsitems/qmlgraphicswebview_p.h
index 30ba0e4..ca63be9 100644
--- a/src/declarative/graphicsitems/qmlgraphicswebview_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicswebview_p.h
@@ -97,9 +97,9 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsWebView : public QmlGraphicsPaintedItem
Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged)
Q_PROPERTY(QString statusText READ statusText NOTIFY statusTextChanged)
- Q_PROPERTY(QString html READ html WRITE setHtml)
+ Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged)
- Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime)
+ Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime NOTIFY pressGrabTimeChanged)
Q_PROPERTY(int preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged)
Q_PROPERTY(int preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged)
@@ -116,10 +116,10 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsWebView : public QmlGraphicsPaintedItem
Q_PROPERTY(QmlListProperty<QObject> javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT)
- Q_PROPERTY(QmlComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent)
- Q_PROPERTY(QmlGraphicsItem* newWindowParent READ newWindowParent WRITE setNewWindowParent)
+ Q_PROPERTY(QmlComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent NOTIFY newWindowComponentChanged)
+ Q_PROPERTY(QmlGraphicsItem* newWindowParent READ newWindowParent WRITE setNewWindowParent NOTIFY newWindowParentChanged)
- Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled)
+ Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged)
public:
QmlGraphicsWebView(QmlGraphicsItem *parent=0);
@@ -192,7 +192,12 @@ Q_SIGNALS:
void titleChanged(const QString&);
void iconChanged();
void statusTextChanged();
+ void htmlChanged();
+ void pressGrabTimeChanged();
void zoomFactorChanged();
+ void newWindowComponentChanged();
+ void newWindowParentChanged();
+ void renderingEnabledChanged();
void loadStarted();
void loadFinished();
diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri
index f09a944..1e4e234 100644
--- a/src/declarative/qml/qml.pri
+++ b/src/declarative/qml/qml.pri
@@ -7,7 +7,6 @@ SOURCES += \
$$PWD/qmlexpression.cpp \
$$PWD/qmlbinding.cpp \
$$PWD/qmlmetaproperty.cpp \
- $$PWD/qmlmoduleplugin.cpp \
$$PWD/qmlcomponent.cpp \
$$PWD/qmlcontext.cpp \
$$PWD/qmlcustomparser.cpp \
@@ -52,6 +51,8 @@ SOURCES += \
$$PWD/qmlworkerscript.cpp \
$$PWD/qmlimageprovider.cpp \
$$PWD/qmlnetworkaccessmanagerfactory.cpp \
+ $$PWD/qmldirparser.cpp \
+ $$PWD/qmlextensionplugin.cpp \
$$PWD/qmllist.cpp
HEADERS += \
@@ -63,7 +64,6 @@ HEADERS += \
$$PWD/qmlbinding_p.h \
$$PWD/qmlbinding_p_p.h \
$$PWD/qmlmetaproperty.h \
- $$PWD/qmlmoduleplugin.h \
$$PWD/qmlcomponent.h \
$$PWD/qmlcomponent_p.h \
$$PWD/qmlcustomparser_p.h \
@@ -122,7 +122,11 @@ HEADERS += \
$$PWD/qmlscriptclass_p.h \
$$PWD/qmlguard_p.h \
$$PWD/qmlimageprovider.h \
- $$PWD/qmlnetworkaccessmanagerfactory.h
+ $$PWD/qmlnetworkaccessmanagerfactory.h \
+ $$PWD/qmldirparser_p.h \
+ $$PWD/qmlextensioninterface.h \
+ $$PWD/qmlextensionplugin.h
+
QT += sql
include(parser/parser.pri)
include(rewriter/rewriter.pri)
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index 10b6e4f..4365b17 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -1132,10 +1132,10 @@ bool QmlCompiler::buildComponent(QmlParser::Object *obj,
Property *idProp = 0;
if (obj->properties.count() > 1 ||
(obj->properties.count() == 1 && obj->properties.begin().key() != "id"))
- COMPILE_EXCEPTION(*obj->properties.begin(), QCoreApplication::translate("QmlCompiler","Invalid component specification"));
+ COMPILE_EXCEPTION(*obj->properties.begin(), QCoreApplication::translate("QmlCompiler","Component elements may not contain properties other than id"));
if (!obj->scriptBlockObjects.isEmpty())
- COMPILE_EXCEPTION(obj->scriptBlockObjects.first(), QCoreApplication::translate("QmlCompiler","Invalid component specification"));
+ COMPILE_EXCEPTION(obj->scriptBlockObjects.first(), QCoreApplication::translate("QmlCompiler","Component elements may not contain script blocks"));
if (obj->properties.count())
idProp = *obj->properties.begin();
@@ -2609,7 +2609,13 @@ int QmlCompiler::genContextCache()
int QmlCompiler::genValueTypeData(QmlParser::Property *valueTypeProp,
QmlParser::Property *prop)
{
- return output->indexForByteArray(QmlMetaPropertyPrivate::saveValueType(prop->parent->metaObject(), prop->index, valueTypeProp->index, valueTypeProp->type));
+ QByteArray data =
+ QmlMetaPropertyPrivate::saveValueType(prop->parent->metaObject(), prop->index,
+ QmlEnginePrivate::get(engine)->valueTypes[prop->type]->metaObject(),
+ valueTypeProp->index);
+// valueTypeProp->index, valueTypeProp->type);
+
+ return output->indexForByteArray(data);
}
int QmlCompiler::genPropertyData(QmlParser::Property *prop)
diff --git a/src/declarative/qml/qmldirparser.cpp b/src/declarative/qml/qmldirparser.cpp
new file mode 100644
index 0000000..60beb72
--- /dev/null
+++ b/src/declarative/qml/qmldirparser.cpp
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** 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 "qmldirparser_p.h"
+#include "qmlerror.h"
+
+#include <QtCore/QTextStream>
+#include <QtCore/QtDebug>
+
+QT_BEGIN_NAMESPACE
+
+QmlDirParser::QmlDirParser()
+ : _isParsed(false)
+{
+}
+
+QmlDirParser::~QmlDirParser()
+{
+}
+
+QUrl QmlDirParser::url() const
+{
+ return _url;
+}
+
+void QmlDirParser::setUrl(const QUrl &url)
+{
+ _url = url;
+}
+
+QString QmlDirParser::source() const
+{
+ return _source;
+}
+
+void QmlDirParser::setSource(const QString &source)
+{
+ _isParsed = false;
+ _source = source;
+}
+
+bool QmlDirParser::isParsed() const
+{
+ return _isParsed;
+}
+
+bool QmlDirParser::parse()
+{
+ if (_isParsed)
+ return true;
+
+ _isParsed = true;
+ _errors.clear();
+ _plugins.clear();
+ _components.clear();
+
+ QTextStream stream(&_source);
+ int lineNumber = 0;
+
+ forever {
+ ++lineNumber;
+
+ const QString line = stream.readLine();
+ if (line.isNull())
+ break;
+
+ QString sections[3];
+ int sectionCount = 0;
+
+ int index = 0;
+ const int length = line.length();
+
+ while (index != length) {
+ const QChar ch = line.at(index);
+
+ if (ch.isSpace()) {
+ do { ++index; }
+ while (index != length && line.at(index).isSpace());
+
+ } else if (ch == QLatin1Char('#')) {
+ // recognized a comment
+ break;
+
+ } else {
+ const int start = index;
+
+ do { ++index; }
+ while (index != length && !line.at(index).isSpace());
+
+ const QString lexeme = line.mid(start, index - start);
+
+ if (sectionCount >= 3) {
+ reportError(lineNumber, start, QLatin1String("unexpected token"));
+
+ } else {
+ sections[sectionCount++] = lexeme;
+ }
+ }
+ }
+
+ if (sectionCount == 0) {
+ continue; // no sections, no party.
+
+ } else if (sections[0] == QLatin1String("plugin")) {
+ if (sectionCount < 2) {
+ reportError(lineNumber, -1,
+ QString::fromUtf8("plugin directive requires 2 arguments, but %1 were provided").arg(sectionCount + 1));
+
+ continue;
+ }
+
+ const Plugin entry(sections[1], sections[2]);
+
+ _plugins.append(entry);
+
+ } else if (sectionCount == 3) {
+ const QString &version = sections[1];
+ const int dotIndex = version.indexOf(QLatin1Char('.'));
+
+ if (dotIndex == -1) {
+ qWarning() << "expected '.'"; // ### use reportError
+
+ } else if (version.indexOf(QLatin1Char('.'), dotIndex + 1) != -1) {
+ qWarning() << "unexpected '.'"; // ### use reportError
+
+ } else {
+ bool validVersionNumber = false;
+ const int majorVersion = version.left(dotIndex).toInt(&validVersionNumber);
+
+ if (validVersionNumber) {
+ const int minorVersion = version.mid(dotIndex + 1).toInt(&validVersionNumber);
+
+ if (validVersionNumber) {
+ const Component entry(sections[0], sections[2], majorVersion, minorVersion);
+
+ _components.append(entry);
+ }
+ }
+ }
+ } else {
+ // ### use reportError
+ qWarning() << "a component declaration requires 3 arguments, but" << (sectionCount + 1) << "were provided";
+ }
+ }
+
+ return hasError();
+}
+
+void QmlDirParser::reportError(int line, int column, const QString &description)
+{
+ QmlError error;
+ error.setUrl(_url);
+ error.setLine(line);
+ error.setColumn(column);
+ error.setDescription(description);
+ _errors.append(error);
+}
+
+bool QmlDirParser::hasError() const
+{
+ if (! _errors.isEmpty())
+ return true;
+
+ return false;
+}
+
+QList<QmlError> QmlDirParser::errors() const
+{
+ return _errors;
+}
+
+QList<QmlDirParser::Plugin> QmlDirParser::plugins() const
+{
+ return _plugins;
+}
+
+QList<QmlDirParser::Component> QmlDirParser::components() const
+{
+ return _components;
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmldirparser_p.h b/src/declarative/qml/qmldirparser_p.h
new file mode 100644
index 0000000..c58c03f
--- /dev/null
+++ b/src/declarative/qml/qmldirparser_p.h
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** 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 QMLDIRPARSER_P_H
+#define QMLDIRPARSER_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 <QtCore/QUrl>
+#include <QtCore/QHash>
+
+QT_BEGIN_NAMESPACE
+
+class QmlError;
+
+class QmlDirParser
+{
+ Q_DISABLE_COPY(QmlDirParser)
+
+public:
+ QmlDirParser();
+ ~QmlDirParser();
+
+ QUrl url() const;
+ void setUrl(const QUrl &url);
+
+ QString source() const;
+ void setSource(const QString &source);
+
+ bool isParsed() const;
+ bool parse();
+
+ bool hasError() const;
+ QList<QmlError> errors() const;
+
+ struct Plugin
+ {
+ Plugin() {}
+
+ Plugin(const QString &name, const QString &path)
+ : name(name), path(path) {}
+
+ QString name;
+ QString path;
+ };
+
+ struct Component
+ {
+ Component()
+ : majorVersion(0), minorVersion(0) {}
+
+ Component(const QString &typeName, const QString &fileName, int majorVersion, int minorVersion)
+ : typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion) {}
+
+ QString typeName;
+ QString fileName;
+ int majorVersion;
+ int minorVersion;
+ };
+
+ QList<Component> components() const;
+ QList<Plugin> plugins() const;
+
+private:
+ void reportError(int line, int column, const QString &message);
+
+private:
+ QList<QmlError> _errors;
+ QUrl _url;
+ QString _source;
+ QList<Component> _components;
+ QList<Plugin> _plugins;
+ unsigned _isParsed: 1;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMLDIRPARSER_P_H
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 2460f52..c7e1e16 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -50,7 +50,6 @@
#include "qmlexpression.h"
#include "qmlcomponent.h"
#include "qmlmetaproperty_p.h"
-#include "qmlmoduleplugin.h"
#include "qmlbinding_p_p.h"
#include "qmlvme_p.h"
#include "qmlenginedebug_p.h"
@@ -66,6 +65,8 @@
#include "qmlscriptclass_p.h"
#include "qmlnetworkaccessmanagerfactory.h"
#include "qmlimageprovider.h"
+#include "qmldirparser_p.h"
+#include "qmlextensioninterface.h"
#include "qmllist_p.h"
#include <qfxperf_p_p.h>
@@ -82,6 +83,7 @@
#include <QDebug>
#include <QMetaObject>
#include <QStack>
+#include <QPluginLoader>
#include <QtCore/qlibraryinfo.h>
#include <QtCore/qthreadstorage.h>
#include <QtCore/qthread.h>
@@ -94,7 +96,6 @@
#include <QGraphicsObject>
#include <QtCore/qcryptographichash.h>
-#include <private/qfactoryloader_p.h>
#include <private/qobject_p.h>
#include <private/qscriptdeclarativeclass_p.h>
@@ -156,6 +157,21 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
}
globalClass = new QmlGlobalScriptClass(&scriptEngine);
fileImportPath.append(QLibraryInfo::location(QLibraryInfo::DataPath)+QDir::separator()+QLatin1String("qml"));
+
+ // env import paths
+ QByteArray envImportPath = qgetenv("QML_IMPORT_PATH");
+ if (!envImportPath.isEmpty()) {
+#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+ QLatin1Char pathSep(';');
+#else
+ QLatin1Char pathSep(':');
+#endif
+ foreach (const QString &path, QString::fromLatin1(envImportPath).split(pathSep, QString::SkipEmptyParts)) {
+ QString canonicalPath = QDir(path).canonicalPath();
+ if (!canonicalPath.isEmpty() && !environmentImportPath.contains(canonicalPath))
+ environmentImportPath.append(canonicalPath);
+ }
+ }
}
QUrl QmlScriptEngine::resolvedUrl(QScriptContext *context, const QUrl& url)
@@ -1235,7 +1251,6 @@ struct QmlEnginePrivate::ImportedNamespace {
QList<int> majversions;
QList<int> minversions;
QList<bool> isLibrary;
- QList<bool> isBuiltin; // Types provided by C++ code (including plugins)
QList<QString> qmlDirContent;
bool find(const QByteArray& type, int *vmajor, int *vminor, QmlType** type_return, QUrl* url_return) const
@@ -1244,23 +1259,23 @@ struct QmlEnginePrivate::ImportedNamespace {
int vmaj = majversions.at(i);
int vmin = minversions.at(i);
- if (isBuiltin.at(i)) {
- QByteArray qt = uris.at(i).toUtf8();
- qt += '/';
- qt += type;
- if (qmlImportTrace())
- qDebug() << "Look in" << qt;
- QmlType *t = QmlMetaType::qmlType(qt,vmaj,vmin);
+ QByteArray qt = uris.at(i).toUtf8();
+ qt += '/';
+ qt += type;
+
+ if (qmlImportTrace())
+ qDebug() << "Look in" << qt;
+ QmlType *t = QmlMetaType::qmlType(qt,vmaj,vmin);
+ if (t) {
if (vmajor) *vmajor = vmaj;
if (vminor) *vminor = vmin;
- if (t) {
- if (qmlImportTrace())
- qDebug() << "Found" << qt;
- if (type_return)
- *type_return = t;
- return true;
- }
+ if (qmlImportTrace())
+ qDebug() << "Found" << qt;
+ if (type_return)
+ *type_return = t;
+ return true;
}
+
QUrl url = QUrl(urls.at(i) + QLatin1Char('/') + QString::fromUtf8(type) + QLatin1String(".qml"));
QString qmldircontent = qmlDirContent.at(i);
if (vmaj>=0 || !qmldircontent.isEmpty()) {
@@ -1271,27 +1286,25 @@ struct QmlEnginePrivate::ImportedNamespace {
qmldircontent = QString::fromUtf8(qmldir.readAll());
}
}
- QString typespace = QString::fromUtf8(type)+QLatin1Char(' ');
- QStringList lines = qmldircontent.split(QLatin1Char('\n'));
- foreach (QString line, lines) {
- if (line.isEmpty() || line.at(0) == QLatin1Char('#'))
- continue;
- if (line.startsWith(typespace)) {
- int space1 = line.indexOf(QLatin1Char(' '));
- int space2 = space1 >=0 ? line.indexOf(QLatin1Char(' '),space1+1) : -1;
- QString mapversions = line.mid(space1+1,space2<0?line.length()-space1-1:space2-space1-1);
- int dot = mapversions.indexOf(QLatin1Char('.'));
- int mapvmaj = mapversions.left(dot).toInt();
- if (mapvmaj<=vmaj) {
- if (mapvmaj<vmaj || vmin >= mapversions.mid(dot+1).toInt()) {
- QStringRef mapfile = space2<0 ? QStringRef() : line.midRef(space2+1,line.length()-space2-1);
- if (url_return)
- *url_return = url.resolved(QUrl(mapfile.toString()));
- return true;
- }
+
+ const QString typeName = QString::fromUtf8(type);
+
+ QmlDirParser qmldirParser;
+ qmldirParser.setUrl(url);
+ qmldirParser.setSource(qmldircontent);
+ qmldirParser.parse();
+
+ foreach (const QmlDirParser::Component &c, qmldirParser.components()) { // ### TODO: cache the components
+ if (c.majorVersion < vmaj || (c.majorVersion == vmaj && vmin >= c.minorVersion)) {
+ if (c.typeName == typeName) {
+ if (url_return)
+ *url_return = url.resolved(QUrl(c.fileName));
+
+ return true;
}
}
}
+
} else {
// XXX search non-files too! (eg. zip files, see QT-524)
QFileInfo f(toLocalFileOrQrc(url));
@@ -1306,9 +1319,6 @@ struct QmlEnginePrivate::ImportedNamespace {
}
};
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
- (QmlModuleFactoryInterface_iid, QLatin1String("/qmlmodules")))
-
class QmlImportsPrivate {
public:
QmlImportsPrivate() : ref(1)
@@ -1321,7 +1331,9 @@ public:
delete s;
}
- bool add(const QUrl& base, const QString& qmldircontent, const QString& uri, const QString& prefix, int vmaj, int vmin, QmlScriptParser::Import::Type importType, const QStringList& importPath)
+ QSet<QString> qmlDirFilesForWhichPluginsHaveBeenLoaded;
+
+ bool add(const QUrl& base, const QString& qmldircontent, const QString& uri, const QString& prefix, int vmaj, int vmin, QmlScriptParser::Import::Type importType, const QStringList& importPath, QmlEngine *engine)
{
QmlEnginePrivate::ImportedNamespace *s;
if (prefix.isEmpty()) {
@@ -1332,39 +1344,63 @@ public:
set.insert(prefix,(s=new QmlEnginePrivate::ImportedNamespace));
}
QString url = uri;
- bool isbuiltin = false;
if (importType == QmlScriptParser::Import::Library) {
- url.replace(QLatin1Char('.'),QLatin1Char('/'));
+ url.replace(QLatin1Char('.'), QLatin1Char('/'));
bool found = false;
- foreach (QString p, importPath) {
- QString dir = p+QLatin1Char('/')+url;
+ QString content;
+ QString dir;
+
+ // user import paths
+ QStringList paths;
+
+ // base..
+ paths += QFileInfo(base.toLocalFile()).path();
+ paths += importPath;
+ paths += QmlEnginePrivate::get(engine)->environmentImportPath;
+
+ foreach (const QString &p, paths) {
+ dir = p+QLatin1Char('/')+url;
QFileInfo fi(dir+QLatin1String("/qmldir"));
+ const QString absoluteFilePath = fi.absoluteFilePath();
+
if (fi.isFile()) {
- url = QUrl::fromLocalFile(fi.absolutePath()).toString();
found = true;
+
+ url = QUrl::fromLocalFile(fi.absolutePath()).toString();
+
+ QFile file(absoluteFilePath);
+ if (file.open(QFile::ReadOnly))
+ content = QString::fromUtf8(file.readAll());
+
+ if (! qmlDirFilesForWhichPluginsHaveBeenLoaded.contains(absoluteFilePath)) {
+ qmlDirFilesForWhichPluginsHaveBeenLoaded.insert(absoluteFilePath);
+
+ QmlDirParser qmldirParser;
+ qmldirParser.setSource(content);
+ qmldirParser.parse();
+
+ foreach (const QmlDirParser::Plugin &plugin, qmldirParser.plugins()) {
+ QString resolvedFilePath = QmlEnginePrivate::get(engine)->resolvePlugin(dir + QDir::separator() + plugin.path,
+ plugin.name);
+
+ if (!resolvedFilePath.isEmpty())
+ engine->importExtension(resolvedFilePath, uri);
+ }
+ }
+
break;
}
}
- if (!found) {
- // XXX assume it is a built-in type qualifier
- isbuiltin = true;
- }
- QFactoryLoader *l = loader();
- QmlModuleFactoryInterface *factory =
- qobject_cast<QmlModuleFactoryInterface*>(l->instance(uri));
- if (factory) {
- factory->defineModuleOnce(uri);
- isbuiltin = true;
- }
+
} else {
url = base.resolved(QUrl(url)).toString();
}
+
s->uris.prepend(uri);
s->urls.prepend(url);
s->majversions.prepend(vmaj);
s->minversions.prepend(vmin);
s->isLibrary.prepend(importType == QmlScriptParser::Import::Library);
- s->isBuiltin.prepend(isbuiltin);
s->qmlDirContent.prepend(qmldircontent);
return true;
}
@@ -1387,10 +1423,11 @@ public:
if (s) {
if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return))
return true;
- if (s->urls.count() == 1 && !s->isBuiltin[0] && !s->isLibrary[0] && url_return) {
+ if (s->urls.count() == 1 && !s->isLibrary[0] && url_return) {
*url_return = QUrl(s->urls[0]+QLatin1Char('/')).resolved(QUrl(QString::fromUtf8(unqualifiedtype) + QLatin1String(".qml")));
return true;
}
+
}
if (url_return) {
*url_return = base.resolved(QUrl(QString::fromUtf8(type + ".qml")));
@@ -1451,9 +1488,6 @@ static QmlTypeNameCache *cacheForNamespace(QmlEngine *engine, const QmlEnginePri
QList<QmlType *> types = QmlMetaType::qmlTypes();
for (int ii = 0; ii < set.uris.count(); ++ii) {
- if (!set.isBuiltin.at(ii))
- continue;
-
QByteArray base = set.uris.at(ii).toUtf8() + '/';
int major = set.majversions.at(ii);
int minor = set.minversions.at(ii);
@@ -1552,6 +1586,24 @@ void QmlEngine::addImportPath(const QString& path)
}
/*!
+ Imports the given \a extension into this QmlEngine. Returns
+ true if the extension was successfully imported.
+
+ \sa QmlExtensionInterface
+*/
+bool QmlEngine::importExtension(const QString &fileName, const QString &uri)
+{
+ QPluginLoader loader(fileName);
+
+ if (QmlExtensionInterface *iface = qobject_cast<QmlExtensionInterface *>(loader.instance())) {
+ iface->initialize(this, uri.toUtf8().constData());
+ return true;
+ }
+
+ return false;
+}
+
+/*!
\property QmlEngine::offlineStoragePath
\brief the directory for storing offline user data
@@ -1580,6 +1632,87 @@ QString QmlEngine::offlineStoragePath() const
return d->scriptEngine.offlineStoragePath;
}
+/*!
+ \internal
+
+ Returns the result of the merge of \a baseName with \a dir, \a suffixes, and \a prefix.
+ */
+QString QmlEnginePrivate::resolvePlugin(const QDir &dir, const QString &baseName,
+ const QStringList &suffixes,
+ const QString &prefix)
+{
+ foreach (const QString &suffix, suffixes) {
+ QString pluginFileName = prefix;
+
+ pluginFileName += baseName;
+ pluginFileName += QLatin1Char('.');
+ pluginFileName += suffix;
+
+ QFileInfo fileInfo(dir, pluginFileName);
+
+ if (fileInfo.exists())
+ return fileInfo.absoluteFilePath();
+ }
+
+ return QString();
+}
+
+/*!
+ \internal
+
+ Returns the result of the merge of \a baseName with \a dir and the platform suffix.
+
+ \table
+ \header \i Platform \i Valid suffixes
+ \row \i Windows \i \c .dll
+ \row \i Unix/Linux \i \c .so
+ \row \i AIX \i \c .a
+ \row \i HP-UX \i \c .sl, \c .so (HP-UXi)
+ \row \i Mac OS X \i \c .dylib, \c .bundle, \c .so
+ \row \i Symbian \i \c .dll
+ \endtable
+
+ Version number on unix are ignored.
+*/
+QString QmlEnginePrivate::resolvePlugin(const QDir &dir, const QString &baseName)
+{
+#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
+ return resolvePlugin(dir, baseName, QStringList(QLatin1String("dll")));
+#elif defined(Q_OS_SYMBIAN)
+ return resolvePlugin(dir, baseName, QStringList() << QLatin1String("dll") << QLatin1String("qtplugin"));
+#else
+
+# if defined(Q_OS_DARWIN)
+
+ return resolvePlugin(dir, baseName, QStringList() << QLatin1String("dylib") << QLatin1String("so") << QLatin1String("bundle"),
+ QLatin1String("lib"));
+# else // Generic Unix
+ QStringList validSuffixList;
+
+# if defined(Q_OS_HPUX)
+/*
+ See "HP-UX Linker and Libraries User's Guide", section "Link-time Differences between PA-RISC and IPF":
+ "In PA-RISC (PA-32 and PA-64) shared libraries are suffixed with .sl. In IPF (32-bit and 64-bit),
+ the shared libraries are suffixed with .so. For compatibility, the IPF linker also supports the .sl suffix."
+ */
+ validSuffixList << QLatin1String("sl");
+# if defined __ia64
+ validSuffixList << QLatin1String("so");
+# endif
+# elif defined(Q_OS_AIX)
+ validSuffixList << QLatin1String("a") << QLatin1String("so");
+# elif defined(Q_OS_UNIX)
+ validSuffixList << QLatin1String("so");
+# endif
+
+ // Examples of valid library names:
+ // libfoo.so
+
+ return resolvePlugin(dir, baseName, validSuffixList, QLatin1String("lib"));
+# endif
+
+#endif
+}
/*!
\internal
@@ -1597,7 +1730,8 @@ QString QmlEngine::offlineStoragePath() const
*/
bool QmlEnginePrivate::addToImport(Imports* imports, const QString& qmldircontent, const QString& uri, const QString& prefix, int vmaj, int vmin, QmlScriptParser::Import::Type importType) const
{
- bool ok = imports->d->add(imports->d->base,qmldircontent,uri,prefix,vmaj,vmin,importType,fileImportPath);
+ QmlEngine *engine = QmlEnginePrivate::get(const_cast<QmlEnginePrivate *>(this));
+ bool ok = imports->d->add(imports->d->base,qmldircontent,uri,prefix,vmaj,vmin,importType,fileImportPath, engine);
if (qmlImportTrace())
qDebug() << "QmlEngine::addToImport(" << imports << uri << prefix << vmaj << '.' << vmin << (importType==QmlScriptParser::Import::Library? "Library" : "File") << ": " << ok;
return ok;
diff --git a/src/declarative/qml/qmlengine.h b/src/declarative/qml/qmlengine.h
index 64d0b9d..dd2012a 100644
--- a/src/declarative/qml/qmlengine.h
+++ b/src/declarative/qml/qmlengine.h
@@ -78,6 +78,7 @@ public:
void clearComponentCache();
void addImportPath(const QString& dir);
+ bool importExtension(const QString &fileName, const QString &uri);
void setNetworkAccessManagerFactory(QmlNetworkAccessManagerFactory *);
QmlNetworkAccessManagerFactory *networkAccessManagerFactory() const;
diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h
index 3fe7991..85c5fbe 100644
--- a/src/declarative/qml/qmlengine_p.h
+++ b/src/declarative/qml/qmlengine_p.h
@@ -104,6 +104,7 @@ class QmlCleanup;
class QmlDelayedError;
class QmlWorkerScriptEngine;
class QmlGlobalScriptClass;
+class QDir;
class QmlScriptEngine : public QScriptEngine
{
@@ -263,6 +264,15 @@ public:
QmlImportsPrivate *d;
};
+
+ QStringList environmentImportPath;
+
+ QString resolvePlugin(const QDir &dir, const QString &baseName,
+ const QStringList &suffixes,
+ const QString &prefix = QString());
+ QString resolvePlugin(const QDir &dir, const QString &baseName);
+
+
bool addToImport(Imports*, const QString& qmlDirContent,const QString& uri, const QString& prefix, int vmaj, int vmin, QmlScriptParser::Import::Type importType) const;
bool resolveType(const Imports&, const QByteArray& type,
QmlType** type_return, QUrl* url_return,
diff --git a/src/declarative/qml/qmlextensioninterface.h b/src/declarative/qml/qmlextensioninterface.h
new file mode 100644
index 0000000..644ef1e
--- /dev/null
+++ b/src/declarative/qml/qmlextensioninterface.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** 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 QMLEXTENSIONINTERFACE_H
+#define QMLEXTENSIONINTERFACE_H
+
+#include <QtCore/qobject.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class QmlEngine;
+
+struct Q_DECLARATIVE_EXPORT QmlExtensionInterface
+{
+ virtual ~QmlExtensionInterface() {}
+ virtual void initialize(QmlEngine *engine, const char *uri) = 0;
+};
+
+Q_DECLARE_INTERFACE(QmlExtensionInterface, "com.trolltech.Qt.QmlExtensionInterface/1.0")
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QMLEXTENSIONINTERFACE_H
diff --git a/src/declarative/qml/qmlextensionplugin.cpp b/src/declarative/qml/qmlextensionplugin.cpp
new file mode 100644
index 0000000..c1195d2
--- /dev/null
+++ b/src/declarative/qml/qmlextensionplugin.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** 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 "qmlextensionplugin.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \since 4.7
+ \class QmlExtensionPlugin
+ \brief The QmlExtensionPlugin class provides an abstract base for custom QML extension plugins.
+
+ \ingroup plugins
+
+ QmlExtensionPlugin is a plugin interface that makes it
+ possible to offer extensions that can be loaded dynamically into
+ applications using the QmlEngine class.
+
+ Writing a QML extension plugin is achieved by subclassing this
+ base class, reimplementing the pure virtual initialize()
+ function, and exporting the class using the Q_EXPORT_PLUGIN2()
+ macro. See \l {How to Create Qt Plugins} for details.
+
+ \sa QmlEngine::importExtension()
+*/
+
+/*!
+ \fn void QmlExtensionPlugin::initialize(QmlEngine *engine)
+
+ Initializes the extension specified in the given \a engine.
+*/
+
+/*!
+ Constructs a QML extension plugin with the given \a parent.
+
+ Note that this constructor is invoked automatically by the
+ Q_EXPORT_PLUGIN2() macro, so there is no need for calling it
+ explicitly.
+*/
+QmlExtensionPlugin::QmlExtensionPlugin(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QmlExtensionPlugin::~QmlExtensionPlugin()
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlmoduleplugin.h b/src/declarative/qml/qmlextensionplugin.h
index b28f1ad..8cc64ad 100644
--- a/src/declarative/qml/qmlmoduleplugin.h
+++ b/src/declarative/qml/qmlextensionplugin.h
@@ -39,14 +39,12 @@
**
****************************************************************************/
-#ifndef QMLMODULEPLUGIN_H
-#define QMLMODULEPLUGIN_H
+#ifndef QMLEXTENSIONPLUGIN_H
+#define QMLEXTENSIONPLUGIN_H
#include <QtCore/qplugin.h>
-#include <QtCore/qfactoryinterface.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qset.h>
-#include <QtCore/qbytearray.h>
+
+#include "qmlextensioninterface.h"
QT_BEGIN_HEADER
@@ -54,33 +52,21 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-struct Q_DECLARATIVE_EXPORT QmlModuleFactoryInterface : public QFactoryInterface
-{
- virtual void defineModuleOnce(const QString& uri) = 0;
-};
-
-#define QmlModuleFactoryInterface_iid "com.nokia.Qt.QmlModuleFactoryInterface"
+class QmlEngine;
-Q_DECLARE_INTERFACE(QmlModuleFactoryInterface, QmlModuleFactoryInterface_iid)
-
-
-class Q_DECLARATIVE_EXPORT QmlModulePlugin : public QObject, public QmlModuleFactoryInterface
+class Q_DECLARATIVE_EXPORT QmlExtensionPlugin : public QObject, public QmlExtensionInterface
{
Q_OBJECT
- Q_INTERFACES(QmlModuleFactoryInterface:QFactoryInterface)
+ Q_INTERFACES(QmlExtensionInterface)
public:
- explicit QmlModulePlugin(QObject *parent = 0);
- ~QmlModulePlugin();
-
- virtual void defineModule(const QString& uri) = 0;
+ explicit QmlExtensionPlugin(QObject *parent = 0);
+ ~QmlExtensionPlugin();
-private:
- void defineModuleOnce(const QString& uri);
- QSet<QString> defined;
+ virtual void initialize(QmlEngine *engine, const char *uri) = 0;
};
QT_END_NAMESPACE
QT_END_HEADER
-#endif // QMLMODULEPLUGIN_H
+#endif // QMLEXTENSIONPLUGIN_H
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index ac619ec..d731393 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -777,6 +777,7 @@ bool QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value,
writeBack->read(object, core.coreIndex);
QmlPropertyCache::Data data = core;
+ data.flags = valueType.flags;
data.coreIndex = valueType.valueTypeCoreIdx;
data.propType = valueType.valueTypePropType;
rv = write(writeBack, data, value, context, flags);
@@ -1082,15 +1083,20 @@ struct ValueTypeSerializedData : public SerializedData {
};
QByteArray QmlMetaPropertyPrivate::saveValueType(const QMetaObject *metaObject, int index,
- int subIndex, int subType)
+ const QMetaObject *subObject, int subIndex)
{
+ QMetaProperty prop = metaObject->property(index);
+ QMetaProperty subProp = subObject->property(subIndex);
+
ValueTypeSerializedData sd;
sd.type = QmlMetaProperty::ValueTypeProperty;
sd.core.load(metaObject->property(index));
+ sd.valueType.flags = QmlPropertyCache::Data::flagsForProperty(subProp);
sd.valueType.valueTypeCoreIdx = subIndex;
- sd.valueType.valueTypePropType = subType;
+ sd.valueType.valueTypePropType = subProp.userType();
QByteArray rv((const char *)&sd, sizeof(sd));
+
return rv;
}
diff --git a/src/declarative/qml/qmlmetaproperty_p.h b/src/declarative/qml/qmlmetaproperty_p.h
index b99e5be..9236bd3 100644
--- a/src/declarative/qml/qmlmetaproperty_p.h
+++ b/src/declarative/qml/qmlmetaproperty_p.h
@@ -111,7 +111,8 @@ public:
static QmlAbstractBinding *setBinding(QObject *, const QmlPropertyCache::Data &, QmlAbstractBinding *,
QmlMetaProperty::WriteFlags flags = QmlMetaProperty::DontRemoveBinding);
- static QByteArray saveValueType(const QMetaObject *, int, int, int);
+ static QByteArray saveValueType(const QMetaObject *, int,
+ const QMetaObject *, int);
static QByteArray saveProperty(const QMetaObject *, int);
static QmlMetaProperty restore(const QByteArray &, QObject *, QmlContext * = 0);
diff --git a/src/declarative/qml/qmlmoduleplugin.cpp b/src/declarative/qml/qmlmoduleplugin.cpp
deleted file mode 100644
index 8019805..0000000
--- a/src/declarative/qml/qmlmoduleplugin.cpp
+++ /dev/null
@@ -1,111 +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 "qmlmoduleplugin.h"
-#include "qstringlist.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QmlModulePlugin
- \brief The QmlModulePlugin class provides an abstract base for custom QML module plugins.
- \reentrant
- \ingroup plugins
-
- The QML module plugin is a simple plugin interface that makes it
- easy to add custom QML modules that can be loaded dynamically
- into applications.
-
- Writing a QML module plugin is achieved by subclassing this base
- class, reimplementing the pure virtual function keys(), and
- exporting the class with the Q_EXPORT_PLUGIN2() macro. See \l{How
- to Create Qt Plugins} for details.
-
- The strings returned by keys() should be the list of URIs of modules
- that the plugin registers.
-
- The plugin should register QML types with qmlRegisterType() when the
- defineModule() method is called.
-
- See the example in \c{examples/declarative/plugins}.
-*/
-
-/*!
- Constructs a QML module plugin with the given \a parent. This is
- invoked automatically by the Q_EXPORT_PLUGIN2() macro.
-*/
-QmlModulePlugin::QmlModulePlugin(QObject *parent)
- : QObject(parent)
-{
-}
-
-/*!
- Destroys the QML module plugin.
-
- You never have to call this explicitly. Qt destroys a plugin
- automatically when it is no longer used.
-*/
-QmlModulePlugin::~QmlModulePlugin()
-{
-}
-
-/*!
- \fn void QmlModulePlugin::defineModule(const QString& uri)
-
- Subclasses must override this function to register types
- of the module \a uri, which will be one of the strings returned by keys().
-
- The plugin registers QML types with qmlRegisterType():
-
- \code
- qmlRegisterType<MyClass>("com.nokia.MyModule", 1, 0, "MyType", "MyClass");
- \endcode
-*/
-
-void QmlModulePlugin::defineModuleOnce(const QString& uri)
-{
- if (!defined.contains(uri)) {
- defined += uri;
- defineModule(uri);
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp
index 2d087b6..81f8e51 100644
--- a/src/declarative/qml/qmlpropertycache.cpp
+++ b/src/declarative/qml/qmlpropertycache.cpp
@@ -49,13 +49,11 @@ Q_DECLARE_METATYPE(QScriptValue);
QT_BEGIN_NAMESPACE
-void QmlPropertyCache::Data::load(const QMetaProperty &p, QmlEngine *engine)
+QmlPropertyCache::Data::Flags QmlPropertyCache::Data::flagsForProperty(const QMetaProperty &p, QmlEngine *engine)
{
- propType = p.userType();
- if (QVariant::Type(propType) == QVariant::LastType)
- propType = qMetaTypeId<QVariant>();
- coreIndex = p.propertyIndex();
- notifyIndex = p.notifySignalIndex();
+ int propType = p.userType();
+
+ Flags flags;
if (p.isConstant())
flags |= Data::IsConstant;
@@ -78,6 +76,18 @@ void QmlPropertyCache::Data::load(const QMetaProperty &p, QmlEngine *engine)
else if (cat == QmlMetaType::List)
flags |= Data::IsQList;
}
+
+ return flags;
+}
+
+void QmlPropertyCache::Data::load(const QMetaProperty &p, QmlEngine *engine)
+{
+ propType = p.userType();
+ if (QVariant::Type(propType) == QVariant::LastType)
+ propType = qMetaTypeId<QVariant>();
+ coreIndex = p.propertyIndex();
+ notifyIndex = p.notifySignalIndex();
+ flags = flagsForProperty(p, engine);
}
void QmlPropertyCache::Data::load(const QMetaMethod &m)
diff --git a/src/declarative/qml/qmlpropertycache_p.h b/src/declarative/qml/qmlpropertycache_p.h
index 18eea80..4a98b88 100644
--- a/src/declarative/qml/qmlpropertycache_p.h
+++ b/src/declarative/qml/qmlpropertycache_p.h
@@ -104,6 +104,7 @@ public:
int coreIndex;
int notifyIndex;
+ static Flags flagsForProperty(const QMetaProperty &, QmlEngine *engine = 0);
void load(const QMetaProperty &, QmlEngine *engine = 0);
void load(const QMetaMethod &);
QString name(QObject *);
@@ -113,6 +114,7 @@ public:
struct ValueTypeData {
inline ValueTypeData();
inline bool operator==(const ValueTypeData &);
+ Data::Flags flags; // flags on the value type wrapper
int valueTypeCoreIdx; // The prop index of the access property on the value type wrapper
int valueTypePropType; // The QVariant::Type of access property on the value type wrapper
};
@@ -173,13 +175,14 @@ QmlPropertyCache::property(const QScriptDeclarativeClass::Identifier &id) const
}
QmlPropertyCache::ValueTypeData::ValueTypeData()
-: valueTypeCoreIdx(-1), valueTypePropType(0)
+: flags(QmlPropertyCache::Data::NoFlags), valueTypeCoreIdx(-1), valueTypePropType(0)
{
}
bool QmlPropertyCache::ValueTypeData::operator==(const ValueTypeData &o)
{
- return valueTypeCoreIdx == o.valueTypeCoreIdx &&
+ return flags == o.flags &&
+ valueTypeCoreIdx == o.valueTypeCoreIdx &&
valueTypePropType == o.valueTypePropType;
}
diff --git a/src/declarative/qml/qmlvaluetype.cpp b/src/declarative/qml/qmlvaluetype.cpp
index 33c3e76..e3b4219 100644
--- a/src/declarative/qml/qmlvaluetype.cpp
+++ b/src/declarative/qml/qmlvaluetype.cpp
@@ -75,6 +75,8 @@ QmlValueType *QmlValueTypeFactory::valueType(int t)
return new QmlRectFValueType;
case QVariant::Vector3D:
return new QmlVector3DValueType;
+ case QVariant::EasingCurve:
+ return new QmlEasingValueType;
case QVariant::Font:
return new QmlFontValueType;
default:
@@ -473,6 +475,74 @@ void QmlVector3DValueType::setZ(qreal z)
vector.setZ(z);
}
+QmlEasingValueType::QmlEasingValueType(QObject *parent)
+: QmlValueType(parent)
+{
+}
+
+void QmlEasingValueType::read(QObject *obj, int idx)
+{
+ void *a[] = { &easing, 0 };
+ QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+}
+
+void QmlEasingValueType::write(QObject *obj, int idx, QmlMetaProperty::WriteFlags flags)
+{
+ int status = -1;
+ void *a[] = { &easing, 0, &status, &flags };
+ QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a);
+}
+
+QVariant QmlEasingValueType::value()
+{
+ return QVariant(easing);
+}
+
+void QmlEasingValueType::setValue(QVariant value)
+{
+ easing = qvariant_cast<QEasingCurve>(value);
+}
+
+QmlEasingValueType::Type QmlEasingValueType::type() const
+{
+ return (QmlEasingValueType::Type)easing.type();
+}
+
+qreal QmlEasingValueType::amplitude() const
+{
+ return easing.amplitude();
+}
+
+qreal QmlEasingValueType::overshoot() const
+{
+ return easing.overshoot();
+}
+
+qreal QmlEasingValueType::period() const
+{
+ return easing.period();
+}
+
+void QmlEasingValueType::setType(QmlEasingValueType::Type type)
+{
+ easing.setType((QEasingCurve::Type)type);
+}
+
+void QmlEasingValueType::setAmplitude(qreal amplitude)
+{
+ easing.setAmplitude(amplitude);
+}
+
+void QmlEasingValueType::setOvershoot(qreal overshoot)
+{
+ easing.setOvershoot(overshoot);
+}
+
+void QmlEasingValueType::setPeriod(qreal period)
+{
+ easing.setPeriod(period);
+}
+
QmlFontValueType::QmlFontValueType(QObject *parent)
: QmlValueType(parent), hasPixelSize(false)
{
diff --git a/src/declarative/qml/qmlvaluetype_p.h b/src/declarative/qml/qmlvaluetype_p.h
index 0a152e8..6dd3703 100644
--- a/src/declarative/qml/qmlvaluetype_p.h
+++ b/src/declarative/qml/qmlvaluetype_p.h
@@ -57,6 +57,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qrect.h>
+#include <QtCore/qeasingcurve.h>
#include <QtCore/qvariant.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qfont.h>
@@ -256,6 +257,62 @@ private:
QVector3D vector;
};
+class Q_AUTOTEST_EXPORT QmlEasingValueType : public QmlValueType
+{
+ Q_OBJECT
+ Q_ENUMS(Type)
+
+ Q_PROPERTY(QmlEasingValueType::Type type READ type WRITE setType)
+ Q_PROPERTY(qreal amplitude READ amplitude WRITE setAmplitude)
+ Q_PROPERTY(qreal overshoot READ overshoot WRITE setOvershoot)
+ Q_PROPERTY(qreal period READ period WRITE setPeriod)
+public:
+ enum Type {
+ Linear = QEasingCurve::Linear,
+ InQuad = QEasingCurve::InQuad, OutQuad = QEasingCurve::OutQuad,
+ InOutQuad = QEasingCurve::InOutQuad, OutInQuad = QEasingCurve::OutInQuad,
+ InCubic = QEasingCurve::InCubic, OutCubic = QEasingCurve::OutCubic,
+ InOutCubic = QEasingCurve::InOutCubic, OutInCubic = QEasingCurve::OutInCubic,
+ InQuart = QEasingCurve::InQuart, OutQuart = QEasingCurve::OutQuart,
+ InOutQuart = QEasingCurve::InOutQuart, OutInQuart = QEasingCurve::OutInQuart,
+ InQuint = QEasingCurve::InQuint, OutQuint = QEasingCurve::OutQuint,
+ InOutQuint = QEasingCurve::InOutQuint, OutInQuint = QEasingCurve::OutInQuint,
+ InSine = QEasingCurve::InSine, OutSine = QEasingCurve::OutSine,
+ InOutSine = QEasingCurve::InOutSine, OutInSine = QEasingCurve::OutInSine,
+ InExpo = QEasingCurve::InExpo, OutExpo = QEasingCurve::OutExpo,
+ InOutExpo = QEasingCurve::InOutExpo, OutInExpo = QEasingCurve::OutInExpo,
+ InCirc = QEasingCurve::InCirc, OutCirc = QEasingCurve::OutCirc,
+ InOutCirc = QEasingCurve::InOutCirc, OutInCirc = QEasingCurve::OutInCirc,
+ InElastic = QEasingCurve::InElastic, OutElastic = QEasingCurve::OutElastic,
+ InOutElastic = QEasingCurve::InOutElastic, OutInElastic = QEasingCurve::OutInElastic,
+ InBack = QEasingCurve::InBack, OutBack = QEasingCurve::OutBack,
+ InOutBack = QEasingCurve::InOutBack, OutInBack = QEasingCurve::OutInBack,
+ InBounce = QEasingCurve::InBounce, OutBounce = QEasingCurve::OutBounce,
+ InOutBounce = QEasingCurve::InOutBounce, OutInBounce = QEasingCurve::OutInBounce,
+ InCurve = QEasingCurve::InCurve, OutCurve = QEasingCurve::OutCurve,
+ SineCurve = QEasingCurve::SineCurve, CosineCurve = QEasingCurve::CosineCurve,
+ };
+
+ QmlEasingValueType(QObject *parent = 0);
+
+ virtual void read(QObject *, int);
+ virtual void write(QObject *, int, QmlMetaProperty::WriteFlags);
+ virtual QVariant value();
+ virtual void setValue(QVariant value);
+
+ Type type() const;
+ qreal amplitude() const;
+ qreal overshoot() const;
+ qreal period() const;
+ void setType(Type);
+ void setAmplitude(qreal);
+ void setOvershoot(qreal);
+ void setPeriod(qreal);
+
+private:
+ QEasingCurve easing;
+};
+
class Q_AUTOTEST_EXPORT QmlFontValueType : public QmlValueType
{
Q_OBJECT
diff --git a/src/declarative/qml/qmlworkerscript.cpp b/src/declarative/qml/qmlworkerscript.cpp
index a2e8c7a..9a48c4f 100644
--- a/src/declarative/qml/qmlworkerscript.cpp
+++ b/src/declarative/qml/qmlworkerscript.cpp
@@ -169,7 +169,7 @@ private:
class QmlWorkerListModelAgent : public QObject
{
Q_OBJECT
- Q_PROPERTY(int count READ count);
+ Q_PROPERTY(int count READ count)
public:
QmlWorkerListModelAgent(QmlWorkerListModel *);
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index 6dcce58..2f24167 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -66,79 +66,6 @@
QT_BEGIN_NAMESPACE
-static QEasingCurve stringToCurve(const QString &curve, QObject *obj)
-{
- QEasingCurve easingCurve;
-
- QString normalizedCurve = curve;
- bool hasParams = curve.contains(QLatin1Char('('));
- QStringList props;
-
- if (hasParams) {
- QString easeName = curve.trimmed();
- if (!easeName.endsWith(QLatin1Char(')'))) {
- qmlInfo(obj) << QmlPropertyAnimation::tr("Unmatched parenthesis in easing function \"%1\"").arg(curve);
- return easingCurve;
- }
-
- int idx = easeName.indexOf(QLatin1Char('('));
- QString prop_str =
- easeName.mid(idx + 1, easeName.length() - 1 - idx - 1);
- normalizedCurve = easeName.left(idx);
- if (!normalizedCurve.startsWith(QLatin1String("ease"))) {
- qmlInfo(obj) << QmlPropertyAnimation::tr("Easing function \"%1\" must start with \"ease\"").arg(curve);
- return easingCurve;
- }
-
- props = prop_str.split(QLatin1Char(','));
- }
-
- if (normalizedCurve.startsWith(QLatin1String("ease")))
- normalizedCurve = normalizedCurve.mid(4);
-
- static int index = QEasingCurve::staticMetaObject.indexOfEnumerator("Type");
- static QMetaEnum me = QEasingCurve::staticMetaObject.enumerator(index);
-
- int value = me.keyToValue(normalizedCurve.toUtf8().constData());
- if (value < 0) {
- qmlInfo(obj) << QmlPropertyAnimation::tr("Unknown easing curve \"%1\"").arg(curve);
- return easingCurve;
- }
- easingCurve.setType((QEasingCurve::Type)value);
-
- if (hasParams) {
- foreach(const QString &str, props) {
- int sep = str.indexOf(QLatin1Char(':'));
-
- if (sep == -1) {
- qmlInfo(obj) << QmlPropertyAnimation::tr("Improperly specified parameter in easing function \"%1\"").arg(curve);
- continue;
- }
-
- QString propName = str.left(sep).trimmed();
- bool isOk;
- qreal propValue = str.mid(sep + 1).trimmed().toDouble(&isOk);
-
- if (propName.isEmpty() || !isOk) {
- qmlInfo(obj) << QmlPropertyAnimation::tr("Improperly specified parameter in easing function \"%1\"").arg(curve);
- continue;
- }
-
- if (propName == QLatin1String("amplitude")) {
- easingCurve.setAmplitude(propValue);
- } else if (propName == QLatin1String("period")) {
- easingCurve.setPeriod(propValue);
- } else if (propName == QLatin1String("overshoot")) {
- easingCurve.setOvershoot(propValue);
- } else {
- qmlInfo(obj) << QmlPropertyAnimation::tr("Unknown easing parameter \"%1\"").arg(propName);
- continue;
- }
- }
- }
- return easingCurve;
-}
-
QML_DEFINE_NOCREATE_TYPE(QmlAbstractAnimation)
/*!
@@ -1927,195 +1854,195 @@ void QmlPropertyAnimation::setTo(const QVariant &t)
}
/*!
- \qmlproperty string PropertyAnimation::easing
+ \qmlproperty QEasingCurve PropertyAnimation::easing
\brief the easing curve used for the transition.
Available values are:
\table
\row
- \o \c easeLinear
+ \o \c Linear
\o Easing curve for a linear (t) function: velocity is constant.
\o \inlineimage qeasingcurve-linear.png
\row
- \o \c easeInQuad
+ \o \c InQuad
\o Easing curve for a quadratic (t^2) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inquad.png
\row
- \o \c easeOutQuad
+ \o \c OutQuad
\o Easing curve for a quadratic (t^2) function: decelerating to zero velocity.
\o \inlineimage qeasingcurve-outquad.png
\row
- \o \c easeInOutQuad
+ \o \c InOutQuad
\o Easing curve for a quadratic (t^2) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutquad.png
\row
- \o \c easeOutInQuad
+ \o \c OutInQuad
\o Easing curve for a quadratic (t^2) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinquad.png
\row
- \o \c easeInCubic
+ \o \c InCubic
\o Easing curve for a cubic (t^3) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-incubic.png
\row
- \o \c easeOutCubic
+ \o \c OutCubic
\o Easing curve for a cubic (t^3) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outcubic.png
\row
- \o \c easeInOutCubic
+ \o \c InOutCubic
\o Easing curve for a cubic (t^3) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutcubic.png
\row
- \o \c easeOutInCubic
+ \o \c OutInCubic
\o Easing curve for a cubic (t^3) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outincubic.png
\row
- \o \c easeInQuart
+ \o \c InQuart
\o Easing curve for a quartic (t^4) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inquart.png
\row
- \o \c easeOutQuart
+ \o \c OutQuart
\o Easing curve for a cubic (t^4) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outquart.png
\row
- \o \c easeInOutQuart
+ \o \c InOutQuart
\o Easing curve for a cubic (t^4) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutquart.png
\row
- \o \c easeOutInQuart
+ \o \c OutInQuart
\o Easing curve for a cubic (t^4) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinquart.png
\row
- \o \c easeInQuint
+ \o \c InQuint
\o Easing curve for a quintic (t^5) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inquint.png
\row
- \o \c easeOutQuint
+ \o \c OutQuint
\o Easing curve for a cubic (t^5) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outquint.png
\row
- \o \c easeInOutQuint
+ \o \c InOutQuint
\o Easing curve for a cubic (t^5) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutquint.png
\row
- \o \c easeOutInQuint
+ \o \c OutInQuint
\o Easing curve for a cubic (t^5) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinquint.png
\row
- \o \c easeInSine
+ \o \c InSine
\o Easing curve for a sinusoidal (sin(t)) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-insine.png
\row
- \o \c easeOutSine
+ \o \c OutSine
\o Easing curve for a sinusoidal (sin(t)) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outsine.png
\row
- \o \c easeInOutSine
+ \o \c InOutSine
\o Easing curve for a sinusoidal (sin(t)) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutsine.png
\row
- \o \c easeOutInSine
+ \o \c OutInSine
\o Easing curve for a sinusoidal (sin(t)) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinsine.png
\row
- \o \c easeInExpo
+ \o \c InExpo
\o Easing curve for an exponential (2^t) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inexpo.png
\row
- \o \c easeOutExpo
+ \o \c OutExpo
\o Easing curve for an exponential (2^t) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outexpo.png
\row
- \o \c easeInOutExpo
+ \o \c InOutExpo
\o Easing curve for an exponential (2^t) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutexpo.png
\row
- \o \c easeOutInExpo
+ \o \c OutInExpo
\o Easing curve for an exponential (2^t) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinexpo.png
\row
- \o \c easeInCirc
+ \o \c InCirc
\o Easing curve for a circular (sqrt(1-t^2)) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-incirc.png
\row
- \o \c easeOutCirc
+ \o \c OutCirc
\o Easing curve for a circular (sqrt(1-t^2)) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outcirc.png
\row
- \o \c easeInOutCirc
+ \o \c InOutCirc
\o Easing curve for a circular (sqrt(1-t^2)) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutcirc.png
\row
- \o \c easeOutInCirc
+ \o \c OutInCirc
\o Easing curve for a circular (sqrt(1-t^2)) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outincirc.png
\row
- \o \c easeInElastic
+ \o \c InElastic
\o Easing curve for an elastic (exponentially decaying sine wave) function: accelerating from zero velocity.
\br The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter.
\o \inlineimage qeasingcurve-inelastic.png
\row
- \o \c easeOutElastic
+ \o \c OutElastic
\o Easing curve for an elastic (exponentially decaying sine wave) function: decelerating from zero velocity.
\br The peak amplitude can be set with the \e amplitude parameter, and the period of decay by the \e period parameter.
\o \inlineimage qeasingcurve-outelastic.png
\row
- \o \c easeInOutElastic
+ \o \c InOutElastic
\o Easing curve for an elastic (exponentially decaying sine wave) function: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutelastic.png
\row
- \o \c easeOutInElastic
+ \o \c OutInElastic
\o Easing curve for an elastic (exponentially decaying sine wave) function: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinelastic.png
\row
- \o \c easeInBack
+ \o \c InBack
\o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inback.png
\row
- \o \c easeOutBack
+ \o \c OutBack
\o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing out: decelerating to zero velocity.
\o \inlineimage qeasingcurve-outback.png
\row
- \o \c easeInOutBack
+ \o \c InOutBack
\o Easing curve for a back (overshooting cubic function: (s+1)*t^3 - s*t^2) easing in/out: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutback.png
\row
- \o \c easeOutInBack
+ \o \c OutInBack
\o Easing curve for a back (overshooting cubic easing: (s+1)*t^3 - s*t^2) easing out/in: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinback.png
\row
- \o \c easeInBounce
+ \o \c InBounce
\o Easing curve for a bounce (exponentially decaying parabolic bounce) function: accelerating from zero velocity.
\o \inlineimage qeasingcurve-inbounce.png
\row
- \o \c easeOutBounce
+ \o \c OutBounce
\o Easing curve for a bounce (exponentially decaying parabolic bounce) function: decelerating from zero velocity.
\o \inlineimage qeasingcurve-outbounce.png
\row
- \o \c easeInOutBounce
+ \o \c InOutBounce
\o Easing curve for a bounce (exponentially decaying parabolic bounce) function easing in/out: acceleration until halfway, then deceleration.
\o \inlineimage qeasingcurve-inoutbounce.png
\row
- \o \c easeOutInBounce
+ \o \c OutInBounce
\o Easing curve for a bounce (exponentially decaying parabolic bounce) function easing out/in: deceleration until halfway, then acceleration.
\o \inlineimage qeasingcurve-outinbounce.png
\endtable
*/
-QString QmlPropertyAnimation::easing() const
+QEasingCurve QmlPropertyAnimation::easing() const
{
Q_D(const QmlPropertyAnimation);
return d->easing;
}
-void QmlPropertyAnimation::setEasing(const QString &e)
+void QmlPropertyAnimation::setEasing(const QEasingCurve &e)
{
Q_D(QmlPropertyAnimation);
if (d->easing == e)
return;
d->easing = e;
- d->va->setEasingCurve(stringToCurve(d->easing, this));
+ d->va->setEasingCurve(d->easing);
emit easingChanged(e);
}
diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h
index 623ad8d..fd868bc 100644
--- a/src/declarative/util/qmlanimation_p.h
+++ b/src/declarative/util/qmlanimation_p.h
@@ -51,6 +51,7 @@
#include <qmlscriptstring.h>
#include <QtCore/qvariant.h>
+#include <QtCore/qeasingcurve.h>
#include <QtCore/QAbstractAnimation>
#include <QtGui/qcolor.h>
@@ -261,7 +262,7 @@ class Q_AUTOTEST_EXPORT QmlPropertyAnimation : public QmlAbstractAnimation
Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
Q_PROPERTY(QVariant from READ from WRITE setFrom NOTIFY fromChanged)
Q_PROPERTY(QVariant to READ to WRITE setTo NOTIFY toChanged)
- Q_PROPERTY(QString easing READ easing WRITE setEasing NOTIFY easingChanged)
+ Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged)
Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged)
Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged)
Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged)
@@ -281,8 +282,8 @@ public:
QVariant to() const;
void setTo(const QVariant &);
- QString easing() const;
- void setEasing(const QString &);
+ QEasingCurve easing() const;
+ void setEasing(const QEasingCurve &);
QObject *target() const;
void setTarget(QObject *);
@@ -307,7 +308,7 @@ Q_SIGNALS:
void durationChanged(int);
void fromChanged(QVariant);
void toChanged(QVariant);
- void easingChanged(const QString &);
+ void easingChanged(const QEasingCurve &);
void propertiesChanged(const QString &);
void targetChanged(QObject *, const QString &);
};
diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h
index 056ce82..8c88f14 100644
--- a/src/declarative/util/qmlanimation_p_p.h
+++ b/src/declarative/util/qmlanimation_p_p.h
@@ -327,7 +327,7 @@ public:
QVariant from;
QVariant to;
- QString easing;
+ QEasingCurve easing;
QObject *target;
QString propertyName;
diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp
index 400ae52..9e95b66 100644
--- a/src/declarative/util/qmlview.cpp
+++ b/src/declarative/util/qmlview.cpp
@@ -132,6 +132,8 @@ public:
QmlViewPrivate(QmlView *view)
: q(view), root(0), component(0), resizeMode(QmlView::SizeViewToRootObject) {}
+ void execute();
+
QmlView *q;
QGuard<QGraphicsObject> root;
@@ -152,6 +154,20 @@ public:
QGraphicsScene scene;
};
+void QmlViewPrivate::execute()
+{
+ delete root;
+ delete component;
+ component = new QmlComponent(&engine, source, q);
+
+ if (!component->isLoading()) {
+ q->continueExecute();
+ } else {
+ QObject::connect(component, SIGNAL(statusChanged(QmlComponent::Status)), q, SLOT(continueExecute()));
+ }
+}
+
+
/*!
\class QmlView
\brief The QmlView class provides a widget for displaying a Qt Declarative user interface.
@@ -188,9 +204,6 @@ public:
QUrl url(fileName);
view->setSource(url);
- ...
- view->execute();
- ...
view->show();
\endcode
@@ -220,6 +233,19 @@ QmlView::QmlView(QWidget *parent)
d->init();
}
+/*!
+ \fn QmlView::QmlView(const QUrl &source, QWidget *parent)
+
+ Constructs a QmlView with the given QML \a source and \a parent.
+*/
+QmlView::QmlView(const QUrl &source, QWidget *parent)
+: QGraphicsView(parent), d(new QmlViewPrivate(this))
+{
+ setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
+ d->init();
+ setSource(source);
+}
+
void QmlViewPrivate::init()
{
#ifdef Q_ENABLE_PERFORMANCE_LOG
@@ -254,15 +280,14 @@ QmlView::~QmlView()
}
/*!
- Sets the source to the \a url.
-
- Call \l execute() to load the QML and instantiate the component.
-
- \sa execute()
+ Sets the source to the \a url, loads the QML component and instantiates it.
*/
void QmlView::setSource(const QUrl& url)
{
- d->source = url;
+ if (url != d->source) {
+ d->source = url;
+ d->execute();
+ }
}
/*!
@@ -296,23 +321,6 @@ QmlContext* QmlView::rootContext()
return d->engine.rootContext();
}
-/*!
- Loads and instantiates the QML component set by the \l setSource() method.
-
- \sa setSource()
-*/
-void QmlView::execute()
-{
- delete d->root;
- delete d->component;
- d->component = new QmlComponent(&d->engine, d->source, this);
-
- if (!d->component->isLoading()) {
- continueExecute();
- } else {
- connect(d->component, SIGNAL(statusChanged(QmlComponent::Status)), this, SLOT(continueExecute()));
- }
-}
/*!
\enum QmlView::Status
@@ -417,52 +425,58 @@ void QmlView::continueExecute()
return;
}
- if (obj) {
- if (QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem *>(obj)) {
-
- d->scene.addItem(item);
-
- QPerformanceLog::displayData();
- QPerformanceLog::clear();
- d->root = item;
- d->qmlRoot = item;
- connect(item, SIGNAL(widthChanged()), this, SLOT(sizeChanged()));
- connect(item, SIGNAL(heightChanged()), this, SLOT(sizeChanged()));
- if (d->initialSize.height() <= 0 && d->qmlRoot->width() > 0)
- d->initialSize.setWidth(d->qmlRoot->width());
- if (d->initialSize.height() <= 0 && d->qmlRoot->height() > 0)
- d->initialSize.setHeight(d->qmlRoot->height());
- resize(d->initialSize);
-
- if (d->resizeMode == SizeRootObjectToView) {
- d->qmlRoot->setWidth(width());
- d->qmlRoot->setHeight(height());
- } else {
- QSize sz(d->qmlRoot->width(),d->qmlRoot->height());
- emit sceneResized(sz);
- resize(sz);
- }
- updateGeometry();
- } else if (QGraphicsObject *item = qobject_cast<QGraphicsObject *>(obj)) {
- d->scene.addItem(item);
- qWarning() << "QmlView::resizeMode is not honored for components of type QGraphicsObject";
- } else if (QWidget *wid = qobject_cast<QWidget *>(obj)) {
- window()->setAttribute(Qt::WA_OpaquePaintEvent, false);
- window()->setAttribute(Qt::WA_NoSystemBackground, false);
- if (!layout()) {
- setLayout(new QVBoxLayout);
- layout()->setContentsMargins(0, 0, 0, 0);
- } else if (layout()->count()) {
- // Hide the QGraphicsView in GV mode.
- QLayoutItem *item = layout()->itemAt(0);
- if (item->widget())
- item->widget()->hide();
- }
- layout()->addWidget(wid);
- emit sceneResized(wid->size());
+ setRootObject(obj);
+ emit statusChanged(status());
+}
+
+
+/*!
+ \internal
+*/
+void QmlView::setRootObject(QObject *obj)
+{
+ if (QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem *>(obj)) {
+ d->scene.addItem(item);
+
+ QPerformanceLog::displayData();
+ QPerformanceLog::clear();
+ d->root = item;
+ d->qmlRoot = item;
+ connect(item, SIGNAL(widthChanged()), this, SLOT(sizeChanged()));
+ connect(item, SIGNAL(heightChanged()), this, SLOT(sizeChanged()));
+ if (d->initialSize.height() <= 0 && d->qmlRoot->width() > 0)
+ d->initialSize.setWidth(d->qmlRoot->width());
+ if (d->initialSize.height() <= 0 && d->qmlRoot->height() > 0)
+ d->initialSize.setHeight(d->qmlRoot->height());
+ resize(d->initialSize);
+
+ if (d->resizeMode == SizeRootObjectToView) {
+ d->qmlRoot->setWidth(width());
+ d->qmlRoot->setHeight(height());
+ } else {
+ QSize sz(d->qmlRoot->width(),d->qmlRoot->height());
+ emit sceneResized(sz);
+ resize(sz);
}
+ updateGeometry();
+ } else if (QGraphicsObject *item = qobject_cast<QGraphicsObject *>(obj)) {
+ d->scene.addItem(item);
+ qWarning() << "QmlView::resizeMode is not honored for components of type QGraphicsObject";
+ } else if (QWidget *wid = qobject_cast<QWidget *>(obj)) {
+ window()->setAttribute(Qt::WA_OpaquePaintEvent, false);
+ window()->setAttribute(Qt::WA_NoSystemBackground, false);
+ if (!layout()) {
+ setLayout(new QVBoxLayout);
+ layout()->setContentsMargins(0, 0, 0, 0);
+ } else if (layout()->count()) {
+ // Hide the QGraphicsView in GV mode.
+ QLayoutItem *item = layout()->itemAt(0);
+ if (item->widget())
+ item->widget()->hide();
+ }
+ layout()->addWidget(wid);
+ emit sceneResized(wid->size());
}
- emit statusChanged(status());
}
/*!
diff --git a/src/declarative/util/qmlview.h b/src/declarative/util/qmlview.h
index 1d6ef1c..26be18f 100644
--- a/src/declarative/util/qmlview.h
+++ b/src/declarative/util/qmlview.h
@@ -67,6 +67,7 @@ class Q_DECLARATIVE_EXPORT QmlView : public QGraphicsView
public:
explicit QmlView(QWidget *parent = 0);
+ QmlView(const QUrl &source, QWidget *parent = 0);
virtual ~QmlView();
QUrl source() const;
@@ -74,7 +75,6 @@ public:
QmlEngine* engine();
QmlContext* rootContext();
- void execute();
QGraphicsObject *rootObject() const;
@@ -100,8 +100,10 @@ private Q_SLOTS:
protected:
virtual void resizeEvent(QResizeEvent *);
virtual void paintEvent(QPaintEvent *event);
- void timerEvent(QTimerEvent*);
+ virtual void timerEvent(QTimerEvent*);
+ virtual void setRootObject(QObject *obj);
+ friend class QmlViewPrivate;
QmlViewPrivate *d;
};
diff --git a/src/multimedia/qml/qml.cpp b/src/multimedia/qml/qml.cpp
index b9ee212..43a32c5 100644
--- a/src/multimedia/qml/qml.cpp
+++ b/src/multimedia/qml/qml.cpp
@@ -55,11 +55,13 @@ namespace QtMultimedia
\internal
*/
-void qRegisterQmlElements()
+void qRegisterQmlElements(QmlEngine *engine, const char *uri)
{
- qmlRegisterType<QSoundEffect>("Qt.multimedia", 4, 7, "SoundEffect", "SoundEffect");
- qmlRegisterType<QmlAudio>("Qt.multimedia", 4, 7, "Audio", "Audio");
- qmlRegisterType<QmlGraphicsVideo>("Qt.multimedia", 4, 7, "Video", "Video");
+ Q_UNUSED(engine);
+
+ qmlRegisterType<QSoundEffect>(uri, 4, 7, "SoundEffect", "SoundEffect");
+ qmlRegisterType<QmlAudio>(uri, 4, 7, "Audio", "Audio");
+ qmlRegisterType<QmlGraphicsVideo>(uri, 4, 7, "Video", "Video");
}
}
diff --git a/src/multimedia/qml/qml.h b/src/multimedia/qml/qml.h
index 41274c8..c4159b3 100644
--- a/src/multimedia/qml/qml.h
+++ b/src/multimedia/qml/qml.h
@@ -47,11 +47,13 @@
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+class QmlEngine;
+
QT_MODULE(Multimedia)
namespace QtMultimedia
{
-extern void Q_MULTIMEDIA_EXPORT qRegisterQmlElements();
+extern void Q_MULTIMEDIA_EXPORT qRegisterQmlElements(QmlEngine *engine, const char *uri);
}
QT_END_NAMESPACE
diff --git a/src/plugins/qmlmodules/multimedia/multimedia.cpp b/src/plugins/qmlmodules/multimedia/multimedia.cpp
index d9414ee..0ebdfd9 100644
--- a/src/plugins/qmlmodules/multimedia/multimedia.cpp
+++ b/src/plugins/qmlmodules/multimedia/multimedia.cpp
@@ -39,27 +39,19 @@
**
****************************************************************************/
-#include <QtDeclarative/qmlmoduleplugin.h>
+#include <QtDeclarative/qmlextensionplugin.h>
#include <QtDeclarative/qml.h>
#include <QtMultimedia/qml.h>
QT_BEGIN_NAMESPACE
-class QMultimediaQmlModule : public QmlModulePlugin
+class QMultimediaQmlModule : public QmlExtensionPlugin
{
Q_OBJECT
public:
- QStringList keys() const
+ virtual void initialize(QmlEngine *engine, const char *uri)
{
- return QStringList() << QLatin1String("Qt.multimedia");
- }
-
- void defineModule(const QString& uri)
- {
- Q_UNUSED(uri)
- Q_ASSERT(uri == QLatin1String("Qt.multimedia"));
-
- QtMultimedia::qRegisterQmlElements();
+ QtMultimedia::qRegisterQmlElements(engine, uri);
}
};
diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp
index ee05574..53c1ede 100644
--- a/tests/auto/declarative/layouts/tst_layouts.cpp
+++ b/tests/auto/declarative/layouts/tst_layouts.cpp
@@ -67,7 +67,6 @@ void tst_QmlGraphicsLayouts::test_qml()
{
QmlView *canvas = createView(SRCDIR "/data/layouts.qml");
- canvas->execute();
qApp->processEvents();
QmlGraphicsLayoutItem *left = static_cast<QmlGraphicsLayoutItem*>(canvas->rootObject()->findChild<QmlGraphicsItem*>("left"));
QVERIFY(left != 0);
diff --git a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp
index 9eae308..00e099e 100644
--- a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp
+++ b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp
@@ -45,6 +45,7 @@
#include <private/qmlgraphicsrectangle_p.h>
#include <private/qmlanimation_p.h>
#include <QVariantAnimation>
+#include <QEasingCurve>
class tst_qmlanimations : public QObject
{
@@ -67,11 +68,11 @@ private slots:
void mixedTypes();
void properties();
void propertiesTransition();
- void easingStringConversion();
void invalidDuration();
void attached();
void propertyValueSourceDefaultStart();
void dontStart();
+ void easingProperties();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -261,7 +262,6 @@ void tst_qmlanimations::badTypes()
QmlView *view = new QmlView;
view->setSource(QUrl::fromLocalFile(SRCDIR "/data/badtype1.qml"));
- view->execute();
qApp->processEvents();
delete view;
@@ -518,57 +518,6 @@ void tst_qmlanimations::propertiesTransition()
}*/
}
-void tst_qmlanimations::easingStringConversion()
-{
- QmlNumberAnimation *animation = new QmlNumberAnimation;
- animation->setEasing("easeInOutQuad");
- QCOMPARE(animation->easing(),QLatin1String("easeInOutQuad"));
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve(), QEasingCurve(QEasingCurve::InOutQuad));
-
- animation->setEasing("OutQuad");
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve(), QEasingCurve(QEasingCurve::OutQuad));
-
- animation->setEasing("easeOutBounce(amplitude: 5)");
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutBounce);
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude(), qreal(5));
-
- animation->setEasing("easeOutElastic(amplitude: 5, period: 3)");
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutElastic);
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude(), qreal(5));
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().period(), qreal(3));
-
- animation->setEasing("easeInOutBack(overshoot: 2)");
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutBack);
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().overshoot(), qreal(2));
-
- QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Unmatched parenthesis in easing function \"easeInOutBack(overshoot: 2\"");
- animation->setEasing("easeInOutBack(overshoot: 2");
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear);
-
- QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Easing function \"InOutBack(overshoot: 2)\" must start with \"ease\"");
- animation->setEasing("InOutBack(overshoot: 2)");
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear);
-
- QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Unknown easing curve \"NonExistantEase\"");
- animation->setEasing("NonExistantEase");
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear);
-
- QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Improperly specified parameter in easing function \"easeInOutElastic(amplitude 5)\"");
- animation->setEasing("easeInOutElastic(amplitude 5)");
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutElastic);
-
- QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Improperly specified parameter in easing function \"easeInOutElastic(amplitude: yes)\"");
- animation->setEasing("easeInOutElastic(amplitude: yes)");
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutElastic);
- QVERIFY(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude() != qreal(5));
-
- QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Unknown easing parameter \"nonexistentproperty\"");
- animation->setEasing("easeOutQuad(nonexistentproperty: 12)");
- QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutQuad);
-
- delete animation;
-}
-
void tst_qmlanimations::invalidDuration()
{
QmlPropertyAnimation *animation = new QmlPropertyAnimation;
@@ -667,6 +616,57 @@ void tst_qmlanimations::dontStart()
}
}
+void tst_qmlanimations::easingProperties()
+{
+ {
+ QmlEngine engine;
+ QString componentStr = "import Qt 4.6\nNumberAnimation { easing.type: \"InOutQuad\" }";
+ QmlComponent animationComponent(&engine);
+ animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QmlPropertyAnimation *animObject = qobject_cast<QmlPropertyAnimation*>(animationComponent.create());
+
+ QVERIFY(animObject != 0);
+ QCOMPARE(animObject->easing().type(), QEasingCurve::InOutQuad);
+ }
+
+ {
+ QmlEngine engine;
+ QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"OutBounce\"; easing.amplitude: 5.0 }";
+ QmlComponent animationComponent(&engine);
+ animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QmlPropertyAnimation *animObject = qobject_cast<QmlPropertyAnimation*>(animationComponent.create());
+
+ QVERIFY(animObject != 0);
+ QCOMPARE(animObject->easing().type(), QEasingCurve::OutBounce);
+ QCOMPARE(animObject->easing().amplitude(), 5.0);
+ }
+
+ {
+ QmlEngine engine;
+ QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"OutElastic\"; easing.amplitude: 5.0; easing.period: 3.0}";
+ QmlComponent animationComponent(&engine);
+ animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QmlPropertyAnimation *animObject = qobject_cast<QmlPropertyAnimation*>(animationComponent.create());
+
+ QVERIFY(animObject != 0);
+ QCOMPARE(animObject->easing().type(), QEasingCurve::OutElastic);
+ QCOMPARE(animObject->easing().amplitude(), 5.0);
+ QCOMPARE(animObject->easing().period(), 3.0);
+ }
+
+ {
+ QmlEngine engine;
+ QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"InOutBack\"; easing.overshoot: 2 }";
+ QmlComponent animationComponent(&engine);
+ animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QmlPropertyAnimation *animObject = qobject_cast<QmlPropertyAnimation*>(animationComponent.create());
+
+ QVERIFY(animObject != 0);
+ QCOMPARE(animObject->easing().type(), QEasingCurve::InOutBack);
+ QCOMPARE(animObject->easing().overshoot(), 2.0);
+ }
+}
+
QTEST_MAIN(tst_qmlanimations)
#include "tst_qmlanimations.moc"
diff --git a/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp b/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp
index aa6b56a..721608e 100644
--- a/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp
+++ b/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp
@@ -104,7 +104,6 @@ void tst_qmlgraphicsanchors::basicAnchors()
QmlView *view = new QmlView;
view->setSource(QUrl::fromLocalFile(SRCDIR "/data/anchors.qml"));
- view->execute();
qApp->processEvents();
//sibling horizontal
@@ -171,28 +170,28 @@ void tst_qmlgraphicsanchors::basicAnchors()
void tst_qmlgraphicsanchors::loops()
{
{
- QmlView *view = new QmlView;
-
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/loop1.qml"));
+ QUrl source(QUrl::fromLocalFile(SRCDIR "/data/loop1.qml"));
- QString expect = "QML Text (" + view->source().toString() + ":6:5" + ") Possible anchor loop detected on horizontal anchor.";
+ QString expect = "QML Text (" + source.toString() + ":6:5" + ") Possible anchor loop detected on horizontal anchor.";
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
- view->execute();
+
+ QmlView *view = new QmlView;
+ view->setSource(source);
qApp->processEvents();
delete view;
}
{
- QmlView *view = new QmlView;
+ QUrl source(QUrl::fromLocalFile(SRCDIR "/data/loop2.qml"));
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/loop2.qml"));
-
- QString expect = "QML Image (" + view->source().toString() + ":8:3" + ") Possible anchor loop detected on horizontal anchor.";
+ QString expect = "QML Image (" + source.toString() + ":8:3" + ") Possible anchor loop detected on horizontal anchor.";
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
- view->execute();
+
+ QmlView *view = new QmlView;
+ view->setSource(source);
qApp->processEvents();
delete view;
@@ -370,14 +369,13 @@ void tst_qmlgraphicsanchors::nullItem_data()
void tst_qmlgraphicsanchors::crash1()
{
- QmlView *view = new QmlView;
+ QUrl source(QUrl::fromLocalFile(SRCDIR "/data/crash1.qml"));
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/crash1.qml"));
-
- QString expect = "QML Text (" + view->source().toString() + ":4:5" + ") Possible anchor loop detected on fill.";
+ QString expect = "QML Text (" + source.toString() + ":4:5" + ") Possible anchor loop detected on fill.";
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); // XXX ideally, should be one message
- view->execute();
+
+ QmlView *view = new QmlView(source);
qApp->processEvents();
delete view;
@@ -385,11 +383,8 @@ void tst_qmlgraphicsanchors::crash1()
void tst_qmlgraphicsanchors::fill()
{
- QmlView *view = new QmlView;
-
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/fill.qml"));
+ QmlView *view = new QmlView(QUrl::fromLocalFile(SRCDIR "/data/fill.qml"));
- view->execute();
qApp->processEvents();
QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("filler"));
QCOMPARE(rect->x(), 0.0 + 10.0);
@@ -411,11 +406,8 @@ void tst_qmlgraphicsanchors::fill()
void tst_qmlgraphicsanchors::centerIn()
{
- QmlView *view = new QmlView;
-
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/centerin.qml"));
+ QmlView *view = new QmlView(QUrl::fromLocalFile(SRCDIR "/data/centerin.qml"));
- view->execute();
qApp->processEvents();
QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("centered"));
QCOMPARE(rect->x(), 75.0 + 10);
@@ -431,11 +423,8 @@ void tst_qmlgraphicsanchors::centerIn()
void tst_qmlgraphicsanchors::margins()
{
- QmlView *view = new QmlView;
-
- view->setSource(QUrl::fromLocalFile(SRCDIR "/data/margins.qml"));
+ QmlView *view = new QmlView(QUrl::fromLocalFile(SRCDIR "/data/margins.qml"));
- view->execute();
qApp->processEvents();
QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("filler"));
QCOMPARE(rect->x(), 5.0);
diff --git a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp
index 2520d4a..7c8501c 100644
--- a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp
+++ b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp
@@ -68,7 +68,7 @@ private slots:
void positionViewAtIndex();
private:
- QmlView *createView(const QString &filename);
+ QmlView *createView();
template<typename T>
T *findItem(QGraphicsObject *parent, const QString &id, int index=-1);
template<typename T>
@@ -142,7 +142,7 @@ tst_QmlGraphicsGridView::tst_QmlGraphicsGridView()
void tst_QmlGraphicsGridView::items()
{
- QmlView *canvas = createView(SRCDIR "/data/gridview.qml");
+ QmlView *canvas = createView();
TestModel model;
model.addItem("Fred", "12345");
@@ -157,7 +157,7 @@ void tst_QmlGraphicsGridView::items()
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml"));
qApp->processEvents();
QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid");
@@ -190,7 +190,7 @@ void tst_QmlGraphicsGridView::items()
void tst_QmlGraphicsGridView::changed()
{
- QmlView *canvas = createView(SRCDIR "/data/gridview.qml");
+ QmlView *canvas = createView();
TestModel model;
model.addItem("Fred", "12345");
@@ -205,7 +205,7 @@ void tst_QmlGraphicsGridView::changed()
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml"));
qApp->processEvents();
QmlGraphicsFlickable *gridview = findItem<QmlGraphicsFlickable>(canvas->rootObject(), "grid");
@@ -227,7 +227,7 @@ void tst_QmlGraphicsGridView::changed()
void tst_QmlGraphicsGridView::inserted()
{
- QmlView *canvas = createView(SRCDIR "/data/gridview.qml");
+ QmlView *canvas = createView();
TestModel model;
model.addItem("Fred", "12345");
@@ -238,7 +238,7 @@ void tst_QmlGraphicsGridView::inserted()
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml"));
qApp->processEvents();
QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid");
@@ -309,7 +309,7 @@ void tst_QmlGraphicsGridView::inserted()
void tst_QmlGraphicsGridView::removed()
{
- QmlView *canvas = createView(SRCDIR "/data/gridview.qml");
+ QmlView *canvas = createView();
TestModel model;
for (int i = 0; i < 40; i++)
@@ -319,7 +319,7 @@ void tst_QmlGraphicsGridView::removed()
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml"));
qApp->processEvents();
QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid");
@@ -469,7 +469,7 @@ void tst_QmlGraphicsGridView::removed()
void tst_QmlGraphicsGridView::moved()
{
- QmlView *canvas = createView(SRCDIR "/data/gridview.qml");
+ QmlView *canvas = createView();
TestModel model;
for (int i = 0; i < 30; i++)
@@ -479,7 +479,7 @@ void tst_QmlGraphicsGridView::moved()
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml"));
qApp->processEvents();
QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid");
@@ -580,7 +580,6 @@ void tst_QmlGraphicsGridView::currentIndex()
QString filename(SRCDIR "/data/gridview-initCurrent.qml");
canvas->setSource(QUrl::fromLocalFile(filename));
- canvas->execute();
qApp->processEvents();
QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid");
@@ -690,7 +689,7 @@ void tst_QmlGraphicsGridView::currentIndex()
void tst_QmlGraphicsGridView::changeFlow()
{
- QmlView *canvas = createView(SRCDIR "/data/gridview.qml");
+ QmlView *canvas = createView();
TestModel model;
for (int i = 0; i < 30; i++)
@@ -700,7 +699,7 @@ void tst_QmlGraphicsGridView::changeFlow()
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml"));
qApp->processEvents();
QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid");
@@ -795,7 +794,7 @@ void tst_QmlGraphicsGridView::properties()
void tst_QmlGraphicsGridView::positionViewAtIndex()
{
- QmlView *canvas = createView(SRCDIR "/data/gridview.qml");
+ QmlView *canvas = createView();
TestModel model;
for (int i = 0; i < 40; i++)
@@ -805,7 +804,7 @@ void tst_QmlGraphicsGridView::positionViewAtIndex()
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testTopToBottom", QVariant(false));
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml"));
qApp->processEvents();
QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid");
@@ -883,13 +882,11 @@ void tst_QmlGraphicsGridView::positionViewAtIndex()
delete canvas;
}
-QmlView *tst_QmlGraphicsGridView::createView(const QString &filename)
+QmlView *tst_QmlGraphicsGridView::createView()
{
QmlView *canvas = new QmlView(0);
canvas->setFixedSize(240,320);
- canvas->setSource(QUrl::fromLocalFile(filename));
-
return canvas;
}
diff --git a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp
index 820a6de..1bface4 100644
--- a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp
+++ b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp
@@ -112,14 +112,12 @@ void tst_QmlGraphicsItem::keys()
QmlView *canvas = new QmlView(0);
canvas->setFixedSize(240,320);
- canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keys.qml"));
-
KeysTestObject *testObject = new KeysTestObject;
canvas->rootContext()->setContextProperty("keysTestObject", testObject);
canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(true));
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keys.qml"));
canvas->show();
qApp->processEvents();
@@ -195,7 +193,6 @@ void tst_QmlGraphicsItem::keyNavigation()
canvas->setFixedSize(240,320);
canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigation.qml"));
- canvas->execute();
canvas->show();
qApp->processEvents();
diff --git a/tests/auto/declarative/qmlgraphicslistview/data/listview.qml b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml
index 99b3db6..1c1b3f8 100644
--- a/tests/auto/declarative/qmlgraphicslistview/data/listview.qml
+++ b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml
@@ -88,7 +88,7 @@ Rectangle {
ScriptAction { script: console.log("Fix PropertyAction with attached properties") }
/*
PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
- NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing: "easeInOutQuad" }
+ NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: "InOutQuad" }
PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false }
*/
}
diff --git a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp
index 0876520..cf96ad5 100644
--- a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp
+++ b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp
@@ -88,7 +88,7 @@ private:
template <class T> void removed(bool animated);
template <class T> void moved();
template <class T> void clear();
- QmlView *createView(const QString &filename);
+ QmlView *createView();
template<typename T>
T *findItem(QGraphicsObject *parent, const QString &id, int index=-1);
template<typename T>
@@ -300,7 +300,7 @@ tst_QmlGraphicsListView::tst_QmlGraphicsListView()
template <class T>
void tst_QmlGraphicsListView::items()
{
- QmlView *canvas = createView(SRCDIR "/data/listview.qml");
+ QmlView *canvas = createView();
T model;
model.addItem("Fred", "12345");
@@ -313,7 +313,7 @@ void tst_QmlGraphicsListView::items()
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml"));
qApp->processEvents();
QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
@@ -380,7 +380,7 @@ void tst_QmlGraphicsListView::items()
template <class T>
void tst_QmlGraphicsListView::changed()
{
- QmlView *canvas = createView(SRCDIR "/data/listview.qml");
+ QmlView *canvas = createView();
T model;
model.addItem("Fred", "12345");
@@ -393,7 +393,7 @@ void tst_QmlGraphicsListView::changed()
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml"));
qApp->processEvents();
QmlGraphicsFlickable *listview = findItem<QmlGraphicsFlickable>(canvas->rootObject(), "list");
@@ -416,7 +416,7 @@ void tst_QmlGraphicsListView::changed()
template <class T>
void tst_QmlGraphicsListView::inserted()
{
- QmlView *canvas = createView(SRCDIR "/data/listview.qml");
+ QmlView *canvas = createView();
T model;
model.addItem("Fred", "12345");
@@ -429,7 +429,7 @@ void tst_QmlGraphicsListView::inserted()
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml"));
qApp->processEvents();
QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
@@ -509,7 +509,7 @@ void tst_QmlGraphicsListView::inserted()
template <class T>
void tst_QmlGraphicsListView::removed(bool animated)
{
- QmlView *canvas = createView(SRCDIR "/data/listview.qml");
+ QmlView *canvas = createView();
T model;
for (int i = 0; i < 30; i++)
@@ -522,7 +522,7 @@ void tst_QmlGraphicsListView::removed(bool animated)
testObject->setAnimate(animated);
ctxt->setContextProperty("testObject", testObject);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml"));
qApp->processEvents();
QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
@@ -652,7 +652,7 @@ void tst_QmlGraphicsListView::removed(bool animated)
template <class T>
void tst_QmlGraphicsListView::clear()
{
- QmlView *canvas = createView(SRCDIR "/data/listview.qml");
+ QmlView *canvas = createView();
T model;
for (int i = 0; i < 30; i++)
@@ -664,7 +664,7 @@ void tst_QmlGraphicsListView::clear()
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml"));
qApp->processEvents();
QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
@@ -689,7 +689,7 @@ void tst_QmlGraphicsListView::clear()
template <class T>
void tst_QmlGraphicsListView::moved()
{
- QmlView *canvas = createView(SRCDIR "/data/listview.qml");
+ QmlView *canvas = createView();
T model;
for (int i = 0; i < 30; i++)
@@ -701,7 +701,7 @@ void tst_QmlGraphicsListView::moved()
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml"));
qApp->processEvents();
QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
@@ -785,7 +785,7 @@ void tst_QmlGraphicsListView::moved()
void tst_QmlGraphicsListView::enforceRange()
{
- QmlView *canvas = createView(SRCDIR "/data/listview-enforcerange.qml");
+ QmlView *canvas = createView();
TestModel model;
for (int i = 0; i < 30; i++)
@@ -794,7 +794,7 @@ void tst_QmlGraphicsListView::enforceRange()
QmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-enforcerange.qml"));
qApp->processEvents();
QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
@@ -830,7 +830,7 @@ void tst_QmlGraphicsListView::enforceRange()
void tst_QmlGraphicsListView::spacing()
{
- QmlView *canvas = createView(SRCDIR "/data/listview.qml");
+ QmlView *canvas = createView();
TestModel model;
for (int i = 0; i < 30; i++)
@@ -842,7 +842,7 @@ void tst_QmlGraphicsListView::spacing()
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml"));
qApp->processEvents();
QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
@@ -888,7 +888,7 @@ void tst_QmlGraphicsListView::spacing()
void tst_QmlGraphicsListView::sections()
{
- QmlView *canvas = createView(SRCDIR "/data/listview-sections.qml");
+ QmlView *canvas = createView();
TestModel model;
for (int i = 0; i < 30; i++)
@@ -897,7 +897,7 @@ void tst_QmlGraphicsListView::sections()
QmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-sections.qml"));
qApp->processEvents();
QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
@@ -975,7 +975,6 @@ void tst_QmlGraphicsListView::currentIndex()
QString filename(SRCDIR "/data/listview-initCurrent.qml");
canvas->setSource(QUrl::fromLocalFile(filename));
- canvas->execute();
qApp->processEvents();
QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
@@ -1055,9 +1054,9 @@ void tst_QmlGraphicsListView::currentIndex()
void tst_QmlGraphicsListView::itemList()
{
- QmlView *canvas = createView(SRCDIR "/data/itemlist.qml");
+ QmlView *canvas = createView();
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/itemlist.qml"));
qApp->processEvents();
QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "view");
@@ -1096,7 +1095,7 @@ void tst_QmlGraphicsListView::itemList()
void tst_QmlGraphicsListView::cacheBuffer()
{
- QmlView *canvas = createView(SRCDIR "/data/listview.qml");
+ QmlView *canvas = createView();
TestModel model;
for (int i = 0; i < 30; i++)
@@ -1108,7 +1107,7 @@ void tst_QmlGraphicsListView::cacheBuffer()
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml"));
qApp->processEvents();
QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
@@ -1148,7 +1147,7 @@ void tst_QmlGraphicsListView::cacheBuffer()
void tst_QmlGraphicsListView::positionViewAtIndex()
{
- QmlView *canvas = createView(SRCDIR "/data/listview.qml");
+ QmlView *canvas = createView();
TestModel model;
for (int i = 0; i < 40; i++)
@@ -1160,7 +1159,7 @@ void tst_QmlGraphicsListView::positionViewAtIndex()
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml"));
qApp->processEvents();
QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list");
@@ -1295,13 +1294,11 @@ void tst_QmlGraphicsListView::qAbstractItemModel_clear()
clear<TestModel2>();
}
-QmlView *tst_QmlGraphicsListView::createView(const QString &filename)
+QmlView *tst_QmlGraphicsListView::createView()
{
QmlView *canvas = new QmlView(0);
canvas->setFixedSize(240,320);
- canvas->setSource(QUrl::fromLocalFile(filename));
-
return canvas;
}
diff --git a/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp b/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp
index 869a7bd..22a12a9 100644
--- a/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp
+++ b/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp
@@ -56,7 +56,6 @@ private:
void tst_QmlGraphicsMouseArea::dragProperties()
{
QmlView *canvas = createView(SRCDIR "/data/dragproperties.qml");
- canvas->execute();
canvas->show();
canvas->setFocus();
QVERIFY(canvas->rootObject() != 0);
diff --git a/tests/auto/declarative/qmlgraphicsparticles/data/particlemotion.qml b/tests/auto/declarative/qmlgraphicsparticles/data/particlemotion.qml
new file mode 100644
index 0000000..ace61fe
--- /dev/null
+++ b/tests/auto/declarative/qmlgraphicsparticles/data/particlemotion.qml
@@ -0,0 +1,33 @@
+import Qt 4.6
+Rectangle {
+ width: 240
+ height: 320
+ color: "black"
+ Particles {
+ objectName: "particles"
+ anchors.fill: parent
+ width: 1
+ height: 1
+ source: "particle.png"
+ lifeSpan: 5000
+ count: 200
+ angle: 270
+ angleDeviation: 45
+ velocity: 50
+ velocityDeviation: 30
+ ParticleMotionGravity {
+ objectName: "motionGravity"
+ yattractor: 1000
+ xattractor: 0
+ acceleration: 25
+ }
+ }
+ resources: [
+ ParticleMotionWander {
+ objectName: "motionWander"
+ xvariance: 30
+ yvariance: 30
+ pace: 100
+ }
+ ]
+} \ No newline at end of file
diff --git a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp
index a5c0b78..9436772 100644
--- a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp
+++ b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
#include <QtTest/QtTest>
+#include <QtTest/QSignalSpy>
#include <qmlview.h>
#include <private/qmlgraphicsparticles_p.h>
@@ -50,6 +51,8 @@ public:
private slots:
void properties();
+ void motionGravity();
+ void motionWander();
void runs();
private:
QmlView *createView(const QString &filename);
@@ -98,6 +101,91 @@ void tst_QmlGraphicsParticles::properties()
QCOMPARE(particles->emissionRate(), 12);
}
+void tst_QmlGraphicsParticles::motionGravity()
+{
+ QmlView *canvas = createView(SRCDIR "/data/particlemotion.qml");
+ QVERIFY(canvas->rootObject());
+ QmlGraphicsParticles* particles = canvas->rootObject()->findChild<QmlGraphicsParticles*>("particles");
+ QVERIFY(particles);
+
+ QmlGraphicsParticleMotionGravity* motionGravity = canvas->rootObject()->findChild<QmlGraphicsParticleMotionGravity*>("motionGravity");
+ QCOMPARE(particles->motion(), motionGravity);
+
+ QSignalSpy xattractorSpy(motionGravity, SIGNAL(xattractorChanged()));
+ QSignalSpy yattractorSpy(motionGravity, SIGNAL(yattractorChanged()));
+ QSignalSpy accelerationSpy(motionGravity, SIGNAL(accelerationChanged()));
+
+ QCOMPARE(motionGravity->xAttractor(), 0.0);
+ QCOMPARE(motionGravity->yAttractor(), 1000.0);
+ QCOMPARE(motionGravity->acceleration(), 25.0);
+
+ motionGravity->setXAttractor(20.0);
+ motionGravity->setYAttractor(10.0);
+ motionGravity->setAcceleration(10.0);
+
+ QCOMPARE(motionGravity->xAttractor(), 20.0);
+ QCOMPARE(motionGravity->yAttractor(), 10.0);
+ QCOMPARE(motionGravity->acceleration(), 10.0);
+
+ QCOMPARE(xattractorSpy.count(), 1);
+ QCOMPARE(yattractorSpy.count(), 1);
+ QCOMPARE(accelerationSpy.count(), 1);
+
+ motionGravity->setXAttractor(20.0);
+ motionGravity->setYAttractor(10.0);
+ motionGravity->setAcceleration(10.0);
+
+ QCOMPARE(xattractorSpy.count(), 1);
+ QCOMPARE(yattractorSpy.count(), 1);
+ QCOMPARE(accelerationSpy.count(), 1);
+}
+
+void tst_QmlGraphicsParticles::motionWander()
+{
+ QmlView *canvas = createView(SRCDIR "/data/particlemotion.qml");
+ QVERIFY(canvas->rootObject());
+ QmlGraphicsParticles* particles = canvas->rootObject()->findChild<QmlGraphicsParticles*>("particles");
+ QVERIFY(particles);
+
+ QSignalSpy motionSpy(particles, SIGNAL(motionChanged()));
+ QmlGraphicsParticleMotionWander* motionWander = canvas->rootObject()->findChild<QmlGraphicsParticleMotionWander*>("motionWander");
+
+ particles->setMotion(motionWander);
+ QCOMPARE(particles->motion(),motionWander);
+ QCOMPARE(motionSpy.count(), 1);
+
+ particles->setMotion(motionWander);
+ QCOMPARE(motionSpy.count(), 1);
+
+ QSignalSpy xvarianceSpy(motionWander, SIGNAL(xvarianceChanged()));
+ QSignalSpy yvarianceSpy(motionWander, SIGNAL(yvarianceChanged()));
+ QSignalSpy paceSpy(motionWander, SIGNAL(paceChanged()));
+
+ QCOMPARE(motionWander->xVariance(), 30.0);
+ QCOMPARE(motionWander->yVariance(), 30.0);
+ QCOMPARE(motionWander->pace(), 100.0);
+
+ motionWander->setXVariance(20.0);
+ motionWander->setYVariance(10.0);
+ motionWander->setPace(10.0);
+
+ QCOMPARE(motionWander->xVariance(), 20.0);
+ QCOMPARE(motionWander->yVariance(), 10.0);
+ QCOMPARE(motionWander->pace(), 10.0);
+
+ QCOMPARE(xvarianceSpy.count(), 1);
+ QCOMPARE(yvarianceSpy.count(), 1);
+ QCOMPARE(paceSpy.count(), 1);
+
+ motionWander->setXVariance(20.0);
+ motionWander->setYVariance(10.0);
+ motionWander->setPace(10.0);
+
+ QCOMPARE(xvarianceSpy.count(), 1);
+ QCOMPARE(yvarianceSpy.count(), 1);
+ QCOMPARE(paceSpy.count(), 1);
+}
+
void tst_QmlGraphicsParticles::runs()
{
QmlView *canvas = createView(SRCDIR "/data/particles.qml");
@@ -113,7 +201,6 @@ QmlView *tst_QmlGraphicsParticles::createView(const QString &filename)
canvas->setFixedSize(240,320);
canvas->setSource(QUrl::fromLocalFile(filename));
- canvas->execute();
return canvas;
}
diff --git a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp
index 62b3cfc..b57142e 100644
--- a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp
+++ b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp
@@ -69,7 +69,7 @@ private slots:
void pathMoved();
private:
- QmlView *createView(const QString &filename);
+ QmlView *createView();
template<typename T>
T *findItem(QGraphicsObject *parent, const QString &objectName, int index=-1);
template<typename T>
@@ -191,7 +191,7 @@ void tst_QmlGraphicsPathView::initValues()
void tst_QmlGraphicsPathView::items()
{
- QmlView *canvas = createView(SRCDIR "/data/pathview.qml");
+ QmlView *canvas = createView();
TestModel model;
model.addItem("Fred", "12345");
@@ -201,7 +201,7 @@ void tst_QmlGraphicsPathView::items()
QmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview.qml"));
qApp->processEvents();
QmlGraphicsPathView *pathview = findItem<QmlGraphicsPathView>(canvas->rootObject(), "view");
@@ -304,7 +304,7 @@ void tst_QmlGraphicsPathView::path()
void tst_QmlGraphicsPathView::dataModel()
{
- QmlView *canvas = createView(SRCDIR "/data/datamodel.qml");
+ QmlView *canvas = createView();
QmlContext *ctxt = canvas->rootContext();
TestObject *testObject = new TestObject;
@@ -323,7 +323,7 @@ void tst_QmlGraphicsPathView::dataModel()
ctxt->setContextProperty("testData", &model);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/datamodel.qml"));
qApp->processEvents();
QmlGraphicsPathView *pathview = qobject_cast<QmlGraphicsPathView*>(canvas->rootObject());
@@ -384,7 +384,7 @@ void tst_QmlGraphicsPathView::dataModel()
void tst_QmlGraphicsPathView::pathMoved()
{
- QmlView *canvas = createView(SRCDIR "/data/pathview.qml");
+ QmlView *canvas = createView();
TestModel model;
model.addItem("Ben", "12345");
@@ -395,7 +395,7 @@ void tst_QmlGraphicsPathView::pathMoved()
QmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testModel", &model);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview.qml"));
qApp->processEvents();
QmlGraphicsPathView *pathview = findItem<QmlGraphicsPathView>(canvas->rootObject(), "view");
@@ -425,13 +425,11 @@ void tst_QmlGraphicsPathView::pathMoved()
delete canvas;
}
-QmlView *tst_QmlGraphicsPathView::createView(const QString &filename)
+QmlView *tst_QmlGraphicsPathView::createView()
{
QmlView *canvas = new QmlView(0);
canvas->setFixedSize(240,320);
- canvas->setSource(QUrl::fromLocalFile(filename));
-
return canvas;
}
diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/propertychanges.qml b/tests/auto/declarative/qmlgraphicspositioners/data/propertychanges.qml
new file mode 100644
index 0000000..c3dc7bf
--- /dev/null
+++ b/tests/auto/declarative/qmlgraphicspositioners/data/propertychanges.qml
@@ -0,0 +1,39 @@
+import Qt 4.6
+
+Grid {
+ id: myGrid
+
+ width: 270
+ height: 270
+ x: 3
+ y: 3
+ columns: 4
+ spacing: 3
+
+ add: columnTransition
+ move: columnTransition
+
+ Repeater {
+ model: 20
+ Rectangle { color: "black"; width: 50; height: 50 }
+ }
+
+ data: [
+ Transition {
+ id: rowTransition
+ objectName: "rowTransition"
+ NumberAnimation {
+ properties: "x,y";
+ easing: "easeOutInCubic"
+ }
+ },
+ Transition {
+ id: columnTransition
+ objectName: "columnTransition"
+ NumberAnimation {
+ properties: "x,y";
+ easing: "easeOutInCubic"
+ }
+ }
+ ]
+}
diff --git a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp
index b51266a..5089dc5 100644
--- a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp
+++ b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp
@@ -42,6 +42,8 @@
#include <private/qlistmodelinterface_p.h>
#include <qmlview.h>
#include <private/qmlgraphicsrectangle_p.h>
+#include <private/qmlgraphicspositioners_p.h>
+#include <private/qmltransition_p.h>
#include <qmlexpression.h>
#include "../../../shared/util.h"
@@ -61,7 +63,7 @@ private slots:
void test_grid();
void test_grid_spacing();
void test_grid_animated();
-
+ void test_propertychanges();
void test_repeater();
private:
QmlView *createView(const QString &filename);
@@ -75,8 +77,6 @@ void tst_QmlGraphicsPositioners::test_horizontal()
{
QmlView *canvas = createView(SRCDIR "/data/horizontal.qml");
- canvas->execute();
-
QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
@@ -98,8 +98,6 @@ void tst_QmlGraphicsPositioners::test_horizontal_spacing()
{
QmlView *canvas = createView(SRCDIR "/data/horizontal-spacing.qml");
- canvas->execute();
-
QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
@@ -121,8 +119,6 @@ void tst_QmlGraphicsPositioners::test_horizontal_animated()
{
QmlView *canvas = createView(SRCDIR "/data/horizontal-animated.qml");
- canvas->execute();
-
QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
@@ -163,8 +159,6 @@ void tst_QmlGraphicsPositioners::test_vertical()
{
QmlView *canvas = createView(SRCDIR "/data/vertical.qml");
- canvas->execute();
-
QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
@@ -186,8 +180,6 @@ void tst_QmlGraphicsPositioners::test_vertical_spacing()
{
QmlView *canvas = createView(SRCDIR "/data/vertical-spacing.qml");
- canvas->execute();
-
QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
@@ -209,8 +201,6 @@ void tst_QmlGraphicsPositioners::test_vertical_animated()
{
QmlView *canvas = createView(SRCDIR "/data/vertical-animated.qml");
- canvas->execute();
-
//Note that they animate in
QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
@@ -251,8 +241,6 @@ void tst_QmlGraphicsPositioners::test_grid()
{
QmlView *canvas = createView("data/grid.qml");
- canvas->execute();
-
QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
@@ -280,8 +268,6 @@ void tst_QmlGraphicsPositioners::test_grid_spacing()
{
QmlView *canvas = createView("data/grid-spacing.qml");
- canvas->execute();
-
QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two");
@@ -308,7 +294,6 @@ void tst_QmlGraphicsPositioners::test_grid_spacing()
void tst_QmlGraphicsPositioners::test_grid_animated()
{
QmlView *canvas = createView(SRCDIR "/data/grid-animated.qml");
- canvas->execute();
//Note that all animate in
QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
@@ -378,13 +363,66 @@ void tst_QmlGraphicsPositioners::test_grid_animated()
QTRY_COMPARE(five->y(), 50.0);
}
+void tst_QmlGraphicsPositioners::test_propertychanges()
+{
+ QmlView *canvas = createView("data/propertychanges.qml");
+
+ QmlGraphicsGrid *grid = qobject_cast<QmlGraphicsGrid*>(canvas->rootObject());
+ QmlTransition *rowTransition = canvas->rootObject()->findChild<QmlTransition*>("rowTransition");
+ QmlTransition *columnTransition = canvas->rootObject()->findChild<QmlTransition*>("columnTransition");
+
+ QSignalSpy addSpy(grid, SIGNAL(addChanged()));
+ QSignalSpy moveSpy(grid, SIGNAL(moveChanged()));
+ QSignalSpy columnsSpy(grid, SIGNAL(columnsChanged()));
+ QSignalSpy rowsSpy(grid, SIGNAL(rowsChanged()));
+
+ QVERIFY(grid);
+ QVERIFY(rowTransition);
+ QVERIFY(columnTransition);
+ QCOMPARE(grid->add(), columnTransition);
+ QCOMPARE(grid->move(), columnTransition);
+ QCOMPARE(grid->columns(), 4);
+ QCOMPARE(grid->rows(), -1);
+
+ grid->setAdd(rowTransition);
+ grid->setMove(rowTransition);
+ QCOMPARE(grid->add(), rowTransition);
+ QCOMPARE(grid->move(), rowTransition);
+ QCOMPARE(addSpy.count(),1);
+ QCOMPARE(moveSpy.count(),1);
+
+ grid->setAdd(rowTransition);
+ grid->setMove(rowTransition);
+ QCOMPARE(addSpy.count(),1);
+ QCOMPARE(moveSpy.count(),1);
+
+ grid->setAdd(0);
+ grid->setMove(0);
+ QCOMPARE(addSpy.count(),2);
+ QCOMPARE(moveSpy.count(),2);
+
+ grid->setColumns(-1);
+ grid->setRows(3);
+ QCOMPARE(grid->columns(), -1);
+ QCOMPARE(grid->rows(), 3);
+ QCOMPARE(columnsSpy.count(),1);
+ QCOMPARE(rowsSpy.count(),1);
+
+ grid->setColumns(-1);
+ grid->setRows(3);
+ QCOMPARE(columnsSpy.count(),1);
+ QCOMPARE(rowsSpy.count(),1);
+
+ grid->setColumns(2);
+ grid->setRows(2);
+ QCOMPARE(columnsSpy.count(),2);
+ QCOMPARE(rowsSpy.count(),2);
+}
void tst_QmlGraphicsPositioners::test_repeater()
{
QmlView *canvas = createView("data/repeater.qml");
- canvas->execute();
-
QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one");
QVERIFY(one != 0);
diff --git a/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp b/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp
index c971840..9f3ff45 100644
--- a/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp
+++ b/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp
@@ -68,7 +68,7 @@ private slots:
void properties();
private:
- QmlView *createView(const QString &filename);
+ QmlView *createView();
template<typename T>
T *findItem(QGraphicsObject *parent, const QString &id);
};
@@ -164,14 +164,14 @@ tst_QmlGraphicsRepeater::tst_QmlGraphicsRepeater()
void tst_QmlGraphicsRepeater::numberModel()
{
- QmlView *canvas = createView(SRCDIR "/data/intmodel.qml");
+ QmlView *canvas = createView();
QmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testData", 5);
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/intmodel.qml"));
qApp->processEvents();
QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater");
@@ -186,7 +186,7 @@ void tst_QmlGraphicsRepeater::numberModel()
void tst_QmlGraphicsRepeater::objectList()
{
- QmlView *canvas = createView(SRCDIR "/data/objlist.qml");
+ QmlView *canvas = createView();
QObjectList data;
for(int i=0; i<100; i++){
@@ -197,7 +197,7 @@ void tst_QmlGraphicsRepeater::objectList()
QmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testData", QVariant::fromValue(data));
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/objlist.qml"));
qApp->processEvents();
QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater");
@@ -213,7 +213,7 @@ elements to test this.
*/
void tst_QmlGraphicsRepeater::stringList()
{
- QmlView *canvas = createView(SRCDIR "/data/repeater.qml");
+ QmlView *canvas = createView();
QStringList data;
data << "One";
@@ -224,7 +224,7 @@ void tst_QmlGraphicsRepeater::stringList()
QmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("testData", data);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/repeater.qml"));
qApp->processEvents();
QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater");
@@ -265,7 +265,7 @@ void tst_QmlGraphicsRepeater::stringList()
void tst_QmlGraphicsRepeater::dataModel()
{
- QmlView *canvas = createView(SRCDIR "/data/repeater2.qml");
+ QmlView *canvas = createView();
QmlContext *ctxt = canvas->rootContext();
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
@@ -277,7 +277,7 @@ void tst_QmlGraphicsRepeater::dataModel()
ctxt->setContextProperty("testData", &testModel);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/repeater2.qml"));
qApp->processEvents();
QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater");
@@ -297,12 +297,12 @@ void tst_QmlGraphicsRepeater::dataModel()
void tst_QmlGraphicsRepeater::itemModel()
{
- QmlView *canvas = createView(SRCDIR "/data/itemlist.qml");
+ QmlView *canvas = createView();
QmlContext *ctxt = canvas->rootContext();
TestObject *testObject = new TestObject;
ctxt->setContextProperty("testObject", testObject);
- canvas->execute();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/itemlist.qml"));
qApp->processEvents();
QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater");
@@ -354,13 +354,11 @@ void tst_QmlGraphicsRepeater::properties()
QCOMPARE(delegateSpy.count(),1);
}
-QmlView *tst_QmlGraphicsRepeater::createView(const QString &filename)
+QmlView *tst_QmlGraphicsRepeater::createView()
{
QmlView *canvas = new QmlView(0);
canvas->setFixedSize(240,320);
- canvas->setSource(QUrl::fromLocalFile(filename));
-
return canvas;
}
diff --git a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
index cc2f929..0d6ac77 100644
--- a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
+++ b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp
@@ -604,7 +604,6 @@ void tst_qmlgraphicstextedit::selection()
void tst_qmlgraphicstextedit::inputMethodHints()
{
QmlView *canvas = createView(SRCDIR "/data/inputmethodhints.qml");
- canvas->execute();
canvas->show();
canvas->setFocus();
@@ -619,7 +618,6 @@ void tst_qmlgraphicstextedit::inputMethodHints()
void tst_qmlgraphicstextedit::cursorDelegate()
{
QmlView* view = createView(SRCDIR "/data/cursorTest.qml");
- view->execute();
view->show();
view->setFocus();
QmlGraphicsTextEdit *textEditObject = view->rootObject()->findChild<QmlGraphicsTextEdit*>("textEditObject");
@@ -651,7 +649,6 @@ void tst_qmlgraphicstextedit::delegateLoading()
server.serveDirectory(SRCDIR "/data/http");
QmlView* view = new QmlView(0);
view->setSource(QUrl("http://localhost:42332/cursorHttpTestPass.qml"));
- view->execute();
view->show();
view->setFocus();
QTRY_VERIFY(view->rootObject());//Wait for loading to finish.
@@ -665,12 +662,10 @@ void tst_qmlgraphicstextedit::delegateLoading()
delegate = view->rootObject()->findChild<QmlGraphicsItem*>("delegateSlow");
QVERIFY(delegate);
view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail1.qml"));
- view->execute();
view->show();
view->setFocus();
QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test
view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail2.qml"));
- view->execute();
view->show();
view->setFocus();
QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test
@@ -688,7 +683,6 @@ the extent of the text, then they should ignore the keys.
void tst_qmlgraphicstextedit::navigation()
{
QmlView *canvas = createView(SRCDIR "/data/navigation.qml");
- canvas->execute();
canvas->show();
canvas->setFocus();
@@ -711,7 +705,6 @@ void tst_qmlgraphicstextedit::navigation()
void tst_qmlgraphicstextedit::readOnly()
{
QmlView *canvas = createView(SRCDIR "/data/readOnly.qml");
- canvas->execute();
canvas->show();
canvas->setFocus();
diff --git a/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp b/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp
index 8b45fc7..748cf5e 100644
--- a/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp
+++ b/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp
@@ -349,7 +349,6 @@ void tst_qmlgraphicstextinput::maxLength()
{
//QString componentStr = "import Qt 4.6\nTextInput { maximumLength: 10; }";
QmlView *canvas = createView(SRCDIR "/data/maxLength.qml");
- canvas->execute();
canvas->show();
canvas->setFocus();
QVERIFY(canvas->rootObject() != 0);
@@ -378,7 +377,6 @@ void tst_qmlgraphicstextinput::masks()
//Not a comprehensive test of the possible masks, that's done elsewhere (QLineEdit)
//QString componentStr = "import Qt 4.6\nTextInput { inputMask: 'HHHHhhhh'; }";
QmlView *canvas = createView(SRCDIR "/data/masks.qml");
- canvas->execute();
canvas->show();
canvas->setFocus();
QVERIFY(canvas->rootObject() != 0);
@@ -403,7 +401,6 @@ void tst_qmlgraphicstextinput::validators()
// here to ensure that their exposure to QML is working.
QmlView *canvas = createView(SRCDIR "/data/validators.qml");
- canvas->execute();
canvas->show();
canvas->setFocus();
@@ -493,7 +490,6 @@ void tst_qmlgraphicstextinput::validators()
void tst_qmlgraphicstextinput::inputMethodHints()
{
QmlView *canvas = createView(SRCDIR "/data/inputmethodhints.qml");
- canvas->execute();
canvas->show();
canvas->setFocus();
@@ -513,7 +509,6 @@ the extent of the text, then they should ignore the keys.
void tst_qmlgraphicstextinput::navigation()
{
QmlView *canvas = createView(SRCDIR "/data/navigation.qml");
- canvas->execute();
canvas->show();
canvas->setFocus();
@@ -546,7 +541,6 @@ void tst_qmlgraphicstextinput::navigation()
void tst_qmlgraphicstextinput::cursorDelegate()
{
QmlView* view = createView(SRCDIR "/data/cursorTest.qml");
- view->execute();
view->show();
view->setFocus();
QmlGraphicsTextInput *textInputObject = view->rootObject()->findChild<QmlGraphicsTextInput*>("textInputObject");
@@ -574,7 +568,6 @@ void tst_qmlgraphicstextinput::cursorDelegate()
void tst_qmlgraphicstextinput::readOnly()
{
QmlView *canvas = createView(SRCDIR "/data/readOnly.qml");
- canvas->execute();
canvas->show();
canvas->setFocus();
diff --git a/tests/auto/declarative/qmlgraphicswebview/data/propertychanges.qml b/tests/auto/declarative/qmlgraphicswebview/data/propertychanges.qml
new file mode 100644
index 0000000..3dd4e51
--- /dev/null
+++ b/tests/auto/declarative/qmlgraphicswebview/data/propertychanges.qml
@@ -0,0 +1,33 @@
+import Qt 4.6
+
+Item {
+ width: 240
+ height: 160
+ Grid {
+ anchors.fill: parent
+ objectName: "newWindowParent"
+ id: newWindowParent
+ }
+
+ Row {
+ anchors.fill: parent
+ id: oldWindowParent
+ objectName: "oldWindowParent"
+ }
+
+ Loader {
+ sourceComponent: webViewComponent
+ }
+ Component {
+ id: webViewComponent
+ WebView {
+ id: webView
+ objectName: "webView"
+ newWindowComponent: webViewComponent
+ newWindowParent: oldWindowParent
+ url: "basic.html"
+ renderingEnabled: true
+ pressGrabTime: 200
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp
index f3c39f8..5815e22 100644
--- a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp
+++ b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
#include <qtest.h>
+#include <QtTest/QSignalSpy>
#include "../../../shared/util.h"
#include <QtDeclarative/qmlengine.h>
#include <QtDeclarative/qmlcomponent.h>
@@ -69,6 +70,10 @@ private slots:
void javaScript();
void cleanupTestCase();
void pixelCache();
+ void newWindowParent();
+ void newWindowComponent();
+ void renderingEnabled();
+ void pressGrabTime();
private:
void checkNoErrors(const QmlComponent& component);
@@ -335,6 +340,10 @@ void tst_qmlgraphicswebview::setHtml()
QmlGraphicsWebView *wv = qobject_cast<QmlGraphicsWebView*>(component.create());
QVERIFY(wv != 0);
QCOMPARE(wv->html(),QString("<html><head></head><body><p>This is a <b>string</b> set on the WebView</p></body></html>"));
+
+ QSignalSpy spy(wv, SIGNAL(htmlChanged()));
+ wv->setHtml(QString("<html><head><title>Basic</title></head><body><p>text</p></body></html>"));
+ QCOMPARE(spy.count(),1);
}
void tst_qmlgraphicswebview::elementAreaAt()
@@ -391,6 +400,106 @@ void tst_qmlgraphicswebview::pixelCache()
QCOMPARE(wv->pixelsPainted(), expected*3); // repainted
}
+void tst_qmlgraphicswebview::newWindowParent()
+{
+ QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+ checkNoErrors(component);
+ QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(component.create());
+ QmlGraphicsWebView *wv = rootItem->findChild<QmlGraphicsWebView*>("webView");
+ QVERIFY(rootItem != 0);
+ QVERIFY(wv != 0);
+ QTRY_COMPARE(wv->progress(), 1.0);
+
+ QmlGraphicsItem* oldWindowParent = rootItem->findChild<QmlGraphicsItem*>("oldWindowParent");
+ QCOMPARE(wv->newWindowParent(), oldWindowParent);
+ QSignalSpy newWindowParentSpy(wv, SIGNAL(newWindowParentChanged()));
+
+ QmlGraphicsItem* newWindowParent = rootItem->findChild<QmlGraphicsItem*>("newWindowParent");
+ wv->setNewWindowParent(newWindowParent);
+ QVERIFY(oldWindowParent);
+ QVERIFY(oldWindowParent->childItems().count() == 0);
+ QCOMPARE(wv->newWindowParent(), newWindowParent);
+ QCOMPARE(newWindowParentSpy.count(),1);
+
+ wv->setNewWindowParent(newWindowParent);
+ QCOMPARE(newWindowParentSpy.count(),1);
+
+ wv->setNewWindowParent(0);
+ QCOMPARE(newWindowParentSpy.count(),2);
+}
+
+void tst_qmlgraphicswebview::newWindowComponent()
+{
+ QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+ checkNoErrors(component);
+ QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(component.create());
+ QmlGraphicsWebView *wv = rootItem->findChild<QmlGraphicsWebView*>("webView");
+ QVERIFY(rootItem != 0);
+ QVERIFY(wv != 0);
+ QTRY_COMPARE(wv->progress(), 1.0);
+
+ QmlComponent substituteComponent(&engine);
+ substituteComponent.setData("import Qt 4.6; WebView { objectName: 'newWebView'; url: 'basic.html'; }", QUrl::fromLocalFile(""));
+ QSignalSpy newWindowComponentSpy(wv, SIGNAL(newWindowComponentChanged()));
+
+ wv->setNewWindowComponent(&substituteComponent);
+ QCOMPARE(wv->newWindowComponent(), &substituteComponent);
+ QCOMPARE(newWindowComponentSpy.count(),1);
+
+ wv->setNewWindowComponent(&substituteComponent);
+ QCOMPARE(newWindowComponentSpy.count(),1);
+
+ wv->setNewWindowComponent(0);
+ QCOMPARE(newWindowComponentSpy.count(),2);
+}
+
+void tst_qmlgraphicswebview::renderingEnabled()
+{
+ QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+ checkNoErrors(component);
+ QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(component.create());
+ QmlGraphicsWebView *wv = rootItem->findChild<QmlGraphicsWebView*>("webView");
+ QVERIFY(rootItem != 0);
+ QVERIFY(wv != 0);
+ QTRY_COMPARE(wv->progress(), 1.0);
+
+ QVERIFY(wv->renderingEnabled());
+ QSignalSpy renderingEnabledSpy(wv, SIGNAL(renderingEnabledChanged()));
+
+ wv->setRenderingEnabled(false);
+ QVERIFY(!wv->renderingEnabled());
+ QCOMPARE(renderingEnabledSpy.count(),1);
+
+ wv->setRenderingEnabled(false);
+ QCOMPARE(renderingEnabledSpy.count(),1);
+
+ wv->setRenderingEnabled(true);
+ QCOMPARE(renderingEnabledSpy.count(),2);
+}
+
+void tst_qmlgraphicswebview::pressGrabTime()
+{
+ QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml"));
+ checkNoErrors(component);
+ QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(component.create());
+ QmlGraphicsWebView *wv = rootItem->findChild<QmlGraphicsWebView*>("webView");
+ QVERIFY(rootItem != 0);
+ QVERIFY(wv != 0);
+ QTRY_COMPARE(wv->progress(), 1.0);
+ QCOMPARE(wv->pressGrabTime(), 200);
+ QSignalSpy pressGrabTimeSpy(wv, SIGNAL(pressGrabTimeChanged()));
+
+ wv->setPressGrabTime(100);
+ QCOMPARE(wv->pressGrabTime(), 100);
+ QCOMPARE(pressGrabTimeSpy.count(),1);
+
+ wv->setPressGrabTime(100);
+ QCOMPARE(pressGrabTimeSpy.count(),1);
+
+ wv->setPressGrabTime(0);
+ QCOMPARE(pressGrabTimeSpy.count(),2);
+}
+
QTEST_MAIN(tst_qmlgraphicswebview)
#include "tst_qmlgraphicswebview.moc"
diff --git a/tests/auto/declarative/qmlvaluetypes/data/enums.1.qml b/tests/auto/declarative/qmlvaluetypes/data/enums.1.qml
new file mode 100644
index 0000000..0eadd50
--- /dev/null
+++ b/tests/auto/declarative/qmlvaluetypes/data/enums.1.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ font.capitalization: "MixedCase"
+}
+
diff --git a/tests/auto/declarative/qmlvaluetypes/data/enums.2.qml b/tests/auto/declarative/qmlvaluetypes/data/enums.2.qml
new file mode 100644
index 0000000..81f1c92
--- /dev/null
+++ b/tests/auto/declarative/qmlvaluetypes/data/enums.2.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ font.capitalization: if (1) "MixedCase"
+}
+
diff --git a/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp b/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp
index f99d3ce..4faa0bc 100644
--- a/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp
+++ b/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp
@@ -74,6 +74,7 @@ private slots:
void bindingVariantCopy();
void scriptVariantCopy();
void cppClasses();
+ void enums();
private:
QmlEngine engine;
@@ -583,6 +584,26 @@ void tst_qmlvaluetypes::cppClasses()
CPP_TEST(QmlFontValueType, QFont("Helvetica"));
}
+
+void tst_qmlvaluetypes::enums()
+{
+ {
+ QmlComponent component(&engine, TEST_FILE("enums.1.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->font().capitalization() == QFont::MixedCase);
+ delete object;
+ }
+
+ {
+ QmlComponent component(&engine, TEST_FILE("enums.2.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->font().capitalization() == QFont::MixedCase);
+ delete object;
+ }
+}
+
QTEST_MAIN(tst_qmlvaluetypes)
#include "tst_qmlvaluetypes.moc"
diff --git a/tests/auto/declarative/visual/Package_Views/packageviews.qml b/tests/auto/declarative/visual/Package_Views/packageviews.qml
index b577e45..cf3f9f7 100644
--- a/tests/auto/declarative/visual/Package_Views/packageviews.qml
+++ b/tests/auto/declarative/visual/Package_Views/packageviews.qml
@@ -64,7 +64,7 @@ Rectangle {
from: "*"; to: "*"
SequentialAnimation {
ParentAction{}
- NumberAnimation { properties: "x,y,width"; easing: "easeInOutQuad" }
+ NumberAnimation { properties: "x,y,width"; easing.type: "InOutQuad" }
}
}
]
diff --git a/tests/auto/declarative/visual/animation/easing/easing.qml b/tests/auto/declarative/visual/animation/easing/easing.qml
index 9c814eb..4248d88 100644
--- a/tests/auto/declarative/visual/animation/easing/easing.qml
+++ b/tests/auto/declarative/visual/animation/easing/easing.qml
@@ -9,127 +9,127 @@ Rectangle {
ListModel {
id: easingtypes
ListElement {
- type: "easeLinear"
+ type: "Linear"
}
ListElement {
- type: "easeInQuad"
+ type: "InQuad"
}
ListElement {
- type: "easeOutQuad"
+ type: "OutQuad"
}
ListElement {
- type: "easeInOutQuad"
+ type: "InOutQuad"
}
ListElement {
- type: "easeOutInQuad"
+ type: "OutInQuad"
}
ListElement {
- type: "easeInCubic"
+ type: "InCubic"
}
ListElement {
- type: "easeOutCubic"
+ type: "OutCubic"
}
ListElement {
- type: "easeInOutCubic"
+ type: "InOutCubic"
}
ListElement {
- type: "easeOutInCubic"
+ type: "OutInCubic"
}
ListElement {
- type: "easeInQuart"
+ type: "InQuart"
}
ListElement {
- type: "easeOutQuart"
+ type: "OutQuart"
}
ListElement {
- type: "easeInOutQuart"
+ type: "InOutQuart"
}
ListElement {
- type: "easeOutInQuart"
+ type: "OutInQuart"
}
ListElement {
- type: "easeInQuint"
+ type: "InQuint"
}
ListElement {
- type: "easeOutQuint"
+ type: "OutQuint"
}
ListElement {
- type: "easeInOutQuint"
+ type: "InOutQuint"
}
ListElement {
- type: "easeOutInQuint"
+ type: "OutInQuint"
}
ListElement {
- type: "easeInSine"
+ type: "InSine"
}
ListElement {
- type: "easeOutSine"
+ type: "OutSine"
}
ListElement {
- type: "easeInOutSine"
+ type: "InOutSine"
}
ListElement {
- type: "easeOutInSine"
+ type: "OutInSine"
}
ListElement {
- type: "easeInExpo"
+ type: "InExpo"
}
ListElement {
- type: "easeOutExpo"
+ type: "OutExpo"
}
ListElement {
- type: "easeInOutExpo"
+ type: "InOutExpo"
}
ListElement {
- type: "easeOutInExpo"
+ type: "OutInExpo"
}
ListElement {
- type: "easeInCirc"
+ type: "InCirc"
}
ListElement {
- type: "easeOutCirc"
+ type: "OutCirc"
}
ListElement {
- type: "easeInOutCirc"
+ type: "InOutCirc"
}
ListElement {
- type: "easeOutInCirc"
+ type: "OutInCirc"
}
ListElement {
- type: "easeInElastic"
+ type: "InElastic"
}
ListElement {
- type: "easeOutElastic"
+ type: "OutElastic"
}
ListElement {
- type: "easeInOutElastic"
+ type: "InOutElastic"
}
ListElement {
- type: "easeOutInElastic"
+ type: "OutInElastic"
}
ListElement {
- type: "easeInBack"
+ type: "InBack"
}
ListElement {
- type: "easeOutBack"
+ type: "OutBack"
}
ListElement {
- type: "easeInOutBack"
+ type: "InOutBack"
}
ListElement {
- type: "easeOutInBack"
+ type: "OutInBack"
}
ListElement {
- type: "easeOutBounce"
+ type: "OutBounce"
}
ListElement {
- type: "easeInBounce"
+ type: "InBounce"
}
ListElement {
- type: "easeInOutBounce"
+ type: "InOutBounce"
}
ListElement {
- type: "easeOutInBounce"
+ type: "OutInBounce"
}
}
]
@@ -177,7 +177,7 @@ Rectangle {
reversible: true
NumberAnimation {
properties: "x"
- easing: type
+ easing.type: type
duration: 1000
}
}
diff --git a/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml b/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml
index f2e065d..24ca76b 100644
--- a/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml
+++ b/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml
@@ -14,11 +14,11 @@ Rectangle {
repeat: true
NumberAnimation {
to: 0; duration: 500
- easing: "easeInOutQuad"
+ easing.type: "InOutQuad"
}
NumberAnimation {
to: 200-img.height
- easing: "easeOutBounce"
+ easing.type: "OutBounce"
duration: 2000
}
PauseAnimation {
diff --git a/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml b/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml
index 593f495..e18e770 100644
--- a/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml
+++ b/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml
@@ -28,7 +28,7 @@ Rectangle {
SequentialAnimation {
ColorAnimation {}
PropertyAction { properties: "x" }
- NumberAnimation { properties: "y"; easing: "InOutQuad" }
+ NumberAnimation { properties: "y"; easing.type: "InOutQuad" }
}
}
}
diff --git a/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml b/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml
index 30d587a..ef4ed76 100644
--- a/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml
+++ b/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml
@@ -27,9 +27,9 @@ Rectangle {
transitions: Transition {
SequentialAnimation {
- NumberAnimation { properties: "x"; easing: "InOutQuad" }
+ NumberAnimation { properties: "x"; easing.type: "InOutQuad" }
ScriptAction { stateChangeScriptName: "setColor" }
- NumberAnimation { properties: "y"; easing: "InOutQuad" }
+ NumberAnimation { properties: "y"; easing.type: "InOutQuad" }
}
}
}
diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml b/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml
index eb1ec00..e268ce7 100644
--- a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml
+++ b/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml
@@ -20,14 +20,14 @@ Item {
width: SequentialAnimation {
repeat: true
- NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing: "easeInOutQuad"}
- NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing: "easeInOutQuad" }
+ NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing.type: "InOutQuad"}
+ NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing.type: "InOutQuad" }
}
height: SequentialAnimation {
repeat: true
- NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing: "easeInOutQuad"}
- NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing: "easeInOutQuad" }
+ NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing.type: "InOutQuad"}
+ NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing.type: "InOutQuad" }
}
border.top: container.margin
diff --git a/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml b/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml
index c33a319..a27aa6e 100644
--- a/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml
+++ b/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml
@@ -36,7 +36,7 @@ Rectangle {
}
transitions: Transition {
- NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 3000 }
+ NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 3000 }
}
}
@@ -64,7 +64,7 @@ Rectangle {
}
transitions: Transition {
- NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 3000 }
+ NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 3000 }
}
}
diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml b/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml
index e0c5db4..176a5b8 100644
--- a/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml
+++ b/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml
@@ -11,8 +11,8 @@ import Qt 4.6
Rectangle { id:bottom; color: "black"; width: 3; height: 1; x: -1; anchors.bottom: parent.bottom;}
opacity: 1
opacity: SequentialAnimation { running: cPage.parent.focus == true; repeat: true;
- NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing: "easeInQuad"}
- NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing: "easeOutQuad"}
+ NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing.type: "InQuad"}
+ NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing.type: "OutQuad"}
}
}
width: 1;
diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml b/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml
index 0038664..6a4e7fa 100644
--- a/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml
+++ b/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml
@@ -11,8 +11,8 @@ import Qt 4.6
Rectangle { id:bottom; color: "black"; width: 3; height: 1; x: -1; anchors.bottom: parent.bottom;}
opacity: 1
opacity: SequentialAnimation { running: cPage.parent.focus == true; repeat: true;
- NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing: "easeInQuad"}
- NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing: "easeOutQuad"}
+ NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing.type: "InQuad"}
+ NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing.type: "OutQuad"}
}
}
width: 1;
diff --git a/tests/auto/declarative/visual/qmlspringfollow/follow.qml b/tests/auto/declarative/visual/qmlspringfollow/follow.qml
index a85a778..62503e4 100644
--- a/tests/auto/declarative/visual/qmlspringfollow/follow.qml
+++ b/tests/auto/declarative/visual/qmlspringfollow/follow.qml
@@ -11,11 +11,11 @@ Rectangle {
repeat: true
NumberAnimation {
to: 20; duration: 500
- easing: "easeInOutQuad"
+ easing.type: "InOutQuad"
}
NumberAnimation {
to: 200; duration: 2000
- easing: "easeOutBounce"
+ easing.type: "OutBounce"
}
PauseAnimation { duration: 1000 }
}
diff --git a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp
index 12ddff1..abb4014 100644
--- a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp
+++ b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp
@@ -69,6 +69,10 @@ private slots:
void valueForProgress();
void setCustomType();
void operators();
+ void dataStreamOperators_data();
+ void dataStreamOperators();
+ void properties();
+ void metaTypes();
protected:
};
@@ -505,6 +509,117 @@ void tst_QEasingCurve::operators()
QVERIFY(curve2 == curve);
}
+void tst_QEasingCurve::dataStreamOperators_data()
+{
+ QTest::addColumn<int>("type");
+ QTest::addColumn<qreal>("amplitude");
+ QTest::addColumn<qreal>("overshoot");
+ QTest::addColumn<qreal>("period");
+ QTest::addColumn<QEasingCurve>("easingCurve");
+ QTest::newRow("Linear") << int(QEasingCurve::Linear) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::Linear);
+ QTest::newRow("OutCubic") << int(QEasingCurve::OutCubic) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::OutCubic);
+ QTest::newRow("InOutSine") << int(QEasingCurve::InOutSine) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::InOutSine);
+ QEasingCurve inOutElastic(QEasingCurve::InOutElastic);
+ inOutElastic.setPeriod(1.5);
+ inOutElastic.setAmplitude(2.0);
+ QTest::newRow("InOutElastic") << int(QEasingCurve::InOutElastic) << 2.0 << -1.0 << 1.5 << inOutElastic;
+ QTest::newRow("OutInBack") << int(QEasingCurve::OutInBack) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::OutInBack);
+ QTest::newRow("OutCurve") << int(QEasingCurve::OutCurve) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::OutCurve);
+ QEasingCurve inOutBack(QEasingCurve::InOutBack);
+ inOutBack.setOvershoot(0.5);
+ QTest::newRow("InOutBack") << int(QEasingCurve::InOutBack) << -1.0 << 0.5 << -1.0 << inOutBack;
+}
+
+void tst_QEasingCurve::dataStreamOperators()
+{
+ QFETCH(int, type);
+ QFETCH(qreal, amplitude);
+ QFETCH(qreal, overshoot);
+ QFETCH(qreal, period);
+ QFETCH(QEasingCurve, easingCurve);
+
+ // operator <<
+ QEasingCurve curve;
+ curve.setType(QEasingCurve::Type(type));
+ if (amplitude != -1.0)
+ curve.setAmplitude(amplitude);
+ if (overshoot != -1.0)
+ curve.setOvershoot(overshoot);
+ if (period != -1.0)
+ curve.setPeriod(period);
+
+ QVERIFY(easingCurve == curve);
+
+ QByteArray array;
+ QDataStream out(&array, QIODevice::WriteOnly);
+ out << curve;
+
+ QDataStream in(array);
+ QEasingCurve curve2;
+ in >> curve2;
+
+ QVERIFY(curve2 == curve);
+}
+
+class tst_QEasingProperties : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing)
+public:
+ tst_QEasingProperties(QObject *parent = 0) : QObject(parent) {}
+
+ QEasingCurve easing() const { return e; }
+ void setEasing(const QEasingCurve& value) { e = value; }
+
+private:
+ QEasingCurve e;
+};
+
+// Test getting and setting easing properties via the metaobject system.
+void tst_QEasingCurve::properties()
+{
+ tst_QEasingProperties obj;
+
+ QEasingCurve inOutBack(QEasingCurve::InOutBack);
+ qreal overshoot = 1.5f;
+ inOutBack.setOvershoot(overshoot);
+ qreal amplitude = inOutBack.amplitude();
+ qreal period = inOutBack.period();
+
+ obj.setEasing(inOutBack);
+
+ QEasingCurve easing = qVariantValue<QEasingCurve>(obj.property("easing"));
+ QCOMPARE(easing.type(), QEasingCurve::InOutBack);
+ QCOMPARE(easing.overshoot(), overshoot);
+ QCOMPARE(easing.amplitude(), amplitude);
+ QCOMPARE(easing.period(), period);
+
+ QEasingCurve linear(QEasingCurve::Linear);
+ overshoot = linear.overshoot();
+ amplitude = linear.amplitude();
+ period = linear.period();
+
+ obj.setProperty("easing",
+ qVariantFromValue(QEasingCurve(QEasingCurve::Linear)));
+
+ easing = qVariantValue<QEasingCurve>(obj.property("easing"));
+ QCOMPARE(easing.type(), QEasingCurve::Linear);
+ QCOMPARE(easing.overshoot(), overshoot);
+ QCOMPARE(easing.amplitude(), amplitude);
+ QCOMPARE(easing.period(), period);
+}
+
+void tst_QEasingCurve::metaTypes()
+{
+ QVERIFY(QMetaType::type("QEasingCurve") == QMetaType::QEasingCurve);
+
+ QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QEasingCurve)),
+ QByteArray("QEasingCurve"));
+
+ QVERIFY(QMetaType::isRegistered(QMetaType::QEasingCurve));
+
+ QVERIFY(qMetaTypeId<QEasingCurve>() == QMetaType::QEasingCurve);
+}
QTEST_MAIN(tst_QEasingCurve)
#include "tst_qeasingcurve.moc"
diff --git a/tests/benchmarks/declarative/binding/binding.pro b/tests/benchmarks/declarative/binding/binding.pro
index e25f186..aa4cc41 100644
--- a/tests/benchmarks/declarative/binding/binding.pro
+++ b/tests/benchmarks/declarative/binding/binding.pro
@@ -7,3 +7,9 @@ macx:CONFIG -= app_bundle
SOURCES += tst_binding.cpp testtypes.cpp
HEADERS += testtypes.h
+symbian* {
+ data.sources = data/*
+ data.path = data
+ DEPLOYMENT = data
+}
+
diff --git a/tests/benchmarks/declarative/creation/creation.pro b/tests/benchmarks/declarative/creation/creation.pro
index fcc2987..3e0caf6 100644
--- a/tests/benchmarks/declarative/creation/creation.pro
+++ b/tests/benchmarks/declarative/creation/creation.pro
@@ -6,5 +6,10 @@ macx:CONFIG -= app_bundle
SOURCES += tst_creation.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
+symbian* {
+ data.sources = data/*
+ data.path = data
+ DEPLOYMENT += addFiles
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+} \ No newline at end of file
diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp
index 23c820c..b99031a 100644
--- a/tests/benchmarks/declarative/creation/tst_creation.cpp
+++ b/tests/benchmarks/declarative/creation/tst_creation.cpp
@@ -49,6 +49,12 @@
#include <QmlGraphicsItem>
#include <private/qobject_p.h>
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+// Application private dir is default serach path for files, so SRCDIR can be set to empty
+#define SRCDIR ""
+#endif
+
class tst_creation : public QObject
{
Q_OBJECT
diff --git a/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro b/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro
index 6a86f58..a77eebb 100644
--- a/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro
+++ b/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro
@@ -7,3 +7,13 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qmlcomponent.cpp testtypes.cpp
HEADERS += testtypes.h
+symbian* {
+ data.sources = data/*
+ data.path = data
+ samegame.sources = data/samegame/*
+ samegame.path = data/samegame
+ samegame_pics.sources = data/samegame/pics/*
+ samegame_pics.path = data/samegame/pics
+ DEPLOYMENT += data samegame samegame_pics
+}
+
diff --git a/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro b/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro
index 449d874..f14931c 100644
--- a/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro
+++ b/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro
@@ -7,5 +7,10 @@ CONFIG += release
SOURCES += tst_qmlgraphicsimage.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
+symbian* {
+ data.sources = image.png
+ data.path = .
+ DEPLOYMENT += data
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
diff --git a/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp b/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp
index 7d7d24e..6d1aa0e 100644
--- a/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp
+++ b/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp
@@ -44,6 +44,12 @@
#include <QmlComponent>
#include <private/qmlgraphicsimage_p.h>
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+// Application private dir is default serach path for files, so SRCDIR can be set to empty
+#define SRCDIR ""
+#endif
+
class tst_qmlgraphicsimage : public QObject
{
Q_OBJECT
diff --git a/tests/benchmarks/declarative/qmltime/qmltime.cpp b/tests/benchmarks/declarative/qmltime/qmltime.cpp
index 2cc5d0d..8e312be 100644
--- a/tests/benchmarks/declarative/qmltime/qmltime.cpp
+++ b/tests/benchmarks/declarative/qmltime/qmltime.cpp
@@ -183,7 +183,11 @@ int main(int argc, char ** argv)
}
if (filename.isEmpty())
+#ifdef Q_OS_SYMBIAN
+ filename = QLatin1String("./tests/item_creation/data.qml");
+#else
usage(argv[0]);
+#endif
QmlEngine engine;
QmlComponent component(&engine, filename);
@@ -204,6 +208,9 @@ int main(int argc, char ** argv)
return -1;
}
+#ifdef Q_OS_SYMBIAN
+ willParent = true;
+#endif
timer->setWillParent(willParent);
if (!timer->component()) {
@@ -211,6 +218,10 @@ int main(int argc, char ** argv)
return -1;
}
+#ifdef Q_OS_SYMBIAN
+ iterations = 1024;
+#endif
+
timer->run(iterations);
return 0;
diff --git a/tests/benchmarks/declarative/qmltime/qmltime.pro b/tests/benchmarks/declarative/qmltime/qmltime.pro
index b077d1a..9352f3b 100644
--- a/tests/benchmarks/declarative/qmltime/qmltime.pro
+++ b/tests/benchmarks/declarative/qmltime/qmltime.pro
@@ -6,3 +6,18 @@ macx:CONFIG -= app_bundle
SOURCES += qmltime.cpp
+symbian* {
+ TARGET.CAPABILITY = "All -TCB"
+ example.sources = example.qml
+ esample.path = .
+ tests.sources = tests/*
+ tests.path = tests
+ anshors.sources = tests/anchors/*
+ anchors.path = tests/anchors
+ item_creation.sources = tests/item_creation/*
+ item_creation.path = tests/item_creation
+ positioner_creation.sources = tests/positioner_creation/*
+ positioner_creation.path = tests/positioner_creation
+ DEPLOYMENT += example tests anchors item_creation positioner_creation
+}
+
diff --git a/tests/benchmarks/declarative/script/script.pro b/tests/benchmarks/declarative/script/script.pro
index 48fea81..6255acc 100644
--- a/tests/benchmarks/declarative/script/script.pro
+++ b/tests/benchmarks/declarative/script/script.pro
@@ -7,5 +7,14 @@ CONFIG += release
SOURCES += tst_script.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+symbian* {
+ data.sources = data/*
+ data.path = data
+ DEPLOYMENT += data
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
+
+
+
diff --git a/tests/benchmarks/declarative/script/tst_script.cpp b/tests/benchmarks/declarative/script/tst_script.cpp
index dd21997..15902e4 100644
--- a/tests/benchmarks/declarative/script/tst_script.cpp
+++ b/tests/benchmarks/declarative/script/tst_script.cpp
@@ -48,6 +48,12 @@
#include <QScriptEngine>
#include <QScriptValue>
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+// Application private dir is default serach path for files, so SRCDIR can be set to empty
+#define SRCDIR "."
+#endif
+
class tst_script : public QObject
{
Q_OBJECT
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp
index 626e4c4..f881cd7 100644
--- a/tools/qmlviewer/qmlviewer.cpp
+++ b/tools/qmlviewer/qmlviewer.cpp
@@ -1063,11 +1063,11 @@ void QmlViewer::openQml(const QString& file_or_url)
}
}
- canvas->setSource(url);
-
QTime t;
t.start();
- canvas->execute();
+
+ canvas->setSource(url);
+
qWarning() << "Wall startup time:" << t.elapsed();
if (!skin) {
diff --git a/tools/qmlviewer/qmlviewer.pro b/tools/qmlviewer/qmlviewer.pro
index aba3cf5..2da244c 100644
--- a/tools/qmlviewer/qmlviewer.pro
+++ b/tools/qmlviewer/qmlviewer.pro
@@ -54,5 +54,5 @@ symbian {
TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h
LIBS += -lesock -lconnmon -linsock
- TARGET.CAPABILITY = NetworkServices
+ TARGET.CAPABILITY = "All -TCB"
}