aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergio Ahumada <sergio.ahumada@digia.com>2013-01-09 09:16:24 +0100
committerSergio Ahumada <sergio.ahumada@digia.com>2013-01-09 09:16:51 +0100
commit7830710e57cbbbc8a2fb37fc97eb99f552ecdd83 (patch)
tree3fe141b7921ec3820c1db13fe1827c051e8f5060
parent0beb478b7f4c50f6b57cdc164ffe8029d2895149 (diff)
parentd37547add0369d45182271754c0a35032d7de2d3 (diff)
Merge branch 'stable' into release
-rw-r--r--.gitignore3
-rw-r--r--dist/changes-5.0.156
-rw-r--r--examples/quick/accessibility/accessibility.qml55
-rw-r--r--examples/quick/accessibility/content/Button.qml18
-rw-r--r--examples/quick/accessibility/content/Checkbox.qml31
-rw-r--r--examples/quick/accessibility/content/Slider.qml28
-rw-r--r--examples/quick/doc/images/custom-geometry-example.pngbin27636 -> 0 bytes
-rw-r--r--examples/quick/scenegraph/customgeometry/doc/images/custom-geometry-example.pngbin0 -> 18006 bytes
-rw-r--r--examples/quick/scenegraph/customgeometry/doc/src/customgeometry.qdoc33
-rw-r--r--examples/quick/scenegraph/customgeometry/main.cpp3
-rw-r--r--examples/quick/scenegraph/openglunderqml/doc/images/openglunderqml-example.jpgbin0 -> 20640 bytes
-rw-r--r--examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc168
-rw-r--r--examples/quick/scenegraph/openglunderqml/squircle.cpp20
-rw-r--r--examples/quick/scenegraph/openglunderqml/squircle.h2
-rw-r--r--examples/quick/scenegraph/simplematerial/doc/images/simplematerial-example.jpgbin0 -> 10744 bytes
-rw-r--r--examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc180
-rw-r--r--examples/quick/scenegraph/simplematerial/main.qml38
-rw-r--r--examples/quick/scenegraph/simplematerial/simplematerial.cpp85
-rw-r--r--src/plugins/accessible/quick/accessible.json2
-rw-r--r--src/plugins/accessible/quick/main.cpp25
-rw-r--r--src/plugins/accessible/quick/qaccessiblequickitem.cpp28
-rw-r--r--src/plugins/accessible/quick/qaccessiblequickitem.h55
-rw-r--r--src/plugins/accessible/quick/qaccessiblequickview.cpp46
-rw-r--r--src/plugins/accessible/quick/qaccessiblequickview.h10
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp2
-rw-r--r--src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h2
-rw-r--r--src/plugins/qmltooling/shared/abstracttool.h2
-rw-r--r--src/plugins/qmltooling/shared/abstractviewinspector.cpp4
-rw-r--r--src/plugins/qmltooling/shared/abstractviewinspector.h2
-rw-r--r--src/plugins/qmltooling/shared/qpacketprotocol.cpp1
-rw-r--r--src/qml/animations/qabstractanimationjob.cpp2
-rw-r--r--src/qml/doc/qtqml.qdocconf8
-rw-r--r--src/qml/qml/parser/qqmljskeywords_p.h50
-rw-r--r--src/qml/qml/qqmlimport.cpp1
-rw-r--r--src/qmltest/qmltest.pro7
-rw-r--r--src/qmltest/quicktest.cpp29
-rw-r--r--src/qmltest/quicktestevent.cpp4
-rw-r--r--src/qmltest/quicktestevent_p.h2
-rw-r--r--src/quick/doc/qtquick.qdocconf8
-rw-r--r--src/quick/items/qquickaccessibleattached.cpp4
-rw-r--r--src/quick/items/qquickaccessibleattached_p.h18
-rw-r--r--src/quick/items/qquickflickable.cpp2
-rw-r--r--src/quick/items/qquickflickable_p.h2
-rw-r--r--src/quick/items/qquickitem.cpp16
-rw-r--r--src/quick/items/qquickitem.h2
-rw-r--r--src/quick/items/qquickitem_p.h2
-rw-r--r--src/quick/items/qquickmousearea.cpp2
-rw-r--r--src/quick/items/qquickmousearea_p.h2
-rw-r--r--src/quick/items/qquickshadereffectnode.cpp2
-rw-r--r--src/quick/items/qquickshadereffectsource.cpp1
-rw-r--r--src/quick/items/qquicktextinput.cpp17
-rw-r--r--src/quick/items/qquickthreadedwindowmanager.cpp3
-rw-r--r--src/quick/items/qquickwindow.cpp4
-rw-r--r--src/quick/items/qquickwindow_p.h2
-rw-r--r--src/quick/items/qquickwindowmanager.cpp2
-rw-r--r--src/quick/scenegraph/util/qsgsimplematerial.cpp23
-rw-r--r--src/quick/util/qquickanimationcontroller.cpp2
-rw-r--r--tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp2
-rw-r--r--tests/auto/qml/qqmlbundle/data/imports/bundletest/plugin1.pro1
-rw-r--r--tests/auto/qml/qqmlbundle/tst_qqmlbundle.cpp2
-rw-r--r--tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp26
-rw-r--r--tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp2
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp71
-rw-r--r--tests/auto/qml/qqmlengine/tst_qqmlengine.cpp25
-rw-r--r--tests/auto/qml/qqmlinstruction/qqmlinstruction.pro2
-rw-r--r--tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp32
-rw-r--r--tests/auto/qml/qqmllanguage/data/literals.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/testtypes.h2
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp16
-rw-r--r--tests/auto/qml/qqmlpropertymap/qqmlpropertymap.pro2
-rw-r--r--tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp17
-rw-r--r--tests/auto/qml/qqmlqt/tst_qqmlqt.cpp16
-rw-r--r--tests/auto/qml/v4/tst_v4.cpp40
-rw-r--r--tests/auto/qmltest/animations/tst_abstractanimationjobcrash.qml73
-rw-r--r--tests/auto/quick/geometry/tst_geometry.cpp6
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp1
-rw-r--r--tests/auto/quick/qquickimage/tst_qquickimage.cpp14
-rw-r--r--tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp2
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp15
-rw-r--r--tests/auto/quick/qquickloader/tst_qquickloader.cpp2
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp3
-rw-r--r--tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp62
-rw-r--r--tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp2
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp4
-rw-r--r--tests/auto/quick/qquickview/qquickview.pro2
-rw-r--r--tests/auto/quick/qquickview/tst_qquickview.cpp3
-rw-r--r--tests/auto/shared/util.cpp29
-rw-r--r--tests/auto/shared/util.h21
-rw-r--r--tools/qmlscene/main.cpp8
89 files changed, 1152 insertions, 472 deletions
diff --git a/.gitignore b/.gitignore
index 914f9e39e0..2f83627143 100644
--- a/.gitignore
+++ b/.gitignore
@@ -263,3 +263,6 @@ tests/auto/*/*.o
tests/auto/*/*.moc
tests/auto/*/*/*.o
tests/auto/*/*/*.moc
+
+# Generated static plugin import sources
+*_plugin_import.cpp
diff --git a/dist/changes-5.0.1 b/dist/changes-5.0.1
new file mode 100644
index 0000000000..9959c36a11
--- /dev/null
+++ b/dist/changes-5.0.1
@@ -0,0 +1,56 @@
+Qt 5.0.1 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.0.0.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+ http://qt-project.org/doc/qt-5.0/
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ http://bugreports.qt-project.org/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+
+****************************************************************************
+* General *
+****************************************************************************
+
+General Improvements
+--------------------
+
+Third party components
+----------------------
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+Qt QML
+------
+
+Qt Quick
+--------
+
+****************************************************************************
+* Platform Specific Changes *
+****************************************************************************
+
+
+****************************************************************************
+* Compiler Specific Changes *
+****************************************************************************
+
+
+****************************************************************************
+* Tools *
+****************************************************************************
+
+
+****************************************************************************
+* Plugins *
+****************************************************************************
+
diff --git a/examples/quick/accessibility/accessibility.qml b/examples/quick/accessibility/accessibility.qml
index 248d17ae16..fe9e03dbc4 100644
--- a/examples/quick/accessibility/accessibility.qml
+++ b/examples/quick/accessibility/accessibility.qml
@@ -55,17 +55,13 @@ Rectangle {
anchors.fill: parent
anchors.margins: 10
width: parent.width
- Row {
- spacing: 6
- width: column.width
- Button { width: 100; height: column.h + 20; text: "Send"; onClicked : { status.text = "Send" } }
- Button { width: 100; height: column.h + 20; text: "Discard"; onClicked : { status.text = "Discard" } }
- }
+
Row {
spacing: 6
width: column.width
height: column.h
+
Text {
id: subjectLabel
//! [text]
@@ -73,6 +69,7 @@ Rectangle {
Accessible.name: text
//! [text]
text: "Subject:"
+ y: 3
}
Rectangle {
id: subjectBorder
@@ -80,13 +77,20 @@ Rectangle {
Accessible.name: subjectEdit.text
border.width: 1
border.color: "black"
- height: subjectEdit.height
+ height: subjectEdit.height + 6
width: 240
TextInput {
+ focus: true
+ y: 3
+ x: 3
+ width: parent.width - 6
id: subjectEdit
text: "Vacation plans"
+ KeyNavigation.tab: textEdit
}
+
}
+
}
Rectangle {
id: textBorder
@@ -95,12 +99,18 @@ Rectangle {
border.width: 1
border.color: "black"
width: parent.width - 2
- height: parent.height - (textBorder.y + column.spacing)
+
+ height: 200
TextEdit {
id: textEdit
- text: "Hi, we're going to the Dolomites this summer. Weren't you also going to northern Italy? \n\nbest wishes, your friend Luke"
- width: parent.width
+ y: 3
+ x: 3
+ width: parent.width - 6
+ height: parent.height - 6
+ text: "Hi, we're going to the Dolomites this summer. Weren't you also going to northern Italy? \n\nBest wishes, your friend Luke"
wrapMode: TextEdit.WordWrap
+ KeyNavigation.tab: sendButton
+ KeyNavigation.priority: KeyNavigation.BeforeItem
}
}
Text {
@@ -110,9 +120,28 @@ Rectangle {
Row {
spacing: 6
- width: column.width
- Checkbox { checked: false }
- Slider { value: 10 }
+ Button { id: sendButton; width: 100; height: column.h + 20; text: "Send";
+ onClicked : { status.text = "Send" }
+ KeyNavigation.tab: discardButton
+ }
+ Button { id: discardButton; width: 100; height: column.h + 20; text: "Discard";
+ onClicked : { status.text = "Discard" }
+ KeyNavigation.tab: checkBox
+ }
+ }
+
+ Row {
+ spacing: 6
+ Checkbox {
+ id: checkBox
+ checked: false
+ KeyNavigation.tab: slider
+ }
+ Slider {
+ id: slider
+ value: 10
+ KeyNavigation.tab: subjectEdit
+ }
}
}
}
diff --git a/examples/quick/accessibility/content/Button.qml b/examples/quick/accessibility/content/Button.qml
index 2d17e18ae3..fa26177d32 100644
--- a/examples/quick/accessibility/content/Button.qml
+++ b/examples/quick/accessibility/content/Button.qml
@@ -61,11 +61,12 @@ Rectangle {
height: 30
gradient: Gradient {
GradientStop { position: 0.0; color: "lightsteelblue" }
- GradientStop { position: 1.0; color: "blue" }
+ GradientStop { position: 1.0;
+ color: button.focus ? "red" : "blue" }
}
- border.width: 2
- border.color: "black";
- radius: 10
+ // border.width: 1
+ //border.color: "black";
+ radius: 5
antialiasing: true
Text {
@@ -73,14 +74,15 @@ Rectangle {
text: parent.description
anchors.centerIn: parent
font.pixelSize: parent.height * .5
- style: Text.Sunken; color: "white"; styleColor: "black"
+ style: Text.Sunken
+ color: "white"
+ styleColor: "black"
}
MouseArea {
id: mouseArea
anchors.fill: parent
- onClicked: {
- parent.clicked()
- }
+ onClicked: parent.clicked()
}
+ Keys.onSpacePressed: clicked()
}
diff --git a/examples/quick/accessibility/content/Checkbox.qml b/examples/quick/accessibility/content/Checkbox.qml
index 273e38b239..f16f66ebb2 100644
--- a/examples/quick/accessibility/content/Checkbox.qml
+++ b/examples/quick/accessibility/content/Checkbox.qml
@@ -43,20 +43,37 @@
import QtQuick 2.0
-Rectangle {
+FocusScope {
id: checkbox
Accessible.role: Accessible.CheckBox
+ property string text: "CheckBox"
property bool checked // required variable
- width: 30
+ width: 100
height: 30
-
- Text {
- id: checkboxText
- text: parent.checked ? "on" : "off"
- anchors.centerIn: parent
+ Row {
+ spacing: 2
+ Rectangle {
+ width: 12
+ height: 12
+ border.width: checkbox.focus ? 2 : 1
+ border.color: "black"
+ Text {
+ id: checkboxText
+ text: checkbox.checked ? "x" : ""
+ anchors.centerIn: parent
+ }
+ }
+ Text {
+ text: checkbox.text
+ }
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: checkbox.checked = !checkbox.checked
}
+ Keys.onSpacePressed: checkbox.checked = !checkbox.checked
}
diff --git a/examples/quick/accessibility/content/Slider.qml b/examples/quick/accessibility/content/Slider.qml
index fdbfd399b9..a116308a14 100644
--- a/examples/quick/accessibility/content/Slider.qml
+++ b/examples/quick/accessibility/content/Slider.qml
@@ -46,17 +46,30 @@ import QtQuick 2.0
Rectangle {
id: slider
- property alias text : buttonText.text
+ property alias text: buttonText.text
Accessible.role: Accessible.Slider
- property int value // required
+ property int value : 5 // required
property int minimumValue : 0 // optional (default INT_MIN)
property int maximumValue : 20 // optional (default INT_MAX)
property int stepSize : 1 // optional (default 1)
- width: 30
+ width: 100
height: 30
+ border.color: "black"
+ border.width: 1
+ Rectangle {
+ id: indicator
+ x: 1
+ y: 1
+ height: parent.height - 2
+ width: ((parent.width - 2) / maximumValue) * value
+ color: "lightgrey"
+ Behavior on width {
+ NumberAnimation { duration: 50 }
+ }
+ }
Text {
id: buttonText
@@ -64,4 +77,13 @@ Rectangle {
anchors.centerIn: parent
font.pixelSize: parent.height * .5
}
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ var pos = mouse.x / slider.width * (maximumValue - minimumValue) + minimumValue
+ slider.value = pos
+ }
+ }
+ Keys.onLeftPressed: value > minimumValue ? value = value - stepSize : minimumValue
+ Keys.onRightPressed: value < maximumValue ? value = value + stepSize : maximumValue
}
diff --git a/examples/quick/doc/images/custom-geometry-example.png b/examples/quick/doc/images/custom-geometry-example.png
deleted file mode 100644
index 33739f78b8..0000000000
--- a/examples/quick/doc/images/custom-geometry-example.png
+++ /dev/null
Binary files differ
diff --git a/examples/quick/scenegraph/customgeometry/doc/images/custom-geometry-example.png b/examples/quick/scenegraph/customgeometry/doc/images/custom-geometry-example.png
new file mode 100644
index 0000000000..4ed20d3485
--- /dev/null
+++ b/examples/quick/scenegraph/customgeometry/doc/images/custom-geometry-example.png
Binary files differ
diff --git a/examples/quick/scenegraph/customgeometry/doc/src/customgeometry.qdoc b/examples/quick/scenegraph/customgeometry/doc/src/customgeometry.qdoc
index c226634823..7127fd0dc4 100644
--- a/examples/quick/scenegraph/customgeometry/doc/src/customgeometry.qdoc
+++ b/examples/quick/scenegraph/customgeometry/doc/src/customgeometry.qdoc
@@ -28,7 +28,8 @@
/*!
\example quick/scenegraph/customgeometry
\title Custom Geometry Example
- \ingroup examples
+ \ingroup qtquickexamples
+ \brief Shows how to implement a custom geometry in the Qt Quick Scene Graph.
\brief The custom geometry example shows how to create a QQuickItem which
uses the scene graph API to build a custom geometry for the scene
@@ -58,11 +59,11 @@
QQuickItem::updatePaintNode() which all items with custom scene
graph logic must implement.
- \e { The scene graph will on many hardware configurations be
+ \note The scene graph will on many hardware configurations be
rendering on a separate thread. It is therefore crucial that
- interaction with the scene graph happens in a controlled
- manner, first and foremost through the \l
- QQuickItem::updatePaintNode() function. }
+ interaction with the scene graph happens in a controlled manner,
+ first and foremost through the \l QQuickItem::updatePaintNode()
+ function.
\section1 BezierCurve Implementation
@@ -122,17 +123,17 @@
set which has two floats, one for x coordinates and one for y
coordinates. The second argument is the vertex count.
- \e {Custom attribute sets can also created, but that is not
- covered in this example}.
+ Custom attribute sets can also created, but that is not
+ covered in this example.
Since we do not have any special needs for memory managing the
geometry, we specify that the QSGGeometryNode should own the
geometry.
- \e {To minimize allocations, reduce memory fragmentation and
+ To minimize allocations, reduce memory fragmentation and
improve performance, it would also be possible to make the
geometry a member of a QSGGeometryNode subclass, in which case, we
- would not have set the QSGGeometryNode::OwnsGeometry flag}.
+ would not have set the QSGGeometryNode::OwnsGeometry flag.
\snippet quick/scenegraph/customgeometry/beziercurve.cpp 6
@@ -174,26 +175,32 @@
BezierCurve and make it part of the \c {CustomGeometry 1.0}
module.
+ As the bezier curve is drawn using GL_LINE_STRIP, we specify that
+ the view should be multisampled to get antialiasing. This is not
+ required, but it will make the item look a bit nicer on hardware
+ that supports it. Multisampling is not enabled by default because
+ it often results in higher memory usage.
+
\section1 Using the Item
- \snippet quick/scenegraph/customgeometry/LineTester.qml 1
+ \snippet quick/scenegraph/customgeometry/main.qml 1
Our .qml file imports the \c {QtQuick 2.0} module to get the
standard elements and also our own \c {CustomGeometry 1.0} module
which contains our newly created BezierCurve element.
- \snippet quick/scenegraph/customgeometry/LineTester.qml 2
+ \snippet quick/scenegraph/customgeometry/main.qml 2
Then we create the our root item and an instance of the
BezierCurve which we anchor to fill the root.
- \snippet quick/scenegraph/customgeometry/LineTester.qml 3
+ \snippet quick/scenegraph/customgeometry/main.qml 3
To make the example a bit more interesting we add an animation to
change the two control points in the curve. The end points stay
unchanged.
- \snippet quick/scenegraph/customgeometry/LineTester.qml 4
+ \snippet quick/scenegraph/customgeometry/main.qml 4
Finally we overlay a short text outlining what the example shows.
diff --git a/examples/quick/scenegraph/customgeometry/main.cpp b/examples/quick/scenegraph/customgeometry/main.cpp
index ea699c1c36..f2ec27d229 100644
--- a/examples/quick/scenegraph/customgeometry/main.cpp
+++ b/examples/quick/scenegraph/customgeometry/main.cpp
@@ -52,6 +52,9 @@ int main(int argc, char **argv)
qmlRegisterType<BezierCurve>("CustomGeometry", 1, 0, "BezierCurve");
QQuickView view;
+ QSurfaceFormat format;
+ format.setSamples(16);
+ view.setFormat(format);
view.setSource(QUrl("qrc:///scenegraph/customgeometry/main.qml"));
view.show();
diff --git a/examples/quick/scenegraph/openglunderqml/doc/images/openglunderqml-example.jpg b/examples/quick/scenegraph/openglunderqml/doc/images/openglunderqml-example.jpg
new file mode 100644
index 0000000000..69ee04d2ea
--- /dev/null
+++ b/examples/quick/scenegraph/openglunderqml/doc/images/openglunderqml-example.jpg
Binary files differ
diff --git a/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc b/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc
new file mode 100644
index 0000000000..5ded717e5f
--- /dev/null
+++ b/examples/quick/scenegraph/openglunderqml/doc/src/openglunderqml.qdoc
@@ -0,0 +1,168 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example quick/scenegraph/openglunderqml
+ \title OpenGL Under QML
+ \ingroup qtquickexamples
+ \brief Shows how to render OpenGL under a Qt Quick scene.
+
+ \image openglunderqml-example.jpg
+
+ The OpenGL under QML example shows how an application can make use
+ of the \l QQuickWindow::beforeRendering() signal to draw custom
+ OpenGL content under a Qt Quick scene. This signal is emitted at
+ the start of every frame, before the scene graph starts its
+ rendering, thus any OpenGL draw calls that are made as a response
+ to this signal, will stack under the Qt Quick items.
+
+ As an alternative, applications that wish to render OpenGL content
+ on top of the Qt Quick scene, can do so by connecting to the \l
+ QQuickWindow::afterRendering() signal.
+
+ In this example, we will also see how it is possible to have
+ values that are exposed to QML which affect the OpenGL
+ rendering. We animate the threshold value using a NumberAnimation
+ in the QML file and this value is used by the OpenGL shader
+ program that draws the squircles.
+
+ \snippet quick/scenegraph/openglunderqml/squircle.h 1
+
+ First of all, we need a QObject with a slot to connect the signals
+ to. We subclass QQuickItem in order to use the \l
+ QQuickItem::window() which holds the window instance we want to
+ connect to.
+
+ We use two values of \c t. The variable \c m_t is the property
+ value as it exists in the GUI thread. The \c m_thread_t value is a
+ copy of \c m_t for use in the rendering thread. We need an
+ explicit copy because the scene graph can render in one thread
+ while updating properties on the GUI thread in preparation for the
+ next frame. If we had used only one value, the animation could
+ have updated the value to that of the next frame before we got a
+ chance to render it.
+
+ \note In this example, a wrong value for \c t will have minimal
+ consequences, but we emphasize that rendering and GUI thread
+ objects and values must stay separate to avoid race conditions,
+ undesired behavior and in the worst case, crashes.
+
+ Lets move on to the implementation.
+
+ \snippet quick/scenegraph/openglunderqml/squircle.cpp 7
+
+ The constructor of the \c Squircle class simply initializes the
+ values. The shader program will be initialized during rendering
+ later.
+
+ \snippet quick/scenegraph/openglunderqml/squircle.cpp 8
+
+ The property setter checks that the value has indeed changed
+ before updating its internal variable. It then calls \l
+ QQuickWindow::update() which will trigger another frame to be
+ rendered. Note that the setter might be called during
+ initialization, before the object has been entered into the scene
+ and before it has a window.
+
+ \snippet quick/scenegraph/openglunderqml/squircle.cpp 1
+ \snippet quick/scenegraph/openglunderqml/squircle.cpp 2
+
+ For our paint function to be called, we need to connect to the
+ window's signals. When Squircle object is populated into the
+ scene, the itemChange function is called with the change type \c
+ ItemSceneChange. We connect \l QQuickWindow::beforeRendering() to
+ \c paint() to do the rendering, and \l
+ QQuickWindow::beforeSynchronizing() to \c sync() to copy the state
+ of the \c t property for the upcoming frame.
+
+ \note Since the Squircle object has affinity to the GUI thread and
+ the signals are emitted from the rendering thread, it is crucial
+ that the connections are made with \l
+ Qt::DirectConnection. Failing to do so, will result in that the
+ slots are invoked on the wrong thread with no OpenGL context
+ present.
+
+ \snippet quick/scenegraph/openglunderqml/squircle.cpp 3
+
+ The default behavior of the scene graph is to clear the
+ framebuffer before rendering. Since we render before the scene
+ graph, we need to turn this clearing off. This means that we need
+ to clear ourselves in the \c paint() function.
+
+ \snippet quick/scenegraph/openglunderqml/squircle.cpp 4
+
+ The first thing we do in the \c paint() function is to
+ initialize the shader program. By initializing the shader program
+ here, we make sure that the OpenGL context is bound and that we
+ are on the correct thread.
+
+ We also connect to the QOpenGLContext::aboutToBeDestroyed()
+ signal, so that we can clean up the shader program when the
+ context is destroyed. Again, this is a \l Qt::DirectConnection as
+ all rendering related operations must happen on the rendering
+ thread.
+
+ \snippet quick/scenegraph/openglunderqml/squircle.cpp 5
+
+ We use the shader program to draw the squircle. At the end of the
+ \c paint function we release the program and disable the
+ attributes we used so that the OpenGL context is in a "clean"
+ state for the scene graph to pick it up.
+
+ \snippet quick/scenegraph/openglunderqml/squircle.cpp 6
+
+ In the \c cleanup() function we delete the program.
+
+ \snippet quick/scenegraph/openglunderqml/squircle.cpp 9
+
+ We use the \c sync() function to copy the state of the
+ object in the GUI thread into the rendering thread.
+
+ The signal is emitted on the rendering thread while the GUI
+ thread is blocked, so it is safe to simply copy the value without
+ any additional protection.
+
+ \snippet quick/scenegraph/openglunderqml/main.cpp 1
+
+ The application's \c main() function instantiates a QQuickView and
+ launches the \c main.qml file. The only thing worth noting is that
+ we export the \c Squircle class to QML using the \l
+ qmlRegisterType() macro.
+
+ \snippet quick/scenegraph/openglunderqml/main.qml 1
+
+ We import the Squircle QML type with the name we registered in the
+ \c main() function. We then instantiate it and create a running
+ NumberAnimation on the its \c t property.
+
+ \snippet quick/scenegraph/openglunderqml/main.qml 2
+
+ Then we overlay a short descriptive text, so that it is clearly
+ visible that we are in fact rendering OpenGL under our Qt Quick
+ scene.
+
+ */
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp
index 867ce4a7e0..e907995e7a 100644
--- a/examples/quick/scenegraph/openglunderqml/squircle.cpp
+++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp
@@ -48,6 +48,8 @@
//! [7]
Squircle::Squircle()
: m_program(0)
+ , m_t(0)
+ , m_thread_t(0)
{
}
//! [7]
@@ -70,8 +72,8 @@ void Squircle::itemChange(ItemChange change, const ItemChangeData &)
{
// The ItemSceneChange event is sent when we are first attached to a window.
if (change == ItemSceneChange) {
- QQuickWindow *c = window();
- if (!c)
+ QQuickWindow *win = window();
+ if (!win)
return;
//! [1]
@@ -79,15 +81,17 @@ void Squircle::itemChange(ItemChange change, const ItemChangeData &)
// Since this call is executed on the rendering thread it must be
// a Qt::DirectConnection
//! [2]
- connect(c, SIGNAL(beforeRendering()), this, SLOT(paint()), Qt::DirectConnection);
+ connect(win, SIGNAL(beforeRendering()), this, SLOT(paint()), Qt::DirectConnection);
+ connect(win, SIGNAL(beforeSynchronizing()), this, SLOT(sync()), Qt::DirectConnection);
//! [2]
// If we allow QML to do the clearing, they would clear what we paint
// and nothing would show.
//! [3]
- c->setClearBeforeRendering(false);
+ win->setClearBeforeRendering(false);
}
}
+
//! [3] //! [4]
void Squircle::paint()
{
@@ -128,7 +132,7 @@ void Squircle::paint()
1, 1
};
m_program->setAttributeArray(0, GL_FLOAT, values, 2);
- m_program->setUniformValue("t", (float) m_t);
+ m_program->setUniformValue("t", (float) m_thread_t);
glViewport(0, 0, window()->width(), window()->height());
@@ -157,4 +161,10 @@ void Squircle::cleanup()
}
//! [6]
+//! [9]
+void Squircle::sync()
+{
+ m_thread_t = m_t;
+}
+//! [9]
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.h b/examples/quick/scenegraph/openglunderqml/squircle.h
index 3d0a46e2ec..85e6187ae4 100644
--- a/examples/quick/scenegraph/openglunderqml/squircle.h
+++ b/examples/quick/scenegraph/openglunderqml/squircle.h
@@ -67,11 +67,13 @@ protected:
public slots:
void paint();
void cleanup();
+ void sync();
private:
QOpenGLShaderProgram *m_program;
qreal m_t;
+ qreal m_thread_t;
};
//! [1]
diff --git a/examples/quick/scenegraph/simplematerial/doc/images/simplematerial-example.jpg b/examples/quick/scenegraph/simplematerial/doc/images/simplematerial-example.jpg
new file mode 100644
index 0000000000..08db8dee4e
--- /dev/null
+++ b/examples/quick/scenegraph/simplematerial/doc/images/simplematerial-example.jpg
Binary files differ
diff --git a/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc b/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc
new file mode 100644
index 0000000000..20d244fe99
--- /dev/null
+++ b/examples/quick/scenegraph/simplematerial/doc/src/simplematerial.qdoc
@@ -0,0 +1,180 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example quick/scenegraph/simplematerial
+ \title Simple Material Example
+ \ingroup qtquickexamples
+ \brief Shows how to define a scene graph material to fill a shape.
+
+ \image simplematerial-example.jpg
+
+ In this example, we will make use of the \l
+ QSGSimpleMaterialShader class to fill a shape in the scene
+ graph. This is a convenience class intended to avoid a lot of the
+ boilerplate code required when creating materials with the \l
+ QSGMaterial, \l QSGMaterialShader and \l QSGMaterialType classes
+ directly.
+
+ A simple material consists of two parts, the material state and
+ the material shader. The material shader has one instance per
+ scene graph and contains the actual OpenGL shader program and
+ information about which attributes and uniforms it uses. The
+ material state is what we assign to each individual node, in this
+ case to give them different colors.
+
+ \snippet quick/scenegraph/simplematerial/simplematerial.cpp 1
+
+ The first thing we do when creating custom materials with the
+ simplified scheme is to create a state class. In this case the
+ state class contains only one member, a QColor. It also defines a
+ compare function which the scene graph can use to reorder the node
+ rendering.
+
+ \snippet quick/scenegraph/simplematerial/simplematerial.cpp 2
+
+ Next we define the material shader, by subclassing a template
+ instantiation of \l QSGSimpleMaterialShader with our \c State.
+
+ Then we use the macro \l QSG_DECLARE_SIMPLE_COMPARABLE_SHADER()
+ which will generate some boilerplate code for us. Since our \c
+ State class has a compare function, we declare that the states can
+ be compared. It would have been possible to remove the \c
+ State::compare() function and instead declare the shader with \l
+ QSG_DECLARE_SIMPLE_SHADER(), but this could then reduce performance
+ in certain usecases.
+
+ The state struct is used as a template parameter to
+ automatically generate a \l QSGMaterialType for us, so it is
+ crucial that the pair of shader and state are made up of unique
+ classes. Using the same \c State class in multiple shaders will
+ will lead to undefined behavior.
+
+ \snippet quick/scenegraph/simplematerial/simplematerial.cpp 3
+
+ Next comes the declaration of the shader source code, where we
+ define a vertex and fragment shader. The simple material assumes
+ the presence of \c qt_Matrix in the vertex shader and \c
+ qt_Opacity in the fragment shader.
+
+ \snippet quick/scenegraph/simplematerial/simplematerial.cpp 4
+
+ We reimplement the \c attributes function to return the name of
+ the \c aVertex and \c aTexCoord attribute names. These attributes
+ will be mapped to attribute indices 0 and 1 in the node's
+ geometry.
+
+ \snippet quick/scenegraph/simplematerial/simplematerial.cpp 6
+
+ Uniforms can be accessed either by name or by index, where index
+ is faster than name, so we reimplement the \c resolveUniforms()
+ function to find the index of the \c color uniform. We do not have
+ to worry about resolving \c qt_Opacity or \c qt_Matrix as these
+ are handled by the baseclass.
+
+ \snippet quick/scenegraph/simplematerial/simplematerial.cpp 5
+
+ The \c updateState() function is called once for every unique
+ state and we use it to update the shader program with the current
+ color. The previous state is passed in as a second parameter so
+ that the user can update only that which has changed. In our
+ usecase, where all the colors are different, the updateState will
+ be called once for every node.
+
+ \snippet quick/scenegraph/simplematerial/simplematerial.cpp 7
+
+ The \c ColorNode class is supposed to draw something, so it needs
+ to be a subclass of \l QSGGeometryNode.
+
+ Since our shader expects both a position and a texture coordinate,
+ we use the default attribute set \l
+ QSGGeometry::defaultAttributes_TexturedPoint2D() and define that
+ the geometry consists of a total of four vertices. To avoid the
+ allocation, we make the QSGGeometry a member of the
+ QSGGeometryNode.
+
+ When used the macro \l QSG_DECLARE_SIMPLE_COMPARABLE_SHADER() above,
+ it defined the \c createMaterial() function which we use to
+ instantiate materials for our \c State struct.
+
+ As we will be making use of opacity in our custom material, we
+ need to set the \l QSGMaterial::Blending flag. The scene graph may
+ use this flag to either disable or enable \c GL_BLEND when drawing
+ the node or to reorder the drawing of the node.
+
+ Finally, we tell the node to take ownership of the material, so we
+ do not have to explicitly memorymanage it.
+
+ \snippet quick/scenegraph/simplematerial/simplematerial.cpp 8
+
+ Since the Item is providing its own graphics to the scene graph,
+ we set the flag \l QQuickItem::ItemHasContents.
+
+ \snippet quick/scenegraph/simplematerial/simplematerial.cpp 9
+
+ Whenever the Item has changed graphically, the \l
+ QQuickItem::updatePaintNode() function is called.
+
+ \note The scene graph may be rendered in a different thread than the
+ GUI thread and \l QQuickItem::updatePaintNode() is one of the few
+ places where it is safe to access properties of the QML
+ object. Any interaction with the scene graph from a custom \l
+ QQuickItem should be contained to this function. The function is
+ called on the rendering thread while the GUI thread is blocked.
+
+ The first time this function is called for an \c Item instance,
+ the node will be 0 and we create a new one. For every consecutive
+ call, the node will be what we returned previously. There are
+ scenarios where the scene graph will be removed and rebuilt from
+ scratch however, so one should always check the node and recreate
+ it if required.
+
+ Once we have a \c ColorNode, we update its geometry and material
+ state. Finally, we notify the scene graph that the node has
+ undergone changes to its geometry and material.
+
+ \snippet quick/scenegraph/simplematerial/simplematerial.cpp 11
+
+ The \c main() function of the application adds the custom QML type
+ using \l qmlRegisterType() and opens up a \l QQuickView with our
+ QML file.
+
+ \snippet quick/scenegraph/simplematerial/main.qml 1
+
+ In the QML file, we import our custom type so we can instantiate
+ it.
+
+ \snippet quick/scenegraph/simplematerial/main.qml 2
+
+ Then we create a column of three instances of our custom item,
+ each with a different color.
+
+ \snippet quick/scenegraph/simplematerial/main.qml 3
+
+ And finally we overlay a short descriptive text.
+
+ */
diff --git a/examples/quick/scenegraph/simplematerial/main.qml b/examples/quick/scenegraph/simplematerial/main.qml
index 70771a7c35..b90afdd63e 100644
--- a/examples/quick/scenegraph/simplematerial/main.qml
+++ b/examples/quick/scenegraph/simplematerial/main.qml
@@ -44,30 +44,40 @@ import QtQuick 2.0
import SimpleMaterial 1.0
Rectangle {
- width: 640
- height: 360
-
- gradient: Gradient {
- GradientStop { position: 0; color: "#00ffff" }
- GradientStop { position: 1; color: "#00ff00" }
- }
+ width: 320
+ height: 480
+ color: "black"
//! [1] //! [2]
- SimpleMaterialItem {
+ Column {
anchors.fill: parent
- SequentialAnimation on scale {
- NumberAnimation { to: 100; duration: 60000; easing.type: Easing.InCubic }
- NumberAnimation { to: 1; duration: 60000; easing.type: Easing.OutCubic }
- loops: Animation.Infinite
+
+ SimpleMaterialItem {
+ width: parent.width;
+ height: parent.height / 3;
+ color: "steelblue"
+ }
+
+ SimpleMaterialItem {
+ width: parent.width;
+ height: parent.height / 3;
+ color: "darkorchid"
}
- rotation: scale * 10 - 10
+ SimpleMaterialItem {
+ width: parent.width;
+ height: parent.height / 3;
+ color: "springgreen"
+ }
}
+
+
//! [2] //! [3]
Rectangle {
color: Qt.rgba(0, 0, 0, 0.8)
radius: 10
+ antialiasing: true
border.width: 1
border.color: "black"
anchors.fill: label
@@ -78,7 +88,7 @@ Rectangle {
id: label
color: "white"
wrapMode: Text.WordWrap
- text: "The background here is implemented as one QSGGeometryNode node which uses QSGSimpleMaterial to implement a mandlebrot fractal fill"
+ text: "These three gradient boxes are colorized using a custom material."
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
diff --git a/examples/quick/scenegraph/simplematerial/simplematerial.cpp b/examples/quick/scenegraph/simplematerial/simplematerial.cpp
index b7bea08260..0b4759abc8 100644
--- a/examples/quick/scenegraph/simplematerial/simplematerial.cpp
+++ b/examples/quick/scenegraph/simplematerial/simplematerial.cpp
@@ -52,11 +52,11 @@
#include <qsgsimplematerial.h>
//! [1]
-struct Color
+struct State
{
QColor color;
- int compare(const Color *other) const {
+ int compare(const State *other) const {
uint rgb = color.rgba();
uint otherRgb = other->color.rgba();
@@ -72,9 +72,9 @@ struct Color
//! [1]
//! [2]
-class Shader : public QSGSimpleMaterialShader<Color>
+class Shader : public QSGSimpleMaterialShader<State>
{
- QSG_DECLARE_SIMPLE_COMPARABLE_SHADER(Shader, Color);
+ QSG_DECLARE_SIMPLE_COMPARABLE_SHADER(Shader, State);
//! [2] //! [3]
public:
@@ -97,18 +97,8 @@ public:
"varying highp vec2 texCoord; \n"
"void main () \n"
"{ \n"
- " highp vec2 z = texCoord; \n"
- " gl_FragColor = vec4(0); \n"
- " const highp float maxIterations = 100.; \n"
- " for (float i = 0.; i < maxIterations; i += 1.0) { \n"
- " z = vec2(z.x*z.x - z.y*z.y, 2.0*z.x*z.y) + texCoord; \n"
- " if (dot(z, z) > 4.0) { \n"
- " float col = pow(1. - i / maxIterations, sqrt(maxIterations / 10.)); \n"
- " gl_FragColor = color * col * qt_Opacity; \n"
- " break; \n"
- " } \n"
- " } \n"
- "} \n";
+ " gl_FragColor = texCoord.y * texCoord.x * color * qt_Opacity; \n"
+ "}";
}
//! [3] //! [4]
QList<QByteArray> attributes() const
@@ -116,9 +106,9 @@ public:
return QList<QByteArray>() << "aVertex" << "aTexCoord";
}
//! [4] //! [5]
- void updateState(const Color *color, const Color *)
+ void updateState(const State *state, const State *)
{
- program()->setUniformValue(id_color, color->color);
+ program()->setUniformValue(id_color, state->color);
}
//! [5] //! [6]
void resolveUniforms()
@@ -128,38 +118,37 @@ public:
private:
int id_color;
-};
//! [6]
+};
//! [7]
-class TestNode : public QSGGeometryNode
+class ColorNode : public QSGGeometryNode
{
public:
- TestNode(const QRectF &bounds)
+ ColorNode()
: m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
{
- QSGGeometry::updateTexturedRectGeometry(&m_geometry, bounds, QRectF(-0.60, -0.66, 0.08, 0.04));
setGeometry(&m_geometry);
-//! [7] //! [8]
- QSGSimpleMaterial<Color> *material = Shader::createMaterial();
- material->state()->color = Qt::blue;
+ QSGSimpleMaterial<State> *material = Shader::createMaterial();
material->setFlag(QSGMaterial::Blending);
-
setMaterial(material);
setFlag(OwnsMaterial);
}
-//! [8] //! [9]
+
QSGGeometry m_geometry;
};
-//! [9]
+//! [7]
-//! [10]
+//! [8]
class Item : public QQuickItem
{
Q_OBJECT
+
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+
public:
Item()
@@ -167,17 +156,40 @@ public:
setFlag(ItemHasContents, true);
}
+ void setColor(const QColor &color) {
+ if (m_color != color) {
+ m_color = color;
+ emit colorChanged();
+ update();
+ }
+ }
+ QColor color() const {
+ return m_color;
+ }
+
+signals:
+ void colorChanged();
+
+private:
+ QColor m_color;
+
+//! [8] //! [9]
+public:
QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *)
{
- delete node;
- return new TestNode(boundingRect());
- }
-};
-//! [10]
+ ColorNode *n = static_cast<ColorNode *>(node);
+ if (!node)
+ n = new ColorNode();
+ QSGGeometry::updateTexturedRectGeometry(n->geometry(), boundingRect(), QRectF(0, 0, 1, 1));
+ static_cast<QSGSimpleMaterial<State>*>(n->material())->state()->color = m_color;
+ n->markDirty(QSGNode::DirtyGeometry | QSGNode::DirtyMaterial);
-//! [11]
+ return n;
+ }
+};
+//! [9] //! [11]
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
@@ -185,11 +197,12 @@ int main(int argc, char **argv)
qmlRegisterType<Item>("SimpleMaterial", 1, 0, "SimpleMaterialItem");
QQuickView view;
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:///scenegraph/simplematerial/main.qml"));
view.show();
return app.exec();
}
-//! [11]
#include "simplematerial.moc"
+//! [11]
diff --git a/src/plugins/accessible/quick/accessible.json b/src/plugins/accessible/quick/accessible.json
index 845a45aa78..b21218f19c 100644
--- a/src/plugins/accessible/quick/accessible.json
+++ b/src/plugins/accessible/quick/accessible.json
@@ -1,3 +1,3 @@
{
- "Keys": [ "QQuickView", "QQuickItem" ]
+ "Keys": [ "QQuickWindow", "QQuickItem" ]
}
diff --git a/src/plugins/accessible/quick/main.cpp b/src/plugins/accessible/quick/main.cpp
index 882cbcda4f..019c84fc6e 100644
--- a/src/plugins/accessible/quick/main.cpp
+++ b/src/plugins/accessible/quick/main.cpp
@@ -44,7 +44,7 @@
#include "qaccessiblequickview.h"
#include "qaccessiblequickitem.h"
-#include <QtQuick/QQuickView>
+#include <QtQuick/QQuickWindow>
#include <QtQuick/QQuickItem>
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquickaccessibleattached_p.h>
@@ -77,37 +77,22 @@ AccessibleQuickFactory::AccessibleQuickFactory()
QStringList AccessibleQuickFactory::keys() const
{
QStringList list;
- list << QLatin1String("QQuickView");
+ list << QLatin1String("QQuickWindow");
list << QLatin1String("QQuickItem");
return list;
}
QAccessibleInterface *AccessibleQuickFactory::create(const QString &classname, QObject *object)
{
- if (classname == QLatin1String("QQuickView")) {
- return new QAccessibleQuickView(qobject_cast<QQuickView *>(object)); // FIXME
+ if (classname == QLatin1String("QQuickWindow")) {
+ return new QAccessibleQuickWindow(qobject_cast<QQuickWindow *>(object));
} else if (classname == QLatin1String("QQuickItem")) {
QQuickItem *item = qobject_cast<QQuickItem *>(object);
Q_ASSERT(item);
QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);
if (!itemPrivate->isAccessible)
return 0;
-
- QVariant v = QQuickAccessibleAttached::property(item, "role");
- bool ok;
- QAccessible::Role role = (QAccessible::Role)v.toInt(&ok);
- if (!ok) // Not sure if this check is needed.
- return new QAccessibleQuickItem(item);
-
- switch (role) {
- case QAccessible::Slider:
- case QAccessible::SpinBox:
- case QAccessible::Dial:
- case QAccessible::ScrollBar:
- return new QAccessibleQuickItemValueInterface(item);
- default:
- return new QAccessibleQuickItem(item);
- }
+ return new QAccessibleQuickItem(item);
}
return 0;
diff --git a/src/plugins/accessible/quick/qaccessiblequickitem.cpp b/src/plugins/accessible/quick/qaccessiblequickitem.cpp
index 2d41379940..8d36834d48 100644
--- a/src/plugins/accessible/quick/qaccessiblequickitem.cpp
+++ b/src/plugins/accessible/quick/qaccessiblequickitem.cpp
@@ -228,7 +228,7 @@ QString QAccessibleQuickItem::text(QAccessible::Text textType) const
break;
}
- // the following blocks handles item-specific behavior
+ // the following block handles item-specific behavior
if (role() == QAccessible::EditableText) {
if (textType == QAccessible::Value) {
QVariant text = object()->property("text");
@@ -241,34 +241,44 @@ QString QAccessibleQuickItem::text(QAccessible::Text textType) const
return QString();
}
-void *QAccessibleQuickItemValueInterface::interface_cast(QAccessible::InterfaceType t)
+void *QAccessibleQuickItem::interface_cast(QAccessible::InterfaceType t)
{
- if (t == QAccessible::ValueInterface)
+ QAccessible::Role r = role();
+ if (t == QAccessible::ValueInterface &&
+ (r == QAccessible::Slider ||
+ r == QAccessible::SpinBox ||
+ r == QAccessible::Dial ||
+ r == QAccessible::ScrollBar))
return static_cast<QAccessibleValueInterface*>(this);
- return QAccessibleQuickItem::interface_cast(t);
+
+ if (t == QAccessible::TextInterface &&
+ (r == QAccessible::EditableText))
+ return static_cast<QAccessibleTextInterface*>(this);
+
+ return QQmlAccessible::interface_cast(t);
}
-QVariant QAccessibleQuickItemValueInterface::currentValue() const
+QVariant QAccessibleQuickItem::currentValue() const
{
return item()->property("value");
}
-void QAccessibleQuickItemValueInterface::setCurrentValue(const QVariant &value)
+void QAccessibleQuickItem::setCurrentValue(const QVariant &value)
{
item()->setProperty("value", value);
}
-QVariant QAccessibleQuickItemValueInterface::maximumValue() const
+QVariant QAccessibleQuickItem::maximumValue() const
{
return item()->property("maximumValue");
}
-QVariant QAccessibleQuickItemValueInterface::minimumValue() const
+QVariant QAccessibleQuickItem::minimumValue() const
{
return item()->property("minimumValue");
}
-QVariant QAccessibleQuickItemValueInterface::minimumStepSize() const
+QVariant QAccessibleQuickItem::minimumStepSize() const
{
return item()->property("stepSize");
}
diff --git a/src/plugins/accessible/quick/qaccessiblequickitem.h b/src/plugins/accessible/quick/qaccessiblequickitem.h
index 0d31749ee0..46f573cc75 100644
--- a/src/plugins/accessible/quick/qaccessiblequickitem.h
+++ b/src/plugins/accessible/quick/qaccessiblequickitem.h
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
-class QAccessibleQuickItem : public QQmlAccessible
+class QAccessibleQuickItem : public QQmlAccessible, public QAccessibleValueInterface, public QAccessibleTextInterface
{
public:
QAccessibleQuickItem(QQuickItem *item);
@@ -72,28 +72,51 @@ public:
bool isAccessible() const;
-protected:
- QQuickItem *item() const { return static_cast<QQuickItem*>(object()); }
-};
-
-QRect itemScreenRect(QQuickItem *item);
-
-
-class QAccessibleQuickItemValueInterface: public QAccessibleQuickItem, public QAccessibleValueInterface
-{
-public:
- QAccessibleQuickItemValueInterface(QQuickItem *item) : QAccessibleQuickItem(item)
- {}
-
- void *interface_cast(QAccessible::InterfaceType t);
-
+ // Value Interface
QVariant currentValue() const;
void setCurrentValue(const QVariant &value);
QVariant maximumValue() const;
QVariant minimumValue() const;
QVariant minimumStepSize() const;
+
+
+ // Text Interface
+ // selection (ignored for now)
+ void selection(int selectionIndex, int *startOffset, int *endOffset) const { *startOffset = 0; *endOffset = 0; }
+ int selectionCount() const { return 0; }
+ void addSelection(int startOffset, int endOffset) {}
+ void removeSelection(int selectionIndex) {}
+ void setSelection(int selectionIndex, int startOffset, int endOffset) {}
+
+ // cursor
+ int cursorPosition() const { return 0; }
+ void setCursorPosition(int position) {}
+
+ // text
+ QString text(int startOffset, int endOffset) const { return text(QAccessible::Name).mid(startOffset, endOffset - startOffset); }
+// QString textBeforeOffset(int offset, QAccessible2::BoundaryType boundaryType,
+// int *startOffset, int *endOffset) const;
+// QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
+// int *startOffset, int *endOffset) const;
+// QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
+// int *startOffset, int *endOffset) const;
+ int characterCount() const { return text(QAccessible::Name).count(); }
+
+ // character <-> geometry
+ QRect characterRect(int offset) const { return QRect(); }
+ int offsetAtPoint(const QPoint &point) const { return -1; }
+
+ void scrollToSubstring(int startIndex, int endIndex) {}
+ QString attributes(int offset, int *startOffset, int *endOffset) const { return QString(); }
+
+protected:
+ QQuickItem *item() const { return static_cast<QQuickItem*>(object()); }
+ void *interface_cast(QAccessible::InterfaceType t);
};
+QRect itemScreenRect(QQuickItem *item);
+
+
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE
diff --git a/src/plugins/accessible/quick/qaccessiblequickview.cpp b/src/plugins/accessible/quick/qaccessiblequickview.cpp
index 0106a3d68b..f70a41c6e2 100644
--- a/src/plugins/accessible/quick/qaccessiblequickview.cpp
+++ b/src/plugins/accessible/quick/qaccessiblequickview.cpp
@@ -53,52 +53,59 @@
QT_BEGIN_NAMESPACE
-QAccessibleQuickView::QAccessibleQuickView(QQuickView *object)
+QAccessibleQuickWindow::QAccessibleQuickWindow(QQuickWindow *object)
:QAccessibleObject(object)
{
}
-int QAccessibleQuickView::childCount() const
+QQuickItem *QAccessibleQuickWindow::rootItem() const
{
- return view()->contentItem() ? 1 : 0;
+ if (window()->contentItem())
+ return window()->contentItem()->childItems().first();
+ return 0;
}
-QAccessibleInterface *QAccessibleQuickView::parent() const
+int QAccessibleQuickWindow::childCount() const
+{
+ return rootItem() ? 1 : 0;
+}
+
+QAccessibleInterface *QAccessibleQuickWindow::parent() const
{
// FIXME: for now we assume to be a top level window...
return QAccessible::queryAccessibleInterface(qApp);
}
-QAccessibleInterface *QAccessibleQuickView::child(int index) const
+QAccessibleInterface *QAccessibleQuickWindow::child(int index) const
{
if (index == 0) {
- if (QQuickItem *declarativeRoot = view()->rootObject())
+ if (QQuickItem *declarativeRoot = rootItem())
return new QAccessibleQuickItem(declarativeRoot);
}
return 0;
}
-QAccessible::Role QAccessibleQuickView::role() const
+QAccessible::Role QAccessibleQuickWindow::role() const
{
return QAccessible::Window; // FIXME
}
-QAccessible::State QAccessibleQuickView::state() const
+QAccessible::State QAccessibleQuickWindow::state() const
{
QAccessible::State st;
- if (view() == QGuiApplication::focusWindow())
+ if (window() == QGuiApplication::focusWindow())
st.active = true;
- if (!view()->isVisible())
+ if (!window()->isVisible())
st.invisible = true;
return st;
}
-QRect QAccessibleQuickView::rect() const
+QRect QAccessibleQuickWindow::rect() const
{
- return QRect(view()->x(), view()->y(), view()->width(), view()->height());
+ return QRect(window()->x(), window()->y(), window()->width(), window()->height());
}
-QString QAccessibleQuickView::text(QAccessible::Text text) const
+QString QAccessibleQuickWindow::text(QAccessible::Text text) const
{
#ifdef Q_ACCESSIBLE_QUICK_ITEM_ENABLE_DEBUG_DESCRIPTION
if (text == QAccessible::DebugDescription) {
@@ -107,7 +114,7 @@ QString QAccessibleQuickView::text(QAccessible::Text text) const
#else
Q_UNUSED(text)
#endif
- return view()->title();
+ return window()->title();
}
@@ -152,10 +159,10 @@ static QQuickItem *childAt_helper(QQuickItem *item, int x, int y)
return 0;
}
-QAccessibleInterface *QAccessibleQuickView::childAt(int x, int y) const
+QAccessibleInterface *QAccessibleQuickWindow::childAt(int x, int y) const
{
- Q_ASSERT(view());
- QQuickItem *root = view()->contentItem();
+ Q_ASSERT(window());
+ QQuickItem *root = rootItem();
if (root) {
if (QQuickItem *item = childAt_helper(root, x, y))
return QAccessible::queryAccessibleInterface(item);
@@ -164,15 +171,14 @@ QAccessibleInterface *QAccessibleQuickView::childAt(int x, int y) const
return 0;
}
-int QAccessibleQuickView::indexOfChild(const QAccessibleInterface *iface) const
+int QAccessibleQuickWindow::indexOfChild(const QAccessibleInterface *iface) const
{
if (iface) {
- QQuickItem *declarativeRoot = view()->rootObject();
+ QQuickItem *declarativeRoot = rootItem();
if (declarativeRoot == iface->object())
return 0;
}
return -1;
-
}
QT_END_NAMESPACE
diff --git a/src/plugins/accessible/quick/qaccessiblequickview.h b/src/plugins/accessible/quick/qaccessiblequickview.h
index 03061be275..2b01b18f3c 100644
--- a/src/plugins/accessible/quick/qaccessiblequickview.h
+++ b/src/plugins/accessible/quick/qaccessiblequickview.h
@@ -44,16 +44,16 @@
#include <QtGui/qaccessible2.h>
#include <QtGui/qaccessibleobject.h>
-#include <QtQuick/qquickview.h>
+#include <QtQuick/qquickwindow.h>
QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
-class QAccessibleQuickView : public QAccessibleObject
+class QAccessibleQuickWindow : public QAccessibleObject
{
public:
- QAccessibleQuickView(QQuickView *object);
+ QAccessibleQuickWindow(QQuickWindow *object);
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int index) const;
@@ -66,8 +66,10 @@ public:
int indexOfChild(const QAccessibleInterface *iface) const;
QString text(QAccessible::Text text) const;
QAccessibleInterface *childAt(int x, int y) const;
+
private:
- QQuickView *view() const { return static_cast<QQuickView*>(object()); }
+ QQuickWindow *window() const { return static_cast<QQuickWindow*>(object()); }
+ QQuickItem *rootItem() const;
};
#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp
index d05f4b9b59..93cbdf3018 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp
@@ -166,6 +166,7 @@ void InspectTool::hoverMoveEvent(QMouseEvent *event)
}
}
+#ifndef QT_NO_WHEELEVENT
void InspectTool::wheelEvent(QWheelEvent *event)
{
if (event->orientation() != Qt::Vertical)
@@ -184,6 +185,7 @@ void InspectTool::wheelEvent(QWheelEvent *event)
}
}
}
+#endif
void InspectTool::keyReleaseEvent(QKeyEvent *event)
{
diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h
index 5c480697af..5ed243d361 100644
--- a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h
+++ b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h
@@ -79,7 +79,9 @@ public:
void mouseDoubleClickEvent(QMouseEvent *);
void hoverMoveEvent(QMouseEvent *);
+#ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent *);
+#endif
void keyPressEvent(QKeyEvent *) {}
void keyReleaseEvent(QKeyEvent *);
diff --git a/src/plugins/qmltooling/shared/abstracttool.h b/src/plugins/qmltooling/shared/abstracttool.h
index f29909baf0..6e7d0c09cb 100644
--- a/src/plugins/qmltooling/shared/abstracttool.h
+++ b/src/plugins/qmltooling/shared/abstracttool.h
@@ -74,7 +74,9 @@ public:
virtual void mouseDoubleClickEvent(QMouseEvent *event) = 0;
virtual void hoverMoveEvent(QMouseEvent *event) = 0;
+#ifndef QT_NO_WHEELEVENT
virtual void wheelEvent(QWheelEvent *event) = 0;
+#endif
virtual void keyPressEvent(QKeyEvent *event) = 0;
virtual void keyReleaseEvent(QKeyEvent *keyEvent) = 0;
diff --git a/src/plugins/qmltooling/shared/abstractviewinspector.cpp b/src/plugins/qmltooling/shared/abstractviewinspector.cpp
index ed207c5f26..c1d0cf1343 100644
--- a/src/plugins/qmltooling/shared/abstractviewinspector.cpp
+++ b/src/plugins/qmltooling/shared/abstractviewinspector.cpp
@@ -173,10 +173,12 @@ bool AbstractViewInspector::eventFilter(QObject *obj, QEvent *event)
if (mouseDoubleClickEvent(static_cast<QMouseEvent*>(event)))
return true;
break;
+#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel:
if (wheelEvent(static_cast<QWheelEvent*>(event)))
return true;
break;
+#endif
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
@@ -244,12 +246,14 @@ bool AbstractViewInspector::mouseDoubleClickEvent(QMouseEvent *event)
return true;
}
+#ifndef QT_NO_WHEELEVENT
bool AbstractViewInspector::wheelEvent(QWheelEvent *event)
{
foreach (AbstractTool *tool, m_tools)
tool->wheelEvent(event);
return true;
}
+#endif
bool AbstractViewInspector::touchEvent(QTouchEvent *event)
{
diff --git a/src/plugins/qmltooling/shared/abstractviewinspector.h b/src/plugins/qmltooling/shared/abstractviewinspector.h
index d98707eaca..e0524c880c 100644
--- a/src/plugins/qmltooling/shared/abstractviewinspector.h
+++ b/src/plugins/qmltooling/shared/abstractviewinspector.h
@@ -107,7 +107,9 @@ protected:
virtual bool keyPressEvent(QKeyEvent *event);
virtual bool keyReleaseEvent(QKeyEvent *keyEvent);
virtual bool mouseDoubleClickEvent(QMouseEvent *event);
+#ifndef QT_NO_WHEELEVENT
virtual bool wheelEvent(QWheelEvent *event);
+#endif
virtual bool touchEvent(QTouchEvent *event);
virtual void setShowAppOnTop(bool) = 0;
diff --git a/src/plugins/qmltooling/shared/qpacketprotocol.cpp b/src/plugins/qmltooling/shared/qpacketprotocol.cpp
index 205601c3bf..020e5dbe9d 100644
--- a/src/plugins/qmltooling/shared/qpacketprotocol.cpp
+++ b/src/plugins/qmltooling/shared/qpacketprotocol.cpp
@@ -290,6 +290,7 @@ void QPacketProtocol::send(const QPacket & p)
d->sendingPackets.append(sendSize);
qint32 sendSize32 = sendSize;
qint64 writeBytes = d->dev->write((char *)&sendSize32, sizeof(qint32));
+ Q_UNUSED(writeBytes);
Q_ASSERT(writeBytes == sizeof(qint32));
writeBytes = d->dev->write(p.b);
Q_ASSERT(writeBytes == p.b.size());
diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp
index df8431e746..67b3391c0c 100644
--- a/src/qml/animations/qabstractanimationjob.cpp
+++ b/src/qml/animations/qabstractanimationjob.cpp
@@ -463,7 +463,7 @@ void QAbstractAnimationJob::setCurrentTime(int msecs)
// and has reached the end.
if ((m_direction == Forward && m_totalCurrentTime == totalDura)
|| (m_direction == Backward && m_totalCurrentTime == 0)) {
- stop();
+ RETURN_IF_DELETED(stop());
}
if (m_hasCurrentTimeChangeListeners)
diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf
index 3556570d16..06c1c42a92 100644
--- a/src/qml/doc/qtqml.qdocconf
+++ b/src/qml/doc/qtqml.qdocconf
@@ -3,7 +3,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtQml
description = Qt QML Reference Documentation
url = http://qt-project.org/doc/qt-5.0/qtqml
-version = 5.0.0
+version = 5.0.1
qhp.projects = QtQml
@@ -13,9 +13,9 @@ qhp.QtQml.virtualFolder = qtqml
qhp.QtQml.indexTitle = Qt QML
qhp.QtQml.indexRoot =
-qhp.QtQml.filterAttributes = qtqml 5.0.0 qtrefdoc
-qhp.QtQml.customFilters.Qt.name = QtQml 5.0.0
-qhp.QtQml.customFilters.Qt.filterAttributes = qtqml 5.0.0
+qhp.QtQml.filterAttributes = qtqml 5.0.1 qtrefdoc
+qhp.QtQml.customFilters.Qt.name = QtQml 5.0.1
+qhp.QtQml.customFilters.Qt.filterAttributes = qtqml 5.0.1
qhp.QtQml.subprojects = classes examples
qhp.QtQml.subprojects.classes.title = C++ Classes
qhp.QtQml.subprojects.classes.indexTitle = Qt QML Module C++ Classes
diff --git a/src/qml/qml/parser/qqmljskeywords_p.h b/src/qml/qml/parser/qqmljskeywords_p.h
index 49ce0e2a8f..f20627c23a 100644
--- a/src/qml/qml/parser/qqmljskeywords_p.h
+++ b/src/qml/qml/parser/qqmljskeywords_p.h
@@ -91,7 +91,7 @@ static inline int classify3(const QChar *s, bool qmlMode) {
else if (s[0].unicode() == 'i') {
if (s[1].unicode() == 'n') {
if (s[2].unicode() == 't') {
- return qmlMode ? Lexer::T_INT : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_INT) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -124,7 +124,7 @@ static inline int classify4(const QChar *s, bool qmlMode) {
if (s[1].unicode() == 'y') {
if (s[2].unicode() == 't') {
if (s[3].unicode() == 'e') {
- return qmlMode ? Lexer::T_BYTE : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_BYTE) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -140,7 +140,7 @@ static inline int classify4(const QChar *s, bool qmlMode) {
else if (s[1].unicode() == 'h') {
if (s[2].unicode() == 'a') {
if (s[3].unicode() == 'r') {
- return qmlMode ? Lexer::T_CHAR : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_CHAR) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -165,7 +165,7 @@ static inline int classify4(const QChar *s, bool qmlMode) {
if (s[1].unicode() == 'o') {
if (s[2].unicode() == 't') {
if (s[3].unicode() == 'o') {
- return qmlMode ? Lexer::T_GOTO : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_GOTO) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -174,7 +174,7 @@ static inline int classify4(const QChar *s, bool qmlMode) {
if (s[1].unicode() == 'o') {
if (s[2].unicode() == 'n') {
if (s[3].unicode() == 'g') {
- return qmlMode ? Lexer::T_LONG : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_LONG) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -260,7 +260,7 @@ static inline int classify5(const QChar *s, bool qmlMode) {
if (s[2].unicode() == 'n') {
if (s[3].unicode() == 's') {
if (s[4].unicode() == 't') {
- return qmlMode ? Lexer::T_CONST : Lexer::T_RESERVED_WORD;
+ return qmlMode ? int(Lexer::T_CONST) : int(Lexer::T_RESERVED_WORD);
}
}
}
@@ -280,7 +280,7 @@ static inline int classify5(const QChar *s, bool qmlMode) {
if (s[2].unicode() == 'n') {
if (s[3].unicode() == 'a') {
if (s[4].unicode() == 'l') {
- return qmlMode ? Lexer::T_FINAL : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_FINAL) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -289,7 +289,7 @@ static inline int classify5(const QChar *s, bool qmlMode) {
if (s[2].unicode() == 'o') {
if (s[3].unicode() == 'a') {
if (s[4].unicode() == 't') {
- return qmlMode ? Lexer::T_FLOAT : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_FLOAT) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -300,7 +300,7 @@ static inline int classify5(const QChar *s, bool qmlMode) {
if (s[2].unicode() == 'o') {
if (s[3].unicode() == 'r') {
if (s[4].unicode() == 't') {
- return qmlMode ? Lexer::T_SHORT : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_SHORT) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -309,7 +309,7 @@ static inline int classify5(const QChar *s, bool qmlMode) {
if (s[2].unicode() == 'p') {
if (s[3].unicode() == 'e') {
if (s[4].unicode() == 'r') {
- return qmlMode ? Lexer::T_SUPER : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_SUPER) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -358,7 +358,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 'b') {
if (s[4].unicode() == 'l') {
if (s[5].unicode() == 'e') {
- return qmlMode ? Lexer::T_DOUBLE : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_DOUBLE) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -384,7 +384,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 'o') {
if (s[4].unicode() == 'r') {
if (s[5].unicode() == 't') {
- return qmlMode ? Lexer::T_IMPORT : Lexer::T_RESERVED_WORD;
+ return qmlMode ? int(Lexer::T_IMPORT) : int(Lexer::T_RESERVED_WORD);
}
}
}
@@ -397,7 +397,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 'i') {
if (s[4].unicode() == 'v') {
if (s[5].unicode() == 'e') {
- return qmlMode ? Lexer::T_NATIVE : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_NATIVE) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -447,7 +447,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 't') {
if (s[4].unicode() == 'i') {
if (s[5].unicode() == 'c') {
- return qmlMode ? Lexer::T_STATIC : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_STATIC) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -471,7 +471,7 @@ static inline int classify6(const QChar *s, bool qmlMode) {
if (s[3].unicode() == 'o') {
if (s[4].unicode() == 'w') {
if (s[5].unicode() == 's') {
- return qmlMode ? Lexer::T_THROWS : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_THROWS) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -500,7 +500,7 @@ static inline int classify7(const QChar *s, bool qmlMode) {
if (s[4].unicode() == 'e') {
if (s[5].unicode() == 'a') {
if (s[6].unicode() == 'n') {
- return qmlMode ? Lexer::T_BOOLEAN : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_BOOLEAN) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -560,7 +560,7 @@ static inline int classify7(const QChar *s, bool qmlMode) {
if (s[4].unicode() == 'a') {
if (s[5].unicode() == 'g') {
if (s[6].unicode() == 'e') {
- return qmlMode ? Lexer::T_PACKAGE : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_PACKAGE) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -573,7 +573,7 @@ static inline int classify7(const QChar *s, bool qmlMode) {
if (s[4].unicode() == 'a') {
if (s[5].unicode() == 't') {
if (s[6].unicode() == 'e') {
- return qmlMode ? Lexer::T_PRIVATE : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_PRIVATE) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -593,7 +593,7 @@ static inline int classify8(const QChar *s, bool qmlMode) {
if (s[5].unicode() == 'a') {
if (s[6].unicode() == 'c') {
if (s[7].unicode() == 't') {
- return qmlMode ? Lexer::T_ABSTRACT : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_ABSTRACT) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -695,7 +695,7 @@ static inline int classify8(const QChar *s, bool qmlMode) {
if (s[5].unicode() == 'i') {
if (s[6].unicode() == 'l') {
if (s[7].unicode() == 'e') {
- return qmlMode ? Lexer::T_VOLATILE : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_VOLATILE) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -717,7 +717,7 @@ static inline int classify9(const QChar *s, bool qmlMode) {
if (s[6].unicode() == 'a') {
if (s[7].unicode() == 'c') {
if (s[8].unicode() == 'e') {
- return qmlMode ? Lexer::T_INTERFACE : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_INTERFACE) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -736,7 +736,7 @@ static inline int classify9(const QChar *s, bool qmlMode) {
if (s[6].unicode() == 't') {
if (s[7].unicode() == 'e') {
if (s[8].unicode() == 'd') {
- return qmlMode ? Lexer::T_PROTECTED : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_PROTECTED) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -755,7 +755,7 @@ static inline int classify9(const QChar *s, bool qmlMode) {
if (s[6].unicode() == 'e') {
if (s[7].unicode() == 'n') {
if (s[8].unicode() == 't') {
- return qmlMode ? Lexer::T_TRANSIENT : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_TRANSIENT) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -779,7 +779,7 @@ static inline int classify10(const QChar *s, bool qmlMode) {
if (s[7].unicode() == 'n') {
if (s[8].unicode() == 't') {
if (s[9].unicode() == 's') {
- return qmlMode ? Lexer::T_IMPLEMENTS : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_IMPLEMENTS) : int(Lexer::T_IDENTIFIER);
}
}
}
@@ -825,7 +825,7 @@ static inline int classify12(const QChar *s, bool qmlMode) {
if (s[9].unicode() == 'z') {
if (s[10].unicode() == 'e') {
if (s[11].unicode() == 'd') {
- return qmlMode ? Lexer::T_SYNCHRONIZED : Lexer::T_IDENTIFIER;
+ return qmlMode ? int(Lexer::T_SYNCHRONIZED) : int(Lexer::T_IDENTIFIER);
}
}
}
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 7a2f4eaf34..adce26b76c 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -986,6 +986,7 @@ QQmlImportNamespace::Import *QQmlImportsPrivate::addImportToNamespace(QQmlImport
{
Q_ASSERT(nameSpace);
Q_ASSERT(errors);
+ Q_UNUSED(errors);
Q_ASSERT(url.isEmpty() || url.endsWith(Slash));
QQmlImportNamespace::Import *import = new QQmlImportNamespace::Import;
diff --git a/src/qmltest/qmltest.pro b/src/qmltest/qmltest.pro
index 8864f1cae1..9ed792748c 100644
--- a/src/qmltest/qmltest.pro
+++ b/src/qmltest/qmltest.pro
@@ -4,6 +4,11 @@ DEFINES += QT_NO_URL_CAST_FROM_STRING
QT = core
QT_PRIVATE = testlib-private quick qml-private v8-private gui core-private
+!contains(QT_CONFIG, no-widgets) {
+ QT += widgets
+ DEFINES += QT_QMLTEST_WITH_WIDGETS
+}
+
load(qt_module)
# Install qmltestcase.prf into the Qt mkspecs so that "CONFIG += qmltestcase"
@@ -23,4 +28,4 @@ HEADERS += \
$$PWD/quicktestresult_p.h \
$$PWD/qtestoptions_p.h
-DEFINES += QT_QML_DEBUG_NO_WARNING \ No newline at end of file
+DEFINES += QT_QML_DEBUG_NO_WARNING
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 6be10add38..705908c3c4 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -64,6 +64,10 @@
#include <QtCore/QTranslator>
#include <QtTest/QSignalSpy>
+#ifdef QT_QMLTEST_WITH_WIDGETS
+#include <QtWidgets/QApplication>
+#endif
+
QT_BEGIN_NAMESPACE
class QTestRootObject : public QObject
@@ -167,11 +171,6 @@ bool qWaitForSignal(QObject *obj, const char* signal, int timeout = 5000)
int quick_test_main(int argc, char **argv, const char *name, const char *sourceDir)
{
- QGuiApplication* app = 0;
- if (!QCoreApplication::instance()) {
- app = new QGuiApplication(argc, argv);
- }
-
// Look for QML-specific command-line options.
// -import dir Specify an import directory.
// -input dir Specify the input directory for test cases.
@@ -179,6 +178,9 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
QStringList imports;
QString testPath;
QString translationFile;
+#ifdef QT_QMLTEST_WITH_WIDGETS
+ bool withWidgets = false;
+#endif
int outargc = 1;
int index = 1;
while (index < argc) {
@@ -190,6 +192,11 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
index += 2;
} else if (strcmp(argv[index], "-opengl") == 0) {
++index;
+#ifdef QT_QMLTEST_WITH_WIDGETS
+ } else if (strcmp(argv[index], "-widgets") == 0) {
+ withWidgets = true;
+ ++index;
+#endif
} else if (strcmp(argv[index], "-translation") == 0 && (index + 1) < argc) {
translationFile = stripQuotes(QString::fromLocal8Bit(argv[index + 1]));
index += 2;
@@ -203,6 +210,18 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
argv[outargc] = 0;
argc = outargc;
+ QCoreApplication* app = 0;
+ if (!QCoreApplication::instance()) {
+#ifdef QT_QMLTEST_WITH_WIDGETS
+ if (withWidgets)
+ app = new QApplication(argc, argv);
+ else
+#endif
+ {
+ app = new QGuiApplication(argc, argv);
+ }
+ }
+
// Parse the command-line arguments.
// Setting currentAppname and currentTestObjectName (via setProgramName) are needed
diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp
index 2fccf3cd72..20ede936fa 100644
--- a/src/qmltest/quicktestevent.cpp
+++ b/src/qmltest/quicktestevent.cpp
@@ -146,6 +146,7 @@ namespace QtQuickTest
}
}
+#ifndef QT_NO_WHEELEVENT
static void mouseWheel(QWindow* window, QObject* item, Qt::MouseButtons buttons,
Qt::KeyboardModifiers stateKey,
QPointF _pos, int xDelta, int yDelta, int delay = -1)
@@ -172,6 +173,7 @@ namespace QtQuickTest
if (!qApp->notify(window, &we))
QTest::qWarn("Wheel event not accepted by receiving window");
}
+#endif
};
bool QuickTestEvent::mousePress
@@ -188,6 +190,7 @@ bool QuickTestEvent::mousePress
return true;
}
+#ifndef QT_NO_WHEELEVENT
bool QuickTestEvent::mouseWheel(
QObject *item, qreal x, qreal y, int buttons,
int modifiers, int xDelta, int yDelta, int delay)
@@ -200,6 +203,7 @@ bool QuickTestEvent::mouseWheel(
QPointF(x, y), xDelta, yDelta, delay);
return true;
}
+#endif
bool QuickTestEvent::mouseRelease
(QObject *item, qreal x, qreal y, int button,
diff --git a/src/qmltest/quicktestevent_p.h b/src/qmltest/quicktestevent_p.h
index 9dfa66a54d..f72d9265b5 100644
--- a/src/qmltest/quicktestevent_p.h
+++ b/src/qmltest/quicktestevent_p.h
@@ -69,8 +69,10 @@ public Q_SLOTS:
int modifiers, int delay);
bool mouseMove(QObject *item, qreal x, qreal y, int delay, int buttons);
+#ifndef QT_NO_WHEELEVENT
bool mouseWheel(QObject *item, qreal x, qreal y, int buttons,
int modifiers, int xDelta, int yDelta, int delay);
+#endif
private:
QWindow *eventWindow();
diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf
index 518304ab62..f75ae06539 100644
--- a/src/quick/doc/qtquick.qdocconf
+++ b/src/quick/doc/qtquick.qdocconf
@@ -3,7 +3,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtQuick
description = Qt Quick Reference Documentation
url = http://qt-project.org/doc/qt-5.0/qtquick-index.html
-version = 5.0.0
+version = 5.0.1
qhp.projects = QtQuick
@@ -14,9 +14,9 @@ qhp.QtQuick.virtualFolder = qtquick
qhp.QtQuick.indexTitle = Qt Quick
qhp.QtQuick.indexRoot =
-qhp.QtQuick.filterAttributes = qtquick 5.0.0 qtrefdoc
-qhp.QtQuick.customFilters.Qt.name = QtQuick 5.0.0
-qhp.QtQuick.customFilters.Qt.filterAttributes = qtquick 5.0.0
+qhp.QtQuick.filterAttributes = qtquick 5.0.1 qtrefdoc
+qhp.QtQuick.customFilters.Qt.name = QtQuick 5.0.1
+qhp.QtQuick.customFilters.Qt.filterAttributes = qtquick 5.0.1
qhp.QtQuick.subprojects = qmltypes classes examples
qhp.QtQuick.subprojects.qmltypes.title = QML Types
qhp.QtQuick.subprojects.qmltypes.indexTitle = Qt Quick QML Types
diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp
index 372a47963e..193a0280b3 100644
--- a/src/quick/items/qquickaccessibleattached.cpp
+++ b/src/quick/items/qquickaccessibleattached.cpp
@@ -152,6 +152,10 @@ QQuickAccessibleAttached::QQuickAccessibleAttached(QObject *parent)
item->d_func()->setAccessibleFlagAndListener();
QAccessibleEvent ev(item, QAccessible::ObjectCreated);
QAccessible::updateAccessibility(&ev);
+
+ if (!parent->property("value").isNull()) {
+ connect(parent, SIGNAL(valueChanged()), this, SLOT(valueChanged()));
+ }
}
QQuickAccessibleAttached::~QQuickAccessibleAttached()
diff --git a/src/quick/items/qquickaccessibleattached_p.h b/src/quick/items/qquickaccessibleattached_p.h
index 74f486ae7d..6c10b496d0 100644
--- a/src/quick/items/qquickaccessibleattached_p.h
+++ b/src/quick/items/qquickaccessibleattached_p.h
@@ -127,11 +127,29 @@ public:
return obj->setProperty(propertyName, value);
}
+ static QObject *findAccessible(QObject *object, QAccessible::Role role = QAccessible::NoRole)
+ {
+ while (object) {
+ QObject *att = QQuickAccessibleAttached::attachedProperties(object);
+ if (att && (role == QAccessible::NoRole || att->property("role").toInt() == role)) {
+ break;
+ }
+ object = object->parent();
+ }
+ return object;
+ }
+
+public Q_SLOTS:
+ void valueChanged() {
+ QAccessibleValueChangeEvent ev(parent(), parent()->property("value"));
+ QAccessible::updateAccessibility(&ev);
+ }
Q_SIGNALS:
void roleChanged();
void nameChanged();
void descriptionChanged();
+
private:
QAccessible::Role m_role;
QString m_name;
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 0a3dcd8039..6e5e6b74a0 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -1270,6 +1270,7 @@ void QQuickFlickable::mouseReleaseEvent(QMouseEvent *event)
}
}
+#ifndef QT_NO_WHEELEVENT
void QQuickFlickable::wheelEvent(QWheelEvent *event)
{
Q_D(QQuickFlickable);
@@ -1324,6 +1325,7 @@ void QQuickFlickable::wheelEvent(QWheelEvent *event)
if (!event->isAccepted())
QQuickItem::wheelEvent(event);
}
+#endif
bool QQuickFlickablePrivate::isInnermostPressDelay(QQuickItem *i) const
{
diff --git a/src/quick/items/qquickflickable_p.h b/src/quick/items/qquickflickable_p.h
index d5f97ad963..ed4b026be3 100644
--- a/src/quick/items/qquickflickable_p.h
+++ b/src/quick/items/qquickflickable_p.h
@@ -234,7 +234,9 @@ protected:
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
+#ifndef QT_NO_WHEELEVENT
virtual void wheelEvent(QWheelEvent *event);
+#endif
virtual void timerEvent(QTimerEvent *event);
QQuickFlickableVisibleArea *visibleArea();
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 2340da9b9f..6668cb72c5 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -3129,8 +3129,12 @@ void QQuickItem::inputMethodEvent(QInputMethodEvent *event)
void QQuickItem::focusInEvent(QFocusEvent * /*event*/)
{
#ifndef QT_NO_ACCESSIBILITY
- QAccessibleEvent ev(this, QAccessible::Focus);
- QAccessible::updateAccessibility(&ev);
+ if (QAccessible::isActive()) {
+ if (QObject *acc = QQuickAccessibleAttached::findAccessible(this)) {
+ QAccessibleEvent ev(acc, QAccessible::Focus);
+ QAccessible::updateAccessibility(&ev);
+ }
+ }
#endif
}
@@ -3202,6 +3206,7 @@ void QQuickItem::touchUngrabEvent()
// XXX todo
}
+#ifndef QT_NO_WHEELEVENT
/*!
This event handler can be reimplemented in a subclass to receive
wheel events for an item. The event information is provided by the
@@ -3211,6 +3216,7 @@ void QQuickItem::wheelEvent(QWheelEvent *event)
{
event->ignore();
}
+#endif
/*!
This event handler can be reimplemented in a subclass to receive touch
@@ -4100,11 +4106,13 @@ void QQuickItemPrivate::deliverMouseEvent(QMouseEvent *e)
}
}
+#ifndef QT_NO_WHEELEVENT
void QQuickItemPrivate::deliverWheelEvent(QWheelEvent *e)
{
Q_Q(QQuickItem);
q->wheelEvent(e);
}
+#endif
void QQuickItemPrivate::deliverTouchEvent(QTouchEvent *e)
{
@@ -5264,7 +5272,7 @@ void QQuickItem::setFlags(Flags flags)
{
Q_D(QQuickItem);
- if ((flags & ItemIsFocusScope) != (d->flags & ItemIsFocusScope)) {
+ if (int(flags & ItemIsFocusScope) != int(d->flags & ItemIsFocusScope)) {
if (flags & ItemIsFocusScope && !d->childItems.isEmpty() && d->window) {
qWarning("QQuickItem: Cannot set FocusScope once item has children and is in a window.");
flags &= ~ItemIsFocusScope;
@@ -5274,7 +5282,7 @@ void QQuickItem::setFlags(Flags flags)
}
}
- if ((flags & ItemClipsChildrenToShape ) != (d->flags & ItemClipsChildrenToShape))
+ if (int(flags & ItemClipsChildrenToShape) != int(d->flags & ItemClipsChildrenToShape))
d->dirty(QQuickItemPrivate::Clip);
d->flags = flags;
diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h
index bba26be060..dc20310c48 100644
--- a/src/quick/items/qquickitem.h
+++ b/src/quick/items/qquickitem.h
@@ -398,7 +398,9 @@ protected:
virtual void mouseDoubleClickEvent(QMouseEvent *event);
virtual void mouseUngrabEvent(); // XXX todo - params?
virtual void touchUngrabEvent();
+#ifndef QT_NO_WHEELEVENT
virtual void wheelEvent(QWheelEvent *event);
+#endif
virtual void touchEvent(QTouchEvent *event);
virtual void hoverEnterEvent(QHoverEvent *event);
virtual void hoverMoveEvent(QHoverEvent *event);
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index 363cc93cc4..804b10deac 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -528,7 +528,9 @@ public:
#endif
void deliverFocusEvent(QFocusEvent *);
void deliverMouseEvent(QMouseEvent *);
+#ifndef QT_NO_WHEELEVENT
void deliverWheelEvent(QWheelEvent *);
+#endif
void deliverTouchEvent(QTouchEvent *);
void deliverHoverEvent(QHoverEvent *);
#ifndef QT_NO_DRAGANDDROP
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index fd01c80ba5..0edbd1b9a9 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -938,6 +938,7 @@ void QQuickMouseArea::hoverLeaveEvent(QHoverEvent *event)
setHovered(false);
}
+#ifndef QT_NO_WHEELEVENT
void QQuickMouseArea::wheelEvent(QWheelEvent *event)
{
Q_D(QQuickMouseArea);
@@ -953,6 +954,7 @@ void QQuickMouseArea::wheelEvent(QWheelEvent *event)
if (!we.isAccepted())
QQuickItem::wheelEvent(event);
}
+#endif
void QQuickMouseArea::ungrabMouse()
{
diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h
index eb5bddf1db..c2138792ae 100644
--- a/src/quick/items/qquickmousearea_p.h
+++ b/src/quick/items/qquickmousearea_p.h
@@ -222,7 +222,9 @@ protected:
virtual void hoverEnterEvent(QHoverEvent *event);
virtual void hoverMoveEvent(QHoverEvent *event);
virtual void hoverLeaveEvent(QHoverEvent *event);
+#ifndef QT_NO_WHEELEVENT
virtual void wheelEvent(QWheelEvent *event);
+#endif
virtual bool childMouseEventFilter(QQuickItem *i, QEvent *e);
virtual void timerEvent(QTimerEvent *event);
virtual void windowDeactivateEvent();
diff --git a/src/quick/items/qquickshadereffectnode.cpp b/src/quick/items/qquickshadereffectnode.cpp
index 622000e492..15989db57b 100644
--- a/src/quick/items/qquickshadereffectnode.cpp
+++ b/src/quick/items/qquickshadereffectnode.cpp
@@ -153,7 +153,7 @@ void QQuickCustomMaterialShader::updateState(const RenderState &state, QSGMateri
if (state.isMatrixDirty())
program()->setUniformValue(loc, state.combinedMatrix());
} else if (d.specialType == UniformData::None) {
- switch (d.value.type()) {
+ switch (int(d.value.type())) {
case QMetaType::QColor:
program()->setUniformValue(loc, qt_premultiply_color(qvariant_cast<QColor>(d.value)));
break;
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp
index 2b613df0f2..0c4e263ac2 100644
--- a/src/quick/items/qquickshadereffectsource.cpp
+++ b/src/quick/items/qquickshadereffectsource.cpp
@@ -695,6 +695,7 @@ void QQuickShaderEffectSource::setSourceItem(QQuickItem *item)
void QQuickShaderEffectSource::sourceItemDestroyed(QObject *item)
{
Q_ASSERT(item == m_sourceItem);
+ Q_UNUSED(item);
m_sourceItem = 0;
update();
emit sourceItemChanged();
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index fee49593ee..6dd8fb157d 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -59,6 +59,7 @@
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
+#include "qquickaccessibleattached_p.h"
#endif
QT_BEGIN_NAMESPACE
@@ -3374,9 +3375,11 @@ void QQuickTextInputPrivate::internalSetText(const QString &txt, int pos, bool e
#ifdef QT_NO_ACCESSIBILITY
Q_UNUSED(changed)
#else
- if (changed) {
- QAccessibleTextUpdateEvent ev(q, 0, oldText, m_text);
- QAccessible::updateAccessibility(&ev);
+ if (changed && QAccessible::isActive()) {
+ if (QObject *acc = QQuickAccessibleAttached::findAccessible(q, QAccessible::EditableText)) {
+ QAccessibleTextUpdateEvent ev(acc, 0, oldText, m_text);
+ QAccessible::updateAccessibility(&ev);
+ }
}
#endif
}
@@ -4025,8 +4028,12 @@ bool QQuickTextInputPrivate::emitCursorPositionChanged()
}
#ifndef QT_NO_ACCESSIBILITY
- QAccessibleTextCursorEvent ev(q, m_cursor);
- QAccessible::updateAccessibility(&ev);
+ if (QAccessible::isActive()) {
+ if (QObject *acc = QQuickAccessibleAttached::findAccessible(q, QAccessible::EditableText)) {
+ QAccessibleTextCursorEvent ev(acc, m_cursor);
+ QAccessible::updateAccessibility(&ev);
+ }
+ }
#endif
return true;
diff --git a/src/quick/items/qquickthreadedwindowmanager.cpp b/src/quick/items/qquickthreadedwindowmanager.cpp
index 4c38686298..63e2c46d79 100644
--- a/src/quick/items/qquickthreadedwindowmanager.cpp
+++ b/src/quick/items/qquickthreadedwindowmanager.cpp
@@ -845,6 +845,9 @@ QImage QQuickRenderThreadSingleContextWindowManager::grab(QQuickWindow *window)
if (QThread::currentThread() != qApp->thread()) {
qWarning("QQuickWindow::grabFrameBuffer: can only be called from the GUI thread");
return QImage();
+ } else if (window->size().width() <= 0 || window->size().height() <= 0 ) {
+ qWarning("QQuickWindow::grabFrameBuffer: Can't grab a Window with size %dx%d", window->size().width(), window->size().height());
+ return QImage();
}
#ifdef THREAD_DEBUG
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index a915430616..2cde3cc434 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1421,6 +1421,7 @@ bool QQuickWindowPrivate::deliverHoverEvent(QQuickItem *item, const QPointF &sce
return false;
}
+#ifndef QT_NO_WHEELEVENT
bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event)
{
Q_Q(QQuickWindow);
@@ -1457,7 +1458,6 @@ bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event
return false;
}
-#ifndef QT_NO_WHEELEVENT
/*! \reimp */
void QQuickWindow::wheelEvent(QWheelEvent *event)
{
@@ -2058,9 +2058,11 @@ bool QQuickWindow::sendEvent(QQuickItem *item, QEvent *e)
item->mouseUngrabEvent();
}
break;
+#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel:
QQuickItemPrivate::get(item)->deliverWheelEvent(static_cast<QWheelEvent *>(e));
break;
+#endif
case QEvent::HoverEnter:
case QEvent::HoverLeave:
case QEvent::HoverMove:
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index fdf5fe2abb..c8ecd43238 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -131,7 +131,9 @@ public:
bool deliverInitialMousePressEvent(QQuickItem *, QMouseEvent *);
bool deliverMouseEvent(QMouseEvent *);
bool sendFilteredMouseEvent(QQuickItem *, QQuickItem *, QEvent *);
+#ifndef QT_NO_WHEELEVENT
bool deliverWheelEvent(QQuickItem *, QWheelEvent *);
+#endif
bool deliverTouchPoints(QQuickItem *, QTouchEvent *, const QList<QTouchEvent::TouchPoint> &, QSet<int> *,
QHash<QQuickItem *, QList<QTouchEvent::TouchPoint> > *);
bool deliverTouchEvent(QTouchEvent *);
diff --git a/src/quick/items/qquickwindowmanager.cpp b/src/quick/items/qquickwindowmanager.cpp
index 5da904ace2..1249468a4d 100644
--- a/src/quick/items/qquickwindowmanager.cpp
+++ b/src/quick/items/qquickwindowmanager.cpp
@@ -253,7 +253,7 @@ void QQuickTrivialWindowManager::renderWindow(QQuickWindow *window)
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
cd->polishItems();
- int renderTime, syncTime;
+ int renderTime = 0, syncTime = 0;
QTime renderTimer;
if (qquick_render_timing())
renderTimer.start();
diff --git a/src/quick/scenegraph/util/qsgsimplematerial.cpp b/src/quick/scenegraph/util/qsgsimplematerial.cpp
index 6267d3ff5c..f91c85af93 100644
--- a/src/quick/scenegraph/util/qsgsimplematerial.cpp
+++ b/src/quick/scenegraph/util/qsgsimplematerial.cpp
@@ -145,6 +145,29 @@
*/
/*!
+ \macro QSG_DECLARE_SIMPLE_SHADER(Shader, State)
+ \relates QSGSimpleMaterialShader
+
+ This macro is used to declare a QSGMaterialType and a \c
+ createMaterial() function for \a Shader with the given \a State.
+ */
+
+/*!
+ \macro QSG_DECLARE_SIMPLE_COMPARABLE_SHADER(Shader, State)
+ \relates QSGSimpleMaterialShader
+
+ This macro is used to declare a QSGMaterialType and a \c
+ createMaterial() function for \a Shader with the given \a State,
+ where the \a State class must define a compare function on the
+ form:
+
+ \code
+ int compare(const State *other) const;
+ \endcode
+*/
+
+
+/*!
\fn char const *const *QSGSimpleMaterialShader::attributeNames() const
\internal
*/
diff --git a/src/quick/util/qquickanimationcontroller.cpp b/src/quick/util/qquickanimationcontroller.cpp
index e4a82ca091..71efda5846 100644
--- a/src/quick/util/qquickanimationcontroller.cpp
+++ b/src/quick/util/qquickanimationcontroller.cpp
@@ -67,6 +67,7 @@ void QQuickAnimationControllerPrivate::animationFinished(QAbstractAnimationJob *
{
Q_Q(QQuickAnimationController);
Q_ASSERT(animationInstance && animationInstance == job);
+ Q_UNUSED(job);
animationInstance->removeAnimationChangeListener(this, QAbstractAnimationJob::Completion | QAbstractAnimationJob::CurrentTime);
@@ -84,6 +85,7 @@ void QQuickAnimationControllerPrivate::animationCurrentTimeChanged(QAbstractAnim
{
Q_Q(QQuickAnimationController);
Q_ASSERT(animationInstance && animationInstance == job);
+ Q_UNUSED(job);
const qreal newProgress = currentTime * 1.0 / animationInstance->duration();
if (progress != newProgress) {
progress = newProgress;
diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
index 5848b42028..92f48f398f 100644
--- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
+++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
@@ -85,7 +85,7 @@ private slots:
void reloadQmlWindow();
};
-void tst_QQmlInspector::startQmlsceneProcess(const char *qmlFile)
+void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */)
{
const QString argument = "-qmljsdebugger=port:" STR_PORT ",block";
diff --git a/tests/auto/qml/qqmlbundle/data/imports/bundletest/plugin1.pro b/tests/auto/qml/qqmlbundle/data/imports/bundletest/plugin1.pro
index 2ffa05a007..934bb2d591 100644
--- a/tests/auto/qml/qqmlbundle/data/imports/bundletest/plugin1.pro
+++ b/tests/auto/qml/qqmlbundle/data/imports/bundletest/plugin1.pro
@@ -3,4 +3,5 @@ CONFIG += plugin
SOURCES += plugin.cpp
QT = core qml
+DESTDIR = ./
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlbundle/tst_qqmlbundle.cpp b/tests/auto/qml/qqmlbundle/tst_qqmlbundle.cpp
index 70cb319938..168e685699 100644
--- a/tests/auto/qml/qqmlbundle/tst_qqmlbundle.cpp
+++ b/tests/auto/qml/qqmlbundle/tst_qqmlbundle.cpp
@@ -201,7 +201,7 @@ void tst_qqmlbundle::import()
engine.addImportPath(testFile("imports"));
QQmlComponent component(&engine, testFileUrl("import.qml"));
- QVERIFY(component.isReady());
+ QVERIFY2(component.isReady(), QQmlDataTest::msgComponentError(component, &engine));
QObject *o = component.create();
QVERIFY(o != 0);
diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
index d3aba444af..748d4d71e8 100644
--- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
+++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
@@ -226,20 +226,13 @@ void tst_qqmlcomponent::qmlCreateObjectWithProperties()
delete testBindingThisObj;
}
-static QStringList warnings;
-static void msgHandler(QtMsgType, const QMessageLogContext &, const QString &warning)
-{
- warnings << warning;
-}
-
void tst_qqmlcomponent::qmlCreateParentReference()
{
QQmlEngine engine;
QCOMPARE(engine.outputWarningsToStandardError(), true);
- warnings.clear();
- QtMessageHandler old = qInstallMessageHandler(msgHandler);
+ QQmlTestMessageHandler messageHandler;
QQmlComponent component(&engine, testFileUrl("createParentReference.qml"));
QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8());
@@ -249,12 +242,10 @@ void tst_qqmlcomponent::qmlCreateParentReference()
QVERIFY(QMetaObject::invokeMethod(object, "createChild"));
delete object;
- qInstallMessageHandler(old);
-
engine.setOutputWarningsToStandardError(false);
QCOMPARE(engine.outputWarningsToStandardError(), false);
- QCOMPARE(warnings.count(), 0);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
}
void tst_qqmlcomponent::async()
@@ -398,13 +389,14 @@ void tst_qqmlcomponent::onDestructionCount()
// Warning should not be emitted any further
QCOMPARE(engine.outputWarningsToStandardError(), true);
- warnings.clear();
- QtMessageHandler old = qInstallMessageHandler(msgHandler);
-
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
- QCoreApplication::processEvents();
+ QStringList warnings;
+ {
+ QQmlTestMessageHandler messageHandler;
- qInstallMessageHandler(old);
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+ warnings = messageHandler.messages();
+ }
engine.setOutputWarningsToStandardError(false);
QCOMPARE(engine.outputWarningsToStandardError(), false);
diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
index b9e31d2216..a7ef405aa3 100644
--- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
+++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
@@ -231,7 +231,7 @@ class TestObject : public QObject
Q_PROPERTY(bool ran READ ran WRITE setRan)
public:
- TestObject(QObject *parent = 0) : m_ran(false) {}
+ TestObject(QObject *parent = 0) : QObject(parent), m_ran(false) {}
~TestObject() {}
bool ran() const { return m_ran; }
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 1cf8e13c3c..9ecb3b6e1d 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -1923,27 +1923,18 @@ void tst_qqmlecmascript::compileInvalidBinding()
delete object;
}
-static int transientErrorsMsgCount = 0;
-static void transientErrorsMsgHandler(QtMsgType, const QMessageLogContext &, const QString &)
-{
- ++transientErrorsMsgCount;
-}
-
// Check that transient binding errors are not displayed
void tst_qqmlecmascript::transientErrors()
{
{
QQmlComponent component(&engine, testFileUrl("transientErrors.qml"));
- transientErrorsMsgCount = 0;
- QtMessageHandler old = qInstallMessageHandler(transientErrorsMsgHandler);
+ QQmlTestMessageHandler messageHandler;
QObject *object = component.create();
QVERIFY(object != 0);
- qInstallMessageHandler(old);
-
- QCOMPARE(transientErrorsMsgCount, 0);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
delete object;
}
@@ -1952,15 +1943,12 @@ void tst_qqmlecmascript::transientErrors()
{
QQmlComponent component(&engine, testFileUrl("transientErrors.2.qml"));
- transientErrorsMsgCount = 0;
- QtMessageHandler old = qInstallMessageHandler(transientErrorsMsgHandler);
+ QQmlTestMessageHandler messageHandler;
QObject *object = component.create();
QVERIFY(object != 0);
- qInstallMessageHandler(old);
-
- QCOMPARE(transientErrorsMsgCount, 0);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
delete object;
}
@@ -1973,13 +1961,11 @@ void tst_qqmlecmascript::shutdownErrors()
QObject *object = component.create();
QVERIFY(object != 0);
- transientErrorsMsgCount = 0;
- QtMessageHandler old = qInstallMessageHandler(transientErrorsMsgHandler);
+ QQmlTestMessageHandler messageHandler;
delete object;
- qInstallMessageHandler(old);
- QCOMPARE(transientErrorsMsgCount, 0);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
}
void tst_qqmlecmascript::compositePropertyType()
@@ -3801,6 +3787,7 @@ void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) {
v8::Persistent<v8::Context> context = v8::Context::New();
v8::Context::Scope context_scope(context);
v8::Local<v8::Object> temporaryScope = engine->qmlScope(scriptContext, NULL);
+ Q_UNUSED(temporaryScope)
context.Dispose();
}
@@ -5793,14 +5780,11 @@ void tst_qqmlecmascript::qtbug_9792()
delete context;
- transientErrorsMsgCount = 0;
- QtMessageHandler old = qInstallMessageHandler(transientErrorsMsgHandler);
+ QQmlTestMessageHandler messageHandler;
object->basicSignal();
-
- qInstallMessageHandler(old);
- QCOMPARE(transientErrorsMsgCount, 0);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
delete object;
}
@@ -5834,14 +5818,11 @@ void tst_qqmlecmascript::noSpuriousWarningsAtShutdown()
QObject *o = component.create();
- transientErrorsMsgCount = 0;
- QtMessageHandler old = qInstallMessageHandler(transientErrorsMsgHandler);
+ QQmlTestMessageHandler messageHandler;
delete o;
- qInstallMessageHandler(old);
-
- QCOMPARE(transientErrorsMsgCount, 0);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
}
@@ -5850,14 +5831,11 @@ void tst_qqmlecmascript::noSpuriousWarningsAtShutdown()
QObject *o = component.create();
- transientErrorsMsgCount = 0;
- QtMessageHandler old = qInstallMessageHandler(transientErrorsMsgHandler);
+ QQmlTestMessageHandler messageHandler;
delete o;
- qInstallMessageHandler(old);
-
- QCOMPARE(transientErrorsMsgCount, 0);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
}
}
@@ -6671,22 +6649,15 @@ void tst_qqmlecmascript::doubleEvaluate()
delete object;
}
-static QStringList messages;
-static void captureMsgHandler(QtMsgType, const QMessageLogContext &, const QString &msg)
-{
- messages.append(msg);
-}
-
void tst_qqmlecmascript::nonNotifyable()
{
QV4Compiler::enableV4(false);
QQmlComponent component(&engine, testFileUrl("nonNotifyable.qml"));
QV4Compiler::enableV4(true);
- QtMessageHandler old = qInstallMessageHandler(captureMsgHandler);
- messages.clear();
+ QQmlTestMessageHandler messageHandler;
+
QObject *object = component.create();
- qInstallMessageHandler(old);
QVERIFY(object != 0);
@@ -6697,9 +6668,9 @@ void tst_qqmlecmascript::nonNotifyable()
QLatin1String(object->metaObject()->className()) +
QLatin1String("::value");
- QCOMPARE(messages.length(), 2);
- QCOMPARE(messages.at(0), expected1);
- QCOMPARE(messages.at(1), expected2);
+ QCOMPARE(messageHandler.messages().length(), 2);
+ QCOMPARE(messageHandler.messages().at(0), expected1);
+ QCOMPARE(messageHandler.messages().at(1), expected2);
delete object;
}
@@ -7124,16 +7095,14 @@ void tst_qqmlecmascript::bindingSuppression()
EventProcessor processor;
engine.rootContext()->setContextProperty("pendingEvents", &processor);
- transientErrorsMsgCount = 0;
- QtMessageHandler old = qInstallMessageHandler(transientErrorsMsgHandler);
+ QQmlTestMessageHandler messageHandler;
QQmlComponent c(&engine, testFileUrl("bindingSuppression.qml"));
QObject *obj = c.create();
QVERIFY(obj != 0);
delete obj;
- qInstallMessageHandler(old);
- QCOMPARE(transientErrorsMsgCount, 0);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
}
void tst_qqmlecmascript::signalEmitted()
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
index 128294bbcb..2a78831ba1 100644
--- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
+++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
@@ -417,12 +417,6 @@ void tst_qqmlengine::failedCompilation_data()
QTest::newRow("Invalid content") << "failedCompilation.1.qml";
}
-static QStringList warnings;
-static void msgHandler(QtMsgType, const QMessageLogContext &, const QString &warning)
-{
- warnings << warning;
-}
-
void tst_qqmlengine::outputWarningsToStandardError()
{
QQmlEngine engine;
@@ -434,35 +428,26 @@ void tst_qqmlengine::outputWarningsToStandardError()
QVERIFY(c.isReady() == true);
- warnings.clear();
- QtMessageHandler old = qInstallMessageHandler(msgHandler);
+ QQmlTestMessageHandler messageHandler;
QObject *o = c.create();
- qInstallMessageHandler(old);
-
QVERIFY(o != 0);
delete o;
- QCOMPARE(warnings.count(), 1);
- QCOMPARE(warnings.at(0), QLatin1String("<Unknown File>: Unable to assign [undefined] to int"));
- warnings.clear();
-
+ QCOMPARE(messageHandler.messages().count(), 1);
+ QCOMPARE(messageHandler.messages().at(0), QLatin1String("<Unknown File>: Unable to assign [undefined] to int"));
+ messageHandler.clear();
engine.setOutputWarningsToStandardError(false);
QCOMPARE(engine.outputWarningsToStandardError(), false);
-
- old = qInstallMessageHandler(msgHandler);
-
o = c.create();
- qInstallMessageHandler(old);
-
QVERIFY(o != 0);
delete o;
- QCOMPARE(warnings.count(), 0);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
}
void tst_qqmlengine::objectOwnership()
diff --git a/tests/auto/qml/qqmlinstruction/qqmlinstruction.pro b/tests/auto/qml/qqmlinstruction/qqmlinstruction.pro
index 1eb4a203a3..73f29ab973 100644
--- a/tests/auto/qml/qqmlinstruction/qqmlinstruction.pro
+++ b/tests/auto/qml/qqmlinstruction/qqmlinstruction.pro
@@ -5,5 +5,7 @@ macx:CONFIG -= app_bundle
CONFIG += parallel_test
+include (../../shared/util.pri)
+
QT += core-private gui-private v8-private qml-private testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
index 7d27751e77..e25c38d9cc 100644
--- a/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
+++ b/tests/auto/qml/qqmlinstruction/tst_qqmlinstruction.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include <qtest.h>
+#include "../../shared/util.h"
#include <private/qqmlcompiler_p.h>
#include <QVector3D>
@@ -65,12 +66,6 @@ private slots:
void time();
};
-static QStringList messages;
-static void msgHandler(QtMsgType, const QMessageLogContext &, const QString &msg)
-{
- messages << msg;
-}
-
void tst_qqmlinstruction::dump()
{
QQmlEngine engine;
@@ -128,14 +123,14 @@ void tst_qqmlinstruction::dump()
{
QQmlCompiledData::Instruction::StoreFloat i;
i.propertyIndex = 3;
- i.value = 11.3;
+ i.value = 11.3f;
data->addInstruction(i);
}
{
QQmlCompiledData::Instruction::StoreDouble i;
i.propertyIndex = 4;
- i.value = 14.8;
+ i.value = 14.8f;
data->addInstruction(i);
}
@@ -564,15 +559,14 @@ void tst_qqmlinstruction::dump()
<< "57\t\tSTORE_VAR_BOOL\t\t83\ttrue"
<< "-------------------------------------------------------------------------------";
- messages = QStringList();
- QtMessageHandler old = qInstallMessageHandler(msgHandler);
+ QQmlTestMessageHandler messageHandler;
data->dumpInstructions();
- qInstallMessageHandler(old);
- QCOMPARE(messages.count(), expect.count());
- for (int ii = 0; ii < messages.count(); ++ii) {
- QCOMPARE(messages.at(ii), expect.at(ii));
+ const int messageCount = messageHandler.messages().count();
+ QCOMPARE(messageCount, expect.count());
+ for (int ii = 0; ii < messageCount; ++ii) {
+ QCOMPARE(messageHandler.messages().at(ii), expect.at(ii));
}
data->release();
@@ -676,8 +670,8 @@ void tst_qqmlinstruction::vector3d()
QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storeVector3D::QVector3D), Q_ALIGNOF(QVector3D));
QQmlInstruction i;
- i.storeVector3D.vector.xp = 8.2;
- i.storeVector3D.vector.yp = 99.3;
+ i.storeVector3D.vector.xp = 8.2f;
+ i.storeVector3D.vector.yp = 99.3f;
i.storeVector3D.vector.zp = 12.0;
const QVector3D &vector = (const QVector3D &)(i.storeVector3D.vector);
@@ -692,10 +686,10 @@ void tst_qqmlinstruction::vector4d()
QCOMPARE(Q_ALIGNOF(QQmlInstruction::instr_storeVector4D::QVector4D), Q_ALIGNOF(QVector4D));
QQmlInstruction i;
- i.storeVector4D.vector.xp = 8.2;
- i.storeVector4D.vector.yp = 99.3;
+ i.storeVector4D.vector.xp = 8.2f;
+ i.storeVector4D.vector.yp = 99.3f;
i.storeVector4D.vector.zp = 12.0;
- i.storeVector4D.vector.wp = 121.1;
+ i.storeVector4D.vector.wp = 121.1f;
const QVector4D &vector = (const QVector4D &)(i.storeVector4D.vector);
QCOMPARE(vector.x(), (qreal)(float)8.2);
diff --git a/tests/auto/qml/qqmllanguage/data/literals.qml b/tests/auto/qml/qqmllanguage/data/literals.qml
index 3a3e8461e4..ffef050438 100644
--- a/tests/auto/qml/qqmllanguage/data/literals.qml
+++ b/tests/auto/qml/qqmllanguage/data/literals.qml
@@ -18,7 +18,6 @@ QtObject {
property variant c7: "\'"
property variant c8: "\""
property variant c9: "\\"
- property variant c10: "\251"
- property variant c11: "\xA9"
- property variant c12: "\u00A9" // unicode
+ property variant c10: "\xA9"
+ property variant c11: "\u00A9" // unicode
}
diff --git a/tests/auto/qml/qqmllanguage/testtypes.h b/tests/auto/qml/qqmllanguage/testtypes.h
index bd6205cbdf..e83e9e11ac 100644
--- a/tests/auto/qml/qqmllanguage/testtypes.h
+++ b/tests/auto/qml/qqmllanguage/testtypes.h
@@ -939,7 +939,7 @@ class MyUncreateableBaseClass : public QObject
Q_PROPERTY(bool prop2 READ prop2 WRITE setprop2 REVISION 1)
Q_PROPERTY(bool prop3 READ prop3 WRITE setprop3 REVISION 1)
public:
- explicit MyUncreateableBaseClass(bool arg, QObject *parent = 0)
+ explicit MyUncreateableBaseClass(bool /* arg */, QObject *parent = 0)
: QObject(parent), _prop1(false), _prop2(false), _prop3(false)
{
}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 6b4830f11d..bd92c68f8e 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -596,8 +596,8 @@ void tst_qqmllanguage::assignBasicTypes()
QCOMPARE(object->rectFProperty(), QRectF(1000.1, -10.9, 400, 90.99));
QCOMPARE(object->boolProperty(), true);
QCOMPARE(object->variantProperty(), QVariant("Hello World!"));
- QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2));
- QCOMPARE(object->vector4Property(), QVector4D(10, 1, 2.2, 2.3));
+ QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2f));
+ QCOMPARE(object->vector4Property(), QVector4D(10, 1, 2.2f, 2.3f));
QUrl encoded;
encoded.setEncodedUrl("main.qml?with%3cencoded%3edata", QUrl::TolerantMode);
QCOMPARE(object->urlProperty(), component.url().resolved(encoded));
@@ -2571,7 +2571,7 @@ void tst_qqmllanguage::importJs()
QCOMPARE(expected.size(), actual.size());
for (int i = 0; i < expected.size(); ++i)
{
- size_t compareLen = std::min(expected.at(i).length(), actual.at(i).length());
+ const int compareLen = qMin(expected.at(i).length(), actual.at(i).length());
QCOMPARE(expected.at(i).left(compareLen), actual.at(i).left(compareLen));
}
}
@@ -2948,13 +2948,12 @@ void tst_qqmllanguage::signalWithDefaultArg()
QCOMPARE(object->property("signalCount").toInt(), 2);
QCOMPARE(object->property("signalArg").toInt(), 15);
- const QMetaObject *metaObject = object->metaObject();
- metaObject->invokeMethod(object, "emitNoArgSignal");
+ QMetaObject::invokeMethod(object, "emitNoArgSignal");
QCOMPARE(object->property("signalCount").toInt(), 3);
QCOMPARE(object->property("signalArg").toInt(), 5);
- metaObject->invokeMethod(object, "emitArgSignal");
+ QMetaObject::invokeMethod(object, "emitArgSignal");
QCOMPARE(object->property("signalCount").toInt(), 4);
QCOMPARE(object->property("signalArg").toInt(), 22);
@@ -3065,9 +3064,8 @@ void tst_qqmllanguage::literals_data()
QTest::newRow("special8") << "c8" << QVariant(QString("\""));
QTest::newRow("special9") << "c9" << QVariant(QString("\\"));
// We don't handle octal escape sequences
-// QTest::newRow("special10") << "c10" << QVariant(QString("\251"));
- QTest::newRow("special11") << "c11" << QVariant(QString::fromLatin1("\xa9"));
- QTest::newRow("special12") << "c12" << QVariant(QString::fromUtf8("\u00A9"));
+ QTest::newRow("special11") << "c10" << QVariant(QString(1, QChar(0xa9)));
+ QTest::newRow("special12") << "c11" << QVariant(QString(1, QChar(0x00A9)));
}
void tst_qqmllanguage::literals()
diff --git a/tests/auto/qml/qqmlpropertymap/qqmlpropertymap.pro b/tests/auto/qml/qqmlpropertymap/qqmlpropertymap.pro
index bf22afa20c..81212bb064 100644
--- a/tests/auto/qml/qqmlpropertymap/qqmlpropertymap.pro
+++ b/tests/auto/qml/qqmlpropertymap/qqmlpropertymap.pro
@@ -4,6 +4,8 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qqmlpropertymap.cpp
+include (../../shared/util.pri)
+
CONFIG += parallel_test
QT += core-private gui-private qml-private quick-private testlib
diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
index 99179f533b..af2a032a30 100644
--- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
+++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
#include <qtest.h>
+#include "../../shared/util.h"
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcontext.h>
#include <QtQml/qqmlpropertymap.h>
@@ -294,19 +295,9 @@ public slots:
void testSlot() {}
};
-namespace
-{
- QStringList messages;
- void msgHandler(QtMsgType, const QMessageLogContext &, const QString &msg)
- {
- messages << msg;
- }
-}
-
void tst_QQmlPropertyMap::metaObjectAccessibility()
{
- messages.clear();
- QtMessageHandler old = qInstallMessageHandler(msgHandler);
+ QQmlTestMessageHandler messageHandler;
QQmlEngine engine;
@@ -318,9 +309,7 @@ void tst_QQmlPropertyMap::metaObjectAccessibility()
QCOMPARE(map.metaObject()->className(), "MyEnhancedPropertyMap");
- qInstallMessageHandler(old);
-
- QCOMPARE(messages.count(), 0);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
}
QTEST_MAIN(tst_QQmlPropertyMap)
diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
index 22be661755..9a525df973 100644
--- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
+++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
@@ -320,8 +320,8 @@ void tst_qqmlqt::vector2d()
QObject *object = component.create();
QVERIFY(object != 0);
- QCOMPARE(qvariant_cast<QVector2D>(object->property("test1")), QVector2D(1, 0.9));
- QCOMPARE(qvariant_cast<QVector2D>(object->property("test2")), QVector2D(102, -982.1));
+ QCOMPARE(qvariant_cast<QVector2D>(object->property("test1")), QVector2D(1, 0.9f));
+ QCOMPARE(qvariant_cast<QVector2D>(object->property("test2")), QVector2D(102, -982.1f));
QCOMPARE(qvariant_cast<QVector2D>(object->property("test3")), QVector2D());
QCOMPARE(qvariant_cast<QVector2D>(object->property("test4")), QVector2D());
@@ -340,8 +340,8 @@ void tst_qqmlqt::vector3d()
QObject *object = component.create();
QVERIFY(object != 0);
- QCOMPARE(qvariant_cast<QVector3D>(object->property("test1")), QVector3D(1, 0, 0.9));
- QCOMPARE(qvariant_cast<QVector3D>(object->property("test2")), QVector3D(102, -10, -982.1));
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test1")), QVector3D(1, 0, 0.9f));
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test2")), QVector3D(102, -10, -982.1f));
QCOMPARE(qvariant_cast<QVector3D>(object->property("test3")), QVector3D());
QCOMPARE(qvariant_cast<QVector3D>(object->property("test4")), QVector3D());
@@ -360,8 +360,8 @@ void tst_qqmlqt::vector4d()
QObject *object = component.create();
QVERIFY(object != 0);
- QCOMPARE(qvariant_cast<QVector4D>(object->property("test1")), QVector4D(1, 0, 0.9, 0.6));
- QCOMPARE(qvariant_cast<QVector4D>(object->property("test2")), QVector4D(102, -10, -982.1, 10));
+ QCOMPARE(qvariant_cast<QVector4D>(object->property("test1")), QVector4D(1, 0, 0.9f, 0.6f));
+ QCOMPARE(qvariant_cast<QVector4D>(object->property("test2")), QVector4D(102, -10, -982.1f, 10));
QCOMPARE(qvariant_cast<QVector4D>(object->property("test3")), QVector4D());
QCOMPARE(qvariant_cast<QVector4D>(object->property("test4")), QVector4D());
@@ -380,8 +380,8 @@ void tst_qqmlqt::quaternion()
QObject *object = component.create();
QVERIFY(object != 0);
- QCOMPARE(qvariant_cast<QQuaternion>(object->property("test1")), QQuaternion(2, 17, 0.9, 0.6));
- QCOMPARE(qvariant_cast<QQuaternion>(object->property("test2")), QQuaternion(102, -10, -982.1, 10));
+ QCOMPARE(qvariant_cast<QQuaternion>(object->property("test1")), QQuaternion(2, 17, 0.9f, 0.6f));
+ QCOMPARE(qvariant_cast<QQuaternion>(object->property("test2")), QQuaternion(102, -10, -982.1f, 10));
QCOMPARE(qvariant_cast<QQuaternion>(object->property("test3")), QQuaternion());
QCOMPARE(qvariant_cast<QQuaternion>(object->property("test4")), QQuaternion());
diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp
index f5e66a1d83..0644b363dd 100644
--- a/tests/auto/qml/v4/tst_v4.cpp
+++ b/tests/auto/qml/v4/tst_v4.cpp
@@ -104,16 +104,6 @@ void tst_v4::initTestCase()
registerTypes();
}
-static int v4ErrorCount;
-static QList<QString> v4ErrorMessages;
-static void v4ErrorsMsgHandler(QtMsgType, const QMessageLogContext &, const QString &message)
-{
- v4ErrorMessages.append(message);
-
- if (message.contains("QV4"))
- ++v4ErrorCount;
-}
-
void tst_v4::qtscript()
{
QFETCH(QString, file);
@@ -121,21 +111,14 @@ void tst_v4::qtscript()
QQmlComponent component(&engine, testFileUrl(file));
- v4ErrorCount = 0;
- v4ErrorMessages.clear();
- QtMessageHandler old = qInstallMessageHandler(v4ErrorsMsgHandler);
+ QQmlTestMessageHandler messageHandler;
QObject *o = component.create();
delete o;
- qInstallMessageHandler(old);
-
- if (v4ErrorCount) {
- foreach (const QString &msg, v4ErrorMessages)
- qDebug() << msg;
- }
QEXPECT_FAIL("jsvalueHandling", "QTBUG-26951 - QJSValue has a different representation of NULL to QV8Engine", Continue);
- QCOMPARE(v4ErrorCount, 0);
+ const int v4ErrorCount = messageHandler.messages().filter(QLatin1String("QV4")).size();
+ QVERIFY2(v4ErrorCount == 0, qPrintable(messageHandler.messageString()));
QV4Compiler::enableBindingsTest(false);
}
@@ -959,12 +942,6 @@ void tst_v4::subscriptions()
}
}
-static QStringList messages;
-static void msgHandler(QtMsgType, const QMessageLogContext &, const QString &msg)
-{
- messages << msg;
-}
-
static QByteArray getAddress(int address)
{
return QByteArray::number(address);
@@ -1108,8 +1085,7 @@ void tst_v4::debuggingDumpInstructions()
expectedPreAddress << "\t\tInitString\t\tString_DataIndex(0) -> String_Slot(0)";
QStringList expected;
- messages = QStringList();
- QtMessageHandler old = qInstallMessageHandler(msgHandler);
+ QQmlTestMessageHandler messageHandler;
QQmlJS::Bytecode bc;
#define DUMP_INSTR_IN_UNIT_TEST(I, FMT) { QQmlJS::V4InstrData<QQmlJS::V4Instr::I> i; memset(&i, 0, sizeof(i)); bc.append(i); }
@@ -1130,15 +1106,15 @@ void tst_v4::debuggingDumpInstructions()
bc.dump(start, end);
// ensure that the output was expected.
- qInstallMessageHandler(old);
- QCOMPARE(messages.count(), expected.count());
- for (int ii = 0; ii < messages.count(); ++ii) {
+ const int messageCount = messageHandler.messages().count();
+ QCOMPARE(messageCount, expected.count());
+ for (int ii = 0; ii < messageCount; ++ii) {
// Calculating the destination address of a null jump/branch instruction is tricky
// so instead we simply don't compare that part of those instructions.
QRegExp ignoreAddress("\\bAddress\\((\\w*)\\)");
ignoreAddress.setMinimal(true);
QString expectOut = expected.at(ii); expectOut.replace(ignoreAddress, "");
- QString actualOut = messages.at(ii); actualOut.replace(ignoreAddress, "");
+ QString actualOut = messageHandler.messages().at(ii); actualOut.replace(ignoreAddress, "");
QCOMPARE(actualOut, expectOut);
}
}
diff --git a/tests/auto/qmltest/animations/tst_abstractanimationjobcrash.qml b/tests/auto/qmltest/animations/tst_abstractanimationjobcrash.qml
new file mode 100644
index 0000000000..466bb160aa
--- /dev/null
+++ b/tests/auto/qmltest/animations/tst_abstractanimationjobcrash.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite 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 Digia Plc 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 QtTest 1.0
+
+Item {
+ Rectangle {
+ id: rect
+
+ property bool finished: false
+
+ Behavior on opacity {
+ NumberAnimation {
+ onRunningChanged: {
+ if (!running) {
+ if (rect.opacity <= 0.1)
+ rect.opacity = 1
+ else
+ rect.finished = true
+ }
+ }
+ }
+ }
+ }
+
+ TestCase {
+ name: "AbstractAnitaionJobCrash"
+
+ function test_noCrash() {
+ rect.opacity = 0
+ while (!rect.finished)
+ wait(100)
+ }
+ }
+}
diff --git a/tests/auto/quick/geometry/tst_geometry.cpp b/tests/auto/quick/geometry/tst_geometry.cpp
index 8bf65d1638..fc5e921db5 100644
--- a/tests/auto/quick/geometry/tst_geometry.cpp
+++ b/tests/auto/quick/geometry/tst_geometry.cpp
@@ -139,9 +139,9 @@ void GeometryTest::testCustomGeometry()
};
static QSGGeometry::Attribute attributes[] = {
- { 0, 2, GL_FLOAT },
- { 1, 4, GL_UNSIGNED_BYTE },
- { 2, 4, GL_FLOAT },
+ { 0, 2, GL_FLOAT, 0, 0},
+ { 1, 4, GL_UNSIGNED_BYTE, 0, 0},
+ { 2, 4, GL_FLOAT, 0, 0},
};
static QSGGeometry::AttributeSet set = { 4, 6 * sizeof(float) + 4 * sizeof(unsigned char), attributes };
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 37d96f4950..dc0db6d4ff 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -292,6 +292,7 @@ private:
}
void releaseView(QQuickView *view) {
Q_ASSERT(view == m_view);
+ Q_UNUSED(view)
m_view->setSource(QUrl());
}
#else
diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
index 38c9bb3d8a..bce1366e52 100644
--- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp
+++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
@@ -661,13 +661,6 @@ void tst_qquickimage::sourceSize_QTBUG_16389()
delete window;
}
-static int numberOfWarnings = 0;
-static void checkWarnings(QtMsgType, const QMessageLogContext &, const QString &msg)
-{
- if (!msg.contains("QGLContext::makeCurrent(): Failed."))
- numberOfWarnings++;
-}
-
// QTBUG-15690
void tst_qquickimage::nullPixmapPaint()
{
@@ -679,12 +672,11 @@ void tst_qquickimage::nullPixmapPaint()
QTRY_VERIFY(image != 0);
image->setSource(SERVER_ADDR + QString("/no-such-file.png"));
- QtMessageHandler previousMsgHandler = qInstallMessageHandler(checkWarnings);
-
+ QQmlTestMessageHandler messageHandler;
// used to print "QTransform::translate with NaN called"
QPixmap pm = QPixmap::fromImage(window->grabWindow());
- qInstallMessageHandler(previousMsgHandler);
- QVERIFY(numberOfWarnings == 0);
+ const QStringList glErrors = messageHandler.messages().filter(QLatin1String("QGLContext::makeCurrent(): Failed."), Qt::CaseInsensitive);
+ QVERIFY2(glErrors.size() == messageHandler.messages().size(), qPrintable(messageHandler.messageString()));
delete image;
delete window;
diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
index 64eb0a7f42..19b547944c 100644
--- a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
+++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
@@ -236,7 +236,7 @@ void tst_qquickimageprovider::runTest(bool async, QQuickImageProvider *provider)
// From this point on, treat forced async providers as async behaviour-wise
if (engine.imageProvider(QUrl(source).host()) == provider)
- async |= provider->flags() & QQuickImageProvider::ForceAsynchronousImageLoading;
+ async |= (provider->flags() & QQuickImageProvider::ForceAsynchronousImageLoading) != 0;
if (async)
QTRY_VERIFY(obj->status() == QQuickImage::Loading);
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index af628dff63..51ce74ef40 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -259,18 +259,10 @@ private:
}
#endif
- static void errorMsgHandler(QtMsgType, const QMessageLogContext &, const QString &)
- {
- ++m_errorCount;
- }
-
QQuickView *m_view;
QString testForView;
- static int m_errorCount;
};
-int tst_QQuickListView::m_errorCount = 0;
-
class TestObject : public QObject
{
Q_OBJECT
@@ -6785,8 +6777,7 @@ void tst_QQuickListView::parentBinding()
{
QQuickView *window = createView();
- m_errorCount = 0;
- QtMessageHandler old = qInstallMessageHandler(errorMsgHandler);
+ QQmlTestMessageHandler messageHandler;
window->setSource(testFileUrl("parentBinding.qml"));
window->show();
@@ -6805,9 +6796,7 @@ void tst_QQuickListView::parentBinding()
QCOMPARE(item->height(), listview->height()/12);
// there should be no transient binding error
- QVERIFY(!m_errorCount);
-
- qInstallMessageHandler(old);
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
delete window;
}
diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
index 698c016f6f..e456297a4e 100644
--- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp
+++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
@@ -462,6 +462,7 @@ void tst_QQuickLoader::networkComponent()
" Component { id: comp; NW.Rect120x60 {} }\n"
" Loader { sourceComponent: comp } }")
, dataDirectory());
+ QTRY_COMPARE(component.status(), QQmlComponent::Ready);
QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
@@ -488,6 +489,7 @@ void tst_QQuickLoader::failNetworkRequest()
QQmlComponent component(&engine);
component.setData(QByteArray("import QtQuick 2.0\nLoader { property int did_load: 123; source: \"" SERVER_ADDR "/IDontExist.qml\"; onLoaded: did_load=456 }"), QUrl(QString(SERVER_ADDR "/dummy.qml")));
+ QTRY_COMPARE(component.status(), QQmlComponent::Ready);
QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
QVERIFY(loader != 0);
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index d6b501c619..76768ee395 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -1285,7 +1285,6 @@ void tst_QQuickMouseArea::pressedMultipleButtons()
QPoint point(10,10);
- int prevButtons = 0;
for (int i = 0; i < buttons.count(); ++i) {
int btns = buttons.at(i);
@@ -1294,8 +1293,6 @@ void tst_QQuickMouseArea::pressedMultipleButtons()
QCOMPARE(mouseArea->pressed(), pressed.at(i));
QCOMPARE(mouseArea->pressedButtons(), pressedButtons.at(i));
-
- prevButtons = buttons.at(i);
}
QTest::mousePress(view, Qt::NoButton, 0, point);
diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
index b9a18eec01..baba59a1aa 100644
--- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
+++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
@@ -1722,111 +1722,109 @@ void tst_qquickpositioners::test_flow_implicit_resize()
delete window;
}
-QString warningMessage;
-
-void interceptWarnings(QtMsgType type, const QMessageLogContext &, const QString &msg)
-{
- Q_UNUSED( type );
- warningMessage = msg;
-}
-
void tst_qquickpositioners::test_conflictinganchors()
{
- QtMessageHandler oldMsgHandler = qInstallMessageHandler(interceptWarnings);
+ QQmlTestMessageHandler messageHandler;
QQmlEngine engine;
QQmlComponent component(&engine);
component.setData("import QtQuick 2.0\nColumn { Item { width: 100; height: 100; } }", QUrl::fromLocalFile(""));
QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QVERIFY(warningMessage.isEmpty());
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
delete item;
component.setData("import QtQuick 2.0\nRow { Item { width: 100; height: 100; } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QVERIFY(warningMessage.isEmpty());
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
delete item;
component.setData("import QtQuick 2.0\nGrid { Item { width: 100; height: 100; } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QVERIFY(warningMessage.isEmpty());
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
delete item;
component.setData("import QtQuick 2.0\nFlow { Item { width: 100; height: 100; } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QVERIFY(warningMessage.isEmpty());
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
delete item;
component.setData("import QtQuick 2.0\nColumn { Item { width: 100; height: 100; anchors.top: parent.top } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function."));
- warningMessage.clear();
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function."));
+ messageHandler.clear();
delete item;
component.setData("import QtQuick 2.0\nColumn { Item { width: 100; height: 100; anchors.centerIn: parent } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function."));
- warningMessage.clear();
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column. Column will not function."));
+ messageHandler.clear();
delete item;
component.setData("import QtQuick 2.0\nColumn { Item { width: 100; height: 100; anchors.left: parent.left } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QVERIFY(warningMessage.isEmpty());
- warningMessage.clear();
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
delete item;
component.setData("import QtQuick 2.0\nRow { Item { width: 100; height: 100; anchors.left: parent.left } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row. Row will not function."));
- warningMessage.clear();
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row. Row will not function."));
+ messageHandler.clear();
delete item;
component.setData("import QtQuick 2.0\nRow { width: 100; height: 100; Item { anchors.fill: parent } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row. Row will not function."));
- warningMessage.clear();
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row. Row will not function."));
+ messageHandler.clear();
delete item;
component.setData("import QtQuick 2.0\nRow { Item { width: 100; height: 100; anchors.top: parent.top } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QVERIFY(warningMessage.isEmpty());
- warningMessage.clear();
+ QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString()));
delete item;
component.setData("import QtQuick 2.0\nGrid { Item { width: 100; height: 100; anchors.horizontalCenter: parent.horizontalCenter } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid. Grid will not function."));
- warningMessage.clear();
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid. Grid will not function."));
+ messageHandler.clear();
delete item;
component.setData("import QtQuick 2.0\nGrid { Item { width: 100; height: 100; anchors.centerIn: parent } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid. Grid will not function."));
- warningMessage.clear();
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid. Grid will not function."));
+ messageHandler.clear();
delete item;
component.setData("import QtQuick 2.0\nFlow { Item { width: 100; height: 100; anchors.verticalCenter: parent.verticalCenter } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow. Flow will not function."));
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow. Flow will not function."));
+ messageHandler.clear();
delete item;
component.setData("import QtQuick 2.0\nFlow { width: 100; height: 100; Item { anchors.fill: parent } }", QUrl::fromLocalFile(""));
item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item);
- QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow. Flow will not function."));
- qInstallMessageHandler(oldMsgHandler);
+ QCOMPARE(messageHandler.messages().size(), 1);
+ QCOMPARE(messageHandler.messages().back(), QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow. Flow will not function."));
delete item;
}
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
index ea2ad71bfc..f8332d661d 100644
--- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
@@ -2139,6 +2139,8 @@ void tst_qquicktextedit::positionAt()
case QQuickTextEdit::AlignRight:
xoff = texteditObject->width() - secondLine.naturalTextWidth();
break;
+ case QQuickTextEdit::AlignJustify:
+ break;
}
int pos = texteditObject->positionAt(texteditObject->width()/2, y0);
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index 7e45bd1f14..6c688eda1b 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -3448,15 +3448,13 @@ public:
void tst_qquicktextinput::setHAlignClearCache()
{
QQuickView view;
+ view.resize(200, 200);
MyTextInput input;
input.setText("Hello world");
input.setParentItem(view.contentItem());
view.show();
view.requestActivate();
QTest::qWaitForWindowActive(&view);
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "QTBUG-23485", Abort);
-#endif
QTRY_COMPARE(input.nbPaint, 1);
input.setHAlign(QQuickTextInput::AlignRight);
//Changing the alignment should trigger a repaint
diff --git a/tests/auto/quick/qquickview/qquickview.pro b/tests/auto/quick/qquickview/qquickview.pro
index 079074c83d..3e9c39e2ce 100644
--- a/tests/auto/quick/qquickview/qquickview.pro
+++ b/tests/auto/quick/qquickview/qquickview.pro
@@ -7,8 +7,6 @@ SOURCES += tst_qquickview.cpp
include (../../shared/util.pri)
-mac:CONFIG += insignificant_test # QTBUG-28505
-
TESTDATA = data/*
QT += core-private gui-private qml-private quick-private testlib
diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp
index 94452b142b..aa20967fa3 100644
--- a/tests/auto/quick/qquickview/tst_qquickview.cpp
+++ b/tests/auto/quick/qquickview/tst_qquickview.cpp
@@ -195,9 +195,8 @@ void tst_QQuickView::errors()
{
QQuickView *view = new QQuickView;
QVERIFY(view);
- QtMessageHandler old = qInstallMessageHandler(silentErrorsMsgHandler);
+ QQmlTestMessageHandler messageHandler;
view->setSource(testFileUrl("error1.qml"));
- qInstallMessageHandler(old);
QVERIFY(view->status() == QQuickView::Error);
QVERIFY(view->errors().count() == 1);
delete view;
diff --git a/tests/auto/shared/util.cpp b/tests/auto/shared/util.cpp
index 57c016a16a..eaefb1f9d6 100644
--- a/tests/auto/shared/util.cpp
+++ b/tests/auto/shared/util.cpp
@@ -46,6 +46,8 @@
#include <QtQml/QQmlContext>
#include <QtQml/QQmlEngine>
#include <QtCore/QTextStream>
+#include <QtCore/QDebug>
+#include <QtCore/QMutexLocker>
QQmlDataTest *QQmlDataTest::m_instance = 0;
@@ -107,3 +109,30 @@ QByteArray QQmlDataTest::msgComponentError(const QQmlComponent &c,
}
return result.toLocal8Bit();
}
+
+Q_GLOBAL_STATIC(QMutex, qQmlTestMessageHandlerMutex)
+
+QQmlTestMessageHandler *QQmlTestMessageHandler::m_instance = 0;
+
+void QQmlTestMessageHandler::messageHandler(QtMsgType, const QMessageLogContext &, const QString &message)
+{
+ QMutexLocker locker(qQmlTestMessageHandlerMutex());
+ if (QQmlTestMessageHandler::m_instance)
+ QQmlTestMessageHandler::m_instance->m_messages.push_back(message);
+}
+
+QQmlTestMessageHandler::QQmlTestMessageHandler()
+{
+ QMutexLocker locker(qQmlTestMessageHandlerMutex());
+ Q_ASSERT(!QQmlTestMessageHandler::m_instance);
+ QQmlTestMessageHandler::m_instance = this;
+ m_oldHandler = qInstallMessageHandler(messageHandler);
+}
+
+QQmlTestMessageHandler::~QQmlTestMessageHandler()
+{
+ QMutexLocker locker(qQmlTestMessageHandlerMutex());
+ Q_ASSERT(QQmlTestMessageHandler::m_instance);
+ qInstallMessageHandler(m_oldHandler);
+ QQmlTestMessageHandler::m_instance = 0;
+}
diff --git a/tests/auto/shared/util.h b/tests/auto/shared/util.h
index 4a5c9176c6..eff54b30d9 100644
--- a/tests/auto/shared/util.h
+++ b/tests/auto/shared/util.h
@@ -45,6 +45,7 @@
#include <QtCore/QDir>
#include <QtCore/QUrl>
#include <QtCore/QCoreApplication>
+#include <QtCore/QStringList>
#include <QtTest/QTest>
QT_FORWARD_DECLARE_CLASS(QQmlComponent)
@@ -87,4 +88,24 @@ private:
QString m_directory;
};
+class QQmlTestMessageHandler
+{
+ Q_DISABLE_COPY(QQmlTestMessageHandler)
+public:
+ QQmlTestMessageHandler();
+ ~QQmlTestMessageHandler();
+
+ const QStringList &messages() const { return m_messages; }
+ const QString messageString() const { return m_messages.join(QLatin1Char('\n')); }
+
+ void clear() { m_messages.clear(); }
+
+private:
+ static void messageHandler(QtMsgType, const QMessageLogContext &, const QString &message);
+
+ static QQmlTestMessageHandler *m_instance;
+ QStringList m_messages;
+ QtMessageHandler m_oldHandler;
+};
+
#endif // QQMLTESTUTILS_H
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index 6a0d04beda..475ddfc3e5 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -345,9 +345,9 @@ static void usage()
{
qWarning("Usage: qmlscene [options] <filename>");
qWarning(" ");
- qWarning(" options:");
- qWarning(" --maximized ............................... run maximized");
- qWarning(" --fullscreen .............................. run fullscreen");
+ qWarning(" Options:");
+ qWarning(" --maximized ............................... Run maximized");
+ qWarning(" --fullscreen .............................. Run fullscreen");
qWarning(" --transparent ............................. Make the window transparent");
qWarning(" --no-multisample .......................... Disable multisampling (anti-aliasing)");
qWarning(" --no-version-detection .................... Do not try to detect the version of the .qml file");
@@ -356,7 +356,7 @@ static void usage()
qWarning(" --quit .................................... Quit immediately after starting");
qWarning(" -I <path> ................................. Add <path> to the list of import paths");
qWarning(" -B <name> <file> .......................... Add a named bundle");
- qWarning(" -translation <translationfile> ........... set the language to run in");
+ qWarning(" -translation <translationfile> ............ Set the language to run in");
qWarning(" ");
exit(1);