aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/examples/examples-groups.qdoc10
-rw-r--r--examples/qtquick/mousearea/mousearea-wheel-example.qml84
-rw-r--r--examples/quick/positioners/content/add.pngbin810 -> 0 bytes
-rw-r--r--examples/quick/positioners/content/del.pngbin488 -> 0 bytes
-rw-r--r--examples/quick/positioners/main.cpp (renamed from examples/quick/positioners/content/Button.qml)41
-rw-r--r--examples/quick/positioners/positioners-attachedproperties.qml43
-rw-r--r--examples/quick/positioners/positioners-transitions.qml243
-rw-r--r--examples/quick/positioners/positioners.pro10
-rw-r--r--examples/quick/positioners/positioners.qml239
-rw-r--r--examples/quick/positioners/positioners.qmlproject16
-rw-r--r--examples/quick/righttoleft/layoutdirection/layoutdirection.qml30
-rw-r--r--examples/quick/righttoleft/layoutmirroring/layoutmirroring.qml172
-rw-r--r--examples/quick/righttoleft/main.cpp41
-rw-r--r--examples/quick/righttoleft/righttoleft.pro10
-rw-r--r--examples/quick/righttoleft/righttoleft.qml69
-rw-r--r--examples/quick/righttoleft/righttoleft.qmlproject16
-rw-r--r--examples/quick/righttoleft/textalignment/textalignment.qml72
-rw-r--r--examples/quick/shadereffects/main.cpp41
-rw-r--r--examples/quick/shadereffects/shadereffects.pro10
-rw-r--r--examples/quick/shadereffects/shadereffects.qml482
-rw-r--r--examples/quick/shadereffects/shadereffects.qmlproject16
-rw-r--r--examples/quick/text/fonts/availableFonts.qml4
-rw-r--r--examples/quick/text/fonts/banner.qml2
-rw-r--r--examples/quick/text/fonts/fonts.qml30
-rw-r--r--examples/quick/text/fonts/hello.qml6
-rw-r--r--examples/quick/text/imgtag/TextWithImage.qml6
-rw-r--r--examples/quick/text/imgtag/imgtag.qml10
-rw-r--r--examples/quick/text/main.cpp41
-rw-r--r--examples/quick/text/styledtext-layout.qml48
-rw-r--r--examples/quick/text/text.pro10
-rw-r--r--examples/quick/text/text.qml14
-rw-r--r--src/qml/debugger/debugger.pri4
-rw-r--r--src/qml/qml/qqmlbinding.cpp3
-rw-r--r--src/qml/qml/qqmlscript.cpp1
-rw-r--r--src/qml/qml/qquicklistmodel.cpp18
-rw-r--r--src/qml/qml/rewriter/textwriter.cpp34
-rw-r--r--src/qml/qml/rewriter/textwriter_p.h4
-rw-r--r--src/qml/qml/v4/qv4compiler.cpp29
-rw-r--r--src/qml/qml/v4/qv4ir.cpp51
-rw-r--r--src/qml/qml/v4/qv4ir_p.h2
-rw-r--r--src/qml/qml/v4/qv4irbuilder.cpp22
-rw-r--r--src/qml/qml/v8/qv8sequencewrapper_p_p.h25
-rw-r--r--src/quick/items/qquickcanvas.cpp11
-rw-r--r--src/quick/items/qquickevents.cpp104
-rw-r--r--src/quick/items/qquickevents_p_p.h38
-rw-r--r--src/quick/items/qquickgridview.cpp26
-rw-r--r--src/quick/items/qquickitemsmodule.cpp1
-rw-r--r--src/quick/items/qquickitemview.cpp105
-rw-r--r--src/quick/items/qquickitemview_p_p.h22
-rw-r--r--src/quick/items/qquickitemviewtransition.cpp77
-rw-r--r--src/quick/items/qquickitemviewtransition_p.h26
-rw-r--r--src/quick/items/qquicklistview.cpp23
-rw-r--r--src/quick/items/qquickmousearea.cpp37
-rw-r--r--src/quick/items/qquickmousearea_p.h3
-rw-r--r--src/quick/items/qquickmousearea_p_p.h1
-rw-r--r--src/quick/items/qquickpositioners.cpp89
-rw-r--r--src/quick/items/qquickpositioners_p.h21
-rw-r--r--src/quick/items/qquickpositioners_p_p.h4
-rw-r--r--src/quick/items/qquicktextedit.cpp2
-rw-r--r--sync.profile2
-rw-r--r--tests/auto/qml/debugger/debugger.pro2
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro7
-rw-r--r--tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp4
-rw-r--r--tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro7
-rw-r--r--tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro7
-rw-r--r--tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro8
-rw-r--r--tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp4
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro7
-rw-r--r--tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp4
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro (renamed from tests/auto/qml/debugger/qqmlenginedebug/qqmlenginedebug.pro)9
-rw-r--r--tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp (renamed from tests/auto/qml/debugger/qqmlenginedebug/tst_qqmlenginedebug.cpp)70
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro7
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro10
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp3
-rw-r--r--tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro9
-rw-r--r--tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp3
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp3
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.pri9
-rw-r--r--tests/auto/qml/debugger/shared/debugutil_p.h2
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.cpp (renamed from src/qml/debugger/qqmldebugclient.cpp)25
-rw-r--r--tests/auto/qml/debugger/shared/qqmldebugclient.h (renamed from src/qml/debugger/qqmldebugclient_p.h)21
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebug.cpp (renamed from src/qml/debugger/qqmlenginedebug.cpp)10
-rw-r--r--tests/auto/qml/debugger/shared/qqmlenginedebug_p.h (renamed from src/qml/debugger/qqmlenginedebug_p.h)9
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml14
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp4
-rw-r--r--tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp14
-rw-r--r--tests/auto/qml/v4/data/nestedObjectAccess2.qml5
-rw-r--r--tests/auto/qml/v4/testtypes.h3
-rw-r--r--tests/auto/qml/v4/tst_v4.cpp31
-rw-r--r--tests/auto/quick/qquickgridview/data/multipleTransitions.qml6
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp39
-rw-r--r--tests/auto/quick/qquicklistview/data/multipleTransitions.qml6
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp35
-rw-r--r--tests/auto/quick/qquickmousearea/data/wheel.qml24
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp21
-rw-r--r--tools/qmlprofiler/profileclient.h2
-rw-r--r--tools/qmlprofiler/qmlprofiler.pro8
-rw-r--r--tools/qmlprofiler/qqmldebugclient.cpp410
-rw-r--r--tools/qmlprofiler/qqmldebugclient.h109
101 files changed, 2398 insertions, 1178 deletions
diff --git a/doc/src/examples/examples-groups.qdoc b/doc/src/examples/examples-groups.qdoc
index 0ecd117128..85a9e51087 100644
--- a/doc/src/examples/examples-groups.qdoc
+++ b/doc/src/examples/examples-groups.qdoc
@@ -50,16 +50,6 @@
feature. You can run and observe the behavior of each example.
*/
/*!
- \title QML Examples - Text
- \example declarative/text
- \brief This is a collection of QML examples
- \image qml-text-example.png
-
- This is a collection of small QML examples relating to text. Each example is
- a small QML file, usually containing or emphasizing a particular element or
- feature. You can run and observe the behavior of each example.
-*/
-/*!
\title QML Examples - Touch Interaction
\example declarative/touchinteraction
\brief This is a collection of QML examples
diff --git a/examples/qtquick/mousearea/mousearea-wheel-example.qml b/examples/qtquick/mousearea/mousearea-wheel-example.qml
new file mode 100644
index 0000000000..60cfb166f8
--- /dev/null
+++ b/examples/qtquick/mousearea/mousearea-wheel-example.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ height: 700
+ width: 485
+ color: "#333333"
+
+ Column {
+ anchors.centerIn: parent
+ spacing: 2
+
+ Repeater {
+ model: ["#9ACD32", "#EEEEEE", "#FFD700", "#87CEEB"]
+
+ Rectangle {
+ property real scaleFactor: 1
+
+ height: 40 * scaleFactor
+ width: 60 * scaleFactor
+ color: modelData
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ MouseArea {
+ anchors.fill: parent
+ onWheel: {
+ if (wheel.modifiers & Qt.ControlModifier) {
+ if (wheel.angleDelta.y > 0)
+ parent.scaleFactor += 0.2;
+ else if (parent.scaleFactor - 0.2 >= 0.2)
+ parent.scaleFactor -= 0.2;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Text {
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ color: "#FFD700"
+ text: "Rotate the mouse wheel pressing <Control> to resize the squares."
+ }
+}
diff --git a/examples/quick/positioners/content/add.png b/examples/quick/positioners/content/add.png
deleted file mode 100644
index 1ee45423e3..0000000000
--- a/examples/quick/positioners/content/add.png
+++ /dev/null
Binary files differ
diff --git a/examples/quick/positioners/content/del.png b/examples/quick/positioners/content/del.png
deleted file mode 100644
index 8d2eaed523..0000000000
--- a/examples/quick/positioners/content/del.png
+++ /dev/null
Binary files differ
diff --git a/examples/quick/positioners/content/Button.qml b/examples/quick/positioners/main.cpp
index ee3aa9057e..cfe8db915d 100644
--- a/examples/quick/positioners/content/Button.qml
+++ b/examples/quick/positioners/main.cpp
@@ -37,42 +37,5 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
-import QtQuick 2.0
-
-Rectangle {
- id: page
-
- property string text
- property string icon
- signal clicked
-
- border.color: "black"; color: "steelblue"; radius: 5
- width: pix.width + textelement.width + 13
- height: pix.height + 10
-
- Image { id: pix; x: 5; y:5; source: parent.icon }
-
- Text {
- id: textelement
- text: page.text; color: "white"
- x: pix.width + pix.x + 3
- anchors.verticalCenter: pix.verticalCenter
- }
-
- MouseArea {
- id: mr
- anchors.fill: parent
- onClicked: { parent.focus = true; page.clicked() }
- }
-
- states: State {
- name: "pressed"; when: mr.pressed
- PropertyChanges { target: textelement; x: 5 }
- PropertyChanges { target: pix; x: textelement.x + textelement.width + 3 }
- }
-
- transitions: Transition {
- NumberAnimation { properties: "x,left"; easing.type: Easing.InOutQuad; duration: 200 }
- }
-}
+#include "../../shared/shared.h"
+DECLARATIVE_EXAMPLE_MAIN(positioners)
diff --git a/examples/quick/positioners/positioners-attachedproperties.qml b/examples/quick/positioners/positioners-attachedproperties.qml
index a05927f5ea..af1124368d 100644
--- a/examples/quick/positioners/positioners-attachedproperties.qml
+++ b/examples/quick/positioners/positioners-attachedproperties.qml
@@ -41,12 +41,12 @@
import QtQuick 2.0
Rectangle {
- width: 400
- height: 100
+ width: 320
+ height: 480
- // Create row with four rectangles, the fourth one is hidden
- Row {
- id: row
+ // Create column with four rectangles, the fourth one is hidden
+ Column {
+ id: column
Rectangle {
id: red
@@ -54,10 +54,19 @@ Rectangle {
width: 100
height: 100
+ Text {
+ anchors.left: parent.right
+ anchors.leftMargin: 20
+ anchors.verticalCenter: parent.verticalCenter
+ text: "Index: " + parent.Positioner.index
+ + (parent.Positioner.isFirstItem ? " (First)" : "")
+ + (parent.Positioner.isLastItem ? " (Last)" : "")
+ }
+
// When mouse is clicked, display the values of the positioner
MouseArea {
anchors.fill: parent
- onClicked: row.showInfo(red.Positioner)
+ onClicked: column.showInfo(red.Positioner)
}
}
@@ -67,10 +76,19 @@ Rectangle {
width: 100
height: 100
+ Text {
+ anchors.left: parent.right
+ anchors.leftMargin: 20
+ anchors.verticalCenter: parent.verticalCenter
+ text: "Index: " + parent.Positioner.index
+ + (parent.Positioner.isFirstItem ? " (First)" : "")
+ + (parent.Positioner.isLastItem ? " (Last)" : "")
+ }
+
// When mouse is clicked, display the values of the positioner
MouseArea {
anchors.fill: parent
- onClicked: row.showInfo(green.Positioner)
+ onClicked: column.showInfo(green.Positioner)
}
}
@@ -80,10 +98,19 @@ Rectangle {
width: 100
height: 100
+ Text {
+ anchors.left: parent.right
+ anchors.leftMargin: 20
+ anchors.verticalCenter: parent.verticalCenter
+ text: "Index: " + parent.Positioner.index
+ + (parent.Positioner.isFirstItem ? " (First)" : "")
+ + (parent.Positioner.isLastItem ? " (Last)" : "")
+ }
+
// When mouse is clicked, display the values of the positioner
MouseArea {
anchors.fill: parent
- onClicked: row.showInfo(blue.Positioner)
+ onClicked: column.showInfo(blue.Positioner)
}
}
diff --git a/examples/quick/positioners/positioners-transitions.qml b/examples/quick/positioners/positioners-transitions.qml
new file mode 100644
index 0000000000..6081c9f8a8
--- /dev/null
+++ b/examples/quick/positioners/positioners-transitions.qml
@@ -0,0 +1,243 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: page
+ width: 320; height: 480
+ property int effectiveOpacity: 1.0
+ Timer {
+ interval: 2000
+ running: true
+ repeat: true
+ onTriggered: effectiveOpacity = (effectiveOpacity == 1.0 ? 0.0 : 1.0)
+ }
+
+ Column {
+ id: layout1
+ y: 0
+ move: Transition {
+ NumberAnimation { properties: "y"; easing.type: Easing.OutBounce }
+ }
+ add: Transition {
+ NumberAnimation { properties: "y"; easing.type: Easing.OutQuad }
+ }
+
+ Rectangle { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueV1
+ visible: opacity != 0
+ width: 100; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ opacity: effectiveOpacity
+ }
+
+ Rectangle { color: "green"; width: 100; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueV2
+ visible: opacity != 0
+ width: 100; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ opacity: effectiveOpacity
+ }
+
+ Rectangle { color: "orange"; width: 100; height: 50; border.color: "black"; radius: 15 }
+ Rectangle { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 }
+ }
+
+ Row {
+ id: layout2
+ y: 320
+ move: Transition {
+ NumberAnimation { properties: "x"; easing.type: Easing.OutBounce }
+ }
+ add: Transition {
+ NumberAnimation { properties: "x"; easing.type: Easing.OutQuad }
+ }
+
+ Rectangle { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueH1
+ visible: opacity != 0
+ width: 50; height: 100
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ opacity: effectiveOpacity
+ }
+
+ Rectangle { color: "green"; width: 50; height: 100; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueH2
+ visible: opacity != 0
+ width: 50; height: 100
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ opacity: effectiveOpacity
+ }
+
+ Rectangle { color: "orange"; width: 50; height: 100; border.color: "black"; radius: 15 }
+ Rectangle { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 }
+ }
+
+ Grid {
+ x: 120; y: 0
+ columns: 3
+
+ move: Transition {
+ NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce }
+ }
+
+ add: Transition {
+ NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce }
+ }
+
+ Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueG1
+ visible: opacity != 0
+ width: 50; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ opacity: effectiveOpacity
+ }
+
+ Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueG2
+ visible: opacity != 0
+ width: 50; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ opacity: effectiveOpacity
+ }
+
+ Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueG3
+ visible: opacity != 0
+ width: 50; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ opacity: effectiveOpacity
+ }
+
+ Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 }
+ Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 }
+ Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 }
+ }
+
+ Flow {
+ id: layout4
+ x: 120; y: 160; width: 150
+
+ move: Transition {
+ NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce }
+ }
+
+ add: Transition {
+ NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce }
+ }
+
+ Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueF1
+ visible: opacity != 0
+ width: 60; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ opacity: effectiveOpacity
+ }
+
+ Rectangle { color: "green"; width: 30; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueF2
+ visible: opacity != 0
+ width: 60; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ opacity: effectiveOpacity
+ }
+
+ Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueF3
+ visible: opacity != 0
+ width: 40; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ opacity: effectiveOpacity
+ }
+
+ Rectangle { color: "red"; width: 80; height: 50; border.color: "black"; radius: 15 }
+ }
+}
diff --git a/examples/quick/positioners/positioners.pro b/examples/quick/positioners/positioners.pro
new file mode 100644
index 0000000000..15530dc89f
--- /dev/null
+++ b/examples/quick/positioners/positioners.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+
+QT += quick declarative
+SOURCES += main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/quick/positioners
+qml.files = positioners.qml positioners-transitions.qml positioners-attachedproperties.qml
+qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/quick/positioners
+INSTALLS += target qml
+
diff --git a/examples/quick/positioners/positioners.qml b/examples/quick/positioners/positioners.qml
index 6627ad7dd4..373fa28cae 100644
--- a/examples/quick/positioners/positioners.qml
+++ b/examples/quick/positioners/positioners.qml
@@ -39,230 +39,31 @@
****************************************************************************/
import QtQuick 2.0
-import "content"
+import "../../shared" as Examples
-Rectangle {
- id: page
- width: 320; height: 480
- Flickable {
- anchors.fill: parent
- contentWidth: 420; contentHeight: 420
-
- Column {
- id: layout1
- y: 0
- move: Transition {
- NumberAnimation { properties: "y"; easing.type: Easing.OutBounce }
- }
- add: Transition {
- NumberAnimation { properties: "y"; easing.type: Easing.OutQuad }
- }
-
- Rectangle { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 }
-
- Rectangle {
- id: blueV1
- visible: opacity != 0
- width: 100; height: 50
- color: "lightsteelblue"
- border.color: "black"
- radius: 15
- Behavior on opacity { NumberAnimation {} }
- }
-
- Rectangle { color: "green"; width: 100; height: 50; border.color: "black"; radius: 15 }
-
- Rectangle {
- id: blueV2
- visible: opacity != 0
- width: 100; height: 50
- color: "lightsteelblue"
- border.color: "black"
- radius: 15
- Behavior on opacity { NumberAnimation {} }
- }
-
- Rectangle { color: "orange"; width: 100; height: 50; border.color: "black"; radius: 15 }
- }
-
- Row {
- id: layout2
- y: 300
- move: Transition {
- NumberAnimation { properties: "x"; easing.type: Easing.OutBounce }
- }
- add: Transition {
- NumberAnimation { properties: "x"; easing.type: Easing.OutQuad }
- }
-
- Rectangle { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 }
-
- Rectangle {
- id: blueH1
- visible: opacity != 0
- width: 50; height: 100
- color: "lightsteelblue"
- border.color: "black"
- radius: 15
- Behavior on opacity { NumberAnimation {} }
- }
-
- Rectangle { color: "green"; width: 50; height: 100; border.color: "black"; radius: 15 }
-
- Rectangle {
- id: blueH2
- visible: opacity != 0
- width: 50; height: 100
- color: "lightsteelblue"
- border.color: "black"
- radius: 15
- Behavior on opacity { NumberAnimation {} }
- }
-
- Rectangle { color: "orange"; width: 50; height: 100; border.color: "black"; radius: 15 }
- }
-
- Button {
- x: 135; y: 90
- text: "Remove"
- icon: "del.png"
-
- onClicked: {
- blueH2.opacity = 0
- blueH1.opacity = 0
- blueV1.opacity = 0
- blueV2.opacity = 0
- blueG1.opacity = 0
- blueG2.opacity = 0
- blueG3.opacity = 0
- blueF1.opacity = 0
- blueF2.opacity = 0
- blueF3.opacity = 0
- }
- }
-
- Button {
- x: 145; y: 140
- text: "Add"
- icon: "add.png"
-
- onClicked: {
- blueH2.opacity = 1
- blueH1.opacity = 1
- blueV1.opacity = 1
- blueV2.opacity = 1
- blueG1.opacity = 1
- blueG2.opacity = 1
- blueG3.opacity = 1
- blueF1.opacity = 1
- blueF2.opacity = 1
- blueF3.opacity = 1
- }
- }
-
- Grid {
- x: 260; y: 0
- columns: 3
-
- move: Transition {
- NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce }
- }
-
- add: Transition {
- NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce }
- }
-
- Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 }
-
- Rectangle {
- id: blueG1
- visible: opacity != 0
- width: 50; height: 50
- color: "lightsteelblue"
- border.color: "black"
- radius: 15
- Behavior on opacity { NumberAnimation {} }
- }
-
- Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 }
-
- Rectangle {
- id: blueG2
- visible: opacity != 0
- width: 50; height: 50
- color: "lightsteelblue"
- border.color: "black"
- radius: 15
- Behavior on opacity { NumberAnimation {} }
- }
-
- Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 }
-
- Rectangle {
- id: blueG3
- visible: opacity != 0
- width: 50; height: 50
- color: "lightsteelblue"
- border.color: "black"
- radius: 15
- Behavior on opacity { NumberAnimation {} }
- }
+/*!
+ \title QtQuick Examples - Positioners
+ \example quick/positioners
+ \brief This is a collection of QML Positioner examples.
+ \image qml-positioners-example.png
- Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 }
- Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 }
- Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 }
- }
-
- Flow {
- id: layout4
- x: 260; y: 250; width: 150
-
- move: Transition {
- NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce }
- }
+ This is a collection of small QML examples relating to positioners. Each example is
+ a small QML file emphasizing a particular element or feature.
- add: Transition {
- NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce }
- }
-
- Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 }
-
- Rectangle {
- id: blueF1
- visible: opacity != 0
- width: 60; height: 50
- color: "lightsteelblue"
- border.color: "black"
- radius: 15
- Behavior on opacity { NumberAnimation {} }
- }
+ Transitions shows animated transistions when showing or hiding items in a positioner.
- Rectangle { color: "green"; width: 30; height: 50; border.color: "black"; radius: 15 }
+ Attached Properties show using the attached property to determine where in a positioner an item is.
+*/
- Rectangle {
- id: blueF2
- visible: opacity != 0
- width: 60; height: 50
- color: "lightsteelblue"
- border.color: "black"
- radius: 15
- Behavior on opacity { NumberAnimation {} }
- }
-
- Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 }
-
- Rectangle {
- id: blueF3
- visible: opacity != 0
- width: 40; height: 50
- color: "lightsteelblue"
- border.color: "black"
- radius: 15
- Behavior on opacity { NumberAnimation {} }
+Item {
+ height: 480
+ width: 320
+ Examples.LauncherList {
+ id: ll
+ anchors.fill: parent
+ Component.onCompleted: {
+ addExample("Transitions", "Fluidly shows and hides elements", Qt.resolvedUrl("positioners-transitions.qml"));
+ addExample("Attached Properties", "Knows where it is in the positioner", Qt.resolvedUrl("positioners-attachedproperties.qml"));
}
-
- Rectangle { color: "red"; width: 80; height: 50; border.color: "black"; radius: 15 }
- }
-
}
}
diff --git a/examples/quick/positioners/positioners.qmlproject b/examples/quick/positioners/positioners.qmlproject
new file mode 100644
index 0000000000..03a2012225
--- /dev/null
+++ b/examples/quick/positioners/positioners.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "positioners.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/righttoleft/layoutdirection/layoutdirection.qml b/examples/quick/righttoleft/layoutdirection/layoutdirection.qml
index 0c65647d5b..ee8e52848a 100644
--- a/examples/quick/righttoleft/layoutdirection/layoutdirection.qml
+++ b/examples/quick/righttoleft/layoutdirection/layoutdirection.qml
@@ -46,14 +46,18 @@ Rectangle {
property int direction: Qt.application.layoutDirection
LayoutMirroring.enabled: mirror
LayoutMirroring.childrenInherit: true
- width: column.width + 80
- height: column.height + 40
+ width: 320
+ height: 480
Column {
- id: column
- width: 190
+ id: columnA
spacing: 10
- anchors.centerIn: parent
+ x: 10
+ y: 10
+ width: 140
+ Item {
+ id: rowCell
+ }
Text {
text: "Row"
anchors.horizontalCenter: parent.horizontalCenter
@@ -68,7 +72,7 @@ Rectangle {
}
}
Repeater {
- model: 4
+ model: 3
Loader {
property int value: index
sourceComponent: positionerDelegate
@@ -83,14 +87,14 @@ Rectangle {
Grid {
layoutDirection: root.direction
- spacing: 10; columns: 4
+ spacing: 10; columns: 3
move: Transition {
NumberAnimation {
properties: "x"
}
}
Repeater {
- model: 11
+ model: 8
Loader {
property int value: index
sourceComponent: positionerDelegate
@@ -112,13 +116,19 @@ Rectangle {
}
}
Repeater {
- model: 10
+ model: 8
Loader {
property int value: index
sourceComponent: positionerDelegate
}
}
}
+ }
+ Column {
+ id: columnB
+ spacing: 10
+ x: 160
+ y: 10
Text {
text: "ListView"
@@ -142,7 +152,7 @@ Rectangle {
GridView {
clip: true
- width: 200; height: 160
+ width: 150; height: 160
cellWidth: 50; cellHeight: 50
layoutDirection: root.direction
model: 48
diff --git a/examples/quick/righttoleft/layoutmirroring/layoutmirroring.qml b/examples/quick/righttoleft/layoutmirroring/layoutmirroring.qml
index 5c4739bd57..38ac1d2759 100644
--- a/examples/quick/righttoleft/layoutmirroring/layoutmirroring.qml
+++ b/examples/quick/righttoleft/layoutmirroring/layoutmirroring.qml
@@ -45,8 +45,8 @@ Rectangle {
property bool mirror: Qt.application.layoutDirection == Qt.RightToLeft
LayoutMirroring.enabled: mirror
LayoutMirroring.childrenInherit: true
- width: 400
- height: 875
+ width: 320
+ height: 480
color: "lightsteelblue"
Column {
@@ -54,63 +54,6 @@ Rectangle {
anchors { left: parent.left; right: parent.right; top: parent.top; margins: 10 }
Text {
- text: "Positioners"
- anchors.left: parent.left
- }
-
- Column {
- id: positioners
- spacing: 5
- anchors.left: parent.left
- Row {
- id: row
- spacing: 4
- property string text: "THISISROW"
- anchors.left: parent.left
- Repeater {
- model: parent.text.length
- delegate: positionerDelegate
- }
- }
- Flow {
- id: flow
- spacing: 4
- width: 90
- property string text: "THISISFLOW"
- anchors.left: parent.left
- Repeater {
- model: parent.text.length
- delegate: positionerDelegate
- }
- }
- Grid {
- id: grid
- spacing: 4
- columns: 6
- property string text: "THISISGRID"
- anchors.left: parent.left
- Repeater {
- model: parent.text.length
- delegate: positionerDelegate
- }
- }
- Component {
- id: positionerDelegate
- Text {
- color: "white"
- font.pixelSize: 20
- text: parent.text[index]
- Rectangle {
- z: -1
- opacity: 0.7
- color: "black"
- anchors.fill: parent
- }
- }
- }
- }
-
- Text {
text: "Text alignment"
anchors.left: parent.left
}
@@ -151,62 +94,6 @@ Rectangle {
}
Text {
- text: "Model views"
- anchors.left: parent.left
- }
-
- Column {
- id: views
- spacing: 10
- anchors.left: parent.left
- ListView {
- id: listView
- z: -1
- clip: true
- model: text.length
- width: 360; height: 45
- orientation: Qt.Horizontal
- property string text: "LISTVIEWLISTVIEWLISTVIEWLISTVIEWLISTVIEWLISTVIEW"
- delegate: Rectangle {
- color: "black"
- width: 45; height: 45
- Rectangle {
- anchors { fill: parent; margins: 1 }
- color: "red"
- }
- Text {
- text: listView.text[index]
- font.pixelSize: 30
- anchors.centerIn: parent
- }
- }
- }
- GridView {
- id: gridView
- z: -1
- clip: true
- model: text.length
- width: 180; height: 90
- cellWidth: 45; cellHeight: 45
- property string text: "GRIDVIEWGRIDVIEWGRIDVIEWGRIDVIEWGRIDVIEWGRIDVIEW"
- anchors.left: parent.left
- delegate: Rectangle {
- color: "black"
- width: 45; height: 45
- Rectangle {
- anchors { fill: parent; margins: 1 }
- color: "red"
- }
- Text {
- anchors.centerIn: parent
- font.pixelSize: 30
- text: gridView.text[index]
- }
- }
- }
- }
-
- Text {
text: "Item x"
anchors.left: parent.left
}
@@ -279,33 +166,36 @@ Rectangle {
}
}
}
- Rectangle {
- id: mirrorButton
- color: mouseArea2.pressed ? "black" : "gray"
- height: 50; width: parent.width
- anchors.left: parent.left
- Column {
- anchors.centerIn: parent
- Text {
- text: root.mirror ? "Mirrored" : "Not mirrored"
- color: "white"
- font.pixelSize: 16
- anchors.horizontalCenter: parent.horizontalCenter
- }
- Text {
- text: "(click here to toggle)"
- color: "white"
- font.pixelSize: 10
- font.italic: true
- anchors.horizontalCenter: parent.horizontalCenter
- }
+ }
+
+ Rectangle {
+ id: mirrorButton
+ color: mouseArea2.pressed ? "black" : "gray"
+ height: 50; width: 160
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.margins: 10
+ Column {
+ anchors.centerIn: parent
+ Text {
+ text: root.mirror ? "Mirrored" : "Not mirrored"
+ color: "white"
+ font.pixelSize: 16
+ anchors.horizontalCenter: parent.horizontalCenter
}
- MouseArea {
- id: mouseArea2
- anchors.fill: parent
- onClicked: {
- root.mirror = !root.mirror;
- }
+ Text {
+ text: "(click here to toggle)"
+ color: "white"
+ font.pixelSize: 10
+ font.italic: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ MouseArea {
+ id: mouseArea2
+ anchors.fill: parent
+ onClicked: {
+ root.mirror = !root.mirror;
}
}
}
diff --git a/examples/quick/righttoleft/main.cpp b/examples/quick/righttoleft/main.cpp
new file mode 100644
index 0000000000..c92fc542f1
--- /dev/null
+++ b/examples/quick/righttoleft/main.cpp
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "../../shared/shared.h"
+DECLARATIVE_EXAMPLE_MAIN(righttoleft)
diff --git a/examples/quick/righttoleft/righttoleft.pro b/examples/quick/righttoleft/righttoleft.pro
new file mode 100644
index 0000000000..eb1ecbbf18
--- /dev/null
+++ b/examples/quick/righttoleft/righttoleft.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+
+QT += quick declarative
+SOURCES += main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/righttoleft
+qml.files = righttoleft.qml layoutdirection layoutmirroring textalignment
+qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/righttoleft
+INSTALLS += target qml
+
diff --git a/examples/quick/righttoleft/righttoleft.qml b/examples/quick/righttoleft/righttoleft.qml
new file mode 100644
index 0000000000..6561595603
--- /dev/null
+++ b/examples/quick/righttoleft/righttoleft.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../../shared" as Examples
+
+/*!
+ \title QtQuick Examples - Right to Left
+ \example qtquick/Right to Left
+ \brief This is a collection of QML Right to Left examples.
+ \image qml-righttoleft-example.png
+
+ This is a collection of small QML examples relating to right to left(RTL) localization support.
+
+ Layout direction shows RTL layouting.
+ Layout mirroring shows automatic mirroring of horizontal layouts in RTL locales.
+ Text Alignment shows automatic mirroring of text alignment in RTL locales.
+*/
+
+Item {
+ height: 480
+ width: 320
+ Examples.LauncherList {
+ id: ll
+ anchors.fill: parent
+ Component.onCompleted: {
+ addExample("Layout Direction", "Shows RTL layouting in positioners and views", Qt.resolvedUrl("layoutdirection/layoutdirection.qml"));
+ addExample("Layout Mirroring", "Shows RTL layouting in basic text and anchors", Qt.resolvedUrl("layoutmirroring/layoutmirroring.qml"));
+ addExample("Text Alignment", "Shows RTL layouting in various text elements", Qt.resolvedUrl("textalignment/textalignment.qml"));
+ }
+ }
+}
diff --git a/examples/quick/righttoleft/righttoleft.qmlproject b/examples/quick/righttoleft/righttoleft.qmlproject
new file mode 100644
index 0000000000..f394d9030e
--- /dev/null
+++ b/examples/quick/righttoleft/righttoleft.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "righttoleft.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/righttoleft/textalignment/textalignment.qml b/examples/quick/righttoleft/textalignment/textalignment.qml
index ef5b97bb1a..3302ce5873 100644
--- a/examples/quick/righttoleft/textalignment/textalignment.qml
+++ b/examples/quick/righttoleft/textalignment/textalignment.qml
@@ -43,10 +43,13 @@ import QtQuick 2.0
Rectangle {
id: root
color: "white"
- width: containerColumn.width
- height: containerColumn.height + containerColumn.anchors.topMargin
+ //width: containerColumn.width
+ //height: containerColumn.height + containerColumn.anchors.topMargin
+ width: 320
+ height: 480
property bool mirror: false
+ property int pxSz: 18
property variant horizontalAlignment: undefined
property variant editorType: ["Plain Text", "Styled Text", "Plain Rich Text", "Italic Rich Text", "Plain TextEdit", "Italic TextEdit", "TextInput"]
@@ -76,30 +79,32 @@ Rectangle {
spacing: 10
width: editorTypeRow.width
anchors { top: parent.top; topMargin: 5 }
- Row {
+ ListView {
+ width: 320
+ height: 320
id: editorTypeRow
- Repeater {
- model: editorType.length
- Item {
- width: editorColumn.width
- height: editorColumn.height
+ model: editorType.length
+ orientation: ListView.Horizontal
+ cacheBuffer: 1000//Load the really expensive ones async if possible
+ delegate: Item {
+ width: editorColumn.width
+ height: editorColumn.height
+ Column {
+ id: editorColumn
+ spacing: 5
+ width: textColumn.width+10
+ Text {
+ text: root.editorType[index]
+ font.pixelSize: 16
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
Column {
- id: editorColumn
+ id: textColumn
spacing: 5
- width: textColumn.width+10
- Text {
- text: root.editorType[index]
- font.pixelSize: 16
- anchors.horizontalCenter: parent.horizontalCenter
- }
- Column {
- id: textColumn
- spacing: 5
- anchors.horizontalCenter: parent.horizontalCenter
- Repeater {
- model: textComponents.length
- delegate: textComponents[index]
- }
+ anchors.horizontalCenter: parent.horizontalCenter
+ Repeater {
+ model: textComponents.length
+ delegate: textComponents[index]
}
}
}
@@ -190,7 +195,7 @@ Rectangle {
Text {
width: 180
text: root.text[index]
- font.pixelSize: 24
+ font.pixelSize: pxSz
wrapMode: Text.WordWrap
horizontalAlignment: root.horizontalAlignment
LayoutMirroring.enabled: root.mirror
@@ -204,6 +209,7 @@ Rectangle {
text: root.description[index]
color: Qt.rgba(1,1,1,1.0)
anchors.centerIn: parent
+ font.pixelSize: pxSz - 2
Rectangle {
z: -1
color: Qt.rgba(0.3, 0, 0, 0.3)
@@ -223,7 +229,7 @@ Rectangle {
Text {
width: 180
text: root.text[index]
- font.pixelSize: 24
+ font.pixelSize: pxSz
wrapMode: Text.WordWrap
horizontalAlignment: root.horizontalAlignment
LayoutMirroring.enabled: root.mirror
@@ -239,6 +245,7 @@ Rectangle {
text: root.description[index]
color: Qt.rgba(1,1,1,1.0)
anchors.centerIn: parent
+ font.pixelSize: pxSz - 2
Rectangle {
z: -1
color: Qt.rgba(0.3, 0, 0, 0.3)
@@ -258,7 +265,7 @@ Rectangle {
Text {
width: 180
text: root.text[index]
- font.pixelSize: 24
+ font.pixelSize: pxSz
wrapMode: Text.WordWrap
horizontalAlignment: root.horizontalAlignment
LayoutMirroring.enabled: root.mirror
@@ -272,6 +279,7 @@ Rectangle {
text: root.description[index]
color: Qt.rgba(1,1,1,1.0)
anchors.centerIn: parent
+ font.pixelSize: pxSz - 2
Rectangle {
z: -1
color: Qt.rgba(0.3, 0, 0, 0.3)
@@ -291,7 +299,7 @@ Rectangle {
Text {
width: 180
text: "<i>" + root.text[index] + "</i>"
- font.pixelSize: 24
+ font.pixelSize: pxSz
wrapMode: Text.WordWrap
horizontalAlignment: root.horizontalAlignment
LayoutMirroring.enabled: root.mirror
@@ -306,6 +314,7 @@ Rectangle {
text: root.description[index]
color: Qt.rgba(1,1,1,1.0)
anchors.centerIn: parent
+ font.pixelSize: pxSz - 2
Rectangle {
z: -1
color: Qt.rgba(0.3, 0, 0, 0.3)
@@ -325,7 +334,7 @@ Rectangle {
TextEdit {
width: 180
text: root.text[index]
- font.pixelSize: 24
+ font.pixelSize: pxSz
cursorVisible: true
wrapMode: TextEdit.WordWrap
horizontalAlignment: root.horizontalAlignment
@@ -339,6 +348,7 @@ Rectangle {
text: root.description[index]
color: Qt.rgba(1,1,1,1.0)
anchors.centerIn: parent
+ font.pixelSize: pxSz - 2
Rectangle {
z: -1
color: Qt.rgba(0.3, 0, 0, 0.3)
@@ -358,7 +368,7 @@ Rectangle {
TextEdit {
width: 180
text: "<i>" + root.text[index] + "<i>"
- font.pixelSize: 24
+ font.pixelSize: pxSz
cursorVisible: true
wrapMode: TextEdit.WordWrap
textFormat: TextEdit.RichText
@@ -373,6 +383,7 @@ Rectangle {
text: root.description[index]
color: Qt.rgba(1,1,1,1.0)
anchors.centerIn: parent
+ font.pixelSize: pxSz - 2
Rectangle {
z: -1
color: Qt.rgba(0.3, 0, 0, 0.3)
@@ -396,7 +407,7 @@ Rectangle {
id: textInput
width: 180
text: root.text[index]
- font.pixelSize: 24
+ font.pixelSize: pxSz
cursorVisible: true
horizontalAlignment: root.horizontalAlignment
LayoutMirroring.enabled: root.mirror
@@ -409,6 +420,7 @@ Rectangle {
text: root.description[index]
color: Qt.rgba(1,1,1,1.0)
anchors.centerIn: parent
+ font.pixelSize: pxSz - 2
Rectangle {
z: -1
color: Qt.rgba(0.3, 0, 0, 0.3)
diff --git a/examples/quick/shadereffects/main.cpp b/examples/quick/shadereffects/main.cpp
new file mode 100644
index 0000000000..c28d2c836d
--- /dev/null
+++ b/examples/quick/shadereffects/main.cpp
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "../../shared/shared.h"
+DECLARATIVE_EXAMPLE_MAIN(shadereffects)
diff --git a/examples/quick/shadereffects/shadereffects.pro b/examples/quick/shadereffects/shadereffects.pro
new file mode 100644
index 0000000000..04ac62b497
--- /dev/null
+++ b/examples/quick/shadereffects/shadereffects.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+
+QT += quick declarative
+SOURCES += main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/quick/shadereffects
+qml.files = shadereffects.qml content
+qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/quick/shadereffects
+INSTALLS += target qml
+
diff --git a/examples/quick/shadereffects/shadereffects.qml b/examples/quick/shadereffects/shadereffects.qml
index b820c8131e..b76c960a8f 100644
--- a/examples/quick/shadereffects/shadereffects.qml
+++ b/examples/quick/shadereffects/shadereffects.qml
@@ -42,7 +42,7 @@
import QtQuick 2.0
import "content"
-Image {
+Rectangle {
width: 320
height: 480
/*!
@@ -54,261 +54,261 @@ Image {
This example demonstrates a couple of visual effects that you can perform
with shaders in QtQuick 2.0
*/
- source: "../snake/content/pics/background.png"
-
- Flickable {
- anchors.fill: parent
- contentWidth: 640
- contentHeight: 360
+ property color col: "lightsteelblue"
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: Qt.tint(col, "#20FFFFFF") }
+ GradientStop { position: 0.1; color: Qt.tint(col, "#20AAAAAA") }
+ GradientStop { position: 0.9; color: Qt.tint(col, "#20666666") }
+ GradientStop { position: 1.0; color: Qt.tint(col, "#20000000") }
+ }
- ShaderEffectSource {
- id: theSource
- sourceItem: theItem
- smooth: true
- }
+ ShaderEffectSource {
+ id: theSource
+ sourceItem: theItem
+ smooth: true
+ }
- function saturate(x) {
- return Math.min(Math.max(x, 0), 1)
- }
+ function saturate(x) {
+ return Math.min(Math.max(x, 0), 1)
+ }
- function sliderToColor(x) {
- return Qt.rgba(saturate(Math.max(2 - 6 * x, 6 * x - 4)),
- saturate(Math.min(6 * x, 4 - 6 * x)),
- saturate(Math.min(6 * x - 2, 6 - 6 * x)))
- }
+ function sliderToColor(x) {
+ return Qt.rgba(saturate(Math.max(2 - 6 * x, 6 * x - 4)),
+ saturate(Math.min(6 * x, 4 - 6 * x)),
+ saturate(Math.min(6 * x - 2, 6 - 6 * x)))
+ }
- Grid {
- anchors.centerIn: parent
- columns: 3
+ Grid {
+ anchors.centerIn: parent
+ columns: 2
- Item {
- id: theItem
- width: 180
- height: 180
- ListView {
- anchors.centerIn: parent
- width: 160
- height: 140
- clip: true
- snapMode: ListView.SnapOneItem
- model: VisualItemModel {
- Text {
- width: 160
- height: 140
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- font.pixelSize: 120
- font.family: "Times"
- color: "blue"
- text: "Qt"
- }
- Image {
- width: 160
- height: 140
- source: "content/qt-logo.png"
- smooth: true
- }
- Image {
- width: 160
- height: 140
- source: "content/face-smile.png"
- smooth: true
- }
+ Item {
+ id: theItem
+ width: 160
+ height: 160
+ ListView {
+ anchors.centerIn: parent
+ width: 160
+ height: 140
+ clip: true
+ snapMode: ListView.SnapOneItem
+ model: VisualItemModel {
+ Text {
+ width: 160
+ height: 140
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: 120
+ font.family: "Times"
+ color: "blue"
+ text: "Qt"
+ }
+ Image {
+ width: 160
+ height: 140
+ source: "content/qt-logo.png"
+ smooth: true
+ }
+ Image {
+ width: 160
+ height: 140
+ source: "content/face-smile.png"
+ smooth: true
}
}
}
- ShaderEffect {
- width: 180
- height: 180
- property variant source: theSource
- property real amplitude: 0.04 * wobbleSlider.value
- property real frequency: 20
- property real time: 0
- NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 }
- fragmentShader:
- "uniform lowp float qt_Opacity;" +
- "uniform highp float amplitude;" +
- "uniform highp float frequency;" +
- "uniform highp float time;" +
- "uniform sampler2D source;" +
- "varying highp vec2 qt_TexCoord0;" +
- "void main() {" +
- " highp vec2 p = sin(time + frequency * qt_TexCoord0);" +
- " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;" +
- "}"
- Slider {
- id: wobbleSlider
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- height: 40
- }
+ }
+ ShaderEffect {
+ width: 160
+ height: 160
+ property variant source: theSource
+ property real amplitude: 0.04 * wobbleSlider.value
+ property real frequency: 20
+ property real time: 0
+ NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 }
+ fragmentShader:
+ "uniform lowp float qt_Opacity;" +
+ "uniform highp float amplitude;" +
+ "uniform highp float frequency;" +
+ "uniform highp float time;" +
+ "uniform sampler2D source;" +
+ "varying highp vec2 qt_TexCoord0;" +
+ "void main() {" +
+ " highp vec2 p = sin(time + frequency * qt_TexCoord0);" +
+ " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;" +
+ "}"
+ Slider {
+ id: wobbleSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
}
- ShaderEffect {
- width: 180
- height: 180
- property variant source: theSource
- property variant shadow: ShaderEffectSource {
- smooth: true
- sourceItem: ShaderEffect {
- width: theItem.width
- height: theItem.height
- property variant delta: Qt.size(0.0, 1.0 / height)
- property variant source: ShaderEffectSource {
- smooth: true
- sourceItem: ShaderEffect {
- width: theItem.width
- height: theItem.height
- property variant delta: Qt.size(1.0 / width, 0.0)
- property variant source: theSource
- fragmentShader: "
- uniform lowp float qt_Opacity;
- uniform sampler2D source;
- uniform highp vec2 delta;
- varying highp vec2 qt_TexCoord0;
- void main() {
- gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
- + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
- + 0.2466 * texture2D(source, qt_TexCoord0)
- + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
- + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
- }"
- }
+ }
+ ShaderEffect {
+ width: 160
+ height: 160
+ property variant source: theSource
+ property variant shadow: ShaderEffectSource {
+ smooth: true
+ sourceItem: ShaderEffect {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(0.0, 1.0 / height)
+ property variant source: ShaderEffectSource {
+ smooth: true
+ sourceItem: ShaderEffect {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(1.0 / width, 0.0)
+ property variant source: theSource
+ fragmentShader: "
+ uniform lowp float qt_Opacity;
+ uniform sampler2D source;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
+ }"
}
- fragmentShader: "
- uniform lowp float qt_Opacity;
- uniform sampler2D source;
- uniform highp vec2 delta;
- varying highp vec2 qt_TexCoord0;
- void main() {
- gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
- + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
- + 0.2466 * texture2D(source, qt_TexCoord0)
- + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
- + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
- }"
}
- }
- property real angle: 0
- property variant offset: Qt.point(15.0 * Math.cos(angle), 15.0 * Math.sin(angle))
- NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 }
- property variant delta: Qt.size(offset.x / width, offset.y / height)
- property real darkness: shadowSlider.value
- fragmentShader: "
- uniform lowp float qt_Opacity;
- uniform highp vec2 offset;
- uniform sampler2D source;
- uniform sampler2D shadow;
- uniform highp float darkness;
- uniform highp vec2 delta;
- varying highp vec2 qt_TexCoord0;
- void main() {
- lowp vec4 fg = texture2D(source, qt_TexCoord0);
- lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta);
- gl_FragColor = (fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a)) * qt_Opacity;
- }"
- Slider {
- id: shadowSlider
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- height: 40
+ fragmentShader: "
+ uniform lowp float qt_Opacity;
+ uniform sampler2D source;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
+ }"
}
}
- ShaderEffect {
- width: 180
- height: 180
- property variant source: theSource
- property variant delta: Qt.size(0.5 / width, 0.5 / height)
- fragmentShader: "
- uniform sampler2D source;
- uniform highp vec2 delta;
- uniform highp float qt_Opacity;
- varying highp vec2 qt_TexCoord0;
- void main() {
- lowp vec4 tl = texture2D(source, qt_TexCoord0 - delta);
- lowp vec4 tr = texture2D(source, qt_TexCoord0 + vec2(delta.x, -delta.y));
- lowp vec4 bl = texture2D(source, qt_TexCoord0 - vec2(delta.x, -delta.y));
- lowp vec4 br = texture2D(source, qt_TexCoord0 + delta);
- lowp vec4 gx = (tl + bl) - (tr + br);
- lowp vec4 gy = (tl + tr) - (bl + br);
- gl_FragColor.xyz = vec3(0.);
- gl_FragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * qt_Opacity;
- }"
+ property real angle: 0
+ property variant offset: Qt.point(15.0 * Math.cos(angle), 15.0 * Math.sin(angle))
+ NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 }
+ property variant delta: Qt.size(offset.x / width, offset.y / height)
+ property real darkness: shadowSlider.value
+ fragmentShader: "
+ uniform lowp float qt_Opacity;
+ uniform highp vec2 offset;
+ uniform sampler2D source;
+ uniform sampler2D shadow;
+ uniform highp float darkness;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ lowp vec4 fg = texture2D(source, qt_TexCoord0);
+ lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta);
+ gl_FragColor = (fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a)) * qt_Opacity;
+ }"
+ Slider {
+ id: shadowSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
}
- ShaderEffect {
- width: 180
- height: 180
- property variant source: theSource
- property color tint: sliderToColor(colorizeSlider.value)
- fragmentShader: "
- uniform sampler2D source;
- uniform lowp vec4 tint;
- uniform lowp float qt_Opacity;
- varying highp vec2 qt_TexCoord0;
- void main() {
- lowp vec4 c = texture2D(source, qt_TexCoord0);
- lowp float lo = min(min(c.x, c.y), c.z);
- lowp float hi = max(max(c.x, c.y), c.z);
- gl_FragColor = qt_Opacity * vec4(mix(vec3(lo), vec3(hi), tint.xyz), c.w);
- }"
- Slider {
- id: colorizeSlider
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- height: 40
- }
+ }
+ ShaderEffect {
+ width: 160
+ height: 160
+ property variant source: theSource
+ property variant delta: Qt.size(0.5 / width, 0.5 / height)
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform highp vec2 delta;
+ uniform highp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ lowp vec4 tl = texture2D(source, qt_TexCoord0 - delta);
+ lowp vec4 tr = texture2D(source, qt_TexCoord0 + vec2(delta.x, -delta.y));
+ lowp vec4 bl = texture2D(source, qt_TexCoord0 - vec2(delta.x, -delta.y));
+ lowp vec4 br = texture2D(source, qt_TexCoord0 + delta);
+ lowp vec4 gx = (tl + bl) - (tr + br);
+ lowp vec4 gy = (tl + tr) - (bl + br);
+ gl_FragColor.xyz = vec3(0.);
+ gl_FragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * qt_Opacity;
+ }"
+ }
+ ShaderEffect {
+ width: 160
+ height: 160
+ property variant source: theSource
+ property color tint: sliderToColor(colorizeSlider.value)
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform lowp vec4 tint;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ lowp vec4 c = texture2D(source, qt_TexCoord0);
+ lowp float lo = min(min(c.x, c.y), c.z);
+ lowp float hi = max(max(c.x, c.y), c.z);
+ gl_FragColor = qt_Opacity * vec4(mix(vec3(lo), vec3(hi), tint.xyz), c.w);
+ }"
+ Slider {
+ id: colorizeSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
}
- ShaderEffect {
- width: 180
- height: 180
- mesh: Qt.size(10, 10)
- property variant source: theSource
- property real bend: 0
- property real minimize: 0
- property real side: genieSlider.value
- SequentialAnimation on bend {
- loops: Animation.Infinite
- NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine }
- PauseAnimation { duration: 1600 }
- NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine }
- PauseAnimation { duration: 1000 }
- }
- SequentialAnimation on minimize {
- loops: Animation.Infinite
- PauseAnimation { duration: 300 }
- NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine }
- PauseAnimation { duration: 1000 }
- NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine }
- PauseAnimation { duration: 1300 }
- }
- vertexShader: "
- uniform highp mat4 qt_Matrix;
- uniform highp float bend;
- uniform highp float minimize;
- uniform highp float side;
- uniform highp float width;
- uniform highp float height;
- attribute highp vec4 qt_Vertex;
- attribute highp vec2 qt_MultiTexCoord0;
- varying highp vec2 qt_TexCoord0;
- void main() {
- qt_TexCoord0 = qt_MultiTexCoord0;
- highp vec4 pos = qt_Vertex;
- pos.y = mix(qt_Vertex.y, height, minimize);
- highp float t = pos.y / height;
- t = (3. - 2. * t) * t * t;
- pos.x = mix(qt_Vertex.x, side * width, t * bend);
- gl_Position = qt_Matrix * pos;
- }"
- Slider {
- id: genieSlider
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- height: 40
- }
+ }
+ ShaderEffect {
+ width: 160
+ height: 160
+ mesh: Qt.size(10, 10)
+ property variant source: theSource
+ property real bend: 0
+ property real minimize: 0
+ property real side: genieSlider.value
+ SequentialAnimation on bend {
+ loops: Animation.Infinite
+ NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1600 }
+ NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1000 }
+ }
+ SequentialAnimation on minimize {
+ loops: Animation.Infinite
+ PauseAnimation { duration: 300 }
+ NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1000 }
+ NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1300 }
+ }
+ vertexShader: "
+ uniform highp mat4 qt_Matrix;
+ uniform highp float bend;
+ uniform highp float minimize;
+ uniform highp float side;
+ uniform highp float width;
+ uniform highp float height;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ highp vec4 pos = qt_Vertex;
+ pos.y = mix(qt_Vertex.y, height, minimize);
+ highp float t = pos.y / height;
+ t = (3. - 2. * t) * t * t;
+ pos.x = mix(qt_Vertex.x, side * width, t * bend);
+ gl_Position = qt_Matrix * pos;
+ }"
+ Slider {
+ id: genieSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
}
}
}
diff --git a/examples/quick/shadereffects/shadereffects.qmlproject b/examples/quick/shadereffects/shadereffects.qmlproject
new file mode 100644
index 0000000000..10191ad11c
--- /dev/null
+++ b/examples/quick/shadereffects/shadereffects.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "shadereffects.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/text/fonts/availableFonts.qml b/examples/quick/text/fonts/availableFonts.qml
index 0b87259556..63a74d269b 100644
--- a/examples/quick/text/fonts/availableFonts.qml
+++ b/examples/quick/text/fonts/availableFonts.qml
@@ -41,7 +41,7 @@
import QtQuick 2.0
Rectangle {
- width: 480; height: 640; color: "steelblue"
+ width: 320; height: 480; color: "steelblue"
ListView {
anchors.fill: parent; model: Qt.fontFamilies()
@@ -50,7 +50,7 @@ Rectangle {
height: 40; width: ListView.view.width
Text {
anchors.centerIn: parent
- text: modelData; font.family: modelData; font.pixelSize: 24; color: "white"
+ text: modelData; font.family: modelData; font.pixelSize: 20; color: "white"
}
}
}
diff --git a/examples/quick/text/fonts/banner.qml b/examples/quick/text/fonts/banner.qml
index 6c9aa25fa1..7f690c24c3 100644
--- a/examples/quick/text/fonts/banner.qml
+++ b/examples/quick/text/fonts/banner.qml
@@ -47,7 +47,7 @@ Rectangle {
property color textColor: "lightsteelblue"
property string text: "Hello world! "
- width: 640; height: 320
+ width: 320; height: 480
color: "steelblue"
Row {
diff --git a/examples/quick/text/fonts/fonts.qml b/examples/quick/text/fonts/fonts.qml
index 78cef25eae..f0e9b60bc5 100644
--- a/examples/quick/text/fonts/fonts.qml
+++ b/examples/quick/text/fonts/fonts.qml
@@ -43,7 +43,7 @@ import QtQuick 2.0
Rectangle {
property string myText: "The quick brown fox jumps over the lazy dog."
- width: 800; height: 480
+ width: 320; height: 480
color: "steelblue"
FontLoader { id: fixedFont; name: "Courier" }
@@ -51,43 +51,45 @@ Rectangle {
FontLoader { id: webFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" }
Column {
- anchors { fill: parent; leftMargin: 10; rightMargin: 10 }
+ anchors { fill: parent; leftMargin: 10; rightMargin: 10; topMargin: 10 }
spacing: 15
Text {
text: myText
color: "lightsteelblue"
width: parent.width
- elide: Text.ElideRight
- font.family: "Times"; font.pointSize: 42
+ wrapMode: Text.WordWrap
+ font.family: "Times"; font.pixelSize: 20
}
Text {
text: myText
color: "lightsteelblue"
width: parent.width
- elide: Text.ElideLeft
- font { family: "Times"; pointSize: 42; capitalization: Font.AllUppercase }
+ wrapMode: Text.WordWrap
+ horizontalAlignment: Text.AlignHCenter
+ font { family: "Times"; pixelSize: 20; capitalization: Font.AllUppercase }
}
Text {
text: myText
color: "lightsteelblue"
width: parent.width
- elide: Text.ElideMiddle
- font { family: fixedFont.name; pointSize: 42; weight: Font.Bold; capitalization: Font.AllLowercase }
+ horizontalAlignment: Text.AlignRight
+ wrapMode: Text.WordWrap
+ font { family: fixedFont.name; pixelSize: 20; weight: Font.Bold; capitalization: Font.AllLowercase }
}
Text {
text: myText
color: "lightsteelblue"
width: parent.width
- elide: Text.ElideRight
- font { family: fixedFont.name; pointSize: 42; italic: true; capitalization: Font.SmallCaps }
+ wrapMode: Text.WordWrap
+ font { family: fixedFont.name; pixelSize: 20; italic: true; capitalization: Font.SmallCaps }
}
Text {
text: myText
color: "lightsteelblue"
width: parent.width
- elide: Text.ElideLeft
- font { family: localFont.name; pointSize: 42; capitalization: Font.Capitalize }
+ wrapMode: Text.WordWrap
+ font { family: localFont.name; pixelSize: 20; capitalization: Font.Capitalize }
}
Text {
text: {
@@ -97,8 +99,8 @@ Rectangle {
}
color: "lightsteelblue"
width: parent.width
- elide: Text.ElideMiddle
- font.family: webFont.name; font.pointSize: 42
+ wrapMode: Text.WordWrap
+ font.family: webFont.name; font.pixelSize: 20
}
}
}
diff --git a/examples/quick/text/fonts/hello.qml b/examples/quick/text/fonts/hello.qml
index d9479fb208..8920329ddb 100644
--- a/examples/quick/text/fonts/hello.qml
+++ b/examples/quick/text/fonts/hello.qml
@@ -43,7 +43,7 @@ import QtQuick 2.0
Rectangle {
id: screen
- width: 800; height: 480
+ width: 320; height: 480
color: "black"
Item {
@@ -55,12 +55,12 @@ Rectangle {
anchors.centerIn: parent
color: "white"
text: "Hello world!"
- font.pixelSize: 60
+ font.pixelSize: 32
smooth: true
SequentialAnimation on font.letterSpacing {
loops: Animation.Infinite;
- NumberAnimation { from: 0; to: 150; easing.type: Easing.InQuad; duration: 3000 }
+ NumberAnimation { from: 0; to: 50; easing.type: Easing.InQuad; duration: 3000 }
ScriptAction {
script: {
container.y = (screen.height / 4) + (Math.random() * screen.height / 2)
diff --git a/examples/quick/text/imgtag/TextWithImage.qml b/examples/quick/text/imgtag/TextWithImage.qml
index bc09aa2a52..5e6fba5df4 100644
--- a/examples/quick/text/imgtag/TextWithImage.qml
+++ b/examples/quick/text/imgtag/TextWithImage.qml
@@ -46,10 +46,4 @@ Text {
wrapMode: Text.WordWrap
textFormat: Text.StyledText
horizontalAlignment: main.hAlign
-
- Rectangle {
- border.color: "#efefef"
- color: "transparent"
- anchors.fill: parent
- }
}
diff --git a/examples/quick/text/imgtag/imgtag.qml b/examples/quick/text/imgtag/imgtag.qml
index 9d181af2cb..a28a4911c4 100644
--- a/examples/quick/text/imgtag/imgtag.qml
+++ b/examples/quick/text/imgtag/imgtag.qml
@@ -44,6 +44,7 @@ Rectangle {
id: main
width: 320; height: 480
focus: true
+ color: "#dedede"
property var hAlign: Text.AlignLeft
@@ -62,18 +63,13 @@ Rectangle {
text: "This is a <b>happy</b> face<img src=\"images/face-smile.png\">"
}
TextWithImage {
- text: "This is a <b>very<img src=\"images/face-smile-big.png\" align=\"middle\"/>happy</b> face aligned in the middle."
- }
- TextWithImage {
- elide: Text.ElideRight
- maximumLineCount: 2
- text: "This is a sad face aligned to the top. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc rutrum dui pretium ipsum malesuada venenatis. Nulla sed turpis risus. Integer sit amet odio quis mauris varius venenatis<img src=\"images/face-sad.png\" align=\"top\">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc rutrum dui pretium ipsum malesuada venenatis. Nulla sed turpis risus. Integer sit amet odio quis mauris varius venenatis."
+ text: "This is a <b>very<img src=\"images/face-smile-big.png\" align=\"middle\"/>happy</b> face vertically aligned in the middle."
}
TextWithImage {
text: "This is a tiny<img src=\"images/face-smile.png\" width=\"15\" height=\"15\">happy face."
}
TextWithImage {
- text: "This is a starfish<img src=\"images/starfish_2.png\" width=\"50\" height=\"50\" align=\"top\">aligned to the top and another one<img src=\"images/heart200.png\" width=\"50\" height=\"50\">aligned to the bottom."
+ text: "This is a<img src=\"images/starfish_2.png\" width=\"50\" height=\"50\" align=\"top\">aligned to the top and a<img src=\"images/heart200.png\" width=\"50\" height=\"50\">aligned to the bottom."
}
TextWithImage {
text: "Qt logos<img src=\"images/qtlogo.png\" width=\"55\" height=\"60\" align=\"middle\"><img src=\"images/qtlogo.png\" width=\"37\" height=\"40\" align=\"middle\"><img src=\"images/qtlogo.png\" width=\"18\" height=\"20\" align=\"middle\">aligned in the middle with different sizes."
diff --git a/examples/quick/text/main.cpp b/examples/quick/text/main.cpp
new file mode 100644
index 0000000000..0c896d9ab7
--- /dev/null
+++ b/examples/quick/text/main.cpp
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "../../shared/shared.h"
+DECLARATIVE_EXAMPLE_MAIN(text)
diff --git a/examples/quick/text/styledtext-layout.qml b/examples/quick/text/styledtext-layout.qml
index 4571330568..cb5e1ad277 100644
--- a/examples/quick/text/styledtext-layout.qml
+++ b/examples/quick/text/styledtext-layout.qml
@@ -46,12 +46,7 @@ Rectangle {
focus: true
property real offset: 0
- property real margin: 10
-
- Keys.onLeftPressed: myText.horizontalAlignment = Text.AlignLeft
- Keys.onUpPressed: myText.horizontalAlignment = Text.AlignHCenter
- Keys.onRightPressed: myText.horizontalAlignment = Text.AlignRight
- Keys.onDownPressed: myText.horizontalAlignment = Text.AlignJustify
+ property real margin: 8
Text {
id: myText
@@ -59,47 +54,18 @@ Rectangle {
anchors.margins: 10
wrapMode: Text.WordWrap
font.family: "Times New Roman"
- font.pixelSize: 13
+ font.pixelSize: 14
textFormat: Text.StyledText
horizontalAlignment: Text.AlignJustify
- text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer at ante dui sed eu egestas est facilis <a href=\"www.nokia.com\">www.nokia.com</a>.<br/>Curabitur ante est, pulvinar quis adipiscing a, iaculis id ipsum. Phasellus id neque id velit facilisis cursus ac sit amet nibh. Donec enim arcu, pharetra non semper nec, iaculis eget elit. Nunc blandit condimentum odio vel egestas.<br><ul type=\"bullet\"><li>Coffee<ol type=\"a\"><li>Espresso<li><b>Cappuccino</b><li><i>Flat White</i><li>Latte</ol><li>Juice<ol type=\"1\"><li>Orange</li><li>Apple</li><li>Pineapple</li><li>Tomato</li></ol></li></ul><p><font color=\"#434343\"><i>Proin consectetur <b>sapien</b> in ipsum lacinia sit amet mattis orci interdum. Quisque vitae accumsan lectus. Ut nisi turpis, sollicitudin ut dignissim id, fermentum ac est. Maecenas nec libero leo. Sed ac leo eget ipsum ultricies viverra sit amet eu orci. Praesent et tortor risus, viverra accumsan sapien. Sed faucibus eleifend lectus, sed euismod urna porta eu. Aenean ultricies lectus ut orci dictum quis convallis nisi ultrices. Nunc elit mi, iaculis a porttitor rutrum, venenatis malesuada nisi. Suspendisse turpis quam, euismod non imperdiet et, rutrum nec ligula. Lorem ipsum dolor sit amet, consectetur adipiscing elit."
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer at ante dui <a href=\"www.nokia.com\">www.nokia.com</a>.<br/>Curabitur ante est, pulvinar quis adipiscing a, iaculis id ipsum. Nunc blandit condimentum odio vel egestas.<br><ul type=\"bullet\"><li>Coffee<ol type=\"a\"><li>Espresso<li>Cappuccino<li>Latte</ol><li>Juice<ol type=\"1\"><li>Orange</li><li>Apple</li><li>Pineapple</li><li>Tomato</li></ol></li></ul><p><font color=\"#434343\"><i>Proin consectetur <b>sapien</b> in ipsum lacinia sit amet mattis orci interdum. Quisque vitae accumsan lectus. Ut nisi turpis, sollicitudin ut dignissim id, fermentum ac est. Maecenas nec libero leo. Sed ac leo eget ipsum ultricies viverra sit amet eu orci. Praesent et tortor risus, viverra accumsan sapien. Sed faucibus eleifend lectus, sed euismod urna porta eu. Quisque vitae accumsan lectus. Ut nisi turpis, sollicitudin ut dignissim id, fermentum ac est. Maecenas nec libero leo. Sed ac leo eget ipsum ultricies viverra sit amet eu orci."
onLineLaidOut: {
- line.width = width / 2 - (2 * margin)
- if (line.number === 30) {
- main.offset = line.y
- }
- if (line.number >= 30) {
- line.x = width / 2 + margin
- line.y -= main.offset
- }
- if ((line.y + line.height) > rect.y && line.y < (rect.y + rect.height)) {
- if (line.number < 30)
- line.width = Math.min((rect.x - line.x), line.width)
- else {
- line.x = Math.max((rect.x + rect.width), width / 2 + margin)
- line.width = Math.min((width - margin - line.x), line.width)
- }
- }
- }
-
- Item {
- id: rect
- x: 28; y: 20
- width: 60; height: 60
+ line.width = width / 2 - (margin)
- Rectangle {
- anchors { fill: parent; leftMargin: 2; rightMargin: 2 }
- color: "lightsteelblue"; opacity: 0.3
- }
-
- MouseArea {
- anchors.fill: parent
- drag.target: rect
- acceptedButtons: Qt.LeftButton | Qt.RightButton
- onClicked: mouse.button == Qt.RightButton ? myText.font.pixelSize -= 1 : myText.font.pixelSize += 1
- onPositionChanged: myText.doLayout()
+ if (line.y + line.height >= height) {
+ line.y -= height - margin
+ line.x = width / 2 + margin
}
}
}
diff --git a/examples/quick/text/text.pro b/examples/quick/text/text.pro
new file mode 100644
index 0000000000..ecd0762eda
--- /dev/null
+++ b/examples/quick/text/text.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+
+QT += quick declarative
+SOURCES += main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/text
+qml.files = fonts imgtag styledtext-layout.qml text.qml textselection
+qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/text
+INSTALLS += target qml
+
diff --git a/examples/quick/text/text.qml b/examples/quick/text/text.qml
index 9bfd290059..e9c40773c9 100644
--- a/examples/quick/text/text.qml
+++ b/examples/quick/text/text.qml
@@ -40,10 +40,20 @@
import QtQuick 2.0
import "../../shared"
+/*!
+ \title QML Examples - Text
+ \example declarative/text
+ \brief This is a collection of QML examples
+ \image qml-text-example.png
+
+ This is a collection of small QML examples relating to text. Each example is
+ a small QML file, usually containing or emphasizing a particular element or
+ feature. You can run and observe the behavior of each example.
+*/
Item {
height: 480
- width: 480
+ width: 320
LauncherList {
id: ll
anchors.fill: parent
@@ -52,6 +62,8 @@ Item {
addExample("Fonts", "Using various fonts with a Text element", Qt.resolvedUrl("fonts/fonts.qml"));
addExample("Available Fonts", "A list of your available fonts", Qt.resolvedUrl("fonts/availableFonts.qml"));
addExample("Banner", "Large, scrolling text", Qt.resolvedUrl("fonts/banner.qml"));
+ addExample("Img tag", "Embedding images into text", Qt.resolvedUrl("imgtag/imgtag.qml"));
+ addExample("Text Layout", "Flowing text around items", Qt.resolvedUrl("styledtext-layout.qml"));
}
}
}
diff --git a/src/qml/debugger/debugger.pri b/src/qml/debugger/debugger.pri
index f85663c01f..f5abd2c196 100644
--- a/src/qml/debugger/debugger.pri
+++ b/src/qml/debugger/debugger.pri
@@ -1,8 +1,6 @@
SOURCES += \
$$PWD/qpacketprotocol.cpp \
$$PWD/qqmldebugservice.cpp \
- $$PWD/qqmldebugclient.cpp \
- $$PWD/qqmlenginedebug.cpp \
$$PWD/qqmlprofilerservice.cpp \
$$PWD/qqmldebugserver.cpp \
$$PWD/qqmlinspectorservice.cpp \
@@ -15,8 +13,6 @@ HEADERS += \
$$PWD/qpacketprotocol_p.h \
$$PWD/qqmldebugservice_p.h \
$$PWD/qqmldebugservice_p_p.h \
- $$PWD/qqmldebugclient_p.h \
- $$PWD/qqmlenginedebug_p.h \
$$PWD/qqmlprofilerservice_p.h \
$$PWD/qqmldebugserver_p.h \
$$PWD/qqmldebugserverconnection_p.h \
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index a19644fb3e..bb6eb3b723 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -339,7 +339,8 @@ void QQmlBinding::update(QQmlPropertyPrivate::WriteFlags flags)
if (!d->updating) {
QQmlBindingProfiler prof(d->url, d->line, d->column);
- prof.addDetail(expression());
+ if (prof.enabled)
+ prof.addDetail(expression());
d->updating = true;
QQmlAbstractExpression::DeleteWatcher watcher(d);
diff --git a/src/qml/qml/qqmlscript.cpp b/src/qml/qml/qqmlscript.cpp
index db59a7266f..8e22e488ed 100644
--- a/src/qml/qml/qqmlscript.cpp
+++ b/src/qml/qml/qqmlscript.cpp
@@ -50,6 +50,7 @@
#include <private/qqmlrewrite_p.h>
#include <QStack>
+#include <QStringList>
#include <QCoreApplication>
#include <QtDebug>
diff --git a/src/qml/qml/qquicklistmodel.cpp b/src/qml/qml/qquicklistmodel.cpp
index 30c4f5d1d1..48187ca067 100644
--- a/src/qml/qml/qquicklistmodel.cpp
+++ b/src/qml/qml/qquicklistmodel.cpp
@@ -1110,14 +1110,18 @@ int ListElement::setJsProperty(const ListLayout::Role &role, v8::Handle<v8::Valu
} else if (d->IsNumber()) {
roleIndex = setDoubleProperty(role, d->NumberValue());
} else if (d->IsArray()) {
- ListModel *subModel = new ListModel(role.subLayout, 0, -1);
- v8::Handle<v8::Array> subArray = v8::Handle<v8::Array>::Cast(d);
- int arrayLength = subArray->Length();
- for (int j=0 ; j < arrayLength ; ++j) {
- v8::Handle<v8::Object> subObject = subArray->Get(j)->ToObject();
- subModel->append(subObject, eng);
+ if (role.type == ListLayout::Role::List) {
+ ListModel *subModel = new ListModel(role.subLayout, 0, -1);
+ v8::Handle<v8::Array> subArray = v8::Handle<v8::Array>::Cast(d);
+ int arrayLength = subArray->Length();
+ for (int j=0 ; j < arrayLength ; ++j) {
+ v8::Handle<v8::Object> subObject = subArray->Get(j)->ToObject();
+ subModel->append(subObject, eng);
+ }
+ roleIndex = setListProperty(role, subModel);
+ } else {
+ qmlInfo(0) << QString::fromLatin1("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(role.name).arg(roleTypeName(role.type)).arg(roleTypeName(ListLayout::Role::List));
}
- roleIndex = setListProperty(role, subModel);
} else if (d->IsBoolean()) {
roleIndex = setBoolProperty(role, d->BooleanValue());
} else if (d->IsObject()) {
diff --git a/src/qml/qml/rewriter/textwriter.cpp b/src/qml/qml/rewriter/textwriter.cpp
index f14c4af521..458fee68a1 100644
--- a/src/qml/qml/rewriter/textwriter.cpp
+++ b/src/qml/qml/rewriter/textwriter.cpp
@@ -46,7 +46,7 @@ QT_QML_BEGIN_NAMESPACE
using namespace QQmlJS;
TextWriter::TextWriter()
- :string(0), cursor(0)
+ :string(0)
{
}
@@ -72,8 +72,8 @@ bool TextWriter::hasOverlap(int pos, int length)
if (overlaps(pos, length, cmd.pos, cmd.length))
return true;
}
- return false;
}
+ return false;
}
bool TextWriter::hasMoveInto(int pos, int length)
@@ -137,25 +137,12 @@ void TextWriter::doReplace(const Replace &replace)
}
}
- if (string) {
- string->replace(replace.pos, replace.length, replace.replacement);
- } else if (cursor) {
- cursor->setPosition(replace.pos);
- cursor->setPosition(replace.pos + replace.length, QTextCursor::KeepAnchor);
- cursor->insertText(replace.replacement);
- }
+ string->replace(replace.pos, replace.length, replace.replacement);
}
void TextWriter::doMove(const Move &move)
{
- QString text;
- if (string) {
- text = string->mid(move.pos, move.length);
- } else if (cursor) {
- cursor->setPosition(move.pos);
- cursor->setPosition(move.pos + move.length, QTextCursor::KeepAnchor);
- text = cursor->selectedText();
- }
+ QString text(string->mid(move.pos, move.length));
Replace cut;
cut.pos = move.pos;
@@ -183,17 +170,10 @@ void TextWriter::write(QString *s)
string = 0;
}
-void TextWriter::write(QTextCursor *textCursor)
-{
- cursor = textCursor;
- write_helper();
- cursor = 0;
-}
-
void TextWriter::write_helper()
{
- if (cursor)
- cursor->beginEditBlock();
+ Q_ASSERT(string);
+
{
Replace cmd;
while (!replaceList.isEmpty()) {
@@ -210,8 +190,6 @@ void TextWriter::write_helper()
doMove(cmd);
}
}
- if (cursor)
- cursor->endEditBlock();
}
QT_QML_END_NAMESPACE
diff --git a/src/qml/qml/rewriter/textwriter_p.h b/src/qml/qml/rewriter/textwriter_p.h
index 94e2d08730..6c36a2f00d 100644
--- a/src/qml/qml/rewriter/textwriter_p.h
+++ b/src/qml/qml/rewriter/textwriter_p.h
@@ -46,7 +46,6 @@
#include <QtCore/QString>
#include <QtCore/QList>
-#include <QtGui/QTextCursor>
QT_BEGIN_HEADER
QT_QML_BEGIN_NAMESPACE
@@ -56,7 +55,6 @@ namespace QQmlJS {
class TextWriter
{
QString *string;
- QTextCursor *cursor;
struct Replace {
int pos;
@@ -89,8 +87,6 @@ public:
void move(int pos, int length, int to);
void write(QString *s);
- void write(QTextCursor *textCursor);
-
};
} // end of namespace QQmlJS
diff --git a/src/qml/qml/v4/qv4compiler.cpp b/src/qml/qml/v4/qv4compiler.cpp
index f8fe3b4b57..608368afc2 100644
--- a/src/qml/qml/v4/qv4compiler.cpp
+++ b/src/qml/qml/v4/qv4compiler.cpp
@@ -696,29 +696,20 @@ quint8 QV4CompilerPrivate::instructionOpcode(IR::Binop *e)
void QV4CompilerPrivate::visitBinop(IR::Binop *e)
{
+ if (e->type == IR::InvalidType) {
+ discard();
+ return;
+ }
+
int left = currentReg;
int right = currentReg + 1;
- if (e->left->asTemp() && e->type != IR::StringType) // Not sure if the e->type != String test is needed
- left = e->left->asTemp()->index;
- else
- traceExpression(e->left, left);
+ traceExpression(e->left, left);
+ traceExpression(e->right, right);
- if (IR::Temp *t = e->right->asTemp())
- right = t->index;
- else
- traceExpression(e->right, right);
-
- if (e->left->type != e->right->type) {
- if (qmlVerboseCompiler())
- qWarning().nospace() << "invalid operands to binary operator " << IR::binaryOperator(e->op)
- << "(`" << IR::binaryOperator(e->left->type)
- << "' and `"
- << IR::binaryOperator(e->right->type)
- << "'";
- discard();
- return;
- }
+ // At this point it is possible that the type of the
+ // subexpressions is different. This can happen because
+ // we keep BINOP expressions in HIR.
switch (e->op) {
case IR::OpInvalid:
diff --git a/src/qml/qml/v4/qv4ir.cpp b/src/qml/qml/v4/qv4ir.cpp
index 3b33898cd1..68175d3bf4 100644
--- a/src/qml/qml/v4/qv4ir.cpp
+++ b/src/qml/qml/v4/qv4ir.cpp
@@ -221,7 +221,7 @@ void Name::init(Name *base, Type type, const QString *id, Symbol symbol, quint32
builtin = MathCosBultinFunction;
} else if (id->length() == 10 && *id == QLatin1String("Math.round")) {
builtin = MathRoundBultinFunction;
- } else if (id->length() == 10 && *id == QLatin1String("Math.floor)")) {
+ } else if (id->length() == 10 && *id == QLatin1String("Math.floor")) {
builtin = MathFloorBultinFunction;
} else if (id->length() == 7 && *id == QLatin1String("Math.PI")) {
builtin = MathPIBuiltinConstant;
@@ -448,11 +448,6 @@ Temp *BasicBlock::TEMP(Type type)
return TEMP(type, function->tempCount++);
}
-Expr *BasicBlock::CONST(double value)
-{
- return CONST(IR::RealType, value);
-}
-
Expr *BasicBlock::CONST(Type type, double value)
{
Const *e = function->pool->New<Const>();
@@ -549,28 +544,30 @@ Expr *BasicBlock::BINOP(AluOp op, Expr *left, Expr *right)
if (left && right) {
if (Const *c1 = left->asConst()) {
if (Const *c2 = right->asConst()) {
+ const IR::Type ty = Binop::typeForOp(op, left, right);
+
switch (op) {
- case OpAdd: return CONST(c1->value + c2->value);
- case OpAnd: return CONST(c1->value ? c2->value : 0);
- case OpBitAnd: return CONST(int(c1->value) & int(c2->value));
- case OpBitOr: return CONST(int(c1->value) | int(c2->value));
- case OpBitXor: return CONST(int(c1->value) ^ int(c2->value));
- case OpDiv: return CONST(c1->value / c2->value);
- case OpEqual: return CONST(c1->value == c2->value);
- case OpGe: return CONST(c1->value >= c2->value);
- case OpGt: return CONST(c1->value > c2->value);
- case OpLe: return CONST(c1->value <= c2->value);
- case OpLShift: return CONST(int(c1->value) << int(c2->value));
- case OpLt: return CONST(c1->value < c2->value);
- case OpMod: return CONST(::fmod(c1->value, c2->value));
- case OpMul: return CONST(c1->value * c2->value);
- case OpNotEqual: return CONST(c1->value != c2->value);
- case OpOr: return CONST(c1->value ? c1->value : c2->value);
- case OpRShift: return CONST(int(c1->value) >> int(c2->value));
- case OpStrictEqual: return CONST(c1->value == c2->value);
- case OpStrictNotEqual: return CONST(c1->value != c2->value);
- case OpSub: return CONST(c1->value - c2->value);
- case OpURShift: return CONST(unsigned(c1->value) >> int(c2->value));
+ case OpAdd: return CONST(ty, c1->value + c2->value);
+ case OpAnd: return CONST(ty, c1->value ? c2->value : 0);
+ case OpBitAnd: return CONST(ty, int(c1->value) & int(c2->value));
+ case OpBitOr: return CONST(ty, int(c1->value) | int(c2->value));
+ case OpBitXor: return CONST(ty, int(c1->value) ^ int(c2->value));
+ case OpDiv: return CONST(ty, c1->value / c2->value);
+ case OpEqual: return CONST(ty, c1->value == c2->value);
+ case OpGe: return CONST(ty, c1->value >= c2->value);
+ case OpGt: return CONST(ty, c1->value > c2->value);
+ case OpLe: return CONST(ty, c1->value <= c2->value);
+ case OpLShift: return CONST(ty, int(c1->value) << int(c2->value));
+ case OpLt: return CONST(ty, c1->value < c2->value);
+ case OpMod: return CONST(ty, ::fmod(c1->value, c2->value));
+ case OpMul: return CONST(ty, c1->value * c2->value);
+ case OpNotEqual: return CONST(ty, c1->value != c2->value);
+ case OpOr: return CONST(ty, c1->value ? c1->value : c2->value);
+ case OpRShift: return CONST(ty, int(c1->value) >> int(c2->value));
+ case OpStrictEqual: return CONST(ty, c1->value == c2->value);
+ case OpStrictNotEqual: return CONST(ty, c1->value != c2->value);
+ case OpSub: return CONST(ty, c1->value - c2->value);
+ case OpURShift: return CONST(ty, unsigned(c1->value) >> int(c2->value));
case OpIfTrue: // unary ops
case OpNot:
diff --git a/src/qml/qml/v4/qv4ir_p.h b/src/qml/qml/v4/qv4ir_p.h
index e80c7e2869..3d3288b65f 100644
--- a/src/qml/qml/v4/qv4ir_p.h
+++ b/src/qml/qml/v4/qv4ir_p.h
@@ -339,7 +339,6 @@ struct Binop: Expr {
virtual void dump(QTextStream &out);
-private:
static Type typeForOp(AluOp op, Expr *left, Expr *right);
};
@@ -525,7 +524,6 @@ struct BasicBlock {
Temp *TEMP(Type type, int index);
Temp *TEMP(Type type);
- Expr *CONST(double value);
Expr *CONST(Type type, double value);
Expr *STRING(const QStringRef &value);
diff --git a/src/qml/qml/v4/qv4irbuilder.cpp b/src/qml/qml/v4/qv4irbuilder.cpp
index 32581a072c..36e88e5276 100644
--- a/src/qml/qml/v4/qv4irbuilder.cpp
+++ b/src/qml/qml/v4/qv4irbuilder.cpp
@@ -531,7 +531,7 @@ bool QV4IRBuilder::visit(AST::NumericLiteral *ast)
_expr.format = ExprResult::cx;
_block->JUMP(ast->value ? _expr.iftrue : _expr.iffalse);
} else {
- _expr.code = _block->CONST(ast->value);
+ _expr.code = _block->CONST(IR::RealType, ast->value);
}
return false;
}
@@ -767,7 +767,7 @@ bool QV4IRBuilder::visit(AST::UnaryMinusExpression *ast)
if (expr.isNot(IR::InvalidType)) {
if (IR::Const *c = expr.code->asConst()) {
_expr = expr;
- _expr.code = _block->CONST(-c->value);
+ _expr.code = _block->CONST(expr->type, -c->value);
return false;
}
@@ -785,7 +785,7 @@ bool QV4IRBuilder::visit(AST::TildeExpression *ast)
if (expr.isNot(IR::InvalidType)) {
if (IR::Const *c = expr.code->asConst()) {
_expr = expr;
- _expr.code = _block->CONST(~int(c->value));
+ _expr.code = _block->CONST(expr->type, ~int(c->value));
return false;
}
IR::Expr *code = _block->UNOP(IR::OpCompl, expr);
@@ -803,7 +803,7 @@ bool QV4IRBuilder::visit(AST::NotExpression *ast)
if (expr.isNot(IR::InvalidType)) {
if (IR::Const *c = expr.code->asConst()) {
_expr = expr;
- _expr.code = _block->CONST(!c->value);
+ _expr.code = _block->CONST(IR::BoolType, !c->value);
return false;
}
@@ -823,16 +823,18 @@ bool QV4IRBuilder::visit(AST::NotExpression *ast)
void QV4IRBuilder::binop(AST::BinaryExpression *ast, ExprResult left, ExprResult right)
{
if (IR::Type t = maxType(left.type(), right.type())) {
- implicitCvt(left, t);
- implicitCvt(right, t);
+ if (!left->asConst() && !right->asConst()) {
+ // the implicit conversions are needed only
+ // when compiling non-constant expressions.
+ implicitCvt(left, t);
+ implicitCvt(right, t);
+ }
if (_expr.hint == ExprResult::cx) {
_expr.format = ExprResult::cx;
_block->CJUMP(_block->BINOP(IR::binaryOperator(ast->op), left, right), _expr.iftrue, _expr.iffalse);
} else {
- IR::Expr *code = _block->BINOP(IR::binaryOperator(ast->op), left, right);
- _expr.code = _block->TEMP(code->type);
- _block->MOVE(_expr.code, code);
+ _expr.code = _block->BINOP(IR::binaryOperator(ast->op), left, right);
}
}
}
@@ -862,7 +864,7 @@ bool QV4IRBuilder::visit(AST::BinaryExpression *ast)
IR::Temp *r = _block->TEMP(IR::InvalidType);
_block = iffalse;
- _block->MOVE(r, _block->CONST(0)); // ### use the right null value
+ _block->MOVE(r, _block->CONST(IR::BoolType, 0)); // ### use the right null value
_block->JUMP(endif);
_block = iftrue;
diff --git a/src/qml/qml/v8/qv8sequencewrapper_p_p.h b/src/qml/qml/v8/qv8sequencewrapper_p_p.h
index 9d519809fa..eebc40eeed 100644
--- a/src/qml/qml/v8/qv8sequencewrapper_p_p.h
+++ b/src/qml/qml/v8/qv8sequencewrapper_p_p.h
@@ -265,6 +265,7 @@ static QString convertUrlToString(QV8Engine *, const QUrl &v)
static QVariant toVariant(QV8Engine *e, v8::Handle<v8::Array> array, uint32_t length, bool *succeeded) \
{ \
SequenceType list; \
+ list.reserve(length); \
for (uint32_t ii = 0; ii < length; ++ii) { \
list.append(ConversionFromV8fn(e, array->Get(ii))); \
} \
@@ -334,14 +335,15 @@ static QString convertUrlToString(QV8Engine *, const QUrl &v)
/* according to ECMA262r3 we need to insert */ \
/* undefined values increasing length to newLength. */ \
/* We cannot, so we insert default-values instead. */ \
+ QT_TRY { \
+ c.reserve(newCount); \
+ } QT_CATCH (std::bad_alloc &exception) { \
+ generateWarning(engine, QString(QLatin1String(exception.what()) \
+ + QLatin1String(" during length set"))); \
+ return; /* failed; don't write back any result. */ \
+ } \
while (newCount > count++) { \
- QT_TRY { \
- c.append(DefaultValue); \
- } QT_CATCH (std::bad_alloc &exception) { \
- generateWarning(engine, QString(QLatin1String(exception.what()) \
- + QLatin1String(" during length set"))); \
- return; /* failed; don't write back any result. */ \
- } \
+ c.append(DefaultValue); \
} \
} else { \
/* according to ECMA262r3 we need to remove */ \
@@ -382,15 +384,16 @@ static QString convertUrlToString(QV8Engine *, const QUrl &v)
/* according to ECMA262r3 we need to insert */ \
/* the value at the given index, increasing length to index+1. */ \
QT_TRY { \
- while (signedIdx > count++) { \
- c.append(DefaultValue); \
- } \
- c.append(elementValue); \
+ c.reserve(signedIdx + 1); \
} QT_CATCH (std::bad_alloc &exception) { \
generateWarning(engine, QString(QLatin1String(exception.what()) \
+ QLatin1String(" during indexed set"))); \
return v8::Undefined(); /* failed; don't write back any result. */ \
} \
+ while (signedIdx > count++) { \
+ c.append(DefaultValue); \
+ } \
+ c.append(elementValue); \
} \
/* write back. already checked that object is non-null, so skip that check here. */ \
if (objectType == QV8SequenceResource::Reference) \
diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp
index 170a37c979..60f1992b57 100644
--- a/src/quick/items/qquickcanvas.cpp
+++ b/src/quick/items/qquickcanvas.cpp
@@ -374,6 +374,14 @@ static QQuickMouseEventEx touchToMouseEvent(QEvent::Type type, const QTouchEvent
void QQuickCanvasPrivate::translateTouchToMouse(QTouchEvent *event)
{
+ if (event->type() == QEvent::TouchCancel) {
+ touchMouseId = -1;
+ if (!mouseGrabberItem)
+ return;
+ mouseGrabberItem->ungrabMouse();
+ mouseGrabberItem = 0;
+ return;
+ }
for (int i = 0; i < event->touchPoints().count(); ++i) {
QTouchEvent::TouchPoint p = event->touchPoints().at(i);
if (touchMouseId == -1 && p.state() & Qt::TouchPointPressed) {
@@ -1177,7 +1185,8 @@ bool QQuickCanvasPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event
QPointF p = item->mapFromScene(event->posF());
if (QRectF(0, 0, item->width(), item->height()).contains(p)) {
- QWheelEvent wheel(p, event->delta(), event->buttons(), event->modifiers(), event->orientation());
+ QWheelEvent wheel(p, p, event->pixelDelta(), event->angleDelta(), event->delta(),
+ event->orientation(), event->buttons(), event->modifiers());
wheel.accept();
q->sendEvent(item, &wheel);
if (wheel.isAccepted()) {
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index 597e64eb18..9222a7766d 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -236,4 +236,108 @@ Item {
*/
+/*!
+ \qmlclass WheelEvent QQuickWheelEvent
+ \inqmlmodule QtQuick 2
+ \ingroup qml-event-elements
+
+ \brief The WheelEvent object provides information about a mouse wheel event.
+
+ The position of the mouse can be found via the \l x and \l y properties.
+
+ \sa MouseArea
+*/
+
+/*!
+ \internal
+ \class QQuickWheelEvent
+*/
+
+/*!
+ \qmlproperty int QtQuick2::WheelEvent::x
+ \qmlproperty int QtQuick2::WheelEvent::y
+
+ These properties hold the coordinates of the position supplied by the wheel event.
+*/
+
+/*!
+ \qmlproperty bool QtQuick2::WheelEvent::accepted
+
+ Setting \a accepted to true prevents the wheel event from being
+ propagated to items below this item.
+
+ Generally, if the item acts on the wheel event then it should be accepted
+ so that items lower in the stacking order do not also respond to the same event.
+*/
+
+/*!
+ \qmlproperty int QtQuick2::WheelEvent::buttons
+
+ This property holds the mouse buttons pressed when the wheel event was generated.
+
+ It contains a bitwise combination of:
+ \list
+ \o Qt.LeftButton
+ \o Qt.RightButton
+ \o Qt.MiddleButton
+ \endlist
+*/
+
+/*!
+ \qmlproperty point QtQuick2::WheelEvent::angleDelta
+
+ This property holds the distance that the wheel is rotated in wheel degrees.
+ The x and y cordinate of this property holds the delta in horizontal and
+ vertical orientation.
+
+ A positive value indicates that the wheel was rotated up/right;
+ a negative value indicates that the wheel was rotated down/left.
+
+ Most mouse types work in steps of 15 degrees, in which case the delta value is a
+ multiple of 120; i.e., 120 units * 1/8 = 15 degrees.
+*/
+
+/*!
+ \qmlproperty point QtQuick2::WheelEvent::pixelDelta
+
+ This property holds the delta in screen pixels and is available in plataforms that
+ have high-resolution trackpads, such as Mac OS X.
+ The x and y cordinate of this property holds the delta in horizontal and
+ vertical orientation. The value should be used directly to scroll content on screen.
+
+ For platforms without high-resolution trackpad support, pixelDelta will always be (0,0),
+ and angleDelta should be used instead.
+*/
+
+/*!
+ \qmlproperty int QtQuick2::WheelEvent::modifiers
+
+ This property holds the keyboard modifier flags that existed immediately
+ before the event occurred.
+
+ It contains a bitwise combination of:
+ \list
+ \o Qt.NoModifier - No modifier key is pressed.
+ \o Qt.ShiftModifier - A Shift key on the keyboard is pressed.
+ \o Qt.ControlModifier - A Ctrl key on the keyboard is pressed.
+ \o Qt.AltModifier - An Alt key on the keyboard is pressed.
+ \o Qt.MetaModifier - A Meta key on the keyboard is pressed.
+ \o Qt.KeypadModifier - A keypad button is pressed.
+ \endlist
+
+ For example, to react to a Control key pressed during the wheel event:
+ \qml
+ MouseArea {
+ onWheel: {
+ if (wheel.modifiers & Qt.ControlModifier) {
+ if (wheel.angleDelta.y > 0)
+ zoomIn();
+ else
+ zoomOut();
+ }
+ }
+ }
+ \endqml
+*/
+
QT_END_NAMESPACE
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index 6300b0f2a7..004daafb04 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -201,9 +201,47 @@ private:
};
+class QQuickWheelEvent : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal x READ x)
+ Q_PROPERTY(qreal y READ y)
+ Q_PROPERTY(QPoint angleDelta READ angleDelta)
+ Q_PROPERTY(QPoint pixelDelta READ pixelDelta)
+ Q_PROPERTY(int buttons READ buttons)
+ Q_PROPERTY(int modifiers READ modifiers)
+ Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
+
+public:
+ QQuickWheelEvent(qreal x, qreal y, const QPoint& angleDelta, const QPoint& pixelDelta,
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
+ : _x(x), _y(y), _angleDelta(angleDelta), _pixelDelta(pixelDelta), _buttons(buttons),
+ _modifiers(modifiers), _accepted(true) {}
+
+ qreal x() const { return _x; }
+ qreal y() const { return _y; }
+ QPoint angleDelta() const { return _angleDelta; }
+ QPoint pixelDelta() const { return _pixelDelta; }
+ int buttons() const { return _buttons; }
+ int modifiers() const { return _modifiers; }
+
+ bool isAccepted() { return _accepted; }
+ void setAccepted(bool accepted) { _accepted = accepted; }
+
+private:
+ qreal _x;
+ qreal _y;
+ QPoint _angleDelta;
+ QPoint _pixelDelta;
+ Qt::MouseButtons _buttons;
+ Qt::KeyboardModifiers _modifiers;
+ bool _accepted;
+};
+
QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickKeyEvent)
QML_DECLARE_TYPE(QQuickMouseEvent)
+QML_DECLARE_TYPE(QQuickWheelEvent)
#endif // QQUICKEVENTS_P_P_H
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index a78ab4c4e5..78899b27e5 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -120,8 +120,8 @@ public:
return itemX() + view->cellWidth();
}
}
- void setPosition(qreal col, qreal row) {
- moveTo(pointForPosition(col, row));
+ void setPosition(qreal col, qreal row, bool immediate = false) {
+ moveTo(pointForPosition(col, row), immediate);
}
bool contains(qreal x, qreal y) const {
return (x >= itemX() && x < itemX() + view->cellWidth() &&
@@ -483,7 +483,7 @@ bool QQuickGridViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, bool d
if (!(item = static_cast<FxGridItemSG*>(createItem(modelIndex, doBuffer))))
break;
if (!transitioner || !transitioner->canTransition(QQuickItemViewTransitioner::PopulateTransition, true)) // pos will be set by layoutVisibleItems()
- item->setPosition(colPos, rowPos);
+ item->setPosition(colPos, rowPos, true);
item->item->setVisible(!doBuffer);
visibleItems.append(item);
if (++colNum >= columns) {
@@ -521,7 +521,7 @@ bool QQuickGridViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, bool d
break;
--visibleIndex;
if (!transitioner || !transitioner->canTransition(QQuickItemViewTransitioner::PopulateTransition, true)) // pos will be set by layoutVisibleItems()
- item->setPosition(colPos, rowPos);
+ item->setPosition(colPos, rowPos, true);
item->item->setVisible(!doBuffer);
visibleItems.prepend(item);
if (--colNum < 0) {
@@ -2165,12 +2165,10 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQuickChangeSet::Insert &
FxViewItem *item = visibleItems.at(i);
if (item->index != -1 && item->index >= modelIndex) {
item->index += count;
- if (transitioner) {
- if (change.isMove())
- transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::MoveTransition, false);
- else
- transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::AddTransition, false);
- }
+ if (change.isMove())
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, false);
+ else
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, false);
}
}
@@ -2201,8 +2199,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQuickChangeSet::Insert &
insertResult->changedFirstItem = true;
if (!change.isMove()) {
addedItems->append(item);
- if (transitioner)
- transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::AddTransition, true);
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, true);
}
insertResult->sizeChangesBeforeVisiblePos += rowSize();
}
@@ -2239,8 +2236,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQuickChangeSet::Insert &
movingIntoView->append(MovedItem(item, change.moveKey(item->index)));
} else {
addedItems->append(item);
- if (transitioner)
- transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::AddTransition, true);
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, true);
}
insertResult->sizeChangesAfterVisiblePos += rowSize();
@@ -2291,7 +2287,7 @@ void QQuickGridViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex
qreal origColPos = gridItem->rowPos();
int indexDiff = gridItem->index - countItemsRemoved;
gridItem->setPosition((indexDiff % columns) * colSize(), (indexDiff / columns) * rowSize());
- transitioner->transitionNextReposition(gridItem, QQuickItemViewTransitioner::RemoveTransition, false);
+ gridItem->transitionNextReposition(transitioner, QQuickItemViewTransitioner::RemoveTransition, false);
gridItem->setPosition(origRowPos, origColPos);
}
}
diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp
index 3d23f7b03a..421a4cd0b1 100644
--- a/src/quick/items/qquickitemsmodule.cpp
+++ b/src/quick/items/qquickitemsmodule.cpp
@@ -169,6 +169,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor)
qmlRegisterType<QQuickAnchors>();
qmlRegisterType<QQuickKeyEvent>();
qmlRegisterType<QQuickMouseEvent>();
+ qmlRegisterType<QQuickWheelEvent>();
qmlRegisterType<QQuickTransform>();
qmlRegisterType<QQuickPathElement>();
qmlRegisterType<QQuickCurve>();
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index e368d1aaec..c6f45aaf0b 100644
--- a/src/quick/items/qquickitemview.cpp
+++ b/src/quick/items/qquickitemview.cpp
@@ -46,12 +46,16 @@ QT_BEGIN_NAMESPACE
FxViewItem::FxViewItem(QQuickItem *i, bool own)
- : QQuickViewItem(i), ownItem(own), releaseAfterTransition(false)
+ : item(i)
+ , transitionableItem(0)
+ , ownItem(own)
+ , releaseAfterTransition(false)
{
}
FxViewItem::~FxViewItem()
{
+ delete transitionableItem;
if (ownItem && item) {
item->setParentItem(0);
item->deleteLater();
@@ -59,6 +63,71 @@ FxViewItem::~FxViewItem()
}
}
+qreal FxViewItem::itemX() const
+{
+ return transitionableItem ? transitionableItem->itemX() : item->x();
+}
+
+qreal FxViewItem::itemY() const
+{
+ return transitionableItem ? transitionableItem->itemY() : item->y();
+}
+
+void FxViewItem::moveTo(const QPointF &pos, bool immediate)
+{
+ if (transitionableItem)
+ transitionableItem->moveTo(pos, immediate);
+ else
+ item->setPos(pos);
+}
+
+void FxViewItem::setVisible(bool visible)
+{
+ if (!visible && transitionableItem && transitionableItem->transitionScheduledOrRunning())
+ return;
+ item->setVisible(visible);
+}
+
+QQuickItemViewTransitioner::TransitionType FxViewItem::scheduledTransitionType() const
+{
+ return transitionableItem ? transitionableItem->nextTransitionType : QQuickItemViewTransitioner::NoTransition;
+}
+
+bool FxViewItem::transitionScheduledOrRunning() const
+{
+ return transitionableItem ? transitionableItem->transitionScheduledOrRunning() : false;
+}
+
+bool FxViewItem::transitionRunning() const
+{
+ return transitionableItem ? transitionableItem->transitionRunning() : false;
+}
+
+bool FxViewItem::isPendingRemoval() const
+{
+ return transitionableItem ? transitionableItem->isPendingRemoval() : false;
+}
+
+void FxViewItem::transitionNextReposition(QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, bool asTarget)
+{
+ if (!transitioner)
+ return;
+ if (!transitionableItem)
+ transitionableItem = new QQuickItemViewTransitionableItem(item);
+ transitioner->transitionNextReposition(transitionableItem, type, asTarget);
+}
+
+bool FxViewItem::prepareTransition(QQuickItemViewTransitioner *transitioner, const QRectF &viewBounds)
+{
+ return transitionableItem ? transitionableItem->prepareTransition(transitioner, index, viewBounds) : false;
+}
+
+void FxViewItem::startTransition(QQuickItemViewTransitioner *transitioner)
+{
+ if (transitionableItem)
+ transitionableItem->startTransition(transitioner, index);
+}
+
QQuickItemViewChangeSet::QQuickItemViewChangeSet()
: active(false)
@@ -1615,7 +1684,7 @@ void QQuickItemViewPrivate::layout()
// assume that any items moving now are moving due to the remove - if they schedule
// a different transition, that will override this one anyway
for (int i=0; i<visibleItems.count(); i++)
- transitioner->transitionNextReposition(visibleItems[i], QQuickItemViewTransitioner::RemoveTransition, false);
+ visibleItems[i]->transitionNextReposition(transitioner, QQuickItemViewTransitioner::RemoveTransition, false);
}
ChangeResult insertionPosChanges;
@@ -1631,7 +1700,7 @@ void QQuickItemViewPrivate::layout()
if (transitioner && transitioner->canTransition(QQuickItemViewTransitioner::PopulateTransition, true)) {
for (int i=0; i<visibleItems.count(); i++)
- transitioner->transitionNextReposition(visibleItems.at(i), QQuickItemViewTransitioner::PopulateTransition, true);
+ visibleItems.at(i)->transitionNextReposition(transitioner, QQuickItemViewTransitioner::PopulateTransition, true);
}
layoutVisibleItems();
@@ -1791,7 +1860,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult
repositionItemAt(movingIntoView[i].item, fromIndex, -totalInsertionResult->sizeChangesAfterVisiblePos);
else
repositionItemAt(movingIntoView[i].item, fromIndex, totalInsertionResult->sizeChangesAfterVisiblePos);
- transitioner->transitionNextReposition(movingIntoView[i].item, QQuickItemViewTransitioner::MoveTransition, true);
+ movingIntoView[i].item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, true);
}
}
}
@@ -1855,12 +1924,10 @@ bool QQuickItemViewPrivate::applyRemovalChange(const QQuickChangeSet::Remove &re
} else if (item->index >= removal.index + removal.count) {
// after removed items
item->index -= removal.count;
- if (transitioner) {
- if (removal.isMove())
- transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::MoveTransition, false);
- else
- transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::RemoveTransition, false);
- }
+ if (removal.isMove())
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, false);
+ else
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::RemoveTransition, false);
++it;
} else {
// removed item
@@ -1894,8 +1961,7 @@ void QQuickItemViewPrivate::removeItem(FxViewItem *item, const QQuickChangeSet::
}
if (removal.isMove()) {
currentChanges.removedItems.insert(removal.moveKey(item->index), item);
- if (transitioner)
- transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::MoveTransition, true);
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, true);
} else {
// track item so it is released later
currentChanges.removedItems.insertMulti(QQuickChangeSet::MoveKey(), item);
@@ -1977,7 +2043,7 @@ void QQuickItemViewPrivate::prepareRemoveTransitions(QHash<QQuickChangeSet::Move
FxViewItem *item = *it;
item->releaseAfterTransition = true;
releasePendingTransition.append(item);
- transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::RemoveTransition, true);
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::RemoveTransition, true);
it = removedItems->erase(it);
} else {
++it;
@@ -1996,7 +2062,7 @@ bool QQuickItemViewPrivate::prepareNonVisibleItemTransition(FxViewItem *item, co
if (!transitioner)
return false;
- if (item->nextTransitionType == QQuickItemViewTransitioner::MoveTransition)
+ if (item->scheduledTransitionType() == QQuickItemViewTransitioner::MoveTransition)
repositionItemAt(item, item->index, 0);
if (item->prepareTransition(transitioner, viewBounds)) {
@@ -2006,12 +2072,13 @@ bool QQuickItemViewPrivate::prepareNonVisibleItemTransition(FxViewItem *item, co
return false;
}
-void QQuickItemViewPrivate::viewItemTransitionFinished(QQuickViewItem *i)
+void QQuickItemViewPrivate::viewItemTransitionFinished(QQuickItemViewTransitionableItem *item)
{
- FxViewItem *item = static_cast<FxViewItem *>(i);
- if (item->releaseAfterTransition) {
- releasePendingTransition.removeOne(item);
- releaseItem(item);
+ for (int i=0; i<releasePendingTransition.count(); i++) {
+ if (releasePendingTransition[i]->transitionableItem == item) {
+ releaseItem(releasePendingTransition.takeAt(i));
+ return;
+ }
}
}
diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h
index 80dacc0cb4..dfc0a8bc7e 100644
--- a/src/quick/items/qquickitemview_p_p.h
+++ b/src/quick/items/qquickitemview_p_p.h
@@ -57,12 +57,27 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Quick)
-class FxViewItem : public QQuickViewItem
+class FxViewItem
{
public:
FxViewItem(QQuickItem *, bool own);
virtual ~FxViewItem();
+ qreal itemX() const;
+ qreal itemY() const;
+
+ void moveTo(const QPointF &pos, bool immediate);
+ void setVisible(bool visible);
+
+ QQuickItemViewTransitioner::TransitionType scheduledTransitionType() const;
+ bool transitionScheduledOrRunning() const;
+ bool transitionRunning() const;
+ bool isPendingRemoval() const;
+
+ void transitionNextReposition(QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, bool asTarget);
+ bool prepareTransition(QQuickItemViewTransitioner *transitioner, const QRectF &viewBounds);
+ void startTransition(QQuickItemViewTransitioner *transitioner);
+
// these are positions and sizes along the current direction of scrolling/flicking
virtual qreal position() const = 0;
virtual qreal endPosition() const = 0;
@@ -71,7 +86,10 @@ public:
virtual bool contains(qreal x, qreal y) const = 0;
+ QQuickItem *item;
+ QQuickItemViewTransitionableItem *transitionableItem;
QQuickItemViewAttached *attached;
+ int index;
bool ownItem;
bool releaseAfterTransition;
};
@@ -192,7 +210,7 @@ public:
void prepareVisibleItemTransitions();
void prepareRemoveTransitions(QHash<QQuickChangeSet::MoveKey, FxViewItem *> *removedItems);
bool prepareNonVisibleItemTransition(FxViewItem *item, const QRectF &viewBounds);
- virtual void viewItemTransitionFinished(QQuickViewItem *item);
+ virtual void viewItemTransitionFinished(QQuickItemViewTransitionableItem *item);
int findMoveKeyIndex(QQuickChangeSet::MoveKey key, const QVector<QQuickChangeSet::Remove> &changes) const;
diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp
index 5669ef927e..d9dce49349 100644
--- a/src/quick/items/qquickitemviewtransition.cpp
+++ b/src/quick/items/qquickitemviewtransition.cpp
@@ -55,13 +55,14 @@ public:
QQuickItemViewTransitionJob();
~QQuickItemViewTransitionJob();
- void startTransition(QQuickViewItem *item, QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, const QPointF &to, bool isTargetItem);
+ void startTransition(QQuickItemViewTransitionableItem *item, int index, QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, const QPointF &to, bool isTargetItem);
QQuickItemViewTransitioner *m_transitioner;
- QQuickViewItem *m_item;
+ QQuickItemViewTransitionableItem *m_item;
QPointF m_toPos;
QQuickItemViewTransitioner::TransitionType m_type;
bool m_isTarget;
+ bool *m_wasDeleted;
protected:
virtual void finished();
@@ -73,16 +74,19 @@ QQuickItemViewTransitionJob::QQuickItemViewTransitionJob()
, m_item(0)
, m_type(QQuickItemViewTransitioner::NoTransition)
, m_isTarget(false)
+ , m_wasDeleted(0)
{
}
QQuickItemViewTransitionJob::~QQuickItemViewTransitionJob()
{
+ if (m_wasDeleted)
+ *m_wasDeleted = true;
if (m_transitioner)
m_transitioner->runningJobs.remove(this);
}
-void QQuickItemViewTransitionJob::startTransition(QQuickViewItem *item, QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, const QPointF &to, bool isTargetItem)
+void QQuickItemViewTransitionJob::startTransition(QQuickItemViewTransitionableItem *item, int index, QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, const QPointF &to, bool isTargetItem)
{
if (type == QQuickItemViewTransitioner::NoTransition)
return;
@@ -110,7 +114,7 @@ void QQuickItemViewTransitionJob::startTransition(QQuickViewItem *item, QQuickIt
QQuickViewTransitionAttached *attached =
static_cast<QQuickViewTransitionAttached*>(qmlAttachedPropertiesObject<QQuickViewTransitionAttached>(trans));
if (attached) {
- attached->m_index = item->index;
+ attached->m_index = index;
attached->m_item = item->item;
attached->m_destination = to;
attached->m_targetIndexes = m_transitioner->targetIndexes(type);
@@ -134,8 +138,16 @@ void QQuickItemViewTransitionJob::finished()
{
QQuickTransitionManager::finished();
- if (m_transitioner)
+ if (m_transitioner) {
+ bool deleted = false;
+ m_wasDeleted = &deleted;
m_transitioner->finishedTransition(this, m_item);
+ if (deleted)
+ return;
+ m_wasDeleted = 0;
+
+ m_transitioner = 0;
+ }
m_item = 0;
m_toPos.setX(0);
@@ -197,12 +209,12 @@ bool QQuickItemViewTransitioner::canTransition(QQuickItemViewTransitioner::Trans
return false;
}
-void QQuickItemViewTransitioner::transitionNextReposition(QQuickViewItem *item, QQuickItemViewTransitioner::TransitionType type, bool isTarget)
+void QQuickItemViewTransitioner::transitionNextReposition(QQuickItemViewTransitionableItem *item, QQuickItemViewTransitioner::TransitionType type, bool isTarget)
{
item->setNextTransition(type, isTarget);
}
-void QQuickItemViewTransitioner::addToTargetLists(QQuickItemViewTransitioner::TransitionType type, QQuickViewItem *item, int index)
+void QQuickItemViewTransitioner::addToTargetLists(QQuickItemViewTransitioner::TransitionType type, QQuickItemViewTransitionableItem *item, int index)
{
switch (type) {
case NoTransition:
@@ -302,7 +314,7 @@ const QList<QObject *> &QQuickItemViewTransitioner::targetItems(QQuickItemViewTr
return qquickitemviewtransition_emptyTargets;
}
-void QQuickItemViewTransitioner::finishedTransition(QQuickItemViewTransitionJob *job, QQuickViewItem *item)
+void QQuickItemViewTransitioner::finishedTransition(QQuickItemViewTransitionJob *job, QQuickItemViewTransitionableItem *item)
{
if (!runningJobs.contains(job))
return;
@@ -315,23 +327,22 @@ void QQuickItemViewTransitioner::finishedTransition(QQuickItemViewTransitionJob
}
-QQuickViewItem::QQuickViewItem(QQuickItem *i)
+QQuickItemViewTransitionableItem::QQuickItemViewTransitionableItem(QQuickItem *i)
: item(i)
, transition(0)
, nextTransitionType(QQuickItemViewTransitioner::NoTransition)
- , index(-1)
, isTransitionTarget(false)
, nextTransitionToSet(false)
, prepared(false)
{
}
-QQuickViewItem::~QQuickViewItem()
+QQuickItemViewTransitionableItem::~QQuickItemViewTransitionableItem()
{
delete transition;
}
-qreal QQuickViewItem::itemX() const
+qreal QQuickItemViewTransitionableItem::itemX() const
{
if (nextTransitionType != QQuickItemViewTransitioner::NoTransition)
return nextTransitionToSet ? nextTransitionTo.x() : item->x();
@@ -341,7 +352,7 @@ qreal QQuickViewItem::itemX() const
return item->x();
}
-qreal QQuickViewItem::itemY() const
+qreal QQuickItemViewTransitionableItem::itemY() const
{
// If item is transitioning to some pos, return that dest pos.
// If item was redirected to some new pos before the current transition finished,
@@ -354,35 +365,33 @@ qreal QQuickViewItem::itemY() const
return item->y();
}
-void QQuickViewItem::moveTo(const QPointF &pos)
+void QQuickItemViewTransitionableItem::moveTo(const QPointF &pos, bool immediate)
{
- if (transitionScheduledOrRunning()) {
+ if (immediate || !transitionScheduledOrRunning()) {
+ if (immediate) {
+ if (transition)
+ transition->cancel();
+ resetTransitionData();
+ }
+ item->setPos(pos);
+ } else {
nextTransitionTo = pos;
nextTransitionToSet = true;
- } else {
- item->setPos(pos);
}
}
-void QQuickViewItem::setVisible(bool visible)
-{
- if (!visible && transitionScheduledOrRunning())
- return;
- item->setVisible(visible);
-}
-
-bool QQuickViewItem::transitionScheduledOrRunning() const
+bool QQuickItemViewTransitionableItem::transitionScheduledOrRunning() const
{
return (transition && transition->isRunning())
|| nextTransitionType != QQuickItemViewTransitioner::NoTransition;
}
-bool QQuickViewItem::transitionRunning() const
+bool QQuickItemViewTransitionableItem::transitionRunning() const
{
return (transition && transition->isRunning());
}
-bool QQuickViewItem::isPendingRemoval() const
+bool QQuickItemViewTransitionableItem::isPendingRemoval() const
{
if (nextTransitionType == QQuickItemViewTransitioner::RemoveTransition)
return isTransitionTarget;
@@ -391,7 +400,7 @@ bool QQuickViewItem::isPendingRemoval() const
return false;
}
-bool QQuickViewItem::prepareTransition(QQuickItemViewTransitioner *transitioner, const QRectF &viewBounds)
+bool QQuickItemViewTransitionableItem::prepareTransition(QQuickItemViewTransitioner *transitioner, int index, const QRectF &viewBounds)
{
bool doTransition = false;
@@ -466,7 +475,7 @@ bool QQuickViewItem::prepareTransition(QQuickItemViewTransitioner *transitioner,
return doTransition;
}
-void QQuickViewItem::startTransition(QQuickItemViewTransitioner *transitioner)
+void QQuickItemViewTransitionableItem::startTransition(QQuickItemViewTransitioner *transitioner, int index)
{
if (nextTransitionType == QQuickItemViewTransitioner::NoTransition)
return;
@@ -486,12 +495,12 @@ void QQuickViewItem::startTransition(QQuickItemViewTransitioner *transitioner)
if (!nextTransitionToSet)
moveTo(item->pos());
- transition->startTransition(this, transitioner, nextTransitionType, nextTransitionTo, isTransitionTarget);
+ transition->startTransition(this, index, transitioner, nextTransitionType, nextTransitionTo, isTransitionTarget);
nextTransitionType = QQuickItemViewTransitioner::NoTransition;
prepared = false;
}
-void QQuickViewItem::setNextTransition(QQuickItemViewTransitioner::TransitionType type, bool isTargetItem)
+void QQuickItemViewTransitionableItem::setNextTransition(QQuickItemViewTransitioner::TransitionType type, bool isTargetItem)
{
// Don't reset nextTransitionToSet - once it is set, it cannot be changed
// until the animation finishes since the itemX() and itemY() may be used
@@ -500,20 +509,20 @@ void QQuickViewItem::setNextTransition(QQuickItemViewTransitioner::TransitionTyp
isTransitionTarget = isTargetItem;
}
-bool QQuickViewItem::transitionWillChangePosition() const
+bool QQuickItemViewTransitionableItem::transitionWillChangePosition() const
{
if (transitionRunning() && transition->m_toPos != nextTransitionTo)
return true;
return nextTransitionTo != item->pos();
}
-void QQuickViewItem::finishedTransition()
+void QQuickItemViewTransitionableItem::finishedTransition()
{
nextTransitionToSet = false;
nextTransitionTo = QPointF();
}
-void QQuickViewItem::resetTransitionData()
+void QQuickItemViewTransitionableItem::resetTransitionData()
{
nextTransitionType = QQuickItemViewTransitioner::NoTransition;
isTransitionTarget = false;
diff --git a/src/quick/items/qquickitemviewtransition_p.h b/src/quick/items/qquickitemviewtransition_p.h
index 73c238e929..a4babdca05 100644
--- a/src/quick/items/qquickitemviewtransition_p.h
+++ b/src/quick/items/qquickitemviewtransition_p.h
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Quick)
class QQuickItem;
-class QQuickViewItem;
+class QQuickItemViewTransitionableItem;
class QQuickItemViewTransitionJob;
@@ -61,7 +61,7 @@ public:
QQuickItemViewTransitionChangeListener() {}
virtual ~QQuickItemViewTransitionChangeListener() {}
- virtual void viewItemTransitionFinished(QQuickViewItem *item) = 0;
+ virtual void viewItemTransitionFinished(QQuickItemViewTransitionableItem *item) = 0;
};
@@ -80,9 +80,9 @@ public:
virtual ~QQuickItemViewTransitioner();
bool canTransition(QQuickItemViewTransitioner::TransitionType type, bool asTarget) const;
- void transitionNextReposition(QQuickViewItem *item, QQuickItemViewTransitioner::TransitionType type, bool isTarget);
+ void transitionNextReposition(QQuickItemViewTransitionableItem *item, QQuickItemViewTransitioner::TransitionType type, bool isTarget);
- void addToTargetLists(QQuickItemViewTransitioner::TransitionType type, QQuickViewItem *item, int index);
+ void addToTargetLists(QQuickItemViewTransitioner::TransitionType type, QQuickItemViewTransitionableItem *item, int index);
void resetTargetLists();
QQuickTransition *transitionObject(QQuickItemViewTransitioner::TransitionType type, bool asTarget);
@@ -116,37 +116,35 @@ private:
QQuickItemViewTransitionChangeListener *changeListener;
bool usePopulateTransition;
- void finishedTransition(QQuickItemViewTransitionJob *job, QQuickViewItem *item);
+ void finishedTransition(QQuickItemViewTransitionJob *job, QQuickItemViewTransitionableItem *item);
};
/*
- An item in a view, that can be transitioned using QQuickViewTransitionJob.
+ An item that can be transitioned using QQuickViewTransitionJob.
*/
-class QQuickViewItem
+class QQuickItemViewTransitionableItem
{
public:
- QQuickViewItem(QQuickItem *i);
- virtual ~QQuickViewItem();
+ QQuickItemViewTransitionableItem(QQuickItem *i);
+ virtual ~QQuickItemViewTransitionableItem();
qreal itemX() const;
qreal itemY() const;
- void moveTo(const QPointF &pos);
- void setVisible(bool visible);
+ void moveTo(const QPointF &pos, bool immediate = false);
bool transitionScheduledOrRunning() const;
bool transitionRunning() const;
bool isPendingRemoval() const;
- bool prepareTransition(QQuickItemViewTransitioner *transitioner, const QRectF &viewBounds);
- void startTransition(QQuickItemViewTransitioner *transitioner);
+ bool prepareTransition(QQuickItemViewTransitioner *transitioner, int index, const QRectF &viewBounds);
+ void startTransition(QQuickItemViewTransitioner *transitioner, int index);
QPointF nextTransitionTo;
QQuickItem *item;
QQuickItemViewTransitionJob *transition;
QQuickItemViewTransitioner::TransitionType nextTransitionType;
- int index;
bool isTransitionTarget;
bool nextTransitionToSet;
bool prepared;
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index a2f687c86b..9db2060d89 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -292,7 +292,7 @@ public:
: itemX() + item->width());
}
}
- void setPosition(qreal pos) {
+ void setPosition(qreal pos, bool immediate = false) {
// position the section immediately even if there is a transition
if (section()) {
if (view->orientation() == QQuickListView::Vertical) {
@@ -304,7 +304,7 @@ public:
section()->setX(pos);
}
}
- moveTo(pointForPosition(pos));
+ moveTo(pointForPosition(pos), immediate);
}
void setSize(qreal size) {
if (view->orientation() == QQuickListView::Vertical)
@@ -638,7 +638,7 @@ bool QQuickListViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, bool d
if (!(item = static_cast<FxListItemSG*>(createItem(modelIndex, doBuffer))))
break;
if (!transitioner || !transitioner->canTransition(QQuickItemViewTransitioner::PopulateTransition, true)) // pos will be set by layoutVisibleItems()
- item->setPosition(pos);
+ item->setPosition(pos, true);
item->item->setVisible(!doBuffer);
pos += item->size() + spacing;
visibleItems.append(item);
@@ -658,7 +658,7 @@ bool QQuickListViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, bool d
--visibleIndex;
visiblePos -= item->size() + spacing;
if (!transitioner || !transitioner->canTransition(QQuickItemViewTransitioner::PopulateTransition, true)) // pos will be set by layoutVisibleItems()
- item->setPosition(visiblePos);
+ item->setPosition(visiblePos, true);
item->item->setVisible(!doBuffer);
visibleItems.prepend(item);
changed = true;
@@ -2786,8 +2786,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQuickChangeSet::Insert &
insertResult->changedFirstItem = true;
if (!change.isMove()) {
addedItems->append(item);
- if (transitioner)
- transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::AddTransition, true);
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, true);
}
insertResult->sizeChangesBeforeVisiblePos += item->size() + spacing;
pos -= item->size() + spacing;
@@ -2817,8 +2816,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQuickChangeSet::Insert &
movingIntoView->append(MovedItem(item, change.moveKey(item->index)));
} else {
addedItems->append(item);
- if (transitioner)
- transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::AddTransition, true);
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, true);
}
insertResult->sizeChangesAfterVisiblePos += item->size() + spacing;
pos += item->size() + spacing;
@@ -2828,13 +2826,12 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQuickChangeSet::Insert &
for (; index < visibleItems.count(); ++index) {
FxViewItem *item = visibleItems.at(index);
- if (item->index != -1)
+ if (item->index != -1) {
item->index += count;
- if (transitioner) {
if (change.isMove())
- transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::MoveTransition, false);
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, false);
else
- transitioner->transitionNextReposition(item, QQuickItemViewTransitioner::AddTransition, false);
+ item->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, false);
}
}
@@ -2869,7 +2866,7 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex
if (!listItem->transitionScheduledOrRunning()) {
qreal pos = listItem->position();
listItem->setPosition(pos - sizeRemoved);
- transitioner->transitionNextReposition(listItem, QQuickItemViewTransitioner::RemoveTransition, false);
+ listItem->transitionNextReposition(transitioner, QQuickItemViewTransitioner::RemoveTransition, false);
listItem->setPosition(pos);
}
}
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index ef57242319..efb804bd18 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -236,6 +236,13 @@ bool QQuickMouseAreaPrivate::isClickConnected()
return QObjectPrivate::get(q)->isSignalConnected(idx);
}
+bool QQuickMouseAreaPrivate::isWheelConnected()
+{
+ Q_Q(QQuickMouseArea);
+ static int idx = QObjectPrivate::get(q)->signalIndex("wheel(QQuickWheelEvent*)");
+ return QObjectPrivate::get(q)->isSignalConnected(idx);
+}
+
void QQuickMouseAreaPrivate::propagate(QQuickMouseEvent* event, PropagateType t)
{
Q_Q(QQuickMouseArea);
@@ -331,7 +338,8 @@ bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *i
Information about the mouse position and button clicks are provided via
signals for which event handler properties are defined. The most commonly
used involved handling mouse presses and clicks: onClicked, onDoubleClicked,
- onPressed, onReleased and onPressAndHold.
+ onPressed, onReleased and onPressAndHold. It's also possible to handle mouse
+ wheel events via the onWheel signal.
By default, MouseArea items only report mouse clicks and not changes to the
position of the mouse cursor. Setting the hoverEnabled property ensures that
@@ -513,6 +521,17 @@ bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *i
the logic when the MouseArea has lost the mouse handling to the \l Flickable,
\c onCanceled should be used in addition to onReleased.
*/
+
+/*!
+ \qmlsignal QtQuick2::MouseArea::onWheel(WheelEvent mouse)
+
+ This handler is called in response to both mouse wheel and trackpad scroll gestures.
+
+ The \l {WheelEvent}{wheel} parameter provides information about the event, including the x and y
+ position, any buttons currently pressed, and information about the wheel movement, including
+ angleDelta and pixelDelta.
+*/
+
QQuickMouseArea::QQuickMouseArea(QQuickItem *parent)
: QQuickItem(*(new QQuickMouseAreaPrivate), parent)
{
@@ -860,6 +879,22 @@ void QQuickMouseArea::hoverLeaveEvent(QHoverEvent *event)
setHovered(false);
}
+void QQuickMouseArea::wheelEvent(QWheelEvent *event)
+{
+ Q_D(QQuickMouseArea);
+ if (!d->absorb) {
+ QQuickItem::wheelEvent(event);
+ return;
+ }
+
+ QQuickWheelEvent we(event->posF().x(), event->posF().y(), event->angleDelta(),
+ event->pixelDelta(), event->buttons(), event->modifiers());
+ we.setAccepted(d->isWheelConnected());
+ emit wheel(&we);
+ if (!we.isAccepted())
+ QQuickItem::wheelEvent(event);
+}
+
void QQuickMouseArea::ungrabMouse()
{
Q_D(QQuickMouseArea);
diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h
index 93a0635eb5..7eb9e5da05 100644
--- a/src/quick/items/qquickmousearea_p.h
+++ b/src/quick/items/qquickmousearea_p.h
@@ -119,6 +119,7 @@ private:
};
class QQuickMouseAreaPrivate;
+class QQuickWheelEvent;
// used in QtLocation
class Q_QUICK_EXPORT QQuickMouseArea : public QQuickItem
{
@@ -182,6 +183,7 @@ Q_SIGNALS:
void released(QQuickMouseEvent *mouse);
void clicked(QQuickMouseEvent *mouse);
void doubleClicked(QQuickMouseEvent *mouse);
+ void wheel(QQuickWheelEvent *wheel);
void entered();
void exited();
void canceled();
@@ -199,6 +201,7 @@ protected:
virtual void hoverEnterEvent(QHoverEvent *event);
virtual void hoverMoveEvent(QHoverEvent *event);
virtual void hoverLeaveEvent(QHoverEvent *event);
+ virtual void wheelEvent(QWheelEvent *event);
virtual bool childMouseEventFilter(QQuickItem *i, QEvent *e);
virtual void timerEvent(QTimerEvent *event);
virtual void windowDeactivateEvent();
diff --git a/src/quick/items/qquickmousearea_p_p.h b/src/quick/items/qquickmousearea_p_p.h
index bcdf033cba..f5521d9228 100644
--- a/src/quick/items/qquickmousearea_p_p.h
+++ b/src/quick/items/qquickmousearea_p_p.h
@@ -83,6 +83,7 @@ public:
bool isPressAndHoldConnected();
bool isDoubleClickConnected();
bool isClickConnected();
+ bool isWheelConnected();
bool absorb : 1;
bool hovered : 1;
diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp
index e9a0c179e0..7c4cd18346 100644
--- a/src/quick/items/qquickpositioners.cpp
+++ b/src/quick/items/qquickpositioners.cpp
@@ -72,6 +72,60 @@ void QQuickBasePositionerPrivate::unwatchChanges(QQuickItem* other)
otherPrivate->removeItemChangeListener(this, watchedChanges);
}
+
+QQuickBasePositioner::PositionedItem::PositionedItem(QQuickItem *i)
+ : item(i)
+ , transitionableItem(0)
+ , index(-1)
+ , isNew(false)
+ , isVisible(true)
+{
+}
+
+QQuickBasePositioner::PositionedItem::~PositionedItem()
+{
+ delete transitionableItem;
+}
+
+qreal QQuickBasePositioner::PositionedItem::itemX() const
+{
+ return transitionableItem ? transitionableItem->itemX() : item->x();
+}
+
+qreal QQuickBasePositioner::PositionedItem::itemY() const
+{
+ return transitionableItem ? transitionableItem->itemY() : item->y();
+}
+
+void QQuickBasePositioner::PositionedItem::moveTo(const QPointF &pos)
+{
+ if (transitionableItem)
+ transitionableItem->moveTo(pos);
+ else
+ item->setPos(pos);
+}
+
+void QQuickBasePositioner::PositionedItem::transitionNextReposition(QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, bool asTarget)
+{
+ if (!transitioner)
+ return;
+ if (!transitionableItem)
+ transitionableItem = new QQuickItemViewTransitionableItem(item);
+ transitioner->transitionNextReposition(transitionableItem, type, asTarget);
+}
+
+bool QQuickBasePositioner::PositionedItem::prepareTransition(QQuickItemViewTransitioner *transitioner, const QRectF &viewBounds)
+{
+ return transitionableItem ? transitionableItem->prepareTransition(transitioner, index, viewBounds) : false;
+}
+
+void QQuickBasePositioner::PositionedItem::startTransition(QQuickItemViewTransitioner *transitioner)
+{
+ if (transitionableItem)
+ transitionableItem->startTransition(transitioner, index);
+}
+
+
QQuickBasePositioner::QQuickBasePositioner(PositionerType at, QQuickItem *parent)
: QQuickImplicitSizeItem(*(new QQuickBasePositionerPrivate), parent)
{
@@ -114,7 +168,8 @@ QQuickBasePositioner::~QQuickBasePositioner()
d->unwatchChanges(positionedItems.at(i).item);
for (int i = 0; i < unpositionedItems.count(); ++i)
d->unwatchChanges(unpositionedItems.at(i).item);
- positionedItems.clear();
+ clearPositionedItems(&positionedItems);
+ clearPositionedItems(&unpositionedItems);
}
void QQuickBasePositioner::updatePolish()
@@ -194,10 +249,10 @@ void QQuickBasePositioner::itemChange(ItemChange change, const ItemChangeData &v
int idx = positionedItems.find(posItem);
if (idx >= 0) {
d->unwatchChanges(child);
- positionedItems.remove(idx);
+ removePositionedItem(&positionedItems, idx);
} else if ((idx = unpositionedItems.find(posItem)) >= 0) {
d->unwatchChanges(child);
- unpositionedItems.remove(idx);
+ removePositionedItem(&unpositionedItems, idx);
}
d->setPositioningDirty();
}
@@ -246,8 +301,7 @@ void QQuickBasePositioner::prePositioning()
if (addedIndex < 0)
addedIndex = posItem.index;
PositionedItem *theItem = &positionedItems[positionedItems.count()-1];
- d->transitioner->transitionNextReposition(theItem,
- QQuickItemViewTransitioner::AddTransition, true);
+ theItem->transitionNextReposition(d->transitioner, QQuickItemViewTransitioner::AddTransition, true);
}
}
} else {
@@ -268,8 +322,7 @@ void QQuickBasePositioner::prePositioning()
if (d->transitioner) {
if (addedIndex < 0)
addedIndex = item->index;
- d->transitioner->transitionNextReposition(&positionedItems[positionedItems.count()-1],
- QQuickItemViewTransitioner::AddTransition, true);
+ positionedItems[positionedItems.count()-1].transitionNextReposition(d->transitioner, QQuickItemViewTransitioner::AddTransition, true);
}
} else {
item->isNew = false;
@@ -283,11 +336,11 @@ void QQuickBasePositioner::prePositioning()
for (int i=0; i<positionedItems.count(); i++) {
if (!positionedItems[i].isNew) {
if (addedIndex >= 0) {
- d->transitioner->transitionNextReposition(&positionedItems[i], QQuickItemViewTransitioner::AddTransition, false);
+ positionedItems[i].transitionNextReposition(d->transitioner, QQuickItemViewTransitioner::AddTransition, false);
} else {
// just queue the item for a move-type displace - if the item hasn't
// moved anywhere, it won't be transitioned anyway
- d->transitioner->transitionNextReposition(&positionedItems[i], QQuickItemViewTransitioner::MoveTransition, false);
+ positionedItems[i].transitionNextReposition(d->transitioner, QQuickItemViewTransitioner::MoveTransition, false);
}
}
}
@@ -342,6 +395,24 @@ void QQuickBasePositioner::positionItemY(qreal y, PositionedItem *target)
}
}
+/*
+ Since PositionedItem values are stored by value, their internal transitionableItem pointers
+ must be cleaned up when a PositionedItem is removed from a QPODVector, otherwise the pointer
+ is never deleted since QPODVector doesn't invoke the destructor.
+ */
+void QQuickBasePositioner::removePositionedItem(QPODVector<PositionedItem,8> *items, int index)
+{
+ Q_ASSERT(index >= 0 && index < items->count());
+ delete items->at(index).transitionableItem;
+ items->remove(index);
+}
+void QQuickBasePositioner::clearPositionedItems(QPODVector<PositionedItem,8> *items)
+{
+ for (int i=0; i<items->count(); i++)
+ delete items->at(i).transitionableItem;
+ items->clear();
+}
+
QQuickPositionerAttached *QQuickBasePositioner::qmlAttachedProperties(QObject *obj)
{
return new QQuickPositionerAttached(obj);
diff --git a/src/quick/items/qquickpositioners_p.h b/src/quick/items/qquickpositioners_p.h
index 8921bfa39b..c13d9975af 100644
--- a/src/quick/items/qquickpositioners_p.h
+++ b/src/quick/items/qquickpositioners_p.h
@@ -133,22 +133,39 @@ protected:
virtual void doPositioning(QSizeF *contentSize)=0;
virtual void reportConflictingAnchors()=0;
- class PositionedItem : public QQuickViewItem
+ class PositionedItem
{
public :
- PositionedItem(QQuickItem *i) : QQuickViewItem(i), isNew(false), isVisible(true) {}
+ PositionedItem(QQuickItem *i);
+ ~PositionedItem();
bool operator==(const PositionedItem &other) const { return other.item == item; }
+ qreal itemX() const;
+ qreal itemY() const;
+
+ void moveTo(const QPointF &pos);
+
+ void transitionNextReposition(QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, bool asTarget);
+ bool prepareTransition(QQuickItemViewTransitioner *transitioner, const QRectF &viewBounds);
+ void startTransition(QQuickItemViewTransitioner *transitioner);
+
+ QQuickItem *item;
+ QQuickItemViewTransitionableItem *transitionableItem;
+ int index;
bool isNew;
bool isVisible;
};
QPODVector<PositionedItem,8> positionedItems;
QPODVector<PositionedItem,8> unpositionedItems;//Still 'in' the positioner, just not positioned
+
void positionItem(qreal x, qreal y, PositionedItem *target);
void positionItemX(qreal, PositionedItem *target);
void positionItemY(qreal, PositionedItem *target);
+ void removePositionedItem(QPODVector<PositionedItem,8> *items, int index);
+ void clearPositionedItems(QPODVector<PositionedItem,8> *items);
+
private:
Q_DISABLE_COPY(QQuickBasePositioner)
Q_DECLARE_PRIVATE(QQuickBasePositioner)
diff --git a/src/quick/items/qquickpositioners_p_p.h b/src/quick/items/qquickpositioners_p_p.h
index 21fa67574b..8c6bf7f101 100644
--- a/src/quick/items/qquickpositioners_p_p.h
+++ b/src/quick/items/qquickpositioners_p_p.h
@@ -139,7 +139,9 @@ public:
void itemDestroyed(QQuickItem *item)
{
Q_Q(QQuickBasePositioner);
- q->positionedItems.removeOne(QQuickBasePositioner::PositionedItem(item));
+ int index = q->positionedItems.find(QQuickBasePositioner::PositionedItem(item));
+ if (index >= 0)
+ q->removePositionedItem(&q->positionedItems, index);
}
static Qt::LayoutDirection getLayoutDirection(const QQuickBasePositioner *positioner)
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index a9bff73bd9..3db5f5a7a3 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -1626,7 +1626,7 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
QRectF bounds = boundingRect();
node->addTextDocument(bounds.topLeft(), d->document, d->color, QQuickText::Normal, QColor(),
- d->selectionColor, d->selectedTextColor, selectionStart(),
+ QColor(), d->selectionColor, d->selectedTextColor, selectionStart(),
selectionEnd() - 1); // selectionEnd() returns first char after
// selection
diff --git a/sync.profile b/sync.profile
index 7c7e1a5507..554dd14fbf 100644
--- a/sync.profile
+++ b/sync.profile
@@ -216,7 +216,7 @@
# - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch)
#
%dependencies = (
- "qtbase" => "refs/heads/api_changes",
+ "qtbase" => "3d19422ef16a230bb11dbbfe4a8cc9667f39bf15",
"qtxmlpatterns" => "refs/heads/master",
"qtjsbackend" => "refs/heads/master",
);
diff --git a/tests/auto/qml/debugger/debugger.pro b/tests/auto/qml/debugger/debugger.pro
index 4f9ebbc350..7669aaa83c 100644
--- a/tests/auto/qml/debugger/debugger.pro
+++ b/tests/auto/qml/debugger/debugger.pro
@@ -1,7 +1,7 @@
TEMPLATE = subdirs
PRIVATETESTS += \
- qqmlenginedebug \
+ qqmlenginedebugservice \
qqmldebugclient \
qqmldebugservice \
qqmldebugjs \
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
index d62a262d2f..4b5bf60ace 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
+++ b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro
@@ -3,14 +3,11 @@ TARGET = tst_qdebugmessageservice
QT += network qml-private testlib
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-
-SOURCES += tst_qdebugmessageservice.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qdebugmessageservice.cpp
INCLUDEPATH += ../shared
-
include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
TESTDATA = data/*
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
index a19fd4b766..8473774ae6 100644
--- a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
+++ b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
@@ -39,10 +39,10 @@
**
****************************************************************************/
-#include <QtQml/private/qqmldebugclient_p.h>
+#include "qqmldebugclient.h"
//QQmlDebugTest
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
#include "../../../shared/util.h"
#include <QtCore/QString>
diff --git a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
index 88439196a7..f631929427 100644
--- a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
+++ b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro
@@ -2,9 +2,10 @@ CONFIG += testcase
TARGET = tst_qpacketprotocol
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qpacketprotocol.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qpacketprotocol.cpp
+
+INCLUDEPATH += ../shared
+include(../shared/debugutil.pri)
CONFIG += parallel_test
QT += qml-private network testlib
diff --git a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
index c02dd2d8fa..4a6efb469d 100644
--- a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
+++ b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
@@ -48,7 +48,7 @@
#include <private/qpacketprotocol_p.h>
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
class tst_QPacketProtocol : public QObject
{
diff --git a/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro b/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro
index d298b5c087..22a4df7dc9 100644
--- a/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro
+++ b/tests/auto/qml/debugger/qqmldebugclient/qqmldebugclient.pro
@@ -2,9 +2,10 @@ CONFIG += testcase
TARGET = tst_qqmldebugclient
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmldebugclient.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmldebugclient.cpp
+
+INCLUDEPATH += ../shared
+include(../shared/debugutil.pri)
CONFIG += declarative_debug
diff --git a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
index b18f30ffb3..9377ef6a8f 100644
--- a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
+++ b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp
@@ -47,7 +47,7 @@
#include <QtQml/qqmlengine.h>
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
#define PORT 13770
#define STR_PORT "13770"
diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
index 7bb5161ed6..7c3a2ea042 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
+++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro
@@ -3,13 +3,11 @@ TARGET = tst_qqmldebugjs
QT += qml-private testlib
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmldebugjs.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmldebugjs.cpp
INCLUDEPATH += ../shared
-
-include (../../../shared/util.pri)
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
TESTDATA = data/*
diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
index 9a8b00bb6c..9cd021d5e9 100644
--- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
+++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
@@ -46,11 +46,11 @@
#include <QtCore/QDir>
#include <QtCore/QMutex>
#include <QtCore/QLibraryInfo>
-#include <QtQml/private/qqmldebugclient_p.h>
#include <QtQml/QJSEngine>
//QQmlDebugTest
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
#include "../../../shared/util.h"
const char *V8REQUEST = "v8request";
diff --git a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
index ecb3b2ca2c..dc2039615a 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
+++ b/tests/auto/qml/debugger/qqmldebugservice/qqmldebugservice.pro
@@ -2,9 +2,10 @@ CONFIG += testcase
TARGET = tst_qqmldebugservice
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmldebugservice.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmldebugservice.cpp
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
CONFIG += parallel_test declarative_debug
diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
index 3699530e00..a7fc284443 100644
--- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
+++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
@@ -47,11 +47,11 @@
#include <QtQml/qqmlengine.h>
-#include <private/qqmldebugclient_p.h>
#include <private/qqmldebugservice_p.h>
#include "../../../shared/util.h"
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
#define PORT 13769
#define STR_PORT "13769"
diff --git a/tests/auto/qml/debugger/qqmlenginedebug/qqmlenginedebug.pro b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
index 529c4667cf..0b92a726b5 100644
--- a/tests/auto/qml/debugger/qqmlenginedebug/qqmlenginedebug.pro
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro
@@ -1,10 +1,11 @@
CONFIG += testcase
-TARGET = tst_qqmlenginedebug
+TARGET = tst_qqmlenginedebugservice
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmlenginedebug.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmlenginedebugservice.cpp
+
+INCLUDEPATH += ../shared
+include(../shared/debugutil.pri)
CONFIG += parallel_test declarative_debug
diff --git a/tests/auto/qml/debugger/qqmlenginedebug/tst_qqmlenginedebug.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
index df8109abfb..a35aafff4d 100644
--- a/tests/auto/qml/debugger/qqmlenginedebug/tst_qqmlenginedebug.cpp
+++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp
@@ -54,16 +54,16 @@
#include <private/qqmlbinding_p.h>
#include <private/qqmlboundsignal_p.h>
-#include <private/qqmlenginedebug_p.h>
#include <private/qqmldebugservice_p.h>
#include <private/qqmlmetatype_p.h>
#include <private/qqmlproperty_p.h>
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmlenginedebug_p.h"
Q_DECLARE_METATYPE(QQmlDebugWatch::State)
-class tst_QQmlEngineDebug : public QObject
+class tst_QQmlEngineDebugService : public QObject
{
Q_OBJECT
@@ -127,7 +127,7 @@ signals:
QML_DECLARE_TYPE(NonScriptProperty)
-QQmlDebugObjectReference tst_QQmlEngineDebug::findRootObject(int context, bool recursive)
+QQmlDebugObjectReference tst_QQmlEngineDebugService::findRootObject(int context, bool recursive)
{
QQmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
waitForQuery(q_engines);
@@ -153,7 +153,7 @@ QQmlDebugObjectReference tst_QQmlEngineDebug::findRootObject(int context, bool r
return result;
}
-QQmlDebugPropertyReference tst_QQmlEngineDebug::findProperty(const QList<QQmlDebugPropertyReference> &props, const QString &name) const
+QQmlDebugPropertyReference tst_QQmlEngineDebugService::findProperty(const QList<QQmlDebugPropertyReference> &props, const QString &name) const
{
foreach(const QQmlDebugPropertyReference &p, props) {
if (p.name() == name)
@@ -162,7 +162,7 @@ QQmlDebugPropertyReference tst_QQmlEngineDebug::findProperty(const QList<QQmlDeb
return QQmlDebugPropertyReference();
}
-void tst_QQmlEngineDebug::waitForQuery(QQmlDebugQuery *query)
+void tst_QQmlEngineDebugService::waitForQuery(QQmlDebugQuery *query)
{
QVERIFY(query);
QCOMPARE(query->parent(), qobject_cast<QObject*>(this));
@@ -171,7 +171,7 @@ void tst_QQmlEngineDebug::waitForQuery(QQmlDebugQuery *query)
QFAIL("query timed out");
}
-void tst_QQmlEngineDebug::recursiveObjectTest(QObject *o, const QQmlDebugObjectReference &oref, bool recursive) const
+void tst_QQmlEngineDebugService::recursiveObjectTest(QObject *o, const QQmlDebugObjectReference &oref, bool recursive) const
{
const QMetaObject *meta = o->metaObject();
@@ -248,7 +248,7 @@ void tst_QQmlEngineDebug::recursiveObjectTest(QObject *o, const QQmlDebugObjectR
}
}
-void tst_QQmlEngineDebug::recursiveCompareObjects(const QQmlDebugObjectReference &a, const QQmlDebugObjectReference &b) const
+void tst_QQmlEngineDebugService::recursiveCompareObjects(const QQmlDebugObjectReference &a, const QQmlDebugObjectReference &b) const
{
QCOMPARE(a.debugId(), b.debugId());
QCOMPARE(a.className(), b.className());
@@ -272,7 +272,7 @@ void tst_QQmlEngineDebug::recursiveCompareObjects(const QQmlDebugObjectReference
recursiveCompareObjects(a.children()[i], b.children()[i]);
}
-void tst_QQmlEngineDebug::recursiveCompareContexts(const QQmlDebugContextReference &a, const QQmlDebugContextReference &b) const
+void tst_QQmlEngineDebugService::recursiveCompareContexts(const QQmlDebugContextReference &a, const QQmlDebugContextReference &b) const
{
QCOMPARE(a.debugId(), b.debugId());
QCOMPARE(a.name(), b.name());
@@ -286,7 +286,7 @@ void tst_QQmlEngineDebug::recursiveCompareContexts(const QQmlDebugContextReferen
recursiveCompareContexts(a.contexts()[i], b.contexts()[i]);
}
-void tst_QQmlEngineDebug::compareProperties(const QQmlDebugPropertyReference &a, const QQmlDebugPropertyReference &b) const
+void tst_QQmlEngineDebugService::compareProperties(const QQmlDebugPropertyReference &a, const QQmlDebugPropertyReference &b) const
{
QCOMPARE(a.objectDebugId(), b.objectDebugId());
QCOMPARE(a.name(), b.name());
@@ -296,7 +296,7 @@ void tst_QQmlEngineDebug::compareProperties(const QQmlDebugPropertyReference &a,
QCOMPARE(a.hasNotifySignal(), b.hasNotifySignal());
}
-void tst_QQmlEngineDebug::initTestCase()
+void tst_QQmlEngineDebugService::initTestCase()
{
qRegisterMetaType<QQmlDebugWatch::State>();
qmlRegisterType<NonScriptProperty>("Test", 1, 0, "NonScriptPropertyElement");
@@ -394,7 +394,7 @@ void tst_QQmlEngineDebug::initTestCase()
QTRY_VERIFY(m_dbg->state() == QQmlEngineDebug::Enabled);
}
-void tst_QQmlEngineDebug::cleanupTestCase()
+void tst_QQmlEngineDebugService::cleanupTestCase()
{
delete m_dbg;
delete m_conn;
@@ -402,7 +402,7 @@ void tst_QQmlEngineDebug::cleanupTestCase()
delete m_engine;
}
-void tst_QQmlEngineDebug::setMethodBody()
+void tst_QQmlEngineDebugService::setMethodBody()
{
QQmlDebugObjectReference obj = findRootObject(2);
@@ -439,7 +439,7 @@ void tst_QQmlEngineDebug::setMethodBody()
}
}
-void tst_QQmlEngineDebug::watch_property()
+void tst_QQmlEngineDebugService::watch_property()
{
QQmlDebugObjectReference obj = findRootObject();
QQmlDebugPropertyReference prop = findProperty(obj.properties(), "width");
@@ -484,7 +484,7 @@ void tst_QQmlEngineDebug::watch_property()
QCOMPARE(spy.at(0).at(1).value<QVariant>(), qVariantFromValue(origWidth*2));
}
-void tst_QQmlEngineDebug::watch_object()
+void tst_QQmlEngineDebugService::watch_object()
{
QQmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
waitForQuery(q_engines);
@@ -557,7 +557,7 @@ void tst_QQmlEngineDebug::watch_object()
QCOMPARE(newHeight, origHeight * 2);
}
-void tst_QQmlEngineDebug::watch_expression()
+void tst_QQmlEngineDebugService::watch_expression()
{
QFETCH(QString, expr);
QFETCH(int, increment);
@@ -620,7 +620,7 @@ void tst_QQmlEngineDebug::watch_expression()
}
}
-void tst_QQmlEngineDebug::watch_expression_data()
+void tst_QQmlEngineDebugService::watch_expression_data()
{
QTest::addColumn<QString>("expr");
QTest::addColumn<int>("increment");
@@ -630,21 +630,21 @@ void tst_QQmlEngineDebug::watch_expression_data()
QTest::newRow("width+10") << "width + 10" << 10 << 5;
}
-void tst_QQmlEngineDebug::watch_context()
+void tst_QQmlEngineDebugService::watch_context()
{
QQmlDebugContextReference c;
QTest::ignoreMessage(QtWarningMsg, "QQmlEngineDebug::addWatch(): Not implemented");
QVERIFY(!m_dbg->addWatch(c, QString(), this));
}
-void tst_QQmlEngineDebug::watch_file()
+void tst_QQmlEngineDebugService::watch_file()
{
QQmlDebugFileReference f;
QTest::ignoreMessage(QtWarningMsg, "QQmlEngineDebug::addWatch(): Not implemented");
QVERIFY(!m_dbg->addWatch(f, this));
}
-void tst_QQmlEngineDebug::queryAvailableEngines()
+void tst_QQmlEngineDebugService::queryAvailableEngines()
{
QQmlDebugEnginesQuery *q_engines;
@@ -679,7 +679,7 @@ void tst_QQmlEngineDebug::queryAvailableEngines()
m_dbg = new QQmlEngineDebug(m_conn, this);
}
-void tst_QQmlEngineDebug::queryRootContexts()
+void tst_QQmlEngineDebugService::queryRootContexts()
{
QQmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this);
waitForQuery(q_engines);
@@ -725,7 +725,7 @@ void tst_QQmlEngineDebug::queryRootContexts()
m_dbg = new QQmlEngineDebug(m_conn, this);
}
-void tst_QQmlEngineDebug::queryObject()
+void tst_QQmlEngineDebugService::queryObject()
{
QFETCH(bool, recursive);
@@ -797,7 +797,7 @@ void tst_QQmlEngineDebug::queryObject()
}
}
-void tst_QQmlEngineDebug::queryObject_data()
+void tst_QQmlEngineDebugService::queryObject_data()
{
QTest::addColumn<bool>("recursive");
@@ -805,7 +805,7 @@ void tst_QQmlEngineDebug::queryObject_data()
QTest::newRow("recursive") << true;
}
-void tst_QQmlEngineDebug::queryExpressionResult()
+void tst_QQmlEngineDebugService::queryExpressionResult()
{
QFETCH(QString, expr);
QFETCH(QVariant, result);
@@ -846,7 +846,7 @@ void tst_QQmlEngineDebug::queryExpressionResult()
m_dbg = new QQmlEngineDebug(m_conn, this);
}
-void tst_QQmlEngineDebug::queryExpressionResult_data()
+void tst_QQmlEngineDebugService::queryExpressionResult_data()
{
QTest::addColumn<QString>("expr");
QTest::addColumn<QVariant>("result");
@@ -861,7 +861,7 @@ void tst_QQmlEngineDebug::queryExpressionResult_data()
QTest::newRow("varObjMap") << "varObjMap" << qVariantFromValue(map);
}
-void tst_QQmlEngineDebug::tst_QQmlDebugFileReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugFileReference()
{
QQmlDebugFileReference ref;
QVERIFY(ref.url().isEmpty());
@@ -885,7 +885,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugFileReference()
}
}
-void tst_QQmlEngineDebug::tst_QQmlDebugEngineReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugEngineReference()
{
QQmlDebugEngineReference ref;
QCOMPARE(ref.debugId(), -1);
@@ -909,7 +909,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugEngineReference()
}
}
-void tst_QQmlEngineDebug::tst_QQmlDebugObjectReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugObjectReference()
{
QQmlDebugObjectReference ref;
QCOMPARE(ref.debugId(), -1);
@@ -942,7 +942,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugObjectReference()
recursiveCompareObjects(r, ref);
}
-void tst_QQmlEngineDebug::tst_QQmlDebugContextReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugContextReference()
{
QQmlDebugContextReference ref;
QCOMPARE(ref.debugId(), -1);
@@ -967,7 +967,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugContextReference()
recursiveCompareContexts(r, ref);
}
-void tst_QQmlEngineDebug::tst_QQmlDebugPropertyReference()
+void tst_QQmlEngineDebugService::tst_QQmlDebugPropertyReference()
{
QQmlDebugObjectReference rootObject = findRootObject();
QQmlDebugObjectQuery *query = m_dbg->queryObject(rootObject, this);
@@ -990,7 +990,7 @@ void tst_QQmlEngineDebug::tst_QQmlDebugPropertyReference()
compareProperties(r, ref);
}
-void tst_QQmlEngineDebug::setBindingForObject()
+void tst_QQmlEngineDebugService::setBindingForObject()
{
QQmlDebugObjectReference rootObject = findRootObject();
QVERIFY(rootObject.debugId() != -1);
@@ -1061,7 +1061,7 @@ void tst_QQmlEngineDebug::setBindingForObject()
QCOMPARE(onEnteredRef.value(), QVariant("{console.log('hello, world') }"));
}
-void tst_QQmlEngineDebug::setBindingInStates()
+void tst_QQmlEngineDebugService::setBindingInStates()
{
// Check if changing bindings of propertychanges works
@@ -1153,7 +1153,7 @@ void tst_QQmlEngineDebug::setBindingInStates()
QCOMPARE(findProperty(obj.properties(),"width").value().toInt(), 300);
}
-void tst_QQmlEngineDebug::queryObjectTree()
+void tst_QQmlEngineDebugService::queryObjectTree()
{
const int sourceIndex = 3;
@@ -1227,9 +1227,9 @@ int main(int argc, char *argv[])
_argv[_argc - 1] = arg;
QGuiApplication app(_argc, _argv);
- tst_QQmlEngineDebug tc;
+ tst_QQmlEngineDebugService tc;
return QTest::qExec(&tc, _argc, _argv);
delete _argv;
}
-#include "tst_qqmlenginedebug.moc"
+#include "tst_qqmlenginedebugservice.moc"
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro
index 010e97cef7..c24accac1a 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.pro
@@ -2,9 +2,10 @@ CONFIG += testcase
TARGET = tst_qqmlinspector
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-SOURCES += tst_qqmlinspector.cpp \
- ../shared/debugutil.cpp
+SOURCES += tst_qqmlinspector.cpp
+
+INCLUDEPATH += ../shared
+include(../shared/debugutil.pri)
DEFINES += SRCDIR=\\\"$$PWD\\\"
CONFIG += parallel_test declarative_debug
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
index 81fe3d5943..2bf43c92a2 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
@@ -2,13 +2,13 @@ CONFIG += testcase
TARGET = tst_qqmlprofilerservice
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
+SOURCES += tst_qqmlprofilerservice.cpp
-SOURCES += tst_qqmlprofilerservice.cpp \
- ../shared/debugutil.cpp
-OTHER_FILES += data/test.qml
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
-include (../../../shared/util.pri)
+OTHER_FILES += data/test.qml
CONFIG += parallel_test declarative_debug
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index edc120ba85..2b33ab3944 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -43,7 +43,8 @@
#include <QLibraryInfo>
#include "QtQml/private/qqmlprofilerservice_p.h"
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
#include "../../../shared/util.h"
#define PORT 13773
diff --git a/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro b/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro
index e980d6594d..a8dd634855 100644
--- a/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro
+++ b/tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro
@@ -2,12 +2,11 @@ CONFIG += testcase
TARGET = tst_qv8profilerservice
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
+SOURCES += tst_qv8profilerservice.cpp
-SOURCES += tst_qv8profilerservice.cpp \
- ../shared/debugutil.cpp
-
-include (../../../shared/util.pri)
+INCLUDEPATH += ../shared
+include(../../../shared/util.pri)
+include(../shared/debugutil.pri)
OTHER_FILES += data/test.qml
diff --git a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp b/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
index c5992a4403..7b9cda937c 100644
--- a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
+++ b/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
@@ -43,7 +43,8 @@
#include <QLibraryInfo>
#include "QtQml/private/qv8profilerservice_p.h"
-#include "../shared/debugutil_p.h"
+#include "debugutil_p.h"
+#include "qqmldebugclient.h"
#include "../../../shared/util.h"
#define PORT 13774
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
index a3d3dce644..3d2f460456 100644
--- a/tests/auto/qml/debugger/shared/debugutil.cpp
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -44,9 +44,6 @@
#include <QEventLoop>
#include <QTimer>
-#include <private/qqmldebugclient_p.h>
-#include <private/qqmldebugservice_p.h>
-
bool QQmlDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) {
QEventLoop loop;
QTimer timer;
diff --git a/tests/auto/qml/debugger/shared/debugutil.pri b/tests/auto/qml/debugger/shared/debugutil.pri
new file mode 100644
index 0000000000..b74f6b08b0
--- /dev/null
+++ b/tests/auto/qml/debugger/shared/debugutil.pri
@@ -0,0 +1,9 @@
+QT += core-private
+
+HEADERS += $$PWD/debugutil_p.h \
+ $$PWD/qqmldebugclient.h \
+ $$PWD/qqmlenginedebug_p.h
+SOURCES += $$PWD/debugutil.cpp \
+ $$PWD/qqmldebugclient.cpp \
+ $$PWD/qqmlenginedebug.cpp
+
diff --git a/tests/auto/qml/debugger/shared/debugutil_p.h b/tests/auto/qml/debugger/shared/debugutil_p.h
index 194f8fa14c..177c712833 100644
--- a/tests/auto/qml/debugger/shared/debugutil_p.h
+++ b/tests/auto/qml/debugger/shared/debugutil_p.h
@@ -51,7 +51,7 @@
#include <QtQml/qqmlengine.h>
-#include <private/qqmldebugclient_p.h>
+#include "qqmldebugclient.h"
#include <private/qqmldebugservice_p.h>
class QQmlDebugTest
diff --git a/src/qml/debugger/qqmldebugclient.cpp b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
index fcb0861c21..0453f88350 100644
--- a/src/qml/debugger/qqmldebugclient.cpp
+++ b/tests/auto/qml/debugger/shared/qqmldebugclient.cpp
@@ -39,25 +39,20 @@
**
****************************************************************************/
-#include "qqmldebugclient_p.h"
+#include "qqmldebugclient.h"
-#include "qpacketprotocol_p.h"
+#include <private/qpacketprotocol_p.h>
#include <QtCore/qdebug.h>
#include <QtCore/qstringlist.h>
#include <QtNetwork/qnetworkproxy.h>
-#include <private/qobject_p.h>
-
-QT_BEGIN_NAMESPACE
-
const int protocolVersion = 1;
const QString serverId = QLatin1String("QDeclarativeDebugServer");
const QString clientId = QLatin1String("QDeclarativeDebugClient");
-class QQmlDebugClientPrivate : public QObjectPrivate
+class QQmlDebugClientPrivate
{
- Q_DECLARE_PUBLIC(QQmlDebugClient)
public:
QQmlDebugClientPrivate();
@@ -241,7 +236,7 @@ QQmlDebugConnection::~QQmlDebugConnection()
{
QHash<QString, QQmlDebugClient*>::iterator iter = d->plugins.begin();
for (; iter != d->plugins.end(); ++iter) {
- iter.value()->d_func()->connection = 0;
+ iter.value()->d->connection = 0;
iter.value()->stateChanged(QQmlDebugClient::NotConnected);
}
}
@@ -341,9 +336,9 @@ QQmlDebugClientPrivate::QQmlDebugClientPrivate()
QQmlDebugClient::QQmlDebugClient(const QString &name,
QQmlDebugConnection *parent)
- : QObject(*(new QQmlDebugClientPrivate), parent)
+ : QObject(parent),
+ d(new QQmlDebugClientPrivate)
{
- Q_D(QQmlDebugClient);
d->name = name;
d->connection = parent;
@@ -361,22 +356,20 @@ QQmlDebugClient::QQmlDebugClient(const QString &name,
QQmlDebugClient::~QQmlDebugClient()
{
- Q_D(QQmlDebugClient);
if (d->connection && d->connection->d) {
d->connection->d->plugins.remove(d->name);
d->connection->d->advertisePlugins();
}
+ delete d;
}
QString QQmlDebugClient::name() const
{
- Q_D(const QQmlDebugClient);
return d->name;
}
float QQmlDebugClient::serviceVersion() const
{
- Q_D(const QQmlDebugClient);
if (d->connection->d->serverPlugins.contains(d->name))
return d->connection->d->serverPlugins.value(d->name);
return -1;
@@ -384,7 +377,6 @@ float QQmlDebugClient::serviceVersion() const
QQmlDebugClient::State QQmlDebugClient::state() const
{
- Q_D(const QQmlDebugClient);
if (!d->connection
|| !d->connection->isConnected()
|| !d->connection->d->gotHello)
@@ -398,7 +390,6 @@ QQmlDebugClient::State QQmlDebugClient::state() const
void QQmlDebugClient::sendMessage(const QByteArray &message)
{
- Q_D(QQmlDebugClient);
if (state() != Enabled)
return;
@@ -416,6 +407,4 @@ void QQmlDebugClient::messageReceived(const QByteArray &)
{
}
-QT_END_NAMESPACE
-
#include <qqmldebugclient.moc>
diff --git a/src/qml/debugger/qqmldebugclient_p.h b/tests/auto/qml/debugger/shared/qqmldebugclient.h
index 064e15cf49..d3e5cd59a4 100644
--- a/src/qml/debugger/qqmldebugclient_p.h
+++ b/tests/auto/qml/debugger/shared/qqmldebugclient.h
@@ -42,26 +42,10 @@
#ifndef QQMLDEBUGCLIENT_H
#define QQMLDEBUGCLIENT_H
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
#include <QtNetwork/qtcpsocket.h>
#include <private/qtqmlglobal_p.h>
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-
class QQmlDebugConnectionPrivate;
class Q_QML_PRIVATE_EXPORT QQmlDebugConnection : public QIODevice
{
@@ -120,12 +104,9 @@ protected:
virtual void messageReceived(const QByteArray &);
private:
+ QQmlDebugClientPrivate *d;
friend class QQmlDebugConnection;
friend class QQmlDebugConnectionPrivate;
};
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
#endif // QQMLDEBUGCLIENT_H
diff --git a/src/qml/debugger/qqmlenginedebug.cpp b/tests/auto/qml/debugger/shared/qqmlenginedebug.cpp
index 65af181f1b..8a46c7617c 100644
--- a/src/qml/debugger/qqmlenginedebug.cpp
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebug.cpp
@@ -41,13 +41,11 @@
#include "qqmlenginedebug_p.h"
-#include "qqmldebugclient_p.h"
+#include "qqmldebugclient.h"
-#include "qqmlenginedebugservice_p.h"
+#include <private/qqmlenginedebugservice_p.h>
-#include <private/qobject_p.h>
-
-QT_BEGIN_NAMESPACE
+#include <QtCore/private/qobject_p.h>
class QQmlEngineDebugClient : public QQmlDebugClient
{
@@ -1068,5 +1066,3 @@ bool QQmlDebugPropertyReference::hasNotifySignal() const
return m_hasNotifySignal;
}
-QT_END_NAMESPACE
-
diff --git a/src/qml/debugger/qqmlenginedebug_p.h b/tests/auto/qml/debugger/shared/qqmlenginedebug_p.h
index 0562d8755b..70f04d3a19 100644
--- a/src/qml/debugger/qqmlenginedebug_p.h
+++ b/tests/auto/qml/debugger/shared/qqmlenginedebug_p.h
@@ -59,11 +59,6 @@
#include <private/qtqmlglobal_p.h>
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-
class QQmlDebugConnection;
class QQmlDebugWatch;
class QQmlDebugPropertyWatch;
@@ -385,13 +380,9 @@ private:
QVariant m_result;
};
-QT_END_NAMESPACE
-
Q_DECLARE_METATYPE(QQmlDebugEngineReference)
Q_DECLARE_METATYPE(QQmlDebugObjectReference)
Q_DECLARE_METATYPE(QQmlDebugContextReference)
Q_DECLARE_METATYPE(QQmlDebugPropertyReference)
-QT_END_HEADER
-
#endif // QQMLENGINEDEBUG_H
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml
index 23f1e90417..962e8dd474 100644
--- a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml
@@ -71,19 +71,5 @@ Item {
success = false;
if (!verifyExpected(msco.intListProperty, 4))
success = false;
-
- // NOTE: while these two operations are technically
- // fine, we expect std::bad_alloc exceptions here
- // which we handle in the sequence wrapper.
- msco.intListProperty.length = maxIndex;
- if (msco.intListProperty.length != expectedLength)
- success = false;
- if (!verifyExpected(msco.intListProperty, 4))
- success = false;
- msco.intListProperty[maxIndex] = 15;
- if (msco.intListProperty.length != expectedLength)
- success = false;
- if (!verifyExpected(msco.intListProperty, 4))
- success = false;
}
}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index f8b268199d..4389fe5cb7 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -4655,13 +4655,9 @@ void tst_qqmlecmascript::sequenceConversionIndexes()
QString w1 = qmlFile.toString() + QLatin1String(":34: Index out of range during length set");
QString w2 = qmlFile.toString() + QLatin1String(":41: Index out of range during indexed set");
QString w3 = qmlFile.toString() + QLatin1String(":48: Index out of range during indexed get");
- QString w4 = qmlFile.toString() + QLatin1String(":78: std::bad_alloc during length set");
- QString w5 = qmlFile.toString() + QLatin1String(":83: std::bad_alloc during indexed set");
QTest::ignoreMessage(QtWarningMsg, qPrintable(w1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(w2));
QTest::ignoreMessage(QtWarningMsg, qPrintable(w3));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(w4));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(w5));
QMetaObject::invokeMethod(object, "indexedAccess");
QVERIFY(object->property("success").toBool());
delete object;
diff --git a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp b/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp
index 3fcce60bfb..69a8d2ecd8 100644
--- a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp
+++ b/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp
@@ -139,6 +139,7 @@ private slots:
void role_mode();
void dynamic_role();
void dynamic_role_data();
+ void string_to_list_crash();
};
bool tst_qquicklistmodel::compareVariantList(const QVariantList &testList, QVariant object)
@@ -1627,6 +1628,19 @@ void tst_qquicklistmodel::dynamic_role()
qApp->processEvents();
}
+void tst_qquicklistmodel::string_to_list_crash()
+{
+ QQmlEngine engine;
+ QQuickListModel model;
+ QQmlEngine::setContextForObject(&model,engine.rootContext());
+ engine.rootContext()->setContextObject(&model);
+ QString script = QLatin1String("{append({'a':'data'});get(0).a = [{'x':123}]}");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Can't assign to existing role 'a' of different type [String -> List]");
+ QQmlExpression e(engine.rootContext(), &model, script);
+ // Don't crash!
+ e.evaluate();
+}
+
QTEST_MAIN(tst_qquicklistmodel)
#include "tst_qquicklistmodel.moc"
diff --git a/tests/auto/qml/v4/data/nestedObjectAccess2.qml b/tests/auto/qml/v4/data/nestedObjectAccess2.qml
new file mode 100644
index 0000000000..2f0e0db01c
--- /dev/null
+++ b/tests/auto/qml/v4/data/nestedObjectAccess2.qml
@@ -0,0 +1,5 @@
+import Qt.v4 1.0
+
+Result {
+ result: nested2.result
+}
diff --git a/tests/auto/qml/v4/testtypes.h b/tests/auto/qml/v4/testtypes.h
index 02ba721839..18b5b27b36 100644
--- a/tests/auto/qml/v4/testtypes.h
+++ b/tests/auto/qml/v4/testtypes.h
@@ -59,6 +59,7 @@ class ResultObject : public QObject
Q_OBJECT
Q_PROPERTY(int result READ result WRITE setResult FINAL)
Q_PROPERTY(NestedObject *nested READ nested CONSTANT)
+ Q_PROPERTY(NestedObject *nested2 READ nested2 FINAL CONSTANT)
public:
ResultObject() : m_result(0), m_resultCounter(0) {}
@@ -69,12 +70,14 @@ public:
void setResult(int result) { m_result = result; m_resultCounter++; }
NestedObject *nested() { return &m_nested; }
+ NestedObject *nested2() { return &m_nested2; }
private:
int m_result;
int m_resultCounter;
NestedObject m_nested;
+ NestedObject m_nested2;
};
void registerTypes();
diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp
index 4e3e71f717..041d9ab8e6 100644
--- a/tests/auto/qml/v4/tst_v4.cpp
+++ b/tests/auto/qml/v4/tst_v4.cpp
@@ -225,17 +225,34 @@ void tst_v4::conditionalExpr()
// NestedObject::result.
void tst_v4::nestedObjectAccess()
{
- QQmlComponent component(&engine, testFileUrl("nestedObjectAccess.qml"));
+ {
+ QQmlComponent component(&engine, testFileUrl("nestedObjectAccess.qml"));
- QObject *o = component.create();
- QVERIFY(o != 0);
+ QObject *o = component.create();
+ QVERIFY(o != 0);
- ResultObject *ro = qobject_cast<ResultObject *>(o);
- QVERIFY(ro != 0);
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
- QCOMPARE(ro->result(), 37);
+ QCOMPARE(ro->result(), 37);
- delete o;
+ delete o;
+ }
+
+ {
+ QQmlComponent component(&engine, testFileUrl("nestedObjectAccess2.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+
+ ResultObject *ro = qobject_cast<ResultObject *>(o);
+ QVERIFY(ro != 0);
+
+ QEXPECT_FAIL("","QTBUG-24606", Continue);
+ QCOMPARE(ro->result(), 37);
+
+ delete o;
+ }
}
void tst_v4::subscriptionsInConditionalExpressions()
diff --git a/tests/auto/quick/qquickgridview/data/multipleTransitions.qml b/tests/auto/quick/qquickgridview/data/multipleTransitions.qml
index f0d932082b..cfe0be7b1e 100644
--- a/tests/auto/quick/qquickgridview/data/multipleTransitions.qml
+++ b/tests/auto/quick/qquickgridview/data/multipleTransitions.qml
@@ -60,6 +60,7 @@ Rectangle {
add: Transition {
id: addTargets
+ enabled: enableAddTransitions
SequentialAnimation {
ScriptAction { script: grid.runningAddTargets = true }
ParallelAnimation {
@@ -72,6 +73,7 @@ Rectangle {
addDisplaced: Transition {
id: addDisplaced
+ enabled: enableAddTransitions
SequentialAnimation {
ScriptAction { script: grid.runningAddDisplaced = true }
ParallelAnimation {
@@ -84,6 +86,7 @@ Rectangle {
move: Transition {
id: moveTargets
+ enabled: enableMoveTransitions
SequentialAnimation {
ScriptAction { script: grid.runningMoveTargets = true }
ParallelAnimation {
@@ -96,6 +99,7 @@ Rectangle {
moveDisplaced: Transition {
id: moveDisplaced
+ enabled: enableMoveTransitions
SequentialAnimation {
ScriptAction { script: grid.runningMoveDisplaced = true }
ParallelAnimation {
@@ -108,6 +112,7 @@ Rectangle {
remove: Transition {
id: removeTargets
+ enabled: enableRemoveTransitions
SequentialAnimation {
ScriptAction { script: grid.runningRemoveTargets = true }
ParallelAnimation {
@@ -120,6 +125,7 @@ Rectangle {
removeDisplaced: Transition {
id: removeDisplaced
+ enabled: enableRemoveTransitions
SequentialAnimation {
ScriptAction { script: grid.runningRemoveDisplaced = true }
ParallelAnimation {
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 66c98cda84..04bdfc8ac3 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -4795,6 +4795,9 @@ void tst_QQuickGridView::multipleTransitions()
QFETCH(int, initialCount);
QFETCH(qreal, contentY);
QFETCH(QList<ListChange>, changes);
+ QFETCH(bool, enableAddTransitions);
+ QFETCH(bool, enableMoveTransitions);
+ QFETCH(bool, enableRemoveTransitions);
QFETCH(bool, rippleAddDisplaced);
// add transitions on the left, moves on the right
@@ -4818,6 +4821,9 @@ void tst_QQuickGridView::multipleTransitions()
ctxt->setContextProperty("moveDisplaced_transitionFrom", moveDisplaced_transitionFrom);
ctxt->setContextProperty("removeTargets_transitionTo", removeTargets_transitionTo);
ctxt->setContextProperty("removeDisplaced_transitionFrom", removeDisplaced_transitionFrom);
+ ctxt->setContextProperty("enableAddTransitions", enableAddTransitions);
+ ctxt->setContextProperty("enableMoveTransitions", enableMoveTransitions);
+ ctxt->setContextProperty("enableRemoveTransitions", enableRemoveTransitions);
ctxt->setContextProperty("rippleAddDisplaced", rippleAddDisplaced);
canvas->setSource(testFileUrl("multipleTransitions.qml"));
canvas->show();
@@ -4901,8 +4907,8 @@ void tst_QQuickGridView::multipleTransitions()
for (int i=firstVisibleIndex; i < model.count() && i < itemCount; ++i) {
QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i);
QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i)));
- QCOMPARE(item->x(), (i%3)*80.0);
- QCOMPARE(item->y(), (i/3)*60.0);
+ QTRY_COMPARE(item->x(), (i%3)*80.0);
+ QTRY_COMPARE(item->y(), (i/3)*60.0);
QQuickText *name = findItem<QQuickText>(contentItem, "textName", i);
QVERIFY(name != 0);
QTRY_COMPARE(name->text(), model.name(i));
@@ -4916,6 +4922,9 @@ void tst_QQuickGridView::multipleTransitions_data()
QTest::addColumn<int>("initialCount");
QTest::addColumn<qreal>("contentY");
QTest::addColumn<QList<ListChange> >("changes");
+ QTest::addColumn<bool>("enableAddTransitions");
+ QTest::addColumn<bool>("enableMoveTransitions");
+ QTest::addColumn<bool>("enableRemoveTransitions");
QTest::addColumn<bool>("rippleAddDisplaced");
// the added item and displaced items should move to final dest correctly
@@ -4923,14 +4932,14 @@ void tst_QQuickGridView::multipleTransitions_data()
<< ListChange::insert(0, 1)
<< ListChange::move(0, 3, 1)
)
- << false;
+ << true << true << true << false;
// items affected by the add should change from move to add transition
QTest::newRow("move, then insert item before the moved item") << 20 << 0.0 << (QList<ListChange>()
<< ListChange::move(1, 10, 3)
<< ListChange::insert(0, 1)
)
- << false;
+ << true << true << true << false;
// items should be placed correctly if you trigger a transition then refill for that index
QTest::newRow("add at 0, flick down, flick back to top and add at 0 again") << 20 << 0.0 << (QList<ListChange>()
@@ -4939,13 +4948,31 @@ void tst_QQuickGridView::multipleTransitions_data()
<< ListChange::setContentY(0.0)
<< ListChange::insert(0, 1)
)
- << false;
+ << true << true << true << false;
QTest::newRow("insert then remove same index, with ripple effect on add displaced") << 20 << 0.0 << (QList<ListChange>()
<< ListChange::insert(1, 1)
<< ListChange::remove(1, 1)
)
- << true;
+ << true << true << true << true;
+
+ // if item is removed while undergoing a displaced transition, all other items should end up at their correct positions,
+ // even if a remove-displace transition is not present to re-animate them
+ QTest::newRow("insert then remove, with remove disabled") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::insert(0, 1)
+ << ListChange::remove(2, 1)
+ )
+ << true << true << false << false;
+
+ // if last item is not flush with the edge of the view, it should still be refilled in correctly after a
+ // remove has changed the position of where it will move to
+ QTest::newRow("insert twice then remove, with remove disabled") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::setContentY(-10.0)
+ << ListChange::insert(0, 1)
+ << ListChange::insert(0, 1)
+ << ListChange::remove(2, 1)
+ )
+ << true << true << false << false;
}
void tst_QQuickGridView::cacheBuffer()
diff --git a/tests/auto/quick/qquicklistview/data/multipleTransitions.qml b/tests/auto/quick/qquicklistview/data/multipleTransitions.qml
index 68efeea2ec..c0e888c6c6 100644
--- a/tests/auto/quick/qquicklistview/data/multipleTransitions.qml
+++ b/tests/auto/quick/qquicklistview/data/multipleTransitions.qml
@@ -58,6 +58,7 @@ Rectangle {
add: Transition {
id: addTargets
+ enabled: enableAddTransitions
SequentialAnimation {
ScriptAction { script: list.runningAddTargets = true }
ParallelAnimation {
@@ -70,6 +71,7 @@ Rectangle {
addDisplaced: Transition {
id: addDisplaced
+ enabled: enableAddTransitions
SequentialAnimation {
ScriptAction { script: list.runningAddDisplaced = true }
PauseAnimation { duration: rippleAddDisplaced ? addDisplaced.ViewTransition.index * root.duration/10 : 0 }
@@ -83,6 +85,7 @@ Rectangle {
move: Transition {
id: moveTargets
+ enabled: enableMoveTransitions
SequentialAnimation {
ScriptAction { script: list.runningMoveTargets = true }
ParallelAnimation {
@@ -95,6 +98,7 @@ Rectangle {
moveDisplaced: Transition {
id: moveDisplaced
+ enabled: enableMoveTransitions
SequentialAnimation {
ScriptAction { script: list.runningMoveDisplaced = true }
ParallelAnimation {
@@ -107,6 +111,7 @@ Rectangle {
remove: Transition {
id: removeTargets
+ enabled: enableRemoveTransitions
SequentialAnimation {
ScriptAction { script: list.runningRemoveTargets = true }
ParallelAnimation {
@@ -119,6 +124,7 @@ Rectangle {
removeDisplaced: Transition {
id: removeDisplaced
+ enabled: enableRemoveTransitions
SequentialAnimation {
ScriptAction { script: list.runningRemoveDisplaced = true }
ParallelAnimation {
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index dcc2e9dd16..c038faa0f1 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -5807,6 +5807,9 @@ void tst_QQuickListView::multipleTransitions()
QFETCH(int, initialCount);
QFETCH(qreal, contentY);
QFETCH(QList<ListChange>, changes);
+ QFETCH(bool, enableAddTransitions);
+ QFETCH(bool, enableMoveTransitions);
+ QFETCH(bool, enableRemoveTransitions);
QFETCH(bool, rippleAddDisplaced);
QPointF addTargets_transitionFrom(-50, -50);
@@ -5831,6 +5834,9 @@ void tst_QQuickListView::multipleTransitions()
ctxt->setContextProperty("moveDisplaced_transitionFrom", moveDisplaced_transitionFrom);
ctxt->setContextProperty("removeTargets_transitionTo", removeTargets_transitionTo);
ctxt->setContextProperty("removeDisplaced_transitionFrom", removeDisplaced_transitionFrom);
+ ctxt->setContextProperty("enableAddTransitions", enableAddTransitions);
+ ctxt->setContextProperty("enableMoveTransitions", enableMoveTransitions);
+ ctxt->setContextProperty("enableRemoveTransitions", enableRemoveTransitions);
ctxt->setContextProperty("rippleAddDisplaced", rippleAddDisplaced);
canvas->setSource(testFileUrl("multipleTransitions.qml"));
canvas->show();
@@ -5918,6 +5924,9 @@ void tst_QQuickListView::multipleTransitions_data()
QTest::addColumn<int>("initialCount");
QTest::addColumn<qreal>("contentY");
QTest::addColumn<QList<ListChange> >("changes");
+ QTest::addColumn<bool>("enableAddTransitions");
+ QTest::addColumn<bool>("enableMoveTransitions");
+ QTest::addColumn<bool>("enableRemoveTransitions");
QTest::addColumn<bool>("rippleAddDisplaced");
// the added item and displaced items should move to final dest correctly
@@ -5925,14 +5934,14 @@ void tst_QQuickListView::multipleTransitions_data()
<< ListChange::insert(0, 1)
<< ListChange::move(0, 3, 1)
)
- << false;
+ << true << true << true << false;
// items affected by the add should change from move to add transition
QTest::newRow("move, then insert item before the moved item") << 20 << 0.0 << (QList<ListChange>()
<< ListChange::move(1, 10, 3)
<< ListChange::insert(0, 1)
)
- << false;
+ << true << true << true << false;
// items should be placed correctly if you trigger a transition then refill for that index
QTest::newRow("add at 0, flick down, flick back to top and add at 0 again") << 20 << 0.0 << (QList<ListChange>()
@@ -5941,13 +5950,31 @@ void tst_QQuickListView::multipleTransitions_data()
<< ListChange::setContentY(0.0)
<< ListChange::insert(0, 1)
)
- << false;
+ << true << true << true << false;
QTest::newRow("insert then remove same index, with ripple effect on add displaced") << 20 << 0.0 << (QList<ListChange>()
<< ListChange::insert(1, 1)
<< ListChange::remove(1, 1)
)
- << true;
+ << true << true << true << true;
+
+ // if item is removed while undergoing a displaced transition, all other items should end up at their correct positions,
+ // even if a remove-displace transition is not present to re-animate them
+ QTest::newRow("insert then remove, with remove disabled") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::insert(0, 1)
+ << ListChange::remove(2, 1)
+ )
+ << true << true << false << false;
+
+ // if last item is not flush with the edge of the view, it should still be refilled in correctly after a
+ // remove has changed the position of where it will move to
+ QTest::newRow("insert twice then remove, with remove disabled") << 20 << 0.0 << (QList<ListChange>()
+ << ListChange::setContentY(-10.0)
+ << ListChange::insert(0, 1)
+ << ListChange::insert(0, 1)
+ << ListChange::remove(2, 1)
+ )
+ << true << true << false << false;
}
QList<int> tst_QQuickListView::toIntList(const QVariantList &list)
diff --git a/tests/auto/quick/qquickmousearea/data/wheel.qml b/tests/auto/quick/qquickmousearea/data/wheel.qml
new file mode 100644
index 0000000000..3e0c0c2a48
--- /dev/null
+++ b/tests/auto/quick/qquickmousearea/data/wheel.qml
@@ -0,0 +1,24 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ property var angleDeltaY
+ property real mouseX
+ property real mouseY
+ property bool controlPressed
+
+ width: 400
+ height: 400
+
+ MouseArea {
+ anchors.fill: parent
+
+ onWheel: {
+ root.angleDeltaY = wheel.angleDelta.y;
+ root.mouseX = wheel.x;
+ root.mouseY = wheel.y;
+ root.controlPressed = wheel.modifiers & Qt.ControlModifier;
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index 4375e835aa..0b4a6fa438 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -73,6 +73,7 @@ private slots:
void hoverPropagation();
void hoverVisible();
void disableAfterPress();
+ void onWheel();
private:
QQuickView *createView();
@@ -906,6 +907,26 @@ void tst_QQuickMouseArea::disableAfterPress()
delete canvas;
}
+void tst_QQuickMouseArea::onWheel()
+{
+ QQuickView *canvas = createView();
+ canvas->setSource(testFileUrl("wheel.qml"));
+
+ QQuickItem *root = canvas->rootObject();
+ QVERIFY(root != 0);
+
+ QWheelEvent wheelEvent(QPoint(10, 32), QPoint(10, 32), QPoint(60, 20), QPoint(0, 120),
+ 0, Qt::Vertical,Qt::NoButton, Qt::ControlModifier);
+ QGuiApplication::sendEvent(canvas, &wheelEvent);
+
+ QCOMPARE(root->property("angleDeltaY").toInt(), 120);
+ QCOMPARE(root->property("mouseX").toReal(), qreal(10));
+ QCOMPARE(root->property("mouseY").toReal(), qreal(32));
+ QCOMPARE(root->property("controlPressed").toBool(), true);
+
+ delete canvas;
+}
+
QTEST_MAIN(tst_QQuickMouseArea)
#include "tst_qquickmousearea.moc"
diff --git a/tools/qmlprofiler/profileclient.h b/tools/qmlprofiler/profileclient.h
index 8aa4e67982..54826a291a 100644
--- a/tools/qmlprofiler/profileclient.h
+++ b/tools/qmlprofiler/profileclient.h
@@ -44,7 +44,7 @@
#include "profiledata.h"
-#include <QtQml/private/qqmldebugclient_p.h>
+#include "qqmldebugclient.h"
#include <QtQml/private/qqmlprofilerservice_p.h>
class ProfileClientPrivate;
diff --git a/tools/qmlprofiler/qmlprofiler.pro b/tools/qmlprofiler/qmlprofiler.pro
index ec5f50e376..db7e357b70 100644
--- a/tools/qmlprofiler/qmlprofiler.pro
+++ b/tools/qmlprofiler/qmlprofiler.pro
@@ -2,7 +2,7 @@ TEMPLATE = app
TARGET = qmlprofiler
DESTDIR = $$QT.qml.bins
-QT += qml qml-private network
+QT += qml qml-private network core-private
target.path = $$[QT_INSTALL_BINS]
INSTALLS += target
@@ -15,11 +15,13 @@ SOURCES += main.cpp \
qmlprofilerapplication.cpp \
commandlistener.cpp \
profileclient.cpp \
- profiledata.cpp
+ profiledata.cpp \
+ qqmldebugclient.cpp
HEADERS += \
qmlprofilerapplication.h \
commandlistener.h \
constants.h \
profileclient.h \
- profiledata.h
+ profiledata.h \
+ qqmldebugclient.h
diff --git a/tools/qmlprofiler/qqmldebugclient.cpp b/tools/qmlprofiler/qqmldebugclient.cpp
new file mode 100644
index 0000000000..0453f88350
--- /dev/null
+++ b/tools/qmlprofiler/qqmldebugclient.cpp
@@ -0,0 +1,410 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qqmldebugclient.h"
+
+#include <private/qpacketprotocol_p.h>
+
+#include <QtCore/qdebug.h>
+#include <QtCore/qstringlist.h>
+#include <QtNetwork/qnetworkproxy.h>
+
+const int protocolVersion = 1;
+const QString serverId = QLatin1String("QDeclarativeDebugServer");
+const QString clientId = QLatin1String("QDeclarativeDebugClient");
+
+class QQmlDebugClientPrivate
+{
+public:
+ QQmlDebugClientPrivate();
+
+ QString name;
+ QQmlDebugConnection *connection;
+};
+
+class QQmlDebugConnectionPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ QQmlDebugConnectionPrivate(QQmlDebugConnection *c);
+ QQmlDebugConnection *q;
+ QPacketProtocol *protocol;
+ QIODevice *device;
+
+ bool gotHello;
+ QHash <QString, float> serverPlugins;
+ QHash<QString, QQmlDebugClient *> plugins;
+
+ void advertisePlugins();
+ void connectDeviceSignals();
+
+public Q_SLOTS:
+ void connected();
+ void readyRead();
+ void deviceAboutToClose();
+};
+
+QQmlDebugConnectionPrivate::QQmlDebugConnectionPrivate(QQmlDebugConnection *c)
+ : QObject(c), q(c), protocol(0), device(0), gotHello(false)
+{
+ protocol = new QPacketProtocol(q, this);
+ QObject::connect(c, SIGNAL(connected()), this, SLOT(connected()));
+ QObject::connect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
+}
+
+void QQmlDebugConnectionPrivate::advertisePlugins()
+{
+ if (!q->isConnected())
+ return;
+
+ QPacket pack;
+ pack << serverId << 1 << plugins.keys();
+ protocol->send(pack);
+ q->flush();
+}
+
+void QQmlDebugConnectionPrivate::connected()
+{
+ QPacket pack;
+ pack << serverId << 0 << protocolVersion << plugins.keys();
+ protocol->send(pack);
+ q->flush();
+}
+
+void QQmlDebugConnectionPrivate::readyRead()
+{
+ if (!gotHello) {
+ QPacket pack = protocol->read();
+ QString name;
+
+ pack >> name;
+
+ bool validHello = false;
+ if (name == clientId) {
+ int op = -1;
+ pack >> op;
+ if (op == 0) {
+ int version = -1;
+ pack >> version;
+ if (version == protocolVersion) {
+ QStringList pluginNames;
+ QList<float> pluginVersions;
+ pack >> pluginNames;
+ if (!pack.isEmpty())
+ pack >> pluginVersions;
+
+ const int pluginNamesSize = pluginNames.size();
+ const int pluginVersionsSize = pluginVersions.size();
+ for (int i = 0; i < pluginNamesSize; ++i) {
+ float pluginVersion = 1.0;
+ if (i < pluginVersionsSize)
+ pluginVersion = pluginVersions.at(i);
+ serverPlugins.insert(pluginNames.at(i), pluginVersion);
+ }
+
+ validHello = true;
+ }
+ }
+ }
+
+ if (!validHello) {
+ qWarning("QQmlDebugConnection: Invalid hello message");
+ QObject::disconnect(protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
+ return;
+ }
+ gotHello = true;
+
+ QHash<QString, QQmlDebugClient *>::Iterator iter = plugins.begin();
+ for (; iter != plugins.end(); ++iter) {
+ QQmlDebugClient::State newState = QQmlDebugClient::Unavailable;
+ if (serverPlugins.contains(iter.key()))
+ newState = QQmlDebugClient::Enabled;
+ iter.value()->stateChanged(newState);
+ }
+ }
+
+ while (protocol->packetsAvailable()) {
+ QPacket pack = protocol->read();
+ QString name;
+ pack >> name;
+
+ if (name == clientId) {
+ int op = -1;
+ pack >> op;
+
+ if (op == 1) {
+ // Service Discovery
+ QHash<QString, float> oldServerPlugins = serverPlugins;
+ serverPlugins.clear();
+
+ QStringList pluginNames;
+ QList<float> pluginVersions;
+ pack >> pluginNames;
+ if (!pack.isEmpty())
+ pack >> pluginVersions;
+
+ const int pluginNamesSize = pluginNames.size();
+ const int pluginVersionsSize = pluginVersions.size();
+ for (int i = 0; i < pluginNamesSize; ++i) {
+ float pluginVersion = 1.0;
+ if (i < pluginVersionsSize)
+ pluginVersion = pluginVersions.at(i);
+ serverPlugins.insert(pluginNames.at(i), pluginVersion);
+ }
+
+ QHash<QString, QQmlDebugClient *>::Iterator iter = plugins.begin();
+ for (; iter != plugins.end(); ++iter) {
+ const QString pluginName = iter.key();
+ QQmlDebugClient::State newSate = QQmlDebugClient::Unavailable;
+ if (serverPlugins.contains(pluginName))
+ newSate = QQmlDebugClient::Enabled;
+
+ if (oldServerPlugins.contains(pluginName)
+ != serverPlugins.contains(pluginName)) {
+ iter.value()->stateChanged(newSate);
+ }
+ }
+ } else {
+ qWarning() << "QQmlDebugConnection: Unknown control message id" << op;
+ }
+ } else {
+ QByteArray message;
+ pack >> message;
+
+ QHash<QString, QQmlDebugClient *>::Iterator iter =
+ plugins.find(name);
+ if (iter == plugins.end()) {
+ qWarning() << "QQmlDebugConnection: Message received for missing plugin" << name;
+ } else {
+ (*iter)->messageReceived(message);
+ }
+ }
+ }
+}
+
+void QQmlDebugConnectionPrivate::deviceAboutToClose()
+{
+ // This is nasty syntax but we want to emit our own aboutToClose signal (by calling QIODevice::close())
+ // without calling the underlying device close fn as that would cause an infinite loop
+ q->QIODevice::close();
+}
+
+QQmlDebugConnection::QQmlDebugConnection(QObject *parent)
+ : QIODevice(parent), d(new QQmlDebugConnectionPrivate(this))
+{
+}
+
+QQmlDebugConnection::~QQmlDebugConnection()
+{
+ QHash<QString, QQmlDebugClient*>::iterator iter = d->plugins.begin();
+ for (; iter != d->plugins.end(); ++iter) {
+ iter.value()->d->connection = 0;
+ iter.value()->stateChanged(QQmlDebugClient::NotConnected);
+ }
+}
+
+bool QQmlDebugConnection::isConnected() const
+{
+ return state() == QAbstractSocket::ConnectedState;
+}
+
+qint64 QQmlDebugConnection::readData(char *data, qint64 maxSize)
+{
+ return d->device->read(data, maxSize);
+}
+
+qint64 QQmlDebugConnection::writeData(const char *data, qint64 maxSize)
+{
+ return d->device->write(data, maxSize);
+}
+
+qint64 QQmlDebugConnection::bytesAvailable() const
+{
+ return d->device->bytesAvailable();
+}
+
+bool QQmlDebugConnection::isSequential() const
+{
+ return true;
+}
+
+void QQmlDebugConnection::close()
+{
+ if (isOpen()) {
+ QIODevice::close();
+ d->device->close();
+ emit stateChanged(QAbstractSocket::UnconnectedState);
+
+ QHash<QString, QQmlDebugClient*>::iterator iter = d->plugins.begin();
+ for (; iter != d->plugins.end(); ++iter) {
+ iter.value()->stateChanged(QQmlDebugClient::NotConnected);
+ }
+ }
+}
+
+bool QQmlDebugConnection::waitForConnected(int msecs)
+{
+ QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
+ if (socket)
+ return socket->waitForConnected(msecs);
+ return false;
+}
+
+QAbstractSocket::SocketState QQmlDebugConnection::state() const
+{
+ QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
+ if (socket)
+ return socket->state();
+
+ return QAbstractSocket::UnconnectedState;
+}
+
+void QQmlDebugConnection::flush()
+{
+ QAbstractSocket *socket = qobject_cast<QAbstractSocket*>(d->device);
+ if (socket) {
+ socket->flush();
+ return;
+ }
+}
+
+void QQmlDebugConnection::connectToHost(const QString &hostName, quint16 port)
+{
+ QTcpSocket *socket = new QTcpSocket(d);
+ socket->setProxy(QNetworkProxy::NoProxy);
+ d->device = socket;
+ d->connectDeviceSignals();
+ d->gotHello = false;
+ connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SIGNAL(stateChanged(QAbstractSocket::SocketState)));
+ connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(error(QAbstractSocket::SocketError)));
+ connect(socket, SIGNAL(connected()), this, SIGNAL(connected()));
+ socket->connectToHost(hostName, port);
+ QIODevice::open(ReadWrite | Unbuffered);
+}
+
+void QQmlDebugConnectionPrivate::connectDeviceSignals()
+{
+ connect(device, SIGNAL(bytesWritten(qint64)), q, SIGNAL(bytesWritten(qint64)));
+ connect(device, SIGNAL(readyRead()), q, SIGNAL(readyRead()));
+ connect(device, SIGNAL(aboutToClose()), this, SLOT(deviceAboutToClose()));
+}
+
+//
+
+QQmlDebugClientPrivate::QQmlDebugClientPrivate()
+ : connection(0)
+{
+}
+
+QQmlDebugClient::QQmlDebugClient(const QString &name,
+ QQmlDebugConnection *parent)
+ : QObject(parent),
+ d(new QQmlDebugClientPrivate)
+{
+ d->name = name;
+ d->connection = parent;
+
+ if (!d->connection)
+ return;
+
+ if (d->connection->d->plugins.contains(name)) {
+ qWarning() << "QQmlDebugClient: Conflicting plugin name" << name;
+ d->connection = 0;
+ } else {
+ d->connection->d->plugins.insert(name, this);
+ d->connection->d->advertisePlugins();
+ }
+}
+
+QQmlDebugClient::~QQmlDebugClient()
+{
+ if (d->connection && d->connection->d) {
+ d->connection->d->plugins.remove(d->name);
+ d->connection->d->advertisePlugins();
+ }
+ delete d;
+}
+
+QString QQmlDebugClient::name() const
+{
+ return d->name;
+}
+
+float QQmlDebugClient::serviceVersion() const
+{
+ if (d->connection->d->serverPlugins.contains(d->name))
+ return d->connection->d->serverPlugins.value(d->name);
+ return -1;
+}
+
+QQmlDebugClient::State QQmlDebugClient::state() const
+{
+ if (!d->connection
+ || !d->connection->isConnected()
+ || !d->connection->d->gotHello)
+ return NotConnected;
+
+ if (d->connection->d->serverPlugins.contains(d->name))
+ return Enabled;
+
+ return Unavailable;
+}
+
+void QQmlDebugClient::sendMessage(const QByteArray &message)
+{
+ if (state() != Enabled)
+ return;
+
+ QPacket pack;
+ pack << d->name << message;
+ d->connection->d->protocol->send(pack);
+ d->connection->flush();
+}
+
+void QQmlDebugClient::stateChanged(State)
+{
+}
+
+void QQmlDebugClient::messageReceived(const QByteArray &)
+{
+}
+
+#include <qqmldebugclient.moc>
diff --git a/tools/qmlprofiler/qqmldebugclient.h b/tools/qmlprofiler/qqmldebugclient.h
new file mode 100644
index 0000000000..0f140a1db1
--- /dev/null
+++ b/tools/qmlprofiler/qqmldebugclient.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLDEBUGCLIENT_H
+#define QQMLDEBUGCLIENT_H
+
+#include <QtNetwork/qtcpsocket.h>
+
+class QQmlDebugConnectionPrivate;
+class QQmlDebugConnection : public QIODevice
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(QQmlDebugConnection)
+public:
+ QQmlDebugConnection(QObject * = 0);
+ ~QQmlDebugConnection();
+
+ void connectToHost(const QString &hostName, quint16 port);
+
+ qint64 bytesAvailable() const;
+ bool isConnected() const;
+ QAbstractSocket::SocketState state() const;
+ void flush();
+ bool isSequential() const;
+ void close();
+ bool waitForConnected(int msecs = 30000);
+
+signals:
+ void connected();
+ void stateChanged(QAbstractSocket::SocketState socketState);
+ void error(QAbstractSocket::SocketError socketError);
+
+protected:
+ qint64 readData(char *data, qint64 maxSize);
+ qint64 writeData(const char *data, qint64 maxSize);
+
+private:
+ QQmlDebugConnectionPrivate *d;
+ friend class QQmlDebugClient;
+ friend class QQmlDebugClientPrivate;
+};
+
+class QQmlDebugClientPrivate;
+class QQmlDebugClient : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(QQmlDebugClient)
+
+public:
+ enum State { NotConnected, Unavailable, Enabled };
+
+ QQmlDebugClient(const QString &, QQmlDebugConnection *parent);
+ ~QQmlDebugClient();
+
+ QString name() const;
+ float serviceVersion() const;
+ State state() const;
+
+ virtual void sendMessage(const QByteArray &);
+
+protected:
+ virtual void stateChanged(State);
+ virtual void messageReceived(const QByteArray &);
+
+private:
+ QQmlDebugClientPrivate *d;
+ friend class QQmlDebugConnection;
+ friend class QQmlDebugConnectionPrivate;
+};
+
+#endif // QQMLDEBUGCLIENT_H