summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-11-24 01:39:59 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-11-24 01:39:59 (GMT)
commitc19a55e55996851325cb0ad421af5dc2e8e9164a (patch)
treea35b8954fec090e98817d52b8fa668fb68b671da
parenta7946186fbc56430eeda1fd37b7dbd0852efa893 (diff)
parent3639261fb803c25af17bf8c1563521477da7d1a6 (diff)
downloadQt-c19a55e55996851325cb0ad421af5dc2e8e9164a.zip
Qt-c19a55e55996851325cb0ad421af5dc2e8e9164a.tar.gz
Qt-c19a55e55996851325cb0ad421af5dc2e8e9164a.tar.bz2
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--demos/declarative/twitter/content/AuthView.qml2
-rw-r--r--demos/declarative/webbrowser/webbrowser.qml2
-rw-r--r--doc/src/declarative/animation.qdoc6
-rw-r--r--doc/src/declarative/example-slideswitch.qdoc134
-rw-r--r--doc/src/declarative/examples.qdoc50
-rw-r--r--doc/src/declarative/globalobject.qdoc20
-rw-r--r--doc/src/declarative/qmlintro.qdoc24
-rw-r--r--doc/src/declarative/qmlreference.qdoc16
-rw-r--r--doc/src/declarative/qmlstates.qdoc4
-rw-r--r--doc/src/declarative/qmlviewer.qdoc2
-rw-r--r--doc/src/declarative/qtdeclarative.qdoc32
-rw-r--r--examples/declarative/behaviours/test.qml2
-rw-r--r--examples/declarative/extending/binding/example.qml2
-rw-r--r--examples/declarative/extending/signal/example.qml2
-rw-r--r--examples/declarative/extending/valuesource/example.qml2
-rw-r--r--examples/declarative/focusscope/test.qml10
-rw-r--r--examples/declarative/focusscope/test3.qml4
-rw-r--r--examples/declarative/focusscope/test4.qml10
-rw-r--r--examples/declarative/mouseregion/mouse.qml24
-rw-r--r--examples/declarative/slideswitch/Switch.qml58
-rw-r--r--examples/declarative/slideswitch/content/Switch.qml73
-rw-r--r--examples/declarative/slideswitch/content/background.svg (renamed from examples/declarative/slideswitch/background.svg)0
-rw-r--r--examples/declarative/slideswitch/content/knob.svg (renamed from examples/declarative/slideswitch/knob.svg)0
-rw-r--r--examples/declarative/slideswitch/slideswitch.qml (renamed from examples/declarative/slideswitch/display.qml)5
-rw-r--r--examples/declarative/tutorials/samegame/samegame1/samegame.qml2
-rw-r--r--examples/declarative/xmldata/daringfireball.qml2
-rw-r--r--examples/declarative/xmldata/yahoonews.qml2
-rw-r--r--examples/declarative/xmlhttprequest/test.qml18
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsborderimage.cpp2
-rw-r--r--src/declarative/qml/qmlengine.cpp27
-rw-r--r--src/declarative/qml/qmlengine_p.h1
-rw-r--r--src/declarative/util/qmlpropertychanges.cpp17
-rw-r--r--src/declarative/util/qmlstateoperations.cpp21
-rw-r--r--src/declarative/util/qmlview.cpp4
-rw-r--r--tests/auto/declarative/anchors/data/anchors.qml13
-rw-r--r--tests/auto/declarative/anchors/tst_anchors.cpp13
-rw-r--r--tests/auto/declarative/qmldebug/tst_qmldebug.cpp2
-rw-r--r--tests/auto/declarative/qmlecmascript/data/scriptErrors.qml2
-rw-r--r--tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp2
-rw-r--r--tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp38
-rw-r--r--tests/auto/declarative/qmlgraphicsflickable/data/flickable02.qml2
-rw-r--r--tests/auto/declarative/qmlgraphicsflickable/data/flickable03.qml2
-rw-r--r--tests/auto/declarative/qmlgraphicsflickable/data/flickable04.qml2
-rw-r--r--tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp34
-rw-r--r--tests/auto/declarative/qmlgraphicslistview/data/listview.qml12
-rw-r--r--tests/auto/declarative/qmlgraphicspathview/data/datamodel.qml2
-rw-r--r--tests/auto/declarative/qmlgraphicsrepeater/data/intmodel.qml2
-rw-r--r--tests/auto/declarative/qmlgraphicsrepeater/data/itemlist.qml2
-rw-r--r--tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp4
-rw-r--r--tests/auto/declarative/qmllanguage/data/OnCompletedType.qml2
-rw-r--r--tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt2
-rw-r--r--tests/auto/declarative/qmllanguage/data/defaultGrouped.qml2
-rw-r--r--tests/auto/declarative/qmllanguage/data/doubleSignal.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml2
-rw-r--r--tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml2
-rw-r--r--tests/auto/declarative/qmllanguage/data/missingSignal.qml2
-rw-r--r--tests/auto/declarative/qmllanguage/data/onCompleted.qml4
-rw-r--r--tests/auto/declarative/qmllanguage/data/scriptString.qml2
-rw-r--r--tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp4
-rw-r--r--tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp4
-rw-r--r--tests/auto/declarative/qmlqt/data/consoleLog.qml8
-rw-r--r--tests/auto/declarative/qmlqt/tst_qmlqt.cpp11
-rw-r--r--tests/auto/declarative/shared/debugutil.cpp9
-rw-r--r--tests/auto/declarative/shared/debugutil_p.h3
-rw-r--r--tests/auto/declarative/valuetypes/data/deletedObject.js4
-rw-r--r--tests/auto/declarative/visual/focusscope/test.qml10
-rw-r--r--tests/auto/declarative/visual/focusscope/test3.qml4
-rw-r--r--tests/auto/declarative/visual/webview/zooming/zooming.qml4
68 files changed, 523 insertions, 272 deletions
diff --git a/demos/declarative/twitter/content/AuthView.qml b/demos/declarative/twitter/content/AuthView.qml
index c924649..8fb00f8 100644
--- a/demos/declarative/twitter/content/AuthView.qml
+++ b/demos/declarative/twitter/content/AuthView.qml
@@ -30,7 +30,7 @@ Item {
Item {
id: tabber
//Note: it's not working yet
- Keys.onPressed: {if(event.key == Qt.Key_Tab){print('Tab works!'); passIn.focus = true; accept(); }}
+ Keys.onPressed: {if(event.key == Qt.Key_Tab){console.log('Tab works!'); passIn.focus = true; accept(); }}
}
}
}
diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml
index 345c9af..bfc0749 100644
--- a/demos/declarative/webbrowser/webbrowser.qml
+++ b/demos/declarative/webbrowser/webbrowser.qml
@@ -196,7 +196,7 @@ Item {
fillColor: "white"
focus: true
- onAlert: print(message)
+ onAlert: console.log(message)
function doZoom(zoom,centerX,centerY)
{
diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc
index 1314493..d05a444 100644
--- a/doc/src/declarative/animation.qdoc
+++ b/doc/src/declarative/animation.qdoc
@@ -186,7 +186,7 @@ Transition {
}
\endcode
-To insert an explicit animation into your transition, you can use \target and \property as normal.
+To insert an explicit animation into your transition, you can use \c target and \c property as normal.
\code
Transition {
@@ -214,8 +214,8 @@ Transition {
\section1 Property Behaviors
-A property behavior specifies a default animation to run whenever the property's value changes, regardless
-of what caused the change. Unlike Transition, Behavior doesn't provide a way to indicate that a Behavior
+A \l{Behavior}{property behavior} specifies a default animation to run whenever the property's value changes, regardless
+of what caused the change. Unlike Transition, \l Behavior doesn't provide a way to indicate that a Behavior
should only apply under certain circumstances.
In the following snippet, we specify that we want the x position of redRect to be animated
diff --git a/doc/src/declarative/example-slideswitch.qdoc b/doc/src/declarative/example-slideswitch.qdoc
new file mode 100644
index 0000000..c942918
--- /dev/null
+++ b/doc/src/declarative/example-slideswitch.qdoc
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qmlexampletoggleswitch.html
+\title QML Example - Toggle Switch
+
+This example shows how to create a reusable switch component in QML.
+
+The code for this example can be found in the \c $QTDIR/examples/declarative/slideswitch directory.
+
+\section1 Overview
+
+The elements that composed the switch are:
+
+\list
+\o a \c on property (the interface to interact with the switch),
+\o two images (the background image and the knob),
+\o two mouse regions for user interation (on the background image and on the knob),
+\o two states (a \e on state and a \e off state),
+\o two functions or slots to react to the user interation (\c toggle() and \c dorelease()),
+\o and a transition that describe how to go from one state to the other.
+\endlist
+
+\section1 Switch.qml
+\snippet examples/declarative/slideswitch/content/Switch.qml 0
+
+\section1 Walkthrough
+
+\section2 Interface
+\snippet examples/declarative/slideswitch/content/Switch.qml 1
+
+This property is the interface of the switch. By default, the switch is off and this property is \c false.
+It can be used to activate/disactivate the switch or to query its current state.
+
+In this example:
+
+\qml
+Switch { id: mySwitch; on: true }
+Text { text: "The switch is on"; visible: mySwitch.on == true }
+\endqml
+
+the text will only be visible when the switch is on.
+
+\section2 Images and user interaction
+\snippet examples/declarative/slideswitch/content/Switch.qml 4
+
+First, we create the background image of the switch.
+In order for the switch to toggle when the user clicks on the background, we add a \l{MouseRegion} as a child item of the image.
+A \c MouseRegion has a \c onClicked property that is triggered when the item is clicked. For the moment we will just call a
+\c toggle() function. We will see what this function does in a moment.
+
+\snippet examples/declarative/slideswitch/content/Switch.qml 5
+
+Then, we place the image of the knob on top of the background.
+The interaction here is a little more complex. We want the knob to move with the finger when it is clicked. That is what the \c drag
+property of the \c MouseRegion is for. We also want to toggle the switch if the knob is released between state. We handle this case
+in the \c dorelease() function that is called in the \c onReleased property.
+
+\section2 States
+\snippet examples/declarative/slideswitch/content/Switch.qml 6
+
+We define the two states of the switch:
+\list
+\o In the \e on state the knob is on the right (\c x position is 78) and the \c on property is \c true.
+\o In the \e off state the knob is on the left (\c x position is 1) and the \c on property is \c false.
+\endlist
+
+For more information on states see \l{qmlstates}{QML States}.
+
+\section2 Functions
+
+We add two ECMAScript functions to our switch:
+
+\snippet examples/declarative/slideswitch/content/Switch.qml 2
+
+This first function is called when the background image or the knob are clicked. We simply want the switch to toggle between the two
+states (\e on and \e off).
+
+
+\snippet examples/declarative/slideswitch/content/Switch.qml 3
+
+This second function is called when the knob is released and we want to make sure that the knob does not end up between states
+(neither \e on nor \e off). If it is the case call the \c toggle() function otherwise we do nothing.
+
+For more information on scripts see \l{qmlecmascript.html}{ECMAScript Blocks}.
+
+\section2 Transition
+\snippet examples/declarative/slideswitch/content/Switch.qml 7
+
+At this point, when the switch toggles between the two states the knob will instantly change its \c x position between 1 and 78.
+In order for the the knob to move smoothly we add a transistion that will animate the \c x property with an easing curve for a duration of 200ms.
+
+For more information on transitions see \l{state-transitions}{QML Transitions}.
+
+*/
diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc
index 9d66089..7950f66 100644
--- a/doc/src/declarative/examples.qdoc
+++ b/doc/src/declarative/examples.qdoc
@@ -65,47 +65,25 @@ or
Many other simple examples can be found under the \c examples/declarative sub
directory. Some can be run directly using the viewer like those above, and
-others require you to build and run an executable. More sophisticated demos of
-large applications can be found under the \c demos/declarative sub directory.
-These are intended to show more integrated functionality rather than to be
+others require you to build and run an executable. More sophisticated demos of
+large applications can be found under the \c demos/declarative sub directory.
+These are intended to show more integrated functionality rather than to be
instructive on specific elements.
\section1 Examples
These will be documented, and demonstrate how to achieve various things in QML.
-\raw HTML
-<center>
-<table cellspacing="10">
-<tr>
-<td>
-\endraw
-\image dial-example.gif
-\raw HTML
-</td>
-<td>
-\endraw
-\image switch-example.gif
-\raw HTML
-</td>
-<td>
-\endraw
-\image declarative-adv-tutorial4.gif
-\raw HTML
-</td>
-</tr>
-<tr>
-<td>
-<center>Elastic Dial</center>
-</td>
-<td>
-<center>Touch Toggle Switch</center>
-</td>
-<td>
-<center>Samegame</center>
-</td>
-</table>
-</center>
-\endraw
+\table
+\row
+ \o Elastic Dial
+ \o \image dial-example.gif
+\row
+ \o \l{qmlexampletoggleswitch.html}{Toggle Switch}
+ \o \image switch-example.gif
+\row
+ \o \l{Advanced Tutorial}{SameGame}
+ \o \image declarative-adv-tutorial4.gif
+\endtable
*/
diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc
index e983ad0..e3c8b9a 100644
--- a/doc/src/declarative/globalobject.qdoc
+++ b/doc/src/declarative/globalobject.qdoc
@@ -64,7 +64,7 @@ files.
The Qt object contains all enums in the Qt namespace. For example, you can
access the AlignLeft member of the Qt::AlignmentFlag enum with \c Qt.AlignLeft.
-For a full list of enums, see the Qt Namespace documentation.
+For a full list of enums, see the \l{Qt Namespace} documentation.
\section2 Types
The Qt object also contains helper functions for creating objects of specific
@@ -88,20 +88,20 @@ This function returns a Color with the specified \c red, \c green, \c blue and \
This function returns a Color with the specified \c hue, \c saturation, \c lightness and \c alpha components. All components should be in the range 0-1 inclusive.
\section3 Qt.rect(int x, int y, int width, int height)
-This function returns a Rect with the top-left corner at \c x,\c y and the specified \c width and \c height.
+This function returns a Rect with the top-left corner at \c x, \c y and the specified \c width and \c height.
\section3 Qt.point(int x, int y)
This function returns a Point with the specified \c x and \c y coordinates.
\section3 Qt.size(int width, int height)
-This function returns as Size with the specified width and height.
+This function returns as Size with the specified \c width and \c height.
\section3 Qt.vector3d(real x, real y, real z)
-This function returns a Vector3D with the specified x, y and z.
+This function returns a Vector3D with the specified \c x, \c y and \c z.
\section2 Functions
The Qt object also contains the following miscellaneous functions which expose Qt functionality for use in QML.
\section3 Qt.lighter(color baseColor)
This function returns a color 50% lighter than \c baseColor. See QColor::lighter() for further details.
\section3 Qt.darker(color baseColor)
-This function returns a color 50% darker than \c baseColor. See QColor::lighter() for further details.
+This function returns a color 50% darker than \c baseColor. See QColor::darker() for further details.
\section3 Qt.tint(color baseColor, color tintColor)
This function allows tinting one color with another.
@@ -117,6 +117,16 @@ This function returns a color 50% darker than \c baseColor. See QColor::lighter(
\section3 Qt.closestAngle(number fromAngle, number toAngle)
This function returns an equivalent angle to toAngle, such that the difference between fromAngle and toAngle is never more than 180 degrees. This is useful when animating angles using a NumberAnimation, which does not know about equivalent angles, when you always want to take the shortest path.
+For example, the following would rotate myItem counterclockwise from 350 degrees to 10 degrees, for a total of 340 degrees of rotation.
+\qml
+NumberAnimation { target: myItem; property: "rotation"; from: 350; to: 10 }
+\endqml
+
+while the following would rotate myItem clockwise from 350 degrees to 370 degrees (which is visually equivilant to 10 degrees), for a total of 20 degrees of rotation.
+\qml
+NumberAnimation { target: myItem; property: "rotation"; from: 350; to: Qt.closetAngle(350, 10) }
+\endqml
+
\section3 Qt.playSound(url soundLocation)
This function plays the audio file located at \c soundLocation. Only .wav files are supported.
diff --git a/doc/src/declarative/qmlintro.qdoc b/doc/src/declarative/qmlintro.qdoc
index f84d614..ab9416b 100644
--- a/doc/src/declarative/qmlintro.qdoc
+++ b/doc/src/declarative/qmlintro.qdoc
@@ -239,8 +239,8 @@ Image {
\section2 Default properties
-Each object type can specify one of its list properties as its default property.
-If a list property has been declared as the default property, the property tag can be omitted.
+Each object type can specify one of its list or object properties as its default property.
+If a property has been declared as the default property, the property tag can be omitted.
For example this code:
\code
@@ -263,9 +263,27 @@ State {
because \c changes is the default property of the \c State type.
-\section2 Dot Properties
+\section2 Grouped Properties
+In some cases properties form a logical group and use a 'dot' or grouped notation
+to show this.
+Grouped properties can be written like this:
+\qml
+Text {
+ font.pixelSize: 12
+ font.bold: true
+}
+\endqml
+
+or like this:
+\qml
+Text {
+ font { pixelSize: 12; bold: true }
+}
+\endqml
+
+In the element documentation grouped properties are shown using the 'dot' notation.
\section2 Attached Properties
\target attached-properties
diff --git a/doc/src/declarative/qmlreference.qdoc b/doc/src/declarative/qmlreference.qdoc
index f17e9d7..2c79aeb 100644
--- a/doc/src/declarative/qmlreference.qdoc
+++ b/doc/src/declarative/qmlreference.qdoc
@@ -45,16 +45,22 @@
\target qtdeclarativemainpage
- QML is a language for building highly dynamic and fluid applications. It is targetted at the sorts of user
- interface (and the sorts of hardware) in embedded devices such as phones, media
- players, and set-top boxes. It is also appropriate for highly custom desktop
+ QML is a language for building the animation rich,
+ highly fluid user interfaces that are becoming common in portable consumer
+ electronics devices such as mobile phones, media players, set-top boxes and
+ netbooks. It is also appropriate for highly custom desktop
user interfaces, or special elements in more traditional desktop user interfaces.
Building fluid applications is done declaratively, rather than procedurally.
That is, you specify \e what the UI should look like and how it should behave
rather than specifying step-by-step \e how to build it. Specifying a UI declaratively
does not just include the layout of the interface items, but also the way each
- individual item looks and behaves and the overall flow of the application.
+ individual item looks and behaves and the overall flow of the application.
+
+ The QML elements provide a sophisticated set of graphical and behavioral building
+ blocks. These different elements are combined together in \l {QML Documents}{QML documents} to build components
+ ranging in complexity from simple buttons and sliders, to complete
+ internet-enabled applications like a \l {http://www.flickr.com}{Flickr} photo browser.
Getting Started:
\list
@@ -69,6 +75,7 @@
\o \l {QML Documents}
\o \l {Property Binding}
\o \l {ECMAScript Blocks}
+ \o \l {QML Scope}
\o \l {Network Transparency}
\o \l {qmlmodels}{Data Models}
\o \l {anchor-layout}{Anchor-based Layout}
@@ -82,5 +89,6 @@
QML Reference:
\list
\o \l {elements}{QML Elements}
+ \o \l {QML Global Object}
\endlist
*/
diff --git a/doc/src/declarative/qmlstates.qdoc b/doc/src/declarative/qmlstates.qdoc
index 261e3f5..ddb0fc8 100644
--- a/doc/src/declarative/qmlstates.qdoc
+++ b/doc/src/declarative/qmlstates.qdoc
@@ -3,7 +3,7 @@
\target qmlstates
\title QML States
-QML states describe user interface configurations, including:
+QML states typically describe user interface configurations, including:
\list
\o What UI elements are present
\o The properties of those elements (including how they behave)
@@ -52,7 +52,7 @@ To animate state changes, you can use \l{state-transitions}{transitions}.
Other things you can do in a state change:
\list
\o override signal handlers with PropertyChanges
-\o change an item's parent with ParentChange
+\o change an item's visual parent with ParentChange
\o change an item's anchors with AnchorChanges
\o run some script with StateChangeScript
\endlist
diff --git a/doc/src/declarative/qmlviewer.qdoc b/doc/src/declarative/qmlviewer.qdoc
index f153df2..df96535 100644
--- a/doc/src/declarative/qmlviewer.qdoc
+++ b/doc/src/declarative/qmlviewer.qdoc
@@ -71,7 +71,7 @@
that is a qreal from 0 to 86400 representing the number of seconds since
midnight, dummy data for this could be provided by \c dummydata/clock.qml:
\code
- Object { property real time: 12345 }
+ QtObject { property real time: 12345 }
\endcode
Any QML can be used in the dummy data files. You could even animate the
fictional data!
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index ea8e198..e46cbab 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -45,29 +45,29 @@
\ingroup modules
\brief The Qt Declarative module provides a declarative framework for building
-highly dynamic, custom UIs
+highly dynamic, custom user interfaces.
-Qt Declarative aids programmers and designers in building the animation rich,
-highly fluid user interfaces that are becoming common in portable consumer
-electronics devices, such as mobile phones, media players, set-top boxes and
-netbooks. The Qt Declarative module provides an engine for interpreting the
-declarative QML language, and a rich set of \l {QML Elements} that can be used
+Qt Declarative aids programmers and designers in building the animation rich,
+highly fluid user interfaces that are becoming common in portable consumer
+electronics devices, such as mobile phones, media players, set-top boxes and
+netbooks. The Qt Declarative module provides an engine for interpreting the
+declarative QML language, and a rich set of \l {QML Elements}{QML elements} that can be used
from QML.
QML is an extension to \l {http://www.ecma-international.org/publications/standards/Ecma-262.htm}
-{ECMAScript}, that provides a mechanism to declaratively build an object tree
-of \l {QML Elements}. QML improves the integration between ECMAScript and Qt's
-existing QObject based type system, adds support for automatic
-\l {Property Binding}s and provides \l {Network Transparency} at the language
+{ECMAScript}, that provides a mechanism to declaratively build an object tree
+of QML elements. QML improves the integration between ECMAScript and Qt's
+existing QObject based type system, adds support for automatic
+\l {Property Binding}{property bindings} and provides \l {Network Transparency}{network transparency} at the language
level.
-The \l {QML Elements} are a sophisticated set of graphical and behavioral building
-blocks. \l {QML Elements} are combined together in \l {QML Documents} to build components
-ranging in complexity from simple pushbuttons and sliders, to complete
-internet-enabled applications like a \l {http://www.flickr.com}{flickr} photo browser.
+The QML elements are a sophisticated set of graphical and behavioral building
+blocks. These different elements are combined together in \l {QML Documents}{QML documents} to build components
+ranging in complexity from simple buttons and sliders, to complete
+internet-enabled applications like a \l {http://www.flickr.com}{Flickr} photo browser.
Qt Declarative builds on \l {QML for Qt programmers}{Qt's existing strengths}.
-QML can be be used to incrementally extend an existing application or to build
+QML can be be used to incrementally extend an existing application or to build
completely new applications. QML is fully \l {Extending QML}{extensible from C++}.
\section1 Getting Started:
@@ -76,7 +76,7 @@ completely new applications. QML is fully \l {Extending QML}{extensible from C+
\o \l {Tutorial}{Tutorial: 'Hello World'}
\o \l {advtutorial.html}{Tutorial: 'Same Game'}
\o \l {QML Examples and Walkthroughs}
-\o \l {Using QML in C++ Applications}
+\o \l {Using QML in C++ Applications}
\endlist
\section1 Core QML Features:
diff --git a/examples/declarative/behaviours/test.qml b/examples/declarative/behaviours/test.qml
index 4a44fd7..1869c45 100644
--- a/examples/declarative/behaviours/test.qml
+++ b/examples/declarative/behaviours/test.qml
@@ -7,7 +7,7 @@ Rectangle {
id: page
MouseRegion {
anchors.fill: parent
- onClicked: { bluerect.parent = page; print(mouseX); bluerect.x = mouseX; }
+ onClicked: { bluerect.parent = page; console.log(mouseX); bluerect.x = mouseX; }
}
MyRect {
color: "green"
diff --git a/examples/declarative/extending/binding/example.qml b/examples/declarative/extending/binding/example.qml
index 352bb70..b66bc86 100644
--- a/examples/declarative/extending/binding/example.qml
+++ b/examples/declarative/extending/binding/example.qml
@@ -11,7 +11,7 @@ BirthdayParty {
shoe { size: 12; color: "white"; brand: "Nike"; price: 90.0 }
}
// ![0]
- onPartyStarted: print("This party started rockin' at " + time);
+ onPartyStarted: console.log("This party started rockin' at " + time);
Boy {
diff --git a/examples/declarative/extending/signal/example.qml b/examples/declarative/extending/signal/example.qml
index e46bf32..c7d4792 100644
--- a/examples/declarative/extending/signal/example.qml
+++ b/examples/declarative/extending/signal/example.qml
@@ -2,7 +2,7 @@ import People 1.0
// ![0]
BirthdayParty {
- onPartyStarted: print("This party started rockin' at " + time);
+ onPartyStarted: console.log("This party started rockin' at " + time);
// ![0]
celebrant: Boy {
diff --git a/examples/declarative/extending/valuesource/example.qml b/examples/declarative/extending/valuesource/example.qml
index 6d47350..7cdf8c0 100644
--- a/examples/declarative/extending/valuesource/example.qml
+++ b/examples/declarative/extending/valuesource/example.qml
@@ -5,7 +5,7 @@ BirthdayParty {
speaker: HappyBirthday { name: "Bob Jones" }
// ![0]
- onPartyStarted: print("This party started rockin' at " + time);
+ onPartyStarted: console.log("This party started rockin' at " + time);
celebrant: Boy {
diff --git a/examples/declarative/focusscope/test.qml b/examples/declarative/focusscope/test.qml
index ab5a143..e4332e7 100644
--- a/examples/declarative/focusscope/test.qml
+++ b/examples/declarative/focusscope/test.qml
@@ -5,13 +5,13 @@ Rectangle {
width: 800
height: 600
- Keys.onDigit9Pressed: print("Error - Root")
+ Keys.onDigit9Pressed: console.log("Error - Root")
FocusScope {
id: myScope
focus: true
- Keys.onDigit9Pressed: print("Error - FocusScope")
+ Keys.onDigit9Pressed: console.log("Error - FocusScope")
Rectangle {
height: 120
@@ -27,7 +27,7 @@ Rectangle {
width: 100; height: 100; color: "green"
border.width: 5
border.color: wantsFocus?"blue":"black"
- Keys.onDigit9Pressed: print("Top Left");
+ Keys.onDigit9Pressed: console.log("Top Left");
KeyNavigation.right: item2
focus: true
@@ -44,7 +44,7 @@ Rectangle {
border.width: 5
border.color: wantsFocus?"blue":"black"
KeyNavigation.left: item1
- Keys.onDigit9Pressed: print("Top Right");
+ Keys.onDigit9Pressed: console.log("Top Right");
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
@@ -64,7 +64,7 @@ Rectangle {
border.width: 5
border.color: wantsFocus?"blue":"black"
- Keys.onDigit9Pressed: print("Bottom Left");
+ Keys.onDigit9Pressed: console.log("Bottom Left");
KeyNavigation.up: myScope
Rectangle {
diff --git a/examples/declarative/focusscope/test3.qml b/examples/declarative/focusscope/test3.qml
index 1b3181b..9344d07 100644
--- a/examples/declarative/focusscope/test3.qml
+++ b/examples/declarative/focusscope/test3.qml
@@ -23,10 +23,10 @@ Rectangle {
FocusScope {
id: root
width: 50; height: 50;
- Keys.onDigit9Pressed: print("Error - " + name)
+ Keys.onDigit9Pressed: console.log("Error - " + name)
Rectangle {
focus: true
- Keys.onDigit9Pressed: print(name)
+ Keys.onDigit9Pressed: console.log(name)
width: 50; height: 50;
color: root.ListView.isCurrentItem?"red":"green"
Text { text: name; anchors.centerIn: parent }
diff --git a/examples/declarative/focusscope/test4.qml b/examples/declarative/focusscope/test4.qml
index 5d4fe35..cc96df9 100644
--- a/examples/declarative/focusscope/test4.qml
+++ b/examples/declarative/focusscope/test4.qml
@@ -5,12 +5,12 @@ Rectangle {
width: 800
height: 600
- Keys.onDigit9Pressed: print("Error - Root")
+ Keys.onDigit9Pressed: console.log("Error - Root")
FocusScope {
id: myScope
- Keys.onDigit9Pressed: print("Error - FocusScope")
+ Keys.onDigit9Pressed: console.log("Error - FocusScope")
Rectangle {
height: 120
@@ -26,7 +26,7 @@ Rectangle {
width: 100; height: 100; color: "green"
border.width: 5
border.color: wantsFocus?"blue":"black"
- Keys.onDigit9Pressed: print("Error - Top Left");
+ Keys.onDigit9Pressed: console.log("Error - Top Left");
KeyNavigation.right: item2
focus: true
@@ -43,7 +43,7 @@ Rectangle {
border.width: 5
border.color: wantsFocus?"blue":"black"
KeyNavigation.left: item1
- Keys.onDigit9Pressed: print("Error - Top Right");
+ Keys.onDigit9Pressed: console.log("Error - Top Right");
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
@@ -63,7 +63,7 @@ Rectangle {
border.width: 5
border.color: wantsFocus?"blue":"black"
- Keys.onDigit9Pressed: print("Error - Bottom Left");
+ Keys.onDigit9Pressed: console.log("Error - Bottom Left");
KeyNavigation.up: myScope
Rectangle {
diff --git a/examples/declarative/mouseregion/mouse.qml b/examples/declarative/mouseregion/mouse.qml
index 91f3b6e..d07d471 100644
--- a/examples/declarative/mouseregion/mouse.qml
+++ b/examples/declarative/mouseregion/mouse.qml
@@ -10,13 +10,13 @@ Rectangle {
MouseRegion {
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
- onPressed: { print('press (x: ' + mouse.x + ' y: ' + mouse.y + ' button: ' + (mouse.button == Qt.RightButton ? 'right' : 'left') + ' Shift: ' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')') }
- onReleased: { print('release (x: ' + mouse.x + ' y: ' + mouse.y + ' isClick: ' + mouse.isClick + ' wasHeld: ' + mouse.wasHeld + ')') }
- onClicked: { print('click (x: ' + mouse.x + ' y: ' + mouse.y + ' wasHeld: ' + mouse.wasHeld + ')') }
- onDoubleClicked: { print('double click (x: ' + mouse.x + ' y: ' + mouse.y + ')') }
- onPressAndHold: { print('press and hold') }
- onEntered: { print('entered ' + pressed) }
- onExited: { print('exited ' + pressed) }
+ onPressed: { console.log('press (x: ' + mouse.x + ' y: ' + mouse.y + ' button: ' + (mouse.button == Qt.RightButton ? 'right' : 'left') + ' Shift: ' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')') }
+ onReleased: { console.log('release (x: ' + mouse.x + ' y: ' + mouse.y + ' isClick: ' + mouse.isClick + ' wasHeld: ' + mouse.wasHeld + ')') }
+ onClicked: { console.log('click (x: ' + mouse.x + ' y: ' + mouse.y + ' wasHeld: ' + mouse.wasHeld + ')') }
+ onDoubleClicked: { console.log('double click (x: ' + mouse.x + ' y: ' + mouse.y + ')') }
+ onPressAndHold: { console.log('press and hold') }
+ onEntered: { console.log('entered ' + pressed) }
+ onExited: { console.log('exited ' + pressed) }
anchors.fill: parent
}
}
@@ -29,11 +29,11 @@ Rectangle {
drag.axis: "XAxis"
drag.minimumX: 0
drag.maximumX: 150
- onPressed: { print('press') }
- onReleased: { print('release (isClick: ' + mouse.isClick + ') (wasHeld: ' + mouse.wasHeld + ')') }
- onClicked: { print('click' + '(wasHeld: ' + mouse.wasHeld + ')') }
- onDoubleClicked: { print('double click') }
- onPressAndHold: { print('press and hold') }
+ onPressed: { console.log('press') }
+ onReleased: { console.log('release (isClick: ' + mouse.isClick + ') (wasHeld: ' + mouse.wasHeld + ')') }
+ onClicked: { console.log('click' + '(wasHeld: ' + mouse.wasHeld + ')') }
+ onDoubleClicked: { console.log('double click') }
+ onPressAndHold: { console.log('press and hold') }
anchors.fill: parent
}
}
diff --git a/examples/declarative/slideswitch/Switch.qml b/examples/declarative/slideswitch/Switch.qml
deleted file mode 100644
index 4e13976..0000000
--- a/examples/declarative/slideswitch/Switch.qml
+++ /dev/null
@@ -1,58 +0,0 @@
-import Qt 4.6
-
-Item {
- id: mySwitch
- width: groove.width; height: groove.height
-
- property var on
-
- Script {
-
- function toggle() {
- if(mySwitch.state == "On")
- mySwitch.state = "Off";
- else
- mySwitch.state = "On";
- }
- function dorelease() {
- if(knob.x == 1) {
- if(mySwitch.state == "Off")
- return;
- }
-
- if(knob.x == 78) {
- if(mySwitch.state == "On")
- return;
- }
-
- toggle();
- }
-
- }
- Image { id: groove; source: "background.svg" }
- MouseRegion { anchors.fill: groove; onClicked: { toggle() } }
- Image { id: knob; source: "knob.svg"; x: 1; y: 2 }
- MouseRegion {
- anchors.fill: knob
- onClicked: { toggle() }
- onReleased: { dorelease() }
- drag.target: knob; drag.axis: "XAxis"; drag.minimumX: 1; drag.maximumX: 78
- }
- states: [
- State {
- name: "On"
- PropertyChanges { target: knob; x: 78 }
- PropertyChanges { target: mySwitch; on: true }
- },
- State {
- name: "Off"
- PropertyChanges { target: knob; x: 1 }
- PropertyChanges { target: mySwitch; on: false }
- }
- ]
- transitions: [
- Transition {
- NumberAnimation { matchProperties: "x"; easing: "easeInOutQuad"; duration: 200 }
- }
- ]
-}
diff --git a/examples/declarative/slideswitch/content/Switch.qml b/examples/declarative/slideswitch/content/Switch.qml
new file mode 100644
index 0000000..29a62f7
--- /dev/null
+++ b/examples/declarative/slideswitch/content/Switch.qml
@@ -0,0 +1,73 @@
+//![0]
+import Qt 4.6
+
+Item {
+ id: toggleswitch
+ width: background.width; height: background.height
+
+//![1]
+ property bool on: false
+//![1]
+
+//![2]
+ function toggle() {
+ if (toggleswitch.state == "on")
+ toggleswitch.state = "off";
+ else toggleswitch.state = "on";
+ }
+//![2]
+
+//![3]
+ function dorelease() {
+ if (knob.x == 1) {
+ if (toggleswitch.state == "off") return;
+ }
+ if (knob.x == 78) {
+ if (toggleswitch.state == "on") return;
+ }
+ toggle();
+ }
+//![3]
+
+//![4]
+ Image {
+ id: background; source: "background.svg"
+ MouseRegion { anchors.fill: parent; onClicked: toggle() }
+ }
+//![4]
+
+//![5]
+ Image {
+ id: knob; source: "knob.svg"; x: 1; y: 2
+
+ MouseRegion {
+ anchors.fill: parent
+ drag.target: knob; drag.axis: "XAxis"; drag.minimumX: 1; drag.maximumX: 78
+ onClicked: toggle()
+ onReleased: dorelease()
+ }
+ }
+//![5]
+
+//![6]
+ states: [
+ State {
+ name: "on"
+ PropertyChanges { target: knob; x: 78 }
+ PropertyChanges { target: toggleswitch; on: true }
+ },
+ State {
+ name: "off"
+ PropertyChanges { target: knob; x: 1 }
+ PropertyChanges { target: toggleswitch; on: false }
+ }
+ ]
+//![6]
+
+//![7]
+ transitions: Transition {
+ NumberAnimation { matchProperties: "x"; easing: "easeInOutQuad"; duration: 200 }
+ }
+//![7]
+}
+//![0]
diff --git a/examples/declarative/slideswitch/background.svg b/examples/declarative/slideswitch/content/background.svg
index f920d3e..f920d3e 100644
--- a/examples/declarative/slideswitch/background.svg
+++ b/examples/declarative/slideswitch/content/background.svg
diff --git a/examples/declarative/slideswitch/knob.svg b/examples/declarative/slideswitch/content/knob.svg
index fb69337..fb69337 100644
--- a/examples/declarative/slideswitch/knob.svg
+++ b/examples/declarative/slideswitch/content/knob.svg
diff --git a/examples/declarative/slideswitch/display.qml b/examples/declarative/slideswitch/slideswitch.qml
index 346ffb1..9b46cd1 100644
--- a/examples/declarative/slideswitch/display.qml
+++ b/examples/declarative/slideswitch/slideswitch.qml
@@ -1,9 +1,10 @@
import Qt 4.6
+import "content"
Rectangle {
color: "white"
- width: 150
- height: 150
+ width: 400; height: 250
+
Switch {
anchors.centerIn: parent
}
diff --git a/examples/declarative/tutorials/samegame/samegame1/samegame.qml b/examples/declarative/tutorials/samegame/samegame1/samegame.qml
index 289579a..fad2175 100644
--- a/examples/declarative/tutorials/samegame/samegame1/samegame.qml
+++ b/examples/declarative/tutorials/samegame/samegame1/samegame.qml
@@ -24,7 +24,7 @@ Rectangle {
anchors.bottom: Screen.bottom
Button {
- id: btnA; text: "New Game"; onClicked: print("Implement me!");
+ id: btnA; text: "New Game"; onClicked: console.log("Implement me!");
anchors.left: parent.left; anchors.leftMargin: 3
anchors.verticalCenter: parent.verticalCenter
}
diff --git a/examples/declarative/xmldata/daringfireball.qml b/examples/declarative/xmldata/daringfireball.qml
index 938bdd5..456f309 100644
--- a/examples/declarative/xmldata/daringfireball.qml
+++ b/examples/declarative/xmldata/daringfireball.qml
@@ -33,7 +33,7 @@ Rectangle {
text: content
anchors.top: titleText.bottom
width: 580; wrap: true
- onLinkActivated: { print('link clicked: ' + link) }
+ onLinkActivated: { console.log('link clicked: ' + link) }
}
}
}
diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml
index 4add361..bd14516 100644
--- a/examples/declarative/xmldata/yahoonews.qml
+++ b/examples/declarative/xmldata/yahoonews.qml
@@ -37,7 +37,7 @@ Rectangle {
x: 10; y: 5
text: '<a href=\'' + link + '\'>' + title + '</a>'
font.bold: true; font.family: "Helvetica"; font.pointSize: 14
- onLinkActivated: { print('link clicked: ' + link) }
+ onLinkActivated: { console.log('link clicked: ' + link) }
}
Text {
diff --git a/examples/declarative/xmlhttprequest/test.qml b/examples/declarative/xmlhttprequest/test.qml
index 18447e5..18e328b 100644
--- a/examples/declarative/xmlhttprequest/test.qml
+++ b/examples/declarative/xmlhttprequest/test.qml
@@ -10,21 +10,21 @@ Rectangle {
var doc = new XMLHttpRequest();
doc.onreadystatechange = function() {
if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
- print ("Headers -->");
- print (doc.getAllResponseHeaders ());
- print ("Last modified -->");
- print (doc.getResponseHeader ("Last-Modified"));
+ console.log("Headers -->");
+ console.log(doc.getAllResponseHeaders ());
+ console.log("Last modified -->");
+ console.log(doc.getResponseHeader ("Last-Modified"));
}
else if (doc.readyState == XMLHttpRequest.DONE) {
var a = doc.responseXML.documentElement;
for (var ii = 0; ii < a.childNodes.length; ++ii) {
- print (a.childNodes[ii].nodeName);
+ console.log(a.childNodes[ii].nodeName);
}
- print ("Headers -->");
- print (doc.getAllResponseHeaders ());
- print ("Last modified -->");
- print (doc.getResponseHeader ("Last-Modified"));
+ console.log("Headers -->");
+ console.log(doc.getAllResponseHeaders ());
+ console.log("Last modified -->");
+ console.log(doc.getResponseHeader ("Last-Modified"));
}
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
index 6f953bc..d7d725b 100644
--- a/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsborderimage.cpp
@@ -394,7 +394,7 @@ void QmlGraphicsBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem *
p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth);
const QmlGraphicsScaleGrid *border = d->getScaleGrid();
- QMargins margins(border->top(), border->left(), border->bottom(), border->right());
+ QMargins margins(border->left(), border->top(), border->right(), border->bottom());
QTileRules rules((Qt::TileRule)d->horizontalTileMode, (Qt::TileRule)d->verticalTileMode);
qDrawBorderPixmap(p, QRect(0, 0, (int)d->width, (int)d->height), margins, d->pix, d->pix.rect(), margins, rules);
if (d->smooth) {
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index e292e5c..0a00092 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -145,6 +145,12 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
qtObject.setProperty(QLatin1String("openUrlExternally"),scriptEngine.newFunction(desktopOpenUrl, 1));
qtObject.setProperty(QLatin1String("md5"),scriptEngine.newFunction(md5, 1));
+ //firebug/webkit compat
+ QScriptValue consoleObject = scriptEngine.newObject();
+ consoleObject.setProperty(QLatin1String("log"),scriptEngine.newFunction(consoleLog, 1));
+ consoleObject.setProperty(QLatin1String("debug"),scriptEngine.newFunction(consoleLog, 1));
+ scriptEngine.globalObject().setProperty(QLatin1String("console"), consoleObject);
+
scriptEngine.globalObject().setProperty(QLatin1String("createQmlObject"),
scriptEngine.newFunction(QmlEnginePrivate::createQmlObject, 1));
scriptEngine.globalObject().setProperty(QLatin1String("createComponent"),
@@ -800,7 +806,7 @@ QScriptValue QmlEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QScriptEngin
return e->newVariant(QVariant(ret));
}
-QScriptValue QmlEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine *e)
+QScriptValue QmlEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine *)
{
QByteArray data;
@@ -812,6 +818,25 @@ QScriptValue QmlEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine *e)
return QScriptValue(QLatin1String(result.toHex()));
}
+QScriptValue QmlEnginePrivate::consoleLog(QScriptContext *ctxt, QScriptEngine *e)
+{
+ if(ctxt->argumentCount() < 1)
+ return e->newVariant(QVariant(false));
+
+ QByteArray msg;
+
+ for (int i=0; i<ctxt->argumentCount(); ++i) {
+ if (!msg.isEmpty()) msg += ' ';
+ msg += ctxt->argument(i).toString().toLocal8Bit();
+ // does not support firebug "%[a-z]" formatting, since firebug really
+ // does just ignore the format letter, which makes it pointless.
+ }
+
+ qDebug("%s",msg.data());
+
+ return e->newVariant(QVariant(true));
+}
+
QScriptValue QmlEnginePrivate::closestAngle(QScriptContext *ctxt, QScriptEngine *e)
{
if(ctxt->argumentCount() < 2)
diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h
index 2f41651..c11a399 100644
--- a/src/declarative/qml/qmlengine_p.h
+++ b/src/declarative/qml/qmlengine_p.h
@@ -269,6 +269,7 @@ public:
static QScriptValue playSound(QScriptContext*, QScriptEngine*);
static QScriptValue desktopOpenUrl(QScriptContext*, QScriptEngine*);
static QScriptValue md5(QScriptContext*, QScriptEngine*);
+ static QScriptValue consoleLog(QScriptContext*, QScriptEngine*);
static QScriptEngine *getScriptEngine(QmlEngine *e) { return &e->d_func()->scriptEngine; }
static QmlEngine *getEngine(QScriptEngine *e) { return static_cast<QmlScriptEngine*>(e)->p->q_func(); }
diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp
index 28c8e4f..6a393ee 100644
--- a/src/declarative/util/qmlpropertychanges.cpp
+++ b/src/declarative/util/qmlpropertychanges.cpp
@@ -57,7 +57,8 @@ QT_BEGIN_NAMESPACE
\brief The PropertyChanges element describes new property values for a state.
PropertyChanges changes the properties of an item. It allows you to specify the property
- names and values similar to how you normally would specify them for the actual item:
+ names and values for a state similar to how you normally would specify them for the
+ actual item:
\code
PropertyChanges {
@@ -67,6 +68,20 @@ QT_BEGIN_NAMESPACE
width: 48
}
\endcode
+
+ State-specific script for signal handlers can also be specified:
+
+ \qml
+ PropertyChanges {
+ target: myMouseRegion
+ onClicked: doSomethingDifferent()
+ }
+ \endqml
+
+ Changes to an Item's parent or anchors should be done using the associated change elements
+ (ParentChange and AnchorChanges, respectively) rather than PropertyChanges.
+
+ \sa {qmlstate}{States}
*/
/*!
diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp
index e2933b2..9727ca7 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -153,6 +153,9 @@ void QmlParentChangePrivate::doChange(QmlGraphicsItem *targetParent, QmlGraphics
More specifically, it will not work if the transform property has been set for any
Items involved in the reparenting (defined as any Items in the common ancestor tree
for the original and new parent).
+
+ You can specify at which point in a transition you want a ParentChange to occur by
+ using a ParentAction.
*/
QML_DEFINE_TYPE(Qt,4,6,ParentChange,QmlParentChange)
@@ -166,7 +169,7 @@ QmlParentChange::~QmlParentChange()
}
/*!
- \qmlproperty Object ParentChange::target
+ \qmlproperty Item ParentChange::target
This property holds the item to be reparented
*/
@@ -310,6 +313,10 @@ public:
/*!
\qmlclass StateChangeScript QmlStateChangeScript
\brief The StateChangeScript element allows you to run a script in a state.
+
+ The script specified will be run immediately when the state is made current.
+ Alternatively you can use a ScriptAction to specify at which point in the transition
+ you want the StateChangeScript to be run.
*/
QML_DEFINE_TYPE(Qt,4,6,StateChangeScript,QmlStateChangeScript)
QmlStateChangeScript::QmlStateChangeScript(QObject *parent)
@@ -385,8 +392,16 @@ QString QmlStateChangeScript::typeName() const
\qmlclass AnchorChanges QmlAnchorChanges
\brief The AnchorChanges element allows you to change the anchors of an item in a state.
+ In the following example we change the top and bottom anchors of an item:
\snippet examples/declarative/anchors/anchor-changes.qml 0
+ AnchorChanges will 'inject' \c x, \c y, \c width, and \c height changes into the transition,
+ so you can animate them as you would normally changes to these properties:
+ \qml
+ //animate our anchor changes
+ NumberAnimation { matchTargets: content; matchProperties: "x,y,width,height" }
+ \endqml
+
For more information on anchors see \l {anchor-layout}{Anchor Layouts}.
*/
@@ -432,8 +447,8 @@ public:
};
/*!
- \qmlproperty Object AnchorChanges::target
- This property holds the object that the anchors to change belong to
+ \qmlproperty Item AnchorChanges::target
+ This property holds the Item whose anchors will change
*/
QmlAnchorChanges::QmlAnchorChanges(QObject *parent)
diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp
index 63115bb..62bcc07 100644
--- a/src/declarative/util/qmlview.cpp
+++ b/src/declarative/util/qmlview.cpp
@@ -167,7 +167,11 @@ public:
...
view->execute();
...
+ view->show();
\endcode
+
+ To receive errors related to loading and executing QML with QmlView,
+ you can connect to the errors() signal.
*/
/*!
diff --git a/tests/auto/declarative/anchors/data/anchors.qml b/tests/auto/declarative/anchors/data/anchors.qml
index e6bed48..b64d0b0 100644
--- a/tests/auto/declarative/anchors/data/anchors.qml
+++ b/tests/auto/declarative/anchors/data/anchors.qml
@@ -120,7 +120,7 @@ Rectangle {
anchors.centerIn: masterRect
}
Rectangle {
- id: rect23a; objectName: "rect23a"
+ id: rect23; objectName: "rect23"
anchors.left: masterRect.left
anchors.leftMargin: 5
anchors.right: masterRect.right
@@ -131,17 +131,6 @@ Rectangle {
anchors.bottomMargin: 5
}
Rectangle {
- id: rect23b; objectName: "rect23b"
- anchors.left: rect23a.anchors.left
- anchors.leftMargin: rect23a.anchors.leftMargin
- anchors.right: rect23a.anchors.right
- anchors.rightMargin: rect23a.anchors.rightMargin
- anchors.top: rect23a.anchors.top
- anchors.topMargin: rect23a.anchors.topMargin
- anchors.bottom: rect23a.anchors.bottom
- anchors.bottomMargin: rect23a.anchors.bottomMargin
- }
- Rectangle {
id: rect24; objectName: "rect24"
width: 10; height: 10
anchors.horizontalCenter: masterRect.left
diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp
index d65d289..3011fdc 100644
--- a/tests/auto/declarative/anchors/tst_anchors.cpp
+++ b/tests/auto/declarative/anchors/tst_anchors.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
#include <qtest.h>
+#include <QSignalSpy>
#include <QtDeclarative/qmlengine.h>
#include <QtDeclarative/qmlcomponent.h>
#include <QtDeclarative/qmlview.h>
@@ -144,14 +145,10 @@ void tst_anchors::basicAnchors()
QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect22"))->y(), 5.0);
//margins
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23a"))->x(), 31.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23a"))->y(), 5.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23a"))->width(), 86.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23a"))->height(), 10.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23b"))->x(), 31.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23b"))->y(), 5.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23b"))->width(), 86.0);
- QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23b"))->height(), 10.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23"))->x(), 31.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23"))->y(), 5.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23"))->width(), 86.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23"))->height(), 10.0);
// offsets
QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect24"))->x(), 26.0);
diff --git a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp
index 6916cc9..785d55f 100644
--- a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp
+++ b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp
@@ -816,7 +816,7 @@ int main(int argc, char *argv[])
"Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }"
"Text { color: blueRect.color; }"
"MouseRegion {"
- "onEntered: { print('hello') }"
+ "onEntered: { console.log('hello') }"
"}"
"}";
// add second component to test multiple root contexts
diff --git a/tests/auto/declarative/qmlecmascript/data/scriptErrors.qml b/tests/auto/declarative/qmlecmascript/data/scriptErrors.qml
index ff22990..9d99b41 100644
--- a/tests/auto/declarative/qmlecmascript/data/scriptErrors.qml
+++ b/tests/auto/declarative/qmlecmascript/data/scriptErrors.qml
@@ -9,7 +9,7 @@ MyQmlObject {
property int x: undefinedObject
property int y: (a.value, undefinedObject)
- onBasicSignal: { print(a.value); }
+ onBasicSignal: { console.log(a.value); }
}
diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
index 983ddd0..fe3ae6b 100644
--- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
+++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
@@ -218,7 +218,7 @@ void tst_qmlecmascript::basicExpressions_data()
QTest::addColumn<QVariant>("result");
QTest::addColumn<bool>("nest");
- QTest::newRow("Syntax error (self test)") << "{print({'a':1'}.a)}" << QVariant() << false;
+ QTest::newRow("Syntax error (self test)") << "{console.log({'a':1'}.a)}" << QVariant() << false;
QTest::newRow("Context property") << "a" << QVariant(1944) << false;
QTest::newRow("Context property") << "a" << QVariant(1944) << true;
QTest::newRow("Context property expression") << "a * 2" << QVariant(3888) << false;
diff --git a/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp b/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp
index f23c7d7..bcdfa2e 100644
--- a/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp
+++ b/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp
@@ -112,12 +112,27 @@ void tst_qmlgraphicsborderimage::noSource()
delete obj;
}
+void tst_qmlgraphicsborderimage::imageSource_data()
+{
+ QTest::addColumn<QString>("source");
+ QTest::addColumn<bool>("remote");
+ QTest::addColumn<QString>("error");
+
+ QTest::newRow("local") << SRCDIR "/data/colors.png" << false << "";
+ QTest::newRow("local not found") << SRCDIR "/data/no-such-file.png" << false
+ << "Cannot open QUrl( \"file://" SRCDIR "/data/no-such-file.png\" ) ";
+ QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << "";
+ QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true
+ << "Network error loading QUrl( \"" SERVER_ADDR "/no-such-file.png\" ) "
+ "\"Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found\" ";
+}
+
void tst_qmlgraphicsborderimage::imageSource()
{
QFETCH(QString, source);
- QFETCH(bool, valid);
+ QFETCH(bool, remote);
+ QFETCH(QString, error);
- bool remote = source.startsWith("http");
TestHTTPServer *server = 0;
if (remote) {
server = new TestHTTPServer(SERVER_PORT);
@@ -125,6 +140,9 @@ void tst_qmlgraphicsborderimage::imageSource()
server->serveDirectory(SRCDIR "/data");
}
+ if (!error.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
+
QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }";
QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://"));
QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create());
@@ -135,7 +153,7 @@ void tst_qmlgraphicsborderimage::imageSource()
QCOMPARE(obj->source(), remote ? source : QUrl::fromLocalFile(source));
- if (valid) {
+ if (error.isEmpty()) {
TRY_WAIT(obj->status() == QmlGraphicsBorderImage::Ready);
QCOMPARE(obj->width(), 120.);
QCOMPARE(obj->height(), 120.);
@@ -168,17 +186,6 @@ void tst_qmlgraphicsborderimage::clearSource()
QCOMPARE(obj->height(), 0.);
}
-void tst_qmlgraphicsborderimage::imageSource_data()
-{
- QTest::addColumn<QString>("source");
- QTest::addColumn<bool>("valid");
-
- QTest::newRow("local") << SRCDIR "/data/colors.png" << true;
- QTest::newRow("local not found") << SRCDIR "/data/no-such-file.png" << false;
- QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true;
- QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << false;
-}
-
void tst_qmlgraphicsborderimage::resized()
{
QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }";
@@ -290,6 +297,9 @@ void tst_qmlgraphicsborderimage::sciSource_data()
void tst_qmlgraphicsborderimage::invalidSciFile()
{
+ QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Roun"
+ QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Repea"
+
QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/invalid.sci\"; width: 300; height: 300 }";
QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://"));
QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create());
diff --git a/tests/auto/declarative/qmlgraphicsflickable/data/flickable02.qml b/tests/auto/declarative/qmlgraphicsflickable/data/flickable02.qml
index cf98dd9..3e08359 100644
--- a/tests/auto/declarative/qmlgraphicsflickable/data/flickable02.qml
+++ b/tests/auto/declarative/qmlgraphicsflickable/data/flickable02.qml
@@ -8,7 +8,7 @@ Flickable {
id: row
Repeater {
model: 4
- Rectangle { width: 200; height: 300; color: dayColor }
+ Rectangle { width: 200; height: 300; color: "blue" }
}
}
}
diff --git a/tests/auto/declarative/qmlgraphicsflickable/data/flickable03.qml b/tests/auto/declarative/qmlgraphicsflickable/data/flickable03.qml
index 001bf2f..3ed173d 100644
--- a/tests/auto/declarative/qmlgraphicsflickable/data/flickable03.qml
+++ b/tests/auto/declarative/qmlgraphicsflickable/data/flickable03.qml
@@ -8,7 +8,7 @@ Flickable {
id: column
Repeater {
model: 4
- Rectangle { width: 200; height: 300; color: dayColor }
+ Rectangle { width: 200; height: 300; color: "blue" }
}
}
}
diff --git a/tests/auto/declarative/qmlgraphicsflickable/data/flickable04.qml b/tests/auto/declarative/qmlgraphicsflickable/data/flickable04.qml
index 5a27869..1425d85 100644
--- a/tests/auto/declarative/qmlgraphicsflickable/data/flickable04.qml
+++ b/tests/auto/declarative/qmlgraphicsflickable/data/flickable04.qml
@@ -10,7 +10,7 @@ Flickable {
id: column
Repeater {
model: 4
- Rectangle { width: 200; height: 300; color: dayColor }
+ Rectangle { width: 200; height: 300; color: "blue" }
}
}
}
diff --git a/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp b/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp
index 5ce5faf..784ad42 100644
--- a/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp
+++ b/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp
@@ -106,11 +106,26 @@ void tst_qmlgraphicsimage::noSource()
delete obj;
}
+void tst_qmlgraphicsimage::imageSource_data()
+{
+ QTest::addColumn<QString>("source");
+ QTest::addColumn<bool>("remote");
+ QTest::addColumn<QString>("error");
+
+ QTest::newRow("local") << SRCDIR "/data/colors.png" << false << "";
+ QTest::newRow("local not found") << SRCDIR "/data/no-such-file.png" << false
+ << "Cannot open QUrl( \"file://" SRCDIR "/data/no-such-file.png\" ) ";
+ QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << "";
+ QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true
+ << "Network error loading QUrl( \"" SERVER_ADDR "/no-such-file.png\" ) "
+ "\"Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found\" ";
+}
+
void tst_qmlgraphicsimage::imageSource()
{
QFETCH(QString, source);
QFETCH(bool, remote);
- QFETCH(bool, valid);
+ QFETCH(QString, error);
TestHTTPServer server(SERVER_PORT);
if (remote) {
@@ -118,6 +133,9 @@ void tst_qmlgraphicsimage::imageSource()
server.serveDirectory(SRCDIR "/data");
}
+ if (!error.isEmpty())
+ QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
+
QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\" }";
QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://"));
QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create());
@@ -128,7 +146,7 @@ void tst_qmlgraphicsimage::imageSource()
QCOMPARE(obj->source(), remote ? source : QUrl::fromLocalFile(source));
- if (valid) {
+ if (error.isEmpty()) {
TRY_WAIT(obj->status() == QmlGraphicsImage::Ready);
QCOMPARE(obj->width(), 120.);
QCOMPARE(obj->height(), 120.);
@@ -162,18 +180,6 @@ void tst_qmlgraphicsimage::clearSource()
QCOMPARE(obj->progress(), 0.0);
}
-void tst_qmlgraphicsimage::imageSource_data()
-{
- QTest::addColumn<QString>("source");
- QTest::addColumn<bool>("remote");
- QTest::addColumn<bool>("valid");
-
- QTest::newRow("local") << SRCDIR "/data/colors.png" << false << true;
- QTest::newRow("local not found") << SRCDIR "/data/no-such-file.png" << false << false;
- QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << true;
- QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true << false;
-}
-
void tst_qmlgraphicsimage::resized()
{
QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }";
diff --git a/tests/auto/declarative/qmlgraphicslistview/data/listview.qml b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml
index b64b399..99b3db6 100644
--- a/tests/auto/declarative/qmlgraphicslistview/data/listview.qml
+++ b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml
@@ -7,23 +7,23 @@ Rectangle {
function checkProperties() {
testObject.error = false;
if (list.model != testModel) {
- print("model property incorrect");
+ console.log("model property incorrect");
testObject.error = true;
}
if (!testObject.animate && list.delegate != myDelegate) {
- print("delegate property incorrect - expected myDelegate");
+ console.log("delegate property incorrect - expected myDelegate");
testObject.error = true;
}
if (testObject.animate && list.delegate != animatedDelegate) {
- print("delegate property incorrect - expected animatedDelegate");
+ console.log("delegate property incorrect - expected animatedDelegate");
testObject.error = true;
}
if (testObject.invalidHighlight && list.highlight != invalidHl) {
- print("highlight property incorrect - expected invalidHl");
+ console.log("highlight property incorrect - expected invalidHl");
testObject.error = true;
}
if (!testObject.invalidHighlight && list.highlight != myHighlight) {
- print("highlight property incorrect - expected myHighlight");
+ console.log("highlight property incorrect - expected myHighlight");
testObject.error = true;
}
}
@@ -85,7 +85,7 @@ Rectangle {
}
color: ListView.isCurrentItem ? "lightsteelblue" : "white"
ListView.onRemove: SequentialAnimation {
- ScriptAction { script: print("Fix PropertyAction with attached properties") }
+ ScriptAction { script: console.log("Fix PropertyAction with attached properties") }
/*
PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing: "easeInOutQuad" }
diff --git a/tests/auto/declarative/qmlgraphicspathview/data/datamodel.qml b/tests/auto/declarative/qmlgraphicspathview/data/datamodel.qml
index 6aea96b..9d08e5d 100644
--- a/tests/auto/declarative/qmlgraphicspathview/data/datamodel.qml
+++ b/tests/auto/declarative/qmlgraphicspathview/data/datamodel.qml
@@ -9,7 +9,7 @@ PathView {
function checkProperties() {
testObject.error = false;
if (testObject.useModel && view.model != itemModel) {
- print("model property incorrect");
+ console.log("model property incorrect");
testObject.error = true;
}
}
diff --git a/tests/auto/declarative/qmlgraphicsrepeater/data/intmodel.qml b/tests/auto/declarative/qmlgraphicsrepeater/data/intmodel.qml
index 2d6eae8..cf1fb4d 100644
--- a/tests/auto/declarative/qmlgraphicsrepeater/data/intmodel.qml
+++ b/tests/auto/declarative/qmlgraphicsrepeater/data/intmodel.qml
@@ -10,7 +10,7 @@ Rectangle {
function checkProperties() {
testObject.error = false;
if (repeater.delegate != comp) {
- print("delegate property incorrect");
+ console.log("delegate property incorrect");
testObject.error = true;
}
}
diff --git a/tests/auto/declarative/qmlgraphicsrepeater/data/itemlist.qml b/tests/auto/declarative/qmlgraphicsrepeater/data/itemlist.qml
index 8d28bf8..fc6b34c 100644
--- a/tests/auto/declarative/qmlgraphicsrepeater/data/itemlist.qml
+++ b/tests/auto/declarative/qmlgraphicsrepeater/data/itemlist.qml
@@ -11,7 +11,7 @@ Rectangle {
function checkProperties() {
testObject.error = false;
if (testObject.useModel && view.model != itemModel) {
- print("model property incorrect");
+ console.log("model property incorrect");
testObject.error = true;
}
}
diff --git a/tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp b/tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp
index f493e0e..1173f85 100644
--- a/tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp
+++ b/tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp
@@ -316,7 +316,7 @@ void tst_qmlinstruction::dump()
}
{
- data->primitives << "print(1921)";
+ data->primitives << "console.log(1921)";
QmlInstruction i;
i.line = 27;
@@ -564,7 +564,7 @@ void tst_qmlinstruction::dump()
<< "24\t\t24\tSTORE_OBJECT\t\t21"
<< "25\t\t25\tSTORE_VARIANT_OBJECT\t22"
<< "26\t\t26\tSTORE_INTERFACE\t\t23"
- << "27\t\t27\tSTORE_SIGNAL\t\t2\t4\t\t\"print(1921)\""
+ << "27\t\t27\tSTORE_SIGNAL\t\t2\t4\t\t\"console.log(1921)\""
<< "28\t\t28\tSTORE_SCRIPT\t\t2\t18\t28"
<< "29\t\t29\tSTORE_SCRIPT_STRING\t24\t3\t1"
<< "30\t\t30\tASSIGN_SIGNAL_OBJECT\t0\t\t\t\"mySignal\""
diff --git a/tests/auto/declarative/qmllanguage/data/OnCompletedType.qml b/tests/auto/declarative/qmllanguage/data/OnCompletedType.qml
index cdba495..2889caf 100644
--- a/tests/auto/declarative/qmllanguage/data/OnCompletedType.qml
+++ b/tests/auto/declarative/qmllanguage/data/OnCompletedType.qml
@@ -4,5 +4,5 @@ import Qt 4.6
MyQmlObject {
property int a: Math.max(10, 9)
property int b: 11
- Component.onCompleted: print("Completed " + a + " " + b);
+ Component.onCompleted: console.log("Completed " + a + " " + b);
}
diff --git a/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt b/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt
index d28c0bd..43a8bb2 100644
--- a/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt
+++ b/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt
@@ -1 +1 @@
-4:19:Cannot use reserved "id" property in ListModel
+4:19:ListElement: cannot use reserved "id" property
diff --git a/tests/auto/declarative/qmllanguage/data/defaultGrouped.qml b/tests/auto/declarative/qmllanguage/data/defaultGrouped.qml
index 532b2bb..0fd1404 100644
--- a/tests/auto/declarative/qmllanguage/data/defaultGrouped.qml
+++ b/tests/auto/declarative/qmllanguage/data/defaultGrouped.qml
@@ -3,7 +3,7 @@ import Qt 4.6
MyTypeObject {
grouped {
- script: print(1921)
+ script: console.log(1921)
QtObject {}
}
}
diff --git a/tests/auto/declarative/qmllanguage/data/doubleSignal.qml b/tests/auto/declarative/qmllanguage/data/doubleSignal.qml
index ec813c9..fb07b9f 100644
--- a/tests/auto/declarative/qmllanguage/data/doubleSignal.qml
+++ b/tests/auto/declarative/qmllanguage/data/doubleSignal.qml
@@ -1,7 +1,7 @@
import Test 1.0
MyQmlObject {
- onBasicSignal: print(1921)
- onBasicSignal: print(1921)
+ onBasicSignal: console.log(1921)
+ onBasicSignal: console.log(1921)
}
diff --git a/tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml b/tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml
index 737681e..2a834e8 100644
--- a/tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml
+++ b/tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml
@@ -6,5 +6,5 @@ QtObject {
function slot2() {}
property int test: 0
- function slot3(a) { print(1921); test = a; }
+ function slot3(a) { console.log(1921); test = a; }
}
diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml
index b77fb90..977539a 100644
--- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml
+++ b/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml
@@ -1,5 +1,5 @@
import Test 1.0
MyTypeObject {
- nullGrouped.script: print(1921)
+ nullGrouped.script: console.log(1921)
}
diff --git a/tests/auto/declarative/qmllanguage/data/missingSignal.qml b/tests/auto/declarative/qmllanguage/data/missingSignal.qml
index 8a87437..3bf75f6 100644
--- a/tests/auto/declarative/qmllanguage/data/missingSignal.qml
+++ b/tests/auto/declarative/qmllanguage/data/missingSignal.qml
@@ -1,5 +1,5 @@
import Test 1.0
import Qt 4.6
QtObject {
- onClicked: print("Hello world!")
+ onClicked: console.log("Hello world!")
}
diff --git a/tests/auto/declarative/qmllanguage/data/onCompleted.qml b/tests/auto/declarative/qmllanguage/data/onCompleted.qml
index ae47d4b..5725f85 100644
--- a/tests/auto/declarative/qmllanguage/data/onCompleted.qml
+++ b/tests/auto/declarative/qmllanguage/data/onCompleted.qml
@@ -5,13 +5,13 @@ MyTypeObject {
// We set a and b to ensure that onCompleted is executed after bindings and
// constants have been assigned
property int a: Math.min(6, 7)
- Component.onCompleted: print("Completed " + a + " " + nestedObject.b)
+ Component.onCompleted: console.log("Completed " + a + " " + nestedObject.b)
objectProperty: OnCompletedType {
qmlobjectProperty: MyQmlObject {
id: nestedObject
property int b: 10
- Component.onCompleted: print("Completed " + a + " " + nestedObject.b)
+ Component.onCompleted: console.log("Completed " + a + " " + nestedObject.b)
}
}
}
diff --git a/tests/auto/declarative/qmllanguage/data/scriptString.qml b/tests/auto/declarative/qmllanguage/data/scriptString.qml
index 51e6e48..40a3bbe 100644
--- a/tests/auto/declarative/qmllanguage/data/scriptString.qml
+++ b/tests/auto/declarative/qmllanguage/data/scriptString.qml
@@ -2,5 +2,5 @@ import Test 1.0
MyTypeObject {
scriptProperty: foo + bar
- grouped.script: print(1921)
+ grouped.script: console.log(1921)
}
diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
index 892d2eb..685beaf 100644
--- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
+++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
@@ -606,6 +606,8 @@ void tst_qmllanguage::dynamicObjectProperties()
// Tests the declaration of dynamic signals and slots
void tst_qmllanguage::dynamicSignalsAndSlots()
{
+ QTest::ignoreMessage(QtDebugMsg, "1921");
+
QmlComponent component(&engine, TEST_FILE("dynamicSignalsAndSlots.qml"));
VERIFY_ERRORS(0);
QObject *object = component.create();
@@ -956,7 +958,7 @@ void tst_qmllanguage::scriptString()
QCOMPARE(object->scriptProperty().context(), qmlContext(object));
QVERIFY(object->grouped() != 0);
- QCOMPARE(object->grouped()->script().script(), QString("print(1921)"));
+ QCOMPARE(object->grouped()->script().script(), QString("console.log(1921)"));
QCOMPARE(object->grouped()->script().scopeObject(), object);
QCOMPARE(object->grouped()->script().context(), qmlContext(object));
}
diff --git a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
index d6e88b5..8dcfc11 100644
--- a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
+++ b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
@@ -854,12 +854,12 @@ void tst_qmlmetaproperty::write()
{
PropertyObject o;
QmlMetaProperty p(&o, "onClicked");
- QCOMPARE(p.write(QVariant("print(1921)")), false);
+ QCOMPARE(p.write(QVariant("console.log(1921)")), false);
QVERIFY(0 == p.setSignalExpression(new QmlExpression()));
QVERIFY(0 != p.signalExpression());
- QCOMPARE(p.write(QVariant("print(1921)")), false);
+ QCOMPARE(p.write(QVariant("console.log(1921)")), false);
QVERIFY(0 != p.signalExpression());
}
diff --git a/tests/auto/declarative/qmlqt/data/consoleLog.qml b/tests/auto/declarative/qmlqt/data/consoleLog.qml
new file mode 100644
index 0000000..e657ff1
--- /dev/null
+++ b/tests/auto/declarative/qmlqt/data/consoleLog.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+QtObject {
+ Component.onCompleted: {
+ console.log("completed", "ok")
+ console.log("completed ok")
+ }
+}
diff --git a/tests/auto/declarative/qmlqt/tst_qmlqt.cpp b/tests/auto/declarative/qmlqt/tst_qmlqt.cpp
index 292102a..21c5478 100644
--- a/tests/auto/declarative/qmlqt/tst_qmlqt.cpp
+++ b/tests/auto/declarative/qmlqt/tst_qmlqt.cpp
@@ -72,6 +72,7 @@ private slots:
void md5();
void createComponent();
void createQmlObject();
+ void consoleLog();
private:
QmlEngine engine;
@@ -353,6 +354,16 @@ void tst_qmlqt::createQmlObject()
delete object;
}
+void tst_qmlqt::consoleLog()
+{
+ QTest::ignoreMessage(QtDebugMsg, "completed ok");
+ QTest::ignoreMessage(QtDebugMsg, "completed ok");
+ QmlComponent component(&engine, TEST_FILE("consoleLog.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
QTEST_MAIN(tst_qmlqt)
#include "tst_qmlqt.moc"
diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp
index 7008529..8f6fdef 100644
--- a/tests/auto/declarative/shared/debugutil.cpp
+++ b/tests/auto/declarative/shared/debugutil.cpp
@@ -88,8 +88,8 @@ void QmlDebugTestService::messageReceived(const QByteArray &ba)
void QmlDebugTestService::enabledChanged(bool e)
{
- emit enabledStateChanged();
enabled = e;
+ emit enabledStateChanged();
}
@@ -100,17 +100,18 @@ QmlDebugTestClient::QmlDebugTestClient(const QString &s, QmlDebugConnection *c)
QByteArray QmlDebugTestClient::waitForResponse()
{
- QSignalSpy spy(this, SIGNAL(serverMessage(QByteArray)));
+ lastMsg.clear();
QmlDebugTest::waitForSignal(this, SIGNAL(serverMessage(QByteArray)));
- if (spy.count() == 0) {
+ if (lastMsg.isEmpty()) {
qWarning() << "tst_QmlDebugClient: no response from server!";
return QByteArray();
}
- return spy.at(0).at(0).value<QByteArray>();
+ return lastMsg;
}
void QmlDebugTestClient::messageReceived(const QByteArray &ba)
{
+ lastMsg = ba;
emit serverMessage(ba);
}
diff --git a/tests/auto/declarative/shared/debugutil_p.h b/tests/auto/declarative/shared/debugutil_p.h
index 665aeda..cb20f5c 100644
--- a/tests/auto/declarative/shared/debugutil_p.h
+++ b/tests/auto/declarative/shared/debugutil_p.h
@@ -119,6 +119,9 @@ signals:
protected:
virtual void messageReceived(const QByteArray &ba);
+
+private:
+ QByteArray lastMsg;
};
class tst_QmlDebug_Thread : public QThread
diff --git a/tests/auto/declarative/valuetypes/data/deletedObject.js b/tests/auto/declarative/valuetypes/data/deletedObject.js
index f554a0f..af298ff 100644
--- a/tests/auto/declarative/valuetypes/data/deletedObject.js
+++ b/tests/auto/declarative/valuetypes/data/deletedObject.js
@@ -3,11 +3,11 @@ var savedReference;
function startup()
{
savedReference = object.rect;
- print("Test: " + savedReference.x);
+ console.log("Test: " + savedReference.x);
}
function afterDelete()
{
- print("Test: " + savedReference.x);
+ console.log("Test: " + savedReference.x);
}
diff --git a/tests/auto/declarative/visual/focusscope/test.qml b/tests/auto/declarative/visual/focusscope/test.qml
index 77ffb84..dd6d726 100644
--- a/tests/auto/declarative/visual/focusscope/test.qml
+++ b/tests/auto/declarative/visual/focusscope/test.qml
@@ -5,13 +5,13 @@ Rectangle {
width: 800
height: 600
- Keys.onDigit9Pressed: print("Error - Root")
+ Keys.onDigit9Pressed: console.log("Error - Root")
FocusScope {
id: MyScope
focus: true
- Keys.onDigit9Pressed: print("Error - FocusScope")
+ Keys.onDigit9Pressed: console.log("Error - FocusScope")
Rectangle {
height: 120
@@ -27,7 +27,7 @@ Rectangle {
width: 100; height: 100; color: "green"
border.width: 5
border.color: wantsFocus?"blue":"black"
- Keys.onDigit9Pressed: print("Top Left");
+ Keys.onDigit9Pressed: console.log("Top Left");
KeyNavigation.right: Item2
focus: true
@@ -44,7 +44,7 @@ Rectangle {
border.width: 5
border.color: wantsFocus?"blue":"black"
KeyNavigation.left: Item1
- Keys.onDigit9Pressed: print("Top Right");
+ Keys.onDigit9Pressed: console.log("Top Right");
Rectangle {
width: 50; height: 50; anchors.centerIn: parent
@@ -64,7 +64,7 @@ Rectangle {
border.width: 5
border.color: wantsFocus?"blue":"black"
- Keys.onDigit9Pressed: print("Bottom Left");
+ Keys.onDigit9Pressed: console.log("Bottom Left");
KeyNavigation.up: MyScope
Rectangle {
diff --git a/tests/auto/declarative/visual/focusscope/test3.qml b/tests/auto/declarative/visual/focusscope/test3.qml
index b5feeb5..4be9dc7 100644
--- a/tests/auto/declarative/visual/focusscope/test3.qml
+++ b/tests/auto/declarative/visual/focusscope/test3.qml
@@ -23,10 +23,10 @@ Rectangle {
FocusScope {
id: Root
width: 50; height: 50;
- Keys.onDigit9Pressed: print("Error - " + name)
+ Keys.onDigit9Pressed: console.log("Error - " + name)
Rectangle {
focus: true
- Keys.onDigit9Pressed: print(name)
+ Keys.onDigit9Pressed: console.log(name)
width: 50; height: 50;
color: Root.ListView.isCurrentItem?"red":"green"
Text { text: name; anchors.centerIn: parent }
diff --git a/tests/auto/declarative/visual/webview/zooming/zooming.qml b/tests/auto/declarative/visual/webview/zooming/zooming.qml
index 3ac57f6..0ea9131 100644
--- a/tests/auto/declarative/visual/webview/zooming/zooming.qml
+++ b/tests/auto/declarative/visual/webview/zooming/zooming.qml
@@ -12,6 +12,6 @@ WebView {
url: "zooming.html"
preferredWidth: width
preferredHeight: height
- onDoubleClick: {print(clickX,clickY);heuristicZoom(clickX,clickY,2)}
- onZoomTo: {print(zoom);scale=zoom;x=width/2-centerX;y=height/2-centerY}
+ onDoubleClick: {console.log(clickX,clickY);heuristicZoom(clickX,clickY,2)}
+ onZoomTo: {console.log(zoom);scale=zoom;x=width/2-centerX;y=height/2-centerY}
}