[Qt-qml] Removal of Script{} blocks
henrik.hartz at nokia.com
henrik.hartz at nokia.com
Mon Mar 22 10:36:42 CET 2010
Hi,
FYI, upcoming language change;
> Inline Script{} blocks have been deprecated, and will soon be removed entirely. If you used Script to write inline javascript code, it can simply be removed. For example
>
> Item {
> Script {
> function doSomething() {}
> }
> }
>
> becomes
>
> Item {
> function doSomething() {}
> }
>
> If you used Script to include external JavaScript files, you can replace the Script element with an “import” line. For example
>
> MouseArea {
> Script {
> source: “foo.js”
> }
> onClicked: foo()
> }
>
> becomes
>
> Import “foo.js” as Foo
> MouseArea {
> onClicked: Foo.foo()
> }
>
> The “as” qualifier is mandatory for script imports (as opposed to type imports where it is optional).
Cheers,
Henrik
More information about the Qt-qml
mailing list