summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-03-03 23:39:52 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-03-03 23:39:52 (GMT)
commit651f4336392f86cb5820e3e3cccdc56ec3a0efe8 (patch)
tree4435c8348f40a4a2be184063cc5a5197f61a650e
parentf53ac4f7617bfdefcb62e9b27ee6bf1a91a7ed13 (diff)
parent5ac068602871b78eb4b58634d58e6b8898acbf8d (diff)
downloadQt-651f4336392f86cb5820e3e3cccdc56ec3a0efe8.zip
Qt-651f4336392f86cb5820e3e3cccdc56ec3a0efe8.tar.gz
Qt-651f4336392f86cb5820e3e3cccdc56ec3a0efe8.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
-rw-r--r--doc/src/declarative/tutorial.qdoc6
-rw-r--r--examples/declarative/colorbrowser/colorbrowser.qml101
-rw-r--r--examples/declarative/colorbrowser/dummydata/ColorsModel.qml96
-rw-r--r--examples/declarative/colorbrowser/qml/ColorDelegate.qml114
-rw-r--r--examples/declarative/colorbrowser/qml/box-shadow.pngbin0 -> 871 bytes
-rw-r--r--examples/declarative/colorbrowser/qml/box.pngbin0 -> 765 bytes
-rw-r--r--examples/declarative/dynamic/qml/Sun.qml8
-rw-r--r--examples/declarative/imageprovider/imageprovider.qml2
-rw-r--r--examples/declarative/layouts/layouts.qml2
-rw-r--r--examples/declarative/package/Delegate.qml2
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp10
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp62
-rw-r--r--src/declarative/qml/qdeclarativecompiler_p.h2
-rw-r--r--src/declarative/qml/qdeclarativecontext.cpp4
-rw-r--r--src/declarative/qml/qdeclarativecontextscriptclass.cpp30
-rw-r--r--src/declarative/qml/qdeclarativecontextscriptclass_p.h1
-rw-r--r--src/declarative/qml/qdeclarativedeclarativedata_p.h5
-rw-r--r--src/declarative/qml/qdeclarativedom.cpp8
-rw-r--r--src/declarative/qml/qdeclarativeexpression.cpp46
-rw-r--r--src/declarative/qml/qdeclarativeexpression_p.h5
-rw-r--r--src/declarative/qml/qdeclarativeglobalscriptclass.cpp15
-rw-r--r--src/declarative/qml/qdeclarativeglobalscriptclass_p.h7
-rw-r--r--src/declarative/qml/qdeclarativeproperty.cpp11
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp18
-rw-r--r--src/declarative/util/qdeclarativebehavior.cpp6
-rw-r--r--src/declarative/util/qdeclarativebind.cpp15
-rw-r--r--src/declarative/util/qdeclarativeeasefollow.cpp34
-rw-r--r--src/declarative/util/qdeclarativespringfollow.cpp6
-rw-r--r--src/imports/webkit/plugin.cpp1
-rw-r--r--src/imports/webkit/qdeclarativewebview.cpp2
-rw-r--r--src/imports/webkit/qdeclarativewebview_p.h5
-rw-r--r--src/imports/webkit/qdeclarativewebview_p_p.h4
-rw-r--r--src/multimedia/base/qmediaserviceprovider.cpp14
-rw-r--r--src/multimedia/qml/qsoundeffect_qsound_p.cpp2
-rw-r--r--src/multimedia/qml/wavedecoder_p.cpp2
-rw-r--r--src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp133
-rw-r--r--src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h7
-rw-r--r--src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp124
-rw-r--r--src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml13
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp14
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/testtypes.h10
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp11
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp1
-rw-r--r--tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/data/TestType.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml9
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp37
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp3
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp6
-rwxr-xr-xtests/auto/declarative/runall.sh81
-rw-r--r--tests/auto/qmediaservice/tst_qmediaservice.cpp8
68 files changed, 925 insertions, 243 deletions
diff --git a/doc/src/declarative/tutorial.qdoc b/doc/src/declarative/tutorial.qdoc
index 98efe12..310b776 100644
--- a/doc/src/declarative/tutorial.qdoc
+++ b/doc/src/declarative/tutorial.qdoc
@@ -173,10 +173,10 @@ In this case the rectangle will have the same size as its parent (see \l{anchor-
\snippet examples/declarative/tutorials/helloworld/Cell.qml 3
-In order to change the color of the text when clicking on a cell, we create a \l MouseRegion element with
+In order to change the color of the text when clicking on a cell, we create a \l MouseArea element with
the same size as its parent.
-A \l MouseRegion defines a signal called \e clicked.
+A \l MouseArea defines a signal called \e clicked.
When this signal is triggered we want to emit our own \e clicked signal with the color as parameter.
\section2 The main QML file
@@ -214,7 +214,7 @@ Here is the QML code:
\snippet examples/declarative/tutorials/helloworld/tutorial3.qml 2
First, we create a new \e down state for our text element.
-This state will be activated when the \l MouseRegion is pressed, and deactivated when it is released.
+This state will be activated when the \l MouseArea is pressed, and deactivated when it is released.
The \e down state includes a set of property changes from our implicit \e {default state}
(the items as they were initially defined in the QML).
diff --git a/examples/declarative/colorbrowser/colorbrowser.qml b/examples/declarative/colorbrowser/colorbrowser.qml
new file mode 100644
index 0000000..421ae07
--- /dev/null
+++ b/examples/declarative/colorbrowser/colorbrowser.qml
@@ -0,0 +1,101 @@
+import Qt 4.6
+import 'qml'
+
+Rectangle {
+ id: mainWindow
+ width: 800; height: 480; color: '#454545'
+
+ VisualDataModel { id: colorsVisualModel; delegate: colorsDelegate; model: ColorsModel }
+
+ Component {
+ id: colorsDelegate
+ Package {
+
+ Item {
+ Package.name: 'grid'
+ GridView {
+ id: gridView; model: visualModel.parts.grid; width: mainWindow.width; height: mainWindow.height
+ cellWidth: 160; cellHeight: 160; interactive: false
+ onCurrentIndexChanged: listView.positionViewAtIndex(currentIndex)
+ }
+ }
+
+ Item {
+ Package.name: 'fullscreen'
+ ListView {
+ id: listView; model: visualModel.parts.list; orientation: Qt.Horizontal
+ width: mainWindow.width; height: mainWindow.height; interactive: false
+ onCurrentIndexChanged: gridView.positionViewAtIndex(currentIndex)
+ highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem
+ }
+ }
+
+ Item {
+ Package.name: 'stack'
+ id: wrapper
+ width: 260; height: 240
+
+ VisualDataModel { id: visualModel; model: colors; delegate: ColorDelegate {} }
+
+ PathView {
+ id: pathView; model: visualModel.parts.stack; anchors.centerIn: parent
+ pathItemCount: 3
+ path: Path {
+ PathAttribute { name: 'z'; value: 9999.0 }
+ PathLine { x: 1; y: 1 }
+ PathAttribute { name: 'z'; value: 0.0 }
+ }
+ }
+
+ Item {
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom; anchors.bottomMargin: 20
+ width: albumTitle.width + 20 ; height: albumTitle.height + 4
+ Text { id: albumTitle; text: name; color: 'white'; font.bold: true; anchors.centerIn: parent }
+ }
+
+ MouseArea { anchors.fill: parent; onClicked: wrapper.state = 'inGrid' }
+
+ states: [
+ State {
+ name: 'inGrid'
+ PropertyChanges { target: gridView; interactive: true }
+ PropertyChanges { target: shade; opacity: 1 }
+ },
+ State {
+ name: 'fullscreen'; extend: 'inGrid'
+ PropertyChanges { target: gridView; interactive: false }
+ PropertyChanges { target: listView; interactive: true }
+ PropertyChanges { target: infobox; opacity: 1 }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: ''; to: 'inGrid'; reversible: true
+ NumberAnimation { target: shade; properties: 'opacity'; duration: 300 }
+ },
+ Transition {
+ from: 'inGrid'; to: 'fullscreen'; reversible: true
+ SequentialAnimation {
+ PauseAnimation { duration: 300 }
+ NumberAnimation { target: infobox; properties: 'opacity'; duration: 300 }
+ }
+ }
+ ]
+ }
+ }
+ }
+
+ GridView { width: parent.width; height: parent.height; cellWidth: 260; cellHeight: 240; model: colorsVisualModel.parts.stack }
+ Rectangle { id: shade; color: '#454545'; width: parent.width; height: parent.height; opacity: 0 }
+ ListView { anchors.fill: parent; model: colorsVisualModel.parts.grid; interactive: false }
+ ListView { anchors.fill: parent; model: colorsVisualModel.parts.fullscreen; interactive: false }
+ Item { id: foreground; anchors.fill: parent }
+
+ Column {
+ id: infobox; opacity: 0
+ anchors { left: parent.left; leftMargin: 20; bottom: parent.bottom; bottomMargin: 20 }
+ Text { id: infoColorName; color: '#eeeeee'; style: Text.Outline; styleColor: '#222222'; font.pointSize: 18 }
+ Text { id: infoColorHex; color: '#eeeeee'; style: Text.Outline; styleColor: '#222222'; font.pointSize: 14 }
+ }
+}
diff --git a/examples/declarative/colorbrowser/dummydata/ColorsModel.qml b/examples/declarative/colorbrowser/dummydata/ColorsModel.qml
new file mode 100644
index 0000000..eefbcfe
--- /dev/null
+++ b/examples/declarative/colorbrowser/dummydata/ColorsModel.qml
@@ -0,0 +1,96 @@
+import Qt 4.6
+
+ListModel {
+ id: colorsModel
+
+ ListElement {
+ name: "Reds"
+ colors: [
+ ListElement { name: "Fire Brick"; hex: "#B22222" },
+ ListElement { name: "Fire Brick 1"; hex: "#FF3030" },
+ ListElement { name: "Fire Brick 2"; hex: "#EE2C2C" },
+ ListElement { name: "Fire Brick 3"; hex: "#CD2626" },
+ ListElement { name: "Fire Brick 4"; hex: "#8B1A1A" },
+ ListElement { name: "Red"; hex: "#FF0000" },
+ ListElement { name: "Red 2"; hex: "#EE0000" },
+ ListElement { name: "Red 3"; hex: "#CD0000" },
+ ListElement { name: "Red 4"; hex: "#8B0000" },
+ ListElement { name: "Tomato"; hex: "#FF6347" },
+ ListElement { name: "Tomato 2"; hex: "#EE5C42" },
+ ListElement { name: "Tomato 3"; hex: "#CD4F39" },
+ ListElement { name: "Tomato 4"; hex: "#8B3626" },
+ ListElement { name: "Orange Red"; hex: "#FF4500" },
+ ListElement { name: "Orange Red 2"; hex: "#EE4000" },
+ ListElement { name: "Orange Red 3"; hex: "#CD3700" },
+ ListElement { name: "Orange Red 4"; hex: "#8B2500" },
+ ListElement { name: "Indian Red 2"; hex: "#EE6363" },
+ ListElement { name: "Indian Red 3"; hex: "#CD5555" },
+ ListElement { name: "Indian Red 4"; hex: "#8B3A3A" },
+ ListElement { name: "Brown"; hex: "#A52A2A" },
+ ListElement { name: "Brown 1"; hex: "#FF4040" },
+ ListElement { name: "Brown 2"; hex: "#EE3B3B" },
+ ListElement { name: "Brown 3"; hex: "#CD3333" },
+ ListElement { name: "Brown 4"; hex: "#8B2323" }
+ ]
+ }
+ ListElement {
+ name: "Greens"
+ colors: [
+ ListElement { name: "Green"; hex: "#008000" },
+ ListElement { name: "Green 2"; hex: "#00EE00" },
+ ListElement { name: "Green 3"; hex: "#00CD00" },
+ ListElement { name: "Green 4"; hex: "#008B00" },
+ ListElement { name: "Dark Green"; hex: "#006400" },
+ ListElement { name: "Sap Green"; hex: "#308014" },
+ ListElement { name: "Medium Spring Green"; hex: "#00FA9A" },
+ ListElement { name: "Spring Green"; hex: "#00FF7F" },
+ ListElement { name: "Spring Green 1"; hex: "#00EE76" },
+ ListElement { name: "Spring Green 2"; hex: "#00CD66" },
+ ListElement { name: "Spring Green 3"; hex: "#008B45" },
+ ListElement { name: "Medium Sea Green"; hex: "#3CB371" },
+ ListElement { name: "Sea Green 1"; hex: "#54FF9F" },
+ ListElement { name: "Sea Green 2"; hex: "#4EEE94" },
+ ListElement { name: "Sea Green 3"; hex: "#43CD80" },
+ ListElement { name: "Sea Green 4"; hex: "#2E8B57" },
+ ListElement { name: "Emerald Green"; hex: "#00C957" },
+ ListElement { name: "Mint"; hex: "#BDFCC9" },
+ ListElement { name: "Cobalt Green"; hex: "#3D9140" },
+ ListElement { name: "Dark Sea Green"; hex: "#8FBC8F" },
+ ListElement { name: "Dark Sea Green 1"; hex: "#C1FFC1" },
+ ListElement { name: "Dark Sea Green 2"; hex: "#B4EEB4" },
+ ListElement { name: "Dark Sea Green 3"; hex: "#9BCD9B" },
+ ListElement { name: "Dark Sea Green 4"; hex: "#698B69" },
+ ListElement { name: "Lime Green"; hex: "#00FF00" }
+ ]
+ }
+ ListElement {
+ name: "Blues"
+ colors: [
+ ListElement { name: "Dark Slate Blue"; hex: "#483D8B" },
+ ListElement { name: "Light Slate Blue"; hex: "#8470FF" },
+ ListElement { name: "Medium Slate Blue"; hex: "#7B68EE" },
+ ListElement { name: "Slate Blue"; hex: "#6A5ACD" },
+ ListElement { name: "Blue"; hex: "#0000FF" },
+ ListElement { name: "Midnight Blue"; hex: "#191970" },
+ ListElement { name: "Cobalt"; hex: "#3D59AB" },
+ ListElement { name: "Royal Blue"; hex: "#4169E1" },
+ ListElement { name: "Corn Flower Blue"; hex: "#6495ED" },
+ ListElement { name: "Light Steel Blue"; hex: "#B0C4DE" },
+ ListElement { name: "Light Steel Blue 1"; hex: "#CAE1FF" },
+ ListElement { name: "Light Steel Blue 2"; hex: "#BCD2EE" },
+ ListElement { name: "Light Steel Blue 3"; hex: "#A2B5CD" },
+ ListElement { name: "Dodger Blue"; hex: "#1E90FF" },
+ ListElement { name: "Dodger Blue 2"; hex: "#1C86EE" },
+ ListElement { name: "Dodger Blue 3"; hex: "#1874CD" },
+ ListElement { name: "Dodger Blue 4"; hex: "#104E8B" },
+ ListElement { name: "Steel Blue"; hex: "#4682B4" },
+ ListElement { name: "Light Sky Blue"; hex: "#87CEFA" },
+ ListElement { name: "Sky Blue"; hex: "#87CEEB" },
+ ListElement { name: "Peacock"; hex: "#33A1C9" },
+ ListElement { name: "Light Blue"; hex: "#ADD8E6" },
+ ListElement { name: "Powder Blue"; hex: "#B0E0E6" },
+ ListElement { name: "Cadet Blue"; hex: "#5F9EA0" },
+ ListElement { name: "Cyan"; hex: "#00FFFF" }
+ ]
+ }
+}
diff --git a/examples/declarative/colorbrowser/qml/ColorDelegate.qml b/examples/declarative/colorbrowser/qml/ColorDelegate.qml
new file mode 100644
index 0000000..c123d12
--- /dev/null
+++ b/examples/declarative/colorbrowser/qml/ColorDelegate.qml
@@ -0,0 +1,114 @@
+import Qt 4.6
+
+Package {
+ Item { id: stack; Package.name: 'stack'; width: 110; height: 110; z: stack.PathView.z }
+ Item { id: list; Package.name: 'list'; width: mainWindow.width + 4; height: 110 }
+ Item { id: grid; Package.name: 'grid'; width: 110; height: 110 }
+
+ Item {
+ id: delegate
+
+ property double randomAngle: Math.random() * (2 * 8 + 1) - 8
+ property bool open: false
+
+ width: 110; height: 110; z: stack.PathView.z
+
+ Image { x: -6; y: -5; source: 'box-shadow.png'; smooth: true; }
+ Rectangle { color: hex; anchors.fill: parent; smooth: true }
+ Image { id: box; source: 'box.png'; smooth: true; anchors.fill: parent }
+
+ Binding {
+ target: infoColorName; property: 'text'
+ value: name; when: delegate.open && list.ListView.isCurrentItem
+ }
+
+ Binding {
+ target: infoColorHex; property: 'text'
+ value: hex; when: delegate.open && list.ListView.isCurrentItem
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.RightButton | Qt.LeftButton
+ onClicked: {
+ if (wrapper.state == 'inGrid' && mouse.button == Qt.RightButton) {
+ wrapper.state = ''
+ } else if (wrapper.state == 'inGrid') {
+ grid.GridView.view.currentIndex = index;
+ wrapper.state = 'fullscreen'
+ } else {
+ grid.GridView.view.currentIndex = index;
+ wrapper.state = 'inGrid'
+ }
+ }
+ }
+
+ states: [
+ State {
+ name: 'stacked'; when: wrapper.state == ''
+ ParentChange { target: delegate; parent: stack; x: 0; y: 0; rotation: delegate.randomAngle }
+ PropertyChanges { target: delegate; visible: stack.PathView.onPath ? 1.0 : 0.0 }
+ },
+ State {
+ name: 'inGrid'; when: wrapper.state == 'inGrid'
+ ParentChange { target: delegate; parent: grid; x: 24; y: 24 }
+ PropertyChanges { target: delegate; open: true }
+ },
+ State {
+ name: 'fullscreen'; when: wrapper.state == 'fullscreen'
+ ParentChange { target: delegate; parent: list; x: 0; y: 0; width: mainWindow.width; height: mainWindow.height }
+ PropertyChanges { target: box; opacity: 0 }
+ PropertyChanges { target: delegate; open: true }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: 'stacked'; to: 'inGrid'
+ SequentialAnimation {
+ PauseAnimation { duration: 20 * index }
+ ParentAnimation {
+ target: delegate; via: foreground
+ NumberAnimation { targets: delegate; properties: 'x,y,width,height,rotation'; duration: 600; easing.type: 'OutBack' }
+ }
+ }
+ },
+ Transition {
+ from: 'inGrid'; to: 'stacked'
+ ParentAnimation {
+ target: delegate; via: foreground
+ NumberAnimation { properties: 'x,y,width,height,rotation'; duration: 300; easing.type: 'InOutQuad' }
+ }
+ },
+ Transition {
+ from: 'inGrid'; to: 'fullscreen'
+ SequentialAnimation {
+ PauseAnimation { duration: grid.GridView.isCurrentItem ? 0 : 300 }
+ ParentAnimation {
+ target: delegate; via: foreground
+ NumberAnimation {
+ properties: 'x,y,width,height,opacity'
+ duration: grid.GridView.isCurrentItem ? 300 : 1; easing.type: 'InOutQuad'
+ }
+ }
+ }
+ },
+ Transition {
+ from: 'fullscreen'; to: 'inGrid'
+ SequentialAnimation {
+ PauseAnimation { duration: grid.GridView.isCurrentItem ? 3 : 0 }
+ ParallelAnimation {
+ ParentAnimation {
+ target: delegate; via: foreground
+ NumberAnimation {
+ properties: 'x,y,width,height'
+ duration: grid.GridView.isCurrentItem ? 300 : 1; easing.type: 'InOutQuad'
+ }
+ }
+ NumberAnimation { properties: 'opacity'; duration: grid.GridView.isCurrentItem ? 300 : 1; easing.type: 'InOutQuad' }
+ }
+ }
+ }
+ ]
+ }
+}
diff --git a/examples/declarative/colorbrowser/qml/box-shadow.png b/examples/declarative/colorbrowser/qml/box-shadow.png
new file mode 100644
index 0000000..3281a37
--- /dev/null
+++ b/examples/declarative/colorbrowser/qml/box-shadow.png
Binary files differ
diff --git a/examples/declarative/colorbrowser/qml/box.png b/examples/declarative/colorbrowser/qml/box.png
new file mode 100644
index 0000000..86538aa
--- /dev/null
+++ b/examples/declarative/colorbrowser/qml/box.png
Binary files differ
diff --git a/examples/declarative/dynamic/qml/Sun.qml b/examples/declarative/dynamic/qml/Sun.qml
index 796a370..81b6e9b 100644
--- a/examples/declarative/dynamic/qml/Sun.qml
+++ b/examples/declarative/dynamic/qml/Sun.qml
@@ -11,14 +11,14 @@ Image {
//x and y get set when instantiated
//head offscreen
- y: NumberAnimation {
- to: parent.height;
- duration: 10000;
+ NumberAnimation on y {
+ to: window.height / 2;
running: created
+ onRunningChanged: if (running) duration = (window.height - sun.y) * 10; else state = "OffScreen";
}
states: State {
- name: "OffScreen"; when: created && y > window.height / 2;//Below the ground
+ name: "OffScreen";
StateChangeScript { script: { sun.created = false; sun.destroy() } }
}
}
diff --git a/examples/declarative/imageprovider/imageprovider.qml b/examples/declarative/imageprovider/imageprovider.qml
index a1f2794..f899b1e 100644
--- a/examples/declarative/imageprovider/imageprovider.qml
+++ b/examples/declarative/imageprovider/imageprovider.qml
@@ -1,5 +1,5 @@
import Qt 4.6
-import ImageProviderCore 1.0
+import "ImageProviderCore"
//![0]
ListView {
width: 100
diff --git a/examples/declarative/layouts/layouts.qml b/examples/declarative/layouts/layouts.qml
index accd969..4b2a3f8 100644
--- a/examples/declarative/layouts/layouts.qml
+++ b/examples/declarative/layouts/layouts.qml
@@ -1,5 +1,5 @@
import Qt 4.6
-
+import Qt.widgets 4.6
Item {
id: resizable
width:400
diff --git a/examples/declarative/package/Delegate.qml b/examples/declarative/package/Delegate.qml
index 62198d0..f35314f 100644
--- a/examples/declarative/package/Delegate.qml
+++ b/examples/declarative/package/Delegate.qml
@@ -11,7 +11,7 @@ Package {
color: 'lightsteelblue'
Text { text: display; anchors.centerIn: parent }
- MouseRegion {
+ MouseArea {
anchors.fill: parent
onClicked: {
if (wrapper.state == 'inList')
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 090c46d..5b313be 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -744,7 +744,7 @@ QDeclarativeGridView::~QDeclarativeGridView()
id: myDelegate
Item {
id: wrapper
- GridView.onRemove: SequentialAnimation {
+ SequentialAnimation on GridView.onRemove {
PropertyAction { target: wrapper.GridView; property: "delayRemove"; value: true }
NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing: "easeInOutQuad" }
PropertyAction { target: wrapper.GridView; property: "delayRemove"; value: false }
@@ -989,8 +989,8 @@ void QDeclarativeGridView::setHighlight(QDeclarativeComponent *highlight)
id: myHighlight
Rectangle {
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 }
+ SpringFollow on y { source: Wrapper.GridView.view.currentItem.y; spring: 3; damping: 0.2 }
+ SpringFollow on x { source: Wrapper.GridView.view.currentItem.x; spring: 3; damping: 0.2 }
}
}
\endcode
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index a05e638..eb5315d 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -1431,7 +1431,7 @@ QDeclarativeListView::~QDeclarativeListView()
id: myDelegate
Item {
id: wrapper
- ListView.onRemove: SequentialAnimation {
+ SequentialAnimation on ListView.onRemove {
PropertyAction { target: wrapper.ListView; property: "delayRemove"; value: true }
NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing: "easeInOutQuad" }
PropertyAction { target: wrapper.ListView; property: "delayRemove"; value: false }
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index a0aed46..55f1c89 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -144,7 +144,7 @@ QDeclarativeVisualItemModel::QDeclarativeVisualItemModel()
QDeclarativeListProperty<QDeclarativeItem> QDeclarativeVisualItemModel::children()
{
Q_D(QDeclarativeVisualItemModel);
- return QDeclarativeListProperty<QDeclarativeItem>(this, d, d->children_append,
+ return QDeclarativeListProperty<QDeclarativeItem>(this, d, d->children_append,
d->children_count, d->children_at);
}
@@ -483,7 +483,7 @@ QVariant QDeclarativeVisualDataModelDataMetaObject::initialValue(int propId)
QDeclarativeVisualDataModelData::QDeclarativeVisualDataModelData(int index,
QDeclarativeVisualDataModel *model)
-: m_index(index), m_model(model),
+: m_index(index), m_model(model),
m_meta(new QDeclarativeVisualDataModelDataMetaObject(this, QDeclarativeVisualDataModelPrivate::get(model)->m_delegateDataType))
{
QDeclarativeVisualDataModelPrivate *modelPriv = QDeclarativeVisualDataModelPrivate::get(model);
@@ -550,7 +550,7 @@ QVariant QDeclarativeVisualDataModelPartsMetaObject::initialValue(int id)
}
QDeclarativeVisualDataModelParts::QDeclarativeVisualDataModelParts(QDeclarativeVisualDataModel *parent)
-: QObject(parent), model(parent)
+: QObject(parent), model(parent)
{
new QDeclarativeVisualDataModelPartsMetaObject(this);
}
@@ -840,7 +840,7 @@ void QDeclarativeVisualDataModel::setDelegate(QDeclarativeComponent *delegate)
Rectangle {
height: 25; width: 100
Text { text: path }
- MouseRegion {
+ MouseArea {
anchors.fill: parent;
onClicked: myModel.setRoot(path)
}
@@ -969,7 +969,7 @@ QDeclarativeVisualDataModel::ReleaseFlags QDeclarativeVisualDataModel::release(Q
QObject *QDeclarativeVisualDataModel::parts()
{
Q_D(QDeclarativeVisualDataModel);
- if (!d->m_parts)
+ if (!d->m_parts)
d->m_parts = new QDeclarativeVisualDataModelParts(this);
return d->m_parts;
}
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index a9809c0..1eea012 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -65,6 +65,7 @@
#include "qdeclarativescriptparser_p.h"
#include "qdeclarativebinding_p.h"
#include "qdeclarativecompiledbindings_p.h"
+#include "qdeclarativeglobalscriptclass_p.h"
#include <qfxperf_p_p.h>
@@ -113,32 +114,6 @@ QList<QDeclarativeError> QDeclarativeCompiler::errors() const
}
/*!
- Returns true if \a val is a legal object id, false otherwise.
-
- Legal ids must start with a lower-case letter or underscore, and contain only
- letters, numbers and underscores.
-*/
-bool QDeclarativeCompiler::isValidId(const QString &val)
-{
- if (val.isEmpty())
- return false;
-
- if (val.at(0).isLetter() && !val.at(0).isLower()) {
- qWarning().nospace() << "id " << val << " is invalid: ids cannot start with uppercase letters";
- return false;
- }
-
- QChar u(QLatin1Char('_'));
- for (int ii = 0; ii < val.count(); ++ii)
- if (val.at(ii) != u &&
- ((ii == 0 && !val.at(ii).isLetter()) ||
- (ii != 0 && !val.at(ii).isLetterOrNumber())) )
- return false;
-
- return true;
-}
-
-/*!
Returns true if \a name refers to an attached property, false otherwise.
Attached property names are those that start with a capital letter.
@@ -1140,10 +1115,11 @@ bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj,
if (obj->properties.count())
idProp = *obj->properties.begin();
- if (idProp && (idProp->value || idProp->values.count() > 1 || !isValidId(idProp->values.first()->primitive())))
- COMPILE_EXCEPTION(idProp, QCoreApplication::translate("QDeclarativeCompiler","Invalid component id specification"));
-
if (idProp) {
+ if (idProp->value || idProp->values.count() > 1 || idProp->values.at(0)->object)
+ COMPILE_EXCEPTION(idProp, QCoreApplication::translate("QDeclarativeCompiler","Invalid component id specification"));
+ COMPILE_CHECK(checkValidId(idProp->values.first(), idProp->values.first()->primitive()));
+
QString idVal = idProp->values.first()->primitive();
if (compileState.ids.contains(idVal))
@@ -1726,8 +1702,7 @@ bool QDeclarativeCompiler::buildIdProperty(QDeclarativeParser::Property *prop,
QDeclarativeParser::Value *idValue = prop->values.at(0);
QString val = idValue->primitive();
- if (!isValidId(val))
- COMPILE_EXCEPTION(prop, QCoreApplication::translate("QDeclarativeCompiler","\"%1\" is not a valid object id").arg(val));
+ COMPILE_CHECK(checkValidId(idValue, val));
// We disallow id's that conflict with import prefixes and types
QDeclarativeEnginePrivate::ImportedNamespace *ns = 0;
@@ -2476,6 +2451,31 @@ bool QDeclarativeCompiler::buildDynamicMeta(QDeclarativeParser::Object *obj, Dyn
return true;
}
+bool QDeclarativeCompiler::checkValidId(QDeclarativeParser::Value *v, const QString &val)
+{
+ if (val.isEmpty())
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "Invalid empty ID"));
+
+ if (val.at(0).isLetter() && !val.at(0).isLower())
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "IDs cannot start with an uppercase letter"));
+
+ QChar u(QLatin1Char('_'));
+ for (int ii = 0; ii < val.count(); ++ii) {
+
+ if (ii == 0 && !val.at(ii).isLetter() && val.at(ii) != u) {
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "IDs must start with a letter or underscore"));
+ } else if (ii != 0 && !val.at(ii).isLetterOrNumber() && val.at(ii) != u) {
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "IDs must contain only letters, numbers, and underscores"));
+ }
+
+ }
+
+ if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(val))
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QDeclarativeCompiler", "ID illegally masks global JavaScript property"));
+
+ return true;
+}
+
#include <qdeclarativejsparser_p.h>
static QStringList astNodeToStringList(QDeclarativeJS::AST::Node *node)
diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h
index 93a3f83..f8ada95 100644
--- a/src/declarative/qml/qdeclarativecompiler_p.h
+++ b/src/declarative/qml/qdeclarativecompiler_p.h
@@ -155,7 +155,6 @@ public:
bool isError() const;
QList<QDeclarativeError> errors() const;
- static bool isValidId(const QString &);
static bool isAttachedPropertyName(const QByteArray &);
static bool isSignalPropertyName(const QByteArray &);
@@ -247,6 +246,7 @@ private:
QDeclarativeParser::Object *obj,
const QDeclarativeParser::Object::DynamicProperty &);
bool completeComponentBuild();
+ bool checkValidId(QDeclarativeParser::Value *, const QString &);
void genObject(QDeclarativeParser::Object *obj);
diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp
index b244cd8..35e7a77 100644
--- a/src/declarative/qml/qdeclarativecontext.cpp
+++ b/src/declarative/qml/qdeclarativecontext.cpp
@@ -47,6 +47,7 @@
#include "qdeclarativeengine.h"
#include "qdeclarativecompiledbindings_p.h"
#include "qdeclarativeinfo.h"
+#include "qdeclarativeglobalscriptclass_p.h"
#include <qscriptengine.h>
#include <QtCore/qvarlengtharray.h>
@@ -74,10 +75,13 @@ void QDeclarativeContextPrivate::addScript(const QDeclarativeParser::Object::Scr
QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine);
+
scriptContext->pushScope(enginePriv->contextClass->newContext(q, scopeObject));
+ scriptContext->pushScope(enginePriv->globalClass->globalObject());
QScriptValue scope = scriptEngine->newObject();
scriptContext->setActivationObject(scope);
+ scriptContext->pushScope(scope);
for (int ii = 0; ii < script.codes.count(); ++ii) {
scriptEngine->evaluate(script.codes.at(ii), script.files.at(ii), script.lineNumbers.at(ii));
diff --git a/src/declarative/qml/qdeclarativecontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
index 7deed0b..d6305d8 100644
--- a/src/declarative/qml/qdeclarativecontextscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
@@ -50,10 +50,11 @@
QT_BEGIN_NAMESPACE
struct ContextData : public QScriptDeclarativeClass::Object {
- ContextData() : isSharedContext(true) {}
- ContextData(QDeclarativeContext *c, QObject *o) : context(c), scopeObject(o), isSharedContext(false) {}
+ ContextData() : overrideObject(0), isSharedContext(true) {}
+ ContextData(QDeclarativeContext *c, QObject *o) : context(c), scopeObject(o), overrideObject(0), isSharedContext(false) {}
QDeclarativeGuard<QDeclarativeContext> context;
QDeclarativeGuard<QObject> scopeObject;
+ QObject *overrideObject;
bool isSharedContext;
QDeclarativeContext *getContext(QDeclarativeEngine *engine) {
@@ -110,6 +111,17 @@ QDeclarativeContext *QDeclarativeContextScriptClass::contextFromValue(const QScr
return data->getContext(engine);
}
+QObject *QDeclarativeContextScriptClass::setOverrideObject(QScriptValue &v, QObject *override)
+{
+ if (scriptClass(v) != this)
+ return 0;
+
+ ContextData *data = (ContextData *)object(v);
+ QObject *rv = data->overrideObject;
+ data->overrideObject = override;
+ return rv;
+}
+
QScriptClass::QueryFlags
QDeclarativeContextScriptClass::queryProperty(Object *object, const Identifier &name,
QScriptClass::QueryFlags flags)
@@ -127,6 +139,20 @@ QDeclarativeContextScriptClass::queryProperty(Object *object, const Identifier &
if (!bindContext)
return 0;
+ QObject *overrideObject = ((ContextData *)object)->overrideObject;
+ if (overrideObject) {
+ QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
+ QScriptClass::QueryFlags rv =
+ ep->objectClass->queryProperty(overrideObject, name, flags, bindContext,
+ QDeclarativeObjectScriptClass::ImplicitObject |
+ QDeclarativeObjectScriptClass::SkipAttachedProperties);
+ if (rv) {
+ lastScopeObject = overrideObject;
+ lastContext = bindContext;
+ return rv;
+ }
+ }
+
bool includeTypes = true;
while (bindContext) {
QScriptClass::QueryFlags rv =
diff --git a/src/declarative/qml/qdeclarativecontextscriptclass_p.h b/src/declarative/qml/qdeclarativecontextscriptclass_p.h
index 26086ec..4b0dca0 100644
--- a/src/declarative/qml/qdeclarativecontextscriptclass_p.h
+++ b/src/declarative/qml/qdeclarativecontextscriptclass_p.h
@@ -70,6 +70,7 @@ public:
QScriptValue newSharedContext();
QDeclarativeContext *contextFromValue(const QScriptValue &);
+ QObject *setOverrideObject(QScriptValue &, QObject *);
protected:
virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &,
diff --git a/src/declarative/qml/qdeclarativedeclarativedata_p.h b/src/declarative/qml/qdeclarativedeclarativedata_p.h
index a7a73bc..ae40130 100644
--- a/src/declarative/qml/qdeclarativedeclarativedata_p.h
+++ b/src/declarative/qml/qdeclarativedeclarativedata_p.h
@@ -120,6 +120,11 @@ public:
template<class T>
void QDeclarativeGuard<T>::addGuard()
{
+ if (QObjectPrivate::get(o)->wasDeleted) {
+ if (prev) remGuard();
+ return;
+ }
+
QDeclarativeDeclarativeData *data = QDeclarativeDeclarativeData::get(o, true);
next = data->guards;
if (next) reinterpret_cast<QDeclarativeGuard<T> *>(next)->prev = &next;
diff --git a/src/declarative/qml/qdeclarativedom.cpp b/src/declarative/qml/qdeclarativedom.cpp
index 5b43109..cb56ead 100644
--- a/src/declarative/qml/qdeclarativedom.cpp
+++ b/src/declarative/qml/qdeclarativedom.cpp
@@ -374,7 +374,7 @@ QDeclarativeDomValue QDeclarativeDomProperty::value() const
QDeclarativeDomValue rv;
if (d->property) {
rv.d->property = d->property;
- if (d->property->values.count())
+ if (d->property->values.count())
rv.d->value = d->property->values.at(0);
else
rv.d->value = d->property->onValues.at(0);
@@ -508,7 +508,7 @@ int QDeclarativeDomDynamicProperty::propertyType() const
QByteArray QDeclarativeDomDynamicProperty::propertyTypeName() const
{
- if (isValid())
+ if (isValid())
return d->property.customType;
return QByteArray();
@@ -1184,7 +1184,7 @@ QDeclarativeDomObject QDeclarativeDomValueValueSource::object() const
\qml
Rectangle {
- x: Behavior { NumberAnimation { duration: 500 } }
+ Behavior on x { NumberAnimation { duration: 500 } }
}
\endqml
*/
@@ -1228,7 +1228,7 @@ QDeclarativeDomValueValueInterceptor &QDeclarativeDomValueValueInterceptor::oper
returned.
\qml
Rectangle {
- x: Behavior { NumberAnimation { duration: 500 } }
+ Behavior on x { NumberAnimation { duration: 500 } }
}
\endqml
*/
diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp
index ae1e790..e528e9e 100644
--- a/src/declarative/qml/qdeclarativeexpression.cpp
+++ b/src/declarative/qml/qdeclarativeexpression.cpp
@@ -46,6 +46,7 @@
#include "qdeclarativecontext_p.h"
#include "qdeclarativerewrite_p.h"
#include "qdeclarativecompiler_p.h"
+#include "qdeclarativeglobalscriptclass_p.h"
#include <QtCore/qdebug.h>
#include <QtScript/qscriptprogram.h>
@@ -135,6 +136,7 @@ void QDeclarativeExpressionPrivate::init(QDeclarativeContext *ctxt, void *expr,
if (!dd->cachedClosures.at(progIdx)) {
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine);
scriptContext->pushScope(ep->contextClass->newSharedContext());
+ scriptContext->pushScope(ep->globalClass->globalObject());
dd->cachedClosures[progIdx] = new QScriptValue(scriptEngine->evaluate(data->expression, data->url, data->line));
scriptEngine->popContext();
}
@@ -151,9 +153,11 @@ void QDeclarativeExpressionPrivate::init(QDeclarativeContext *ctxt, void *expr,
new QScriptProgram(data->expression, data->url, data->line);
}
- data->expressionFunction = evalInObjectScope(ctxt, me, *dd->cachedPrograms.at(progIdx));
+ data->expressionFunction = evalInObjectScope(ctxt, me, *dd->cachedPrograms.at(progIdx),
+ &data->expressionContext);
#else
- data->expressionFunction = evalInObjectScope(ctxt, me, data->expression);
+ data->expressionFunction = evalInObjectScope(ctxt, me, data->expression,
+ &data->expressionContext);
#endif
data->expressionFunctionValid = true;
@@ -164,22 +168,34 @@ void QDeclarativeExpressionPrivate::init(QDeclarativeContext *ctxt, void *expr,
}
QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContext *context, QObject *object,
- const QString &program)
+ const QString &program, QScriptValue *contextObject)
{
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context->engine());
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(&ep->scriptEngine);
- scriptContext->pushScope(ep->contextClass->newContext(context, object));
+ if (contextObject) {
+ *contextObject = ep->contextClass->newContext(context, object);
+ scriptContext->pushScope(*contextObject);
+ } else {
+ scriptContext->pushScope(ep->contextClass->newContext(context, object));
+ }
+ scriptContext->pushScope(ep->globalClass->globalObject());
QScriptValue rv = ep->scriptEngine.evaluate(program);
ep->scriptEngine.popContext();
return rv;
}
QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContext *context, QObject *object,
- const QScriptProgram &program)
+ const QScriptProgram &program, QScriptValue *contextObject)
{
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context->engine());
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(&ep->scriptEngine);
- scriptContext->pushScope(ep->contextClass->newContext(context, object));
+ if (contextObject) {
+ *contextObject = ep->contextClass->newContext(context, object);
+ scriptContext->pushScope(*contextObject);
+ } else {
+ scriptContext->pushScope(ep->contextClass->newContext(context, object));
+ }
+ scriptContext->pushScope(ep->globalClass->globalObject());
QScriptValue rv = ep->scriptEngine.evaluate(program);
ep->scriptEngine.popContext();
return rv;
@@ -326,15 +342,14 @@ QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bo
QDeclarativeEngine *engine = data->context()->engine();
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine);
- if (secondaryScope)
- ctxtPriv->defaultObjects.append(secondaryScope);
-
QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
if (!data->expressionFunctionValid) {
QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine);
- scriptContext->pushScope(ep->contextClass->newContext(data->context(), data->me));
+ data->expressionContext = ep->contextClass->newContext(data->context(), data->me);
+ scriptContext->pushScope(data->expressionContext);
+ scriptContext->pushScope(ep->globalClass->globalObject());
if (data->expressionRewritten) {
data->expressionFunction = scriptEngine->evaluate(data->expression,
@@ -357,11 +372,14 @@ QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bo
QDeclarativeContext *oldSharedContext = 0;
QObject *oldSharedScope = 0;
+ QObject *oldOverride = 0;
if (data->isShared) {
oldSharedContext = ep->sharedContext;
oldSharedScope = ep->sharedScope;
ep->sharedContext = data->context();
ep->sharedScope = data->me;
+ } else {
+ oldOverride = ep->contextClass->setOverrideObject(data->expressionContext, secondaryScope);
}
QScriptValue svalue = data->expressionFunction.call();
@@ -369,6 +387,8 @@ QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bo
if (data->isShared) {
ep->sharedContext = oldSharedContext;
ep->sharedScope = oldSharedScope;
+ } else {
+ ep->contextClass->setOverrideObject(data->expressionContext, oldOverride);
}
if (isUndefined)
@@ -383,12 +403,6 @@ QVariant QDeclarativeExpressionPrivate::evalQtScript(QObject *secondaryScope, bo
data->error = QDeclarativeError();
}
- if (secondaryScope) {
- QObject *last = ctxtPriv->defaultObjects.takeLast();
- Q_ASSERT(last == secondaryScope);
- Q_UNUSED(last);
- }
-
QVariant rv;
if (svalue.isArray()) {
diff --git a/src/declarative/qml/qdeclarativeexpression_p.h b/src/declarative/qml/qdeclarativeexpression_p.h
index 91ac4c0..cd1729d 100644
--- a/src/declarative/qml/qdeclarativeexpression_p.h
+++ b/src/declarative/qml/qdeclarativeexpression_p.h
@@ -119,6 +119,7 @@ public:
bool expressionFunctionValid:1;
bool expressionRewritten:1;
QScriptValue expressionFunction;
+ QScriptValue expressionContext;
QObject *me;
bool trackChange;
@@ -180,8 +181,8 @@ public:
virtual void emitValueChanged();
static void exceptionToError(QScriptEngine *, QDeclarativeError &);
- static QScriptValue evalInObjectScope(QDeclarativeContext *, QObject *, const QString &);
- static QScriptValue evalInObjectScope(QDeclarativeContext *, QObject *, const QScriptProgram &);
+ static QScriptValue evalInObjectScope(QDeclarativeContext *, QObject *, const QString &, QScriptValue * = 0);
+ static QScriptValue evalInObjectScope(QDeclarativeContext *, QObject *, const QScriptProgram &, QScriptValue * = 0);
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
index 5b06b42..9ee2fe5 100644
--- a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp
@@ -53,15 +53,17 @@ QT_BEGIN_NAMESPACE
QDeclarativeGlobalScriptClass::QDeclarativeGlobalScriptClass(QScriptEngine *engine)
: QScriptClass(engine)
{
- QScriptValue v = engine->newObject();
- globalObject = engine->globalObject();
+ QScriptValue globalObject = engine->globalObject();
+ m_globalObject = engine->newObject();
QScriptValueIterator iter(globalObject);
while (iter.hasNext()) {
iter.next();
- v.setProperty(iter.scriptName(), iter.value());
+ m_globalObject.setProperty(iter.scriptName(), iter.value());
+ m_illegalNames.insert(iter.name());
}
+ QScriptValue v = engine->newObject();
v.setScriptClass(this);
engine->setGlobalObject(v);
}
@@ -101,12 +103,14 @@ void QDeclarativeGlobalScriptClass::setProperty(QScriptValue &object,
engine()->currentContext()->throwError(error);
}
+/* This method is for the use of tst_qdeclarativeecmascript::callQtInvokables() only */
void QDeclarativeGlobalScriptClass::explicitSetProperty(const QString &name, const QScriptValue &value)
{
+ QScriptValue globalObject = engine()->globalObject();
+
QScriptValue v = engine()->newObject();
- globalObject = engine()->globalObject();
- QScriptValueIterator iter(globalObject);
+ QScriptValueIterator iter(v);
while (iter.hasNext()) {
iter.next();
v.setProperty(iter.scriptName(), iter.value());
@@ -114,6 +118,7 @@ void QDeclarativeGlobalScriptClass::explicitSetProperty(const QString &name, con
v.setProperty(name, value);
v.setScriptClass(this);
+
engine()->setGlobalObject(v);
}
diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h
index a33cf5e..1b34aee 100644
--- a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h
+++ b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h
@@ -54,6 +54,7 @@
//
#include <QtScript/qscriptclass.h>
+#include <QtCore/qset.h>
QT_BEGIN_NAMESPACE
@@ -74,8 +75,12 @@ public:
void explicitSetProperty(const QString &, const QScriptValue &);
+ const QScriptValue &globalObject() const { return m_globalObject; }
+ const QSet<QString> &illegalNames() const { return m_illegalNames; }
+
private:
- QScriptValue globalObject;
+ QSet<QString> m_illegalNames;
+ QScriptValue m_globalObject;
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp
index e1ec2cd..521c241 100644
--- a/src/declarative/qml/qdeclarativeproperty.cpp
+++ b/src/declarative/qml/qdeclarativeproperty.cpp
@@ -793,7 +793,7 @@ QVariant QDeclarativeProperty::read(QObject *object, const QString &name, QDecla
QVariant QDeclarativePropertyPrivate::readValueProperty()
{
- if(isValueType()) {
+ if (isValueType()) {
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context);
QDeclarativeValueType *valueType = 0;
@@ -809,13 +809,20 @@ QVariant QDeclarativePropertyPrivate::readValueProperty()
if (!ep) delete valueType;
return rv;
- } else if(core.flags & QDeclarativePropertyCache::Data::IsQList) {
+ } else if (core.flags & QDeclarativePropertyCache::Data::IsQList) {
QDeclarativeListProperty<QObject> prop;
void *args[] = { &prop, 0 };
QMetaObject::metacall(object, QMetaObject::ReadProperty, core.coreIndex, args);
return QVariant::fromValue(QDeclarativeListReferencePrivate::init(prop, core.propType, engine));
+ } else if (core.flags & QDeclarativePropertyCache::Data::IsQObjectDerived) {
+
+ QObject *rv = 0;
+ void *args[] = { &rv, 0 };
+ QMetaObject::metacall(object, QMetaObject::ReadProperty, core.coreIndex, args);
+ return QVariant::fromValue(rv);
+
} else {
return object->metaObject()->property(core.coreIndex).read(object.data());
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 7f4f1c0..b14de19 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -110,7 +110,7 @@ QDeclarativeAbstractAnimation::QDeclarativeAbstractAnimation(QDeclarativeAbstrac
\code
Rectangle {
width: 100; height: 100
- x: NumberAnimation {
+ NumberAnimation on x {
running: myMouse.pressed
from: 0; to: 100
}
@@ -310,7 +310,7 @@ void QDeclarativeAbstractAnimation::setAlwaysRunToEnd(bool f)
\code
Rectangle {
- rotation: NumberAnimation { running: true; repeat: true; from: 0 to: 360 }
+ NumberAnimation on rotation { running: true; repeat: true; from: 0 to: 360 }
}
\endcode
*/
@@ -412,7 +412,7 @@ void QDeclarativeAbstractAnimation::resume()
no further influence on property values. In this example animation
\code
Rectangle {
- x: NumberAnimation { from: 0; to: 100; duration: 500 }
+ NumberAnimation on x { from: 0; to: 100; duration: 500 }
}
\endcode
was stopped at time 250ms, the \c x property will have a value of 50.
@@ -450,7 +450,7 @@ void QDeclarativeAbstractAnimation::restart()
its end. In the following example,
\code
Rectangle {
- x: NumberAnimation { from: 0; to: 100; duration: 500 }
+ NumberAnimation on x { from: 0; to: 100; duration: 500 }
}
\endcode
calling \c stop() at time 250ms will result in the \c x property having
@@ -1292,7 +1292,7 @@ QDeclarativeVector3dAnimation::QDeclarativeVector3dAnimation(QObject *parent)
Q_D(QDeclarativePropertyAnimation);
d->interpolatorType = QMetaType::QVector3D;
d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
- d->defaultToInterpolatorType = true;
+ d->defaultToInterpolatorType = true;
}
QDeclarativeVector3dAnimation::~QDeclarativeVector3dAnimation()
@@ -1741,7 +1741,7 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int
Animate all changes to a rectangle's x property.
\qml
Rectangle {
- x: Behavior { PropertyAnimation {} }
+ Behavior on x { PropertyAnimation {} }
}
\endqml
\o As a property value source
@@ -1749,7 +1749,7 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int
Repeatedly animate the rectangle's x property.
\qml
Rectangle {
- x: SequentialAnimation {
+ SequentialAnimation on x {
repeat: true
PropertyAnimation { to: 50 }
PropertyAnimation { to: 0 }
@@ -2140,8 +2140,8 @@ void QDeclarativePropertyAnimation::setProperties(const QString &prop)
id: theRect
width: 100; height: 100
color: Qt.rgba(0,0,1)
- x: NumberAnimation { to: 500; repeat: true } //animate theRect's x property
- y: Behavior { NumberAnimation {} } //animate theRect's y property
+ NumberAnimation on x { to: 500; repeat: true } //animate theRect's x property
+ Behavior on y { NumberAnimation {} } //animate theRect's y property
}
\endqml
\row
diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp
index 5352341..dea2c02 100644
--- a/src/declarative/util/qdeclarativebehavior.cpp
+++ b/src/declarative/util/qdeclarativebehavior.cpp
@@ -75,13 +75,13 @@ public:
Behaviors provide one way to specify \l{qdeclarativeanimation.html}{animations} in QML.
- In the example below, the rect will use a bounce easing curve over 200 millisecond for any changes to its y property:
+ In the example below, the rectangle will use a bounce easing curve over 200 millisecond for any changes to its y property:
\code
Rectangle {
width: 20; height: 20
color: "#00ff00"
- y: 200 //initial value
- y: Behavior {
+ y: 200 // initial value
+ Behavior on y {
NumberAnimation {
easing: "easeOutBounce(amplitude:100)"
duration: 200
diff --git a/src/declarative/util/qdeclarativebind.cpp b/src/declarative/util/qdeclarativebind.cpp
index e95a03e..26baa38 100644
--- a/src/declarative/util/qdeclarativebind.cpp
+++ b/src/declarative/util/qdeclarativebind.cpp
@@ -72,7 +72,7 @@ public:
/*!
\qmlclass Binding QDeclarativeBind
- \since 4.7
+ \since 4.7
\brief The Binding element allows arbitrary property bindings to be created.
Sometimes it is necessary to bind to a property of an object that wasn't
@@ -114,6 +114,19 @@ QDeclarativeBind::~QDeclarativeBind()
{
}
+/*!
+ \qmlproperty bool Binding::when
+
+ This property holds when the binding is active.
+ This should be set to an expression that evaluates to true when you want the binding to be active.
+
+ \code
+ Binding {
+ target: contactName; property: 'text'
+ value: name; when: list.ListView.isCurrentItem
+ }
+ \endcode
+*/
bool QDeclarativeBind::when() const
{
Q_D(const QDeclarativeBind);
diff --git a/src/declarative/util/qdeclarativeeasefollow.cpp b/src/declarative/util/qdeclarativeeasefollow.cpp
index 3fa9866..ee181dd 100644
--- a/src/declarative/util/qdeclarativeeasefollow.cpp
+++ b/src/declarative/util/qdeclarativeeasefollow.cpp
@@ -59,10 +59,10 @@ class QDeclarativeEaseFollowPrivate : public QObjectPrivate
public:
QDeclarativeEaseFollowPrivate()
: source(0), velocity(200), duration(-1), maximumEasingTime(-1),
- reversingMode(QDeclarativeEaseFollow::Eased), initialVelocity(0),
+ reversingMode(QDeclarativeEaseFollow::Eased), initialVelocity(0),
initialValue(0), invert(false), enabled(true), trackVelocity(0), clockOffset(0),
lastTick(0), clock(this)
- {}
+ {}
qreal source;
qreal velocity;
@@ -173,7 +173,7 @@ bool QDeclarativeEaseFollowPrivate::recalc()
}
/*
- qWarning() << "a:" << a << "tf:" << tf << "tp:" << tp << "vp:"
+ qWarning() << "a:" << a << "tf:" << tf << "tp:" << tp << "vp:"
<< vp << "sp:" << sp << "vi:" << vi << "invert:" << invert;
*/
return true;
@@ -254,19 +254,19 @@ void QDeclarativeEaseFollowPrivate::tick(int t)
\since 4.7
\brief The EaseFollow element allows a property to smoothly track a value.
- The EaseFollow smoothly animates a property's value to a set target value
+ The EaseFollow smoothly animates a property's value to a set target value
using an ease in/out quad easing curve. If the target value changes while
- the animation is in progress, the easing curves used to animate to the old
+ the animation is in progress, the easing curves used to animate to the old
and the new target values are spliced together to avoid any obvious visual
glitches.
The property animation is configured by setting the velocity at which the
- animation should occur, or the duration that the animation should take.
+ animation should occur, or the duration that the animation should take.
If both a velocity and a duration are specified, the one that results in
the quickest animation is chosen for each change in the target value.
For example, animating from 0 to 800 will take 4 seconds if a velocity
- of 200 is set, will take 8 seconds with a duration of 8000 set, and will
+ of 200 is set, will take 8 seconds with a duration of 8000 set, and will
take 4 seconds with both a velocity of 200 and a duration of 8000 set.
Animating from 0 to 20000 will take 10 seconds if a velocity of 200 is set,
will take 8 seconds with a duration of 8000 set, and will take 8 seconds
@@ -283,8 +283,8 @@ Rectangle {
color: "green"
width: 60; height: 60;
x: -5; y: -5;
- x: EaseFollow { source: rect1.x - 5; velocity: 200 }
- y: EaseFollow { source: rect1.y - 5; velocity: 200 }
+ EaseFollow on x { source: rect1.x - 5; velocity: 200 }
+ EaseFollow on y { source: rect1.y - 5; velocity: 200 }
}
Rectangle {
@@ -338,8 +338,8 @@ qreal QDeclarativeEaseFollow::sourceValue() const
Sets how the EaseFollow behaves if an animation direction is reversed.
If reversing mode is \c Eased, the animation will smoothly decelerate, and
- then reverse direction. If the reversing mode is \c Immediate, the
- animation will immediately begin accelerating in the reverse direction,
+ then reverse direction. If the reversing mode is \c Immediate, the
+ animation will immediately begin accelerating in the reverse direction,
begining with a velocity of 0. If the reversing mode is \c Sync, the
property is immediately set to the target value.
*/
@@ -373,7 +373,7 @@ void QDeclarativeEaseFollowPrivate::restart()
return;
}
- bool hasReversed = trackVelocity != 0. &&
+ bool hasReversed = trackVelocity != 0. &&
((trackVelocity > 0) == ((initialValue - source) > 0));
if (hasReversed) {
@@ -440,7 +440,7 @@ void QDeclarativeEaseFollow::setDuration(qreal v)
d->duration = v;
d->trackVelocity = 0;
- if (d->clock.state() == QAbstractAnimation::Running)
+ if (d->clock.state() == QAbstractAnimation::Running)
d->restart();
emit durationChanged();
@@ -470,7 +470,7 @@ void QDeclarativeEaseFollow::setVelocity(qreal v)
d->velocity = v;
d->trackVelocity = 0;
- if (d->clock.state() == QAbstractAnimation::Running)
+ if (d->clock.state() == QAbstractAnimation::Running)
d->restart();
emit velocityChanged();
@@ -511,8 +511,8 @@ void QDeclarativeEaseFollow::setTarget(const QDeclarativeProperty &t)
\qmlproperty qreal EaseFollow::maximumEasingTime
This property specifies the maximum time an "eases" during the follow should take.
-Setting this property causes the velocity to "level out" after at a time. Setting
-a negative value reverts to the normal mode of easing over the entire animation
+Setting this property causes the velocity to "level out" after at a time. Setting
+a negative value reverts to the normal mode of easing over the entire animation
duration.
The default value is -1.
@@ -528,7 +528,7 @@ void QDeclarativeEaseFollow::setMaximumEasingTime(qreal v)
Q_D(QDeclarativeEaseFollow);
d->maximumEasingTime = v;
- if (d->clock.state() == QAbstractAnimation::Running)
+ if (d->clock.state() == QAbstractAnimation::Running)
d->restart();
emit maximumEasingTimeChanged();
diff --git a/src/declarative/util/qdeclarativespringfollow.cpp b/src/declarative/util/qdeclarativespringfollow.cpp
index 6205ab9..1d69dd3 100644
--- a/src/declarative/util/qdeclarativespringfollow.cpp
+++ b/src/declarative/util/qdeclarativespringfollow.cpp
@@ -222,8 +222,8 @@ void QDeclarativeSpringFollowPrivate::stop()
id: rect1
width: 20; height: 20
color: "#00ff00"
- y: 200 //initial value
- y: SequentialAnimation {
+ y: 200 // initial value
+ SequentialAnimation on y {
running: true
repeat: true
NumberAnimation {
@@ -239,7 +239,7 @@ void QDeclarativeSpringFollowPrivate::stop()
x: rect1.width
width: 20; height: 20
color: "#ff0000"
- y: SpringFollow { source: rect1.y; velocity: 200 }
+ SpringFollow on y { source: rect1.y; velocity: 200 }
}
\endcode
diff --git a/src/imports/webkit/plugin.cpp b/src/imports/webkit/plugin.cpp
index 2f6205d..799fe9e 100644
--- a/src/imports/webkit/plugin.cpp
+++ b/src/imports/webkit/plugin.cpp
@@ -54,6 +54,7 @@ public:
virtual void registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("org.webkit"));
+ QML_REGISTER_NOCREATE_TYPE(QDeclarativeWebSettings);
qmlRegisterType<QDeclarativeWebView>(uri,1,0,"WebView");
}
};
diff --git a/src/imports/webkit/qdeclarativewebview.cpp b/src/imports/webkit/qdeclarativewebview.cpp
index 733ac86..d78ba28 100644
--- a/src/imports/webkit/qdeclarativewebview.cpp
+++ b/src/imports/webkit/qdeclarativewebview.cpp
@@ -931,7 +931,7 @@ QWebPage *QDeclarativeWebView::page() const
}
\endqml
*/
-QObject *QDeclarativeWebView::settingsObject() const
+QDeclarativeWebSettings *QDeclarativeWebView::settingsObject() const
{
Q_D(const QDeclarativeWebView);
d->settings.s = page()->settings();
diff --git a/src/imports/webkit/qdeclarativewebview_p.h b/src/imports/webkit/qdeclarativewebview_p.h
index 5efc3b5..145e74b 100644
--- a/src/imports/webkit/qdeclarativewebview_p.h
+++ b/src/imports/webkit/qdeclarativewebview_p.h
@@ -59,6 +59,7 @@ class QWebSettings;
QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+class QDeclarativeWebSettings;
class QDeclarativeWebViewPrivate;
class QNetworkRequest;
class QDeclarativeWebView;
@@ -113,7 +114,7 @@ class WEBKITQMLPLUGIN_EXPORT QDeclarativeWebView : public QDeclarativePaintedIte
Q_PROPERTY(QAction* forward READ forwardAction CONSTANT)
Q_PROPERTY(QAction* stop READ stopAction CONSTANT)
- Q_PROPERTY(QObject* settings READ settingsObject CONSTANT)
+ Q_PROPERTY(QDeclarativeWebSettings* settings READ settingsObject CONSTANT)
Q_PROPERTY(QDeclarativeListProperty<QObject> javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT)
@@ -170,7 +171,7 @@ public:
QWebHistory *history() const;
QWebSettings *settings() const;
- QObject *settingsObject() const;
+ QDeclarativeWebSettings *settingsObject() const;
bool renderingEnabled() const;
void setRenderingEnabled(bool);
diff --git a/src/imports/webkit/qdeclarativewebview_p_p.h b/src/imports/webkit/qdeclarativewebview_p_p.h
index 258b472..3ad9e9a 100644
--- a/src/imports/webkit/qdeclarativewebview_p_p.h
+++ b/src/imports/webkit/qdeclarativewebview_p_p.h
@@ -42,6 +42,8 @@
#ifndef QDECLARATIVEWEBVIEW_P_H
#define QDECLARATIVEWEBVIEW_P_H
+#include "webkitqmlplugin_export.h"
+
#include <qdeclarative.h>
#include <QtWebKit/QWebPage>
@@ -52,7 +54,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-class QDeclarativeWebSettings : public QObject {
+class WEBKITQMLPLUGIN_EXPORT QDeclarativeWebSettings : public QObject {
Q_OBJECT
Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily)
diff --git a/src/multimedia/base/qmediaserviceprovider.cpp b/src/multimedia/base/qmediaserviceprovider.cpp
index eb6505c..d51d682 100644
--- a/src/multimedia/base/qmediaserviceprovider.cpp
+++ b/src/multimedia/base/qmediaserviceprovider.cpp
@@ -268,7 +268,7 @@ class QPluginServiceProvider : public QMediaServiceProvider
public:
QMediaService* requestService(const QByteArray &type, const QMediaServiceProviderHint &hint)
{
- QString key(type);
+ QString key(QString::fromLatin1(type.constData(),type.length()));
QList<QMediaServiceProviderPlugin *>plugins;
foreach (QObject *obj, loader()->instances(key)) {
@@ -383,7 +383,8 @@ public:
const QStringList& codecs,
int flags) const
{
- QList<QObject*> instances = loader()->instances(serviceType);
+ QList<QObject*> instances = loader()->instances(
+ QString::fromLatin1(serviceType.constData(),serviceType.length()));
if (instances.isEmpty())
return QtMultimedia::NotSupported;
@@ -424,7 +425,8 @@ public:
QStringList supportedMimeTypes(const QByteArray &serviceType, int flags) const
{
- QList<QObject*> instances = loader()->instances(serviceType);
+ QList<QObject*> instances = loader()->instances(
+ QString::fromLatin1(serviceType.constData(),serviceType.length()));
QStringList supportedTypes;
@@ -457,7 +459,8 @@ public:
{
QList<QByteArray> res;
- foreach(QObject *obj, loader()->instances(serviceType)) {
+ foreach(QObject *obj, loader()->instances(
+ QString::fromLatin1(serviceType.constData(),serviceType.length()))) {
QMediaServiceSupportedDevicesInterface *iface =
qobject_cast<QMediaServiceSupportedDevicesInterface*>(obj);
@@ -471,7 +474,8 @@ public:
QString deviceDescription(const QByteArray &serviceType, const QByteArray &device)
{
- foreach(QObject *obj, loader()->instances(serviceType)) {
+ foreach(QObject *obj, loader()->instances(
+ QString::fromLatin1(serviceType.constData(),serviceType.length()))) {
QMediaServiceSupportedDevicesInterface *iface =
qobject_cast<QMediaServiceSupportedDevicesInterface*>(obj);
diff --git a/src/multimedia/qml/qsoundeffect_qsound_p.cpp b/src/multimedia/qml/qsoundeffect_qsound_p.cpp
index 0292d26..df160a9 100644
--- a/src/multimedia/qml/qsoundeffect_qsound_p.cpp
+++ b/src/multimedia/qml/qsoundeffect_qsound_p.cpp
@@ -157,7 +157,7 @@ void QSoundEffectPrivate::setMedia(const QMediaContent &media)
{
m_queued = false;
- if (media.isNull() || media.canonicalUrl().scheme() != "file") {
+ if (media.isNull() || media.canonicalUrl().scheme() != QLatin1String("file")) {
m_media = QMediaContent();
return;
}
diff --git a/src/multimedia/qml/wavedecoder_p.cpp b/src/multimedia/qml/wavedecoder_p.cpp
index b7d6101..f2277ae 100644
--- a/src/multimedia/qml/wavedecoder_p.cpp
+++ b/src/multimedia/qml/wavedecoder_p.cpp
@@ -122,7 +122,7 @@ void WaveDecoder::handleData()
else {
int bps = qFromLittleEndian<quint16>(header.wave.bitsPerSample);
- format.setCodec("audio/pcm");
+ format.setCodec(QLatin1String("audio/pcm"));
format.setSampleType(bps == 8 ? QAudioFormat::UnSignedInt : QAudioFormat::SignedInt);
format.setByteOrder(QAudioFormat::LittleEndian);
format.setFrequency(qFromLittleEndian<quint32>(header.wave.sampleRate));
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
index 2d7aaa8..e646693 100644
--- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
+++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
@@ -59,6 +59,9 @@ QT_BEGIN_NAMESPACE
QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *session, QObject *parent)
: QMediaPlayerControl(parent)
, m_session(session)
+ , m_state(QMediaPlayer::StoppedState)
+ , m_mediaStatus(QMediaPlayer::NoMedia)
+ , m_bufferProgress(-1)
, m_stream(0)
, m_fifoNotifier(0)
, m_fifoCanWrite(false)
@@ -77,11 +80,11 @@ QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *sessio
connect(m_session, SIGNAL(volumeChanged(int)),
this, SIGNAL(volumeChanged(int)));
connect(m_session, SIGNAL(stateChanged(QMediaPlayer::State)),
- this, SIGNAL(stateChanged(QMediaPlayer::State)));
- connect(m_session, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
- this, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
+ this, SLOT(updateState(QMediaPlayer::State)));
connect(m_session,SIGNAL(bufferingProgressChanged(int)),
- this, SIGNAL(bufferStatusChanged(int)));
+ this, SLOT(setBufferProgress(int)));
+ connect(m_session, SIGNAL(playbackFinished()),
+ this, SLOT(processEOS()));
connect(m_session, SIGNAL(audioAvailableChanged(bool)),
this, SIGNAL(audioAvailableChanged(bool)));
connect(m_session, SIGNAL(videoAvailableChanged(bool)),
@@ -114,17 +117,20 @@ qint64 QGstreamerPlayerControl::duration() const
QMediaPlayer::State QGstreamerPlayerControl::state() const
{
- return m_session->state();
+ return m_state;
}
QMediaPlayer::MediaStatus QGstreamerPlayerControl::mediaStatus() const
{
- return m_session->mediaStatus();
+ return m_mediaStatus;
}
int QGstreamerPlayerControl::bufferStatus() const
{
- return 100;
+ if (m_bufferProgress == -1) {
+ return m_session->state() == QMediaPlayer::StoppedState ? 0 : 100;
+ } else
+ return m_bufferProgress;
}
int QGstreamerPlayerControl::volume() const
@@ -169,23 +175,33 @@ void QGstreamerPlayerControl::setPosition(qint64 pos)
void QGstreamerPlayerControl::play()
{
- m_session->play();
-
- if (m_fifoFd[1] >= 0) {
- m_fifoCanWrite = true;
-
- writeFifo();
+ if (m_session->play()) {
+ if (m_state != QMediaPlayer::PlayingState)
+ emit stateChanged(m_state = QMediaPlayer::PlayingState);
}
}
void QGstreamerPlayerControl::pause()
{
- m_session->pause();
+ if (m_session->pause()) {
+ if (m_state != QMediaPlayer::PausedState)
+ emit stateChanged(m_state = QMediaPlayer::PausedState);
+ }
}
void QGstreamerPlayerControl::stop()
{
- m_session->stop();
+ if (m_state != QMediaPlayer::StoppedState) {
+ m_session->pause();
+ if (!m_session->seek(0)) {
+ m_bufferProgress = -1;
+ m_session->stop();
+ m_session->pause();
+ }
+ emit positionChanged(0);
+ if (m_state != QMediaPlayer::StoppedState)
+ emit stateChanged(m_state = QMediaPlayer::StoppedState);
+ }
}
void QGstreamerPlayerControl::setVolume(int volume)
@@ -210,8 +226,15 @@ const QIODevice *QGstreamerPlayerControl::mediaStream() const
void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice *stream)
{
+ QMediaPlayer::State oldState = m_state;
+ m_state = QMediaPlayer::StoppedState;
m_session->stop();
+ if (m_bufferProgress != -1) {
+ m_bufferProgress = -1;
+ emit bufferStatusChanged(0);
+ }
+
if (m_stream) {
closeFifo();
@@ -234,7 +257,25 @@ void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice *
m_session->load(url);
+ if (m_fifoFd[1] >= 0) {
+ m_fifoCanWrite = true;
+
+ writeFifo();
+ }
+
+ if (!url.isEmpty()) {
+ if (m_mediaStatus != QMediaPlayer::LoadingMedia)
+ emit mediaStatusChanged(m_mediaStatus = QMediaPlayer::LoadingMedia);
+ m_session->pause();
+ } else {
+ if (m_mediaStatus != QMediaPlayer::NoMedia)
+ emit mediaStatusChanged(m_mediaStatus = QMediaPlayer::NoMedia);
+ setBufferProgress(0);
+ }
+
emit mediaChanged(m_currentResource);
+ if (m_state != oldState)
+ emit stateChanged(m_state);
}
void QGstreamerPlayerControl::setVideoOutput(QObject *output)
@@ -252,6 +293,68 @@ bool QGstreamerPlayerControl::isVideoAvailable() const
return m_session->isVideoAvailable();
}
+void QGstreamerPlayerControl::updateState(QMediaPlayer::State state)
+{
+ QMediaPlayer::MediaStatus oldStatus = m_mediaStatus;
+
+ switch (state) {
+ case QMediaPlayer::StoppedState:
+ if (m_state != QMediaPlayer::StoppedState)
+ emit stateChanged(m_state = QMediaPlayer::StoppedState);
+ break;
+
+ case QMediaPlayer::PlayingState:
+ case QMediaPlayer::PausedState:
+ if (m_state == QMediaPlayer::StoppedState)
+ m_mediaStatus = QMediaPlayer::LoadedMedia;
+ else {
+ if (m_bufferProgress == -1)
+ m_mediaStatus = QMediaPlayer::BufferedMedia;
+ }
+ break;
+ }
+
+ if (m_mediaStatus != oldStatus)
+ emit mediaStatusChanged(m_mediaStatus);
+}
+
+void QGstreamerPlayerControl::processEOS()
+{
+ m_mediaStatus = QMediaPlayer::EndOfMedia;
+ m_state = QMediaPlayer::StoppedState;
+
+ emit stateChanged(m_state);
+ emit mediaStatusChanged(m_mediaStatus);
+}
+
+void QGstreamerPlayerControl::setBufferProgress(int progress)
+{
+ if (m_bufferProgress == progress || m_mediaStatus == QMediaPlayer::NoMedia)
+ return;
+
+ QMediaPlayer::MediaStatus oldStatus = m_mediaStatus;
+
+ m_bufferProgress = progress;
+
+ if (m_state == QMediaPlayer::StoppedState) {
+ m_mediaStatus = QMediaPlayer::LoadedMedia;
+ } else {
+ if (m_bufferProgress < 100) {
+ m_mediaStatus = QMediaPlayer::StalledMedia;
+ m_session->pause();
+ } else {
+ m_mediaStatus = QMediaPlayer::BufferedMedia;
+ if (m_state == QMediaPlayer::PlayingState)
+ m_session->play();
+ }
+ }
+
+ if (m_mediaStatus != oldStatus)
+ emit mediaStatusChanged(m_mediaStatus);
+
+ emit bufferStatusChanged(m_bufferProgress);
+}
+
void QGstreamerPlayerControl::writeFifo()
{
if (m_fifoCanWrite) {
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h
index ae0f8b6..0c53945 100644
--- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h
+++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h
@@ -107,11 +107,18 @@ private Q_SLOTS:
void writeFifo();
void fifoReadyWrite(int socket);
+ void updateState(QMediaPlayer::State);
+ void processEOS();
+ void setBufferProgress(int progress);
+
private:
bool openFifo();
void closeFifo();
QGstreamerPlayerSession *m_session;
+ QMediaPlayer::State m_state;
+ QMediaPlayer::MediaStatus m_mediaStatus;
+ int m_bufferProgress;
QMediaContent m_currentResource;
QIODevice *m_stream;
QSocketNotifier *m_fifoNotifier;
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp
index 600621e..392a7a8 100644
--- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp
+++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp
@@ -57,7 +57,6 @@ QT_BEGIN_NAMESPACE
QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
:QObject(parent),
m_state(QMediaPlayer::StoppedState),
- m_mediaStatus(QMediaPlayer::UnknownMediaStatus),
m_busHelper(0),
m_playbin(0),
m_nullVideoOutput(0),
@@ -92,6 +91,7 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
m_busHelper->installSyncEventFilter(this);
m_nullVideoOutput = gst_element_factory_make("fakesink", NULL);
+ gst_object_ref(GST_OBJECT(m_nullVideoOutput));
g_object_set(G_OBJECT(m_playbin), "video-sink", m_nullVideoOutput, NULL);
// Initial volume
@@ -109,12 +109,14 @@ QGstreamerPlayerSession::~QGstreamerPlayerSession()
delete m_busHelper;
gst_object_unref(GST_OBJECT(m_bus));
gst_object_unref(GST_OBJECT(m_playbin));
+ gst_object_unref(GST_OBJECT(m_nullVideoOutput));
}
}
void QGstreamerPlayerSession::load(const QUrl &url)
{
m_url = url;
+
if (m_playbin) {
m_tags.clear();
emit tagsChanged();
@@ -259,26 +261,36 @@ bool QGstreamerPlayerSession::isSeekable() const
return m_seekable;
}
-void QGstreamerPlayerSession::play()
+bool QGstreamerPlayerSession::play()
{
if (m_playbin) {
if (gst_element_set_state(m_playbin, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
qWarning() << "GStreamer; Unable to play -" << m_url.toString();
- m_state = QMediaPlayer::StoppedState;
- m_mediaStatus = QMediaPlayer::InvalidMedia;
+ m_state = QMediaPlayer::StoppedState;
emit stateChanged(m_state);
- emit mediaStatusChanged(m_mediaStatus);
-
emit error(int(QMediaPlayer::ResourceError), tr("Unable to play %1").arg(m_url.path()));
- }
+ } else
+ return true;
}
+
+ return false;
}
-void QGstreamerPlayerSession::pause()
+bool QGstreamerPlayerSession::pause()
{
- if (m_playbin)
- gst_element_set_state(m_playbin, GST_STATE_PAUSED);
+ if (m_playbin) {
+ if (gst_element_set_state(m_playbin, GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE) {
+ qWarning() << "GStreamer; Unable to play -" << m_url.toString();
+ m_state = QMediaPlayer::StoppedState;
+
+ emit stateChanged(m_state);
+ emit error(int(QMediaPlayer::ResourceError), tr("Unable to play %1").arg(m_url.path()));
+ } else
+ return true;
+ }
+
+ return false;
}
void QGstreamerPlayerSession::stop()
@@ -292,31 +304,45 @@ void QGstreamerPlayerSession::stop()
}
}
-void QGstreamerPlayerSession::seek(qint64 ms)
+bool QGstreamerPlayerSession::seek(qint64 ms)
{
if (m_playbin && m_state != QMediaPlayer::StoppedState) {
gint64 position = (gint64)ms * 1000000;
- gst_element_seek_simple(m_playbin, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, position);
+ return gst_element_seek_simple(m_playbin, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, position);
}
+
+ return false;
}
void QGstreamerPlayerSession::setVolume(int volume)
{
- m_volume = volume;
- emit volumeChanged(m_volume);
+ if (m_volume != volume) {
+ m_volume = volume;
- if (!m_muted && m_playbin)
- g_object_set(G_OBJECT(m_playbin), "volume", m_volume/100.0, NULL);
+ if (m_playbin) {
+#ifndef USE_PLAYBIN2
+ if(!m_muted)
+#endif
+ g_object_set(G_OBJECT(m_playbin), "volume", m_volume/100.0, NULL);
+ }
+
+ emit volumeChanged(m_volume);
+ }
}
void QGstreamerPlayerSession::setMuted(bool muted)
{
- m_muted = muted;
-
- g_object_set(G_OBJECT(m_playbin), "volume", (m_muted ? 0 : m_volume/100.0), NULL);
+ if (m_muted != muted) {
+ m_muted = muted;
- emit mutedStateChanged(m_muted);
+#ifdef USE_PLAYBIN2
+ g_object_set(G_OBJECT(m_playbin), "mute", m_muted, NULL);
+#else
+ g_object_set(G_OBJECT(m_playbin), "volume", (m_muted ? 0 : m_volume/100.0), NULL);
+#endif
+ emit mutedStateChanged(m_muted);
+ }
}
static void addTagToMap(const GstTagList *list,
@@ -388,14 +414,6 @@ void QGstreamerPlayerSession::setSeekable(bool seekable)
}
}
-void QGstreamerPlayerSession::setMediaStatus(QMediaPlayer::MediaStatus status)
-{
- if (m_mediaStatus != status) {
- m_mediaStatus = status;
- emit mediaStatusChanged(status);
- }
-}
-
bool QGstreamerPlayerSession::processSyncMessage(const QGstreamerMessage &message)
{
GstMessage* gm = message.rawMessage();
@@ -440,9 +458,6 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
if (GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_playbin)) {
switch (GST_MESSAGE_TYPE(gm)) {
- case GST_MESSAGE_DURATION:
- break;
-
case GST_MESSAGE_STATE_CHANGED:
{
GstState oldState;
@@ -462,24 +477,19 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
switch (newState) {
case GST_STATE_VOID_PENDING:
case GST_STATE_NULL:
- setMediaStatus(QMediaPlayer::UnknownMediaStatus);
setSeekable(false);
if (m_state != QMediaPlayer::StoppedState)
emit stateChanged(m_state = QMediaPlayer::StoppedState);
break;
case GST_STATE_READY:
- setMediaStatus(QMediaPlayer::LoadedMedia);
setSeekable(false);
if (m_state != QMediaPlayer::StoppedState)
emit stateChanged(m_state = QMediaPlayer::StoppedState);
break;
case GST_STATE_PAUSED:
- //don't emit state changes for intermediate states
- if (m_state != QMediaPlayer::PausedState && pending == GST_STATE_VOID_PENDING)
+ if (m_state != QMediaPlayer::PausedState)
emit stateChanged(m_state = QMediaPlayer::PausedState);
- setMediaStatus(QMediaPlayer::LoadedMedia);
-
//check for seekable
if (oldState == GST_STATE_READY) {
/*
@@ -513,17 +523,13 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
if (m_state != QMediaPlayer::PlayingState)
emit stateChanged(m_state = QMediaPlayer::PlayingState);
+
break;
}
}
break;
case GST_MESSAGE_EOS:
- if (m_state != QMediaPlayer::StoppedState)
- emit stateChanged(m_state = QMediaPlayer::StoppedState);
-
- setMediaStatus(QMediaPlayer::EndOfMedia);
-
emit playbackFinished();
break;
@@ -546,7 +552,11 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
case GST_MESSAGE_INFO:
break;
case GST_MESSAGE_BUFFERING:
- setMediaStatus(QMediaPlayer::BufferingMedia);
+ {
+ int progress = 0;
+ gst_message_parse_buffering(gm, &progress);
+ emit bufferingProgressChanged(progress);
+ }
break;
case GST_MESSAGE_STATE_DIRTY:
case GST_MESSAGE_STEP_DONE:
@@ -556,8 +566,32 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message)
case GST_MESSAGE_STRUCTURE_CHANGE:
case GST_MESSAGE_APPLICATION:
case GST_MESSAGE_ELEMENT:
+ break;
case GST_MESSAGE_SEGMENT_START:
+ {
+ const GstStructure *structure = gst_message_get_structure(gm);
+ qint64 position = g_value_get_int64(gst_structure_get_value(structure, "position"));
+ position /= 1000000;
+ m_lastPosition = position;
+ emit positionChanged(position);
+ }
+ break;
case GST_MESSAGE_SEGMENT_DONE:
+ break;
+ case GST_MESSAGE_DURATION:
+ {
+ GstFormat format = GST_FORMAT_TIME;
+ gint64 duration = 0;
+
+ if (gst_element_query_duration(m_playbin, &format, &duration)) {
+ int newDuration = duration / 1000000;
+ if (m_duration != newDuration) {
+ m_duration = newDuration;
+ emit durationChanged(m_duration);
+ }
+ }
+ }
+ break;
case GST_MESSAGE_LATENCY:
#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 13)
case GST_MESSAGE_ASYNC_START:
@@ -604,7 +638,7 @@ void QGstreamerPlayerSession::getStreamsInfo()
haveAudio = audioStreamsCount > 0;
haveVideo = videoStreamsCount > 0;
- m_playbin2StreamOffset[QMediaStreamsControl::AudioStream] = 0;
+ /*m_playbin2StreamOffset[QMediaStreamsControl::AudioStream] = 0;
m_playbin2StreamOffset[QMediaStreamsControl::VideoStream] = audioStreamsCount;
m_playbin2StreamOffset[QMediaStreamsControl::SubPictureStream] = audioStreamsCount+videoStreamsCount;
@@ -648,7 +682,9 @@ void QGstreamerPlayerSession::getStreamsInfo()
}
m_streamProperties.append(streamProperties);
+
}
+ */
#else
enum {
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h
index d650ec7..edfec5b 100644
--- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h
+++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h
@@ -71,7 +71,6 @@ public:
QUrl url() const;
QMediaPlayer::State state() const { return m_state; }
- QMediaPlayer::MediaStatus mediaStatus() const { return m_mediaStatus; }
qint64 duration() const;
qint64 position() const;
@@ -105,11 +104,11 @@ public:
public slots:
void load(const QUrl &url);
- void play();
- void pause();
+ bool play();
+ bool pause();
void stop();
- void seek(qint64 pos);
+ bool seek(qint64 pos);
void setVolume(int volume);
void setMuted(bool muted);
@@ -118,7 +117,6 @@ signals:
void durationChanged(qint64 duration);
void positionChanged(qint64 position);
void stateChanged(QMediaPlayer::State state);
- void mediaStatusChanged(QMediaPlayer::MediaStatus mediaStatus);
void volumeChanged(int volume);
void mutedStateChanged(bool muted);
void audioAvailableChanged(bool audioAvailable);
@@ -137,11 +135,8 @@ private slots:
void setSeekable(bool);
private:
- void setMediaStatus(QMediaPlayer::MediaStatus);
-
QUrl m_url;
QMediaPlayer::State m_state;
- QMediaPlayer::MediaStatus m_mediaStatus;
QGstreamerBusHelper* m_busHelper;
GstElement* m_playbin;
GstElement* m_nullVideoOutput;
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml
new file mode 100644
index 0000000..4ad7f34
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml
@@ -0,0 +1,13 @@
+import Qt 4.6
+
+Item {
+ id: root
+
+ property int foo: 12
+ property int console: 11
+
+ property bool test1: foo == 12
+ property bool test2: console != 11
+ property bool test3: root.console == 11
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 8e7944d..75ee7ce 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -729,6 +729,16 @@ void tst_qdeclarativeecmascript::scope()
QCOMPARE(object->property("test5").toInt(), 24);
QCOMPARE(object->property("test6").toInt(), 24);
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("scope.3.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), true);
+ QCOMPARE(object->property("test3").toBool(), true);
+ }
}
/*
@@ -1666,8 +1676,7 @@ void tst_qdeclarativeecmascript::scriptScope()
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
emit object->argumentSignal(19, "Hello world!", 10.3);
- QEXPECT_FAIL("", "QTBUG-8641", Continue);
- QCOMPARE(object->property("result").toString(), QLatin1String("undefined"));
+ QCOMPARE(object->property("result").toString(), QString());
delete object;
}
@@ -1678,7 +1687,6 @@ void tst_qdeclarativeecmascript::scriptScope()
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
emit object->basicSignal();
- QEXPECT_FAIL("", "QTBUG-8641", Continue);
QCOMPARE(object->property("result").toString(), QLatin1String("world"));
delete object;
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml
index b46ec34..aecb3c3 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml
+++ b/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml
@@ -3,6 +3,8 @@ import Test 1.0 as Namespace
import Qt 4.6
QtObject {
+ property int value2: 8
MyQmlObject.value: 10
Namespace.MyQmlObject.value2: 13
+ MyQmlObject.onValueChanged: value2 = MyQmlObject.value
}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt
index 56e3eeb..2c6b8bf 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt
@@ -1,2 +1,2 @@
-3:5:"" is not a valid object id
+3:9:Invalid empty ID
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt
index 160e8b5..7251de1 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt
@@ -1 +1 @@
-3:5:"StartsWithUpperCase" is not a valid object id
+3:9:IDs cannot start with an uppercase letter
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.errors.txt
new file mode 100644
index 0000000..e4fd1db
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.errors.txt
@@ -0,0 +1 @@
+3:9:ID illegally masks global JavaScript property
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.qml
new file mode 100644
index 0000000..d4bc539
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.7.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: gc
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.errors.txt
new file mode 100644
index 0000000..b03ec6c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.errors.txt
@@ -0,0 +1 @@
+3:9:IDs must contain only letters, numbers, and underscores
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.qml
new file mode 100644
index 0000000..1ea615c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.8.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: hello.world
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.errors.txt
new file mode 100644
index 0000000..c010e79
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.errors.txt
@@ -0,0 +1 @@
+3:9:IDs must start with a letter or underscore
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.qml
new file mode 100644
index 0000000..57474b7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.9.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: "3hello"
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt
index 1ca678c..c010e79 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt
@@ -1 +1 @@
-3:5:"1" is not a valid object id
+3:9:IDs must start with a letter or underscore
diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
index ec2c5f7..df93dc8 100644
--- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h
+++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
@@ -62,7 +62,10 @@ public:
MyInterface() : id(913) {}
int id;
};
+
+QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(MyInterface, "com.trolltech.Qt.Test.MyInterface");
+QT_END_NAMESPACE
QML_DECLARE_INTERFACE(MyInterface);
struct MyCustomVariantType
@@ -75,17 +78,20 @@ Q_DECLARE_METATYPE(MyCustomVariantType);
class MyAttachedObject : public QObject
{
Q_OBJECT
- Q_PROPERTY(int value READ value WRITE setValue)
+ Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)
Q_PROPERTY(int value2 READ value2 WRITE setValue2)
public:
MyAttachedObject(QObject *parent) : QObject(parent), m_value(0), m_value2(0) {}
int value() const { return m_value; }
- void setValue(int v) { m_value = v; }
+ void setValue(int v) { if (m_value != v) { m_value = v; emit valueChanged(); } }
int value2() const { return m_value2; }
void setValue2(int v) { m_value2 = v; }
+signals:
+ void valueChanged();
+
private:
int m_value;
int m_value2;
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index 39f5223..5d480fa 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -232,6 +232,9 @@ void tst_qdeclarativelanguage::errors_data()
QTest::newRow("invalidID.4") << "invalidID.4.qml" << "invalidID.4.errors.txt" << false;
QTest::newRow("invalidID.5") << "invalidID.5.qml" << "invalidID.5.errors.txt" << false;
QTest::newRow("invalidID.6") << "invalidID.6.qml" << "invalidID.6.errors.txt" << false;
+ QTest::newRow("invalidID.7") << "invalidID.7.qml" << "invalidID.7.errors.txt" << false;
+ QTest::newRow("invalidID.8") << "invalidID.8.qml" << "invalidID.8.errors.txt" << false;
+ QTest::newRow("invalidID.9") << "invalidID.9.qml" << "invalidID.9.errors.txt" << false;
QTest::newRow("unsupportedProperty") << "unsupportedProperty.qml" << "unsupportedProperty.errors.txt" << false;
QTest::newRow("nullDotProperty") << "nullDotProperty.qml" << "nullDotProperty.errors.txt" << true;
@@ -327,9 +330,6 @@ void tst_qdeclarativelanguage::errors()
QFETCH(QString, errorFile);
QFETCH(bool, create);
- if (file == "invalidID.6.qml")
- QTest::ignoreMessage(QtWarningMsg, "id \"StartsWithUpperCase\" is invalid: ids cannot start with uppercase letters");
-
QDeclarativeComponent component(&engine, TEST_FILE(file));
if(create) {
@@ -713,6 +713,11 @@ void tst_qdeclarativelanguage::attachedProperties()
QVERIFY(attached != 0);
QCOMPARE(attached->property("value"), QVariant(10));
QCOMPARE(attached->property("value2"), QVariant(13));
+
+ QEXPECT_FAIL("", "QTBUG-8677", Abort);
+ attached->setProperty("value", QVariant(12));
+ int val = object->property("value2").toInt();
+ QCOMPARE(val, 12);
}
// Tests non-static object properties
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
index f3caa7f..92f7aef 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
@@ -50,7 +50,6 @@ class tst_qdeclarativemoduleplugin : public QObject
public:
tst_qdeclarativemoduleplugin() {
QCoreApplication::addLibraryPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("plugin"));
-qDebug() << QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("plugin");
}
private slots:
diff --git a/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp b/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp
index 26ff3d5..a9a0077 100644
--- a/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp
+++ b/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp
@@ -172,9 +172,11 @@ tst_qdeclarativenumberformatter::tst_qdeclarativenumberformatter()
<< "00,000,001.0000"
<< "00,000,001.0100"; // end
+ /*
qDebug() << "strings.size()" << strings.size()
<< "\nformats.size()" << formats.size()
<< "texts.size()" << texts.size();
+ */
}
void tst_qdeclarativenumberformatter::text_data()
diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
index 3a8a892..d23d74c 100644
--- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
+++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
@@ -365,7 +365,7 @@ void tst_QDeclarativePositioners::test_grid_animated()
}
void tst_QDeclarativePositioners::test_propertychanges()
{
- QDeclarativeView *canvas = createView("data/propertychanges.qml");
+ QDeclarativeView *canvas = createView(SRCDIR "/data/propertychanges.qml");
QDeclarativeGrid *grid = qobject_cast<QDeclarativeGrid*>(canvas->rootObject());
QDeclarativeTransition *rowTransition = canvas->rootObject()->findChild<QDeclarativeTransition*>("rowTransition");
diff --git a/tests/auto/declarative/qdeclarativeproperty/data/TestType.qml b/tests/auto/declarative/qdeclarativeproperty/data/TestType.qml
new file mode 100644
index 0000000..1dfb3e1
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeproperty/data/TestType.qml
@@ -0,0 +1,6 @@
+import Qt 4.6
+
+QtObject {
+ property int a: 10
+}
+
diff --git a/tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml b/tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml
new file mode 100644
index 0000000..8085db2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeproperty/data/readSynthesizedObject.qml
@@ -0,0 +1,9 @@
+import Qt 4.6
+
+QtObject {
+ property TestType test
+
+ test: TestType {
+ property int b: 19
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
index 22e50cc..af1e1b6 100644
--- a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
+++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
@@ -3,3 +3,5 @@ contains(QT_CONFIG,declarative): QT += declarative
macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeproperty.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
index 0333d98..9b8a643 100644
--- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
+++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
@@ -46,6 +46,14 @@
#include <private/qguard_p.h>
#include <private/qdeclarativebinding_p.h>
#include <QtGui/QLineEdit>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qdir.h>
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ QFileInfo fileInfo(__FILE__);
+ return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(QLatin1String("data/") + filename));
+}
class MyQmlObject : public QObject
{
@@ -181,6 +189,7 @@ class PropertyObject : public QObject
Q_PROPERTY(QUrl url READ url WRITE setUrl);
Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty);
Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal)
+ Q_PROPERTY(MyQmlObject *qmlObject READ qmlObject);
Q_CLASSINFO("DefaultProperty", "defaultProperty");
public:
@@ -202,6 +211,7 @@ public:
int propertyWithNotify() const { return m_propertyWithNotify; }
void setPropertyWithNotify(int i) { m_propertyWithNotify = i; emit oddlyNamedNotifySignal(); }
+ MyQmlObject *qmlObject() { return &m_qmlObject; }
signals:
void clicked();
void oddlyNamedNotifySignal();
@@ -211,6 +221,7 @@ private:
QRect m_rect;
QUrl m_url;
int m_propertyWithNotify;
+ MyQmlObject m_qmlObject;
};
QML_DECLARE_TYPE(PropertyObject);
@@ -953,6 +964,32 @@ void tst_qdeclarativeproperty::read()
QCOMPARE(p.read(), QVariant());
}
+ // Object property
+ {
+ PropertyObject o;
+ QDeclarativeProperty p(&o, "qmlObject");
+ QCOMPARE(p.propertyTypeCategory(), QDeclarativeProperty::Object);
+ QCOMPARE(p.propertyType(), qMetaTypeId<MyQmlObject*>());
+ QVariant v = p.read();
+ QVERIFY(v.userType() == QMetaType::QObjectStar);
+ QVERIFY(qvariant_cast<QObject *>(v) == o.qmlObject());
+ }
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("readSynthesizedObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QDeclarativeProperty p(object, "test", &engine);
+
+ QCOMPARE(p.propertyTypeCategory(), QDeclarativeProperty::Object);
+ QVERIFY(p.propertyType() != QMetaType::QObjectStar);
+
+ QVariant v = p.read();
+ QVERIFY(v.userType() == QMetaType::QObjectStar);
+ QCOMPARE(qvariant_cast<QObject *>(v)->property("a").toInt(), 10);
+ QCOMPARE(qvariant_cast<QObject *>(v)->property("b").toInt(), 19);
+ }
+
// Attached property
{
QDeclarativeComponent component(&engine);
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index b677fec..b1935df 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -663,15 +663,17 @@ void tst_qdeclarativetextedit::delegateLoading()
QVERIFY(delegate);
view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail1.qml"));
view->show();
+ QTRY_VERIFY(view->status()==QDeclarativeView::Error);
view->setFocus();
QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test
view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail2.qml"));
view->show();
+ QTRY_VERIFY(view->status()==QDeclarativeView::Error);
view->setFocus();
QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test
- //ErrorB should get a component which is ready but component.create() returns null
+ //A test should be added here with a component which is ready but component.create() returns null
//Not sure how to accomplish this with QDeclarativeTextEdits cursor delegate
- //###This could be a case of overzealous defensive programming
+ //###This was only needed for code coverage, and could be a case of overzealous defensive programming
//delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateErrorB");
//QVERIFY(!delegate);
}
diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp
index 1d6bedc..b63e14b 100644
--- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp
+++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp
@@ -181,7 +181,8 @@ void tst_qdeclarativewebview::settings()
QVERIFY(wv != 0);
QTRY_COMPARE(wv->property("progress").toDouble(), 1.0);
- QObject *s = qvariant_cast<QObject*>(wv->property("settings"));
+ QObject *s = QDeclarativeProperty(wv,"settings").object();
+ QVERIFY(s != 0);
// merely tests that setting gets stored (in QWebSettings)
// behavioural tests are in WebKit.
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
index b0fc212..15caea6 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
+++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
@@ -106,7 +106,7 @@ void tst_QDeclarativeWorkerScript::source_data()
QTest::addColumn<bool>("valid");
QTest::newRow("valid") << QUrl::fromLocalFile(SRCDIR "/data/worker.qml") << true;
- QTest::newRow("invalid") << QUrl("file:///asdjfk.js") << false;
+ QTest::newRow("invalid") << QUrl::fromLocalFile("asdjfk.js") << false;
}
void tst_QDeclarativeWorkerScript::messaging()
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
index 37d48fa..7dec0ee 100644
--- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
@@ -1168,7 +1168,7 @@ void tst_qdeclarativexmlhttprequest::redirects()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirecttarget.html");
- server.serveDirectory("data");
+ server.serveDirectory(SRCDIR "/data");
QDeclarativeComponent component(&engine, TEST_FILE("redirects.qml"));
QObject *object = component.beginCreate(engine.rootContext());
@@ -1187,7 +1187,7 @@ void tst_qdeclarativexmlhttprequest::redirects()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirectmissing.html");
- server.serveDirectory("data");
+ server.serveDirectory(SRCDIR "/data");
QDeclarativeComponent component(&engine, TEST_FILE("redirectError.qml"));
QObject *object = component.beginCreate(engine.rootContext());
@@ -1206,7 +1206,7 @@ void tst_qdeclarativexmlhttprequest::redirects()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirect.html");
- server.serveDirectory("data");
+ server.serveDirectory(SRCDIR "/data");
QDeclarativeComponent component(&engine, TEST_FILE("redirectRecur.qml"));
QObject *object = component.beginCreate(engine.rootContext());
diff --git a/tests/auto/declarative/runall.sh b/tests/auto/declarative/runall.sh
index 39485d3..62e03e3 100755
--- a/tests/auto/declarative/runall.sh
+++ b/tests/auto/declarative/runall.sh
@@ -41,37 +41,60 @@
##
############################################################################/
-Xnest :7 2>/dev/null &
-sleep 1
-trap "kill $!" EXIT
-export DISPLAY=:7
+if [ "$(uname)" = Linux ]
+then
+ Xnest :7 2>/dev/null &
+ sleep 1
+ trap "kill $!" EXIT
+ export DISPLAY=:7
+ export LANG=en_US
+ kwin 2>/dev/null &
+ sleep 1
+fi
-( make -k -j1 install 2>&1;
- for exe in $(make install | sed -n 's/^install .* "\([^"]*qt4\/tst_[^"]*\)".*/\1/p')
- do
- $exe
- done
-) |
+function filter
+{
+ exe=$1
+ skip=0
while read line
do
- case "$line" in
- make*Error) echo "$line";;
- make*Stop) echo "$line";;
- make*) ;;
- install*) ;;
- */qmake*) ;;
- */bin/moc*) ;;
- *targ.debug*) ;;
- g++*) ;;
- cd*) ;;
- PASS*) ;;
- QDEBUG*) ;;
- Makefile*) ;;
- Config*) ;;
- Totals*) ;;
- \**) ;;
- ./*) ;;
- *) echo "$line"
- esac
+ if [ $skip != 0 ]
+ then
+ let skip=skip-1
+ else
+ case "$line" in
+ make*Error) echo "$line";;
+ make*Stop) echo "$line";;
+ /*/bin/make*) ;;
+ make*) ;;
+ install*) ;;
+ QDeclarativeDebugServer:*Waiting*) ;;
+ QDeclarativeDebugServer:*Connection*) ;;
+ */qmake*) ;;
+ */bin/moc*) ;;
+ *targ.debug*) ;;
+ g++*) ;;
+ cd*) ;;
+ XFAIL*) skip=1;;
+ SKIP*) skip=1;;
+ PASS*) ;;
+ QDEBUG*) ;;
+ Makefile*) ;;
+ Config*) ;;
+ Totals*) ;;
+ \**) ;;
+ ./*) ;;
+ *tst_*) echo "$line" ;;
+ *) echo "$exe: $line"
+ esac
+ fi
done
+}
+
+make -k -j1 install 2>&1 | filter build
+for exe in $(make install | sed -n 's/^install .* "\([^"]*qt4\/tst_[^"]*\)".*/\1/p')
+do
+ echo $exe
+ $exe 2>&1 | filter $exe
+done
diff --git a/tests/auto/qmediaservice/tst_qmediaservice.cpp b/tests/auto/qmediaservice/tst_qmediaservice.cpp
index 35f661d..a0cb69d 100644
--- a/tests/auto/qmediaservice/tst_qmediaservice.cpp
+++ b/tests/auto/qmediaservice/tst_qmediaservice.cpp
@@ -69,7 +69,9 @@ class QtTestMediaControlA : public QMediaControl
#define QtTestMediaControlA_iid "com.nokia.QtTestMediaControlA"
+QT_BEGIN_NAMESPACE
Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlA, QtTestMediaControlA_iid)
+QT_END_NAMESPACE
class QtTestMediaControlB : public QMediaControl
@@ -78,7 +80,9 @@ class QtTestMediaControlB : public QMediaControl
};
#define QtTestMediaControlB_iid "com.nokia.QtTestMediaControlB"
+QT_BEGIN_NAMESPACE
Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlB, QtTestMediaControlB_iid)
+QT_END_NAMESPACE
class QtTestMediaControlC : public QMediaControl
@@ -87,7 +91,9 @@ class QtTestMediaControlC : public QMediaControl
};
#define QtTestMediaControlC_iid "com.nokia.QtTestMediaControlC"
+QT_BEGIN_NAMESPACE
Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlC, QtTestMediaControlA_iid) // Yes A.
+QT_END_NAMESPACE
class QtTestMediaControlD : public QMediaControl
{
@@ -95,7 +101,9 @@ class QtTestMediaControlD : public QMediaControl
};
#define QtTestMediaControlD_iid "com.nokia.QtTestMediaControlD"
+QT_BEGIN_NAMESPACE
Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlD, QtTestMediaControlD_iid)
+QT_END_NAMESPACE
class QtTestMediaControlE : public QMediaControl
{