summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/declarative/flickr/mobile/TitleBar.qml1
-rw-r--r--demos/declarative/minehunt/minehunt.cpp2
-rw-r--r--demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml6
-rw-r--r--demos/declarative/photoviewer/PhotoViewerCore/Button.qml2
-rw-r--r--demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml2
-rw-r--r--demos/declarative/samegame/SamegameCore/BoomBlock.qml10
-rw-r--r--demos/declarative/samegame/SamegameCore/Button.qml4
-rw-r--r--demos/declarative/samegame/SamegameCore/Dialog.qml2
-rw-r--r--demos/declarative/samegame/samegame.qml2
-rw-r--r--demos/declarative/webbrowser/content/FlickableWebView.qml4
-rw-r--r--doc/src/declarative/elements.qdoc7
-rw-r--r--doc/src/declarative/extending-examples.qdoc5
-rw-r--r--doc/src/declarative/extending.qdoc22
-rw-r--r--doc/src/declarative/integrating.qdoc3
-rw-r--r--doc/src/declarative/javascriptblocks.qdoc20
-rw-r--r--doc/src/declarative/network.qdoc6
-rw-r--r--doc/src/declarative/qtdeclarative.qdoc6
-rw-r--r--doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h3
-rw-r--r--doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h3
-rwxr-xr-xdoc/src/template/style/style.css15
-rw-r--r--examples/declarative/extending/adding/person.h1
-rw-r--r--examples/declarative/extending/attached/birthdayparty.h2
-rw-r--r--examples/declarative/extending/attached/person.h4
-rw-r--r--examples/declarative/extending/binding/birthdayparty.h2
-rw-r--r--examples/declarative/extending/binding/happybirthday.h2
-rw-r--r--examples/declarative/extending/binding/person.h4
-rw-r--r--examples/declarative/extending/coercion/birthdayparty.h1
-rw-r--r--examples/declarative/extending/coercion/person.h6
-rw-r--r--examples/declarative/extending/default/birthdayparty.h1
-rw-r--r--examples/declarative/extending/default/person.h3
-rw-r--r--examples/declarative/extending/extended/lineedit.cpp2
-rw-r--r--examples/declarative/extending/grouped/birthdayparty.h2
-rw-r--r--examples/declarative/extending/grouped/person.h4
-rw-r--r--examples/declarative/extending/properties/birthdayparty.h1
-rw-r--r--examples/declarative/extending/properties/person.h1
-rw-r--r--examples/declarative/extending/signal/birthdayparty.h3
-rw-r--r--examples/declarative/extending/signal/person.h4
-rw-r--r--examples/declarative/extending/valuesource/birthdayparty.h3
-rw-r--r--examples/declarative/extending/valuesource/happybirthday.h1
-rw-r--r--examples/declarative/extending/valuesource/person.h4
-rw-r--r--examples/declarative/fillmode/content/QtLogo.qml30
-rw-r--r--examples/declarative/fillmode/content/qt-logo.pngbin0 -> 5149 bytes
-rw-r--r--examples/declarative/fillmode/face.pngbin905 -> 0 bytes
-rw-r--r--examples/declarative/fillmode/fillmode.qml52
-rw-r--r--examples/declarative/plugins/README2
-rw-r--r--examples/declarative/plugins/plugins.pro1
-rw-r--r--examples/declarative/proxywidgets/proxywidgets.cpp2
-rw-r--r--examples/declarative/proxywidgets/proxywidgets.pro1
-rw-r--r--examples/declarative/tutorials/samegame/samegame1/Block.qml4
-rw-r--r--examples/declarative/tutorials/samegame/samegame1/Button.qml4
-rw-r--r--examples/declarative/tutorials/samegame/samegame2/Block.qml4
-rw-r--r--examples/declarative/tutorials/samegame/samegame2/Button.qml4
-rw-r--r--examples/declarative/tutorials/samegame/samegame2/samegame.qml2
-rw-r--r--examples/declarative/tutorials/samegame/samegame3/Block.qml4
-rw-r--r--examples/declarative/tutorials/samegame/samegame3/Button.qml4
-rw-r--r--examples/declarative/tutorials/samegame/samegame3/Dialog.qml2
-rw-r--r--examples/declarative/tutorials/samegame/samegame3/samegame.qml2
-rw-r--r--examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml8
-rw-r--r--examples/declarative/tutorials/samegame/samegame4/content/Button.qml4
-rw-r--r--examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml2
-rw-r--r--examples/declarative/tutorials/samegame/samegame4/samegame.qml2
-rw-r--r--src/declarative/debugger/qdeclarativedebugservice.cpp133
-rw-r--r--src/declarative/debugger/qdeclarativedebugservice_p.h7
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp5
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp12
-rw-r--r--src/declarative/graphicsitems/qdeclarativeevents.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeevents_p_p.h4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp22
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflipable.cpp49
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflipable_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp19
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp36
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp30
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem_p.h6
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp18
-rw-r--r--src/declarative/graphicsitems/qdeclarativeloader.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp24
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea_p.h8
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp15
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle_p_p.h8
-rw-r--r--src/declarative/graphicsitems/qdeclarativescalegrid.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp11
-rw-r--r--src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp2
-rw-r--r--src/declarative/qml/parser/qdeclarativejs.g2
-rw-r--r--src/declarative/qml/parser/qdeclarativejsgrammar.cpp6
-rw-r--r--src/declarative/qml/parser/qdeclarativejslexer.cpp42
-rw-r--r--src/declarative/qml/qdeclarativebinding.cpp3
-rw-r--r--src/declarative/qml/qdeclarativeboundsignal.cpp2
-rw-r--r--src/declarative/qml/qdeclarativecompiledbindings.cpp9
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp106
-rw-r--r--src/declarative/qml/qdeclarativecompiler_p.h1
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp12
-rw-r--r--src/declarative/qml/qdeclarativecomponent.h3
-rw-r--r--src/declarative/qml/qdeclarativecompositetypemanager.cpp1
-rw-r--r--src/declarative/qml/qdeclarativecontext.cpp44
-rw-r--r--src/declarative/qml/qdeclarativecontext_p.h2
-rw-r--r--src/declarative/qml/qdeclarativecontextscriptclass.cpp8
-rw-r--r--src/declarative/qml/qdeclarativedata_p.h3
-rw-r--r--src/declarative/qml/qdeclarativedirparser.cpp9
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp186
-rw-r--r--src/declarative/qml/qdeclarativeengine.h7
-rw-r--r--src/declarative/qml/qdeclarativeengine_p.h10
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeerror.cpp63
-rw-r--r--src/declarative/qml/qdeclarativeexpression.cpp5
-rw-r--r--src/declarative/qml/qdeclarativeextensionplugin.cpp11
-rw-r--r--src/declarative/qml/qdeclarativeimageprovider.cpp22
-rw-r--r--src/declarative/qml/qdeclarativeimageprovider.h2
-rw-r--r--src/declarative/qml/qdeclarativeinfo.cpp119
-rw-r--r--src/declarative/qml/qdeclarativeinfo.h19
-rw-r--r--src/declarative/qml/qdeclarativeinstruction.cpp3
-rw-r--r--src/declarative/qml/qdeclarativeinstruction_p.h1
-rw-r--r--src/declarative/qml/qdeclarativelist.cpp15
-rw-r--r--src/declarative/qml/qdeclarativemetatype.cpp8
-rw-r--r--src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp5
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp28
-rw-r--r--src/declarative/qml/qdeclarativeparser.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeparser_p.h4
-rw-r--r--src/declarative/qml/qdeclarativeparserstatus.cpp32
-rw-r--r--src/declarative/qml/qdeclarativeproperty.cpp1
-rw-r--r--src/declarative/qml/qdeclarativeproxymetaobject.cpp14
-rw-r--r--src/declarative/qml/qdeclarativescriptparser.cpp100
-rw-r--r--src/declarative/qml/qdeclarativescriptstring.cpp33
-rw-r--r--src/declarative/qml/qdeclarativevaluetype.cpp6
-rw-r--r--src/declarative/qml/qdeclarativevme.cpp7
-rw-r--r--src/declarative/qml/qdeclarativevmemetaobject.cpp27
-rw-r--r--src/declarative/qml/qdeclarativevmemetaobject_p.h1
-rw-r--r--src/declarative/qml/qdeclarativexmlhttprequest.cpp2
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp15
-rw-r--r--src/declarative/util/qdeclarativefontloader.cpp9
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp5
-rw-r--r--src/declarative/util/qdeclarativelistmodelworkeragent.cpp5
-rw-r--r--src/declarative/util/qdeclarativepropertymap.cpp4
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation.cpp4
-rw-r--r--src/declarative/util/qdeclarativesmoothedfollow.cpp4
-rw-r--r--src/declarative/util/qdeclarativespringfollow.cpp16
-rw-r--r--src/declarative/util/qdeclarativestategroup.cpp3
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp2
-rw-r--r--src/declarative/util/qdeclarativetimer_p.h1
-rw-r--r--src/declarative/util/qdeclarativeview.cpp272
-rw-r--r--src/declarative/util/qdeclarativeview.h2
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp10
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h1
-rw-r--r--src/imports/gestures/gestures.pro3
-rw-r--r--src/imports/multimedia/multimedia.pro3
-rw-r--r--src/imports/multimedia/qdeclarativeaudio.cpp10
-rw-r--r--src/imports/multimedia/qdeclarativevideo.cpp16
-rw-r--r--src/imports/particles/particles.pro3
-rw-r--r--src/imports/particles/qdeclarativeparticles.cpp14
-rw-r--r--src/imports/webkit/webkit.pro3
-rw-r--r--src/imports/widgets/widgets.pro3
-rw-r--r--src/multimedia/effects/qsoundeffect.cpp4
-rw-r--r--src/s60installs/s60installs.pro19
-rw-r--r--tests/auto/declarative/declarative.pro1
-rw-r--r--tests/auto/declarative/parserstress/tst_parserstress.cpp8
-rw-r--r--tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp30
-rw-r--r--tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp14
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp8
-rw-r--r--tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp91
-rw-r--r--tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp42
-rw-r--r--tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp42
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/externalScript.1.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.js8
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/externalScript.3.qml13
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/externalScript.4.qml15
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/externalScript.js6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scope.qml14
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.js7
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.qml17
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.js4
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml10
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.js5
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml10
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.js3
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.js6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml13
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.js2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml13
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js5
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.h6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp110
-rw-r--r--tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/green.pngbin0 -> 314 bytes
-rw-r--r--tests/auto/declarative/qdeclarativeimage/data/tiling.qml16
-rw-r--r--tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp83
-rw-r--r--tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp16
-rw-r--r--tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp57
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp7
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/testtypes.h16
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp5
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/data/enumerate.qml24
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp118
-rw-r--r--tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp1
-rw-r--r--tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativemousearea/data/updateMousePosOnResize.qml38
-rw-r--r--tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp41
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp8
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createComponent.qml9
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml26
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/hsla.qml4
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/rgba.qml4
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp95
-rw-r--r--tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp14
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp17
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/testtypes.h3
-rw-r--r--tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro7
-rw-r--r--tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp272
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativeflipable/data/test_flipable_resize.qml207
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativeflipable/test_flipable_resize.qml62
-rw-r--r--tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp8
-rw-r--r--tests/auto/declarative/shared/debugutil.cpp81
-rw-r--r--tests/auto/declarative/shared/debugutil_p.h56
-rw-r--r--tools/qdoc3/htmlgenerator.cpp4
-rw-r--r--tools/qml/main.cpp9
-rw-r--r--tools/qml/qmlruntime.cpp112
-rw-r--r--tools/qml/qmlruntime.h4
240 files changed, 2451 insertions, 1784 deletions
diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml
index 72b779f..71d9385 100644
--- a/demos/declarative/flickr/mobile/TitleBar.qml
+++ b/demos/declarative/flickr/mobile/TitleBar.qml
@@ -12,6 +12,7 @@ Item {
width: (parent.width * 2) - 55 ; height: parent.height
function accept() {
+ imageDetails.closed()
titleBar.state = ""
background.state = ""
rssModel.tags = editor.text
diff --git a/demos/declarative/minehunt/minehunt.cpp b/demos/declarative/minehunt/minehunt.cpp
index d4b0039..93cd1c1 100644
--- a/demos/declarative/minehunt/minehunt.cpp
+++ b/demos/declarative/minehunt/minehunt.cpp
@@ -305,8 +305,6 @@ bool MinehuntGame::flag(int row, int col)
return true;
}
-QML_DECLARE_TYPE(TileData);
-
class MinehuntExtensionPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
diff --git a/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml
index cd9ecbc..d39b7bc 100644
--- a/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml
+++ b/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml
@@ -77,10 +77,12 @@ Component {
}
]
- GridView.onAdd: NumberAnimation { target: albumWrapper; properties: "scale"; from: 0.0; to: 1.0 }
+ GridView.onAdd: NumberAnimation {
+ target: albumWrapper; properties: "scale"; from: 0.0; to: 1.0; easing.type: "OutQuad"
+ }
GridView.onRemove: SequentialAnimation {
PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: true }
- NumberAnimation { target: albumWrapper; property: "scale"; from: 1.0; to: 0.0 }
+ NumberAnimation { target: albumWrapper; property: "scale"; from: 1.0; to: 0.0; easing.type: "OutQuad" }
PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: false }
}
diff --git a/demos/declarative/photoviewer/PhotoViewerCore/Button.qml b/demos/declarative/photoviewer/PhotoViewerCore/Button.qml
index fd1fae9..c681064 100644
--- a/demos/declarative/photoviewer/PhotoViewerCore/Button.qml
+++ b/demos/declarative/photoviewer/PhotoViewerCore/Button.qml
@@ -4,7 +4,7 @@ Item {
id: container
property alias label: labelText.text
- property string tint: ""
+ property color tint: "#FFFFFFFF"
signal clicked
width: labelText.width + 70 ; height: labelText.height + 18
diff --git a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml
index e435425..ccfda02 100644
--- a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml
+++ b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml
@@ -4,7 +4,7 @@ Item {
id: container
property string label
- property string tint: ""
+ property color tint: "#FFFFFFFF"
signal clicked
signal labelChanged(string label)
diff --git a/demos/declarative/samegame/SamegameCore/BoomBlock.qml b/demos/declarative/samegame/SamegameCore/BoomBlock.qml
index bad1bf4..47f43c2 100644
--- a/demos/declarative/samegame/SamegameCore/BoomBlock.qml
+++ b/demos/declarative/samegame/SamegameCore/BoomBlock.qml
@@ -1,7 +1,8 @@
import Qt 4.7
import Qt.labs.particles 1.0
-Item { id:block
+Item {
+ id: block
property bool dying: false
property bool spawned: false
property int type: 0
@@ -11,7 +12,8 @@ Item { id:block
SpringFollow on x { enabled: spawned; to: targetX; spring: 2; damping: 0.2 }
SpringFollow on y { to: targetY; spring: 2; damping: 0.2 }
- Image { id: img
+ Image {
+ id: img
source: {
if(type == 0){
"pics/redStone.png";
@@ -26,10 +28,10 @@ Item { id:block
anchors.fill: parent
}
- Particles {
+ Particles {
id: particles
- width: 1; height: 1
+ width: 1; height: 1
anchors.centerIn: parent
emissionRate: 0
diff --git a/demos/declarative/samegame/SamegameCore/Button.qml b/demos/declarative/samegame/SamegameCore/Button.qml
index 0faabc9..6d5d75d 100644
--- a/demos/declarative/samegame/SamegameCore/Button.qml
+++ b/demos/declarative/samegame/SamegameCore/Button.qml
@@ -17,9 +17,9 @@ Rectangle {
GradientStop {
position: 0.0
color: {
- if (mouseArea.pressed)
+ if (mouseArea.pressed)
return activePalette.dark
- else
+ else
return activePalette.light
}
}
diff --git a/demos/declarative/samegame/SamegameCore/Dialog.qml b/demos/declarative/samegame/SamegameCore/Dialog.qml
index 8784348..d4f188c 100644
--- a/demos/declarative/samegame/SamegameCore/Dialog.qml
+++ b/demos/declarative/samegame/SamegameCore/Dialog.qml
@@ -22,7 +22,7 @@ Rectangle {
border.width: 1
opacity: 0
- Behavior on opacity {
+ Behavior on opacity {
NumberAnimation { duration: 1000 }
}
diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml
index 92201f5..f1b41c9 100644
--- a/demos/declarative/samegame/samegame.qml
+++ b/demos/declarative/samegame/samegame.qml
@@ -38,7 +38,7 @@ Rectangle {
Dialog {
id: nameInputDialog
-
+
property int initialWidth: 0
anchors.centerIn: parent
diff --git a/demos/declarative/webbrowser/content/FlickableWebView.qml b/demos/declarative/webbrowser/content/FlickableWebView.qml
index 81904c6..46f45e0 100644
--- a/demos/declarative/webbrowser/content/FlickableWebView.qml
+++ b/demos/declarative/webbrowser/content/FlickableWebView.qml
@@ -45,7 +45,7 @@ Flickable {
smoothCache: true // We do want smooth rendering
fillColor: "white"
focus: true
- zoomFactor: 4
+ zoomFactor: 1
onAlert: console.log(message)
@@ -73,7 +73,7 @@ Flickable {
contentsScale: 1/zoomFactor
onContentsSizeChanged: {
// zoom out
- contentsScale = Math.min(0.25,flickable.width / contentsSize.width)
+ contentsScale = Math.min(1,flickable.width / contentsSize.width)
}
onUrlChanged: {
// got to topleft
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index ce3a6e3..355c0f4 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -46,8 +46,6 @@
The following table lists the QML elements provided by the Qt Declarative module.
-\bold {Standard Qt Declarative Elements}
-
\table 80%
\header
\o \bold {States}
@@ -81,6 +79,7 @@ The following table lists the QML elements provided by the Qt Declarative module
\o \l PropertyAction
\o \l ScriptAction
\o \l Transition
+\o \l SmoothedFollow
\o \l SpringFollow
\o \l Behavior
\endlist
@@ -109,11 +108,7 @@ The following table lists the QML elements provided by the Qt Declarative module
\o \l QtObject
\o \l WorkerScript
\endlist
-\endtable
-\bold {QML Items}
-
-\table 80%
\header
\o \bold {Basic Visual Items}
\o \bold {Basic Interaction Items}
diff --git a/doc/src/declarative/extending-examples.qdoc b/doc/src/declarative/extending-examples.qdoc
index cc66838..307162e 100644
--- a/doc/src/declarative/extending-examples.qdoc
+++ b/doc/src/declarative/extending-examples.qdoc
@@ -57,11 +57,6 @@ element, the C++ class can be named differently, or appear in a namespace.
\snippet examples/declarative/extending/adding/person.h 0
-Following the class declaration, we include the QML_DECLARE_TYPE() macro. This
-is necessary to declare the type to QML. It also includes the logic necessary
-to expose the class to Qt's meta system - that is, it includes the
-Q_DECLARE_METATYPE() functionality.
-
\section1 Define the Person class
\snippet examples/declarative/extending/adding/person.cpp 0
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc
index e1c6469..a1d8a10 100644
--- a/doc/src/declarative/extending.qdoc
+++ b/doc/src/declarative/extending.qdoc
@@ -67,12 +67,11 @@ that derive from QObject.
The QML engine has no intrinsic knowledge of any class types. Instead the
programmer must define the C++ types, and their corresponding QML name.
-Custom C++ types are declared QML types using a macro and a template function:
+Custom C++ types are registered using a template function:
\quotation
\code
-#define QML_DECLARE_TYPE(T)
template<typename T>
int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
\endcode
@@ -81,10 +80,6 @@ Calling qmlRegisterType() registers the C++ type \a T with the QML system, and m
under the name \a qmlName in library \a uri version \a versionMajor.versionMinor.
The \a qmlName can be the same as the C++ type name.
-Generally the QML_DECLARE_TYPE() macro should be included immediately following
-the type declaration (usually in its header file), and the template function qmlRegisterType()
-called by the implementation.
-
Type \a T must be a concrete type that inherits QObject and has a default
constructor.
\endquotation
@@ -149,21 +144,16 @@ property can be assigned.
QML also supports assigning Qt interfaces. To assign to a property whose type
is a Qt interface pointer, the interface must also be registered with QML. As
they cannot be instantiated directly, registering a Qt interface is different
-from registering a new QML type. The following macro and function are used instead:
+from registering a new QML type. The following function is used instead:
\quotation
\code
-#define QML_DECLARE_INTERFACE(T)
template<typename T>
int qmlRegisterInterface(const char *typeName)
\endcode
Registers the C++ interface \a T with the QML system as \a typeName.
-Generally the QML_DECLARE_INTERFACE() macro should be included immediately
-following the interface declaration (usually in its header file), and the
-qmlRegisterInterface() template function called by the implementation.
-
Following registration, QML can coerce objects that implement this interface
for assignment to appropriately typed properties.
\endquotation
@@ -198,11 +188,10 @@ To assign to a property, the property's type must have been registered with QML.
Both the qmlRegisterType() and qmlRegisterInterface() template functions already
shown can be used to register a type with QML. Additionally, if a type that acts purely
as a base class that cannot be instantiated from QML needs to be
-registered these macro and function can be used:
+registered, the following function can be used:
\quotation
\code
- #define QML_DECLARE_TYPE(T)
template<typename T>
int qmlRegisterType()
\endcode
@@ -212,10 +201,6 @@ function qmlRegisterType() does not define a mapping between the
C++ class and a QML element name, so the type is not instantiable from QML, but
it is available for type coercion.
-Generally the QML_DECLARE_TYPE() macro should be included immediately following
-the type declaration (usually in its header file), and the
-qmlRegisterType() template function called from the implementation.
-
Type \a T must inherit QObject, but there are no restrictions on whether it is
concrete or the signature of its constructor.
\endquotation
@@ -320,7 +305,6 @@ public:
};
QML_DECLARE_TYPEINFO(MyType, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(MyType)
\endcode
Return an attachment object, of type \a AttachedPropertiesType, for the
attachee \a object instance. It is customary, though not strictly required, for
diff --git a/doc/src/declarative/integrating.qdoc b/doc/src/declarative/integrating.qdoc
index d4034fa..65413ec 100644
--- a/doc/src/declarative/integrating.qdoc
+++ b/doc/src/declarative/integrating.qdoc
@@ -115,8 +115,7 @@ any custom C++ types and create a plugin that registers the custom types
so that they can be used from your QML file.
Here is an example. Suppose you have two classes, \c RedSquare and \c BlueCircle,
-that both inherit from QGraphicsWidget. First, you need to register these two types
-using the \c QML_DECLARE_TYPE macro from \c <QtDeclarative/qdeclarative.h>, like this:
+that both inherit from QGraphicsWidget:
\c [graphicswidgets/redsquare.h]
\snippet doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h 0
diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc
index 8ffe58c..7c0570e 100644
--- a/doc/src/declarative/javascriptblocks.qdoc
+++ b/doc/src/declarative/javascriptblocks.qdoc
@@ -47,7 +47,7 @@ QML encourages building UIs declaratively, using \l {Property Binding} and the
composition of existing \l {QML Elements}. To allow the implementation of more
advanced behavior, QML integrates tightly with imperative JavaScript code.
-The JavaScript environment provided by QML is stricter than that in a webbrowser.
+The JavaScript environment provided by QML is stricter than that in a web browser.
In QML you cannot add, or modify, members of the JavaScript global object. It
is possible to do this accidentally by using a variable without declaring it. In
QML this will throw an exception, so all local variables should be explicitly
@@ -66,7 +66,7 @@ them.
\code
Item {
function factorial(a) {
- a = Integer(a);
+ a = parseInt(a);
if (a <= 0)
return 1;
else
@@ -104,12 +104,12 @@ Item {
}
\endcode
-Both relative and absolute JavaScript URLs can be imported. In the case of a
-relative URL, the location is resolved relative to the location of the
-\l {QML Document} that contains the import. If the script file is not accessible,
-an error will occur. If the JavaScript needs to be fetched from a network
+Both relative and absolute JavaScript URLs can be imported. In the case of a
+relative URL, the location is resolved relative to the location of the
+\l {QML Document} that contains the import. If the script file is not accessible,
+an error will occur. If the JavaScript needs to be fetched from a network
resource, the QML document has a "Loading"
-\l {QDeclarativeComponent::status()}{status} until the script has been
+\l {QDeclarativeComponent::status()}{status} until the script has been
downloaded.
Imported JavaScript files are always qualified using the "as" keyword. The
@@ -143,7 +143,7 @@ stateless library through the use of a pragma, as shown in the following example
.pragma library
function factorial(a) {
- a = Integer(a);
+ a = parseInt(a);
if (a <= 0)
return 1;
else
@@ -160,7 +160,7 @@ parameters.
\section1 Running JavaScript at Startup
It is occasionally necessary to run some imperative code at application (or
-component instance) "startup". While it is tempting to just include the startup
+component instance) startup. While it is tempting to just include the startup
script as \e {global code} in an external script file, this can have severe limitations
as the QML environment may not have been fully established. For example, some objects
might not have been created or some \l {Property Binding}s may not have been run.
@@ -180,7 +180,7 @@ Rectangle {
}
\endcode
-Any element in a QML file - including nested elements and nested QML component
+Any element in a QML file - including nested elements and nested QML component
instances - can use this attached property. If there is more than one \c onCompleted()
handler to execute at startup, they are run sequentially in an undefined order.
diff --git a/doc/src/declarative/network.qdoc b/doc/src/declarative/network.qdoc
index 0a26c68..d268a13 100644
--- a/doc/src/declarative/network.qdoc
+++ b/doc/src/declarative/network.qdoc
@@ -69,8 +69,10 @@ Network transparency is supported throughout QML, for example:
\endlist
Even QML types themselves can be on the network - if the \l {Qt Declarative UI Runtime}{qml} tool is used to load
-\tt http://example.com/mystuff/Hello.qml and that content refers to a type "World", this
-will load from \tt http://example.com/mystuff/World.qml just as it would for a local file.
+\tt http://example.com/mystuff/Hello.qml and that content refers to a type "World", the engine
+will load \tt http://example.com/mystuff/qmldir and resolve the type just as it would for a local file.
+For example if the qmldir file contains the line "World World.qml", it will load
+\tt http://example.com/mystuff/World.qml
Any other resources that \tt Hello.qml referred to, usually by a relative URL, would
similarly be loaded from the network.
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index cbb2146..b4d8a2e 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -70,9 +70,7 @@
\macro QML_DECLARE_TYPE()
\relates QDeclarativeEngine
- Declares a C++ type to be usable in the QML system. In addition
- to this, a type must also be registered with the QML system using
- qmlRegisterType().
+ Equivalent to Q_DECLARE_METATYPE(TYPE) and Q_DECLARE_METATYPE(QDeclarativeListProperty<TYPE>)
*/
@@ -83,7 +81,6 @@
This template function registers the C++ type in the QML system with
the name \a qmlName. in the library imported from \a uri having the
version number composed from \a versionMajor and \a versionMinor.
- The type should also haved been declared with the QML_DECLARE_TYPE() macro.
Returns the QML type id.
@@ -114,7 +111,6 @@
This template function registers the C++ type in the QML system
under the name \a typeName.
- The type should also haved been declared with the QML_DECLARE_TYPE() macro.
Returns the QML type id.
diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h b/doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h
index 028718f..73d66b7 100644
--- a/doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h
+++ b/doc/src/declarative/snippets/integrating/graphicswidgets/bluecircle.h
@@ -39,7 +39,6 @@
**
****************************************************************************/
//![0]
-#include <QtDeclarative/qdeclarative.h>
#include <QGraphicsWidget>
#include <QPainter>
@@ -53,6 +52,4 @@ public:
painter->drawEllipse(0, 0, size().width(), size().height());
}
};
-
-QML_DECLARE_TYPE(BlueCircle)
//![0]
diff --git a/doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h b/doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h
index 76e7d11..3050662 100644
--- a/doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h
+++ b/doc/src/declarative/snippets/integrating/graphicswidgets/redsquare.h
@@ -39,7 +39,6 @@
**
****************************************************************************/
//![0]
-#include <QtDeclarative/qdeclarative.h>
#include <QGraphicsWidget>
#include <QPainter>
@@ -52,6 +51,4 @@ public:
painter->fillRect(0, 0, size().width(), size().height(), QColor(Qt::red));
}
};
-
-QML_DECLARE_TYPE(RedSquare)
//![0]
diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css
index 1c78118..d5920b9 100755
--- a/doc/src/template/style/style.css
+++ b/doc/src/template/style/style.css
@@ -719,6 +719,21 @@
float: right;
color: #254117;
}
+
+ .qmldefault
+ {
+ float: right;
+ color: red;
+ }
+
+ .qmldoc
+ {
+ }
+
+ *.qmlitem p
+ {
+ }
+
#feedbackBox
{
display:none;
diff --git a/examples/declarative/extending/adding/person.h b/examples/declarative/extending/adding/person.h
index fbaf2df..7a9e0f0 100644
--- a/examples/declarative/extending/adding/person.h
+++ b/examples/declarative/extending/adding/person.h
@@ -61,7 +61,6 @@ private:
QString m_name;
int m_shoeSize;
};
-QML_DECLARE_TYPE(Person);
// ![0]
#endif // PERSON_H
diff --git a/examples/declarative/extending/attached/birthdayparty.h b/examples/declarative/extending/attached/birthdayparty.h
index d8ca2e1..7c45d21 100644
--- a/examples/declarative/extending/attached/birthdayparty.h
+++ b/examples/declarative/extending/attached/birthdayparty.h
@@ -59,7 +59,6 @@ public:
private:
QDate m_rsvp;
};
-QML_DECLARE_TYPE(BirthdayPartyAttached)
class BirthdayParty : public QObject
{
@@ -84,6 +83,5 @@ private:
};
QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(BirthdayParty)
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/attached/person.h b/examples/declarative/extending/attached/person.h
index 08caebf..7a4b9c3 100644
--- a/examples/declarative/extending/attached/person.h
+++ b/examples/declarative/extending/attached/person.h
@@ -71,7 +71,6 @@ private:
QString m_brand;
qreal m_price;
};
-QML_DECLARE_TYPE(ShoeDescription);
class Person : public QObject {
Q_OBJECT
@@ -88,20 +87,17 @@ private:
QString m_name;
ShoeDescription m_shoe;
};
-QML_DECLARE_TYPE(Person);
class Boy : public Person {
Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Boy);
class Girl : public Person {
Q_OBJECT
public:
Girl(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Girl);
#endif // PERSON_H
diff --git a/examples/declarative/extending/binding/birthdayparty.h b/examples/declarative/extending/binding/birthdayparty.h
index 8486442..e2757bc 100644
--- a/examples/declarative/extending/binding/birthdayparty.h
+++ b/examples/declarative/extending/binding/birthdayparty.h
@@ -63,7 +63,6 @@ signals:
private:
QDate m_rsvp;
};
-QML_DECLARE_TYPE(BirthdayPartyAttached)
class BirthdayParty : public QObject
{
@@ -100,6 +99,5 @@ private:
};
QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(BirthdayParty)
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/binding/happybirthday.h b/examples/declarative/extending/binding/happybirthday.h
index eb2da5e..0e5a90a 100644
--- a/examples/declarative/extending/binding/happybirthday.h
+++ b/examples/declarative/extending/binding/happybirthday.h
@@ -51,6 +51,7 @@ class HappyBirthday : public QObject, public QDeclarativePropertyValueSource
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+Q_INTERFACES(QDeclarativePropertyValueSource)
public:
HappyBirthday(QObject *parent = 0);
@@ -70,7 +71,6 @@ private:
QDeclarativeProperty m_target;
QString m_name;
};
-QML_DECLARE_TYPE(HappyBirthday);
#endif // HAPPYBIRTHDAY_H
diff --git a/examples/declarative/extending/binding/person.h b/examples/declarative/extending/binding/person.h
index 2d4ec12..0edfcdd 100644
--- a/examples/declarative/extending/binding/person.h
+++ b/examples/declarative/extending/binding/person.h
@@ -74,7 +74,6 @@ private:
QString m_brand;
qreal m_price;
};
-QML_DECLARE_TYPE(ShoeDescription);
class Person : public QObject {
Q_OBJECT
@@ -96,20 +95,17 @@ private:
QString m_name;
ShoeDescription m_shoe;
};
-QML_DECLARE_TYPE(Person);
class Boy : public Person {
Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Boy);
class Girl : public Person {
Q_OBJECT
public:
Girl(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Girl);
#endif // PERSON_H
diff --git a/examples/declarative/extending/coercion/birthdayparty.h b/examples/declarative/extending/coercion/birthdayparty.h
index fffd407..a5d14f9 100644
--- a/examples/declarative/extending/coercion/birthdayparty.h
+++ b/examples/declarative/extending/coercion/birthdayparty.h
@@ -66,6 +66,5 @@ private:
Person *m_celebrant;
QList<Person *> m_guests;
};
-QML_DECLARE_TYPE(BirthdayParty);
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/coercion/person.h b/examples/declarative/extending/coercion/person.h
index 298ffb1..861f135 100644
--- a/examples/declarative/extending/coercion/person.h
+++ b/examples/declarative/extending/coercion/person.h
@@ -60,7 +60,7 @@ private:
QString m_name;
int m_shoeSize;
};
-QML_DECLARE_TYPE(Person);
+
// ![0]
class Boy : public Person {
@@ -68,14 +68,14 @@ Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Boy);
+
class Girl : public Person {
Q_OBJECT
public:
Girl(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Girl);
+
// ![0]
#endif // PERSON_H
diff --git a/examples/declarative/extending/default/birthdayparty.h b/examples/declarative/extending/default/birthdayparty.h
index 49c20bd..c0cb0a4 100644
--- a/examples/declarative/extending/default/birthdayparty.h
+++ b/examples/declarative/extending/default/birthdayparty.h
@@ -67,6 +67,5 @@ private:
QList<Person *> m_guests;
};
// ![0]
-QML_DECLARE_TYPE(BirthdayParty);
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/default/person.h b/examples/declarative/extending/default/person.h
index b3eceaa..832bf11 100644
--- a/examples/declarative/extending/default/person.h
+++ b/examples/declarative/extending/default/person.h
@@ -60,20 +60,17 @@ private:
QString m_name;
int m_shoeSize;
};
-QML_DECLARE_TYPE(Person);
class Boy : public Person {
Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Boy);
class Girl : public Person {
Q_OBJECT
public:
Girl(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Girl);
#endif // PERSON_H
diff --git a/examples/declarative/extending/extended/lineedit.cpp b/examples/declarative/extending/extended/lineedit.cpp
index 417fbd9..0e521ec 100644
--- a/examples/declarative/extending/extended/lineedit.cpp
+++ b/examples/declarative/extending/extended/lineedit.cpp
@@ -102,4 +102,4 @@ void LineEditExtension::setBottomMargin(int m)
m_lineedit->setTextMargins(l, t, r, m);
}
-QML_DECLARE_TYPE(QLineEdit);
+
diff --git a/examples/declarative/extending/grouped/birthdayparty.h b/examples/declarative/extending/grouped/birthdayparty.h
index 42439c4..4ac5602 100644
--- a/examples/declarative/extending/grouped/birthdayparty.h
+++ b/examples/declarative/extending/grouped/birthdayparty.h
@@ -65,6 +65,6 @@ private:
Person *m_celebrant;
QList<Person *> m_guests;
};
-QML_DECLARE_TYPE(BirthdayParty);
+
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/grouped/person.h b/examples/declarative/extending/grouped/person.h
index 5ea2348..216c015 100644
--- a/examples/declarative/extending/grouped/person.h
+++ b/examples/declarative/extending/grouped/person.h
@@ -71,7 +71,6 @@ private:
QString m_brand;
qreal m_price;
};
-QML_DECLARE_TYPE(ShoeDescription);
class Person : public QObject {
Q_OBJECT
@@ -90,20 +89,17 @@ private:
QString m_name;
ShoeDescription m_shoe;
};
-QML_DECLARE_TYPE(Person);
class Boy : public Person {
Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Boy);
class Girl : public Person {
Q_OBJECT
public:
Girl(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Girl);
#endif // PERSON_H
diff --git a/examples/declarative/extending/properties/birthdayparty.h b/examples/declarative/extending/properties/birthdayparty.h
index c4cb536..dd01562 100644
--- a/examples/declarative/extending/properties/birthdayparty.h
+++ b/examples/declarative/extending/properties/birthdayparty.h
@@ -71,7 +71,6 @@ private:
Person *m_celebrant;
QList<Person *> m_guests;
};
-QML_DECLARE_TYPE(BirthdayParty);
// ![3]
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/properties/person.h b/examples/declarative/extending/properties/person.h
index 860a607..7504d18 100644
--- a/examples/declarative/extending/properties/person.h
+++ b/examples/declarative/extending/properties/person.h
@@ -60,6 +60,5 @@ private:
QString m_name;
int m_shoeSize;
};
-QML_DECLARE_TYPE(Person);
#endif // PERSON_H
diff --git a/examples/declarative/extending/signal/birthdayparty.h b/examples/declarative/extending/signal/birthdayparty.h
index bcdc513..a2b35cd 100644
--- a/examples/declarative/extending/signal/birthdayparty.h
+++ b/examples/declarative/extending/signal/birthdayparty.h
@@ -59,7 +59,6 @@ public:
private:
QDate m_rsvp;
};
-QML_DECLARE_TYPE(BirthdayPartyAttached)
class BirthdayParty : public QObject
{
@@ -89,8 +88,6 @@ private:
Person *m_celebrant;
QList<Person *> m_guests;
};
-
QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(BirthdayParty)
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/signal/person.h b/examples/declarative/extending/signal/person.h
index 08caebf..7a4b9c3 100644
--- a/examples/declarative/extending/signal/person.h
+++ b/examples/declarative/extending/signal/person.h
@@ -71,7 +71,6 @@ private:
QString m_brand;
qreal m_price;
};
-QML_DECLARE_TYPE(ShoeDescription);
class Person : public QObject {
Q_OBJECT
@@ -88,20 +87,17 @@ private:
QString m_name;
ShoeDescription m_shoe;
};
-QML_DECLARE_TYPE(Person);
class Boy : public Person {
Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Boy);
class Girl : public Person {
Q_OBJECT
public:
Girl(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Girl);
#endif // PERSON_H
diff --git a/examples/declarative/extending/valuesource/birthdayparty.h b/examples/declarative/extending/valuesource/birthdayparty.h
index 819a200..a9b3102 100644
--- a/examples/declarative/extending/valuesource/birthdayparty.h
+++ b/examples/declarative/extending/valuesource/birthdayparty.h
@@ -60,7 +60,6 @@ public:
private:
QDate m_rsvp;
};
-QML_DECLARE_TYPE(BirthdayPartyAttached)
class BirthdayParty : public QObject
{
@@ -95,8 +94,6 @@ private:
Person *m_celebrant;
QList<Person *> m_guests;
};
-
QML_DECLARE_TYPEINFO(BirthdayParty, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(BirthdayParty)
#endif // BIRTHDAYPARTY_H
diff --git a/examples/declarative/extending/valuesource/happybirthday.h b/examples/declarative/extending/valuesource/happybirthday.h
index b48c012..8548eb8 100644
--- a/examples/declarative/extending/valuesource/happybirthday.h
+++ b/examples/declarative/extending/valuesource/happybirthday.h
@@ -74,7 +74,6 @@ private:
// ![2]
};
// ![2]
-QML_DECLARE_TYPE(HappyBirthday);
#endif // HAPPYBIRTHDAY_H
diff --git a/examples/declarative/extending/valuesource/person.h b/examples/declarative/extending/valuesource/person.h
index 08caebf..7a4b9c3 100644
--- a/examples/declarative/extending/valuesource/person.h
+++ b/examples/declarative/extending/valuesource/person.h
@@ -71,7 +71,6 @@ private:
QString m_brand;
qreal m_price;
};
-QML_DECLARE_TYPE(ShoeDescription);
class Person : public QObject {
Q_OBJECT
@@ -88,20 +87,17 @@ private:
QString m_name;
ShoeDescription m_shoe;
};
-QML_DECLARE_TYPE(Person);
class Boy : public Person {
Q_OBJECT
public:
Boy(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Boy);
class Girl : public Person {
Q_OBJECT
public:
Girl(QObject * parent = 0);
};
-QML_DECLARE_TYPE(Girl);
#endif // PERSON_H
diff --git a/examples/declarative/fillmode/content/QtLogo.qml b/examples/declarative/fillmode/content/QtLogo.qml
new file mode 100644
index 0000000..6dd714d
--- /dev/null
+++ b/examples/declarative/fillmode/content/QtLogo.qml
@@ -0,0 +1,30 @@
+import Qt 4.7
+
+Item {
+ id: qtLogo
+
+ property alias fillMode: image.fillMode
+ property alias label: labelText.text
+
+ width: ((window.width - 20) - ((grid.columns - 1) * grid.spacing)) / grid.columns
+ height: ((window.height - 20) - ((grid.rows - 1) * grid.spacing)) / grid.rows
+
+ Column {
+ anchors.fill: parent
+
+ Rectangle {
+ height: qtLogo.height - 30; width: qtLogo.width
+ border.color: "black"; clip: true
+
+ Image {
+ id: image
+ anchors.fill: parent; smooth: true; source: "qt-logo.png"
+ }
+ }
+
+ Text {
+ id: labelText; anchors.horizontalCenter: parent.horizontalCenter
+ height: 30; verticalAlignment: Text.AlignVCenter
+ }
+ }
+}
diff --git a/examples/declarative/fillmode/content/qt-logo.png b/examples/declarative/fillmode/content/qt-logo.png
new file mode 100644
index 0000000..14ddf2a
--- /dev/null
+++ b/examples/declarative/fillmode/content/qt-logo.png
Binary files differ
diff --git a/examples/declarative/fillmode/face.png b/examples/declarative/fillmode/face.png
deleted file mode 100644
index 9623b1a..0000000
--- a/examples/declarative/fillmode/face.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/fillmode/fillmode.qml b/examples/declarative/fillmode/fillmode.qml
index e47fc9b..e5b0336 100644
--- a/examples/declarative/fillmode/fillmode.qml
+++ b/examples/declarative/fillmode/fillmode.qml
@@ -1,44 +1,22 @@
import Qt 4.7
+import "content"
-Image {
- width: 400
- height: 250
- source: "face.png"
+Rectangle {
+ id: window
- SequentialAnimation on fillMode {
- loops: Animation.Infinite
- PropertyAction { value: Image.Stretch }
- PropertyAction { target: label; property: "text"; value: "Stretch" }
- PauseAnimation { duration: 1000 }
- PropertyAction { value: Image.PreserveAspectFit }
- PropertyAction { target: label; property: "text"; value: "PreserveAspectFit" }
- PauseAnimation { duration: 1000 }
- PropertyAction { value: Image.PreserveAspectCrop }
- PropertyAction { target: label; property: "text"; value: "PreserveAspectCrop" }
- PauseAnimation { duration: 1000 }
- PropertyAction { value: Image.Tile }
- PropertyAction { target: label; property: "text"; value: "Tile" }
- PauseAnimation { duration: 1000 }
- PropertyAction { value: Image.TileHorizontally }
- PropertyAction { target: label; property: "text"; value: "TileHorizontally" }
- PauseAnimation { duration: 1000 }
- PropertyAction { value: Image.TileVertically }
- PropertyAction { target: label; property: "text"; value: "TileVertically" }
- PauseAnimation { duration: 1000 }
- }
+ width: 800; height: 480
+ color: "#cdcdcd"
- Text {
- id: label
- font.pointSize: 24
- color: "blue"
- style: Text.Outline
- styleColor: "white"
- anchors.centerIn: parent
- }
+ Grid {
+ id: grid
+ anchors { fill: parent; topMargin: 10; leftMargin: 10; rightMargin: 10; bottomMargin: 10 }
+ columns: 3; rows: 2; spacing: 20
- Rectangle {
- border.color: "black"
- color: "transparent"
- anchors { fill: parent; rightMargin: 1; bottomMargin: 1 }
+ QtLogo { fillMode: Image.Stretch; label: "Stretch" }
+ QtLogo { fillMode: Image.PreserveAspectFit; label: "PreserveAspectFit" }
+ QtLogo { fillMode: Image.PreserveAspectCrop; label: "PreserveAspectCrop" }
+ QtLogo { fillMode: Image.Tile; label: "Tile" }
+ QtLogo { fillMode: Image.TileHorizontally; label: "TileHorizontally" }
+ QtLogo { fillMode: Image.TileVertically; label: "TileVertically" }
}
}
diff --git a/examples/declarative/plugins/README b/examples/declarative/plugins/README
index 3ae256d..fe519f8 100644
--- a/examples/declarative/plugins/README
+++ b/examples/declarative/plugins/README
@@ -5,5 +5,5 @@ by a C++ plugin (providing the "Time" type), and by QML files (providing the
To run:
make install
- qml plugins.qml
+ qml -I . plugins.qml
diff --git a/examples/declarative/plugins/plugins.pro b/examples/declarative/plugins/plugins.pro
index c409d39..b501ae3 100644
--- a/examples/declarative/plugins/plugins.pro
+++ b/examples/declarative/plugins/plugins.pro
@@ -3,7 +3,6 @@ DESTDIR = com/nokia/TimeExample
TARGET = qtimeexampleqmlplugin
CONFIG += qt plugin
QT += declarative
-VERSION = 1.0.0
SOURCES += plugin.cpp
diff --git a/examples/declarative/proxywidgets/proxywidgets.cpp b/examples/declarative/proxywidgets/proxywidgets.cpp
index 47d0cb9..067eb2c 100644
--- a/examples/declarative/proxywidgets/proxywidgets.cpp
+++ b/examples/declarative/proxywidgets/proxywidgets.cpp
@@ -94,6 +94,4 @@ public:
#include "proxywidgets.moc"
-QML_DECLARE_TYPE(MyPushButton)
-
Q_EXPORT_PLUGIN2(proxywidgetsplugin, ProxyWidgetsPlugin);
diff --git a/examples/declarative/proxywidgets/proxywidgets.pro b/examples/declarative/proxywidgets/proxywidgets.pro
index eb85191..cb07d80 100644
--- a/examples/declarative/proxywidgets/proxywidgets.pro
+++ b/examples/declarative/proxywidgets/proxywidgets.pro
@@ -3,7 +3,6 @@ DESTDIR = ProxyWidgets
TARGET = proxywidgetsplugin
CONFIG += qt plugin
QT += declarative
-VERSION = 1.0.0
SOURCES += proxywidgets.cpp
diff --git a/examples/declarative/tutorials/samegame/samegame1/Block.qml b/examples/declarative/tutorials/samegame/samegame1/Block.qml
index a535235..a23654b 100644
--- a/examples/declarative/tutorials/samegame/samegame1/Block.qml
+++ b/examples/declarative/tutorials/samegame/samegame1/Block.qml
@@ -1,9 +1,9 @@
//![0]
import Qt 4.7
-Item {
+Item {
id: block
-
+
Image {
id: img
anchors.fill: parent
diff --git a/examples/declarative/tutorials/samegame/samegame1/Button.qml b/examples/declarative/tutorials/samegame/samegame1/Button.qml
index e8034ac..e84b1ce 100644
--- a/examples/declarative/tutorials/samegame/samegame1/Button.qml
+++ b/examples/declarative/tutorials/samegame/samegame1/Button.qml
@@ -18,9 +18,9 @@ Rectangle {
GradientStop {
position: 0.0
color: {
- if (mouseArea.pressed)
+ if (mouseArea.pressed)
return activePalette.dark
- else
+ else
return activePalette.light
}
}
diff --git a/examples/declarative/tutorials/samegame/samegame2/Block.qml b/examples/declarative/tutorials/samegame/samegame2/Block.qml
index 88b3d79..4e71e60 100644
--- a/examples/declarative/tutorials/samegame/samegame2/Block.qml
+++ b/examples/declarative/tutorials/samegame/samegame2/Block.qml
@@ -1,8 +1,8 @@
import Qt 4.7
-Item {
+Item {
id: block
-
+
Image {
id: img
anchors.fill: parent
diff --git a/examples/declarative/tutorials/samegame/samegame2/Button.qml b/examples/declarative/tutorials/samegame/samegame2/Button.qml
index 8d322de5..737d886 100644
--- a/examples/declarative/tutorials/samegame/samegame2/Button.qml
+++ b/examples/declarative/tutorials/samegame/samegame2/Button.qml
@@ -17,9 +17,9 @@ Rectangle {
GradientStop {
position: 0.0
color: {
- if (mouseArea.pressed)
+ if (mouseArea.pressed)
return activePalette.dark
- else
+ else
return activePalette.light
}
}
diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.qml b/examples/declarative/tutorials/samegame/samegame2/samegame.qml
index 7a17d16..a7d1fba 100644
--- a/examples/declarative/tutorials/samegame/samegame2/samegame.qml
+++ b/examples/declarative/tutorials/samegame/samegame2/samegame.qml
@@ -31,7 +31,7 @@ Rectangle {
//![1]
Button {
anchors { left: parent.left; leftMargin: 3; verticalCenter: parent.verticalCenter }
- text: "New Game"
+ text: "New Game"
onClicked: SameGame.startNewGame()
}
//![1]
diff --git a/examples/declarative/tutorials/samegame/samegame3/Block.qml b/examples/declarative/tutorials/samegame/samegame3/Block.qml
index dd0fb48..7411259 100644
--- a/examples/declarative/tutorials/samegame/samegame3/Block.qml
+++ b/examples/declarative/tutorials/samegame/samegame3/Block.qml
@@ -1,11 +1,11 @@
//![0]
import Qt 4.7
-Item {
+Item {
id: block
property int type: 0
-
+
Image {
id: img
diff --git a/examples/declarative/tutorials/samegame/samegame3/Button.qml b/examples/declarative/tutorials/samegame/samegame3/Button.qml
index 8d322de5..737d886 100644
--- a/examples/declarative/tutorials/samegame/samegame3/Button.qml
+++ b/examples/declarative/tutorials/samegame/samegame3/Button.qml
@@ -17,9 +17,9 @@ Rectangle {
GradientStop {
position: 0.0
color: {
- if (mouseArea.pressed)
+ if (mouseArea.pressed)
return activePalette.dark
- else
+ else
return activePalette.light
}
}
diff --git a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml
index be3a7b7..15b3b2f 100644
--- a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml
+++ b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml
@@ -21,7 +21,7 @@ Rectangle {
border.width: 1
opacity: 0
- Behavior on opacity {
+ Behavior on opacity {
NumberAnimation { duration: 1000 }
}
diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.qml b/examples/declarative/tutorials/samegame/samegame3/samegame.qml
index bc5f2f8..50f9d5d 100644
--- a/examples/declarative/tutorials/samegame/samegame3/samegame.qml
+++ b/examples/declarative/tutorials/samegame/samegame3/samegame.qml
@@ -52,7 +52,7 @@ Rectangle {
Button {
anchors { left: parent.left; leftMargin: 3; verticalCenter: parent.verticalCenter }
- text: "New Game"
+ text: "New Game"
onClicked: SameGame.startNewGame()
}
diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml
index d3a9df7..d6ef2e5 100644
--- a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml
+++ b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml
@@ -17,21 +17,21 @@ Item {
//![1]
//![2]
- Image {
+ Image {
id: img
anchors.fill: parent
source: {
if (type == 0)
return "../../shared/pics/redStone.png";
- else if (type == 1)
+ else if (type == 1)
return "../../shared/pics/blueStone.png";
else
return "../../shared/pics/greenStone.png";
}
opacity: 0
- Behavior on opacity {
+ Behavior on opacity {
NumberAnimation { properties:"opacity"; duration: 200 }
}
}
@@ -41,7 +41,7 @@ Item {
Particles {
id: particles
- width: 1; height: 1
+ width: 1; height: 1
anchors.centerIn: parent
emissionRate: 0
diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml
index 8d322de5..737d886 100644
--- a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml
+++ b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml
@@ -17,9 +17,9 @@ Rectangle {
GradientStop {
position: 0.0
color: {
- if (mouseArea.pressed)
+ if (mouseArea.pressed)
return activePalette.dark
- else
+ else
return activePalette.light
}
}
diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml
index adb3f9e..6848534 100644
--- a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml
+++ b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml
@@ -20,7 +20,7 @@ Rectangle {
border.width: 1
opacity: 0
- Behavior on opacity {
+ Behavior on opacity {
NumberAnimation { duration: 1000 }
}
diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame.qml b/examples/declarative/tutorials/samegame/samegame4/samegame.qml
index b2a490d..404af0a 100644
--- a/examples/declarative/tutorials/samegame/samegame4/samegame.qml
+++ b/examples/declarative/tutorials/samegame/samegame4/samegame.qml
@@ -73,7 +73,7 @@ Rectangle {
Button {
anchors { left: parent.left; leftMargin: 3; verticalCenter: parent.verticalCenter }
- text: "New Game"
+ text: "New Game"
onClicked: SameGame.startNewGame()
}
diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp
index 9d9d1d0..34e73fd 100644
--- a/src/declarative/debugger/qdeclarativedebugservice.cpp
+++ b/src/declarative/debugger/qdeclarativedebugservice.cpp
@@ -60,12 +60,12 @@ class QDeclarativeDebugServer : public QObject
Q_DISABLE_COPY(QDeclarativeDebugServer)
public:
static QDeclarativeDebugServer *instance();
- void wait();
- void registerForStartNotification(QObject *object, const char *receiver);
+ void listen();
+ bool hasDebuggingClient() const;
private Q_SLOTS:
void readyRead();
- void registeredObjectDestroyed(QObject *object);
+ void newConnection();
private:
friend class QDeclarativeDebugService;
@@ -78,14 +78,14 @@ class QDeclarativeDebugServerPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QDeclarativeDebugServer)
public:
QDeclarativeDebugServerPrivate();
- void wait();
int port;
QTcpSocket *connection;
QPacketProtocol *protocol;
QHash<QString, QDeclarativeDebugService *> plugins;
QStringList enabledPlugins;
- QList<QPair<QObject*, QByteArray> > notifyClients;
+ QTcpServer *tcpServer;
+ bool gotHello;
};
class QDeclarativeDebugServicePrivate : public QObjectPrivate
@@ -99,56 +99,41 @@ public:
};
QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate()
-: connection(0), protocol(0)
+: connection(0), protocol(0), gotHello(false)
{
}
-void QDeclarativeDebugServerPrivate::wait()
+void QDeclarativeDebugServer::listen()
{
- Q_Q(QDeclarativeDebugServer);
- QTcpServer server;
-
- if (!server.listen(QHostAddress::Any, port)) {
- qWarning("QDeclarativeDebugServer: Unable to listen on port %d", port);
- return;
- }
-
- qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", port);
-
- for (int i=0; i<notifyClients.count(); i++) {
- if (!QMetaObject::invokeMethod(notifyClients[i].first, notifyClients[i].second)) {
- qWarning() << "QDeclarativeDebugServer: unable to call method" << notifyClients[i].second
- << "on object" << notifyClients[i].first << "to notify of debug server start";
- }
- }
- notifyClients.clear();
+ Q_D(QDeclarativeDebugServer);
- if (!server.waitForNewConnection(-1)) {
- qWarning("QDeclarativeDebugServer: Connection error");
- return;
- }
+ d->tcpServer = new QTcpServer(this);
+ QObject::connect(d->tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection()));
+ if (d->tcpServer->listen(QHostAddress::Any, d->port))
+ qWarning("QDeclarativeDebugServer: Waiting for connection on port %d...", d->port);
+ else
+ qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port);
+}
- connection = server.nextPendingConnection();
- connection->setParent(q);
- protocol = new QPacketProtocol(connection, q);
+void QDeclarativeDebugServer::newConnection()
+{
+ Q_D(QDeclarativeDebugServer);
- // ### Wait for hello
- while (!protocol->packetsAvailable()) {
- connection->waitForReadyRead();
- }
- QPacket hello = protocol->read();
- QString name;
- hello >> name >> enabledPlugins;
- if (name != QLatin1String("QDeclarativeDebugServer")) {
- qWarning("QDeclarativeDebugServer: Invalid hello message");
- delete protocol; delete connection; connection = 0; protocol = 0;
+ if (d->connection) {
+ qWarning("QDeclarativeDebugServer error: another client is already connected");
return;
}
- QObject::connect(protocol, SIGNAL(readyRead()), q, SLOT(readyRead()));
- q->readyRead();
+ d->connection = d->tcpServer->nextPendingConnection();
+ d->connection->setParent(this);
+ d->protocol = new QPacketProtocol(d->connection, this);
+ QObject::connect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
+}
- qWarning("QDeclarativeDebugServer: Connection established");
+bool QDeclarativeDebugServer::hasDebuggingClient() const
+{
+ Q_D(const QDeclarativeDebugServer);
+ return d->gotHello;
}
QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
@@ -163,36 +148,15 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
bool ok = false;
int port = env.toInt(&ok);
- if (ok && port > 1024)
+ if (ok && port > 1024) {
server = new QDeclarativeDebugServer(port);
+ server->listen();
+ }
}
return server;
}
-void QDeclarativeDebugServer::wait()
-{
- Q_D(QDeclarativeDebugServer);
- d->wait();
-}
-
-void QDeclarativeDebugServer::registerForStartNotification(QObject *object, const char *methodName)
-{
- Q_D(QDeclarativeDebugServer);
- connect(object, SIGNAL(destroyed(QObject*)), SLOT(registeredObjectDestroyed(QObject*)));
- d->notifyClients.append(qMakePair(object, QByteArray(methodName)));
-}
-
-void QDeclarativeDebugServer::registeredObjectDestroyed(QObject *object)
-{
- Q_D(QDeclarativeDebugServer);
- QMutableListIterator<QPair<QObject*, QByteArray> > i(d->notifyClients);
- while (i.hasNext()) {
- if (i.next().first == object)
- i.remove();
- }
-}
-
QDeclarativeDebugServer::QDeclarativeDebugServer(int port)
: QObject(*(new QDeclarativeDebugServerPrivate))
{
@@ -204,6 +168,23 @@ void QDeclarativeDebugServer::readyRead()
{
Q_D(QDeclarativeDebugServer);
+ if (!d->gotHello) {
+ QPacket hello = d->protocol->read();
+ QString name;
+ hello >> name >> d->enabledPlugins;
+ if (name != QLatin1String("QDeclarativeDebugServer")) {
+ qWarning("QDeclarativeDebugServer: Invalid hello message");
+ QObject::disconnect(d->protocol, SIGNAL(readyRead()), this, SLOT(readyRead()));
+ d->protocol->deleteLater();
+ d->protocol = 0;
+ d->connection->deleteLater();
+ d->connection = 0;
+ return;
+ }
+ d->gotHello = true;
+ qWarning("QDeclarativeDebugServer: Connection established");
+ }
+
QString debugServer(QLatin1String("QDeclarativeDebugServer"));
while (d->protocol->packetsAvailable()) {
@@ -375,6 +356,12 @@ bool QDeclarativeDebugService::isDebuggingEnabled()
return QDeclarativeDebugServer::instance() != 0;
}
+bool QDeclarativeDebugService::hasDebuggingClient()
+{
+ return QDeclarativeDebugServer::instance() != 0
+ && QDeclarativeDebugServer::instance()->hasDebuggingClient();
+}
+
QString QDeclarativeDebugService::objectToString(QObject *obj)
{
if(!obj)
@@ -390,16 +377,6 @@ QString QDeclarativeDebugService::objectToString(QObject *obj)
return rv;
}
-void QDeclarativeDebugService::waitForClients()
-{
- QDeclarativeDebugServer::instance()->wait();
-}
-
-void QDeclarativeDebugService::notifyOnServerStart(QObject *object, const char *receiver)
-{
- QDeclarativeDebugServer::instance()->registerForStartNotification(object, receiver);
-}
-
void QDeclarativeDebugService::sendMessage(const QByteArray &message)
{
Q_D(QDeclarativeDebugService);
diff --git a/src/declarative/debugger/qdeclarativedebugservice_p.h b/src/declarative/debugger/qdeclarativedebugservice_p.h
index 498edf3..c461ddf 100644
--- a/src/declarative/debugger/qdeclarativedebugservice_p.h
+++ b/src/declarative/debugger/qdeclarativedebugservice_p.h
@@ -68,19 +68,16 @@ public:
static int idForObject(QObject *);
static QObject *objectForId(int);
- static bool isDebuggingEnabled();
static QString objectToString(QObject *obj);
- static void waitForClients();
-
- static void notifyOnServerStart(QObject *object, const char *receiver);
+ static bool isDebuggingEnabled();
+ static bool hasDebuggingClient();
protected:
virtual void enabledChanged(bool);
virtual void messageReceived(const QByteArray &);
private:
- void registerForStartNotification(QObject *object, const char *methodName);
friend class QDeclarativeDebugServer;
};
diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
index 6ab126d..c81c2d2 100644
--- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
@@ -44,6 +44,7 @@
#ifndef QT_NO_MOVIE
+#include <qdeclarativeinfo.h>
#include <qdeclarativeengine.h>
#include <QMovie>
@@ -213,7 +214,7 @@ void QDeclarativeAnimatedImage::setSource(const QUrl &url)
//### should be unified with movieRequestFinished
d->_movie = new QMovie(lf);
if (!d->_movie->isValid()){
- qWarning() << "Error Reading Animated Image File" << d->url;
+ qmlInfo(this) << "Error Reading Animated Image File " << d->url.toString();
delete d->_movie;
d->_movie = 0;
return;
@@ -270,7 +271,7 @@ void QDeclarativeAnimatedImage::movieRequestFinished()
d->_movie = new QMovie(d->reply);
if (!d->_movie->isValid()){
- qWarning() << "Error Reading Animated Image File " << d->url;
+ qmlInfo(this) << "Error Reading Animated Image File " << d->url;
delete d->_movie;
d->_movie = 0;
return;
diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
index be9d8bd..06f8363 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -82,7 +82,7 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage()
QDeclarativePixmapCache::cancel(d->sciurl, this);
}
/*!
- \qmlproperty enum BorderImage::status
+ \qmlproperty enumeration BorderImage::status
This property holds the status of image loading. It can be one of:
\list
@@ -264,9 +264,9 @@ void QDeclarativeBorderImage::load()
When the image is scaled:
\list
\i the corners (sections 1, 3, 7, and 9) are not scaled at all
- \i the middle (section 5) is scaled according to BorderImage::horizontalTileMode and BorderImage::verticalTileMode
- \i sections 2 and 8 are scaled according to BorderImage::horizontalTileMode
- \i sections 4 and 6 are scaled according to BorderImage::verticalTileMode
+ \i sections 2 and 8 are scaled according to \l{BorderImage::horizontalTileMode}{horizontalTileMode}
+ \i sections 4 and 6 are scaled according to \l{BorderImage::verticalTileMode}{verticalTileMode}
+ \i the middle (section 5) is scaled according to both \l{BorderImage::horizontalTileMode}{horizontalTileMode} and \l{BorderImage::verticalTileMode}{verticalTileMode}
\endlist
Each border line (left, right, top, and bottom) specifies an offset from the respective side. For example, \c{border.bottom: 10} sets the bottom line 10 pixels up from the bottom of the image.
@@ -282,8 +282,8 @@ QDeclarativeScaleGrid *QDeclarativeBorderImage::border()
}
/*!
- \qmlproperty TileMode BorderImage::horizontalTileMode
- \qmlproperty TileMode BorderImage::verticalTileMode
+ \qmlproperty enumeration BorderImage::horizontalTileMode
+ \qmlproperty enumeration BorderImage::verticalTileMode
This property describes how to repeat or stretch the middle parts of the border image.
diff --git a/src/declarative/graphicsitems/qdeclarativeevents.cpp b/src/declarative/graphicsitems/qdeclarativeevents.cpp
index a181071..4425c97 100644
--- a/src/declarative/graphicsitems/qdeclarativeevents.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeevents.cpp
@@ -145,7 +145,7 @@ Item {
*/
/*!
- \qmlproperty enum MouseEvent::button
+ \qmlproperty enumeration MouseEvent::button
This property holds the button that caused the event. It can be one of:
\list
diff --git a/src/declarative/graphicsitems/qdeclarativeevents_p_p.h b/src/declarative/graphicsitems/qdeclarativeevents_p_p.h
index 65ac8de..0e0329e 100644
--- a/src/declarative/graphicsitems/qdeclarativeevents_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeevents_p_p.h
@@ -115,6 +115,10 @@ public:
bool wasHeld() const { return _wasHeld; }
bool isClick() const { return _isClick; }
+ // only for internal usage
+ void setX(int x) { _x = x; }
+ void setY(int y) { _y = y; }
+
bool isAccepted() { return _accepted; }
void setAccepted(bool accepted) { _accepted = accepted; }
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index 951b171..a76d88e 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -248,18 +248,12 @@ void QDeclarativeFlickablePrivate::fixupX_callback(void *data)
void QDeclarativeFlickablePrivate::fixupX()
{
Q_Q(QDeclarativeFlickable);
- if (!q->xflick() || hData.move.timeLine())
- return;
-
fixup(hData, q->minXExtent(), q->maxXExtent());
}
void QDeclarativeFlickablePrivate::fixupY()
{
Q_Q(QDeclarativeFlickable);
- if (!q->yflick() || vData.move.timeLine())
- return;
-
fixup(vData, q->minYExtent(), q->maxYExtent());
}
@@ -272,7 +266,7 @@ void QDeclarativeFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal
if (fixupDuration) {
qreal dist = minExtent - data.move;
timeline.move(data.move, minExtent - dist/2, QEasingCurve(QEasingCurve::InQuad), fixupDuration/4);
- timeline.move(data.move, minExtent, QEasingCurve(QEasingCurve::OutQuint), 3*fixupDuration/4);
+ timeline.move(data.move, minExtent, QEasingCurve(QEasingCurve::OutExpo), 3*fixupDuration/4);
} else {
data.move.setValue(minExtent);
q->viewportMoved();
@@ -284,7 +278,7 @@ void QDeclarativeFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal
if (fixupDuration) {
qreal dist = maxExtent - data.move;
timeline.move(data.move, maxExtent - dist/2, QEasingCurve(QEasingCurve::InQuad), fixupDuration/4);
- timeline.move(data.move, maxExtent, QEasingCurve(QEasingCurve::OutQuint), 3*fixupDuration/4);
+ timeline.move(data.move, maxExtent, QEasingCurve(QEasingCurve::OutExpo), 3*fixupDuration/4);
} else {
data.move.setValue(maxExtent);
q->viewportMoved();
@@ -1059,8 +1053,12 @@ void QDeclarativeFlickable::setContentWidth(qreal w)
else
d->viewport->setWidth(w);
// Make sure that we're entirely in view.
- if (!d->pressed)
+ if (!d->pressed) {
+ int oldDuration = d->fixupDuration;
+ d->fixupDuration = 0;
d->fixupX();
+ d->fixupDuration = oldDuration;
+ }
emit contentWidthChanged();
d->updateBeginningEnd();
}
@@ -1082,8 +1080,12 @@ void QDeclarativeFlickable::setContentHeight(qreal h)
else
d->viewport->setHeight(h);
// Make sure that we're entirely in view.
- if (!d->pressed)
+ if (!d->pressed) {
+ int oldDuration = d->fixupDuration;
+ d->fixupDuration = 0;
d->fixupY();
+ d->fixupDuration = oldDuration;
+ }
emit contentHeightChanged();
d->updateBeginningEnd();
}
diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
index 98e34a9..57045f1 100644
--- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp
@@ -57,10 +57,14 @@ public:
QDeclarativeFlipablePrivate() : current(QDeclarativeFlipable::Front), front(0), back(0) {}
void updateSceneTransformFromParent();
+ void setBackTransform();
QDeclarativeFlipable::Side current;
QDeclarativeGuard<QGraphicsObject> front;
QDeclarativeGuard<QGraphicsObject> back;
+
+ bool wantBackXFlipped;
+ bool wantBackYFlipped;
};
/*!
@@ -148,6 +152,17 @@ void QDeclarativeFlipable::setBack(QGraphicsObject *back)
d->back->setParentItem(this);
if (Front == d->current)
d->back->setOpacity(0.);
+ connect(back, SIGNAL(widthChanged()),
+ this, SLOT(retransformBack()));
+ connect(back, SIGNAL(heightChanged()),
+ this, SLOT(retransformBack()));
+}
+
+void QDeclarativeFlipable::retransformBack()
+{
+ Q_D(QDeclarativeFlipable);
+ if (d->current == QDeclarativeFlipable::Back && d->back)
+ d->setBackTransform();
}
/*!
@@ -184,26 +199,20 @@ void QDeclarativeFlipablePrivate::updateSceneTransformFromParent()
qreal cross = (p1.x() - p2.x()) * (p3.y() - p2.y()) -
(p1.y() - p2.y()) * (p3.x() - p2.x());
+ wantBackYFlipped = p1.x() >= p2.x();
+ wantBackXFlipped = p2.y() >= p3.y();
+
QDeclarativeFlipable::Side newSide;
if (cross > 0) {
- newSide = QDeclarativeFlipable::Back;
+ newSide = QDeclarativeFlipable::Back;
} else {
newSide = QDeclarativeFlipable::Front;
}
if (newSide != current) {
current = newSide;
- if (current == QDeclarativeFlipable::Back && back) {
- QTransform mat;
- QGraphicsItemPrivate *dBack = QGraphicsItemPrivate::get(back);
- mat.translate(dBack->width()/2,dBack->height()/2);
- if (dBack->width() && p1.x() >= p2.x())
- mat.rotate(180, Qt::YAxis);
- if (dBack->height() && p2.y() >= p3.y())
- mat.rotate(180, Qt::XAxis);
- mat.translate(-dBack->width()/2,-dBack->height()/2);
- back->setTransform(mat);
- }
+ if (current == QDeclarativeFlipable::Back && back)
+ setBackTransform();
if (front)
front->setOpacity((current==QDeclarativeFlipable::Front)?1.:0.);
if (back)
@@ -212,4 +221,20 @@ void QDeclarativeFlipablePrivate::updateSceneTransformFromParent()
}
}
+/* Depends on the width/height of the back item, and so needs reevaulating
+ if those change.
+*/
+void QDeclarativeFlipablePrivate::setBackTransform()
+{
+ QTransform mat;
+ QGraphicsItemPrivate *dBack = QGraphicsItemPrivate::get(back);
+ mat.translate(dBack->width()/2,dBack->height()/2);
+ if (dBack->width() && wantBackYFlipped)
+ mat.rotate(180, Qt::YAxis);
+ if (dBack->height() && wantBackXFlipped)
+ mat.rotate(180, Qt::XAxis);
+ mat.translate(-dBack->width()/2,-dBack->height()/2);
+ back->setTransform(mat);
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativeflipable_p.h b/src/declarative/graphicsitems/qdeclarativeflipable_p.h
index 302f083..fd0119b 100644
--- a/src/declarative/graphicsitems/qdeclarativeflipable_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeflipable_p.h
@@ -81,6 +81,9 @@ public:
Q_SIGNALS:
void sideChanged();
+private Q_SLOTS:
+ void retransformBack();
+
private:
Q_DISABLE_COPY(QDeclarativeFlipable)
Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeFlipable)
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 562ba2a..23140fa 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -50,6 +50,7 @@
#include <qlistmodelinterface_p.h>
#include <QKeyEvent>
+#include <qmath.h>
#include <math.h>
QT_BEGIN_NAMESPACE
@@ -746,12 +747,6 @@ void QDeclarativeGridViewPrivate::fixupPosition()
void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExtent)
{
Q_Q(QDeclarativeGridView);
-
- if ((&data == &vData && !q->yflick())
- || (&data == &hData && !q->xflick())
- || data.move.timeLine())
- return;
-
int oldDuration = fixupDuration;
fixupDuration = moveReason == Mouse ? fixupDuration : 0;
@@ -840,7 +835,15 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
if (v > 0)
dist = -dist;
data.flickTarget = -snapPosAt(-(data.move.value() - highlightRangeStart) + dist) + highlightRangeStart;
- dist = -data.flickTarget + data.move.value();
+ qreal adjDist = -data.flickTarget + data.move.value();
+ if (qAbs(adjDist) > qAbs(dist)) {
+ // Prevent painfully slow flicking - adjust velocity to suit flickDeceleration
+ v2 = accel * 2.0f * qAbs(dist);
+ v = qSqrt(v2);
+ if (dist > 0)
+ v = -v;
+ }
+ dist = adjDist;
accel = v2 / (2.0f * qAbs(dist));
} else {
data.flickTarget = velocity > 0 ? minExtent : maxExtent;
@@ -885,7 +888,7 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
In this case ListModel is a handy way for us to test our UI. In practice
the model would be implemented in C++, or perhaps via a SQL data source.
- Note that views do not enable \e clip automatically. If the view
+ \bold Note that views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
to set \e {clip: true} in order to have the out of view items clipped
nicely.
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index ca86637..247e348 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -221,7 +221,7 @@ qreal QDeclarativeImage::paintedHeight() const
}
/*!
- \qmlproperty enum Image::status
+ \qmlproperty enumeration Image::status
This property holds the status of image loading. It can be one of:
\list
@@ -236,9 +236,12 @@ qreal QDeclarativeImage::paintedHeight() const
to react to the change in status you need to do it yourself, for example in one
of the following ways:
\list
- \o Create a state, so that a state change occurs, e.g. State{name: 'loaded'; when: image.status = Image.Ready;}
- \o Do something inside the onStatusChanged signal handler, e.g. Image{id: image; onStatusChanged: if(image.status == Image.Ready) console.log('Loaded');}
- \o Bind to the status variable somewhere, e.g. Text{text: if(image.status!=Image.Ready){'Not Loaded';}else{'Loaded';}}
+ \o Create a state, so that a state change occurs, e.g.
+ \qml State { name: 'loaded'; when: image.status = Image.Ready } \endqml
+ \o Do something inside the onStatusChanged signal handler, e.g.
+ \qml Image { id: image; onStatusChanged: if (image.status == Image.Ready) console.log('Loaded') } \endqml
+ \o Bind to the status variable somewhere, e.g.
+ \qml Text { text: if (image.status != Image.Ready) { 'Not Loaded' } else { 'Loaded' } } \endqml
\endlist
\sa progress
@@ -366,12 +369,27 @@ void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWi
if (width() != d->pix.width() || height() != d->pix.height()) {
if (d->fillMode >= Tile) {
- if (d->fillMode == Tile)
+ if (d->fillMode == Tile) {
p->drawTiledPixmap(QRectF(0,0,width(),height()), d->pix);
- else if (d->fillMode == TileVertically)
- p->drawTiledPixmap(QRectF(0,0,d->pix.width(),height()), d->pix);
- else
- p->drawTiledPixmap(QRectF(0,0,width(),d->pix.height()), d->pix);
+ } else {
+ qreal widthScale = width() / qreal(d->pix.width());
+ qreal heightScale = height() / qreal(d->pix.height());
+
+ QTransform scale;
+ if (d->fillMode == TileVertically) {
+ scale.scale(widthScale, 1.0);
+ QTransform old = p->transform();
+ p->setWorldTransform(scale * old);
+ p->drawTiledPixmap(QRectF(0,0,d->pix.width(),height()), d->pix);
+ p->setWorldTransform(old);
+ } else {
+ scale.scale(1.0, heightScale);
+ QTransform old = p->transform();
+ p->setWorldTransform(scale * old);
+ p->drawTiledPixmap(QRectF(0,0,width(),d->pix.height()), d->pix);
+ p->setWorldTransform(old);
+ }
+ }
} else {
qreal widthScale = width() / qreal(d->pix.width());
qreal heightScale = height() / qreal(d->pix.height());
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 86dbaf0..37c7923 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -1415,7 +1415,7 @@ QDeclarativeItem::~QDeclarativeItem()
}
/*!
- \qmlproperty enum Item::transformOrigin
+ \qmlproperty enumeration Item::transformOrigin
This property holds the origin point around which scale and rotation transform.
Nine transform origins are available, as shown in the image below.
@@ -1794,9 +1794,13 @@ void QDeclarativeItem::geometryChanged(const QRectF &newGeometry,
if (transformOrigin() != QDeclarativeItem::TopLeft
&& (newGeometry.width() != oldGeometry.width() || newGeometry.height() != oldGeometry.height())) {
- QPointF origin = d->computeTransformOrigin();
- if (transformOriginPoint() != origin)
- setTransformOriginPoint(origin);
+ if (d->transformData) {
+ QPointF origin = d->computeTransformOrigin();
+ if (transformOriginPoint() != origin)
+ setTransformOriginPoint(origin);
+ } else {
+ d->transformOriginDirty = true;
+ }
}
if (newGeometry.x() != oldGeometry.x())
@@ -2238,7 +2242,7 @@ QScriptValue QDeclarativeItem::mapFromItem(const QScriptValue &item, qreal x, qr
QScriptValue sv = QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(this))->newObject();
QDeclarativeItem *itemObj = qobject_cast<QDeclarativeItem*>(item.toQObject());
if (!itemObj && !item.isNull()) {
- qWarning().nospace() << "mapFromItem() given argument " << item.toString() << " which is neither null nor an Item";
+ qmlInfo(this) << "mapFromItem() given argument \"" << item.toString() << "\" which is neither null nor an Item";
return 0;
}
@@ -2264,7 +2268,7 @@ QScriptValue QDeclarativeItem::mapToItem(const QScriptValue &item, qreal x, qrea
QScriptValue sv = QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(this))->newObject();
QDeclarativeItem *itemObj = qobject_cast<QDeclarativeItem*>(item.toQObject());
if (!itemObj && !item.isNull()) {
- qWarning().nospace() << "mapToItem() given argument " << item.toString() << " which is neither null nor an Item";
+ qmlInfo(this) << "mapToItem() given argument \"" << item.toString() << "\" which is neither null nor an Item";
return 0;
}
@@ -2656,11 +2660,23 @@ void QDeclarativeItem::setTransformOrigin(TransformOrigin origin)
Q_D(QDeclarativeItem);
if (origin != d->origin) {
d->origin = origin;
- QGraphicsItem::setTransformOriginPoint(d->computeTransformOrigin());
+ if (d->transformData)
+ QGraphicsItem::setTransformOriginPoint(d->computeTransformOrigin());
+ else
+ d->transformOriginDirty = true;
emit transformOriginChanged(d->origin);
}
}
+void QDeclarativeItemPrivate::transformChanged()
+{
+ Q_Q(QDeclarativeItem);
+ if (transformOriginDirty) {
+ q->QGraphicsItem::setTransformOriginPoint(computeTransformOrigin());
+ transformOriginDirty = false;
+ }
+}
+
/*!
\property QDeclarativeItem::smooth
\brief whether the item is smoothly transformed.
diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h
index cf138c3..3f5bf1a 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h
@@ -116,7 +116,7 @@ public:
_stateGroup(0), origin(QDeclarativeItem::Center),
widthValid(false), heightValid(false),
_componentComplete(true), _keepMouse(false),
- smooth(false), keyHandler(0),
+ smooth(false), transformOriginDirty(true), keyHandler(0),
mWidth(0), mHeight(0), implicitWidth(0), implicitHeight(0)
{
QGraphicsItemPrivate::acceptedMouseButtons = 0;
@@ -233,6 +233,7 @@ public:
bool _componentComplete:1;
bool _keepMouse:1;
bool smooth:1;
+ bool transformOriginDirty : 1;
QDeclarativeItemKeyFilter *keyHandler;
@@ -269,6 +270,9 @@ public:
}
}
+ // Reimplemented from QGraphicsItemPrivate
+ virtual void transformChanged();
+
virtual void focusChanged(bool);
static int consistentTime;
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 307c0a7..672f723 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -50,6 +50,7 @@
#include <qdeclarativeguard_p.h>
#include <qlistmodelinterface_p.h>
+#include <qmath.h>
#include <QKeyEvent>
QT_BEGIN_NAMESPACE
@@ -1101,11 +1102,6 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
|| (orient == QDeclarativeListView::Vertical && &data == &hData))
return;
- if ((&data == &vData && !q->yflick())
- || (&data == &hData && !q->xflick())
- || data.move.timeLine())
- return;
-
int oldDuration = fixupDuration;
fixupDuration = moveReason == Mouse ? fixupDuration : 0;
@@ -1211,7 +1207,15 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
data.flickTarget -= overshootDist;
}
}
- dist = -data.flickTarget + data.move.value();
+ qreal adjDist = -data.flickTarget + data.move.value();
+ if (qAbs(adjDist) > qAbs(dist)) {
+ // Prevent painfully slow flicking - adjust velocity to suit flickDeceleration
+ v2 = accel * 2.0f * qAbs(dist);
+ v = qSqrt(v2);
+ if (dist > 0)
+ v = -v;
+ }
+ dist = adjDist;
accel = v2 / (2.0f * qAbs(dist));
} else if (overShoot) {
data.flickTarget = data.move.value() - dist;
@@ -1286,7 +1290,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
In this case ListModel is a handy way for us to test our UI. In practice
the model would be implemented in C++, or perhaps via a SQL data source.
- Note that views do not enable \e clip automatically. If the view
+ \bold Note that views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
to set \e {clip: true} in order to have the out of view items clipped
nicely.
diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp
index 409c228..3f257b5 100644
--- a/src/declarative/graphicsitems/qdeclarativeloader.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp
@@ -277,7 +277,7 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
if (component) {
if (!component->errors().isEmpty()) {
- qWarning() << component->errors();
+ QDeclarativeEnginePrivate::warning(qmlEngine(q), component->errors());
emit q->sourceChanged();
emit q->statusChanged();
emit q->progressChanged();
@@ -312,7 +312,7 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
}
} else {
if (!component->errors().isEmpty())
- qWarning() << component->errors();
+ QDeclarativeEnginePrivate::warning(qmlEngine(q), component->errors());
delete obj;
delete ctxt;
source = QUrl();
@@ -325,7 +325,7 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded()
}
/*!
- \qmlproperty enum Loader::status
+ \qmlproperty enumeration Loader::status
This property holds the status of QML loading. It can be one of:
\list
@@ -383,7 +383,7 @@ qreal QDeclarativeLoader::progress() const
}
/*!
- \qmlproperty enum Loader::resizeMode
+ \qmlproperty enumeration Loader::resizeMode
This property determines how the Loader or item are resized:
\list
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index a6cc75e..bdb4868 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -466,6 +466,9 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
d->moved = true;
}
QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress);
+ emit mousePositionChanged(&me);
+ me.setX(d->lastPos.x());
+ me.setY(d->lastPos.y());
emit positionChanged(&me);
}
@@ -518,6 +521,9 @@ void QDeclarativeMouseArea::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
} else {
d->lastPos = event->pos();
QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), Qt::NoButton, d->lastButtons, d->lastModifiers, false, d->longPress);
+ emit mousePositionChanged(&me);
+ me.setX(d->lastPos.x());
+ me.setY(d->lastPos.y());
emit positionChanged(&me);
}
}
@@ -561,6 +567,18 @@ void QDeclarativeMouseArea::timerEvent(QTimerEvent *event)
}
}
+void QDeclarativeMouseArea::geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry)
+{
+ Q_D(QDeclarativeMouseArea);
+ QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
+
+ if (d->lastScenePos.isNull)
+ d->lastScenePos = mapToScene(d->lastPos);
+ else if (newGeometry.x() != oldGeometry.x() || newGeometry.y() != oldGeometry.y())
+ d->lastPos = mapFromScene(d->lastScenePos);
+}
+
/*!
\qmlproperty bool MouseArea::hoverEnabled
This property holds whether hover events are handled.
@@ -648,9 +666,13 @@ bool QDeclarativeMouseArea::setPressed(bool p)
QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress);
if (d->pressed) {
emit pressed(&me);
- emit positionChanged(&me);
+ me.setX(d->lastPos.x());
+ me.setY(d->lastPos.y());
+ emit mousePositionChanged(&me);
} else {
emit released(&me);
+ me.setX(d->lastPos.x());
+ me.setY(d->lastPos.y());
if (isclick && !d->longPress)
emit clicked(&me);
}
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
index 58faac1..630840f 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h
+++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
@@ -108,8 +108,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeMouseArea : public QDeclarativeItem
{
Q_OBJECT
- Q_PROPERTY(qreal mouseX READ mouseX NOTIFY positionChanged)
- Q_PROPERTY(qreal mouseY READ mouseY NOTIFY positionChanged)
+ Q_PROPERTY(qreal mouseX READ mouseX NOTIFY mousePositionChanged)
+ Q_PROPERTY(qreal mouseY READ mouseY NOTIFY mousePositionChanged)
Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged)
Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
@@ -144,6 +144,7 @@ Q_SIGNALS:
void enabledChanged();
void acceptedButtonsChanged();
void positionChanged(QDeclarativeMouseEvent *mouse);
+ void mousePositionChanged(QDeclarativeMouseEvent *mouse);
void pressed(QDeclarativeMouseEvent *mouse);
void pressAndHold(QDeclarativeMouseEvent *mouse);
@@ -167,6 +168,9 @@ protected:
bool sceneEvent(QEvent *);
void timerEvent(QTimerEvent *event);
+ virtual void geometryChanged(const QRectF &newGeometry,
+ const QRectF &oldGeometry);
+
private:
void handlePress();
void handleRelease();
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h
index 9068c7c..4973957 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h
@@ -81,6 +81,7 @@ public:
void saveEvent(QGraphicsSceneMouseEvent *event) {
lastPos = event->pos();
+ lastScenePos = event->scenePos();
lastButton = event->button();
lastButtons = event->buttons();
lastModifiers = event->modifiers();
@@ -105,6 +106,7 @@ public:
qreal startX;
qreal startY;
QPointF lastPos;
+ QDeclarativeNullableValue<QPointF> lastScenePos;
Qt::MouseButton lastButton;
Qt::MouseButtons lastButtons;
Qt::KeyboardModifiers lastModifiers;
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 4aaa28d..d0a3cd1 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -314,7 +314,7 @@ void QDeclarativePathViewPrivate::regenerate()
\image pathview.gif
- Note that views do not enable \e clip automatically. If the view
+ \bold Note that views do not enable \e clip automatically. If the view
is not clipped by another item or the screen, it will be necessary
to set \e {clip: true} in order to have the out of view items clipped
nicely.
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
index 24b65fa..b5fc979 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
@@ -136,7 +136,7 @@ private:
class Q_DECLARATIVE_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner
{
Q_OBJECT
- Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowChanged)
+ Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged)
Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged)
Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged)
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
index 54c8ab2..3daa83f 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp
@@ -172,6 +172,8 @@ void QDeclarativeGradient::doUpdate()
\image declarative-rect.png
*/
+int QDeclarativeRectanglePrivate::doUpdateSlotIdx = -1;
+
/*!
\internal
\class QDeclarativeRectangle
@@ -252,11 +254,16 @@ void QDeclarativeRectangle::setGradient(QDeclarativeGradient *gradient)
Q_D(QDeclarativeRectangle);
if (d->gradient == gradient)
return;
+ static int updatedSignalIdx = -1;
+ if (updatedSignalIdx < 0)
+ updatedSignalIdx = QDeclarativeGradient::staticMetaObject.indexOfSignal("updated()");
+ if (d->doUpdateSlotIdx < 0)
+ d->doUpdateSlotIdx = QDeclarativeRectangle::staticMetaObject.indexOfSlot("doUpdate()");
if (d->gradient)
- disconnect(d->gradient, SIGNAL(updated()), this, SLOT(doUpdate()));
+ QMetaObject::disconnect(d->gradient, updatedSignalIdx, this, d->doUpdateSlotIdx);
d->gradient = gradient;
if (d->gradient)
- connect(d->gradient, SIGNAL(updated()), this, SLOT(doUpdate()));
+ QMetaObject::connect(d->gradient, updatedSignalIdx, this, d->doUpdateSlotIdx);
update();
}
@@ -350,7 +357,9 @@ void QDeclarativeRectangle::generateBorderedRect()
Q_D(QDeclarativeRectangle);
if (d->rectImage.isNull()) {
const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
- d->rectImage = QPixmap(pw*2 + 3, pw*2 + 3);
+ // Adding 5 here makes qDrawBorderPixmap() paint correctly with smooth: true
+ // Ideally qDrawBorderPixmap() would be fixed - QTBUG-7999
+ d->rectImage = QPixmap(pw*2 + 5, pw*2 + 5);
d->rectImage.fill(Qt::transparent);
QPainter p(&(d->rectImage));
p.setRenderHint(QPainter::Antialiasing);
diff --git a/src/declarative/graphicsitems/qdeclarativerectangle_p_p.h b/src/declarative/graphicsitems/qdeclarativerectangle_p_p.h
index 84418bc..001b018 100644
--- a/src/declarative/graphicsitems/qdeclarativerectangle_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativerectangle_p_p.h
@@ -81,12 +81,18 @@ public:
qreal radius;
qreal paintmargin;
QPixmap rectImage;
+ static int doUpdateSlotIdx;
QDeclarativePen *getPen() {
if (!pen) {
Q_Q(QDeclarativeRectangle);
pen = new QDeclarativePen;
- QObject::connect(pen, SIGNAL(penChanged()), q, SLOT(doUpdate()));
+ static int penChangedSignalIdx = -1;
+ if (penChangedSignalIdx < 0)
+ penChangedSignalIdx = QDeclarativePen::staticMetaObject.indexOfSignal("penChanged()");
+ if (doUpdateSlotIdx < 0)
+ doUpdateSlotIdx = QDeclarativeRectangle::staticMetaObject.indexOfSlot("doUpdate()");
+ QMetaObject::connect(pen, penChangedSignalIdx, q, doUpdateSlotIdx);
}
return pen;
}
diff --git a/src/declarative/graphicsitems/qdeclarativescalegrid.cpp b/src/declarative/graphicsitems/qdeclarativescalegrid.cpp
index e68f645..fe89190 100644
--- a/src/declarative/graphicsitems/qdeclarativescalegrid.cpp
+++ b/src/declarative/graphicsitems/qdeclarativescalegrid.cpp
@@ -175,7 +175,7 @@ QDeclarativeBorderImage::TileMode QDeclarativeGridScaledImage::stringToRule(cons
if (s == QLatin1String("Round"))
return QDeclarativeBorderImage::Round;
- qWarning() << "Unknown tile rule specified. Using Stretch";
+ qWarning("QDeclarativeGridScaledImage: Invalid tile rule specified. Using Stretch.");
return QDeclarativeBorderImage::Stretch;
}
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 1fec484..77fb459 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -614,7 +614,7 @@ void QDeclarativeTextEdit::loadCursorDelegate()
d->cursor->setHeight(QFontMetrics(d->font).height());
moveCursorDelegate();
}else{
- qWarning() << QLatin1String("Error loading cursor delegate for TextEdit:") + objectName();
+ qmlInfo(this) << "Error loading cursor delegate.";
}
}
@@ -1076,8 +1076,6 @@ void QDeclarativeTextEditPrivate::updateSelection()
q->selectionEndChanged();
startChange = (lastSelectionStart != control->textCursor().selectionStart());
endChange = (lastSelectionEnd != control->textCursor().selectionEnd());
- if(startChange || endChange)
- qWarning() << "QDeclarativeTextEditPrivate::updateSelection() has failed you.";
}
void QDeclarativeTextEdit::updateSelectionMarkers()
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index e00d333..2161e23 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -779,9 +779,8 @@ void QDeclarativeTextInputPrivate::startCreatingCursor()
}else if(cursorComponent->isLoading()){
q->connect(cursorComponent, SIGNAL(statusChanged(int)),
q, SLOT(createCursor()));
- }else{//isError
- qmlInfo(q) << QDeclarativeTextInput::tr("Could not load cursor delegate");
- qWarning() << cursorComponent->errors();
+ }else {//isError
+ qmlInfo(q, cursorComponent->errors()) << QDeclarativeTextInput::tr("Could not load cursor delegate");
}
}
@@ -789,8 +788,7 @@ void QDeclarativeTextInput::createCursor()
{
Q_D(QDeclarativeTextInput);
if(d->cursorComponent->isError()){
- qmlInfo(this) << tr("Could not load cursor delegate");
- qWarning() << d->cursorComponent->errors();
+ qmlInfo(this, d->cursorComponent->errors()) << tr("Could not load cursor delegate");
return;
}
@@ -801,8 +799,7 @@ void QDeclarativeTextInput::createCursor()
delete d->cursorItem;
d->cursorItem = qobject_cast<QDeclarativeItem*>(d->cursorComponent->create());
if(!d->cursorItem){
- qmlInfo(this) << tr("Could not instantiate cursor delegate");
- //The failed instantiation should print its own error messages
+ qmlInfo(this, d->cursorComponent->errors()) << tr("Could not instantiate cursor delegate");
return;
}
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
index 751284d..207232d 100644
--- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
+++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp
@@ -1011,7 +1011,7 @@ QDeclarativeItem *QDeclarativeVisualDataModel::item(int index, const QByteArray
} else {
delete data;
delete ctxt;
- qWarning() << d->m_delegate->errors();
+ qmlInfo(this, d->m_delegate->errors()) << "Error creating delgate";
}
}
QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(nobj);
diff --git a/src/declarative/qml/parser/qdeclarativejs.g b/src/declarative/qml/parser/qdeclarativejs.g
index ba9338e..1b66ba0 100644
--- a/src/declarative/qml/parser/qdeclarativejs.g
+++ b/src/declarative/qml/parser/qdeclarativejs.g
@@ -1376,7 +1376,7 @@ case $rule_number: {
} break;
./
-PropertyName: T_IDENTIFIER %prec REDUCE_HERE ;
+PropertyName: T_IDENTIFIER %prec SHIFT_THERE ;
/.
case $rule_number: {
AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval);
diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp
index 52e979a..b87d8f4 100644
--- a/src/declarative/qml/parser/qdeclarativejsgrammar.cpp
+++ b/src/declarative/qml/parser/qdeclarativejsgrammar.cpp
@@ -40,7 +40,7 @@
****************************************************************************/
// This file was generated by qlalr - DO NOT EDIT!
-#include "private/qdeclarativejsgrammar_p.h"
+#include "qdeclarativejsgrammar_p.h"
QT_BEGIN_NAMESPACE
@@ -346,9 +346,9 @@ const short QDeclarativeJSGrammar::action_index [] = {
const short QDeclarativeJSGrammar::action_info [] = {
399, 352, 345, -101, 343, 457, 440, 403, 257, -112,
- -125, -131, -123, -98, -120, 348, -128, 389, 453, 391,
+ -125, -131, -123, 346, -120, 348, -128, 389, 453, 391,
416, 401, 408, 563, -101, -123, 416, -120, 539, -131,
- -98, -112, -125, 348, 257, 99, 71, 645, 621, 101,
+ 346, -112, -125, 348, 257, 99, 71, 645, 621, 101,
-128, 440, 141, 621, 164, 431, 539, 430, 453, 573,
457, 444, 440, 424, 71, 424, 101, 446, 559, 420,
424, 448, 539, 440, 570, 539, 466, 527, 312, 346,
diff --git a/src/declarative/qml/parser/qdeclarativejslexer.cpp b/src/declarative/qml/parser/qdeclarativejslexer.cpp
index 3a0e897..a686dca 100644
--- a/src/declarative/qml/parser/qdeclarativejslexer.cpp
+++ b/src/declarative/qml/parser/qdeclarativejslexer.cpp
@@ -484,6 +484,8 @@ int Lexer::lex()
stackToken = -1;
}
+ bool identifierWithEscapedUnicode = false;
+
while (!done) {
switch (state) {
case Start:
@@ -523,7 +525,26 @@ int Lexer::lex()
state = InString;
multiLineString = false;
stringType = current;
+ } else if (current == '\\' && next1 == 'u') {
+ identifierWithEscapedUnicode = true;
+ recordStartPos();
+
+ shift(2); // skip the unicode escape prefix `\u'
+
+ if (isHexDigit(current) && isHexDigit(next1) &&
+ isHexDigit(next2) && isHexDigit(next3)) {
+ record16(convertUnicode(current, next1, next2, next3));
+ shift(3);
+ state = InIdentifier;
+ } else {
+ setDone(Bad);
+ err = IllegalUnicodeEscapeSequence;
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal unicode escape sequence");
+ break;
+ }
+
} else if (isIdentLetter(current)) {
+ identifierWithEscapedUnicode = false;
recordStartPos();
record16(current);
state = InIdentifier;
@@ -683,6 +704,21 @@ int Lexer::lex()
if (isIdentLetter(current) || isDecimalDigit(current)) {
record16(current);
break;
+ } else if (current == '\\' && next1 == 'u') {
+ identifierWithEscapedUnicode = true;
+ shift(2); // skip the unicode escape prefix `\u'
+
+ if (isHexDigit(current) && isHexDigit(next1) &&
+ isHexDigit(next2) && isHexDigit(next3)) {
+ record16(convertUnicode(current, next1, next2, next3));
+ shift(3);
+ break;
+ } else {
+ setDone(Bad);
+ err = IllegalUnicodeEscapeSequence;
+ errmsg = QCoreApplication::translate("QDeclarativeParser", "Illegal unicode escape sequence");
+ break;
+ }
}
setDone(Identifier);
break;
@@ -825,7 +861,11 @@ int Lexer::lex()
delimited = true;
return token;
case Identifier:
- if ((token = findReservedWord(buffer16, pos16)) < 0) {
+ token = -1;
+ if (! identifierWithEscapedUnicode)
+ token = findReservedWord(buffer16, pos16);
+
+ if (token < 0) {
/* TODO: close leak on parse error. same holds true for String */
if (driver)
qsyylval.ustr = driver->intern(buffer16, pos16);
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp
index 25492ac..d759427 100644
--- a/src/declarative/qml/qdeclarativebinding.cpp
+++ b/src/declarative/qml/qdeclarativebinding.cpp
@@ -210,8 +210,7 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags)
}
if (data->error.isValid()) {
- if (!data->addError(ep))
- qWarning().nospace() << qPrintable(this->error().toString());
+ if (!data->addError(ep)) ep->warning(this->error());
} else {
data->removeError();
}
diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp
index 8c7a977..00a93cc 100644
--- a/src/declarative/qml/qdeclarativeboundsignal.cpp
+++ b/src/declarative/qml/qdeclarativeboundsignal.cpp
@@ -179,7 +179,7 @@ int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a)
if (m_expression && m_expression->engine()) {
QDeclarativeExpressionPrivate::get(m_expression)->value(m_params);
if (m_expression && m_expression->hasError())
- qWarning().nospace() << qPrintable(m_expression->error().toString());
+ QDeclarativeEnginePrivate::warning(m_expression->engine(), m_expression->error());
}
if (m_params) m_params->clearValues();
return -1;
diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp
index 6fdf706..6596aba 100644
--- a/src/declarative/qml/qdeclarativecompiledbindings.cpp
+++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp
@@ -888,13 +888,6 @@ void QDeclarativeCompiledBindingsPrivate::findgeneric(Register *output,
return;
}
- for (int ii = 0; ii < context->scripts.count(); ++ii) {
- QScriptValue function = QScriptDeclarativeClass::function(context->scripts.at(ii), name);
- if (function.isValid()) {
- qFatal("Binding optimizer resolved name to QScript method");
- }
- }
-
if (QObject *root = context->contextObject) {
if (findproperty(root, output, enginePriv, subIdx, name, isTerminal))
@@ -938,7 +931,7 @@ static void throwException(int id, QDeclarativeDelayedError *error,
error->error.setColumn(-1);
}
if (!context->engine || !error->addError(QDeclarativeEnginePrivate::get(context->engine)))
- qWarning() << error->error;
+ QDeclarativeEnginePrivate::warning(context->engine, error->error);
}
static void dumpInstruction(const Instr *instr)
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index 065009a..2614764 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -733,10 +733,6 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt)
return true;
}
- // Build any script blocks for this type
- for (int ii = 0; ii < obj->scriptBlockObjects.count(); ++ii)
- COMPILE_CHECK(buildScript(obj, obj->scriptBlockObjects.at(ii)));
-
// Object instantiations reset the binding context
BindingContext objCtxt(obj);
@@ -961,17 +957,6 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj)
output->bytecode << id;
}
- // Set any script blocks
- for (int ii = 0; ii < obj->scripts.count(); ++ii) {
- QDeclarativeInstruction script;
- script.type = QDeclarativeInstruction::StoreScript;
- script.line = 0; // ###
- int idx = output->scripts.count();
- output->scripts << obj->scripts.at(ii);
- script.storeScript.value = idx;
- output->bytecode << script;
- }
-
// Begin the class
if (obj->parserStatusCast != -1) {
QDeclarativeInstruction begin;
@@ -1177,9 +1162,6 @@ bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj,
(obj->properties.count() == 1 && obj->properties.begin().key() != "id"))
COMPILE_EXCEPTION(*obj->properties.begin(), tr("Component elements may not contain properties other than id"));
- if (!obj->scriptBlockObjects.isEmpty())
- COMPILE_EXCEPTION(obj->scriptBlockObjects.first(), tr("Component elements may not contain script blocks"));
-
if (obj->properties.count())
idProp = *obj->properties.begin();
@@ -1216,94 +1198,6 @@ bool QDeclarativeCompiler::buildComponent(QDeclarativeParser::Object *obj,
return true;
}
-bool QDeclarativeCompiler::buildScript(QDeclarativeParser::Object *obj, QDeclarativeParser::Object *script)
-{
- qWarning().nospace() << qPrintable(output->url.toString()) << ":" << obj->location.start.line << ":" << obj->location.start.column << ": Script blocks have been deprecated. Support will be removed entirely shortly.";
-
- Object::ScriptBlock scriptBlock;
-
- if (script->properties.count() == 1 &&
- script->properties.begin().key() == QByteArray("source")) {
-
- Property *source = *script->properties.begin();
- if (script->defaultProperty)
- COMPILE_EXCEPTION(source, tr("Invalid Script block. Specify either the source property or inline script"));
-
- if (source->value || source->values.count() != 1 ||
- source->values.at(0)->object || !source->values.at(0)->value.isStringList())
- COMPILE_EXCEPTION(source, tr("Invalid Script source value"));
-
- QStringList sources = source->values.at(0)->value.asStringList();
-
- for (int jj = 0; jj < sources.count(); ++jj) {
- QString sourceUrl = output->url.resolved(QUrl(sources.at(jj))).toString();
- QString scriptCode;
- int lineNumber = 1;
-
- for (int ii = 0; ii < unit->resources.count(); ++ii) {
- if (unit->resources.at(ii)->url == sourceUrl) {
- scriptCode = QString::fromUtf8(unit->resources.at(ii)->data);
- break;
- }
- }
-
- if (!scriptCode.isEmpty()) {
- scriptBlock.codes.append(scriptCode);
- scriptBlock.files.append(sourceUrl);
- scriptBlock.lineNumbers.append(lineNumber);
- scriptBlock.pragmas.append(Object::ScriptBlock::None);
- }
- }
-
- } else if (!script->properties.isEmpty()) {
- COMPILE_EXCEPTION(*script->properties.begin(), tr("Properties cannot be set on Script block"));
- } else if (script->defaultProperty) {
-
- QString scriptCode;
- int lineNumber = 1;
- QString sourceUrl = output->url.toString();
-
- QDeclarativeParser::Location currentLocation;
-
- for (int ii = 0; ii < script->defaultProperty->values.count(); ++ii) {
- Value *v = script->defaultProperty->values.at(ii);
- if (lineNumber == 1)
- lineNumber = v->location.start.line;
- if (v->object || !v->value.isString())
- COMPILE_EXCEPTION(v, tr("Invalid Script block"));
-
- if (ii == 0) {
- currentLocation = v->location.start;
- scriptCode.append(QString(currentLocation.column, QLatin1Char(' ')));
- }
-
- while (currentLocation.line < v->location.start.line) {
- scriptCode.append(QLatin1Char('\n'));
- currentLocation.line++;
- currentLocation.column = 0;
- }
-
- scriptCode.append(QString(v->location.start.column - currentLocation.column, QLatin1Char(' ')));
-
- scriptCode += v->value.asString();
- currentLocation = v->location.end;
- currentLocation.column++;
- }
-
- if (!scriptCode.isEmpty()) {
- scriptBlock.codes.append(scriptCode);
- scriptBlock.files.append(sourceUrl);
- scriptBlock.lineNumbers.append(lineNumber);
- scriptBlock.pragmas.append(Object::ScriptBlock::None);
- }
- }
-
- if (!scriptBlock.codes.isEmpty())
- obj->scripts << scriptBlock;
-
- return true;
-}
-
bool QDeclarativeCompiler::buildComponentFromRoot(QDeclarativeParser::Object *obj,
const BindingContext &ctxt)
{
diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h
index 867db2c..cdc514d 100644
--- a/src/declarative/qml/qdeclarativecompiler_p.h
+++ b/src/declarative/qml/qdeclarativecompiler_p.h
@@ -186,7 +186,6 @@ private:
bool buildObject(QDeclarativeParser::Object *obj, const BindingContext &);
- bool buildScript(QDeclarativeParser::Object *obj, QDeclarativeParser::Object *script);
bool buildComponent(QDeclarativeParser::Object *obj, const BindingContext &);
bool buildSubObject(QDeclarativeParser::Object *obj, const BindingContext &);
bool buildSignal(QDeclarativeParser::Property *prop, QDeclarativeParser::Object *obj,
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 3e4651c..c86f089 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -530,10 +530,8 @@ QScriptValue QDeclarativeComponent::createObject()
{
Q_D(QDeclarativeComponent);
QDeclarativeContext* ctxt = creationContext();
- if(!ctxt){
- qWarning() << QLatin1String("createObject can only be used in QML");
+ if(!ctxt)
return QScriptValue();
- }
QObject* ret = create(ctxt);
if (!ret)
return QScriptValue();
@@ -613,17 +611,17 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context, cons
{
Q_Q(QDeclarativeComponent);
if (!context) {
- qWarning("QDeclarativeComponent::beginCreate(): Cannot create a component in a null context");
+ qWarning("QDeclarativeComponent: Cannot create a component in a null context");
return 0;
}
if (!context->isValid()) {
- qWarning("QDeclarativeComponent::beginCreate(): Cannot create a component in an invalid context");
+ qWarning("QDeclarativeComponent: Cannot create a component in an invalid context");
return 0;
}
if (context->engine != engine) {
- qWarning("QDeclarativeComponent::beginCreate(): Must create component in context from the same QDeclarativeEngine");
+ qWarning("QDeclarativeComponent: Must create component in context from the same QDeclarativeEngine");
return 0;
}
@@ -766,7 +764,7 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri
enginePriv->inProgressCreations--;
if (0 == enginePriv->inProgressCreations) {
while (enginePriv->erroredBindings) {
- qWarning().nospace() << qPrintable(enginePriv->erroredBindings->error.toString());
+ enginePriv->warning(enginePriv->erroredBindings->error);
enginePriv->erroredBindings->removeError();
}
}
diff --git a/src/declarative/qml/qdeclarativecomponent.h b/src/declarative/qml/qdeclarativecomponent.h
index 6ee5070..526a319 100644
--- a/src/declarative/qml/qdeclarativecomponent.h
+++ b/src/declarative/qml/qdeclarativecomponent.h
@@ -99,8 +99,6 @@ public:
virtual QObject *beginCreate(QDeclarativeContext *);
virtual void completeCreate();
- Q_INVOKABLE QScriptValue createObject();
-
void loadUrl(const QUrl &url);
void setData(const QByteArray &, const QUrl &baseUrl);
@@ -114,6 +112,7 @@ Q_SIGNALS:
protected:
QDeclarativeComponent(QDeclarativeComponentPrivate &dd, QObject* parent);
+ Q_INVOKABLE QScriptValue createObject();
private:
QDeclarativeComponent(QDeclarativeEngine *, QDeclarativeCompiledData *, int, int, QObject *parent);
diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp
index 133b71f..adeb7a5 100644
--- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp
+++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp
@@ -341,7 +341,6 @@ static QString toLocalFileOrQrc(const QUrl& url)
if (url.scheme() == QLatin1String("qrc")) {
if (url.authority().isEmpty())
return QLatin1Char(':') + url.path();
- qWarning() << "Invalid url:" << url.toString() << "authority" << url.authority() << "not known.";
return QString();
}
return url.toLocalFile();
diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp
index 6657fea..2041e0a 100644
--- a/src/declarative/qml/qdeclarativecontext.cpp
+++ b/src/declarative/qml/qdeclarativecontext.cpp
@@ -114,7 +114,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate()
\endcode
All properties added explicitly by QDeclarativeContext::setContextProperty() take
- precedence over context object's properties.
+ precedence over the context object's properties.
Contexts form a hierarchy. The root of this heirarchy is the QDeclarativeEngine's
\l {QDeclarativeEngine::rootContext()}{root context}. A component instance can
@@ -140,6 +140,11 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate()
While QML objects instantiated in a context are not strictly owned by that
context, their bindings are. If a context is destroyed, the property bindings of
outstanding QML objects will stop evaluating.
+
+ \note Setting the context object or adding new context properties after an object
+ has been created in that context is an expensive operation (essentially forcing all bindings
+ to reevaluate). Thus whenever possible you should complete "setup" of the context
+ before using it to create any objects.
*/
/*! \internal */
@@ -655,7 +660,7 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object
if (scriptEngine->hasUncaughtException()) {
QDeclarativeError error;
QDeclarativeExpressionPrivate::exceptionToError(scriptEngine, error);
- qWarning().nospace() << qPrintable(error.toString());
+ enginePriv->warning(error);
}
scriptEngine->popContext();
@@ -681,7 +686,7 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object
if (scriptEngine->hasUncaughtException()) {
QDeclarativeError error;
QDeclarativeExpressionPrivate::exceptionToError(scriptEngine, error);
- qWarning().nospace() << qPrintable(error.toString());
+ enginePriv->warning(error);
}
scriptEngine->popContext();
@@ -691,39 +696,6 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object
}
}
-void QDeclarativeContextData::addScript(const QDeclarativeParser::Object::ScriptBlock &script,
- QObject *scopeObject)
-{
- if (!engine)
- return;
-
- QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine);
- QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine);
-
- QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine);
-
- scriptContext->pushScope(enginePriv->contextClass->newContext(this, scopeObject));
- scriptContext->pushScope(enginePriv->globalClass->globalObject());
-
- QScriptValue scope = scriptEngine->newObject();
- scriptContext->setActivationObject(scope);
- scriptContext->pushScope(scope);
-
- for (int ii = 0; ii < script.codes.count(); ++ii) {
- scriptEngine->evaluate(script.codes.at(ii), script.files.at(ii), script.lineNumbers.at(ii));
-
- if (scriptEngine->hasUncaughtException()) {
- QDeclarativeError error;
- QDeclarativeExpressionPrivate::exceptionToError(scriptEngine, error);
- qWarning().nospace() << qPrintable(error.toString());
- }
- }
-
- scriptEngine->popContext();
-
- scripts.append(scope);
-}
-
void QDeclarativeContextData::setIdProperty(int idx, QObject *obj)
{
idValues[idx] = obj;
diff --git a/src/declarative/qml/qdeclarativecontext_p.h b/src/declarative/qml/qdeclarativecontext_p.h
index 77a6d94..c7fb099 100644
--- a/src/declarative/qml/qdeclarativecontext_p.h
+++ b/src/declarative/qml/qdeclarativecontext_p.h
@@ -145,10 +145,8 @@ public:
QObject *contextObject;
// Any script blocks that exist on this context
- QList<QScriptValue> scripts;
QList<QScriptValue> importedScripts;
void addImportedScript(const QDeclarativeParser::Object::ScriptBlock &script);
- void addScript(const QDeclarativeParser::Object::ScriptBlock &script, QObject *scopeObject);
// Context base url
QUrl url;
diff --git a/src/declarative/qml/qdeclarativecontextscriptclass.cpp b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
index 461fab5..1336a1a 100644
--- a/src/declarative/qml/qdeclarativecontextscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativecontextscriptclass.cpp
@@ -189,14 +189,6 @@ QDeclarativeContextScriptClass::queryProperty(QDeclarativeContextData *bindConte
}
}
- for (int ii = 0; ii < bindContext->scripts.count(); ++ii) {
- lastFunction = QScriptDeclarativeClass::function(bindContext->scripts.at(ii), name);
- if (lastFunction.isValid()) {
- lastContext = bindContext;
- return QScriptClass::HandlesReadAccess;
- }
- }
-
if (scopeObject) {
QScriptClass::QueryFlags rv =
ep->objectClass->queryProperty(scopeObject, name, flags, bindContext,
diff --git a/src/declarative/qml/qdeclarativedata_p.h b/src/declarative/qml/qdeclarativedata_p.h
index 2ddd7e5..4a56536 100644
--- a/src/declarative/qml/qdeclarativedata_p.h
+++ b/src/declarative/qml/qdeclarativedata_p.h
@@ -75,7 +75,7 @@ public:
: ownMemory(true), ownContext(false), indestructible(true), explicitIndestructibleSet(false),
context(0), outerContext(0), bindings(0), nextContextObject(0), prevContextObject(0), bindingBitsSize(0),
bindingBits(0), lineNumber(0), columnNumber(0), deferredComponent(0), deferredIdx(0),
- attachedProperties(0), scriptValue(0), propertyCache(0), guards(0) {
+ attachedProperties(0), scriptValue(0), objectDataRefCount(0), propertyCache(0), guards(0) {
init();
}
@@ -128,6 +128,7 @@ public:
// ### Can we make this QScriptValuePrivate so we incur no additional allocation
// cost?
QScriptValue *scriptValue;
+ quint32 objectDataRefCount;
QDeclarativePropertyCache *propertyCache;
QDeclarativeGuard<QObject> *guards;
diff --git a/src/declarative/qml/qdeclarativedirparser.cpp b/src/declarative/qml/qdeclarativedirparser.cpp
index 1e3b37b..3e05853 100644
--- a/src/declarative/qml/qdeclarativedirparser.cpp
+++ b/src/declarative/qml/qdeclarativedirparser.cpp
@@ -170,10 +170,9 @@ bool QDeclarativeDirParser::parse()
const int dotIndex = version.indexOf(QLatin1Char('.'));
if (dotIndex == -1) {
- qWarning() << "expected '.'"; // ### use reportError
+ reportError(lineNumber, -1, QLatin1String("expected '.'"));
} else if (version.indexOf(QLatin1Char('.'), dotIndex + 1) != -1) {
- qWarning() << "unexpected '.'"; // ### use reportError
-
+ reportError(lineNumber, -1, QLatin1String("unexpected '.'"));
} else {
bool validVersionNumber = false;
const int majorVersion = version.left(dotIndex).toInt(&validVersionNumber);
@@ -189,8 +188,8 @@ bool QDeclarativeDirParser::parse()
}
}
} else {
- // ### use reportError
- qWarning() << "a component declaration requires 3 arguments, but" << (sectionCount + 1) << "were provided";
+ reportError(lineNumber, -1,
+ QString::fromUtf8("a component declaration requires 3 arguments, but %1 were provided").arg(sectionCount + 1));
}
}
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 96145fb..9cd6b3c 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -153,10 +153,10 @@ void QDeclarativeEnginePrivate::defineModule()
QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e)
: captureProperties(false), rootContext(0), currentExpression(0), isDebugging(false),
- contextClass(0), sharedContext(0), sharedScope(0), objectClass(0), valueTypeClass(0),
- globalClass(0), cleanup(0), erroredBindings(0), inProgressCreations(0),
- scriptEngine(this), workerScriptEngine(0), componentAttached(0), inBeginCreate(false),
- networkAccessManager(0), networkAccessManagerFactory(0),
+ outputWarningsToStdErr(true), contextClass(0), sharedContext(0), sharedScope(0),
+ objectClass(0), valueTypeClass(0), globalClass(0), cleanup(0), erroredBindings(0),
+ inProgressCreations(0), scriptEngine(this), workerScriptEngine(0), componentAttached(0),
+ inBeginCreate(false), networkAccessManager(0), networkAccessManagerFactory(0),
typeManager(e), uniqueId(1)
{
if (!qt_QmlQtModule_registered) {
@@ -216,8 +216,6 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr
offlineStoragePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation).replace(QLatin1Char('/'), QDir::separator())
+ QDir::separator() + QLatin1String("QML")
+ QDir::separator() + QLatin1String("OfflineStorage");
-#else
- qWarning("offlineStoragePath is not set by default with QT_NO_DESKTOPSERVICES");
#endif
qt_add_qmlxmlhttprequest(this);
@@ -390,8 +388,6 @@ void QDeclarativeEnginePrivate::init()
qmlEngineDebugServer();
isDebugging = true;
QDeclarativeEngineDebugServer::addEngine(q);
-
- qmlEngineDebugServer()->waitForClients();
}
}
@@ -652,6 +648,34 @@ void QDeclarativeEngine::setBaseUrl(const QUrl &url)
{
Q_D(QDeclarativeEngine);
d->baseUrl = url;
+}
+
+/*!
+ Returns true if warning messages will be output to stderr in addition
+ to being emitted by the warnings() signal, otherwise false.
+
+ The default value is true.
+*/
+bool QDeclarativeEngine::outputWarningsToStandardError() const
+{
+ Q_D(const QDeclarativeEngine);
+ return d->outputWarningsToStdErr;
+}
+
+/*!
+ Set whether warning messages will be output to stderr to \a enabled.
+
+ If \a enabled is true, any warning messages generated by QML will be
+ output to stderr and emitted by the warnings() signal. If \a enabled
+ is false, on the warnings() signal will be emitted. This allows
+ applications to handle warning output themselves.
+
+ The default value is true.
+*/
+void QDeclarativeEngine::setOutputWarningsToStandardError(bool enabled)
+{
+ Q_D(QDeclarativeEngine);
+ d->outputWarningsToStdErr = enabled;
}
/*!
@@ -779,9 +803,8 @@ void qmlExecuteDeferred(QObject *object)
QDeclarativeComponentPrivate::complete(ep, &state);
- if (!state.errors.isEmpty())
- qWarning() << state.errors;
-
+ if (!state.errors.isEmpty())
+ ep->warning(state.errors);
}
}
@@ -957,7 +980,7 @@ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QS
Q_ASSERT(context);
if(ctxt->argumentCount() != 1) {
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 1 parameter"));
}else{
QString arg = ctxt->argument(0).toString();
if (arg.isEmpty())
@@ -977,7 +1000,7 @@ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QS
QDeclarativeEngine* activeEngine = activeEnginePriv->q_func();
if(ctxt->argumentCount() < 2 || ctxt->argumentCount() > 3)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 2 or 3 parameters"));
QDeclarativeContextData* context = activeEnginePriv->getContext(ctxt);
Q_ASSERT(context);
@@ -997,35 +1020,30 @@ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QS
QObject *parentArg = activeEnginePriv->objectClass->toQObject(ctxt->argument(1));
if(!parentArg)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("parent object not found"));
QDeclarativeComponent component(activeEngine);
component.setData(qml.toUtf8(), url);
if(component.isError()) {
QList<QDeclarativeError> errors = component.errors();
- qWarning().nospace() << "QDeclarativeEngine::createQmlObject():";
+ QString errstr = QLatin1String("Qt.createQmlObject(): ");
foreach (const QDeclarativeError &error, errors)
- qWarning().nospace() << " " << error;
-
- return engine->nullValue();
+ errstr += QLatin1String(" ") + error.toString() + QLatin1String("\n");
+ return ctxt->throwError(errstr);
}
- if (!component.isReady()) {
- qWarning().nospace() << "QDeclarativeEngine::createQmlObject(): Component is not ready";
-
- return engine->nullValue();
- }
+ if (!component.isReady())
+ return ctxt->throwError(QDeclarativeEngine::tr("Qt.createQmlObject(): component is not ready"));
QObject *obj = component.create(context->asQDeclarativeContext());
if(component.isError()) {
QList<QDeclarativeError> errors = component.errors();
- qWarning().nospace() << "QDeclarativeEngine::createQmlObject():";
+ QString errstr = QLatin1String("Qt.createQmlObject(): ");
foreach (const QDeclarativeError &error, errors)
- qWarning().nospace() << " " << error;
-
- return engine->nullValue();
+ errstr += QLatin1String(" ") + error.toString() + QLatin1String("\n");
+ return ctxt->throwError(errstr);
}
Q_ASSERT(obj);
@@ -1051,7 +1069,7 @@ QScriptValue QDeclarativeEnginePrivate::isQtObject(QScriptContext *ctxt, QScript
QScriptValue QDeclarativeEnginePrivate::vector(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 3)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 3 parameters"));
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
qsreal z = ctxt->argument(2).toNumber();
@@ -1062,7 +1080,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptE
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 1 or 2 parameters"));
QDate date = ctxt->argument(0).toDateTime().date();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1073,7 +1091,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptE
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
} else
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("invalid date format"));
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
}
@@ -1082,7 +1100,7 @@ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptE
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 1 or 2 parameters"));
QTime date = ctxt->argument(0).toDateTime().time();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1093,7 +1111,7 @@ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptE
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
} else
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("invalid time format"));
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
}
@@ -1102,7 +1120,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr
{
int argCount = ctxt->argumentCount();
if(argCount == 0 || argCount > 2)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 1 or 2 parameters"));
QDateTime date = ctxt->argument(0).toDateTime();
Qt::DateFormat enumFormat = Qt::DefaultLocaleShortDate;
@@ -1113,7 +1131,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
} else
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("invalid datetiem format"));
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
}
@@ -1122,14 +1140,20 @@ QScriptValue QDeclarativeEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine
{
int argCount = ctxt->argumentCount();
if(argCount < 3 || argCount > 4)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 3 or 4 parameters"));
qsreal r = ctxt->argument(0).toNumber();
qsreal g = ctxt->argument(1).toNumber();
qsreal b = ctxt->argument(2).toNumber();
qsreal a = (argCount == 4) ? ctxt->argument(3).toNumber() : 1;
- if (r < 0 || r > 1 || g < 0 || g > 1 || b < 0 || b > 1 || a < 0 || a > 1)
- return engine->nullValue();
+ if (r < 0.0) r=0.0;
+ if (r > 1.0) r=1.0;
+ if (g < 0.0) g=0.0;
+ if (g > 1.0) g=1.0;
+ if (b < 0.0) b=0.0;
+ if (b > 1.0) b=1.0;
+ if (a < 0.0) a=0.0;
+ if (a > 1.0) a=1.0;
return qScriptValueFromValue(engine, qVariantFromValue(QColor::fromRgbF(r, g, b, a)));
}
@@ -1138,14 +1162,20 @@ QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine
{
int argCount = ctxt->argumentCount();
if(argCount < 3 || argCount > 4)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 3 or 4 parameters"));
qsreal h = ctxt->argument(0).toNumber();
qsreal s = ctxt->argument(1).toNumber();
qsreal l = ctxt->argument(2).toNumber();
qsreal a = (argCount == 4) ? ctxt->argument(3).toNumber() : 1;
- if (h < 0 || h > 1 || s < 0 || s > 1 || l < 0 || l > 1 || a < 0 || a > 1)
- return engine->nullValue();
+ if (h < 0.0) h=0.0;
+ if (h > 1.0) h=1.0;
+ if (s < 0.0) s=0.0;
+ if (s > 1.0) s=1.0;
+ if (l < 0.0) l=0.0;
+ if (l > 1.0) l=1.0;
+ if (a < 0.0) a=0.0;
+ if (a > 1.0) a=1.0;
return qScriptValueFromValue(engine, qVariantFromValue(QColor::fromHslF(h, s, l, a)));
}
@@ -1153,7 +1183,7 @@ QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 4)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 4 parameters"));
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
@@ -1169,7 +1199,7 @@ QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::point(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 2 parameters"));
qsreal x = ctxt->argument(0).toNumber();
qsreal y = ctxt->argument(1).toNumber();
return qScriptValueFromValue(engine, qVariantFromValue(QPointF(x, y)));
@@ -1178,7 +1208,7 @@ QScriptValue QDeclarativeEnginePrivate::point(QScriptContext *ctxt, QScriptEngin
QScriptValue QDeclarativeEnginePrivate::size(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 2 parameters"));
qsreal w = ctxt->argument(0).toNumber();
qsreal h = ctxt->argument(1).toNumber();
return qScriptValueFromValue(engine, qVariantFromValue(QSizeF(w, h)));
@@ -1187,7 +1217,7 @@ QScriptValue QDeclarativeEnginePrivate::size(QScriptContext *ctxt, QScriptEngine
QScriptValue QDeclarativeEnginePrivate::lighter(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 1)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 1 parameter"));
QVariant v = ctxt->argument(0).toVariant();
QColor color;
if (v.userType() == QVariant::Color)
@@ -1206,7 +1236,7 @@ QScriptValue QDeclarativeEnginePrivate::lighter(QScriptContext *ctxt, QScriptEng
QScriptValue QDeclarativeEnginePrivate::darker(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 1)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 1 parameter"));
QVariant v = ctxt->argument(0).toVariant();
QColor color;
if (v.userType() == QVariant::Color)
@@ -1284,23 +1314,82 @@ QScriptValue QDeclarativeEnginePrivate::consoleLog(QScriptContext *ctxt, QScript
return e->newVariant(QVariant(true));
}
-void QDeclarativeEnginePrivate::sendQuit ()
+void QDeclarativeEnginePrivate::sendQuit()
{
Q_Q(QDeclarativeEngine);
emit q->quit();
}
+static void dumpwarning(const QDeclarativeError &error)
+{
+ qWarning().nospace() << qPrintable(error.toString());
+}
+
+static void dumpwarning(const QList<QDeclarativeError> &errors)
+{
+ for (int ii = 0; ii < errors.count(); ++ii)
+ dumpwarning(errors.at(ii));
+}
+
+void QDeclarativeEnginePrivate::warning(const QDeclarativeError &error)
+{
+ Q_Q(QDeclarativeEngine);
+ q->warnings(QList<QDeclarativeError>() << error);
+ if (outputWarningsToStdErr)
+ dumpwarning(error);
+}
+
+void QDeclarativeEnginePrivate::warning(const QList<QDeclarativeError> &errors)
+{
+ Q_Q(QDeclarativeEngine);
+ q->warnings(errors);
+ if (outputWarningsToStdErr)
+ dumpwarning(errors);
+}
+
+void QDeclarativeEnginePrivate::warning(QDeclarativeEngine *engine, const QDeclarativeError &error)
+{
+ if (engine)
+ QDeclarativeEnginePrivate::get(engine)->warning(error);
+ else
+ dumpwarning(error);
+}
+
+void QDeclarativeEnginePrivate::warning(QDeclarativeEngine *engine, const QList<QDeclarativeError> &error)
+{
+ if (engine)
+ QDeclarativeEnginePrivate::get(engine)->warning(error);
+ else
+ dumpwarning(error);
+}
+
+void QDeclarativeEnginePrivate::warning(QDeclarativeEnginePrivate *engine, const QDeclarativeError &error)
+{
+ if (engine)
+ engine->warning(error);
+ else
+ dumpwarning(error);
+}
+
+void QDeclarativeEnginePrivate::warning(QDeclarativeEnginePrivate *engine, const QList<QDeclarativeError> &error)
+{
+ if (engine)
+ engine->warning(error);
+ else
+ dumpwarning(error);
+}
+
QScriptValue QDeclarativeEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptEngine *e)
{
QDeclarativeEnginePrivate *qe = get (e);
- qe->sendQuit ();
+ qe->sendQuit();
return QScriptValue();
}
QScriptValue QDeclarativeEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
{
if(ctxt->argumentCount() != 2)
- return engine->nullValue();
+ return ctxt->throwError(QDeclarativeEngine::tr("expected 2 parameters"));
//get color
QVariant v = ctxt->argument(0).toVariant();
QColor color;
@@ -1410,7 +1499,6 @@ static QString toLocalFileOrQrc(const QUrl& url)
if (url.scheme() == QLatin1String("qrc")) {
if (url.authority().isEmpty())
return QLatin1Char(':') + url.path();
- qWarning() << "Invalid url:" << url.toString() << "authority" << url.authority() << "not known.";
return QString();
}
return url.toLocalFile();
diff --git a/src/declarative/qml/qdeclarativeengine.h b/src/declarative/qml/qdeclarativeengine.h
index 7b058ea..e161cd9 100644
--- a/src/declarative/qml/qdeclarativeengine.h
+++ b/src/declarative/qml/qdeclarativeengine.h
@@ -46,6 +46,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qmap.h>
#include <QtScript/qscriptvalue.h>
+#include <QtDeclarative/qdeclarativeerror.h>
QT_BEGIN_HEADER
@@ -102,6 +103,9 @@ public:
QUrl baseUrl() const;
void setBaseUrl(const QUrl &);
+ bool outputWarningsToStandardError() const;
+ void setOutputWarningsToStandardError(bool);
+
static QDeclarativeContext *contextForObject(const QObject *);
static void setContextForObject(QObject *, QDeclarativeContext *);
@@ -110,7 +114,8 @@ public:
static ObjectOwnership objectOwnership(QObject *);
Q_SIGNALS:
- void quit ();
+ void quit();
+ void warnings(const QList<QDeclarativeError> &warnings);
private:
Q_DECLARE_PRIVATE(QDeclarativeEngine)
diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h
index b3bba43..f6b9bcb 100644
--- a/src/declarative/qml/qdeclarativeengine_p.h
+++ b/src/declarative/qml/qdeclarativeengine_p.h
@@ -162,6 +162,8 @@ public:
QDeclarativeExpression *currentExpression;
bool isDebugging;
+ bool outputWarningsToStdErr;
+
struct ImportedNamespace;
QDeclarativeContextScriptClass *contextClass;
QDeclarativeContextData *sharedContext;
@@ -311,7 +313,13 @@ public:
QScriptValue scriptValueFromVariant(const QVariant &);
QVariant scriptValueToVariant(const QScriptValue &, int hint = QVariant::Invalid);
- void sendQuit ();
+ void sendQuit();
+ void warning(const QDeclarativeError &);
+ void warning(const QList<QDeclarativeError> &);
+ static void warning(QDeclarativeEngine *, const QDeclarativeError &);
+ static void warning(QDeclarativeEngine *, const QList<QDeclarativeError> &);
+ static void warning(QDeclarativeEnginePrivate *, const QDeclarativeError &);
+ static void warning(QDeclarativeEnginePrivate *, const QList<QDeclarativeError> &);
static QScriptValue qmlScriptObject(QObject*, QDeclarativeEngine*);
diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp
index 578733c..264fd8d 100644
--- a/src/declarative/qml/qdeclarativeenginedebug.cpp
+++ b/src/declarative/qml/qdeclarativeenginedebug.cpp
@@ -308,8 +308,6 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message)
QByteArray type;
ds >> type;
- //qDebug() << "QDeclarativeEngineDebugServer::messageReceived()" << type;
-
if (type == "LIST_ENGINES") {
int queryId;
ds >> queryId;
diff --git a/src/declarative/qml/qdeclarativeerror.cpp b/src/declarative/qml/qdeclarativeerror.cpp
index 7e8aac0..8717f56 100644
--- a/src/declarative/qml/qdeclarativeerror.cpp
+++ b/src/declarative/qml/qdeclarativeerror.cpp
@@ -49,8 +49,27 @@ QT_BEGIN_NAMESPACE
/*!
\class QDeclarativeError
- \since 4.7
- \brief The QDeclarativeError class encapsulates a QML error
+ \since 4.7
+ \brief The QDeclarativeError class encapsulates a QML error.
+
+ QDeclarativeError includes a textual description of the error, as well
+ as location information (the file, line, and column). The toString()
+ method creates a single-line, human-readable string containing all of
+ this information, for example:
+ \code
+ file:///home/user/test.qml:7:8: Invalid property assignment: double expected
+ \endcode
+
+ You can use qDebug() or qWarning() to output errors to the console. This method
+ will attempt to open the file indicated by the error
+ and include additional contextual information.
+ \code
+ file:///home/user/test.qml:7:8: Invalid property assignment: double expected
+ y: "hello"
+ ^
+ \endcode
+
+ \sa QDeclarativeView::errors(), QDeclarativeComponent::errors()
*/
class QDeclarativeErrorPrivate
{
@@ -69,7 +88,7 @@ QDeclarativeErrorPrivate::QDeclarativeErrorPrivate()
}
/*!
- Create an empty error object.
+ Creates an empty error object.
*/
QDeclarativeError::QDeclarativeError()
: d(0)
@@ -77,7 +96,7 @@ QDeclarativeError::QDeclarativeError()
}
/*!
- Create a copy of \a other.
+ Creates a copy of \a other.
*/
QDeclarativeError::QDeclarativeError(const QDeclarativeError &other)
: d(0)
@@ -86,7 +105,7 @@ QDeclarativeError::QDeclarativeError(const QDeclarativeError &other)
}
/*!
- Assign \a other to this error object.
+ Assigns \a other to this error object.
*/
QDeclarativeError &QDeclarativeError::operator=(const QDeclarativeError &other)
{
@@ -112,7 +131,7 @@ QDeclarativeError::~QDeclarativeError()
}
/*!
- Return true if this error is valid, otherwise false.
+ Returns true if this error is valid, otherwise false.
*/
bool QDeclarativeError::isValid() const
{
@@ -120,7 +139,7 @@ bool QDeclarativeError::isValid() const
}
/*!
- Return the url for the file that caused this error.
+ Returns the url for the file that caused this error.
*/
QUrl QDeclarativeError::url() const
{
@@ -129,7 +148,7 @@ QUrl QDeclarativeError::url() const
}
/*!
- Set the \a url for the file that caused this error.
+ Sets the \a url for the file that caused this error.
*/
void QDeclarativeError::setUrl(const QUrl &url)
{
@@ -138,7 +157,7 @@ void QDeclarativeError::setUrl(const QUrl &url)
}
/*!
- Return the error description.
+ Returns the error description.
*/
QString QDeclarativeError::description() const
{
@@ -147,7 +166,7 @@ QString QDeclarativeError::description() const
}
/*!
- Set the error \a description.
+ Sets the error \a description.
*/
void QDeclarativeError::setDescription(const QString &description)
{
@@ -156,7 +175,7 @@ void QDeclarativeError::setDescription(const QString &description)
}
/*!
- Return the error line number.
+ Returns the error line number.
*/
int QDeclarativeError::line() const
{
@@ -165,7 +184,7 @@ int QDeclarativeError::line() const
}
/*!
- Set the error \a line number.
+ Sets the error \a line number.
*/
void QDeclarativeError::setLine(int line)
{
@@ -174,7 +193,7 @@ void QDeclarativeError::setLine(int line)
}
/*!
- Return the error column number.
+ Returns the error column number.
*/
int QDeclarativeError::column() const
{
@@ -183,7 +202,7 @@ int QDeclarativeError::column() const
}
/*!
- Set the error \a column number.
+ Sets the error \a column number.
*/
void QDeclarativeError::setColumn(int column)
{
@@ -192,14 +211,20 @@ void QDeclarativeError::setColumn(int column)
}
/*!
- Return the error as a human readable string.
+ Returns the error as a human readable string.
*/
QString QDeclarativeError::toString() const
{
QString rv;
- rv = url().toString() + QLatin1Char(':') + QString::number(line());
- if(column() != -1)
- rv += QLatin1Char(':') + QString::number(column());
+ if (url().isEmpty()) {
+ rv = QLatin1String("<Unknown File>");
+ } else if (line() != -1) {
+ rv = url().toString() + QLatin1Char(':') + QString::number(line());
+ if(column() != -1)
+ rv += QLatin1Char(':') + QString::number(column());
+ } else {
+ rv = url().toString();
+ }
rv += QLatin1String(": ") + description();
@@ -210,7 +235,7 @@ QString QDeclarativeError::toString() const
\relates QDeclarativeError
\fn QDebug operator<<(QDebug debug, const QDeclarativeError &error)
- Output a human readable version of \a error to \a debug.
+ Outputs a human readable version of \a error to \a debug.
*/
QDebug operator<<(QDebug debug, const QDeclarativeError &error)
diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp
index 05240a2..8b5a62f 100644
--- a/src/declarative/qml/qdeclarativeexpression.cpp
+++ b/src/declarative/qml/qdeclarativeexpression.cpp
@@ -695,14 +695,13 @@ void QDeclarativeExpressionPrivate::updateGuards(const QPODVector<QDeclarativeEn
if (!outputWarningHeader) {
outputWarningHeader = true;
qWarning() << "QDeclarativeExpression: Expression" << q->expression()
- << "depends on non-NOTIFYable properties:";
+ << "depends on non-NOTIFYable properties:";
}
const QMetaObject *metaObj = property.object->metaObject();
QMetaProperty metaProp = metaObj->property(property.coreIndex);
- qWarning().nospace() << " " << metaObj->className()
- << "::" << metaProp.name();
+ qWarning().nospace() << " " << metaObj->className() << "::" << metaProp.name();
}
}
}
diff --git a/src/declarative/qml/qdeclarativeextensionplugin.cpp b/src/declarative/qml/qdeclarativeextensionplugin.cpp
index 762c642d..863bfc4 100644
--- a/src/declarative/qml/qdeclarativeextensionplugin.cpp
+++ b/src/declarative/qml/qdeclarativeextensionplugin.cpp
@@ -59,6 +59,11 @@ QT_BEGIN_NAMESPACE
function, and exporting the class using the Q_EXPORT_PLUGIN2()
macro.
+ QML extension plugins can be used to provide either application-specific or
+ library-like plugins. Library plugins should limit themselves to registering types,
+ as any manipulation of the engine's root context may cause conflicts
+ or other issues in the library user's code.
+
See \l {Extending QML in C++} for details how to write a QML extension plugin.
See \l {How to Create Qt Plugins} for general Qt plugin documentation.
@@ -85,7 +90,7 @@ QDeclarativeExtensionPlugin::QDeclarativeExtensionPlugin(QObject *parent)
}
/*!
- Destructor.
+ Destroys the plugin.
*/
QDeclarativeExtensionPlugin::~QDeclarativeExtensionPlugin()
{
@@ -94,7 +99,9 @@ QDeclarativeExtensionPlugin::~QDeclarativeExtensionPlugin()
/*!
\fn void QDeclarativeExtensionPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
- Initializes the extension from the \a uri using the \a engine.
+ Initializes the extension from the \a uri using the \a engine. Here an application
+ plugin might, for example, expose some data or objects to QML,
+ as context properties on the engine's root context.
*/
void QDeclarativeExtensionPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri)
diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp
index b992b9f..4be3472 100644
--- a/src/declarative/qml/qdeclarativeimageprovider.cpp
+++ b/src/declarative/qml/qdeclarativeimageprovider.cpp
@@ -45,31 +45,39 @@ QT_BEGIN_NAMESPACE
/*!
\class QDeclarativeImageProvider
- \brief The QDeclarativeImageProvider class provides an interface for threaded image requests.
+ \since 4.7
+ \brief The QDeclarativeImageProvider class provides an interface for threaded image requests in QML.
- Note: the request() method may be called by multiple threads, so ensure the
+ QDeclarativeImageProvider can be used by a QDeclarativeEngine to provide images to QML asynchronously.
+ The image request will be run in a low priority thread, allowing potentially costly image
+ loading to be done in the background, without affecting the performance of the UI.
+
+ See the QDeclarativeEngine::addImageProvider() documentation for an
+ example of how a custom QDeclarativeImageProvider can be constructed and used.
+
+ \note the request() method may be called by multiple threads, so ensure the
implementation of this method is reentrant.
\sa QDeclarativeEngine::addImageProvider()
*/
/*!
- The destructor is virtual.
+ Destroys the image provider.
*/
QDeclarativeImageProvider::~QDeclarativeImageProvider()
{
}
/*!
- \fn QImage QDeclarativeImageProvider::request(const QString &id, QSize *size, const QSize& requested_size)
+ \fn QImage QDeclarativeImageProvider::request(const QString &id, QSize *size, const QSize& requestedSize)
Implement this method to return the image with \a id.
- If \a requested_size is a valid size, resize the image to that size before returning.
+ If \a requestedSize is a valid size, the image returned should be of that size.
- In any case, \a size must be set to the (original) size of the image.
+ In all cases, \a size must be set to the original size of the image.
- Note: this method may be called by multiple threads, so ensure the
+ \note this method may be called by multiple threads, so ensure the
implementation of this method is reentrant.
*/
diff --git a/src/declarative/qml/qdeclarativeimageprovider.h b/src/declarative/qml/qdeclarativeimageprovider.h
index 50b73fe..cc9c9af 100644
--- a/src/declarative/qml/qdeclarativeimageprovider.h
+++ b/src/declarative/qml/qdeclarativeimageprovider.h
@@ -54,7 +54,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeImageProvider
{
public:
virtual ~QDeclarativeImageProvider();
- virtual QImage request(const QString &id, QSize *size, const QSize& requested_size) = 0;
+ virtual QImage request(const QString &id, QSize *size, const QSize& requestedSize) = 0;
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeinfo.cpp b/src/declarative/qml/qdeclarativeinfo.cpp
index 0a4352f..f6560a6 100644
--- a/src/declarative/qml/qdeclarativeinfo.cpp
+++ b/src/declarative/qml/qdeclarativeinfo.cpp
@@ -45,6 +45,7 @@
#include "qdeclarativecontext.h"
#include "private/qdeclarativecontext_p.h"
#include "private/qdeclarativemetatype_p.h"
+#include "private/qdeclarativeengine_p.h"
#include <QCoreApplication>
@@ -77,52 +78,94 @@ QT_BEGIN_NAMESPACE
\endcode
*/
+struct QDeclarativeInfoPrivate
+{
+ const QObject *object;
+ QString *buffer;
+ QList<QDeclarativeError> errors;
+};
+
QDeclarativeInfo::QDeclarativeInfo(const QObject *object)
-: QDebug(QtWarningMsg)
+: QDebug((*(QString **)&d) = new QString)
{
- QString pos = QLatin1String("QML");
- if (object) {
- pos += QLatin1Char(' ');
-
- QString typeName;
- QDeclarativeType *type = QDeclarativeMetaType::qmlType(object->metaObject());
- if (type) {
- typeName = QLatin1String(type->qmlTypeName());
- int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
- if (lastSlash != -1)
- typeName = typeName.mid(lastSlash+1);
- } else {
- typeName = QString::fromUtf8(object->metaObject()->className());
- int marker = typeName.indexOf(QLatin1String("_QMLTYPE_"));
- if (marker != -1)
- typeName = typeName.left(marker);
- }
+ QDeclarativeInfoPrivate *p = new QDeclarativeInfoPrivate;
+ p->buffer = (QString *)d;
+ d = p;
- pos += typeName;
- }
- QDeclarativeData *ddata = object?QDeclarativeData::get(object):0;
- pos += QLatin1String(" (");
- if (ddata) {
- if (ddata->outerContext && !ddata->outerContext->url.isEmpty()) {
- pos += ddata->outerContext->url.toString();
- pos += QLatin1Char(':');
- pos += QString::number(ddata->lineNumber);
- pos += QLatin1Char(':');
- pos += QString::number(ddata->columnNumber);
- } else {
- pos += QCoreApplication::translate("QDeclarativeInfo","unknown location");
- }
- } else {
- pos += QCoreApplication::translate("QDeclarativeInfo","unknown location");
- }
- pos += QLatin1Char(')');
- *this << pos;
+ d->object = object;
nospace();
}
-QDeclarativeInfo::~QDeclarativeInfo()
+QDeclarativeInfo::QDeclarativeInfo(const QObject *object, const QList<QDeclarativeError> &errors)
+: QDebug((*(QString **)&d) = new QString)
{
+ QDeclarativeInfoPrivate *p = new QDeclarativeInfoPrivate;
+ p->buffer = (QString *)d;
+ d = p;
+
+ d->object = object;
+ d->errors = errors;
+ nospace();
}
+QDeclarativeInfo::QDeclarativeInfo(const QObject *object, const QDeclarativeError &error)
+: QDebug((*(QString **)&d) = new QString)
+{
+ QDeclarativeInfoPrivate *p = new QDeclarativeInfoPrivate;
+ p->buffer = (QString *)d;
+ d = p;
+
+ d->object = object;
+ d->errors << error;
+ nospace();
+}
+
+QDeclarativeInfo::~QDeclarativeInfo()
+{
+ QList<QDeclarativeError> errors = d->errors;
+
+ QDeclarativeEngine *engine = 0;
+
+ if (!d->buffer->isEmpty()) {
+ QDeclarativeError error;
+
+ QObject *object = const_cast<QObject *>(d->object);
+
+ if (object) {
+ engine = qmlEngine(d->object);
+ QString typeName;
+ QDeclarativeType *type = QDeclarativeMetaType::qmlType(object->metaObject());
+ if (type) {
+ typeName = QLatin1String(type->qmlTypeName());
+ int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
+ if (lastSlash != -1)
+ typeName = typeName.mid(lastSlash+1);
+ } else {
+ typeName = QString::fromUtf8(object->metaObject()->className());
+ int marker = typeName.indexOf(QLatin1String("_QMLTYPE_"));
+ if (marker != -1)
+ typeName = typeName.left(marker);
+ }
+
+ d->buffer->prepend(QLatin1String("QML ") + typeName + QLatin1String(": "));
+
+ QDeclarativeData *ddata = QDeclarativeData::get(object, false);
+ if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty()) {
+ error.setUrl(ddata->outerContext->url);
+ error.setLine(ddata->lineNumber);
+ error.setColumn(ddata->columnNumber);
+ }
+ }
+
+ error.setDescription(*d->buffer);
+
+ errors.prepend(error);
+ }
+
+ QDeclarativeEnginePrivate::warning(engine, errors);
+
+ delete d->buffer;
+ delete d;
+}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeinfo.h b/src/declarative/qml/qdeclarativeinfo.h
index 8f69f73..3d5a111 100644
--- a/src/declarative/qml/qdeclarativeinfo.h
+++ b/src/declarative/qml/qdeclarativeinfo.h
@@ -43,6 +43,8 @@
#define QDECLARATIVEINFO_H
#include <QtCore/qdebug.h>
+#include <QtCore/qurl.h>
+#include <QtDeclarative/qdeclarativeerror.h>
QT_BEGIN_HEADER
@@ -50,10 +52,13 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
+class QDeclarativeInfoPrivate;
class Q_DECLARATIVE_EXPORT QDeclarativeInfo : public QDebug
{
public:
QDeclarativeInfo(const QObject *);
+ QDeclarativeInfo(const QObject *, const QDeclarativeError &);
+ QDeclarativeInfo(const QObject *, const QList<QDeclarativeError> &);
~QDeclarativeInfo();
inline QDeclarativeInfo &operator<<(QChar t) { QDebug::operator<<(t); return *this; }
@@ -78,6 +83,10 @@ public:
inline QDeclarativeInfo &operator<<(const void * t) { QDebug::operator<<(t); return *this; }
inline QDeclarativeInfo &operator<<(QTextStreamFunction f) { QDebug::operator<<(f); return *this; }
inline QDeclarativeInfo &operator<<(QTextStreamManipulator m) { QDebug::operator<<(m); return *this; }
+ inline QDeclarativeInfo &operator<<(const QUrl &t) { static_cast<QDebug &>(*this) << t; return *this; }
+
+private:
+ QDeclarativeInfoPrivate *d;
};
Q_DECLARATIVE_EXPORT inline QDeclarativeInfo qmlInfo(const QObject *me)
@@ -85,6 +94,16 @@ Q_DECLARATIVE_EXPORT inline QDeclarativeInfo qmlInfo(const QObject *me)
return QDeclarativeInfo(me);
}
+Q_DECLARATIVE_EXPORT inline QDeclarativeInfo qmlInfo(const QObject *me, const QDeclarativeError &error)
+{
+ return QDeclarativeInfo(me, error);
+}
+
+Q_DECLARATIVE_EXPORT inline QDeclarativeInfo qmlInfo(const QObject *me, const QList<QDeclarativeError> &errors)
+{
+ return QDeclarativeInfo(me, errors);
+}
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp
index d88d06a..99f1cc8 100644
--- a/src/declarative/qml/qdeclarativeinstruction.cpp
+++ b/src/declarative/qml/qdeclarativeinstruction.cpp
@@ -149,9 +149,6 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
case QDeclarativeInstruction::StoreSignal:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value << "\t\t" << primitives.at(instr->storeSignal.value);
break;
- case QDeclarativeInstruction::StoreScript:
- qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SCRIPT\t\t" << instr->storeScript.value;
- break;
case QDeclarativeInstruction::StoreImportedScript:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_IMPORTED_SCRIPT\t" << instr->storeScript.value;
break;
diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h
index e8287c0..c09b157 100644
--- a/src/declarative/qml/qdeclarativeinstruction_p.h
+++ b/src/declarative/qml/qdeclarativeinstruction_p.h
@@ -121,7 +121,6 @@ public:
StoreInterface, /* storeObject */
StoreSignal, /* storeSignal */
- StoreScript, /* storeScript */
StoreImportedScript, /* storeScript */
StoreScriptString, /* storeScriptString */
diff --git a/src/declarative/qml/qdeclarativelist.cpp b/src/declarative/qml/qdeclarativelist.cpp
index 45b8cd7..31ef4c2 100644
--- a/src/declarative/qml/qdeclarativelist.cpp
+++ b/src/declarative/qml/qdeclarativelist.cpp
@@ -87,9 +87,10 @@ void QDeclarativeListReferencePrivate::release()
/*!
\class QDeclarativeListReference
+\since 4.7
\brief The QDeclarativeListReference class allows the manipulation of QDeclarativeListProperty properties.
-QDeclarativeListReference allows programs to read from, and assign values to a QML list property in a
+QDeclarativeListReference allows C++ programs to read from, and assign values to a QML list property in a
simple and type safe way. A QDeclarativeListReference can be created by passing an object and property
name or through a QDeclarativeProperty instance. These two are equivalant:
@@ -304,6 +305,7 @@ int QDeclarativeListReference::count() const
/*!
\class QDeclarativeListProperty
+\since 4.7
\brief The QDeclarativeListProperty class allows applications to explose list-like
properties to QML.
@@ -313,10 +315,10 @@ The use of a list property from QML looks like this:
\code
FruitBasket {
fruit: [
- Apple {},
- Orange{},
- Banana {}
- ]
+ Apple {},
+ Orange{},
+ Banana{}
+ ]
}
\endcode
@@ -336,6 +338,9 @@ Q_PROPERTY(QDeclarativeListProperty<Fruit> fruit READ fruit);
QML list properties are typesafe - in this case \c {Fruit} is a QObject type that
\c {Apple}, \c {Orange} and \c {Banana} all derive from.
+
+\note QDeclarativeListProperty can only be used for lists of QObject-derived object pointers.
+
*/
/*!
diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp
index 7b71608..d41bd43 100644
--- a/src/declarative/qml/qdeclarativemetatype.cpp
+++ b/src/declarative/qml/qdeclarativemetatype.cpp
@@ -403,10 +403,8 @@ int QDeclarativeType::index() const
int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterInterface &interface)
{
- if (interface.version > 0) {
- qWarning("Cannot mix incompatible QML versions.");
- return -1;
- }
+ if (interface.version > 0)
+ qFatal("qmlRegisterType(): Cannot mix incompatible QML versions.");
QWriteLocker lock(metaTypeDataLock());
QDeclarativeMetaTypeData *data = metaTypeData();
@@ -437,7 +435,7 @@ int QDeclarativePrivate::registerType(const QDeclarativePrivate::RegisterType &t
if (type.elementName) {
for (int ii = 0; type.elementName[ii]; ++ii) {
if (!isalnum(type.elementName[ii])) {
- qWarning("QDeclarativeMetaType: Invalid QML element name %s", type.elementName);
+ qWarning("qmlRegisterType(): Invalid QML element name \"%s\"", type.elementName);
return -1;
}
}
diff --git a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp
index 9dd7d39..f5f1a1f 100644
--- a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp
+++ b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp
@@ -56,12 +56,17 @@ QT_BEGIN_NAMESPACE
To implement a factory, subclass QDeclarativeNetworkAccessManagerFactory and implement
the create() method.
+ To use a factory, assign it to the relevant QDeclarativeEngine using
+ QDeclarativeEngine::setNetworkAccessManagerFactory().
+
If the created QNetworkAccessManager becomes invalid, due to a
change in proxy settings, for example, call the invalidate() method.
This will cause all QNetworkAccessManagers to be recreated.
Note: the create() method may be called by multiple threads, so ensure the
implementation of this method is reentrant.
+
+ \sa QDeclarativeEngine::setNetworkAccessManagerFactory()
*/
/*!
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index 5773fe6..a194354 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -59,12 +59,17 @@ Q_DECLARE_METATYPE(QScriptValue);
QT_BEGIN_NAMESPACE
struct ObjectData : public QScriptDeclarativeClass::Object {
- ObjectData(QObject *o, int t) : object(o), type(t) {}
+ ObjectData(QObject *o, int t) : object(o), type(t) {
+ if (o) {
+ QDeclarativeData *ddata = QDeclarativeData::get(object, true);
+ if (ddata) ddata->objectDataRefCount++;
+ }
+ }
virtual ~ObjectData() {
if (object && !object->parent()) {
QDeclarativeData *ddata = QDeclarativeData::get(object, false);
- if (ddata && !ddata->indestructible)
+ if (ddata && !ddata->indestructible && 0 == --ddata->objectDataRefCount)
object->deleteLater();
}
}
@@ -458,12 +463,21 @@ QStringList QDeclarativeObjectScriptClass::propertyNames(Object *object)
cache = ddata->propertyCache;
if (!cache) {
cache = enginePrivate->cache(obj);
- if (cache && ddata) { cache->addref(); ddata->propertyCache = cache; }
+ if (cache) {
+ if (ddata) { cache->addref(); ddata->propertyCache = cache; }
+ } else {
+ // Not cachable - fall back to QMetaObject (eg. dynamic meta object)
+ // XXX QDeclarativeOpenMetaObject has a cache, so this is suboptimal.
+ // XXX This is a workaround for QTBUG-9420.
+ const QMetaObject *mo = obj->metaObject();
+ QStringList r;
+ int pc = mo->propertyCount();
+ int po = mo->propertyOffset();
+ for (int i=po; i<pc; ++i)
+ r += QString::fromUtf8(mo->property(i).name());
+ return r;
+ }
}
-
- if (!cache)
- return QStringList();
-
return cache->propertyNames();
}
diff --git a/src/declarative/qml/qdeclarativeparser.cpp b/src/declarative/qml/qdeclarativeparser.cpp
index d1f209a..b38bd76 100644
--- a/src/declarative/qml/qdeclarativeparser.cpp
+++ b/src/declarative/qml/qdeclarativeparser.cpp
@@ -89,8 +89,6 @@ QDeclarativeParser::Object::~Object()
prop.first->release();
foreach(const DynamicProperty &prop, dynamicProperties)
if (prop.defaultValue) prop.defaultValue->release();
- foreach(Object *obj, scriptBlockObjects)
- obj->release();
}
void Object::setBindingBit(int b)
diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h
index 00fc65b..0870cfb 100644
--- a/src/declarative/qml/qdeclarativeparser_p.h
+++ b/src/declarative/qml/qdeclarativeparser_p.h
@@ -160,8 +160,6 @@ namespace QDeclarativeParser
Property *defaultProperty;
QHash<QByteArray, Property *> properties;
- QList<Object *> scriptBlockObjects;
-
// Output of the compilation phase (these properties continue to exist
// in either the defaultProperty or properties members too)
void addValueProperty(Property *);
@@ -190,7 +188,9 @@ namespace QDeclarativeParser
QList<int> lineNumbers;
QList<Pragmas> pragmas;
};
+#if 0
QList<ScriptBlock> scripts;
+#endif
// The bytes to cast instances by to get to the QDeclarativeParserStatus
// interface. -1 indicates the type doesn't support this interface.
diff --git a/src/declarative/qml/qdeclarativeparserstatus.cpp b/src/declarative/qml/qdeclarativeparserstatus.cpp
index ec6260e..978bfb4 100644
--- a/src/declarative/qml/qdeclarativeparserstatus.cpp
+++ b/src/declarative/qml/qdeclarativeparserstatus.cpp
@@ -45,8 +45,36 @@ QT_BEGIN_NAMESPACE
/*!
\class QDeclarativeParserStatus
- \since 4.7
- \brief The QDeclarativeParserStatus class provides updates on the parser state.
+ \since 4.7
+ \brief The QDeclarativeParserStatus class provides updates on the QML parser state.
+
+ QDeclarativeParserStatus provides a mechanism for classes instantiated by
+ a QDeclarativeEngine to receive notification at key points in their creation.
+
+ This class is often used for optimization purposes, as it allows you to defer an
+ expensive operation until after all the properties have been set on an
+ object. For example, QML's \l {Text} element uses the parser status
+ to defer text layout until all of its properties have been set (we
+ don't want to layout when the \c text is assigned, and then relayout
+ when the \c font is assigned, and relayout again when the \c width is assigned,
+ and so on).
+
+ To use QDeclarativeParserStatus, you must inherit both a QObject-derived class
+ and QDeclarativeParserStatus, and use the Q_INTERFACES() macro.
+
+ \code
+ class MyObject : public QObject, public QDeclarativeParserStatus
+ {
+ Q_OBJECT
+ Q_INTERFACES(QDeclarativeParserStatus)
+
+ public:
+ MyObject(QObject *parent = 0);
+ ...
+ void classBegin();
+ void componentComplete();
+ }
+ \endcode
*/
/*! \internal */
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp
index afd0d84..3881d0a 100644
--- a/src/declarative/qml/qdeclarativeproperty.cpp
+++ b/src/declarative/qml/qdeclarativeproperty.cpp
@@ -64,6 +64,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QDeclarativeProperty
+\since 4.7
\brief The QDeclarativeProperty class abstracts accessing properties on objects created from QML.
As QML uses Qt's meta-type system all of the existing QMetaObject classes can be used to introspect
diff --git a/src/declarative/qml/qdeclarativeproxymetaobject.cpp b/src/declarative/qml/qdeclarativeproxymetaobject.cpp
index fe0dce7..c2dce0a 100644
--- a/src/declarative/qml/qdeclarativeproxymetaobject.cpp
+++ b/src/declarative/qml/qdeclarativeproxymetaobject.cpp
@@ -41,17 +41,11 @@
#include "private/qdeclarativeproxymetaobject_p.h"
-#include <QDebug>
-
QT_BEGIN_NAMESPACE
QDeclarativeProxyMetaObject::QDeclarativeProxyMetaObject(QObject *obj, QList<ProxyData> *mList)
: metaObjects(mList), proxies(0), parent(0), object(obj)
{
-#ifdef QDECLARATIVEPROXYMETAOBJECT_DEBUG
- qWarning() << "QDeclarativeProxyMetaObject" << obj->metaObject()->className();
-#endif
-
*static_cast<QMetaObject *>(this) = *metaObjects->first().metaObject;
QObjectPrivate *op = QObjectPrivate::get(obj);
@@ -59,14 +53,6 @@ QDeclarativeProxyMetaObject::QDeclarativeProxyMetaObject(QObject *obj, QList<Pro
parent = static_cast<QAbstractDynamicMetaObject*>(op->metaObject);
op->metaObject = this;
-
-#ifdef QDECLARATIVEPROXYMETAOBJECT_DEBUG
- const QMetaObject *mo = obj->metaObject();
- while(mo) {
- qWarning() << " " << mo->className();
- mo = mo->superClass();
- }
-#endif
}
QDeclarativeProxyMetaObject::~QDeclarativeProxyMetaObject()
diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp
index ac49332..e7c8a12 100644
--- a/src/declarative/qml/qdeclarativescriptparser.cpp
+++ b/src/declarative/qml/qdeclarativescriptparser.cpp
@@ -296,27 +296,12 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName,
if (lastTypeDot >= 0)
resolvableObjectType.replace(QLatin1Char('.'),QLatin1Char('/'));
- bool isScript = resolvableObjectType == QLatin1String("Script");
-
- if (isScript) {
- if (_stateStack.isEmpty() || _stateStack.top().property) {
- QDeclarativeError error;
- error.setDescription(QCoreApplication::translate("QDeclarativeParser","Invalid use of Script block"));
- error.setLine(typeLocation.startLine);
- error.setColumn(typeLocation.startColumn);
- _parser->_errors << error;
- return 0;
- }
- }
-
Object *obj = new Object;
- if (!isScript) {
- QDeclarativeScriptParser::TypeReference *typeRef = _parser->findOrCreateType(resolvableObjectType);
- obj->type = typeRef->id;
+ QDeclarativeScriptParser::TypeReference *typeRef = _parser->findOrCreateType(resolvableObjectType);
+ obj->type = typeRef->id;
- typeRef->refObjects.append(obj);
- }
+ typeRef->refObjects.append(obj);
// XXX this doesn't do anything (_scope never builds up)
_scope.append(resolvableObjectType);
@@ -325,11 +310,7 @@ ProcessAST::defineObjectBinding_helper(AST::UiQualifiedId *propertyName,
obj->location = location;
- if (isScript) {
-
- _stateStack.top().object->scriptBlockObjects.append(obj);
-
- } else if (propertyCount) {
+ if (propertyCount) {
Property *prop = currentProperty();
Value *v = new Value;
@@ -535,7 +516,6 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
// { "time", Object::DynamicProperty::Time, "QTime" },
// { "date", Object::DynamicProperty::Date, "QDate" },
{ "date", Object::DynamicProperty::DateTime, "QDateTime" },
- { "var", Object::DynamicProperty::Variant, "QVariant" },
{ "variant", Object::DynamicProperty::Variant, "QVariant" }
};
const int propTypeNameToTypesCount = sizeof(propTypeNameToTypes) /
@@ -647,11 +627,6 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
property.location = location(node->firstSourceLocation(),
node->lastSourceLocation());
- if (memberType == QLatin1String("var"))
- qWarning().nospace() << qPrintable(_parser->_scriptFile) << ":" << property.location.start.line << ":"
- << property.location.start.column << ": var type has been replaced by variant. "
- << "Support will be removed entirely shortly.";
-
if (node->expression) { // default value
property.defaultValue = new Property;
property.defaultValue->parent = _stateStack.top().object;
@@ -827,62 +802,29 @@ bool ProcessAST::visit(AST::UiSourceElement *node)
{
QDeclarativeParser::Object *obj = currentObject();
- bool isScript = (obj && obj->typeName == "Script");
-
- if (!isScript) {
-
- if (AST::FunctionDeclaration *funDecl = AST::cast<AST::FunctionDeclaration *>(node->sourceElement)) {
+ if (AST::FunctionDeclaration *funDecl = AST::cast<AST::FunctionDeclaration *>(node->sourceElement)) {
- Object::DynamicSlot slot;
- slot.location = location(funDecl->firstSourceLocation(), funDecl->lastSourceLocation());
+ Object::DynamicSlot slot;
+ slot.location = location(funDecl->firstSourceLocation(), funDecl->lastSourceLocation());
- AST::FormalParameterList *f = funDecl->formals;
- while (f) {
- slot.parameterNames << f->name->asString().toUtf8();
- f = f->finish();
- }
-
- QString body = textAt(funDecl->lbraceToken, funDecl->rbraceToken);
- slot.name = funDecl->name->asString().toUtf8();
- slot.body = body;
- obj->dynamicSlots << slot;
-
- } else {
- QDeclarativeError error;
- error.setDescription(QCoreApplication::translate("QDeclarativeParser","JavaScript declaration outside Script element"));
- error.setLine(node->firstSourceLocation().startLine);
- error.setColumn(node->firstSourceLocation().startColumn);
- _parser->_errors << error;
+ AST::FormalParameterList *f = funDecl->formals;
+ while (f) {
+ slot.parameterNames << f->name->asString().toUtf8();
+ f = f->finish();
}
- return false;
-
- } else {
- QString source;
- int line = 0;
- if (AST::FunctionDeclaration *funDecl = AST::cast<AST::FunctionDeclaration *>(node->sourceElement)) {
- line = funDecl->functionToken.startLine;
- source = asString(funDecl);
- } else if (AST::VariableStatement *varStmt = AST::cast<AST::VariableStatement *>(node->sourceElement)) {
- // ignore variable declarations
- line = varStmt->declarationKindToken.startLine;
+ QString body = textAt(funDecl->lbraceToken, funDecl->rbraceToken);
+ slot.name = funDecl->name->asString().toUtf8();
+ slot.body = body;
+ obj->dynamicSlots << slot;
- QDeclarativeError error;
- error.setDescription(QCoreApplication::translate("QDeclarativeParser", "Variable declarations not allow in inline Script blocks"));
- error.setLine(node->firstSourceLocation().startLine);
- error.setColumn(node->firstSourceLocation().startColumn);
- _parser->_errors << error;
- return false;
- }
-
- Value *value = new Value;
- value->location = location(node->firstSourceLocation(),
- node->lastSourceLocation());
- value->value = QDeclarativeParser::Variant(source);
-
- obj->getDefaultProperty()->addValue(value);
+ } else {
+ QDeclarativeError error;
+ error.setDescription(QCoreApplication::translate("QDeclarativeParser","JavaScript declaration outside Script element"));
+ error.setLine(node->firstSourceLocation().startLine);
+ error.setColumn(node->firstSourceLocation().startColumn);
+ _parser->_errors << error;
}
-
return false;
}
diff --git a/src/declarative/qml/qdeclarativescriptstring.cpp b/src/declarative/qml/qdeclarativescriptstring.cpp
index 5b9afe9..8f717d1 100644
--- a/src/declarative/qml/qdeclarativescriptstring.cpp
+++ b/src/declarative/qml/qdeclarativescriptstring.cpp
@@ -55,24 +55,35 @@ public:
/*!
\class QDeclarativeScriptString
- \since 4.7
+\since 4.7
\brief The QDeclarativeScriptString class encapsulates a script and its context.
-The QDeclarativeScriptString is used by properties that want to accept a script "assignment" from QML.
+QDeclarativeScriptString is used to create QObject properties that accept a script "assignment" from QML.
-Normally, the following code would result in a binding being established for the \c script
-property. If the property had a type of QDeclarativeScriptString, the script - \e {console.log(1921)} - itself
-would be passed to the property and it could choose how to handle it.
+Normally, the following QML would result in a binding being established for the \c script
+property; i.e. \c script would be assigned the value obtained from running \c {myObj.value = Math.max(myValue, 100)}
-\code
+\qml
MyType {
- script: console.log(1921)
+ script: myObj.value = Math.max(myValue, 100)
}
+\endqml
+
+If instead the property had a type of QDeclarativeScriptString,
+the script itself -- \e {myObj.value = Math.max(myValue, 100)} -- would be passed to the \c script property
+and the class could choose how to handle it. Typically, the class will evaluate
+the script at some later time using a QDeclarativeExpression.
+
+\code
+QDeclarativeExpression expr(scriptString.context(), scriptString.script(), scriptStr.scopeObject());
+expr.value();
\endcode
+
+\sa QDeclarativeExpression
*/
/*!
-Construct an empty instance.
+Constructs an empty instance.
*/
QDeclarativeScriptString::QDeclarativeScriptString()
: d(new QDeclarativeScriptStringPrivate)
@@ -80,7 +91,7 @@ QDeclarativeScriptString::QDeclarativeScriptString()
}
/*!
-Copy \a other.
+Copies \a other.
*/
QDeclarativeScriptString::QDeclarativeScriptString(const QDeclarativeScriptString &other)
: d(other.d)
@@ -95,7 +106,7 @@ QDeclarativeScriptString::~QDeclarativeScriptString()
}
/*!
-Assign \a other to this.
+Assigns \a other to this.
*/
QDeclarativeScriptString &QDeclarativeScriptString::operator=(const QDeclarativeScriptString &other)
{
@@ -104,7 +115,7 @@ QDeclarativeScriptString &QDeclarativeScriptString::operator=(const QDeclarative
}
/*!
-Return the context for the script.
+Returns the context for the script.
*/
QDeclarativeContext *QDeclarativeScriptString::context() const
{
diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp
index 352a6c0..c5f6d6a 100644
--- a/src/declarative/qml/qdeclarativevaluetype.cpp
+++ b/src/declarative/qml/qdeclarativevaluetype.cpp
@@ -55,13 +55,13 @@ int qmlRegisterValueTypeEnums(const char *qmlName)
QByteArray pointerName(name + '*');
QDeclarativePrivate::RegisterType type = {
- 0,
+ 0,
qRegisterMetaType<T *>(pointerName.constData()), 0, 0, 0,
"Qt", 4, 6, qmlName, &T::staticMetaObject,
- 0, 0,
+ 0, 0,
0, 0, 0,
@@ -712,7 +712,7 @@ int QDeclarativeFontValueType::pixelSize() const
void QDeclarativeFontValueType::setPixelSize(int size)
{
- if (size >=0) {
+ if (size >0) {
if (pointSizeSet)
qWarning() << "Both point size and pixel size set. Using pixel size.";
font.setPixelSize(size);
diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp
index fdcbeee..57bf726 100644
--- a/src/declarative/qml/qdeclarativevme.cpp
+++ b/src/declarative/qml/qdeclarativevme.cpp
@@ -623,13 +623,6 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
}
break;
- case QDeclarativeInstruction::StoreScript:
- {
- QObject *target = stack.top();
- ctxt->addScript(scripts.at(instr.storeScript.value), target);
- }
- break;
-
case QDeclarativeInstruction::StoreImportedScript:
{
ctxt->addImportedScript(scripts.at(instr.storeScript.value));
diff --git a/src/declarative/qml/qdeclarativevmemetaobject.cpp b/src/declarative/qml/qdeclarativevmemetaobject.cpp
index c4d47b3..45f04a0 100644
--- a/src/declarative/qml/qdeclarativevmemetaobject.cpp
+++ b/src/declarative/qml/qdeclarativevmemetaobject.cpp
@@ -86,7 +86,6 @@ public:
inline void setValue(const QDate &);
inline void setValue(const QDateTime &);
inline void setValue(const QScriptValue &);
-
private:
int type;
void *data[4]; // Large enough to hold all types
@@ -112,6 +111,9 @@ void QDeclarativeVMEVariant::cleanup()
type == QMetaType::Bool ||
type == QMetaType::Double) {
type = QVariant::Invalid;
+ } else if (type == QMetaType::QObjectStar) {
+ ((QDeclarativeGuard<QObject>*)dataPtr())->~QDeclarativeGuard<QObject>();
+ type = QVariant::Invalid;
} else if (type == QMetaType::QString) {
((QString *)dataPtr())->~QString();
type = QVariant::Invalid;
@@ -160,7 +162,7 @@ QObject *QDeclarativeVMEVariant::asQObject()
if (type != QMetaType::QObjectStar)
setValue((QObject *)0);
- return *(QObject **)(dataPtr());
+ return *(QDeclarativeGuard<QObject> *)(dataPtr());
}
const QVariant &QDeclarativeVMEVariant::asQVariant()
@@ -256,8 +258,9 @@ void QDeclarativeVMEVariant::setValue(QObject *v)
if (type != QMetaType::QObjectStar) {
cleanup();
type = QMetaType::QObjectStar;
+ new (dataPtr()) QDeclarativeGuard<QObject>();
}
- *(QObject **)(dataPtr()) = v;
+ *(QDeclarativeGuard<QObject>*)(dataPtr()) = v;
}
void QDeclarativeVMEVariant::setValue(const QVariant &v)
@@ -465,8 +468,7 @@ int QDeclarativeVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a)
if (c == QMetaObject::ReadProperty) {
*reinterpret_cast<QVariant *>(a[0]) = readVarPropertyAsVariant(id);
} else if (c == QMetaObject::WriteProperty) {
- needActivate = (data[id].asQVariant() != *reinterpret_cast<QVariant *>(a[0]));
- data[id].setValue(*reinterpret_cast<QVariant *>(a[0]));
+ writeVarProperty(id, *reinterpret_cast<QVariant *>(a[0]));
}
} else {
@@ -682,6 +684,8 @@ QScriptValue QDeclarativeVMEMetaObject::readVarProperty(int id)
{
if (data[id].dataType() == qMetaTypeId<QScriptValue>())
return data[id].asQScriptValue();
+ else if (data[id].dataType() == QMetaType::QObjectStar)
+ return QDeclarativeEnginePrivate::get(ctxt->engine)->objectClass->newQObject(data[id].asQObject());
else
return QDeclarativeEnginePrivate::get(ctxt->engine)->scriptValueFromVariant(data[id].asQVariant());
}
@@ -690,7 +694,9 @@ QVariant QDeclarativeVMEMetaObject::readVarPropertyAsVariant(int id)
{
if (data[id].dataType() == qMetaTypeId<QScriptValue>())
return QDeclarativeEnginePrivate::get(ctxt->engine)->scriptValueToVariant(data[id].asQScriptValue());
- else
+ else if (data[id].dataType() == QMetaType::QObjectStar)
+ return QVariant::fromValue(data[id].asQObject());
+ else
return data[id].asQVariant();
}
@@ -700,6 +706,15 @@ void QDeclarativeVMEMetaObject::writeVarProperty(int id, const QScriptValue &val
activate(object, methodOffset + id, 0);
}
+void QDeclarativeVMEMetaObject::writeVarProperty(int id, const QVariant &value)
+{
+ if (value.userType() == QMetaType::QObjectStar)
+ data[id].setValue(qvariant_cast<QObject *>(value));
+ else
+ data[id].setValue(value);
+ activate(object, methodOffset + id, 0);
+}
+
void QDeclarativeVMEMetaObject::listChanged(int id)
{
activate(object, methodOffset + id, 0);
diff --git a/src/declarative/qml/qdeclarativevmemetaobject_p.h b/src/declarative/qml/qdeclarativevmemetaobject_p.h
index 76390c9..4fc3269 100644
--- a/src/declarative/qml/qdeclarativevmemetaobject_p.h
+++ b/src/declarative/qml/qdeclarativevmemetaobject_p.h
@@ -148,6 +148,7 @@ private:
QScriptValue readVarProperty(int);
QVariant readVarPropertyAsVariant(int);
void writeVarProperty(int, const QScriptValue &);
+ void writeVarProperty(int, const QVariant &);
QAbstractDynamicMetaObject *parent;
diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
index be2a1a7..b7e1832 100644
--- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp
+++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp
@@ -1305,7 +1305,7 @@ void QDeclarativeXMLHttpRequest::printError(const QScriptValue& sv)
{
QDeclarativeError error;
QDeclarativeExpressionPrivate::exceptionToError(sv.engine(), error);
- qWarning().nospace() << qPrintable(error.toString());
+ QDeclarativeEnginePrivate::warning(QDeclarativeEnginePrivate::get(sv.engine()), error);
}
void QDeclarativeXMLHttpRequest::destroyNetwork()
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 7e20428..27f37df 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -185,7 +185,7 @@ void QDeclarativeAbstractAnimation::setRunning(bool r)
return;
if (d->group || d->disableUserControl) {
- qWarning("QDeclarativeAbstractAnimation: setRunning() cannot be used on non-root animation nodes");
+ qmlInfo(this) << "setRunning() cannot be used on non-root animation nodes.";
return;
}
@@ -245,7 +245,7 @@ void QDeclarativeAbstractAnimation::setPaused(bool p)
return;
if (d->group || d->disableUserControl) {
- qWarning("QDeclarativeAbstractAnimation: setPaused() cannot be used on non-root animation nodes");
+ qmlInfo(this) << "setPaused() cannot be used on non-root animation nodes.";
return;
}
@@ -781,8 +781,8 @@ void QDeclarativeScriptActionPrivate::execute()
if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty())
expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
expr.value();
- if (expr.hasError())
- qWarning() << expr.error();
+ if (expr.hasError())
+ qmlInfo(q) << expr.error();
}
}
@@ -1316,7 +1316,7 @@ void QDeclarativeRotationAnimation::setTo(qreal t)
}
/*!
- \qmlproperty enum RotationAnimation::direction
+ \qmlproperty enumeration RotationAnimation::direction
The direction in which to rotate.
Possible values are Numerical, Clockwise, Counterclockwise,
or Shortest.
@@ -1741,14 +1741,15 @@ void QDeclarativePropertyAnimation::setTo(const QVariant &t)
}
/*!
- \qmlproperty enum PropertyAnimation::easing.type
+ \qmlproperty enumeration PropertyAnimation::easing.type
\qmlproperty real PropertyAnimation::easing.amplitude
\qmlproperty real PropertyAnimation::easing.overshoot
\qmlproperty real PropertyAnimation::easing.period
\brief the easing curve used for the animation.
To specify an easing curve you need to specify at least the type. For some curves you can also specify
- amplitude, period and/or overshoot (more details provided after the table).
+ amplitude, period and/or overshoot (more details provided after the table). The default easing curve is
+ Linear.
\qml
PropertyAnimation { properties: "y"; easing.type: "InOutElastic"; easing.amplitude: 2.0; easing.period: 1.5 }
diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp
index b577b81..4115193 100644
--- a/src/declarative/util/qdeclarativefontloader.cpp
+++ b/src/declarative/util/qdeclarativefontloader.cpp
@@ -53,6 +53,7 @@
#include <QFontDatabase>
#include <private/qobject_p.h>
+#include <qdeclarativeinfo.h>
QT_BEGIN_NAMESPACE
@@ -136,7 +137,7 @@ void QDeclarativeFontLoader::setSource(const QUrl &url)
d->status = QDeclarativeFontLoader::Ready;
} else {
d->status = QDeclarativeFontLoader::Error;
- qWarning() << "Cannot load font:" << url;
+ qmlInfo(this) << "Cannot load font: \"" << url.toString() << "\"";
}
emit statusChanged();
} else
@@ -181,7 +182,7 @@ void QDeclarativeFontLoader::setName(const QString &name)
}
/*!
- \qmlproperty enum FontLoader::status
+ \qmlproperty enumeration FontLoader::status
This property holds the status of font loading. It can be one of:
\list
@@ -231,7 +232,7 @@ void QDeclarativeFontLoader::replyFinished()
d->addFontToDatabase(ba);
} else {
d->status = Error;
- qWarning() << "Cannot load font:" << d->reply->url();
+ qmlInfo(this) << "Cannot load font: \"" << d->reply->url().toString() << "\"";
emit statusChanged();
}
d->reply->deleteLater();
@@ -250,7 +251,7 @@ void QDeclarativeFontLoaderPrivate::addFontToDatabase(const QByteArray &ba)
status = QDeclarativeFontLoader::Ready;
} else {
status = QDeclarativeFontLoader::Error;
- qWarning() << "Cannot load font:" << url;
+ qmlInfo(q) << "Cannot load font: \"" << url.toString() << "\"";
}
emit q->statusChanged();
}
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 2616ccf..6e980d0 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -1187,10 +1187,9 @@ QScriptValue NestedListModel::get(int index) const
if (!node)
return 0;
QDeclarativeEngine *eng = qmlEngine(m_listModel);
- if (!eng) {
- qWarning("Cannot call QDeclarativeListModel::get() without a QDeclarativeEngine");
+ if (!eng)
return 0;
- }
+
return QDeclarativeEnginePrivate::qmlScriptObject(node->object(this), eng);
}
diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp
index d91b107..534c923 100644
--- a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp
+++ b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp
@@ -202,10 +202,9 @@ bool QDeclarativeListModelWorkerAgent::event(QEvent *e)
FlatListModel *orig = m_orig->m_flat;
FlatListModel *copy = s->list->m_flat;
- if (!orig || !copy) {
- qWarning("QML ListModel worker: sync() failed");
+ if (!orig || !copy)
return QObject::event(e);
- }
+
orig->m_roles = copy->m_roles;
orig->m_strings = copy->m_strings;
orig->m_values = copy->m_values;
diff --git a/src/declarative/util/qdeclarativepropertymap.cpp b/src/declarative/util/qdeclarativepropertymap.cpp
index 0e477b1..c8161a7 100644
--- a/src/declarative/util/qdeclarativepropertymap.cpp
+++ b/src/declarative/util/qdeclarativepropertymap.cpp
@@ -98,7 +98,7 @@ void QDeclarativePropertyMapMetaObject::propertyCreated(int, QMetaPropertyBuilde
/*!
\class QDeclarativePropertyMap
\since 4.7
- \brief The QDeclarativePropertyMap class allows you to set key-value pairs that can be used in bindings.
+ \brief The QDeclarativePropertyMap class allows you to set key-value pairs that can be used in QML bindings.
QDeclarativePropertyMap provides a convenient way to expose domain data to the UI layer.
The following example shows how you might declare data in C++ and then
@@ -112,7 +112,7 @@ void QDeclarativePropertyMapMetaObject::propertyCreated(int, QMetaPropertyBuilde
ownerData.insert("phone", QVariant(QString("555-5555")));
//expose it to the UI layer
- QDeclarativeContext *ctxt = view->bindContext();
+ QDeclarativeContext *ctxt = view->rootContext();
ctxt->setProperty("owner", &data);
\endcode
diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp
index 48a7583..19a00ee 100644
--- a/src/declarative/util/qdeclarativesmoothedanimation.cpp
+++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp
@@ -438,7 +438,7 @@ qreal QDeclarativeSmoothedAnimation::velocity() const
}
/*!
- \qmlproperty qreal SmoothedAnimation::velocity
+ \qmlproperty real SmoothedAnimation::velocity
This property holds the average velocity allowed when tracking the 'to' value.
@@ -457,7 +457,7 @@ void QDeclarativeSmoothedAnimation::setVelocity(qreal v)
}
/*!
- \qmlproperty qreal SmoothedAnimation::maximumEasingTime
+ \qmlproperty int SmoothedAnimation::maximumEasingTime
This property specifies the maximum time, in msecs, an "eases" during the follow should take.
Setting this property causes the velocity to "level out" after at a time. Setting
diff --git a/src/declarative/util/qdeclarativesmoothedfollow.cpp b/src/declarative/util/qdeclarativesmoothedfollow.cpp
index 9f155fc..3ed9257 100644
--- a/src/declarative/util/qdeclarativesmoothedfollow.cpp
+++ b/src/declarative/util/qdeclarativesmoothedfollow.cpp
@@ -195,7 +195,7 @@ qreal QDeclarativeSmoothedFollow::velocity() const
}
/*!
- \qmlproperty qreal SmoothedFollow::velocity
+ \qmlproperty real SmoothedFollow::velocity
This property holds the average velocity allowed when tracking the 'to' value.
@@ -214,7 +214,7 @@ void QDeclarativeSmoothedFollow::setVelocity(qreal v)
}
/*!
- \qmlproperty qreal SmoothedFollow::maximumEasingTime
+ \qmlproperty int SmoothedFollow::maximumEasingTime
This property specifies the maximum time, in msecs, an "eases" during the follow should take.
Setting this property causes the velocity to "level out" after at a time. Setting
diff --git a/src/declarative/util/qdeclarativespringfollow.cpp b/src/declarative/util/qdeclarativespringfollow.cpp
index 7921735..70077f3 100644
--- a/src/declarative/util/qdeclarativespringfollow.cpp
+++ b/src/declarative/util/qdeclarativespringfollow.cpp
@@ -267,7 +267,7 @@ qreal QDeclarativeSpringFollow::to() const
}
/*!
- \qmlproperty qreal SpringFollow::to
+ \qmlproperty real SpringFollow::to
This property holds the target value which will be tracked.
Bind to a property in order to track its changes.
@@ -284,7 +284,7 @@ void QDeclarativeSpringFollow::setTo(qreal value)
}
/*!
- \qmlproperty qreal SpringFollow::velocity
+ \qmlproperty real SpringFollow::velocity
This property holds the maximum velocity allowed when tracking the source.
*/
@@ -303,7 +303,7 @@ void QDeclarativeSpringFollow::setVelocity(qreal velocity)
}
/*!
- \qmlproperty qreal SpringFollow::spring
+ \qmlproperty real SpringFollow::spring
This property holds the spring constant
The spring constant describes how strongly the target is pulled towards the
@@ -326,7 +326,7 @@ void QDeclarativeSpringFollow::setSpring(qreal spring)
}
/*!
- \qmlproperty qreal SpringFollow::damping
+ \qmlproperty real SpringFollow::damping
This property holds the spring damping constant
The damping constant describes how quickly a sprung follower comes to rest.
@@ -349,7 +349,7 @@ void QDeclarativeSpringFollow::setDamping(qreal damping)
/*!
- \qmlproperty qreal SpringFollow::epsilon
+ \qmlproperty real SpringFollow::epsilon
This property holds the spring epsilon
The epsilon is the rate and amount of change in the value which is close enough
@@ -371,7 +371,7 @@ void QDeclarativeSpringFollow::setEpsilon(qreal epsilon)
}
/*!
- \qmlproperty qreal SpringFollow::modulus
+ \qmlproperty real SpringFollow::modulus
This property holds the modulus value.
Setting a \a modulus forces the target value to "wrap around" at the modulus.
@@ -394,7 +394,7 @@ void QDeclarativeSpringFollow::setModulus(qreal modulus)
}
/*!
- \qmlproperty qreal SpringFollow::mass
+ \qmlproperty real SpringFollow::mass
This property holds the "mass" of the property being moved.
mass is 1.0 by default. Setting a different mass changes the dynamics of
@@ -452,7 +452,7 @@ bool QDeclarativeSpringFollow::inSync() const
}
/*!
- \qmlproperty qreal SpringFollow::value
+ \qmlproperty real SpringFollow::value
The current value.
*/
qreal QDeclarativeSpringFollow::value() const
diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp
index ff78c60..81f4230 100644
--- a/src/declarative/util/qdeclarativestategroup.cpp
+++ b/src/declarative/util/qdeclarativestategroup.cpp
@@ -50,6 +50,7 @@
#include <QtCore/qdebug.h>
#include <private/qobject_p.h>
+#include <qdeclarativeinfo.h>
QT_BEGIN_NAMESPACE
@@ -381,7 +382,7 @@ void QDeclarativeStateGroupPrivate::setCurrentStateInternal(const QString &state
}
if (applyingState) {
- qWarning() << "Can't apply a state change as part of a state definition.";
+ qmlInfo(q) << "Can't apply a state change as part of a state definition.";
return;
}
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 3854b10..eb6ac7b 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -577,7 +577,7 @@ void QDeclarativeStateChangeScript::execute()
expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber);
expr.value();
if (expr.hasError())
- qWarning() << expr.error();
+ qmlInfo(this, expr.error());
}
}
diff --git a/src/declarative/util/qdeclarativetimer_p.h b/src/declarative/util/qdeclarativetimer_p.h
index d1e6630..08c3d4e 100644
--- a/src/declarative/util/qdeclarativetimer_p.h
+++ b/src/declarative/util/qdeclarativetimer_p.h
@@ -63,6 +63,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTimer : public QObject, public QDeclarati
Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
Q_PROPERTY(bool repeat READ isRepeating WRITE setRepeating NOTIFY repeatChanged)
Q_PROPERTY(bool triggeredOnStart READ triggeredOnStart WRITE setTriggeredOnStart NOTIFY triggeredOnStartChanged)
+ Q_PROPERTY(QObject *parent READ parent CONSTANT)
public:
QDeclarativeTimer(QObject *parent=0);
diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp
index c0425ef..5cfa0e8 100644
--- a/src/declarative/util/qdeclarativeview.cpp
+++ b/src/declarative/util/qdeclarativeview.cpp
@@ -59,10 +59,14 @@
#include <qfontdatabase.h>
#include <qicon.h>
#include <qurl.h>
-#include <qboxlayout.h>
+#include <qlayout.h>
+#include <qwidget.h>
+#include <qgraphicswidget.h>
#include <qbasictimer.h>
#include <QtCore/qabstractanimation.h>
#include <private/qgraphicsview_p.h>
+#include <private/qdeclarativeitem_p.h>
+#include <private/qdeclarativeitemchangelistener_p.h>
QT_BEGIN_NAMESPACE
@@ -124,19 +128,23 @@ void FrameBreakAnimation::updateCurrentTime(int msecs)
server->frameBreak();
}
-class QDeclarativeViewPrivate
+class QDeclarativeViewPrivate : public QDeclarativeItemChangeListener
{
public:
QDeclarativeViewPrivate(QDeclarativeView *view)
- : q(view), root(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject) {}
+ : q(view), root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject) {}
~QDeclarativeViewPrivate() { delete root; }
-
void execute();
+ void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
+ void initResize();
+ void updateSize();
+ inline QSize rootObjectSize();
QDeclarativeView *q;
QDeclarativeGuard<QGraphicsObject> root;
- QDeclarativeGuard<QDeclarativeItem> qmlRoot;
+ QDeclarativeGuard<QDeclarativeItem> declarativeItemRoot;
+ QDeclarativeGuard<QGraphicsWidget> graphicsWidgetRoot;
QUrl source;
@@ -144,7 +152,6 @@ public:
QDeclarativeComponent *component;
QBasicTimer resizetimer;
- mutable QSize initialSize;
QDeclarativeView::ResizeMode resizeMode;
QTime frameTimer;
@@ -155,18 +162,32 @@ public:
void QDeclarativeViewPrivate::execute()
{
- delete root;
- delete component;
- initialSize = QSize();
- component = new QDeclarativeComponent(&engine, source, q);
-
- if (!component->isLoading()) {
- q->continueExecute();
- } else {
- QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), q, SLOT(continueExecute()));
+ if (root) {
+ delete root;
+ root = 0;
+ }
+ if (component) {
+ delete component;
+ component = 0;
+ }
+ if (!source.isEmpty()) {
+ component = new QDeclarativeComponent(&engine, source, q);
+ if (!component->isLoading()) {
+ q->continueExecute();
+ } else {
+ QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), q, SLOT(continueExecute()));
+ }
}
}
+void QDeclarativeViewPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem, const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ if (resizeItem == root && resizeMode == QDeclarativeView::SizeViewToRootObject) {
+ // wait for both width and height to be changed
+ resizetimer.start(0,q);
+ }
+ QDeclarativeItemChangeListener::itemGeometryChanged(resizeItem, newGeometry, oldGeometry);
+}
/*!
\class QDeclarativeView
@@ -332,21 +353,20 @@ QDeclarativeContext* QDeclarativeView::rootContext()
/*!
\enum QDeclarativeView::Status
-
Specifies the loading status of the QDeclarativeView.
\value Null This QDeclarativeView has no source set.
\value Ready This QDeclarativeView has loaded and created the QML component.
\value Loading This QDeclarativeView is loading network data.
- \value Error An error has occured. Calling errorDescription() to retrieve a description.
+ \value Error An error has occured. Call errorDescription() to retrieve a description.
*/
/*! \enum QDeclarativeView::ResizeMode
This enum specifies how to resize the view.
- \value SizeViewToRootObject
- \value SizeRootObjectToView
+ \value SizeViewToRootObject The view resizes with the root item in the QML.
+ \value SizeRootObjectToView The view will automatically resize the root item to the size of the view.
*/
/*!
@@ -373,7 +393,6 @@ QList<QDeclarativeError> QDeclarativeView::errors() const
return QList<QDeclarativeError>();
}
-
/*!
\property QDeclarativeView::resizeMode
\brief whether the view should resize the canvas contents
@@ -394,16 +413,92 @@ void QDeclarativeView::setResizeMode(ResizeMode mode)
if (d->resizeMode == mode)
return;
+ if (d->declarativeItemRoot) {
+ if (d->resizeMode == SizeViewToRootObject) {
+ QDeclarativeItemPrivate *p =
+ static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(d->declarativeItemRoot));
+ p->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry);
+ }
+ } else if (d->graphicsWidgetRoot) {
+ if (d->resizeMode == QDeclarativeView::SizeViewToRootObject) {
+ d->graphicsWidgetRoot->removeEventFilter(this);
+ }
+ }
+
d->resizeMode = mode;
- if (d->qmlRoot) {
- if (d->resizeMode == SizeRootObjectToView) {
- d->qmlRoot->setWidth(width());
- d->qmlRoot->setHeight(height());
- } else {
- d->qmlRoot->setWidth(d->initialSize.width());
- d->qmlRoot->setHeight(d->initialSize.height());
+ if (d->root) {
+ d->initResize();
+ }
+}
+
+void QDeclarativeViewPrivate::initResize()
+{
+ if (declarativeItemRoot) {
+ if (resizeMode == QDeclarativeView::SizeViewToRootObject) {
+ QDeclarativeItemPrivate *p =
+ static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(declarativeItemRoot));
+ p->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
+ }
+ } else if (graphicsWidgetRoot) {
+ if (resizeMode == QDeclarativeView::SizeViewToRootObject) {
+ graphicsWidgetRoot->installEventFilter(q);
+ }
+ }
+ updateSize();
+}
+
+void QDeclarativeViewPrivate::updateSize()
+{
+ if (!root)
+ return;
+ if (declarativeItemRoot) {
+ if (resizeMode == QDeclarativeView::SizeViewToRootObject) {
+ QSize newSize = QSize(declarativeItemRoot->width(), declarativeItemRoot->height());
+ if (newSize.isValid() && newSize != q->size()) {
+ q->resize(newSize);
+ }
+ } else if (resizeMode == QDeclarativeView::SizeRootObjectToView) {
+ if (!qFuzzyCompare(q->width(), declarativeItemRoot->width()))
+ declarativeItemRoot->setWidth(q->width());
+ if (!qFuzzyCompare(q->height(), declarativeItemRoot->height()))
+ declarativeItemRoot->setHeight(q->height());
}
+ } else if (graphicsWidgetRoot) {
+ if (resizeMode == QDeclarativeView::SizeViewToRootObject) {
+ QSize newSize = QSize(graphicsWidgetRoot->size().width(), graphicsWidgetRoot->size().height());
+ if (newSize.isValid() && newSize != q->size()) {
+ q->resize(newSize);
+ }
+ } else if (resizeMode == QDeclarativeView::SizeRootObjectToView) {
+ QSizeF newSize = QSize(q->size().width(), q->size().height());
+ if (newSize.isValid() && newSize != graphicsWidgetRoot->size()) {
+ graphicsWidgetRoot->resize(newSize);
+ }
+ }
+ }
+ q->updateGeometry();
+}
+
+QSize QDeclarativeViewPrivate::rootObjectSize()
+{
+ QSize rootObjectSize(0,0);
+ int widthCandidate = -1;
+ int heightCandidate = -1;
+ if (declarativeItemRoot) {
+ widthCandidate = declarativeItemRoot->width();
+ heightCandidate = declarativeItemRoot->height();
+ } else if (root) {
+ QSizeF size = root->boundingRect().size();
+ widthCandidate = size.width();
+ heightCandidate = size.height();
+ }
+ if (widthCandidate > 0) {
+ rootObjectSize.setWidth(widthCandidate);
}
+ if (heightCandidate > 0) {
+ rootObjectSize.setHeight(heightCandidate);
+ }
+ return rootObjectSize;
}
QDeclarativeView::ResizeMode QDeclarativeView::resizeMode() const
@@ -449,55 +544,46 @@ void QDeclarativeView::continueExecute()
*/
void QDeclarativeView::setRootObject(QObject *obj)
{
- if (QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(obj)) {
- d->scene.addItem(item);
-
- d->root = item;
- d->qmlRoot = item;
- connect(item, SIGNAL(widthChanged()), this, SLOT(sizeChanged()));
- connect(item, SIGNAL(heightChanged()), this, SLOT(sizeChanged()));
- if (d->initialSize.height() <= 0 && d->qmlRoot->width() > 0)
- d->initialSize.setWidth(d->qmlRoot->width());
- if (d->initialSize.height() <= 0 && d->qmlRoot->height() > 0)
- d->initialSize.setHeight(d->qmlRoot->height());
- resize(d->initialSize);
-
- if (d->resizeMode == SizeRootObjectToView) {
- d->qmlRoot->setWidth(width());
- d->qmlRoot->setHeight(height());
+ if (d->root == obj)
+ return;
+ if (QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem *>(obj)) {
+ d->scene.addItem(declarativeItem);
+ d->root = declarativeItem;
+ d->declarativeItemRoot = declarativeItem;
+ } else if (QGraphicsObject *graphicsObject = qobject_cast<QGraphicsObject *>(obj)) {
+ d->scene.addItem(graphicsObject);
+ d->root = graphicsObject;
+ if (graphicsObject->isWidget()) {
+ d->graphicsWidgetRoot = static_cast<QGraphicsWidget*>(graphicsObject);
} else {
- QSize sz(d->qmlRoot->width(),d->qmlRoot->height());
- emit sceneResized(sz);
- resize(sz);
+ qWarning() << "QDeclarativeView::resizeMode is not honored for components of type QGraphicsObject";
}
- updateGeometry();
- } else if (QGraphicsObject *item = qobject_cast<QGraphicsObject *>(obj)) {
- d->scene.addItem(item);
- qWarning() << "QDeclarativeView::resizeMode is not honored for components of type QGraphicsObject";
- } else if (QWidget *wid = qobject_cast<QWidget *>(obj)) {
- window()->setAttribute(Qt::WA_OpaquePaintEvent, false);
- window()->setAttribute(Qt::WA_NoSystemBackground, false);
- if (!layout()) {
- setLayout(new QVBoxLayout);
- layout()->setContentsMargins(0, 0, 0, 0);
- } else if (layout()->count()) {
- // Hide the QGraphicsView in GV mode.
- QLayoutItem *item = layout()->itemAt(0);
- if (item->widget())
- item->widget()->hide();
+ } else if (obj) {
+ qWarning() << "QDeclarativeView only supports loading of root objects that derive from QGraphicsObject";
+ if (QWidget* widget = qobject_cast<QWidget *>(obj)) {
+ window()->setAttribute(Qt::WA_OpaquePaintEvent, false);
+ window()->setAttribute(Qt::WA_NoSystemBackground, false);
+ if (layout() && layout()->count()) {
+ // Hide the QGraphicsView in GV mode.
+ QLayoutItem *item = layout()->itemAt(0);
+ if (item->widget())
+ item->widget()->hide();
+ }
+ widget->setParent(this);
+ if (isVisible()) {
+ widget->setVisible(true);
+ }
+ resize(widget->size());
}
- layout()->addWidget(wid);
- emit sceneResized(wid->size());
}
-}
-/*!
- \internal
- */
-void QDeclarativeView::sizeChanged()
-{
- // delay, so we catch both width and height changing.
- d->resizetimer.start(0,this);
+ if (d->root) {
+ QSize initialSize = d->rootObjectSize();
+ if (initialSize != size()) {
+ resize(initialSize);
+ }
+ d->initResize();
+ }
}
/*!
@@ -508,30 +594,36 @@ void QDeclarativeView::sizeChanged()
void QDeclarativeView::timerEvent(QTimerEvent* e)
{
if (!e || e->timerId() == d->resizetimer.timerId()) {
- if (d->qmlRoot) {
- QSize sz(d->qmlRoot->width(),d->qmlRoot->height());
- emit sceneResized(sz);
- //if (!d->resizable)
- //resize(sz);
- }
+ d->updateSize();
d->resizetimer.stop();
- updateGeometry();
}
}
+bool QDeclarativeView::eventFilter(QObject *watched, QEvent *e)
+{
+ if (watched == d->root && d->resizeMode == SizeViewToRootObject) {
+ if (d->graphicsWidgetRoot) {
+ if (e->type() == QEvent::GraphicsSceneResize) {
+ d->updateSize();
+ }
+ }
+ }
+ return QGraphicsView::eventFilter(watched, e);
+}
+
/*!
\internal
- The size hint is the size of the root item.
+ Preferred size follows the root object in
+ resize mode SizeViewToRootObject and
+ the view in resize mode SizeRootObjectToView.
*/
QSize QDeclarativeView::sizeHint() const
{
- if (d->qmlRoot) {
- if (d->initialSize.width() <= 0)
- d->initialSize.setWidth(d->qmlRoot->width());
- if (d->initialSize.height() <= 0)
- d->initialSize.setHeight(d->qmlRoot->height());
+ if (d->resizeMode == SizeRootObjectToView) {
+ return size();
+ } else { // d->resizeMode == SizeViewToRootObject
+ return d->rootObjectSize();
}
- return d->initialSize;
}
/*!
@@ -549,17 +641,17 @@ QGraphicsObject *QDeclarativeView::rootObject() const
*/
void QDeclarativeView::resizeEvent(QResizeEvent *e)
{
- if (d->resizeMode == SizeRootObjectToView && d->qmlRoot) {
- d->qmlRoot->setWidth(width());
- d->qmlRoot->setHeight(height());
+ if (d->resizeMode == SizeRootObjectToView) {
+ d->updateSize();
}
- if (d->qmlRoot) {
- setSceneRect(QRectF(0, 0, d->qmlRoot->width(), d->qmlRoot->height()));
+ if (d->declarativeItemRoot) {
+ setSceneRect(QRectF(0, 0, d->declarativeItemRoot->width(), d->declarativeItemRoot->height()));
} else if (d->root) {
setSceneRect(d->root->boundingRect());
} else {
setSceneRect(rect());
}
+ emit sceneResized(e->size());
QGraphicsView::resizeEvent(e);
}
diff --git a/src/declarative/util/qdeclarativeview.h b/src/declarative/util/qdeclarativeview.h
index 107f3f9..1807758 100644
--- a/src/declarative/util/qdeclarativeview.h
+++ b/src/declarative/util/qdeclarativeview.h
@@ -97,13 +97,13 @@ Q_SIGNALS:
private Q_SLOTS:
void continueExecute();
- void sizeChanged();
protected:
virtual void resizeEvent(QResizeEvent *);
virtual void paintEvent(QPaintEvent *event);
virtual void timerEvent(QTimerEvent*);
virtual void setRootObject(QObject *obj);
+ virtual bool eventFilter(QObject *watched, QEvent *e);
friend class QDeclarativeViewPrivate;
QDeclarativeViewPrivate *d;
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index 7f8b962..55e768e 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -667,7 +667,7 @@ void QDeclarativeXmlListModel::setNamespaceDeclarations(const QString &declarati
}
/*!
- \qmlproperty enum XmlListModel::status
+ \qmlproperty enumeration XmlListModel::status
Specifies the model loading status, which can be one of the following:
\list
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 9759b39..e290c7e 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1237,6 +1237,8 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q
}
dirtySceneTransform = 1;
+ if (!inDestructor && (transformData || (newParent && newParent->d_ptr->transformData)))
+ transformChanged();
// Restore the sub focus chain.
if (subFocusItem) {
@@ -3622,6 +3624,7 @@ void QGraphicsItemPrivate::setTransformHelper(const QTransform &transform)
q_ptr->prepareGeometryChange();
transformData->transform = transform;
dirtySceneTransform = 1;
+ transformChanged();
}
/*!
@@ -3812,6 +3815,8 @@ void QGraphicsItem::setRotation(qreal angle)
if (d_ptr->isObject)
emit static_cast<QGraphicsObject *>(this)->rotationChanged();
+
+ d_ptr->transformChanged();
}
/*!
@@ -3876,6 +3881,8 @@ void QGraphicsItem::setScale(qreal factor)
if (d_ptr->isObject)
emit static_cast<QGraphicsObject *>(this)->scaleChanged();
+
+ d_ptr->transformChanged();
}
@@ -3931,6 +3938,7 @@ void QGraphicsItem::setTransformations(const QList<QGraphicsTransform *> &transf
transformations.at(i)->d_func()->setItem(this);
d_ptr->transformData->onlyTransform = false;
d_ptr->dirtySceneTransform = 1;
+ d_ptr->transformChanged();
}
/*!
@@ -3947,6 +3955,7 @@ void QGraphicsItemPrivate::prependGraphicsTransform(QGraphicsTransform *t)
t->d_func()->setItem(q);
transformData->onlyTransform = false;
dirtySceneTransform = 1;
+ transformChanged();
}
/*!
@@ -3963,6 +3972,7 @@ void QGraphicsItemPrivate::appendGraphicsTransform(QGraphicsTransform *t)
t->d_func()->setItem(q);
transformData->onlyTransform = false;
dirtySceneTransform = 1;
+ transformChanged();
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index f922842..8c7fbb4 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -284,6 +284,7 @@ public:
void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true);
bool discardUpdateRequest(bool ignoreVisibleBit = false,
bool ignoreDirtyBit = false, bool ignoreOpacity = false) const;
+ virtual void transformChanged() {}
int depth() const;
#ifndef QT_NO_GRAPHICSEFFECT
enum InvalidateReason {
diff --git a/src/imports/gestures/gestures.pro b/src/imports/gestures/gestures.pro
index b9c5b4e..f55c00e 100644
--- a/src/imports/gestures/gestures.pro
+++ b/src/imports/gestures/gestures.pro
@@ -17,8 +17,7 @@ symbian:{
load(data_caging_paths)
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
- importFiles.sources = gesturesqmlplugin.dll \
- qmldir
+ importFiles.sources = gesturesqmlplugin.dll qmldir
importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
DEPLOYMENT = importFiles
diff --git a/src/imports/multimedia/multimedia.pro b/src/imports/multimedia/multimedia.pro
index 92f7ec4..c366e54 100644
--- a/src/imports/multimedia/multimedia.pro
+++ b/src/imports/multimedia/multimedia.pro
@@ -27,8 +27,7 @@ symbian:{
load(data_caging_paths)
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
- importFiles.sources = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH/multimedia.dll \
- qmldir
+ importFiles.sources = multimedia.dll qmldir
importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
DEPLOYMENT = importFiles
diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp
index 82d5d89..849c51d 100644
--- a/src/imports/multimedia/qdeclarativeaudio.cpp
+++ b/src/imports/multimedia/qdeclarativeaudio.cpp
@@ -195,7 +195,7 @@ void QDeclarativeAudio::stop()
*/
/*!
- \qmlproperty enum Audio::status
+ \qmlproperty enumeration Audio::status
This property holds the status of media loading. It can be one of:
@@ -263,7 +263,7 @@ QDeclarativeAudio::Status QDeclarativeAudio::status() const
*/
/*!
- \qmlproperty qreal Audio::volume
+ \qmlproperty real Audio::volume
This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume).
*/
@@ -275,7 +275,7 @@ QDeclarativeAudio::Status QDeclarativeAudio::status() const
*/
/*!
- \qmlproperty qreal Audio::bufferProgress
+ \qmlproperty real Audio::bufferProgress
This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0
(full).
@@ -290,13 +290,13 @@ QDeclarativeAudio::Status QDeclarativeAudio::status() const
*/
/*!
- \qmlproperty qreal Audio::playbackRate
+ \qmlproperty real Audio::playbackRate
This property holds the rate at which audio is played at as a multiple of the normal rate.
*/
/*!
- \qmlproperty enum Audio::error
+ \qmlproperty enumeration Audio::error
This property holds the error state of the audio. It can be one of:
diff --git a/src/imports/multimedia/qdeclarativevideo.cpp b/src/imports/multimedia/qdeclarativevideo.cpp
index c6ae272..d84d304 100644
--- a/src/imports/multimedia/qdeclarativevideo.cpp
+++ b/src/imports/multimedia/qdeclarativevideo.cpp
@@ -82,11 +82,11 @@ void QDeclarativeVideo::_q_error(int errorCode, const QString &errorString)
Video { source: "video/movie.mpg" }
\endqml
- The video item supports untransformed, stretched, and uniformly scaled video presentation.
+ The Video item supports untransformed, stretched, and uniformly scaled video presentation.
For a description of stretched uniformly scaled presentation, see the \l fillMode property
description.
- The video item is only visible when the \l hasVideo property is true and the video is playing.
+ The Video item is only visible when the \l hasVideo property is true and the video is playing.
\sa Audio
*/
@@ -169,7 +169,7 @@ QDeclarativeVideo::~QDeclarativeVideo()
*/
/*!
- \qmlproperty enum Video::status
+ \qmlproperty enumeration Video::status
This property holds the status of media loading. It can be one of:
@@ -236,7 +236,7 @@ QDeclarativeVideo::Status QDeclarativeVideo::status() const
*/
/*!
- \qmlproperty qreal Video::volume
+ \qmlproperty real Video::volume
This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume).
*/
@@ -270,7 +270,7 @@ bool QDeclarativeVideo::hasVideo() const
}
/*!
- \qmlproperty qreal Video::bufferProgress
+ \qmlproperty real Video::bufferProgress
This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0
(full).
@@ -283,13 +283,13 @@ bool QDeclarativeVideo::hasVideo() const
*/
/*!
- \qmlproperty qreal Video::playbackRate
+ \qmlproperty real Video::playbackRate
This property holds the rate at which video is played at as a multiple of the normal rate.
*/
/*!
- \qmlproperty enum Video::error
+ \qmlproperty enumeration Video::error
This property holds the error state of the video. It can be one of:
@@ -325,7 +325,7 @@ QDeclarativeVideo::Error QDeclarativeVideo::error() const
*/
/*!
- \qmlproperty enum Video::fillMode
+ \qmlproperty enumeration Video::fillMode
Set this property to define how the video is scaled to fit the target area.
diff --git a/src/imports/particles/particles.pro b/src/imports/particles/particles.pro
index 58bfe05..79ac543 100644
--- a/src/imports/particles/particles.pro
+++ b/src/imports/particles/particles.pro
@@ -21,8 +21,7 @@ symbian:{
load(data_caging_paths)
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
- importFiles.sources = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH/particles.dll \
- qmldir
+ importFiles.sources = particles.dll qmldir
importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
DEPLOYMENT = importFiles
diff --git a/src/imports/particles/qdeclarativeparticles.cpp b/src/imports/particles/qdeclarativeparticles.cpp
index 264cba2..ecc6604 100644
--- a/src/imports/particles/qdeclarativeparticles.cpp
+++ b/src/imports/particles/qdeclarativeparticles.cpp
@@ -189,13 +189,13 @@ void QDeclarativeParticleMotionLinear::advance(QDeclarativeParticle &p, int inte
*/
/*!
- \qmlproperty qreal ParticleMotionGravity::xattractor
- \qmlproperty qreal ParticleMotionGravity::yattractor
+ \qmlproperty real ParticleMotionGravity::xattractor
+ \qmlproperty real ParticleMotionGravity::yattractor
These properties hold the x and y coordinates of the point attracting the particles.
*/
/*!
- \qmlproperty qreal ParticleMotionGravity::acceleration
+ \qmlproperty real ParticleMotionGravity::acceleration
This property holds the acceleration to apply to the particles.
*/
@@ -303,14 +303,14 @@ Rectangle {
*/
/*!
- \qmlproperty qreal QDeclarativeParticleMotionWander::xvariance
- \qmlproperty qreal QDeclarativeParticleMotionWander::yvariance
+ \qmlproperty real QDeclarativeParticleMotionWander::xvariance
+ \qmlproperty real QDeclarativeParticleMotionWander::yvariance
These properties set the amount to wander in the x and y directions.
*/
/*!
- \qmlproperty qreal QDeclarativeParticleMotionWander::pace
+ \qmlproperty real QDeclarativeParticleMotionWander::pace
This property holds how quickly the paricles will move from side to side.
*/
@@ -859,7 +859,7 @@ void QDeclarativeParticles::setEmissionRate(int er)
}
/*!
- \qmlproperty qreal Particles::emissionVariance
+ \qmlproperty real Particles::emissionVariance
This property holds how inconsistent the rate of particle emissions are.
It is a number between 0 (no variance) and 1 (some variance).
diff --git a/src/imports/webkit/webkit.pro b/src/imports/webkit/webkit.pro
index 62db9ac..77cbc4d 100644
--- a/src/imports/webkit/webkit.pro
+++ b/src/imports/webkit/webkit.pro
@@ -18,8 +18,7 @@ symbian:{
load(data_caging_paths)
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
- importFiles.sources = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH/webkitqmlplugin.dll \
- qmldir
+ importFiles.sources = webkitqmlplugin.dll qmldir
importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
DEPLOYMENT = importFiles
diff --git a/src/imports/widgets/widgets.pro b/src/imports/widgets/widgets.pro
index f26e4b9..234ff1e 100644
--- a/src/imports/widgets/widgets.pro
+++ b/src/imports/widgets/widgets.pro
@@ -21,8 +21,7 @@ symbian:{
load(data_caging_paths)
include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri)
- importFiles.sources = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH/widgets.dll \
- qmldir
+ importFiles.sources = widgets.dll qmldir
importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH
DEPLOYMENT = importFiles
diff --git a/src/multimedia/effects/qsoundeffect.cpp b/src/multimedia/effects/qsoundeffect.cpp
index d34e532..1992ee5 100644
--- a/src/multimedia/effects/qsoundeffect.cpp
+++ b/src/multimedia/effects/qsoundeffect.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlclass SoundEffect QSoundEffect
\since 4.7
- \brief The SoundEffect element provides a way to play sound effects in qml.
+ \brief The SoundEffect element provides a way to play sound effects in QML.
This element is part of the \bold{Qt.multimedia 4.7} module.
@@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlproperty QUrl SoundEffect::source
+ \qmlproperty url SoundEffect::source
This property provides a way to control the sound to play.
*/
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index dfce7d2..c3809b2 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -143,6 +143,25 @@ symbian: {
contains(QT_CONFIG, declarative): {
qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtDeclarative$${QT_LIBINFIX}.dll
+
+ widgetImport.sources = widgets.dll $$QT_BUILD_TREE/src/imports/widgets/qmldir
+ widgetImport.path = $$QT_IMPORTS_BASE_DIR/Qt/widgets
+ DEPLOYMENT += widgetImport
+
+ particlesImport.sources = particles.dll $$QT_BUILD_TREE/src/imports/particles/qmldir
+ particlesImport.path = $$QT_IMPORTS_BASE_DIR/Qt/labs/particles
+ DEPLOYMENT += particlesImport
+
+ contains(QT_CONFIG, webkit): {
+ webkitImport.sources = webkitqmlplugin.dll $$QT_BUILD_TREE/src/imports/webkit/qmldir
+ webkitImport.path = $$QT_IMPORTS_BASE_DIR/org/webkit
+ DEPLOYMENT += webkitImport
+ }
+ contains(QT_CONFIG, multimedia): {
+ multimediaImport.sources = multimedia.dll $$QT_BUILD_TREE/src/imports/multimedia/qmldir
+ multimediaImport.path = $$QT_IMPORTS_BASE_DIR/Qt/multimedia
+ DEPLOYMENT += multimediaImport
+ }
}
graphicssystems_plugins.path = c:$$QT_PLUGINS_BASE_DIR/graphicssystems
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index 7834650..58371c1 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -59,6 +59,7 @@ SUBDIRS += \
qdeclarativerepeater \ # Cover
qdeclarativeworkerscript \ # Cover
qdeclarativevaluetypes \ # Cover
+ qdeclarativeview \ # Cover
qdeclarativexmlhttprequest \ # Cover
qdeclarativeimageprovider \ # Cover
qdeclarativestyledtext \ # Cover
diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp
index 41c0a1b..f61ca9f 100644
--- a/tests/auto/declarative/parserstress/tst_parserstress.cpp
+++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp
@@ -65,7 +65,7 @@ QStringList tst_parserstress::findJSFiles(const QDir &d)
{
QStringList rv;
- QStringList files = d.entryList(QStringList() << QLatin1String("*.js"),
+ QStringList files = d.entryList(QStringList() << QLatin1String("*.js"),
QDir::Files);
foreach (const QString &file, files) {
if (file == "browser.js")
@@ -73,7 +73,7 @@ QStringList tst_parserstress::findJSFiles(const QDir &d)
rv << d.absoluteFilePath(file);
}
- QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
+ QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
QDir::NoSymLinks);
foreach (const QString &dir, dirs) {
QDir sub = d;
@@ -131,8 +131,8 @@ void tst_parserstress::ecmascript()
QDeclarativeComponent component(&engine);
component.setData(qmlData, QUrl::fromLocalFile(SRCDIR + QString("/dummy.qml")));
QSet<QString> failingTests;
- failingTests << "uc-003.js" << "uc-005.js" << "regress-352044-02-n.js"
- << "regress-334158.js" << "regress-58274.js" << "dowhile-006.js" << "dowhile-005.js";
+ failingTests << "regress-352044-02-n.js"
+ << "regress-334158.js";
QFileInfo info(file);
foreach (const QString &failing, failingTests) {
if (info.fileName().endsWith(failing)) {
diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp
index 01b5bc5..06a8f64 100644
--- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp
+++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp
@@ -262,7 +262,7 @@ void tst_qdeclarativeanchors::loops()
{
QUrl source(QUrl::fromLocalFile(SRCDIR "/data/loop1.qml"));
- QString expect = "QML Text (" + source.toString() + ":6:5" + ") Possible anchor loop detected on horizontal anchor.";
+ QString expect = source.toString() + ":6:5: QML Text: Possible anchor loop detected on horizontal anchor.";
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
@@ -277,7 +277,7 @@ void tst_qdeclarativeanchors::loops()
{
QUrl source(QUrl::fromLocalFile(SRCDIR "/data/loop2.qml"));
- QString expect = "QML Image (" + source.toString() + ":8:3" + ") Possible anchor loop detected on horizontal anchor.";
+ QString expect = source.toString() + ":8:3: QML Image: Possible anchor loop detected on horizontal anchor.";
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
QDeclarativeView *view = new QDeclarativeView;
@@ -312,55 +312,55 @@ void tst_qdeclarativeanchors::illegalSets_data()
QTest::newRow("H - too many anchors")
<< "Rectangle { id: rect; Rectangle { anchors.left: rect.left; anchors.right: rect.right; anchors.horizontalCenter: rect.horizontalCenter } }"
- << "QML Rectangle (file::2:23) Cannot specify left, right, and hcenter anchors.";
+ << "file::2:23: QML Rectangle: Cannot specify left, right, and hcenter anchors.";
foreach (const QString &side, QStringList() << "left" << "right") {
QTest::newRow("H - anchor to V")
<< QString("Rectangle { Rectangle { anchors.%1: parent.top } }").arg(side)
- << "QML Rectangle (file::2:13) Cannot anchor a horizontal edge to a vertical edge.";
+ << "file::2:13: QML Rectangle: Cannot anchor a horizontal edge to a vertical edge.";
QTest::newRow("H - anchor to non parent/sibling")
<< QString("Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.%1: rect.%1 } }").arg(side)
- << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling.";
+ << "file::2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling.";
QTest::newRow("H - anchor to self")
<< QString("Rectangle { id: rect; anchors.%1: rect.%1 }").arg(side)
- << "QML Rectangle (file::2:1) Cannot anchor item to self.";
+ << "file::2:1: QML Rectangle: Cannot anchor item to self.";
}
QTest::newRow("V - too many anchors")
<< "Rectangle { id: rect; Rectangle { anchors.top: rect.top; anchors.bottom: rect.bottom; anchors.verticalCenter: rect.verticalCenter } }"
- << "QML Rectangle (file::2:23) Cannot specify top, bottom, and vcenter anchors.";
+ << "file::2:23: QML Rectangle: Cannot specify top, bottom, and vcenter anchors.";
QTest::newRow("V - too many anchors with baseline")
<< "Rectangle { Text { id: text1; text: \"Hello\" } Text { anchors.baseline: text1.baseline; anchors.top: text1.top; } }"
- << "QML Text (file::2:47) Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors.";
+ << "file::2:47: QML Text: Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors.";
foreach (const QString &side, QStringList() << "top" << "bottom" << "baseline") {
QTest::newRow("V - anchor to H")
<< QString("Rectangle { Rectangle { anchors.%1: parent.left } }").arg(side)
- << "QML Rectangle (file::2:13) Cannot anchor a vertical edge to a horizontal edge.";
+ << "file::2:13: QML Rectangle: Cannot anchor a vertical edge to a horizontal edge.";
QTest::newRow("V - anchor to non parent/sibling")
<< QString("Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.%1: rect.%1 } }").arg(side)
- << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling.";
+ << "file::2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling.";
QTest::newRow("V - anchor to self")
<< QString("Rectangle { id: rect; anchors.%1: rect.%1 }").arg(side)
- << "QML Rectangle (file::2:1) Cannot anchor item to self.";
+ << "file::2:1: QML Rectangle: Cannot anchor item to self.";
}
QTest::newRow("centerIn - anchor to non parent/sibling")
<< "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.centerIn: rect} }"
- << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling.";
+ << "file::2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling.";
QTest::newRow("fill - anchor to non parent/sibling")
<< "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.fill: rect} }"
- << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling.";
+ << "file::2:45: QML Rectangle: Cannot anchor to an item that isn't a parent or sibling.";
}
void tst_qdeclarativeanchors::reset()
@@ -437,7 +437,7 @@ void tst_qdeclarativeanchors::nullItem()
const QMetaObject *meta = item->anchors()->metaObject();
QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData()));
- QTest::ignoreMessage(QtWarningMsg, "QML Item (unknown location) Cannot anchor to a null item.");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML Item: Cannot anchor to a null item.");
QVERIFY(p.write(item->anchors(), qVariantFromValue(anchor)));
delete item;
@@ -461,7 +461,7 @@ void tst_qdeclarativeanchors::crash1()
{
QUrl source(QUrl::fromLocalFile(SRCDIR "/data/crash1.qml"));
- QString expect = "QML Text (" + source.toString() + ":4:5" + ") Possible anchor loop detected on fill.";
+ QString expect = source.toString() + ":4:5: QML Text: Possible anchor loop detected on fill.";
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp
index 0fb080c..237a436 100644
--- a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp
+++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp
@@ -199,7 +199,7 @@ void tst_qdeclarativeanimatedimage::invalidSource()
component.setData("import Qt 4.7\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl::fromLocalFile(""));
QVERIFY(component.isReady());
- QTest::ignoreMessage(QtWarningMsg, "Error Reading Animated Image File QUrl( \"file:no-such-file.gif\" ) ");
+ QTest::ignoreMessage(QtWarningMsg, "file::2:2: QML AnimatedImage: Error Reading Animated Image File file:no-such-file.gif");
QDeclarativeAnimatedImage *anim = qobject_cast<QDeclarativeAnimatedImage *>(component.create());
QVERIFY(anim);
diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
index 959cc19..e217e34 100644
--- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
+++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
@@ -339,13 +339,13 @@ void tst_qdeclarativeanimations::badProperties()
QDeclarativeEngine engine;
QDeclarativeComponent c1(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml"));
- QByteArray message = "QML ColorAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml").toString().toUtf8() + ":18:9) Cannot animate non-existent property \"border.colr\"";
+ QByteArray message = QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml").toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate non-existent property \"border.colr\"";
QTest::ignoreMessage(QtWarningMsg, message);
QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c1.create());
QVERIFY(rect);
QDeclarativeComponent c2(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml"));
- message = "QML ColorAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml").toString().toUtf8() + ":18:9) Cannot animate read-only property \"border\"";
+ message = QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml").toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate read-only property \"border\"";
QTest::ignoreMessage(QtWarningMsg, message);
rect = qobject_cast<QDeclarativeRectangle*>(c2.create());
QVERIFY(rect);
@@ -549,12 +549,12 @@ void tst_qdeclarativeanimations::propertiesTransition()
void tst_qdeclarativeanimations::invalidDuration()
{
QDeclarativePropertyAnimation *animation = new QDeclarativePropertyAnimation;
- QTest::ignoreMessage(QtWarningMsg, "QML PropertyAnimation (unknown location) Cannot set a duration of < 0");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML PropertyAnimation: Cannot set a duration of < 0");
animation->setDuration(-1);
QCOMPARE(animation->duration(), 250);
QDeclarativePauseAnimation *pauseAnimation = new QDeclarativePauseAnimation;
- QTest::ignoreMessage(QtWarningMsg, "QML PauseAnimation (unknown location) Cannot set a duration of < 0");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML PauseAnimation: Cannot set a duration of < 0");
pauseAnimation->setDuration(-1);
QCOMPARE(pauseAnimation->duration(), 250);
}
@@ -620,7 +620,8 @@ void tst_qdeclarativeanimations::dontStart()
QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart.qml"));
- QTest::ignoreMessage(QtWarningMsg, "QDeclarativeAbstractAnimation: setRunning() cannot be used on non-root animation nodes");
+ QString warning = c.url().toString() + ":14:13: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes.";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
QVERIFY(rect);
@@ -634,7 +635,8 @@ void tst_qdeclarativeanimations::dontStart()
QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart2.qml"));
- QTest::ignoreMessage(QtWarningMsg, "QDeclarativeAbstractAnimation: setRunning() cannot be used on non-root animation nodes");
+ QString warning = c.url().toString() + ":15:17: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes.";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
QVERIFY(rect);
diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
index 3bff2f5..ee9e282 100644
--- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
+++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp
@@ -272,7 +272,8 @@ void tst_qdeclarativebehaviors::reassignedAnimation()
{
QDeclarativeEngine engine;
QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml"));
- QTest::ignoreMessage(QtWarningMsg, QString("QML Behavior (" + QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:9) Cannot change the animation assigned to a Behavior.").toUtf8().constData());
+ QString warning = QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:9: QML Behavior: Cannot change the animation assigned to a Behavior.";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
QTRY_VERIFY(rect);
QTRY_COMPARE(qobject_cast<QDeclarativeNumberAnimation*>(
@@ -303,7 +304,8 @@ void tst_qdeclarativebehaviors::dontStart()
QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart.qml"));
- QTest::ignoreMessage(QtWarningMsg, "QDeclarativeAbstractAnimation: setRunning() cannot be used on non-root animation nodes");
+ QString warning = c.url().toString() + ":13:13: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes.";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
QTRY_VERIFY(rect);
diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
index 8621239..69b4a89 100644
--- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
+++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
@@ -121,10 +121,10 @@ void tst_qdeclarativeborderimage::imageSource_data()
QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << false << "";
QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << false
- << "QML BorderImage (file::2:1) Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString();
+ << "file::2:1: QML BorderImage: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString();
QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << "";
QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true
- << "QML BorderImage (file::2:1) Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found";
+ << "file::2:1: QML BorderImage: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found";
}
void tst_qdeclarativeborderimage::imageSource()
@@ -304,8 +304,8 @@ void tst_qdeclarativeborderimage::sciSource_data()
void tst_qdeclarativeborderimage::invalidSciFile()
{
- QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Roun"
- QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Repea"
+ QTest::ignoreMessage(QtWarningMsg, "QDeclarativeGridScaledImage: Invalid tile rule specified. Using Stretch."); // for "Roun"
+ QTest::ignoreMessage(QtWarningMsg, "QDeclarativeGridScaledImage: Invalid tile rule specified. Using Stretch."); // for "Repea"
QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }";
QDeclarativeComponent component(&engine);
diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
index 133dcb8..49d430e 100644
--- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
+++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
@@ -60,6 +60,7 @@
#include <private/qdeclarativemetatype_p.h>
#include <private/qdeclarativeproperty_p.h>
+#include "../../../shared/util.h"
#include "../shared/debugutil_p.h"
Q_DECLARE_METATYPE(QDeclarativeDebugWatch::State)
@@ -69,14 +70,6 @@ class tst_QDeclarativeDebug : public QObject
{
Q_OBJECT
-public:
- tst_QDeclarativeDebug(QDeclarativeDebugTestData *data)
- {
- m_conn = data->conn;
- m_engine = data->engine;
- m_rootItem = data->items[0];
- }
-
private:
QDeclarativeDebugObjectReference findRootObject();
QDeclarativeDebugPropertyReference findProperty(const QList<QDeclarativeDebugPropertyReference> &props, const QString &name) const;
@@ -93,8 +86,11 @@ private:
QDeclarativeEngine *m_engine;
QDeclarativeItem *m_rootItem;
+ QObjectList m_components;
+
private slots:
void initTestCase();
+ void cleanupTestCase();
void watch_property();
void watch_object();
@@ -278,9 +274,50 @@ void tst_QDeclarativeDebug::compareProperties(const QDeclarativeDebugPropertyRef
void tst_QDeclarativeDebug::initTestCase()
{
+ qRegisterMetaType<QDeclarativeDebugWatch::State>();
+
+ qputenv("QML_DEBUG_SERVER_PORT", "3768");
+ m_engine = new QDeclarativeEngine(this);
+
+ QList<QByteArray> qml;
+ qml << "import Qt 4.7\n"
+ "Item {"
+ "width: 10; height: 20; scale: blueRect.scale;"
+ "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }"
+ "Text { color: blueRect.color; }"
+ "MouseArea {"
+ "onEntered: { console.log('hello') }"
+ "}"
+ "}";
+ // add second component to test multiple root contexts
+ qml << "import Qt 4.7\n"
+ "Item {}";
+
+ for (int i=0; i<qml.count(); i++) {
+ QDeclarativeComponent component(m_engine);
+ component.setData(qml[i], QUrl::fromLocalFile(""));
+ Q_ASSERT(component.isReady()); // fails if bad syntax
+ m_components << qobject_cast<QDeclarativeItem*>(component.create());
+ }
+ m_rootItem = qobject_cast<QDeclarativeItem*>(m_components.first());
+
+
+ // add an extra context to test for multiple contexts
+ QDeclarativeContext *context = new QDeclarativeContext(m_engine->rootContext(), this);
+ context->setObjectName("tst_QDeclarativeDebug_childContext");
+
+ m_conn = new QDeclarativeDebugConnection(this);
+ m_conn->connectToHost("127.0.0.1", 3768);
+ bool ok = m_conn->waitForConnected();
+ Q_ASSERT(ok);
+ QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient());
+
m_dbg = new QDeclarativeEngineDebug(m_conn, this);
+}
- qRegisterMetaType<QDeclarativeDebugWatch::State>();
+void tst_QDeclarativeDebug::cleanupTestCase()
+{
+ qDeleteAll(m_components);
}
void tst_QDeclarativeDebug::watch_property()
@@ -804,40 +841,6 @@ void tst_QDeclarativeDebug::tst_QDeclarativeDebugPropertyReference()
compareProperties(r, ref);
}
-
-class tst_QDeclarativeDebug_Factory : public QDeclarativeTestFactory
-{
-public:
- QObject *createTest(QDeclarativeDebugTestData *data)
- {
- tst_QDeclarativeDebug *test = new tst_QDeclarativeDebug(data);
- QDeclarativeContext *c = new QDeclarativeContext(data->engine->rootContext(), test);
- c->setObjectName("tst_QDeclarativeDebug_childContext");
- return test;
- }
-};
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- QList<QByteArray> qml;
- qml << "import Qt 4.7\n"
- "Item {"
- "width: 10; height: 20; scale: blueRect.scale;"
- "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }"
- "Text { color: blueRect.color; }"
- "MouseArea {"
- "onEntered: { console.log('hello') }"
- "}"
- "}";
- // add second component to test multiple root contexts
- qml << "import Qt 4.7\n"
- "Item {}";
- tst_QDeclarativeDebug_Factory factory;
- return QDeclarativeDebugTest::runTests(&factory, qml);
-}
-
-//QTEST_MAIN(tst_QDeclarativeDebug)
+QTEST_MAIN(tst_QDeclarativeDebug)
#include "tst_qdeclarativedebug.moc"
diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
index d3679a7..fb17f90 100644
--- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
+++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
@@ -52,21 +52,19 @@
#include <private/qdeclarativedebugclient_p.h>
#include <private/qdeclarativedebugservice_p.h>
+#include "../../../shared/util.h"
#include "../shared/debugutil_p.h"
class tst_QDeclarativeDebugClient : public QObject
{
Q_OBJECT
-public:
- tst_QDeclarativeDebugClient(QDeclarativeDebugTestData *data)
- {
- m_conn = data->conn;
- }
-
+private:
QDeclarativeDebugConnection *m_conn;
private slots:
+ void initTestCase();
+
void name();
void isEnabled();
void setEnabled();
@@ -74,6 +72,19 @@ private slots:
void sendMessage();
};
+void tst_QDeclarativeDebugClient::initTestCase()
+{
+ qputenv("QML_DEBUG_SERVER_PORT", "3768");
+ new QDeclarativeEngine(this);
+
+ m_conn = new QDeclarativeDebugConnection(this);
+ m_conn->connectToHost("127.0.0.1", 3768);
+ bool ok = m_conn->waitForConnected();
+ Q_ASSERT(ok);
+
+ QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient());
+}
+
void tst_QDeclarativeDebugClient::name()
{
QString name = "tst_QDeclarativeDebugClient::name()";
@@ -136,22 +147,7 @@ void tst_QDeclarativeDebugClient::sendMessage()
QCOMPARE(resp, msg);
}
-
-class tst_QDeclarativeDebugClient_Factory : public QDeclarativeTestFactory
-{
-public:
- QObject *createTest(QDeclarativeDebugTestData *data) { return new tst_QDeclarativeDebugClient(data); }
-};
-
-
-// This does not use QTEST_MAIN because the test has to be created and run
-// in a separate thread.
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- tst_QDeclarativeDebugClient_Factory factory;
- return QDeclarativeDebugTest::runTests(&factory);
-}
+QTEST_MAIN(tst_QDeclarativeDebugClient)
#include "tst_qdeclarativedebugclient.moc"
+
diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
index c8fc001..80d7f76 100644
--- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
+++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
@@ -52,21 +52,19 @@
#include <private/qdeclarativedebugclient_p.h>
#include <private/qdeclarativedebugservice_p.h>
+#include "../../../shared/util.h"
#include "../shared/debugutil_p.h"
+
class tst_QDeclarativeDebugService : public QObject
{
Q_OBJECT
-
-public:
- tst_QDeclarativeDebugService(QDeclarativeDebugTestData *data)
- {
- m_conn = data->conn;
- }
-
+private:
QDeclarativeDebugConnection *m_conn;
private slots:
+ void initTestCase();
+
void name();
void isEnabled();
void enabledChanged();
@@ -76,6 +74,19 @@ private slots:
void objectToString();
};
+void tst_QDeclarativeDebugService::initTestCase()
+{
+ qputenv("QML_DEBUG_SERVER_PORT", "3768");
+ new QDeclarativeEngine(this);
+
+ m_conn = new QDeclarativeDebugConnection(this);
+ m_conn->connectToHost("127.0.0.1", 3768);
+ bool ok = m_conn->waitForConnected();
+ Q_ASSERT(ok);
+
+ QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient());
+}
+
void tst_QDeclarativeDebugService::name()
{
QString name = "tst_QDeclarativeDebugService::name()";
@@ -170,21 +181,6 @@ void tst_QDeclarativeDebugService::objectToString()
delete obj;
}
-
-class tst_QDeclarativeDebugService_Factory : public QDeclarativeTestFactory
-{
-public:
- QObject *createTest(QDeclarativeDebugTestData *data) { return new tst_QDeclarativeDebugService(data); }
-};
-
-// This does not use QTEST_MAIN because the test has to be created and run
-// in a separate thread.
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- tst_QDeclarativeDebugService_Factory factory;
- return QDeclarativeDebugTest::runTests(&factory);
-}
+QTEST_MAIN(tst_QDeclarativeDebugService)
#include "tst_qdeclarativedebugservice.moc"
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml
index b7bec63..12ac754 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml
@@ -5,10 +5,8 @@ Item {
property int binding: myFunction();
property int binding2: myCompFunction();
- Script {
- function myCompFunction() {
- return a;
- }
+ function myCompFunction() {
+ return a;
}
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml
index 29eba42..64b83af 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml
@@ -20,6 +20,6 @@ QtObject {
myObject.deleteOnSet = 1;
test3 = myObject.value == undefined;
- // test4 = obj.value == undefined;
+ test4 = obj.value == undefined;
}
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.1.qml
deleted file mode 100644
index 2ac7b6e..0000000
--- a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.1.qml
+++ /dev/null
@@ -1,11 +0,0 @@
-import Qt 4.6
-
-QtObject {
- property int test: external_script_func();
-
- Script {
- // Single source as non-array literal
- source: "externalScript.js"
- }
-}
-
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.js b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.js
deleted file mode 100644
index 78c3a86..0000000
--- a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.js
+++ /dev/null
@@ -1,8 +0,0 @@
-function external_script_func2() {
- return a;
-}
-
-function is_a_undefined() {
- return a == undefined;
-}
-
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.qml
deleted file mode 100644
index dec657c..0000000
--- a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.qml
+++ /dev/null
@@ -1,11 +0,0 @@
-import Qt 4.6
-
-QtObject {
- property int test: external_script_func();
-
- Script {
- // Single source as array
- source: [ "externalScript.js" ]
- }
-}
-
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.3.qml
deleted file mode 100644
index d7acf38..0000000
--- a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.3.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-import Qt 4.6
-
-QtObject {
- property int test: external_script_func();
- property int test2: external_script_func2();
- property bool test3: is_a_undefined();
-
- Script {
- // Multiple script
- source: [ "externalScript.js", "externalScript.2.js" ]
- }
-}
-
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.4.qml
deleted file mode 100644
index 16211aa..0000000
--- a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.4.qml
+++ /dev/null
@@ -1,15 +0,0 @@
-import Qt 4.6
-
-QtObject {
- property int test: external_script_func();
- property bool test2: is_a_undefined();
-
- // Disconnected scripts
- Script {
- source: "externalScript.js"
- }
-
- Script {
- source: "externalScript.2.js"
- }
-}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.js b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.js
deleted file mode 100644
index 8928652..0000000
--- a/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.js
+++ /dev/null
@@ -1,6 +0,0 @@
-var a = 92;
-
-function external_script_func() {
- return a;
-}
-
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml
index 8e5aa0b..9beda6a 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml
@@ -4,10 +4,8 @@ Item {
property int a: 0
property int b: 0
- Script {
- function b() { return 11; }
- function c() { return 33; }
- }
+ function b() { return 11; }
+ function c() { return 33; }
QtObject {
id: a
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.qml
index cccd3d3..1c0be98 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scope.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.qml
@@ -7,21 +7,17 @@ Item {
property int binding: a
property string binding2: a + "Test"
property int binding3: myFunction()
- property int binding4: myNestedFunction()
+ property int binding4: nestedObject.myNestedFunction()
- Script {
- function myFunction() {
- return a;
- }
+ function myFunction() {
+ return a;
}
Item {
id: nestedObject
- Script {
- function myNestedFunction() {
- return a;
- }
+ function myNestedFunction() {
+ return a;
}
property int a: 2
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.js
deleted file mode 100644
index c00d285..0000000
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.js
+++ /dev/null
@@ -1,7 +0,0 @@
-var extVariable = 19;
-
-function extMethod()
-{
- return extVariable;
-}
-
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.qml
deleted file mode 100644
index feb6d16..0000000
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.qml
+++ /dev/null
@@ -1,17 +0,0 @@
-import Qt 4.6
-
-Item {
- Script {
- function method() {
- return 10;
- }
- }
-
- Script {
- source: "scriptAccess.js"
- }
-
- property int test1: method()
- property int test2: extMethod()
- property int test3: extVariable
-}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.js
new file mode 100644
index 0000000..54284fe
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.js
@@ -0,0 +1,4 @@
+function testFunction() {
+ test = true;
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml
index 2bdd706..d6e4207 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.1.qml
@@ -1,16 +1,10 @@
import Qt.test 1.0
import Qt 4.6
-
+import "scriptConnect.1.js" as Script
MyQmlObject {
property bool test: false
id: root
- Script {
- function testFunction() {
- test = true;
- }
- }
-
- Component.onCompleted: root.argumentSignal.connect(testFunction);
+ Component.onCompleted: root.argumentSignal.connect(Script.testFunction);
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.js
new file mode 100644
index 0000000..595c778
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.js
@@ -0,0 +1,5 @@
+function testFunction() {
+ if (this.b == 12)
+ test = true;
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml
index fa90918..7992ba5 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.2.qml
@@ -1,22 +1,16 @@
import Qt.test 1.0
import Qt 4.6
+import "scriptConnect.2.js" as Script
MyQmlObject {
property bool test: false
id: root
- Script {
- function testFunction() {
- if (this.b == 12)
- test = true;
- }
- }
-
Component.onCompleted: {
var a = new Object;
a.b = 12;
- root.argumentSignal.connect(a, testFunction);
+ root.argumentSignal.connect(a, Script.testFunction);
}
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.js
new file mode 100644
index 0000000..71bdd08
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.js
@@ -0,0 +1,3 @@
+function testFunction() {
+ test++;
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml
index 8c35db1..d546495 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptConnect.6.qml
@@ -1,20 +1,15 @@
import Qt.test 1.0
import Qt 4.6
+import "scriptConnect.6.js" as Script
MyQmlObject {
property int test: 0
id: root
-
- Script {
- function testFunction() {
- test++;
- }
- }
Component.onCompleted: {
- root.argumentSignal.connect(testFunction);
- root.argumentSignal.connect(testFunction);
+ root.argumentSignal.connect(Script.testFunction);
+ root.argumentSignal.connect(Script.testFunction);
}
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.js
new file mode 100644
index 0000000..407426f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.js
@@ -0,0 +1,6 @@
+function testFunction() {
+ test++;
+}
+
+function otherFunction() {
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml
index 45c4f73..0d262c6 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.1.qml
@@ -1,18 +1,13 @@
import Qt.test 1.0
import Qt 4.6
+import "scriptDisconnect.1.js" as Script
MyQmlObject {
property int test: 0
id: root
- Script {
- function testFunction() {
- test++;
- }
- }
+ Component.onCompleted: root.argumentSignal.connect(Script.testFunction);
- Component.onCompleted: root.argumentSignal.connect(testFunction);
-
- onBasicSignal: root.argumentSignal.disconnect(testFunction);
+ onBasicSignal: root.argumentSignal.disconnect(Script.testFunction);
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml
index a47fe74..6d379e6 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.2.qml
@@ -1,19 +1,14 @@
import Qt.test 1.0
import Qt 4.6
+import "scriptDisconnect.1.js" as Script
MyQmlObject {
property int test: 0
id: root
- Script {
- function testFunction() {
- test++;
- }
- }
+ Component.onCompleted: root.argumentSignal.connect(root, Script.testFunction);
- Component.onCompleted: root.argumentSignal.connect(root, testFunction);
-
- onBasicSignal: root.argumentSignal.disconnect(root, testFunction);
+ onBasicSignal: root.argumentSignal.disconnect(root, Script.testFunction);
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml
index c95ffbf..526580a 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.3.qml
@@ -1,19 +1,14 @@
import Qt.test 1.0
import Qt 4.6
+import "scriptDisconnect.1.js" as Script
MyQmlObject {
property int test: 0
id: root
- Script {
- function testFunction() {
- test++;
- }
- }
+ Component.onCompleted: root.argumentSignal.connect(root, Script.testFunction);
- Component.onCompleted: root.argumentSignal.connect(root, testFunction);
-
- onBasicSignal: root.argumentSignal.disconnect(testFunction);
+ onBasicSignal: root.argumentSignal.disconnect(Script.testFunction);
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml
index 342f24a..18b05ad 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptDisconnect.4.qml
@@ -1,20 +1,13 @@
import Qt.test 1.0
import Qt 4.6
+import "scriptDisconnect.1.js" as Script
MyQmlObject {
property int test: 0
id: root
- Script {
- function testFunction() {
- test++;
- }
- function otherFunction() {
- }
- }
+ Component.onCompleted: root.argumentSignal.connect(Script.testFunction);
- Component.onCompleted: root.argumentSignal.connect(testFunction);
-
- onBasicSignal: root.argumentSignal.disconnect(otherFunction);
+ onBasicSignal: root.argumentSignal.disconnect(Script.otherFunction);
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.js
index 1d7b357..d22f623 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.js
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.js
@@ -1,2 +1,4 @@
// Comment
a = 10
+
+function getValue() { a = 10; return 0; }
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.qml
index c2edb41..e8f7b62 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.qml
@@ -1,11 +1,9 @@
import Qt.test 1.0
+import "scriptErrors.js" as Script
MyQmlObject {
- Script { source: "scriptErrors.js" }
- Script { function getValue() { a = 10; return 0; } }
-
property int t: a.value
- property int w: getValue();
+ property int w: Script.getValue();
property int x: undefinedObject
property int y: (a.value, undefinedObject)
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml
deleted file mode 100644
index 9b11fa9..0000000
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.1.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-import Qt.test 1.0
-
-MyQmlObject {
- property string result
-
- Script{
- function f() {
- result = b
- }
-
- }
- onArgumentSignal: f()
-}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml
deleted file mode 100644
index ec727e2..0000000
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.2.qml
+++ /dev/null
@@ -1,11 +0,0 @@
-import Qt.test 1.0
-
-MyQmlObject {
- property string result
- property string aProp: "hello"
-
- Script{
- source: "scriptScope.js"
- }
- onBasicSignal: f()
-}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js
deleted file mode 100644
index 5689930..0000000
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scriptScope.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var aProp = "world";
-
-function f() {
- result = aProp;
-}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
index 4424419..79d3226 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
+++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
@@ -170,7 +170,6 @@ private:
};
QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(MyQmlObject);
class MyQmlContainer : public QObject
{
@@ -185,7 +184,6 @@ private:
QList<MyQmlObject*> m_children;
};
-QML_DECLARE_TYPE(MyQmlContainer);
class MyExpression : public QDeclarativeExpression
{
@@ -258,7 +256,6 @@ private:
QObject *m_object;
QObject *m_object2;
};
-QML_DECLARE_TYPE(MyDeferredObject);
class MyBaseExtendedObject : public QObject
{
@@ -273,7 +270,6 @@ public:
private:
int m_value;
};
-QML_DECLARE_TYPE(MyBaseExtendedObject);
class MyExtendedObject : public MyBaseExtendedObject
{
@@ -288,7 +284,6 @@ public:
private:
int m_value;
};
-QML_DECLARE_TYPE(MyExtendedObject);
class MyTypeObject : public QObject
{
@@ -555,7 +550,6 @@ signals:
void rectPropertyChanged();
};
Q_DECLARE_OPERATORS_FOR_FLAGS(MyTypeObject::MyFlags)
-QML_DECLARE_TYPE(MyTypeObject);
Q_DECLARE_METATYPE(QScriptValue);
class MyInvokableObject : public QObject
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 098ac36..33629b8 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -100,7 +100,6 @@ private slots:
void scope();
void signalParameterTypes();
void objectsCompareAsEqual();
- void scriptAccess();
void dynamicCreation_data();
void dynamicCreation();
void dynamicDestruction();
@@ -117,14 +116,12 @@ private slots:
void exceptionBindingProducesWarning();
void transientErrors();
void shutdownErrors();
- void externalScript();
void compositePropertyType();
void jsObject();
void undefinedResetsProperty();
void listToVariant();
void multiEngineObject();
void deletedObject();
- void scriptScope();
void attachedPropertyScope();
void scriptConnect();
void scriptDisconnect();
@@ -320,7 +317,7 @@ void tst_qdeclarativeecmascript::methods()
void tst_qdeclarativeecmascript::bindingLoop()
{
QDeclarativeComponent component(&engine, TEST_FILE("bindingLoop.qml"));
- QString warning = "QML MyQmlObject (" + component.url().toString() + ":9:9) Binding loop detected for property \"stringProperty\"";
+ QString warning = component.url().toString() + ":9:9: QML MyQmlObject: Binding loop detected for property \"stringProperty\"";
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
QObject *object = component.create();
QVERIFY(object != 0);
@@ -837,24 +834,6 @@ void tst_qdeclarativeecmascript::aliasPropertyAndBinding()
QCOMPARE(object->property("c3").toInt(), 19);
}
-/*
-Tests that only methods of Script {} blocks are exposed.
-*/
-void tst_qdeclarativeecmascript::scriptAccess()
-{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptAccess.qml"));
-
- QString warning = component.url().toString() + ":16: Unable to assign [undefined] to int";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
-
- QObject *object = component.create();
- QVERIFY(object != 0);
-
- QCOMPARE(object->property("test1").toInt(), 10);
- QCOMPARE(object->property("test2").toInt(), 19);
- QCOMPARE(object->property("test3").toInt(), 0);
-}
-
void tst_qdeclarativeecmascript::dynamicCreation_data()
{
QTest::addColumn<QString>("method");
@@ -977,13 +956,13 @@ void tst_qdeclarativeecmascript::scriptErrors()
QString url = component.url().toString();
QString warning1 = url.left(url.length() - 3) + "js:2: Error: Invalid write to global property \"a\"";
- QString warning2 = url + ":7: TypeError: Result of expression 'a' [undefined] is not an object.";
- QString warning3 = url + ":5: Error: Invalid write to global property \"a\"";
- QString warning4 = url + ":12: TypeError: Result of expression 'a' [undefined] is not an object.";
- QString warning5 = url + ":10: TypeError: Result of expression 'a' [undefined] is not an object.";
- QString warning6 = url + ":9: Unable to assign [undefined] to int";
- QString warning7 = url + ":14: Error: Cannot assign to read-only property \"trueProperty\"";
- QString warning8 = url + ":15: Error: Cannot assign to non-existent property \"fakeProperty\"";
+ QString warning2 = url + ":5: TypeError: Result of expression 'a' [undefined] is not an object.";
+ QString warning3 = url.left(url.length() - 3) + "js:4: Error: Invalid write to global property \"a\"";
+ QString warning4 = url + ":10: TypeError: Result of expression 'a' [undefined] is not an object.";
+ QString warning5 = url + ":8: TypeError: Result of expression 'a' [undefined] is not an object.";
+ QString warning6 = url + ":7: Unable to assign [undefined] to int";
+ QString warning7 = url + ":12: Error: Cannot assign to read-only property \"trueProperty\"";
+ QString warning8 = url + ":13: Error: Cannot assign to non-existent property \"fakeProperty\"";
QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData());
QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData());
@@ -1166,53 +1145,6 @@ void tst_qdeclarativeecmascript::shutdownErrors()
QCOMPARE(transientErrorsMsgCount, 0);
}
-// Check that Script::source property works as expected
-void tst_qdeclarativeecmascript::externalScript()
-{
- {
- QDeclarativeComponent component(&engine, TEST_FILE("externalScript.1.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
-
- QCOMPARE(object->property("test").toInt(), 92);
-
- delete object;
- }
-
- {
- QDeclarativeComponent component(&engine, TEST_FILE("externalScript.2.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
-
- QCOMPARE(object->property("test").toInt(), 92);
-
- delete object;
- }
-
- {
- QDeclarativeComponent component(&engine, TEST_FILE("externalScript.3.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
-
- QCOMPARE(object->property("test").toInt(), 92);
- QCOMPARE(object->property("test2").toInt(), 92);
- QCOMPARE(object->property("test3").toBool(), false);
-
- delete object;
- }
-
- {
- QDeclarativeComponent component(&engine, TEST_FILE("externalScript.4.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
-
- QCOMPARE(object->property("test").toInt(), 92);
- QCOMPARE(object->property("test2").toBool(), true);
-
- delete object;
- }
-}
-
void tst_qdeclarativeecmascript::compositePropertyType()
{
QDeclarativeComponent component(&engine, TEST_FILE("compositePropertyType.qml"));
@@ -1764,37 +1696,11 @@ void tst_qdeclarativeecmascript::deletedObject()
QCOMPARE(object->property("test1").toBool(), true);
QCOMPARE(object->property("test2").toBool(), true);
QCOMPARE(object->property("test3").toBool(), true);
- QEXPECT_FAIL("", "QTBUG-8077", Continue);
QCOMPARE(object->property("test4").toBool(), true);
delete object;
}
-void tst_qdeclarativeecmascript::scriptScope()
-{
- {
- QDeclarativeComponent component(&engine, TEST_FILE("scriptScope.1.qml"));
-
- MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
- QVERIFY(object != 0);
- emit object->argumentSignal(19, "Hello world!", 10.3);
- QCOMPARE(object->property("result").toString(), QString());
-
- delete object;
- }
-
- {
- QDeclarativeComponent component(&engine, TEST_FILE("scriptScope.2.qml"));
-
- MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
- QVERIFY(object != 0);
- emit object->basicSignal();
- QCOMPARE(object->property("result").toString(), QLatin1String("world"));
-
- delete object;
- }
-}
-
void tst_qdeclarativeecmascript::attachedPropertyScope()
{
QDeclarativeComponent component(&engine, TEST_FILE("attachedPropertyScope.qml"));
diff --git a/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp b/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp
index 4155edb..f32cdbd 100644
--- a/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp
+++ b/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp
@@ -103,11 +103,11 @@ void tst_qdeclarativeflipable::setFrontAndBack()
QVERIFY(obj->front() != 0);
QVERIFY(obj->back() != 0);
- QString message = "QML Flipable (" + c.url().toString() + ":3:1) front is a write-once property";
+ QString message = c.url().toString() + ":3:1: QML Flipable: front is a write-once property";
QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
obj->setFront(new QDeclarativeRectangle());
- message = "QML Flipable (" + c.url().toString() + ":3:1) back is a write-once property";
+ message = c.url().toString() + ":3:1: QML Flipable: back is a write-once property";
QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
obj->setBack(new QDeclarativeRectangle());
delete obj;
diff --git a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp
index 5cdc96c..36908d9 100644
--- a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp
+++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp
@@ -121,7 +121,7 @@ void tst_qdeclarativefontloader::localFont()
void tst_qdeclarativefontloader::failLocalFont()
{
QString componentStr = "import Qt 4.7\nFontLoader { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" }";
- QTest::ignoreMessage(QtWarningMsg, QString("Cannot load font: QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" ) ").toUtf8().constData());
+ QTest::ignoreMessage(QtWarningMsg, QString("file::2:1: QML FontLoader: Cannot load font: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\"").toUtf8().constData());
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create());
@@ -165,7 +165,7 @@ void tst_qdeclarativefontloader::redirWebFont()
void tst_qdeclarativefontloader::failWebFont()
{
QString componentStr = "import Qt 4.7\nFontLoader { source: \"http://localhost:14448/nonexist.ttf\" }";
- QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://localhost:14448/nonexist.ttf\" ) ");
+ QTest::ignoreMessage(QtWarningMsg, "file::2:1: QML FontLoader: Cannot load font: \"http://localhost:14448/nonexist.ttf\"");
QDeclarativeComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create());
diff --git a/tests/auto/declarative/qdeclarativeimage/data/green.png b/tests/auto/declarative/qdeclarativeimage/data/green.png
new file mode 100644
index 0000000..0a2e153
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeimage/data/green.png
Binary files differ
diff --git a/tests/auto/declarative/qdeclarativeimage/data/tiling.qml b/tests/auto/declarative/qdeclarativeimage/data/tiling.qml
new file mode 100644
index 0000000..32839bb
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeimage/data/tiling.qml
@@ -0,0 +1,16 @@
+import Qt 4.7
+
+Rectangle {
+ width: 800; height: 600
+
+ Image {
+ objectName: "vTiling"; height: 550; width: 200
+ source: "green.png"; fillMode: Image.TileVertically
+ }
+
+ Image {
+ objectName: "hTiling"; x: 225; height: 250; width: 550
+ source: "green.png"; fillMode: Image.TileHorizontally
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
index 854bcdd..73aefaf 100644
--- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
+++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
@@ -51,6 +51,7 @@
#include <private/qdeclarativeimagebase_p.h>
#include <private/qdeclarativeloader_p.h>
#include <QtDeclarative/qdeclarativecontext.h>
+#include <QtDeclarative/qdeclarativeexpression.h>
#include "../shared/testhttpserver.h"
@@ -86,8 +87,12 @@ private slots:
void pixmap();
void svg();
void big();
+ void tiling_QTBUG_6716();
private:
+ template<typename T>
+ T *findItem(QGraphicsObject *parent, const QString &id, int index=-1);
+
QDeclarativeEngine engine;
};
@@ -124,13 +129,13 @@ void tst_qdeclarativeimage::imageSource_data()
QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << "";
QTest::newRow("local async") << QUrl::fromLocalFile(SRCDIR "/data/colors1.png").toString() << 120.0 << 120.0 << false << true << "";
QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << 0.0 << 0.0 << false
- << false << "QML Image (file::2:1) Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString();
+ << false << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString();
QTest::newRow("local async not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() << 0.0 << 0.0 << false
- << true << "QML Image (file::2:1) Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString();
+ << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString();
QTest::newRow("remote") << SERVER_ADDR "/colors.png" << 120.0 << 120.0 << true << false << "";
QTest::newRow("remote svg") << SERVER_ADDR "/heart.svg" << 550.0 << 500.0 << true << false << "";
QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << 0.0 << 0.0 << true
- << false << "QML Image (file::2:1) Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found";
+ << false << "file::2:1: QML Image: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found";
}
@@ -161,7 +166,7 @@ void tst_qdeclarativeimage::imageSource()
if (async)
QVERIFY(obj->asynchronous() == true);
-
+
if (remote || async)
TRY_WAIT(obj->status() == QDeclarativeImage::Loading);
@@ -339,6 +344,76 @@ void tst_qdeclarativeimage::big()
delete obj;
}
+void tst_qdeclarativeimage::tiling_QTBUG_6716()
+{
+ QDeclarativeView *canvas = new QDeclarativeView(0);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/tiling.qml"));
+ canvas->show();
+ qApp->processEvents();
+
+ QDeclarativeImage *vTiling = findItem<QDeclarativeImage>(canvas->rootObject(), "vTiling");
+ QDeclarativeImage *hTiling = findItem<QDeclarativeImage>(canvas->rootObject(), "hTiling");
+
+ QVERIFY(vTiling != 0);
+ QVERIFY(hTiling != 0);
+
+ {
+ QPixmap pm(vTiling->width(), vTiling->height());
+ QPainter p(&pm);
+ vTiling->paint(&p, 0, 0);
+
+ QImage img = pm.toImage();
+ for (int x = 0; x < vTiling->width(); ++x) {
+ for (int y = 0; y < vTiling->height(); ++y) {
+ QVERIFY(img.pixel(x, y) == qRgb(0, 255, 0));
+ }
+ }
+ }
+
+ {
+ QPixmap pm(hTiling->width(), hTiling->height());
+ QPainter p(&pm);
+ hTiling->paint(&p, 0, 0);
+
+ QImage img = pm.toImage();
+ for (int x = 0; x < hTiling->width(); ++x) {
+ for (int y = 0; y < hTiling->height(); ++y) {
+ QVERIFY(img.pixel(x, y) == qRgb(0, 255, 0));
+ }
+ }
+ }
+}
+
+/*
+ Find an item with the specified objectName. If index is supplied then the
+ item must also evaluate the {index} expression equal to index
+*/
+template<typename T>
+T *tst_qdeclarativeimage::findItem(QGraphicsObject *parent, const QString &objectName, int index)
+{
+ const QMetaObject &mo = T::staticMetaObject;
+ //qDebug() << parent->childItems().count() << "children";
+ for (int i = 0; i < parent->childItems().count(); ++i) {
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i));
+ if(!item)
+ continue;
+ //qDebug() << "try" << item;
+ if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
+ if (index != -1) {
+ QDeclarativeExpression e(qmlContext(item), "index", item);
+ if (e.value().toInt() == index)
+ return static_cast<T*>(item);
+ } else {
+ return static_cast<T*>(item);
+ }
+ }
+ item = findItem<T>(item, objectName, index);
+ if (item)
+ return static_cast<T*>(item);
+ }
+
+ return 0;
+}
QTEST_MAIN(tst_qdeclarativeimage)
diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
index aca951b..cc4ec20 100644
--- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
+++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
@@ -96,9 +96,9 @@ void tst_qdeclarativeimageprovider::imageSource_data()
QTest::newRow("exists") << "image://test/exists.png" << "" << QSize(100,100) << "";
QTest::newRow("scaled") << "image://test/exists.png" << "sourceSize: \"80x30\"" << QSize(80,30) << "";
QTest::newRow("missing") << "image://test/no-such-file.png" << "" << QSize()
- << "QML Image (file::2:1) Failed to get image from provider: image://test/no-such-file.png";
+ << "file::2:1: QML Image: Failed to get image from provider: image://test/no-such-file.png";
QTest::newRow("unknown provider") << "image://bogus/exists.png" << "" << QSize()
- << "QML Image (file::2:1) Failed to get image from provider: image://bogus/exists.png";
+ << "file::2:1: QML Image: Failed to get image from provider: image://bogus/exists.png";
}
@@ -158,7 +158,7 @@ void tst_qdeclarativeimageprovider::removeProvider()
QCOMPARE(obj->width(), 100.0);
// remove the provider and confirm
- QString error("QML Image (file::2:1) Failed to get image from provider: image://test2/exists2.png");
+ QString error("file::2:1: QML Image: Failed to get image from provider: image://test2/exists2.png");
QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
diff --git a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp
index aa3f03b..36db448 100644
--- a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp
+++ b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp
@@ -75,14 +75,14 @@ void tst_qdeclarativeinfo::qmlObject()
QObject *object = component.create();
QVERIFY(object != 0);
- QString message = "QML QObject_QML_0 (" + component.url().toString() + ":3:1) Test Message";
+ QString message = component.url().toString() + ":3:1: QML QObject_QML_0: Test Message";
QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
qmlInfo(object) << "Test Message";
QObject *nested = qvariant_cast<QObject *>(object->property("nested"));
QVERIFY(nested != 0);
- message = "QML QtObject (" + component.url().toString() + ":6:13) Second Test Message";
+ message = component.url().toString() + ":6:13: QML QtObject: Second Test Message";
QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
qmlInfo(nested) << "Second Test Message";
}
@@ -99,11 +99,11 @@ void tst_qdeclarativeinfo::nestedQmlObject()
QObject *nested2 = qvariant_cast<QObject *>(object->property("nested2"));
QVERIFY(nested2 != 0);
- QString message = "QML NestedObject (" + component.url().toString() + ":5:13) Outer Object";
+ QString message = component.url().toString() + ":5:13: QML NestedObject: Outer Object";
QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
qmlInfo(nested) << "Outer Object";
- message = "QML QtObject (" + TEST_FILE("NestedObject.qml").toString() + ":6:14) Inner Object";
+ message = TEST_FILE("NestedObject.qml").toString() + ":6:14: QML QtObject: Inner Object";
QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
qmlInfo(nested2) << "Inner Object";
}
@@ -111,17 +111,17 @@ void tst_qdeclarativeinfo::nestedQmlObject()
void tst_qdeclarativeinfo::nonQmlObject()
{
QObject object;
- QTest::ignoreMessage(QtWarningMsg, "QML QtObject (unknown location) Test Message");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML QtObject: Test Message");
qmlInfo(&object) << "Test Message";
QPushButton pbObject;
- QTest::ignoreMessage(QtWarningMsg, "QML QPushButton (unknown location) Test Message");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML QPushButton: Test Message");
qmlInfo(&pbObject) << "Test Message";
}
void tst_qdeclarativeinfo::nullObject()
{
- QTest::ignoreMessage(QtWarningMsg, "QML (unknown location) Null Object Test Message");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Null Object Test Message");
qmlInfo(0) << "Null Object Test Message";
}
@@ -130,7 +130,7 @@ void tst_qdeclarativeinfo::nonQmlContextedObject()
QObject object;
QDeclarativeContext context(&engine);
QDeclarativeEngine::setContextForObject(&object, &context);
- QTest::ignoreMessage(QtWarningMsg, "QML QtObject (unknown location) Test Message");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML QtObject: Test Message");
qmlInfo(&object) << "Test Message";
}
diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
index f4df130..9ae26f2 100644
--- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
+++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
@@ -332,16 +332,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
- i.line = 28;
- i.type = QDeclarativeInstruction::StoreScript;
- i.storeScript.value = 2;
- //i.storeScript.fileName = 18;
- //i.storeScript.lineNumber = 28;
- data->bytecode << i;
- }
-
- {
- QDeclarativeInstruction i;
i.line = 29;
i.type = QDeclarativeInstruction::StoreScriptString;
i.storeScriptString.propertyIndex = 24;
@@ -571,30 +561,29 @@ void tst_qdeclarativeinstruction::dump()
<< "25\t\t25\tSTORE_VARIANT_OBJECT\t22"
<< "26\t\t26\tSTORE_INTERFACE\t\t23"
<< "27\t\t27\tSTORE_SIGNAL\t\t2\t3\t\t\"console.log(1921)\""
- << "28\t\t28\tSTORE_SCRIPT\t\t2"
- << "29\t\t29\tSTORE_SCRIPT_STRING\t24\t3\t1"
- << "30\t\t30\tASSIGN_SIGNAL_OBJECT\t0\t\t\t\"mySignal\""
- << "31\t\t31\tASSIGN_CUSTOMTYPE\t25\t4"
- << "32\t\t32\tSTORE_BINDING\t26\t3\t2"
- << "33\t\t33\tSTORE_COMPILED_BINDING\t27\t2\t4"
- << "34\t\t34\tSTORE_VALUE_SOURCE\t29\t4"
- << "35\t\t35\tSTORE_VALUE_INTERCEPTOR\t30\t-4"
- << "36\t\t36\tBEGIN\t\t\t4"
- << "37\t\t38\tSTORE_OBJECT_QLIST"
- << "38\t\t39\tASSIGN_OBJECT_LIST"
- << "39\t\t40\tFETCH_ATTACHED\t\t23"
- << "40\t\t42\tFETCH_QLIST\t\t32"
- << "41\t\t43\tFETCH\t\t\t33"
- << "42\t\t44\tFETCH_VALUE\t\t34\t6"
- << "43\t\t45\tPOP"
- << "44\t\t46\tPOP_QLIST"
- << "45\t\t47\tPOP_VALUE\t\t35\t8"
- << "46\t\t48\tDEFER\t\t\t7"
- << "47\t\tNA\tDEFER\t\t\t7"
- << "48\t\t48\tSTORE_IMPORTED_SCRIPT\t2"
- << "49\t\t50\tXXX UNKOWN INSTRUCTION\t1234"
- << "50\t\t51\tSTORE_VARIANT_INTEGER\t\t32\t11"
- << "51\t\t52\tSTORE_VARIANT_DOUBLE\t\t19\t33.7"
+ << "28\t\t29\tSTORE_SCRIPT_STRING\t24\t3\t1"
+ << "29\t\t30\tASSIGN_SIGNAL_OBJECT\t0\t\t\t\"mySignal\""
+ << "30\t\t31\tASSIGN_CUSTOMTYPE\t25\t4"
+ << "31\t\t32\tSTORE_BINDING\t26\t3\t2"
+ << "32\t\t33\tSTORE_COMPILED_BINDING\t27\t2\t4"
+ << "33\t\t34\tSTORE_VALUE_SOURCE\t29\t4"
+ << "34\t\t35\tSTORE_VALUE_INTERCEPTOR\t30\t-4"
+ << "35\t\t36\tBEGIN\t\t\t4"
+ << "36\t\t38\tSTORE_OBJECT_QLIST"
+ << "37\t\t39\tASSIGN_OBJECT_LIST"
+ << "38\t\t40\tFETCH_ATTACHED\t\t23"
+ << "39\t\t42\tFETCH_QLIST\t\t32"
+ << "40\t\t43\tFETCH\t\t\t33"
+ << "41\t\t44\tFETCH_VALUE\t\t34\t6"
+ << "42\t\t45\tPOP"
+ << "43\t\t46\tPOP_QLIST"
+ << "44\t\t47\tPOP_VALUE\t\t35\t8"
+ << "45\t\t48\tDEFER\t\t\t7"
+ << "46\t\tNA\tDEFER\t\t\t7"
+ << "47\t\t48\tSTORE_IMPORTED_SCRIPT\t2"
+ << "48\t\t50\tXXX UNKOWN INSTRUCTION\t1234"
+ << "49\t\t51\tSTORE_VARIANT_INTEGER\t\t32\t11"
+ << "50\t\t52\tSTORE_VARIANT_DOUBLE\t\t19\t33.7"
<< "-------------------------------------------------------------------------------";
messages = QStringList();
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index 4400116..d2c328e 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -385,12 +385,15 @@ void tst_QDeclarativeItem::mapCoordinates()
Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y)));
QCOMPARE(result.value<QPointF>(), qobject_cast<QGraphicsItem*>(a)->mapFromScene(x, y));
- QTest::ignoreMessage(QtWarningMsg, "mapToItem() given argument \"1122\" which is neither null nor an Item");
+ QString warning1 = QUrl::fromLocalFile(SRCDIR "/data/mapCoordinates.qml").toString() + ":7:5: QML Item: mapToItem() given argument \"1122\" which is neither null nor an Item";
+ QString warning2 = QUrl::fromLocalFile(SRCDIR "/data/mapCoordinates.qml").toString() + ":7:5: QML Item: mapFromItem() given argument \"1122\" which is neither null nor an Item";
+
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QVERIFY(QMetaObject::invokeMethod(root, "checkMapAToInvalid",
Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y)));
QVERIFY(result.toBool());
- QTest::ignoreMessage(QtWarningMsg, "mapFromItem() given argument \"1122\" which is neither null nor an Item");
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
QVERIFY(QMetaObject::invokeMethod(root, "checkMapAFromInvalid",
Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y)));
QVERIFY(result.toBool());
diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
index 8c163a5..951cea0 100644
--- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h
+++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
@@ -167,8 +167,9 @@ private:
MyCustomVariantType m_custom;
int m_propertyWithNotify;
};
+QML_DECLARE_TYPE(MyQmlObject)
QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES)
-QML_DECLARE_TYPE(MyQmlObject);
+
class MyGroupedObject : public QObject
{
@@ -187,8 +188,6 @@ private:
QDeclarativeScriptString m_script;
};
-QML_DECLARE_TYPE(MyGroupedObject);
-
class MyTypeObject : public QObject
{
@@ -462,7 +461,7 @@ signals:
void rectPropertyChanged();
};
Q_DECLARE_OPERATORS_FOR_FLAGS(MyTypeObject::MyFlags)
-QML_DECLARE_TYPE(MyTypeObject);
+
class MyContainer : public QObject
{
@@ -482,8 +481,6 @@ public:
QList<MyInterface *> m_interfaces;
};
-QML_DECLARE_TYPE(MyContainer);
-
class MyPropertyValueSource : public QObject, public QDeclarativePropertyValueSource
{
@@ -499,7 +496,7 @@ public:
prop = p;
}
};
-QML_DECLARE_TYPE(MyPropertyValueSource);
+
class MyDotPropertyObject : public QObject
{
@@ -540,7 +537,6 @@ private:
bool m_ownRWObj;
};
-QML_DECLARE_TYPE(MyDotPropertyObject);
namespace MyNamespace {
class MyNamespacedType : public QObject
@@ -559,8 +555,6 @@ namespace MyNamespace {
QList<MyNamespacedType *> m_list;
};
}
-QML_DECLARE_TYPE(MyNamespace::MyNamespacedType);
-QML_DECLARE_TYPE(MyNamespace::MySecondNamespacedType);
class MyCustomParserType : public QObject
{
@@ -574,8 +568,6 @@ public:
void setCustomData(QObject *, const QByteArray &) {}
};
-QML_DECLARE_TYPE(MyCustomParserType);
-
void registerTypes();
#endif // TESTTYPES_H
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index 8feab32..07fbf83 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -779,8 +779,7 @@ void tst_qdeclarativelanguage::valueTypes()
QDeclarativeComponent component(&engine, TEST_FILE("valueTypes.qml"));
VERIFY_ERRORS(0);
- QString message = QLatin1String("QML MyTypeObject (") + component.url().toString() +
- QLatin1String(":2:1) Binding loop detected for property \"rectProperty.width\"");
+ QString message = component.url().toString() + ":2:1: QML MyTypeObject: Binding loop detected for property \"rectProperty.width\"";
QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
@@ -1133,8 +1132,6 @@ void tst_qdeclarativelanguage::testType(const QString& qml, const QString& type,
}
}
-QML_DECLARE_TYPE(TestType)
-QML_DECLARE_TYPE(TestType2)
// Import tests (QT-558)
diff --git a/tests/auto/declarative/qdeclarativelistmodel/data/enumerate.qml b/tests/auto/declarative/qdeclarativelistmodel/data/enumerate.qml
new file mode 100644
index 0000000..8d23d4b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistmodel/data/enumerate.qml
@@ -0,0 +1,24 @@
+import Qt 4.6
+
+Item {
+ property string result
+
+ ListModel {
+ id: model
+
+ ListElement {
+ val1: 1
+ val2: 2
+ val3: "str"
+ val4: false
+ val5: true
+ }
+ }
+
+ Component.onCompleted: {
+ var element = model.get(0);
+
+ for (var i in element)
+ result += i+"="+element[i]+(element[i] ? "Y" : "N")+":";
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index 9d61ad0..bbea98a 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -51,11 +51,11 @@
#include "../../../shared/util.h"
-class tst_QDeclarativeListModel : public QObject
+class tst_qdeclarativelistmodel : public QObject
{
Q_OBJECT
public:
- tst_QDeclarativeListModel() {}
+ tst_qdeclarativelistmodel() {}
private:
QScriptValue nestedListValue(QScriptEngine *eng) const;
@@ -76,12 +76,13 @@ private slots:
void convertNestedToFlat_fail_data();
void convertNestedToFlat_ok();
void convertNestedToFlat_ok_data();
+ void enumerate();
void error_data();
void error();
void set();
};
-QScriptValue tst_QDeclarativeListModel::nestedListValue(QScriptEngine *eng) const
+QScriptValue tst_qdeclarativelistmodel::nestedListValue(QScriptEngine *eng) const
{
QScriptValue list = eng->newArray();
list.setProperty(0, eng->newObject());
@@ -91,7 +92,7 @@ QScriptValue tst_QDeclarativeListModel::nestedListValue(QScriptEngine *eng) cons
return sv;
}
-QDeclarativeItem *tst_QDeclarativeListModel::createWorkerTest(QDeclarativeEngine *eng, QDeclarativeComponent *component, QDeclarativeListModel *model)
+QDeclarativeItem *tst_qdeclarativelistmodel::createWorkerTest(QDeclarativeEngine *eng, QDeclarativeComponent *component, QDeclarativeListModel *model)
{
QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component->create());
QDeclarativeEngine::setContextForObject(model, eng->rootContext());
@@ -100,7 +101,7 @@ QDeclarativeItem *tst_QDeclarativeListModel::createWorkerTest(QDeclarativeEngine
return item;
}
-void tst_QDeclarativeListModel::waitForWorker(QDeclarativeItem *item)
+void tst_qdeclarativelistmodel::waitForWorker(QDeclarativeItem *item)
{
QEventLoop loop;
QTimer timer;
@@ -115,7 +116,7 @@ void tst_QDeclarativeListModel::waitForWorker(QDeclarativeItem *item)
QVERIFY(timer.isActive());
}
-void tst_QDeclarativeListModel::static_i18n()
+void tst_qdeclarativelistmodel::static_i18n()
{
QString expect = QString::fromUtf8("na\303\257ve");
QString componentStr = "import Qt 4.7\nListModel { ListElement { prop1: \""+expect+"\" } }";
@@ -129,7 +130,7 @@ void tst_QDeclarativeListModel::static_i18n()
delete obj;
}
-void tst_QDeclarativeListModel::static_nestedElements()
+void tst_qdeclarativelistmodel::static_nestedElements()
{
QFETCH(int, elementCount);
@@ -163,7 +164,7 @@ void tst_QDeclarativeListModel::static_nestedElements()
delete obj;
}
-void tst_QDeclarativeListModel::static_nestedElements_data()
+void tst_qdeclarativelistmodel::static_nestedElements_data()
{
QTest::addColumn<int>("elementCount");
@@ -173,7 +174,7 @@ void tst_QDeclarativeListModel::static_nestedElements_data()
QTest::newRow("many items") << 5;
}
-void tst_QDeclarativeListModel::dynamic_data()
+void tst_qdeclarativelistmodel::dynamic_data()
{
QTest::addColumn<QString>("script");
QTest::addColumn<int>("result");
@@ -183,58 +184,58 @@ void tst_QDeclarativeListModel::dynamic_data()
QTest::newRow("count") << "count" << 0 << "";
- QTest::newRow("get1") << "{get(0)}" << 0 << "QML ListModel (unknown location) get: index 0 out of range";
- QTest::newRow("get2") << "{get(-1)}" << 0 << "QML ListModel (unknown location) get: index -1 out of range";
+ QTest::newRow("get1") << "{get(0)}" << 0 << "<Unknown File>: QML ListModel: get: index 0 out of range";
+ QTest::newRow("get2") << "{get(-1)}" << 0 << "<Unknown File>: QML ListModel: get: index -1 out of range";
QTest::newRow("append1") << "{append({'foo':123});count}" << 1 << "";
QTest::newRow("append2") << "{append({'foo':123,'bar':456});count}" << 1 << "";
QTest::newRow("append3a") << "{append({'foo':123});append({'foo':456});get(0).foo}" << 123 << "";
QTest::newRow("append3b") << "{append({'foo':123});append({'foo':456});get(1).foo}" << 456 << "";
- QTest::newRow("append4a") << "{append(123)}" << 0 << "QML ListModel (unknown location) append: value is not an object";
- QTest::newRow("append4b") << "{append([1,2,3])}" << 0 << "QML ListModel (unknown location) append: value is not an object";
+ QTest::newRow("append4a") << "{append(123)}" << 0 << "<Unknown File>: QML ListModel: append: value is not an object";
+ QTest::newRow("append4b") << "{append([1,2,3])}" << 0 << "<Unknown File>: QML ListModel: append: value is not an object";
QTest::newRow("clear1") << "{append({'foo':456});clear();count}" << 0 << "";
QTest::newRow("clear2") << "{append({'foo':123});append({'foo':456});clear();count}" << 0 << "";
- QTest::newRow("clear3") << "{append({'foo':123});clear();get(0).foo}" << 0 << "QML ListModel (unknown location) get: index 0 out of range";
+ QTest::newRow("clear3") << "{append({'foo':123});clear();get(0).foo}" << 0 << "<Unknown File>: QML ListModel: get: index 0 out of range";
QTest::newRow("remove1") << "{append({'foo':123});remove(0);count}" << 0 << "";
QTest::newRow("remove2a") << "{append({'foo':123});append({'foo':456});remove(0);count}" << 1 << "";
QTest::newRow("remove2b") << "{append({'foo':123});append({'foo':456});remove(0);get(0).foo}" << 456 << "";
QTest::newRow("remove2c") << "{append({'foo':123});append({'foo':456});remove(1);get(0).foo}" << 123 << "";
- QTest::newRow("remove3") << "{append({'foo':123});remove(0);get(0).foo}" << 0 << "QML ListModel (unknown location) get: index 0 out of range";
- QTest::newRow("remove3a") << "{append({'foo':123});remove(-1);count}" << 1 << "QML ListModel (unknown location) remove: index -1 out of range";
- QTest::newRow("remove4a") << "{remove(0)}" << 0 << "QML ListModel (unknown location) remove: index 0 out of range";
- QTest::newRow("remove4b") << "{append({'foo':123});remove(0);remove(0);count}" << 0 << "QML ListModel (unknown location) remove: index 0 out of range";
- QTest::newRow("remove4c") << "{append({'foo':123});remove(1);count}" << 1 << "QML ListModel (unknown location) remove: index 1 out of range";
+ QTest::newRow("remove3") << "{append({'foo':123});remove(0);get(0).foo}" << 0 << "<Unknown File>: QML ListModel: get: index 0 out of range";
+ QTest::newRow("remove3a") << "{append({'foo':123});remove(-1);count}" << 1 << "<Unknown File>: QML ListModel: remove: index -1 out of range";
+ QTest::newRow("remove4a") << "{remove(0)}" << 0 << "<Unknown File>: QML ListModel: remove: index 0 out of range";
+ QTest::newRow("remove4b") << "{append({'foo':123});remove(0);remove(0);count}" << 0 << "<Unknown File>: QML ListModel: remove: index 0 out of range";
+ QTest::newRow("remove4c") << "{append({'foo':123});remove(1);count}" << 1 << "<Unknown File>: QML ListModel: remove: index 1 out of range";
QTest::newRow("insert1") << "{insert(0,{'foo':123});count}" << 1 << "";
- QTest::newRow("insert2") << "{insert(1,{'foo':123});count}" << 0 << "QML ListModel (unknown location) insert: index 1 out of range";
+ QTest::newRow("insert2") << "{insert(1,{'foo':123});count}" << 0 << "<Unknown File>: QML ListModel: insert: index 1 out of range";
QTest::newRow("insert3a") << "{append({'foo':123});insert(1,{'foo':456});count}" << 2 << "";
QTest::newRow("insert3b") << "{append({'foo':123});insert(1,{'foo':456});get(0).foo}" << 123 << "";
QTest::newRow("insert3c") << "{append({'foo':123});insert(1,{'foo':456});get(1).foo}" << 456 << "";
QTest::newRow("insert3d") << "{append({'foo':123});insert(0,{'foo':456});get(0).foo}" << 456 << "";
QTest::newRow("insert3e") << "{append({'foo':123});insert(0,{'foo':456});get(1).foo}" << 123 << "";
- QTest::newRow("insert4") << "{append({'foo':123});insert(-1,{'foo':456});count}" << 1 << "QML ListModel (unknown location) insert: index -1 out of range";
- QTest::newRow("insert5a") << "{insert(0,123)}" << 0 << "QML ListModel (unknown location) insert: value is not an object";
- QTest::newRow("insert5b") << "{insert(0,[1,2,3])}" << 0 << "QML ListModel (unknown location) insert: value is not an object";
+ QTest::newRow("insert4") << "{append({'foo':123});insert(-1,{'foo':456});count}" << 1 << "<Unknown File>: QML ListModel: insert: index -1 out of range";
+ QTest::newRow("insert5a") << "{insert(0,123)}" << 0 << "<Unknown File>: QML ListModel: insert: value is not an object";
+ QTest::newRow("insert5b") << "{insert(0,[1,2,3])}" << 0 << "<Unknown File>: QML ListModel: insert: value is not an object";
QTest::newRow("set1") << "{append({'foo':123});set(0,{'foo':456});count}" << 1 << "";
QTest::newRow("set2") << "{append({'foo':123});set(0,{'foo':456});get(0).foo}" << 456 << "";
QTest::newRow("set3a") << "{append({'foo':123,'bar':456});set(0,{'foo':999});get(0).foo}" << 999 << "";
QTest::newRow("set3b") << "{append({'foo':123,'bar':456});set(0,{'foo':999});get(0).bar}" << 456 << "";
- QTest::newRow("set4a") << "{set(0,{'foo':456})}" << 0 << "QML ListModel (unknown location) set: index 0 out of range";
- QTest::newRow("set4c") << "{set(-1,{'foo':456})}" << 0 << "QML ListModel (unknown location) set: index -1 out of range";
- QTest::newRow("set5a") << "{append({'foo':123,'bar':456});set(0,123);count}" << 1 << "QML ListModel (unknown location) set: value is not an object";
- QTest::newRow("set5b") << "{append({'foo':123,'bar':456});set(0,[1,2,3]);count}" << 1 << "QML ListModel (unknown location) set: value is not an object";
+ QTest::newRow("set4a") << "{set(0,{'foo':456})}" << 0 << "<Unknown File>: QML ListModel: set: index 0 out of range";
+ QTest::newRow("set4c") << "{set(-1,{'foo':456})}" << 0 << "<Unknown File>: QML ListModel: set: index -1 out of range";
+ QTest::newRow("set5a") << "{append({'foo':123,'bar':456});set(0,123);count}" << 1 << "<Unknown File>: QML ListModel: set: value is not an object";
+ QTest::newRow("set5b") << "{append({'foo':123,'bar':456});set(0,[1,2,3]);count}" << 1 << "<Unknown File>: QML ListModel: set: value is not an object";
QTest::newRow("set6") << "{append({'foo':123});set(1,{'foo':456});count}" << 2 << "";
QTest::newRow("setprop1") << "{append({'foo':123});setProperty(0,'foo',456);count}" << 1 << "";
QTest::newRow("setprop2") << "{append({'foo':123});setProperty(0,'foo',456);get(0).foo}" << 456 << "";
QTest::newRow("setprop3a") << "{append({'foo':123,'bar':456});setProperty(0,'foo',999);get(0).foo}" << 999 << "";
QTest::newRow("setprop3b") << "{append({'foo':123,'bar':456});setProperty(0,'foo',999);get(0).bar}" << 456 << "";
- QTest::newRow("setprop4a") << "{setProperty(0,'foo',456)}" << 0 << "QML ListModel (unknown location) set: index 0 out of range";
- QTest::newRow("setprop4b") << "{setProperty(-1,'foo',456)}" << 0 << "QML ListModel (unknown location) set: index -1 out of range";
- QTest::newRow("setprop4c") << "{append({'foo':123,'bar':456});setProperty(1,'foo',456);count}" << 1 << "QML ListModel (unknown location) set: index 1 out of range";
+ QTest::newRow("setprop4a") << "{setProperty(0,'foo',456)}" << 0 << "<Unknown File>: QML ListModel: set: index 0 out of range";
+ QTest::newRow("setprop4b") << "{setProperty(-1,'foo',456)}" << 0 << "<Unknown File>: QML ListModel: set: index -1 out of range";
+ QTest::newRow("setprop4c") << "{append({'foo':123,'bar':456});setProperty(1,'foo',456);count}" << 1 << "<Unknown File>: QML ListModel: set: index 1 out of range";
QTest::newRow("setprop5") << "{append({'foo':123,'bar':456});append({'foo':111});setProperty(1,'bar',222);get(1).bar}" << 222 << "";
QTest::newRow("move1a") << "{append({'foo':123});append({'foo':456});move(0,1,1);count}" << 2 << "";
@@ -246,10 +247,10 @@ void tst_QDeclarativeListModel::dynamic_data()
QTest::newRow("move2b") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(0).foo}" << 789 << "";
QTest::newRow("move2c") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(1).foo}" << 123 << "";
QTest::newRow("move2d") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(2).foo}" << 456 << "";
- QTest::newRow("move3a") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,0,3);count}" << 3 << "QML ListModel (unknown location) move: out of range";
- QTest::newRow("move3b") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,-1,1);count}" << 3 << "QML ListModel (unknown location) move: out of range";
- QTest::newRow("move3c") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,0,-1);count}" << 3 << "QML ListModel (unknown location) move: out of range";
- QTest::newRow("move3d") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,3,1);count}" << 3 << "QML ListModel (unknown location) move: out of range";
+ QTest::newRow("move3a") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,0,3);count}" << 3 << "<Unknown File>: QML ListModel: move: out of range";
+ QTest::newRow("move3b") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,-1,1);count}" << 3 << "<Unknown File>: QML ListModel: move: out of range";
+ QTest::newRow("move3c") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,0,-1);count}" << 3 << "<Unknown File>: QML ListModel: move: out of range";
+ QTest::newRow("move3d") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,3,1);count}" << 3 << "<Unknown File>: QML ListModel: move: out of range";
// Nested models
@@ -264,7 +265,7 @@ void tst_QDeclarativeListModel::dynamic_data()
//QTest::newRow("nested-setprop") << "{append({'foo':123});setProperty(0,'foo',[{'x':123}]);get(0).foo.get(0).x}" << 123 << "";
}
-void tst_QDeclarativeListModel::dynamic()
+void tst_qdeclarativelistmodel::dynamic()
{
QFETCH(QString, script);
QFETCH(int, result);
@@ -285,12 +286,12 @@ void tst_QDeclarativeListModel::dynamic()
QCOMPARE(actual,result);
}
-void tst_QDeclarativeListModel::dynamic_worker_data()
+void tst_qdeclarativelistmodel::dynamic_worker_data()
{
dynamic_data();
}
-void tst_QDeclarativeListModel::dynamic_worker()
+void tst_qdeclarativelistmodel::dynamic_worker()
{
QFETCH(QString, script);
QFETCH(int, result);
@@ -323,7 +324,7 @@ void tst_QDeclarativeListModel::dynamic_worker()
// execute a set of commands on the worker list model, then check the
// changes are reflected in the list model in the main thread
if (QByteArray(QTest::currentDataTag()).startsWith("nested"))
- QTest::ignoreMessage(QtWarningMsg, "QML ListModel (unknown location) Cannot add nested list values when modifying or after modification from a worker script");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML ListModel: Cannot add nested list values when modifying or after modification from a worker script");
QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker",
Q_ARG(QVariant, operations.mid(0, operations.length()-1))));
@@ -340,7 +341,7 @@ void tst_QDeclarativeListModel::dynamic_worker()
qApp->processEvents();
}
-void tst_QDeclarativeListModel::convertNestedToFlat_fail()
+void tst_qdeclarativelistmodel::convertNestedToFlat_fail()
{
// If a model has nested data, it cannot be used at all from a worker script
@@ -359,7 +360,7 @@ void tst_QDeclarativeListModel::convertNestedToFlat_fail()
model.append(nestedListValue(&s_eng));
QCOMPARE(model.count(), 2);
- QTest::ignoreMessage(QtWarningMsg, "QML ListModel (unknown location) List contains nested list values and cannot be used from a worker script");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML ListModel: List contains nested list values and cannot be used from a worker script");
QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", Q_ARG(QVariant, script)));
waitForWorker(item);
@@ -369,7 +370,7 @@ void tst_QDeclarativeListModel::convertNestedToFlat_fail()
qApp->processEvents();
}
-void tst_QDeclarativeListModel::convertNestedToFlat_fail_data()
+void tst_qdeclarativelistmodel::convertNestedToFlat_fail_data()
{
QTest::addColumn<QString>("script");
@@ -383,7 +384,7 @@ void tst_QDeclarativeListModel::convertNestedToFlat_fail_data()
QTest::newRow("get") << "get(0)";
}
-void tst_QDeclarativeListModel::convertNestedToFlat_ok()
+void tst_qdeclarativelistmodel::convertNestedToFlat_ok()
{
// If a model only has plain data, it can be modified from a worker script. However,
// once the model is used from a worker script, it no longer accepts nested data
@@ -411,7 +412,7 @@ void tst_QDeclarativeListModel::convertNestedToFlat_ok()
QCOMPARE(model.count(), count+1);
QScriptValue nested = nestedListValue(&s_eng);
- const char *warning = "QML ListModel (unknown location) Cannot add nested list values when modifying or after modification from a worker script";
+ const char *warning = "<Unknown File>: QML ListModel: Cannot add nested list values when modifying or after modification from a worker script";
QTest::ignoreMessage(QtWarningMsg, warning);
model.append(nested);
@@ -428,12 +429,12 @@ void tst_QDeclarativeListModel::convertNestedToFlat_ok()
qApp->processEvents();
}
-void tst_QDeclarativeListModel::convertNestedToFlat_ok_data()
+void tst_qdeclarativelistmodel::convertNestedToFlat_ok_data()
{
convertNestedToFlat_fail_data();
}
-void tst_QDeclarativeListModel::static_types_data()
+void tst_qdeclarativelistmodel::static_types_data()
{
QTest::addColumn<QString>("qml");
QTest::addColumn<QVariant>("value");
@@ -463,7 +464,7 @@ void tst_QDeclarativeListModel::static_types_data()
<< QVariant(double(QDeclarativeText::AlignHCenter));
}
-void tst_QDeclarativeListModel::static_types()
+void tst_qdeclarativelistmodel::static_types()
{
QFETCH(QString, qml);
QFETCH(QVariant, value);
@@ -494,7 +495,24 @@ void tst_QDeclarativeListModel::static_types()
delete obj;
}
-void tst_QDeclarativeListModel::error_data()
+void tst_qdeclarativelistmodel::enumerate()
+{
+ QDeclarativeEngine eng;
+ QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/enumerate.qml"));
+ QVERIFY(!component.isError());
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(item != 0);
+ QStringList r = item->property("result").toString().split(":");
+ QCOMPARE(r[0],QLatin1String("val1=1Y"));
+ QCOMPARE(r[1],QLatin1String("val2=2Y"));
+ QCOMPARE(r[2],QLatin1String("val3=strY"));
+ QCOMPARE(r[3],QLatin1String("val4=falseN"));
+ QCOMPARE(r[4],QLatin1String("val5=trueY"));
+ delete item;
+}
+
+
+void tst_qdeclarativelistmodel::error_data()
{
QTest::addColumn<QString>("qml");
QTest::addColumn<QString>("error");
@@ -532,7 +550,7 @@ void tst_QDeclarativeListModel::error_data()
<< "ListElement: cannot contain nested elements";
}
-void tst_QDeclarativeListModel::error()
+void tst_qdeclarativelistmodel::error()
{
QFETCH(QString, qml);
QFETCH(QString, error);
@@ -551,7 +569,7 @@ void tst_QDeclarativeListModel::error()
}
}
-void tst_QDeclarativeListModel::set()
+void tst_qdeclarativelistmodel::set()
{
QDeclarativeEngine engine;
QDeclarativeListModel model;
@@ -575,6 +593,6 @@ void tst_QDeclarativeListModel::set()
}
-QTEST_MAIN(tst_QDeclarativeListModel)
+QTEST_MAIN(tst_qdeclarativelistmodel)
#include "tst_qdeclarativelistmodel.moc"
diff --git a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp
index 908f336..7689270 100644
--- a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp
+++ b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp
@@ -102,7 +102,6 @@ public:
QList<TestType *> data;
QDeclarativeListProperty<TestType> property;
};
-QML_DECLARE_TYPE(TestType);
void tst_qdeclarativelistreference::initTestCase()
{
diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
index 4a82b50..1b17a56 100644
--- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
+++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
@@ -138,7 +138,7 @@ void tst_QDeclarativeLoader::component()
void tst_QDeclarativeLoader::invalidUrl()
{
- QTest::ignoreMessage(QtWarningMsg, QString("(:-1: File error for URL " + QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ") ").toUtf8().constData());
+ QTest::ignoreMessage(QtWarningMsg, QString("<Unknown File>: File error for URL " + QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString()).toUtf8().constData());
QDeclarativeComponent component(&engine);
component.setData(QByteArray("import Qt 4.7\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE(""));
@@ -465,7 +465,7 @@ void tst_QDeclarativeLoader::failNetworkRequest()
QVERIFY(server.isValid());
server.serveDirectory(SRCDIR "/data");
- QTest::ignoreMessage(QtWarningMsg, "(:-1: Network error for URL http://127.0.0.1:14450/IDontExist.qml) ");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Network error for URL http://127.0.0.1:14450/IDontExist.qml");
QDeclarativeComponent component(&engine);
component.setData(QByteArray("import Qt 4.7\nLoader { source: \"http://127.0.0.1:14450/IDontExist.qml\" }"), QUrl::fromLocalFile("http://127.0.0.1:14450/dummy.qml"));
@@ -505,7 +505,7 @@ void tst_QDeclarativeLoader::deleteComponentCrash()
void tst_QDeclarativeLoader::nonItem()
{
QDeclarativeComponent component(&engine, TEST_FILE("nonItem.qml"));
- QString err = QString("QML Loader (") + QUrl::fromLocalFile(SRCDIR).toString() + QString("/data/nonItem.qml:3:1) Loader does not support loading non-visual elements.");
+ QString err = QUrl::fromLocalFile(SRCDIR).toString() + "/data/nonItem.qml:3:1: QML Loader: Loader does not support loading non-visual elements.";
QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData());
QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create());
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp
index fd94cc6..7d89bee 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp
@@ -61,8 +61,6 @@ private:
int v;
};
-QML_DECLARE_TYPE(MyPluginType);
-
class MyPlugin : public QDeclarativeExtensionPlugin
{
diff --git a/tests/auto/declarative/qdeclarativemousearea/data/updateMousePosOnResize.qml b/tests/auto/declarative/qdeclarativemousearea/data/updateMousePosOnResize.qml
new file mode 100644
index 0000000..63de624
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemousearea/data/updateMousePosOnResize.qml
@@ -0,0 +1,38 @@
+import Qt 4.6
+
+Rectangle {
+ color: "#ffffff"
+ width: 320; height: 240
+ Rectangle {
+ id: brother
+ objectName: "brother"
+ color: "lightgreen"
+ x: 200; y: 100
+ width: 120; height: 120
+ }
+ MouseArea {
+ id: mouseRegion
+ objectName: "mouseregion"
+
+ property int x1
+ property int y1
+ property int x2
+ property int y2
+ property bool emitPositionChanged: false
+ property bool mouseMatchesPos: true
+
+ anchors.fill: brother
+ onPressed: {
+ if (mouse.x != mouseX || mouse.y != mouseY)
+ mouseMatchesPos = false
+ x1 = mouseX; y1 = mouseY
+ anchors.fill = parent
+ }
+ onPositionChanged: { emitPositionChanged = true }
+ onMousePositionChanged: {
+ if (mouse.x != mouseX || mouse.y != mouseY)
+ mouseMatchesPos = false
+ x2 = mouseX; y2 = mouseY
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
index bdb8eca..4a58049 100644
--- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
+++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
@@ -53,6 +53,7 @@ private slots:
void dragProperties();
void resetDrag();
void updateMouseAreaPosOnClick();
+ void updateMouseAreaPosOnResize();
void noOnClickedWithPressAndHold();
private:
QDeclarativeView *createView();
@@ -203,6 +204,46 @@ void tst_QDeclarativeMouseArea::updateMouseAreaPosOnClick()
delete canvas;
}
+void tst_QDeclarativeMouseArea::updateMouseAreaPosOnResize()
+{
+ QDeclarativeView *canvas = createView();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/updateMousePosOnResize.qml"));
+ canvas->show();
+ canvas->setFocus();
+ QVERIFY(canvas->rootObject() != 0);
+
+ QDeclarativeMouseArea *mouseRegion = canvas->rootObject()->findChild<QDeclarativeMouseArea*>("mouseregion");
+ QVERIFY(mouseRegion != 0);
+
+ QDeclarativeRectangle *rect = canvas->rootObject()->findChild<QDeclarativeRectangle*>("brother");
+ QVERIFY(rect != 0);
+
+ QCOMPARE(mouseRegion->mouseX(), 0.0);
+ QCOMPARE(mouseRegion->mouseY(), 0.0);
+
+ QGraphicsScene *scene = canvas->scene();
+ QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress);
+ event.setScenePos(rect->pos());
+ event.setButton(Qt::LeftButton);
+ event.setButtons(Qt::LeftButton);
+ QApplication::sendEvent(scene, &event);
+
+ QVERIFY(!mouseRegion->property("emitPositionChanged").toBool());
+ QVERIFY(mouseRegion->property("mouseMatchesPos").toBool());
+
+ QCOMPARE(mouseRegion->property("x1").toInt(), 0);
+ QCOMPARE(mouseRegion->property("y1").toInt(), 0);
+
+ // XXX: is it on purpose that mouseX is real and mouse.x is int?
+ QCOMPARE(mouseRegion->property("x2").toInt(), (int) rect->x());
+ QCOMPARE(mouseRegion->property("y2").toInt(), (int) rect->y());
+
+ QCOMPARE(mouseRegion->mouseX(), rect->x());
+ QCOMPARE(mouseRegion->mouseY(), rect->y());
+
+ delete canvas;
+}
+
void tst_QDeclarativeMouseArea::noOnClickedWithPressAndHold()
{
QDeclarativeView *canvas = createView();
diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
index 7d51bb6..53614fe 100644
--- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
+++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
@@ -310,7 +310,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object()
QCOMPARE(prop.propertyTypeName(), "int");
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0);
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Unable to assign null to int");
QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0);
QVERIFY(binding != 0);
QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data());
@@ -409,7 +409,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string()
QCOMPARE(prop.propertyTypeName(), "int");
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0);
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Unable to assign null to int");
QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0);
QVERIFY(binding != 0);
QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data());
@@ -602,7 +602,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_context()
QCOMPARE(prop.propertyTypeName(), "int");
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0);
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Unable to assign null to int");
QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0);
QVERIFY(binding != 0);
QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data());
@@ -701,7 +701,7 @@ void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context()
QCOMPARE(prop.propertyTypeName(), "int");
QCOMPARE(QString(prop.property().name()), QString("defaultProperty"));
QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0);
- QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Unable to assign null to int");
QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding.data()) == 0);
QVERIFY(binding != 0);
QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding.data());
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml
index d9b70ec..412c467 100644
--- a/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml
+++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml
@@ -1,19 +1,16 @@
import Qt 4.6
QtObject {
- property bool incorrectArgCount1: false
- property bool incorrectArgCount2: false
property bool emptyArg: false
property string relativeUrl
property string absoluteUrl
+ property QtObject incorectArgCount1: createComponent()
+ property QtObject incorectArgCount2: createComponent("main.qml", 10)
+
Component.onCompleted: {
- // Test that using incorrect argument count returns a null object
- incorrectArgCount1 = (createComponent() == null);
- incorrectArgCount2 = (createComponent("main.qml", 10) == null);
emptyArg = (createComponent("") == null);
-
var r = createComponent("createComponentData.qml");
relativeUrl = r.url;
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml b/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml
index 54a3e7d..8e6c58e 100644
--- a/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml
+++ b/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml
@@ -3,25 +3,25 @@ import Qt 4.6
Item {
id: root
- property bool incorrectArgCount1: false
- property bool incorrectArgCount2: false
+ // errors resulting in exceptions
+ property QtObject incorrectArgCount1: createQmlObject()
+ property QtObject incorrectArgCount2: createQmlObject("import Qt 4.6\nQtObject{}", root, "main.qml", 10)
+ property QtObject noParent: createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13}", 0)
+ property QtObject notAvailable: createQmlObject("import Qt 4.6\nQtObject{Blah{}}", root)
+ property QtObject errors: createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\nproperty int test: 13\n}", root, "main.qml")
+
property bool emptyArg: false
- property bool noParent: false
- property bool notAvailable: false
- property bool runtimeError: false
- property bool errors: false
property bool success: false
Component.onCompleted: {
- // errors
- incorrectArgCount1 = (createQmlObject() == null);
- incorrectArgCount2 = (createQmlObject("import Qt 4.6\nQtObject{}", root, "main.qml", 10) == null);
+ // errors resulting in nulls
emptyArg = (createQmlObject("", root) == null);
- errors = (createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\nproperty int test: 13\n}", root, "main.qml") == null);
- noParent = (createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13}", 0) == null);
- notAvailable = (createQmlObject("import Qt 4.6\nQtObject{Blah{}}", root) == null);
- runtimeError = (createQmlObject("import Qt 4.6\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root) == null);
+ try {
+ createQmlObject("import Qt 4.6\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root)
+ } catch (error) {
+ console.log("RunTimeError: ",error.message);
+ }
var o = createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\n}", root);
success = (o.test == 13);
diff --git a/tests/auto/declarative/qdeclarativeqt/data/hsla.qml b/tests/auto/declarative/qdeclarativeqt/data/hsla.qml
index df51ccd..142410b 100644
--- a/tests/auto/declarative/qdeclarativeqt/data/hsla.qml
+++ b/tests/auto/declarative/qdeclarativeqt/data/hsla.qml
@@ -5,7 +5,7 @@ QtObject {
property color test2: Qt.hsla(1, 0.5, 0.3);
property color test3: Qt.hsla(1, 1);
property color test4: Qt.hsla(1, 1, 1, 1, 1);
- property color test5: Qt.hsla(1.2, 1, 1);
- property color test6: Qt.hsla(-0.1, 1, 1);
+ property color test5: Qt.hsla(1.2, 1.3, 1.4, 1.5);
+ property color test6: Qt.hsla(-0.1, -0.2, -0.3, -0.4);
}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/rgba.qml b/tests/auto/declarative/qdeclarativeqt/data/rgba.qml
index 6dd6565..66305a4 100644
--- a/tests/auto/declarative/qdeclarativeqt/data/rgba.qml
+++ b/tests/auto/declarative/qdeclarativeqt/data/rgba.qml
@@ -5,6 +5,6 @@ QtObject {
property color test2: Qt.rgba(1, 0.5, 0.3);
property color test3: Qt.rgba(1, 1);
property color test4: Qt.rgba(1, 1, 1, 1, 1);
- property color test5: Qt.rgba(1.2, 1, 1);
- property color test6: Qt.rgba(-0.1, 1, 1);
+ property color test5: Qt.rgba(1.2, 1.3, 1.4, 1.5);
+ property color test6: Qt.rgba(-0.1, -0.2, -0.3, -0.4);
}
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index 98f1200..4d22b0a 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -102,14 +102,10 @@ void tst_qdeclarativeqt::rgba()
{
QDeclarativeComponent component(&engine, TEST_FILE("rgba.qml"));
- QString warning1 = component.url().toString() + ":6: Unable to assign null to QColor";
- QString warning2 = component.url().toString() + ":7: Unable to assign null to QColor";
- QString warning3 = component.url().toString() + ":8: Unable to assign null to QColor";
- QString warning4 = component.url().toString() + ":9: Unable to assign null to QColor";
+ QString warning1 = component.url().toString() + ":6: Error: expected 3 or 4 parameters";
+ QString warning2 = component.url().toString() + ":7: Error: expected 3 or 4 parameters";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -119,8 +115,8 @@ void tst_qdeclarativeqt::rgba()
QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0.5, 0.3, 1));
QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor());
QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
- QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
- QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor::fromRgbF(1, 1, 1, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor::fromRgbF(0, 0, 0, 0));
delete object;
}
@@ -129,14 +125,10 @@ void tst_qdeclarativeqt::hsla()
{
QDeclarativeComponent component(&engine, TEST_FILE("hsla.qml"));
- QString warning1 = component.url().toString() + ":6: Unable to assign null to QColor";
- QString warning2 = component.url().toString() + ":7: Unable to assign null to QColor";
- QString warning3 = component.url().toString() + ":8: Unable to assign null to QColor";
- QString warning4 = component.url().toString() + ":9: Unable to assign null to QColor";
+ QString warning1 = component.url().toString() + ":6: Error: expected 3 or 4 parameters";
+ QString warning2 = component.url().toString() + ":7: Error: expected 3 or 4 parameters";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -145,8 +137,8 @@ void tst_qdeclarativeqt::hsla()
QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromHslF(1, 0.5, 0.3, 1));
QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor());
QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
- QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
- QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor::fromHslF(1, 1, 1, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor::fromHslF(0, 0, 0, 0));
delete object;
}
@@ -154,6 +146,12 @@ void tst_qdeclarativeqt::hsla()
void tst_qdeclarativeqt::rect()
{
QDeclarativeComponent component(&engine, TEST_FILE("rect.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: expected 4 parameters";
+ QString warning2 = component.url().toString() + ":7: Error: expected 4 parameters";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
QObject *object = component.create();
QVERIFY(object != 0);
@@ -169,6 +167,12 @@ void tst_qdeclarativeqt::rect()
void tst_qdeclarativeqt::point()
{
QDeclarativeComponent component(&engine, TEST_FILE("point.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: expected 2 parameters";
+ QString warning2 = component.url().toString() + ":7: Error: expected 2 parameters";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
QObject *object = component.create();
QVERIFY(object != 0);
@@ -183,6 +187,12 @@ void tst_qdeclarativeqt::point()
void tst_qdeclarativeqt::size()
{
QDeclarativeComponent component(&engine, TEST_FILE("size.qml"));
+
+ QString warning1 = component.url().toString() + ":7: Error: expected 2 parameters";
+ QString warning2 = component.url().toString() + ":8: Error: expected 2 parameters";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
QObject *object = component.create();
QVERIFY(object != 0);
@@ -198,6 +208,12 @@ void tst_qdeclarativeqt::size()
void tst_qdeclarativeqt::vector()
{
QDeclarativeComponent component(&engine, TEST_FILE("vector.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: expected 3 parameters";
+ QString warning2 = component.url().toString() + ":7: Error: expected 3 parameters";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
QObject *object = component.create();
QVERIFY(object != 0);
@@ -212,6 +228,12 @@ void tst_qdeclarativeqt::vector()
void tst_qdeclarativeqt::lighter()
{
QDeclarativeComponent component(&engine, TEST_FILE("lighter.qml"));
+
+ QString warning1 = component.url().toString() + ":5: Error: expected 1 parameter";
+ QString warning2 = component.url().toString() + ":6: Error: expected 1 parameter";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
QObject *object = component.create();
QVERIFY(object != 0);
@@ -228,6 +250,12 @@ void tst_qdeclarativeqt::lighter()
void tst_qdeclarativeqt::darker()
{
QDeclarativeComponent component(&engine, TEST_FILE("darker.qml"));
+
+ QString warning1 = component.url().toString() + ":5: Error: expected 1 parameter";
+ QString warning2 = component.url().toString() + ":6: Error: expected 1 parameter";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
QObject *object = component.create();
QVERIFY(object != 0);
@@ -245,8 +273,9 @@ void tst_qdeclarativeqt::tint()
{
QDeclarativeComponent component(&engine, TEST_FILE("tint.qml"));
- QString warning1 = component.url().toString() + ":7: Unable to assign null to QColor";
- QString warning2 = component.url().toString() + ":8: Unable to assign null to QColor";
+ QString warning1 = component.url().toString() + ":7: Error: expected 2 parameters";
+ QString warning2 = component.url().toString() + ":8: Error: expected 2 parameters";
+
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
@@ -305,13 +334,15 @@ void tst_qdeclarativeqt::md5()
void tst_qdeclarativeqt::createComponent()
{
QDeclarativeComponent component(&engine, TEST_FILE("createComponent.qml"));
+
+ QString warning1 = component.url().toString() + ":9: Error: expected 1 parameter";
+ QString warning2 = component.url().toString() + ":10: Error: expected 1 parameter";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
QObject *object = component.create();
QVERIFY(object != 0);
- QCOMPARE(object->property("incorrectArgCount1").toBool(), true);
- QCOMPARE(object->property("incorrectArgCount2").toBool(), true);
- QCOMPARE(object->property("emptyArg").toBool(), true);
-
QCOMPARE(object->property("absoluteUrl").toString(), QString("http://www.example.com/test.qml"));
QCOMPARE(object->property("relativeUrl").toString(), TEST_FILE("createComponentData.qml").toString());
@@ -322,30 +353,24 @@ void tst_qdeclarativeqt::createQmlObject()
{
QDeclarativeComponent component(&engine, TEST_FILE("createQmlObject.qml"));
- QString warning1 = "QDeclarativeEngine::createQmlObject():";
- QString warning2 = " " + TEST_FILE("main.qml").toString() + ":4:1: Duplicate property name";
- QString warning3 = "QDeclarativeEngine::createQmlObject():";
- QString warning4 = " " + TEST_FILE("inline").toString() + ":2:10: Blah is not a type";
- QString warning5 = "QDeclarativeEngine::createQmlObject():";
- QString warning6 = " " + TEST_FILE("inline").toString() + ":3: Cannot assign object type QObject with no default method";
+ QString warning1 = component.url().toString() + ":7: Error: expected 2 or 3 parameters";
+ QString warning2 = component.url().toString()+ ":10: Error: Qt.createQmlObject(): " + TEST_FILE("inline").toString() + ":2:10: Blah is not a type\n";
+ QString warning3 = component.url().toString()+ ":11: Error: Qt.createQmlObject(): " + TEST_FILE("main.qml").toString() + ":4:1: Duplicate property name\n";
+ QString warning4 = component.url().toString()+ ":9: Error: parent object not found";
+ QString warning5 = component.url().toString()+ ":8: Error: expected 2 or 3 parameters";
+ QString warning6 = "RunTimeError: Qt.createQmlObject(): " + TEST_FILE("inline").toString() + ":3: Cannot assign object type QObject with no default method\n";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning5));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning6));
+ QTest::ignoreMessage(QtDebugMsg, qPrintable(warning6));
QObject *object = component.create();
QVERIFY(object != 0);
- QCOMPARE(object->property("incorrectArgCount1").toBool(), true);
- QCOMPARE(object->property("incorrectArgCount2").toBool(), true);
QCOMPARE(object->property("emptyArg").toBool(), true);
- QCOMPARE(object->property("errors").toBool(), true);
- QCOMPARE(object->property("noParent").toBool(), true);
- QCOMPARE(object->property("notAvailable").toBool(), true);
- QCOMPARE(object->property("runtimeError").toBool(), true);
QCOMPARE(object->property("success").toBool(), true);
QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(object);
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
index 578bcb4..bd3186a 100644
--- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
+++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp
@@ -68,8 +68,6 @@ private:
int m_prop;
};
-QML_DECLARE_TYPE(MyRect)
-
class tst_qdeclarativestates : public QObject
{
@@ -522,7 +520,7 @@ void tst_qdeclarativestates::parentChangeErrors()
QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"));
QVERIFY(innerRect != 0);
- QTest::ignoreMessage(QtWarningMsg, QByteArray("QML ParentChange (" + fullDataPath("/data/parentChange4.qml") + ":25:9) Unable to preserve appearance under non-uniform scale").constData());
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/parentChange4.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under non-uniform scale");
rect->setState("reparented");
QCOMPARE(innerRect->rotation(), qreal(0));
QCOMPARE(innerRect->scale(), qreal(1));
@@ -538,7 +536,7 @@ void tst_qdeclarativestates::parentChangeErrors()
QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"));
QVERIFY(innerRect != 0);
- QTest::ignoreMessage(QtWarningMsg, QByteArray("QML ParentChange (" + fullDataPath("/data/parentChange5.qml") + ":25:9) Unable to preserve appearance under complex transform").constData());
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/parentChange5.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under complex transform");
rect->setState("reparented");
QCOMPARE(innerRect->rotation(), qreal(0));
QCOMPARE(innerRect->scale(), qreal(1));
@@ -813,8 +811,8 @@ void tst_qdeclarativestates::propertyErrors()
QCOMPARE(rect->color(),QColor("red"));
- QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/propertyErrors.qml") + ":8:9) Cannot assign to non-existent property \"colr\"").constData());
- QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/propertyErrors.qml") + ":8:9) Cannot assign to read-only property \"wantsFocus\"").constData());
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\"");
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to read-only property \"wantsFocus\"");
rect->setState("blue");
}
@@ -946,7 +944,7 @@ void tst_qdeclarativestates::illegalTempState()
QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
- QTest::ignoreMessage(QtWarningMsg, "Can't apply a state change as part of a state definition. ");
+ QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML StateGroup: Can't apply a state change as part of a state definition.");
rect->setState("placed");
QCOMPARE(rect->state(), QLatin1String("placed"));
}
@@ -959,7 +957,7 @@ void tst_qdeclarativestates::nonExistantProperty()
QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
- QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/nonExistantProp.qml") + ":9:9) Cannot assign to non-existent property \"colr\"").constData());
+ QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/nonExistantProp.qml") + ":9:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\"");
rect->setState("blue");
QCOMPARE(rect->state(), QLatin1String("blue"));
}
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index edb4a32..551e17b 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -871,10 +871,10 @@ void tst_qdeclarativetext::embeddedImages_data()
QTest::addColumn<QString>("error");
QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesLocal.qml") << "";
QTest::newRow("local-error") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesLocalError.qml")
- << "QML Text ("+QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesLocalError.qml").toString()+":3:1) Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/http/notexists.png").toString();
+ << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesLocalError.qml").toString()+":3:1: QML Text: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/http/notexists.png").toString();
QTest::newRow("remote") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesRemote.qml") << "";
QTest::newRow("remote-error") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesRemoteError.qml")
- << "QML Text ("+QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesRemoteError.qml").toString()+":3:1) Error downloading http://127.0.0.1:14453/notexists.png - server replied: Not found";
+ << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesRemoteError.qml").toString()+":3:1: QML Text: Error downloading http://127.0.0.1:14453/notexists.png - server replied: Not found";
}
void tst_qdeclarativetext::embeddedImages()
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 25101ba..3307b7c 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -649,7 +649,7 @@ void tst_qdeclarativetextedit::delegateLoading_data()
// import installed
QTest::newRow("pass") << "cursorHttpTestPass.qml" << "";
- QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << ":-1: Network error for URL http://localhost:42332/FailItem.qml ";
+ QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << "<Unknown File>: Network error for URL http://localhost:42332/FailItem.qml ";
QTest::newRow("fail2") << "cursorHttpTestFail2.qml" << "http://localhost:42332/ErrItem.qml:4:5: Fungus is not a type ";
}
diff --git a/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp
index a08a91c..da2d173 100644
--- a/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp
+++ b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp
@@ -43,6 +43,7 @@
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
#include <private/qdeclarativetimer_p.h>
+#include <QtDeclarative/qdeclarativeitem.h>
#include <QDebug>
class tst_qdeclarativetimer : public QObject
@@ -60,6 +61,7 @@ private slots:
void triggeredOnStartRepeat();
void changeDuration();
void restart();
+ void parentProperty();
};
class TimerHelper : public QObject
@@ -317,6 +319,21 @@ void tst_qdeclarativetimer::restart()
delete timer;
}
+void tst_qdeclarativetimer::parentProperty()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine);
+ component.setData(QByteArray("import Qt 4.7\nItem { Timer { objectName: \"timer\"; running: parent.visible } }"), QUrl::fromLocalFile(""));
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(item != 0);
+ QDeclarativeTimer *timer = item->findChild<QDeclarativeTimer*>("timer");
+ QVERIFY(timer != 0);
+
+ QVERIFY(timer->isRunning());
+
+ delete timer;
+}
+
QTEST_MAIN(tst_qdeclarativetimer)
#include "tst_qdeclarativetimer.moc"
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
index dd13429..8a9b981 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
+++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
@@ -133,7 +133,6 @@ signals:
public slots:
QSize method() { return QSize(13, 14); }
};
-QML_DECLARE_TYPE(MyTypeObject);
class MyConstantValueSource : public QObject, public QDeclarativePropertyValueSource
{
@@ -142,7 +141,6 @@ class MyConstantValueSource : public QObject, public QDeclarativePropertyValueSo
public:
virtual void setTarget(const QDeclarativeProperty &p) { p.write(3345); }
};
-QML_DECLARE_TYPE(MyConstantValueSource);
class MyOffsetValueInterceptor : public QObject, public QDeclarativePropertyValueInterceptor
{
@@ -155,7 +153,6 @@ public:
private:
QDeclarativeProperty prop;
};
-QML_DECLARE_TYPE(MyOffsetValueInterceptor);
void registerTypes();
diff --git a/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml b/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml
new file mode 100644
index 0000000..27c8454
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml
@@ -0,0 +1,5 @@
+import Qt 4.7
+Item {
+ width: 200
+ height: 200
+}
diff --git a/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml b/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml
new file mode 100644
index 0000000..964810c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml
@@ -0,0 +1,5 @@
+import Qt 4.7
+QGraphicsWidget {
+ width: 200
+ height: 200
+}
diff --git a/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro
new file mode 100644
index 0000000..d6be728
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative gui
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qdeclarativeview.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp
new file mode 100644
index 0000000..1ed51c1
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp
@@ -0,0 +1,272 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QSignalSpy>
+#include <QtDeclarative/qdeclarativecomponent.h>
+#include <QtDeclarative/qdeclarativecontext.h>
+#include <QtDeclarative/qdeclarativeview.h>
+#include <QtDeclarative/qdeclarativeitem.h>
+#include <QtGui/qgraphicswidget.h>
+
+class tst_QDeclarativeView : public QObject
+
+{
+ Q_OBJECT
+public:
+ tst_QDeclarativeView();
+
+private slots:
+ void resizemodedeclarativeitem();
+ void resizemodegraphicswidget();
+
+private:
+ template<typename T>
+ T *findItem(QGraphicsObject *parent, const QString &objectName);
+};
+
+
+tst_QDeclarativeView::tst_QDeclarativeView()
+{
+}
+
+void tst_QDeclarativeView::resizemodedeclarativeitem()
+{
+ QWidget window;
+ QDeclarativeView *canvas = new QDeclarativeView(&window);
+ QVERIFY(canvas);
+ QSignalSpy sceneResizedSpy(canvas, SIGNAL(sceneResized(QSize)));
+ canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodedeclarativeitem.qml"));
+ QDeclarativeItem* declarativeItem = qobject_cast<QDeclarativeItem*>(canvas->rootObject());
+ QVERIFY(declarativeItem);
+ window.show();
+
+ // initial size from root object
+ QCOMPARE(declarativeItem->width(), 200.0);
+ QCOMPARE(declarativeItem->height(), 200.0);
+ QCOMPARE(canvas->size(), QSize(200, 200));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy.count(), 1);
+
+ // size update from view
+ canvas->resize(QSize(80,100));
+ QCOMPARE(declarativeItem->width(), 80.0);
+ QCOMPARE(declarativeItem->height(), 100.0);
+ QCOMPARE(canvas->size(), QSize(80, 100));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy.count(), 2);
+
+ canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject);
+
+ // size update from view disabled
+ canvas->resize(QSize(60,80));
+ QCOMPARE(declarativeItem->width(), 80.0);
+ QCOMPARE(declarativeItem->height(), 100.0);
+ QCOMPARE(canvas->size(), QSize(60, 80));
+ QCOMPARE(sceneResizedSpy.count(), 3);
+
+ // size update from root object
+ declarativeItem->setWidth(250);
+ declarativeItem->setHeight(350);
+ qApp->processEvents();
+ QCOMPARE(declarativeItem->width(), 250.0);
+ QCOMPARE(declarativeItem->height(), 350.0);
+ QCOMPARE(canvas->size(), QSize(250, 350));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy.count(), 4);
+
+ // reset canvas
+ window.hide();
+ delete canvas;
+ canvas = new QDeclarativeView(&window);
+ QVERIFY(canvas);
+ QSignalSpy sceneResizedSpy2(canvas, SIGNAL(sceneResized(QSize)));
+ canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodedeclarativeitem.qml"));
+ declarativeItem = qobject_cast<QDeclarativeItem*>(canvas->rootObject());
+ QVERIFY(declarativeItem);
+ window.show();
+
+ // initial size for root object
+ QCOMPARE(declarativeItem->width(), 200.0);
+ QCOMPARE(declarativeItem->height(), 200.0);
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 1);
+
+ // size update from root object
+ declarativeItem->setWidth(80);
+ declarativeItem->setHeight(100);
+ qApp->processEvents();
+ QCOMPARE(declarativeItem->width(), 80.0);
+ QCOMPARE(declarativeItem->height(), 100.0);
+ QCOMPARE(canvas->size(), QSize(80, 100));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 2);
+
+ // size update from root object disabled
+ canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ declarativeItem->setWidth(60);
+ declarativeItem->setHeight(80);
+ QCOMPARE(canvas->width(), 80);
+ QCOMPARE(canvas->height(), 100);
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 2);
+
+ // size update from view
+ canvas->resize(QSize(200,300));
+ QCOMPARE(declarativeItem->width(), 200.0);
+ QCOMPARE(declarativeItem->height(), 300.0);
+ QCOMPARE(canvas->size(), QSize(200, 300));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 3);
+
+ delete canvas;
+}
+
+void tst_QDeclarativeView::resizemodegraphicswidget()
+{
+ QWidget window;
+ QDeclarativeView *canvas = new QDeclarativeView(&window);
+ QVERIFY(canvas);
+ QSignalSpy sceneResizedSpy(canvas, SIGNAL(sceneResized(QSize)));
+ canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodegraphicswidget.qml"));
+ QGraphicsWidget* graphicsWidget = qobject_cast<QGraphicsWidget*>(canvas->rootObject());
+ QVERIFY(graphicsWidget);
+ window.show();
+
+ // initial size from root object
+ QCOMPARE(graphicsWidget->size(), QSizeF(200.0, 200.0));
+ QCOMPARE(canvas->size(), QSize(200, 200));
+ QCOMPARE(canvas->size(), QSize(200, 200));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy.count(), 1);
+
+ // size update from view
+ canvas->resize(QSize(80,100));
+ QCOMPARE(graphicsWidget->size(), QSizeF(80.0,100.0));
+ QCOMPARE(canvas->size(), QSize(80,100));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy.count(), 2);
+
+ // size update from view disabled
+ canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject);
+ canvas->resize(QSize(60,80));
+ QCOMPARE(graphicsWidget->size(), QSizeF(80.0,100.0));
+ QCOMPARE(canvas->size(), QSize(60, 80));
+ QCOMPARE(sceneResizedSpy.count(), 3);
+
+ // size update from root object
+ graphicsWidget->resize(QSizeF(250.0, 350.0));
+ QCOMPARE(graphicsWidget->size(), QSizeF(250.0,350.0));
+ QCOMPARE(canvas->size(), QSize(250, 350));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy.count(), 4);
+
+ // reset canvas
+ window.hide();
+ delete canvas;
+ canvas = new QDeclarativeView(&window);
+ QVERIFY(canvas);
+ QSignalSpy sceneResizedSpy2(canvas, SIGNAL(sceneResized(QSize)));
+ canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodegraphicswidget.qml"));
+ graphicsWidget = qobject_cast<QGraphicsWidget*>(canvas->rootObject());
+ QVERIFY(graphicsWidget);
+ window.show();
+
+ // initial size from root object
+ QCOMPARE(graphicsWidget->size(), QSizeF(200.0, 200.0));
+ QCOMPARE(canvas->size(), QSize(200, 200));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 1);
+
+ // size update from root object
+ graphicsWidget->resize(QSizeF(80, 100));
+ QCOMPARE(graphicsWidget->size(), QSizeF(80.0, 100.0));
+ QCOMPARE(canvas->size(), QSize(80, 100));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 2);
+
+ // size update from root object disabled
+ canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ graphicsWidget->resize(QSizeF(60,80));
+ QCOMPARE(canvas->size(), QSize(80,100));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 2);
+
+ // size update from view
+ canvas->resize(QSize(200,300));
+ QCOMPARE(graphicsWidget->size(), QSizeF(200.0, 300.0));
+ QCOMPARE(canvas->size(), QSize(200, 300));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 3);
+
+ window.show();
+ delete canvas;
+}
+
+template<typename T>
+T *tst_QDeclarativeView::findItem(QGraphicsObject *parent, const QString &objectName)
+{
+ if (!parent)
+ return 0;
+
+ const QMetaObject &mo = T::staticMetaObject;
+ //qDebug() << parent->QGraphicsObject::children().count() << "children";
+ for (int i = 0; i < parent->childItems().count(); ++i) {
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i));
+ if(!item)
+ continue;
+ //qDebug() << "try" << item;
+ if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName))
+ return static_cast<T*>(item);
+ item = findItem<T>(item, objectName);
+ if (item)
+ return static_cast<T*>(item);
+ }
+
+ return 0;
+}
+
+QTEST_MAIN(tst_QDeclarativeView)
+
+#include "tst_qdeclarativeview.moc"
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeflipable/data/test_flipable_resize.qml b/tests/auto/declarative/qmlvisual/qdeclarativeflipable/data/test_flipable_resize.qml
new file mode 100644
index 0000000..6e5f7a0
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/qdeclarativeflipable/data/test_flipable_resize.qml
@@ -0,0 +1,207 @@
+import Qt.VisualTest 4.6
+
+VisualTest {
+ Frame {
+ msec: 0
+ }
+ Frame {
+ msec: 16
+ hash: "04382a80a203e1fe3d0d4944c9195e0b"
+ }
+ Frame {
+ msec: 32
+ hash: "8d8c6a3c37ba3cb77afcc7ed4234d40f"
+ }
+ Frame {
+ msec: 48
+ hash: "93ab01494e2229c0921c25d3acbcffe6"
+ }
+ Frame {
+ msec: 64
+ hash: "5036bf3c842e5ad09b7bac5512e433ad"
+ }
+ Frame {
+ msec: 80
+ hash: "ef02ef4598fbe6390391b7f2c17ec99d"
+ }
+ Frame {
+ msec: 96
+ hash: "7fa83afca86cfec48a4986ba3df08e3b"
+ }
+ Frame {
+ msec: 112
+ hash: "d9388827bd7755bb9bc1ef78507cc0ac"
+ }
+ Frame {
+ msec: 128
+ hash: "d18778f4f748f7ee54404db334831ff7"
+ }
+ Frame {
+ msec: 144
+ hash: "fee69ae3b4d79b795d4443b055a8a91a"
+ }
+ Frame {
+ msec: 160
+ hash: "f80fa0131c859286e900071b51e74784"
+ }
+ Frame {
+ msec: 176
+ hash: "b654e51ea71ec118e6b985743281b6a1"
+ }
+ Frame {
+ msec: 192
+ hash: "91c771226e9c97e0f00c6f7c6fc6c95c"
+ }
+ Frame {
+ msec: 208
+ hash: "0f612f81541b093442e68d99e00c288c"
+ }
+ Frame {
+ msec: 224
+ hash: "246b619598606fef9f0442439cee4ec6"
+ }
+ Frame {
+ msec: 240
+ hash: "1d2f34459b2128877218cef340f46f06"
+ }
+ Frame {
+ msec: 256
+ hash: "af3c2eef734da05d45484bbb19646425"
+ }
+ Frame {
+ msec: 272
+ hash: "85dfe5680e47919500728de6e93c8290"
+ }
+ Frame {
+ msec: 288
+ hash: "8fd7d439bafa07461a65a3c97cf8602a"
+ }
+ Frame {
+ msec: 304
+ hash: "1ebf543a84aae4abfd480f24ad362cb0"
+ }
+ Frame {
+ msec: 320
+ hash: "60a9c9300981282986659e7c73d381b0"
+ }
+ Frame {
+ msec: 336
+ hash: "686f3ff048f2b214033988d989ed087a"
+ }
+ Frame {
+ msec: 352
+ hash: "24694e17476b0ffe9848159aa282e931"
+ }
+ Frame {
+ msec: 368
+ hash: "c05e1bdf62e3e58972f868b930823a58"
+ }
+ Frame {
+ msec: 384
+ hash: "cbc1a3c78b8f79047d1221d5ae06f0f8"
+ }
+ Frame {
+ msec: 400
+ hash: "05ad366e74bf30b1619cf2ef1f530d82"
+ }
+ Frame {
+ msec: 416
+ hash: "4c5c536f2c03ecfb7d3d8f56638001ec"
+ }
+ Frame {
+ msec: 432
+ hash: "9754048ffcb7863a8a676e5bee4a7991"
+ }
+ Frame {
+ msec: 448
+ hash: "047aa8203ad18023f5af340a41f1084e"
+ }
+ Frame {
+ msec: 464
+ hash: "1351b7c92cd873db387e93dc74cca848"
+ }
+ Frame {
+ msec: 480
+ hash: "4066f52fae753013396195dc98311058"
+ }
+ Frame {
+ msec: 496
+ hash: "21d969b92993e428e79babb574e9203d"
+ }
+ Frame {
+ msec: 512
+ hash: "62c00f52e8b0592fbb59f88deb3b022e"
+ }
+ Frame {
+ msec: 528
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Frame {
+ msec: 544
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Frame {
+ msec: 560
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Frame {
+ msec: 576
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Frame {
+ msec: 592
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Frame {
+ msec: 608
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Frame {
+ msec: 624
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Frame {
+ msec: 640
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Frame {
+ msec: 656
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Frame {
+ msec: 672
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Frame {
+ msec: 688
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Frame {
+ msec: 704
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Frame {
+ msec: 720
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Key {
+ type: 6
+ key: 16777249
+ modifiers: 67108864
+ text: ""
+ autorep: false
+ count: 1
+ }
+ Frame {
+ msec: 736
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Frame {
+ msec: 752
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+ Frame {
+ msec: 768
+ hash: "322719dee40d3495e9b4d2faac351e89"
+ }
+}
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativeflipable/test_flipable_resize.qml b/tests/auto/declarative/qmlvisual/qdeclarativeflipable/test_flipable_resize.qml
new file mode 100644
index 0000000..5a73e67
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/qdeclarativeflipable/test_flipable_resize.qml
@@ -0,0 +1,62 @@
+import Qt 4.6
+Item { //realWindow
+ width: 370
+ height: 480
+ Item {
+ id: window
+ NumberAnimation on width{ from:320; to:370; duration: 500 }
+ NumberAnimation on height{ from:480; to:320; duration: 500 }
+ Flipable {
+ id: flipable
+ x: 0
+ y: window.height / 3.0 - 40
+ width: parent.width
+ height: parent.height
+ transform: Rotation {
+ id: transform
+ origin.x: window.width / 2.0
+ origin.y: 0
+ origin.z: 0
+ axis.x: 0
+ axis.y: 1
+ axis.z: 0
+ angle: 0;
+ }
+ front: Rectangle{
+ width: parent.width
+ height: 80
+ color: "blue"
+ }back: Rectangle{
+ width: parent.width
+ height: 80
+ color: "red"
+ }
+ }
+ Flipable {
+ id: flipableBack
+ x: 0
+ y: 2.0 * window.height / 3.0 - 40
+ width: parent.width
+ height: parent.height
+ transform: Rotation {
+ id: transformBack
+ origin.x: window.width / 2.0
+ origin.y: 0
+ origin.z: 0
+ axis.x: 0
+ axis.y: 1
+ axis.z: 0
+ angle: 180;
+ }
+ front: Rectangle{
+ width: parent.width
+ height: 80
+ color: "blue"
+ }back: Rectangle{
+ width: parent.width
+ height: 80
+ color: "red"
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp
index 2621d65..b8e317e 100644
--- a/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp
+++ b/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp
@@ -111,14 +111,6 @@ void tst_QPacketProtocol::setMaximumPacketSize()
QPacketProtocol out(m_serverConn);
QCOMPARE(out.setMaximumPacketSize(size), expected);
-
- if (size == expected) {
- QPacketProtocol in(m_client);
- QByteArray b;
- b.fill('a', size + 1);
- out.send() << b.constData();
- QVERIFY(QDeclarativeDebugTest::waitForSignal(&in, SIGNAL(invalidPacket())));
- }
}
void tst_QPacketProtocol::setMaximumPacketSize_data()
diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp
index 66f04e5..c0c3eca 100644
--- a/tests/auto/declarative/shared/debugutil.cpp
+++ b/tests/auto/declarative/shared/debugutil.cpp
@@ -47,11 +47,11 @@
#include "debugutil_p.h"
-#include <iostream>
bool QDeclarativeDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) {
QEventLoop loop;
QTimer timer;
+ timer.setSingleShot(true);
QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
QObject::connect(receiver, member, &loop, SLOT(quit()));
timer.start(timeout);
@@ -59,25 +59,6 @@ bool QDeclarativeDebugTest::waitForSignal(QObject *receiver, const char *member,
return timer.isActive();
}
-
-QDeclarativeDebugTestData::QDeclarativeDebugTestData(QEventLoop *el)
- : exitCode(-1), loop(el)
-{
-}
-
-QDeclarativeDebugTestData::~QDeclarativeDebugTestData()
-{
- qDeleteAll(items);
-}
-
-void QDeclarativeDebugTestData::testsFinished(int code)
-{
- exitCode = code;
- loop->quit();
-}
-
-
-
QDeclarativeDebugTestService::QDeclarativeDebugTestService(const QString &s, QObject *parent)
: QDeclarativeDebugService(s, parent), enabled(false)
{
@@ -117,63 +98,3 @@ void QDeclarativeDebugTestClient::messageReceived(const QByteArray &ba)
emit serverMessage(ba);
}
-
-tst_QDeclarativeDebug_Thread::tst_QDeclarativeDebug_Thread(QDeclarativeDebugTestData *data, QDeclarativeTestFactory *factory)
- : m_data(data), m_factory(factory)
-{
-}
-
-void tst_QDeclarativeDebug_Thread::run()
-{
- bool ok = false;
-
- QDeclarativeDebugConnection conn;
- conn.connectToHost("127.0.0.1", 3768);
- ok = conn.waitForConnected();
- Q_ASSERT(ok);
-
- QEventLoop loop;
- connect(m_data, SIGNAL(engineCreated()), &loop, SLOT(quit()));
- loop.exec();
-
- m_data->conn = &conn;
-
- Q_ASSERT(m_factory);
- QObject *test = m_factory->createTest(m_data);
- Q_ASSERT(test);
- int code = QTest::qExec(test, QCoreApplication::arguments());
- delete test;
- emit testsFinished(code);
-}
-
-int QDeclarativeDebugTest::runTests(QDeclarativeTestFactory *factory, const QList<QByteArray> &qml)
-{
- qputenv("QML_DEBUG_SERVER_PORT", "3768");
-
- QEventLoop loop;
- QDeclarativeDebugTestData data(&loop);
-
- tst_QDeclarativeDebug_Thread thread(&data, factory);
- QObject::connect(&thread, SIGNAL(testsFinished(int)), &data, SLOT(testsFinished(int)));
-
- QDeclarativeDebugService::notifyOnServerStart(&thread, "start");
-
- QDeclarativeEngine engine; // blocks until client connects
-
- foreach (const QByteArray &code, qml) {
- QDeclarativeComponent c(&engine);
- c.setData(code, QUrl::fromLocalFile(""));
- Q_ASSERT(c.isReady()); // fails if bad syntax
- data.items << qobject_cast<QDeclarativeItem*>(c.create());
- }
-
- // start the test
- data.engine = &engine;
- emit data.engineCreated();
-
- loop.exec();
- thread.wait();
-
- return data.exitCode;
-}
-
diff --git a/tests/auto/declarative/shared/debugutil_p.h b/tests/auto/declarative/shared/debugutil_p.h
index c152b5a..e6bb7ad 100644
--- a/tests/auto/declarative/shared/debugutil_p.h
+++ b/tests/auto/declarative/shared/debugutil_p.h
@@ -51,50 +51,10 @@
#include <private/qdeclarativedebugservice_p.h>
#include <private/qdeclarativeitem_p.h>
-class QDeclarativeTestFactory;
-
class QDeclarativeDebugTest
{
public:
static bool waitForSignal(QObject *receiver, const char *member, int timeout = 5000);
-
- static int runTests(QDeclarativeTestFactory *factory, const QList<QByteArray> &qml = QList<QByteArray>());
-};
-
-class QDeclarativeDebugTestData : public QObject
-{
- Q_OBJECT
-public:
- QDeclarativeDebugTestData(QEventLoop *el);
-
- ~QDeclarativeDebugTestData();
-
- QDeclarativeDebugConnection *conn;
- QDeclarativeEngine *engine;
-
- int exitCode;
- QEventLoop *loop;
-
- QList<QDeclarativeItem *> items;
-
-signals:
- void engineCreated();
-
-public slots:
- void testsFinished(int code);
-
-private:
- friend class QDeclarativeDebugTest;
-};
-
-
-class QDeclarativeTestFactory
-{
-public:
- QDeclarativeTestFactory() {}
- virtual ~QDeclarativeTestFactory() {}
-
- virtual QObject *createTest(QDeclarativeDebugTestData *data) = 0;
};
class QDeclarativeDebugTestService : public QDeclarativeDebugService
@@ -131,20 +91,4 @@ private:
QByteArray lastMsg;
};
-class tst_QDeclarativeDebug_Thread : public QThread
-{
- Q_OBJECT
-public:
- tst_QDeclarativeDebug_Thread(QDeclarativeDebugTestData *data, QDeclarativeTestFactory *factory);
-
- void run();
-
-signals:
- void testsFinished(int);
-
-private:
- QDeclarativeDebugTestData *m_data;
- QDeclarativeTestFactory *m_factory;
-};
-
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index a5dc7b7..23a3ef1 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -4437,7 +4437,9 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node,
out() << "<tr><td>";
out() << "<a name=\"" + refForNode(qpn) + "\"></a>";
if (!qpn->isWritable())
- out() << "<span class=\"qmlreadonly\">read-only</span>";
+ out() << "<span class=\"qmlreadonly\">read-only&nbsp;</span>";
+ if (qpgn->isDefault())
+ out() << "<span class=\"qmldefault\">default&nbsp;</span>";
generateQmlItem(qpn, relative, marker, false);
out() << "</td></tr>";
if (qpgn->isDefault()) {
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 45c2b85..15e8f64 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -88,6 +88,8 @@ void usage()
qWarning(" -skin <qvfbskindir> ...................... run with a skin window frame");
qWarning(" \"list\" for a list of built-ins");
qWarning(" -resizeview .............................. resize the view, not the skin");
+ qWarning(" -sizeviewtorootobject .................... the view resizes to the changes in the content");
+ qWarning(" -sizerootobjecttoview .................... the content resizes to the changes in the view");
qWarning(" -qmlbrowser .............................. use a QML-based file browser");
qWarning(" -recordfile <output> ..................... set video recording file");
qWarning(" - ImageMagick 'convert' for GIF)");
@@ -184,6 +186,7 @@ int main(int argc, char ** argv)
bool stayOnTop = false;
bool maximized = false;
bool useNativeFileBrowser = true;
+ bool sizeToView = true;
#if defined(Q_OS_SYMBIAN)
maximized = true;
@@ -270,6 +273,10 @@ int main(int argc, char ** argv)
if (lastArg) usage();
script = QString(argv[++i]);
runScript = true;
+ } else if (arg == "-sizeviewtorootobject") {
+ sizeToView = false;
+ } else if (arg == "-sizerootobjecttoview") {
+ sizeToView = true;
} else if (arg[0] != '-') {
fileName = arg;
} else if (1 || arg == "-help") {
@@ -339,6 +346,7 @@ int main(int argc, char ** argv)
viewer.setNetworkCacheSize(cache);
viewer.setRecordFile(recordfile);
+ viewer.setSizeToView(sizeToView);
if (resizeview)
viewer.setScaleView();
if (fps>0)
@@ -390,6 +398,5 @@ int main(int argc, char ** argv)
}
viewer.setUseGL(useGL);
viewer.raise();
-
return app.exec();
}
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index 53409c1..7b4706b 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -496,7 +496,7 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
canvas = new QDeclarativeView(this);
canvas->setAttribute(Qt::WA_OpaquePaintEvent);
canvas->setAttribute(Qt::WA_NoSystemBackground);
- canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject);
+
canvas->setFocus();
QObject::connect(canvas, SIGNAL(sceneResized(QSize)), this, SLOT(sceneResized(QSize)));
@@ -519,7 +519,6 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags)
#else
setCentralWidget(canvas);
#endif
-
namFactory = new NetworkAccessManagerFactory;
canvas->engine()->setNetworkAccessManagerFactory(namFactory);
@@ -753,10 +752,11 @@ void QDeclarativeViewer::setScaleSkin()
if (scaleSkin)
return;
scaleSkin = true;
- canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject);
if (skin) {
- canvas->setFixedSize(canvas->sizeHint());
- skin->setScreenSize(canvas->sizeHint());
+ canvas->resize(initialSize);
+ canvas->setFixedSize(initialSize);
+ canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject);
+ updateSizeHints();
}
}
@@ -766,11 +766,8 @@ void QDeclarativeViewer::setScaleView()
return;
scaleSkin = false;
if (skin) {
- canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject);
- canvas->setMinimumSize(QSize(0,0));
- canvas->setMaximumSize(QSize(16777215,16777215));
- canvas->resize(skin->standardScreenSize());
- skin->setScreenSize(skin->standardScreenSize());
+ canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ updateSizeHints();
}
}
@@ -916,19 +913,12 @@ void QDeclarativeViewer::statusChanged()
tester->executefailure();
if (canvas->status() == QDeclarativeView::Ready) {
- if (!skin) {
- canvas->updateGeometry();
- if (mb)
- mb->updateGeometry();
- if (!isFullScreen() && !isMaximized())
- resize(sizeHint());
- } else {
- if (scaleSkin)
- canvas->resize(canvas->sizeHint());
- else {
- canvas->setFixedSize(skin->standardScreenSize());
- canvas->resize(skin->standardScreenSize());
- }
+ initialSize = canvas->sizeHint();
+ if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) {
+ QSize newWindowSize = initialSize;
+ newWindowSize.setHeight(newWindowSize.height()+menuBar()->height());
+ updateSizeHints();
+ resize(newWindowSize);
}
}
}
@@ -1010,7 +1000,6 @@ bool QDeclarativeViewer::open(const QString& file_or_url)
t.start();
canvas->setSource(url);
-
qWarning() << "Wall startup time:" << t.elapsed();
return true;
@@ -1056,41 +1045,43 @@ void QDeclarativeViewer::setSkin(const QString& skinDirOrName)
skin->deleteLater();
}
- canvas->setResizeMode((!skin || !scaleSkin) ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject);
-
DeviceSkinParameters parameters;
if (!skinDirectory.isEmpty() && parameters.read(skinDirectory,DeviceSkinParameters::ReadAll,&err)) {
layout()->setEnabled(false);
- //setMenuBar(0);
if (mb)
mb->hide();
if (!err.isEmpty())
qWarning() << err;
skin = new PreviewDeviceSkin(parameters,this);
- canvas->resize(canvas->sizeHint());
if (scaleSkin)
skin->setPreviewAndScale(canvas);
else
skin->setPreview(canvas);
createMenu(0,skin->menu);
+ if (scaleSkin) {
+ canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject);
+ }
+ updateSizeHints();
skin->show();
- } else {
+ } else if (skin) {
skin = 0;
clearMask();
menuBar()->clear();
- canvas->setParent(this, Qt::SubWindow);
createMenu(menuBar(),0);
- mb->show();
- setMinimumSize(QSize(0,0));
- setMaximumSize(QSize(16777215,16777215));
- canvas->setMinimumSize(QSize(0,0));
- canvas->setMaximumSize(QSize(16777215,16777215));
- QRect g = geometry();
- g.setSize(sizeHint());
+ canvas->setParent(this, Qt::SubWindow);
setParent(0,windowFlags()); // recreate
- canvas->move(0,menuBar()->sizeHint().height());
- setGeometry(g);
+ mb->show();
+ canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ updateSizeHints();
+
layout()->setEnabled(true);
+ if (!scaleSkin) {
+ canvas->resize(initialSize);
+ canvas->setFixedSize(initialSize);
+ }
+ QSize newWindowSize = canvas->size();
+ newWindowSize.setHeight(newWindowSize.height()+menuBar()->height());
+ resize(newWindowSize);
show();
}
canvas->show();
@@ -1122,9 +1113,10 @@ void QDeclarativeViewer::setRecordRate(int fps)
void QDeclarativeViewer::sceneResized(QSize size)
{
if (size.width() > 0 && size.height() > 0) {
- if (skin && scaleSkin)
- skin->setScreenSize(size);
- }
+ if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) {
+ updateSizeHints();
+ }
+ }
}
void QDeclarativeViewer::keyPressEvent(QKeyEvent *event)
@@ -1397,6 +1389,42 @@ void QDeclarativeViewer::setUseNativeFileBrowser(bool use)
useQmlFileBrowser = !use;
}
+void QDeclarativeViewer::setSizeToView(bool sizeToView)
+{
+ QDeclarativeView::ResizeMode resizeMode = sizeToView ? QDeclarativeView::SizeRootObjectToView : QDeclarativeView::SizeViewToRootObject;
+ if (resizeMode != canvas->resizeMode()) {
+ canvas->setResizeMode(resizeMode);
+ updateSizeHints();
+ }
+}
+
+void QDeclarativeViewer::updateSizeHints()
+{
+ if (canvas->resizeMode() == QDeclarativeView::SizeViewToRootObject) {
+ QSize newWindowSize = canvas->sizeHint();
+ if (!skin) {
+ newWindowSize.setHeight(newWindowSize.height()+menuBar()->height());
+ }
+ if (!isFullScreen() && !isMaximized()) {
+ resize(newWindowSize);
+ setFixedSize(newWindowSize);
+ if (skin && scaleSkin) {
+ skin->setScreenSize(newWindowSize);
+ }
+ }
+ } else { // QDeclarativeView::SizeRootObjectToView
+ canvas->setMinimumSize(QSize(0,0));
+ canvas->setMaximumSize(QSize(16777215,16777215));
+ setMinimumSize(QSize(0,0));
+ setMaximumSize(QSize(16777215,16777215));
+ if (skin && !scaleSkin) {
+ canvas->setFixedSize(skin->standardScreenSize());
+ skin->setScreenSize(skin->standardScreenSize());
+ }
+ }
+ updateGeometry();
+}
+
void QDeclarativeViewer::registerTypes()
{
static bool registered = false;
diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h
index 2089dda..a00a703 100644
--- a/tools/qml/qmlruntime.h
+++ b/tools/qml/qmlruntime.h
@@ -100,7 +100,8 @@ public:
void addPluginPath(const QString& plugin);
void setUseGL(bool use);
void setUseNativeFileBrowser(bool);
-
+ void updateSizeHints();
+ void setSizeToView(bool sizeToView);
QStringList builtinSkins() const;
QMenuBar *menuBar() const;
@@ -149,6 +150,7 @@ private:
PreviewDeviceSkin *skin;
QSize skinscreensize;
QDeclarativeView *canvas;
+ QSize initialSize;
QString currentFileOrUrl;
QDeclarativeTimer recordTimer;
QString frame_fmt;