diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-20 08:04:29 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-20 08:04:29 (GMT) |
commit | 30b45ba2b11342a9e7cc06b68237b68a68955213 (patch) | |
tree | 1018c188375b3217b31abe9b7a0883ee1184a447 /examples | |
parent | ce27cf24539e0c7971937e55d8539496ad51ee52 (diff) | |
parent | 8f10ca802dee1ed110f301191c4a56a85575033c (diff) | |
download | Qt-30b45ba2b11342a9e7cc06b68237b68a68955213.zip Qt-30b45ba2b11342a9e7cc06b68237b68a68955213.tar.gz Qt-30b45ba2b11342a9e7cc06b68237b68a68955213.tar.bz2 |
Merge remote branch 'origin/master' into qt-master-from-4.6
Conflicts:
configure.exe
src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
src/opengl/qgl.cpp
Diffstat (limited to 'examples')
27 files changed, 177 insertions, 41 deletions
diff --git a/examples/declarative/anchors/anchor-changes.qml b/examples/declarative/anchors/anchor-changes.qml index 2ebe1c0..f6fd35d 100644 --- a/examples/declarative/anchors/anchor-changes.qml +++ b/examples/declarative/anchors/anchor-changes.qml @@ -41,6 +41,6 @@ Item { } transitions : Transition { - NumberAnimation { matchProperties: "y,height" } + NumberAnimation { properties: "y,height" } } } diff --git a/examples/declarative/animations/easing.qml b/examples/declarative/animations/easing.qml index a9ba05f..59e9b17 100644 --- a/examples/declarative/animations/easing.qml +++ b/examples/declarative/animations/easing.qml @@ -80,8 +80,8 @@ Rectangle { transitions: Transition { ParallelAnimation { - NumberAnimation { matchProperties: "x"; easing: type; duration: 1000 } - ColorAnimation { matchProperties: "color"; easing: type; duration: 1000 } + NumberAnimation { properties: "x"; easing: type; duration: 1000 } + ColorAnimation { properties: "color"; easing: type; duration: 1000 } } } } diff --git a/examples/declarative/dynamic/qml/PerspectiveItem.qml b/examples/declarative/dynamic/qml/PerspectiveItem.qml index 728c3a5..a0dfad3 100644 --- a/examples/declarative/dynamic/qml/PerspectiveItem.qml +++ b/examples/declarative/dynamic/qml/PerspectiveItem.qml @@ -6,6 +6,7 @@ Image { property double scaleFactor: Math.max((y+height-250)*0.01, 0.3) property double scaledBottom: y + (height+height*scaleFactor)/2 property bool onLand: scaledBottom > window.height/2 + property string image //Needed for compatibility with GenericItem opacity: onLand ? 1 : 0.25 onCreatedChanged: if (created && !onLand) { tree.destroy() } else { z = scaledBottom } scale: scaleFactor diff --git a/examples/declarative/imageprovider/imageprovider.pro b/examples/declarative/imageprovider/imageprovider.pro new file mode 100644 index 0000000..60423ab --- /dev/null +++ b/examples/declarative/imageprovider/imageprovider.pro @@ -0,0 +1,9 @@ +TEMPLATE = app +TARGET = imageprovider +DEPENDPATH += . +INCLUDEPATH += . +QT += declarative + +# Input +SOURCES += main.cpp +RESOURCES += imageprovider.qrc diff --git a/examples/declarative/imageprovider/imageprovider.qrc b/examples/declarative/imageprovider/imageprovider.qrc new file mode 100644 index 0000000..17e9301 --- /dev/null +++ b/examples/declarative/imageprovider/imageprovider.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>view.qml</file> +</qresource> +</RCC> diff --git a/examples/declarative/imageprovider/main.cpp b/examples/declarative/imageprovider/main.cpp new file mode 100644 index 0000000..9526105 --- /dev/null +++ b/examples/declarative/imageprovider/main.cpp @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** 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 demonstration applications 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 <QApplication> + +#include <qmlengine.h> +#include <qmlcontext.h> +#include <qml.h> +#include <qmlgraphicsitem.h> +#include <qmlimageprovider.h> +#include <qmlview.h> +#include <QImage> +#include <QPainter> + +/* + This example illustrates using a QmlImageProvider to serve + images asynchronously. +*/ + +//![0] +class ColorImageProvider : public QmlImageProvider +{ +public: + // This is run in a low priority thread. + QImage request(const QString &id) { + QImage image(100, 50, QImage::Format_RGB32); + image.fill(QColor(id).rgba()); + QPainter p(&image); + p.setPen(Qt::black); + p.drawText(QRectF(0,0,100,50),Qt::AlignCenter,id); + return image; + } +}; + +int main(int argc, char ** argv) +{ + QApplication app(argc, argv); + + QmlView view; + view.setSource(QUrl("qrc:view.qml")); + + view.engine()->addImageProvider("colors", new ColorImageProvider); + + QStringList dataList; + dataList.append("image://colors/red"); + dataList.append("image://colors/green"); + dataList.append("image://colors/blue"); + dataList.append("image://colors/brown"); + dataList.append("image://colors/orange"); + dataList.append("image://colors/purple"); + dataList.append("image://colors/yellow"); + + QmlContext *ctxt = view.rootContext(); + ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); + + view.execute(); + view.show(); + + return app.exec(); +} +//![0] diff --git a/examples/declarative/imageprovider/view.qml b/examples/declarative/imageprovider/view.qml new file mode 100644 index 0000000..2ab729d --- /dev/null +++ b/examples/declarative/imageprovider/view.qml @@ -0,0 +1,22 @@ +import Qt 4.6 +//![0] +ListView { + width: 100 + height: 100 + anchors.fill: parent + model: myModel + delegate: Component { + Item { + width: 100 + height: 50 + Text { + text: "Loading..." + anchors.centerIn: parent + } + Image { + source: modelData + } + } + } +} +//![0] diff --git a/examples/declarative/layouts/Button.qml b/examples/declarative/layouts/Button.qml index 215b536..44d0c7b 100644 --- a/examples/declarative/layouts/Button.qml +++ b/examples/declarative/layouts/Button.qml @@ -17,6 +17,6 @@ Rectangle { border.color: "black"; color: "steelblue"; radius: 5; width: pix.wid transitions: Transition{ - NumberAnimation { matchProperties:"x,left"; easing:"easeInOutQuad"; duration:200 } + NumberAnimation { properties:"x,left"; easing:"easeInOutQuad"; duration:200 } } } diff --git a/examples/declarative/layouts/positioners.qml b/examples/declarative/layouts/positioners.qml index 46762f7..fefd964 100644 --- a/examples/declarative/layouts/positioners.qml +++ b/examples/declarative/layouts/positioners.qml @@ -11,12 +11,12 @@ Rectangle { y: 0 move: Transition { NumberAnimation { - matchProperties: "y"; easing: "easeOutBounce" + properties: "y"; easing: "easeOutBounce" } } add: Transition { NumberAnimation { - matchProperties: "y"; easing: "easeOutQuad" + properties: "y"; easing: "easeOutQuad" } } Rectangle { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 } @@ -35,12 +35,12 @@ Rectangle { y: 300 move: Transition { NumberAnimation { - matchProperties: "x"; easing: "easeOutBounce" + properties: "x"; easing: "easeOutBounce" } } add: Transition { NumberAnimation { - matchProperties: "x"; easing: "easeOutQuad" + properties: "x"; easing: "easeOutQuad" } } Rectangle { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 } @@ -101,13 +101,13 @@ Rectangle { move: Transition { NumberAnimation { - matchProperties: "x,y"; easing: "easeOutBounce" + properties: "x,y"; easing: "easeOutBounce" } } add: Transition { NumberAnimation { - matchProperties: "x,y"; easing: "easeOutBounce" + properties: "x,y"; easing: "easeOutBounce" } } @@ -136,13 +136,13 @@ Rectangle { move: Transition { NumberAnimation { - matchProperties: "x,y"; easing: "easeOutBounce" + properties: "x,y"; easing: "easeOutBounce" } } add: Transition { NumberAnimation { - matchProperties: "x,y"; easing: "easeOutBounce" + properties: "x,y"; easing: "easeOutBounce" } } Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } diff --git a/examples/declarative/listview/content/ClickAutoRepeating.qml b/examples/declarative/listview/content/ClickAutoRepeating.qml index 796f9e3..be37b50 100644 --- a/examples/declarative/listview/content/ClickAutoRepeating.qml +++ b/examples/declarative/listview/content/ClickAutoRepeating.qml @@ -11,6 +11,7 @@ Item { signal clicked isPressed: SequentialAnimation { + running: false id: autoRepeat PropertyAction { target: page; property: "isPressed"; value: true } ScriptAction { script: page.pressed() } diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml index 101b708..dd898f9 100644 --- a/examples/declarative/listview/dynamic.qml +++ b/examples/declarative/listview/dynamic.qml @@ -24,7 +24,6 @@ Rectangle { } ListElement { name: "Cumquat"; cost: 3.25 - types: [ "Small", "Smaller" ] attributes: [ ListElement { description: "Citrus" } ] @@ -82,12 +81,12 @@ Rectangle { anchors.right: removeButton.left; anchors.rightMargin: 35; spacing: 10 width: childrenRect.width; anchors.verticalCenter: parent.verticalCenter Image { source: "content/pics/list-add.png" - ClickAutoRepeating { id: clickUp; anchors.fill: parent; onClicked: fruitModel.set(index,"cost",Number(cost)+0.25) } + ClickAutoRepeating { id: clickUp; anchors.fill: parent; onClicked: fruitModel.setProperty(index,"cost",cost+0.25) } scale: clickUp.isPressed ? 0.9 : 1; transformOrigin: Item.Center } Text { id: costText; text: '$'+Number(cost).toFixed(2); font.pixelSize: 15; color: "White"; font.bold: true; } Image { source: "content/pics/list-remove.png" - ClickAutoRepeating { id: clickDown; anchors.fill: parent; onClicked: fruitModel.set(index,"cost",Math.max(0,Number(cost)-0.25)) } + ClickAutoRepeating { id: clickDown; anchors.fill: parent; onClicked: fruitModel.setProperty(index,"cost",Math.max(0,cost-0.25)) } scale: clickDown.isPressed ? 0.9 : 1; transformOrigin: Item.Center } } @@ -122,7 +121,7 @@ Rectangle { PropertyChanges { target: verticalScrollBar; opacity: 1 } } ] - transitions: [ Transition { NumberAnimation { matchProperties: "opacity"; duration: 400 } } ] + transitions: [ Transition { NumberAnimation { properties: "opacity"; duration: 400 } } ] } Row { diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml index 9665499..be1f62d 100644 --- a/examples/declarative/listview/highlight.qml +++ b/examples/declarative/listview/highlight.qml @@ -31,7 +31,7 @@ Rectangle { transitions: [ Transition { NumberAnimation { - matchProperties: "x"; duration: 200 + properties: "x"; duration: 200 } } ] diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml index c133351..3410f56 100644 --- a/examples/declarative/listview/recipes.qml +++ b/examples/declarative/listview/recipes.qml @@ -124,7 +124,7 @@ Rectangle { ParallelAnimation { ColorAnimation { property: "color"; duration: 500 } NumberAnimation { - duration: 300; matchProperties: "detailsOpacity,x,viewportY,height,width" + duration: 300; properties: "detailsOpacity,x,viewportY,height,width" } } } diff --git a/examples/declarative/objectlistmodel/main.cpp b/examples/declarative/objectlistmodel/main.cpp index 8231538..5eb6b7d 100644 --- a/examples/declarative/objectlistmodel/main.cpp +++ b/examples/declarative/objectlistmodel/main.cpp @@ -59,7 +59,7 @@ int main(int argc, char ** argv) QApplication app(argc, argv); QmlView view; - view.setUrl(QUrl("qrc:view.qml")); + view.setSource(QUrl("qrc:view.qml")); QList<QObject*> dataList; dataList.append(new DataObject("Item 1", "red")); diff --git a/examples/declarative/parallax/qml/ParallaxView.qml b/examples/declarative/parallax/qml/ParallaxView.qml index ff4a85a..f10d374 100644 --- a/examples/declarative/parallax/qml/ParallaxView.qml +++ b/examples/declarative/parallax/qml/ParallaxView.qml @@ -74,7 +74,7 @@ Item { } transitions: Transition { NumberAnimation { - matchProperties: "scale,y" + properties: "scale,y" } } } diff --git a/examples/declarative/scrollbar/ScrollBar.qml b/examples/declarative/scrollbar/ScrollBar.qml index f68775c..802b537 100644 --- a/examples/declarative/scrollbar/ScrollBar.qml +++ b/examples/declarative/scrollbar/ScrollBar.qml @@ -2,7 +2,7 @@ import Qt 4.6 Item { id: scrollBar - // The matchProperties that define the scrollbar's state. + // The properties that define the scrollbar's state. // position and pageSize are in the range 0.0 - 1.0. They are relative to the // height of the page, i.e. a pageSize of 0.5 means that you can see 50% // of the height of the view. diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml index 0b9f95a..536a8b7 100644 --- a/examples/declarative/scrollbar/display.qml +++ b/examples/declarative/scrollbar/display.qml @@ -27,7 +27,7 @@ Rectangle { from: "*" to: "*" NumberAnimation { - matchProperties: "opacity" + properties: "opacity" duration: 400 } } diff --git a/examples/declarative/searchbox/SearchBox.qml b/examples/declarative/searchbox/SearchBox.qml index 42b5d67..7077a11 100644 --- a/examples/declarative/searchbox/SearchBox.qml +++ b/examples/declarative/searchbox/SearchBox.qml @@ -50,11 +50,11 @@ FocusScope { transitions: [ Transition { from: ""; to: "hasText" - NumberAnimation { exclude: typeSomething; matchProperties: "opacity" } + NumberAnimation { exclude: typeSomething; properties: "opacity" } }, Transition { from: "hasText"; to: "" - NumberAnimation { matchProperties: "opacity" } + NumberAnimation { properties: "opacity" } } ] } diff --git a/examples/declarative/slideswitch/content/Switch.qml b/examples/declarative/slideswitch/content/Switch.qml index 29a62f7..c7f1c24 100644 --- a/examples/declarative/slideswitch/content/Switch.qml +++ b/examples/declarative/slideswitch/content/Switch.qml @@ -66,7 +66,7 @@ Item { //![7] transitions: Transition { - NumberAnimation { matchProperties: "x"; easing: "easeInOutQuad"; duration: 200 } + NumberAnimation { properties: "x"; easing: "easeInOutQuad"; duration: 200 } } //![7] } diff --git a/examples/declarative/snow/ImageBatch.qml b/examples/declarative/snow/ImageBatch.qml index 1d738b2..c2a2674 100644 --- a/examples/declarative/snow/ImageBatch.qml +++ b/examples/declarative/snow/ImageBatch.qml @@ -23,7 +23,7 @@ GridView { transitions: Transition { SequentialAnimation { PauseAnimation { duration: 150 } - PropertyAction { matchProperties: "z" } + PropertyAction { properties: "z" } } } model: XmlListModel { @@ -55,15 +55,15 @@ GridView { to: "selected" SequentialAnimation { PauseAnimation { duration: 150 } - PropertyAction { matchProperties: "z" } - NumberAnimation { matchProperties: "scale"; duration: 150; } + PropertyAction { properties: "z" } + NumberAnimation { properties: "scale"; duration: 150; } } }, Transition { from: "selected" SequentialAnimation { - NumberAnimation { matchProperties: "scale"; duration: 150 } - PropertyAction { matchProperties: "z" } + NumberAnimation { properties: "scale"; duration: 150 } + PropertyAction { properties: "z" } } } ] diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml index 925d90e..ba97d9be 100644 --- a/examples/declarative/states/transitions.qml +++ b/examples/declarative/states/transitions.qml @@ -48,23 +48,23 @@ Rectangle { } ] - // transitions define how the matchProperties change. + // transitions define how the properties change. transitions: [ // When transitioning to 'Position1' move x,y over a duration of 1 second, // with easeOutBounce easing function. Transition { from: "*"; to: "Position1" - NumberAnimation { matchProperties: "x,y"; easing: "easeOutBounce"; duration: 1000 } + NumberAnimation { properties: "x,y"; easing: "easeOutBounce"; duration: 1000 } }, // When transitioning to 'Position2' move x,y over a duration of 2 seconds, // with easeInOutQuad easing function. Transition { from: "*"; to: "Position2" - NumberAnimation { matchProperties: "x,y"; easing: "easeInOutQuad"; duration: 2000 } + NumberAnimation { properties: "x,y"; easing: "easeInOutQuad"; duration: 2000 } }, // For any other state changes move x,y linearly over duration of 200ms. Transition { - NumberAnimation { matchProperties: "x,y"; duration: 200 } + NumberAnimation { properties: "x,y"; duration: 200 } } ] } diff --git a/examples/declarative/tutorials/helloworld/tutorial3.qml b/examples/declarative/tutorials/helloworld/tutorial3.qml index 0f27f86..107b066 100644 --- a/examples/declarative/tutorials/helloworld/tutorial3.qml +++ b/examples/declarative/tutorials/helloworld/tutorial3.qml @@ -28,7 +28,7 @@ Rectangle { transitions: Transition { from: ""; to: "down"; reversible: true ParallelAnimation { - NumberAnimation { matchProperties: "y,rotation"; duration: 500; easing: "easeInOutQuad" } + NumberAnimation { properties: "y,rotation"; duration: 500; easing: "easeInOutQuad" } ColorAnimation { duration: 500 } } } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml index 2eb2ceb..4c2ba43 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml @@ -24,7 +24,7 @@ Item { id:block } } opacity: 0 - opacity: Behavior { NumberAnimation { matchProperties:"opacity"; duration: 200 } } + opacity: Behavior { NumberAnimation { properties:"opacity"; duration: 200 } } anchors.fill: parent } //![2] diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index 3a7ffa9..030fa13 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -71,7 +71,7 @@ Rectangle { } transitions: Transition { - NumberAnimation { matchProperties: "rotation,scale"; duration: 200 } + NumberAnimation { properties: "rotation,scale"; duration: 200 } } } } diff --git a/examples/declarative/webview/autosize.qml b/examples/declarative/webview/autosize.qml index 1614906..74c6844 100644 --- a/examples/declarative/webview/autosize.qml +++ b/examples/declarative/webview/autosize.qml @@ -1,7 +1,7 @@ import Qt 4.6 // The WebView size is determined by the width, height, -// preferredWidth, and preferredHeight matchProperties. +// preferredWidth, and preferredHeight properties. Rectangle { id: rect color: "white" diff --git a/examples/declarative/webview/content/FieldText.qml b/examples/declarative/webview/content/FieldText.qml index 6b1d271..b1c1938 100644 --- a/examples/declarative/webview/content/FieldText.qml +++ b/examples/declarative/webview/content/FieldText.qml @@ -149,7 +149,7 @@ Item { to: "*" reversible: true NumberAnimation { - matchProperties: "opacity,leftMargin,rightMargin" + properties: "opacity,leftMargin,rightMargin" duration: 200 } ColorAnimation { diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml index bd14516..23463c2 100644 --- a/examples/declarative/xmldata/yahoonews.qml +++ b/examples/declarative/xmldata/yahoonews.qml @@ -61,8 +61,8 @@ Rectangle { transitions: Transition { from: "*"; to: "Details"; reversible: true SequentialAnimation { - NumberAnimation { duration: 200; matchProperties: "height"; easing: "easeOutQuad" } - NumberAnimation { duration: 200; matchProperties: "opacity" } + NumberAnimation { duration: 200; properties: "height"; easing: "easeOutQuad" } + NumberAnimation { duration: 200; properties: "opacity" } } } } |