aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/HACKING23
-rw-r--r--examples/README12
-rw-r--r--examples/demos/calculator/CalculatorCore/Button.qml84
-rw-r--r--examples/demos/calculator/CalculatorCore/Display.qml68
-rw-r--r--examples/demos/calculator/CalculatorCore/calculator.js95
-rw-r--r--examples/demos/calculator/CalculatorCore/images/button-.pngbin0 -> 1288 bytes
-rw-r--r--examples/demos/calculator/CalculatorCore/images/button-blue.pngbin0 -> 1565 bytes
-rw-r--r--examples/demos/calculator/CalculatorCore/images/button-green.pngbin0 -> 1543 bytes
-rw-r--r--examples/demos/calculator/CalculatorCore/images/button-purple.pngbin0 -> 1566 bytes
-rw-r--r--examples/demos/calculator/CalculatorCore/images/button-red.pngbin0 -> 1586 bytes
-rw-r--r--examples/demos/calculator/CalculatorCore/images/display.pngbin0 -> 998 bytes
-rw-r--r--examples/demos/calculator/CalculatorCore/qmldir2
-rw-r--r--examples/demos/calculator/calculator-desktop.qml136
-rw-r--r--examples/demos/calculator/calculator-mobile.qml164
-rw-r--r--examples/demos/calculator/calculator.pro9
-rw-r--r--examples/demos/calculator/calculator.qdoc37
-rw-r--r--examples/demos/calculator/main.cpp66
-rw-r--r--examples/demos/clocks/clocks.qml88
-rw-r--r--examples/demos/clocks/content/Clock.qml143
-rw-r--r--examples/demos/clocks/content/QuitButton.qml52
-rw-r--r--examples/demos/clocks/content/arrow.pngbin0 -> 692 bytes
-rw-r--r--examples/demos/clocks/content/background.pngbin0 -> 46895 bytes
-rw-r--r--examples/demos/clocks/content/center.pngbin0 -> 765 bytes
-rw-r--r--examples/demos/clocks/content/clock-night.pngbin0 -> 23359 bytes
-rw-r--r--examples/demos/clocks/content/clock.pngbin0 -> 20653 bytes
-rw-r--r--examples/demos/clocks/content/hour.pngbin0 -> 625 bytes
-rw-r--r--examples/demos/clocks/content/minute.pngbin0 -> 625 bytes
-rw-r--r--examples/demos/clocks/content/quit.pngbin0 -> 583 bytes
-rw-r--r--examples/demos/clocks/content/second.pngbin0 -> 303 bytes
-rw-r--r--examples/demos/demos.pro2
-rw-r--r--examples/demos/flickr/content/Button.qml79
-rw-r--r--examples/demos/flickr/content/GridDelegate.qml111
-rw-r--r--examples/demos/flickr/content/ImageDetails.qml323
-rw-r--r--examples/demos/flickr/content/ListDelegate.qml64
-rw-r--r--examples/demos/flickr/content/Progress.qml88
-rw-r--r--examples/demos/flickr/content/RssModel.qml64
-rw-r--r--examples/demos/flickr/content/ScrollBar.qml81
-rw-r--r--examples/demos/flickr/content/Slider.qml91
-rw-r--r--examples/demos/flickr/content/TitleBar.qml128
-rw-r--r--examples/demos/flickr/content/ToolBar.qml69
-rw-r--r--examples/demos/flickr/content/UnifiedDelegate.qml154
-rw-r--r--examples/demos/flickr/content/images/gloss.pngbin0 -> 1236 bytes
-rw-r--r--examples/demos/flickr/content/images/lineedit.pngbin0 -> 1415 bytes
-rw-r--r--examples/demos/flickr/content/images/lineedit.sci5
-rw-r--r--examples/demos/flickr/content/images/noise.pngbin0 -> 25447 bytes
-rw-r--r--examples/demos/flickr/content/images/particle.pngbin0 -> 5148 bytes
-rw-r--r--examples/demos/flickr/content/images/quit.pngbin0 -> 2369 bytes
-rw-r--r--examples/demos/flickr/content/images/squareParticle.pngbin0 -> 933 bytes
-rw-r--r--examples/demos/flickr/content/images/stripes.pngbin0 -> 257 bytes
-rw-r--r--examples/demos/flickr/content/images/titlebar.pngbin0 -> 1436 bytes
-rw-r--r--examples/demos/flickr/content/images/titlebar.sci5
-rw-r--r--examples/demos/flickr/content/images/toolbutton.pngbin0 -> 2550 bytes
-rw-r--r--examples/demos/flickr/content/images/toolbutton.sci5
-rw-r--r--examples/demos/flickr/content/qmldir10
-rw-r--r--examples/demos/flickr/flickr-90.qml52
-rw-r--r--examples/demos/flickr/flickr.qml158
-rw-r--r--examples/demos/flickr/flickr.qmlproject17
-rw-r--r--examples/demos/minehunt/MinehuntCore/Explosion.qml69
-rw-r--r--examples/demos/minehunt/MinehuntCore/Tile.qml128
-rw-r--r--examples/demos/minehunt/MinehuntCore/pics/back.pngbin0 -> 558 bytes
-rw-r--r--examples/demos/minehunt/MinehuntCore/pics/background.pngbin0 -> 313930 bytes
-rw-r--r--examples/demos/minehunt/MinehuntCore/pics/bomb-color.pngbin0 -> 284 bytes
-rw-r--r--examples/demos/minehunt/MinehuntCore/pics/bomb.pngbin0 -> 535 bytes
-rw-r--r--examples/demos/minehunt/MinehuntCore/pics/face-sad.pngbin0 -> 14844 bytes
-rw-r--r--examples/demos/minehunt/MinehuntCore/pics/face-smile-big.pngbin0 -> 13810 bytes
-rw-r--r--examples/demos/minehunt/MinehuntCore/pics/face-smile.pngbin0 -> 15408 bytes
-rw-r--r--examples/demos/minehunt/MinehuntCore/pics/flag-color.pngbin0 -> 219 bytes
-rw-r--r--examples/demos/minehunt/MinehuntCore/pics/flag.pngbin0 -> 196 bytes
-rw-r--r--examples/demos/minehunt/MinehuntCore/pics/front.pngbin0 -> 580 bytes
-rw-r--r--examples/demos/minehunt/MinehuntCore/pics/quit.pngbin0 -> 583 bytes
-rw-r--r--examples/demos/minehunt/MinehuntCore/pics/star.pngbin0 -> 2677 bytes
-rw-r--r--examples/demos/minehunt/MinehuntCore/qmldir2
-rw-r--r--examples/demos/minehunt/README6
-rw-r--r--examples/demos/minehunt/main.cpp64
-rw-r--r--examples/demos/minehunt/minehunt.cpp221
-rw-r--r--examples/demos/minehunt/minehunt.h129
-rw-r--r--examples/demos/minehunt/minehunt.pro5
-rw-r--r--examples/demos/minehunt/minehunt.qml112
-rw-r--r--examples/demos/minehunt/minehunt.qmlproject16
-rw-r--r--examples/demos/minehunt/minehunt.qrc20
-rw-r--r--examples/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml147
-rw-r--r--examples/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml50
-rw-r--r--examples/demos/photoviewer/PhotoViewerCore/Button.qml72
-rw-r--r--examples/demos/photoviewer/PhotoViewerCore/EditableButton.qml86
-rw-r--r--examples/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml188
-rw-r--r--examples/demos/photoviewer/PhotoViewerCore/ProgressBar.qml57
-rw-r--r--examples/demos/photoviewer/PhotoViewerCore/RssModel.qml57
-rw-r--r--examples/demos/photoviewer/PhotoViewerCore/Tag.qml91
-rw-r--r--examples/demos/photoviewer/PhotoViewerCore/images/box-shadow.pngbin0 -> 588 bytes
-rw-r--r--examples/demos/photoviewer/PhotoViewerCore/images/busy.pngbin0 -> 2629 bytes
-rw-r--r--examples/demos/photoviewer/PhotoViewerCore/images/cardboard.pngbin0 -> 8844 bytes
-rw-r--r--examples/demos/photoviewer/PhotoViewerCore/qmldir8
-rw-r--r--examples/demos/photoviewer/PhotoViewerCore/script/script.js27
-rw-r--r--examples/demos/photoviewer/i18n/base.ts30
-rw-r--r--examples/demos/photoviewer/i18n/qml_fr.qmbin0 -> 268 bytes
-rw-r--r--examples/demos/photoviewer/i18n/qml_fr.ts30
-rw-r--r--examples/demos/photoviewer/photoviewer.qml110
-rw-r--r--examples/demos/photoviewer/photoviewer.qmlproject20
-rw-r--r--examples/demos/plasmapatrol/PlasmaPatrol.qmlproject19
-rw-r--r--examples/demos/plasmapatrol/TODO10
-rw-r--r--examples/demos/plasmapatrol/content/BlasterHardpoint.qml133
-rw-r--r--examples/demos/plasmapatrol/content/Button.qml66
-rw-r--r--examples/demos/plasmapatrol/content/CannonHardpoint.qml97
-rw-r--r--examples/demos/plasmapatrol/content/ChoiceBox.qml105
-rw-r--r--examples/demos/plasmapatrol/content/Cruiser.qml146
-rw-r--r--examples/demos/plasmapatrol/content/Frigate.qml114
-rw-r--r--examples/demos/plasmapatrol/content/Hardpoint.qml114
-rw-r--r--examples/demos/plasmapatrol/content/HelpScreens.qml268
-rw-r--r--examples/demos/plasmapatrol/content/LaserHardpoint.qml108
-rw-r--r--examples/demos/plasmapatrol/content/PlasmaPatrolParticles.qml173
-rw-r--r--examples/demos/plasmapatrol/content/SequentialLoader.qml54
-rw-r--r--examples/demos/plasmapatrol/content/Ship.qml114
-rw-r--r--examples/demos/plasmapatrol/content/Sloop.qml108
-rw-r--r--examples/demos/plasmapatrol/content/pics/TitleText.pngbin0 -> 1109 bytes
-rw-r--r--examples/demos/plasmapatrol/content/pics/blur-circle2.pngbin0 -> 3627 bytes
-rw-r--r--examples/demos/plasmapatrol/content/pics/blur-circle3.pngbin0 -> 5148 bytes
-rw-r--r--examples/demos/plasmapatrol/content/pics/finalfrontier.pngbin0 -> 695061 bytes
-rw-r--r--examples/demos/plasmapatrol/content/pics/meteor.pngbin0 -> 83169 bytes
-rw-r--r--examples/demos/plasmapatrol/content/pics/meteor_explo.pngbin0 -> 81528 bytes
-rw-r--r--examples/demos/plasmapatrol/content/pics/nullRock.pngbin0 -> 140 bytes
-rw-r--r--examples/demos/plasmapatrol/content/pics/particle.pngbin0 -> 861 bytes
-rw-r--r--examples/demos/plasmapatrol/content/pics/star.pngbin0 -> 1550 bytes
-rw-r--r--examples/demos/plasmapatrol/content/pics/star2.pngbin0 -> 6507 bytes
-rw-r--r--examples/demos/plasmapatrol/content/pics/star3.pngbin0 -> 4602 bytes
-rw-r--r--examples/demos/plasmapatrol/plasmapatrol.qml386
-rw-r--r--examples/demos/rssnews/content/BusyIndicator.qml53
-rw-r--r--examples/demos/rssnews/content/CategoryDelegate.qml82
-rw-r--r--examples/demos/rssnews/content/NewsDelegate.qml71
-rw-r--r--examples/demos/rssnews/content/RssFeeds.qml59
-rw-r--r--examples/demos/rssnews/content/ScrollBar.qml107
-rw-r--r--examples/demos/rssnews/content/images/busy.pngbin0 -> 2629 bytes
-rw-r--r--examples/demos/rssnews/content/images/scrollbar.pngbin0 -> 161 bytes
-rw-r--r--examples/demos/rssnews/rssnews.qml112
-rw-r--r--examples/demos/rssnews/rssnews.qmlproject16
-rw-r--r--examples/demos/samegame/content/BoomBlock.qml112
-rw-r--r--examples/demos/samegame/content/Button.qml75
-rw-r--r--examples/demos/samegame/content/Dialog.qml81
-rw-r--r--examples/demos/samegame/content/GameArea.qml92
-rw-r--r--examples/demos/samegame/content/NameInputDialog.qml93
-rw-r--r--examples/demos/samegame/content/pics/background.pngbin0 -> 313930 bytes
-rw-r--r--examples/demos/samegame/content/pics/blueStone.pngbin0 -> 3054 bytes
-rw-r--r--examples/demos/samegame/content/pics/greenStone.pngbin0 -> 2932 bytes
-rw-r--r--examples/demos/samegame/content/pics/particle.pngbin0 -> 861 bytes
-rw-r--r--examples/demos/samegame/content/pics/redStone.pngbin0 -> 2902 bytes
-rw-r--r--examples/demos/samegame/content/pics/yellowStone.pngbin0 -> 3056 bytes
-rwxr-xr-xexamples/demos/samegame/content/samegame.js290
-rw-r--r--examples/demos/samegame/samegame.qml87
-rw-r--r--examples/demos/samegame/samegame.qmlproject16
-rw-r--r--examples/demos/snake/content/Button.qml66
-rw-r--r--examples/demos/snake/content/Cookie.qml102
-rw-r--r--examples/demos/snake/content/HighScoreModel.qml140
-rw-r--r--examples/demos/snake/content/Link.qml129
-rw-r--r--examples/demos/snake/content/Skull.qml62
-rw-r--r--examples/demos/snake/content/pics/README1
-rw-r--r--examples/demos/snake/content/pics/background.pngbin0 -> 144508 bytes
-rw-r--r--examples/demos/snake/content/pics/blueStar.pngbin0 -> 272 bytes
-rw-r--r--examples/demos/snake/content/pics/blueStone.pngbin0 -> 3139 bytes
-rw-r--r--examples/demos/snake/content/pics/cookie.pngbin0 -> 2729 bytes
-rw-r--r--examples/demos/snake/content/pics/eyes.svg118
-rw-r--r--examples/demos/snake/content/pics/head.pngbin0 -> 3473 bytes
-rw-r--r--examples/demos/snake/content/pics/pause.pngbin0 -> 4327 bytes
-rw-r--r--examples/demos/snake/content/pics/redStar.pngbin0 -> 273 bytes
-rw-r--r--examples/demos/snake/content/pics/redStone.pngbin0 -> 3456 bytes
-rw-r--r--examples/demos/snake/content/pics/skull.pngbin0 -> 2543 bytes
-rw-r--r--examples/demos/snake/content/pics/snake.jpgbin0 -> 663901 bytes
-rw-r--r--examples/demos/snake/content/pics/star.pngbin0 -> 262 bytes
-rw-r--r--examples/demos/snake/content/pics/stoneShadow.pngbin0 -> 1699 bytes
-rw-r--r--examples/demos/snake/content/pics/yellowStar.pngbin0 -> 276 bytes
-rw-r--r--examples/demos/snake/content/pics/yellowStone.pngbin0 -> 2667 bytes
-rw-r--r--examples/demos/snake/content/snake.js316
-rw-r--r--examples/demos/snake/snake.qml273
-rw-r--r--examples/demos/snake/snake.qmlproject16
-rw-r--r--examples/demos/tic-tac-toe/content/Button.qml79
-rw-r--r--examples/demos/tic-tac-toe/content/TicTac.qml60
-rw-r--r--examples/demos/tic-tac-toe/content/pics/board.pngbin0 -> 12258 bytes
-rw-r--r--examples/demos/tic-tac-toe/content/pics/o.pngbin0 -> 1470 bytes
-rw-r--r--examples/demos/tic-tac-toe/content/pics/x.pngbin0 -> 1331 bytes
-rw-r--r--examples/demos/tic-tac-toe/content/tic-tac-toe.js149
-rw-r--r--examples/demos/tic-tac-toe/tic-tac-toe.qml123
-rw-r--r--examples/demos/twitter/TwitterCore/Button.qml90
-rw-r--r--examples/demos/twitter/TwitterCore/FatDelegate.qml105
-rw-r--r--examples/demos/twitter/TwitterCore/Input.qml65
-rw-r--r--examples/demos/twitter/TwitterCore/Loading.qml49
-rw-r--r--examples/demos/twitter/TwitterCore/MultiTitleBar.qml60
-rw-r--r--examples/demos/twitter/TwitterCore/RssModel.qml80
-rw-r--r--examples/demos/twitter/TwitterCore/SearchView.qml124
-rw-r--r--examples/demos/twitter/TwitterCore/TitleBar.qml130
-rw-r--r--examples/demos/twitter/TwitterCore/ToolBar.qml64
-rw-r--r--examples/demos/twitter/TwitterCore/UserModel.qml66
-rw-r--r--examples/demos/twitter/TwitterCore/images/gloss.pngbin0 -> 1236 bytes
-rw-r--r--examples/demos/twitter/TwitterCore/images/lineedit.pngbin0 -> 1415 bytes
-rw-r--r--examples/demos/twitter/TwitterCore/images/lineedit.sci5
-rw-r--r--examples/demos/twitter/TwitterCore/images/loading.pngbin0 -> 813 bytes
-rw-r--r--examples/demos/twitter/TwitterCore/images/quit.pngbin0 -> 2369 bytes
-rw-r--r--examples/demos/twitter/TwitterCore/images/stripes.pngbin0 -> 257 bytes
-rw-r--r--examples/demos/twitter/TwitterCore/images/titlebar.pngbin0 -> 1436 bytes
-rw-r--r--examples/demos/twitter/TwitterCore/images/titlebar.sci5
-rw-r--r--examples/demos/twitter/TwitterCore/images/toolbutton.pngbin0 -> 2550 bytes
-rw-r--r--examples/demos/twitter/TwitterCore/images/toolbutton.sci5
-rw-r--r--examples/demos/twitter/TwitterCore/qmldir10
-rw-r--r--examples/demos/twitter/twitter.qml135
-rw-r--r--examples/demos/twitter/twitter.qmlproject16
-rw-r--r--examples/examples.pro2
-rw-r--r--examples/localstorage/hello.qml78
-rw-r--r--examples/localstorage/localstorage.pro1
-rw-r--r--examples/particles/affectors/age.qml97
-rw-r--r--examples/particles/affectors/attractor.qml213
-rw-r--r--examples/particles/affectors/customaffector.qml173
-rw-r--r--examples/particles/affectors/friction.qml109
-rw-r--r--examples/particles/affectors/gravity.qml103
-rw-r--r--examples/particles/affectors/groupgoal.qml193
-rw-r--r--examples/particles/affectors/move.qml141
-rw-r--r--examples/particles/affectors/spritegoal.qml212
-rw-r--r--examples/particles/affectors/turbulence.qml135
-rw-r--r--examples/particles/affectors/wander.qml95
-rw-r--r--examples/particles/customparticle/blurparticles.qml140
-rw-r--r--examples/particles/customparticle/fragmentshader.qml115
-rw-r--r--examples/particles/customparticle/imagecolors.qml118
-rw-r--r--examples/particles/emitters/burstandpulse.qml84
-rw-r--r--examples/particles/emitters/customemitter.qml92
-rw-r--r--examples/particles/emitters/emitmask.qml72
-rw-r--r--examples/particles/emitters/maximumemitted.qml81
-rw-r--r--examples/particles/emitters/shapeanddirection.qml112
-rw-r--r--examples/particles/emitters/timedgroupchanges.qml121
-rw-r--r--examples/particles/emitters/trailemitter.qml175
-rw-r--r--examples/particles/emitters/velocityfrommotion.qml311
-rw-r--r--examples/particles/exampleslauncher/content/Button.qml73
-rw-r--r--examples/particles/exampleslauncher/content/Shell.qml78
-rw-r--r--examples/particles/exampleslauncher/content/launcher.js8
-rw-r--r--examples/particles/exampleslauncher/exampleslauncher.qml116
-rw-r--r--examples/particles/imageparticle/allatonce.qml98
-rw-r--r--examples/particles/imageparticle/colored.qml86
-rw-r--r--examples/particles/imageparticle/colortable.qml84
-rw-r--r--examples/particles/imageparticle/deformation.qml121
-rw-r--r--examples/particles/imageparticle/rotation.qml71
-rw-r--r--examples/particles/imageparticle/sharing.qml199
-rw-r--r--examples/particles/imageparticle/sprites.qml116
-rw-r--r--examples/particles/images/_explo.pngbin0 -> 81528 bytes
-rwxr-xr-xexamples/particles/images/backgroundLeaves.jpgbin0 -> 78665 bytes
-rw-r--r--examples/particles/images/bear_tiles.pngbin0 -> 40349 bytes
-rw-r--r--examples/particles/images/candle.pngbin0 -> 1348 bytes
-rw-r--r--examples/particles/images/colortable.pngbin0 -> 704 bytes
-rw-r--r--examples/particles/images/finalfrontier.pngbin0 -> 695061 bytes
-rw-r--r--examples/particles/images/flower.pngbin0 -> 4683 bytes
-rw-r--r--examples/particles/images/launcherIcons/allatonce.pngbin0 -> 7075 bytes
-rw-r--r--examples/particles/images/launcherIcons/attractor.pngbin0 -> 31296 bytes
-rw-r--r--examples/particles/images/launcherIcons/blurparticles.pngbin0 -> 19109 bytes
-rw-r--r--examples/particles/images/launcherIcons/close.pngbin0 -> 2144 bytes
-rw-r--r--examples/particles/images/launcherIcons/colortable.pngbin0 -> 6538 bytes
-rw-r--r--examples/particles/images/launcherIcons/customaffector.pngbin0 -> 10350 bytes
-rw-r--r--examples/particles/images/launcherIcons/customemitter.pngbin0 -> 22967 bytes
-rw-r--r--examples/particles/images/launcherIcons/deformation.pngbin0 -> 2870 bytes
-rw-r--r--examples/particles/images/launcherIcons/delegates.pngbin0 -> 1892 bytes
-rw-r--r--examples/particles/images/launcherIcons/dynamicemitters.pngbin0 -> 9347 bytes
-rw-r--r--examples/particles/images/launcherIcons/emitmask.pngbin0 -> 45055 bytes
-rw-r--r--examples/particles/images/launcherIcons/flickr.pngbin0 -> 10542 bytes
-rw-r--r--examples/particles/images/launcherIcons/fragmentshader.pngbin0 -> 22294 bytes
-rw-r--r--examples/particles/images/launcherIcons/gridsplosion.pngbin0 -> 8154 bytes
-rw-r--r--examples/particles/images/launcherIcons/groupgoal.pngbin0 -> 7173 bytes
-rw-r--r--examples/particles/images/launcherIcons/imagecolors.pngbin0 -> 56647 bytes
-rw-r--r--examples/particles/images/launcherIcons/list.pngbin0 -> 32912 bytes
-rw-r--r--examples/particles/images/launcherIcons/maximumemitted.pngbin0 -> 1019 bytes
-rw-r--r--examples/particles/images/launcherIcons/multiplepainters.pngbin0 -> 8572 bytes
-rw-r--r--examples/particles/images/launcherIcons/package.pngbin0 -> 3163 bytes
-rw-r--r--examples/particles/images/launcherIcons/particleview.pngbin0 -> 26560 bytes
-rw-r--r--examples/particles/images/launcherIcons/plasmapatrol.pngbin0 -> 9839 bytes
-rw-r--r--examples/particles/images/launcherIcons/remove.pngbin0 -> 2144 bytes
-rw-r--r--examples/particles/images/launcherIcons/rotation.pngbin0 -> 20661 bytes
-rw-r--r--examples/particles/images/launcherIcons/samegame.pngbin0 -> 8647 bytes
-rw-r--r--examples/particles/images/launcherIcons/shapeanddirection.pngbin0 -> 11359 bytes
-rw-r--r--examples/particles/images/launcherIcons/spaceexplorer.pngbin0 -> 9152 bytes
-rw-r--r--examples/particles/images/launcherIcons/spritegoal.pngbin0 -> 35579 bytes
-rw-r--r--examples/particles/images/launcherIcons/sprites.pngbin0 -> 17009 bytes
-rw-r--r--examples/particles/images/launcherIcons/spritevariedparticles.pngbin0 -> 2569 bytes
-rw-r--r--examples/particles/images/launcherIcons/startstop.pngbin0 -> 13670 bytes
-rw-r--r--examples/particles/images/launcherIcons/timedgroupchanges.pngbin0 -> 16139 bytes
-rw-r--r--examples/particles/images/launcherIcons/trailemitter.pngbin0 -> 5371 bytes
-rw-r--r--examples/particles/images/launcherIcons/trails.pngbin0 -> 23168 bytes
-rw-r--r--examples/particles/images/launcherIcons/turbulence.pngbin0 -> 9684 bytes
-rw-r--r--examples/particles/images/launcherIcons/velocityfrommotion.pngbin0 -> 36360 bytes
-rw-r--r--examples/particles/images/launcherIcons/wander.pngbin0 -> 5858 bytes
-rw-r--r--examples/particles/images/matchmask.pngbin0 -> 2369 bytes
-rw-r--r--examples/particles/images/meteor.pngbin0 -> 83169 bytes
-rw-r--r--examples/particles/images/meteor_explo.pngbin0 -> 219946 bytes
-rw-r--r--examples/particles/images/meteors.pngbin0 -> 132137 bytes
-rw-r--r--examples/particles/images/nullRock.pngbin0 -> 140 bytes
-rw-r--r--examples/particles/images/particle.pngbin0 -> 861 bytes
-rw-r--r--examples/particles/images/particle2.pngbin0 -> 3909 bytes
-rw-r--r--examples/particles/images/particle3.pngbin0 -> 3186 bytes
-rw-r--r--examples/particles/images/particle4.pngbin0 -> 1799 bytes
-rw-r--r--examples/particles/images/particleA.pngbin0 -> 3541 bytes
-rw-r--r--examples/particles/images/portal_bg.pngbin0 -> 96858 bytes
-rw-r--r--examples/particles/images/realLeaf1.pngbin0 -> 15625 bytes
-rw-r--r--examples/particles/images/realLeaf2.pngbin0 -> 13660 bytes
-rw-r--r--examples/particles/images/realLeaf3.pngbin0 -> 23809 bytes
-rw-r--r--examples/particles/images/realLeaf4.pngbin0 -> 23655 bytes
-rw-r--r--examples/particles/images/rocket.pngbin0 -> 7315 bytes
-rw-r--r--examples/particles/images/rocket2.pngbin0 -> 1918 bytes
-rw-r--r--examples/particles/images/sizeInOut.pngbin0 -> 251 bytes
-rw-r--r--examples/particles/images/snowflake.pngbin0 -> 189327 bytes
-rw-r--r--examples/particles/images/sparkleSize.pngbin0 -> 378 bytes
-rw-r--r--examples/particles/images/star.pngbin0 -> 1550 bytes
-rw-r--r--examples/particles/images/starfish_0.pngbin0 -> 15972 bytes
-rw-r--r--examples/particles/images/starfish_1.pngbin0 -> 15746 bytes
-rw-r--r--examples/particles/images/starfish_2.pngbin0 -> 16067 bytes
-rw-r--r--examples/particles/images/starfish_3.pngbin0 -> 16201 bytes
-rw-r--r--examples/particles/images/starfish_4.pngbin0 -> 14698 bytes
-rw-r--r--examples/particles/images/starfish_mask.pngbin0 -> 11301 bytes
-rw-r--r--examples/particles/itemparticle/content/Delegate.qml88
-rw-r--r--examples/particles/itemparticle/content/Delegate2.qml79
-rw-r--r--examples/particles/itemparticle/content/ExpandingDelegate.qml204
-rw-r--r--examples/particles/itemparticle/content/RssModel.qml56
-rw-r--r--examples/particles/itemparticle/content/bubble.pngbin0 -> 3413 bytes
-rw-r--r--examples/particles/itemparticle/content/script.js27
-rw-r--r--examples/particles/itemparticle/delegates.qml91
-rw-r--r--examples/particles/itemparticle/particleview.qml274
-rw-r--r--examples/particles/particles.pro1
-rw-r--r--examples/particles/simple/dynamiccomparison.qml126
-rw-r--r--examples/particles/simple/dynamicemitters.qml122
-rw-r--r--examples/particles/simple/multiplepainters.qml90
-rw-r--r--examples/particles/simple/startstop.qml81
-rw-r--r--examples/qml/cppextensions/imageprovider/imageprovider.cpp6
-rw-r--r--examples/qml/cppextensions/imageprovider/imageprovider.json1
-rw-r--r--examples/qml/cppextensions/imageprovider/imageprovider.pro2
-rw-r--r--examples/qml/cppextensions/plugins/plugin.cpp6
-rw-r--r--examples/qml/cppextensions/plugins/plugin.json1
-rw-r--r--examples/qml/cppextensions/plugins/plugins.pro8
-rw-r--r--examples/qml/cppextensions/referenceexamples/attached/birthdayparty.cpp2
-rw-r--r--examples/qml/cppextensions/referenceexamples/binding/birthdayparty.cpp2
-rw-r--r--examples/qml/cppextensions/referenceexamples/coercion/birthdayparty.cpp2
-rw-r--r--examples/qml/cppextensions/referenceexamples/default/birthdayparty.cpp2
-rw-r--r--examples/qml/cppextensions/referenceexamples/grouped/birthdayparty.cpp2
-rw-r--r--examples/qml/cppextensions/referenceexamples/methods/birthdayparty.cpp2
-rw-r--r--examples/qml/cppextensions/referenceexamples/properties/birthdayparty.cpp2
-rw-r--r--examples/qml/cppextensions/referenceexamples/signal/birthdayparty.cpp2
-rw-r--r--examples/qml/cppextensions/referenceexamples/valuesource/birthdayparty.cpp2
-rw-r--r--examples/qml/dynamicscene/content/Button.qml80
-rw-r--r--examples/qml/dynamicscene/content/GenericSceneItem.qml49
-rw-r--r--examples/qml/dynamicscene/content/PaletteItem.qml59
-rw-r--r--examples/qml/dynamicscene/content/PerspectiveItem.qml65
-rw-r--r--examples/qml/dynamicscene/content/Sun.qml78
-rw-r--r--examples/qml/dynamicscene/content/images/NOTE1
-rw-r--r--examples/qml/dynamicscene/content/images/face-smile.pngbin0 -> 15408 bytes
-rw-r--r--examples/qml/dynamicscene/content/images/moon.pngbin0 -> 1757 bytes
-rw-r--r--examples/qml/dynamicscene/content/images/rabbit_brown.pngbin0 -> 1245 bytes
-rw-r--r--examples/qml/dynamicscene/content/images/rabbit_bw.pngbin0 -> 1759 bytes
-rw-r--r--examples/qml/dynamicscene/content/images/star.pngbin0 -> 349 bytes
-rw-r--r--examples/qml/dynamicscene/content/images/sun.pngbin0 -> 8153 bytes
-rw-r--r--examples/qml/dynamicscene/content/images/tree_s.pngbin0 -> 3406 bytes
-rw-r--r--examples/qml/dynamicscene/content/itemCreation.js62
-rw-r--r--examples/qml/dynamicscene/dynamicscene.qml275
-rw-r--r--examples/qml/qml.pro37
-rw-r--r--examples/qml/xmlhttprequest/data.xml5
-rw-r--r--examples/qml/xmlhttprequest/xmlhttprequest-example.qml95
-rw-r--r--examples/quick/accessibility/accessibility.pro10
-rw-r--r--examples/quick/accessibility/accessibility.qml110
-rw-r--r--examples/quick/accessibility/accessibility.qmlproject16
-rw-r--r--examples/quick/accessibility/content/Button.qml80
-rw-r--r--examples/quick/accessibility/main.cpp41
-rw-r--r--examples/quick/animation/animation.pro10
-rw-r--r--examples/quick/animation/animation.qml93
-rw-r--r--examples/quick/animation/animation.qmlproject16
-rw-r--r--examples/quick/animation/basics/color-animation.qml121
-rw-r--r--examples/quick/animation/basics/images/face-smile.pngbin0 -> 15408 bytes
-rw-r--r--examples/quick/animation/basics/images/moon.pngbin0 -> 2433 bytes
-rw-r--r--examples/quick/animation/basics/images/shadow.pngbin0 -> 425 bytes
-rw-r--r--examples/quick/animation/basics/images/star.pngbin0 -> 349 bytes
-rw-r--r--examples/quick/animation/basics/images/sun.pngbin0 -> 8153 bytes
-rw-r--r--examples/quick/animation/basics/property-animation.qml105
-rw-r--r--examples/quick/animation/behaviors/SideRect.qml62
-rw-r--r--examples/quick/animation/behaviors/behavior-example.qml118
-rw-r--r--examples/quick/animation/behaviors/tvtennis.qml109
-rw-r--r--examples/quick/animation/behaviors/wigglytext.qml108
-rw-r--r--examples/quick/animation/easing/content/QuitButton.qml52
-rw-r--r--examples/quick/animation/easing/content/quit.pngbin0 -> 583 bytes
-rw-r--r--examples/quick/animation/easing/easing.qml157
-rw-r--r--examples/quick/animation/main.cpp41
-rw-r--r--examples/quick/animation/pathanimation/pathanimation.qml105
-rw-r--r--examples/quick/animation/pathinterpolator/pathinterpolator.qml112
-rw-r--r--examples/quick/animation/states/qt-logo.pngbin0 -> 5149 bytes
-rw-r--r--examples/quick/animation/states/states.qml101
-rw-r--r--examples/quick/animation/states/transitions.qml130
-rw-r--r--examples/quick/canvas/bezierCurve/bezierCurve.qml124
-rw-r--r--examples/quick/canvas/clip/clip.qml150
-rw-r--r--examples/quick/canvas/contents/Button.qml87
-rw-r--r--examples/quick/canvas/contents/ScrollBar.qml74
-rw-r--r--examples/quick/canvas/contents/Slider.qml115
-rw-r--r--examples/quick/canvas/contents/Stocks.qml147
-rw-r--r--examples/quick/canvas/contents/TitleBar.qml70
-rw-r--r--examples/quick/canvas/contents/ToolBar.qml69
-rw-r--r--examples/quick/canvas/contents/images/button-pressed.pngbin0 -> 571 bytes
-rw-r--r--examples/quick/canvas/contents/images/button.pngbin0 -> 564 bytes
-rw-r--r--examples/quick/canvas/contents/images/default.svg82
-rwxr-xr-xexamples/quick/canvas/contents/images/gloss.pngbin0 -> 1236 bytes
-rwxr-xr-xexamples/quick/canvas/contents/images/lineedit.pngbin0 -> 1415 bytes
-rw-r--r--examples/quick/canvas/contents/images/lineedit.sci5
-rwxr-xr-xexamples/quick/canvas/contents/images/quit.pngbin0 -> 2369 bytes
-rwxr-xr-xexamples/quick/canvas/contents/images/stripes.pngbin0 -> 257 bytes
-rwxr-xr-xexamples/quick/canvas/contents/images/titlebar.pngbin0 -> 1436 bytes
-rw-r--r--examples/quick/canvas/contents/images/titlebar.sci5
-rwxr-xr-xexamples/quick/canvas/contents/images/toolbutton.pngbin0 -> 2550 bytes
-rw-r--r--examples/quick/canvas/contents/images/toolbutton.sci5
-rw-r--r--examples/quick/canvas/contents/qt-logo.pngbin0 -> 23519 bytes
-rw-r--r--examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml128
-rw-r--r--examples/quick/canvas/roundedrect/roundedrect.qml125
-rw-r--r--examples/quick/canvas/smile/smile.qml128
-rw-r--r--examples/quick/canvas/squircle/squircle.pngbin0 -> 771 bytes
-rw-r--r--examples/quick/canvas/squircle/squircle.qml155
-rw-r--r--examples/quick/canvas/stockchart/README5
-rw-r--r--examples/quick/canvas/stockchart/com/nokia/StockChartExample/qmldir1
-rw-r--r--examples/quick/canvas/stockchart/model.cpp255
-rw-r--r--examples/quick/canvas/stockchart/model.h166
-rw-r--r--examples/quick/canvas/stockchart/plugin.cpp60
-rw-r--r--examples/quick/canvas/stockchart/stock.qml726
-rw-r--r--examples/quick/canvas/stockchart/stockchart.pro20
-rw-r--r--examples/quick/canvas/tiger/tiger.js721
-rw-r--r--examples/quick/canvas/tiger/tiger.qml129
-rw-r--r--examples/quick/canvas/twitterfriends/TwitterUser.qml294
-rw-r--r--examples/quick/canvas/twitterfriends/cache.js42
-rw-r--r--examples/quick/canvas/twitterfriends/twitter.qml141
-rw-r--r--examples/quick/draganddrop/draganddrop.pro10
-rw-r--r--examples/quick/draganddrop/draganddrop.qml68
-rw-r--r--examples/quick/draganddrop/draganddrop.qmlproject16
-rw-r--r--examples/quick/draganddrop/main.cpp41
-rw-r--r--examples/quick/draganddrop/tiles/DragTile.qml90
-rw-r--r--examples/quick/draganddrop/tiles/DropTile.qml68
-rw-r--r--examples/quick/draganddrop/tiles/tiles.qml109
-rw-r--r--examples/quick/draganddrop/views/gridview.qml129
-rw-r--r--examples/quick/imageelements/animatedsprite.qml76
-rw-r--r--examples/quick/imageelements/borderimage.qml119
-rw-r--r--examples/quick/imageelements/content/BearSheet.pngbin0 -> 406337 bytes
-rw-r--r--examples/quick/imageelements/content/BorderImageSelector.qml96
-rw-r--r--examples/quick/imageelements/content/ImageCell.qml60
-rw-r--r--examples/quick/imageelements/content/MyBorderImage.qml90
-rw-r--r--examples/quick/imageelements/content/ShadowRectangle.qml54
-rw-r--r--examples/quick/imageelements/content/bw.pngbin0 -> 1357 bytes
-rw-r--r--examples/quick/imageelements/content/colors-round.sci7
-rw-r--r--examples/quick/imageelements/content/colors-stretch.sci5
-rw-r--r--examples/quick/imageelements/content/colors.pngbin0 -> 1655 bytes
-rw-r--r--examples/quick/imageelements/content/qt-logo.pngbin0 -> 5149 bytes
-rw-r--r--examples/quick/imageelements/content/shadow.pngbin0 -> 588 bytes
-rw-r--r--examples/quick/imageelements/content/speaker.pngbin0 -> 784525 bytes
-rw-r--r--examples/quick/imageelements/image.qml66
-rw-r--r--examples/quick/imageelements/imageelements.pro10
-rw-r--r--examples/quick/imageelements/imageelements.qml77
-rw-r--r--examples/quick/imageelements/imageelements.qmlproject16
-rw-r--r--examples/quick/imageelements/main.cpp41
-rw-r--r--examples/quick/imageelements/shadows.qml64
-rw-r--r--examples/quick/imageelements/spritesequence.qml116
-rw-r--r--examples/quick/keyinteraction/focus/Core/ContextMenu.qml65
-rw-r--r--examples/quick/keyinteraction/focus/Core/GridMenu.qml105
-rw-r--r--examples/quick/keyinteraction/focus/Core/ListMenu.qml105
-rw-r--r--examples/quick/keyinteraction/focus/Core/ListViewDelegate.qml85
-rw-r--r--examples/quick/keyinteraction/focus/Core/images/arrow.pngbin0 -> 583 bytes
-rw-r--r--examples/quick/keyinteraction/focus/Core/images/qt-logo.pngbin0 -> 5149 bytes
-rw-r--r--examples/quick/keyinteraction/focus/focus.qml111
-rw-r--r--examples/quick/modelviews/abstractitemmodel/abstractitemmodel.pro10
-rw-r--r--examples/quick/modelviews/abstractitemmodel/abstractitemmodel.qrc6
-rw-r--r--examples/quick/modelviews/abstractitemmodel/main.cpp70
-rw-r--r--examples/quick/modelviews/abstractitemmodel/model.cpp90
-rw-r--r--examples/quick/modelviews/abstractitemmodel/model.h83
-rw-r--r--examples/quick/modelviews/abstractitemmodel/view.qml50
-rw-r--r--examples/quick/modelviews/gridview/gridview-example.qml93
-rw-r--r--examples/quick/modelviews/gridview/pics/AddressBook_48.pngbin0 -> 3350 bytes
-rw-r--r--examples/quick/modelviews/gridview/pics/AudioPlayer_48.pngbin0 -> 3806 bytes
-rw-r--r--examples/quick/modelviews/gridview/pics/Camera_48.pngbin0 -> 3540 bytes
-rw-r--r--examples/quick/modelviews/gridview/pics/DateBook_48.pngbin0 -> 2610 bytes
-rw-r--r--examples/quick/modelviews/gridview/pics/EMail_48.pngbin0 -> 3655 bytes
-rw-r--r--examples/quick/modelviews/gridview/pics/TodoList_48.pngbin0 -> 3429 bytes
-rw-r--r--examples/quick/modelviews/gridview/pics/VideoPlayer_48.pngbin0 -> 4151 bytes
-rw-r--r--examples/quick/modelviews/listview/content/PetsModel.qml98
-rw-r--r--examples/quick/modelviews/listview/content/PressAndHoldButton.qml82
-rw-r--r--examples/quick/modelviews/listview/content/RecipesModel.qml129
-rw-r--r--examples/quick/modelviews/listview/content/TextButton.qml78
-rw-r--r--examples/quick/modelviews/listview/content/ToggleButton.qml58
-rw-r--r--examples/quick/modelviews/listview/content/pics/arrow-down.pngbin0 -> 594 bytes
-rw-r--r--examples/quick/modelviews/listview/content/pics/arrow-up.pngbin0 -> 692 bytes
-rw-r--r--examples/quick/modelviews/listview/content/pics/fruit-salad.jpgbin0 -> 17952 bytes
-rw-r--r--examples/quick/modelviews/listview/content/pics/hamburger.jpgbin0 -> 8572 bytes
-rw-r--r--examples/quick/modelviews/listview/content/pics/lemonade.jpgbin0 -> 6645 bytes
-rw-r--r--examples/quick/modelviews/listview/content/pics/list-delete.pngbin0 -> 831 bytes
-rw-r--r--examples/quick/modelviews/listview/content/pics/minus-sign.pngbin0 -> 250 bytes
-rw-r--r--examples/quick/modelviews/listview/content/pics/moreDown.pngbin0 -> 217 bytes
-rw-r--r--examples/quick/modelviews/listview/content/pics/moreUp.pngbin0 -> 212 bytes
-rw-r--r--examples/quick/modelviews/listview/content/pics/pancakes.jpgbin0 -> 9163 bytes
-rw-r--r--examples/quick/modelviews/listview/content/pics/plus-sign.pngbin0 -> 462 bytes
-rw-r--r--examples/quick/modelviews/listview/content/pics/vegetable-soup.jpgbin0 -> 8639 bytes
-rw-r--r--examples/quick/modelviews/listview/dynamiclist.qml203
-rw-r--r--examples/quick/modelviews/listview/expandingdelegates.qml202
-rw-r--r--examples/quick/modelviews/listview/highlight.qml99
-rw-r--r--examples/quick/modelviews/listview/highlightranges.qml122
-rw-r--r--examples/quick/modelviews/listview/sections.qml127
-rw-r--r--examples/quick/modelviews/modelviews.pro8
-rw-r--r--examples/quick/modelviews/modelviews.qml64
-rw-r--r--examples/quick/modelviews/modelviews.qmlproject16
-rw-r--r--examples/quick/modelviews/objectlistmodel/dataobject.cpp78
-rw-r--r--examples/quick/modelviews/objectlistmodel/dataobject.h76
-rw-r--r--examples/quick/modelviews/objectlistmodel/main.cpp78
-rw-r--r--examples/quick/modelviews/objectlistmodel/objectlistmodel.pro6
-rw-r--r--examples/quick/modelviews/objectlistmodel/objectlistmodel.qmlproject14
-rw-r--r--examples/quick/modelviews/objectlistmodel/objectlistmodel.qrc5
-rw-r--r--examples/quick/modelviews/objectlistmodel/view.qml55
-rw-r--r--examples/quick/modelviews/package/Delegate.qml88
-rw-r--r--examples/quick/modelviews/package/view.qml80
-rw-r--r--examples/quick/modelviews/parallax/content/Clock.qml143
-rw-r--r--examples/quick/modelviews/parallax/content/ParallaxView.qml123
-rw-r--r--examples/quick/modelviews/parallax/content/QuitButton.qml52
-rw-r--r--examples/quick/modelviews/parallax/content/Smiley.qml84
-rw-r--r--examples/quick/modelviews/parallax/content/background.pngbin0 -> 46895 bytes
-rw-r--r--examples/quick/modelviews/parallax/content/center.pngbin0 -> 765 bytes
-rw-r--r--examples/quick/modelviews/parallax/content/clock-night.pngbin0 -> 23359 bytes
-rw-r--r--examples/quick/modelviews/parallax/content/clock.pngbin0 -> 20653 bytes
-rw-r--r--examples/quick/modelviews/parallax/content/hour.pngbin0 -> 625 bytes
-rw-r--r--examples/quick/modelviews/parallax/content/minute.pngbin0 -> 625 bytes
-rw-r--r--examples/quick/modelviews/parallax/content/pics/background.jpgbin0 -> 209814 bytes
-rw-r--r--examples/quick/modelviews/parallax/content/pics/face-smile.pngbin0 -> 15408 bytes
-rw-r--r--examples/quick/modelviews/parallax/content/pics/home-page.pngbin0 -> 3051 bytes
-rw-r--r--examples/quick/modelviews/parallax/content/pics/home-page.svg445
-rw-r--r--examples/quick/modelviews/parallax/content/pics/shadow.pngbin0 -> 425 bytes
-rw-r--r--examples/quick/modelviews/parallax/content/pics/yast-joystick.pngbin0 -> 2723 bytes
-rw-r--r--examples/quick/modelviews/parallax/content/pics/yast-wol.pngbin0 -> 3769 bytes
-rw-r--r--examples/quick/modelviews/parallax/content/quit.pngbin0 -> 583 bytes
-rw-r--r--examples/quick/modelviews/parallax/content/second.pngbin0 -> 303 bytes
-rw-r--r--examples/quick/modelviews/parallax/parallax.qml76
-rw-r--r--examples/quick/modelviews/pathview/pathview-example.qml107
-rw-r--r--examples/quick/modelviews/pathview/pics/AddressBook_48.pngbin0 -> 3350 bytes
-rw-r--r--examples/quick/modelviews/pathview/pics/AudioPlayer_48.pngbin0 -> 3806 bytes
-rw-r--r--examples/quick/modelviews/pathview/pics/Camera_48.pngbin0 -> 3540 bytes
-rw-r--r--examples/quick/modelviews/pathview/pics/DateBook_48.pngbin0 -> 2610 bytes
-rw-r--r--examples/quick/modelviews/pathview/pics/EMail_48.pngbin0 -> 3655 bytes
-rw-r--r--examples/quick/modelviews/pathview/pics/TodoList_48.pngbin0 -> 3429 bytes
-rw-r--r--examples/quick/modelviews/pathview/pics/VideoPlayer_48.pngbin0 -> 4151 bytes
-rw-r--r--examples/quick/modelviews/stringlistmodel/main.cpp77
-rw-r--r--examples/quick/modelviews/stringlistmodel/stringlistmodel.pro4
-rw-r--r--examples/quick/modelviews/stringlistmodel/stringlistmodel.qrc5
-rw-r--r--examples/quick/modelviews/stringlistmodel/view.qml54
-rw-r--r--examples/quick/modelviews/visualdatamodel/dragselection.qml200
-rw-r--r--examples/quick/modelviews/visualdatamodel/slideshow.qml156
-rw-r--r--examples/quick/modelviews/visualdatamodel/sortedmodel.qml141
-rw-r--r--examples/quick/modelviews/visualdatamodel/visualdatamodel.qmlproject14
-rw-r--r--examples/quick/modelviews/visualitemmodel/visualitemmodel.qml116
-rw-r--r--examples/quick/mousearea/mousearea-example.qml176
-rw-r--r--examples/quick/openglunderqml/main.cpp60
-rw-r--r--examples/quick/openglunderqml/main.qml78
-rw-r--r--examples/quick/openglunderqml/openglunderqml.pro6
-rw-r--r--examples/quick/openglunderqml/squircle.cpp123
-rw-r--r--examples/quick/openglunderqml/squircle.h76
-rw-r--r--examples/quick/painteditem/painteditem.pro5
-rw-r--r--examples/quick/painteditem/smile/main.cpp96
-rw-r--r--examples/quick/painteditem/smile/smile.pro11
-rw-r--r--examples/quick/painteditem/smile/smile.qml132
-rw-r--r--examples/quick/painteditem/textballoons/TextBalloonPlugin/plugin.h55
-rw-r--r--examples/quick/painteditem/textballoons/TextBalloonPlugin/qmldir1
-rw-r--r--examples/quick/painteditem/textballoons/textballoon.cpp92
-rw-r--r--examples/quick/painteditem/textballoons/textballoon.h68
-rw-r--r--examples/quick/painteditem/textballoons/textballoon.json1
-rw-r--r--examples/quick/painteditem/textballoons/textballoons.pro25
-rw-r--r--examples/quick/painteditem/textballoons/textballoons.qml110
-rw-r--r--examples/quick/positioners/content/Button.qml78
-rw-r--r--examples/quick/positioners/content/add.pngbin0 -> 810 bytes
-rw-r--r--examples/quick/positioners/content/del.pngbin0 -> 488 bytes
-rw-r--r--examples/quick/positioners/positioners-attachedproperties.qml106
-rw-r--r--examples/quick/positioners/positioners.qml268
-rw-r--r--examples/quick/quick.pro17
-rw-r--r--examples/quick/righttoleft/layoutdirection/layoutdirection.qml246
-rw-r--r--examples/quick/righttoleft/layoutdirection/layoutdirection.qmlproject16
-rw-r--r--examples/quick/righttoleft/layoutmirroring/layoutmirroring.qml313
-rw-r--r--examples/quick/righttoleft/layoutmirroring/layoutmirroring.qmlproject16
-rw-r--r--examples/quick/righttoleft/textalignment/textalignment.qml427
-rw-r--r--examples/quick/righttoleft/textalignment/textalignment.qmlproject16
-rw-r--r--examples/quick/shadereffects/content/Slider.qml93
-rw-r--r--examples/quick/shadereffects/content/face-smile.pngbin0 -> 15408 bytes
-rw-r--r--examples/quick/shadereffects/content/qt-logo.pngbin0 -> 13923 bytes
-rw-r--r--examples/quick/shadereffects/shadereffects.qml315
-rw-r--r--examples/quick/text/fonts/availableFonts.qml57
-rw-r--r--examples/quick/text/fonts/banner.qml61
-rw-r--r--examples/quick/text/fonts/content/fonts/tarzeau_ocr_a.ttfbin0 -> 24544 bytes
-rw-r--r--examples/quick/text/fonts/fonts.qml104
-rw-r--r--examples/quick/text/fonts/hello.qml79
-rw-r--r--examples/quick/text/imgtag/TextWithImage.qml55
-rw-r--r--examples/quick/text/imgtag/images/face-sad.pngbin0 -> 6148 bytes
-rw-r--r--examples/quick/text/imgtag/images/face-smile-big.pngbin0 -> 6058 bytes
-rw-r--r--examples/quick/text/imgtag/images/face-smile.pngbin0 -> 6446 bytes
-rw-r--r--examples/quick/text/imgtag/images/heart200.pngbin0 -> 8248 bytes
-rw-r--r--examples/quick/text/imgtag/images/qtlogo.pngbin0 -> 6450 bytes
-rw-r--r--examples/quick/text/imgtag/images/starfish_2.pngbin0 -> 18243 bytes
-rw-r--r--examples/quick/text/imgtag/imgtag.qml101
-rw-r--r--examples/quick/text/styledtext-layout.qml107
-rw-r--r--examples/quick/text/text.qml57
-rw-r--r--examples/quick/text/text.qmlproject16
-rw-r--r--examples/quick/text/textselection/pics/endHandle.pngbin0 -> 185 bytes
-rw-r--r--examples/quick/text/textselection/pics/endHandle.sci5
-rw-r--r--examples/quick/text/textselection/pics/startHandle.pngbin0 -> 178 bytes
-rw-r--r--examples/quick/text/textselection/pics/startHandle.sci5
-rw-r--r--examples/quick/text/textselection/textselection.qml211
-rw-r--r--examples/quick/threading/threadedlistmodel/dataloader.js49
-rw-r--r--examples/quick/threading/threadedlistmodel/threadedlistmodel.qmlproject56
-rw-r--r--examples/quick/threading/threadedlistmodel/timedisplay.qml76
-rw-r--r--examples/quick/threading/workerscript/workerscript.js15
-rw-r--r--examples/quick/threading/workerscript/workerscript.qml83
-rw-r--r--examples/quick/threading/workerscript/workerscript.qmlproject16
-rw-r--r--examples/quick/touchinteraction/flickable/content/Day.qml153
-rw-r--r--examples/quick/touchinteraction/flickable/content/cork.jpgbin0 -> 149337 bytes
-rw-r--r--examples/quick/touchinteraction/flickable/content/note-yellow.pngbin0 -> 54559 bytes
-rw-r--r--examples/quick/touchinteraction/flickable/content/tack.pngbin0 -> 7282 bytes
-rw-r--r--examples/quick/touchinteraction/flickable/corkboards.qml116
-rw-r--r--examples/quick/touchinteraction/multipointtouch/bearwhack.qml133
-rw-r--r--examples/quick/touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml70
-rw-r--r--examples/quick/touchinteraction/multipointtouch/content/Bear0.pngbin0 -> 15163 bytes
-rw-r--r--examples/quick/touchinteraction/multipointtouch/content/Bear1.pngbin0 -> 99378 bytes
-rw-r--r--examples/quick/touchinteraction/multipointtouch/content/Bear2.pngbin0 -> 80759 bytes
-rw-r--r--examples/quick/touchinteraction/multipointtouch/content/Bear3.pngbin0 -> 21122 bytes
-rw-r--r--examples/quick/touchinteraction/multipointtouch/content/BearB.pngbin0 -> 18667 bytes
-rw-r--r--examples/quick/touchinteraction/multipointtouch/content/BearWhackParticleSystem.qml180
-rw-r--r--examples/quick/touchinteraction/multipointtouch/content/ParticleFlame.qml65
-rw-r--r--examples/quick/touchinteraction/multipointtouch/content/blur-circle.pngbin0 -> 4279 bytes
-rw-r--r--examples/quick/touchinteraction/multipointtouch/content/blur-circle3.pngbin0 -> 5148 bytes
-rw-r--r--examples/quick/touchinteraction/multipointtouch/content/heart-blur.pngbin0 -> 5406 bytes
-rw-r--r--examples/quick/touchinteraction/multipointtouch/content/title.pngbin0 -> 81252 bytes
-rw-r--r--examples/quick/touchinteraction/multipointtouch/multiflame.qml91
-rw-r--r--examples/quick/touchinteraction/pincharea/flickresize.qml97
-rw-r--r--examples/quick/touchinteraction/pincharea/qt-logo.jpgbin0 -> 40886 bytes
-rw-r--r--examples/quick/touchinteraction/touchinteraction.qml56
-rw-r--r--examples/quick/touchinteraction/touchinteraction.qmlproject16
-rw-r--r--examples/shared/Button.qml64
-rw-r--r--examples/shared/LauncherList.qml102
-rw-r--r--examples/shared/README11
-rw-r--r--examples/shared/SimpleLauncherDelegate.qml53
-rw-r--r--examples/shared/images/back.pngbin0 -> 404 bytes
-rw-r--r--examples/shared/qmldir3
-rw-r--r--examples/shared/shared.h49
-rw-r--r--examples/shared/shared.pro9
-rw-r--r--examples/tutorials/dynamicview/dynamicview1/PetsModel.qml102
-rw-r--r--examples/tutorials/dynamicview/dynamicview1/dynamicview.qml90
-rw-r--r--examples/tutorials/dynamicview/dynamicview2/PetsModel.qml98
-rw-r--r--examples/tutorials/dynamicview/dynamicview2/dynamicview.qml121
-rw-r--r--examples/tutorials/dynamicview/dynamicview3/PetsModel.qml98
-rw-r--r--examples/tutorials/dynamicview/dynamicview3/dynamicview.qml143
-rw-r--r--examples/tutorials/dynamicview/dynamicview4/ListSelector.qml120
-rw-r--r--examples/tutorials/dynamicview/dynamicview4/PetsModel.qml98
-rw-r--r--examples/tutorials/dynamicview/dynamicview4/dynamicview.qml219
-rw-r--r--examples/tutorials/extending/chapter1-basics/app.qml60
-rw-r--r--examples/tutorials/extending/chapter1-basics/chapter1-basics.pro5
-rw-r--r--examples/tutorials/extending/chapter1-basics/main.cpp57
-rw-r--r--examples/tutorials/extending/chapter1-basics/piechart.cpp79
-rw-r--r--examples/tutorials/extending/chapter1-basics/piechart.h71
-rw-r--r--examples/tutorials/extending/chapter2-methods/app.qml66
-rw-r--r--examples/tutorials/extending/chapter2-methods/chapter2-methods.pro5
-rw-r--r--examples/tutorials/extending/chapter2-methods/main.cpp57
-rw-r--r--examples/tutorials/extending/chapter2-methods/piechart.cpp84
-rw-r--r--examples/tutorials/extending/chapter2-methods/piechart.h84
-rw-r--r--examples/tutorials/extending/chapter3-bindings/app.qml74
-rw-r--r--examples/tutorials/extending/chapter3-bindings/chapter3-bindings.pro5
-rw-r--r--examples/tutorials/extending/chapter3-bindings/main.cpp57
-rw-r--r--examples/tutorials/extending/chapter3-bindings/piechart.cpp86
-rw-r--r--examples/tutorials/extending/chapter3-bindings/piechart.h84
-rw-r--r--examples/tutorials/extending/chapter4-customPropertyTypes/app.qml60
-rw-r--r--examples/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro7
-rw-r--r--examples/tutorials/extending/chapter4-customPropertyTypes/main.cpp66
-rw-r--r--examples/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp70
-rw-r--r--examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h78
-rw-r--r--examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp66
-rw-r--r--examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.h66
-rw-r--r--examples/tutorials/extending/chapter5-listproperties/app.qml70
-rw-r--r--examples/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro7
-rw-r--r--examples/tutorials/extending/chapter5-listproperties/main.cpp58
-rw-r--r--examples/tutorials/extending/chapter5-listproperties/piechart.cpp72
-rw-r--r--examples/tutorials/extending/chapter5-listproperties/piechart.h75
-rw-r--r--examples/tutorials/extending/chapter5-listproperties/pieslice.cpp86
-rw-r--r--examples/tutorials/extending/chapter5-listproperties/pieslice.h76
-rw-r--r--examples/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir1
-rw-r--r--examples/tutorials/extending/chapter6-plugins/app.qml69
-rw-r--r--examples/tutorials/extending/chapter6-plugins/chapter6-plugins.pro18
-rw-r--r--examples/tutorials/extending/chapter6-plugins/chartsplugin.cpp53
-rw-r--r--examples/tutorials/extending/chapter6-plugins/chartsplugin.h57
-rw-r--r--examples/tutorials/extending/chapter6-plugins/chartsplugin.json1
-rw-r--r--examples/tutorials/extending/chapter6-plugins/piechart.cpp71
-rw-r--r--examples/tutorials/extending/chapter6-plugins/piechart.h69
-rw-r--r--examples/tutorials/extending/chapter6-plugins/pieslice.cpp86
-rw-r--r--examples/tutorials/extending/chapter6-plugins/pieslice.h74
-rw-r--r--examples/tutorials/extending/extending.pro10
-rw-r--r--examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp3
-rw-r--r--examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.h1
-rw-r--r--examples/tutorials/gettingStartedQml/filedialog/dialogplugin.json1
-rw-r--r--examples/tutorials/helloworld/Cell.qml72
-rw-r--r--examples/tutorials/helloworld/tutorial1.qml63
-rw-r--r--examples/tutorials/helloworld/tutorial2.qml72
-rw-r--r--examples/tutorials/helloworld/tutorial3.qml91
-rw-r--r--examples/tutorials/samegame/samegame1/Block.qml53
-rw-r--r--examples/tutorials/samegame/samegame1/Button.qml83
-rw-r--r--examples/tutorials/samegame/samegame1/samegame.qml82
-rw-r--r--examples/tutorials/samegame/samegame1/samegame1.qmlproject16
-rw-r--r--examples/tutorials/samegame/samegame2/Block.qml51
-rw-r--r--examples/tutorials/samegame/samegame2/Button.qml81
-rw-r--r--examples/tutorials/samegame/samegame2/samegame.js63
-rw-r--r--examples/tutorials/samegame/samegame2/samegame.qml85
-rw-r--r--examples/tutorials/samegame/samegame2/samegame2.qmlproject16
-rw-r--r--examples/tutorials/samegame/samegame3/Block.qml63
-rw-r--r--examples/tutorials/samegame/samegame3/Button.qml81
-rw-r--r--examples/tutorials/samegame/samegame3/Dialog.qml71
-rw-r--r--examples/tutorials/samegame/samegame3/samegame.js174
-rw-r--r--examples/tutorials/samegame/samegame3/samegame.qml109
-rw-r--r--examples/tutorials/samegame/samegame3/samegame3.qmlproject16
-rw-r--r--examples/tutorials/samegame/samegame4/content/BoomBlock.qml122
-rw-r--r--examples/tutorials/samegame/samegame4/content/Button.qml81
-rw-r--r--examples/tutorials/samegame/samegame4/content/Dialog.qml107
-rwxr-xr-xexamples/tutorials/samegame/samegame4/content/samegame.js226
-rw-r--r--examples/tutorials/samegame/samegame4/highscores/README1
-rwxr-xr-xexamples/tutorials/samegame/samegame4/highscores/score_data.xml2
-rwxr-xr-xexamples/tutorials/samegame/samegame4/highscores/score_style.xsl28
-rwxr-xr-xexamples/tutorials/samegame/samegame4/highscores/scores.php31
-rw-r--r--examples/tutorials/samegame/samegame4/samegame.qml115
-rw-r--r--examples/tutorials/samegame/samegame4/samegame4.qmlproject16
-rw-r--r--examples/tutorials/samegame/shared/pics/background.jpgbin0 -> 36473 bytes
-rw-r--r--examples/tutorials/samegame/shared/pics/blueStar.pngbin0 -> 278 bytes
-rw-r--r--examples/tutorials/samegame/shared/pics/blueStone.pngbin0 -> 3054 bytes
-rw-r--r--examples/tutorials/samegame/shared/pics/greenStar.pngbin0 -> 273 bytes
-rw-r--r--examples/tutorials/samegame/shared/pics/greenStone.pngbin0 -> 2932 bytes
-rw-r--r--examples/tutorials/samegame/shared/pics/redStar.pngbin0 -> 274 bytes
-rw-r--r--examples/tutorials/samegame/shared/pics/redStone.pngbin0 -> 2902 bytes
-rw-r--r--examples/tutorials/samegame/shared/pics/star.pngbin0 -> 262 bytes
-rw-r--r--examples/tutorials/samegame/shared/pics/yellowStone.pngbin0 -> 3056 bytes
-rw-r--r--examples/tutorials/ui-components/dialcontrol/content/Dial.qml86
-rw-r--r--examples/tutorials/ui-components/dialcontrol/content/QuitButton.qml52
-rw-r--r--examples/tutorials/ui-components/dialcontrol/content/background.pngbin0 -> 35876 bytes
-rw-r--r--examples/tutorials/ui-components/dialcontrol/content/needle.pngbin0 -> 342 bytes
-rw-r--r--examples/tutorials/ui-components/dialcontrol/content/needle_shadow.pngbin0 -> 632 bytes
-rw-r--r--examples/tutorials/ui-components/dialcontrol/content/overlay.pngbin0 -> 3564 bytes
-rw-r--r--examples/tutorials/ui-components/dialcontrol/content/quit.pngbin0 -> 583 bytes
-rw-r--r--examples/tutorials/ui-components/dialcontrol/dialcontrol.qml98
-rw-r--r--examples/tutorials/ui-components/flipable/content/5_heart.pngbin0 -> 3872 bytes
-rw-r--r--examples/tutorials/ui-components/flipable/content/9_club.pngbin0 -> 6135 bytes
-rw-r--r--examples/tutorials/ui-components/flipable/content/Card.qml80
-rw-r--r--examples/tutorials/ui-components/flipable/content/back.pngbin0 -> 1418 bytes
-rw-r--r--examples/tutorials/ui-components/flipable/flipable.qml55
-rw-r--r--examples/tutorials/ui-components/progressbar/content/ProgressBar.qml83
-rw-r--r--examples/tutorials/ui-components/progressbar/content/background.pngbin0 -> 426 bytes
-rw-r--r--examples/tutorials/ui-components/progressbar/main.qml73
-rw-r--r--examples/tutorials/ui-components/scrollbar/ScrollBar.qml74
-rw-r--r--examples/tutorials/ui-components/scrollbar/main.qml93
-rw-r--r--examples/tutorials/ui-components/scrollbar/pics/niagara_falls.jpgbin0 -> 142510 bytes
-rw-r--r--examples/tutorials/ui-components/scrollbar/scrollbar.qmlproject16
-rw-r--r--examples/tutorials/ui-components/searchbox/SearchBox.qml109
-rw-r--r--examples/tutorials/ui-components/searchbox/images/clear.pngbin0 -> 429 bytes
-rw-r--r--examples/tutorials/ui-components/searchbox/images/lineedit-bg-focus.pngbin0 -> 526 bytes
-rw-r--r--examples/tutorials/ui-components/searchbox/images/lineedit-bg.pngbin0 -> 426 bytes
-rw-r--r--examples/tutorials/ui-components/searchbox/main.qml60
-rw-r--r--examples/tutorials/ui-components/searchbox/searchbox.qmlproject16
-rw-r--r--examples/tutorials/ui-components/slideswitch/content/Switch.qml117
-rw-r--r--examples/tutorials/ui-components/slideswitch/content/background.pngbin0 -> 3091 bytes
-rw-r--r--examples/tutorials/ui-components/slideswitch/content/background.svg23
-rw-r--r--examples/tutorials/ui-components/slideswitch/content/knob.pngbin0 -> 3101 bytes
-rw-r--r--examples/tutorials/ui-components/slideswitch/content/knob.svg867
-rw-r--r--examples/tutorials/ui-components/slideswitch/slideswitch.qml51
-rw-r--r--examples/tutorials/ui-components/spinner/content/Spinner.qml70
-rw-r--r--examples/tutorials/ui-components/spinner/content/spinner-bg.pngbin0 -> 345 bytes
-rw-r--r--examples/tutorials/ui-components/spinner/content/spinner-select.pngbin0 -> 320 bytes
-rw-r--r--examples/tutorials/ui-components/spinner/main.qml61
-rw-r--r--examples/tutorials/ui-components/spinner/spinner.qmlproject16
-rw-r--r--examples/tutorials/ui-components/tabwidget/TabWidget.qml102
-rw-r--r--examples/tutorials/ui-components/tabwidget/main.qml99
-rw-r--r--examples/tutorials/ui-components/tabwidget/tab.pngbin0 -> 507 bytes
-rw-r--r--examples/tutorials/ui-components/tabwidget/tabwidget.qmlproject16
-rw-r--r--examples/window/Window.qml58
-rw-r--r--examples/window/screen/screenInfo.qml90
-rw-r--r--examples/window/standalone.qml71
-rw-r--r--examples/window/window.cpp58
-rw-r--r--examples/window/window.pro5
768 files changed, 41326 insertions, 59 deletions
diff --git a/examples/HACKING b/examples/HACKING
new file mode 100644
index 0000000000..9539d2d129
--- /dev/null
+++ b/examples/HACKING
@@ -0,0 +1,23 @@
+Some guidelines for QtQml examples
+
+Snippets
+---
+Snippets are snatches of QML code that won't even run on their own. They don't belong here, they belong in doc/src/snippets. They should be contained in files that will compile on their own, for automated syntax validation, but don't have to look like anything.
+
+Examples
+---
+
+Examples are large blocks of QML code that demonstrate a feature. You should be able to launch an example and visually see the feature take effect. Examples should be written in a small form, and should automatically activate any features. Ideally, when you run an example, you see the feature demonstrate itself over and over until you get bored and close the application using your platform's close window mechanism. Examples shouldn't contain their own close buttons or start screen, explanatory text should be kept to a minimum (show, not tell), and reserve interaction for demonstrating interactive elements. The code should be held to a high level of quality, and should be understandable by people new to QML.
+
+Unless the demonstrated feature uses it, assume no interface devices other than a screen that can show a 320x480 rectangle and a generic pointing device (with the shared subset of mouse/touch functionality).
+
+Groups of similar examples should be placed in one folder with a single launcher application, which uses the shared folder of common components.
+
+The example, or launcher application in case of groups, should contain a qdoc comment explaining the example. The example or launcher should be buildable as a full C++ application and runnable with the standard qml file launcher. Usually this will consist primarily of using the macro found in shared.h.
+
+Demos
+---
+
+Demos are examples of creating full applications using QML. They should fit both a desktop and a mobile form factor, they should have their own start screen and method of exiting the application. They should be at a level of quality that you'd be comfortable submitting them to an app store for a platform of the appropriate hardware (screen size, input methods, etc.). The code should be written to a level that is easily understood and modified by a QML expert.
+
+Demos should have a qdoc file in their directory explaining the demo at a high level. The demo should be buildable as a full C++ application and preferably runnable with the standard qml file launcher.
diff --git a/examples/README b/examples/README
new file mode 100644
index 0000000000..aba1e2cc0d
--- /dev/null
+++ b/examples/README
@@ -0,0 +1,12 @@
+The Qt Declarative module provides the ability to specify and implement
+your user interface declaratively, using the Qt Meta-Object Language (QML). This
+language is very expressive and human readable, and can be used by
+designers to actually implement their UI vision. QML UIs can integrate
+with C++ code in many ways, including being loaded as a part of a C++ UI
+and loading data models from C++ and interacting with them.
+
+Mostof these examples can be viewed directly with the
+QML viewer utility, without requiring compilation.
+
+Documentation for these examples can be found via the Examples
+link in the main Qt documentation.
diff --git a/examples/demos/calculator/CalculatorCore/Button.qml b/examples/demos/calculator/CalculatorCore/Button.qml
new file mode 100644
index 0000000000..e7b3637b4c
--- /dev/null
+++ b/examples/demos/calculator/CalculatorCore/Button.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+BorderImage {
+ id: button
+
+ property alias operation: buttonText.text
+ property string color: ""
+
+ Accessible.name: operation
+ Accessible.description: "This button does " + operation
+ Accessible.role: Accessible.Button
+
+ signal clicked
+
+ source: "images/button-" + color + ".png"; clip: true
+ border { left: 10; top: 10; right: 10; bottom: 10 }
+
+ Rectangle {
+ id: shade
+ anchors.fill: button; radius: 10; color: "black"; opacity: 0
+ }
+
+ Text {
+ id: buttonText
+ anchors.centerIn: parent; anchors.verticalCenterOffset: -1
+ font.pixelSize: parent.width > parent.height ? parent.height * .5 : parent.width * .5
+ style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: {
+ window.doOp(operation)
+ button.clicked()
+ }
+ }
+
+ states: State {
+ name: "pressed"; when: mouseArea.pressed == true
+ PropertyChanges { target: shade; opacity: .4 }
+ }
+}
diff --git a/examples/demos/calculator/CalculatorCore/Display.qml b/examples/demos/calculator/CalculatorCore/Display.qml
new file mode 100644
index 0000000000..3dceeab169
--- /dev/null
+++ b/examples/demos/calculator/CalculatorCore/Display.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+BorderImage {
+ id: image
+
+ property alias text : displayText.text
+ property alias currentOperation : operationText
+
+ source: "images/display.png"
+ border { left: 10; top: 10; right: 10; bottom: 10 }
+
+ Text {
+ id: displayText
+ anchors {
+ right: parent.right; verticalCenter: parent.verticalCenter; verticalCenterOffset: -1
+ rightMargin: 6; left: operationText.right
+ }
+ font.pixelSize: parent.height * .6; text: "0"; horizontalAlignment: Text.AlignRight; elide: Text.ElideRight
+ color: "#343434"; smooth: true; font.bold: true
+ }
+ Text {
+ id: operationText
+ font.bold: true; font.pixelSize: parent.height * .7
+ color: "#343434"; smooth: true
+ anchors { left: parent.left; leftMargin: 6; verticalCenterOffset: -3; verticalCenter: parent.verticalCenter }
+ }
+}
diff --git a/examples/demos/calculator/CalculatorCore/calculator.js b/examples/demos/calculator/CalculatorCore/calculator.js
new file mode 100644
index 0000000000..e2b5692cf3
--- /dev/null
+++ b/examples/demos/calculator/CalculatorCore/calculator.js
@@ -0,0 +1,95 @@
+
+var curVal = 0
+var memory = 0
+var lastOp = ""
+var timer = 0
+
+function disabled(op) {
+ if (op == "." && display.text.toString().search(/\./) != -1) {
+ return true
+ } else if (op == squareRoot && display.text.toString().search(/-/) != -1) {
+ return true
+ } else {
+ return false
+ }
+}
+
+function doOperation(op) {
+ if (op == '*')//Keyboard Aliases
+ op = multiplication;
+ if (op == '/')
+ op = division;
+ if (disabled(op)) {
+ return
+ }
+
+ if (op.toString().length==1 && ((op >= "0" && op <= "9") || op==".") ) {
+ if (display.text.toString().length >= 14)
+ return; // No arbitrary length numbers
+ if (lastOp.toString().length == 1 && ((lastOp >= "0" && lastOp <= "9") || lastOp == ".") ) {
+ display.text = display.text + op.toString()
+ } else {
+ display.text = op
+ }
+ lastOp = op
+ return
+ }
+ lastOp = op
+
+ if (display.currentOperation.text == "+") {
+ display.text = Number(display.text.valueOf()) + Number(curVal.valueOf())
+ } else if (display.currentOperation.text == "-") {
+ display.text = Number(curVal) - Number(display.text.valueOf())
+ } else if (display.currentOperation.text == multiplication) {
+ display.text = Number(curVal) * Number(display.text.valueOf())
+ } else if (display.currentOperation.text == division) {
+ display.text = Number(Number(curVal) / Number(display.text.valueOf())).toString()
+ } else if (display.currentOperation.text == "=") {
+ }
+
+ if (op == "+" || op == "-" || op == multiplication || op == division) {
+ display.currentOperation.text = op
+ curVal = display.text.valueOf()
+ return
+ }
+
+ curVal = 0
+ display.currentOperation.text = ""
+
+ if (op == "1/x") {
+ display.text = (1 / display.text.valueOf()).toString()
+ } else if (op == "x^2") {
+ display.text = (display.text.valueOf() * display.text.valueOf()).toString()
+ } else if (op == "Abs") {
+ display.text = (Math.abs(display.text.valueOf())).toString()
+ } else if (op == "Int") {
+ display.text = (Math.floor(display.text.valueOf())).toString()
+ } else if (op == plusminus) {
+ display.text = (display.text.valueOf() * -1).toString()
+ } else if (op == squareRoot) {
+ display.text = (Math.sqrt(display.text.valueOf())).toString()
+ } else if (op == "mc") {
+ memory = 0;
+ } else if (op == "m+") {
+ memory += display.text.valueOf()
+ } else if (op == "mr") {
+ display.text = memory.toString()
+ } else if (op == "m-") {
+ memory = display.text.valueOf()
+ } else if (op == leftArrow) {
+ display.text = display.text.toString().slice(0, -1)
+ if (display.text.length == 0) {
+ display.text = "0"
+ }
+ } else if (op == "Off") {
+ Qt.quit();
+ } else if (op == "C") {
+ display.text = "0"
+ } else if (op == "AC") {
+ curVal = 0
+ memory = 0
+ lastOp = ""
+ display.text ="0"
+ }
+}
+
diff --git a/examples/demos/calculator/CalculatorCore/images/button-.png b/examples/demos/calculator/CalculatorCore/images/button-.png
new file mode 100644
index 0000000000..544e514536
--- /dev/null
+++ b/examples/demos/calculator/CalculatorCore/images/button-.png
Binary files differ
diff --git a/examples/demos/calculator/CalculatorCore/images/button-blue.png b/examples/demos/calculator/CalculatorCore/images/button-blue.png
new file mode 100644
index 0000000000..5f92de32d0
--- /dev/null
+++ b/examples/demos/calculator/CalculatorCore/images/button-blue.png
Binary files differ
diff --git a/examples/demos/calculator/CalculatorCore/images/button-green.png b/examples/demos/calculator/CalculatorCore/images/button-green.png
new file mode 100644
index 0000000000..36c93914c7
--- /dev/null
+++ b/examples/demos/calculator/CalculatorCore/images/button-green.png
Binary files differ
diff --git a/examples/demos/calculator/CalculatorCore/images/button-purple.png b/examples/demos/calculator/CalculatorCore/images/button-purple.png
new file mode 100644
index 0000000000..347cbbea9d
--- /dev/null
+++ b/examples/demos/calculator/CalculatorCore/images/button-purple.png
Binary files differ
diff --git a/examples/demos/calculator/CalculatorCore/images/button-red.png b/examples/demos/calculator/CalculatorCore/images/button-red.png
new file mode 100644
index 0000000000..3b335891ae
--- /dev/null
+++ b/examples/demos/calculator/CalculatorCore/images/button-red.png
Binary files differ
diff --git a/examples/demos/calculator/CalculatorCore/images/display.png b/examples/demos/calculator/CalculatorCore/images/display.png
new file mode 100644
index 0000000000..9507f4382e
--- /dev/null
+++ b/examples/demos/calculator/CalculatorCore/images/display.png
Binary files differ
diff --git a/examples/demos/calculator/CalculatorCore/qmldir b/examples/demos/calculator/CalculatorCore/qmldir
new file mode 100644
index 0000000000..a926b93fac
--- /dev/null
+++ b/examples/demos/calculator/CalculatorCore/qmldir
@@ -0,0 +1,2 @@
+Button Button.qml
+Display Display.qml
diff --git a/examples/demos/calculator/calculator-desktop.qml b/examples/demos/calculator/calculator-desktop.qml
new file mode 100644
index 0000000000..be65c77170
--- /dev/null
+++ b/examples/demos/calculator/calculator-desktop.qml
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Window 2.0
+import "CalculatorCore"
+import "CalculatorCore/calculator.js" as CalcEngine
+
+Rectangle {
+ id: window
+
+ width: 640; height: 480
+ color: "#282828"
+
+ property string rotateLeft: "\u2939"
+ property string rotateRight: "\u2935"
+ property string leftArrow: "\u2190"
+ property string division : "\u00f7"
+ property string multiplication : "\u00d7"
+ property string squareRoot : "\u221a"
+ property string plusminus : "\u00b1"
+
+ function doOp(operation) { CalcEngine.doOperation(operation) }
+ focus: true
+ Keys.onPressed: doOp(event.text);
+
+ Item {
+ id: main
+ width: 640
+ height: 480
+ anchors.centerIn: parent
+
+ Column {
+ id: box; spacing: 8
+
+ anchors { fill: parent; topMargin: 6; bottomMargin: 6; leftMargin: 6; rightMargin: 6 }
+
+ Display {
+ id: display
+ width: box.width-3
+ height: 64
+ }
+
+ Column {
+ id: column; spacing: 6
+
+ property real h: ((box.height - 72) / 6) - ((spacing * (6 - 1)) / 6)
+ property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4)
+
+ Row {
+ spacing: 6
+ Button { width: column.w; height: column.h; color: 'purple'; operation: "Off" }
+ Button { width: column.w; height: column.h; color: 'purple'; operation: leftArrow }
+ Button { width: column.w; height: column.h; color: 'purple'; operation: "C" }
+ Button { width: column.w; height: column.h; color: 'purple'; operation: "AC" }
+ }
+
+ Row {
+ spacing: 6
+ property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4)
+
+ Button { width: column.w; height: column.h; color: 'green'; operation: "mc" }
+ Button { width: column.w; height: column.h; color: 'green'; operation: "m+" }
+ Button { width: column.w; height: column.h; color: 'green'; operation: "m-" }
+ Button { width: column.w; height: column.h; color: 'green'; operation: "mr" }
+ }
+
+ Grid {
+ id: grid; rows: 5; columns: 5; spacing: 6
+
+ property real w: (box.width / columns) - ((spacing * (columns - 1)) / columns)
+
+ Button { width: grid.w; height: column.h; operation: "7"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "8"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "9"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: division }
+ Button { width: grid.w; height: column.h; operation: squareRoot }
+ Button { width: grid.w; height: column.h; operation: "4"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "5"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "6"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: multiplication }
+ Button { width: grid.w; height: column.h; operation: "x^2" }
+ Button { width: grid.w; height: column.h; operation: "1"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "2"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "3"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "-" }
+ Button { width: grid.w; height: column.h; operation: "1/x" }
+ Button { width: grid.w; height: column.h; operation: "0"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "." }
+ Button { width: grid.w; height: column.h; operation: plusminus }
+ Button { width: grid.w; height: column.h; operation: "+" }
+ Button { width: grid.w; height: column.h; operation: "="; color: 'red' }
+ }
+ }
+ }
+
+ }
+}
diff --git a/examples/demos/calculator/calculator-mobile.qml b/examples/demos/calculator/calculator-mobile.qml
new file mode 100644
index 0000000000..7ee622f698
--- /dev/null
+++ b/examples/demos/calculator/calculator-mobile.qml
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Window 2.0
+import "CalculatorCore"
+import "CalculatorCore/calculator.js" as CalcEngine
+
+Rectangle {
+ id: window
+
+ width: 320; height: 480
+ color: "#282828"
+
+ property string rotateLeft: "\u2939"
+ property string rotateRight: "\u2935"
+ property string leftArrow: "\u2190"
+ property string division : "\u00f7"
+ property string multiplication : "\u00d7"
+ property string squareRoot : "\u221a"
+ property string plusminus : "\u00b1"
+
+ function doOp(operation) { CalcEngine.doOperation(operation) }
+
+ Item {
+ id: main
+ state: "orientation " + Screen.orientation
+
+ //Note: Assumes a primarily portrait device
+ property bool landscapeWindow: window.width > window.height
+ property real baseWidth: landscapeWindow ? window.height : window.width
+ property real baseHeight: landscapeWindow ? window.width : window.height
+ property real rotationDelta: landscapeWindow ? -90 : 0
+
+ rotation: rotationDelta
+ width: main.baseWidth
+ height: main.baseHeight
+ anchors.centerIn: parent
+
+ Column {
+ id: box; spacing: 8
+
+ anchors { fill: parent; topMargin: 6; bottomMargin: 6; leftMargin: 6; rightMargin: 6 }
+
+ Display {
+ id: display
+ width: box.width-3
+ height: 64
+ }
+
+ Column {
+ id: column; spacing: 6
+
+ property real h: ((box.height - 72) / 6) - ((spacing * (6 - 1)) / 6)
+ property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4)
+
+ Row {
+ spacing: 6
+ Button { width: column.w; height: column.h; color: 'purple'; operation: "Off" }
+ Button { width: column.w; height: column.h; color: 'purple'; operation: leftArrow }
+ Button { width: column.w; height: column.h; color: 'purple'; operation: "C" }
+ Button { width: column.w; height: column.h; color: 'purple'; operation: "AC" }
+ }
+
+ Row {
+ spacing: 6
+ property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4)
+
+ Button { width: column.w; height: column.h; color: 'green'; operation: "mc" }
+ Button { width: column.w; height: column.h; color: 'green'; operation: "m+" }
+ Button { width: column.w; height: column.h; color: 'green'; operation: "m-" }
+ Button { width: column.w; height: column.h; color: 'green'; operation: "mr" }
+ }
+
+ Grid {
+ id: grid; rows: 5; columns: 5; spacing: 6
+
+ property real w: (box.width / columns) - ((spacing * (columns - 1)) / columns)
+
+ Button { width: grid.w; height: column.h; operation: "7"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "8"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "9"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: division }
+ Button { width: grid.w; height: column.h; operation: squareRoot }
+ Button { width: grid.w; height: column.h; operation: "4"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "5"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "6"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: multiplication }
+ Button { width: grid.w; height: column.h; operation: "x^2" }
+ Button { width: grid.w; height: column.h; operation: "1"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "2"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "3"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "-" }
+ Button { width: grid.w; height: column.h; operation: "1/x" }
+ Button { width: grid.w; height: column.h; operation: "0"; color: 'blue' }
+ Button { width: grid.w; height: column.h; operation: "." }
+ Button { width: grid.w; height: column.h; operation: plusminus }
+ Button { width: grid.w; height: column.h; operation: "+" }
+ Button { width: grid.w; height: column.h; operation: "="; color: 'red' }
+ }
+ }
+ }
+
+ states: [
+ State {
+ name: "orientation " + Qt.LandscapeOrientation
+ PropertyChanges { target: main; rotation: 90 + rotationDelta; width: main.baseHeight; height: main.baseWidth }
+ },
+ State {
+ name: "orientation " + Qt.InvertedPortraitOrientation
+ PropertyChanges { target: main; rotation: 180 + rotationDelta; }
+ },
+ State {
+ name: "orientation " + Qt.InvertedLandscapeOrientation
+ PropertyChanges { target: main; rotation: 270 + rotationDelta; width: main.baseHeight; height: main.baseWidth }
+ }
+ ]
+
+ transitions: Transition {
+ SequentialAnimation {
+ RotationAnimation { direction: RotationAnimation.Shortest; duration: 300; easing.type: Easing.InOutQuint }
+ NumberAnimation { properties: "x,y,width,height"; duration: 300; easing.type: Easing.InOutQuint }
+ }
+ }
+ }
+}
diff --git a/examples/demos/calculator/calculator.pro b/examples/demos/calculator/calculator.pro
new file mode 100644
index 0000000000..297d5cfdbb
--- /dev/null
+++ b/examples/demos/calculator/calculator.pro
@@ -0,0 +1,9 @@
+TEMPLATE = app
+
+QT += quick qml
+SOURCES += main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/demos/calculator
+qml.files = calculator-desktop.qml calculator-mobile.qml CalculatorCore
+qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/demos/calculator
+INSTALLS += target qml
diff --git a/examples/demos/calculator/calculator.qdoc b/examples/demos/calculator/calculator.qdoc
new file mode 100644
index 0000000000..e94bdb4cfd
--- /dev/null
+++ b/examples/demos/calculator/calculator.qdoc
@@ -0,0 +1,37 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title QML Demo - Calculator
+ \example declarative/calculator
+ \brief This is an example calculator application written in QML.
+ \image qml-calculator-demo-small.png
+
+ The Calculator demo implements a simple calculator in QML. It is written for desktop and portrait devices,
+ although on device it supports orientation changes.
+*/
+
diff --git a/examples/demos/calculator/main.cpp b/examples/demos/calculator/main.cpp
new file mode 100644
index 0000000000..fafe14fe46
--- /dev/null
+++ b/examples/demos/calculator/main.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QStringList>
+#include <QQuickView>
+#include <QQmlEngine>
+
+void usage()
+{
+ printf("Pass -desktop to use the Desktop UI");
+ exit(0);
+}
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc,argv);
+ QQuickView view;
+ QUrl launchFile = QUrl::fromLocalFile(QLatin1String("calculator-mobile.qml"));
+ if (app.arguments().contains(QLatin1String("-help")))
+ usage();
+ if (app.arguments().contains(QLatin1String("-desktop")))
+ launchFile = QUrl::fromLocalFile(QLatin1String("calculator-desktop.qml"));
+ view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));
+ view.setSource(launchFile);
+ view.show();
+ return app.exec();
+}
+
diff --git a/examples/demos/clocks/clocks.qml b/examples/demos/clocks/clocks.qml
new file mode 100644
index 0000000000..288e50c9eb
--- /dev/null
+++ b/examples/demos/clocks/clocks.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ id: root
+ width: 640; height: 320
+ color: "#646464"
+
+ ListView {
+ id: clockview
+ anchors.fill: parent
+ orientation: ListView.Horizontal
+ cacheBuffer: 2000
+ snapMode: ListView.SnapOneItem
+ highlightRangeMode: ListView.ApplyRange
+
+ delegate: Clock { city: cityName; shift: timeShift }
+ model: ListModel {
+ ListElement { cityName: "New York"; timeShift: -4 }
+ ListElement { cityName: "London"; timeShift: 0 }
+ ListElement { cityName: "Oslo"; timeShift: 1 }
+ ListElement { cityName: "Mumbai"; timeShift: 5.5 }
+ ListElement { cityName: "Tokyo"; timeShift: 9 }
+ ListElement { cityName: "Brisbane"; timeShift: 10 }
+ ListElement { cityName: "Los Angeles"; timeShift: -8 }
+ }
+ }
+
+ Image {
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ anchors.margins: 10
+ source: "content/arrow.png"
+ rotation: -90
+ opacity: clockview.atXBeginning ? 0 : 0.5
+ Behavior on opacity { NumberAnimation { duration: 500 } }
+ }
+
+ Image {
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ anchors.margins: 10
+ source: "content/arrow.png"
+ rotation: 90
+ opacity: clockview.atXEnd ? 0 : 0.5
+ Behavior on opacity { NumberAnimation { duration: 500 } }
+ }
+}
diff --git a/examples/demos/clocks/content/Clock.qml b/examples/demos/clocks/content/Clock.qml
new file mode 100644
index 0000000000..7f0e8cba83
--- /dev/null
+++ b/examples/demos/clocks/content/Clock.qml
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id : clock
+ width: {
+ if (ListView.view && ListView.view.width >= 200)
+ return ListView.view.width / Math.floor(ListView.view.width / 200.0);
+ else
+ return 200;
+ }
+
+ height: {
+ if (ListView.view && ListView.view.height >= 240)
+ return ListView.view.height;
+ else
+ return 240;
+ }
+
+ property alias city: cityLabel.text
+ property int hours
+ property int minutes
+ property int seconds
+ property real shift
+ property bool night: false
+ property bool internationalTime: true //Unset for local time
+
+ function timeChanged() {
+ var date = new Date;
+ hours = internationalTime ? date.getUTCHours() + Math.floor(clock.shift) : date.getHours()
+ night = ( hours < 7 || hours > 19 )
+ minutes = internationalTime ? date.getUTCMinutes() + ((clock.shift % 1) * 60) : date.getMinutes()
+ seconds = date.getUTCSeconds();
+ }
+
+ Timer {
+ interval: 100; running: true; repeat: true;
+ onTriggered: clock.timeChanged()
+ }
+
+ Item {
+ anchors.centerIn: parent
+ width: 200; height: 240
+
+ Image { id: background; source: "clock.png"; visible: clock.night == false }
+ Image { source: "clock-night.png"; visible: clock.night == true }
+
+
+ Image {
+ x: 92.5; y: 27
+ source: "hour.png"
+ smooth: true
+ transform: Rotation {
+ id: hourRotation
+ origin.x: 7.5; origin.y: 73;
+ angle: (clock.hours * 30) + (clock.minutes * 0.5)
+ Behavior on angle {
+ SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
+ }
+ }
+ }
+
+ Image {
+ x: 93.5; y: 17
+ source: "minute.png"
+ smooth: true
+ transform: Rotation {
+ id: minuteRotation
+ origin.x: 6.5; origin.y: 83;
+ angle: clock.minutes * 6
+ Behavior on angle {
+ SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
+ }
+ }
+ }
+
+ Image {
+ x: 97.5; y: 20
+ source: "second.png"
+ smooth: true
+ transform: Rotation {
+ id: secondRotation
+ origin.x: 2.5; origin.y: 80;
+ angle: clock.seconds * 6
+ Behavior on angle {
+ SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
+ }
+ }
+ }
+
+ Image {
+ anchors.centerIn: background; source: "center.png"
+ }
+
+ Text {
+ id: cityLabel
+ y: 210; anchors.horizontalCenter: parent.horizontalCenter
+ color: "white"
+ font.family: "Helvetica"
+ font.bold: true; font.pixelSize: 16
+ style: Text.Raised; styleColor: "black"
+ }
+ }
+}
diff --git a/examples/demos/clocks/content/QuitButton.qml b/examples/demos/clocks/content/QuitButton.qml
new file mode 100644
index 0000000000..702b892d23
--- /dev/null
+++ b/examples/demos/clocks/content/QuitButton.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+Image {
+ source: "quit.png"
+ scale: quitMouse.pressed ? 0.8 : 1.0
+ smooth: quitMouse.pressed
+ MouseArea {
+ id: quitMouse
+ anchors.fill: parent
+ anchors.margins: -10
+ onClicked: Qt.quit()
+ }
+}
diff --git a/examples/demos/clocks/content/arrow.png b/examples/demos/clocks/content/arrow.png
new file mode 100644
index 0000000000..e437312217
--- /dev/null
+++ b/examples/demos/clocks/content/arrow.png
Binary files differ
diff --git a/examples/demos/clocks/content/background.png b/examples/demos/clocks/content/background.png
new file mode 100644
index 0000000000..a885950862
--- /dev/null
+++ b/examples/demos/clocks/content/background.png
Binary files differ
diff --git a/examples/demos/clocks/content/center.png b/examples/demos/clocks/content/center.png
new file mode 100644
index 0000000000..7fbd802a44
--- /dev/null
+++ b/examples/demos/clocks/content/center.png
Binary files differ
diff --git a/examples/demos/clocks/content/clock-night.png b/examples/demos/clocks/content/clock-night.png
new file mode 100644
index 0000000000..cc7151a397
--- /dev/null
+++ b/examples/demos/clocks/content/clock-night.png
Binary files differ
diff --git a/examples/demos/clocks/content/clock.png b/examples/demos/clocks/content/clock.png
new file mode 100644
index 0000000000..462edacc0e
--- /dev/null
+++ b/examples/demos/clocks/content/clock.png
Binary files differ
diff --git a/examples/demos/clocks/content/hour.png b/examples/demos/clocks/content/hour.png
new file mode 100644
index 0000000000..f8061a1235
--- /dev/null
+++ b/examples/demos/clocks/content/hour.png
Binary files differ
diff --git a/examples/demos/clocks/content/minute.png b/examples/demos/clocks/content/minute.png
new file mode 100644
index 0000000000..1297ec7c2b
--- /dev/null
+++ b/examples/demos/clocks/content/minute.png
Binary files differ
diff --git a/examples/demos/clocks/content/quit.png b/examples/demos/clocks/content/quit.png
new file mode 100644
index 0000000000..b822057d4e
--- /dev/null
+++ b/examples/demos/clocks/content/quit.png
Binary files differ
diff --git a/examples/demos/clocks/content/second.png b/examples/demos/clocks/content/second.png
new file mode 100644
index 0000000000..4aa9fb5e8e
--- /dev/null
+++ b/examples/demos/clocks/content/second.png
Binary files differ
diff --git a/examples/demos/demos.pro b/examples/demos/demos.pro
new file mode 100644
index 0000000000..abe718b910
--- /dev/null
+++ b/examples/demos/demos.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS = calculator
diff --git a/examples/demos/flickr/content/Button.qml b/examples/demos/flickr/content/Button.qml
new file mode 100644
index 0000000000..57f846aec3
--- /dev/null
+++ b/examples/demos/flickr/content/Button.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: container
+
+ signal clicked
+
+ property string text
+
+ BorderImage {
+ id: buttonImage
+ source: "images/toolbutton.sci"
+ width: container.width; height: container.height
+ }
+ BorderImage {
+ id: pressed
+ opacity: 0
+ source: "images/toolbutton.sci"
+ width: container.width; height: container.height
+ }
+ MouseArea {
+ id: mouseRegion
+ anchors.fill: buttonImage
+ onClicked: { container.clicked(); }
+ }
+ Text {
+ color: "white"
+ anchors.centerIn: buttonImage; font.bold: true; font.pixelSize: 15
+ text: container.text; style: Text.Raised; styleColor: "black"
+ }
+ states: [
+ State {
+ name: "Pressed"
+ when: mouseRegion.pressed == true
+ PropertyChanges { target: pressed; opacity: 1 }
+ }
+ ]
+}
diff --git a/examples/demos/flickr/content/GridDelegate.qml b/examples/demos/flickr/content/GridDelegate.qml
new file mode 100644
index 0000000000..f8838bd609
--- /dev/null
+++ b/examples/demos/flickr/content/GridDelegate.qml
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: wrapper; width: GridView.view.cellWidth; height: GridView.view.cellHeight
+
+ function photoClicked() {
+ imageDetails.photoTitle = title;
+ imageDetails.photoTags = tags;
+ imageDetails.photoWidth = photoWidth;
+ imageDetails.photoHeight = photoHeight;
+ imageDetails.photoType = photoType;
+ imageDetails.photoAuthor = photoAuthor;
+ imageDetails.photoDate = photoDate;
+ imageDetails.photoUrl = url;
+ imageDetails.rating = 0;
+ scaleMe.state = "Details";
+ }
+
+ Item {
+ anchors.centerIn: parent
+ scale: 0.0
+ Behavior on scale { NumberAnimation { easing.type: Easing.InOutQuad} }
+ id: scaleMe
+
+ Item {
+ width: 77; height: 77; anchors.centerIn: parent
+ Rectangle {
+ id: whiteRect; width: 77; height: 77; color: "#dddddd"; smooth: true
+ Image { id: thumb; source: imagePath; x: 1; y: 1; smooth: true }
+ Image { source: "images/gloss.png" }
+ }
+ }
+
+ Connections {
+ target: toolBar
+ onButton2Clicked: if (scaleMe.state == 'Details' ) scaleMe.state = 'Show'
+ }
+
+ states: [
+ State {
+ name: "Show"; when: thumb.status == Image.Ready
+ PropertyChanges { target: scaleMe; scale: 1 }
+ },
+ State {
+ name: "Details"
+ PropertyChanges { target: scaleMe; scale: 1 }
+ ParentChange { target: whiteRect; x: 10; y: 20; parent: imageDetails.frontContainer }
+ PropertyChanges { target: background; state: "DetailedView" }
+ }
+ ]
+ transitions: [
+ Transition {
+ from: "Show"; to: "Details"
+ ParentAnimation {
+ via: foreground
+ NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad }
+ }
+ },
+ Transition {
+ from: "Details"; to: "Show"
+ ParentAnimation {
+ via: foreground
+ NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad }
+ }
+ }
+ ]
+ }
+ MouseArea { anchors.fill: wrapper; onClicked: photoClicked() }
+}
+
diff --git a/examples/demos/flickr/content/ImageDetails.qml b/examples/demos/flickr/content/ImageDetails.qml
new file mode 100644
index 0000000000..42b5e845ea
--- /dev/null
+++ b/examples/demos/flickr/content/ImageDetails.qml
@@ -0,0 +1,323 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Flipable {
+ id: container
+
+ property alias frontContainer: containerFront
+ property string photoTitle: ""
+ property string photoTags: ""
+ property int photoWidth
+ property int photoHeight
+ property string photoType
+ property string photoAuthor
+ property string photoDate
+ property string photoUrl
+ property int rating: 2
+ property variant prevScale: 1.0
+
+ property int flipDuration: 1600
+
+ signal closed
+
+ transform: Rotation {
+ id: itemRotation
+ origin.x: container.width / 2;
+ axis.y: 1; axis.z: 0
+ }
+
+ front: Item {
+ id: containerFront; anchors.fill: container
+
+ Rectangle {
+ anchors.fill: parent
+ color: "black"; opacity: 0.4
+ }
+
+ Column {
+ spacing: 10
+ anchors {
+ left: parent.left; leftMargin: 10
+ right: parent.right; rightMargin: 10
+ top: parent.top; topMargin: 120
+ }
+ Text { font.bold: true; color: "white"; elide: Text.ElideRight; text: container.photoTitle; width: parent.width }
+ Text { color: "white"; elide: Text.ElideRight; text: "Size: " + container.photoWidth + 'x' + container.photoHeight; width: parent.width }
+ Text { color: "white"; elide: Text.ElideRight; text: "Type: " + container.photoType; width: parent.width }
+ Text { color: "white"; elide: Text.ElideRight; text: "Author: " + container.photoAuthor; width: parent.width }
+ Text { color: "white"; elide: Text.ElideRight; text: "Published: " + container.photoDate; width: parent.width }
+ Text { color: "white"; elide: Text.ElideRight; text: container.photoTags == "" ? "" : "Tags: "; width: parent.width }
+ Text { color: "white"; elide: Text.ElideRight; text: container.photoTags; width: parent.width }
+ }
+ }
+
+ back: Item {
+ anchors.fill: container
+
+ Rectangle { anchors.fill: parent; color: "black"; opacity: 0.4 }
+
+ Progress {
+ anchors.centerIn: parent; width: 200; height: 22
+ progress: bigImage.progress; visible: bigImage.status != Image.Ready
+ }
+
+ Flickable {
+ id: flickable; anchors.fill: parent; clip: true
+ contentWidth: imageContainer.width; contentHeight: imageContainer.height
+
+ function updateMinimumScale() {
+ if (bigImage.status == Image.Ready && bigImage.width != 0) {
+ slider.minimum = Math.min(flickable.width / bigImage.width, flickable.height / bigImage.height);
+ if (bigImage.width * slider.value > flickable.width) {
+ var xoff = (flickable.width/2 + flickable.contentX) * slider.value / prevScale;
+ flickable.contentX = xoff - flickable.width/2;
+ }
+ if (bigImage.height * slider.value > flickable.height) {
+ var yoff = (flickable.height/2 + flickable.contentY) * slider.value / prevScale;
+ flickable.contentY = yoff - flickable.height/2;
+ }
+ prevScale = slider.value;
+ }
+ }
+
+ onWidthChanged: updateMinimumScale()
+ onHeightChanged: updateMinimumScale()
+
+ Item {
+ id: imageContainer
+ width: Math.max(bigImage.width * bigImage.scale, flickable.width);
+ height: Math.max(bigImage.height * bigImage.scale, flickable.height);
+ Image {
+ id: bigImage; source: container.photoUrl; scale: slider.value
+ anchors.centerIn: parent; smooth: !flickable.movingVertically
+ onStatusChanged : {
+ // Default scale shows the entire image.
+ if (bigImage.status == Image.Ready && bigImage.width != 0) {
+ slider.minimum = Math.min(flickable.width / bigImage.width, flickable.height / bigImage.height);
+ prevScale = Math.min(slider.minimum, 1);
+ slider.value = prevScale;
+ }
+ if (inBackState && bigImage.status == Image.Ready)
+ effectBox.imageInAnim();
+ }
+ property bool inBackState: false
+ onInBackStateChanged:{
+ if(inBackState && bigImage.status == Image.Ready)
+ effectBox.imageInAnim();
+ else if (!inBackState && bigImage.status == Image.Ready)
+ effectBox.imageOutAnim();
+ }
+ }
+ ShaderEffectSource{
+ id: pictureSource
+ sourceItem: bigImage
+ smooth: true
+ //Workaround: Doesn't work below lines
+ width: bigImage.width
+ height: bigImage.width
+ visible: false
+ }
+ Turbulence{//only fill visible rect
+ id: turbulence
+ system: imageSystem
+ anchors.fill: parent
+ strength: 240
+ enabled: false
+ }
+
+ Item{
+ id: effectBox
+ width: bigImage.width * bigImage.scale
+ height: bigImage.height * bigImage.scale
+ anchors.centerIn: parent
+ function imageInAnim(){
+ bigImage.visible = false;
+ noiseIn.visible = true;
+ endEffectTimer.start();
+ }
+ function imageOutAnim(){
+ bigImage.visible = false;
+ noiseIn.visible = false;
+ turbulence.enabled = true;
+ endEffectTimer.start();
+ pixelEmitter.burst(2048);
+ }
+ Timer{
+ id: endEffectTimer
+ interval: flipDuration
+ repeat: false
+ running: false
+ onTriggered:{
+ turbulence.enabled = false;
+ noiseIn.visible = false;
+ bigImage.visible = true;
+ }
+ }
+ ShaderEffect{
+ id: noiseIn
+ anchors.fill: parent
+ property real t: 0
+ visible: false
+ onVisibleChanged: tAnim.start()
+ NumberAnimation{
+ id: tAnim
+ target: noiseIn
+ property: "t"
+ from: 0.0
+ to: 1.0
+ duration: flipDuration
+ }
+ property variant source: pictureSource
+ property variant noise: ShaderEffectSource{
+ sourceItem:Image{
+ source: "images/noise.png"
+ }
+ hideSource: true
+ smooth: false
+ }
+ fragmentShader:"
+ uniform sampler2D noise;
+ uniform sampler2D source;
+ uniform highp float t;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main(){
+ //Want to use noise2, but it always returns (0,0)?
+ if(texture2D(noise, qt_TexCoord0).w <= t)
+ gl_FragColor = texture2D(source, qt_TexCoord0) * qt_Opacity;
+ else
+ gl_FragColor = vec4(0.,0.,0.,0.);
+ }
+ "
+ }
+ ParticleSystem{
+ id: imageSystem
+ }
+ Emitter{
+ id: pixelEmitter
+ system: imageSystem
+ //anchors.fill: parent
+ width: Math.min(bigImage.width * bigImage.scale, flickable.width);
+ height: Math.min(bigImage.height * bigImage.scale, flickable.height);
+ anchors.centerIn: parent
+ size: 4
+ lifeSpan: flipDuration
+ emitRate: 2048
+ enabled: false
+ }
+ CustomParticle{
+ id: blowOut
+ system: imageSystem
+ property real maxWidth: effectBox.width
+ property real maxHeight: effectBox.height
+ vertexShader:"
+ uniform highp float maxWidth;
+ uniform highp float maxHeight;
+
+ varying highp vec2 fTex2;
+
+ void main() {
+ defaultMain();
+ fTex2 = vec2(qt_ParticlePos.x / maxWidth, qt_ParticlePos.y / maxHeight);
+ }
+ "
+ property variant pictureTexture: pictureSource
+ fragmentShader: "
+ uniform lowp float qt_Opacity;
+ uniform sampler2D pictureTexture;
+ varying highp vec2 fTex2;
+ void main() {
+ gl_FragColor = texture2D(pictureTexture, fTex2) * qt_Opacity;
+ }"
+ }
+
+
+
+ }
+ }
+ }
+
+ Text {
+ text: "Image Unavailable"
+ visible: bigImage.status == Image.Error
+ anchors.centerIn: parent; color: "white"; font.bold: true
+ }
+
+ Slider {
+ id: slider; visible: { bigImage.status == Image.Ready && maximum > minimum }
+ anchors {
+ bottom: parent.bottom; bottomMargin: 65
+ left: parent.left; leftMargin: 25
+ right: parent.right; rightMargin: 25
+ }
+ onValueChanged: {
+ if (bigImage.width * value > flickable.width) {
+ var xoff = (flickable.width/2 + flickable.contentX) * value / prevScale;
+ flickable.contentX = xoff - flickable.width/2;
+ }
+ if (bigImage.height * value > flickable.height) {
+ var yoff = (flickable.height/2 + flickable.contentY) * value / prevScale;
+ flickable.contentY = yoff - flickable.height/2;
+ }
+ prevScale = value;
+ }
+ }
+ }
+
+ states: State {
+ name: "Back"
+ PropertyChanges { target: itemRotation; angle: 180 }
+ PropertyChanges { target: toolBar; button2Visible: false }
+ PropertyChanges { target: toolBar; button1Label: "Back" }
+ PropertyChanges { target: bigImage; inBackState: true }
+ }
+
+ transitions: Transition {
+ SequentialAnimation {
+ PropertyAction { target: bigImage; property: "smooth"; value: false }
+ NumberAnimation { easing.type: Easing.InOutQuad; properties: "angle"; duration: flipDuration }
+ PropertyAction { target: bigImage; property: "smooth"; value: !flickable.movingVertically }
+ }
+ }
+}
diff --git a/examples/demos/flickr/content/ListDelegate.qml b/examples/demos/flickr/content/ListDelegate.qml
new file mode 100644
index 0000000000..00f837f862
--- /dev/null
+++ b/examples/demos/flickr/content/ListDelegate.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Component {
+ Item {
+ id: wrapper; width: wrapper.ListView.view.width; height: 86
+ Item {
+ id: moveMe
+ Rectangle { color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 }
+ Rectangle {
+ x: 6; y: 4; width: 77; height: 77; color: "white"; smooth: true
+
+ Image { source: imagePath; x: 1; y: 1 }
+ Image { source: "images/gloss.png" }
+ }
+ Column {
+ x: 92; width: wrapper.ListView.view.width - 95; y: 15; spacing: 2
+ Text { text: title; color: "white"; width: parent.width; font.pixelSize: 14; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" }
+ Text { text: photoAuthor; width: parent.width; font.pixelSize: 14; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
+ Text { text: photoDate; width: parent.width; font.pixelSize: 14; elide: Text.ElideRight; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
+ }
+ }
+ }
+}
diff --git a/examples/demos/flickr/content/Progress.qml b/examples/demos/flickr/content/Progress.qml
new file mode 100644
index 0000000000..ed2629b48a
--- /dev/null
+++ b/examples/demos/flickr/content/Progress.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item{
+ id: container
+ property variant progress: 0
+
+ Rectangle {
+ anchors.fill: parent; smooth: true
+ border.color: "white"; border.width: 0; radius: height/2 - 2
+ gradient: Gradient {
+ GradientStop { position: 0; color: "#66343434" }
+ GradientStop { position: 1.0; color: "#66000000" }
+ }
+ }
+
+ ParticleSystem{
+ running: container.visible
+ id: barSys
+ }
+ ImageParticle{
+ color: "lightsteelblue"
+ alpha: 0.1
+ colorVariation: 0.05
+ source: "images/particle.png"
+ system: barSys
+ }
+ Emitter{
+ y: 2; height: parent.height-4;
+ x: 2; width: Math.max(parent.width * progress - 4, 0);
+ speed: AngleDirection{ angleVariation: 180; magnitudeVariation: 12 }
+ system: barSys
+ emitRate: width;
+ lifeSpan: 1000
+ size: 20
+ sizeVariation: 4
+ endSize: 12
+ maximumEmitted: parent.width;
+ }
+
+ Text {
+ text: Math.round(progress * 100) + "%"
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ color: Qt.rgba(1.0, 1.0 - progress, 1.0 - progress,0.9); font.bold: true; font.pixelSize: 15
+ }
+}
diff --git a/examples/demos/flickr/content/RssModel.qml b/examples/demos/flickr/content/RssModel.qml
new file mode 100644
index 0000000000..51cea498e6
--- /dev/null
+++ b/examples/demos/flickr/content/RssModel.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+XmlListModel {
+ property string tags : ""
+
+ function encodeTags(x) { return encodeURIComponent(x.replace(' ',',')); }
+
+ source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+encodeTags(tags)+"&" : "")+"format=rss2"
+ query: "/rss/channel/item"
+ namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
+
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "imagePath"; query: "media:thumbnail/@url/string()" }
+ XmlRole { name: "url"; query: "media:content/@url/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+ XmlRole { name: "tags"; query: "media:category/string()" }
+ XmlRole { name: "photoWidth"; query: "media:content/@width/string()" }
+ XmlRole { name: "photoHeight"; query: "media:content/@height/string()" }
+ XmlRole { name: "photoType"; query: "media:content/@type/string()" }
+ XmlRole { name: "photoAuthor"; query: "author/string()" }
+ XmlRole { name: "photoDate"; query: "pubDate/string()" }
+}
diff --git a/examples/demos/flickr/content/ScrollBar.qml b/examples/demos/flickr/content/ScrollBar.qml
new file mode 100644
index 0000000000..7c62ad088f
--- /dev/null
+++ b/examples/demos/flickr/content/ScrollBar.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: container
+
+ property variant flickableArea
+
+ Rectangle {
+ radius: 5
+ color: "black"
+ opacity: 0.3
+ border.color: "white"
+ border.width: 2
+ x: 0
+ y: flickableArea.visibleArea.yPosition * container.height
+ width: parent.width
+ height: flickableArea.visibleArea.heightRatio * container.height
+ }
+ states: [
+ State {
+ name: "show"
+ when: flickableArea.movingVertically
+ PropertyChanges {
+ target: container
+ opacity: 1
+ }
+ }
+ ]
+ transitions: [
+ Transition {
+ from: "*"
+ to: "*"
+ NumberAnimation {
+ target: container
+ properties: "opacity"
+ duration: 400
+ }
+ }
+ ]
+}
diff --git a/examples/demos/flickr/content/Slider.qml b/examples/demos/flickr/content/Slider.qml
new file mode 100644
index 0000000000..c4e743641f
--- /dev/null
+++ b/examples/demos/flickr/content/Slider.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: slider; width: 400; height: 16
+
+ // value is read/write.
+ property real value: 1
+ onValueChanged: updatePos();
+ property real maximum: 1
+ property real minimum: 1
+ property int xMax: width - handle.width - 4
+ onXMaxChanged: updatePos();
+ onMinimumChanged: updatePos();
+
+ function updatePos() {
+ if (maximum > minimum) {
+ var pos = 2 + (value - minimum) * slider.xMax / (maximum - minimum);
+ pos = Math.min(pos, width - handle.width - 2);
+ pos = Math.max(pos, 2);
+ handle.x = pos;
+ } else {
+ handle.x = 2;
+ }
+ }
+
+ Rectangle {
+ anchors.fill: parent
+ border.color: "white"; border.width: 0; radius: 8
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#66343434" }
+ GradientStop { position: 1.0; color: "#66000000" }
+ }
+ }
+
+ Rectangle {
+ id: handle; smooth: true
+ y: 2; width: 30; height: slider.height-4; radius: 6
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "lightgray" }
+ GradientStop { position: 1.0; color: "gray" }
+ }
+
+ MouseArea {
+ id: mouse
+ anchors.fill: parent; drag.target: parent
+ drag.axis: Drag.XAxis; drag.minimumX: 2; drag.maximumX: slider.xMax+2
+ onPositionChanged: { value = (maximum - minimum) * (handle.x-2) / slider.xMax + minimum; }
+ }
+ }
+}
diff --git a/examples/demos/flickr/content/TitleBar.qml b/examples/demos/flickr/content/TitleBar.qml
new file mode 100644
index 0000000000..223939f81a
--- /dev/null
+++ b/examples/demos/flickr/content/TitleBar.qml
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: titleBar
+ property string untaggedString: "Uploads from everyone"
+ property string taggedString: "Recent uploads tagged "
+
+ BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
+
+ Item {
+ id: container
+ width: (parent.width * 2) - 55 ; height: parent.height
+
+ function accept() {
+ imageDetails.closed()
+ titleBar.state = ""
+ background.state = ""
+ rssModel.tags = editor.text
+ }
+
+ Image {
+ id: quitButton
+ anchors.left: parent.left//; anchors.leftMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/quit.png"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.quit()
+ }
+ }
+
+ Text {
+ id: categoryText
+ anchors {
+ left: quitButton.right; right: tagButton.left; leftMargin: 10; rightMargin: 10
+ verticalCenter: parent.verticalCenter
+ }
+ elide: Text.ElideLeft
+ text: (rssModel.tags=="" ? untaggedString : taggedString + rssModel.tags)
+ font.bold: true; font.pixelSize: 15; color: "White"; style: Text.Raised; styleColor: "Black"
+ }
+
+ Button {
+ id: tagButton; x: titleBar.width - 50; width: 45; height: 32; text: "..."
+ onClicked: if (titleBar.state == "Tags") container.accept(); else titleBar.state = "Tags"
+ anchors.verticalCenter: parent.verticalCenter
+ }
+
+ Item {
+ id: lineEdit
+ y: 4; height: parent.height - 9
+ anchors { left: tagButton.right; leftMargin: 5; right: parent.right; rightMargin: 5 }
+
+ BorderImage { source: "images/lineedit.sci"; anchors.fill: parent }
+
+ TextInput {
+ id: editor
+ anchors {
+ left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10
+ verticalCenter: parent.verticalCenter
+ }
+ cursorVisible: true; font.bold: true
+ color: "#151515"; selectionColor: "Green"
+ }
+
+ Keys.forwardTo: [ (returnKey), (editor)]
+
+ Item {
+ id: returnKey
+ Keys.onReturnPressed: container.accept()
+ Keys.onEnterPressed: container.accept()
+ Keys.onEscapePressed: titleBar.state = ""
+ }
+ }
+ }
+
+ states: State {
+ name: "Tags"
+ PropertyChanges { target: container; x: -tagButton.x + 5 }
+ PropertyChanges { target: tagButton; text: "OK" }
+ PropertyChanges { target: editor; focus: true }
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad }
+ }
+}
diff --git a/examples/demos/flickr/content/ToolBar.qml b/examples/demos/flickr/content/ToolBar.qml
new file mode 100644
index 0000000000..356993b41a
--- /dev/null
+++ b/examples/demos/flickr/content/ToolBar.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: toolbar
+
+ property alias button1Label: button1.text
+ property alias button2Label: button2.text
+ property alias button2Visible: button2.visible
+
+ signal button1Clicked
+ signal button2Clicked
+
+ BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
+
+ Row {
+ anchors.right: parent.right; anchors.rightMargin: 5; y: 3; height: 32; spacing: 30
+ Button {
+ id: button1
+ width: 140; height: 32
+ onClicked: toolbar.button1Clicked()
+ }
+
+ Button {
+ id: button2; width: 140; height: 32
+ onClicked: toolbar.button2Clicked()
+ }
+ }
+}
diff --git a/examples/demos/flickr/content/UnifiedDelegate.qml b/examples/demos/flickr/content/UnifiedDelegate.qml
new file mode 100644
index 0000000000..0b068c0abe
--- /dev/null
+++ b/examples/demos/flickr/content/UnifiedDelegate.qml
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Package {
+ function photoClicked() {
+ imageDetails.photoTitle = title;
+ imageDetails.photoTags = tags;
+ imageDetails.photoWidth = photoWidth;
+ imageDetails.photoHeight = photoHeight;
+ imageDetails.photoType = photoType;
+ imageDetails.photoAuthor = photoAuthor;
+ imageDetails.photoDate = photoDate;
+ imageDetails.photoUrl = url;
+ imageDetails.rating = 0;
+ scaleMe.state = "Details";
+ }
+
+ Item {
+ id: gridwrapper;
+ width: GridView.view.cellWidth; height: GridView.view.cellHeight
+ Package.name: "grid"
+ }
+ Item {
+ id: streamwrapper;
+ width: 80; height: 80
+ Package.name: "stream"
+ }
+ Item {
+ //anchors.centerIn: parent//Doesn't animate :(
+ width: 80; height: 80
+ scale: 0.0
+ Behavior on scale { NumberAnimation { easing.type: Easing.InOutQuad} }
+ id: scaleMe
+
+ Item {
+ id: whiteRectContainer
+ width: 77; height: 77; anchors.centerIn: parent
+ Rectangle {
+ id: whiteRect; width: 77; height: 77; color: "#dddddd"; smooth: true
+ x:0; y:0
+ Image { id: thumb; source: imagePath; x: 1; y: 1; smooth: true }
+ Image { source: "images/gloss.png" }
+ MouseArea { anchors.fill: parent; onClicked: photoClicked() }
+ }
+ }
+
+ Connections {
+ target: toolBar
+ onButton2Clicked: if (scaleMe.state == 'Details' ) scaleMe.state = 'Show'
+ }
+
+ state: 'inStream'
+ states: [
+ State {
+ name: "Show"; when: thumb.status == Image.Ready
+ PropertyChanges { target: scaleMe; scale: 1; }
+ },
+ State {
+ name: "Details"
+ PropertyChanges { target: scaleMe; scale: 1 }
+ ParentChange { target: whiteRect; x: 10; y: 20; parent: imageDetails.frontContainer }
+ PropertyChanges { target: background; state: "DetailedView" }
+ }
+ ]
+ transitions: [
+ Transition {
+ from: "Show"; to: "Details"
+ ParentAnimation {
+ via: foreground
+ NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad }
+ }
+ },
+ Transition {
+ from: "Details"; to: "Show"
+ SequentialAnimation{
+ ParentAnimation {
+ via: foreground
+ NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad }
+ }
+ }
+ }
+ ]
+ Item{
+ id: stateContainer
+ states: [
+ State {
+ name: 'inStream'
+ when: screen.inGridView == false
+ ParentChange {
+ target: scaleMe; parent: streamwrapper
+ x: 0; y: 0;
+ }
+ },
+ State {
+ name: 'inGrid'
+ when: screen.inGridView == true
+ ParentChange {
+ target: scaleMe; parent: gridwrapper
+ x: 0; y: 0;
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ ParentAnimation {
+ NumberAnimation { target: scaleMe; properties: 'x,y,width,height'; duration: 300 }
+ }
+ }
+ ]
+ }
+ }
+}
diff --git a/examples/demos/flickr/content/images/gloss.png b/examples/demos/flickr/content/images/gloss.png
new file mode 100644
index 0000000000..5d370cd93d
--- /dev/null
+++ b/examples/demos/flickr/content/images/gloss.png
Binary files differ
diff --git a/examples/demos/flickr/content/images/lineedit.png b/examples/demos/flickr/content/images/lineedit.png
new file mode 100644
index 0000000000..2cc38dc35b
--- /dev/null
+++ b/examples/demos/flickr/content/images/lineedit.png
Binary files differ
diff --git a/examples/demos/flickr/content/images/lineedit.sci b/examples/demos/flickr/content/images/lineedit.sci
new file mode 100644
index 0000000000..054bff78be
--- /dev/null
+++ b/examples/demos/flickr/content/images/lineedit.sci
@@ -0,0 +1,5 @@
+border.left: 10
+border.top: 10
+border.bottom: 10
+border.right: 10
+source: lineedit.png
diff --git a/examples/demos/flickr/content/images/noise.png b/examples/demos/flickr/content/images/noise.png
new file mode 100644
index 0000000000..c5a5ba0053
--- /dev/null
+++ b/examples/demos/flickr/content/images/noise.png
Binary files differ
diff --git a/examples/demos/flickr/content/images/particle.png b/examples/demos/flickr/content/images/particle.png
new file mode 100644
index 0000000000..dbc39cb16e
--- /dev/null
+++ b/examples/demos/flickr/content/images/particle.png
Binary files differ
diff --git a/examples/demos/flickr/content/images/quit.png b/examples/demos/flickr/content/images/quit.png
new file mode 100644
index 0000000000..5bda1b6e0d
--- /dev/null
+++ b/examples/demos/flickr/content/images/quit.png
Binary files differ
diff --git a/examples/demos/flickr/content/images/squareParticle.png b/examples/demos/flickr/content/images/squareParticle.png
new file mode 100644
index 0000000000..faf85c24e0
--- /dev/null
+++ b/examples/demos/flickr/content/images/squareParticle.png
Binary files differ
diff --git a/examples/demos/flickr/content/images/stripes.png b/examples/demos/flickr/content/images/stripes.png
new file mode 100644
index 0000000000..9f36727ea4
--- /dev/null
+++ b/examples/demos/flickr/content/images/stripes.png
Binary files differ
diff --git a/examples/demos/flickr/content/images/titlebar.png b/examples/demos/flickr/content/images/titlebar.png
new file mode 100644
index 0000000000..51c90082d0
--- /dev/null
+++ b/examples/demos/flickr/content/images/titlebar.png
Binary files differ
diff --git a/examples/demos/flickr/content/images/titlebar.sci b/examples/demos/flickr/content/images/titlebar.sci
new file mode 100644
index 0000000000..0418d94cd6
--- /dev/null
+++ b/examples/demos/flickr/content/images/titlebar.sci
@@ -0,0 +1,5 @@
+border.left: 10
+border.top: 12
+border.bottom: 12
+border.right: 10
+source: titlebar.png
diff --git a/examples/demos/flickr/content/images/toolbutton.png b/examples/demos/flickr/content/images/toolbutton.png
new file mode 100644
index 0000000000..11310013ee
--- /dev/null
+++ b/examples/demos/flickr/content/images/toolbutton.png
Binary files differ
diff --git a/examples/demos/flickr/content/images/toolbutton.sci b/examples/demos/flickr/content/images/toolbutton.sci
new file mode 100644
index 0000000000..9e4f965307
--- /dev/null
+++ b/examples/demos/flickr/content/images/toolbutton.sci
@@ -0,0 +1,5 @@
+border.left: 15
+border.top: 4
+border.bottom: 4
+border.right: 15
+source: toolbutton.png
diff --git a/examples/demos/flickr/content/qmldir b/examples/demos/flickr/content/qmldir
new file mode 100644
index 0000000000..adc2479b9f
--- /dev/null
+++ b/examples/demos/flickr/content/qmldir
@@ -0,0 +1,10 @@
+ImageDetails ImageDetails.qml
+LikeOMeter LikeOMeter.qml
+Loading Loading.qml
+MediaButton MediaButton.qml
+MediaLineEdit MediaLineEdit.qml
+Progress Progress.qml
+RssModel RssModel.qml
+ScrollBar ScrollBar.qml
+Slider Slider.qml
+Star Star.qml
diff --git a/examples/demos/flickr/flickr-90.qml b/examples/demos/flickr/flickr-90.qml
new file mode 100644
index 0000000000..b95b1c9872
--- /dev/null
+++ b/examples/demos/flickr/flickr-90.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ width: 480; height: 320
+
+ Loader {
+ y: 320; rotation: -90
+ transformOrigin: Item.TopLeft
+ source: "flickr.qml"
+ }
+}
diff --git a/examples/demos/flickr/flickr.qml b/examples/demos/flickr/flickr.qml
new file mode 100644
index 0000000000..98ca5197ab
--- /dev/null
+++ b/examples/demos/flickr/flickr.qml
@@ -0,0 +1,158 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+import "content"
+
+Item {
+ id: screen; width: 320; height: 480
+ property bool inGridView : true
+
+ Rectangle {
+ id: background
+ anchors.fill: parent; color: "#343434";
+
+ Image { source: "content/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 }
+ ParticleSystem {
+ id: bgParticles
+ anchors.fill: parent
+ ImageParticle {
+ groups: ["trail"]
+ source: "content/images/particle.png"
+ color: "#1A1A6F"
+ alpha: 0.1
+ colorVariation: 0.01
+ blueVariation: 0.8
+ }
+ Emitter {
+ group: "drops"
+ width: parent.width
+ emitRate: 0.5
+ lifeSpan: 20000
+ startTime: 16000
+ speed: PointDirection{
+ y: {screen.height/18}
+ }
+ }
+ TrailEmitter {
+ follow: "drops"
+ group: "trail"
+ emitRatePerParticle: 18
+ size: 32
+ endSize: 0
+ sizeVariation: 4
+ lifeSpan: 1200
+ anchors.fill: parent
+ emitWidth: 16
+ emitHeight: 16
+ emitShape: EllipseShape{}
+ }
+ }
+
+ VisualDataModel{
+ id: vdm
+ delegate: UnifiedDelegate{}
+ model: RssModel { id: rssModel }
+ }
+
+ Item {
+ id: views
+ width: parent.width
+ anchors.top: titleBar.bottom; anchors.bottom: toolBar.top
+
+ GridView {
+ id: photoGridView; model: vdm.parts.grid
+ cacheBuffer: 1000
+ cellWidth: (parent.width-2)/4; cellHeight: cellWidth; width: parent.width; height: parent.height
+ }
+
+ states: State {
+ name: "GridView"; when: state.inGridView == true
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad }
+ }
+
+ ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height }
+
+ Item { id: foreground; anchors.fill: parent }
+ }
+
+ TitleBar { id: titleBar; width: parent.width; height: 40; opacity: 0.9 }
+
+ ToolBar {
+ id: toolBar
+ height: 40; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9
+ button1Label: "Update"; button2Label: "View mode"
+ onButton1Clicked: rssModel.reload()
+ onButton2Clicked: if (screen.inGridView == true) screen.inGridView = false; else screen.inGridView = true
+ }
+
+ Connections {
+ target: imageDetails
+ onClosed: {
+ if (background.state == "DetailedView") {
+ background.state = '';
+ imageDetails.photoUrl = "";
+ }
+ }
+ }
+
+ states: State {
+ name: "DetailedView"
+ PropertyChanges { target: views; x: -parent.width }
+ PropertyChanges { target: toolBar; button1Label: "View..." }
+ PropertyChanges {
+ target: toolBar
+ onButton1Clicked: if (imageDetails.state=='') imageDetails.state='Back'; else imageDetails.state=''
+ }
+ PropertyChanges { target: toolBar; button2Label: "Back" }
+ PropertyChanges { target: toolBar; onButton2Clicked: imageDetails.closed() }
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad }
+ }
+
+ }
+}
diff --git a/examples/demos/flickr/flickr.qmlproject b/examples/demos/flickr/flickr.qmlproject
new file mode 100644
index 0000000000..af5179d84b
--- /dev/null
+++ b/examples/demos/flickr/flickr.qmlproject
@@ -0,0 +1,17 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "flickr.qml"
+ //mainFile: "flickr-90.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/demos/minehunt/MinehuntCore/Explosion.qml b/examples/demos/minehunt/MinehuntCore/Explosion.qml
new file mode 100644
index 0000000000..a1b4292bcf
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/Explosion.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ property bool explode : false
+ ParticleSystem {
+ width: 40
+ height: 40
+ ImageParticle {
+ groups: ["star"]
+ source: "file:MinehuntCore/pics/star.png" // TODO: Use qrc path once QTBUG-21129 is fixed
+ }
+ Emitter {
+ id: particles
+ enabled: false
+ anchors.centerIn: parent
+ group: "star"
+ speed: AngleDirection { angleVariation: 360; magnitude: 150; magnitudeVariation: 50 }
+ emitRate: 200
+ z: 100
+ lifeSpan: 1000
+ }
+ }
+ states: State { name: "exploding"; when: explode
+ StateChangeScript { script: particles.burst(200); }
+ }
+
+}
diff --git a/examples/demos/minehunt/MinehuntCore/Tile.qml b/examples/demos/minehunt/MinehuntCore/Tile.qml
new file mode 100644
index 0000000000..1180b6f584
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/Tile.qml
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Flipable {
+ id: flipable
+ property int angle: 0
+
+ width: 40; height: 40
+ transform: Rotation { origin.x: 20; origin.y: 20; axis.x: 1; axis.z: 0; angle: flipable.angle }
+
+ front: Image {
+ source: "pics/front.png"; width: 40; height: 40
+
+ Image {
+ anchors.centerIn: parent
+ source: "pics/flag.png"; opacity: modelData.hasFlag
+
+ Behavior on opacity { NumberAnimation {} }
+ }
+ }
+
+ back: Image {
+ source: "pics/back.png"
+ width: 40; height: 40
+
+ Text {
+ anchors.centerIn: parent
+ text: modelData.hint; color: "white"; font.bold: true
+ opacity: !modelData.hasMine && modelData.hint > 0
+ }
+
+ Image {
+ anchors.centerIn: parent
+ source: "pics/bomb.png"; opacity: modelData.hasMine
+ }
+
+ Explosion { id: expl }
+ }
+
+ states: State {
+ name: "back"; when: modelData.flipped
+ PropertyChanges { target: flipable; angle: 180 }
+ }
+
+ property real pauseDur: 250
+ transitions: Transition {
+ SequentialAnimation {
+ ScriptAction {
+ script: {
+ var ret = Math.abs(flipable.x - field.clickx)
+ + Math.abs(flipable.y - field.clicky);
+ if (modelData.hasMine && modelData.flipped)
+ pauseDur = ret * 3
+ else
+ pauseDur = ret
+ }
+ }
+ PauseAnimation {
+ duration: pauseDur
+ }
+ RotationAnimation { easing.type: Easing.InOutQuad }
+ ScriptAction { script: if (modelData.hasMine && modelData.flipped) { expl.explode = true } }
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: {
+ field.clickx = flipable.x
+ field.clicky = flipable.y
+ var row = Math.floor(index / 9)
+ var col = index - (Math.floor(index / 9) * 9)
+ if (mouse.button == undefined || mouse.button == Qt.RightButton) {
+ flag(row, col)
+ } else {
+ flip(row, col)
+ }
+ }
+ onPressAndHold: {
+ field.clickx = flipable.x
+ field.clicky = flipable.y
+ var row = Math.floor(index / 9)
+ var col = index - (Math.floor(index / 9) * 9)
+ flag(row, col)
+ }
+ }
+}
diff --git a/examples/demos/minehunt/MinehuntCore/pics/back.png b/examples/demos/minehunt/MinehuntCore/pics/back.png
new file mode 100644
index 0000000000..f6b3f0b4d7
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/pics/back.png
Binary files differ
diff --git a/examples/demos/minehunt/MinehuntCore/pics/background.png b/examples/demos/minehunt/MinehuntCore/pics/background.png
new file mode 100644
index 0000000000..3734a27744
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/pics/background.png
Binary files differ
diff --git a/examples/demos/minehunt/MinehuntCore/pics/bomb-color.png b/examples/demos/minehunt/MinehuntCore/pics/bomb-color.png
new file mode 100644
index 0000000000..61ad0a928f
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/pics/bomb-color.png
Binary files differ
diff --git a/examples/demos/minehunt/MinehuntCore/pics/bomb.png b/examples/demos/minehunt/MinehuntCore/pics/bomb.png
new file mode 100644
index 0000000000..a992575518
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/pics/bomb.png
Binary files differ
diff --git a/examples/demos/minehunt/MinehuntCore/pics/face-sad.png b/examples/demos/minehunt/MinehuntCore/pics/face-sad.png
new file mode 100644
index 0000000000..cf00aafe1f
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/pics/face-sad.png
Binary files differ
diff --git a/examples/demos/minehunt/MinehuntCore/pics/face-smile-big.png b/examples/demos/minehunt/MinehuntCore/pics/face-smile-big.png
new file mode 100644
index 0000000000..f9c2335df5
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/pics/face-smile-big.png
Binary files differ
diff --git a/examples/demos/minehunt/MinehuntCore/pics/face-smile.png b/examples/demos/minehunt/MinehuntCore/pics/face-smile.png
new file mode 100644
index 0000000000..3d66d72578
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/pics/face-smile.png
Binary files differ
diff --git a/examples/demos/minehunt/MinehuntCore/pics/flag-color.png b/examples/demos/minehunt/MinehuntCore/pics/flag-color.png
new file mode 100644
index 0000000000..aadad0f11a
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/pics/flag-color.png
Binary files differ
diff --git a/examples/demos/minehunt/MinehuntCore/pics/flag.png b/examples/demos/minehunt/MinehuntCore/pics/flag.png
new file mode 100644
index 0000000000..39cde4df82
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/pics/flag.png
Binary files differ
diff --git a/examples/demos/minehunt/MinehuntCore/pics/front.png b/examples/demos/minehunt/MinehuntCore/pics/front.png
new file mode 100644
index 0000000000..834331bd49
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/pics/front.png
Binary files differ
diff --git a/examples/demos/minehunt/MinehuntCore/pics/quit.png b/examples/demos/minehunt/MinehuntCore/pics/quit.png
new file mode 100644
index 0000000000..b822057d4e
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/pics/quit.png
Binary files differ
diff --git a/examples/demos/minehunt/MinehuntCore/pics/star.png b/examples/demos/minehunt/MinehuntCore/pics/star.png
new file mode 100644
index 0000000000..3772359188
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/pics/star.png
Binary files differ
diff --git a/examples/demos/minehunt/MinehuntCore/qmldir b/examples/demos/minehunt/MinehuntCore/qmldir
new file mode 100644
index 0000000000..a0213a19c4
--- /dev/null
+++ b/examples/demos/minehunt/MinehuntCore/qmldir
@@ -0,0 +1,2 @@
+Explosion 2.0 Explosion.qml
+Tile 2.0 Tile.qml
diff --git a/examples/demos/minehunt/README b/examples/demos/minehunt/README
new file mode 100644
index 0000000000..3849ca5fbf
--- /dev/null
+++ b/examples/demos/minehunt/README
@@ -0,0 +1,6 @@
+Minehunt has to be compiled to run.
+
+To compile the C++ part, do 'qmake && make'.
+To run, simply run the executable.
+To deploy on a device, do 'make sis'.
+
diff --git a/examples/demos/minehunt/main.cpp b/examples/demos/minehunt/main.cpp
new file mode 100644
index 0000000000..0aa11a1d7a
--- /dev/null
+++ b/examples/demos/minehunt/main.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QGuiApplication>
+#include <QtQuick/qquickview.h>
+#include <QtQml/QQmlContext>
+#include <QtQml/QQmlEngine>
+
+#include "minehunt.h"
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQuickView canvas;
+
+ qmlRegisterType<TileData>();
+ MinehuntGame* game = new MinehuntGame();
+
+ canvas.setResizeMode(QQuickView::SizeRootObjectToView);
+ canvas.engine()->rootContext()->setContextObject(game);
+ canvas.setSource(QString("qrc:///minehunt.qml"));
+ QObject::connect(canvas.engine(), SIGNAL(quit()), &app, SLOT(quit()));
+
+ canvas.show();
+ return app.exec();
+}
diff --git a/examples/demos/minehunt/minehunt.cpp b/examples/demos/minehunt/minehunt.cpp
new file mode 100644
index 0000000000..cde30278b3
--- /dev/null
+++ b/examples/demos/minehunt/minehunt.cpp
@@ -0,0 +1,221 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <stdlib.h>
+#include <QTime>
+#include <QTimer>
+
+#include "minehunt.h"
+
+void tilesPropAppend(QQmlListProperty<TileData>* prop, TileData* value)
+{
+ Q_UNUSED(prop);
+ Q_UNUSED(value);
+ return; //Append not supported
+}
+
+int tilesPropCount(QQmlListProperty<TileData>* prop)
+{
+ return static_cast<QList<TileData*>*>(prop->data)->count();
+}
+
+TileData* tilesPropAt(QQmlListProperty<TileData>* prop, int index)
+{
+ return static_cast<QList<TileData*>*>(prop->data)->at(index);
+}
+
+QQmlListProperty<TileData> MinehuntGame::tiles(){
+ return QQmlListProperty<TileData>(this, &_tiles, &tilesPropAppend,
+ &tilesPropCount, &tilesPropAt, 0);
+}
+
+MinehuntGame::MinehuntGame()
+: numCols(9), numRows(9), playing(true), won(false)
+{
+ setObjectName("mainObject");
+ srand(QTime(0,0,0).secsTo(QTime::currentTime()));
+
+ //initialize array
+ for(int ii = 0; ii < numRows * numCols; ++ii) {
+ _tiles << new TileData;
+ }
+ reset();
+
+}
+
+void MinehuntGame::setBoard()
+{
+ foreach(TileData* t, _tiles){
+ t->setHasMine(false);
+ t->setHint(-1);
+ }
+ //place mines
+ int mines = nMines;
+ remaining = numRows*numCols-mines;
+ while ( mines ) {
+ int col = int((double(rand()) / double(RAND_MAX)) * numCols);
+ int row = int((double(rand()) / double(RAND_MAX)) * numRows);
+
+ TileData* t = tile( row, col );
+
+ if (t && !t->hasMine()) {
+ t->setHasMine( true );
+ mines--;
+ }
+ }
+
+ //set hints
+ for (int r = 0; r < numRows; r++)
+ for (int c = 0; c < numCols; c++) {
+ TileData* t = tile(r, c);
+ if (t && !t->hasMine()) {
+ int hint = getHint(r,c);
+ t->setHint(hint);
+ }
+ }
+
+ setPlaying(true);
+}
+
+void MinehuntGame::reset()
+{
+ foreach(TileData* t, _tiles){
+ t->unflip();
+ t->setHasFlag(false);
+ }
+ nMines = 12;
+ nFlags = 0;
+ emit numMinesChanged();
+ emit numFlagsChanged();
+ setPlaying(false);
+ QTimer::singleShot(600,this, SLOT(setBoard()));
+}
+
+int MinehuntGame::getHint(int row, int col)
+{
+ int hint = 0;
+ for (int c = col-1; c <= col+1; c++)
+ for (int r = row-1; r <= row+1; r++) {
+ TileData* t = tile(r, c);
+ if (t && t->hasMine())
+ hint++;
+ }
+ return hint;
+}
+
+bool MinehuntGame::flip(int row, int col)
+{
+ if(!playing)
+ return false;
+
+ TileData *t = tile(row, col);
+ if (!t || t->hasFlag())
+ return false;
+
+ if(t->flipped()){
+ int flags = 0;
+ for (int c = col-1; c <= col+1; c++)
+ for (int r = row-1; r <= row+1; r++) {
+ TileData *nearT = tile(r, c);
+ if(!nearT || nearT == t)
+ continue;
+ if(nearT->hasFlag())
+ flags++;
+ }
+ if(!t->hint() || t->hint() != flags)
+ return false;
+ for (int c = col-1; c <= col+1; c++)
+ for (int r = row-1; r <= row+1; r++) {
+ TileData *nearT = tile(r, c);
+ if (nearT && !nearT->flipped() && !nearT->hasFlag()) {
+ flip( r, c );
+ }
+ }
+ return true;
+ }
+
+ t->flip();
+
+ if (t->hint() == 0) {
+ for (int c = col-1; c <= col+1; c++)
+ for (int r = row-1; r <= row+1; r++) {
+ TileData* t = tile(r, c);
+ if (t && !t->flipped()) {
+ flip( r, c );
+ }
+ }
+ }
+
+ if(t->hasMine()){
+ for (int r = 0; r < numRows; r++)//Flip all other mines
+ for (int c = 0; c < numCols; c++) {
+ TileData* t = tile(r, c);
+ if (t && t->hasMine()) {
+ flip(r, c);
+ }
+ }
+ won = false;
+ hasWonChanged();
+ setPlaying(false);
+ return true;
+ }
+
+ remaining--;
+ if(!remaining){
+ won = true;
+ hasWonChanged();
+ setPlaying(false);
+ return true;
+ }
+ return true;
+}
+
+bool MinehuntGame::flag(int row, int col)
+{
+ TileData *t = tile(row, col);
+ if(!t || !playing || t->flipped())
+ return false;
+
+ t->setHasFlag(!t->hasFlag());
+ nFlags += (t->hasFlag()?1:-1);
+ emit numFlagsChanged();
+ return true;
+}
diff --git a/examples/demos/minehunt/minehunt.h b/examples/demos/minehunt/minehunt.h
new file mode 100644
index 0000000000..34bab71218
--- /dev/null
+++ b/examples/demos/minehunt/minehunt.h
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <qqml.h>
+
+class TileData : public QObject
+{
+ Q_OBJECT
+public:
+ TileData() : _hasFlag(false), _hasMine(false), _hint(-1), _flipped(false) {}
+
+ Q_PROPERTY(bool hasFlag READ hasFlag WRITE setHasFlag NOTIFY hasFlagChanged)
+ bool hasFlag() const { return _hasFlag; }
+
+ Q_PROPERTY(bool hasMine READ hasMine NOTIFY hasMineChanged)
+ bool hasMine() const { return _hasMine; }
+
+ Q_PROPERTY(int hint READ hint NOTIFY hintChanged)
+ int hint() const { return _hint; }
+
+ Q_PROPERTY(bool flipped READ flipped NOTIFY flippedChanged())
+ bool flipped() const { return _flipped; }
+
+ void setHasFlag(bool flag) {if(flag==_hasFlag) return; _hasFlag = flag; emit hasFlagChanged();}
+ void setHasMine(bool mine) {if(mine==_hasMine) return; _hasMine = mine; emit hasMineChanged();}
+ void setHint(int hint) { if(hint == _hint) return; _hint = hint; emit hintChanged(); }
+ void flip() { if (_flipped) return; _flipped = true; emit flippedChanged(); }
+ void unflip() { if(!_flipped) return; _flipped = false; emit flippedChanged(); }
+
+signals:
+ void flippedChanged();
+ void hasFlagChanged();
+ void hintChanged();
+ void hasMineChanged();
+
+private:
+ bool _hasFlag;
+ bool _hasMine;
+ int _hint;
+ bool _flipped;
+};
+
+class MinehuntGame : public QObject
+{
+ Q_OBJECT
+public:
+ MinehuntGame();
+
+ Q_PROPERTY(QQmlListProperty<TileData> tiles READ tiles CONSTANT)
+ QQmlListProperty<TileData> tiles();
+
+ Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged)
+ bool isPlaying() {return playing;}
+
+ Q_PROPERTY(bool hasWon READ hasWon NOTIFY hasWonChanged)
+ bool hasWon() {return won;}
+
+ Q_PROPERTY(int numMines READ numMines NOTIFY numMinesChanged)
+ int numMines() const{return nMines;}
+
+ Q_PROPERTY(int numFlags READ numFlags NOTIFY numFlagsChanged)
+ int numFlags() const{return nFlags;}
+
+public slots:
+ Q_INVOKABLE bool flip(int row, int col);
+ Q_INVOKABLE bool flag(int row, int col);
+ void setBoard();
+ void reset();
+
+signals:
+ void isPlayingChanged();
+ void hasWonChanged();
+ void numMinesChanged();
+ void numFlagsChanged();
+
+private:
+ bool onBoard( int r, int c ) const { return r >= 0 && r < numRows && c >= 0 && c < numCols; }
+ TileData *tile( int row, int col ) { return onBoard(row, col) ? _tiles[col+numRows*row] : 0; }
+ int getHint(int row, int col);
+ void setPlaying(bool b){if(b==playing) return; playing=b; emit isPlayingChanged();}
+
+ QList<TileData *> _tiles;
+ int numCols;
+ int numRows;
+ bool playing;
+ bool won;
+ int remaining;
+ int nMines;
+ int nFlags;
+};
diff --git a/examples/demos/minehunt/minehunt.pro b/examples/demos/minehunt/minehunt.pro
new file mode 100644
index 0000000000..78e874d805
--- /dev/null
+++ b/examples/demos/minehunt/minehunt.pro
@@ -0,0 +1,5 @@
+QT += qml quick
+
+HEADERS += minehunt.h
+SOURCES += main.cpp minehunt.cpp
+RESOURCES = minehunt.qrc
diff --git a/examples/demos/minehunt/minehunt.qml b/examples/demos/minehunt/minehunt.qml
new file mode 100644
index 0000000000..42dc408fff
--- /dev/null
+++ b/examples/demos/minehunt/minehunt.qml
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "MinehuntCore" 2.0
+
+Item {
+ id: field
+ property int clickx: 0
+ property int clicky: 0
+
+ width: 450; height: 450
+
+ Image { source: "MinehuntCore/pics/background.png"; anchors.fill: parent; fillMode: Image.Tile }
+
+ Grid {
+ anchors.horizontalCenter: parent.horizontalCenter
+ columns: 9; spacing: 1
+
+ Repeater {
+ id: repeater
+ model: tiles
+ delegate: Tile {}
+ }
+ }
+
+ Row {
+ id: gamedata
+ x: 20; spacing: 20
+ anchors.bottom: field.bottom; anchors.bottomMargin: 15
+
+ Image {
+ source: "MinehuntCore/pics/quit.png"
+ scale: quitMouse.pressed ? 0.8 : 1.0
+ smooth: quitMouse.pressed
+ y: 10
+ MouseArea {
+ id: quitMouse
+ anchors.fill: parent
+ anchors.margins: -20
+ onClicked: Qt.quit()
+ }
+ }
+ Column {
+ spacing: 2
+ Image { source: "MinehuntCore/pics/bomb-color.png" }
+ Text { anchors.horizontalCenter: parent.horizontalCenter; color: "white"; text: numMines }
+ }
+
+ Column {
+ spacing: 2
+ Image { source: "MinehuntCore/pics/flag-color.png" }
+ Text { anchors.horizontalCenter: parent.horizontalCenter; color: "white"; text: numFlags }
+ }
+ }
+
+ Image {
+ anchors.bottom: field.bottom; anchors.bottomMargin: 15
+ anchors.right: field.right; anchors.rightMargin: 20
+ source: isPlaying ? 'MinehuntCore/pics/face-smile.png' :
+ hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png'
+
+ MouseArea { anchors.fill: parent; onPressed: reset() }
+ }
+ Text {
+ anchors.centerIn: parent; width: parent.width - 20
+ horizontalAlignment: Text.AlignHCenter
+ wrapMode: Text.WordWrap
+ text: "Minehunt demo has to be compiled to run.\n\nPlease see README."
+ color: "white"; font.bold: true; font.pixelSize: 14
+ visible: tiles == undefined
+ }
+
+}
diff --git a/examples/demos/minehunt/minehunt.qmlproject b/examples/demos/minehunt/minehunt.qmlproject
new file mode 100644
index 0000000000..5aeb78f1ea
--- /dev/null
+++ b/examples/demos/minehunt/minehunt.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "minehunt.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/demos/minehunt/minehunt.qrc b/examples/demos/minehunt/minehunt.qrc
new file mode 100644
index 0000000000..fa8e27d383
--- /dev/null
+++ b/examples/demos/minehunt/minehunt.qrc
@@ -0,0 +1,20 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>minehunt.qml</file>
+ <file>MinehuntCore/Explosion.qml</file>
+ <file>MinehuntCore/Tile.qml</file>
+ <file>MinehuntCore/qmldir</file>
+ <file>MinehuntCore/pics/background.png</file>
+ <file>MinehuntCore/pics/back.png</file>
+ <file>MinehuntCore/pics/bomb-color.png</file>
+ <file>MinehuntCore/pics/bomb.png</file>
+ <file>MinehuntCore/pics/face-sad.png</file>
+ <file>MinehuntCore/pics/face-smile-big.png</file>
+ <file>MinehuntCore/pics/face-smile.png</file>
+ <file>MinehuntCore/pics/flag-color.png</file>
+ <file>MinehuntCore/pics/flag.png</file>
+ <file>MinehuntCore/pics/front.png</file>
+ <file>MinehuntCore/pics/quit.png</file>
+ <file>MinehuntCore/pics/star.png</file>
+</qresource>
+</RCC>
diff --git a/examples/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/examples/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml
new file mode 100644
index 0000000000..164f47faa9
--- /dev/null
+++ b/examples/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+Component {
+ id: albumDelegate
+ Package {
+
+ Item {
+ Package.name: 'browser'
+ GridView {
+ id: photosGridView; model: visualModel.parts.grid; width: mainWindow.width; height: mainWindow.height - 21
+ x: 0; y: 21; cellWidth: 160; cellHeight: 153; interactive: false
+ onCurrentIndexChanged: photosListView.positionViewAtIndex(currentIndex, ListView.Contain)
+ }
+ }
+
+ Item {
+ Package.name: 'fullscreen'
+ ListView {
+ id: photosListView; model: visualModel.parts.list; orientation: Qt.Horizontal
+ width: mainWindow.width; height: mainWindow.height; interactive: false
+ onCurrentIndexChanged: photosGridView.positionViewAtIndex(currentIndex, GridView.Contain)
+ highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem
+ }
+ }
+
+ Item {
+ Package.name: 'album'
+ id: albumWrapper; width: 210; height: 220
+
+ VisualDataModel {
+ id: visualModel; delegate: PhotoDelegate { }
+ model: RssModel { id: rssModel; tags: tag }
+ }
+
+ BusyIndicator {
+ id: busyIndicator
+ anchors { centerIn: parent; verticalCenterOffset: -20 }
+ on: rssModel.status != XmlListModel.Ready
+ }
+
+ PathView {
+ id: photosPathView; model: visualModel.parts.stack; pathItemCount: 5
+ visible: !busyIndicator.visible
+ anchors.centerIn: parent; anchors.verticalCenterOffset: -30
+ path: Path {
+ PathAttribute { name: 'z'; value: 9999.0 }
+ PathLine { x: 1; y: 1 }
+ PathAttribute { name: 'z'; value: 0.0 }
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: mainWindow.editMode ? photosModel.remove(index) : albumWrapper.state = 'inGrid'
+ }
+
+ Tag {
+ anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom; bottomMargin: 10 }
+ frontLabel: tag; backLabel: qsTr("Remove"); flipped: mainWindow.editMode
+ onTagChanged: rssModel.tags = tag
+ onBackClicked: if (mainWindow.editMode) photosModel.remove(index);
+ }
+
+ states: [
+ State {
+ name: 'inGrid'
+ PropertyChanges { target: photosGridView; interactive: true }
+ PropertyChanges { target: albumsShade; opacity: 1 }
+ PropertyChanges { target: backButton; onClicked: albumWrapper.state = ''; y: 6 }
+ },
+ State {
+ name: 'fullscreen'; extend: 'inGrid'
+ PropertyChanges { target: photosGridView; interactive: false }
+ PropertyChanges { target: photosListView; interactive: true }
+ PropertyChanges { target: photosShade; opacity: 1 }
+ PropertyChanges { target: backButton; y: -backButton.height - 8 }
+ }
+ ]
+
+ GridView.onAdd: NumberAnimation {
+ target: albumWrapper; properties: "scale"; from: 0.0; to: 1.0; easing.type: Easing.OutQuad
+ }
+ GridView.onRemove: SequentialAnimation {
+ PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: true }
+ NumberAnimation { target: albumWrapper; property: "scale"; from: 1.0; to: 0.0; easing.type: Easing.OutQuad }
+ PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: false }
+ }
+
+ transitions: [
+ Transition {
+ from: '*'; to: 'inGrid'
+ SequentialAnimation {
+ NumberAnimation { properties: 'opacity'; duration: 250 }
+ PauseAnimation { duration: 350 }
+ NumberAnimation { target: backButton; properties: "y"; duration: 200; easing.type: Easing.OutQuad }
+ }
+ },
+ Transition {
+ from: 'inGrid'; to: '*'
+ NumberAnimation { properties: "y,opacity"; easing.type: Easing.OutQuad; duration: 300 }
+ }
+ ]
+ }
+ }
+}
diff --git a/examples/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml b/examples/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml
new file mode 100644
index 0000000000..867c268399
--- /dev/null
+++ b/examples/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Image {
+ id: container
+ property bool on: false
+
+ source: "images/busy.png"; visible: container.on
+ NumberAnimation on rotation { running: container.on; from: 0; to: 360; loops: Animation.Infinite; duration: 1200 }
+}
diff --git a/examples/demos/photoviewer/PhotoViewerCore/Button.qml b/examples/demos/photoviewer/PhotoViewerCore/Button.qml
new file mode 100644
index 0000000000..8f4177c097
--- /dev/null
+++ b/examples/demos/photoviewer/PhotoViewerCore/Button.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: container
+
+ property alias label: labelText.text
+ property color tint: "transparent"
+ signal clicked
+
+ width: labelText.width + 70 ; height: labelText.height + 18
+
+ BorderImage {
+ anchors { fill: container; leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 }
+ source: 'images/box-shadow.png'; smooth: true
+ border.left: 10; border.top: 10; border.right: 10; border.bottom: 10
+ }
+
+ Image { anchors.fill: parent; source: "images/cardboard.png"; smooth: true }
+
+ Rectangle {
+ anchors.fill: container; color: container.tint; visible: container.tint != ""
+ opacity: 0.25; smooth: true
+ }
+
+ Text { id: labelText; font.pixelSize: 15; anchors.centerIn: parent; smooth: true }
+
+ MouseArea {
+ anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 }
+ onClicked: container.clicked()
+ }
+}
diff --git a/examples/demos/photoviewer/PhotoViewerCore/EditableButton.qml b/examples/demos/photoviewer/PhotoViewerCore/EditableButton.qml
new file mode 100644
index 0000000000..435ad2644f
--- /dev/null
+++ b/examples/demos/photoviewer/PhotoViewerCore/EditableButton.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: container
+
+ property string label
+ signal clicked
+ signal labelChanged(string label)
+
+ width: textInput.width + 70 ; height: textInput.height + 18
+
+ BorderImage {
+ anchors { fill: container; leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 }
+ source: 'images/box-shadow.png'; smooth: true
+ border.left: 10; border.top: 10; border.right: 10; border.bottom: 10
+ }
+
+ Image { anchors.fill: parent; source: "images/cardboard.png"; smooth: true }
+
+ TextInput {
+ id: textInput; text: label; font.pixelSize: 15; anchors.centerIn: parent; smooth: true
+ Keys.onReturnPressed: {
+ container.labelChanged(textInput.text)
+ container.focus = true
+ }
+ Keys.onEnterPressed: {
+ container.labelChanged(textInput.text)
+ container.focus = true
+ }
+ Keys.onEscapePressed: {
+ textInput.text = container.label
+ container.focus = true
+ }
+ }
+
+ Rectangle {
+ anchors.fill: container; border.color: "steelblue"; border.width: 4
+ color: "transparent"; visible: textInput.focus; smooth: true
+ }
+
+ MouseArea {
+ anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 }
+ onClicked: { textInput.forceActiveFocus(); textInput.openSoftwareInputPanel(); }
+ }
+}
diff --git a/examples/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/examples/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml
new file mode 100644
index 0000000000..5d4e5aee5d
--- /dev/null
+++ b/examples/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml
@@ -0,0 +1,188 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "script/script.js" as Script
+
+Package {
+ Item { id: stackItem; Package.name: 'stack'; width: 160; height: 153; z: stackItem.PathView.z }
+ Item { id: listItem; Package.name: 'list'; width: mainWindow.width + 40; height: 153 }
+ Item { id: gridItem; Package.name: 'grid'; width: 160; height: 153 }
+
+ Item {
+ width: 160; height: 153
+
+ Item {
+ id: photoWrapper
+
+ property double randomAngle: Math.random() * (2 * 6 + 1) - 6
+ property double randomAngle2: Math.random() * (2 * 6 + 1) - 6
+
+ x: 0; y: 0; width: 140; height: 133
+ z: stackItem.PathView.z; rotation: photoWrapper.randomAngle
+
+ BorderImage {
+ anchors {
+ fill: originalImage.status == Image.Ready ? border : placeHolder
+ leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8
+ }
+ source: 'images/box-shadow.png'; smooth: true
+ border.left: 10; border.top: 10; border.right: 10; border.bottom: 10
+ }
+ Rectangle {
+ id: placeHolder
+
+ property int w: Script.getWidth(content)
+ property int h: Script.getHeight(content)
+ property double s: Script.calculateScale(w, h, photoWrapper.width)
+
+ color: 'white'; anchors.centerIn: parent; smooth: true
+ width: w * s; height: h * s; visible: originalImage.status != Image.Ready
+ Rectangle {
+ color: "#878787"; smooth: true
+ anchors { fill: parent; topMargin: 3; bottomMargin: 3; leftMargin: 3; rightMargin: 3 }
+ }
+ }
+ Rectangle {
+ id: border; color: 'white'; anchors.centerIn: parent; smooth: true
+ width: originalImage.paintedWidth + 6; height: originalImage.paintedHeight + 6
+ visible: !placeHolder.visible
+ }
+ BusyIndicator { anchors.centerIn: parent; on: originalImage.status != Image.Ready }
+ Image {
+ id: originalImage; smooth: true; source: "http://" + Script.getImagePath(content); cache: false
+ fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height
+ }
+ Image {
+ id: hqImage; smooth: true; source: ""; visible: false; cache: false
+ fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height
+ }
+ Binding {
+ target: mainWindow; property: "downloadProgress"; value: hqImage.progress
+ when: listItem.ListView.isCurrentItem
+ }
+ Binding {
+ target: mainWindow; property: "imageLoading"
+ value: (hqImage.status == Image.Loading) ? 1 : 0; when: listItem.ListView.isCurrentItem
+ }
+ MouseArea {
+ width: originalImage.paintedWidth; height: originalImage.paintedHeight; anchors.centerIn: originalImage
+ onClicked: {
+ if (albumWrapper.state == 'inGrid') {
+ gridItem.GridView.view.currentIndex = index;
+ albumWrapper.state = 'fullscreen'
+ } else {
+ gridItem.GridView.view.currentIndex = index;
+ albumWrapper.state = 'inGrid'
+ }
+ }
+ }
+
+ states: [
+ State {
+ name: 'stacked'; when: albumWrapper.state == ''
+ ParentChange { target: photoWrapper; parent: stackItem; x: 10; y: 10 }
+ PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 }
+ },
+ State {
+ name: 'inGrid'; when: albumWrapper.state == 'inGrid'
+ ParentChange { target: photoWrapper; parent: gridItem; x: 10; y: 10; rotation: photoWrapper.randomAngle2 }
+ },
+ State {
+ name: 'fullscreen'; when: albumWrapper.state == 'fullscreen'
+ ParentChange {
+ target: photoWrapper; parent: listItem; x: 0; y: 0; rotation: 0
+ width: mainWindow.width; height: mainWindow.height
+ }
+ PropertyChanges { target: border; opacity: 0 }
+ PropertyChanges { target: hqImage; source: listItem.ListView.isCurrentItem ? hq : ""; visible: true }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: 'stacked'; to: 'inGrid'
+ SequentialAnimation {
+ PauseAnimation { duration: 10 * index }
+ ParentAnimation {
+ target: photoWrapper; via: foreground
+ NumberAnimation {
+ target: photoWrapper; properties: 'x,y,rotation,opacity'; duration: 600; easing.type: 'OutQuart'
+ }
+ }
+ }
+ },
+ Transition {
+ from: 'inGrid'; to: 'stacked'
+ ParentAnimation {
+ target: photoWrapper; via: foreground
+ NumberAnimation { properties: 'x,y,rotation,opacity'; duration: 600; easing.type: 'OutQuart' }
+ }
+ },
+ Transition {
+ from: 'inGrid'; to: 'fullscreen'
+ SequentialAnimation {
+ PauseAnimation { duration: gridItem.GridView.isCurrentItem ? 0 : 600 }
+ ParentAnimation {
+ target: photoWrapper; via: foreground
+ NumberAnimation {
+ targets: [ photoWrapper, border ]
+ properties: 'x,y,width,height,opacity,rotation'
+ duration: gridItem.GridView.isCurrentItem ? 600 : 1; easing.type: 'OutQuart'
+ }
+ }
+ }
+ },
+ Transition {
+ from: 'fullscreen'; to: 'inGrid'
+ ParentAnimation {
+ target: photoWrapper; via: foreground
+ NumberAnimation {
+ targets: [ photoWrapper, border ]
+ properties: 'x,y,width,height,rotation,opacity'
+ duration: gridItem.GridView.isCurrentItem ? 600 : 1; easing.type: 'OutQuart'
+ }
+ }
+ }
+ ]
+ }
+ }
+}
diff --git a/examples/demos/photoviewer/PhotoViewerCore/ProgressBar.qml b/examples/demos/photoviewer/PhotoViewerCore/ProgressBar.qml
new file mode 100644
index 0000000000..58beef57f3
--- /dev/null
+++ b/examples/demos/photoviewer/PhotoViewerCore/ProgressBar.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: container
+
+ property real progress: 0
+
+ Behavior on opacity { NumberAnimation { duration: 600 } }
+
+ Rectangle { anchors.fill: parent; color: "black"; opacity: 0.5 }
+
+ Rectangle {
+ id: fill; color: "white"; height: container.height
+ width: container.width * container.progress
+ }
+}
diff --git a/examples/demos/photoviewer/PhotoViewerCore/RssModel.qml b/examples/demos/photoviewer/PhotoViewerCore/RssModel.qml
new file mode 100644
index 0000000000..1598977bb1
--- /dev/null
+++ b/examples/demos/photoviewer/PhotoViewerCore/RssModel.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+XmlListModel {
+ property string tags : ""
+
+ function encodeTags(x) { return encodeURIComponent(x.replace(' ',',')); }
+
+ source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+encodeTags(tags)+"&" : "")
+ query: "/feed/entry"
+ namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"
+
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "content"; query: "content/string()" }
+ XmlRole { name: "hq"; query: "link[@rel='enclosure']/@href/string()" }
+}
diff --git a/examples/demos/photoviewer/PhotoViewerCore/Tag.qml b/examples/demos/photoviewer/PhotoViewerCore/Tag.qml
new file mode 100644
index 0000000000..ed4a248a7b
--- /dev/null
+++ b/examples/demos/photoviewer/PhotoViewerCore/Tag.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Flipable {
+ id: flipable
+
+ property alias frontLabel: frontButton.label
+ property alias backLabel: backButton.label
+
+ property int angle: 0
+ property int randomAngle: Math.random() * (2 * 6 + 1) - 6
+ property bool flipped: false
+
+ signal frontClicked
+ signal backClicked
+ signal tagChanged(string tag)
+
+ front: EditableButton {
+ id: frontButton; rotation: flipable.randomAngle
+ anchors { centerIn: parent; verticalCenterOffset: -20 }
+ onClicked: flipable.frontClicked()
+ onLabelChanged: flipable.tagChanged(label)
+ }
+
+ back: Button {
+ id: backButton; tint: "red"; rotation: flipable.randomAngle
+ anchors { centerIn: parent; verticalCenterOffset: -20 }
+ onClicked: flipable.backClicked()
+ }
+
+ transform: Rotation {
+ origin.x: flipable.width / 2; origin.y: flipable.height / 2
+ axis.x: 0; axis.y: 1; axis.z: 0
+ angle: flipable.angle
+ }
+
+ states: State {
+ name: "back"; when: flipable.flipped
+ PropertyChanges { target: flipable; angle: 180 }
+ }
+
+ transitions: Transition {
+ ParallelAnimation {
+ NumberAnimation { properties: "angle"; duration: 400 }
+ SequentialAnimation {
+ NumberAnimation { target: flipable; property: "scale"; to: 0.8; duration: 200 }
+ NumberAnimation { target: flipable; property: "scale"; to: 1.0; duration: 200 }
+ }
+ }
+ }
+}
diff --git a/examples/demos/photoviewer/PhotoViewerCore/images/box-shadow.png b/examples/demos/photoviewer/PhotoViewerCore/images/box-shadow.png
new file mode 100644
index 0000000000..431af8545d
--- /dev/null
+++ b/examples/demos/photoviewer/PhotoViewerCore/images/box-shadow.png
Binary files differ
diff --git a/examples/demos/photoviewer/PhotoViewerCore/images/busy.png b/examples/demos/photoviewer/PhotoViewerCore/images/busy.png
new file mode 100644
index 0000000000..664c2b1491
--- /dev/null
+++ b/examples/demos/photoviewer/PhotoViewerCore/images/busy.png
Binary files differ
diff --git a/examples/demos/photoviewer/PhotoViewerCore/images/cardboard.png b/examples/demos/photoviewer/PhotoViewerCore/images/cardboard.png
new file mode 100644
index 0000000000..1847ab528d
--- /dev/null
+++ b/examples/demos/photoviewer/PhotoViewerCore/images/cardboard.png
Binary files differ
diff --git a/examples/demos/photoviewer/PhotoViewerCore/qmldir b/examples/demos/photoviewer/PhotoViewerCore/qmldir
new file mode 100644
index 0000000000..d3c247f21a
--- /dev/null
+++ b/examples/demos/photoviewer/PhotoViewerCore/qmldir
@@ -0,0 +1,8 @@
+AlbumDelegate AlbumDelegate.qml
+PhotoDelegate PhotoDelegate.qml
+ProgressBar ProgressBar.qml
+RssModel RssModel.qml
+BusyIndicator BusyIndicator.qml
+EditableButton EditableButton.qml
+Button Button.qml
+Tag Tag.qml
diff --git a/examples/demos/photoviewer/PhotoViewerCore/script/script.js b/examples/demos/photoviewer/PhotoViewerCore/script/script.js
new file mode 100644
index 0000000000..e8ef93a847
--- /dev/null
+++ b/examples/demos/photoviewer/PhotoViewerCore/script/script.js
@@ -0,0 +1,27 @@
+.pragma library
+
+function getWidth(string) {
+ return (string.match(/width=\"([0-9]+)\"/))[1]
+}
+
+function getHeight(string) {
+ return (string.match(/height=\"([0-9]+)\"/))[1]
+}
+
+function getImagePath(string) {
+ var pattern = /src=\"http:\/\/(\S+)\"/
+ return (string.match(pattern))[1]
+}
+
+function calculateScale(width, height, cellSize) {
+ var widthScale = (cellSize * 1.0) / width
+ var heightScale = (cellSize * 1.0) / height
+ var scale = 0
+
+ if (widthScale <= heightScale) {
+ scale = widthScale;
+ } else if (heightScale < widthScale) {
+ scale = heightScale;
+ }
+ return scale;
+}
diff --git a/examples/demos/photoviewer/i18n/base.ts b/examples/demos/photoviewer/i18n/base.ts
new file mode 100644
index 0000000000..1accfd2f90
--- /dev/null
+++ b/examples/demos/photoviewer/i18n/base.ts
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+ <name>AlbumDelegate</name>
+ <message>
+ <location filename="../PhotoViewerCore/AlbumDelegate.qml" line="59"/>
+ <source>Remove</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>photoviewer</name>
+ <message>
+ <location filename="../photoviewer.qml" line="30"/>
+ <source>Add</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../photoviewer.qml" line="39"/>
+ <source>Edit</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../photoviewer.qml" line="52"/>
+ <source>Back</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/examples/demos/photoviewer/i18n/qml_fr.qm b/examples/demos/photoviewer/i18n/qml_fr.qm
new file mode 100644
index 0000000000..c24fcbc46c
--- /dev/null
+++ b/examples/demos/photoviewer/i18n/qml_fr.qm
Binary files differ
diff --git a/examples/demos/photoviewer/i18n/qml_fr.ts b/examples/demos/photoviewer/i18n/qml_fr.ts
new file mode 100644
index 0000000000..9f892db616
--- /dev/null
+++ b/examples/demos/photoviewer/i18n/qml_fr.ts
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr_FR">
+<context>
+ <name>AlbumDelegate</name>
+ <message>
+ <location filename="../PhotoViewerCore/AlbumDelegate.qml" line="59"/>
+ <source>Remove</source>
+ <translation>Supprimer</translation>
+ </message>
+</context>
+<context>
+ <name>photoviewer</name>
+ <message>
+ <location filename="../photoviewer.qml" line="30"/>
+ <source>Add</source>
+ <translation>Ajouter</translation>
+ </message>
+ <message>
+ <location filename="../photoviewer.qml" line="39"/>
+ <source>Edit</source>
+ <translation>Éditer</translation>
+ </message>
+ <message>
+ <location filename="../photoviewer.qml" line="52"/>
+ <source>Back</source>
+ <translation>Retour</translation>
+ </message>
+</context>
+</TS>
diff --git a/examples/demos/photoviewer/photoviewer.qml b/examples/demos/photoviewer/photoviewer.qml
new file mode 100644
index 0000000000..208720b9e6
--- /dev/null
+++ b/examples/demos/photoviewer/photoviewer.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "PhotoViewerCore"
+
+Rectangle {
+ id: mainWindow
+
+ property real downloadProgress: 0
+ property bool imageLoading: false
+ property bool editMode: false
+
+ width: 800; height: 480; color: "#d5d6d8"
+
+ ListModel {
+ id: photosModel
+ ListElement { tag: "Flowers" }
+ ListElement { tag: "Wildlife" }
+ ListElement { tag: "Prague" }
+ }
+
+ VisualDataModel { id: albumVisualModel; model: photosModel; delegate: AlbumDelegate {} }
+
+ GridView {
+ id: albumView; width: parent.width; height: parent.height; cellWidth: 210; cellHeight: 220
+ model: albumVisualModel.parts.album; visible: albumsShade.opacity != 1.0
+ }
+
+ Column {
+ spacing: 20; anchors { bottom: parent.bottom; right: parent.right; rightMargin: 20; bottomMargin: 20 }
+ Button {
+ id: newButton; label: qsTr("Add"); rotation: 3
+ anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: {
+ mainWindow.editMode = false
+ photosModel.append( { tag: "" } )
+ albumView.positionViewAtIndex(albumView.count - 1, GridView.Contain)
+ }
+ }
+ Button {
+ id: deleteButton; label: qsTr("Edit"); rotation: -2;
+ onClicked: mainWindow.editMode = !mainWindow.editMode
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Button {
+ id: quitButton; label: qsTr("Quit"); rotation: -2;
+ onClicked: Qt.quit()
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ Rectangle {
+ id: albumsShade; color: mainWindow.color
+ width: parent.width; height: parent.height; opacity: 0.0
+ }
+
+ ListView { anchors.fill: parent; model: albumVisualModel.parts.browser; interactive: false }
+
+ Button { id: backButton; label: qsTr("Back"); rotation: 3; x: parent.width - backButton.width - 6; y: -backButton.height - 8 }
+
+ Rectangle { id: photosShade; color: 'black'; width: parent.width; height: parent.height; opacity: 0; visible: opacity != 0.0 }
+
+ ListView { anchors.fill: parent; model: albumVisualModel.parts.fullscreen; interactive: false }
+
+ Item { id: foreground; anchors.fill: parent }
+
+ ProgressBar {
+ progress: mainWindow.downloadProgress; width: parent.width; height: 4
+ anchors.bottom: parent.bottom; opacity: mainWindow.imageLoading; visible: opacity != 0.0
+ }
+}
diff --git a/examples/demos/photoviewer/photoviewer.qmlproject b/examples/demos/photoviewer/photoviewer.qmlproject
new file mode 100644
index 0000000000..600bdb10f4
--- /dev/null
+++ b/examples/demos/photoviewer/photoviewer.qmlproject
@@ -0,0 +1,20 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "photoviewer.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ Files {
+ filter: "*.ts"
+ directory: "i18n"
+ }
+}
diff --git a/examples/demos/plasmapatrol/PlasmaPatrol.qmlproject b/examples/demos/plasmapatrol/PlasmaPatrol.qmlproject
new file mode 100644
index 0000000000..548295243d
--- /dev/null
+++ b/examples/demos/plasmapatrol/PlasmaPatrol.qmlproject
@@ -0,0 +1,19 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "plasmapatrol.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ Files {
+ paths: ["TODO"]
+ }
+}
diff --git a/examples/demos/plasmapatrol/TODO b/examples/demos/plasmapatrol/TODO
new file mode 100644
index 0000000000..ef9d21a73d
--- /dev/null
+++ b/examples/demos/plasmapatrol/TODO
@@ -0,0 +1,10 @@
+Realistic Tasks:
+Particle explosions on ship death.
+Better help text (both content and styled a little nicer).
+Hardpoint help showing them firing across the screen.
+Endless Demo Mode
+
+Nice-but-i-doubt-it-will-get-done Tasks:
+Particle Text for the winner.
+Particle-based buttons.
+Single player mode that is challenges (known opponents) to master the game with and earn achievements (in addition to 'skirmish').
diff --git a/examples/demos/plasmapatrol/content/BlasterHardpoint.qml b/examples/demos/plasmapatrol/content/BlasterHardpoint.qml
new file mode 100644
index 0000000000..10c50d43c8
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/BlasterHardpoint.qml
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ property variant target: {"y": -90, "x":12}
+ property Item targetObj: container
+ property Item hardpoint: container
+ property ParticleSystem system
+ property int blasts: 16
+ property int bonusBlasts: 12
+ property bool show: true
+
+ width: 24
+ height: 24
+ Emitter {
+ id: visualization
+ group: "blaster"
+ system: container.system
+ enabled: show
+ anchors.fill: parent
+ shape: EllipseShape {}
+ speed: TargetDirection { targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true}
+ lifeSpan: 1000
+ emitRate: 64
+
+ size: 24
+ sizeVariation: 24
+ endSize: 0
+ }
+
+ property int blastsLeft: 0
+ function fireAt(targetArg, container) {
+ target = container.mapFromItem(targetArg, targetArg.width/2, targetArg.height/2);
+ targetObj = targetArg;
+ hardpoint = container;
+ blastsLeft = blasts;
+ rofTimer.repeat = true;
+ rofTimer.start();
+ }
+ Timer {
+ id: rofTimer
+ interval: 30;//Has to be greater than 1 frame or they stack up
+ running: false
+ repeat: false
+ onTriggered: {
+ if (targetObj.hp <= 0)
+ return;
+ //TODO: calculate hit and damage at target, which must be a Ship
+ var hit;
+ if (blastsLeft >= bonusBlasts)
+ hit = Math.random() > targetObj.dodge;
+ else
+ hit = false; //purely aesthetic shots, because the damage isn't that fine grained
+ if (hit == true) {
+ switch (targetObj.shipType) {
+ case 1: hardpoint.damageDealt += 4; break;
+ case 2: hardpoint.damageDealt += 5; break;
+ case 3: hardpoint.damageDealt += 1; break;
+ default: hardpoint.damageDealt += 100;
+ }
+ }
+ blastVector.targetX = target.x;
+ blastVector.targetY = target.y;
+ if (!hit) {//TODO: Actual targetVariation
+ blastVector.targetX += (128 * Math.random() - 64);
+ blastVector.targetY += (128 * Math.random() - 64);
+ }
+ emitter.burst(1);
+ blastsLeft--;
+ if (!blastsLeft)
+ rofTimer.repeat = false;
+ }
+ }
+ Emitter {
+ id: emitter
+ group: "blaster"
+ enabled: false
+ system: container.system
+ anchors.centerIn: parent
+
+ lifeSpan: 1000
+ emitRate: 16
+ maximumEmitted: blasts
+ size: 24
+ endSize:16
+ sizeVariation: 8
+ speed: TargetDirection {
+ id: blastVector
+ targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true
+ }
+ }
+}
diff --git a/examples/demos/plasmapatrol/content/Button.qml b/examples/demos/plasmapatrol/content/Button.qml
new file mode 100644
index 0000000000..992be295fc
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/Button.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+//TODO: Add particles to this component too
+Rectangle {
+ id: container
+ property alias text: txt.text
+ signal clicked
+ //color: "lightsteelblue"
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "lightsteelblue" }
+ GradientStop { position: 1.0; color: "steelblue" }
+ }
+ height: 64
+ radius: 16
+ width: 128
+ Text {
+ id: txt
+ anchors.centerIn: parent
+ font.pixelSize: 24
+ color: "white"
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: container.clicked()
+ }
+}
diff --git a/examples/demos/plasmapatrol/content/CannonHardpoint.qml b/examples/demos/plasmapatrol/content/CannonHardpoint.qml
new file mode 100644
index 0000000000..48eb9d171a
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/CannonHardpoint.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ property variant target: {"y": -90, "x":12}
+ property ParticleSystem system
+ property bool show: true
+
+ width: 24
+ height: 24
+ Emitter {
+ id: visualization
+ group: "cannon"
+ enabled: container.show
+ system: container.system
+ anchors.centerIn: parent
+ lifeSpan: 2000
+ emitRate: 1
+
+ size: 4
+ endSize: 0
+ }
+
+ function fireAt(targetArg, hardpoint) {
+ target = container.mapFromItem(targetArg, targetArg.width/2, targetArg.height/2);
+ if (container.hp <= 0 || targetArg.hp <= 0)
+ return;
+ //TODO: calculate hit and damage at target, which must be a Ship
+ var hit = Math.random() > targetArg.dodge
+ if (hit) {
+ switch (targetArg.shipType) {
+ case 1: hardpoint.damageDealt += 8; break;
+ case 2: hardpoint.damageDealt += 10; break;
+ case 3: hardpoint.damageDealt += 16; break;
+ default: hardpoint.damageDealt += 1000;
+ }
+ }
+ emitter.burst(1);
+ }
+ Emitter {
+ id: emitter
+ group: "cannon"
+ enabled: false
+ system: container.system
+ anchors.centerIn: parent
+
+ lifeSpan: 1000
+ emitRate: 1
+ size: 8
+ endSize: 4
+ speed: TargetDirection {
+ id: blastVector
+ targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true
+ }
+ }
+}
diff --git a/examples/demos/plasmapatrol/content/ChoiceBox.qml b/examples/demos/plasmapatrol/content/ChoiceBox.qml
new file mode 100644
index 0000000000..6e21101f2e
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/ChoiceBox.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ width: 360
+ height: 160
+ property ParticleSystem system
+ Ship {
+ id: nully
+ system: system
+ }
+ property Item target: nully
+ /*
+ Component.onCompleted: {
+ container.target.shipType = 1
+ container.target.gunType = 1
+ }
+ */
+ Row {
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: parent.height
+ spacing: 8
+ Button {
+ width: 80
+ height: 80
+ anchors.verticalCenter: parent.verticalCenter
+ text: "Cycle\nShip"
+ onClicked: {
+ var nextVal = container.target.shipType;
+ if(nextVal == 3)
+ nextVal = 1;
+ else
+ nextVal++;
+ container.target.shipType = nextVal;
+ }
+ }
+ Item {
+ width: 128
+ height: 128
+ anchors.verticalCenter: parent.verticalCenter
+ Ship {
+ hp: 20
+ anchors.centerIn: parent
+ shipType: container.target.shipType
+ gunType: container.target.gunType
+ system: container.system
+ }
+ }
+ Button {
+ width: 80
+ height: 80
+ anchors.verticalCenter: parent.verticalCenter
+ text: "Cycle\nGun"
+ onClicked: {
+ var nextVal = container.target.gunType;
+ if(nextVal == 3)
+ nextVal = 1;
+ else
+ nextVal++;
+ container.target.gunType = nextVal;
+ }
+ }
+ }
+}
diff --git a/examples/demos/plasmapatrol/content/Cruiser.qml b/examples/demos/plasmapatrol/content/Cruiser.qml
new file mode 100644
index 0000000000..c469eb46d2
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/Cruiser.qml
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ property int maxHP: 100
+ property int hp: maxHP
+ property real initialDodge: 0.01
+ property real dodge: initialDodge
+ onHpChanged: if(hp <= 0) target = container;
+ property ParticleSystem system//TODO: Ship abstraction
+ property Item target: container
+ property string shipParticle: "default"//Per team colors?
+ property int gunType: 0
+ width: 128
+ height: 128
+ Emitter {
+ //TODO: Cooler would be an 'orbiting' affector
+ //TODO: On the subject, opacity and size should be grouped type 'overLife' if we can cram that in the particles
+ system: container.system
+ group: container.shipParticle
+ anchors.centerIn: parent
+ width: 64
+ height: 64
+ shape: EllipseShape {}
+
+ emitRate: hp > 0 ? hp * 1 + 20 : 0
+ lifeSpan: 2400
+ maximumEmitted: (maxHP * 1 + 20)*2.4
+
+ size: 48
+ sizeVariation: 16
+ endSize: 16
+
+ speed: AngleDirection {angleVariation:360; magnitudeVariation: 32}
+ }
+ Emitter {
+ system: container.system
+ group: "cruiserArmor"
+ anchors.fill: parent
+ shape: EllipseShape { fill: false }
+ enabled: hp>0
+
+ emitRate: 16
+ lifeSpan: 2000
+
+ size: 48
+ sizeVariation: 24
+
+ SpriteGoal {
+ id: destructor
+ system: container.system
+ enabled: container.hp <=0
+ anchors.fill: parent
+ groups: ["cruiserArmor"]
+ goalState: "death"
+// jump: true
+ once: true
+ }
+ }
+
+ Timer {
+ id: fireControl
+ property int next: Math.floor(Math.random() * 3) + 1
+ interval: 800
+ running: root.readySetGo
+ repeat: true
+ onTriggered: {
+ if (next == 1) {
+ gun1.fireAt(container.target);
+ next = Math.floor(Math.random() * 3) + 1;
+ } else if (next == 2) {
+ gun2.fireAt(container.target);
+ next = Math.floor(Math.random() * 3) + 1;
+ } else if (next == 3) {
+ gun3.fireAt(container.target);
+ next = Math.floor(Math.random() * 3) + 1;
+ }
+ }
+ }
+
+ Hardpoint {//TODO: Hardpoint abstraction
+ x: 112 - 12 - 8*2
+ y: 128 - 12 - 12*2
+ id: gun1
+ system: container.system
+ show: hp > 0
+ hardpointType: gunType
+ }
+ Hardpoint {
+ x: 64 - 12
+ y: 0 - 12 + 12*2
+ id: gun2
+ system: container.system
+ show: hp > 0
+ hardpointType: gunType
+ }
+ Hardpoint {
+ x: 16 - 12 + 8*2
+ y: 128 - 12 - 12*2
+ id: gun3
+ system: container.system
+ show: hp > 0
+ hardpointType: gunType
+ }
+}
diff --git a/examples/demos/plasmapatrol/content/Frigate.qml b/examples/demos/plasmapatrol/content/Frigate.qml
new file mode 100644
index 0000000000..92c63b87d1
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/Frigate.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ property int maxHP: 100
+ property int hp: maxHP
+ property real initialDodge: 0.2
+ property real dodge: initialDodge
+ onHpChanged: if(hp <= 0) target = container;
+ property ParticleSystem system//TODO: Ship abstraction
+ property Item target: container
+ property string shipParticle: "default"//Per team colors?
+ property int gunType: 0
+ width: 128
+ height: 128
+ Emitter {
+ system: container.system
+ group: "frigateShield"
+ anchors.centerIn: parent
+ size: 92
+ emitRate: 1
+ lifeSpan: 4800
+ enabled: hp > 0
+ }
+ Emitter {
+ system: container.system
+ group: container.shipParticle
+ anchors.centerIn: parent
+ width: 64
+ height: 16
+ shape: EllipseShape {}
+
+ size: 16
+ sizeVariation: 8
+ endSize: 8
+ emitRate: hp > 0 ? hp * 1 + 20 : 0
+ lifeSpan: 1200
+ maximumEmitted: (maxHP * 1 + 20)*2
+ }
+ Timer {
+ id: fireControl
+ property int next: Math.floor(Math.random() * 2) + 1
+ interval: 800
+ running: root.readySetGo
+ repeat: true
+ onTriggered: {
+ if (next == 1) {
+ gun1.fireAt(container.target);
+ next = Math.floor(Math.random() * 2) + 1;
+ } else if (next == 2) {
+ gun2.fireAt(container.target);
+ next = Math.floor(Math.random() * 2) + 1;
+ }
+ }
+ }
+
+ Hardpoint {
+ x: 128 - 32 - 12
+ y: 64 - 12
+ id: gun1
+ system: container.system
+ show: hp > 0
+ hardpointType: gunType
+ }
+ Hardpoint {
+ x: 0 + 32 - 12
+ y: 64 - 12
+ id: gun2
+ system: container.system
+ show: hp > 0
+ hardpointType: gunType
+ }
+}
diff --git a/examples/demos/plasmapatrol/content/Hardpoint.qml b/examples/demos/plasmapatrol/content/Hardpoint.qml
new file mode 100644
index 0000000000..9e6057057d
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/Hardpoint.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ //ReflectiveProperties
+ //TransferredProperties
+ property variant target: {"y": -90, "x":12}
+ property ParticleSystem system
+ property bool show: true
+ property int hardpointType: 0 //default is pea shooter - always bad.
+
+ property Item targetObj: null
+ property int damageDealt: 0
+ onDamageDealtChanged: dealDamageTimer.start();
+ Timer {
+ id: dealDamageTimer
+ interval: 16
+ running: false
+ repeat: false
+ onTriggered: {targetObj.hp -= damageDealt; damageDealt = 0;}
+ }
+ width: 24
+ height: 24
+ function fireAt(targetArg) {//Each implement own
+ if (targetArg != null) {
+ hardpointLoader.item.fireAt(targetArg, container);
+ targetObj = targetArg;
+ }
+ }
+ Loader {
+ id: hardpointLoader
+ sourceComponent: {
+ switch (hardpointType) {
+ case 1: laserComponent; break;
+ case 2: blasterComponent; break;
+ case 3: cannonComponent; break;
+ default: emptyComponent;
+ }
+ }
+ }
+ Component {
+ id: laserComponent
+ LaserHardpoint {
+ target: container.target
+ system: container.system
+ show: container.show
+ }
+ }
+ Component {
+ id: blasterComponent
+ BlasterHardpoint {
+ target: container.target
+ system: container.system
+ show: container.show
+ }
+ }
+ Component {
+ id: cannonComponent
+ CannonHardpoint {
+ target: container.target
+ system: container.system
+ show: container.show
+ }
+ }
+ Component {
+ id: emptyComponent
+ Item {
+ function fireAt(obj) {
+ console.log("Firing null weapon. It hurts.");
+ }
+ }
+ }
+}
diff --git a/examples/demos/plasmapatrol/content/HelpScreens.qml b/examples/demos/plasmapatrol/content/HelpScreens.qml
new file mode 100644
index 0000000000..db70c6ee90
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/HelpScreens.qml
@@ -0,0 +1,268 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+SequentialLoader {
+ id: hLdr
+ signal exitDesired
+ Component.onCompleted: advance();
+ ParticleSystem { id: helpSystem }
+ PlasmaPatrolParticles { sys: helpSystem }
+ pages: [
+ Component {Item {
+ id: story
+ Text {
+ color: "white"
+ text: "Story"
+ font.pixelSize: 48
+ }
+ /*
+ Flickable {
+ y: 60
+ width: 360
+ height: 500
+ contentHeight: txt1.height
+ contentWidth: 360//TODO: Less magic numbers?
+ */
+ Text {
+ id: txt1
+ color: "white"
+ y: 60
+ font.pixelSize: 18
+ text: "
+In a remote nebula, a race of energy beings formed and lived prosperous lives for millenia. Until the schism - when they became constantly at each other's energy-throats. War soon followed, crippling both sides, until a truce was formed. But while governments knew the desparate need for peace, the soldiers in the ion-field were still filled with rampant bloodlust. On the border, patrols are constantly engaging in minor skirmishes whenever they cross paths.
+
+You must select one such patrol unit for the border, heading into an inevitable skirmish, in Plasma Patrol: the game of energy being spaceship combat!
+ "
+ width: 360
+ wrapMode: Text.WordWrap
+ }
+ // }
+ Button {
+ x: 20
+ y: 560
+ height: 40
+ width: 120
+ text: "Next"
+ onClicked: hLdr.advance();
+ }
+ Button {
+ x: 220
+ y: 560
+ height: 40
+ width: 120
+ text: "Menu"
+ onClicked: hLdr.exitDesired();
+ }
+ }},
+ Component {Item {
+ id: ships
+ Text {
+ color: "white"
+ text: "Vessels"
+ font.pixelSize: 48
+ }
+ Column {
+ spacing: 16
+ y: 60
+ Row {
+ height: 128
+ Sloop {
+ system: helpSystem
+ }
+ Text {
+ text: "The nimble sloop"
+ color: "white"
+ font.pixelSize: 18
+ }
+ }
+ Row {
+ height: 128
+ Frigate {
+ system: helpSystem
+ }
+ Text {
+ text: "The versitile shield frigate"
+ color: "white"
+ font.pixelSize: 18
+ }
+ }
+ Row {
+ height: 128
+ Cruiser {
+ system: helpSystem
+ }
+ Text {
+ text: "The armored cruiser"
+ color: "white"
+ font.pixelSize: 18
+ }
+ }
+ }
+ Button {
+ x: 20
+ y: 560
+ height: 40
+ width: 120
+ text: "Next"
+ onClicked: hLdr.advance();
+ }
+ Button {
+ x: 220
+ y: 560
+ height: 40
+ width: 120
+ text: "Menu"
+ onClicked: hLdr.exitDesired();
+ }
+ }},
+ Component {Item {
+ id: guns
+ Text {
+ color: "white"
+ text: "Hardpoints"
+ font.pixelSize: 48
+ }
+ Column {
+ spacing: 16
+ y: 60
+ Row {
+ height: 128
+ LaserHardpoint {
+ system: helpSystem
+ }
+ Text {
+ text: "The laser hardpoint almost always hits the target, even the nimble sloop, but loses much of its potency against the frigate's shields"
+ width: 332
+ wrapMode: Text.WordWrap
+ color: "white"
+ font.pixelSize: 18
+ }
+ }
+ Row {
+ height: 128
+ BlasterHardpoint {
+ system: helpSystem
+ }
+ Text {
+ text: "The blaster passes right through the frigate's shields but loses much of its impact against the armor of the cruiser"
+ width: 332
+ wrapMode: Text.WordWrap
+ color: "white"
+ font.pixelSize: 18
+ }
+ }
+ Row {
+ height: 128
+ CannonHardpoint {
+ system: helpSystem
+ }
+ Text {
+ text: "The cannon has poor accuracy, often missing the nimble sloop, but can punch right through the armor of the cruiser"
+ width: 332
+ wrapMode: Text.WordWrap
+ color: "white"
+ font.pixelSize: 18
+ }
+ }
+ }
+ Button {
+ x: 20
+ y: 560
+ height: 40
+ width: 120
+ text: "Next"
+ onClicked: hLdr.advance();
+ }
+ Button {
+ x: 220
+ y: 560
+ height: 40
+ width: 120
+ text: "Menu"
+ onClicked: hLdr.exitDesired();
+ }
+ }},
+ Component {Item {
+ id: strategy
+ Text {
+ color: "white"
+ text: "Strategy"
+ font.pixelSize: 48
+ }
+ Flickable {
+ y: 60
+ width: 360
+ height: 500
+ contentHeight: txt1.height
+ contentWidth: 360//TODO: Less magic numbers?
+ Text {
+ id: txt1
+ color: "white"
+ font.pixelSize: 18
+ text: "
+Basic Strategy: Good luck, have fun - don't die.
+More to come after thorough playtesting.
+ "
+ width: 360
+ wrapMode: Text.WordWrap
+ }
+ }
+ Button {
+ x: 20
+ y: 560
+ height: 40
+ width: 120
+ text: "Story"
+ onClicked: {hLdr.at=0; hLdr.advance();}
+ }
+ Button {
+ x: 220
+ y: 560
+ height: 40
+ width: 120
+ text: "Menu"
+ onClicked: hLdr.exitDesired();
+ }
+ }}
+ ]
+}
diff --git a/examples/demos/plasmapatrol/content/LaserHardpoint.qml b/examples/demos/plasmapatrol/content/LaserHardpoint.qml
new file mode 100644
index 0000000000..a7baed604b
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/LaserHardpoint.qml
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ property variant target: {"y": -90, "x":12}
+ property ParticleSystem system
+ property bool show: true
+
+ width: 24
+ height: 24
+ Emitter {
+ id: visualization
+ group: "laser"
+ system: container.system
+ anchors.fill: parent
+ enabled: container.show
+ shape: EllipseShape {}
+ speed: TargetDirection { targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true }
+ lifeSpan: 1000
+ emitRate: 64
+
+ size: 24
+ sizeVariation: 8
+ endSize: 8
+ }
+
+ function fireAt(targetArg, hardpoint) {
+ if (targetArg.hp <= 0)
+ return;
+ //TODO: calculate hit and damage at target, which must be a Ship
+ var offset = 0;
+ if (Math.random() < 0.99) {
+ switch (targetArg.shipType) {
+ case 1: hardpoint.damageDealt += 16; break;
+ case 2: hardpoint.damageDealt += 4; break;
+ case 3: hardpoint.damageDealt += 8; break;
+ default: hardpoint.damageDealt += 500; //Really effective against unregistered vessels
+ }
+ } else {//Misses with Lasers are really rare
+ offset = Math.random() * 100;
+ }
+ target = container.mapFromItem(targetArg, offset + targetArg.width/2, offset + targetArg.height/2);
+ emitter.pulse(100);
+ // console.log("Fire box: " + Math.min(container.width/2, target.x) + "," + Math.min(container.height/2, target.y) + " " + (Math.max(container.width/2, target.x) - Math.min(container.width/2, target.x)) + "," + (Math.max(container.height/2, target.y) - Math.min(container.height/2, target.y)));
+ }
+ Emitter {
+ id: emitter
+ group: "laser"
+ enabled: false
+ system: container.system
+ x: Math.min(container.width/2, target.x);
+ width: Math.max(container.width/2, target.x) - x;
+ y: Math.min(container.height/2, target.y);
+ height: Math.max(container.height/2, target.y) - y;
+ shape: LineShape {
+ mirrored: (emitter.y < 0 || emitter.x < 0) && !(emitter.y < 0 && emitter.x < 0 )//I just want XOR
+ }
+
+ lifeSpan: 1000
+ emitRate: 8000
+ maximumEmitted: 800
+ size: 16
+ endSize: 0
+
+ speed: PointDirection {xVariation: 4; yVariation: 4}
+ }
+}
diff --git a/examples/demos/plasmapatrol/content/PlasmaPatrolParticles.qml b/examples/demos/plasmapatrol/content/PlasmaPatrolParticles.qml
new file mode 100644
index 0000000000..e1924c3467
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/PlasmaPatrolParticles.qml
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ property ParticleSystem sys
+ ImageParticle {
+ system: sys
+ groups: ["default"]
+ source: "pics/blur-circle3.png"
+ color: "#003A3A3A"
+ colorVariation: 0.1
+ z: 0
+ }
+ ImageParticle {
+ system: sys
+ groups: ["redTeam"]
+ source: "pics/blur-circle3.png"
+ color: "#0028060A"
+ colorVariation: 0.1
+ z: 0
+ }
+ ImageParticle {
+ system: sys
+ groups: ["greenTeam"]
+ source: "pics/blur-circle3.png"
+ color: "#0006280A"
+ colorVariation: 0.1
+ z: 0
+ }
+ ImageParticle {
+ system: sys
+ groups: ["blaster"]
+ source: "pics/star2.png"
+ //color: "#0F282406"
+ color: "#0F484416"
+ colorVariation: 0.2
+ z: 2
+ }
+ ImageParticle {
+ system: sys
+ groups: ["laser"]
+ source: "pics/star3.png"
+ //color: "#00123F68"
+ color: "#00428FF8"
+ colorVariation: 0.2
+ z: 2
+ }
+ ImageParticle {
+ system: sys
+ groups: ["cannon"]
+ source: "pics/particle.png"
+ color: "#80FFAAFF"
+ colorVariation: 0.1
+ z: 2
+ }
+ ImageParticle {
+ system: sys
+ groups: ["cannonCore"]
+ source: "pics/particle.png"
+ color: "#00666666"
+ colorVariation: 0.8
+ z: 1
+ }
+ ImageParticle {
+ system: sys
+ groups: ["cannonWake"]
+ source: "pics/star.png"
+ color: "#00CCCCCC"
+ colorVariation: 0.2
+ z: 1
+ }
+ ImageParticle {
+ system: sys
+ groups: ["frigateShield"]
+ source: "pics/blur-circle2.png"
+ color: "#00000000"
+ colorVariation: 0.05
+ blueVariation: 0.5
+ greenVariation: 0.1
+ z: 3
+ }
+ ImageParticle {
+ system: sys
+ groups: ["cruiserArmor"]
+ z: 1
+ sprites:[Sprite {
+ id: spinState
+ name: "spinning"
+ source: "pics/meteor.png"
+ frameCount: 35
+ frameDuration: 40
+ to: {"death":0, "spinning":1}
+ },Sprite {
+ name: "death"
+ source: "pics/meteor_explo.png"
+ frameCount: 22
+ frameDuration: 40
+ to: {"null":1}
+ }, Sprite {
+ name: "null"
+ source: "pics/nullRock.png"
+ frameCount: 1
+ frameDuration: 1000
+ }
+ ]
+ }
+ TrailEmitter {
+ system: sys
+ group: "cannonWake"
+ follow: "cannon"
+ emitRatePerParticle: 64
+ lifeSpan: 600
+ speed: AngleDirection { angleVariation: 360; magnitude: 48}
+ size: 16
+ endSize: 8
+ sizeVariation: 2
+ enabled: true
+ width: 1000//XXX: Terrible hack
+ height: 1000
+ }
+ TrailEmitter {
+ system: sys
+ group: "cannonCore"
+ follow: "cannon"
+ emitRatePerParticle: 256
+ lifeSpan: 128
+ size: 24
+ endSize: 8
+ enabled: true
+ width: 1000//XXX: Terrible hack
+ height: 1000
+ }
+}
diff --git a/examples/demos/plasmapatrol/content/SequentialLoader.qml b/examples/demos/plasmapatrol/content/SequentialLoader.qml
new file mode 100644
index 0000000000..3707759ce3
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/SequentialLoader.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+Item {
+ id: container
+ //TODO: Somehow get particles into this?
+ property list<Component> pages
+ property Item cur: null
+ property int at: 0
+ function advance() {
+ if(cur != null)
+ cur.destroy();
+ cur = pages[at++].createObject(container);
+ }
+}
diff --git a/examples/demos/plasmapatrol/content/Ship.qml b/examples/demos/plasmapatrol/content/Ship.qml
new file mode 100644
index 0000000000..bd023b1dc2
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/Ship.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: me
+ //Reflective Properties
+ width: shipLoader.width
+ height: shipLoader.height
+ //Transfered Properties
+ property int hp: 100//shipLoader.item.maxHP
+ property real dodge: shipLoader.item.initialDodge
+ property ParticleSystem system
+ property int targetIdx: 0
+ property Item target: targets[targetIdx] == undefined?null:targets[targetIdx]
+ Connections {
+ target: me.target
+ onHpChanged: if (me.target.hp<=0) me.targetIdx++;
+ }
+ property list<Item> targets
+ property string shipParticle: "default"//Per team colors?
+ property int gunType: 0
+ property int shipType: 0
+ Component {
+ id: sloopComp
+ Sloop {
+ system: me.system
+ target: me.target
+ shipParticle: me.shipParticle
+ gunType: me.gunType
+ hp: me.hp
+ dodge: me.dodge
+ }
+ }
+ Component {
+ id: frigateComp
+ Frigate {
+ system: me.system
+ target: me.target
+ shipParticle: me.shipParticle
+ gunType: me.gunType
+ hp: me.hp
+ dodge: me.dodge
+ }
+ }
+ Component {
+ id: cruiserComp
+ Cruiser {
+ system: me.system
+ target: me.target
+ shipParticle: me.shipParticle
+ gunType: me.gunType
+ hp: me.hp
+ dodge: me.dodge
+ }
+ }
+ Component {
+ id: dumbComp
+ Item {
+ property int maxHP: 0
+ property int initialDodge: 0
+ }
+ }
+ Loader {
+ id: shipLoader
+ sourceComponent: {
+ switch (shipType) {
+ case 1: sloopComp; break;
+ case 2: frigateComp; break;
+ case 3: cruiserComp; break;
+ default: dumbComp;
+ }
+ }
+ }
+}
diff --git a/examples/demos/plasmapatrol/content/Sloop.qml b/examples/demos/plasmapatrol/content/Sloop.qml
new file mode 100644
index 0000000000..3bc58a28b0
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/Sloop.qml
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: container
+ property int maxHP: 100
+ property int hp: maxHP
+ property real initialDodge: 0.5
+ property real dodge: initialDodge
+ property int blinkInterval: 800
+ onHpChanged: if(hp <= 0) target = container;
+ property ParticleSystem system//TODO: Ship abstraction
+ property Item target: container
+ property string shipParticle: "default"//Per team colors?
+ property int gunType: 0
+ width: 128
+ height: 128
+ Emitter {
+ id: emitter
+ //TODO: Cooler would be an 'orbiting' affector
+ //TODO: On the subject, opacity and size should be grouped type 'overLife' if we can cram that in the particles
+ system: container.system
+ group: container.shipParticle
+ shape: EllipseShape {}
+
+ emitRate: hp > 0 ? hp + 20 : 0
+ lifeSpan: blinkInterval
+ maximumEmitted: (maxHP + 20)
+
+ acceleration: AngleDirection {angleVariation: 360; magnitude: 8}
+
+ size: 24
+ endSize: 4
+ sizeVariation: 8
+ width: 16
+ height: 16
+ x: 64
+ y: 64
+ Behavior on x {NumberAnimation {duration:blinkInterval}}
+ Behavior on y {NumberAnimation {duration:blinkInterval}}
+ Timer {
+ interval: blinkInterval
+ running: true
+ repeat: true
+ onTriggered: {
+ emitter.x = Math.random() * 48 + 32
+ emitter.y = Math.random() * 48 + 32
+ }
+ }
+ }
+ Hardpoint {
+ anchors.centerIn: parent
+ id: gun2
+ system: container.system
+ show: container.hp > 0
+ hardpointType: gunType
+ }
+ Timer {
+ id: fireControl
+ interval: 800
+ running: root.readySetGo
+ repeat: true
+ onTriggered: {
+ gun2.fireAt(container.target);
+ }
+ }
+
+}
diff --git a/examples/demos/plasmapatrol/content/pics/TitleText.png b/examples/demos/plasmapatrol/content/pics/TitleText.png
new file mode 100644
index 0000000000..dc3acebe39
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/pics/TitleText.png
Binary files differ
diff --git a/examples/demos/plasmapatrol/content/pics/blur-circle2.png b/examples/demos/plasmapatrol/content/pics/blur-circle2.png
new file mode 100644
index 0000000000..f7c9f3e98e
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/pics/blur-circle2.png
Binary files differ
diff --git a/examples/demos/plasmapatrol/content/pics/blur-circle3.png b/examples/demos/plasmapatrol/content/pics/blur-circle3.png
new file mode 100644
index 0000000000..dbc39cb16e
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/pics/blur-circle3.png
Binary files differ
diff --git a/examples/demos/plasmapatrol/content/pics/finalfrontier.png b/examples/demos/plasmapatrol/content/pics/finalfrontier.png
new file mode 100644
index 0000000000..2ba1815230
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/pics/finalfrontier.png
Binary files differ
diff --git a/examples/demos/plasmapatrol/content/pics/meteor.png b/examples/demos/plasmapatrol/content/pics/meteor.png
new file mode 100644
index 0000000000..e8c368aea7
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/pics/meteor.png
Binary files differ
diff --git a/examples/demos/plasmapatrol/content/pics/meteor_explo.png b/examples/demos/plasmapatrol/content/pics/meteor_explo.png
new file mode 100644
index 0000000000..4297245d49
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/pics/meteor_explo.png
Binary files differ
diff --git a/examples/demos/plasmapatrol/content/pics/nullRock.png b/examples/demos/plasmapatrol/content/pics/nullRock.png
new file mode 100644
index 0000000000..4076327a1a
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/pics/nullRock.png
Binary files differ
diff --git a/examples/demos/plasmapatrol/content/pics/particle.png b/examples/demos/plasmapatrol/content/pics/particle.png
new file mode 100644
index 0000000000..5c83896d22
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/pics/particle.png
Binary files differ
diff --git a/examples/demos/plasmapatrol/content/pics/star.png b/examples/demos/plasmapatrol/content/pics/star.png
new file mode 100644
index 0000000000..0d592cfa87
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/pics/star.png
Binary files differ
diff --git a/examples/demos/plasmapatrol/content/pics/star2.png b/examples/demos/plasmapatrol/content/pics/star2.png
new file mode 100644
index 0000000000..bb55c44788
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/pics/star2.png
Binary files differ
diff --git a/examples/demos/plasmapatrol/content/pics/star3.png b/examples/demos/plasmapatrol/content/pics/star3.png
new file mode 100644
index 0000000000..636a25f480
--- /dev/null
+++ b/examples/demos/plasmapatrol/content/pics/star3.png
Binary files differ
diff --git a/examples/demos/plasmapatrol/plasmapatrol.qml b/examples/demos/plasmapatrol/plasmapatrol.qml
new file mode 100644
index 0000000000..b14ac6385b
--- /dev/null
+++ b/examples/demos/plasmapatrol/plasmapatrol.qml
@@ -0,0 +1,386 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+import "content"
+
+Rectangle {
+ id: root
+ property bool readySetGo: false
+ //Debugging
+ property int hits: 0
+ property int misses: 0
+ property real ratio: hits/(misses?misses:1)
+ //Move to JS file?
+ property Ship redVar1: Ship {shipType: 1; gunType: 1}
+ property Ship redVar2: Ship {shipType: 1; gunType: 2}
+ property Ship redVar3: Ship {shipType: 1; gunType: 3}
+ property Ship greenVar1: Ship {shipType: 3; gunType: 1}
+ property Ship greenVar2: Ship {shipType: 2; gunType: 2}
+ property Ship greenVar3: Ship {shipType: 1; gunType: 3}
+ property string winner: "0"
+ property int players: 0
+ function aiSet(ship) {
+ ship.gunType = Math.floor(Math.random() * 3) + 1
+ ship.shipType = Math.floor(Math.random() * 3) + 1
+ }
+
+ width: 360
+ height: 600
+ color: "black"
+ SequentialLoader {
+ anchors.fill: parent
+ //General Children
+ Image {
+ anchors.centerIn: parent
+ source: "../images/finalfrontier.png"
+ }
+ ParticleSystem {
+ id: particles
+ }
+ PlasmaPatrolParticles { sys: particles; z: 100 }//Renders all particles on the one plane
+ //Component parts
+ id: pageControl
+ Component.onCompleted: advance();
+ pages:[
+ Component {Item {
+ id: menu
+ width: root.width
+ height: root.height
+ Column {
+ anchors.verticalCenter: parent.verticalCenter
+ width: parent.width
+ spacing: 8
+ Item {
+ id: title
+ width: root.width
+ height: 240
+ Emitter {
+ anchors.fill: parent
+ system: particles
+ enabled: true
+ group: "default"
+ emitRate: 1200
+ lifeSpan: 1200
+ shape: MaskShape {source:"content/pics/TitleText.png"}
+ size: 16
+ endSize: 0
+ sizeVariation: 8
+ speed: AngleDirection {angleVariation:360; magnitudeVariation: 6}
+ }
+ }
+ Button {
+ text: "1P"
+ onClicked: {root.players = 1; pageControl.advance();}
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Button {
+ text: "2P"
+ onClicked: {root.players = 2; pageControl.advance();}
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Button {
+ text: "Demo"
+ anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: {root.players = 0;
+ aiSet(redVar1);
+ aiSet(redVar2);
+ aiSet(redVar3);
+ aiSet(greenVar1);
+ aiSet(greenVar2);
+ aiSet(greenVar3);
+ pageControl.at = 5;//TODO: Not a magic number
+ pageControl.advance();}
+ }
+ Button {
+ text: "Help"
+ anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: {
+ pageControl.at = 7;//TODO: Not a magic number
+ pageControl.advance();
+ }
+ }
+ Button {
+ text: "Quit"
+ anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: Qt.quit();
+ }
+ }
+ }},
+ Component {Item {
+ id: p1Screen
+ z: 101
+ width: root.width
+ height: root.height
+ Rectangle {
+ anchors.fill: parent
+ color: "red"
+ }
+ Text {
+ anchors.centerIn: parent
+ color: "white"
+ font.pixelSize: 64
+ font.bold: true
+ text: "Player\n 1"
+ horizontalAlignment: Text.AlignHCenter
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: pageControl.advance()
+ }
+ }},
+ Component {Item {
+ id: p1Choices
+ z: 3
+ width: root.width
+ height: root.height
+ Rectangle {
+ color: "black"
+ anchors.fill: parent
+ }
+ Column {
+ spacing: 16
+ width: root.width
+ anchors.horizontalCenter: parent.horizontalCenter
+ ChoiceBox {
+ target: redVar1
+ system: particles
+ }
+ ChoiceBox {
+ target: redVar2
+ system: particles
+ }
+ ChoiceBox {
+ target: redVar3
+ system: particles
+ }
+ Button {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: "Next"
+ onClicked: {
+ if (root.players < 2) {
+ aiSet(greenVar1);
+ aiSet(greenVar2);
+ aiSet(greenVar3);
+ pageControl.at = 5;//TODO: Not a magic number
+ }
+ pageControl.advance();
+ }
+ }
+ }
+ }},
+ Component {Item {
+ id: p2Screen
+ z: 101
+ width: root.width
+ height: root.height
+ Rectangle {
+ anchors.fill: parent
+ color: "green"
+ }
+ Text {
+ anchors.centerIn: parent
+ color: "white"
+ font.pixelSize: 64
+ font.bold: true
+ text: "Player\n 2"
+ horizontalAlignment: Text.AlignHCenter
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: pageControl.advance()
+ }
+ }},
+ Component {Item {
+ id: p2Choices
+ z: 1
+ width: root.width
+ height: root.height
+ Rectangle {
+ color: "black"
+ anchors.fill: parent
+ }
+ Column {
+ spacing: 16
+ width: root.width
+ anchors.horizontalCenter: parent.horizontalCenter
+ ChoiceBox {
+ target: greenVar1
+ system: particles
+ }
+ ChoiceBox {
+ target: greenVar2
+ system: particles
+ }
+ ChoiceBox {
+ target: greenVar3
+ system: particles
+ }
+ Button {
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: "Next"
+ onClicked: pageControl.advance()
+ }
+ }
+ }},
+ Component {Item {
+ id: arena
+ width: root.width
+ height: root.height
+ z: 0
+ Component.onCompleted: root.readySetGo = true
+ Component.onDestruction: root.readySetGo = false
+ property bool victory: redShip3.hp <= 0 || greenShip3.hp <=0
+ onVictoryChanged: {
+ if (redShip3.hp <= 0) {
+ if (greenShip3.hp <= 0) {
+ root.winner = "1&2"
+ }else {
+ root.winner = "2"
+ }
+ } else {
+ root.winner = "1"
+ }
+ winTimer.start()
+ }
+ Timer {
+ id: winTimer
+ interval: 1200
+ repeat: false
+ running: false
+ onTriggered: pageControl.advance();
+ }
+ Ship {
+ id: redShip1
+ shipParticle: "redTeam"
+ system: particles
+ x: 180-64
+ y: 128
+ shipType: redVar1.shipType
+ gunType: redVar1.gunType
+ targets: [greenShip1, greenShip2, greenShip3]
+ }
+ Ship {
+ id: redShip2
+ shipParticle: "redTeam"
+ system: particles
+ x: 0
+ y: 0
+ shipType: redVar2.shipType
+ gunType: redVar2.gunType
+ targets: [greenShip1, greenShip2, greenShip3]
+ }
+ Ship {
+ id: redShip3
+ shipParticle: "redTeam"
+ system: particles
+ x: 360-128
+ y: 0
+ shipType: redVar3.shipType
+ gunType: redVar3.gunType
+ targets: [greenShip1, greenShip2, greenShip3]
+ }
+
+ Ship {
+ id: greenShip1
+ shipParticle: "greenTeam"
+ system: particles
+ x: 180-64
+ y: 600 - 128 - 128
+ shipType: greenVar1.shipType
+ gunType: greenVar1.gunType
+ targets: [redShip1, redShip2, redShip3]
+ }
+ Ship {
+ id: greenShip2
+ shipParticle: "greenTeam"
+ system: particles
+ x: 0
+ y: 600-128
+ shipType: greenVar2.shipType
+ gunType: greenVar2.gunType
+ targets: [redShip1, redShip2, redShip3]
+ }
+ Ship {
+ id: greenShip3
+ shipParticle: "greenTeam"
+ system: particles
+ x: 360 - 128
+ y: 600 - 128
+ shipType: greenVar3.shipType
+ gunType: greenVar3.gunType
+ targets: [redShip1, redShip2, redShip3]
+ }
+ }},
+ Component {Item {
+ id: winScreen
+ z: 101
+ width: root.width
+ height: root.height
+ /*
+ Rectangle {
+ anchors.fill: parent
+ color: "black"
+ }
+ */
+ Text {//TODO: Particle Text?
+ anchors.fill: parent
+ color: "white"
+ font.pixelSize: 64
+ font.bold: true
+ text: "Player " + root.winner + " wins!"
+ wrapMode: Text.WordWrap
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {pageControl.at = 0; pageControl.advance();}
+ }
+ }},
+ Component {
+ HelpScreens {
+ onExitDesired: {pageControl.at = 0; pageControl.advance();}
+ }
+ }
+ ]
+ }
+}
diff --git a/examples/demos/rssnews/content/BusyIndicator.qml b/examples/demos/rssnews/content/BusyIndicator.qml
new file mode 100644
index 0000000000..f1abd1119c
--- /dev/null
+++ b/examples/demos/rssnews/content/BusyIndicator.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Image {
+ id: container
+ property bool on: false
+
+ source: "images/busy.png"; visible: container.on
+
+ NumberAnimation on rotation {
+ running: container.on; from: 0; to: 360; loops: Animation.Infinite; duration: 1200
+ }
+}
diff --git a/examples/demos/rssnews/content/CategoryDelegate.qml b/examples/demos/rssnews/content/CategoryDelegate.qml
new file mode 100644
index 0000000000..fe64238adb
--- /dev/null
+++ b/examples/demos/rssnews/content/CategoryDelegate.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: delegate
+
+ width: delegate.ListView.view.width; height: 60
+
+ Text {
+ text: name
+ color: delegate.ListView.isCurrentItem ? "white" : "black"
+ font { family: "Helvetica"; pixelSize: 16; bold: true }
+ anchors {
+ left: parent.left; leftMargin: 15
+ verticalCenter: parent.verticalCenter
+ }
+ }
+
+ BusyIndicator {
+ scale: 0.6
+ on: delegate.ListView.isCurrentItem && window.loading
+ anchors { right: parent.right; rightMargin: 10; verticalCenter: parent.verticalCenter }
+ }
+
+ Rectangle {
+ width: delegate.width; height: 1; color: "#cccccc"
+ anchors.bottom: delegate.bottom
+ visible: delegate.ListView.isCurrentItem ? false : true
+ }
+ Rectangle {
+ width: delegate.width; height: 1; color: "white"
+ visible: delegate.ListView.isCurrentItem ? false : true
+ }
+
+ MouseArea {
+ anchors.fill: delegate
+ onClicked: {
+ delegate.ListView.view.currentIndex = index
+ window.currentFeed = feed
+ }
+ }
+}
diff --git a/examples/demos/rssnews/content/NewsDelegate.qml b/examples/demos/rssnews/content/NewsDelegate.qml
new file mode 100644
index 0000000000..59ab269d3b
--- /dev/null
+++ b/examples/demos/rssnews/content/NewsDelegate.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: delegate
+ height: column.height + 40
+ width: delegate.ListView.view.width
+
+ Column {
+ id: column
+ x: 20; y: 20
+ width: parent.width - 40
+
+ Text {
+ id: titleText
+ text: title; width: parent.width; wrapMode: Text.WordWrap
+ font { bold: true; family: "Helvetica"; pointSize: 16 }
+ }
+
+ Text {
+ id: descriptionText
+ width: parent.width; text: description
+ wrapMode: Text.WordWrap; font.family: "Helvetica"
+ }
+ }
+
+ Rectangle {
+ width: parent.width; height: 1; color: "#cccccc"
+ anchors.bottom: parent.bottom
+ }
+}
diff --git a/examples/demos/rssnews/content/RssFeeds.qml b/examples/demos/rssnews/content/RssFeeds.qml
new file mode 100644
index 0000000000..ed58ef3852
--- /dev/null
+++ b/examples/demos/rssnews/content/RssFeeds.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+ListModel {
+ id: rssFeeds
+
+ ListElement { name: "Top Stories"; feed: "rss.news.yahoo.com/rss/topstories" }
+ ListElement { name: "World"; feed: "rss.news.yahoo.com/rss/world" }
+ ListElement { name: "Europe"; feed: "rss.news.yahoo.com/rss/europe" }
+ ListElement { name: "Oceania"; feed: "rss.news.yahoo.com/rss/oceania" }
+ ListElement { name: "U.S. National"; feed: "rss.news.yahoo.com/rss/us" }
+ ListElement { name: "Politics"; feed: "rss.news.yahoo.com/rss/politics" }
+ ListElement { name: "Business"; feed: "rss.news.yahoo.com/rss/business" }
+ ListElement { name: "Technology"; feed: "rss.news.yahoo.com/rss/tech" }
+ ListElement { name: "Entertainment"; feed: "rss.news.yahoo.com/rss/entertainment" }
+ ListElement { name: "Health"; feed: "rss.news.yahoo.com/rss/health" }
+ ListElement { name: "Science"; feed: "rss.news.yahoo.com/rss/science" }
+ ListElement { name: "Sports"; feed: "rss.news.yahoo.com/rss/sports" }
+}
diff --git a/examples/demos/rssnews/content/ScrollBar.qml b/examples/demos/rssnews/content/ScrollBar.qml
new file mode 100644
index 0000000000..7b1a2ac3e5
--- /dev/null
+++ b/examples/demos/rssnews/content/ScrollBar.qml
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: container
+
+ property variant scrollArea
+ property variant orientation: Qt.Vertical
+
+ opacity: 0
+
+ function position()
+ {
+ var ny = 0;
+ if (container.orientation == Qt.Vertical)
+ ny = scrollArea.visibleArea.yPosition * container.height;
+ else
+ ny = scrollArea.visibleArea.xPosition * container.width;
+ if (ny > 2) return ny; else return 2;
+ }
+
+ function size()
+ {
+ var nh, ny;
+
+ if (container.orientation == Qt.Vertical)
+ nh = scrollArea.visibleArea.heightRatio * container.height;
+ else
+ nh = scrollArea.visibleArea.widthRatio * container.width;
+
+ if (container.orientation == Qt.Vertical)
+ ny = scrollArea.visibleArea.yPosition * container.height;
+ else
+ ny = scrollArea.visibleArea.xPosition * container.width;
+
+ if (ny > 3) {
+ var t;
+ if (container.orientation == Qt.Vertical)
+ t = Math.ceil(container.height - 3 - ny);
+ else
+ t = Math.ceil(container.width - 3 - ny);
+ if (nh > t) return t; else return nh;
+ } else return nh + ny;
+ }
+
+ Rectangle { anchors.fill: parent; color: "Black"; opacity: 0.3 }
+
+ BorderImage {
+ source: "images/scrollbar.png"
+ border { left: 1; right: 1; top: 1; bottom: 1 }
+ x: container.orientation == Qt.Vertical ? 2 : position()
+ width: container.orientation == Qt.Vertical ? container.width - 4 : size()
+ y: container.orientation == Qt.Vertical ? position() : 2
+ height: container.orientation == Qt.Vertical ? size() : container.height - 4
+ }
+
+ states: State {
+ name: "visible"
+ when: container.orientation == Qt.Vertical ? scrollArea.movingVertically : scrollArea.movingHorizontally
+ PropertyChanges { target: container; opacity: 1.0 }
+ }
+
+ transitions: Transition {
+ from: "visible"; to: ""
+ NumberAnimation { properties: "opacity"; duration: 600 }
+ }
+}
diff --git a/examples/demos/rssnews/content/images/busy.png b/examples/demos/rssnews/content/images/busy.png
new file mode 100644
index 0000000000..664c2b1491
--- /dev/null
+++ b/examples/demos/rssnews/content/images/busy.png
Binary files differ
diff --git a/examples/demos/rssnews/content/images/scrollbar.png b/examples/demos/rssnews/content/images/scrollbar.png
new file mode 100644
index 0000000000..0228dcf9eb
--- /dev/null
+++ b/examples/demos/rssnews/content/images/scrollbar.png
Binary files differ
diff --git a/examples/demos/rssnews/rssnews.qml b/examples/demos/rssnews/rssnews.qml
new file mode 100644
index 0000000000..d26b94b6d3
--- /dev/null
+++ b/examples/demos/rssnews/rssnews.qml
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+import "content"
+
+Rectangle {
+ id: window
+ width: 800; height: 480
+
+ property string currentFeed: "rss.news.yahoo.com/rss/topstories"
+ property bool loading: feedModel.status == XmlListModel.Loading
+
+ RssFeeds { id: rssFeeds }
+
+ XmlListModel {
+ id: feedModel
+ source: "http://" + window.currentFeed
+ query: "/rss/channel/item"
+
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "link"; query: "link/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+ }
+
+ Row {
+ Rectangle {
+ width: 220; height: window.height
+ color: "#efefef"
+
+ ListView {
+ focus: true
+ id: categories
+ anchors.fill: parent
+ model: rssFeeds
+ footer: quitButtonDelegate
+ delegate: CategoryDelegate {}
+ highlight: Rectangle { color: "steelblue" }
+ highlightMoveSpeed: 9999999
+ }
+ ScrollBar {
+ scrollArea: categories; height: categories.height; width: 8
+ anchors.right: categories.right
+ }
+ }
+ ListView {
+ id: list
+ width: window.width - 220; height: window.height
+ model: feedModel
+ delegate: NewsDelegate {}
+ }
+ }
+ Component {
+ id: quitButtonDelegate
+ Item {
+ width: categories.width; height: 60
+ Text {
+ text: "Quit"
+ font { family: "Helvetica"; pixelSize: 16; bold: true }
+ anchors {
+ left: parent.left; leftMargin: 15
+ verticalCenter: parent.verticalCenter
+ }
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.quit()
+ }
+ }
+ }
+ ScrollBar { scrollArea: list; height: list.height; width: 8; anchors.right: window.right }
+ Rectangle { x: 220; height: window.height; width: 1; color: "#cccccc" }
+}
diff --git a/examples/demos/rssnews/rssnews.qmlproject b/examples/demos/rssnews/rssnews.qmlproject
new file mode 100644
index 0000000000..5becbdaed0
--- /dev/null
+++ b/examples/demos/rssnews/rssnews.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "rssnews.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/demos/samegame/content/BoomBlock.qml b/examples/demos/samegame/content/BoomBlock.qml
new file mode 100644
index 0000000000..a348368ae1
--- /dev/null
+++ b/examples/demos/samegame/content/BoomBlock.qml
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: block
+ property bool dying: false
+ property bool spawned: false
+ property int type: 0
+ property ParticleSystem particleSystem
+
+ Behavior on x {
+ enabled: spawned;
+ SpringAnimation{ spring: 2; damping: 0.2 }
+ }
+ Behavior on y {
+ SpringAnimation{ spring: 2; damping: 0.2 }
+ }
+
+ Image {
+ id: img
+ source: {
+ if(type == 0){
+ "pics/redStone.png";
+ } else if(type == 1) {
+ "pics/blueStone.png";
+ } else {
+ "pics/greenStone.png";
+ }
+ }
+ opacity: 0
+ Behavior on opacity { NumberAnimation { duration: 200 } }
+ anchors.fill: parent
+ }
+ Emitter {
+ id: particles
+ system: particleSystem
+ group: {
+ if(type == 0){
+ "red";
+ } else if (type == 1) {
+ "blue";
+ } else {
+ "green";
+ }
+ }
+ anchors.fill: parent
+
+ speed: TargetDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -60; magnitudeVariation: 60}
+ shape: EllipseShape{fill:true}
+ enabled: false;
+ lifeSpan: 700; lifeSpanVariation: 100
+ emitRate: 1000
+ maximumEmitted: 100 //only fires 0.1s bursts (still 2x old number)
+ size: 28
+ endSize: 14
+ }
+
+ states: [
+ State {
+ name: "AliveState"; when: spawned == true && dying == false
+ PropertyChanges { target: img; opacity: 1 }
+ },
+
+ State {
+ name: "DeathState"; when: dying == true
+ StateChangeScript { script: {particleSystem.paused = false; particles.pulse(100);} }
+ PropertyChanges { target: img; opacity: 0 }
+ StateChangeScript { script: block.destroy(1000); }
+ }
+ ]
+}
diff --git a/examples/demos/samegame/content/Button.qml b/examples/demos/samegame/content/Button.qml
new file mode 100644
index 0000000000..2d1a993226
--- /dev/null
+++ b/examples/demos/samegame/content/Button.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+
+ property string text: "Button"
+
+ signal clicked
+
+ width: buttonLabel.width + 20; height: buttonLabel.height + 20
+ smooth: true
+ border { width: 1; color: Qt.darker(activePalette.button) }
+ radius: 8
+ color: activePalette.button
+
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: {
+ if (mouseArea.pressed)
+ return activePalette.dark
+ else
+ return activePalette.light
+ }
+ }
+ GradientStop { position: 1.0; color: activePalette.button }
+ }
+
+ MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() }
+
+ Text {
+ id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText; font.pixelSize: 24
+ }
+}
diff --git a/examples/demos/samegame/content/Dialog.qml b/examples/demos/samegame/content/Dialog.qml
new file mode 100644
index 0000000000..c81580e6a5
--- /dev/null
+++ b/examples/demos/samegame/content/Dialog.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: page
+ anchors.centerIn: parent
+
+ property Item text: dialogText
+ property bool open: false
+
+ signal closed
+ signal opened
+ function forceClose() {
+ if(!open)
+ return; //already closed
+ page.open = false;
+ page.closed();
+ page.opacity = 0;
+ }
+
+ function show(txt) {
+ page.open = true;
+ page.opened();
+ dialogText.text = txt;
+ page.opacity = 1;
+ }
+
+ width: dialogText.width + 20; height: dialogText.height + 20
+ color: "white"
+ border.width: 1
+ opacity: 0
+ visible: opacity > 0
+ Behavior on opacity {
+ NumberAnimation { duration: 1000 }
+ }
+
+ Text { id: dialogText; anchors.centerIn: parent; text: "Hello World!" }
+
+ MouseArea { anchors.fill: parent; onClicked: forceClose(); }
+}
+
diff --git a/examples/demos/samegame/content/GameArea.qml b/examples/demos/samegame/content/GameArea.qml
new file mode 100644
index 0000000000..3422582b21
--- /dev/null
+++ b/examples/demos/samegame/content/GameArea.qml
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+import "samegame.js" as Logic
+
+Item {
+ id: gameCanvas
+ property int score: 0
+ property int blockSize: 40
+ property ParticleSystem ps: particleSystem
+ Image {
+ id: background
+ anchors.fill: parent
+ z: -1
+ source: "pics/background.png"
+ fillMode: Image.PreserveAspectCrop
+ }
+
+ width: 480
+ height: 800
+ MouseArea {
+ anchors.fill: parent; onClicked: Logic.handleClick(mouse.x,mouse.y);
+ }
+ ParticleSystem{
+ id: particleSystem;
+ onEmptyChanged: if (empty) paused = true;
+ z:2
+ ImageParticle {
+ groups: ["red"]
+ color: Qt.darker("red");//Actually want desaturated...
+ source: "pics/particle.png"
+ colorVariation: 0.4
+ alpha: 0.1
+ }
+ ImageParticle {
+ groups: ["green"]
+ color: Qt.darker("green");//Actually want desaturated...
+ source: "pics/particle.png"
+ colorVariation: 0.4
+ alpha: 0.1
+ }
+ ImageParticle {
+ groups: ["blue"]
+ color: Qt.darker("blue");//Actually want desaturated...
+ source: "pics/particle.png"
+ colorVariation: 0.4
+ alpha: 0.1
+ }
+ anchors.fill: parent
+ }
+}
+
diff --git a/examples/demos/samegame/content/NameInputDialog.qml b/examples/demos/samegame/content/NameInputDialog.qml
new file mode 100644
index 0000000000..7c3bfa274a
--- /dev/null
+++ b/examples/demos/samegame/content/NameInputDialog.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+Dialog {
+ id: nameInputDialog
+
+ property int initialWidth: 0
+ property alias name: nameInputText.text
+
+ anchors.centerIn: parent
+ z: 22;
+
+ Behavior on width {
+ NumberAnimation {}
+ enabled: nameInputDialog.initialWidth != 0
+ }
+
+ signal accepted(string name)
+ onClosed: {
+ if (nameInputText.text != "")
+ accepted(name);
+ }
+ Text {
+ id: dialogText
+ anchors { left: nameInputDialog.left; leftMargin: 20; verticalCenter: parent.verticalCenter }
+ text: "You won! Please enter your name: "
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (nameInputText.text == "")
+ nameInputText.openSoftwareInputPanel();
+ else
+ nameInputDialog.forceClose();
+ }
+ }
+
+ TextInput {
+ id: nameInputText
+ anchors { verticalCenter: parent.verticalCenter; left: dialogText.right }
+ focus: visible
+ autoScroll: false
+ maximumLength: 24
+ onTextChanged: {
+ var newWidth = nameInputText.width + dialogText.width + 40;
+ if ( (newWidth > nameInputDialog.width && newWidth < screen.width)
+ || (nameInputDialog.width > nameInputDialog.initialWidth) )
+ nameInputDialog.width = newWidth;
+ }
+ onAccepted: {
+ nameInputDialog.forceClose();
+ }
+ }
+}
diff --git a/examples/demos/samegame/content/pics/background.png b/examples/demos/samegame/content/pics/background.png
new file mode 100644
index 0000000000..3734a27744
--- /dev/null
+++ b/examples/demos/samegame/content/pics/background.png
Binary files differ
diff --git a/examples/demos/samegame/content/pics/blueStone.png b/examples/demos/samegame/content/pics/blueStone.png
new file mode 100644
index 0000000000..20e43c75b6
--- /dev/null
+++ b/examples/demos/samegame/content/pics/blueStone.png
Binary files differ
diff --git a/examples/demos/samegame/content/pics/greenStone.png b/examples/demos/samegame/content/pics/greenStone.png
new file mode 100644
index 0000000000..b568a1900c
--- /dev/null
+++ b/examples/demos/samegame/content/pics/greenStone.png
Binary files differ
diff --git a/examples/demos/samegame/content/pics/particle.png b/examples/demos/samegame/content/pics/particle.png
new file mode 100644
index 0000000000..5c83896d22
--- /dev/null
+++ b/examples/demos/samegame/content/pics/particle.png
Binary files differ
diff --git a/examples/demos/samegame/content/pics/redStone.png b/examples/demos/samegame/content/pics/redStone.png
new file mode 100644
index 0000000000..36b09a2686
--- /dev/null
+++ b/examples/demos/samegame/content/pics/redStone.png
Binary files differ
diff --git a/examples/demos/samegame/content/pics/yellowStone.png b/examples/demos/samegame/content/pics/yellowStone.png
new file mode 100644
index 0000000000..b1ce76212c
--- /dev/null
+++ b/examples/demos/samegame/content/pics/yellowStone.png
Binary files differ
diff --git a/examples/demos/samegame/content/samegame.js b/examples/demos/samegame/content/samegame.js
new file mode 100755
index 0000000000..611767584b
--- /dev/null
+++ b/examples/demos/samegame/content/samegame.js
@@ -0,0 +1,290 @@
+/* This script file handles the game logic */
+.pragma library
+.import QtQuick.LocalStorage 2.0 as Sql
+
+var maxColumn = 10;
+var maxRow = 15;
+var maxIndex = maxColumn*maxRow;
+var board = new Array(maxIndex);
+var blockSrc = "BoomBlock.qml";
+var scoresURL = "";
+var gameDuration;
+var component = Qt.createComponent(blockSrc);
+var highScoreBar = -1;
+var gameCanvas;
+var nameInputDialog = null;
+var dialog = null;
+
+// Index function used instead of a 2D array
+function index(column, row)
+{
+ return column + row * maxColumn;
+}
+
+function timeStr(msecs)
+{
+ var secs = Math.floor(msecs/1000);
+ var m = Math.floor(secs/60);
+ var ret = "" + m + "m " + (secs%60) + "s";
+ return ret;
+}
+
+function startNewGame(gc)
+{
+ gameCanvas = gc;
+ // Delete blocks from previous game
+ for (var i = 0; i < maxIndex; i++) {
+ if (board[i] != null)
+ board[i].destroy();
+ }
+
+ // Calculate board size
+ maxColumn = Math.floor(gameCanvas.width/gameCanvas.blockSize);
+ maxRow = Math.floor(gameCanvas.height/gameCanvas.blockSize);
+ maxIndex = maxRow * maxColumn;
+
+ // Close dialogs
+ if(nameInputDialog != null)
+ nameInputDialog.forceClose();
+ if(dialog != null)
+ dialog.forceClose();
+
+ // Initialize Board
+ board = new Array(maxIndex);
+ gameCanvas.score = 0;
+ for (var column = 0; column < maxColumn; column++) {
+ for (var row = 0; row < maxRow; row++) {
+ board[index(column, row)] = null;
+ createBlock(column, row);
+ }
+ }
+ gameDuration = new Date();
+}
+
+var fillFound; // Set after a floodFill call to the number of blocks found
+var floodBoard; // Set to 1 if the floodFill reaches off that node
+
+// NOTE: Be careful with vars named x,y, as the calling object's x,y are still in scope
+function handleClick(x,y)
+{
+ if(gameCanvas == undefined){
+ console.log("But the game hasn't started yet!");
+ return;
+ }
+ var column = Math.floor(x/gameCanvas.blockSize);
+ var row = Math.floor(y/gameCanvas.blockSize);
+ if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
+ return;
+ if (board[index(column, row)] == null)
+ return;
+ // If it's a valid block, remove it and all connected (does nothing if it's not connected)
+ floodFill(column,row, -1);
+ if (fillFound <= 0)
+ return;
+ gameCanvas.score += (fillFound - 1) * (fillFound - 1);
+ shuffleDown();
+ victoryCheck();
+}
+
+function floodFill(column,row,type)
+{
+ if (board[index(column, row)] == null)
+ return;
+ var first = false;
+ if (type == -1) {
+ first = true;
+ type = board[index(column,row)].type;
+
+ // Flood fill initialization
+ fillFound = 0;
+ floodBoard = new Array(maxIndex);
+ }
+ if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
+ return;
+ if (floodBoard[index(column, row)] == 1 || (!first && type != board[index(column, row)].type))
+ return;
+ floodBoard[index(column, row)] = 1;
+ floodFill(column + 1, row, type);
+ floodFill(column - 1, row, type);
+ floodFill(column, row + 1, type);
+ floodFill(column, row - 1, type);
+ if (first == true && fillFound == 0)
+ return; // Can't remove single blocks
+ board[index(column, row)].dying = true;
+ board[index(column, row)] = null;
+ fillFound += 1;
+}
+
+function shuffleDown()
+{
+ // Fall down
+ for (var column = 0; column < maxColumn; column++) {
+ var fallDist = 0;
+ for (var row = maxRow - 1; row >= 0; row--) {
+ if (board[index(column,row)] == null) {
+ fallDist += 1;
+ } else {
+ if (fallDist > 0) {
+ var obj = board[index(column, row)];
+ obj.y = (row + fallDist) * gameCanvas.blockSize;
+ board[index(column, row + fallDist)] = obj;
+ board[index(column, row)] = null;
+ }
+ }
+ }
+ }
+ // Fall to the left
+ fallDist = 0;
+ for (column = 0; column < maxColumn; column++) {
+ if (board[index(column, maxRow - 1)] == null) {
+ fallDist += 1;
+ } else {
+ if (fallDist > 0) {
+ for (row = 0; row < maxRow; row++) {
+ obj = board[index(column, row)];
+ if (obj == null)
+ continue;
+ obj.x = (column - fallDist) * gameCanvas.blockSize;
+ board[index(column - fallDist,row)] = obj;
+ board[index(column, row)] = null;
+ }
+ }
+ }
+ }
+}
+
+function victoryCheck()
+{
+ // Awards bonuses for no blocks left
+ var deservesBonus = true;
+ for (var column = maxColumn - 1; column >= 0; column--)
+ if (board[index(column, maxRow - 1)] != null)
+ deservesBonus = false;
+ if (deservesBonus)
+ gameCanvas.score += 500;
+ // Checks for game over
+ if (deservesBonus || !(floodMoveCheck(0, maxRow - 1, -1))) {
+ gameDuration = new Date() - gameDuration;
+ if(nameInputDialog == null){
+ nameInputDialog = Qt.createQmlObject('import "."; import "samegame.js" as Logic; NameInputDialog{onAccepted: Logic.saveHighScore(name)}', gameCanvas, "highscoredialog.qml");
+ }
+ if(dialog == null){
+ dialog = Qt.createComponent("Dialog.qml").createObject(gameCanvas);
+ }
+ initHighScoreBar();
+ if(gameCanvas.score > highScoreBar){
+ nameInputDialog.show("You won! Please enter your name: ");
+ nameInputDialog.initialWidth = nameInputDialog.text.width + 20;
+ if (nameInputDialog.name == "")
+ nameInputDialog.width = nameInputDialog.initialWidth;
+ nameInputDialog.text.opacity = 0; // Just a spacer
+ }else{
+ dialog.show("You won!");
+ }
+ }
+}
+
+// Only floods up and right, to see if it can find adjacent same-typed blocks
+function floodMoveCheck(column, row, type)
+{
+ if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
+ return false;
+ if (board[index(column, row)] == null)
+ return false;
+ var myType = board[index(column, row)].type;
+ if (type == myType)
+ return true;
+ return floodMoveCheck(column + 1, row, myType) ||
+ floodMoveCheck(column, row - 1, board[index(column, row)].type);
+}
+
+function createBlock(column,row)
+{
+ // Note that we don't wait for the component to become ready. This will
+ // only work if the block QML is a local file. Otherwise the component will
+ // not be ready immediately. There is a statusChanged signal on the
+ // component you could use if you want to wait to load remote files.
+ if(component.status == 1){
+ var dynamicObject = component.createObject(gameCanvas,
+ {"type": Math.floor(Math.random() * 3),
+ "x": column*gameCanvas.blockSize,
+ "width": gameCanvas.blockSize,
+ "height": gameCanvas.blockSize,
+ "particleSystem": gameCanvas.ps});
+ if(dynamicObject == null){
+ console.log("error creating block");
+ console.log(component.errorString());
+ return false;
+ }
+ dynamicObject.y = row*gameCanvas.blockSize;
+ dynamicObject.spawned = true;
+
+ board[index(column,row)] = dynamicObject;
+ }else{
+ console.log("error loading block component");
+ console.log(component.errorString());
+ return false;
+ }
+ return true;
+}
+
+function initHighScoreBar()
+{
+ var db = Sql.openDatabaseSync(
+ "SameGameScores",
+ "1.0",
+ "Local SameGame High Scores",
+ 100
+ );
+ db.transaction(
+ function(tx) {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)');
+ // Only show results for the current grid size
+ var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "'
+ + maxColumn + "x" + maxRow + '" ORDER BY score desc LIMIT 10');
+ if(rs.rows.length < 10)
+ highScoreBar = 0;
+ else
+ highScoreBar = rs.rows.item(rs.rows.length - 1).score;
+ }
+ );
+}
+
+function saveHighScore(name)
+{
+ if (scoresURL != "")
+ sendHighScore(name);
+ // Offline storage
+ var db = Sql.openDatabaseSync(
+ "SameGameScores",
+ "1.0",
+ "Local SameGame High Scores",
+ 100
+ );
+ var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)";
+ var data = [
+ name,
+ gameCanvas.score,
+ maxColumn + "x" + maxRow,
+ Math.floor(gameDuration / 1000)
+ ];
+ db.transaction(
+ function(tx) {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)');
+ tx.executeSql(dataStr, data);
+
+ // Only show results for the current grid size
+ var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "'
+ + maxColumn + "x" + maxRow + '" ORDER BY score desc LIMIT 10');
+ var r = "\nHIGH SCORES for this grid size\n\n"
+ for (var i = 0; i < rs.rows.length; i++) {
+ r += (i+1) + ". " + rs.rows.item(i).name + ' got '
+ + rs.rows.item(i).score + ' points in '
+ + rs.rows.item(i).time + ' seconds.\n';
+ }
+ if(rs.rows.length == 10)
+ highScoreBar = rs.rows.item(9).score;
+ dialog.show(r);
+ }
+ );
+}
diff --git a/examples/demos/samegame/samegame.qml b/examples/demos/samegame/samegame.qml
new file mode 100644
index 0000000000..b98b6a0074
--- /dev/null
+++ b/examples/demos/samegame/samegame.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+import "content"
+import "content/samegame.js" as Logic
+
+Rectangle {
+ id: screen
+ width: 480; height: 640
+
+ SystemPalette { id: activePalette }
+
+ GameArea {
+ id: gameCanvas
+ width: parent.width
+ anchors { top: parent.top; bottom: toolBar.top }
+ }
+
+ Rectangle {
+ id: toolBar
+ width: parent.width; height: 80
+ color: activePalette.window
+ anchors.bottom: screen.bottom
+
+ Button {
+ id: newGameButton
+ anchors { left: parent.left; leftMargin: 12; verticalCenter: parent.verticalCenter }
+ text: "New Game"
+ onClicked: Logic.startNewGame(gameCanvas)
+ }
+
+ Button {
+ text: "Quit"
+ anchors { left: newGameButton.right; leftMargin: 12; verticalCenter: parent.verticalCenter }
+ onClicked: Qt.quit();
+ }
+
+ Text {
+ id: score
+ anchors { right: parent.right; rightMargin: 12; verticalCenter: parent.verticalCenter }
+ text: "Score: " + gameCanvas.score
+ font.bold: true
+ font.pixelSize: 24
+ color: activePalette.windowText
+ }
+ }
+}
diff --git a/examples/demos/samegame/samegame.qmlproject b/examples/demos/samegame/samegame.qmlproject
new file mode 100644
index 0000000000..42ffacf4f8
--- /dev/null
+++ b/examples/demos/samegame/samegame.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "samegame.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/demos/snake/content/Button.qml b/examples/demos/snake/content/Button.qml
new file mode 100644
index 0000000000..4f294556b3
--- /dev/null
+++ b/examples/demos/snake/content/Button.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+
+ signal clicked
+ property string text: "Button"
+
+ color: activePalette.button; smooth: true
+ width: txtItem.width + 20; height: txtItem.height + 6
+ border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8;
+
+ gradient: Gradient {
+ GradientStop {
+ id: topGrad; position: 0.0
+ color: if (mr.pressed) { activePalette.dark } else { activePalette.light } }
+ GradientStop { position: 1.0; color: activePalette.button }
+ }
+
+ MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() }
+
+ Text {
+ id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText
+ }
+}
diff --git a/examples/demos/snake/content/Cookie.qml b/examples/demos/snake/content/Cookie.qml
new file mode 100644
index 0000000000..35ffe400b8
--- /dev/null
+++ b/examples/demos/snake/content/Cookie.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: root
+ property bool dying: false
+ property int row;
+ property int column;
+ x: margin + column * gridSize
+ y: margin + row * gridSize
+
+ width: gridSize
+ height: gridSize
+ property int value : 1;
+
+ Image {
+ id: img
+ anchors.fill: parent
+ source: "pics/cookie.png"
+ opacity: 0
+ Text {
+ font.bold: true
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: value
+ }
+ }
+
+
+ ParticleSystem {
+ width:1; height:1; anchors.centerIn: parent;
+ ImageParticle {
+ groups: ["star"]
+ source: "pics/yellowStar.png"
+ }
+ Emitter {
+ id: particles
+ anchors.fill: parent
+ group: "star"
+ emitRate: 50
+ enabled: false
+ lifeSpan: 700
+ acceleration: AngleDirection { angleVariation: 360; magnitude: 200 }
+ }
+ }
+
+ states: [
+ State{ name: "AliveState"; when: dying == false
+ PropertyChanges { target: img; opacity: 1 }
+ },
+ State{ name: "DeathState"; when: dying == true
+ StateChangeScript { script: particles.burst(50); }
+ PropertyChanges { target: img; opacity: 0 }
+ }
+ ]
+ transitions: [
+ Transition {
+ NumberAnimation { target: img; property: "opacity"; duration: 100 }
+ }
+ ]
+}
diff --git a/examples/demos/snake/content/HighScoreModel.qml b/examples/demos/snake/content/HighScoreModel.qml
new file mode 100644
index 0000000000..734a661f5b
--- /dev/null
+++ b/examples/demos/snake/content/HighScoreModel.qml
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.LocalStorage 2.0 as Sql
+
+// Models a high score table.
+//
+// Use this component like this:
+//
+// HighScoreModel {
+// id: highScores
+// game: "MyCoolGame"
+// }
+//
+// Then use either use the top-score properties:
+//
+// Text { text: "HI: " + highScores.topScore }
+//
+// or, use the model in a view:
+//
+// ListView {
+// model: highScore
+// delegate: Component {
+// ... player ... score ...
+// }
+// }
+//
+// Add new scores via:
+//
+// saveScore(newScore)
+//
+// or:
+//
+// savePlayerScore(playerName,newScore)
+//
+// The best maxScore scores added by this method will be retained in an SQL database,
+// and presented in the model and in the topScore/topPlayer properties.
+//
+
+ListModel {
+ id: model
+ property string game: ""
+ property int topScore: 0
+ property string topPlayer: ""
+ property int maxScores: 10
+
+ function __db()
+ {
+ return Sql.openDatabaseSync("HighScoreModel", "1.0", "Generic High Score Functionality for QML", 1000000);
+ }
+ function __ensureTables(tx)
+ {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS HighScores(game TEXT, score INT, player TEXT)', []);
+ }
+
+ function fillModel() {
+ __db().transaction(
+ function(tx) {
+ __ensureTables(tx);
+ var rs = tx.executeSql("SELECT score,player FROM HighScores WHERE game=? ORDER BY score DESC", [game]);
+ model.clear();
+ if (rs.rows.length > 0) {
+ topScore = rs.rows.item(0).score
+ topPlayer = rs.rows.item(0).player
+ for (var i=0; i<rs.rows.length; ++i) {
+ if (i < maxScores)
+ model.append(rs.rows.item(i))
+ }
+ if (rs.rows.length > maxScores)
+ tx.executeSql("DELETE FROM HighScores WHERE game=? AND score <= ?",
+ [game, rs.rows.item(maxScores).score]);
+ }
+ }
+ )
+ }
+
+ function savePlayerScore(player,score) {
+ __db().transaction(
+ function(tx) {
+ __ensureTables(tx);
+ tx.executeSql("INSERT INTO HighScores VALUES(?,?,?)", [game,score,player]);
+ fillModel();
+ }
+ )
+ }
+
+ function saveScore(score) {
+ savePlayerScore("player",score);
+ }
+
+ function clearScores() {
+ __db().transaction(
+ function(tx) {
+ tx.executeSql("DELETE FROM HighScores WHERE game=?", [game]);
+ fillModel();
+ }
+ )
+ }
+
+ Component.onCompleted: { fillModel() }
+}
diff --git a/examples/demos/snake/content/Link.qml b/examples/demos/snake/content/Link.qml
new file mode 100644
index 0000000000..aab005afd5
--- /dev/null
+++ b/examples/demos/snake/content/Link.qml
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item { id:link
+ property bool dying: false
+ property bool spawned: false
+ property int type: 0
+ property int row: 0
+ property int column: 0
+ property int rotation;
+
+ width: 40;
+ height: 40
+
+ x: margin - 3 + gridSize * column
+ y: margin - 3 + gridSize * row
+ Behavior on x { NumberAnimation { duration: spawned ? heartbeatInterval : 0} }
+ Behavior on y { NumberAnimation { duration: spawned ? heartbeatInterval : 0 } }
+
+
+ Item {
+ id: img
+ anchors.fill: parent
+ Image {
+ source: {
+ if(type == 1) {
+ "pics/blueStone.png";
+ } else if (type == 2) {
+ "pics/head.png";
+ } else {
+ "pics/redStone.png";
+ }
+ }
+
+ transform: Rotation {
+ id: actualImageRotation
+ origin.x: width/2; origin.y: height/2;
+ angle: rotation * 90
+ Behavior on angle {
+ RotationAnimation{
+ direction: RotationAnimation.Shortest
+ duration: spawned ? 200 : 0
+ }
+ }
+ }
+ }
+
+ Image {
+ source: "pics/stoneShadow.png"
+ }
+
+ opacity: 0
+ }
+
+ ParticleSystem {
+ width:1; height:1; anchors.centerIn: parent;
+ ImageParticle {
+ groups: ["star"]
+ source: type == 1 ? "pics/blueStar.png" : "pics/redStar.png"
+ }
+ Emitter {
+ id: particles
+ anchors.fill: parent
+ group: "star"
+ emitRate: 50
+ enabled: false
+ lifeSpan: 700
+ acceleration: AngleDirection { angleVariation: 360; magnitude: 200 }
+ }
+ }
+
+ states: [
+ State{ name: "AliveState"; when: spawned == true && dying == false
+ PropertyChanges { target: img; opacity: 1 }
+ },
+ State{ name: "DeathState"; when: dying == true
+ StateChangeScript { script: particles.burst(50); }
+ PropertyChanges { target: img; opacity: 0 }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ NumberAnimation { target: img; property: "opacity"; duration: 200 }
+ }
+ ]
+
+}
diff --git a/examples/demos/snake/content/Skull.qml b/examples/demos/snake/content/Skull.qml
new file mode 100644
index 0000000000..0c173be7da
--- /dev/null
+++ b/examples/demos/snake/content/Skull.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Image {
+ property bool spawned: false
+ property int row;
+ property int column;
+ property int verticalMovement;
+ property int horizontalMovement;
+
+ x: screen.margin + column * screen.gridSize + 2
+ y: screen.margin + row * screen.gridSize - 3
+ Behavior on x { NumberAnimation { duration: spawned ? screen.halfbeatInterval : 0} }
+ Behavior on y { NumberAnimation { duration: spawned ? screen.halfbeatInterval : 0 } }
+
+ opacity: spawned ? 1 : 0
+ Behavior on opacity { NumberAnimation { duration: 200 } }
+
+ source: "pics/skull.png"
+ width: 24
+ height: 40
+}
diff --git a/examples/demos/snake/content/pics/README b/examples/demos/snake/content/pics/README
new file mode 100644
index 0000000000..0215132caa
--- /dev/null
+++ b/examples/demos/snake/content/pics/README
@@ -0,0 +1 @@
+snake.jpg: This image is based on the picture "Eastern Green Mamba.jpg" from the free media databse Wikimedia Commons and is published under the terms of the GNU Free Documentation License. The original picture was taken by Danleo.
diff --git a/examples/demos/snake/content/pics/background.png b/examples/demos/snake/content/pics/background.png
new file mode 100644
index 0000000000..72dffaa843
--- /dev/null
+++ b/examples/demos/snake/content/pics/background.png
Binary files differ
diff --git a/examples/demos/snake/content/pics/blueStar.png b/examples/demos/snake/content/pics/blueStar.png
new file mode 100644
index 0000000000..ba7acabd26
--- /dev/null
+++ b/examples/demos/snake/content/pics/blueStar.png
Binary files differ
diff --git a/examples/demos/snake/content/pics/blueStone.png b/examples/demos/snake/content/pics/blueStone.png
new file mode 100644
index 0000000000..356affdd95
--- /dev/null
+++ b/examples/demos/snake/content/pics/blueStone.png
Binary files differ
diff --git a/examples/demos/snake/content/pics/cookie.png b/examples/demos/snake/content/pics/cookie.png
new file mode 100644
index 0000000000..aec2957f34
--- /dev/null
+++ b/examples/demos/snake/content/pics/cookie.png
Binary files differ
diff --git a/examples/demos/snake/content/pics/eyes.svg b/examples/demos/snake/content/pics/eyes.svg
new file mode 100644
index 0000000000..1078692725
--- /dev/null
+++ b/examples/demos/snake/content/pics/eyes.svg
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ width="40"
+ height="40"
+ version="1.0"
+ sodipodi:docname="eyes.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
+ inkscape:export-filename="/home/ettrich/dev/research/qml-validate/snake/pics/eyes.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs5">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective9" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:window-height="838"
+ inkscape:window-width="907"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ showgrid="false"
+ inkscape:zoom="12.35"
+ inkscape:cx="20"
+ inkscape:cy="20"
+ inkscape:window-x="117"
+ inkscape:window-y="45"
+ inkscape:current-layer="svg2" />
+ <path
+ sodipodi:type="arc"
+ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path2384"
+ sodipodi:cx="18.056681"
+ sodipodi:cy="9.5141697"
+ sodipodi:rx="7.1255059"
+ sodipodi:ry="11.295547"
+ d="M 25.182187,9.5141697 A 7.1255059,11.295547 0 1 1 10.931175,9.5141697 A 7.1255059,11.295547 0 1 1 25.182187,9.5141697 z"
+ transform="matrix(1.0089865,0,0,0.5462656,-4.9233835,3.3301401)" />
+ <path
+ sodipodi:type="arc"
+ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path3158"
+ sodipodi:cx="18.056681"
+ sodipodi:cy="9.5141697"
+ sodipodi:rx="7.1255059"
+ sodipodi:ry="11.295547"
+ d="M 25.182187,9.5141697 A 7.1255059,11.295547 0 1 1 10.931175,9.5141697 A 7.1255059,11.295547 0 1 1 25.182187,9.5141697 z"
+ transform="matrix(1.0089865,0,0,0.5462656,9.6190931,3.3522563)" />
+ <path
+ sodipodi:type="arc"
+ style="fill:#000000;fill-opacity:1"
+ id="path3182"
+ sodipodi:cx="16.275303"
+ sodipodi:cy="12.307693"
+ sodipodi:rx="2.2672064"
+ sodipodi:ry="3.4008098"
+ d="M 18.542509,12.307693 A 2.2672064,3.4008098 0 0 1 14.008446,12.367372"
+ sodipodi:start="0"
+ sodipodi:end="3.1240432"
+ transform="translate(11.65992,-9.740891)"
+ sodipodi:open="true" />
+ <rect
+ style="fill:#000000;fill-opacity:0"
+ id="rect2382"
+ width="40"
+ height="40"
+ x="0"
+ y="-7.1054274e-15"
+ inkscape:export-filename="/home/ettrich/dev/research/qml-validate/snake/pics/eyes.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90" />
+ <path
+ sodipodi:type="arc"
+ style="fill:#000000;fill-opacity:1"
+ id="path2383"
+ sodipodi:cx="16.275303"
+ sodipodi:cy="12.307693"
+ sodipodi:rx="2.2672064"
+ sodipodi:ry="3.4008098"
+ d="M 18.542509,12.307693 A 2.2672064,3.4008098 0 0 1 14.008446,12.367372"
+ sodipodi:start="0"
+ sodipodi:end="3.1240432"
+ transform="translate(-3.3200119,-9.821862)"
+ sodipodi:open="true" />
+</svg>
diff --git a/examples/demos/snake/content/pics/head.png b/examples/demos/snake/content/pics/head.png
new file mode 100644
index 0000000000..550e002687
--- /dev/null
+++ b/examples/demos/snake/content/pics/head.png
Binary files differ
diff --git a/examples/demos/snake/content/pics/pause.png b/examples/demos/snake/content/pics/pause.png
new file mode 100644
index 0000000000..056d97dd17
--- /dev/null
+++ b/examples/demos/snake/content/pics/pause.png
Binary files differ
diff --git a/examples/demos/snake/content/pics/redStar.png b/examples/demos/snake/content/pics/redStar.png
new file mode 100644
index 0000000000..cd06854719
--- /dev/null
+++ b/examples/demos/snake/content/pics/redStar.png
Binary files differ
diff --git a/examples/demos/snake/content/pics/redStone.png b/examples/demos/snake/content/pics/redStone.png
new file mode 100644
index 0000000000..9bb7fe4277
--- /dev/null
+++ b/examples/demos/snake/content/pics/redStone.png
Binary files differ
diff --git a/examples/demos/snake/content/pics/skull.png b/examples/demos/snake/content/pics/skull.png
new file mode 100644
index 0000000000..63186167bd
--- /dev/null
+++ b/examples/demos/snake/content/pics/skull.png
Binary files differ
diff --git a/examples/demos/snake/content/pics/snake.jpg b/examples/demos/snake/content/pics/snake.jpg
new file mode 100644
index 0000000000..e91a784f71
--- /dev/null
+++ b/examples/demos/snake/content/pics/snake.jpg
Binary files differ
diff --git a/examples/demos/snake/content/pics/star.png b/examples/demos/snake/content/pics/star.png
new file mode 100644
index 0000000000..defbde53ca
--- /dev/null
+++ b/examples/demos/snake/content/pics/star.png
Binary files differ
diff --git a/examples/demos/snake/content/pics/stoneShadow.png b/examples/demos/snake/content/pics/stoneShadow.png
new file mode 100644
index 0000000000..1bd56afd04
--- /dev/null
+++ b/examples/demos/snake/content/pics/stoneShadow.png
Binary files differ
diff --git a/examples/demos/snake/content/pics/yellowStar.png b/examples/demos/snake/content/pics/yellowStar.png
new file mode 100644
index 0000000000..52fb9c4b78
--- /dev/null
+++ b/examples/demos/snake/content/pics/yellowStar.png
Binary files differ
diff --git a/examples/demos/snake/content/pics/yellowStone.png b/examples/demos/snake/content/pics/yellowStone.png
new file mode 100644
index 0000000000..c56124a895
--- /dev/null
+++ b/examples/demos/snake/content/pics/yellowStone.png
Binary files differ
diff --git a/examples/demos/snake/content/snake.js b/examples/demos/snake/content/snake.js
new file mode 100644
index 0000000000..107c9f4591
--- /dev/null
+++ b/examples/demos/snake/content/snake.js
@@ -0,0 +1,316 @@
+
+var snake = new Array;
+var board = new Array;
+var links = new Array;
+var scheduledDirections = new Array;
+var numRows = 1;
+var numColumns = 1;
+var linkComponent = Qt.createComponent("Link.qml");
+var cookieComponent = Qt.createComponent("Cookie.qml");
+var cookie;
+var linksToGrow = 0;
+var linksToDie = 0;
+var waitForCookie = 0;
+var growType = 0;
+var skullMovementsBeforeDirectionChange = 0;
+
+
+function rand(n)
+{
+ return (Math.floor(Math.random() * n));
+}
+
+function scheduleDirection(dir)
+{
+ if (state == "starting") {
+ direction = dir;
+ headDirection = direction;
+ head.rotation = headDirection;
+ } else if (state == "running"){
+ direction = dir;
+ if(scheduledDirections[scheduledDirections.length-1]!=direction)
+ scheduledDirections.push(direction);
+ }
+}
+
+function startNewGame()
+{
+ if (state == "starting") {
+ return;
+ }
+
+ if (activeGame) {
+ endGame();
+ startNewGameTimer.running = true;
+ return;
+ }
+
+ state = "starting";
+
+ numRows = numRowsAvailable;
+ numColumns = numColumnsAvailable;
+ board = new Array(numRows * numColumns);
+ snake = new Array;
+ scheduledDirections = new Array;
+ growType = 0;
+
+ skull.z = numRows * numColumns + 1;
+
+ for (var i = 0; i < numRows * numColumns; ++i) {
+ if (i < links.length) {
+ var link = links[i];
+ link.spawned = false;
+ link.dying = false;
+ } else {
+ if(linkComponent.status != Component.Ready) {
+ if(linkComponent.status == Component.Error)
+ console.log(linkComponent.errorString());
+ else
+ console.log("Still loading linkComponent");
+ continue;//TODO: Better error handling?
+ }
+ var link = linkComponent.createObject(playfield);
+ link.z = numRows * numColumns + 1 - i;
+ link.type = i == 0 ? 2 : 0;
+ link.spawned = false;
+ link.dying = false;
+ links.push(link);
+ }
+ }
+
+ head = links[0];
+ snake.push(head);
+ head.row = numRows/2 -1;
+ head.column = numColumns/2 -1;
+ head.spawned = true;
+
+ linksToGrow = 5;
+ linksToDie = 0;
+ waitForCookie = 5;
+ score = 0;
+ startHeartbeatTimer.running = true;
+}
+
+function endGame()
+{
+ activeGame = false;
+ for(var i in snake)
+ snake[i].dying = true;
+ if (cookie) {
+ cookie.dying = true;
+ cookie = 0;
+ }
+ lastScore = score;
+ highScores.saveScore(lastScore);
+ state = "";
+}
+
+function move() {
+
+ if (!head)
+ return;
+
+ var dir = direction;
+
+ if (scheduledDirections.length) {
+ dir = scheduledDirections.shift();
+ }
+
+ if (state == "starting") {
+ var turn = (dir - headDirection);
+ head.rotation += turn == -3 ? 1 : (turn == 3 ? -1 : turn );
+ headDirection = dir;
+ return;
+ }
+
+ var row = head.row;
+ var column = head.column;
+
+ if (dir == 0) {
+ row = row - 1;
+ } else if (dir == 1) {
+ column = column + 1
+ } else if (dir == 2) {
+ row = row + 1;
+ } else if (dir == 3) {
+ column = column - 1;
+ }
+
+ //validate the new position
+ if (row < 0 || row >= numRows
+ || column < 0 || column >= numColumns
+ || (row == skull.row && column == skull.column)
+ || !isFree(row, column)) {
+ var turn = (dir - headDirection);
+ head.rotation += turn == -3 ? 1 : (turn == 3 ? -1 : turn );
+ headDirection = dir;
+ endGame();
+ return;
+ }
+
+ var newLink;
+ if (linksToGrow > 0) {
+ --linksToGrow;
+ newLink = links[snake.length];
+ newLink.spawned = false;
+ newLink.rotation = snake[snake.length-1].rotation;
+ newLink.type = growType;
+ newLink.dying = false;
+ snake.push(newLink);
+ } else {
+ var lastLink = snake[snake.length-1];
+ board[lastLink.row * numColumns + lastLink.column] = undefined;
+ }
+
+ if (waitForCookie > 0) {
+ if (--waitForCookie == 0)
+ createCookie(cookie? (cookie.value+1) : 1);
+ }
+
+ for (var i = snake.length-1; i > 0; --i) {
+ snake[i].row = snake[i-1].row;
+ snake[i].column = snake[i-1].column;
+ snake[i].rotation = snake[i-1].rotation;
+ }
+
+ if (newLink) {
+ newLink.spawned = true;
+ }
+
+ // move the head
+ head.row = row;
+ head.column = column;
+ board[row * numColumns + column] = head;
+
+ var turn = (dir - headDirection);
+ head.rotation += turn == -3 ? 1 : (turn == 3 ? -1 : turn );
+ headDirection = dir;
+
+ var value = testCookie(row, column);
+ if (value > 0) {
+ linksToGrow += value;
+ score += value;
+ }
+}
+
+function isFree(row, column)
+{
+ return board[row * numColumns + column] == undefined;
+}
+
+function isHead(row, column)
+{
+ return head.column == column && head.row == row;
+}
+
+function testCookie(row, column)
+{
+ if (cookie && !cookie.dying && cookie.row == row && cookie.column == column) {
+ var value = cookie.value;
+ waitForCookie = value;
+ growType = snake[snake.length-1].type == 1 ? 0 : 1;
+ cookie.dying = true;
+ cookie.z = numRows * numColumns + 2;
+ return value;
+ }
+ return 0;
+}
+
+function moveSkull()
+{
+
+ if (linksToDie > 0) {
+ --linksToDie;
+ var link = snake.pop();
+ link.dying = true;
+ board[link.row * numColumns + link.column] = undefined;
+ if (score > 0)
+ --score;
+ if (snake.length == 0) {
+ endGame();
+ return;
+ }
+ }
+
+ var row = skull.row;
+ var column = skull.column;
+ if (isHead(row, column)) {
+ endGame();
+ return;
+ }
+ row += skull.verticalMovement;
+ column += skull.horizontalMovement;
+
+ var attempts = 4;
+
+ while (skullMovementsBeforeDirectionChange == 0 || row < 0 || row >= numRows
+ || column < 0 || column >= numColumns
+ || (!isFree(row, column) && !isHead(row, column))) {
+ var d = rand(8);
+ skull.verticalMovement = 0;
+ skull.horizontalMovement = 0;
+ skullMovementsBeforeDirectionChange = rand(20)+1;
+ if (d == 0) {
+ skull.verticalMovement = -1
+ } else if (d == 1) {
+ skull.horizontalMovement = -1;
+ } else if (d == 2) {
+ skull.verticalMovement = 1
+ } else if (d == 3){
+ skull.horizontalMovement = 1;
+ } else if (cookie) {
+ var rd = cookie.row - skull.row;
+ var rc = cookie.column - skull.column;
+ if (Math.abs(rd) > Math.abs(rc)) {
+ skull.verticalMovement = rd > 0 ? 1 : -1;
+ skullMovementsBeforeDirectionChange = Math.abs(rd);
+ } else {
+ skull.horizontalMovement= rc > 0 ? 1 : -1;
+ skullMovementsBeforeDirectionChange = Math.abs(rc);
+ }
+ }
+ row = skull.row + skull.verticalMovement;
+ column = skull.column + skull.horizontalMovement;
+ if (--attempts == 0)
+ return;
+ }
+
+ skull.row = row;
+ skull.column = column;
+ --skullMovementsBeforeDirectionChange;
+ var value = testCookie(row, column);
+ if (value > 0)
+ linksToDie += value/2;
+
+ if (isHead(row, column))
+ endGame();
+}
+
+function createCookie(value) {
+ if (numRows * numColumns - snake.length < 10)
+ return;
+
+ var column = rand(numColumns);
+ var row = rand(numRows);
+ while (!isFree(row, column)) {
+ column++;
+ if (column == numColumns) {
+ column = 0;
+ row++;
+ if (row == numRows)
+ row = 0;
+ }
+ }
+
+ if(cookieComponent.status != Component.Ready) {
+ if(cookieComponent.status == Component.Error)
+ console.log(cookieComponent.errorString());
+ else
+ console.log("Still loading cookieComponent");
+ return;//TODO: Better error handling?
+ }
+ cookie = cookieComponent.createObject(head.parent);
+ cookie.value = value;
+ cookie.row = row;
+ cookie.column = column;
+}
diff --git a/examples/demos/snake/snake.qml b/examples/demos/snake/snake.qml
new file mode 100644
index 0000000000..efd5747173
--- /dev/null
+++ b/examples/demos/snake/snake.qml
@@ -0,0 +1,273 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content" as Content
+import "content/snake.js" as Logic
+Item{
+Rectangle {
+ id: screen;
+ SystemPalette { id: activePalette }
+ color: activePalette.window
+ property bool activeGame: false
+
+ property int gridSize : 34
+ property int margin: 4
+ property int numRowsAvailable: Math.floor((height-32-2*margin)/gridSize)
+ property int numColumnsAvailable: Math.floor((width-2*margin)/gridSize)
+
+ property int lastScore : 0
+
+ property int score: 0;
+ property int heartbeatInterval: 200
+ property int halfbeatInterval: 160
+
+ width: 480
+ height: 750
+
+ property int direction
+ property int headDirection
+
+ property variant head;
+
+ Content.HighScoreModel {
+ id: highScores
+ game: "Snake"
+ }
+
+ Timer {
+ id: heartbeat;
+ interval: screen.heartbeatInterval;
+ running: screen.activeGame
+ repeat: true
+ onTriggered: { Logic.move() }
+ }
+ Timer {
+ id: halfbeat;
+ interval: screen.halfbeatInterval;
+ repeat: true
+ running: heartbeat.running
+ onTriggered: { Logic.moveSkull() }
+ }
+ Timer {
+ id: startNewGameTimer;
+ interval: 700;
+ onTriggered: { Logic.startNewGame(); }
+ }
+
+ Timer {
+ id: startHeartbeatTimer;
+ interval: 1000 ;
+ onTriggered: { screen.state = "running"; screen.activeGame = true; }
+ }
+
+ Image{
+ id: pauseDialog
+ z: 1
+ source: "content/pics/pause.png"
+ anchors.centerIn: parent;
+ //opacity is deliberately not animated
+ opacity: 0 //Was !Qt.application.active && activeGame, but application doesn't work (QTBUG-23331)
+ }
+
+ Image {
+
+ Image {
+ id: title
+ source: "content/pics/snake.jpg"
+ fillMode: Image.PreserveAspectCrop
+ anchors.fill: parent
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+
+ Column {
+ spacing: 140
+ anchors.verticalCenter: parent.verticalCenter;
+ anchors.left: parent.left;
+ anchors.right: parent.right;
+
+ Text {
+ color: "white"
+ font.pointSize: 48
+ font.italic: true;
+ font.bold: true;
+ text: "Snake"
+ anchors.horizontalCenter: parent.horizontalCenter;
+ }
+
+ Text {
+ color: "white"
+ font.pointSize: 24
+ anchors.horizontalCenter: parent.horizontalCenter;
+ //horizontalAlignment: Text.AlignHCenter
+ text: "Last Score:\t" + screen.lastScore + "\nHighscore:\t" + highScores.topScore;
+ }
+ }
+ }
+
+ source: "content/pics/background.png"
+ fillMode: Image.PreserveAspectCrop
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: toolbar.top
+
+ Rectangle {
+ id: playfield
+ border.width: 1
+ border.color: "white"
+ color: "transparent"
+ anchors.horizontalCenter: parent.horizontalCenter
+ y: (screen.height - 32 - height)/2;
+ width: screen.numColumnsAvailable * screen.gridSize + 2*screen.margin
+ height: screen.numRowsAvailable * screen.gridSize + 2*screen.margin
+
+
+ Content.Skull {
+ id: skull
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onPressed: {
+ if (screen.state == "") {
+ Logic.startNewGame();
+ return;
+ }
+ if (direction == 0 || direction == 2)
+ Logic.scheduleDirection((mouseX > (head.x + head.width/2)) ? 1 : 3);
+ else
+ Logic.scheduleDirection((mouseY > (head.y + head.height/2)) ? 2 : 0);
+ }
+ }
+ }
+
+ }
+
+ Rectangle {
+ id: progressBar
+ opacity: 0
+ Behavior on opacity { NumberAnimation { duration: 200 } }
+ color: "transparent"
+ border.width: 2
+ border.color: "#221edd"
+ x: 50
+ y: 50
+ width: 200
+ height: 30
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.verticalCenterOffset: 40
+
+ Rectangle {
+ id: progressIndicator
+ color: "#221edd";
+ width: 0;
+ height: 30;
+ }
+ }
+
+ Rectangle {
+ id: toolbar
+ color: activePalette.window
+ height: 32; width: parent.width
+ anchors.bottom: screen.bottom
+
+ Content.Button {
+ id: btnA; text: "New Game"; onClicked: Logic.startNewGame();
+ anchors.left: parent.left; anchors.leftMargin: 3
+ anchors.verticalCenter: parent.verticalCenter
+ }
+
+ Content.Button {
+ text: "Quit"
+ anchors { left: btnA.right; leftMargin: 3; verticalCenter: parent.verticalCenter }
+ onClicked: Qt.quit();
+ }
+
+ Text {
+ color: activePalette.text
+ text: "Score: " + screen.score; font.bold: true
+ anchors.right: parent.right; anchors.rightMargin: 3
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+
+ focus: true
+ Keys.onSpacePressed: Logic.startNewGame();
+ Keys.onLeftPressed: if (state == "starting" || direction != 1) Logic.scheduleDirection(3);
+ Keys.onRightPressed: if (state == "starting" || direction != 3) Logic.scheduleDirection(1);
+ Keys.onUpPressed: if (state == "starting" || direction != 2) Logic.scheduleDirection(0);
+ Keys.onDownPressed: if (state == "starting" || direction != 0) Logic.scheduleDirection(2);
+
+ states: [
+ State {
+ name: "starting"
+ PropertyChanges {target: progressIndicator; width: 200}
+ PropertyChanges {target: title; opacity: 0}
+ PropertyChanges {target: progressBar; opacity: 1}
+ },
+ State {
+ name: "running"
+ PropertyChanges {target: progressIndicator; width: 200}
+ PropertyChanges {target: title; opacity: 0}
+ PropertyChanges {target: skull; row: 0; column: 0; }
+ PropertyChanges {target: skull; spawned: 1}
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "*"
+ to: "starting"
+ NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 }
+ NumberAnimation { property: "opacity"; duration: 200 }
+ },
+ Transition {
+ to: "starting"
+ NumberAnimation { target: progressIndicator; property: "width"; duration: 1000 }
+ NumberAnimation { property: "opacity"; duration: 200 }
+ }
+ ]
+
+}
+}
diff --git a/examples/demos/snake/snake.qmlproject b/examples/demos/snake/snake.qmlproject
new file mode 100644
index 0000000000..fb015465d1
--- /dev/null
+++ b/examples/demos/snake/snake.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "snake.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/demos/tic-tac-toe/content/Button.qml b/examples/demos/tic-tac-toe/content/Button.qml
new file mode 100644
index 0000000000..6dd141f838
--- /dev/null
+++ b/examples/demos/tic-tac-toe/content/Button.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+
+ property string text
+ property bool pressed: false
+
+ signal clicked
+
+ width: buttonLabel.width + 20; height: buttonLabel.height + 6
+ border { width: 1; color: Qt.darker(container.color) }
+ radius: 8
+ color: "lightgray"
+ smooth: true
+
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: container.pressed ? "darkgray" : "white"
+ }
+ GradientStop {
+ position: 1.0
+ color: container.color
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: container.clicked()
+ }
+
+ Text {
+ id: buttonLabel
+ anchors.centerIn: container
+ text: container.text
+ font.pixelSize: 14
+ }
+}
diff --git a/examples/demos/tic-tac-toe/content/TicTac.qml b/examples/demos/tic-tac-toe/content/TicTac.qml
new file mode 100644
index 0000000000..e74bc6bcda
--- /dev/null
+++ b/examples/demos/tic-tac-toe/content/TicTac.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ signal clicked
+
+ states: [
+ State { name: "X"; PropertyChanges { target: image; source: "pics/x.png" } },
+ State { name: "O"; PropertyChanges { target: image; source: "pics/o.png" } }
+ ]
+
+ Image {
+ id: image
+ anchors.centerIn: parent
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.clicked()
+ }
+}
diff --git a/examples/demos/tic-tac-toe/content/pics/board.png b/examples/demos/tic-tac-toe/content/pics/board.png
new file mode 100644
index 0000000000..7e5b7ba27c
--- /dev/null
+++ b/examples/demos/tic-tac-toe/content/pics/board.png
Binary files differ
diff --git a/examples/demos/tic-tac-toe/content/pics/o.png b/examples/demos/tic-tac-toe/content/pics/o.png
new file mode 100644
index 0000000000..abc7ee020b
--- /dev/null
+++ b/examples/demos/tic-tac-toe/content/pics/o.png
Binary files differ
diff --git a/examples/demos/tic-tac-toe/content/pics/x.png b/examples/demos/tic-tac-toe/content/pics/x.png
new file mode 100644
index 0000000000..ddc65c83b8
--- /dev/null
+++ b/examples/demos/tic-tac-toe/content/pics/x.png
Binary files differ
diff --git a/examples/demos/tic-tac-toe/content/tic-tac-toe.js b/examples/demos/tic-tac-toe/content/tic-tac-toe.js
new file mode 100644
index 0000000000..5a166b750f
--- /dev/null
+++ b/examples/demos/tic-tac-toe/content/tic-tac-toe.js
@@ -0,0 +1,149 @@
+function winner(board)
+{
+ for (var i=0; i<3; ++i) {
+ if (board.children[i].state != ""
+ && board.children[i].state == board.children[i+3].state
+ && board.children[i].state == board.children[i+6].state)
+ return true
+
+ if (board.children[i*3].state != ""
+ && board.children[i*3].state == board.children[i*3+1].state
+ && board.children[i*3].state == board.children[i*3+2].state)
+ return true
+ }
+
+ if (board.children[0].state != ""
+ && board.children[0].state == board.children[4].state != ""
+ && board.children[0].state == board.children[8].state != "")
+ return true
+
+ if (board.children[2].state != ""
+ && board.children[2].state == board.children[4].state != ""
+ && board.children[2].state == board.children[6].state != "")
+ return true
+
+ return false
+}
+
+function restartGame()
+{
+ game.running = true
+
+ for (var i=0; i<9; ++i)
+ board.children[i].state = ""
+}
+
+function makeMove(pos, player)
+{
+ board.children[pos].state = player
+ if (winner(board)) {
+ gameFinished(player + " wins")
+ return true
+ } else {
+ return false
+ }
+}
+
+function canPlayAtPos(pos)
+{
+ return board.children[pos].state == ""
+}
+
+function computerTurn()
+{
+ var r = Math.random();
+ if (r < game.difficulty)
+ smartAI();
+ else
+ randomAI();
+}
+
+function smartAI()
+{
+ function boardCopy(a) {
+ var ret = new Object;
+ ret.children = new Array(9);
+ for (var i = 0; i<9; i++) {
+ ret.children[i] = new Object;
+ ret.children[i].state = a.children[i].state;
+ }
+ return ret;
+ }
+
+ for (var i=0; i<9; i++) {
+ var simpleBoard = boardCopy(board);
+ if (canPlayAtPos(i)) {
+ simpleBoard.children[i].state = "O";
+ if (winner(simpleBoard)) {
+ makeMove(i, "O")
+ return
+ }
+ }
+ }
+ for (var i=0; i<9; i++) {
+ var simpleBoard = boardCopy(board);
+ if (canPlayAtPos(i)) {
+ simpleBoard.children[i].state = "X";
+ if (winner(simpleBoard)) {
+ makeMove(i, "O")
+ return
+ }
+ }
+ }
+
+ function thwart(a,b,c) { //If they are at a, try b or c
+ if (board.children[a].state == "X") {
+ if (canPlayAtPos(b)) {
+ makeMove(b, "O")
+ return true
+ } else if (canPlayAtPos(c)) {
+ makeMove(c, "O")
+ return true
+ }
+ }
+ return false;
+ }
+
+ if (thwart(4,0,2)) return;
+ if (thwart(0,4,3)) return;
+ if (thwart(2,4,1)) return;
+ if (thwart(6,4,7)) return;
+ if (thwart(8,4,5)) return;
+ if (thwart(1,4,2)) return;
+ if (thwart(3,4,0)) return;
+ if (thwart(5,4,8)) return;
+ if (thwart(7,4,6)) return;
+
+ for (var i =0; i<9; i++) {
+ if (canPlayAtPos(i)) {
+ makeMove(i, "O")
+ return
+ }
+ }
+ restartGame();
+}
+
+function randomAI()
+{
+ var unfilledPosns = new Array();
+
+ for (var i=0; i<9; ++i) {
+ if (canPlayAtPos(i))
+ unfilledPosns.push(i);
+ }
+
+ if (unfilledPosns.length == 0) {
+ restartGame();
+ } else {
+ var choice = unfilledPosns[Math.floor(Math.random() * unfilledPosns.length)];
+ makeMove(choice, "O");
+ }
+}
+
+function gameFinished(message)
+{
+ messageDisplay.text = message
+ messageDisplay.visible = true
+ game.running = false
+}
+
diff --git a/examples/demos/tic-tac-toe/tic-tac-toe.qml b/examples/demos/tic-tac-toe/tic-tac-toe.qml
new file mode 100644
index 0000000000..8d15233eaa
--- /dev/null
+++ b/examples/demos/tic-tac-toe/tic-tac-toe.qml
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+import "content/tic-tac-toe.js" as Logic
+
+Rectangle {
+ id: game
+
+ property bool running: true
+ property real difficulty: 1.0 //chance it will actually think
+
+ width: display.width; height: display.height + 10
+
+ Image {
+ id: boardImage
+ source: "content/pics/board.png"
+ }
+
+
+ Column {
+ id: display
+
+ Grid {
+ id: board
+ width: boardImage.width; height: boardImage.height
+ columns: 3
+
+ Repeater {
+ model: 9
+
+ TicTac {
+ width: board.width/3
+ height: board.height/3
+
+ onClicked: {
+ if (game.running && Logic.canPlayAtPos(index)) {
+ if (!Logic.makeMove(index, "X"))
+ Logic.computerTurn();
+ }
+ }
+ }
+ }
+ }
+
+ Row {
+ spacing: 4
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Button {
+ text: "Hard"
+ pressed: game.difficulty == 1.0
+ onClicked: { game.difficulty = 1.0 }
+ }
+ Button {
+ text: "Moderate"
+ pressed: game.difficulty == 0.8
+ onClicked: { game.difficulty = 0.8 }
+ }
+ Button {
+ text: "Easy"
+ pressed: game.difficulty == 0.2
+ onClicked: { game.difficulty = 0.2 }
+ }
+ }
+ }
+
+
+ Text {
+ id: messageDisplay
+ anchors.centerIn: parent
+ color: "blue"
+ style: Text.Outline; styleColor: "white"
+ font.pixelSize: 50; font.bold: true
+ visible: false
+
+ Timer {
+ running: messageDisplay.visible
+ onTriggered: {
+ messageDisplay.visible = false;
+ Logic.restartGame();
+ }
+ }
+ }
+}
diff --git a/examples/demos/twitter/TwitterCore/Button.qml b/examples/demos/twitter/TwitterCore/Button.qml
new file mode 100644
index 0000000000..353b993742
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/Button.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: container
+
+ signal clicked
+
+ property string text
+ property bool keyUsing: false
+
+ BorderImage {
+ id: buttonImage
+ source: "images/toolbutton.sci"
+ width: container.width; height: container.height
+ }
+ BorderImage {
+ id: pressed
+ opacity: 0
+ source: "images/toolbutton.sci"
+ width: container.width; height: container.height
+ }
+ MouseArea {
+ id: mouseRegion
+ anchors.fill: buttonImage
+ onClicked: { container.clicked(); }
+ }
+ Text {
+ id: btnText
+ color: if(container.keyUsing){"#D0D0D0";} else {"#FFFFFF";}
+ anchors.centerIn: buttonImage; font.bold: true
+ text: container.text; style: Text.Raised; styleColor: "black"
+ font.pixelSize: 12
+ }
+ states: [
+ State {
+ name: "Pressed"
+ when: mouseRegion.pressed == true
+ PropertyChanges { target: pressed; opacity: 1 }
+ },
+ State {
+ name: "Focused"
+ when: container.activeFocus == true
+ PropertyChanges { target: btnText; color: "#FFFFFF" }
+ }
+ ]
+ transitions: Transition {
+ ColorAnimation { target: btnText; }
+ }
+}
diff --git a/examples/demos/twitter/TwitterCore/FatDelegate.qml b/examples/demos/twitter/TwitterCore/FatDelegate.qml
new file mode 100644
index 0000000000..4cb0dfc713
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/FatDelegate.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Component {
+ id: listDelegate
+ Item {
+ id: wrapper; width: wrapper.ListView.view.width; height: if(txt.height > 60){txt.height+10}else{60} //50+5+5
+ function handleLink(link){
+ if(link.slice(0,3) == 'app'){
+ screen.setUser(link.slice(7));
+ }else if(link.slice(0,4) == 'http'){
+ Qt.openUrlExternally(link);
+ }
+ }
+ function addTags(str){
+ var ret = str.replace(/@[a-zA-Z0-9_]+/g, '<a href="app://$&">$&</a>');//click to jump to user?
+ var ret2 = ret.replace(/http:\/\/[^ \n\t]+/g, '<a href="$&">$&</a>');//surrounds http links with html link tags
+ return ret2;
+ }
+
+ // Strip away paranthesis
+ function userName(str) {
+ var user = str.replace(/\([\S|\s]*\)/gi, "");
+ return user.trim();
+ }
+
+ Item {
+ id: moveMe; height: parent.height
+ Rectangle {
+ id: blackRect
+ color: "black"; opacity: wrapper.ListView.index % 2 ? 0.2 : 0.3; height: wrapper.height-2; width: wrapper.width; y: 1
+ }
+ Item {
+ id: image; x: 6; width: 48; height: 48; smooth: true
+ anchors.verticalCenter: parent.verticalCenter
+
+ Loading { x: 1; y: 1; width: 48; height: 48; visible: realImage.status != Image.Ready }
+ Image {
+ id: realImage;
+ source: userImage; x: 1; y: 1;
+ width:48; height:48; opacity:0 ;
+ onStatusChanged: {
+ if(status==Image.Ready)
+ image.state="loaded"
+ }
+ }
+ states: State {
+ name: "loaded";
+ PropertyChanges { target: realImage ; opacity:1 }
+ }
+ transitions: Transition { NumberAnimation { target: realImage; property: "opacity"; duration: 200 } }
+
+ }
+ Text { id:txt; y:4; x: 56
+ text: '<html>'
+ + '<a href="app://@'+userName(name)+'"><b>'+userName(name) + "</b></a> from " +source
+ + "<br /><b>" + statusText + "</b></html>";
+ textFormat: Text.StyledText
+ color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap; linkColor: "#aaccaa"
+ anchors.left: image.right; anchors.right: blackRect.right; anchors.leftMargin: 6; anchors.rightMargin: 6
+ onLinkActivated: wrapper.handleLink(link)
+ }
+ }
+ }
+}
diff --git a/examples/demos/twitter/TwitterCore/Input.qml b/examples/demos/twitter/TwitterCore/Input.qml
new file mode 100644
index 0000000000..68b1c6186a
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/Input.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+FocusScope {
+ id:container
+ width: 220
+ height: 28
+ BorderImage { source: "images/lineedit.sci"; anchors.fill: parent }
+ signal accepted
+ property alias text: input.text
+ property alias item:input
+ TextInput{
+ id: input
+ width: parent.width - 12
+ anchors.centerIn: parent
+ maximumLength:21
+ font.pixelSize: 16;
+ font.bold: true
+ color: "#151515"; selectionColor: "mediumseagreen"
+ focus: true
+ onAccepted:{container.accepted()}
+ text: ""
+ selectByMouse: true
+ }
+}
diff --git a/examples/demos/twitter/TwitterCore/Loading.qml b/examples/demos/twitter/TwitterCore/Loading.qml
new file mode 100644
index 0000000000..566857b8b2
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/Loading.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Image {
+ id: loading; source: "images/loading.png"
+ NumberAnimation on rotation {
+ from: 0; to: 360; running: loading.visible == true; loops: Animation.Infinite; duration: 900
+ }
+}
diff --git a/examples/demos/twitter/TwitterCore/MultiTitleBar.qml b/examples/demos/twitter/TwitterCore/MultiTitleBar.qml
new file mode 100644
index 0000000000..3920520b7a
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/MultiTitleBar.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ TitleBar { id: titleBar; width: parent.width; height: 60;
+ y: -80
+ untaggedString: "Latest tweets from everyone"
+ taggedString: "Latest tweets from "
+ }
+ states: [
+ State {
+ name: "search"; when: screen.state!="search"
+ PropertyChanges { target: titleBar; y: 0 }
+ }
+ ]
+ transitions: [
+ Transition { NumberAnimation { properties: "x,y"; duration: 500; easing.type: Easing.InOutQuad } }
+ ]
+}
+
diff --git a/examples/demos/twitter/TwitterCore/RssModel.qml b/examples/demos/twitter/TwitterCore/RssModel.qml
new file mode 100644
index 0000000000..27f7495be2
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/RssModel.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+Item { id: wrapper
+ property variant model: xmlModel
+ property string from : ""
+ property string to : ""
+ property string phrase : ""
+
+ property string mode : "everyone"
+ property int status: xmlModel.status
+ function reload() { xmlModel.reload(); }
+
+ XmlListModel {
+ id: xmlModel
+
+ function encodePhrase(x) { return encodeURIComponent(x); }
+
+ source: (from=="" && to=="" && phrase=="") ? "" :
+ 'http://search.twitter.com/search.atom?from='+from+"&to="+to+"&phrase="+encodePhrase(phrase)
+
+ namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom'; " +
+ "declare namespace twitter=\"http://api.twitter.com/\";";
+
+ query: "/feed/entry"
+
+ XmlRole { name: "statusText"; query: "content/string()" }
+ XmlRole { name: "timestamp"; query: "published/string()" }
+ XmlRole { name: "source"; query: "twitter:source/string()" }
+ XmlRole { name: "name"; query: "author/name/string()" }
+ XmlRole { name: "userImage"; query: "link[@rel = 'image']/@href/string()" }
+
+ }
+ Binding {
+ property: "mode"
+ target: wrapper
+ value: {if(wrapper.tags==''){"everyone";}else if(wrapper.tags=='my timeline'){"self";}else{"user";}}
+ }
+}
diff --git a/examples/demos/twitter/TwitterCore/SearchView.qml b/examples/demos/twitter/TwitterCore/SearchView.qml
new file mode 100644
index 0000000000..7732e6f68d
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/SearchView.qml
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+FocusScope {
+ id: wrapper
+ Column {
+ anchors.centerIn: parent
+ spacing: 20
+ Column{
+ spacing: 4
+ Text {
+ text: "Posted by:"
+ font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black"
+ horizontalAlignment: Qt.AlignRight
+ }
+ Input{
+ id: fromIn
+ KeyNavigation.backtab: searchbutton
+ KeyNavigation.tab:toIn
+ onAccepted:searchbutton.doSearch();
+ focus: true
+ }
+ Text {
+ text: "In reply to:"
+ font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black"
+ horizontalAlignment: Qt.AlignRight
+ }
+ Input{
+ id: toIn
+ KeyNavigation.backtab: fromIn
+ KeyNavigation.tab:phraseIn
+ onAccepted:searchbutton.doSearch();
+ }
+ Text {
+ text: "Search phrase:"
+ font.pixelSize: 16; font.bold: true; color: "white"; style: Text.Raised; styleColor: "black"
+ horizontalAlignment: Qt.AlignRight
+ }
+ Input{
+ id: phraseIn
+ KeyNavigation.backtab: toIn
+ KeyNavigation.tab:searchbutton
+ onAccepted:searchbutton.doSearch();
+ text: "Qt Quick"
+ }
+ }
+ Button {
+ width: 100
+ height: 32
+ id: searchbutton
+ keyUsing: true;
+ opacity: 1
+ text: "Search"
+ KeyNavigation.tab: fromIn
+ Keys.onReturnPressed: searchbutton.doSearch();
+ Keys.onEnterPressed: searchbutton.doSearch();
+ Keys.onSelectPressed: searchbutton.doSearch();
+ Keys.onSpacePressed: searchbutton.doSearch();
+ onClicked: searchbutton.doSearch();
+
+ function doSearch() {
+ // Search ! allowed
+ if (wrapper.state=="invalidinput")
+ return;
+
+ rssModel.from=fromIn.text;
+ rssModel.to= toIn.text;
+ rssModel.phrase = phraseIn.text;
+ screen.focus = true;
+ screen.state = ""
+ }
+ }
+ }
+ states:
+ State {
+ name: "invalidinput"
+ when: fromIn.text=="" && toIn.text=="" && phraseIn.text==""
+ PropertyChanges { target: searchbutton ; opacity: 0.6 ; }
+ }
+ transitions:
+ Transition {
+ NumberAnimation { target: searchbutton; property: "opacity"; duration: 200 }
+ }
+}
diff --git a/examples/demos/twitter/TwitterCore/TitleBar.qml b/examples/demos/twitter/TwitterCore/TitleBar.qml
new file mode 100644
index 0000000000..3e0818b0dd
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/TitleBar.qml
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: titleBar
+ property string untaggedString: "Uploads from everyone"
+ property string taggedString: "Recent uploads tagged "
+
+ BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
+
+ Item {
+ id: container
+ width: (parent.width * 2) - 55 ; height: parent.height
+
+ function accept() {
+ titleBar.state = ""
+ background.state = ""
+ rssModel.tags = editor.text
+ }
+
+ Item {
+ id:imageBox
+ x: 6; width: 0; height: 50; smooth: true
+ anchors.verticalCenter: parent.verticalCenter
+
+ UserModel { user: rssModel.from; id: userModel }
+ Component {
+ id: imgDelegate;
+ Item {
+ id:imageitem
+ visible:true
+ Loading { width:48; height:48; visible: realImage.status != Image.Ready }
+ Image { id: realImage; source: image; width:48; height:48; opacity:0; }
+ states:
+ State {
+ name: "loaded"
+ when: (realImage.status == Image.Ready)
+ PropertyChanges { target: realImage; opacity:1 }
+ }
+ transitions: Transition {
+ NumberAnimation { target: realImage; property: "opacity"; duration: 200 }
+ }
+ }
+ }
+ ListView { id:view; model: userModel.model; x:1; y:1; delegate: imgDelegate }
+ states:
+ State {
+ when: !userModel.user==""
+ PropertyChanges { target: imageBox; width: 50; }
+ }
+ transitions:
+ Transition {
+ NumberAnimation { target: imageBox; property: "width"; duration: 200 }
+ }
+ }
+
+ Image {
+ id: quitButton
+ x: 5
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/quit.png"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.quit()
+ }
+ }
+
+ Text {
+ id: categoryText
+ anchors {
+ left: quitButton.right; right: parent.right; leftMargin: 10; rightMargin: 10
+ verticalCenter: parent.verticalCenter
+ }
+ elide: Text.ElideLeft
+ text: (rssModel.from=="" ? untaggedString : taggedString + rssModel.from)
+ font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black"
+ font.pixelSize: 12
+ }
+ }
+
+ states: State {
+ name: "Tags"
+ PropertyChanges { target: container; x: -tagButton.x + 5 }
+ PropertyChanges { target: editor; focus: true }
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad }
+ }
+}
diff --git a/examples/demos/twitter/TwitterCore/ToolBar.qml b/examples/demos/twitter/TwitterCore/ToolBar.qml
new file mode 100644
index 0000000000..d4265f3e98
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/ToolBar.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: toolbar
+
+ property alias button1Label: button1.text
+ property alias button2Label: button2.text
+ signal button1Clicked
+ signal button2Clicked
+ focus:true
+ BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
+ Button {
+ id: button1
+ anchors.left: parent.left; anchors.leftMargin: 5; y: 3; width: 140; height: 32
+ onClicked: toolbar.button1Clicked()
+ focus:true
+ }
+ Button {
+ id: button2
+ anchors.right: parent.right; anchors.rightMargin: 5; y: 3; width: 140; height: 32
+ onClicked: toolbar.button2Clicked()
+ }
+}
diff --git a/examples/demos/twitter/TwitterCore/UserModel.qml b/examples/demos/twitter/TwitterCore/UserModel.qml
new file mode 100644
index 0000000000..428089b539
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/UserModel.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+//This "model" gets the user information about the searched user. Mainly for the icon.
+
+Item { id: wrapper
+ property variant model: xmlModel
+ property string user : ""
+ property int status: xmlModel.status
+ function reload() { xmlModel.reload(); }
+ XmlListModel {
+ id: xmlModel
+
+ source: user!= "" ? "http://twitter.com/users/show.xml?screen_name="+user : ""
+ query: "/user"
+
+ XmlRole { name: "name"; query: "name/string()" }
+ XmlRole { name: "screenName"; query: "screen_name/string()" }
+ XmlRole { name: "image"; query: "profile_image_url/string()" }
+ XmlRole { name: "location"; query: "location/string()" }
+ XmlRole { name: "description"; query: "description/string()" }
+ XmlRole { name: "followers"; query: "followers_count/string()" }
+ //TODO: Could also get the user's color scheme, timezone and a few other things
+ }
+}
diff --git a/examples/demos/twitter/TwitterCore/images/gloss.png b/examples/demos/twitter/TwitterCore/images/gloss.png
new file mode 100644
index 0000000000..5d370cd93d
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/images/gloss.png
Binary files differ
diff --git a/examples/demos/twitter/TwitterCore/images/lineedit.png b/examples/demos/twitter/TwitterCore/images/lineedit.png
new file mode 100644
index 0000000000..2cc38dc35b
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/images/lineedit.png
Binary files differ
diff --git a/examples/demos/twitter/TwitterCore/images/lineedit.sci b/examples/demos/twitter/TwitterCore/images/lineedit.sci
new file mode 100644
index 0000000000..054bff78be
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/images/lineedit.sci
@@ -0,0 +1,5 @@
+border.left: 10
+border.top: 10
+border.bottom: 10
+border.right: 10
+source: lineedit.png
diff --git a/examples/demos/twitter/TwitterCore/images/loading.png b/examples/demos/twitter/TwitterCore/images/loading.png
new file mode 100644
index 0000000000..47a1589c5d
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/images/loading.png
Binary files differ
diff --git a/examples/demos/twitter/TwitterCore/images/quit.png b/examples/demos/twitter/TwitterCore/images/quit.png
new file mode 100644
index 0000000000..5bda1b6e0d
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/images/quit.png
Binary files differ
diff --git a/examples/demos/twitter/TwitterCore/images/stripes.png b/examples/demos/twitter/TwitterCore/images/stripes.png
new file mode 100644
index 0000000000..9f36727ea4
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/images/stripes.png
Binary files differ
diff --git a/examples/demos/twitter/TwitterCore/images/titlebar.png b/examples/demos/twitter/TwitterCore/images/titlebar.png
new file mode 100644
index 0000000000..51c90082d0
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/images/titlebar.png
Binary files differ
diff --git a/examples/demos/twitter/TwitterCore/images/titlebar.sci b/examples/demos/twitter/TwitterCore/images/titlebar.sci
new file mode 100644
index 0000000000..0418d94cd6
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/images/titlebar.sci
@@ -0,0 +1,5 @@
+border.left: 10
+border.top: 12
+border.bottom: 12
+border.right: 10
+source: titlebar.png
diff --git a/examples/demos/twitter/TwitterCore/images/toolbutton.png b/examples/demos/twitter/TwitterCore/images/toolbutton.png
new file mode 100644
index 0000000000..11310013ee
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/images/toolbutton.png
Binary files differ
diff --git a/examples/demos/twitter/TwitterCore/images/toolbutton.sci b/examples/demos/twitter/TwitterCore/images/toolbutton.sci
new file mode 100644
index 0000000000..9e4f965307
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/images/toolbutton.sci
@@ -0,0 +1,5 @@
+border.left: 15
+border.top: 4
+border.bottom: 4
+border.right: 15
+source: toolbutton.png
diff --git a/examples/demos/twitter/TwitterCore/qmldir b/examples/demos/twitter/TwitterCore/qmldir
new file mode 100644
index 0000000000..452a648b23
--- /dev/null
+++ b/examples/demos/twitter/TwitterCore/qmldir
@@ -0,0 +1,10 @@
+SearchView 2.0 SearchView.qml
+Button 2.0 Button.qml
+Input 2.0 Input.qml
+FatDelegate 2.0 FatDelegate.qml
+Loading 2.0 Loading.qml
+MultiTitleBar 2.0 MultiTitleBar.qml
+TitleBar 2.0 TitleBar.qml
+RssModel 2.0 RssModel.qml
+UserModel 2.0 UserModel.qml
+ToolBar 2.0 ToolBar.qml
diff --git a/examples/demos/twitter/twitter.qml b/examples/demos/twitter/twitter.qml
new file mode 100644
index 0000000000..aca0968cfb
--- /dev/null
+++ b/examples/demos/twitter/twitter.qml
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+import "TwitterCore" 2.0 as Twitter
+
+Item {
+ id: screen; width: 320; height: 480
+ property bool userView : false
+ property variant tmpStr
+ function setUser(str){hack.running = true; tmpStr = str}
+ function reallySetUser(){rssModel.from = tmpStr;rssModel.to = ""; rssModel.phrase = ""}
+ state:"searchquery"
+ //Workaround for bug 260266
+ Timer{ interval: 1; running: false; repeat: false; onTriggered: screen.reallySetUser(); id:hack }
+ Keys.onEscapePressed: screen.state="searchquery"
+ Keys.onBacktabPressed: screen.state="searchquery"
+ Rectangle {
+ id: background
+ anchors.fill: parent; color: "#343434";
+
+ state:"searchquery"
+ Image { source: "TwitterCore/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: screen.focus = false;
+ }
+
+ Twitter.RssModel { id: rssModel }
+ Twitter.Loading { anchors.centerIn: parent; visible: rssModel.status==XmlListModel.Loading && state!='unauthed'}
+ Text {
+ width: 180
+ text: "Could not access twitter using this screen name and password pair.";
+ color: "#cccccc"; style: Text.Raised; styleColor: "black"; wrapMode: Text.WordWrap
+ visible: rssModel.status==XmlListModel.Error; anchors.centerIn: parent
+ }
+
+ Item {
+ id: views
+ x: 2; width: parent.width - 4
+ y:60 //Below the title bars
+ height: parent.height - 100
+
+ Text {
+ id:title
+ text: "Search Twitter"
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.pixelSize: 20; font.bold: true; color: "#bbb"; style: Text.Raised; styleColor: "black"
+ opacity:0
+ }
+
+ Twitter.SearchView{
+ id: searchView
+ anchors.verticalCenter: parent.verticalCenter
+ width: parent.width; height: parent.height-60;
+ x: -(screen.width * 1.5)
+ }
+
+ Twitter.FatDelegate { id: fatDelegate }
+ ListView {
+ id: mainView; model: rssModel.model; delegate: fatDelegate;
+ width: parent.width; height: parent.height; x: 0; cacheBuffer: 100;
+ }
+ }
+
+ Twitter.MultiTitleBar { id: titleBar; width: parent.width }
+ Twitter.ToolBar { id: toolBar; height: 40;
+ //anchors.bottom: parent.bottom;
+ //TODO: Use anchor changes instead of hard coding
+ y: screen.height - 40
+ width: parent.width; opacity: 0.9
+ button1Label: "New Search"
+ button2Label: "Update"
+ onButton1Clicked:
+ {
+ screen.state="searchquery"
+ }
+ onButton2Clicked: rssModel.reload();
+ }
+ }
+ states: [
+ State {
+ name: "searchquery";
+ PropertyChanges { target: searchView; x: 0; focus:true}
+ PropertyChanges { target: mainView; x: -(parent.width * 1.5) }
+ PropertyChanges { target: titleBar; y: -80 }
+ PropertyChanges { target: toolBar; y: screen.height }
+ PropertyChanges { target: toolBar }
+ PropertyChanges { target: title; opacity:1}
+ }
+ ]
+ transitions: [
+ Transition { NumberAnimation { properties: "x,y,opacity"; duration: 500; easing.type: Easing.InOutQuad } }
+ ]
+}
diff --git a/examples/demos/twitter/twitter.qmlproject b/examples/demos/twitter/twitter.qmlproject
new file mode 100644
index 0000000000..b14f71fdfd
--- /dev/null
+++ b/examples/demos/twitter/twitter.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "twitter.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/examples.pro b/examples/examples.pro
index 3e5c4d08a5..d3d2f5520f 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -1,3 +1,3 @@
TEMPLATE = subdirs
-SUBDIRS += qml tutorials
+SUBDIRS += demos shared localstorage particles qml quick tutorials window
contains(QT_CONFIG, qmltest): SUBDIRS += qmltest
diff --git a/examples/localstorage/hello.qml b/examples/localstorage/hello.qml
new file mode 100644
index 0000000000..3496b86bd9
--- /dev/null
+++ b/examples/localstorage/hello.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import QtQuick 2.0
+import QtQuick.LocalStorage 2.0 as LS
+
+Rectangle {
+ color: "white"
+ width: 200
+ height: 100
+
+ Text {
+ text: "?"
+ anchors.horizontalCenter: parent.horizontalCenter
+ function findGreetings() {
+ var db = LS.openDatabaseSync("QDeclarativeExampleDB", "1.0", "The Example QML SQL!", 1000000);
+
+ db.transaction(
+ function(tx) {
+ // Create the database if it doesn't already exist
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
+
+ // Add (another) greeting row
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
+
+ // Show all added greetings
+ var rs = tx.executeSql('SELECT * FROM Greeting');
+
+ var r = ""
+ for(var i = 0; i < rs.rows.length; i++) {
+ r += rs.rows.item(i).salutation + ", " + rs.rows.item(i).salutee + "\n"
+ }
+ text = r
+ }
+ )
+ }
+
+ Component.onCompleted: findGreetings()
+ }
+}
+//![0]
diff --git a/examples/localstorage/localstorage.pro b/examples/localstorage/localstorage.pro
new file mode 100644
index 0000000000..967108504e
--- /dev/null
+++ b/examples/localstorage/localstorage.pro
@@ -0,0 +1 @@
+TEMPLATE = subdirs
diff --git a/examples/particles/affectors/age.qml b/examples/particles/affectors/age.qml
new file mode 100644
index 0000000000..ea1b30275e
--- /dev/null
+++ b/examples/particles/affectors/age.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ id: root
+ width: 360
+ height: 600
+ color: "white"
+
+ ParticleSystem { id: particles }
+
+ ImageParticle {
+ system: particles
+ sprites: Sprite {
+ name: "snow"
+ source: "../images/snowflake.png"
+ frameCount: 51
+ frameDuration: 40
+ frameDurationVariation: 8
+ }
+ }
+
+ Emitter {
+ system: particles
+ emitRate: 20
+ lifeSpan: 8000
+ speed: PointDirection { y:80; yVariation: 40; }
+ acceleration: PointDirection { y: 4 }
+ size: 36
+ endSize: 12
+ sizeVariation: 8
+ width: parent.width
+ height: 100
+ }
+
+ MouseArea {
+ id: ma
+ anchors.fill: parent
+ hoverEnabled: true
+ }
+
+ Rectangle {
+ color: "#803333AA"
+ border.color: "black"
+ x: ma.mouseX - 36
+ y: ma.mouseY - 36
+ width: 72
+ height: 72
+ Age {
+ anchors.fill: parent
+ system: particles
+ once: true
+ lifeLeft: 1200
+ advancePosition: false
+ }
+ }
+}
diff --git a/examples/particles/affectors/attractor.qml b/examples/particles/affectors/attractor.qml
new file mode 100644
index 0000000000..0d50937fe7
--- /dev/null
+++ b/examples/particles/affectors/attractor.qml
@@ -0,0 +1,213 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ id: root
+ width: 360
+ height: 540
+ color: "black"
+ property bool spacePressed: false
+ focus: true
+ Image {
+ source: "../images/finalfrontier.png"
+ anchors.centerIn:parent
+ }
+ Keys.onPressed: {
+ if (event.key == Qt.Key_Space) {
+ spacePressed = true;
+ event.accepted = true;
+ }
+ }
+ Keys.onReleased: {
+ if (event.key == Qt.Key_Space) {
+ spacePressed = false;
+ event.accepted = true;
+ }
+ }
+
+ Emitter {
+ group: "stars"
+ system: particles
+ emitRate: 40
+ lifeSpan: 4000
+ enabled: true
+ size: 30
+ sizeVariation: 10
+ speed: PointDirection { x: 220; xVariation: 40 }
+ height: parent.height
+ }
+ Emitter {
+ group: "roids"
+ system: particles
+ emitRate: 10
+ lifeSpan: 4000
+ enabled: true
+ size: 30
+ sizeVariation: 10
+ speed: PointDirection { x: 220; xVariation: 40 }
+ height: parent.height
+ }
+ ParticleSystem {
+ id: particles
+ anchors.fill: parent
+ }
+ ImageParticle {
+ id: stars
+ groups: ["stars"]
+ system: particles
+ source: "../images/star.png"
+ color: "white"
+ colorVariation: 0.1
+ alpha: 0
+ }
+ ImageParticle {
+ id: roids
+ groups: ["roids"]
+ system: particles
+ sprites: Sprite {
+ id: spinState
+ name: "spinning"
+ source: "../images/meteor.png"
+ frameCount: 35
+ frameDuration: 60
+ }
+ }
+ ImageParticle {
+ id: shot
+ groups: ["shot"]
+ system: particles
+ source: "../images/star.png"
+
+ color: "#0FF06600"
+ colorVariation: 0.3
+ }
+ ImageParticle {
+ id: engine
+ groups: ["engine"]
+ system: particles
+ source: "../images/particle4.png"
+
+ color: "orange"
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation {
+ from: "red"
+ to: "cyan"
+ duration: 1000
+ }
+ ColorAnimation {
+ from: "cyan"
+ to: "red"
+ duration: 1000
+ }
+ }
+
+ colorVariation: 0.2
+ }
+ Attractor {
+ id: gs; pointX: root.width/2; pointY: root.height/2; strength: 4000000;
+ system: particles
+ affectedParameter: Attractor.Acceleration
+ proportionalToDistance: Attractor.InverseQuadratic
+ }
+ Age {
+ system: particles
+ x: gs.pointX - 8;
+ y: gs.pointY - 8;
+ width: 16
+ height: 16
+ }
+ Rectangle {
+ color: "black"
+ width: 8
+ height: 8
+ radius: 4
+ x: gs.pointX - 4
+ y: gs.pointY - 4
+ }
+
+ Image {
+ source:"../images/rocket2.png"
+ id: ship
+ width: 45
+ height: 22
+ MouseArea {
+ id: ma
+ anchors.fill: parent;
+ drag.axis: Drag.XandYAxis
+ drag.target: ship
+ }
+ }
+ Emitter {
+ group: "engine"
+ system: particles
+ emitRate: 200
+ lifeSpan: 1000
+ size: 10
+ endSize: 4
+ sizeVariation: 4
+ speed: PointDirection { x: -128; xVariation: 32 }
+ height: ship.height
+ y: ship.y
+ x: ship.x
+ width: 20
+ }
+ Emitter {
+ group: "shot"
+ system: particles
+ emitRate: 32
+ lifeSpan: 2000
+ enabled: spacePressed
+ size: 40
+ speed: PointDirection { x: 256; }
+ x: ship.x + ship.width
+ y: ship.y + ship.height/2
+ }
+
+ Text {
+ color: "white"
+ anchors.bottom: parent.bottom
+ text:"Drag the ship, Spacebar to fire."
+ }
+}
+
diff --git a/examples/particles/affectors/customaffector.qml b/examples/particles/affectors/customaffector.qml
new file mode 100644
index 0000000000..9ccf45d3e6
--- /dev/null
+++ b/examples/particles/affectors/customaffector.qml
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ width: 360
+ height: 600
+
+ Image {
+ source: "../images/backgroundLeaves.jpg"
+ anchors.fill: parent
+ }
+ ParticleSystem {
+ id: sys
+ }
+ Emitter {
+ system: sys
+ width: parent.width
+ emitRate: 4
+ lifeSpan: 14000
+ size: 80
+ speed: PointDirection { y: 60 }
+ }
+ Wander {
+ system: sys
+ anchors.fill: parent
+ anchors.bottomMargin: 100
+ xVariance: 60
+ pace: 60
+ }
+
+ Affector {
+ system: sys
+ property real coefficient: 0.1
+ property real speed: 1.5
+ width: parent.width
+ height: parent.height - 100
+ onAffectParticles: {
+ /* //Linear movement
+ if (particle.r == 0) {
+ particle.r = Math.random() > 0.5 ? -1 : 1;
+ }else if (particle.r == 1) {
+ particle.rotation += speed * dt;
+ if(particle.rotation >= maxAngle)
+ particle.r = -1;
+ }else if (particle.r == -1) {
+ particle.rotation -= speed * dt;
+ if(particle.rotation <= -1 * maxAngle)
+ particle.r = 1;
+ }
+ */
+ //Wobbly movement
+ for (var i=0; i<particles.length; i++) {
+ var particle = particles[i];
+ if (particle.r == 0.0) {
+ particle.r = Math.random() + 0.01;
+ }
+ particle.rotation += speed * particle.r * dt;
+ particle.r -= particle.rotation * coefficient;
+ if (particle.r == 0.0)
+ particle.r -= particle.rotation * 0.000001;
+ particle.update = 1;
+ }
+ }
+ }
+
+ Affector {//Custom Friction, adds some 'randomness'
+ system: sys
+ //onceOff: true
+ x: -60
+ width: parent.width + 120
+ height: 100
+ anchors.bottom: parent.bottom
+ onAffectParticles: {
+ for (var i=0; i<particles.length; i++) {
+ var particle = particles[i];
+ var pseudoRand = (Math.floor(particle.t*1327) % 10) + 1;
+ var yslow = dt * pseudoRand * 0.5 + 1;
+ var xslow = dt * pseudoRand * 0.05 + 1;
+ if (particle.vy < 1)
+ particle.vy = 0;
+ else
+ particle.vy = (particle.vy / yslow);
+ if (particle.vx < 1)
+ particle.vx = 0;
+ else
+ particle.vx = (particle.vx / xslow);
+ particle.update = true;
+ }
+ }
+ }
+
+ ImageParticle {
+ anchors.fill: parent
+ id: particles
+ system: sys
+ sprites: [Sprite {
+ source: "../images/realLeaf1.png"
+ frameCount: 1
+ frameDuration: 1
+ to: {"a":1, "b":1, "c":1, "d":1}
+ }, Sprite {
+ name: "a"
+ source: "../images/realLeaf1.png"
+ frameCount: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "b"
+ source: "../images/realLeaf2.png"
+ frameCount: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "c"
+ source: "../images/realLeaf3.png"
+ frameCount: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "d"
+ source: "../images/realLeaf4.png"
+ frameCount: 1
+ frameDuration: 10000
+ }
+ ]
+
+ width: 100
+ height: 100
+ x: 20
+ y: 20
+ z:4
+ }
+}
diff --git a/examples/particles/affectors/friction.qml b/examples/particles/affectors/friction.qml
new file mode 100644
index 0000000000..b93ead1967
--- /dev/null
+++ b/examples/particles/affectors/friction.qml
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ width: 360
+ height: 600
+
+ Image {
+ source: "../images/backgroundLeaves.jpg"
+ anchors.fill: parent
+ }
+ ParticleSystem { id: sys }
+ Emitter {
+ system: sys
+ width: parent.width
+ emitRate: 4
+ lifeSpan: 14000
+ size: 80
+ speed: PointDirection { y: 160; yVariation: 80; xVariation: 20 }
+ }
+
+ ImageParticle {
+ anchors.fill: parent
+ id: particles
+ system: sys
+ sprites: [Sprite {
+ source: "../images/realLeaf1.png"
+ frameCount: 1
+ frameDuration: 1
+ to: {"a":1, "b":1, "c":1, "d":1}
+ }, Sprite {
+ name: "a"
+ source: "../images/realLeaf1.png"
+ frameCount: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "b"
+ source: "../images/realLeaf2.png"
+ frameCount: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "c"
+ source: "../images/realLeaf3.png"
+ frameCount: 1
+ frameDuration: 10000
+ },
+ Sprite {
+ name: "d"
+ source: "../images/realLeaf4.png"
+ frameCount: 1
+ frameDuration: 10000
+ }
+ ]
+
+ width: 100
+ height: 100
+ x: 20
+ y: 20
+ z:4
+ }
+ Friction {
+ anchors.fill: parent
+ anchors.margins: -40
+ system: sys
+ factor: 0.4
+ }
+}
diff --git a/examples/particles/affectors/gravity.qml b/examples/particles/affectors/gravity.qml
new file mode 100644
index 0000000000..b90d83e1c8
--- /dev/null
+++ b/examples/particles/affectors/gravity.qml
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: window
+ width: 480; height: 480
+ Rectangle {
+ id: sky
+ anchors.fill: parent
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: "DeepSkyBlue"
+ }
+ GradientStop {
+ position: 1.0
+ color: "SkyBlue"
+ }
+ }
+ }
+
+ Rectangle {
+ id: ground
+ width: parent.width * 2
+ height: parent.height
+ y: parent.height/2
+ x: -parent.height/2
+ transformOrigin: Item.Top
+ rotation: 0
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "ForestGreen"; }
+ GradientStop { position: 1.0; color: "DarkGreen"; }
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onPositionChanged: {
+ var rot = Math.atan2(mouseY - window.height/2,mouseX - window.width/2) * 180/Math.PI;
+ ground.rotation = rot;
+ }
+ }
+
+ ParticleSystem { id: sys }
+ Gravity {
+ system: sys
+ magnitude: 32
+ angle: ground.rotation + 90
+ }
+ Emitter {
+ system: sys
+ anchors.centerIn: parent
+ emitRate: 1
+ lifeSpan: 10000
+ size: 64
+ }
+ ImageParticle {
+ anchors.fill: parent
+ system: sys
+ source: "../images/realLeaf1.png"
+ }
+
+}
diff --git a/examples/particles/affectors/groupgoal.qml b/examples/particles/affectors/groupgoal.qml
new file mode 100644
index 0000000000..273ec1a30c
--- /dev/null
+++ b/examples/particles/affectors/groupgoal.qml
@@ -0,0 +1,193 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+
+Rectangle {
+ id: root
+ width: 360
+ height: 600
+ color: "black"
+
+ property int score: 0
+ Text {
+ color: "white"
+ anchors.right: parent.right
+ text: score
+ }
+
+ ParticleSystem {
+ id: particles
+ anchors.fill: parent
+ ParticleGroup {
+ name: "unlit"
+ duration: 1000
+ to: {"lighting":1, "unlit":99}
+ ImageParticle {
+ source: "../images/particleA.png"
+ colorVariation: 0.1
+ color: "#2060160f"
+ }
+ GroupGoal {
+ whenCollidingWith: ["lit"]
+ goalState: "lighting"
+ jump: true
+ }
+ }
+ ParticleGroup {
+ name: "lighting"
+ duration: 100
+ to: {"lit":1}
+ }
+ ParticleGroup {
+ name: "lit"
+ duration: 10000
+ onEntered: score++;
+ TrailEmitter {
+ id: fireballFlame
+ group: "flame"
+
+ emitRatePerParticle: 48
+ lifeSpan: 200
+ emitWidth: 8
+ emitHeight: 8
+
+ size: 24
+ sizeVariation: 8
+ endSize: 4
+ }
+
+ TrailEmitter {
+ id: fireballSmoke
+ group: "smoke"
+
+ emitRatePerParticle: 120
+ lifeSpan: 2000
+ emitWidth: 16
+ emitHeight: 16
+
+ speed: PointDirection {yVariation: 16; xVariation: 16}
+ acceleration: PointDirection {y: -16}
+
+ size: 24
+ sizeVariation: 8
+ endSize: 8
+ }
+ }
+
+ ImageParticle {
+ id: smoke
+ anchors.fill: parent
+ groups: ["smoke"]
+ source: "../images/particle.png"
+ colorVariation: 0
+ color: "#00111111"
+ }
+ ImageParticle {
+ id: pilot
+ anchors.fill: parent
+ groups: ["pilot"]
+ source: "../images/particle.png"
+ redVariation: 0.01
+ blueVariation: 0.4
+ color: "#0010004f"
+ }
+ ImageParticle {
+ id: flame
+ anchors.fill: parent
+ groups: ["flame", "lit", "lighting"]
+ source: "../images/particleA.png"
+ colorVariation: 0.1
+ color: "#00ff400f"
+ }
+
+ Emitter {
+ height: parent.height/2
+ emitRate: 4
+ lifeSpan: 4000//TODO: Infinite & kill zone
+ size: 24
+ sizeVariation: 4
+ speed: PointDirection {x:120; xVariation: 80; yVariation: 50}
+ acceleration: PointDirection {y:120}
+ group: "unlit"
+ }
+
+ Emitter {
+ id: flamer
+ x: 100
+ y: 300
+ group: "pilot"
+ emitRate: 80
+ lifeSpan: 600
+ size: 24
+ sizeVariation: 2
+ endSize: 0
+ speed: PointDirection { y:-100; yVariation: 4; xVariation: 4 }
+ GroupGoal {
+ groups: ["unlit"]
+ goalState: "lit"
+ jump: true
+ system: particles
+ x: -15
+ y: -55
+ height: 75
+ width: 30
+ shape: MaskShape {source: "../images/matchmask.png"}
+ }
+ }
+ //Click to enflame
+ GroupGoal {
+ groups: ["unlit"]
+ goalState: "lighting"
+ jump: true
+ enabled: ma.pressed
+ width: 18
+ height: 18
+ x: ma.mouseX - width/2
+ y: ma.mouseY - height/2
+ }
+ MouseArea {
+ id: ma
+ anchors.fill: parent
+ }
+ }
+}
diff --git a/examples/particles/affectors/move.qml b/examples/particles/affectors/move.qml
new file mode 100644
index 0000000000..f290173ca8
--- /dev/null
+++ b/examples/particles/affectors/move.qml
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ width: 360
+ height: 540
+ color: "black"
+ ParticleSystem {
+ anchors.fill: parent
+ ImageParticle {
+ groups: ["A"]
+ anchors.fill: parent
+ source: "../images/star.png"
+ color:"#FF1010"
+ redVariation: 0.8
+ }
+
+ Emitter {
+ group: "A"
+ emitRate: 100
+ lifeSpan: 2800
+ size: 32
+ sizeVariation: 8
+ speed: PointDirection{ x: 66; xVariation: 20 }
+ width: 80
+ height: 80
+ }
+
+ Affector {
+ groups: ["A"]
+ x: 120
+ width: 80
+ height: 80
+ once: true
+ position: PointDirection { x: 120; }
+ }
+
+ ImageParticle {
+ groups: ["B"]
+ anchors.fill: parent
+ source: "../images/star.png"
+ color:"#10FF10"
+ greenVariation: 0.8
+ }
+
+ Emitter {
+ group: "B"
+ emitRate: 100
+ lifeSpan: 2800
+ size: 32
+ sizeVariation: 8
+ speed: PointDirection{ x: 240; xVariation: 60 }
+ y: 260
+ width: 10
+ height: 10
+ }
+
+ Affector {
+ groups: ["B"]
+ x: 120
+ y: 240
+ width: 80
+ height: 80
+ once: true
+ speed: AngleDirection { angleVariation:360; magnitude: 72 }
+ }
+
+ ImageParticle {
+ groups: ["C"]
+ anchors.fill: parent
+ source: "../images/star.png"
+ color:"#1010FF"
+ blueVariation: 0.8
+ }
+
+ Emitter {
+ group: "C"
+ y: 400
+ emitRate: 100
+ lifeSpan: 2800
+ size: 32
+ sizeVariation: 8
+ speed: PointDirection{ x: 80; xVariation: 10 }
+ acceleration: PointDirection { y: 10; x: 20; }
+ width: 80
+ height: 80
+ }
+
+ Affector {
+ groups: ["C"]
+ x: 120
+ y: 400
+ width: 80
+ height: 120
+ once: true
+ relative: false
+ acceleration: PointDirection { y: -80; }
+ }
+
+ }
+}
diff --git a/examples/particles/affectors/spritegoal.qml b/examples/particles/affectors/spritegoal.qml
new file mode 100644
index 0000000000..7102d09bc2
--- /dev/null
+++ b/examples/particles/affectors/spritegoal.qml
@@ -0,0 +1,212 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: root
+ width: 360
+ height: 540
+ MouseArea {
+ id: ma
+ anchors.fill: parent
+ }
+
+ ParticleSystem { id: sys }
+ Image {
+ source: "../images/finalfrontier.png"
+ transformOrigin: Item.Center
+ anchors.centerIn: parent
+ smooth: true
+ NumberAnimation on rotation {
+ from: 0
+ to: 360
+ duration: 200000
+ loops: Animation.Infinite
+ }
+
+ }
+ ImageParticle {
+ system: sys
+ groups: ["starfield"]
+ source: "../images/star.png"
+ colorVariation: 0.3
+ color: "white"
+ }
+ Emitter {
+ id: starField
+ system: sys
+ group: "starfield"
+
+ emitRate: 80
+ lifeSpan: 2500
+
+ anchors.centerIn: parent
+
+ //acceleration: AngledDirection {angleVariation: 360; magnitude: 200}//Is this a better effect, more consistent speed?
+ acceleration: PointDirection { xVariation: 200; yVariation: 200; }
+
+ size: 0
+ endSize: 80
+ sizeVariation: 10
+ }
+ Emitter {
+ system: sys
+ group: "meteor"
+ emitRate: 12
+ lifeSpan: 5000
+ acceleration: PointDirection { xVariation: 80; yVariation: 80; }
+ size: 15
+ endSize: 300
+ anchors.centerIn: parent
+ }
+ ImageParticle {
+ system: sys
+ groups: ["meteor"]
+ sprites:[Sprite {
+ id: spinState
+ name: "spinning"
+ source: "../images/meteor.png"
+ frameCount: 35
+ frameDuration: 40
+ randomStart: true
+ to: {"explode":0, "spinning":1}
+ },Sprite {
+ name: "explode"
+ source: "../images/_explo.png"
+ frameCount: 22
+ frameDuration: 40
+ to: {"nullFrame":1}
+ },Sprite {//Not sure if this is needed, but seemed easiest
+ name: "nullFrame"
+ source: "../images/nullRock.png"
+ frameCount: 1
+ frameDuration: 1000
+ }
+ ]
+ }
+ SpriteGoal {
+ groups: ["meteor"]
+ system: sys
+ goalState: "explode"
+ jump: true
+ anchors.centerIn: holder//A bug in affectors currently isn't compensating for relative x,y. when that's fixed this can just anchors.fill: rocketShip
+ width: 60
+ height: 60
+ }
+ Image {
+ id: rocketShip
+ source: "../images/rocket.png"
+ smooth: true
+ anchors.centerIn: holder
+ rotation: (circle.percent+0.25) * 360
+ z: 2
+ }
+ Item {
+ id: holder
+ x: circle.x - Math.sin(circle.percent * 6.28316530714)*200
+ y: circle.y + Math.cos(circle.percent * 6.28316530714)*200
+ z: 1
+ }
+
+ Item {
+ id: circle
+ x: root.width / 1.2
+ y: root.height / 1.7
+ property real percent: 0
+
+ SequentialAnimation on percent {
+ id: circleAnim1
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation {
+ duration: 4000
+ from: 1
+ to: 0
+ }
+
+ }
+ }
+
+ ImageParticle {
+ z:0
+ system: sys
+ groups: ["exhaust"]
+ source: "../images/particle4.png"
+
+ color: "orange"
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation {
+ from: "red"
+ to: "cyan"
+ duration: 1000
+ }
+ ColorAnimation {
+ from: "cyan"
+ to: "red"
+ duration: 1000
+ }
+ }
+
+ colorVariation: 0.2
+ }
+
+ Emitter {
+ id: trailsNormal2
+ system: sys
+ group: "exhaust"
+
+ emitRate: 300
+ lifeSpan: 500
+
+ y: holder.y
+ x: holder.x
+
+ speed: PointDirection { xVariation: 40; yVariation: 40; }
+ speedFromMovement: 16
+
+ acceleration: PointDirection { xVariation: 10; yVariation: 10; }
+
+ size: 4
+ sizeVariation: 4
+ }
+}
diff --git a/examples/particles/affectors/turbulence.qml b/examples/particles/affectors/turbulence.qml
new file mode 100644
index 0000000000..f3ad13431f
--- /dev/null
+++ b/examples/particles/affectors/turbulence.qml
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ width: 360
+ height: 600
+ color: "#222222"
+ id: root
+ Image {
+ source: "../images/candle.png"
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottomMargin: -8
+ anchors.horizontalCenterOffset: 2
+ }
+ ParticleSystem {
+ id: ps
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: turb.enabled = !turb.enabled
+ }
+
+ Turbulence {
+ id: turb
+ system: ps
+ enabled: true
+ height: (parent.height / 2)
+ width: parent.width / 2
+ x: parent. width / 4
+ anchors.fill: parent
+ strength: 32
+ }
+
+ ImageParticle {
+ groups: ["smoke"]
+ system: ps
+ source: "../images/particle.png"
+ color: "#11111111"
+ colorVariation: 0
+ }
+ ImageParticle {
+ groups: ["flame"]
+ system: ps
+ source: "../images/particle.png"
+ color: "#11ff400f"
+ colorVariation: 0.1
+ }
+ Emitter {
+ anchors.centerIn: parent
+ system: ps
+ group: "flame"
+
+ emitRate: 120
+ lifeSpan: 1200
+ size: 20
+ endSize: 10
+ sizeVariation: 10
+ acceleration: PointDirection { y: -40 }
+ speed: AngleDirection { angle: 270; magnitude: 20; angleVariation: 22; magnitudeVariation: 5 }
+ }
+ TrailEmitter {
+ id: smoke1
+ width: root.width
+ height: root.height/2 - 20
+ system: ps
+ group: "smoke"
+ follow: "flame"
+
+ emitRatePerParticle: 1
+ lifeSpan: 2400
+ lifeSpanVariation: 400
+ size: 16
+ endSize: 8
+ sizeVariation: 8
+ acceleration: PointDirection { y: -40 }
+ speed: AngleDirection { angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 }
+ }
+ TrailEmitter {
+ id: smoke2
+ width: root.width
+ height: root.height/2 - 40
+ system: ps
+ group: "smoke"
+ follow: "flame"
+
+ emitRatePerParticle: 4
+ lifeSpan: 2400
+ size: 36
+ endSize: 24
+ sizeVariation: 12
+ acceleration: PointDirection { y: -40 }
+ speed: AngleDirection { angle: 270; magnitude: 40; angleVariation: 22; magnitudeVariation: 5 }
+ }
+}
diff --git a/examples/particles/affectors/wander.qml b/examples/particles/affectors/wander.qml
new file mode 100644
index 0000000000..ea008795c2
--- /dev/null
+++ b/examples/particles/affectors/wander.qml
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+import "../exampleslauncher/content" as UI
+
+Rectangle {
+ width: 360
+ height: 540
+ ParticleSystem { id: particles }
+ ImageParticle {
+ system: particles
+ sprites: Sprite {
+ name: "snow"
+ source: "../images/snowflake.png"
+ frameCount: 51
+ frameDuration: 40
+ frameDurationVariation: 8
+ }
+ }
+
+ Wander {
+ id: wanderer
+ system: particles
+ anchors.fill: parent
+ xVariance: 360/(wanderer.affectedParameter+1);
+ pace: 100*(wanderer.affectedParameter+1);
+ }
+
+ Emitter {
+ system: particles
+ emitRate: 20
+ lifeSpan: 7000
+ speed: PointDirection { y:80; yVariation: 40; }
+ acceleration: PointDirection { y: 4 }
+ size: 20
+ sizeVariation: 10
+ width: parent.width
+ height: 100
+ }
+ Row {
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ UI.Button {
+ text:"dx/dt"
+ onClicked: wanderer.affectedParameter = Wander.Position;
+ }
+ UI.Button {
+ text:"dv/dt"
+ onClicked: wanderer.affectedParameter = Wander.Velocity;
+ }
+ UI.Button {
+ text:"da/dt"
+ onClicked: wanderer.affectedParameter = Wander.Acceleration;
+ }
+ }
+}
diff --git a/examples/particles/customparticle/blurparticles.qml b/examples/particles/customparticle/blurparticles.qml
new file mode 100644
index 0000000000..3d72425655
--- /dev/null
+++ b/examples/particles/customparticle/blurparticles.qml
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "white"
+ width: 240
+ height: 360
+ ParticleSystem {
+ id: sys
+ }
+ Emitter {
+ system:sys
+ height: parent.height
+ emitRate: 1
+ lifeSpan: 12000
+ speed: PointDirection {x:20;}
+ size: 128
+ }
+ ShaderEffectSource {
+ id: theSource
+ sourceItem: theItem
+ hideSource: true
+ }
+ Image {
+ id: theItem
+ source: "../images/starfish_1.png"
+ }
+
+ CustomParticle {
+ system: sys
+ vertexShader:"
+ uniform lowp float qt_Opacity;
+ varying lowp float fFade;
+ varying lowp float fBlur;
+
+ void main() {
+ defaultMain();
+ highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y;
+ highp float fadeIn = min(t * 10., 1.);
+ highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+
+ fFade = fadeIn * fadeOut * qt_Opacity;
+ fBlur = max(0.2 * t, t * qt_ParticleR);
+ }
+ "
+ property variant source: theSource
+ property variant blurred: ShaderEffectSource {
+ smooth: true
+ sourceItem: ShaderEffect {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(0.0, 1.0 / height)
+ property variant source: ShaderEffectSource {
+ smooth: true
+ sourceItem: ShaderEffect {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(1.0 / width, 0.0)
+ property variant source: theSource
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform lowp float qt_Opacity;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
+ }"
+ }
+ }
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform lowp float qt_Opacity;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
+ }"
+ }
+ }
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform sampler2D blurred;
+ varying highp vec2 qt_TexCoord0;
+ varying highp float fBlur;
+ varying highp float fFade;
+ void main() {
+ gl_FragColor = mix(texture2D(source, qt_TexCoord0), texture2D(blurred, qt_TexCoord0), min(1.0,fBlur*3.0)) * fFade;
+ }"
+
+ }
+}
+
diff --git a/examples/particles/customparticle/fragmentshader.qml b/examples/particles/customparticle/fragmentshader.qml
new file mode 100644
index 0000000000..34acb1bd7c
--- /dev/null
+++ b/examples/particles/customparticle/fragmentshader.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+ParticleSystem {
+ id: root
+ width: 1024
+ height: 768
+ Rectangle {
+ z: -1
+ anchors.fill: parent
+ color: "black"
+ Text {
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.pixelSize: 36
+ color: "white"
+ text: "It's all in the fragment shader."
+ }
+ }
+
+ Emitter {
+ emitRate: 400
+ lifeSpan: 8000
+ size: 24
+ sizeVariation: 16
+ speed: PointDirection {x: root.width/10; y: root.height/10;}
+ //acceleration: AngledDirection {angle:225; magnitude: root.width/36; angleVariation: 45; magnitudeVariation: 80}
+ acceleration: PointDirection {x: -root.width/40; y: -root.height/40; xVariation: -root.width/20; yVariation: -root.width/20}
+ }
+
+ CustomParticle {
+ vertexShader:"
+ uniform lowp float qt_Opacity;
+ varying lowp float fFade;
+ varying highp vec2 fPos;
+
+ void main() {
+ qt_TexCoord0 = qt_ParticleTex;
+ highp float size = qt_ParticleData.z;
+ highp float endSize = qt_ParticleData.w;
+
+ highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y;
+
+ highp float currentSize = mix(size, endSize, t * t);
+
+ if (t < 0. || t > 1.)
+ currentSize = 0.;
+
+ highp vec2 pos = qt_ParticlePos
+ - currentSize / 2. + currentSize * qt_ParticleTex // adjust size
+ + qt_ParticleVec.xy * t * qt_ParticleData.y // apply speed vector..
+ + 0.5 * qt_ParticleVec.zw * pow(t * qt_ParticleData.y, 2.);
+
+ gl_Position = qt_Matrix * vec4(pos.x, pos.y, 0, 1);
+
+ highp float fadeIn = min(t * 20., 1.);
+ highp float fadeOut = 1. - max(0., min((t - 0.75) * 4., 1.));
+
+ fFade = fadeIn * fadeOut * qt_Opacity;
+ fPos = vec2(pos.x/1024., pos.y/768.);
+ }
+ "
+ fragmentShader: "
+ varying highp vec2 fPos;
+ varying lowp float fFade;
+ varying highp vec2 qt_TexCoord0;
+ void main() {//*2 because this generates dark colors mostly
+ highp vec2 circlePos = qt_TexCoord0*2.0 - vec2(1.0,1.0);
+ highp float dist = length(circlePos);
+ highp float circleFactor = max(min(1.0 - dist, 1.0), 0.0);
+ gl_FragColor = vec4(fPos.x*2.0 - fPos.y, fPos.y*2.0 - fPos.x, fPos.x*fPos.y*2.0, 0.0) * circleFactor * fFade;
+ }"
+
+ }
+}
diff --git a/examples/particles/customparticle/imagecolors.qml b/examples/particles/customparticle/imagecolors.qml
new file mode 100644
index 0000000000..94e5123a0c
--- /dev/null
+++ b/examples/particles/customparticle/imagecolors.qml
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ width: 400
+ height: 400
+ Rectangle {
+ id: root
+ color: "white"
+ width: 310
+ height: 300
+ anchors.centerIn: parent
+ ParticleSystem { id: sys }
+ CustomParticle {
+ system: sys
+ property real maxWidth: root.width
+ property real maxHeight: root.height
+ ShaderEffectSource {
+ id: pictureSource
+ sourceItem: picture
+ hideSource: true
+ }
+ Image {
+ id: picture
+ source: "../images/starfish_3.png"
+ }
+ ShaderEffectSource {
+ id: particleSource
+ sourceItem: particle
+ hideSource: true
+ }
+ Image {
+ id: particle
+ source: "../images/particle4.png"
+ }
+ vertexShader:"
+ uniform highp float maxWidth;
+ uniform highp float maxHeight;
+ varying highp vec2 fTex2;
+ varying lowp float fFade;
+ uniform lowp float qt_Opacity;
+
+ void main() {
+ fTex2 = vec2(qt_ParticlePos.x / maxWidth, qt_ParticlePos.y / maxHeight);
+ highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y;
+ fFade = min(t*4., (1.-t*t)*.75) * qt_Opacity;
+ defaultMain();
+ }
+ "
+ property variant particleTexture: particleSource
+ property variant pictureTexture: pictureSource
+ fragmentShader: "
+ uniform sampler2D particleTexture;
+ uniform sampler2D pictureTexture;
+ varying highp vec2 qt_TexCoord0;
+ varying highp vec2 fTex2;
+ varying lowp float fFade;
+ void main() {
+ gl_FragColor = texture2D(pictureTexture, fTex2) * texture2D(particleTexture, qt_TexCoord0).w * fFade;
+ }"
+ }
+
+ Emitter {
+ id: emitter
+ system: sys
+ enabled: false
+ lifeSpan: 8000
+ maximumEmitted: 4000
+ anchors.fill: parent
+ size: 16
+ acceleration: PointDirection { xVariation: 12; yVariation: 12 }
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: emitter.burst(4000);
+ }
+ }
+}
diff --git a/examples/particles/emitters/burstandpulse.qml b/examples/particles/emitters/burstandpulse.qml
new file mode 100644
index 0000000000..1b1c2a60c9
--- /dev/null
+++ b/examples/particles/emitters/burstandpulse.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ width: 360
+ height: 540
+ color: "black"
+ MouseArea {
+ id: ma
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: {
+ if (mouse.button == Qt.LeftButton)
+ emitter.burst(1000);
+ else
+ emitter.pulse(500);
+ }
+ }
+
+ ParticleSystem {
+ id: particles
+ }
+
+ ImageParticle {
+ anchors.fill: parent
+ system: particles
+ source: "../images/star.png"
+ alpha: 0
+ colorVariation: 0.6
+ }
+
+ Emitter {
+ id: emitter
+ x: ma.mouseX
+ y: ma.mouseY
+ system: particles
+ emitRate: 2000
+ lifeSpan: 2000
+ enabled: false
+ speed: AngleDirection{magnitude: 64; angleVariation: 360}
+ size: 24
+ sizeVariation: 8
+ }
+}
diff --git a/examples/particles/emitters/customemitter.qml b/examples/particles/emitters/customemitter.qml
new file mode 100644
index 0000000000..757c836106
--- /dev/null
+++ b/examples/particles/emitters/customemitter.qml
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+ParticleSystem {
+ id: sys
+ width: 360
+ height: 600
+ running: true
+ Rectangle {
+ z: -1
+ anchors.fill: parent
+ color: "black"
+ }
+
+ property real petalLength: 180
+ property real petalRotation: 0
+ NumberAnimation on petalRotation {
+ from: 0;
+ to: 360;
+ loops: -1;
+ running: true
+ duration: 24000
+ }
+
+ function convert(a) {return a*(Math.PI/180);}
+ Emitter {
+ lifeSpan: 4000
+ emitRate: 120
+ size: 12
+ anchors.centerIn: parent
+ onEmitParticles: {
+ for (var i=0; i<particles.length; i++) {
+ var particle = particles[i];
+ particle.startSize = Math.max(02,Math.min(492,Math.tan(particle.t/2)*24));
+ var theta = Math.floor(Math.random() * 6.0) / 6.0;
+ theta *= 2.0*Math.PI;
+ theta += sys.convert(sys.petalRotation);
+ particle.initialVX = petalLength * Math.cos(theta);
+ particle.initialVY = petalLength * Math.sin(theta);
+ particle.initialAX = particle.initialVX * -0.5;
+ particle.initialAY = particle.initialVY * -0.5;
+ }
+ }
+ }
+
+ ImageParticle {
+ source: "../images/particle4.png"
+ alpha: 0.0
+ redVariation: 0.6
+ color: "white"
+ }
+}
diff --git a/examples/particles/emitters/emitmask.qml b/examples/particles/emitters/emitmask.qml
new file mode 100644
index 0000000000..9c02f6a213
--- /dev/null
+++ b/examples/particles/emitters/emitmask.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "goldenrod"
+ width: 400
+ height: 400
+ ParticleSystem {
+ width: 300
+ height: 300
+ anchors.centerIn: parent
+
+ ImageParticle {
+ source: "../images/particle.png"
+ z: 2
+ anchors.fill: parent
+ color: "#336666CC"
+ colorVariation: 0.0
+ }
+
+ Emitter {
+ anchors.fill: parent
+ emitRate: 6000
+ lifeSpan: 720
+ size: 10
+ shape: MaskShape {
+ source: "../images/starfish_mask.png"
+ }
+ }
+
+ }
+}
diff --git a/examples/particles/emitters/maximumemitted.qml b/examples/particles/emitters/maximumemitted.qml
new file mode 100644
index 0000000000..6dbdf8db61
--- /dev/null
+++ b/examples/particles/emitters/maximumemitted.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "black"
+ width: 360
+ height: 540
+ ParticleSystem {
+ id: sys
+ onEmptyChanged: if (empty) sys.pause();
+ }
+
+ ImageParticle {
+ system: sys
+ id: cp
+ source: "../images/particle.png"
+ colorVariation: 0.4
+ color: "#000000FF"
+ }
+
+ Emitter {
+ //burst on click
+ id: bursty
+ system: sys
+ enabled: ma.pressed
+ x: ma.mouseX
+ y: ma.mouseY
+ emitRate: 16000
+ maximumEmitted: 4000
+ acceleration: AngleDirection {angleVariation: 360; magnitude: 360; }
+ size: 8
+ endSize: 16
+ sizeVariation: 4
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onPressed: sys.resume()
+ id: ma
+ }
+}
diff --git a/examples/particles/emitters/shapeanddirection.qml b/examples/particles/emitters/shapeanddirection.qml
new file mode 100644
index 0000000000..43623427b6
--- /dev/null
+++ b/examples/particles/emitters/shapeanddirection.qml
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ id: root
+ width: 360
+ height: 540
+ color: "black"
+ Image {
+ anchors.fill: parent
+ source: "../images/portal_bg.png"
+ }
+
+ ParticleSystem {
+ id: particles
+ }
+
+ ImageParticle {
+ groups: ["center","edge"]
+ anchors.fill: parent
+ system: particles
+ source: "../images/particle.png"
+ colorVariation: 0.1
+ color: "#009999FF"
+ }
+
+ Emitter {
+ anchors.fill: parent
+ group: "center"
+ system: particles
+ emitRate: 400
+ lifeSpan: 2000
+ size: 20
+ sizeVariation: 2
+ endSize: 0
+ shape: EllipseShape {fill: false}
+ speed: TargetDirection {
+ targetX: root.width/2
+ targetY: root.height/2
+ proportionalMagnitude: true
+ magnitude: 0.5
+ }
+ }
+
+ Emitter {
+ anchors.fill: parent
+ group: "edge"
+ startTime: 2000
+ system: particles
+ emitRate: 2000
+ lifeSpan: 2000
+ size: 28
+ sizeVariation: 2
+ endSize: 16
+ shape: EllipseShape {fill: false}
+ speed: TargetDirection {
+ targetX: root.width/2
+ targetY: root.height/2
+ proportionalMagnitude: true
+ magnitude: 0.1
+ magnitudeVariation: 0.1
+ }
+ acceleration: TargetDirection {
+ targetX: root.width/2
+ targetY: root.height/2
+ targetVariation: 200
+ proportionalMagnitude: true
+ magnitude: 0.1
+ magnitudeVariation: 0.1
+ }
+ }
+}
diff --git a/examples/particles/emitters/timedgroupchanges.qml b/examples/particles/emitters/timedgroupchanges.qml
new file mode 100644
index 0000000000..699e7eb066
--- /dev/null
+++ b/examples/particles/emitters/timedgroupchanges.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ width: 360
+ height: 600
+ color: "black"
+ ParticleSystem {
+ anchors.fill: parent
+ id: syssy
+ ParticleGroup {
+ name: "fire"
+ duration: 2000
+ durationVariation: 2000
+ to: {"splode":1}
+ }
+ ParticleGroup {
+ name: "splode"
+ duration: 400
+ to: {"dead":1}
+ TrailEmitter {
+ group: "works"
+ emitRatePerParticle: 100
+ lifeSpan: 1000
+ maximumEmitted: 1200
+ size: 8
+ speed: AngleDirection {angle: 270; angleVariation: 45; magnitude: 20; magnitudeVariation: 20;}
+ acceleration: PointDirection {y:100; yVariation: 20}
+ }
+ }
+ ParticleGroup {
+ name: "dead"
+ duration: 1000
+ Affector {
+ once: true
+ onAffected: worksEmitter.burst(400,x,y)
+ }
+ }
+
+ Timer {
+ interval: 6000
+ running: true
+ triggeredOnStart: true
+ repeat: true
+ onTriggered:startingEmitter.pulse(100);
+ }
+ Emitter {
+ id: startingEmitter
+ group: "fire"
+ width: parent.width
+ y: parent.height
+ enabled: false
+ emitRate: 80
+ lifeSpan: 6000
+ speed: PointDirection {y:-100;}
+ size: 32
+ }
+
+ Emitter {
+ id: worksEmitter
+ group: "works"
+ enabled: false
+ emitRate: 100
+ lifeSpan: 1600
+ maximumEmitted: 6400
+ size: 8
+ speed: CumulativeDirection {
+ PointDirection {y:-100}
+ AngleDirection {angleVariation: 360; magnitudeVariation: 80;}
+ }
+ acceleration: PointDirection {y:100; yVariation: 20}
+ }
+
+ ImageParticle {
+ groups: ["works", "fire", "splode"]
+ source: "../images/particle.png"
+ entryEffect: ImageParticle.Scale
+ }
+ }
+}
+
diff --git a/examples/particles/emitters/trailemitter.qml b/examples/particles/emitters/trailemitter.qml
new file mode 100644
index 0000000000..e896329ca1
--- /dev/null
+++ b/examples/particles/emitters/trailemitter.qml
@@ -0,0 +1,175 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ id: root
+ width: 360
+ height: 540
+ color: "black"
+
+ ParticleSystem {
+ id: particles
+ }
+
+ ImageParticle {
+ id: smoke
+ system: particles
+ anchors.fill: parent
+ groups: ["A", "B"]
+ source: "../images/particle.png"
+ colorVariation: 0
+ color: "#00111111"
+ }
+ ImageParticle {
+ id: flame
+ anchors.fill: parent
+ system: particles
+ groups: ["C", "D"]
+ source: "../images/particle.png"
+ colorVariation: 0.1
+ color: "#00ff400f"
+ }
+
+ Emitter {
+ id: fire
+ system: particles
+ group: "C"
+
+ y: parent.height
+ width: parent.width
+
+ emitRate: 350
+ lifeSpan: 3500
+
+ acceleration: PointDirection { y: -17; xVariation: 3 }
+ speed: PointDirection {xVariation: 3}
+
+ size: 24
+ sizeVariation: 8
+ endSize: 4
+ }
+
+ TrailEmitter {
+ id: fireSmoke
+ group: "B"
+ system: particles
+ follow: "C"
+ width: root.width
+ height: root.height - 68
+
+ emitRatePerParticle: 1
+ lifeSpan: 2000
+
+ speed: PointDirection {y:-17*6; yVariation: -17; xVariation: 3}
+ acceleration: PointDirection {xVariation: 3}
+
+ size: 36
+ sizeVariation: 8
+ endSize: 16
+ }
+
+ TrailEmitter {
+ id: fireballFlame
+ anchors.fill: parent
+ system: particles
+ group: "D"
+ follow: "E"
+
+ emitRatePerParticle: 120
+ lifeSpan: 180
+ emitWidth: TrailEmitter.ParticleSize
+ emitHeight: TrailEmitter.ParticleSize
+ emitShape: EllipseShape{}
+
+ size: 16
+ sizeVariation: 4
+ endSize: 4
+ }
+
+ TrailEmitter {
+ id: fireballSmoke
+ anchors.fill: parent
+ system: particles
+ group: "A"
+ follow: "E"
+
+ emitRatePerParticle: 128
+ lifeSpan: 2400
+ emitWidth: TrailEmitter.ParticleSize
+ emitHeight: TrailEmitter.ParticleSize
+ emitShape: EllipseShape{}
+
+ speed: PointDirection {yVariation: 16; xVariation: 16}
+ acceleration: PointDirection {y: -16}
+
+ size: 24
+ sizeVariation: 8
+ endSize: 8
+ }
+
+ Emitter {
+ id: balls
+ system: particles
+ group: "E"
+
+ y: parent.height
+ width: parent.width
+
+ emitRate: 2
+ lifeSpan: 7000
+
+ speed: PointDirection {y:-17*4*2; xVariation: 6*6}
+ acceleration: PointDirection {y: 17*2; xVariation: 6*6}
+
+ size: 8
+ sizeVariation: 4
+ }
+
+ Turbulence { //A bit of turbulence makes the smoke look better
+ anchors.fill: parent
+ groups: ["A","B"]
+ strength: 32
+ system: particles
+ }
+}
+
diff --git a/examples/particles/emitters/velocityfrommotion.qml b/examples/particles/emitters/velocityfrommotion.qml
new file mode 100644
index 0000000000..7ad2b4d6c4
--- /dev/null
+++ b/examples/particles/emitters/velocityfrommotion.qml
@@ -0,0 +1,311 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+
+ id: root
+
+ height: 540
+ width: 360
+
+ gradient: Gradient {
+ GradientStop { position: 0; color: "#000020" }
+ GradientStop { position: 1; color: "#000000" }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: root
+ }
+
+ ParticleSystem { id: sys1 }
+ ImageParticle {
+ system: sys1
+ source: "../images/particle.png"
+ color: "cyan"
+ alpha: 0
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation {
+ from: "cyan"
+ to: "magenta"
+ duration: 1000
+ }
+ ColorAnimation {
+ from: "magenta"
+ to: "blue"
+ duration: 2000
+ }
+ ColorAnimation {
+ from: "blue"
+ to: "violet"
+ duration: 2000
+ }
+ ColorAnimation {
+ from: "violet"
+ to: "cyan"
+ duration: 2000
+ }
+ }
+ colorVariation: 0.3
+ }
+ Emitter {
+ id: trailsNormal
+ system: sys1
+
+ emitRate: 500
+ lifeSpan: 2000
+
+
+ y: mouseArea.pressed ? mouseArea.mouseY : circle.cy
+ x: mouseArea.pressed ? mouseArea.mouseX : circle.cx
+
+ speed: PointDirection {xVariation: 4; yVariation: 4;}
+ acceleration: PointDirection {xVariation: 10; yVariation: 10;}
+ speedFromMovement: 8
+
+ size: 8
+ sizeVariation: 4
+ }
+ ParticleSystem { id: sys2 }
+ ImageParticle {
+ color: "cyan"
+ system: sys2
+ alpha: 0
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation {
+ from: "magenta"
+ to: "cyan"
+ duration: 1000
+ }
+ ColorAnimation {
+ from: "cyan"
+ to: "magenta"
+ duration: 2000
+ }
+ }
+ colorVariation: 0.5
+ source: "../images/star.png"
+ }
+ Emitter {
+ id: trailsStars
+ system: sys2
+
+ emitRate: 100
+ lifeSpan: 2200
+
+
+ y: mouseArea.pressed ? mouseArea.mouseY : circle.cy
+ x: mouseArea.pressed ? mouseArea.mouseX : circle.cx
+
+ speed: PointDirection {xVariation: 4; yVariation: 4;}
+ acceleration: PointDirection {xVariation: 10; yVariation: 10;}
+ speedFromMovement: 8
+
+ size: 22
+ sizeVariation: 4
+ }
+ ParticleSystem { id: sys3; }
+ ImageParticle {
+ source: "../images/particle.png"
+ system: sys3
+ color: "orange"
+ alpha: 0
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation {
+ from: "red"
+ to: "green"
+ duration: 2000
+ }
+ ColorAnimation {
+ from: "green"
+ to: "red"
+ duration: 2000
+ }
+ }
+
+ colorVariation: 0.2
+
+ }
+ Emitter {
+ id: trailsNormal2
+ system: sys3
+
+ emitRate: 300
+ lifeSpan: 2000
+
+ y: mouseArea.pressed ? mouseArea.mouseY : circle2.cy
+ x: mouseArea.pressed ? mouseArea.mouseX : circle2.cx
+
+ speedFromMovement: 16
+
+ speed: PointDirection {xVariation: 4; yVariation: 4;}
+ acceleration: PointDirection {xVariation: 10; yVariation: 10;}
+
+ size: 12
+ sizeVariation: 4
+ }
+ ParticleSystem { id: sys4; }
+ ImageParticle {
+ system: sys4
+ source: "../images/star.png"
+ color: "green"
+ alpha: 0
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation {
+ from: "green"
+ to: "red"
+ duration: 2000
+ }
+ ColorAnimation {
+ from: "red"
+ to: "green"
+ duration: 2000
+ }
+ }
+
+ colorVariation: 0.5
+ }
+ Emitter {
+ id: trailsStars2
+ system: sys4
+
+ emitRate: 50
+ lifeSpan: 2200
+
+
+ y: mouseArea.pressed ? mouseArea.mouseY : circle2.cy
+ x: mouseArea.pressed ? mouseArea.mouseX : circle2.cx
+
+ speedFromMovement: 16
+ speed: PointDirection {xVariation: 2; yVariation: 2;}
+ acceleration: PointDirection {xVariation: 10; yVariation: 10;}
+
+ size: 22
+ sizeVariation: 4
+ }
+
+
+
+ color: "white"
+
+ Item {
+ id: circle
+ //anchors.fill: parent
+ property real radius: 0
+ property real dx: root.width / 2
+ property real dy: root.height / 2
+ property real cx: radius * Math.sin(percent*6.283185307179) + dx
+ property real cy: radius * Math.cos(percent*6.283185307179) + dy
+ property real percent: 0
+
+ SequentialAnimation on percent {
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation {
+ duration: 1000
+ from: 1
+ to: 0
+ loops: 8
+ }
+ NumberAnimation {
+ duration: 1000
+ from: 0
+ to: 1
+ loops: 8
+ }
+
+ }
+
+ SequentialAnimation on radius {
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation {
+ duration: 4000
+ from: 0
+ to: 100
+ }
+ NumberAnimation {
+ duration: 4000
+ from: 100
+ to: 0
+ }
+ }
+ }
+
+ Item {
+ id: circle3
+ property real radius: 100
+ property real dx: root.width / 2
+ property real dy: root.height / 2
+ property real cx: radius * Math.sin(percent*6.283185307179) + dx
+ property real cy: radius * Math.cos(percent*6.283185307179) + dy
+ property real percent: 0
+
+ SequentialAnimation on percent {
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation { from: 0.0; to: 1 ; duration: 10000; }
+ }
+ }
+
+ Item {
+ id: circle2
+ property real radius: 30
+ property real dx: circle3.cx
+ property real dy: circle3.cy
+ property real cx: radius * Math.sin(percent*6.283185307179) + dx
+ property real cy: radius * Math.cos(percent*6.283185307179) + dy
+ property real percent: 0
+
+ SequentialAnimation on percent {
+ loops: Animation.Infinite
+ running: true
+ NumberAnimation { from: 0.0; to: 1 ; duration: 1000; }
+ }
+ }
+
+}
diff --git a/examples/particles/exampleslauncher/content/Button.qml b/examples/particles/exampleslauncher/content/Button.qml
new file mode 100644
index 0000000000..e51a9be003
--- /dev/null
+++ b/examples/particles/exampleslauncher/content/Button.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+
+ property string text: "Button"
+ signal clicked
+
+ width: buttonLabel.width + 20; height: buttonLabel.height + 20
+ smooth: true
+ property color myCol: "#999999"
+ border { width: 1; color: Qt.darker(myCol) }
+ radius: 8
+
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: {
+ if (mouseArea.pressed)
+ return Qt.darker(myCol)
+ else
+ return Qt.lighter(myCol)
+ }
+ }
+ GradientStop { position: 1.0; color: myCol }
+ }
+
+ MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() }
+
+ Text {
+ id: buttonLabel; text: container.text; anchors.centerIn: container; color: "black"; font.pixelSize: 24
+ }
+}
diff --git a/examples/particles/exampleslauncher/content/Shell.qml b/examples/particles/exampleslauncher/content/Shell.qml
new file mode 100644
index 0000000000..afab77485f
--- /dev/null
+++ b/examples/particles/exampleslauncher/content/Shell.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Loader {
+ id: ldr
+ visible: false
+ focus: visible
+ onVisibleChanged: source = ""
+ opacity: visible?1:0
+ Behavior on opacity {NumberAnimation {}}
+
+ function setDemo(str) {
+ visible = true;
+ source = str;
+ }
+ Image {//TODO: Augment with PARTICLES
+ z: 1
+ source: "../../images/launcherIcons/close.png"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: ldr.visible = false;
+ }
+ }
+ Rectangle {
+ z: -1
+ anchors.fill: parent
+ color:"black"
+ Text {
+ color: "white"
+ anchors.centerIn: parent
+ text: ldr.Status == Loader.Error ? "Error :(" : "Loading..."
+ }
+ MouseArea {
+ id: graball
+ anchors.fill: parent
+ onClicked:;
+ }
+ }
+}
diff --git a/examples/particles/exampleslauncher/content/launcher.js b/examples/particles/exampleslauncher/content/launcher.js
new file mode 100644
index 0000000000..a296dbd6a6
--- /dev/null
+++ b/examples/particles/exampleslauncher/content/launcher.js
@@ -0,0 +1,8 @@
+function nameFromPath(path){
+ var ret = path.split('/');
+ return ret[ret.length-1].split('.')[0];
+}
+function iconFromPath(path){
+ var ret = path.split('/');
+ return "../images/launcherIcons/" + ret[ret.length-1].split('.')[0] + ".png";
+}
diff --git a/examples/particles/exampleslauncher/exampleslauncher.qml b/examples/particles/exampleslauncher/exampleslauncher.qml
new file mode 100644
index 0000000000..22914343ba
--- /dev/null
+++ b/examples/particles/exampleslauncher/exampleslauncher.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+import "content/launcher.js" as Util
+import "content"
+
+Rectangle {
+ color: "black"
+ width: 360
+ height: 600
+ Shell {
+ z: 1
+ id: shell
+ anchors.fill: parent
+ }
+
+ VisualDataModel {//TODO: Transitions between modes (and a second mode...)
+ id: vdm
+ model: [
+ "../../affectors/attractor.qml",
+ "../../affectors/customaffector.qml",
+ "../../affectors/groupgoal.qml",
+ "../../affectors/spritegoal.qml",
+ "../../affectors/turbulence.qml",
+ "../../affectors/wander.qml",
+ "../../customparticle/blurparticles.qml",
+ "../../customparticle/fragmentshader.qml",
+ "../../customparticle/imagecolors.qml",
+ "../../emitters/customemitter.qml",
+ "../../emitters/emitmask.qml",
+ "../../emitters/maximumemitted.qml",
+ "../../emitters/shapeanddirection.qml",
+ "../../emitters/timedgroupchanges.qml",
+ "../../emitters/trailemitter.qml",
+ "../../emitters/velocityfrommotion.qml",
+ "../../imageparticle/allatonce.qml",
+ "../../imageparticle/colortable.qml",
+ "../../imageparticle/deformation.qml",
+ "../../imageparticle/rotation.qml",
+ "../../imageparticle/sprites.qml",
+ "../../itemparticle/delegates.qml",
+ "../../itemparticle/particleview.qml",
+ "../../simple/dynamicemitters.qml",
+ "../../simple/multiplepainters.qml",
+ "../../simple/startstop.qml",
+ "../../plasmapatrol/plasmapatrol.qml"
+ ]
+ delegate: Rectangle {
+ color: "white"
+ width: 96
+ height: 96
+ Image {
+ width: 72
+ height: 72
+ anchors.centerIn: parent
+ source: Util.iconFromPath(modelData)
+ }
+ Text {
+ text: Util.nameFromPath(modelData)
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ font.pixelSize: 8
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: shell.setDemo(modelData)
+ }
+ }
+ }
+
+ GridView {
+ anchors.fill: parent
+ cellWidth: 120
+ cellHeight: 120
+ model: vdm
+ }
+}
diff --git a/examples/particles/imageparticle/allatonce.qml b/examples/particles/imageparticle/allatonce.qml
new file mode 100644
index 0000000000..b62735d7f9
--- /dev/null
+++ b/examples/particles/imageparticle/allatonce.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "white"
+ width: 640
+ height: 480
+ ParticleSystem {
+ id: sys
+ }
+
+ ImageParticle {
+ sprites: [
+ Sprite {
+ name: "bear"
+ source: "../images/bear_tiles.png"
+ frameCount: 13
+ frameDuration: 120
+ }
+ ]
+ colorVariation: 0.5
+ rotationSpeedVariation: 360
+ system: sys
+ colorTable: "../trails/../images/colortable.png"
+ }
+
+ Friction {
+ factor: 0.1
+ system: sys
+ }
+
+ Emitter {
+ system: sys
+ anchors.centerIn: parent
+ id: particles
+ emitRate: 200
+ lifeSpan: 6000
+ speed: AngleDirection {angleVariation: 360; magnitude: 80; magnitudeVariation: 40}
+ size: 60
+ endSize: 120
+ }
+
+ Text {
+ x: 16
+ y: 16
+ text: "QML..."
+ style: Text.Outline; styleColor: "#AAAAAA"
+ font.pixelSize: 32
+ }
+ Text {
+ anchors.bottom: parent.bottom
+ anchors.right: parent.right
+ anchors.margins: 16
+ text: "... can you be trusted with the power?"
+ style: Text.Outline; styleColor: "#AAAAAA"
+ font.pixelSize: width > 400 ? 32 : 16
+ }
+}
diff --git a/examples/particles/imageparticle/colored.qml b/examples/particles/imageparticle/colored.qml
new file mode 100644
index 0000000000..ac760b6219
--- /dev/null
+++ b/examples/particles/imageparticle/colored.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ width: 360
+ height: 540
+ color: "black"
+ ParticleSystem {
+ anchors.fill: parent
+ ImageParticle {
+ groups: ["stars"]
+ anchors.fill: parent
+ source: "../images/star.png"
+ }
+ Emitter {
+ group: "stars"
+ emitRate: 800
+ lifeSpan: 2400
+ size: 24
+ sizeVariation: 8
+ anchors.fill: parent
+ }
+
+ ImageParticle {
+ anchors.fill: parent
+ source: "../images/star.png"
+ alpha: 0
+ alphaVariation: 0.2
+ colorVariation: 1.0
+ }
+
+ Emitter {
+ anchors.centerIn: parent
+ emitRate: 400
+ lifeSpan: 2400
+ size: 48
+ sizeVariation: 8
+ speed: AngleDirection {angleVariation: 180; magnitude: 60}
+ }
+
+ Turbulence {
+ anchors.fill: parent
+ strength: 2
+ }
+ }
+}
diff --git a/examples/particles/imageparticle/colortable.qml b/examples/particles/imageparticle/colortable.qml
new file mode 100644
index 0000000000..623029dae0
--- /dev/null
+++ b/examples/particles/imageparticle/colortable.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick.Particles 2.0
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ width: 360
+ height: 540
+ color: "black"
+
+ ParticleSystem { id: particles }
+
+ ImageParticle {
+ system: particles
+ colorVariation: 0.5
+ alpha: 0
+
+ source: "../images/particle.png"
+ colorTable: "../images/colortable.png"
+ sizeTable: "../images/colortable.png"
+ }
+
+ Emitter {
+ system: particles
+ emitRate: 500
+ lifeSpan: 2000
+
+ y: root.height / 2 + Math.sin(t * 2) * root.height * 0.3
+ x: root.width / 2 + Math.cos(t) * root.width * 0.3
+ property real t;
+
+ NumberAnimation on t {
+ from: 0; to: Math.PI * 2; duration: 10000; loops: Animation.Infinite
+ }
+
+ speedFromMovement: 20
+
+ speed: PointDirection { xVariation: 5; yVariation: 5;}
+ acceleration: PointDirection { xVariation: 5; yVariation: 5;}
+
+ size: 16
+ //endSize: 8
+ //sizeVariation: 8
+ }
+}
diff --git a/examples/particles/imageparticle/deformation.qml b/examples/particles/imageparticle/deformation.qml
new file mode 100644
index 0000000000..e282927e78
--- /dev/null
+++ b/examples/particles/imageparticle/deformation.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "goldenrod"
+ width: 400
+ height: 400
+ ParticleSystem {id:sys}
+
+ ImageParticle {
+ system: sys
+ groups: ["goingLeft", "goingRight"]
+ source: "../images/starfish_4.png"
+ rotation: 90
+ rotationSpeed: 90
+ autoRotation: true
+ }
+ ImageParticle {
+ system: sys
+ groups: ["goingDown"]
+ source: "../images/starfish_0.png"
+ rotation: 180
+ yVector: PointDirection { y: 0.5; yVariation: 0.25; xVariation: 0.25; }
+ }
+
+ Timer {
+ running: true
+ repeat: false
+ interval: 100
+ onTriggered: emitA.enabled = true;
+ }
+ Timer {
+ running: true
+ repeat: false
+ interval: 4200
+ onTriggered: emitB.enabled = true;
+ }
+ Timer {
+ running: true
+ repeat: false
+ interval: 8400
+ onTriggered: emitC.enabled = true;
+ }
+
+ Emitter {
+ id: emitA
+ x: 0
+ y: 120
+ system: sys
+ enabled: false
+ group: "goingRight"
+ speed: PointDirection { x: 100 }
+ lifeSpan: 4000
+ emitRate: 1
+ size: 128
+ }
+ Emitter {
+ id: emitB
+ x: 400
+ y: 240
+ system: sys
+ enabled: false
+ group: "goingLeft"
+ speed: PointDirection { x: -100 }
+ lifeSpan: 4000
+ emitRate: 1
+ size: 128
+ }
+ Emitter {
+ id: emitC
+ x: 0
+ y: 360
+ system: sys
+ enabled: false
+ group: "goingDown"
+ speed: PointDirection { x: 100 }
+ lifeSpan: 4000
+ emitRate: 1
+ size: 128
+ }
+}
diff --git a/examples/particles/imageparticle/rotation.qml b/examples/particles/imageparticle/rotation.qml
new file mode 100644
index 0000000000..3a75c379ed
--- /dev/null
+++ b/examples/particles/imageparticle/rotation.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "goldenrod"
+ width: 2000
+ height: 2000
+ ParticleSystem {id: sys}
+ ImageParticle {
+ id: up
+ system: sys
+ source: "../images/starfish_2.png"
+ }
+
+ Emitter {
+ anchors.centerIn: parent
+ system: sys
+ emitRate: 10
+ size: 200
+ lifeSpan: 10000
+ speed: AngleDirection {angleVariation: 360; magnitudeVariation: 100;}
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ up.autoRotation = !up.autoRotation
+ up.rotation = up.autoRotation ? -90 : 0
+ }
+ }
+}
diff --git a/examples/particles/imageparticle/sharing.qml b/examples/particles/imageparticle/sharing.qml
new file mode 100644
index 0000000000..27e08322d9
--- /dev/null
+++ b/examples/particles/imageparticle/sharing.qml
@@ -0,0 +1,199 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This example shows how to create your own highlight delegate for a ListView
+// that uses a SpringAnimation to provide custom movement when the
+// highlight bar is moved between items.
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ property real delegateHeight: 65
+ width: 200; height: 300
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#EEEEFF" }
+ GradientStop { position: 1.0; color: "lightblue" }
+ }
+
+ // Define a delegate component. A component will be
+ // instantiated for each visible item in the list.
+ Component {
+ id: petDelegate
+ Item {
+ id: wrapper
+ width: 200; height: delegateHeight
+ z: 10
+ Column {
+ Text {color: "white"; text: name; font.pixelSize: 18 }
+ Text {color: "white"; text: 'Type: ' + type; font.pixelSize: 14 }
+ Text {color: "white"; text: 'Age: ' + age; font.pixelSize: 14 }
+ }
+ // indent the item if it is the current item
+ states: State {
+ name: "Current"
+ when: wrapper.ListView.isCurrentItem
+ PropertyChanges { target: wrapper; x: 20 }
+ }
+ transitions: Transition {
+ NumberAnimation { properties: "x"; duration: 200 }
+ }
+ }
+ }
+
+ // Define a highlight with customised movement between items.
+ Component {
+ id: highlightBar
+ Rectangle {
+ z: 0
+ width: 200; height: delegateHeight
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#99FF99" }
+ GradientStop { position: 1.0; color: "#88FF88" }
+ }
+ y: listView.currentItem.y;
+ Behavior on y { SpringAnimation { spring: 2; damping: 0.2 } }
+ ImageParticle {
+ anchors.fill: parent
+ system: particles
+ source: "../images/flower.png"
+ color: "red"
+ clip: true
+ alpha: 1.0
+ }
+ }
+ }
+
+ ListView {
+ id: listView
+ width: 200; height: parent.height
+
+ model: petsModel
+ delegate: petDelegate
+ focus: true
+
+ // Set the highlight delegate. Note we must also set highlightFollowsCurrentItem
+ // to false so the highlight delegate can control how the highlight is moved.
+ highlight: highlightBar
+ highlightFollowsCurrentItem: false
+
+ ParticleSystem { id: particles }
+ Emitter {
+ system: particles
+ anchors.fill: parent
+ emitRate: 1
+ lifeSpan: 10000
+ size: 24
+ sizeVariation: 8
+ speed: AngleDirection { angleVariation: 360; magnitude: 3 }
+ maximumEmitted: 10
+ startTime: 5000
+ }
+
+ ImageParticle {
+ anchors.fill: parent
+ system: particles
+ source: "../images/flower.png"
+ alpha: 0.1
+ color: "white"
+ rotationVariation: 180
+ z: -1
+ }
+ }
+
+ ListModel {
+ id: petsModel
+ ListElement {
+ name: "Polly"
+ type: "Parrot"
+ age: 12
+ size: "Small"
+ }
+ ListElement {
+ name: "Penny"
+ type: "Turtle"
+ age: 4
+ size: "Small"
+ }
+ ListElement {
+ name: "Warren"
+ type: "Rabbit"
+ age: 2
+ size: "Small"
+ }
+ ListElement {
+ name: "Spot"
+ type: "Dog"
+ age: 9
+ size: "Medium"
+ }
+ ListElement {
+ name: "Schrödinger"
+ type: "Cat"
+ age: 2
+ size: "Medium"
+ }
+ ListElement {
+ name: "Joey"
+ type: "Kangaroo"
+ age: 1
+ size: "Medium"
+ }
+ ListElement {
+ name: "Kimba"
+ type: "Bunny"
+ age: 65
+ size: "Large"
+ }
+ ListElement {
+ name: "Rover"
+ type: "Dog"
+ age: 5
+ size: "Large"
+ }
+ ListElement {
+ name: "Tiny"
+ type: "Elephant"
+ age: 15
+ size: "Large"
+ }
+ }
+
+}
diff --git a/examples/particles/imageparticle/sprites.qml b/examples/particles/imageparticle/sprites.qml
new file mode 100644
index 0000000000..45ff2ebbaf
--- /dev/null
+++ b/examples/particles/imageparticle/sprites.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ color: "lightsteelblue"
+ width: 800
+ height: 800
+ id: root
+
+ SpriteSequence {
+ sprites: Sprite {
+ name: "bear"
+ source: "../images/bear_tiles.png"
+ frameCount: 13
+ frameDuration: 120
+ }
+ width: 250
+ height: 250
+ x: 20
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 20
+ z:4
+ }
+
+ ParticleSystem { id: sys }
+
+ ImageParticle {
+ anchors.fill: parent
+ id: particles
+ system: sys
+ sprites: [Sprite {
+ name: "happy"
+ source: "../images/starfish_1.png"
+ frameCount: 1
+ frameDuration: 260
+ to: {"happy": 1, "silly": 1, "angry": 1}
+ }, Sprite {
+ name: "angry"
+ source: "../images/starfish_0.png"
+ frameCount: 1
+ frameDuration: 260
+ to: {"happy": 1, "silly": 1, "angry": 1}
+ }, Sprite {
+ name: "silly"
+ source: "../images/starfish_2.png"
+ frameCount: 1
+ frameDuration: 260
+ to: {"happy": 1, "silly": 1, "noticedbear": 0}
+ }, Sprite {
+ name: "noticedbear"
+ source: "../images/starfish_3.png"
+ frameCount: 1
+ frameDuration: 2600
+ }]
+ }
+
+ Emitter {
+ system: sys
+ emitRate: 2
+ lifeSpan: 10000
+ speed: AngleDirection {angle: 90; magnitude: 60; angleVariation: 5}
+ acceleration: PointDirection { y: 10 }
+ size: 160
+ sizeVariation: 40
+ width: parent.width
+ height: 100
+ }
+
+ SpriteGoal {
+ system: sys
+ width: root.width;
+ height: root.height/2;
+ y: root.height/2;
+ goalState:"noticedbear"
+ }
+}
diff --git a/examples/particles/images/_explo.png b/examples/particles/images/_explo.png
new file mode 100644
index 0000000000..4297245d49
--- /dev/null
+++ b/examples/particles/images/_explo.png
Binary files differ
diff --git a/examples/particles/images/backgroundLeaves.jpg b/examples/particles/images/backgroundLeaves.jpg
new file mode 100755
index 0000000000..08be16751d
--- /dev/null
+++ b/examples/particles/images/backgroundLeaves.jpg
Binary files differ
diff --git a/examples/particles/images/bear_tiles.png b/examples/particles/images/bear_tiles.png
new file mode 100644
index 0000000000..6bbb2a9b6d
--- /dev/null
+++ b/examples/particles/images/bear_tiles.png
Binary files differ
diff --git a/examples/particles/images/candle.png b/examples/particles/images/candle.png
new file mode 100644
index 0000000000..8fa3193719
--- /dev/null
+++ b/examples/particles/images/candle.png
Binary files differ
diff --git a/examples/particles/images/colortable.png b/examples/particles/images/colortable.png
new file mode 100644
index 0000000000..a62ceeb4a0
--- /dev/null
+++ b/examples/particles/images/colortable.png
Binary files differ
diff --git a/examples/particles/images/finalfrontier.png b/examples/particles/images/finalfrontier.png
new file mode 100644
index 0000000000..2ba1815230
--- /dev/null
+++ b/examples/particles/images/finalfrontier.png
Binary files differ
diff --git a/examples/particles/images/flower.png b/examples/particles/images/flower.png
new file mode 100644
index 0000000000..b5c606210e
--- /dev/null
+++ b/examples/particles/images/flower.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/allatonce.png b/examples/particles/images/launcherIcons/allatonce.png
new file mode 100644
index 0000000000..b61d2d50d8
--- /dev/null
+++ b/examples/particles/images/launcherIcons/allatonce.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/attractor.png b/examples/particles/images/launcherIcons/attractor.png
new file mode 100644
index 0000000000..4bd8040c3b
--- /dev/null
+++ b/examples/particles/images/launcherIcons/attractor.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/blurparticles.png b/examples/particles/images/launcherIcons/blurparticles.png
new file mode 100644
index 0000000000..4337f979cb
--- /dev/null
+++ b/examples/particles/images/launcherIcons/blurparticles.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/close.png b/examples/particles/images/launcherIcons/close.png
new file mode 100644
index 0000000000..c37714ee8f
--- /dev/null
+++ b/examples/particles/images/launcherIcons/close.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/colortable.png b/examples/particles/images/launcherIcons/colortable.png
new file mode 100644
index 0000000000..8841ea30f9
--- /dev/null
+++ b/examples/particles/images/launcherIcons/colortable.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/customaffector.png b/examples/particles/images/launcherIcons/customaffector.png
new file mode 100644
index 0000000000..d02e7918fa
--- /dev/null
+++ b/examples/particles/images/launcherIcons/customaffector.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/customemitter.png b/examples/particles/images/launcherIcons/customemitter.png
new file mode 100644
index 0000000000..6d492573d1
--- /dev/null
+++ b/examples/particles/images/launcherIcons/customemitter.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/deformation.png b/examples/particles/images/launcherIcons/deformation.png
new file mode 100644
index 0000000000..d1b722df01
--- /dev/null
+++ b/examples/particles/images/launcherIcons/deformation.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/delegates.png b/examples/particles/images/launcherIcons/delegates.png
new file mode 100644
index 0000000000..929414cd0e
--- /dev/null
+++ b/examples/particles/images/launcherIcons/delegates.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/dynamicemitters.png b/examples/particles/images/launcherIcons/dynamicemitters.png
new file mode 100644
index 0000000000..0cdef9d21e
--- /dev/null
+++ b/examples/particles/images/launcherIcons/dynamicemitters.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/emitmask.png b/examples/particles/images/launcherIcons/emitmask.png
new file mode 100644
index 0000000000..e943a4adb9
--- /dev/null
+++ b/examples/particles/images/launcherIcons/emitmask.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/flickr.png b/examples/particles/images/launcherIcons/flickr.png
new file mode 100644
index 0000000000..4de2650280
--- /dev/null
+++ b/examples/particles/images/launcherIcons/flickr.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/fragmentshader.png b/examples/particles/images/launcherIcons/fragmentshader.png
new file mode 100644
index 0000000000..7c6de498d5
--- /dev/null
+++ b/examples/particles/images/launcherIcons/fragmentshader.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/gridsplosion.png b/examples/particles/images/launcherIcons/gridsplosion.png
new file mode 100644
index 0000000000..ec75453df6
--- /dev/null
+++ b/examples/particles/images/launcherIcons/gridsplosion.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/groupgoal.png b/examples/particles/images/launcherIcons/groupgoal.png
new file mode 100644
index 0000000000..69c6f64e54
--- /dev/null
+++ b/examples/particles/images/launcherIcons/groupgoal.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/imagecolors.png b/examples/particles/images/launcherIcons/imagecolors.png
new file mode 100644
index 0000000000..0ff13a346e
--- /dev/null
+++ b/examples/particles/images/launcherIcons/imagecolors.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/list.png b/examples/particles/images/launcherIcons/list.png
new file mode 100644
index 0000000000..bc13263cff
--- /dev/null
+++ b/examples/particles/images/launcherIcons/list.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/maximumemitted.png b/examples/particles/images/launcherIcons/maximumemitted.png
new file mode 100644
index 0000000000..4ef0435991
--- /dev/null
+++ b/examples/particles/images/launcherIcons/maximumemitted.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/multiplepainters.png b/examples/particles/images/launcherIcons/multiplepainters.png
new file mode 100644
index 0000000000..a28e3c4f02
--- /dev/null
+++ b/examples/particles/images/launcherIcons/multiplepainters.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/package.png b/examples/particles/images/launcherIcons/package.png
new file mode 100644
index 0000000000..eba8951c26
--- /dev/null
+++ b/examples/particles/images/launcherIcons/package.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/particleview.png b/examples/particles/images/launcherIcons/particleview.png
new file mode 100644
index 0000000000..a74f9a0340
--- /dev/null
+++ b/examples/particles/images/launcherIcons/particleview.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/plasmapatrol.png b/examples/particles/images/launcherIcons/plasmapatrol.png
new file mode 100644
index 0000000000..fda852b420
--- /dev/null
+++ b/examples/particles/images/launcherIcons/plasmapatrol.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/remove.png b/examples/particles/images/launcherIcons/remove.png
new file mode 100644
index 0000000000..c37714ee8f
--- /dev/null
+++ b/examples/particles/images/launcherIcons/remove.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/rotation.png b/examples/particles/images/launcherIcons/rotation.png
new file mode 100644
index 0000000000..6a8dbea236
--- /dev/null
+++ b/examples/particles/images/launcherIcons/rotation.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/samegame.png b/examples/particles/images/launcherIcons/samegame.png
new file mode 100644
index 0000000000..d00698264b
--- /dev/null
+++ b/examples/particles/images/launcherIcons/samegame.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/shapeanddirection.png b/examples/particles/images/launcherIcons/shapeanddirection.png
new file mode 100644
index 0000000000..9c1f910d0c
--- /dev/null
+++ b/examples/particles/images/launcherIcons/shapeanddirection.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/spaceexplorer.png b/examples/particles/images/launcherIcons/spaceexplorer.png
new file mode 100644
index 0000000000..770584a0fa
--- /dev/null
+++ b/examples/particles/images/launcherIcons/spaceexplorer.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/spritegoal.png b/examples/particles/images/launcherIcons/spritegoal.png
new file mode 100644
index 0000000000..77480c6f09
--- /dev/null
+++ b/examples/particles/images/launcherIcons/spritegoal.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/sprites.png b/examples/particles/images/launcherIcons/sprites.png
new file mode 100644
index 0000000000..144216ac7c
--- /dev/null
+++ b/examples/particles/images/launcherIcons/sprites.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/spritevariedparticles.png b/examples/particles/images/launcherIcons/spritevariedparticles.png
new file mode 100644
index 0000000000..495bb6beee
--- /dev/null
+++ b/examples/particles/images/launcherIcons/spritevariedparticles.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/startstop.png b/examples/particles/images/launcherIcons/startstop.png
new file mode 100644
index 0000000000..0ff53196a6
--- /dev/null
+++ b/examples/particles/images/launcherIcons/startstop.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/timedgroupchanges.png b/examples/particles/images/launcherIcons/timedgroupchanges.png
new file mode 100644
index 0000000000..ec9f826495
--- /dev/null
+++ b/examples/particles/images/launcherIcons/timedgroupchanges.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/trailemitter.png b/examples/particles/images/launcherIcons/trailemitter.png
new file mode 100644
index 0000000000..39acf8b40d
--- /dev/null
+++ b/examples/particles/images/launcherIcons/trailemitter.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/trails.png b/examples/particles/images/launcherIcons/trails.png
new file mode 100644
index 0000000000..0337ebcfd8
--- /dev/null
+++ b/examples/particles/images/launcherIcons/trails.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/turbulence.png b/examples/particles/images/launcherIcons/turbulence.png
new file mode 100644
index 0000000000..2b9446ea90
--- /dev/null
+++ b/examples/particles/images/launcherIcons/turbulence.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/velocityfrommotion.png b/examples/particles/images/launcherIcons/velocityfrommotion.png
new file mode 100644
index 0000000000..79baa08293
--- /dev/null
+++ b/examples/particles/images/launcherIcons/velocityfrommotion.png
Binary files differ
diff --git a/examples/particles/images/launcherIcons/wander.png b/examples/particles/images/launcherIcons/wander.png
new file mode 100644
index 0000000000..d98e14b8ae
--- /dev/null
+++ b/examples/particles/images/launcherIcons/wander.png
Binary files differ
diff --git a/examples/particles/images/matchmask.png b/examples/particles/images/matchmask.png
new file mode 100644
index 0000000000..e575875c55
--- /dev/null
+++ b/examples/particles/images/matchmask.png
Binary files differ
diff --git a/examples/particles/images/meteor.png b/examples/particles/images/meteor.png
new file mode 100644
index 0000000000..e8c368aea7
--- /dev/null
+++ b/examples/particles/images/meteor.png
Binary files differ
diff --git a/examples/particles/images/meteor_explo.png b/examples/particles/images/meteor_explo.png
new file mode 100644
index 0000000000..e659bfe2cf
--- /dev/null
+++ b/examples/particles/images/meteor_explo.png
Binary files differ
diff --git a/examples/particles/images/meteors.png b/examples/particles/images/meteors.png
new file mode 100644
index 0000000000..bada8a1407
--- /dev/null
+++ b/examples/particles/images/meteors.png
Binary files differ
diff --git a/examples/particles/images/nullRock.png b/examples/particles/images/nullRock.png
new file mode 100644
index 0000000000..4076327a1a
--- /dev/null
+++ b/examples/particles/images/nullRock.png
Binary files differ
diff --git a/examples/particles/images/particle.png b/examples/particles/images/particle.png
new file mode 100644
index 0000000000..5c83896d22
--- /dev/null
+++ b/examples/particles/images/particle.png
Binary files differ
diff --git a/examples/particles/images/particle2.png b/examples/particles/images/particle2.png
new file mode 100644
index 0000000000..36349c6c6e
--- /dev/null
+++ b/examples/particles/images/particle2.png
Binary files differ
diff --git a/examples/particles/images/particle3.png b/examples/particles/images/particle3.png
new file mode 100644
index 0000000000..905d8f37b8
--- /dev/null
+++ b/examples/particles/images/particle3.png
Binary files differ
diff --git a/examples/particles/images/particle4.png b/examples/particles/images/particle4.png
new file mode 100644
index 0000000000..bc95b703c1
--- /dev/null
+++ b/examples/particles/images/particle4.png
Binary files differ
diff --git a/examples/particles/images/particleA.png b/examples/particles/images/particleA.png
new file mode 100644
index 0000000000..c63acdee1f
--- /dev/null
+++ b/examples/particles/images/particleA.png
Binary files differ
diff --git a/examples/particles/images/portal_bg.png b/examples/particles/images/portal_bg.png
new file mode 100644
index 0000000000..3c59eeabb9
--- /dev/null
+++ b/examples/particles/images/portal_bg.png
Binary files differ
diff --git a/examples/particles/images/realLeaf1.png b/examples/particles/images/realLeaf1.png
new file mode 100644
index 0000000000..6cabf29efd
--- /dev/null
+++ b/examples/particles/images/realLeaf1.png
Binary files differ
diff --git a/examples/particles/images/realLeaf2.png b/examples/particles/images/realLeaf2.png
new file mode 100644
index 0000000000..bfeca861d5
--- /dev/null
+++ b/examples/particles/images/realLeaf2.png
Binary files differ
diff --git a/examples/particles/images/realLeaf3.png b/examples/particles/images/realLeaf3.png
new file mode 100644
index 0000000000..b1071e862b
--- /dev/null
+++ b/examples/particles/images/realLeaf3.png
Binary files differ
diff --git a/examples/particles/images/realLeaf4.png b/examples/particles/images/realLeaf4.png
new file mode 100644
index 0000000000..d61d53d10e
--- /dev/null
+++ b/examples/particles/images/realLeaf4.png
Binary files differ
diff --git a/examples/particles/images/rocket.png b/examples/particles/images/rocket.png
new file mode 100644
index 0000000000..a171610b03
--- /dev/null
+++ b/examples/particles/images/rocket.png
Binary files differ
diff --git a/examples/particles/images/rocket2.png b/examples/particles/images/rocket2.png
new file mode 100644
index 0000000000..7110f8fdc6
--- /dev/null
+++ b/examples/particles/images/rocket2.png
Binary files differ
diff --git a/examples/particles/images/sizeInOut.png b/examples/particles/images/sizeInOut.png
new file mode 100644
index 0000000000..0a306ea21a
--- /dev/null
+++ b/examples/particles/images/sizeInOut.png
Binary files differ
diff --git a/examples/particles/images/snowflake.png b/examples/particles/images/snowflake.png
new file mode 100644
index 0000000000..490887a82f
--- /dev/null
+++ b/examples/particles/images/snowflake.png
Binary files differ
diff --git a/examples/particles/images/sparkleSize.png b/examples/particles/images/sparkleSize.png
new file mode 100644
index 0000000000..752056541b
--- /dev/null
+++ b/examples/particles/images/sparkleSize.png
Binary files differ
diff --git a/examples/particles/images/star.png b/examples/particles/images/star.png
new file mode 100644
index 0000000000..0d592cfa87
--- /dev/null
+++ b/examples/particles/images/star.png
Binary files differ
diff --git a/examples/particles/images/starfish_0.png b/examples/particles/images/starfish_0.png
new file mode 100644
index 0000000000..8747f0236e
--- /dev/null
+++ b/examples/particles/images/starfish_0.png
Binary files differ
diff --git a/examples/particles/images/starfish_1.png b/examples/particles/images/starfish_1.png
new file mode 100644
index 0000000000..1f3f159d5e
--- /dev/null
+++ b/examples/particles/images/starfish_1.png
Binary files differ
diff --git a/examples/particles/images/starfish_2.png b/examples/particles/images/starfish_2.png
new file mode 100644
index 0000000000..c6c7e5a676
--- /dev/null
+++ b/examples/particles/images/starfish_2.png
Binary files differ
diff --git a/examples/particles/images/starfish_3.png b/examples/particles/images/starfish_3.png
new file mode 100644
index 0000000000..307a89f815
--- /dev/null
+++ b/examples/particles/images/starfish_3.png
Binary files differ
diff --git a/examples/particles/images/starfish_4.png b/examples/particles/images/starfish_4.png
new file mode 100644
index 0000000000..d61c26545a
--- /dev/null
+++ b/examples/particles/images/starfish_4.png
Binary files differ
diff --git a/examples/particles/images/starfish_mask.png b/examples/particles/images/starfish_mask.png
new file mode 100644
index 0000000000..2ef74f902b
--- /dev/null
+++ b/examples/particles/images/starfish_mask.png
Binary files differ
diff --git a/examples/particles/itemparticle/content/Delegate.qml b/examples/particles/itemparticle/content/Delegate.qml
new file mode 100644
index 0000000000..97c7840cb4
--- /dev/null
+++ b/examples/particles/itemparticle/content/Delegate.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//![0]
+Package {
+ Text { id: listDelegate; width: 200; height: 25; text: 'Empty'; Package.name: 'list' }
+ Text { id: gridDelegate; width: 100; height: 50; text: 'Empty'; Package.name: 'grid' }
+
+ Rectangle {
+ id: wrapper
+ width: 200; height: 25
+ color: 'lightsteelblue'
+
+ Text { text: display; anchors.centerIn: parent }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (wrapper.state == 'inList')
+ wrapper.state = 'inGrid';
+ else
+ wrapper.state = 'inList';
+ }
+ }
+
+ state: 'inList'
+ states: [
+ State {
+ name: 'inList'
+ ParentChange { target: wrapper; parent: listDelegate }
+ },
+ State {
+ name: 'inGrid'
+ ParentChange {
+ target: wrapper; parent: gridDelegate
+ x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ ParentAnimation {
+ NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
+ }
+ }
+ ]
+ }
+}
+//![0]
diff --git a/examples/particles/itemparticle/content/Delegate2.qml b/examples/particles/itemparticle/content/Delegate2.qml
new file mode 100644
index 0000000000..cf60d43dc2
--- /dev/null
+++ b/examples/particles/itemparticle/content/Delegate2.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//![0]
+Package {
+ Item { id: gridDelegate; width: w; height: h; Package.name: 'grid' }
+ Item { id: particleDelegate; width: w; height: h; Package.name: 'particles'
+
+ Rectangle {
+ id: wrapper
+ width: w; height: h;
+ color: col
+ rotation: Math.random()*360
+ Behavior on rotation {RotationAnimation {}}
+
+ states: State {
+ name: "gridded"
+ when: root.inGrid
+ PropertyChanges {
+ target: wrapper
+ rotation: 0
+ }
+ ParentChange {
+ target: wrapper
+ parent: gridDelegate
+ x:0
+ y:0
+ }
+ }
+ transitions: [
+ Transition {
+ ParentAnimation {
+ NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
+ }
+ }
+ ]
+ }
+ }
+}
+//![0]
diff --git a/examples/particles/itemparticle/content/ExpandingDelegate.qml b/examples/particles/itemparticle/content/ExpandingDelegate.qml
new file mode 100644
index 0000000000..87f723d3f7
--- /dev/null
+++ b/examples/particles/itemparticle/content/ExpandingDelegate.qml
@@ -0,0 +1,204 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../../../modelviews/listview/content"
+
+// This example illustrates expanding a list item to show a more detailed view.
+
+ // Delegate for the recipes. This delegate has two modes:
+ // 1. List mode (default), which just shows the picture and title of the recipe.
+ // 2. Details mode, which also shows the ingredients and method.
+ Component {
+ id: recipeDelegate
+
+ Item {
+ id: recipe
+
+ // Create a property to contain the visibility of the details.
+ // We can bind multiple element's opacity to this one property,
+ // rather than having a "PropertyChanges" line for each element we
+ // want to fade.
+ property real detailsOpacity : 0
+
+ //this bit changed for aesthetics
+ width: 70
+ height: 70
+ // A simple rounded rectangle for the background
+ Rectangle {
+ id: background
+ x: 2; y: 2; width: parent.width - x*2; height: parent.height - y*2
+ color: "ivory"
+ border.color: "orange"
+ radius: 5
+ }
+ Image {
+ anchors.fill:parent
+ anchors.margins: -32
+ source: "bubble.png"
+ }
+
+
+ // This mouse region covers the entire delegate.
+ // When clicked it changes mode to 'Details'. If we are already
+ // in Details mode, then no change will happen.
+ MouseArea {
+ anchors.fill: parent
+ onClicked: recipe.state = 'Details';
+ }
+
+ // Lay out the page: picture, title and ingredients at the top, and method at the
+ // bottom. Note that elements that should not be visible in the list
+ // mode have their opacity set to recipe.detailsOpacity.
+ Row {
+ id: topLayout
+ x: 10; y: 10; height: recipeImage.height; width: parent.width
+ spacing: 10
+
+ Image {
+ id: recipeImage
+ width: 50; height: 50
+ source: "../../modelviews/listview/" + picture
+ }
+
+ Column {
+ width: background.width - recipeImage.width - 20; height: recipeImage.height
+ spacing: 5
+
+ Text {
+ text: title
+ font.bold: true; font.pointSize: 16
+ }
+
+ Text {
+ text: "Ingredients"
+ font.pointSize: 12; font.bold: true
+ opacity: recipe.detailsOpacity
+ }
+
+ Text {
+ text: ingredients
+ wrapMode: Text.WordWrap
+ width: parent.width
+ opacity: recipe.detailsOpacity
+ }
+ }
+ }
+
+ Item {
+ id: details
+ x: 10; width: parent.width - 20
+ anchors { top: topLayout.bottom; topMargin: 10; bottom: parent.bottom; bottomMargin: 10 }
+ opacity: recipe.detailsOpacity
+
+ Text {
+ id: methodTitle
+ anchors.top: parent.top
+ text: "Method"
+ font.pointSize: 12; font.bold: true
+ }
+
+ Flickable {
+ id: flick
+ width: parent.width
+ anchors { top: methodTitle.bottom; bottom: parent.bottom }
+ contentHeight: methodText.height
+ clip: true
+
+ Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width }
+ }
+
+ Image {
+ anchors { right: flick.right; top: flick.top }
+ source: "../../modelviews/listview/" + "content/pics/moreUp.png"
+ opacity: flick.atYBeginning ? 0 : 1
+ }
+
+ Image {
+ anchors { right: flick.right; bottom: flick.bottom }
+ source: "../../modelviews/listview/" + "content/pics/moreDown.png"
+ opacity: flick.atYEnd ? 0 : 1
+ }
+ }
+
+ // A button to close the detailed view, i.e. set the state back to default ('').
+ TextButton {
+ y: 10
+ anchors { right: background.right; rightMargin: 10 }
+ opacity: recipe.detailsOpacity
+ text: "Close"
+
+ onClicked: recipe.state = '';
+ }
+
+ states: State {
+ name: "Details"
+
+ PropertyChanges { target: background; color: "white" }
+ PropertyChanges { target: recipeImage; width: 130; height: 130 } // Make picture bigger
+ PropertyChanges { target: recipe; detailsOpacity: 1; x: 0; opacity: 1 } // Make details visible
+ PropertyChanges { target: recipe; height: root.height; width: root.height; x:0; y:0; z:100} // Fill the entire list area with the detailed view
+
+ // Move the list so that this item is at the top.
+ //PropertyChanges { target: recipe.ListView.view; explicit: true; contentY: recipe.y }
+
+ // Disallow flicking while we're in detailed view
+ //PropertyChanges { target: recipe.ListView.view; interactive: false }
+ }
+
+ transitions: Transition {
+ //The only strictly necessary particle specific lines
+ to: "Details"
+ reversible: true
+ ScriptAction {script: {
+ if(state == "Details")
+ mp.freeze(index);
+ else
+ mp.unfreeze(index);
+ }
+ }
+ // Make the state changes smooth
+ ParallelAnimation {
+ ColorAnimation { property: "color"; duration: 500 }
+ NumberAnimation { duration: 300; properties: "detailsOpacity,opacity,x,y,height,width" }
+ }
+ }
+ }
+ }
diff --git a/examples/particles/itemparticle/content/RssModel.qml b/examples/particles/itemparticle/content/RssModel.qml
new file mode 100644
index 0000000000..46027600b3
--- /dev/null
+++ b/examples/particles/itemparticle/content/RssModel.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+XmlListModel {
+ property string tags : ""
+
+ function encodeTags(x) { return encodeURIComponent(x.replace(' ',',')); }
+
+ source: "http://api.flickr.com/services/feeds/photos_public.gne?"+(tags ? "tags="+encodeTags(tags)+"&" : "")
+ query: "/feed/entry"
+ namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"
+
+ XmlRole { name: "title"; query: "title/string()" }
+ XmlRole { name: "content"; query: "content/string()" }
+ XmlRole { name: "hq"; query: "link[@rel='enclosure']/@href/string()" }
+}
diff --git a/examples/particles/itemparticle/content/bubble.png b/examples/particles/itemparticle/content/bubble.png
new file mode 100644
index 0000000000..c7f479e9e3
--- /dev/null
+++ b/examples/particles/itemparticle/content/bubble.png
Binary files differ
diff --git a/examples/particles/itemparticle/content/script.js b/examples/particles/itemparticle/content/script.js
new file mode 100644
index 0000000000..e8ef93a847
--- /dev/null
+++ b/examples/particles/itemparticle/content/script.js
@@ -0,0 +1,27 @@
+.pragma library
+
+function getWidth(string) {
+ return (string.match(/width=\"([0-9]+)\"/))[1]
+}
+
+function getHeight(string) {
+ return (string.match(/height=\"([0-9]+)\"/))[1]
+}
+
+function getImagePath(string) {
+ var pattern = /src=\"http:\/\/(\S+)\"/
+ return (string.match(pattern))[1]
+}
+
+function calculateScale(width, height, cellSize) {
+ var widthScale = (cellSize * 1.0) / width
+ var heightScale = (cellSize * 1.0) / height
+ var scale = 0
+
+ if (widthScale <= heightScale) {
+ scale = widthScale;
+ } else if (heightScale < widthScale) {
+ scale = heightScale;
+ }
+ return scale;
+}
diff --git a/examples/particles/itemparticle/delegates.qml b/examples/particles/itemparticle/delegates.qml
new file mode 100644
index 0000000000..58734d320a
--- /dev/null
+++ b/examples/particles/itemparticle/delegates.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ id: root;
+ width: 360
+ height: 600
+ color: "black"
+
+ function newPithySaying() {
+ switch (Math.floor(Math.random()*16)) {
+ case 0: return "Hello World";
+ case 1: return "G'day Mate";
+ case 2: return "Code Less";
+ case 3: return "Create More";
+ case 4: return "Deploy Everywhere";
+ case 5: return "Qt Meta-object Language";
+ case 6: return "Qt Magic Language";
+ case 7: return "Fluid UIs";
+ case 8: return "Touchable";
+ case 9: return "How's it going?";
+ case 10: return "Do you like text?";
+ case 11: return "Enjoy!";
+ case 12: return "ERROR: Out of pith";
+ case 13: return "Punctuation Failure";
+ case 14: return "I can go faster";
+ case 15: return "I can go slower";
+ default: return "OMGWTFBBQ";
+ }
+ }
+
+ ParticleSystem {
+ anchors.fill: parent
+ id: syssy
+ Emitter {
+ anchors.centerIn: parent
+ emitRate: 1
+ lifeSpan: 4800
+ lifeSpanVariation: 1600
+ speed: AngleDirection {angleVariation: 360; magnitude: 40; magnitudeVariation: 20}
+ }
+ ItemParticle {
+ delegate: Text {
+ text: root.newPithySaying();
+ color: "white"
+ font.pixelSize: 18
+ font.bold: true
+ }
+ }
+ }
+}
diff --git a/examples/particles/itemparticle/particleview.qml b/examples/particles/itemparticle/particleview.qml
new file mode 100644
index 0000000000..774539a958
--- /dev/null
+++ b/examples/particles/itemparticle/particleview.qml
@@ -0,0 +1,274 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+import "content/script.js" as Script
+import "content"
+
+Item {
+ id: root
+ width: 640
+ height: 480
+ Rectangle {
+ anchors.fill: parent
+ color: "black"
+ z: -1
+ }
+ Item {
+ id: loading
+ Behavior on opacity {NumberAnimation {}}
+ anchors.fill: parent
+ Text {
+ anchors.centerIn: parent
+ text: "Loading"
+ color: "white"
+ }
+ }
+ ParticleSystem {
+ id: sys;
+ running: true
+ }
+ Emitter {
+ id: emitter
+ system: sys
+ height: parent.height - 132/2
+ x: -132/2
+ y: 132/2
+ speed: PointDirection { x: 32; xVariation: 8 }
+ emitRate: 0.5
+ lifeSpan: Emitter.InfiniteLife
+ group: "photos"
+ }
+ Age {
+ system: sys
+ x: parent.width + 132/2
+ height: parent.height
+ width: 1000
+ }
+ ImageParticle {
+ system: sys
+ groups: ["fireworks"]
+ source: "../trails/../images/star.png"
+ color: "lightsteelblue"
+ alpha: 0
+ colorVariation: 0
+ z: 1000
+ }
+ ItemParticle {
+ id: mp
+ z: 0
+ system: sys
+ fade: false
+ groups: ["photos"]
+ }
+ Component {
+ id: alertDelegate
+ Rectangle {
+ width: 132
+ height: 132
+ NumberAnimation on scale {
+ running: true
+ loops: 1
+ from: 0.2
+ to: 1
+ }
+ Image {
+ source: "../asteroid/../images/rocket.png"
+ anchors.centerIn: parent
+ }
+ Text {
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: "A new ship has arrived!"
+ }
+ }
+ }
+ property Item alertItem;
+ function alert() {
+ //resetter.active = false
+ force.active = true;
+ alertItem = alertDelegate.createObject(root);
+ alertItem.x = root.width/2 - alertItem.width/2
+ alertItem.y = root.height/2 - alertItem.height/2
+ spawnFireworks.pulse(200);
+ stopAlert.start();
+ }
+ focus: true
+ Keys.onSpacePressed: alert();
+ Timer {
+ id: stopAlert
+ running: false
+ repeat: false
+ interval: 800
+ onTriggered: {
+ force.active = false
+ //resetter.active = true;
+ mp.take(alertItem, true);
+ centerEmitter.burst(1);
+ }
+ }
+ Attractor {
+ id: force
+ system: sys
+ pointX: root.width/2
+ pointY: root.height/2
+ strength: -10000
+ enabled: false
+ anchors.centerIn: parent
+ width: parent.width/2
+ height: parent.height/2
+ groups:["photos"]
+ affectedParameter: Attractor.Position
+ }
+ Emitter {
+ id: centerEmitter
+ speed: PointDirection { x: 32; xVariation: 8;}
+ emitRate: 0.5
+ lifeSpan: 12000 //TODO: A -1 or something which does 'infinite'? (but need disable fade first)
+ maximumEmitted: 20
+ group: "photos"
+ system: sys
+ anchors.centerIn: parent
+ enabled: false
+
+ //TODO: Zoom in effect
+ }
+ Emitter {
+ id: spawnFireworks
+ group: "fireworks"
+ system: sys
+ maximumEmitted: 400
+ emitRate: 400
+ lifeSpan: 2800
+ x: parent.width/2
+ y: parent.height/2 - 64
+ width: 8
+ height: 8
+ enabled: false
+ size: 32
+ endSize: 8
+ speed: AngleDirection { magnitude: 160; magnitudeVariation: 120; angleVariation: 90; angle: 270 }
+ acceleration: PointDirection { y: 160 }
+ }
+ Item { x: -1000; y: -1000 //offscreen
+ Repeater {//Load them here, add to system on completed
+ model: theModel
+ delegate: theDelegate
+ }
+ }
+ RssModel {id: theModel; tags:"particle,particles"}
+ Component {
+ id: theDelegate
+ Rectangle {
+ id: container
+ border.width: 2
+ property real myRand: Math.random();//'depth'
+ z: Math.floor(myRand * 100)
+ scale: (myRand + 1.0)/2;
+ //TODO: Darken based on 'depth'
+ width: 132
+ height: 132
+ //ItemParticle.onAttached: console.log("I'm in" + x + "," + y + ":" + opacity);
+ ItemParticle.onDetached: mp.take(container);//respawns
+ function manage()
+ {
+ if (state == "selected") {
+ console.log("Taking " + index);
+ mp.freeze(container);
+ } else {
+ console.log("Returning " +index);
+ mp.unfreeze(container);
+ }
+ }
+ Image {
+ id: img
+ anchors.centerIn: parent
+ smooth: true; source: "http://" + Script.getImagePath(content); cache: true
+ fillMode: Image.PreserveAspectFit;
+ width: parent.width-4; height: parent.height-4
+ onStatusChanged: if (img.status == Image.Ready) {
+ loading.opacity = 0;
+ mp.take(container);
+ }
+ }
+ Text {
+ anchors.bottom: parent.bottom
+ width: parent.width
+ horizontalAlignment: Text.AlignHCenter
+ elide: Text.ElideRight
+ text: title
+ color: "black"
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: container.state == "selected" ? container.state = "" : container.state = "selected"
+ }
+ states: State {
+ name: "selected"
+ ParentChange {
+ target: container
+ parent: root
+ x: 0
+ y: 0
+ }
+ PropertyChanges {
+ target: container
+ width: root.width
+ height: root.height
+ z: 101
+ opacity: 1
+ rotation: 0
+ }
+ }
+ transitions: Transition {
+ to: "selected"
+ reversible: true
+ SequentialAnimation {
+ ScriptAction {script: container.manage();}
+ ParallelAnimation {
+ ParentAnimation {NumberAnimation { properties: "x,y" }}//Doesn't work, particles takes control of x,y instantly
+ NumberAnimation { properties: "width, height, z, rotation" }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/particles/particles.pro b/examples/particles/particles.pro
new file mode 100644
index 0000000000..967108504e
--- /dev/null
+++ b/examples/particles/particles.pro
@@ -0,0 +1 @@
+TEMPLATE = subdirs
diff --git a/examples/particles/simple/dynamiccomparison.qml b/examples/particles/simple/dynamiccomparison.qml
new file mode 100644
index 0000000000..a7cdb9b32a
--- /dev/null
+++ b/examples/particles/simple/dynamiccomparison.qml
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ id: root
+ color: "black"
+ width: 640
+ height: 480
+ ParticleSystem {
+ id: sys
+ }
+
+ ImageParticle {
+ system: sys
+ source: "../images/particle.png"
+ color: "white"
+ colorVariation: 1.0
+ alpha: 0.1
+ entryEffect: ImageParticle.None
+ }
+
+ Emitter {
+ id: emitter
+ system: sys
+ width: parent.width/2
+ speed: PointDirection {y: 72; yVariation: 24}
+ lifeSpan: 10000
+ emitRate: 1000
+ enabled: false
+ size: 32
+ }
+
+ Item {
+ id: fakeEmitter
+ function burst(number) {
+ while (number > 0) {
+ var item = fakeParticle.createObject(root);
+ item.lifeSpan = Math.random() * 5000 + 5000;
+ item.x = Math.random() * 320 + 320;
+ item.y = 0;
+ number--;
+ }
+ }
+
+ Component {
+ id: fakeParticle
+ Image {
+ id: container
+ property int lifeSpan: 10000
+ width: 32
+ height: 32
+ source: "../images/particle.png"
+ y: 0
+ PropertyAnimation on y {from: -16; to: 480-16; duration: container.lifeSpan; running: true}
+ SequentialAnimation on opacity {
+ running: true
+ NumberAnimation { from:0; to: 1; duration: 500}
+ PauseAnimation { duration: container.lifeSpan - 1000}
+ NumberAnimation { from:1; to: 0; duration: 500}
+ ScriptAction { script: container.destroy(); }
+ }
+ }
+ }
+ }
+
+ Text {
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ text: "1000 particles"
+ color: "white"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: emitter.burst(1000);
+ }
+ }
+ Text {
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ text: "1000 items"
+ color: "white"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: fakeEmitter.burst(1000);
+ }
+ }
+}
diff --git a/examples/particles/simple/dynamicemitters.qml b/examples/particles/simple/dynamicemitters.qml
new file mode 100644
index 0000000000..4431ebe82e
--- /dev/null
+++ b/examples/particles/simple/dynamicemitters.qml
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ id: root
+ color: "black"
+ width: 640
+ height: 480
+ ParticleSystem {
+ id: sys
+ }
+ ImageParticle {
+ system: sys
+ source: "../images/particle.png"
+ color: "white"
+ colorVariation: 1.0
+ alpha: 0.1
+ }
+
+ Component {
+ id: emitterComp
+ Emitter {
+ id: container
+ Emitter {
+ id: emitMore
+ system: sys
+ emitRate: 128
+ lifeSpan: 600
+ size: 16
+ endSize: 8
+ speed: AngleDirection {angleVariation:360; magnitude: 60}
+ }
+
+ property int life: 2600
+ property real targetX: 0
+ property real targetY: 0
+ function go() {
+ xAnim.start();
+ yAnim.start();
+ container.enabled = true
+ }
+ system: sys
+ emitRate: 32
+ lifeSpan: 600
+ size: 24
+ endSize: 8
+ NumberAnimation on x {
+ id: xAnim;
+ to: targetX
+ duration: life
+ running: false
+ }
+ NumberAnimation on y {
+ id: yAnim;
+ to: targetY
+ duration: life
+ running: false
+ }
+ Timer {
+ interval: life
+ running: true
+ onTriggered: container.destroy();
+ }
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ for (var i=0; i<8; i++) {
+ var obj = emitterComp.createObject(root);
+ obj.x = mouse.x
+ obj.y = mouse.y
+ obj.targetX = Math.random() * 240 - 120 + obj.x
+ obj.targetY = Math.random() * 240 - 120 + obj.y
+ obj.life = Math.round(Math.random() * 2400) + 200
+ obj.emitRate = Math.round(Math.random() * 32) + 32
+ obj.go();
+ }
+ }
+ }
+}
diff --git a/examples/particles/simple/multiplepainters.qml b/examples/particles/simple/multiplepainters.qml
new file mode 100644
index 0000000000..c1b85caa2d
--- /dev/null
+++ b/examples/particles/simple/multiplepainters.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ id: root
+ width: 360
+ height: 600
+ color: "darkblue"
+ property bool cloneMode: false
+ ParticleSystem {
+ id: sys
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: cloneMode = !cloneMode;
+ }
+ Emitter {
+ system: sys
+ y:root.height + 20
+ width: root.width
+ emitRate: 200
+ lifeSpan: 4000
+ startTime: 4000
+ speed: PointDirection { y: -120; }
+ }
+
+ ImageParticle {
+ system: sys
+ visible: !cloneMode
+ source: "../images/particle2.png"
+ }
+
+ ImageParticle {
+ system: sys
+ visible: cloneMode
+ z: 0
+ source: "../images/particle3.png"
+ }
+
+ ImageParticle {
+ system: sys
+ clip: true
+ visible: cloneMode
+ y: 120
+ height: 240
+ width: root.width
+ z: 1
+ source: "../images/particle.png"
+ }
+}
diff --git a/examples/particles/simple/startstop.qml b/examples/particles/simple/startstop.qml
new file mode 100644
index 0000000000..62105b28a0
--- /dev/null
+++ b/examples/particles/simple/startstop.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Rectangle {
+ width: 360
+ height: 540
+ color: "black"
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: {
+ if (mouse.button == Qt.LeftButton)
+ particles.running = !particles.running
+ else
+ particles.paused = !particles.paused;
+ }
+ }
+
+ ParticleSystem {
+ id: particles
+ running: false
+ }
+
+ ImageParticle {
+ anchors.fill: parent
+ system: particles
+ source: "../images/star.png"
+ sizeTable: "../images/sparkleSize.png"
+ alpha: 0
+ colorVariation: 0.6
+ }
+
+ Emitter {
+ anchors.fill: parent
+ system: particles
+ emitRate: 2000
+ lifeSpan: 2000
+ size: 30
+ sizeVariation: 10
+ }
+}
diff --git a/examples/qml/cppextensions/imageprovider/imageprovider.cpp b/examples/qml/cppextensions/imageprovider/imageprovider.cpp
index 506d5b0812..f6632a89e8 100644
--- a/examples/qml/cppextensions/imageprovider/imageprovider.cpp
+++ b/examples/qml/cppextensions/imageprovider/imageprovider.cpp
@@ -87,6 +87,7 @@ public:
class ImageProviderExtensionPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" FILE "imageprovider.json")
public:
void registerTypes(const char *uri)
{
@@ -101,7 +102,8 @@ public:
};
-#include "imageprovider.moc"
-Q_EXPORT_PLUGIN(ImageProviderExtensionPlugin);
+#define QQmlExtensionInterface_iid "org.qt-project.Qt.QQmlExtensionInterface"
+
+#include "imageprovider.moc"
diff --git a/examples/qml/cppextensions/imageprovider/imageprovider.json b/examples/qml/cppextensions/imageprovider/imageprovider.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/examples/qml/cppextensions/imageprovider/imageprovider.json
@@ -0,0 +1 @@
+{}
diff --git a/examples/qml/cppextensions/imageprovider/imageprovider.pro b/examples/qml/cppextensions/imageprovider/imageprovider.pro
index f75a6ebd89..b4a832b720 100644
--- a/examples/qml/cppextensions/imageprovider/imageprovider.pro
+++ b/examples/qml/cppextensions/imageprovider/imageprovider.pro
@@ -7,6 +7,8 @@ TARGET = qmlimageproviderplugin
SOURCES += imageprovider.cpp
+OTHER_FILES += imageprovider.json
+
sources.files = $$SOURCES imageprovider.qml imageprovider.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/imageprovider
diff --git a/examples/qml/cppextensions/plugins/plugin.cpp b/examples/qml/cppextensions/plugins/plugin.cpp
index b53ef2ccb3..5e9900cb4f 100644
--- a/examples/qml/cppextensions/plugins/plugin.cpp
+++ b/examples/qml/cppextensions/plugins/plugin.cpp
@@ -141,6 +141,8 @@ MinuteTimer *TimeModel::timer=0;
class QExampleQmlPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" FILE "plugin.json")
+
public:
void registerTypes(const char *uri)
{
@@ -151,7 +153,3 @@ public:
//![plugin]
#include "plugin.moc"
-
-//![export]
-Q_EXPORT_PLUGIN2(qmlqtimeexampleplugin, QExampleQmlPlugin);
-//![export]
diff --git a/examples/qml/cppextensions/plugins/plugin.json b/examples/qml/cppextensions/plugins/plugin.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/examples/qml/cppextensions/plugins/plugin.json
@@ -0,0 +1 @@
+{}
diff --git a/examples/qml/cppextensions/plugins/plugins.pro b/examples/qml/cppextensions/plugins/plugins.pro
index e6c7fe64a0..08a4d1a61c 100644
--- a/examples/qml/cppextensions/plugins/plugins.pro
+++ b/examples/qml/cppextensions/plugins/plugins.pro
@@ -7,7 +7,9 @@ TARGET = qmlqtimeexampleplugin
SOURCES += plugin.cpp
-qqmlsources.files += \
+OTHER_FILES += "plugin.json"
+
+qdeclarativesources.files += \
com/nokia/TimeExample/qmldir \
com/nokia/TimeExample/center.png \
com/nokia/TimeExample/clock.png \
@@ -15,11 +17,11 @@ qqmlsources.files += \
com/nokia/TimeExample/hour.png \
com/nokia/TimeExample/minute.png
-qqmlsources.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/plugins/com/nokia/TimeExample
+qdeclarativesources.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/plugins/com/nokia/TimeExample
sources.files += plugins.pro plugin.cpp plugins.qml README
sources.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/plugins
target.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/plugins/com/nokia/TimeExample
-INSTALLS += qqmlsources sources target
+INSTALLS += qdeclarativesources sources target
diff --git a/examples/qml/cppextensions/referenceexamples/attached/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/attached/birthdayparty.cpp
index 6b784fdccd..c4f906119a 100644
--- a/examples/qml/cppextensions/referenceexamples/attached/birthdayparty.cpp
+++ b/examples/qml/cppextensions/referenceexamples/attached/birthdayparty.cpp
@@ -69,7 +69,7 @@ void BirthdayParty::setHost(Person *c)
m_host = c;
}
-QQmlListProperty<Person> BirthdayParty::guests()
+QQmlListProperty<Person> BirthdayParty::guests()
{
return QQmlListProperty<Person>(this, m_guests);
}
diff --git a/examples/qml/cppextensions/referenceexamples/binding/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/binding/birthdayparty.cpp
index 9a38c3b646..62499862f0 100644
--- a/examples/qml/cppextensions/referenceexamples/binding/birthdayparty.cpp
+++ b/examples/qml/cppextensions/referenceexamples/binding/birthdayparty.cpp
@@ -75,7 +75,7 @@ void BirthdayParty::setHost(Person *c)
emit hostChanged();
}
-QQmlListProperty<Person> BirthdayParty::guests()
+QQmlListProperty<Person> BirthdayParty::guests()
{
return QQmlListProperty<Person>(this, m_guests);
}
diff --git a/examples/qml/cppextensions/referenceexamples/coercion/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/coercion/birthdayparty.cpp
index d697ac22b6..e15ffe1604 100644
--- a/examples/qml/cppextensions/referenceexamples/coercion/birthdayparty.cpp
+++ b/examples/qml/cppextensions/referenceexamples/coercion/birthdayparty.cpp
@@ -54,7 +54,7 @@ void BirthdayParty::setHost(Person *c)
m_host = c;
}
-QQmlListProperty<Person> BirthdayParty::guests()
+QQmlListProperty<Person> BirthdayParty::guests()
{
return QQmlListProperty<Person>(this, m_guests);
}
diff --git a/examples/qml/cppextensions/referenceexamples/default/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/default/birthdayparty.cpp
index d697ac22b6..e15ffe1604 100644
--- a/examples/qml/cppextensions/referenceexamples/default/birthdayparty.cpp
+++ b/examples/qml/cppextensions/referenceexamples/default/birthdayparty.cpp
@@ -54,7 +54,7 @@ void BirthdayParty::setHost(Person *c)
m_host = c;
}
-QQmlListProperty<Person> BirthdayParty::guests()
+QQmlListProperty<Person> BirthdayParty::guests()
{
return QQmlListProperty<Person>(this, m_guests);
}
diff --git a/examples/qml/cppextensions/referenceexamples/grouped/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/grouped/birthdayparty.cpp
index d697ac22b6..e15ffe1604 100644
--- a/examples/qml/cppextensions/referenceexamples/grouped/birthdayparty.cpp
+++ b/examples/qml/cppextensions/referenceexamples/grouped/birthdayparty.cpp
@@ -54,7 +54,7 @@ void BirthdayParty::setHost(Person *c)
m_host = c;
}
-QQmlListProperty<Person> BirthdayParty::guests()
+QQmlListProperty<Person> BirthdayParty::guests()
{
return QQmlListProperty<Person>(this, m_guests);
}
diff --git a/examples/qml/cppextensions/referenceexamples/methods/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/methods/birthdayparty.cpp
index 0935d708a7..c96f41d944 100644
--- a/examples/qml/cppextensions/referenceexamples/methods/birthdayparty.cpp
+++ b/examples/qml/cppextensions/referenceexamples/methods/birthdayparty.cpp
@@ -55,7 +55,7 @@ void BirthdayParty::setHost(Person *c)
m_host = c;
}
-QQmlListProperty<Person> BirthdayParty::guests()
+QQmlListProperty<Person> BirthdayParty::guests()
{
return QQmlListProperty<Person>(this, m_guests);
}
diff --git a/examples/qml/cppextensions/referenceexamples/properties/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/properties/birthdayparty.cpp
index f7280560ab..8e79d07748 100644
--- a/examples/qml/cppextensions/referenceexamples/properties/birthdayparty.cpp
+++ b/examples/qml/cppextensions/referenceexamples/properties/birthdayparty.cpp
@@ -55,7 +55,7 @@ void BirthdayParty::setHost(Person *c)
m_host = c;
}
-QQmlListProperty<Person> BirthdayParty::guests()
+QQmlListProperty<Person> BirthdayParty::guests()
{
return QQmlListProperty<Person>(this, m_guests);
}
diff --git a/examples/qml/cppextensions/referenceexamples/signal/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/signal/birthdayparty.cpp
index 078c5f9a2d..b9f7e15907 100644
--- a/examples/qml/cppextensions/referenceexamples/signal/birthdayparty.cpp
+++ b/examples/qml/cppextensions/referenceexamples/signal/birthdayparty.cpp
@@ -70,7 +70,7 @@ void BirthdayParty::setHost(Person *c)
m_host = c;
}
-QQmlListProperty<Person> BirthdayParty::guests()
+QQmlListProperty<Person> BirthdayParty::guests()
{
return QQmlListProperty<Person>(this, m_guests);
}
diff --git a/examples/qml/cppextensions/referenceexamples/valuesource/birthdayparty.cpp b/examples/qml/cppextensions/referenceexamples/valuesource/birthdayparty.cpp
index a69a58557e..aa8bc77116 100644
--- a/examples/qml/cppextensions/referenceexamples/valuesource/birthdayparty.cpp
+++ b/examples/qml/cppextensions/referenceexamples/valuesource/birthdayparty.cpp
@@ -70,7 +70,7 @@ void BirthdayParty::setHost(Person *c)
m_host = c;
}
-QQmlListProperty<Person> BirthdayParty::guests()
+QQmlListProperty<Person> BirthdayParty::guests()
{
return QQmlListProperty<Person>(this, m_guests);
}
diff --git a/examples/qml/dynamicscene/content/Button.qml b/examples/qml/dynamicscene/content/Button.qml
new file mode 100644
index 0000000000..014692274a
--- /dev/null
+++ b/examples/qml/dynamicscene/content/Button.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+
+ property variant text
+ signal clicked
+
+ height: text.height + 10; width: text.width + 20
+ border.width: 1
+ radius: 4
+ smooth: true
+
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: !mouseArea.pressed ? activePalette.light : activePalette.button
+ }
+ GradientStop {
+ position: 1.0
+ color: !mouseArea.pressed ? activePalette.button : activePalette.dark
+ }
+ }
+
+ SystemPalette { id: activePalette }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: container.clicked()
+ }
+
+ Text {
+ id: text
+ anchors.centerIn:parent
+ font.pointSize: 10
+ text: parent.text
+ color: activePalette.buttonText
+ }
+}
diff --git a/examples/qml/dynamicscene/content/GenericSceneItem.qml b/examples/qml/dynamicscene/content/GenericSceneItem.qml
new file mode 100644
index 0000000000..0408aa87fb
--- /dev/null
+++ b/examples/qml/dynamicscene/content/GenericSceneItem.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Image {
+ property bool created: false
+ property string image
+
+ source: image
+
+}
diff --git a/examples/qml/dynamicscene/content/PaletteItem.qml b/examples/qml/dynamicscene/content/PaletteItem.qml
new file mode 100644
index 0000000000..e993f89989
--- /dev/null
+++ b/examples/qml/dynamicscene/content/PaletteItem.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "itemCreation.js" as Code
+
+Image {
+ id: paletteItem
+
+ property string componentFile
+ property string image
+
+ source: image
+
+ MouseArea {
+ anchors.fill: parent
+
+ onPressed: Code.startDrag(mouse);
+ onPositionChanged: Code.continueDrag(mouse);
+ onReleased: Code.endDrag(mouse);
+ }
+}
diff --git a/examples/qml/dynamicscene/content/PerspectiveItem.qml b/examples/qml/dynamicscene/content/PerspectiveItem.qml
new file mode 100644
index 0000000000..f651369452
--- /dev/null
+++ b/examples/qml/dynamicscene/content/PerspectiveItem.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Image {
+ id: rootItem
+
+ property bool created: false
+ property string image
+
+ property double scaledBottom: y + (height + height*scale) / 2
+ property bool onLand: scaledBottom > (window.height / 2 + window.centerOffset)
+
+ source: image
+ opacity: onLand ? 1 : 0.25
+ scale: Math.max((y + height - 250) * 0.01, 0.3)
+ smooth: true
+
+ onCreatedChanged: {
+ if (created && !onLand)
+ rootItem.destroy();
+ else
+ z = scaledBottom;
+ }
+
+ onYChanged: z = scaledBottom;
+}
diff --git a/examples/qml/dynamicscene/content/Sun.qml b/examples/qml/dynamicscene/content/Sun.qml
new file mode 100644
index 0000000000..b84516eecc
--- /dev/null
+++ b/examples/qml/dynamicscene/content/Sun.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Image {
+ id: sun
+
+ property bool created: false
+ property string image: "images/sun.png"
+
+ source: image
+
+ // once item is created, start moving offscreen
+ NumberAnimation on y {
+ to: (window.height / 2) + window.centerOffset
+ running: created
+ onRunningChanged: {
+ if (running)
+ duration = (window.height + window.centerOffset - sun.y) * 10;
+ else
+ state = "OffScreen"
+ }
+ }
+
+ states: State {
+ name: "OffScreen"
+ StateChangeScript {
+ script: { sun.created = false; sun.destroy() }
+ }
+ }
+
+ onCreatedChanged: {
+ if (created) {
+ sun.z = 1; // above the sky but below the ground layer
+ window.activeSuns++;
+ } else {
+ window.activeSuns--;
+ }
+ }
+}
diff --git a/examples/qml/dynamicscene/content/images/NOTE b/examples/qml/dynamicscene/content/images/NOTE
new file mode 100644
index 0000000000..fcd87f9132
--- /dev/null
+++ b/examples/qml/dynamicscene/content/images/NOTE
@@ -0,0 +1 @@
+Images (except star.png) are from the KDE project.
diff --git a/examples/qml/dynamicscene/content/images/face-smile.png b/examples/qml/dynamicscene/content/images/face-smile.png
new file mode 100644
index 0000000000..3d66d72578
--- /dev/null
+++ b/examples/qml/dynamicscene/content/images/face-smile.png
Binary files differ
diff --git a/examples/qml/dynamicscene/content/images/moon.png b/examples/qml/dynamicscene/content/images/moon.png
new file mode 100644
index 0000000000..1c0d6066a8
--- /dev/null
+++ b/examples/qml/dynamicscene/content/images/moon.png
Binary files differ
diff --git a/examples/qml/dynamicscene/content/images/rabbit_brown.png b/examples/qml/dynamicscene/content/images/rabbit_brown.png
new file mode 100644
index 0000000000..ebfdeed332
--- /dev/null
+++ b/examples/qml/dynamicscene/content/images/rabbit_brown.png
Binary files differ
diff --git a/examples/qml/dynamicscene/content/images/rabbit_bw.png b/examples/qml/dynamicscene/content/images/rabbit_bw.png
new file mode 100644
index 0000000000..7bff9b92ca
--- /dev/null
+++ b/examples/qml/dynamicscene/content/images/rabbit_bw.png
Binary files differ
diff --git a/examples/qml/dynamicscene/content/images/star.png b/examples/qml/dynamicscene/content/images/star.png
new file mode 100644
index 0000000000..27ef924267
--- /dev/null
+++ b/examples/qml/dynamicscene/content/images/star.png
Binary files differ
diff --git a/examples/qml/dynamicscene/content/images/sun.png b/examples/qml/dynamicscene/content/images/sun.png
new file mode 100644
index 0000000000..7713ca5ce7
--- /dev/null
+++ b/examples/qml/dynamicscene/content/images/sun.png
Binary files differ
diff --git a/examples/qml/dynamicscene/content/images/tree_s.png b/examples/qml/dynamicscene/content/images/tree_s.png
new file mode 100644
index 0000000000..6eac35a729
--- /dev/null
+++ b/examples/qml/dynamicscene/content/images/tree_s.png
Binary files differ
diff --git a/examples/qml/dynamicscene/content/itemCreation.js b/examples/qml/dynamicscene/content/itemCreation.js
new file mode 100644
index 0000000000..40f5415f9f
--- /dev/null
+++ b/examples/qml/dynamicscene/content/itemCreation.js
@@ -0,0 +1,62 @@
+var itemComponent = null;
+var draggedItem = null;
+var startingMouse;
+var posnInWindow;
+
+function startDrag(mouse)
+{
+ posnInWindow = paletteItem.mapToItem(window, 0, 0);
+ startingMouse = { x: mouse.x, y: mouse.y }
+ loadComponent();
+}
+
+//Creation is split into two functions due to an asynchronous wait while
+//possible external files are loaded.
+
+function loadComponent() {
+ if (itemComponent != null) { // component has been previously loaded
+ createItem();
+ return;
+ }
+
+ itemComponent = Qt.createComponent(paletteItem.componentFile);
+ if (itemComponent.status == Component.Loading) //Depending on the content, it can be ready or error immediately
+ component.statusChanged.connect(createItem);
+ else
+ createItem();
+}
+
+function createItem() {
+ if (itemComponent.status == Component.Ready && draggedItem == null) {
+ draggedItem = itemComponent.createObject(window, {"image": paletteItem.image, "x": posnInWindow.x, "y": posnInWindow.y, "z": 3});
+ // make sure created item is above the ground layer
+ } else if (itemComponent.status == Component.Error) {
+ draggedItem = null;
+ console.log("error creating component");
+ console.log(itemComponent.errorString());
+ }
+}
+
+function continueDrag(mouse)
+{
+ if (draggedItem == null)
+ return;
+
+ draggedItem.x = mouse.x + posnInWindow.x - startingMouse.x;
+ draggedItem.y = mouse.y + posnInWindow.y - startingMouse.y;
+}
+
+function endDrag(mouse)
+{
+ if (draggedItem == null)
+ return;
+
+ if (draggedItem.y < toolbox.height) { //Don't drop it in the toolbox
+ draggedItem.destroy();
+ draggedItem = null;
+ } else {
+ draggedItem.created = true;
+ draggedItem = null;
+ }
+}
+
diff --git a/examples/qml/dynamicscene/dynamicscene.qml b/examples/qml/dynamicscene/dynamicscene.qml
new file mode 100644
index 0000000000..c64df5cfc0
--- /dev/null
+++ b/examples/qml/dynamicscene/dynamicscene.qml
@@ -0,0 +1,275 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+import "content"
+
+Item {
+ id: window
+
+ property int activeSuns: 0
+ property int centerOffset: 72
+
+ height: 480; width: 320
+
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: window.focus = false;
+ }
+
+ //This is the message box that pops up when there's an error
+ Rectangle {
+ id: dialog
+
+ opacity: 0
+ anchors.centerIn: parent
+ width: dialogText.width + 6; height: dialogText.height + 6
+ border.color: 'black'
+ color: 'lightsteelblue'
+ z: 65535 //Arbitrary number chosen to be above all the items, including the scaled perspective ones.
+
+ function show(str){
+ dialogText.text = str;
+ dialogAnim.start();
+ }
+
+ Text {
+ id: dialogText
+ x: 3; y: 3
+ font.pixelSize: 14
+ }
+
+ SequentialAnimation {
+ id: dialogAnim
+ NumberAnimation { target: dialog; property:"opacity"; to: 1; duration: 1000 }
+ PauseAnimation { duration: 5000 }
+ NumberAnimation { target: dialog; property:"opacity"; to: 0; duration: 1000 }
+ }
+ }
+
+ Item {
+ id: scene
+ anchors { top: sky.top; bottom: ground.bottom; left: parent.left; right: parent.right}
+ z: 10
+ }
+
+ // sky
+ Rectangle {
+ id: sky
+ anchors { left: parent.left; top: toolbox.bottom; right: parent.right; bottomMargin: -centerOffset; bottom: parent.verticalCenter }
+ gradient: Gradient {
+ GradientStop { id: gradientStopA; position: 0.0; color: "#0E1533" }
+ GradientStop { id: gradientStopB; position: 1.0; color: "#437284" }
+ }
+ }
+
+ // stars (when there's no sun)
+ ParticleSystem {
+ id: particlesystem
+ anchors.fill: sky
+
+ ImageParticle {
+ id: stars
+ source: "content/images/star.png"
+ groups: ["stars"]
+ opacity: .5
+ }
+
+ Emitter {
+ id: starsemitter
+ anchors.fill: parent
+ emitRate: parent.width / 50
+ lifeSpan: 5000
+ group: "stars"
+ }
+ }
+
+ // ground
+ Rectangle {
+ id: ground
+ z: 2 // just above the sun so that the sun can set behind it
+ anchors { left: parent.left; top: parent.verticalCenter; topMargin: centerOffset; right: parent.right; bottom: parent.bottom }
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "ForestGreen" }
+ GradientStop { position: 1.0; color: "DarkGreen" }
+ }
+ }
+
+ SystemPalette { id: activePalette }
+
+ // right-hand panel
+ Rectangle {
+ id: toolbox
+
+ height: centerOffset * 2
+ color: activePalette.window
+ anchors { right: parent.right; top: parent.top; left: parent.left}
+
+ Column {
+ anchors.centerIn: parent
+ spacing: 8
+
+ Text { text: "Drag an item into the scene." }
+
+ Rectangle {
+ width: palette.width + 10; height: palette.height + 10
+ border.color: "black"
+
+ Row {
+ id: palette
+ anchors.centerIn: parent
+ spacing: 8
+
+ PaletteItem {
+ anchors.verticalCenter: parent.verticalCenter
+ componentFile: "Sun.qml"
+ source: "content/images/sun.png"
+ image: "images/sun.png"
+ }
+ PaletteItem {
+ anchors.verticalCenter: parent.verticalCenter
+ componentFile: "GenericSceneItem.qml"
+ source: "content/images/moon.png"
+ image: "images/moon.png"
+ }
+ PaletteItem {
+ anchors.verticalCenter: parent.verticalCenter
+ componentFile: "PerspectiveItem.qml"
+ source: "content/images/tree_s.png"
+ image: "images/tree_s.png"
+ }
+ PaletteItem {
+ anchors.verticalCenter: parent.verticalCenter
+ componentFile: "PerspectiveItem.qml"
+ source: "content/images/rabbit_brown.png"
+ image: "images/rabbit_brown.png"
+ }
+ PaletteItem {
+ anchors.verticalCenter: parent.verticalCenter
+ componentFile: "PerspectiveItem.qml"
+ source: "content/images/rabbit_bw.png"
+ image: "images/rabbit_bw.png"
+ }
+ }
+ }
+
+ Text { text: "Active Suns: " + activeSuns }
+ }
+ }
+
+ //Popup toolbox down the bottom
+ Rectangle {
+ id: popupToolbox
+ z: 1000
+ width: parent.width
+ height: popupColumn.height + 16
+ color: activePalette.window
+
+ property bool poppedUp: false
+ property int downY: window.height - (createButton.height + 16)
+ property int upY: window.height - (popupColumn.height + 16)
+ y: poppedUp ? upY : downY
+ Behavior on y { NumberAnimation {}}
+
+ Column {
+ id: popupColumn
+ y: 8
+ anchors.centerIn: parent
+ spacing: 8
+
+ Row {
+ height: createButton.height
+ spacing: 8
+ Text { text: "Custom QML:"; anchors.verticalCenter: parent.verticalCenter }
+ Button {
+ id: popupButton
+ text: popupToolbox.poppedUp ? "Hide" : "Show"
+ onClicked: popupToolbox.poppedUp = !popupToolbox.poppedUp
+ }
+ Button {
+ id: createButton
+ text: "Create"
+ onClicked: {
+ try {
+ Qt.createQmlObject(qmlText.text, scene, 'CustomObject');
+ } catch(err) {
+ dialog.show('Error on line ' + err.qmlErrors[0].lineNumber + '\n' + err.qmlErrors[0].message);
+ }
+ }
+ }
+
+ }
+
+ Rectangle {
+ width: 360; height: 240
+
+ TextEdit {
+ id: qmlText
+ anchors.fill: parent; anchors.margins: 5
+ readOnly: false
+ font.pixelSize: 14
+ selectByMouse: true
+ wrapMode: TextEdit.WordWrap
+
+ text: "import QtQuick 2.0\nImage {\n id: smile\n x: 360 * Math.random()\n y: 180 * Math.random() \n source: 'content/images/face-smile.png'\n NumberAnimation on opacity { \n to: 0; duration: 1500\n }\n Component.onCompleted: smile.destroy(1500);\n}"
+ }
+ }
+ }
+ }
+
+ //Day state, for when a sun is added to the scene
+ states: State {
+ name: "Day"
+ when: window.activeSuns > 0
+
+ PropertyChanges { target: gradientStopA; color: "DeepSkyBlue" }
+ PropertyChanges { target: gradientStopB; color: "SkyBlue" }
+ PropertyChanges { target: stars; opacity: 0 }
+ }
+
+ //! [top-level transitions]
+ transitions: Transition {
+ PropertyAnimation { duration: 3000 }
+ ColorAnimation { duration: 3000 }
+ }
+ //! [top-level transitions]
+}
diff --git a/examples/qml/qml.pro b/examples/qml/qml.pro
index 23d33bd653..967108504e 100644
--- a/examples/qml/qml.pro
+++ b/examples/qml/qml.pro
@@ -1,38 +1 @@
TEMPLATE = subdirs
-
-# These examples contain some C++ and need to be built
-SUBDIRS = \
- cppextensions \
- minehunt \
- modelviews \
- painteditem \
- tutorials \
- script
-
-# These examples contain no C++ and can simply be copied
-sources.files = \
- animation \
- calculator \
- cppextensions \
- flickr \
- i18n \
- imageelements \
- keyinteraction \
- photoviewer \
- positioners \
- rssnews \
- samegame \
- snake \
- sqllocalstorage \
- text \
- threading \
- touchinteraction \
- toys \
- twitter \
- ui-components \
- webbrowser \
- xml
-
-
-sources.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml
-INSTALLS += sources
diff --git a/examples/qml/xmlhttprequest/data.xml b/examples/qml/xmlhttprequest/data.xml
new file mode 100644
index 0000000000..8b7f1e116d
--- /dev/null
+++ b/examples/qml/xmlhttprequest/data.xml
@@ -0,0 +1,5 @@
+<data>
+ <element1 />
+ <element2 />
+</data>
+
diff --git a/examples/qml/xmlhttprequest/xmlhttprequest-example.qml b/examples/qml/xmlhttprequest/xmlhttprequest-example.qml
new file mode 100644
index 0000000000..28ba078160
--- /dev/null
+++ b/examples/qml/xmlhttprequest/xmlhttprequest-example.qml
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 350; height: 400
+
+ function showRequestInfo(text) {
+ log.text = log.text + "\n" + text
+ console.log(text)
+ }
+
+ Text { id: log; anchors.fill: parent; anchors.margins: 10 }
+
+ Rectangle {
+ id: button
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom; anchors.margins: 10
+ width: buttonText.width + 10; height: buttonText.height + 10
+ border.width: mouseArea.pressed ? 2 : 1
+ radius : 5; smooth: true
+
+ Text { id: buttonText; anchors.centerIn: parent; text: "Request data.xml" }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: {
+ log.text = ""
+ console.log("\n")
+
+ var doc = new XMLHttpRequest();
+ doc.onreadystatechange = function() {
+ if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
+ showRequestInfo("Headers -->");
+ showRequestInfo(doc.getAllResponseHeaders ());
+ showRequestInfo("Last modified -->");
+ showRequestInfo(doc.getResponseHeader ("Last-Modified"));
+
+ } else if (doc.readyState == XMLHttpRequest.DONE) {
+ var a = doc.responseXML.documentElement;
+ for (var ii = 0; ii < a.childNodes.length; ++ii) {
+ showRequestInfo(a.childNodes[ii].nodeName);
+ }
+ showRequestInfo("Headers -->");
+ showRequestInfo(doc.getAllResponseHeaders ());
+ showRequestInfo("Last modified -->");
+ showRequestInfo(doc.getResponseHeader ("Last-Modified"));
+ }
+ }
+
+ doc.open("GET", "data.xml");
+ doc.send();
+ }
+ }
+ }
+}
+
diff --git a/examples/quick/accessibility/accessibility.pro b/examples/quick/accessibility/accessibility.pro
new file mode 100644
index 0000000000..2826161945
--- /dev/null
+++ b/examples/quick/accessibility/accessibility.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+
+QT += quick qml
+SOURCES += main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/accessibility
+qml.files = accessibility.qml content
+qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/accessibility
+INSTALLS += target qml
+
diff --git a/examples/quick/accessibility/accessibility.qml b/examples/quick/accessibility/accessibility.qml
new file mode 100644
index 0000000000..2804d2abc8
--- /dev/null
+++ b/examples/quick/accessibility/accessibility.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+/*!
+ \title QtQuick Examples - Accessibility
+ \example qtquick/accessibility
+ \brief This example has accessible buttons.
+
+*/
+
+Rectangle {
+ id: window
+
+ width: 320; height: 480
+ color: "white"
+
+ Column {
+ id: column
+ spacing: 6
+ anchors.fill: parent
+ width: parent.width
+ Row {
+ spacing: 6
+ width: column.width
+ Button { width: 100; height: column.h + 20; text: "Send" }
+ Button { width: 100; height: column.h + 20; text: "Discard" }
+ }
+
+ Row {
+ spacing: 6
+ width: column.width
+ height: column.h
+ Text {
+ id: subjectLabel
+ Accessible.role: Accessible.StaticText
+ Accessible.name: text
+ text: "Subject:"
+ }
+ Rectangle {
+ id: subjectBorder
+ Accessible.role: Accessible.EditableText
+ Accessible.name: subjectEdit.text
+ border.width: 1
+ border.color: "black"
+ height: subjectEdit.height
+ width: 240
+ TextInput {
+ id: subjectEdit
+ text: "Vacation plans"
+ }
+ }
+ }
+ Rectangle {
+ id: textBorder
+ Accessible.role: Accessible.EditableText
+ property alias text : textEdit.text
+ border.width: 1
+ border.color: "black"
+ width: parent.width - 2
+ height: parent.height - (textBorder.y + column.spacing)
+ TextEdit {
+ id: textEdit
+ text: "Hi, we're going to the Dolomites this summer. Weren't you also going to northern Italy? \n\nbest wishes, your friend Luke"
+ width: parent.width
+ wrapMode: TextEdit.WordWrap
+ }
+ }
+ }
+}
diff --git a/examples/quick/accessibility/accessibility.qmlproject b/examples/quick/accessibility/accessibility.qmlproject
new file mode 100644
index 0000000000..04a3190914
--- /dev/null
+++ b/examples/quick/accessibility/accessibility.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "accessibility.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/accessibility/content/Button.qml b/examples/quick/accessibility/content/Button.qml
new file mode 100644
index 0000000000..2c203abe11
--- /dev/null
+++ b/examples/quick/accessibility/content/Button.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: button
+
+ property bool checked: false
+ property alias text : buttonText.text
+ Accessible.name: text
+ Accessible.description: "This button does " + text
+ Accessible.role: Accessible.Button
+
+ signal clicked
+
+ width: buttonText.width + 20
+ height: 30
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "lightsteelblue" }
+ GradientStop { position: 1.0; color: "blue" }
+ }
+ border.width: 2
+ border.color: "black";
+ radius: 10
+
+ Text {
+ id: buttonText
+ text: parent.description
+ anchors.centerIn: parent
+ font.pixelSize: parent.height * .5
+ style: Text.Sunken; color: "white"; styleColor: "black"; smooth: true
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: {
+ checked = !checked;
+ }
+ }
+}
diff --git a/examples/quick/accessibility/main.cpp b/examples/quick/accessibility/main.cpp
new file mode 100644
index 0000000000..89e23b477b
--- /dev/null
+++ b/examples/quick/accessibility/main.cpp
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "../../shared/shared.h"
+DECLARATIVE_EXAMPLE_MAIN(accessibility)
diff --git a/examples/quick/animation/animation.pro b/examples/quick/animation/animation.pro
new file mode 100644
index 0000000000..cdf83f80c8
--- /dev/null
+++ b/examples/quick/animation/animation.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+
+QT += quick qml
+SOURCES += main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/animation
+qml.files = animation.qml basics behaviors easing pathanimation pathinterpolator states
+qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/animation
+INSTALLS += target qml
+
diff --git a/examples/quick/animation/animation.qml b/examples/quick/animation/animation.qml
new file mode 100644
index 0000000000..bca68457d9
--- /dev/null
+++ b/examples/quick/animation/animation.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../../shared" as Examples
+
+/*!
+ \title QtQuick Examples - Animation
+ \example qtquick/animation
+ \brief This is a collection of QML Animation examples.
+ \image qml-animations-example.png
+
+ This is a collection of small QML examples relating to animation. Each example is
+ a small QML file emphasizing a particular element or feature.
+
+ ColorAnimation demonstrates using a color animation to fade a sky from day to night.
+
+ PropertyAnimation demonstrates using a number animation to bounce a circle up and down.
+
+ Behaviors demonstrates using behaviors to animate moving a rectangle to whereever you click.
+
+ Wiggly Text demonstrates using more complex behaviors to animate and wiggle some text around as you drag it.
+
+ Tv Tennis demonstrates using more complex behaviors to get paddles following a ball for an infinite game.
+
+ Easing Curves shows off all the easing curves available in Qt Quick animations.
+
+ States demonstrates how the properties of an item can vary between states.
+
+ Transitions takes the States example and animates the property changes.
+
+ PathAnimation animates an image along a beizer curve using a PathAnimation.
+
+ PathInterpolator animates an image along the same beizer curve, using a PathInterpolator instead.
+*/
+
+Item {
+ height: 480
+ width: 320
+ Examples.LauncherList {
+ id: ll
+ anchors.fill: parent
+ Component.onCompleted: {
+ addExample("ColorAnimation", "Interpolates between colors", Qt.resolvedUrl("basics/color-animation.qml"));
+ addExample("PropertyAnimation", "Interpolates between numbers", Qt.resolvedUrl("basics/property-animation.qml"));
+ addExample("Behaviors", "Animates procedural movement", Qt.resolvedUrl("behaviors/behavior-example.qml"));
+ addExample("Wiggly Text", "Text that wiggles as you drag it", Qt.resolvedUrl("behaviors/wigglytext.qml"));
+ addExample("Tv Tennis", "Paddles that follow a ball", Qt.resolvedUrl("behaviors/tvtennis.qml"));
+ addExample("Easing Curves", "Compare available easing curves", Qt.resolvedUrl("easing/easing.qml"));
+ addExample("States", "Simple states", Qt.resolvedUrl("states/states.qml"));
+ addExample("Transitions", "Simple states with animated transitions", Qt.resolvedUrl("states/transitions.qml"));
+ addExample("PathAnimation", "Animate along a path", Qt.resolvedUrl("pathanimation/pathanimation.qml"));
+ addExample("PathInterpolator", "Interpolates along a path", Qt.resolvedUrl("pathinterpolator/pathinterpolator.qml"));
+ }
+ }
+}
diff --git a/examples/quick/animation/animation.qmlproject b/examples/quick/animation/animation.qmlproject
new file mode 100644
index 0000000000..2e96daa881
--- /dev/null
+++ b/examples/quick/animation/animation.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "animation.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/animation/basics/color-animation.qml b/examples/quick/animation/basics/color-animation.qml
new file mode 100644
index 0000000000..f1bf40c40b
--- /dev/null
+++ b/examples/quick/animation/basics/color-animation.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+Item {
+ id: window
+ width: 320; height: 480
+
+ // Let's draw the sky...
+ Rectangle {
+ anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation { from: "DeepSkyBlue"; to: "#0E1533"; duration: 5000 }
+ ColorAnimation { from: "#0E1533"; to: "DeepSkyBlue"; duration: 5000 }
+ }
+ }
+ GradientStop {
+ position: 1.0
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation { from: "SkyBlue"; to: "#437284"; duration: 5000 }
+ ColorAnimation { from: "#437284"; to: "SkyBlue"; duration: 5000 }
+ }
+ }
+ }
+ }
+
+ // the sun, moon, and stars
+ Item {
+ width: parent.width; height: 2 * parent.height
+ NumberAnimation on rotation { from: 0; to: 360; duration: 10000; loops: Animation.Infinite }
+ Image {
+ source: "images/sun.png"; y: 10; anchors.horizontalCenter: parent.horizontalCenter
+ rotation: -3 * parent.rotation
+ }
+ Image {
+ source: "images/moon.png"; y: parent.height - 74; anchors.horizontalCenter: parent.horizontalCenter
+ rotation: -parent.rotation
+ }
+ ParticleSystem {
+ id: particlesystem
+ x: 0; y: parent.height/2
+ width: parent.width; height: parent.height/2
+ ImageParticle {
+ source: "images/star.png"
+ groups: ["star"]
+ color: "#00333333"
+ SequentialAnimation on opacity {
+ loops: Animation.Infinite
+ NumberAnimation { from: 0; to: 1; duration: 5000 }
+ NumberAnimation { from: 1; to: 0; duration: 5000 }
+ }
+ }
+ Emitter {
+ group: "star"
+ anchors.fill: parent
+ emitRate: parent.width / 50
+ lifeSpan: 5000
+ }
+ }
+ }
+
+ // ...and the ground.
+ Rectangle {
+ anchors { left: parent.left; top: parent.verticalCenter; right: parent.right; bottom: parent.bottom }
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ SequentialAnimation on color {
+ loops: Animation.Infinite
+ ColorAnimation { from: "ForestGreen"; to: "#001600"; duration: 5000 }
+ ColorAnimation { from: "#001600"; to: "ForestGreen"; duration: 5000 }
+ }
+ }
+ GradientStop { position: 1.0; color: "DarkGreen" }
+ }
+ }
+}
diff --git a/examples/quick/animation/basics/images/face-smile.png b/examples/quick/animation/basics/images/face-smile.png
new file mode 100644
index 0000000000..3d66d72578
--- /dev/null
+++ b/examples/quick/animation/basics/images/face-smile.png
Binary files differ
diff --git a/examples/quick/animation/basics/images/moon.png b/examples/quick/animation/basics/images/moon.png
new file mode 100644
index 0000000000..9407b2b4f0
--- /dev/null
+++ b/examples/quick/animation/basics/images/moon.png
Binary files differ
diff --git a/examples/quick/animation/basics/images/shadow.png b/examples/quick/animation/basics/images/shadow.png
new file mode 100644
index 0000000000..8270565e87
--- /dev/null
+++ b/examples/quick/animation/basics/images/shadow.png
Binary files differ
diff --git a/examples/quick/animation/basics/images/star.png b/examples/quick/animation/basics/images/star.png
new file mode 100644
index 0000000000..27ef924267
--- /dev/null
+++ b/examples/quick/animation/basics/images/star.png
Binary files differ
diff --git a/examples/quick/animation/basics/images/sun.png b/examples/quick/animation/basics/images/sun.png
new file mode 100644
index 0000000000..7713ca5ce7
--- /dev/null
+++ b/examples/quick/animation/basics/images/sun.png
Binary files differ
diff --git a/examples/quick/animation/basics/property-animation.qml b/examples/quick/animation/basics/property-animation.qml
new file mode 100644
index 0000000000..4a4d3e3b2a
--- /dev/null
+++ b/examples/quick/animation/basics/property-animation.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: window
+ width: 320; height: 480
+
+ // Let's draw the sky...
+ Rectangle {
+ anchors { left: parent.left; top: parent.top; right: parent.right; bottom: parent.verticalCenter }
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "DeepSkyBlue" }
+ GradientStop { position: 1.0; color: "LightSkyBlue" }
+ }
+ }
+
+ // ...and the ground.
+ Rectangle {
+ anchors { left: parent.left; top: parent.verticalCenter; right: parent.right; bottom: parent.bottom }
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "ForestGreen" }
+ GradientStop { position: 1.0; color: "DarkGreen" }
+ }
+ }
+
+ // The shadow for the smiley face
+ Image {
+ anchors.horizontalCenter: parent.horizontalCenter
+ y: smiley.minHeight + 58
+ source: "images/shadow.png"
+
+ // The scale property depends on the y position of the smiley face.
+ scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight)
+ }
+
+ Image {
+ id: smiley
+ property int maxHeight: window.height / 3
+ property int minHeight: 2 * window.height / 3
+
+ anchors.horizontalCenter: parent.horizontalCenter
+ y: minHeight
+ source: "images/face-smile.png"
+
+ // Animate the y property. Setting loops to Animation.Infinite makes the
+ // animation repeat indefinitely, otherwise it would only run once.
+ SequentialAnimation on y {
+ loops: Animation.Infinite
+
+ // Move from minHeight to maxHeight in 300ms, using the OutExpo easing function
+ NumberAnimation {
+ from: smiley.minHeight; to: smiley.maxHeight
+ easing.type: Easing.OutExpo; duration: 300
+ }
+
+ // Then move back to minHeight in 1 second, using the OutBounce easing function
+ NumberAnimation {
+ from: smiley.maxHeight; to: smiley.minHeight
+ easing.type: Easing.OutBounce; duration: 1000
+ }
+
+ // Then pause for 500ms
+ PauseAnimation { duration: 500 }
+ }
+ }
+}
diff --git a/examples/quick/animation/behaviors/SideRect.qml b/examples/quick/animation/behaviors/SideRect.qml
new file mode 100644
index 0000000000..623c6965d8
--- /dev/null
+++ b/examples/quick/animation/behaviors/SideRect.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: myRect
+
+ property string text
+
+ width: 75; height: 50
+ radius: 6
+ color: "#646464"
+ border.width: 4; border.color: "white"
+
+ MouseArea {
+ anchors.fill: parent
+ hoverEnabled: true
+ onEntered: {
+ focusRect.x = myRect.x;
+ focusRect.y = myRect.y;
+ focusRect.text = myRect.text;
+ }
+ }
+}
diff --git a/examples/quick/animation/behaviors/behavior-example.qml b/examples/quick/animation/behaviors/behavior-example.qml
new file mode 100644
index 0000000000..a88d7c8c7b
--- /dev/null
+++ b/examples/quick/animation/behaviors/behavior-example.qml
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 320; height: 480
+ color: "#343434"
+
+ Rectangle {
+ anchors.centerIn: parent
+ width: 200; height: 200
+ radius: 30
+ color: "transparent"
+ border.width: 4; border.color: "white"
+
+
+ SideRect {
+ id: leftRect
+ anchors { verticalCenter: parent.verticalCenter; horizontalCenter: parent.left }
+ text: "Left"
+ }
+
+ SideRect {
+ id: rightRect
+ anchors { verticalCenter: parent.verticalCenter; horizontalCenter: parent.right }
+ text: "Right"
+ }
+
+ SideRect {
+ id: topRect
+ anchors { verticalCenter: parent.top; horizontalCenter: parent.horizontalCenter }
+ text: "Top"
+ }
+
+ SideRect {
+ id: bottomRect
+ anchors { verticalCenter: parent.bottom; horizontalCenter: parent.horizontalCenter }
+ text: "Bottom"
+ }
+
+
+ Rectangle {
+ id: focusRect
+
+ property string text
+
+ x: 62; y: 75; width: 75; height: 50
+ radius: 6
+ border.width: 4; border.color: "white"
+ color: "firebrick"
+
+ // Set an 'elastic' behavior on the focusRect's x property.
+ Behavior on x {
+ NumberAnimation { easing.type: Easing.OutElastic; easing.amplitude: 3.0; easing.period: 2.0; duration: 300 }
+ }
+
+ // Set an 'elastic' behavior on the focusRect's y property.
+ Behavior on y {
+ NumberAnimation { easing.type: Easing.OutElastic; easing.amplitude: 3.0; easing.period: 2.0; duration: 300 }
+ }
+
+ Text {
+ id: focusText
+ text: focusRect.text
+ anchors.centerIn: parent
+ color: "white"
+ font.pixelSize: 16; font.bold: true
+
+ // Set a behavior on the focusText's x property:
+ // Set the opacity to 0, set the new text value, then set the opacity back to 1.
+ Behavior on text {
+ SequentialAnimation {
+ NumberAnimation { target: focusText; property: "opacity"; to: 0; duration: 150 }
+ NumberAnimation { target: focusText; property: "opacity"; to: 1; duration: 150 }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quick/animation/behaviors/tvtennis.qml b/examples/quick/animation/behaviors/tvtennis.qml
new file mode 100644
index 0000000000..108f19a11d
--- /dev/null
+++ b/examples/quick/animation/behaviors/tvtennis.qml
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: page
+ width: 320; height: 480;
+ color: "Black"
+
+ // Make a ball to bounce
+ Rectangle {
+ id: ball
+
+ // Add a property for the target y coordinate
+ property variant direction : "right"
+
+ x: 20; width: 20; height: 20; z: 1
+ color: "Lime"
+
+ // Move the ball to the right and back to the left repeatedly
+ SequentialAnimation on x {
+ loops: Animation.Infinite
+ NumberAnimation { to: page.width - 40; duration: 2000 }
+ PropertyAction { target: ball; property: "direction"; value: "left" }
+ NumberAnimation { to: 20; duration: 2000 }
+ PropertyAction { target: ball; property: "direction"; value: "right" }
+ }
+
+ // Make y move with a velocity of 200
+ Behavior on y { SpringAnimation{ velocity: 200; }
+ }
+
+ Component.onCompleted: y = page.height-10; // start the ball motion
+
+ // Detect the ball hitting the top or bottom of the view and bounce it
+ onYChanged: {
+ if (y <= 0) {
+ y = page.height - 20;
+ } else if (y >= page.height - 20) {
+ y = 0;
+ }
+ }
+ }
+
+ // Place bats to the left and right of the view, following the y
+ // coordinates of the ball.
+ Rectangle {
+ id: leftBat
+ color: "Lime"
+ x: 2; width: 20; height: 90
+ y: ball.direction == 'left' ? ball.y - 45 : page.height/2 -45;
+ Behavior on y { SpringAnimation{ velocity: 300 } }
+ }
+ Rectangle {
+ id: rightBat
+ color: "Lime"
+ x: page.width - 22; width: 20; height: 90
+ y: ball.direction == 'right' ? ball.y - 45 : page.height/2 -45;
+ Behavior on y { SpringAnimation{ velocity: 300 } }
+ }
+
+ // The rest, to make it look realistic, if neither ever scores...
+ Rectangle { color: "Lime"; x: page.width/2-80; y: 0; width: 40; height: 60 }
+ Rectangle { color: "Black"; x: page.width/2-70; y: 10; width: 20; height: 40 }
+ Rectangle { color: "Lime"; x: page.width/2+40; y: 0; width: 40; height: 60 }
+ Rectangle { color: "Black"; x: page.width/2+50; y: 10; width: 20; height: 40 }
+ Repeater {
+ model: page.height / 20
+ Rectangle { color: "Lime"; x: page.width/2-5; y: index * 20; width: 10; height: 10 }
+ }
+}
diff --git a/examples/quick/animation/behaviors/wigglytext.qml b/examples/quick/animation/behaviors/wigglytext.qml
new file mode 100644
index 0000000000..4bb94da100
--- /dev/null
+++ b/examples/quick/animation/behaviors/wigglytext.qml
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+
+ property string text: "Drag me!"
+ property bool animated: true
+
+ width: 320; height: 480; color: "#474747"; focus: true
+
+ Keys.onPressed: {
+ if (event.key == Qt.Key_Delete || event.key == Qt.Key_Backspace)
+ container.remove()
+ else if (event.text != "") {
+ container.append(event.text)
+ }
+ }
+
+ function append(text) {
+ container.animated = false
+ var lastLetter = container.children[container.children.length - 1]
+ var newLetter = letterComponent.createObject(container)
+ newLetter.text = text
+ newLetter.follow = lastLetter
+ container.animated = true
+ }
+
+ function remove() {
+ if (container.children.length)
+ container.children[container.children.length - 1].destroy()
+ }
+
+ function doLayout() {
+ var follow = null
+ for (var i = 0; i < container.text.length; ++i) {
+ var newLetter = letterComponent.createObject(container)
+ newLetter.text = container.text[i]
+ newLetter.follow = follow
+ follow = newLetter
+ }
+ }
+
+ Component {
+ id: letterComponent
+ Text {
+ id: letter
+ property variant follow
+
+ x: follow ? follow.x + follow.width : container.width / 6
+ y: follow ? follow.y : container.height / 2
+
+ font.pixelSize: 40; font.bold: true
+ color: "#999999"; styleColor: "#222222"; style: Text.Raised
+
+ MouseArea {
+ anchors.fill: parent
+ drag.target: letter; drag.axis: Drag.XandYAxis
+ onPressed: letter.color = "#dddddd"
+ onReleased: letter.color = "#999999"
+ }
+
+ Behavior on x { enabled: container.animated; SpringAnimation { spring: 3; damping: 0.3; mass: 1.0 } }
+ Behavior on y { enabled: container.animated; SpringAnimation { spring: 3; damping: 0.3; mass: 1.0 } }
+ }
+ }
+
+ Component.onCompleted: doLayout()
+}
diff --git a/examples/quick/animation/easing/content/QuitButton.qml b/examples/quick/animation/easing/content/QuitButton.qml
new file mode 100644
index 0000000000..702b892d23
--- /dev/null
+++ b/examples/quick/animation/easing/content/QuitButton.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+Image {
+ source: "quit.png"
+ scale: quitMouse.pressed ? 0.8 : 1.0
+ smooth: quitMouse.pressed
+ MouseArea {
+ id: quitMouse
+ anchors.fill: parent
+ anchors.margins: -10
+ onClicked: Qt.quit()
+ }
+}
diff --git a/examples/quick/animation/easing/content/quit.png b/examples/quick/animation/easing/content/quit.png
new file mode 100644
index 0000000000..b822057d4e
--- /dev/null
+++ b/examples/quick/animation/easing/content/quit.png
Binary files differ
diff --git a/examples/quick/animation/easing/easing.qml b/examples/quick/animation/easing/easing.qml
new file mode 100644
index 0000000000..8977029fb3
--- /dev/null
+++ b/examples/quick/animation/easing/easing.qml
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ id: window
+ width: 320; height: 480; color: "#232323"
+
+ property var easingCurve: [ 0.2, 0.2, 0.13, 0.65, 0.2, 0.8,
+ 0.624, 0.98, 0.93, 0.95, 1, 1 ]
+
+ ListModel {
+ id: easingTypes
+ ListElement { name: "Easing.Linear"; type: Easing.Linear; ballColor: "DarkRed" }
+ ListElement { name: "Easing.InQuad"; type: Easing.InQuad; ballColor: "IndianRed" }
+ ListElement { name: "Easing.OutQuad"; type: Easing.OutQuad; ballColor: "Salmon" }
+ ListElement { name: "Easing.InOutQuad"; type: Easing.InOutQuad; ballColor: "Tomato" }
+ ListElement { name: "Easing.OutInQuad"; type: Easing.OutInQuad; ballColor: "DarkOrange" }
+ ListElement { name: "Easing.InCubic"; type: Easing.InCubic; ballColor: "Gold" }
+ ListElement { name: "Easing.OutCubic"; type: Easing.OutCubic; ballColor: "Yellow" }
+ ListElement { name: "Easing.InOutCubic"; type: Easing.InOutCubic; ballColor: "PeachPuff" }
+ ListElement { name: "Easing.OutInCubic"; type: Easing.OutInCubic; ballColor: "Thistle" }
+ ListElement { name: "Easing.InQuart"; type: Easing.InQuart; ballColor: "Orchid" }
+ ListElement { name: "Easing.OutQuart"; type: Easing.OutQuart; ballColor: "Purple" }
+ ListElement { name: "Easing.InOutQuart"; type: Easing.InOutQuart; ballColor: "SlateBlue" }
+ ListElement { name: "Easing.OutInQuart"; type: Easing.OutInQuart; ballColor: "Chartreuse" }
+ ListElement { name: "Easing.InQuint"; type: Easing.InQuint; ballColor: "LimeGreen" }
+ ListElement { name: "Easing.OutQuint"; type: Easing.OutQuint; ballColor: "SeaGreen" }
+ ListElement { name: "Easing.InOutQuint"; type: Easing.InOutQuint; ballColor: "DarkGreen" }
+ ListElement { name: "Easing.OutInQuint"; type: Easing.OutInQuint; ballColor: "Olive" }
+ ListElement { name: "Easing.InSine"; type: Easing.InSine; ballColor: "DarkSeaGreen" }
+ ListElement { name: "Easing.OutSine"; type: Easing.OutSine; ballColor: "Teal" }
+ ListElement { name: "Easing.InOutSine"; type: Easing.InOutSine; ballColor: "Turquoise" }
+ ListElement { name: "Easing.OutInSine"; type: Easing.OutInSine; ballColor: "SteelBlue" }
+ ListElement { name: "Easing.InExpo"; type: Easing.InExpo; ballColor: "SkyBlue" }
+ ListElement { name: "Easing.OutExpo"; type: Easing.OutExpo; ballColor: "RoyalBlue" }
+ ListElement { name: "Easing.InOutExpo"; type: Easing.InOutExpo; ballColor: "MediumBlue" }
+ ListElement { name: "Easing.OutInExpo"; type: Easing.OutInExpo; ballColor: "MidnightBlue" }
+ ListElement { name: "Easing.InCirc"; type: Easing.InCirc; ballColor: "CornSilk" }
+ ListElement { name: "Easing.OutCirc"; type: Easing.OutCirc; ballColor: "Bisque" }
+ ListElement { name: "Easing.InOutCirc"; type: Easing.InOutCirc; ballColor: "RosyBrown" }
+ ListElement { name: "Easing.OutInCirc"; type: Easing.OutInCirc; ballColor: "SandyBrown" }
+ ListElement { name: "Easing.InElastic"; type: Easing.InElastic; ballColor: "DarkGoldenRod" }
+ ListElement { name: "Easing.OutElastic"; type: Easing.OutElastic; ballColor: "Chocolate" }
+ ListElement { name: "Easing.InOutElastic"; type: Easing.InOutElastic; ballColor: "SaddleBrown" }
+ ListElement { name: "Easing.OutInElastic"; type: Easing.OutInElastic; ballColor: "Brown" }
+ ListElement { name: "Easing.InBack"; type: Easing.InBack; ballColor: "Maroon" }
+ ListElement { name: "Easing.OutBack"; type: Easing.OutBack; ballColor: "LavenderBlush" }
+ ListElement { name: "Easing.InOutBack"; type: Easing.InOutBack; ballColor: "MistyRose" }
+ ListElement { name: "Easing.OutInBack"; type: Easing.OutInBack; ballColor: "Gainsboro" }
+ ListElement { name: "Easing.OutBounce"; type: Easing.OutBounce; ballColor: "Silver" }
+ ListElement { name: "Easing.InBounce"; type: Easing.InBounce; ballColor: "DimGray" }
+ ListElement { name: "Easing.InOutBounce"; type: Easing.InOutBounce; ballColor: "SlateGray" }
+ ListElement { name: "Easing.OutInBounce"; type: Easing.OutInBounce; ballColor: "DarkSlateGray" }
+ ListElement { name: "Easing.Bezier"; type: Easing.Bezier; ballColor: "Chartreuse"; }
+ }
+
+ Component {
+ id: delegate
+
+ Item {
+ height: 56; width: window.width
+
+ Text { text: name; anchors.centerIn: parent; color: "White" }
+
+ Rectangle {
+ id: slot1; color: "#121212"; x: 30; height: 46; width: 46
+ border.color: "#343434"; border.width: 1; radius: 12
+ anchors.verticalCenter: parent.verticalCenter
+ }
+
+ Rectangle {
+ id: slot2; color: "#121212"; x: window.width - 76; height: 46; width: 46
+ border.color: "#343434"; border.width: 1; radius: 12
+ anchors.verticalCenter: parent.verticalCenter
+ }
+
+ Rectangle {
+ id: rect; x: 30; color: "#454545"
+ border.color: "White"; border.width: 2
+ height: 46; width: 46; radius: 12
+ anchors.verticalCenter: parent.verticalCenter
+
+ MouseArea {
+ onClicked: if (rect.state == '') rect.state = "right"; else rect.state = ''
+ anchors.fill: parent
+ anchors.margins: -5 // Make MouseArea bigger than the rectangle, itself
+ }
+
+ states : State {
+ name: "right"
+ PropertyChanges { target: rect; x: window.width - 76; color: ballColor }
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "x"; easing.type: type; easing.bezierCurve: getBezierCurve(name); duration: 1000 }
+ ColorAnimation { properties: "color"; easing.type: type; easing.bezierCurve: getBezierCurve(name); duration: 1000 }
+ }
+ }
+ }
+ }
+
+ Flickable {
+ anchors.fill: parent
+ contentHeight: layout.height
+ Column {
+ id: layout
+ Repeater { model: easingTypes; delegate: delegate }
+ }
+ }
+
+ function getBezierCurve(name)
+ {
+ if (name === "Easing.Bezier")
+ return easingCurve;
+ return [];
+ }
+}
diff --git a/examples/quick/animation/main.cpp b/examples/quick/animation/main.cpp
new file mode 100644
index 0000000000..799dfd7725
--- /dev/null
+++ b/examples/quick/animation/main.cpp
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "../../shared/shared.h"
+DECLARATIVE_EXAMPLE_MAIN(animation)
diff --git a/examples/quick/animation/pathanimation/pathanimation.qml b/examples/quick/animation/pathanimation/pathanimation.qml
new file mode 100644
index 0000000000..f995218c6c
--- /dev/null
+++ b/examples/quick/animation/pathanimation/pathanimation.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: window
+ width: 320
+ height: 480
+
+ Canvas {
+ id: canvas
+ anchors.fill: parent
+ smooth: true
+
+ onPaint: {
+ var context = canvas.getContext("2d")
+ context.clearRect(0, 0, width, height)
+ context.strokeStyle = "black"
+ context.path = pathAnim.path
+ context.stroke()
+ }
+ }
+
+ SequentialAnimation {
+ running: true
+ loops: -1
+
+ PauseAnimation { duration: 1000 }
+ PathAnimation {
+ id: pathAnim
+
+ duration: 2000
+ easing.type: Easing.InQuad
+
+ target: box
+ orientation: PathAnimation.RightFirst
+ anchorPoint: Qt.point(box.width/2, box.height/2)
+ path: Path {
+ startX: 50; startY: 50
+
+ PathCubic {
+ x: window.width - 50
+ y: window.height - 50
+
+ control1X: x; control1Y: 50
+ control2X: 50; control2Y: y
+ }
+
+ onChanged: canvas.requestPaint()
+ }
+ }
+ }
+
+ Rectangle {
+ id: box
+
+ x: 25; y: 25
+ width: 50; height: 50
+ border.width: 1
+ smooth: true
+
+ Text {
+ anchors.centerIn: parent
+ text: "Box"
+ }
+ }
+}
diff --git a/examples/quick/animation/pathinterpolator/pathinterpolator.qml b/examples/quick/animation/pathinterpolator/pathinterpolator.qml
new file mode 100644
index 0000000000..5a137c732d
--- /dev/null
+++ b/examples/quick/animation/pathinterpolator/pathinterpolator.qml
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: window
+ width: 320
+ height: 480
+
+ Canvas {
+ id: canvas
+ anchors.fill: parent
+ smooth: true
+
+ onPaint: {
+ var context = canvas.getContext("2d")
+ context.clearRect(0, 0, width, height)
+ context.strokeStyle = "black"
+ context.path = motionPath.path
+ context.stroke()
+ }
+ }
+
+ PathInterpolator {
+ id: motionPath
+
+ path: Path {
+ startX: 50; startY: 50
+
+ PathCubic {
+ x: window.width - 50
+ y: window.height - 50
+
+ control1X: x; control1Y: 50
+ control2X: 50; control2Y: y
+ }
+
+ onChanged: canvas.requestPaint()
+ }
+
+ SequentialAnimation on progress {
+ running: true
+ loops: -1
+ PauseAnimation { duration: 1000 }
+ NumberAnimation {
+ id: progressAnim
+ running: false
+ from: 0; to: 1
+ duration: 2000
+ easing.type: Easing.InQuad
+ }
+ }
+ }
+
+ Rectangle {
+ id: box
+
+ width: 50; height: 50
+ border.width: 1
+ smooth: true
+
+ //bind our attributes to follow the path as progress changes
+ x: motionPath.x
+ y: motionPath.y
+ rotation: motionPath.angle
+ transform: Translate { x: -box.width/2; y: -box.height/2 }
+
+ Text {
+ anchors.centerIn: parent
+ text: "Box"
+ }
+ }
+
+}
diff --git a/examples/quick/animation/states/qt-logo.png b/examples/quick/animation/states/qt-logo.png
new file mode 100644
index 0000000000..14ddf2a028
--- /dev/null
+++ b/examples/quick/animation/states/qt-logo.png
Binary files differ
diff --git a/examples/quick/animation/states/states.qml b/examples/quick/animation/states/states.qml
new file mode 100644
index 0000000000..7ca56a9295
--- /dev/null
+++ b/examples/quick/animation/states/states.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: page
+ width: 640; height: 480
+ color: "#343434"
+
+ Image {
+ id: userIcon
+ x: topLeftRect.x; y: topLeftRect.y
+ source: "qt-logo.png"
+ }
+
+ Rectangle {
+ id: topLeftRect
+
+ anchors { left: parent.left; top: parent.top; leftMargin: 10; topMargin: 20 }
+ width: 46; height: 54
+ color: "Transparent"; border.color: "Gray"; radius: 6
+
+ // Clicking in here sets the state to the default state, returning the image to
+ // its initial position
+ MouseArea { anchors.fill: parent; onClicked: page.state = '' }
+ }
+
+ Rectangle {
+ id: middleRightRect
+
+ anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 20 }
+ width: 46; height: 54
+ color: "Transparent"; border.color: "Gray"; radius: 6
+
+ // Clicking in here sets the state to 'middleRight'
+ MouseArea { anchors.fill: parent; onClicked: page.state = 'middleRight' }
+ }
+
+ Rectangle {
+ id: bottomLeftRect
+
+ anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 20 }
+ width: 46; height: 54
+ color: "Transparent"; border.color: "Gray"; radius: 6
+
+ // Clicking in here sets the state to 'bottomLeft'
+ MouseArea { anchors.fill: parent; onClicked: page.state = 'bottomLeft' }
+ }
+
+ states: [
+ // In state 'middleRight', move the image to middleRightRect
+ State {
+ name: "middleRight"
+ PropertyChanges { target: userIcon; x: middleRightRect.x; y: middleRightRect.y }
+ },
+
+ // In state 'bottomLeft', move the image to bottomLeftRect
+ State {
+ name: "bottomLeft"
+ PropertyChanges { target: userIcon; x: bottomLeftRect.x; y: bottomLeftRect.y }
+ }
+ ]
+}
diff --git a/examples/quick/animation/states/transitions.qml b/examples/quick/animation/states/transitions.qml
new file mode 100644
index 0000000000..d57924d6d2
--- /dev/null
+++ b/examples/quick/animation/states/transitions.qml
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+/*
+ This is exactly the same as states.qml, except that we have appended
+ a set of transitions to apply animations when the item changes
+ between each state.
+*/
+
+Rectangle {
+ id: page
+ width: 640; height: 480
+ color: "#343434"
+
+ Image {
+ id: userIcon
+ x: topLeftRect.x; y: topLeftRect.y
+ source: "qt-logo.png"
+ }
+
+ Rectangle {
+ id: topLeftRect
+
+ anchors { left: parent.left; top: parent.top; leftMargin: 10; topMargin: 20 }
+ width: 46; height: 54
+ color: "Transparent"; border.color: "Gray"; radius: 6
+
+ // Clicking in here sets the state to the default state, returning the image to
+ // its initial position
+ MouseArea { anchors.fill: parent; onClicked: page.state = '' }
+ }
+
+ Rectangle {
+ id: middleRightRect
+
+ anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 20 }
+ width: 46; height: 54
+ color: "Transparent"; border.color: "Gray"; radius: 6
+
+ // Clicking in here sets the state to 'middleRight'
+ MouseArea { anchors.fill: parent; onClicked: page.state = 'middleRight' }
+ }
+
+ Rectangle {
+ id: bottomLeftRect
+
+ anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 20 }
+ width: 46; height: 54
+ color: "Transparent"; border.color: "Gray"; radius: 6
+
+ // Clicking in here sets the state to 'bottomLeft'
+ MouseArea { anchors.fill: parent; onClicked: page.state = 'bottomLeft' }
+ }
+
+ states: [
+ // In state 'middleRight', move the image to middleRightRect
+ State {
+ name: "middleRight"
+ PropertyChanges { target: userIcon; x: middleRightRect.x; y: middleRightRect.y }
+ },
+
+ // In state 'bottomLeft', move the image to bottomLeftRect
+ State {
+ name: "bottomLeft"
+ PropertyChanges { target: userIcon; x: bottomLeftRect.x; y: bottomLeftRect.y }
+ }
+ ]
+
+ // Transitions define how the properties change when the item moves between each state
+ transitions: [
+
+ // When transitioning to 'middleRight' move x,y over a duration of 1 second,
+ // with OutBounce easing function.
+ Transition {
+ from: "*"; to: "middleRight"
+ NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce; duration: 1000 }
+ },
+
+ // When transitioning to 'bottomLeft' move x,y over a duration of 2 seconds,
+ // with InOutQuad easing function.
+ Transition {
+ from: "*"; to: "bottomLeft"
+ NumberAnimation { properties: "x,y"; easing.type: Easing.InOutQuad; duration: 2000 }
+ },
+
+ // For any other state changes move x,y linearly over duration of 200ms.
+ Transition {
+ NumberAnimation { properties: "x,y"; duration: 200 }
+ }
+ ]
+}
diff --git a/examples/quick/canvas/bezierCurve/bezierCurve.qml b/examples/quick/canvas/bezierCurve/bezierCurve.qml
new file mode 100644
index 0000000000..f57839b0a5
--- /dev/null
+++ b/examples/quick/canvas/bezierCurve/bezierCurve.qml
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../contents"
+Item {
+ id:container
+ width:360
+ height:600
+
+ Column {
+ spacing:5
+ anchors.fill:parent
+ Text { font.pointSize:25; text:"Bezier Curve"; anchors.horizontalCenter:parent.horizontalCenter}
+
+ Canvas {
+ id:canvas
+ width:360
+ height:360
+ property string strokeStyle:"red"
+ property string fillStyle:"red"
+ property int lineWidth:lineWidthCtrl.value
+ property bool fill:true
+ property bool stroke:true
+ property real alpha:alphaCtrl.value
+ property real scaleX : scaleXCtrl.value
+ property real scaleY : scaleYCtrl.value
+ property real rotate : rotateCtrl.value
+ smooth:true
+ renderTarget:Canvas.Image
+ renderStrategy: Canvas.Immediate
+
+
+ Behavior on scaleX { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite } }
+ Behavior on scaleY { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite} }
+ Behavior on rotate { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite} }
+
+ onLineWidthChanged:requestPaint();
+ onFillChanged:requestPaint();
+ onStrokeChanged:requestPaint();
+ onAlphaChanged:requestPaint();
+ onScaleXChanged:requestPaint();
+ onScaleYChanged:requestPaint();
+ onRotateChanged:requestPaint();
+
+ onPaint: {
+ var ctx = canvas.getContext('2d');
+ ctx.save();
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ ctx.globalAlpha = canvas.alpha;
+ ctx.strokeStyle = canvas.strokeStyle;
+ ctx.fillStyle = canvas.fillStyle;
+ ctx.lineWidth = canvas.lineWidth;
+ ctx.scale(canvas.scaleX, canvas.scaleY);
+ ctx.rotate(canvas.rotate);
+ ctx.beginPath();
+ ctx.moveTo(75,40);
+ ctx.bezierCurveTo(75,37,70,25,50,25);
+ ctx.bezierCurveTo(20,25,20,62.5,20,62.5);
+ ctx.bezierCurveTo(20,80,40,102,75,120);
+ ctx.bezierCurveTo(110,102,130,80,130,62.5);
+ ctx.bezierCurveTo(130,62.5,130,25,100,25);
+ ctx.bezierCurveTo(85,25,75,37,75,40);
+ ctx.closePath();
+ if (canvas.fill)
+ ctx.fill();
+ if (canvas.stroke)
+ ctx.stroke();
+ ctx.restore();
+ }
+ }
+
+ Rectangle {
+ id:controls
+ width:360
+ height:160
+ Column {
+ spacing:3
+ Slider {id:lineWidthCtrl; width:300; height:30; min:1; max:10; init:2; name:"Line width"}
+ Slider {id:scaleXCtrl; width:300; height:30; min:0.1; max:10; init:1; name:"ScaleX"}
+ Slider {id:scaleYCtrl; width:300; height:30; min:0.1; max:10; init:1; name:"ScaleY"}
+ Slider {id:rotateCtrl; width:300; height:30; min:0; max:Math.PI*2; init:0; name:"Rotate"}
+ Slider {id:alphaCtrl; width:300; height:30; min:0; max:1; init:1; name:"Alpha"}
+ }
+ }
+ }
+}
diff --git a/examples/quick/canvas/clip/clip.qml b/examples/quick/canvas/clip/clip.qml
new file mode 100644
index 0000000000..d861ff0a46
--- /dev/null
+++ b/examples/quick/canvas/clip/clip.qml
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../contents"
+Item {
+ id:container
+ width:360
+ height:600
+
+ Column {
+ spacing:5
+ anchors.fill:parent
+ Text { font.pointSize:25; text:"Makes squircle icon with clip"; anchors.horizontalCenter:parent.horizontalCenter}
+ Canvas {
+ id:canvas
+ width:360
+ height:360
+ property string strokeStyle:"blue"
+ property string fillStyle:"steelblue"
+ property int lineWidth:2
+ property int nSize:nCtrl.value
+ property real radius:rCtrl.value
+ property bool fill:true
+ property bool stroke:false
+ property real px:xCtrl.value
+ property real py:yCtrl.value
+ property real alpha:alphaCtrl.value
+ property string imagefile:"../contents/qt-logo.png"
+ smooth:true
+ renderTarget:Canvas.Image
+ renderStrategy: Canvas.Immediate
+ Component.onCompleted:loadImage(canvas.imagefile);
+
+ onAlphaChanged:requestPaint();
+ onRadiusChanged:requestPaint();
+ onLineWidthChanged:requestPaint();
+ onNSizeChanged:requestPaint();
+ onFillChanged:requestPaint();
+ onStrokeChanged:requestPaint();
+ onPxChanged:requestPaint();
+ onPyChanged:requestPaint();
+
+ onImageLoaded : requestPaint();
+
+ onPaint: squcirle();
+
+ function squcirle() {
+ var ctx = canvas.getContext("2d");
+ var N = canvas.nSize;
+ var R = canvas.radius;
+
+ N=Math.abs(N);
+ var M=N;
+ if (N>100) M=100;
+ if (N<0.00000000001) M=0.00000000001;
+
+ ctx.save();
+ ctx.globalAlpha =canvas.alpha;
+ ctx.fillStyle = "gray";
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+
+ ctx.strokeStyle = canvas.strokeStyle;
+ ctx.fillStyle = canvas.fillStyle;
+ ctx.lineWidth = canvas.lineWidth;
+
+ ctx.beginPath();
+ var i = 0, x, y;
+ for (i=0; i<(2*R+1); i++){
+ x = Math.round(i-R) + canvas.px;
+ y = Math.round(Math.pow(Math.abs(Math.pow(R,M)-Math.pow(Math.abs(i-R),M)),1/M)) + canvas.py;
+
+ if (i == 0)
+ ctx.moveTo(x, y);
+ else
+ ctx.lineTo(x, y);
+ }
+
+ for (i=(2*R); i<(4*R+1); i++){
+ x =Math.round(3*R-i)+canvas.px;
+ y = Math.round(-Math.pow(Math.abs(Math.pow(R,M)-Math.pow(Math.abs(3*R-i),M)),1/M)) + canvas.py;
+ ctx.lineTo(x, y);
+ }
+ ctx.closePath();
+ if (canvas.stroke) {
+ ctx.stroke();
+ }
+
+ if (canvas.fill) {
+ ctx.fill();
+ }
+ ctx.clip();
+
+ ctx.drawImage(canvas.imagefile, 0, 0);
+ ctx.restore();
+ }
+ }
+
+ Rectangle {
+ id:controls
+ width:360
+ height:160
+ Column {
+ spacing:3
+ Slider {id:nCtrl; width:300; height:30; min:1; max:10; init:4; name:"N"}
+ Slider {id:rCtrl; width:300; height:30; min:30; max:180; init:100; name:"Radius"}
+ Slider {id:xCtrl; width:300; height:30; min:50; max:300; init:180; name:"X"}
+ Slider {id:yCtrl; width:300; height:30; min:30; max:300; init:220; name:"Y"}
+ Slider {id:alphaCtrl; width:300; height:30; min:0; max:1; init:1; name:"Alpha"}
+ }
+ }
+ }
+}
diff --git a/examples/quick/canvas/contents/Button.qml b/examples/quick/canvas/contents/Button.qml
new file mode 100644
index 0000000000..1413cdb9fa
--- /dev/null
+++ b/examples/quick/canvas/contents/Button.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: container
+
+ signal clicked
+
+ property string text
+ width: buttonText.width + 28
+ height: buttonText.height + 14
+
+ BorderImage {
+ id: buttonImage
+ source: "images/toolbutton.sci"
+ width: container.width - 10
+ height: container.height
+ }
+ BorderImage {
+ id: pressed
+ opacity: 0
+ source: "images/toolbutton.sci"
+ width: container.width - 10
+ height: container.height
+ }
+ MouseArea {
+ id: mouseRegion
+ anchors.fill: buttonImage
+ onClicked: { container.clicked(); }
+ }
+ Text {
+ id: buttonText
+ color: "white"
+ anchors.centerIn: buttonImage
+ font.bold: true
+ font.pointSize: 15
+ text: container.text
+ style: Text.Raised
+ styleColor: "black"
+ }
+ states: [
+ State {
+ name: "Pressed"
+ when: mouseRegion.pressed == true
+ PropertyChanges { target: pressed; opacity: 1 }
+ }
+ ]
+} \ No newline at end of file
diff --git a/examples/quick/canvas/contents/ScrollBar.qml b/examples/quick/canvas/contents/ScrollBar.qml
new file mode 100644
index 0000000000..98b8efee4a
--- /dev/null
+++ b/examples/quick/canvas/contents/ScrollBar.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: scrollBar
+ // 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.
+ // orientation can be either 'Vertical' or 'Horizontal'
+ property real position
+ property real pageSize
+ property string orientation : "Vertical"
+ property alias bgColor: background.color
+ property alias fgColor: thumb.color
+
+ // A light, semi-transparent background
+ Rectangle {
+ id: background
+ radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1)
+ color: "white"; opacity: 0.3
+ anchors.fill: parent
+ }
+ // Size the bar to the required size, depending upon the orientation.
+ Rectangle {
+ id: thumb
+ opacity: 0.7
+ color: "black"
+ radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1)
+ x: orientation == 'Vertical' ? 1 : (scrollBar.position * (scrollBar.width-2) + 1)
+ y: orientation == 'Vertical' ? (scrollBar.position * (scrollBar.height-2) + 1) : 1
+ width: orientation == 'Vertical' ? (parent.width-2) : (scrollBar.pageSize * (scrollBar.width-2))
+ height: orientation == 'Vertical' ? (scrollBar.pageSize * (scrollBar.height-2)) : (parent.height-2)
+ }
+}
diff --git a/examples/quick/canvas/contents/Slider.qml b/examples/quick/canvas/contents/Slider.qml
new file mode 100644
index 0000000000..093b9e40dd
--- /dev/null
+++ b/examples/quick/canvas/contents/Slider.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQuick module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id:slider
+ property real min:0
+ property real max:1
+ property real value: min + (max - min) * (bar.x / (foo.width - bar.width))
+ property real init:min+(max-min)/2
+ property string name:"Slider"
+
+ Component.onCompleted: setValue(init)
+ function setValue(v) {
+ if (min < max)
+ bar.x = v/(max - min) * (foo.width - bar.width);
+ }
+ Rectangle {
+ id:sliderName
+ anchors.left:parent.left
+ height: childrenRect.height
+ width:childrenRect.width
+ anchors.verticalCenter:parent.verticalCenter
+ Text {
+ text:slider.name
+ font.pointSize:12
+ }
+ }
+ Item {
+ id: foo
+ height: 6
+ width: parent.width - 4 - sliderName.width
+ anchors.verticalCenter:parent.verticalCenter
+ anchors.left:sliderName.right
+ anchors.leftMargin:5
+ Rectangle {
+ height: parent.height
+ anchors.left: parent.left
+ anchors.right: bar.horizontalCenter
+ color: "blue"
+ radius: 3
+ }
+ Rectangle {
+ height: parent.height
+ anchors.left: bar.horizontalCenter
+ anchors.right: parent.right
+ color: "gray"
+ radius: 3
+ }
+ Rectangle {
+ anchors.fill: parent
+ color: "transparent"
+ radius: 3
+ border.width: 2
+ border.color: "black"
+ }
+
+ Rectangle {
+ id: bar
+ y: -7
+ width: 20
+ height: 20
+ radius: 15
+ color: "white"
+ border.width: 2
+ border.color: "black"
+ MouseArea {
+ anchors.fill: parent
+ drag.target: parent
+ drag.axis: Drag.XAxis
+ drag.minimumX: 0
+ drag.maximumX: foo.width - parent.width
+ }
+ }
+ }
+}
diff --git a/examples/quick/canvas/contents/Stocks.qml b/examples/quick/canvas/contents/Stocks.qml
new file mode 100644
index 0000000000..043bca132e
--- /dev/null
+++ b/examples/quick/canvas/contents/Stocks.qml
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+ListModel {
+ id:stocks
+ //Data from : http://en.wikipedia.org/wiki/NASDAQ-100
+
+ ListElement {name:"Activision Blizzard"; stockId:"ATVI"}
+ ListElement {name:"Adobe Systems Incorporated"; stockId:"ADBE"}
+ ListElement {name:"Akamai Technologies, Inc"; stockId:"AKAM"}
+ ListElement {name:"Alexion Pharmaceuticals"; stockId:"ALXN"}
+ ListElement {name:"Altera Corporation"; stockId:"ALTR"}
+ ListElement {name:"Amazon.com, Inc."; stockId:"AMZN"}
+ ListElement {name:"Amgen Inc."; stockId:"AMGN"}
+ ListElement {name:"Apollo Group, Inc."; stockId:"APOL"}
+ ListElement {name:"Apple Inc."; stockId:"AAPL"}
+ ListElement {name:"Applied Materials, Inc."; stockId:"AMAT"}
+ ListElement {name:"Autodesk, Inc."; stockId:"ADSK"}
+ ListElement {name:"Automatic Data Processing, Inc."; stockId:"ADP"}
+ ListElement {name:"Baidu.com, Inc."; stockId:"BIDU"}
+ ListElement {name:"Bed Bath & Beyond Inc."; stockId:"BBBY"}
+ ListElement {name:"Biogen Idec, Inc"; stockId:"BIIB"}
+ ListElement {name:"BMC Software, Inc."; stockId:"BMC"}
+ ListElement {name:"Broadcom Corporation"; stockId:"BRCM"}
+ ListElement {name:"C. H. Robinson Worldwide, Inc."; stockId:"CHRW"}
+ ListElement {name:"CA, Inc."; stockId:"CA"}
+ ListElement {name:"Celgene Corporation"; stockId:"CELG"}
+ ListElement {name:"Cephalon, Inc."; stockId:"CEPH"}
+ ListElement {name:"Cerner Corporation"; stockId:"CERN"}
+ ListElement {name:"Check Point Software Technologies Ltd."; stockId:"CHKP"}
+ ListElement {name:"Cisco Systems, Inc."; stockId:"CSCO"}
+ ListElement {name:"Citrix Systems, Inc."; stockId:"CTXS"}
+ ListElement {name:"Cognizant Technology Solutions Corporation"; stockId:"CTSH"}
+ ListElement {name:"Comcast Corporation"; stockId:"CMCSA"}
+ ListElement {name:"Costco Wholesale Corporation"; stockId:"COST"}
+ ListElement {name:"Ctrip.com International, Ltd."; stockId:"CTRP"}
+ ListElement {name:"Dell Inc."; stockId:"DELL"}
+ ListElement {name:"DENTSPLY International Inc."; stockId:"XRAY"}
+ ListElement {name:"DirecTV"; stockId:"DTV"}
+ ListElement {name:"Dollar Tree, Inc."; stockId:"DLTR"}
+ ListElement {name:"eBay Inc."; stockId:"EBAY"}
+ ListElement {name:"Electronic Arts Inc."; stockId:"ERTS"}
+ ListElement {name:"Expedia, Inc."; stockId:"EXPE"}
+ ListElement {name:"Expeditors International of Washington, Inc."; stockId:"EXPD"}
+ ListElement {name:"Express Scripts, Inc."; stockId:"ESRX"}
+ ListElement {name:"F5 Networks, Inc."; stockId:"FFIV"}
+ ListElement {name:"Fastenal Company"; stockId:"FAST"}
+ ListElement {name:"First Solar, Inc."; stockId:"FSLR"}
+ ListElement {name:"Fiserv, Inc."; stockId:"FISV"}
+ ListElement {name:"Flextronics International Ltd."; stockId:"FLEX"}
+ ListElement {name:"FLIR Systems, Inc."; stockId:"FLIR"}
+ ListElement {name:"Garmin Ltd."; stockId:"GRMN"}
+ ListElement {name:"Gilead Sciences, Inc."; stockId:"GILD"}
+ ListElement {name:"Google Inc."; stockId:"GOOG"}
+ ListElement {name:"Green Mountain Coffee Roasters, Inc."; stockId:"GMCR"}
+ ListElement {name:"Henry Schein, Inc."; stockId:"HSIC"}
+ ListElement {name:"Illumina, Inc."; stockId:"ILMN"}
+ ListElement {name:"Infosys Technologies"; stockId:"INFY"}
+ ListElement {name:"Intel Corporation"; stockId:"INTC"}
+ ListElement {name:"Intuit, Inc."; stockId:"INTU"}
+ ListElement {name:"Intuitive Surgical Inc."; stockId:"ISRG"}
+ ListElement {name:"Joy Global Inc."; stockId:"JOYG"}
+ ListElement {name:"KLA Tencor Corporation"; stockId:"KLAC"}
+ ListElement {name:"Lam Research Corporation"; stockId:"LRCX"}
+ ListElement {name:"Liberty Media Corporation, Interactive Series A"; stockId:"LINTA"}
+ ListElement {name:"Life Technologies Corporation"; stockId:"LIFE"}
+ ListElement {name:"Linear Technology Corporation"; stockId:"LLTC"}
+ ListElement {name:"Marvell Technology Group, Ltd."; stockId:"MRVL"}
+ ListElement {name:"Mattel, Inc."; stockId:"MAT"}
+ ListElement {name:"Maxim Integrated Products"; stockId:"MXIM"}
+ ListElement {name:"Microchip Technology Incorporated"; stockId:"MCHP"}
+ ListElement {name:"Micron Technology, Inc."; stockId:"MU"}
+ ListElement {name:"Microsoft Corporation"; stockId:"MSFT"}
+ ListElement {name:"Mylan, Inc."; stockId:"MYL"}
+ ListElement {name:"NetApp, Inc."; stockId:"NTAP"}
+ ListElement {name:"Netflix, Inc."; stockId:"NFLX"}
+ ListElement {name:"News Corporation, Ltd."; stockId:"NWSA"}
+ ListElement {name:"NII Holdings, Inc."; stockId:"NIHD"}
+ ListElement {name:"NVIDIA Corporation"; stockId:"NVDA"}
+ ListElement {name:"O'Reilly Automotive, Inc."; stockId:"ORLY"}
+ ListElement {name:"Oracle Corporation"; stockId:"ORCL"}
+ ListElement {name:"PACCAR Inc."; stockId:"PCAR"}
+ ListElement {name:"Paychex, Inc."; stockId:"PAYX"}
+ ListElement {name:"Priceline.com, Incorporated"; stockId:"PCLN"}
+ ListElement {name:"Qiagen N.V."; stockId:"QGEN"}
+ ListElement {name:"QUALCOMM Incorporated"; stockId:"QCOM"}
+ ListElement {name:"Research in Motion Limited"; stockId:"RIMM"}
+ ListElement {name:"Ross Stores Inc."; stockId:"ROST"}
+ ListElement {name:"SanDisk Corporation"; stockId:"SNDK"}
+ ListElement {name:"Seagate Technology Holdings"; stockId:"STX"}
+ ListElement {name:"Sears Holdings Corporation"; stockId:"SHLD"}
+ ListElement {name:"Sigma-Aldrich Corporation"; stockId:"SIAL"}
+ ListElement {name:"Staples Inc."; stockId:"SPLS"}
+ ListElement {name:"Starbucks Corporation"; stockId:"SBUX"}
+ ListElement {name:"Stericycle, Inc"; stockId:"SRCL"}
+ ListElement {name:"Symantec Corporation"; stockId:"SYMC"}
+ ListElement {name:"Teva Pharmaceutical Industries Ltd."; stockId:"TEVA"}
+ ListElement {name:"Urban Outfitters, Inc."; stockId:"URBN"}
+ ListElement {name:"VeriSign, Inc."; stockId:"VRSN"}
+ ListElement {name:"Vertex Pharmaceuticals"; stockId:"VRTX"}
+ ListElement {name:"Virgin Media, Inc."; stockId:"VMED"}
+ ListElement {name:"Vodafone Group, plc."; stockId:"VOD"}
+ ListElement {name:"Warner Chilcott, Ltd."; stockId:"WCRX"}
+ ListElement {name:"Whole Foods Market, Inc."; stockId:"WFM"}
+ ListElement {name:"Wynn Resorts Ltd."; stockId:"WYNN"}
+ ListElement {name:"Xilinx, Inc."; stockId:"XLNX"}
+ ListElement {name:"Yahoo! Inc."; stockId:"YHOO"}
+}
diff --git a/examples/quick/canvas/contents/TitleBar.qml b/examples/quick/canvas/contents/TitleBar.qml
new file mode 100644
index 0000000000..28edda2ae7
--- /dev/null
+++ b/examples/quick/canvas/contents/TitleBar.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: titleBar
+ property string title: ""
+
+ BorderImage { source: "images/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
+
+ Image {
+ id: quitButton
+ anchors.left: parent.left//; anchors.leftMargin: 0
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/quit.png"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.quit()
+ }
+ }
+
+ Text {
+ id: categoryText
+ anchors {
+ left: quitButton.right; right: parent.right; //leftMargin: 10; rightMargin: 10
+ verticalCenter: parent.verticalCenter
+ }
+ elide: Text.ElideLeft
+ text: title
+ font.bold: true; font.pointSize: 20; color: "White"; style: Text.Raised; styleColor: "Black"
+ }
+}
diff --git a/examples/quick/canvas/contents/ToolBar.qml b/examples/quick/canvas/contents/ToolBar.qml
new file mode 100644
index 0000000000..7ae7391ddf
--- /dev/null
+++ b/examples/quick/canvas/contents/ToolBar.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: toolbar
+
+ property variant labels
+ signal buttonClicked(int index)
+
+ BorderImage {
+ source: "images/titlebar.sci"
+ width: parent.width
+ height: parent.height + 14
+ y: -7
+ }
+
+ Row {
+ y: 3
+ anchors.horizontalCenter: parent.horizontalCenter
+ Repeater {
+ model: toolbar.labels
+ delegate:
+ Button {
+ text: modelData
+ onClicked: toolbar.buttonClicked(model.index)
+ }
+ }
+ }
+
+}
diff --git a/examples/quick/canvas/contents/images/button-pressed.png b/examples/quick/canvas/contents/images/button-pressed.png
new file mode 100644
index 0000000000..e434d327f2
--- /dev/null
+++ b/examples/quick/canvas/contents/images/button-pressed.png
Binary files differ
diff --git a/examples/quick/canvas/contents/images/button.png b/examples/quick/canvas/contents/images/button.png
new file mode 100644
index 0000000000..56a63ce641
--- /dev/null
+++ b/examples/quick/canvas/contents/images/button.png
Binary files differ
diff --git a/examples/quick/canvas/contents/images/default.svg b/examples/quick/canvas/contents/images/default.svg
new file mode 100644
index 0000000000..248199cc4e
--- /dev/null
+++ b/examples/quick/canvas/contents/images/default.svg
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48px" height="48px" id="svg1306">
+ <defs id="defs1308">
+ <linearGradient id="linearGradient4083">
+ <stop id="stop4085" offset="0" stop-color="#ffffff" stop-opacity="0"/>
+ <stop offset="0.75" id="stop4089" stop-color="#ffffff" stop-opacity="0"/>
+ <stop id="stop4087" offset="1" stop-color="#ffffff" stop-opacity="1"/>
+ </linearGradient>
+ <linearGradient id="linearGradient4032">
+ <stop id="stop4034" offset="0" stop-color="#fff7c2" stop-opacity="0.63829786"/>
+ <stop offset="0.59394139" id="stop4036" stop-color="#fcaf3e" stop-opacity="0.18348624"/>
+ <stop id="stop4038" offset="0.83850551" stop-color="#fcaf3e" stop-opacity="0.50458717"/>
+ <stop id="stop4040" offset="1" stop-color="#fcaf3e" stop-opacity="1"/>
+ </linearGradient>
+ <linearGradient id="linearGradient4026">
+ <stop id="stop4028" offset="0" stop-color="#fff9c6" stop-opacity="1"/>
+ <stop offset="0.54166669" id="stop4042" stop-color="#fff28c" stop-opacity="1"/>
+ <stop id="stop4030" offset="1" stop-color="#ffea85" stop-opacity="1"/>
+ </linearGradient>
+ <linearGradient xlink:href="#linearGradient4026" id="linearGradient3168" gradientUnits="userSpaceOnUse" x1="-28.968945" y1="-25.326815" x2="-37.19698" y2="-9.5590506"/>
+ <radialGradient xlink:href="#linearGradient4032" id="radialGradient4020" cx="-33.519073" cy="-22.113297" fx="-33.519073" fy="-22.113297" r="9.5" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.487739,1.292402,-1.10267,0.497242,-41.77393,32.41492)"/>
+ <radialGradient xlink:href="#linearGradient4083" id="radialGradient4081" cx="23.99999" cy="23.381506" fx="23.99999" fy="23.381506" r="19.141981" gradientTransform="matrix(1.006701,2.235326e-16,-2.23715e-16,1.007522,-0.160816,0.426981)" gradientUnits="userSpaceOnUse"/>
+ </defs>
+
+ <metadata id="metadata1311">
+ <rdf:RDF>
+ <cc:Work rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+ <dc:title>weather-clear</dc:title>
+ <dc:date>January 2006</dc:date>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Ryan Collier (pseudo)</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:publisher>
+ <cc:Agent>
+ <dc:title>http://www.tango-project.org</dc:title>
+ </cc:Agent>
+ </dc:publisher>
+ <dc:source>http://www.pseudocode.org</dc:source>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>weather</rdf:li>
+ <rdf:li>applet</rdf:li>
+ <rdf:li>notification</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/"/>
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title>Garrett LeSage</dc:title>
+ </cc:Agent>
+ </dc:contributor>
+ </cc:Work>
+ <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
+ <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
+ <cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
+ <cc:requires rdf:resource="http://web.resource.org/cc/Notice"/>
+ <cc:requires rdf:resource="http://web.resource.org/cc/Attribution"/>
+ <cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
+ <cc:requires rdf:resource="http://web.resource.org/cc/ShareAlike"/>
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g id="layer1">
+ <g>
+ <g opacity="0.7">
+ <path d="M 24 2.5 L 21.625 9.1875 C 22.399034 9.0641318 23.191406 9 24 9 C 24.808594 9 25.600966 9.0641317 26.375 9.1875 L 24 2.5 z M 8.8125 8.78125 L 11.84375 15.21875 C 12.779034 13.928569 13.928569 12.779034 15.21875 11.84375 L 8.8125 8.78125 z M 39.21875 8.78125 L 32.78125 11.84375 C 34.071431 12.779034 35.220966 13.928569 36.15625 15.21875 L 39.21875 8.78125 z M 9.1875 21.59375 L 2.5 23.96875 L 9.1875 26.34375 C 9.0673373 25.57952 9 24.797813 9 24 C 9 23.180625 9.0608858 22.377571 9.1875 21.59375 z M 38.8125 21.625 C 38.935868 22.399034 39 23.191406 39 24 C 39 24.808594 38.935868 25.600966 38.8125 26.375 L 45.5 24 L 38.8125 21.625 z M 11.84375 32.78125 L 8.8125 39.1875 L 15.21875 36.15625 C 13.928569 35.220966 12.779034 34.071431 11.84375 32.78125 z M 36.15625 32.78125 C 35.229789 34.05926 34.087617 35.194799 32.8125 36.125 L 39.21875 39.1875 L 36.15625 32.78125 z M 21.625 38.8125 L 24 45.5 L 26.375 38.8125 C 25.600966 38.935868 24.808594 39 24 39 C 23.191406 39 22.399034 38.935868 21.625 38.8125 z " fill="#fce94f" fill-opacity="1" stroke="#fcaf3e" stroke-width="0.73732895" stroke-linecap="square" stroke-linejoin="miter" stroke-miterlimit="4" stroke-dasharray="none" stroke-opacity="1"/>
+ <path d="M 24 5.25 L 22.65625 9.0625 C 23.098888 9.0231486 23.547187 9 24 9 C 24.452813 9 24.901112 9.0231486 25.34375 9.0625 L 24 5.25 z M 10.78125 10.75 L 12.5 14.375 C 13.071538 13.694089 13.724004 13.038745 14.40625 12.46875 L 10.78125 10.75 z M 37.25 10.75 L 33.625 12.46875 C 34.304675 13.038189 34.961811 13.695325 35.53125 14.375 L 37.25 10.75 z M 9.0625 22.625 L 5.28125 23.96875 L 9.0625 25.3125 C 9.024981 24.880146 9 24.442031 9 24 C 9 23.536406 9.0212735 23.077908 9.0625 22.625 z M 38.9375 22.65625 C 38.976851 23.098888 39 23.547187 39 24 C 39 24.452813 38.976851 24.901112 38.9375 25.34375 L 42.71875 24 L 38.9375 22.65625 z M 35.53125 33.59375 C 34.958293 34.27954 34.309985 34.957363 33.625 35.53125 L 37.25 37.25 L 35.53125 33.59375 z M 12.5 33.625 L 10.78125 37.21875 L 14.375 35.5 C 13.702932 34.935884 13.064116 34.297068 12.5 33.625 z M 22.65625 38.9375 L 24 42.71875 L 25.34375 38.9375 C 24.901112 38.976851 24.452813 39 24 39 C 23.547187 39 23.098888 38.976851 22.65625 38.9375 z " fill="none" fill-opacity="1" stroke="url(#radialGradient4081)" stroke-width="0.84646249" stroke-linecap="square" stroke-linejoin="miter" stroke-miterlimit="4" stroke-dasharray="none" stroke-opacity="1"/>
+ </g>
+ <g>
+ <g>
+ <path transform="matrix(0.778062,-1.061285,1.061287,0.778062,67.47952,3.641324)" d="M -22.5 -17.5 A 9.5 9.5 0 1 1 -41.5,-17.5 A 9.5 9.5 0 1 1 -22.5 -17.5 z" fill="#ffee54" fill-opacity="1" stroke="#fcaf3e" stroke-width="0.75991178" stroke-linecap="square" stroke-linejoin="miter" stroke-miterlimit="4" stroke-dasharray="none" stroke-opacity="1"/>
+ <path transform="matrix(1.244257,-0.167707,0.216642,1.251844,67.61648,40.527)" d="M -22.5 -17.5 A 9.5 9.5 0 1 1 -41.5,-17.5 A 9.5 9.5 0 1 1 -22.5 -17.5 z" fill="url(#radialGradient4020)" fill-opacity="1" stroke="none" stroke-width="1.01737845" stroke-linecap="square" stroke-linejoin="miter" stroke-miterlimit="4" stroke-dasharray="none" stroke-opacity="1"/>
+ <path transform="matrix(0.715791,-0.976349,0.97635,0.715792,64.00044,5.269544)" d="M -22.5 -17.5 A 9.5 9.5 0 1 1 -41.5,-17.5 A 9.5 9.5 0 1 1 -22.5 -17.5 z" fill="none" fill-opacity="1" stroke="url(#linearGradient3168)" stroke-width="0.82601947" stroke-linecap="square" stroke-linejoin="miter" stroke-miterlimit="4" stroke-dasharray="none" stroke-opacity="1"/>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg>
diff --git a/examples/quick/canvas/contents/images/gloss.png b/examples/quick/canvas/contents/images/gloss.png
new file mode 100755
index 0000000000..5d370cd93d
--- /dev/null
+++ b/examples/quick/canvas/contents/images/gloss.png
Binary files differ
diff --git a/examples/quick/canvas/contents/images/lineedit.png b/examples/quick/canvas/contents/images/lineedit.png
new file mode 100755
index 0000000000..2cc38dc35b
--- /dev/null
+++ b/examples/quick/canvas/contents/images/lineedit.png
Binary files differ
diff --git a/examples/quick/canvas/contents/images/lineedit.sci b/examples/quick/canvas/contents/images/lineedit.sci
new file mode 100644
index 0000000000..054bff78be
--- /dev/null
+++ b/examples/quick/canvas/contents/images/lineedit.sci
@@ -0,0 +1,5 @@
+border.left: 10
+border.top: 10
+border.bottom: 10
+border.right: 10
+source: lineedit.png
diff --git a/examples/quick/canvas/contents/images/quit.png b/examples/quick/canvas/contents/images/quit.png
new file mode 100755
index 0000000000..5bda1b6e0d
--- /dev/null
+++ b/examples/quick/canvas/contents/images/quit.png
Binary files differ
diff --git a/examples/quick/canvas/contents/images/stripes.png b/examples/quick/canvas/contents/images/stripes.png
new file mode 100755
index 0000000000..9f36727ea4
--- /dev/null
+++ b/examples/quick/canvas/contents/images/stripes.png
Binary files differ
diff --git a/examples/quick/canvas/contents/images/titlebar.png b/examples/quick/canvas/contents/images/titlebar.png
new file mode 100755
index 0000000000..51c90082d0
--- /dev/null
+++ b/examples/quick/canvas/contents/images/titlebar.png
Binary files differ
diff --git a/examples/quick/canvas/contents/images/titlebar.sci b/examples/quick/canvas/contents/images/titlebar.sci
new file mode 100644
index 0000000000..0418d94cd6
--- /dev/null
+++ b/examples/quick/canvas/contents/images/titlebar.sci
@@ -0,0 +1,5 @@
+border.left: 10
+border.top: 12
+border.bottom: 12
+border.right: 10
+source: titlebar.png
diff --git a/examples/quick/canvas/contents/images/toolbutton.png b/examples/quick/canvas/contents/images/toolbutton.png
new file mode 100755
index 0000000000..11310013ee
--- /dev/null
+++ b/examples/quick/canvas/contents/images/toolbutton.png
Binary files differ
diff --git a/examples/quick/canvas/contents/images/toolbutton.sci b/examples/quick/canvas/contents/images/toolbutton.sci
new file mode 100644
index 0000000000..9e4f965307
--- /dev/null
+++ b/examples/quick/canvas/contents/images/toolbutton.sci
@@ -0,0 +1,5 @@
+border.left: 15
+border.top: 4
+border.bottom: 4
+border.right: 15
+source: toolbutton.png
diff --git a/examples/quick/canvas/contents/qt-logo.png b/examples/quick/canvas/contents/qt-logo.png
new file mode 100644
index 0000000000..5ab3a1b0c4
--- /dev/null
+++ b/examples/quick/canvas/contents/qt-logo.png
Binary files differ
diff --git a/examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml b/examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml
new file mode 100644
index 0000000000..bc3ca0071a
--- /dev/null
+++ b/examples/quick/canvas/quadraticCurveTo/quadraticCurveTo.qml
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../contents"
+Item {
+ id:container
+ width:360
+ height:600
+
+ Column {
+ spacing:5
+ anchors.fill:parent
+ Text { font.pointSize:25; text:"Quadratic Curve"; anchors.horizontalCenter:parent.horizontalCenter}
+
+ Canvas {
+ id:canvas
+ width:360
+ height:360
+ property string strokeStyle:"steelblue"
+ property string fillStyle:"yellow"
+ property int lineWidth:lineWidthCtrl.value
+ property bool fill:true
+ property bool stroke:true
+ property real alpha:alphaCtrl.value
+ property real scaleX : scaleXCtrl.value
+ property real scaleY : scaleYCtrl.value
+ property real rotate : rotateCtrl.value
+ smooth:true
+ renderTarget:Canvas.Image
+ renderStrategy: Canvas.Immediate
+
+ onLineWidthChanged:requestPaint();
+ onFillChanged:requestPaint();
+ onStrokeChanged:requestPaint();
+ onAlphaChanged:requestPaint();
+ onScaleXChanged:requestPaint();
+ onScaleYChanged:requestPaint();
+ onRotateChanged:requestPaint();
+ Behavior on scaleX { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite } }
+ Behavior on scaleY { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite} }
+ Behavior on rotate { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite} }
+
+ onPaint: {
+ var ctx = canvas.getContext('2d');
+ ctx.save();
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ ctx.globalAlpha = canvas.alpha;
+ ctx.strokeStyle = canvas.strokeStyle;
+ ctx.fillStyle = canvas.fillStyle;
+ ctx.lineWidth = canvas.lineWidth;
+ ctx.scale(canvas.scaleX, canvas.scaleY);
+ ctx.rotate(canvas.rotate);
+ ctx.beginPath();
+ ctx.moveTo(75,25);
+ ctx.quadraticCurveTo(25,25,25,62.5);
+ ctx.quadraticCurveTo(25,100,50,100);
+ ctx.quadraticCurveTo(50,120,30,125);
+ ctx.quadraticCurveTo(60,120,65,100);
+ ctx.quadraticCurveTo(125,100,125,62.5);
+ ctx.quadraticCurveTo(125,25,75,25);
+ ctx.closePath();
+ if (canvas.fill)
+ ctx.fill();
+ if (canvas.stroke)
+ ctx.stroke();
+
+
+ ctx.fillStyle="green";
+ ctx.font = "Bold 15px";
+
+ ctx.fillText("QML酷毙了", 30, 60);
+ ctx.restore();
+ }
+ }
+
+ Rectangle {
+ id:controls
+ width:360
+ height:160
+ Column {
+ spacing:3
+ Slider {id:lineWidthCtrl; width:300; height:30; min:1; max:10; init:2; name:"Line width"}
+ Slider {id:scaleXCtrl; width:300; height:30; min:0.1; max:10; init:1; name:"ScaleX"}
+ Slider {id:scaleYCtrl; width:300; height:30; min:0.1; max:10; init:1; name:"ScaleY"}
+ Slider {id:rotateCtrl; width:300; height:30; min:0; max:Math.PI*2; init:0; name:"Rotate"}
+ Slider {id:alphaCtrl; width:300; height:30; min:0; max:1; init:1; name:"Alpha"}
+ }
+ }
+ }
+}
diff --git a/examples/quick/canvas/roundedrect/roundedrect.qml b/examples/quick/canvas/roundedrect/roundedrect.qml
new file mode 100644
index 0000000000..fd86c63a3b
--- /dev/null
+++ b/examples/quick/canvas/roundedrect/roundedrect.qml
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../contents"
+Item {
+ id:container
+ width:360
+ height:600
+
+ Column {
+ spacing:5
+ anchors.fill:parent
+ Text { font.pointSize:25; text:"Rounded rectangle"; anchors.horizontalCenter:parent.horizontalCenter}
+ Canvas {
+ id:canvas
+ width:360
+ height:360
+ smooth:true
+ renderTarget:Canvas.Image
+ renderStrategy: Canvas.Immediate
+
+ property int radius: rCtrl.value
+ property int rectx: rxCtrl.value
+ property int recty: ryCtrl.value
+ property int rectWidth: width - 2*rectx
+ property int rectHeight: height - 2*recty
+ property string strokeStyle:"blue"
+ property string fillStyle:"steelblue"
+ property int lineWidth:lineWidthCtrl.value
+ property bool fill:true
+ property bool stroke:true
+ property real alpha:alphaCtrl.value
+
+ onLineWidthChanged:requestPaint();
+ onFillChanged:requestPaint();
+ onStrokeChanged:requestPaint();
+ onRadiusChanged:requestPaint();
+ onRectxChanged:requestPaint();
+ onRectyChanged:requestPaint();
+ onAlphaChanged:requestPaint();
+
+ onPaint: {
+ var ctx = getContext("2d");
+ ctx.save();
+ ctx.clearRect(0,0,canvas.width, canvas.height);
+ ctx.strokeStyle = canvas.strokeStyle;
+ ctx.lineWidth = canvas.lineWidth
+ ctx.fillStyle = canvas.fillStyle
+ ctx.globalAlpha = canvas.alpha
+ ctx.beginPath();
+ ctx.moveTo(rectx+radius,recty); // top side
+ ctx.lineTo(rectx+rectWidth-radius,recty);
+ // draw top right corner
+ ctx.arcTo(rectx+rectWidth,recty,rectx+rectWidth,recty+radius,radius);
+ ctx.lineTo(rectx+rectWidth,recty+rectHeight-radius); // right side
+ // draw bottom right corner
+ ctx.arcTo(rectx+rectWidth,recty+rectHeight,rectx+rectWidth-radius,recty+rectHeight,radius);
+ ctx.lineTo(rectx+radius,recty+rectHeight); // bottom side
+ // draw bottom left corner
+ ctx.arcTo(rectx,recty+rectHeight,rectx,recty+rectHeight-radius,radius);
+ ctx.lineTo(rectx,recty+radius); // left side
+ // draw top left corner
+ ctx.arcTo(rectx,recty,rectx+radius,recty,radius);
+ ctx.closePath();
+ if (canvas.fill)
+ ctx.fill();
+ if (canvas.stroke)
+ ctx.stroke();
+ ctx.restore();
+ }
+ }
+
+ Rectangle {
+ id:controls
+ width:360
+ height:160
+ Column {
+ spacing:3
+ Slider {id:lineWidthCtrl; width:300; height:30; min:1; max:10; init:2; name:"Line width"}
+ Slider {id:rxCtrl; width:300; height:30; min:5; max:30; init:10; name:"rectx"}
+ Slider {id:ryCtrl; width:300; height:30; min:5; max:30; init:10; name:"recty"}
+ Slider {id:rCtrl; width:300; height:30; min:10; max:100; init:40; name:"Radius"}
+ Slider {id:alphaCtrl; width:300; height:30; min:0; max:1; init:1; name:"Alpha"}
+ }
+ }
+ }
+}
diff --git a/examples/quick/canvas/smile/smile.qml b/examples/quick/canvas/smile/smile.qml
new file mode 100644
index 0000000000..28a48a6c81
--- /dev/null
+++ b/examples/quick/canvas/smile/smile.qml
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../contents"
+Item {
+ id:container
+ width:360
+ height:600
+
+ Column {
+ spacing:5
+ anchors.fill:parent
+ Text { font.pointSize:25; text:"Smile with arcs"; anchors.horizontalCenter:parent.horizontalCenter}
+
+ Canvas {
+ id:canvas
+ width:360
+ height:360
+ smooth:true
+ renderTarget:Canvas.Image
+ renderStrategy: Canvas.Immediate
+
+ property string strokeStyle:"green"
+ property string fillStyle:"yellow"
+ property int lineWidth:lineWidthCtrl.value
+ property bool fill:true
+ property bool stroke:true
+ property real alpha:alphaCtrl.value
+ property real scaleX : scaleXCtrl.value
+ property real scaleY : scaleYCtrl.value
+ property real rotate : rotateCtrl.value
+
+ onLineWidthChanged:requestPaint();
+ onFillChanged:requestPaint();
+ onStrokeChanged:requestPaint();
+ onAlphaChanged:requestPaint();
+ onScaleXChanged:requestPaint();
+ onScaleYChanged:requestPaint();
+ onRotateChanged:requestPaint();
+
+ Behavior on scaleX { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite } }
+ Behavior on scaleY { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite} }
+ Behavior on rotate { SpringAnimation { spring: 2; damping: 0.2; loops:Animation.Infinite} }
+
+ onPaint: {
+ var ctx = canvas.getContext('2d');
+ ctx.save();
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ ctx.globalAlpha = canvas.alpha;
+ ctx.strokeStyle = canvas.strokeStyle;
+ ctx.fillStyle = canvas.fillStyle;
+ ctx.lineWidth = canvas.lineWidth;
+ ctx.scale(canvas.scaleX, canvas.scaleY);
+ ctx.rotate(canvas.rotate);
+ ctx.beginPath();
+ ctx.moveTo(75 + 50 * Math.cos(0),
+ 75 - 50 * Math.sin(Math.PI*2));
+ ctx.arc(75,75,50,0,Math.PI*2,true); // Outer circle
+ ctx.moveTo(75,70);
+ ctx.arc(75,70,35,0,Math.PI,false); // Mouth (clockwise)
+ ctx.moveTo(60,65);
+ ctx.arc(60,65,5,0,Math.PI*2,true); // Left eye
+ ctx.moveTo(90 + 5 * Math.cos(0),
+ 65 - 5 * Math.sin(Math.PI*2));
+ ctx.moveTo(90,65);
+ ctx.arc(90,65,5,0,Math.PI*2,true); // Right eye
+ ctx.closePath();
+ if (canvas.fill)
+ ctx.fill();
+ if (canvas.stroke)
+ ctx.stroke();
+ ctx.restore();
+ }
+ }
+
+ Rectangle {
+ id:controls
+ width:360
+ height:160
+ Column {
+ spacing:3
+ Slider {id:lineWidthCtrl; width:300; height:30; min:1; max:10; init:2; name:"Line width"}
+ Slider {id:scaleXCtrl; width:300; height:30; min:0.1; max:10; init:1; name:"ScaleX"}
+ Slider {id:scaleYCtrl; width:300; height:30; min:0.1; max:10; init:1; name:"ScaleY"}
+ Slider {id:rotateCtrl; width:300; height:30; min:0; max:Math.PI*2; init:0; name:"Rotate"}
+ Slider {id:alphaCtrl; width:300; height:30; min:0; max:1; init:1; name:"Alpha"}
+ }
+ }
+ }
+}
diff --git a/examples/quick/canvas/squircle/squircle.png b/examples/quick/canvas/squircle/squircle.png
new file mode 100644
index 0000000000..86c69d945f
--- /dev/null
+++ b/examples/quick/canvas/squircle/squircle.png
Binary files differ
diff --git a/examples/quick/canvas/squircle/squircle.qml b/examples/quick/canvas/squircle/squircle.qml
new file mode 100644
index 0000000000..2fc65b67b3
--- /dev/null
+++ b/examples/quick/canvas/squircle/squircle.qml
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../contents"
+Item {
+ id:container
+ width:360
+ height:600
+
+ Column {
+ spacing:5
+ anchors.fill:parent
+ Text { font.pointSize:25; text:"Squircles"; anchors.horizontalCenter:parent.horizontalCenter}
+ Image {
+ anchors.horizontalCenter:parent.horizontalCenter
+ source:"squircle.png"
+ width:250
+ height:25
+ }
+ Canvas {
+ id:canvas
+ width:360
+ height:360
+ smooth:true
+ renderTarget:Canvas.Image
+ renderStrategy: Canvas.Immediate
+
+ property string strokeStyle:"blue"
+ property string fillStyle:"steelblue"
+ property int lineWidth:2
+ property int nSize:nCtrl.value
+ property real radius:rCtrl.value
+ property bool fill:true
+ property bool stroke:false
+ property real px:xCtrl.value
+ property real py:yCtrl.value
+ property real alpha:alphaCtrl.value
+
+ onAlphaChanged:requestPaint();
+ onRadiusChanged:requestPaint();
+ onLineWidthChanged:requestPaint();
+ onNSizeChanged:requestPaint();
+ onFillChanged:requestPaint();
+ onStrokeChanged:requestPaint();
+ onPxChanged:requestPaint();
+ onPyChanged:requestPaint();
+
+
+ onPaint: squcirle();
+
+ function squcirle() {
+ var ctx = canvas.getContext("2d");
+ var N = canvas.nSize;
+ var R = canvas.radius;
+
+ N=Math.abs(N);
+ var M=N;
+ if (N>100) M=100;
+ if (N<0.00000000001) M=0.00000000001;
+
+ ctx.save();
+ ctx.globalAlpha =canvas.alpha;
+ ctx.fillStyle = "gray";
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+
+ ctx.strokeStyle = canvas.strokeStyle;
+ ctx.fillStyle = canvas.fillStyle;
+ ctx.lineWidth = canvas.lineWidth;
+
+ ctx.beginPath();
+ var i = 0, x, y;
+ for (i=0; i<(2*R+1); i++){
+ x = Math.round(i-R) + canvas.px;
+ y = Math.round(Math.pow(Math.abs(Math.pow(R,M)-Math.pow(Math.abs(i-R),M)),1/M)) + canvas.py;
+
+ if (i == 0)
+ ctx.moveTo(x, y);
+ else
+ ctx.lineTo(x, y);
+ }
+
+ for (i=(2*R); i<(4*R+1); i++){
+ x =Math.round(3*R-i)+canvas.px;
+ y = Math.round(-Math.pow(Math.abs(Math.pow(R,M)-Math.pow(Math.abs(3*R-i),M)),1/M)) + canvas.py;
+ ctx.lineTo(x, y);
+ }
+ ctx.closePath();
+ if (canvas.stroke) {
+ ctx.stroke();
+ }
+
+ if (canvas.fill) {
+ ctx.fill();
+ }
+
+ ctx.fillStyle = "yellow";
+ ctx.font = "Helvetica 16px";
+ ctx.fillText("|X-" + Math.round(canvas.px) + "|^" + N + " + |Y-"+Math.round(canvas.py)+"|^" + N + " = |" + Math.round(R) + "|^" + N, canvas.px - 125, canvas.py);
+ ctx.restore();
+ }
+ }
+
+ Rectangle {
+ id:controls
+ width:360
+ height:160
+ Column {
+ spacing:3
+ Slider {id:nCtrl; width:300; height:30; min:1; max:10; init:4; name:"N"}
+ Slider {id:rCtrl; width:300; height:30; min:30; max:180; init:100; name:"Radius"}
+ Slider {id:xCtrl; width:300; height:30; min:50; max:300; init:180; name:"X"}
+ Slider {id:yCtrl; width:300; height:30; min:30; max:300; init:220; name:"Y"}
+ Slider {id:alphaCtrl; width:300; height:30; min:0; max:1; init:1; name:"Alpha"}
+ }
+ }
+ }
+}
diff --git a/examples/quick/canvas/stockchart/README b/examples/quick/canvas/stockchart/README
new file mode 100644
index 0000000000..2652866ed6
--- /dev/null
+++ b/examples/quick/canvas/stockchart/README
@@ -0,0 +1,5 @@
+To run:
+
+ make install
+ QML_IMPORT_PATH=$PWD qmlscene stock.qml
+
diff --git a/examples/quick/canvas/stockchart/com/nokia/StockChartExample/qmldir b/examples/quick/canvas/stockchart/com/nokia/StockChartExample/qmldir
new file mode 100644
index 0000000000..4c60e556d4
--- /dev/null
+++ b/examples/quick/canvas/stockchart/com/nokia/StockChartExample/qmldir
@@ -0,0 +1 @@
+plugin qmlstockchartexampleplugin
diff --git a/examples/quick/canvas/stockchart/model.cpp b/examples/quick/canvas/stockchart/model.cpp
new file mode 100644
index 0000000000..42eb2d592f
--- /dev/null
+++ b/examples/quick/canvas/stockchart/model.cpp
@@ -0,0 +1,255 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "model.h"
+
+#include <QtCore/QUrl>
+#include <QtCore/QDate>
+#include <QtCore/QList>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+
+#include <QtNetwork/QNetworkAccessManager>
+#include <QtNetwork/QNetworkReply>
+
+StockModel::StockModel(QObject *parent)
+ : QAbstractListModel(parent)
+ , _startDate(QDate(1995, 4, 25))
+ , _endDate(QDate::currentDate())
+ , _dataCycle(StockModel::Daily)
+ , _manager(0)
+ , _updating(false)
+{
+ QHash<int, QByteArray> roles;
+ roles[StockModel::DateRole] = "date";
+ roles[StockModel::SectionRole] = "year";
+ roles[StockModel::OpenPriceRole] = "openPrice";
+ roles[StockModel::ClosePriceRole] = "closePrice";
+ roles[StockModel::HighPriceRole] = "highPrice";
+ roles[StockModel::LowPriceRole] = "lowPrice";
+ roles[StockModel::VolumeRole] = "volume";
+ roles[StockModel::AdjustedPriceRole] = "adjustedPrice";
+ setRoleNames(roles);
+
+ connect(this, SIGNAL(stockNameChanged()), SLOT(requestData()));
+ connect(this, SIGNAL(startDateChanged()), SLOT(requestData()));
+ connect(this, SIGNAL(endDateChanged()), SLOT(requestData()));
+ connect(this, SIGNAL(dataCycleChanged()), SLOT(requestData()));
+
+ _manager = new QNetworkAccessManager(this);
+ connect(_manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(update(QNetworkReply*)));
+
+}
+
+int StockModel::rowCount(const QModelIndex & parent) const {
+ Q_UNUSED(parent);
+ return _prices.count();
+}
+
+StockPrice* StockModel::stockPriceAtIndex(int idx) const
+{
+ if (idx >=0 && idx < _prices.size()) {
+ return _prices[idx];
+ }
+ return 0;
+}
+
+
+void StockModel::requestData()
+{
+ if (!_updating) {
+ _updating = true;
+ QMetaObject::invokeMethod(this, "doRequest", Qt::QueuedConnection);
+ }
+}
+
+void StockModel::doRequest()
+{
+ /*
+ Fetch stock data from yahoo finance:
+ url: http://ichart.finance.yahoo.com/table.csv?s=NOK&a=5&b=11&c=2010&d=7&e=23&f=2010&g=d&ignore=.csv
+ s:stock name/id, a:start day, b:start month, c:start year default: 25 April 1995, oldest c= 1962
+ d:end day, e:end month, f:end year, default:today (data only available 3 days before today)
+ g:data cycle(d daily, w weekly, m monthly, v Dividend)
+ */
+ if (_manager && !_stockName.isEmpty() && _endDate > _startDate) {
+ QString query("http://ichart.finance.yahoo.com/table.csv?s=%1&a=%2&b=%3&c=%4&d=%5&e=%6&f=%7&g=%8&ignore=.csv");
+ query = query.arg(_stockName)
+ .arg(_startDate.day()).arg(_startDate.month()).arg(_startDate.year())
+ .arg(_endDate.day()).arg(_endDate.month()).arg(_endDate.year())
+ .arg(dataCycleString());
+
+ qDebug() << "request stock data:" << query;
+ QNetworkReply* reply = _manager->get(QNetworkRequest(QUrl(query)));
+ connect(reply, SIGNAL(downloadProgress(qint64,qint64)), SIGNAL(downloadProgress(qint64,qint64)));
+ }
+}
+
+void StockModel::update(QNetworkReply *reply)
+{
+ _updating = false;
+
+ if (reply) {
+ if (reply->error() == QNetworkReply::NoError) {
+ beginResetModel();
+
+ foreach (StockPrice* p, _prices) {
+ p->deleteLater();
+ }
+
+ _prices.clear();
+
+ while (!reply->atEnd()) {
+ QString line = reply->readLine();
+ QStringList fields = line.split(',');
+
+ //data format:Date,Open,High,Low,Close,Volume,Adjusted close price
+ //example: 2011-06-24,6.03,6.04,5.88,5.88,20465200,5.88
+ if (fields.size() == 7) {
+ StockPrice* price = new StockPrice(this);
+ price->setDate(QDate::fromString(fields[0], Qt::ISODate));
+ price->setOpenPrice(fields[1].toFloat());
+ price->setHighPrice(fields[2].toFloat());
+ price->setLowPrice(fields[3].toFloat());
+ price->setClosePrice(fields[4].toFloat());
+ price->setVolume(fields[5].toInt());
+ price->setAdjustedPrice(fields[6].toFloat());
+ _prices.prepend(price);
+ }
+ }
+ qDebug() << "get stock data successfully, total:" << _prices.count() << "records.";
+ } else {
+ qDebug() << "get stock data failed:" << reply->errorString();
+ }
+ reply->deleteLater();
+ endResetModel();
+ emit dataChanged(QModelIndex(), QModelIndex());
+ }
+}
+
+QVariant StockModel::data(const QModelIndex & index, int role) const {
+ if (index.row() < 0 || index.row() > _prices.count())
+ return QVariant();
+
+ const StockPrice* price = _prices[index.row()];
+ if (role == StockModel::DateRole)
+ return price->date();
+ else if (role == StockModel::OpenPriceRole)
+ return price->openPrice();
+ else if (role == StockModel::ClosePriceRole)
+ return price->closePrice();
+ else if (role == StockModel::HighPriceRole)
+ return price->highPrice();
+ else if (role == StockModel::LowPriceRole)
+ return price->lowPrice();
+ else if (role == StockModel::AdjustedPriceRole)
+ return price->adjustedPrice();
+ else if (role == StockModel::VolumeRole)
+ return price->volume();
+ else if (role == StockModel::SectionRole)
+ return price->date().year();
+ return QVariant();
+}
+
+QString StockModel::stockName() const
+{
+ return _stockName;
+}
+void StockModel::setStockName(const QString& name)
+{
+ if (_stockName != name) {
+ _stockName = name;
+ emit stockNameChanged();
+ }
+}
+
+QDate StockModel::startDate() const
+{
+ return _startDate;
+}
+void StockModel::setStartDate(const QDate& date)
+{
+ if (_startDate.isValid() && _startDate != date) {
+ _startDate = date;
+ emit startDateChanged();
+ }
+}
+
+QDate StockModel::endDate() const
+{
+ return _endDate;
+}
+void StockModel::setEndDate(const QDate& date)
+{
+ if (_endDate.isValid() && _endDate != date) {
+ _endDate = date;
+ emit endDateChanged();
+ }
+}
+
+StockModel::StockDataCycle StockModel::dataCycle() const
+{
+ return _dataCycle;
+}
+
+QString StockModel::dataCycleString() const
+{
+ switch (_dataCycle) {
+ case StockModel::Daily:
+ return QString('d');
+ break;
+ case StockModel::Weekly:
+ return QString('w');
+ case StockModel::Monthly:
+ return QString('m');
+ case StockModel::Dividend:
+ return QString('v');
+ }
+
+ return QString('d');
+}
+
+
+void StockModel::setDataCycle(StockModel::StockDataCycle cycle)
+{
+ if (_dataCycle != cycle) {
+ _dataCycle = cycle;
+ emit dataCycleChanged();
+ }
+}
diff --git a/examples/quick/canvas/stockchart/model.h b/examples/quick/canvas/stockchart/model.h
new file mode 100644
index 0000000000..95e6f4891c
--- /dev/null
+++ b/examples/quick/canvas/stockchart/model.h
@@ -0,0 +1,166 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore/QAbstractListModel>
+#include <QtCore/QDate>
+
+class StockPrice : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QDate date READ date)
+ Q_PROPERTY(qreal openPrice READ openPrice)
+ Q_PROPERTY(qreal closePrice READ closePrice)
+ Q_PROPERTY(qreal highPrice READ highPrice)
+ Q_PROPERTY(qreal lowPrice READ lowPrice)
+ Q_PROPERTY(qint32 volume READ volume)
+ Q_PROPERTY(qreal adjustedPrice READ adjustedPrice)
+public:
+
+ StockPrice(QObject *parent = 0)
+ : QObject(parent)
+ , _openPrice(-1)
+ , _closePrice(-1)
+ , _highPrice(-1)
+ , _lowPrice(-1)
+ , _volume(-1)
+ , _adjustedPrice(-1)
+ {
+ }
+ QDate date() const {return _date;}
+ qreal openPrice() const {return _openPrice; }
+ qreal closePrice() const {return _closePrice;}
+ qreal highPrice() const {return _highPrice;}
+ qreal lowPrice() const{return _lowPrice;}
+ qreal adjustedPrice() const{return _adjustedPrice;}
+ qint32 volume() const{return _volume;}
+
+ void setDate(const QDate& date){_date = date;}
+ void setOpenPrice(qreal price){_openPrice = price;}
+ void setClosePrice(qreal price){_closePrice = price;}
+ void setHighPrice(qreal price){_highPrice = price;}
+ void setLowPrice(qreal price){_lowPrice = price;}
+ void setAdjustedPrice(qreal price) {_adjustedPrice = price;}
+ void setVolume(qint32 volume) {_volume = volume;}
+
+private:
+ QDate _date;
+ qreal _openPrice;
+ qreal _closePrice;
+ qreal _highPrice;
+ qreal _lowPrice;
+ qint32 _volume;
+ qreal _adjustedPrice;
+};
+
+class QNetworkReply;
+class QNetworkAccessManager;
+class StockModel : public QAbstractListModel
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QString stockName READ stockName WRITE setStockName NOTIFY stockNameChanged)
+ Q_PROPERTY(QDate startDate READ startDate WRITE setStartDate NOTIFY startDateChanged)
+ Q_PROPERTY(QDate endDate READ endDate WRITE setEndDate NOTIFY endDateChanged)
+ Q_PROPERTY(StockDataCycle dataCycle READ dataCycle WRITE setDataCycle NOTIFY dataCycleChanged)
+
+ Q_ENUMS(StockDataCycle)
+public:
+ enum StockDataCycle {
+ Daily,
+ Weekly,
+ Monthly,
+ Dividend
+ };
+
+ enum StockModelRoles {
+ DateRole = Qt::UserRole + 1,
+ SectionRole,
+ OpenPriceRole,
+ ClosePriceRole,
+ HighPriceRole,
+ LowPriceRole,
+ VolumeRole,
+ AdjustedPriceRole
+ };
+
+ StockModel(QObject *parent = 0);
+
+ QString stockName() const;
+ void setStockName(const QString& name);
+
+ QDate startDate() const;
+ void setStartDate(const QDate& date);
+
+ QDate endDate() const;
+ void setEndDate(const QDate& date);
+
+ StockDataCycle dataCycle() const;
+ void setDataCycle(StockDataCycle cycle);
+
+ int rowCount(const QModelIndex & parent = QModelIndex()) const;
+
+ QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
+
+signals:
+ void stockNameChanged();
+ void startDateChanged();
+ void endDateChanged();
+ void dataCycleChanged();
+ void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
+
+public slots:
+ void requestData();
+ StockPrice* stockPriceAtIndex(int idx) const;
+private slots:
+ void doRequest();
+ void update(QNetworkReply* reply);
+private:
+ QString dataCycleString() const;
+ QList<StockPrice*> _prices;
+ QString _stockName;
+ QDate _startDate;
+ QDate _endDate;
+ StockDataCycle _dataCycle;
+ QNetworkAccessManager* _manager;
+ bool _updating;
+};
+
+
+
+
diff --git a/examples/quick/canvas/stockchart/plugin.cpp b/examples/quick/canvas/stockchart/plugin.cpp
new file mode 100644
index 0000000000..3b354e2b31
--- /dev/null
+++ b/examples/quick/canvas/stockchart/plugin.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml/QQmlExtensionPlugin>
+#include <QtQml/qqml.h>
+#include <QtGui/QGuiApplication>
+#include "model.h"
+
+class QStockChartExampleQmlPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+public:
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(uri == QLatin1String("com.nokia.StockChartExample"));
+ qmlRegisterType<StockModel>(uri, 1, 0, "StockModel");
+ qmlRegisterType<StockPrice>(uri, 1, 0, "StockPrice");
+ }
+};
+
+#include "plugin.moc"
+
+Q_EXPORT_PLUGIN2(qmlstockchartexampleplugin, QStockChartExampleQmlPlugin);
diff --git a/examples/quick/canvas/stockchart/stock.qml b/examples/quick/canvas/stockchart/stock.qml
new file mode 100644
index 0000000000..1c95fde2ce
--- /dev/null
+++ b/examples/quick/canvas/stockchart/stock.qml
@@ -0,0 +1,726 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import com.nokia.StockChartExample 1.0
+import "../contents"
+
+Rectangle {
+ id:container
+ width: 360; height: 600
+ color: "#343434";
+ Image { source: "contents/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 1 }
+
+
+ TitleBar {
+ id: titleBar
+ width: parent.width
+ anchors.top : container.top
+ height: 40
+ opacity: 0.9
+ }
+
+ StockModel {
+ id:stockModel
+ dataCycle: StockModel.Daily
+ function dataCycleName() {
+ if (dataCycle === StockModel.Weekly)
+ return "Weekly";
+ else if (dataCycle === StockModel.Monthly)
+ return "Monthly";
+ return "Daily";
+ }
+
+ onDataChanged: {
+ if (view.viewType == "chart") {
+ canvas.requestPaint();
+ }
+ }
+ onDownloadProgress: {
+ if (bytesReceived == bytesTotal && bytesTotal != -1) {
+ progress.opacity = 0;
+ } else {
+ progress.opacity = 0.8;
+ progress.text = "downloading " + stockModel.dataCycleName() + " data ..."+ Math.round(bytesReceived/1000) + " KB";
+ }
+ }
+
+ property string description:"";
+ }
+
+ Stocks {id:stocks}
+
+ Rectangle {
+ id: header
+ width: parent.width
+ height: 20
+ color: "steelblue"
+ opacity: 0
+ Row {
+ spacing: 2
+ Text {
+ id:t
+ font.pointSize:15
+ horizontalAlignment:Text.AlignHCenter
+ font.bold: true
+ font.underline:true
+ }
+ Rectangle {
+ height:20
+ width:50
+ Text {text:"Stock list"; font.pointSize:15; font.bold: true}
+ }
+ }
+ }
+
+ ListView {
+ id:stockList
+ width: parent.width
+ anchors.bottom: container.bottom
+ anchors.top : titleBar.bottom
+ focus: true
+ keyNavigationWraps: true
+ spacing:1
+ opacity: 1
+ model: stocks
+
+ Component.onCompleted: opacity = 0.9;
+ onOpacityChanged: {
+ titleBar.title = "Top 100 NASDAQ stocks"
+ }
+
+
+ delegate : Rectangle {
+ height: 30
+ width: view.width
+ color: {
+ if (ListView.isCurrentItem)
+ return focus ? "lightyellow" : "pink";
+ return index % 2 == 0 ? "lightblue" : "lightsteelblue"
+ }
+ Text {
+ font.pointSize:20
+ text: index + ". " + stockId + " \t(" + name + ")";
+ }
+ MouseArea {
+ anchors.fill: parent;
+ onDoubleClicked: {
+ stockList.opacity = 0;
+ stockModel.stockName = stockId;
+ stockModel.description = "NASDAQ:" + stockId + " (" + name + ")";
+ view.opacity = 1;
+ view.viewType = "chart";
+ canvas.opacity = 0.7;
+ }
+ onClicked: stockList.currentIndex = index
+ }//mousearea
+ }//delegate
+ }
+
+ ListView {
+ id:view
+ width: container.width
+ height: container.height - 50
+ anchors.bottom: container.bottom
+ focus: true
+ keyNavigationWraps: true
+
+ spacing:1
+ opacity: 0
+ model: stockModel
+ highlightFollowsCurrentItem: false
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ preferredHighlightBegin:50
+ preferredHighlightEnd : height - 50
+ highlight: listHighlight
+
+ //header : Text {}
+ delegate: listDelegate
+ snapMode: ListView.SnapToItem
+
+ property string viewType : "list"
+ property int topIndex:indexAt(0,contentY);
+ property int bottomIndex:indexAt(0, contentY+height);
+
+ onCountChanged: {
+
+ titleBar.title = stockModel.description + " " + Qt.formatDate(stockModel.startDate, "yyyy-MM-dd") + " - " +
+ Qt.formatDate(stockModel.endDate, "yyyy-MM-dd") + " " + stockModel.dataCycleName() +
+ " records:" + view.count;
+
+ }
+
+ Component {
+ id: listDelegate
+ Rectangle {
+ height: 20
+ width: view.width
+ border.color: "lightsteelblue"
+ border.width: 1
+ color: {
+ if (ListView.isCurrentItem)
+ return focus ? "lightyellow" : "pink";
+
+ return index % 2 == 0 ? "lightblue" : "lightsteelblue"
+ }
+ Text {
+ font.pointSize:13
+ text: index + ". " + Qt.formatDate(date, "yyyy-MM-dd")
+ + "\t " + Math.round(openPrice*100)/100
+ + "\t " + Math.round(highPrice*100)/100
+ + "\t " + Math.round(lowPrice*100)/100
+ + "\t " + Math.round(closePrice*100)/100
+ + "\t " + volume + "\t "
+ + Math.round(adjustedPrice*100)/100;
+ }
+ MouseArea {anchors.fill: parent; onClicked: view.currentIndex = index}
+ }
+ }
+
+ Component {
+ id: chartDelegate
+ Rectangle {
+ height: 20
+ width: view.width/view.count * canvas.scaleX
+ border.color: "lightsteelblue"
+ border.width: 1
+ color: {
+ if (ListView.isCurrentItem)
+ return focus ? "lightyellow" : "pink";
+
+ return index % 2 == 0 ? "lightblue" : "lightsteelblue"
+ }
+
+ Text {
+ anchors.bottom: parent.bottom
+ font.pointSize: {
+ if (parent.width <= 4)
+ return 1;
+ if (parent.width <= 50)
+ return parent.width/4;
+ return 15;
+ }
+ horizontalAlignment:Text.AlignHCenter
+ verticalAlignment:Text.AlignBottom
+ text:font.pointSize > 1 ? Qt.formatDate(date, "d/M/yy") : ""
+ }
+ MouseArea {anchors.fill: parent; onClicked: view.currentIndex = index}
+ }
+ }
+
+ Component {
+ id:chartHighlight
+ Rectangle { radius: 5; width:40; height: 20; color: "lightsteelblue" }
+ }
+
+ Component {
+ id:listHighlight
+ Rectangle { radius: 5; width:container.width; height: 20; color: "lightsteelblue" }
+ }
+
+
+
+
+ onViewTypeChanged : {
+ if (viewType == "list") {
+ view.orientation = ListView.Vertical;
+ view.delegate = listDelegate;
+// view.section.property = "year";
+// view.section.criteria = ViewSection.FullString;
+// view.section.delegate = sectionHeading;
+ view.highlight = listHighlight;
+ view.opacity = 1;
+ canvas.opacity = 0;
+ // comment.opacity = 0;
+
+ } else if (viewType == "chart") {
+ view.orientation = ListView.Horizontal;
+ view.delegate = chartDelegate;
+ //comment.opacity = 0.6;
+
+ view.opacity = 1;
+ view.height = 30
+
+ canvas.opacity = 0.7;
+ canvas.requestPaint();
+ } else {
+ viewType = "list";
+ }
+ }
+
+
+ onCurrentIndexChanged: {
+ //header.updateCurrent(stockModel.stockPriceAtIndex(view.currentIndex));
+ if (viewType == "chart") {
+ canvas.first = Math.round(view.currentIndex - view.currentIndex / canvas.scaleX);
+ canvas.last = Math.round(view.currentIndex + (view.count - view.currentIndex) / canvas.scaleX);
+
+ canvas.requestPaint();
+ }
+ }
+ onContentYChanged: { // keep "current" item visible
+ topIndex = indexAt(0,contentY);
+ bottomIndex = indexAt(0, contentY+height);
+
+ if (topIndex != -1 && currentIndex <= topIndex)
+ currentIndex = topIndex+1;
+ else if (bottomIndex != -1 && currentIndex >= bottomIndex)
+ currentIndex = bottomIndex-1;
+ if (viewType == "chart")
+ canvas.requestPaint();
+ }
+
+ onContentXChanged: { // keep "current" item visible
+ topIndex = indexAt(contentX,0);
+ bottomIndex = indexAt(contentX+width, 0);
+
+ if (topIndex != -1 && currentIndex <= topIndex)
+ currentIndex = topIndex+1;
+ else if (bottomIndex != -1 && currentIndex >= bottomIndex)
+ currentIndex = bottomIndex-1;
+ if (viewType == "chart")
+ canvas.requestPaint();
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onDoubleClicked: {
+ if (view.viewType == "list")
+ view.viewType = "chart";
+ else
+ view.viewType = "list";
+ }
+ }
+ }
+
+
+
+ Canvas {
+ id:canvas
+ anchors.top : titleBar.bottom
+ anchors.bottom : view.top
+ width:container.width;
+ opacity:0
+ renderTarget: Canvas.Image
+ renderStrategy: Canvas.Immediate
+ property bool running:false
+ property int frames:first
+ property int mouseX:0;
+ property int mouseY:0;
+ property int mousePressedX:0;
+ property int mousePressedY:0;
+ property int movedY:0
+ property real scaleX:1.0;
+ property real scaleY:1.0;
+ property int first:0;
+ property int last:view.count - 1;
+
+ onOpacityChanged: {
+ if (opacity > 0)
+ requestPaint();
+ }
+ Text {
+ id:comment
+ x:100
+ y:50
+ font.pointSize: 20
+ color:"white"
+ opacity: 0.7
+ focus:false
+ text: stockModel.description
+ function updateCurrent(price)
+ {
+ if (price !== undefined) {
+ text =stockModel.description + "\n"
+ + Qt.formatDate(price.date, "yyyy-MM-dd") + " OPEN:"
+ + Math.round(price.openPrice*100)/100 + " HIGH:"
+ + Math.round(price.highPrice*100)/100 + " LOW:"
+ + Math.round(price.lowPrice*100)/100 + " CLOSE:"
+ + Math.round(price.closePrice*100)/100 + " VOLUME:"
+ + price.volume;
+ }
+ }
+ }
+
+ Text {
+ id:priceAxis
+ x:25
+ y:25
+ font.pointSize: 15
+ color:"yellow"
+ opacity: 0.7
+ focus: false
+ }
+ Text {
+ id:volumeAxis
+ x:canvas.width - 200
+ y:25
+ font.pointSize: 15
+ color:"yellow"
+ opacity: 0.7
+ }
+
+ Rectangle {
+ id:progress
+ x:canvas.width/2 - 100
+ y:canvas.height/2
+ width:childrenRect.width
+ height: childrenRect.height
+ opacity: 0
+ color:"white"
+ property string text;
+ Text {
+ text:parent.text
+ font.pointSize: 20
+ }
+ }
+
+ Button {
+ id:runButton
+ text:"Run this chart"
+ y:0
+ x:canvas.width/2 - 50
+ opacity: 0.5
+ onClicked: {
+ if (canvas.running) {
+ canvas.running = false;
+ canvas.frames = canvas.first;
+ canvas.requestPaint();
+ text = "Run this chart";
+ comment.text = stockModel.description;
+ } else {
+ text = " Stop running ";
+ canvas.runChart();
+ }
+ }
+ }
+ Button {
+ id:returnButton
+ text:"Stocks"
+ y:0
+ anchors.left : runButton.right
+ anchors.leftMargin : 20
+ opacity: 0.5
+ onClicked: {
+ stockList.opacity = 1;
+ canvas.opacity = 0;
+ }
+ }
+ PinchArea {
+ anchors.fill: parent
+ onPinchUpdated : {
+ var current = pinch.center;
+ var scale = pinch.scale;
+ console.log("center:" + pinch.center + " scale:" + pinch.scale);
+ //canvas.requestPaint();
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+
+ onDoubleClicked: {
+ if (stockModel.dataCycle == StockModel.Daily)
+ stockModel.dataCycle = StockModel.Weekly;
+ else if (stockModel.dataCycle == StockModel.Weekly)
+ stockModel.dataCycle = StockModel.Monthly;
+ else
+ stockModel.dataCycle = StockModel.Daily;
+ }
+
+ onPositionChanged: {
+ if (mouse.modifiers & Qt.ControlModifier) {
+ if (canvas.mouseX == 0 && canvas.mouseY == 0) {
+ canvas.mouseX = mouse.x;
+ canvas.mouseY = mouse.y;
+ }
+ } else{
+ var w = (view.width/view.count)*canvas.scaleX;
+
+ //canvas.movedY += Math.round((canvas.mousePressedY - mouse.y)/2);
+
+ var movedX = Math.round((canvas.mousePressedX - mouse.x)/w);
+ if (movedX != 0 || canvas.movedY != 0) {
+ if (canvas.first + movedX >= 0 && canvas.last + movedX < view.count) {
+ canvas.first += movedX;
+ canvas.last += movedX;
+ }
+ canvas.requestPaint();
+ }
+ }
+ }
+
+ onPressed: {
+ canvas.mousePressedX = mouse.x;
+ canvas.mousePressedY = mouse.y;
+ }
+
+ onReleased : {
+ if (mouse.modifiers & Qt.ControlModifier) {
+ var sx = mouse.x - canvas.mouseX;
+ var sy = canvas.mouseY - mouse.y;
+
+ if (Math.abs(sx) < 50) sx = 0;
+ if (Math.abs(sy) < 50) sy = 0;
+
+ if (sx > 0)
+ canvas.scaleX *= sx/100 +1;
+ else
+ canvas.scaleX *= 1/(-sx/100 + 1);
+
+ if (sy > 0)
+ canvas.scaleY *= sy/100 +1;
+ else
+ canvas.scaleY *= 1/(-sy/100 + 1);
+
+ if (canvas.scaleX < 1)
+ canvas.scaleX = 1;
+
+ //console.log("scaleX:" + canvas.scaleX + ", scaleY:" + canvas.scaleY);
+
+ canvas.first = Math.round(view.currentIndex - view.currentIndex / canvas.scaleX);
+ canvas.last = Math.round(view.currentIndex + (view.count - view.currentIndex) / canvas.scaleX);
+
+ canvas.mouseX = 0;
+ canvas.mouseY = 0;
+ canvas.mousePressedX = 0;
+ canvas.mousePressedY = 0;
+ canvas.requestPaint();
+ }
+ }
+ }
+
+ function runChart() {
+ canvas.running = true;
+ requestPaint();
+ }
+
+ function showPriceAt(x) {
+ var w = (view.width/view.count)*canvas.scaleX;
+ //header.updateCurrent(stockModel.stockPriceAtIndex(canvas.first + Math.round(x/w)));
+ //console.log("x:" + x + " w:" + w + " index:" + (canvas.first + Math.round(x/w)));
+ }
+
+ function drawPrice(ctx, from, to, color, price, points, highest)
+ {
+ ctx.globalAlpha = 0.7;
+ ctx.strokeStyle = color;
+ ctx.lineWidth = 1;
+ ctx.beginPath();
+
+ //price x axis
+ priceAxis.text = "price:" + Math.round(highest);
+ ctx.font = "bold 12px sans-serif";
+
+ ctx.strokeText("price", 25, 25);
+ for (var j = 1; j < 30; j++) {
+ var val = (highest * j) / 30;
+ val = canvas.height * (1 - val/highest);
+ ctx.beginPath();
+
+ ctx.moveTo(10, val);
+ if (j % 5)
+ ctx.lineTo(15, val);
+ else
+ ctx.lineTo(20, val);
+ ctx.stroke();
+ }
+
+ ctx.beginPath();
+ ctx.moveTo(10, 0);
+ ctx.lineTo(10, canvas.height);
+ ctx.stroke();
+
+
+ var w = canvas.width/points.length;
+ var end = canvas.running? canvas.frames - canvas.first :points.length;
+ for (var i = 0; i < end; i++) {
+ var x = points[i].x;
+ var y = points[i][price];
+ y += canvas.movedY;
+
+ y = canvas.height * (1 - y/highest);
+ if (i == 0) {
+ ctx.moveTo(x+w/2, y);
+ } else {
+ ctx.lineTo(x+w/2, y);
+ }
+ }
+ ctx.stroke();
+ }
+
+ function drawKLine(ctx, from, to, points, highest)
+ {
+ ctx.globalAlpha = 0.4;
+ ctx.lineWidth = 2;
+ var end = canvas.running? canvas.frames - canvas.first :points.length;
+ for (var i = 0; i < end; i++) {
+ var x = points[i].x;
+ var open = canvas.height * (1 - points[i].open/highest) - canvas.movedY;
+ var close = canvas.height * (1 - points[i].close/highest) - canvas.movedY;
+ var high = canvas.height * (1 - points[i].high/highest) - canvas.movedY;
+ var low = canvas.height * (1 - points[i].low/highest) - canvas.movedY;
+
+ var top, bottom;
+ if (close <= open) {
+ ctx.fillStyle = Qt.rgba(1, 0, 0, 1);
+ ctx.strokeStyle = Qt.rgba(1, 0, 0, 1);
+ top = close;
+ bottom = open;
+ } else {
+ ctx.fillStyle = Qt.rgba(0, 1, 0, 1);
+ ctx.strokeStyle = Qt.rgba(0, 1, 0, 1);
+ top = open;
+ bottom = close;
+ }
+
+ var w1, w2;
+ w1 = canvas.width/points.length;
+ w2 = w1 > 10 ? w1/2 : w1;
+
+ ctx.fillRect(x + (w1 - w2)/2, top, w2, bottom - top);
+ ctx.beginPath();
+ ctx.moveTo(x+w1/2, high);
+ ctx.lineTo(x+w1/2, low);
+ ctx.stroke();
+ }
+ ctx.globalAlpha = 1;
+
+ }
+
+ function drawVolume(ctx, from, to, color, price, points, highest)
+ {
+ ctx.fillStyle = color;
+ ctx.globalAlpha = 0.6;
+ ctx.strokeStyle = Qt.rgba(0.8, 0.8, 0.8, 1);
+ ctx.lineWidth = 1;
+
+ //volume x axis
+ volumeAxis.text = "volume:" + Math.round(highest/(1000*100)) + "M";
+ for (var j = 1; j < 30; j++) {
+ var val = (highest * j) / 30;
+ val = canvas.height * (1 - val/highest);
+ ctx.beginPath();
+ if (j % 5)
+ ctx.moveTo(canvas.width - 15, val);
+ else
+ ctx.moveTo(canvas.width - 20, val);
+ ctx.lineTo(canvas.width - 10, val);
+ ctx.stroke();
+ }
+
+ ctx.beginPath();
+ ctx.moveTo(canvas.width - 10, 0);
+ ctx.lineTo(canvas.width - 10, canvas.height);
+ ctx.stroke();
+
+ var end = canvas.running? canvas.frames - canvas.first :points.length;
+ for (var i = 0; i < end; i++) {
+ var x = points[i].x;
+ var y = points[i][price];
+ y = canvas.height * (1 - y/highest);
+ ctx.fillRect(x, y, canvas.width/points.length, canvas.height - y);
+ }
+ }
+/*
+ onPainted : {
+ if (canvas.running) {
+ if (frames >= last) {
+ canvas.running = false;
+ canvas.frames = first;
+ runButton.text = "Run this chart";
+ comment.text = stockModel.description;
+ requestPaint();
+ } else {
+ frames += Math.round(view.count / 100);
+ if (frames > last) frames = last;
+ var price = stockModel.stockPriceAtIndex(frames);
+ if (price) {
+ comment.updateCurrent(price);
+ }
+
+ requestPaint();
+ }
+ }
+ }
+*/
+ onPaint: {
+ if (view.currentIndex <= 0)
+ first = 0;
+ if (last >= view.count)
+ last = view.count - 1;
+
+ //console.log("painting... first:" + first + ", last:" + last + " current:" + view.currentIndex);
+ var ctx = canvas.getContext("2d");
+ ctx.save();
+
+ ctx.globalCompositeOperation = "source-over";
+ ctx.lineWidth = 1;
+ ctx.lineJoin = "round";
+ ctx.fillStyle = "rgba(0,0,0,0)";
+
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+
+
+
+ var highestPrice = 500/canvas.scaleY;
+ var highestValume = 600 * 1000 * 1000/canvas.scaleY;
+ var points = [];
+ for (var i = 0; i <= last - first; i++) {
+ var price = stockModel.stockPriceAtIndex(i + first);
+ points.push({
+ x: i*canvas.width/(last-first+1),
+ open: price.openPrice,
+ close: price.closePrice,
+ high:price.highPrice,
+ low:price.lowPrice,
+ volume:price.volume
+ });
+ }
+
+ drawPrice(ctx, first, last, Qt.rgba(1, 0, 0, 1),"high", points, highestPrice);
+ drawPrice(ctx, first, last, Qt.rgba(0, 1, 0, 1),"low", points, highestPrice);
+ drawPrice(ctx, first, last, Qt.rgba(0, 0, 1, 1),"open", points, highestPrice);
+ drawPrice(ctx, first, last, Qt.rgba(0.5, 0.5, 0.5, 1),"close", points, highestPrice);
+ drawVolume(ctx, first, last, Qt.rgba(0.3, 0.5, 0.7, 1),"volume", points, highestValume);
+ drawKLine(ctx, first, last, points, highestPrice);
+ ctx.restore();
+ }
+ }
+}
diff --git a/examples/quick/canvas/stockchart/stockchart.pro b/examples/quick/canvas/stockchart/stockchart.pro
new file mode 100644
index 0000000000..e368746db5
--- /dev/null
+++ b/examples/quick/canvas/stockchart/stockchart.pro
@@ -0,0 +1,20 @@
+TEMPLATE = lib
+CONFIG += qt plugin
+QT += qml network
+
+DESTDIR = com/nokia/StockChartExample
+TARGET = qmlstockchartexampleplugin
+
+SOURCES += model.cpp plugin.cpp
+HEADERS += model.h
+qdeclarativesources.files += \
+ com/nokia/StockChartExample/qmldir \
+ stock.qml
+
+qdeclarativesources.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/plugins/com/nokia/StockChartExample
+
+sources.files += stockchart.pro model.h model.cpp plugin.cpp README
+sources.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/plugins
+target.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/plugins/com/nokia/StockChartExample
+
+INSTALLS += qdeclarativesources sources target
diff --git a/examples/quick/canvas/tiger/tiger.js b/examples/quick/canvas/tiger/tiger.js
new file mode 100644
index 0000000000..4be0d26c9d
--- /dev/null
+++ b/examples/quick/canvas/tiger/tiger.js
@@ -0,0 +1,721 @@
+var tiger = [
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
+ "path":"M-122.304 84.285C-122.304 84.285 -122.203 86.179 -123.027 86.16C-123.851 86.141 -140.305 38.066 -160.833 40.309C-160.833 40.309 -143.05 32.956 -122.304 84.285z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
+ "path":"M-118.774 81.262C-118.774 81.262 -119.323 83.078 -120.092 82.779C-120.86 82.481 -119.977 31.675 -140.043 26.801C-140.043 26.801 -120.82 25.937 -118.774 81.262z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
+ "path":"M-91.284 123.59C-91.284 123.59 -89.648 124.55 -90.118 125.227C-90.589 125.904 -139.763 113.102 -149.218 131.459C-149.218 131.459 -145.539 112.572 -91.284 123.59z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
+ "path":"M-94.093 133.801C-94.093 133.801 -92.237 134.197 -92.471 134.988C-92.704 135.779 -143.407 139.121 -146.597 159.522C-146.597 159.522 -149.055 140.437 -94.093 133.801z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
+ "path":"M-98.304 128.276C-98.304 128.276 -96.526 128.939 -96.872 129.687C-97.218 130.435 -147.866 126.346 -153.998 146.064C-153.998 146.064 -153.646 126.825 -98.304 128.276z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
+ "path":"M-109.009 110.072C-109.009 110.072 -107.701 111.446 -108.34 111.967C-108.979 112.488 -152.722 86.634 -166.869 101.676C-166.869 101.676 -158.128 84.533 -109.009 110.072z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
+ "path":"M-116.554 114.263C-116.554 114.263 -115.098 115.48 -115.674 116.071C-116.25 116.661 -162.638 95.922 -174.992 112.469C-174.992 112.469 -168.247 94.447 -116.554 114.263z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
+ "path":"M-119.154 118.335C-119.154 118.335 -117.546 119.343 -118.036 120.006C-118.526 120.669 -167.308 106.446 -177.291 124.522C-177.291 124.522 -173.066 105.749 -119.154 118.335z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
+ "path":"M-108.42 118.949C-108.42 118.949 -107.298 120.48 -107.999 120.915C-108.7 121.35 -148.769 90.102 -164.727 103.207C-164.727 103.207 -153.862 87.326 -108.42 118.949z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
+ "path":"M-128.2 90C-128.2 90 -127.6 91.8 -128.4 92C-129.2 92.2 -157.8 50.2 -177.001 57.8C-177.001 57.8 -161.8 46 -128.2 90z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
+ "path":"M-127.505 96.979C-127.505 96.979 -126.53 98.608 -127.269 98.975C-128.007 99.343 -164.992 64.499 -182.101 76.061C-182.101 76.061 -169.804 61.261 -127.505 96.979z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.172,
+ "path":"M-127.62 101.349C-127.62 101.349 -126.498 102.88 -127.199 103.315C-127.9 103.749 -167.969 72.502 -183.927 85.607C-183.927 85.607 -173.062 69.726 -127.62 101.349z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000",
+ "path":"M-129.83 103.065C-129.327 109.113 -128.339 115.682 -126.6 118.801C-126.6 118.801 -130.2 131.201 -121.4 144.401C-121.4 144.401 -121.8 151.601 -120.2 154.801C-120.2 154.801 -116.2 163.201 -111.4 164.001C-107.516 164.648 -98.793 167.717 -88.932 169.121C-88.932 169.121 -71.8 183.201 -75 196.001C-75 196.001 -75.4 212.401 -79 214.001C-79 214.001 -67.4 202.801 -77 219.601L-81.4 238.401C-81.4 238.401 -55.8 216.801 -71.4 235.201L-81.4 261.201C-81.4 261.201 -61.8 242.801 -69 251.201L-72.2 260.001C-72.2 260.001 -29 232.801 -59.8 262.401C-59.8 262.401 -51.8 258.801 -47.4 261.601C-47.4 261.601 -40.6 260.401 -41.4 262.001C-41.4 262.001 -62.2 272.401 -65.8 290.801C-65.8 290.801 -57.4 280.801 -60.6 291.601L-60.2 303.201C-60.2 303.201 -56.2 281.601 -56.6 319.201C-56.6 319.201 -37.4 301.201 -49 322.001L-49 338.801C-49 338.801 -33.8 322.401 -40.2 335.201C-40.2 335.201 -30.2 326.401 -34.2 341.601C-34.2 341.601 -35 352.001 -30.6 340.801C-30.6 340.801 -14.6 310.201 -20.6 336.401C-20.6 336.401 -21.4 355.601 -16.6 340.801C-16.6 340.801 -16.2 351.201 -7 358.401C-7 358.401 -8.2 307.601 4.6 343.601L8.6 360.001C8.6 360.001 11.4 350.801 11 345.601C11 345.601 25.8 329.201 19 353.601C19 353.601 34.2 330.801 31 344.001C31 344.001 23.4 360.001 25 364.801C25 364.801 41.8 330.001 43 328.401C43 328.401 41 370.802 51.8 334.801C51.8 334.801 57.4 346.801 54.6 351.201C54.6 351.201 62.6 343.201 61.8 340.001C61.8 340.001 66.4 331.801 69.2 345.401C69.2 345.401 71 354.801 72.6 351.601C72.6 351.601 76.6 375.602 77.8 352.801C77.8 352.801 79.4 339.201 72.2 327.601C72.2 327.601 73 324.401 70.2 320.401C70.2 320.401 83.8 342.001 76.6 313.201C76.6 313.201 87.801 321.201 89.001 321.201C89.001 321.201 75.4 298.001 84.2 302.801C84.2 302.801 79 292.401 97.001 304.401C97.001 304.401 81 288.401 98.601 298.001C98.601 298.001 106.601 304.401 99.001 294.401C99.001 294.401 84.6 278.401 106.601 296.401C106.601 296.401 118.201 312.801 119.001 315.601C119.001 315.601 109.001 286.401 104.601 283.601C104.601 283.601 113.001 247.201 154.201 262.801C154.201 262.801 161.001 280.001 165.401 261.601C165.401 261.601 178.201 255.201 189.401 282.801C189.401 282.801 193.401 269.201 192.601 266.401C192.601 266.401 199.401 267.601 198.601 266.401C198.601 266.401 211.801 270.801 213.001 270.001C213.001 270.001 219.801 276.801 220.201 273.201C220.201 273.201 229.401 276.001 227.401 272.401C227.401 272.401 236.201 288.001 236.601 291.601L239.001 277.601L241.001 280.401C241.001 280.401 242.601 272.801 241.801 271.601C241.001 270.401 261.801 278.401 266.601 299.201L268.601 307.601C268.601 307.601 274.601 292.801 273.001 288.801C273.001 288.801 278.201 289.601 278.601 294.001C278.601 294.001 282.601 270.801 277.801 264.801C277.801 264.801 282.201 264.001 283.401 267.601L283.401 260.401C283.401 260.401 290.601 261.201 290.601 258.801C290.601 258.801 295.001 254.801 297.001 259.601C297.001 259.601 284.601 224.401 303.001 243.601C303.001 243.601 310.201 254.401 306.601 235.601C303.001 216.801 299.001 215.201 303.801 214.801C303.801 214.801 304.601 211.201 302.601 209.601C300.601 208.001 303.801 209.601 303.801 209.601C303.801 209.601 308.601 213.601 303.401 191.601C303.401 191.601 309.801 193.201 297.801 164.001C297.801 164.001 300.601 161.601 296.601 153.201C296.601 153.201 304.601 157.601 307.401 156.001C307.401 156.001 307.001 154.401 303.801 150.401C303.801 150.401 282.201 95.6 302.601 117.601C302.601 117.601 314.451 131.151 308.051 108.351C308.051 108.351 298.94 84.341 299.717 80.045L-129.83 103.065z"}
+ ,
+ {"fill": "#cc7226", "stroke":"#000000",
+ "path":"M299.717 80.245C300.345 80.426 302.551 81.55 303.801 83.2C303.801 83.2 310.601 94 305.401 75.6C305.401 75.6 296.201 46.8 305.001 58C305.001 58 311.001 65.2 307.801 51.6C303.936 35.173 301.401 28.8 301.401 28.8C301.401 28.8 313.001 33.6 286.201 -6L295.001 -2.4C295.001 -2.4 275.401 -42 253.801 -47.2L245.801 -53.2C245.801 -53.2 284.201 -91.2 271.401 -128C271.401 -128 264.601 -133.2 255.001 -124C255.001 -124 248.601 -119.2 242.601 -120.8C242.601 -120.8 211.801 -119.6 209.801 -119.6C207.801 -119.6 173.001 -156.8 107.401 -139.2C107.401 -139.2 102.201 -137.2 97.801 -138.4C97.801 -138.4 79.4 -154.4 30.6 -131.6C30.6 -131.6 20.6 -129.6 19 -129.6C17.4 -129.6 14.6 -129.6 6.6 -123.2C-1.4 -116.8 -1.8 -116 -3.8 -114.4C-3.8 -114.4 -20.2 -103.2 -25 -102.4C-25 -102.4 -36.6 -96 -41 -86L-44.6 -84.8C-44.6 -84.8 -46.2 -77.6 -46.6 -76.4C-46.6 -76.4 -51.4 -72.8 -52.2 -67.2C-52.2 -67.2 -61 -61.2 -60.6 -56.8C-60.6 -56.8 -62.2 -51.6 -63 -46.8C-63 -46.8 -70.2 -42 -69.4 -39.2C-69.4 -39.2 -77 -25.2 -75.8 -18.4C-75.8 -18.4 -82.2 -18.8 -85 -16.4C-85 -16.4 -85.8 -11.6 -87.4 -11.2C-87.4 -11.2 -90.2 -10 -87.8 -6C-87.8 -6 -89.4 -3.2 -89.8 -1.6C-89.8 -1.6 -89 1.2 -93.4 6.8C-93.4 6.8 -99.8 25.6 -97.8 30.8C-97.8 30.8 -97.4 35.6 -100.2 37.2C-100.2 37.2 -103.8 36.8 -95.4 48.8C-95.4 48.8 -94.6 50 -97.8 52.4C-97.8 52.4 -115 56 -117.4 72.4C-117.4 72.4 -131 87.2 -131 92.4C-131 94.705 -130.729 97.852 -130.03 102.465C-130.03 102.465 -130.6 110.801 -103 111.601C-75.4 112.401 299.717 80.245 299.717 80.245z"}
+ ,
+ {"fill": "#cc7226",
+ "path":"M-115.6 102.6C-140.6 63.2 -126.2 119.601 -126.2 119.601C-117.4 154.001 12.2 116.401 12.2 116.401C12.2 116.401 181.001 86 192.201 82C203.401 78 298.601 84.4 298.601 84.4L293.001 67.6C228.201 21.2 209.001 44.4 195.401 40.4C181.801 36.4 184.201 46 181.001 46.8C177.801 47.6 138.601 22.8 132.201 23.6C125.801 24.4 100.459 0.649 115.401 32.4C131.401 66.4 57 71.6 40.2 60.4C23.4 49.2 47.4 78.8 47.4 78.8C65.8 98.8 31.4 82 31.4 82C-3 69.2 -27 94.8 -30.2 95.6C-33.4 96.4 -38.2 99.6 -39 93.2C-39.8 86.8 -47.31 70.099 -79 96.4C-99 113.001 -112.8 91 -112.8 91L-115.6 102.6z"}
+ ,
+ {"fill": "#e87f3a",
+ "path":"M133.51 25.346C127.11 26.146 101.743 2.407 116.71 34.146C133.31 69.346 58.31 73.346 41.51 62.146C24.709 50.946 48.71 80.546 48.71 80.546C67.11 100.546 32.709 83.746 32.709 83.746C-1.691 70.946 -25.691 96.546 -28.891 97.346C-32.091 98.146 -36.891 101.346 -37.691 94.946C-38.491 88.546 -45.87 72.012 -77.691 98.146C-98.927 115.492 -112.418 94.037 -112.418 94.037L-115.618 104.146C-140.618 64.346 -125.546 122.655 -125.546 122.655C-116.745 157.056 13.509 118.146 13.509 118.146C13.509 118.146 182.31 87.746 193.51 83.746C204.71 79.746 299.038 86.073 299.038 86.073L293.51 68.764C228.71 22.364 210.31 46.146 196.71 42.146C183.11 38.146 185.51 47.746 182.31 48.546C179.11 49.346 139.91 24.546 133.51 25.346z"}
+ ,
+ {"fill": "#ea8c4d",
+ "path":"M134.819 27.091C128.419 27.891 103.685 3.862 118.019 35.891C134.219 72.092 59.619 75.092 42.819 63.892C26.019 52.692 50.019 82.292 50.019 82.292C68.419 102.292 34.019 85.492 34.019 85.492C-0.381 72.692 -24.382 98.292 -27.582 99.092C-30.782 99.892 -35.582 103.092 -36.382 96.692C-37.182 90.292 -44.43 73.925 -76.382 99.892C-98.855 117.983 -112.036 97.074 -112.036 97.074L-115.636 105.692C-139.436 66.692 -124.891 125.71 -124.891 125.71C-116.091 160.11 14.819 119.892 14.819 119.892C14.819 119.892 183.619 89.492 194.819 85.492C206.019 81.492 299.474 87.746 299.474 87.746L294.02 69.928C229.219 23.528 211.619 47.891 198.019 43.891C184.419 39.891 186.819 49.491 183.619 50.292C180.419 51.092 141.219 26.291 134.819 27.091z"}
+ ,
+ {"fill": "#ec9961",
+ "path":"M136.128 28.837C129.728 29.637 104.999 5.605 119.328 37.637C136.128 75.193 60.394 76.482 44.128 65.637C27.328 54.437 51.328 84.037 51.328 84.037C69.728 104.037 35.328 87.237 35.328 87.237C0.928 74.437 -23.072 100.037 -26.272 100.837C-29.472 101.637 -34.272 104.837 -35.072 98.437C-35.872 92.037 -42.989 75.839 -75.073 101.637C-98.782 120.474 -111.655 100.11 -111.655 100.11L-115.655 107.237C-137.455 70.437 -124.236 128.765 -124.236 128.765C-115.436 163.165 16.128 121.637 16.128 121.637C16.128 121.637 184.928 91.237 196.129 87.237C207.329 83.237 299.911 89.419 299.911 89.419L294.529 71.092C229.729 24.691 212.929 49.637 199.329 45.637C185.728 41.637 188.128 51.237 184.928 52.037C181.728 52.837 142.528 28.037 136.128 28.837z"}
+ ,
+ {"fill": "#eea575",
+ "path":"M137.438 30.583C131.037 31.383 106.814 7.129 120.637 39.383C137.438 78.583 62.237 78.583 45.437 67.383C28.637 56.183 52.637 85.783 52.637 85.783C71.037 105.783 36.637 88.983 36.637 88.983C2.237 76.183 -21.763 101.783 -24.963 102.583C-28.163 103.383 -32.963 106.583 -33.763 100.183C-34.563 93.783 -41.548 77.752 -73.763 103.383C-98.709 122.965 -111.273 103.146 -111.273 103.146L-115.673 108.783C-135.473 73.982 -123.582 131.819 -123.582 131.819C-114.782 166.22 17.437 123.383 17.437 123.383C17.437 123.383 186.238 92.983 197.438 88.983C208.638 84.983 300.347 91.092 300.347 91.092L295.038 72.255C230.238 25.855 214.238 51.383 200.638 47.383C187.038 43.383 189.438 52.983 186.238 53.783C183.038 54.583 143.838 29.783 137.438 30.583z"}
+ ,
+ {"fill": "#f1b288",
+ "path":"M138.747 32.328C132.347 33.128 106.383 9.677 121.947 41.128C141.147 79.928 63.546 80.328 46.746 69.128C29.946 57.928 53.946 87.528 53.946 87.528C72.346 107.528 37.946 90.728 37.946 90.728C3.546 77.928 -20.454 103.528 -23.654 104.328C-26.854 105.128 -31.654 108.328 -32.454 101.928C-33.254 95.528 -40.108 79.665 -72.454 105.128C-98.636 125.456 -110.891 106.183 -110.891 106.183L-115.691 110.328C-133.691 77.128 -122.927 134.874 -122.927 134.874C-114.127 169.274 18.746 125.128 18.746 125.128C18.746 125.128 187.547 94.728 198.747 90.728C209.947 86.728 300.783 92.764 300.783 92.764L295.547 73.419C230.747 27.019 215.547 53.128 201.947 49.128C188.347 45.128 190.747 54.728 187.547 55.528C184.347 56.328 145.147 31.528 138.747 32.328z"}
+ ,
+ {"fill": "#f3bf9c",
+ "path":"M140.056 34.073C133.655 34.873 107.313 11.613 123.255 42.873C143.656 82.874 64.855 82.074 48.055 70.874C31.255 59.674 55.255 89.274 55.255 89.274C73.655 109.274 39.255 92.474 39.255 92.474C4.855 79.674 -19.145 105.274 -22.345 106.074C-25.545 106.874 -30.345 110.074 -31.145 103.674C-31.945 97.274 -38.668 81.578 -71.145 106.874C-98.564 127.947 -110.509 109.219 -110.509 109.219L-115.709 111.874C-131.709 81.674 -122.273 137.929 -122.273 137.929C-113.473 172.329 20.055 126.874 20.055 126.874C20.055 126.874 188.856 96.474 200.056 92.474C211.256 88.474 301.22 94.437 301.22 94.437L296.056 74.583C231.256 28.183 216.856 54.874 203.256 50.874C189.656 46.873 192.056 56.474 188.856 57.274C185.656 58.074 146.456 33.273 140.056 34.073z"}
+ ,
+ {"fill": "#f5ccb0",
+ "path":"M141.365 35.819C134.965 36.619 107.523 13.944 124.565 44.619C146.565 84.219 66.164 83.819 49.364 72.619C32.564 61.419 56.564 91.019 56.564 91.019C74.964 111.019 40.564 94.219 40.564 94.219C6.164 81.419 -17.836 107.019 -21.036 107.819C-24.236 108.619 -29.036 111.819 -29.836 105.419C-30.636 99.019 -37.227 83.492 -69.836 108.619C-98.491 130.438 -110.127 112.256 -110.127 112.256L-115.727 113.419C-130.128 85.019 -121.618 140.983 -121.618 140.983C-112.818 175.384 21.364 128.619 21.364 128.619C21.364 128.619 190.165 98.219 201.365 94.219C212.565 90.219 301.656 96.11 301.656 96.11L296.565 75.746C231.765 29.346 218.165 56.619 204.565 52.619C190.965 48.619 193.365 58.219 190.165 59.019C186.965 59.819 147.765 35.019 141.365 35.819z"}
+ ,
+ {"fill": "#f8d8c4",
+ "path":"M142.674 37.565C136.274 38.365 108.832 15.689 125.874 46.365C147.874 85.965 67.474 85.565 50.674 74.365C33.874 63.165 57.874 92.765 57.874 92.765C76.274 112.765 41.874 95.965 41.874 95.965C7.473 83.165 -16.527 108.765 -19.727 109.565C-22.927 110.365 -27.727 113.565 -28.527 107.165C-29.327 100.765 -35.786 85.405 -68.527 110.365C-98.418 132.929 -109.745 115.293 -109.745 115.293L-115.745 114.965C-129.346 88.564 -120.963 144.038 -120.963 144.038C-112.163 178.438 22.673 130.365 22.673 130.365C22.673 130.365 191.474 99.965 202.674 95.965C213.874 91.965 302.093 97.783 302.093 97.783L297.075 76.91C232.274 30.51 219.474 58.365 205.874 54.365C192.274 50.365 194.674 59.965 191.474 60.765C188.274 61.565 149.074 36.765 142.674 37.565z"}
+ ,
+ {"fill": "#fae5d7",
+ "path":"M143.983 39.31C137.583 40.11 110.529 17.223 127.183 48.11C149.183 88.91 68.783 87.31 51.983 76.11C35.183 64.91 59.183 94.51 59.183 94.51C77.583 114.51 43.183 97.71 43.183 97.71C8.783 84.91 -15.217 110.51 -18.417 111.31C-21.618 112.11 -26.418 115.31 -27.218 108.91C-28.018 102.51 -34.346 87.318 -67.218 112.11C-98.345 135.42 -109.363 118.329 -109.363 118.329L-115.764 116.51C-128.764 92.51 -120.309 147.093 -120.309 147.093C-111.509 181.493 23.983 132.11 23.983 132.11C23.983 132.11 192.783 101.71 203.983 97.71C215.183 93.71 302.529 99.456 302.529 99.456L297.583 78.074C232.783 31.673 220.783 60.11 207.183 56.11C193.583 52.11 195.983 61.71 192.783 62.51C189.583 63.31 150.383 38.51 143.983 39.31z"}
+ ,
+ {"fill": "#fcf2eb",
+ "path":"M145.292 41.055C138.892 41.855 112.917 18.411 128.492 49.855C149.692 92.656 70.092 89.056 53.292 77.856C36.492 66.656 60.492 96.256 60.492 96.256C78.892 116.256 44.492 99.456 44.492 99.456C10.092 86.656 -13.908 112.256 -17.108 113.056C-20.308 113.856 -25.108 117.056 -25.908 110.656C-26.708 104.256 -32.905 89.232 -65.908 113.856C-98.273 137.911 -108.982 121.365 -108.982 121.365L-115.782 118.056C-128.582 94.856 -119.654 150.147 -119.654 150.147C-110.854 184.547 25.292 133.856 25.292 133.856C25.292 133.856 194.093 103.456 205.293 99.456C216.493 95.456 302.965 101.128 302.965 101.128L298.093 79.237C233.292 32.837 222.093 61.856 208.493 57.856C194.893 53.855 197.293 63.456 194.093 64.256C190.892 65.056 151.692 40.255 145.292 41.055z"}
+ ,
+ {"fill": "#ffffff",
+ "path":"M-115.8 119.601C-128.6 97.6 -119 153.201 -119 153.201C-110.2 187.601 26.6 135.601 26.6 135.601C26.6 135.601 195.401 105.2 206.601 101.2C217.801 97.2 303.401 102.8 303.401 102.8L298.601 80.4C233.801 34 223.401 63.6 209.801 59.6C196.201 55.6 198.601 65.2 195.401 66C192.201 66.8 153.001 42 146.601 42.8C140.201 43.6 114.981 19.793 129.801 51.6C152.028 99.307 69.041 89.227 54.6 79.6C37.8 68.4 61.8 98 61.8 98C80.2 118.001 45.8 101.2 45.8 101.2C11.4 88.4 -12.6 114.001 -15.8 114.801C-19 115.601 -23.8 118.801 -24.6 112.401C-25.4 106 -31.465 91.144 -64.6 115.601C-98.2 140.401 -108.6 124.401 -108.6 124.401L-115.8 119.601z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-74.2 149.601C-74.2 149.601 -81.4 161.201 -60.6 174.401C-60.6 174.401 -59.2 175.801 -77.2 171.601C-77.2 171.601 -83.4 169.601 -85 159.201C-85 159.201 -89.8 154.801 -94.6 149.201C-99.4 143.601 -74.2 149.601 -74.2 149.601z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M65.8 102C65.8 102 83.498 128.821 82.9 133.601C81.6 144.001 81.4 153.601 84.6 157.601C87.801 161.601 96.601 194.801 96.601 194.801C96.601 194.801 96.201 196.001 108.601 158.001C108.601 158.001 120.201 142.001 100.201 123.601C100.201 123.601 65 94.8 65.8 102z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-54.2 176.401C-54.2 176.401 -43 183.601 -57.4 214.801L-51 212.401C-51 212.401 -51.8 223.601 -55 226.001L-47.8 222.801C-47.8 222.801 -43 230.801 -47 235.601C-47 235.601 -30.2 243.601 -31 250.001C-31 250.001 -24.6 242.001 -28.6 235.601C-32.6 229.201 -39.8 233.201 -39 214.801L-47.8 218.001C-47.8 218.001 -42.2 209.201 -42.2 202.801L-50.2 205.201C-50.2 205.201 -34.731 178.623 -45.4 177.201C-51.4 176.401 -54.2 176.401 -54.2 176.401z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-21.8 193.201C-21.8 193.201 -19 188.801 -21.8 189.601C-24.6 190.401 -55.8 205.201 -61.8 214.801C-61.8 214.801 -27.4 190.401 -21.8 193.201z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-11.4 201.201C-11.4 201.201 -8.6 196.801 -11.4 197.601C-14.2 198.401 -45.4 213.201 -51.4 222.801C-51.4 222.801 -17 198.401 -11.4 201.201z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M1.8 186.001C1.8 186.001 4.6 181.601 1.8 182.401C-1 183.201 -32.2 198.001 -38.2 207.601C-38.2 207.601 -3.8 183.201 1.8 186.001z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-21.4 229.601C-21.4 229.601 -21.4 223.601 -24.2 224.401C-27 225.201 -63 242.801 -69 252.401C-69 252.401 -27 226.801 -21.4 229.601z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-20.2 218.801C-20.2 218.801 -19 214.001 -21.8 214.801C-23.8 214.801 -50.2 226.401 -56.2 236.001C-56.2 236.001 -26.6 214.401 -20.2 218.801z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-34.6 266.401L-44.6 274.001C-44.6 274.001 -34.2 266.401 -30.6 267.601C-30.6 267.601 -37.4 278.801 -38.2 284.001C-38.2 284.001 -27.8 271.201 -22.2 271.601C-22.2 271.601 -14.6 272.001 -14.6 282.801C-14.6 282.801 -9 272.401 -5.8 272.801C-5.8 272.801 -4.6 279.201 -5.8 286.001C-5.8 286.001 -1.8 278.401 2.2 280.001C2.2 280.001 8.6 278.001 7.8 289.601C7.8 289.601 7.8 300.001 7 302.801C7 302.801 12.6 276.401 15 276.001C15 276.001 23 274.801 27.8 283.601C27.8 283.601 23.8 276.001 28.6 278.001C28.6 278.001 39.4 279.601 42.6 286.401C42.6 286.401 35.8 274.401 41.4 277.601C41.4 277.601 48.2 277.601 49.4 284.001C49.4 284.001 57.8 305.201 59.8 306.801C59.8 306.801 52.2 285.201 53.8 285.201C53.8 285.201 51.8 273.201 57 288.001C57 288.001 53.8 274.001 59.4 274.801C65 275.601 69.4 285.601 77.8 283.201C77.8 283.201 87.401 288.801 89.401 219.601L-34.6 266.401z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-29.8 173.601C-29.8 173.601 -15 167.601 25 173.601C25 173.601 32.2 174.001 39 165.201C45.8 156.401 72.6 149.201 79 151.201L88.601 157.601L89.401 158.801C89.401 158.801 101.801 169.201 102.201 176.801C102.601 184.401 87.801 232.401 78.2 248.401C68.6 264.401 59 276.801 39.8 274.401C39.8 274.401 19 270.401 -6.6 274.401C-6.6 274.401 -35.8 272.801 -38.6 264.801C-41.4 256.801 -27.4 241.601 -27.4 241.601C-27.4 241.601 -23 233.201 -24.2 218.801C-25.4 204.401 -25 176.401 -29.8 173.601z"}
+ ,
+ {"fill": "#e5668c",
+ "path":"M-7.8 175.601C0.6 194.001 -29 259.201 -29 259.201C-31 260.801 -16.34 266.846 -6.2 264.401C4.746 261.763 45 266.001 45 266.001C68.6 250.401 81.4 206.001 81.4 206.001C81.4 206.001 91.801 182.001 74.2 178.801C56.6 175.601 -7.8 175.601 -7.8 175.601z"}
+ ,
+ {"fill": "#b23259",
+ "path":"M-9.831 206.497C-6.505 193.707 -4.921 181.906 -7.8 175.601C-7.8 175.601 54.6 182.001 65.8 161.201C70.041 153.326 84.801 184.001 84.4 193.601C84.4 193.601 21.4 208.001 6.6 196.801L-9.831 206.497z"}
+ ,
+ {"fill": "#a5264c",
+ "path":"M-5.4 222.801C-5.4 222.801 -3.4 230.001 -5.8 234.001C-5.8 234.001 -7.4 234.801 -8.6 235.201C-8.6 235.201 -7.4 238.801 -1.4 240.401C-1.4 240.401 0.6 244.801 3 245.201C5.4 245.601 10.2 251.201 14.2 250.001C18.2 248.801 29.4 244.801 29.4 244.801C29.4 244.801 35 241.601 43.8 245.201C43.8 245.201 46.175 244.399 46.6 240.401C47.1 235.701 50.2 232.001 52.2 230.001C54.2 228.001 63.8 215.201 62.6 214.801C61.4 214.401 -5.4 222.801 -5.4 222.801z"}
+ ,
+ {"fill": "#ff727f", "stroke":"#000000",
+ "path":"M-9.8 174.401C-9.8 174.401 -12.6 196.801 -9.4 205.201C-6.2 213.601 -7 215.601 -7.8 219.601C-8.6 223.601 -4.2 233.601 1.4 239.601L13.4 241.201C13.4 241.201 28.6 237.601 37.8 240.401C37.8 240.401 46.794 241.744 50.2 226.801C50.2 226.801 55 220.401 62.2 217.601C69.4 214.801 76.6 173.201 72.6 165.201C68.6 157.201 54.2 152.801 38.2 168.401C22.2 184.001 20.2 167.201 -9.8 174.401z"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M-8.2 249.201C-8.2 249.201 -9 247.201 -13.4 246.801C-13.4 246.801 -35.8 243.201 -44.2 230.801C-44.2 230.801 -51 225.201 -46.6 236.801C-46.6 236.801 -36.2 257.201 -29.4 260.001C-29.4 260.001 -13 264.001 -8.2 249.201z"}
+ ,
+ {"fill": "#cc3f4c",
+ "path":"M71.742 185.229C72.401 177.323 74.354 168.709 72.6 165.201C66.154 152.307 49.181 157.695 38.2 168.401C22.2 184.001 20.2 167.201 -9.8 174.401C-9.8 174.401 -11.545 188.364 -10.705 198.376C-10.705 198.376 26.6 186.801 27.4 192.401C27.4 192.401 29 189.201 38.2 189.201C47.4 189.201 70.142 188.029 71.742 185.229z"}
+ ,
+ {"stroke":"#a51926", "width":2,
+ "path":"M28.6 175.201C28.6 175.201 33.4 180.001 29.8 189.601C29.8 189.601 15.4 205.601 17.4 219.601"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M-19.4 260.001C-19.4 260.001 -23.8 247.201 -15 254.001C-15 254.001 -10.2 256.001 -11.4 257.601C-12.6 259.201 -18.2 263.201 -19.4 260.001z"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M-14.36 261.201C-14.36 261.201 -17.88 250.961 -10.84 256.401C-10.84 256.401 -6.419 258.849 -7.96 259.281C-12.52 260.561 -7.96 263.121 -14.36 261.201z"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M-9.56 261.201C-9.56 261.201 -13.08 250.961 -6.04 256.401C-6.04 256.401 -1.665 258.711 -3.16 259.281C-6.52 260.561 -3.16 263.121 -9.56 261.201z"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M-2.96 261.401C-2.96 261.401 -6.48 251.161 0.56 256.601C0.56 256.601 4.943 258.933 3.441 259.481C0.48 260.561 3.441 263.321 -2.96 261.401z"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M3.52 261.321C3.52 261.321 0 251.081 7.041 256.521C7.041 256.521 10.881 258.121 9.921 259.401C8.961 260.681 9.921 263.241 3.52 261.321z"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M10.2 262.001C10.2 262.001 5.4 249.601 14.6 256.001C14.6 256.001 19.4 258.001 18.2 259.601C17 261.201 18.2 264.401 10.2 262.001z"}
+ ,
+ {"stroke":"#a5264c", "width":2,
+ "path":"M-18.2 244.801C-18.2 244.801 -5 242.001 1 245.201C1 245.201 7 246.401 8.2 246.001C9.4 245.601 12.6 245.201 12.6 245.201"}
+ ,
+ {"stroke":"#a5264c", "width":2,
+ "path":"M15.8 253.601C15.8 253.601 27.8 240.001 39.8 244.401C46.816 246.974 45.8 243.601 46.6 240.801C47.4 238.001 47.6 233.801 52.6 230.801"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M33 237.601C33 237.601 29 226.801 26.2 239.601C23.4 252.401 20.2 256.001 18.6 258.801C18.6 258.801 18.6 264.001 27 263.601C27 263.601 37.8 263.201 38.2 260.401C38.6 257.601 37 246.001 33 237.601z"}
+ ,
+ {"stroke":"#a5264c", "width":2,
+ "path":"M47 244.801C47 244.801 50.6 242.401 53 243.601"}
+ ,
+ {"stroke":"#a5264c", "width":2,
+ "path":"M53.5 228.401C53.5 228.401 56.4 223.501 61.2 222.701"}
+ ,
+ {"fill": "#b2b2b2",
+ "path":"M-25.8 265.201C-25.8 265.201 -7.8 268.401 -3.4 266.801C-3.4 266.801 5.4 266.801 -3 268.801C-3 268.801 -15.8 268.801 -23.8 267.601C-23.8 267.601 -35.4 262.001 -25.8 265.201z"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M-11.8 172.001C-11.8 172.001 5.8 172.001 7.8 172.801C7.8 172.801 15 203.601 11.4 211.201C11.4 211.201 10.2 214.001 7.4 208.401C7.4 208.401 -11 175.601 -14.2 173.601C-17.4 171.601 -13 172.001 -11.8 172.001z"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M-88.9 169.301C-88.9 169.301 -80 171.001 -67.4 173.601C-67.4 173.601 -62.6 196.001 -59.4 200.801C-56.2 205.601 -59.8 205.601 -63.4 202.801C-67 200.001 -81.8 186.001 -83.8 181.601C-85.8 177.201 -88.9 169.301 -88.9 169.301z"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M-67.039 173.818C-67.039 173.818 -61.239 175.366 -60.23 177.581C-59.222 179.795 -61.432 183.092 -61.432 183.092C-61.432 183.092 -62.432 186.397 -63.634 184.235C-64.836 182.072 -67.708 174.412 -67.039 173.818z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-67 173.601C-67 173.601 -63.4 178.801 -59.8 178.801C-56.2 178.801 -55.818 178.388 -53 179.001C-48.4 180.001 -48.8 178.001 -42.2 179.201C-39.56 179.681 -37 178.801 -34.2 180.001C-31.4 181.201 -28.2 180.401 -27 178.401C-25.8 176.401 -21 172.201 -21 172.201C-21 172.201 -33.8 174.001 -36.6 174.801C-36.6 174.801 -59 176.001 -67 173.601z"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M-22.4 173.801C-22.4 173.801 -28.85 177.301 -29.25 179.701C-29.65 182.101 -24 185.801 -24 185.801C-24 185.801 -21.25 190.401 -20.65 188.001C-20.05 185.601 -21.6 174.201 -22.4 173.801z"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M-59.885 179.265C-59.885 179.265 -52.878 190.453 -52.661 179.242C-52.661 179.242 -52.104 177.984 -53.864 177.962C-59.939 177.886 -58.418 173.784 -59.885 179.265z"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M-52.707 179.514C-52.707 179.514 -44.786 190.701 -45.422 179.421C-45.422 179.421 -45.415 179.089 -47.168 178.936C-51.915 178.522 -51.57 174.004 -52.707 179.514z"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M-45.494 179.522C-45.494 179.522 -37.534 190.15 -38.203 180.484C-38.203 180.484 -38.084 179.251 -39.738 178.95C-43.63 178.244 -43.841 174.995 -45.494 179.522z"}
+ ,
+ {"fill": "#ffffcc", "stroke":"#000000", "width":0.5,
+ "path":"M-38.618 179.602C-38.618 179.602 -30.718 191.163 -30.37 181.382C-30.37 181.382 -28.726 180.004 -30.472 179.782C-36.29 179.042 -35.492 174.588 -38.618 179.602z"}
+ ,
+ {"fill": "#e5e5b2",
+ "path":"M-74.792 183.132L-82.45 181.601C-85.05 176.601 -87.15 170.451 -87.15 170.451C-87.15 170.451 -80.8 171.451 -68.3 174.251C-68.3 174.251 -67.424 177.569 -65.952 183.364L-74.792 183.132z"}
+ ,
+ {"fill": "#e5e5b2",
+ "path":"M-9.724 178.47C-11.39 175.964 -12.707 174.206 -13.357 173.8C-16.37 171.917 -12.227 172.294 -11.098 172.294C-11.098 172.294 5.473 172.294 7.356 173.047C7.356 173.047 7.88 175.289 8.564 178.68C8.564 178.68 -1.524 176.67 -9.724 178.47z"}
+ ,
+ {"fill": "#cc7226",
+ "path":"M43.88 40.321C71.601 44.281 97.121 8.641 98.881 -1.04C100.641 -10.72 90.521 -22.6 90.521 -22.6C91.841 -25.68 87.001 -39.76 81.721 -49C76.441 -58.24 60.54 -57.266 43 -58.24C27.16 -59.12 8.68 -35.8 7.36 -34.04C6.04 -32.28 12.2 6.001 13.52 11.721C14.84 17.441 12.2 43.841 12.2 43.841C46.44 34.741 16.16 36.361 43.88 40.321z"}
+ ,
+ {"fill": "#ea8e51",
+ "path":"M8.088 -33.392C6.792 -31.664 12.84 5.921 14.136 11.537C15.432 17.153 12.84 43.073 12.84 43.073C45.512 34.193 16.728 35.729 43.944 39.617C71.161 43.505 96.217 8.513 97.945 -0.992C99.673 -10.496 89.737 -22.16 89.737 -22.16C91.033 -25.184 86.281 -39.008 81.097 -48.08C75.913 -57.152 60.302 -56.195 43.08 -57.152C27.528 -58.016 9.384 -35.12 8.088 -33.392z"}
+ ,
+ {"fill": "#efaa7c",
+ "path":"M8.816 -32.744C7.544 -31.048 13.48 5.841 14.752 11.353C16.024 16.865 13.48 42.305 13.48 42.305C44.884 33.145 17.296 35.097 44.008 38.913C70.721 42.729 95.313 8.385 97.009 -0.944C98.705 -10.272 88.953 -21.72 88.953 -21.72C90.225 -24.688 85.561 -38.256 80.473 -47.16C75.385 -56.064 60.063 -55.125 43.16 -56.064C27.896 -56.912 10.088 -34.44 8.816 -32.744z"}
+ ,
+ {"fill": "#f4c6a8",
+ "path":"M9.544 -32.096C8.296 -30.432 14.12 5.761 15.368 11.169C16.616 16.577 14.12 41.537 14.12 41.537C43.556 32.497 17.864 34.465 44.072 38.209C70.281 41.953 94.409 8.257 96.073 -0.895C97.737 -10.048 88.169 -21.28 88.169 -21.28C89.417 -24.192 84.841 -37.504 79.849 -46.24C74.857 -54.976 59.824 -54.055 43.24 -54.976C28.264 -55.808 10.792 -33.76 9.544 -32.096z"}
+ ,
+ {"fill": "#f9e2d3",
+ "path":"M10.272 -31.448C9.048 -29.816 14.76 5.681 15.984 10.985C17.208 16.289 14.76 40.769 14.76 40.769C42.628 31.849 18.432 33.833 44.136 37.505C69.841 41.177 93.505 8.129 95.137 -0.848C96.769 -9.824 87.385 -20.84 87.385 -20.84C88.609 -23.696 84.121 -36.752 79.225 -45.32C74.329 -53.888 59.585 -52.985 43.32 -53.888C28.632 -54.704 11.496 -33.08 10.272 -31.448z"}
+ ,
+ {"fill": "#ffffff",
+ "path":"M44.2 36.8C69.4 40.4 92.601 8 94.201 -0.8C95.801 -9.6 86.601 -20.4 86.601 -20.4C87.801 -23.2 83.4 -36 78.6 -44.4C73.8 -52.8 59.346 -51.914 43.4 -52.8C29 -53.6 12.2 -32.4 11 -30.8C9.8 -29.2 15.4 5.6 16.6 10.8C17.8 16 15.4 40 15.4 40C40.9 31.4 19 33.2 44.2 36.8z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M90.601 2.8C90.601 2.8 62.8 10.4 51.2 8.8C51.2 8.8 35.4 2.2 26.6 24C26.6 24 23 31.2 21 33.2C19 35.2 90.601 2.8 90.601 2.8z"}
+ ,
+ {"fill": "#000000",
+ "path":"M94.401 0.6C94.401 0.6 65.4 12.8 55.4 12.4C55.4 12.4 39 7.8 30.6 22.4C30.6 22.4 22.2 31.6 19 33.2C19 33.2 18.6 34.8 25 30.8L35.4 36C35.4 36 50.2 45.6 59.8 29.6C59.8 29.6 63.8 18.4 63.8 16.4C63.8 14.4 85 8.8 86.601 8.4C88.201 8 94.801 3.8 94.401 0.6z"}
+ ,
+ {"fill": "#99cc32",
+ "path":"M47 36.514C40.128 36.514 31.755 32.649 31.755 26.4C31.755 20.152 40.128 13.887 47 13.887C53.874 13.887 59.446 18.952 59.446 25.2C59.446 31.449 53.874 36.514 47 36.514z"}
+ ,
+ {"fill": "#659900",
+ "path":"M43.377 19.83C38.531 20.552 33.442 22.055 33.514 21.839C35.054 17.22 41.415 13.887 47 13.887C51.296 13.887 55.084 15.865 57.32 18.875C57.32 18.875 52.004 18.545 43.377 19.83z"}
+ ,
+ {"fill": "#ffffff",
+ "path":"M55.4 19.6C55.4 19.6 51 16.4 51 18.6C51 18.6 54.6 23 55.4 19.6z"}
+ ,
+ {"fill": "#000000",
+ "path":"M45.4 27.726C42.901 27.726 40.875 25.7 40.875 23.2C40.875 20.701 42.901 18.675 45.4 18.675C47.9 18.675 49.926 20.701 49.926 23.2C49.926 25.7 47.9 27.726 45.4 27.726z"}
+ ,
+ {"fill": "#cc7226",
+ "path":"M-58.6 14.4C-58.6 14.4 -61.8 -6.8 -59.4 -11.2C-59.4 -11.2 -48.6 -21.2 -49 -24.8C-49 -24.8 -49.4 -42.8 -50.6 -43.6C-51.8 -44.4 -59.4 -50.4 -65.4 -44C-65.4 -44 -75.8 -26 -75 -19.6L-75 -17.6C-75 -17.6 -82.6 -18 -84.2 -16C-84.2 -16 -85.4 -10.8 -86.6 -10.4C-86.6 -10.4 -89.4 -8 -87.4 -5.2C-87.4 -5.2 -89.4 -2.8 -89 1.2L-81.4 5.2C-81.4 5.2 -79.4 19.6 -68.6 24.8C-63.764 27.129 -60.6 20.4 -58.6 14.4z"}
+ ,
+ {"fill": "#ffffff",
+ "path":"M-59.6 12.56C-59.6 12.56 -62.48 -6.52 -60.32 -10.48C-60.32 -10.48 -50.6 -19.48 -50.96 -22.72C-50.96 -22.72 -51.32 -38.92 -52.4 -39.64C-53.48 -40.36 -60.32 -45.76 -65.72 -40C-65.72 -40 -75.08 -23.8 -74.36 -18.04L-74.36 -16.24C-74.36 -16.24 -81.2 -16.6 -82.64 -14.8C-82.64 -14.8 -83.72 -10.12 -84.8 -9.76C-84.8 -9.76 -87.32 -7.6 -85.52 -5.08C-85.52 -5.08 -87.32 -2.92 -86.96 0.68L-80.12 4.28C-80.12 4.28 -78.32 17.24 -68.6 21.92C-64.248 24.015 -61.4 17.96 -59.6 12.56z"}
+ ,
+ {"fill": "#eb955c",
+ "path":"M-51.05 -42.61C-52.14 -43.47 -59.63 -49.24 -65.48 -43C-65.48 -43 -75.62 -25.45 -74.84 -19.21L-74.84 -17.26C-74.84 -17.26 -82.25 -17.65 -83.81 -15.7C-83.81 -15.7 -84.98 -10.63 -86.15 -10.24C-86.15 -10.24 -88.88 -7.9 -86.93 -5.17C-86.93 -5.17 -88.88 -2.83 -88.49 1.07L-81.08 4.97C-81.08 4.97 -79.13 19.01 -68.6 24.08C-63.886 26.35 -60.8 19.79 -58.85 13.94C-58.85 13.94 -61.97 -6.73 -59.63 -11.02C-59.63 -11.02 -49.1 -20.77 -49.49 -24.28C-49.49 -24.28 -49.88 -41.83 -51.05 -42.61z"}
+ ,
+ {"fill": "#f2b892",
+ "path":"M-51.5 -41.62C-52.48 -42.54 -59.86 -48.08 -65.56 -42C-65.56 -42 -75.44 -24.9 -74.68 -18.82L-74.68 -16.92C-74.68 -16.92 -81.9 -17.3 -83.42 -15.4C-83.42 -15.4 -84.56 -10.46 -85.7 -10.08C-85.7 -10.08 -88.36 -7.8 -86.46 -5.14C-86.46 -5.14 -88.36 -2.86 -87.98 0.94L-80.76 4.74C-80.76 4.74 -78.86 18.42 -68.6 23.36C-64.006 25.572 -61 19.18 -59.1 13.48C-59.1 13.48 -62.14 -6.66 -59.86 -10.84C-59.86 -10.84 -49.6 -20.34 -49.98 -23.76C-49.98 -23.76 -50.36 -40.86 -51.5 -41.62z"}
+ ,
+ {"fill": "#f8dcc8",
+ "path":"M-51.95 -40.63C-52.82 -41.61 -60.09 -46.92 -65.64 -41C-65.64 -41 -75.26 -24.35 -74.52 -18.43L-74.52 -16.58C-74.52 -16.58 -81.55 -16.95 -83.03 -15.1C-83.03 -15.1 -84.14 -10.29 -85.25 -9.92C-85.25 -9.92 -87.84 -7.7 -85.99 -5.11C-85.99 -5.11 -87.84 -2.89 -87.47 0.81L-80.44 4.51C-80.44 4.51 -78.59 17.83 -68.6 22.64C-64.127 24.794 -61.2 18.57 -59.35 13.02C-59.35 13.02 -62.31 -6.59 -60.09 -10.66C-60.09 -10.66 -50.1 -19.91 -50.47 -23.24C-50.47 -23.24 -50.84 -39.89 -51.95 -40.63z"}
+ ,
+ {"fill": "#ffffff",
+ "path":"M-59.6 12.46C-59.6 12.46 -62.48 -6.52 -60.32 -10.48C-60.32 -10.48 -50.6 -19.48 -50.96 -22.72C-50.96 -22.72 -51.32 -38.92 -52.4 -39.64C-53.16 -40.68 -60.32 -45.76 -65.72 -40C-65.72 -40 -75.08 -23.8 -74.36 -18.04L-74.36 -16.24C-74.36 -16.24 -81.2 -16.6 -82.64 -14.8C-82.64 -14.8 -83.72 -10.12 -84.8 -9.76C-84.8 -9.76 -87.32 -7.6 -85.52 -5.08C-85.52 -5.08 -87.32 -2.92 -86.96 0.68L-80.12 4.28C-80.12 4.28 -78.32 17.24 -68.6 21.92C-64.248 24.015 -61.4 17.86 -59.6 12.46z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-62.7 6.2C-62.7 6.2 -84.3 -4 -85.2 -4.8C-85.2 -4.8 -76.1 3.4 -75.3 3.4C-74.5 3.4 -62.7 6.2 -62.7 6.2z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-79.8 0C-79.8 0 -61.4 3.6 -61.4 8C-61.4 10.912 -61.643 24.331 -67 22.8C-75.4 20.4 -71.8 6 -79.8 0z"}
+ ,
+ {"fill": "#99cc32",
+ "path":"M-71.4 3.8C-71.4 3.8 -62.422 5.274 -61.4 8C-60.8 9.6 -60.137 17.908 -65.6 19C-70.152 19.911 -72.382 9.69 -71.4 3.8z"}
+ ,
+ {"fill": "#000000",
+ "path":"M14.595 46.349C14.098 44.607 15.409 44.738 17.2 44.2C19.2 43.6 31.4 39.8 32.2 37.2C33 34.6 46.2 39 46.2 39C48 39.8 52.4 42.4 52.4 42.4C57.2 43.6 63.8 44 63.8 44C66.2 45 69.6 47.8 69.6 47.8C84.2 58 96.601 50.8 96.601 50.8C116.601 44.2 110.601 27 110.601 27C107.601 18 110.801 14.6 110.801 14.6C111.001 10.8 118.201 17.2 118.201 17.2C120.801 21.4 121.601 26.4 121.601 26.4C129.601 37.6 126.201 19.8 126.201 19.8C126.401 18.8 123.601 15.2 123.601 14C123.601 12.8 121.801 9.4 121.801 9.4C118.801 6 121.201 -1 121.201 -1C123.001 -14.8 120.801 -13 120.801 -13C119.601 -14.8 110.401 -4.8 110.401 -4.8C108.201 -1.4 102.201 0.2 102.201 0.2C99.401 2 96.001 0.6 96.001 0.6C93.401 0.2 87.801 7.2 87.801 7.2C90.601 7 93.001 11.4 95.401 11.6C97.801 11.8 99.601 9.2 101.201 8.6C102.801 8 105.601 13.8 105.601 13.8C106.001 16.4 100.401 21.2 100.401 21.2C100.001 25.8 98.401 24.2 98.401 24.2C95.401 23.6 94.201 27.4 93.201 32C92.201 36.6 88.001 37 88.001 37C86.401 44.4 85.2 41.4 85.2 41.4C85 35.8 79 41.6 79 41.6C77.8 43.6 73.2 41.4 73.2 41.4C66.4 39.4 68.8 37.4 68.8 37.4C70.6 35.2 81.8 37.4 81.8 37.4C84 35.8 76 31.8 76 31.8C75.4 30 76.4 25.6 76.4 25.6C77.6 22.4 84.4 16.8 84.4 16.8C93.801 15.6 91.001 14 91.001 14C84.801 8.8 79 16.4 79 16.4C76.8 22.6 59.4 37.6 59.4 37.6C54.6 41 57.2 34.2 53.2 37.6C49.2 41 28.6 32 28.6 32C17.038 30.807 14.306 46.549 10.777 43.429C10.777 43.429 16.195 51.949 14.595 46.349z"}
+ ,
+ {"fill": "#000000",
+ "path":"M209.401 -120C209.401 -120 183.801 -112 181.001 -93.2C181.001 -93.2 178.601 -70.4 199.001 -52.8C199.001 -52.8 199.401 -46.4 201.401 -43.2C201.401 -43.2 199.801 -38.4 218.601 -46L245.801 -54.4C245.801 -54.4 252.201 -56.8 257.401 -65.6C262.601 -74.4 277.801 -93.2 274.201 -118.4C274.201 -118.4 275.401 -129.6 269.401 -130C269.401 -130 261.001 -131.6 253.801 -124C253.801 -124 247.001 -120.8 244.601 -121.2L209.401 -120z"}
+ ,
+ {"fill": "#000000",
+ "path":"M264.022 -120.99C264.022 -120.99 266.122 -129.92 261.282 -125.08C261.282 -125.08 254.242 -119.36 246.761 -119.36C246.761 -119.36 232.241 -117.16 227.841 -103.96C227.841 -103.96 223.881 -77.12 231.801 -71.4C231.801 -71.4 236.641 -63.92 243.681 -70.52C250.722 -77.12 266.222 -107.35 264.022 -120.99z"}
+ ,
+ {"fill": "#323232",
+ "path":"M263.648 -120.632C263.648 -120.632 265.738 -129.376 260.986 -124.624C260.986 -124.624 254.074 -119.008 246.729 -119.008C246.729 -119.008 232.473 -116.848 228.153 -103.888C228.153 -103.888 224.265 -77.536 232.041 -71.92C232.041 -71.92 236.793 -64.576 243.705 -71.056C250.618 -77.536 265.808 -107.24 263.648 -120.632z"}
+ ,
+ {"fill": "#666666",
+ "path":"M263.274 -120.274C263.274 -120.274 265.354 -128.832 260.69 -124.168C260.69 -124.168 253.906 -118.656 246.697 -118.656C246.697 -118.656 232.705 -116.536 228.465 -103.816C228.465 -103.816 224.649 -77.952 232.281 -72.44C232.281 -72.44 236.945 -65.232 243.729 -71.592C250.514 -77.952 265.394 -107.13 263.274 -120.274z"}
+ ,
+ {"fill": "#999999",
+ "path":"M262.9 -119.916C262.9 -119.916 264.97 -128.288 260.394 -123.712C260.394 -123.712 253.738 -118.304 246.665 -118.304C246.665 -118.304 232.937 -116.224 228.777 -103.744C228.777 -103.744 225.033 -78.368 232.521 -72.96C232.521 -72.96 237.097 -65.888 243.753 -72.128C250.41 -78.368 264.98 -107.02 262.9 -119.916z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M262.526 -119.558C262.526 -119.558 264.586 -127.744 260.098 -123.256C260.098 -123.256 253.569 -117.952 246.633 -117.952C246.633 -117.952 233.169 -115.912 229.089 -103.672C229.089 -103.672 225.417 -78.784 232.761 -73.48C232.761 -73.48 237.249 -66.544 243.777 -72.664C250.305 -78.784 264.566 -106.91 262.526 -119.558z"}
+ ,
+ {"fill": "#ffffff",
+ "path":"M262.151 -119.2C262.151 -119.2 264.201 -127.2 259.801 -122.8C259.801 -122.8 253.401 -117.6 246.601 -117.6C246.601 -117.6 233.401 -115.6 229.401 -103.6C229.401 -103.6 225.801 -79.2 233.001 -74C233.001 -74 237.401 -67.2 243.801 -73.2C250.201 -79.2 264.151 -106.8 262.151 -119.2z"}
+ ,
+ {"fill": "#992600",
+ "path":"M50.6 84C50.6 84 30.2 64.8 22.2 64C22.2 64 -12.2 60 -27 78C-27 78 -9.4 57.6 18.2 63.2C18.2 63.2 -3.4 58.8 -15.8 62C-15.8 62 -32.6 62 -42.2 76L-45 80.8C-45 80.8 -41 66 -22.6 60C-22.6 60 0.2 55.2 11 60C11 60 -10.6 53.2 -20.6 55.2C-20.6 55.2 -51 52.8 -63.8 79.2C-63.8 79.2 -59.8 64.8 -45 57.6C-45 57.6 -31.4 48.8 -11 51.6C-11 51.6 3.4 54.8 8.6 57.2C13.8 59.6 12.6 56.8 4.2 52C4.2 52 -1.4 42 -15.4 42.4C-15.4 42.4 -58.2 46 -68.6 58C-68.6 58 -55 46.8 -44.6 44C-44.6 44 -22.2 36 -13.8 36.8C-13.8 36.8 11 37.8 18.6 33.8C18.6 33.8 7.4 38.8 10.6 42C13.8 45.2 20.6 52.8 20.6 54C20.6 55.2 44.8 77.3 48.4 81.7L50.6 84z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M189 278C189 278 173.5 241.5 161 232C161 232 187 248 190.5 266C190.5 266 190.5 276 189 278z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M236 285.5C236 285.5 209.5 230.5 191 206.5C191 206.5 234.5 244 239.5 270.5L240 276L237 273.5C237 273.5 236.5 282.5 236 285.5z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M292.5 237C292.5 237 230 177.5 228.5 175C228.5 175 289 241 292 248.5C292 248.5 290 239.5 292.5 237z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M104 280.5C104 280.5 123.5 228.5 142.5 251C142.5 251 157.5 261 157 264C157 264 153 257.5 135 258C135 258 116 255 104 280.5z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M294.5 153C294.5 153 249.5 124.5 242 123C230.193 120.639 291.5 152 296.5 162.5C296.5 162.5 298.5 160 294.5 153z"}
+ ,
+ {"fill": "#000000",
+ "path":"M143.801 259.601C143.801 259.601 164.201 257.601 171.001 250.801L175.401 254.401L193.001 216.001L196.601 221.201C196.601 221.201 211.001 206.401 210.201 198.401C209.401 190.401 223.001 204.401 223.001 204.401C223.001 204.401 222.201 192.801 229.401 199.601C229.401 199.601 227.001 184.001 235.401 192.001C235.401 192.001 224.864 161.844 247.401 187.601C253.001 194.001 248.601 187.201 248.601 187.201C248.601 187.201 222.601 139.201 244.201 153.601C244.201 153.601 246.201 130.801 245.001 126.401C243.801 122.001 241.801 99.6 237.001 94.4C232.201 89.2 237.401 87.6 243.001 92.8C243.001 92.8 231.801 68.8 245.001 80.8C245.001 80.8 241.401 65.6 237.001 62.8C237.001 62.8 231.401 45.6 246.601 56.4C246.601 56.4 242.201 44 239.001 40.8C239.001 40.8 227.401 13.2 234.601 18L239.001 21.6C239.001 21.6 232.201 7.6 238.601 12C245.001 16.4 245.001 16 245.001 16C245.001 16 223.801 -17.2 244.201 0.4C244.201 0.4 236.042 -13.518 232.601 -20.4C232.601 -20.4 213.801 -40.8 228.201 -34.4L233.001 -32.8C233.001 -32.8 224.201 -42.8 216.201 -44.4C208.201 -46 218.601 -52.4 225.001 -50.4C231.401 -48.4 247.001 -40.8 247.001 -40.8C247.001 -40.8 259.801 -22 263.801 -21.6C263.801 -21.6 243.801 -29.2 249.801 -21.2C249.801 -21.2 264.201 -7.2 257.001 -7.6C257.001 -7.6 251.001 -0.4 255.801 8.4C255.801 8.4 237.342 -9.991 252.201 15.6L259.001 32C259.001 32 234.601 7.2 245.801 29.2C245.801 29.2 263.001 52.8 265.001 53.2C267.001 53.6 271.401 62.4 271.401 62.4L267.001 60.4L272.201 69.2C272.201 69.2 261.001 57.2 267.001 70.4L272.601 84.8C272.601 84.8 252.201 62.8 265.801 92.4C265.801 92.4 249.401 87.2 258.201 104.4C258.201 104.4 256.601 120.401 257.001 125.601C257.401 130.801 258.601 159.201 254.201 167.201C249.801 175.201 260.201 194.401 262.201 198.401C264.201 202.401 267.801 213.201 259.001 204.001C250.201 194.801 254.601 200.401 256.601 209.201C258.601 218.001 264.601 233.601 263.801 239.201C263.801 239.201 262.601 240.401 259.401 236.801C259.401 236.801 244.601 214.001 246.201 228.401C246.201 228.401 245.001 236.401 241.801 245.201C241.801 245.201 238.601 256.001 238.601 247.201C238.601 247.201 235.401 230.401 232.601 238.001C229.801 245.601 226.201 251.601 223.401 254.001C220.601 256.401 215.401 233.601 214.201 244.001C214.201 244.001 202.201 231.601 197.401 248.001L185.801 264.401C185.801 264.401 185.401 252.001 184.201 258.001C184.201 258.001 154.201 264.001 143.801 259.601z"}
+ ,
+ {"fill": "#000000",
+ "path":"M109.401 -97.2C109.401 -97.2 97.801 -105.2 93.801 -104.8C89.801 -104.4 121.401 -113.6 162.601 -86C162.601 -86 167.401 -83.2 171.001 -83.6C171.001 -83.6 174.201 -81.2 171.401 -77.6C171.401 -77.6 162.601 -68 173.801 -56.8C173.801 -56.8 192.201 -50 186.601 -58.8C186.601 -58.8 197.401 -54.8 199.801 -50.8C202.201 -46.8 201.001 -50.8 201.001 -50.8C201.001 -50.8 194.601 -58 188.601 -63.2C188.601 -63.2 183.401 -65.2 180.601 -73.6C177.801 -82 175.401 -92 179.801 -95.2C179.801 -95.2 175.801 -90.8 176.601 -94.8C177.401 -98.8 181.001 -102.4 182.601 -102.8C184.201 -103.2 200.601 -119 207.401 -119.4C207.401 -119.4 198.201 -118 195.201 -119C192.201 -120 165.601 -131.4 159.601 -132.6C159.601 -132.6 142.801 -139.2 154.801 -137.2C154.801 -137.2 190.601 -133.4 208.801 -120.2C208.801 -120.2 201.601 -128.6 183.201 -135.6C183.201 -135.6 161.001 -148.2 125.801 -143.2C125.801 -143.2 108.001 -140 100.201 -138.2C100.201 -138.2 97.601 -138.8 97.001 -139.2C96.401 -139.6 84.6 -148.6 57 -141.6C57 -141.6 40 -137 31.4 -132.2C31.4 -132.2 16.2 -131 12.6 -127.8C12.6 -127.8 -6 -113.2 -8 -112.4C-10 -111.6 -21.4 -104 -22.2 -103.6C-22.2 -103.6 2.4 -110.2 4.8 -112.6C7.2 -115 24.6 -117.6 27 -116.2C29.4 -114.8 37.8 -115.4 28.2 -114.8C28.2 -114.8 103.801 -100 104.601 -98C105.401 -96 109.401 -97.2 109.401 -97.2z"}
+ ,
+ {"fill": "#cc7226",
+ "path":"M180.801 -106.4C180.801 -106.4 170.601 -113.8 168.601 -113.8C166.601 -113.8 154.201 -124 150.001 -123.6C145.801 -123.2 133.601 -133.2 106.201 -125C106.201 -125 105.601 -127 109.201 -127.8C109.201 -127.8 115.601 -130 116.001 -130.6C116.001 -130.6 136.201 -134.8 143.401 -131.2C143.401 -131.2 152.601 -128.6 158.801 -122.4C158.801 -122.4 170.001 -119.2 173.201 -120.2C173.201 -120.2 182.001 -118 182.401 -116.2C182.401 -116.2 188.201 -113.2 186.401 -110.6C186.401 -110.6 186.801 -109 180.801 -106.4z"}
+ ,
+ {"fill": "#cc7226",
+ "path":"M168.33 -108.509C169.137 -107.877 170.156 -107.779 170.761 -106.97C170.995 -106.656 170.706 -106.33 170.391 -106.233C169.348 -105.916 168.292 -106.486 167.15 -105.898C166.748 -105.691 166.106 -105.873 165.553 -106.022C163.921 -106.463 162.092 -106.488 160.401 -105.8C158.416 -106.929 156.056 -106.345 153.975 -107.346C153.917 -107.373 153.695 -107.027 153.621 -107.054C150.575 -108.199 146.832 -107.916 144.401 -110.2C141.973 -110.612 139.616 -111.074 137.188 -111.754C135.37 -112.263 133.961 -113.252 132.341 -114.084C130.964 -114.792 129.507 -115.314 127.973 -115.686C126.11 -116.138 124.279 -116.026 122.386 -116.546C122.293 -116.571 122.101 -116.227 122.019 -116.254C121.695 -116.362 121.405 -116.945 121.234 -116.892C119.553 -116.37 118.065 -117.342 116.401 -117C115.223 -118.224 113.495 -117.979 111.949 -118.421C108.985 -119.269 105.831 -117.999 102.801 -119C106.914 -120.842 111.601 -119.61 115.663 -121.679C117.991 -122.865 120.653 -121.763 123.223 -122.523C123.71 -122.667 124.401 -122.869 124.801 -122.2C124.935 -122.335 125.117 -122.574 125.175 -122.546C127.625 -121.389 129.94 -120.115 132.422 -119.049C132.763 -118.903 133.295 -119.135 133.547 -118.933C135.067 -117.717 137.01 -117.82 138.401 -116.6C140.099 -117.102 141.892 -116.722 143.621 -117.346C143.698 -117.373 143.932 -117.032 143.965 -117.054C145.095 -117.802 146.25 -117.531 147.142 -117.227C147.48 -117.112 148.143 -116.865 148.448 -116.791C149.574 -116.515 150.43 -116.035 151.609 -115.852C151.723 -115.834 151.908 -116.174 151.98 -116.146C153.103 -115.708 154.145 -115.764 154.801 -114.6C154.936 -114.735 155.101 -114.973 155.183 -114.946C156.21 -114.608 156.859 -113.853 157.96 -113.612C158.445 -113.506 159.057 -112.88 159.633 -112.704C162.025 -111.973 163.868 -110.444 166.062 -109.549C166.821 -109.239 167.697 -109.005 168.33 -108.509z"}
+ ,
+ {"fill": "#cc7226",
+ "path":"M91.696 -122.739C89.178 -124.464 86.81 -125.57 84.368 -127.356C84.187 -127.489 83.827 -127.319 83.625 -127.441C82.618 -128.05 81.73 -128.631 80.748 -129.327C80.209 -129.709 79.388 -129.698 78.88 -129.956C76.336 -131.248 73.707 -131.806 71.2 -133C71.882 -133.638 73.004 -133.394 73.6 -134.2C73.795 -133.92 74.033 -133.636 74.386 -133.827C76.064 -134.731 77.914 -134.884 79.59 -134.794C81.294 -134.702 83.014 -134.397 84.789 -134.125C85.096 -134.078 85.295 -133.555 85.618 -133.458C87.846 -132.795 90.235 -133.32 92.354 -132.482C93.945 -131.853 95.515 -131.03 96.754 -129.755C97.006 -129.495 96.681 -129.194 96.401 -129C96.789 -129.109 97.062 -128.903 97.173 -128.59C97.257 -128.351 97.257 -128.049 97.173 -127.81C97.061 -127.498 96.782 -127.397 96.408 -127.346C95.001 -127.156 96.773 -128.536 96.073 -128.088C94.8 -127.274 95.546 -125.868 94.801 -124.6C94.521 -124.794 94.291 -125.012 94.401 -125.4C94.635 -124.878 94.033 -124.588 93.865 -124.272C93.48 -123.547 92.581 -122.132 91.696 -122.739z"}
+ ,
+ {"fill": "#cc7226",
+ "path":"M59.198 -115.391C56.044 -116.185 52.994 -116.07 49.978 -117.346C49.911 -117.374 49.688 -117.027 49.624 -117.054C48.258 -117.648 47.34 -118.614 46.264 -119.66C45.351 -120.548 43.693 -120.161 42.419 -120.648C42.095 -120.772 41.892 -121.284 41.591 -121.323C40.372 -121.48 39.445 -122.429 38.4 -123C40.736 -123.795 43.147 -123.764 45.609 -124.148C45.722 -124.166 45.867 -123.845 46 -123.845C46.136 -123.845 46.266 -124.066 46.4 -124.2C46.595 -123.92 46.897 -123.594 47.154 -123.848C47.702 -124.388 48.258 -124.198 48.798 -124.158C48.942 -124.148 49.067 -123.845 49.2 -123.845C49.336 -123.845 49.467 -124.156 49.6 -124.156C49.736 -124.155 49.867 -123.845 50 -123.845C50.136 -123.845 50.266 -124.066 50.4 -124.2C51.092 -123.418 51.977 -123.972 52.799 -123.793C53.837 -123.566 54.104 -122.418 55.178 -122.12C59.893 -120.816 64.03 -118.671 68.393 -116.584C68.7 -116.437 68.91 -116.189 68.8 -115.8C69.067 -115.8 69.38 -115.888 69.57 -115.756C70.628 -115.024 71.669 -114.476 72.366 -113.378C72.582 -113.039 72.253 -112.632 72.02 -112.684C67.591 -113.679 63.585 -114.287 59.198 -115.391z"}
+ ,
+ {"fill": "#cc7226",
+ "path":"M45.338 -71.179C43.746 -72.398 43.162 -74.429 42.034 -76.221C41.82 -76.561 42.094 -76.875 42.411 -76.964C42.971 -77.123 43.514 -76.645 43.923 -76.443C45.668 -75.581 47.203 -74.339 49.2 -74.2C51.19 -71.966 55.45 -71.581 55.457 -68.2C55.458 -67.341 54.03 -68.259 53.6 -67.4C51.149 -68.403 48.76 -68.3 46.38 -69.767C45.763 -70.148 46.093 -70.601 45.338 -71.179z"}
+ ,
+ {"fill": "#cc7226",
+ "path":"M17.8 -123.756C17.935 -123.755 24.966 -123.522 24.949 -123.408C24.904 -123.099 17.174 -122.05 16.81 -122.22C16.646 -122.296 9.134 -119.866 9 -120C9.268 -120.135 17.534 -123.756 17.8 -123.756z"}
+ ,
+ {"fill": "#000000",
+ "path":"M33.2 -114C33.2 -114 18.4 -112.2 14 -111C9.6 -109.8 -9 -102.2 -12 -100.2C-12 -100.2 -25.4 -94.8 -42.4 -74.8C-42.4 -74.8 -34.8 -78.2 -32.6 -81C-32.6 -81 -19 -93.6 -19.2 -91C-19.2 -91 -7 -99.6 -7.6 -97.4C-7.6 -97.4 16.8 -108.6 14.8 -105.4C14.8 -105.4 36.4 -110 35.4 -108C35.4 -108 54.2 -103.6 51.4 -103.4C51.4 -103.4 45.6 -102.2 52 -98.6C52 -98.6 48.6 -94.2 43.2 -98.2C37.8 -102.2 40.8 -100 35.8 -99C35.8 -99 33.2 -98.2 28.6 -102.2C28.6 -102.2 23 -106.8 14.2 -103.2C14.2 -103.2 -16.4 -90.6 -18.4 -90C-18.4 -90 -22 -87.2 -24.4 -83.6C-24.4 -83.6 -30.2 -79.2 -33.2 -77.8C-33.2 -77.8 -46 -66.2 -47.2 -64.8C-47.2 -64.8 -50.6 -59.6 -51.4 -59.2C-51.4 -59.2 -45 -63 -43 -65C-43 -65 -29 -75 -23.6 -75.8C-23.6 -75.8 -19.2 -78.8 -18.4 -80.2C-18.4 -80.2 -4 -89.4 0.2 -89.4C0.2 -89.4 9.4 -84.2 11.8 -91.2C11.8 -91.2 17.6 -93 23.2 -91.8C23.2 -91.8 26.4 -94.4 25.6 -96.6C25.6 -96.6 27.2 -98.4 28.2 -94.6C28.2 -94.6 31.6 -91 36.4 -93C36.4 -93 40.4 -93.2 38.4 -90.8C38.4 -90.8 34 -87 22.2 -86.8C22.2 -86.8 9.8 -86.2 -6.6 -78.6C-6.6 -78.6 -36.4 -68.2 -45.6 -57.8C-45.6 -57.8 -52 -49 -57.4 -47.8C-57.4 -47.8 -63.2 -47 -69.2 -39.6C-69.2 -39.6 -59.4 -45.4 -50.4 -45.4C-50.4 -45.4 -46.4 -47.8 -50.2 -44.2C-50.2 -44.2 -53.8 -36.6 -52.2 -31.2C-52.2 -31.2 -52.8 -26 -53.6 -24.4C-53.6 -24.4 -61.4 -11.6 -61.4 -9.2C-61.4 -6.8 -60.2 3 -59.8 3.6C-59.4 4.2 -60.8 2 -57 4.4C-53.2 6.8 -50.4 8.4 -49.6 11.2C-48.8 14 -51.6 5.8 -51.8 4C-52 2.2 -56.2 -5 -55.4 -7.4C-55.4 -7.4 -54.4 -6.4 -53.6 -5C-53.6 -5 -54.2 -5.6 -53.6 -9.2C-53.6 -9.2 -52.8 -14.4 -51.4 -17.6C-50 -20.8 -48 -24.6 -47.6 -25.4C-47.2 -26.2 -47.2 -32 -45.8 -29.4L-42.4 -26.8C-42.4 -26.8 -45.2 -29.4 -43 -31.6C-43 -31.6 -44 -37.2 -42.2 -39.8C-42.2 -39.8 -35.2 -48.2 -33.6 -49.2C-32 -50.2 -33.4 -49.8 -33.4 -49.8C-33.4 -49.8 -27.4 -54 -33.2 -52.4C-33.2 -52.4 -37.2 -50.8 -40.2 -50.8C-40.2 -50.8 -47.8 -48.8 -43.8 -53C-39.8 -57.2 -29.8 -62.6 -26 -62.4L-25.2 -60.8L-14 -63.2L-15.2 -62.4C-15.2 -62.4 -15.4 -62.6 -11.2 -63C-7 -63.4 -1.2 -62 0.2 -63.8C1.6 -65.6 5 -66.6 4.6 -65.2C4.2 -63.8 4 -61.8 4 -61.8C4 -61.8 9 -67.6 8.4 -65.4C7.8 -63.2 -0.4 -58 -1.8 -51.8L8.6 -60L12.2 -63C12.2 -63 15.8 -60.8 16 -62.4C16.2 -64 20.8 -69.8 22 -69.6C23.2 -69.4 25.2 -72.2 25 -69.6C24.8 -67 32.4 -61.6 32.4 -61.6C32.4 -61.6 35.6 -63.4 37 -62C38.4 -60.6 42.6 -81.8 42.6 -81.8L67.6 -92.4L111.201 -95.8L94.201 -102.6L33.2 -114z"}
+ ,
+ {"stroke":"#4c0000", "width":2,
+ "path":"M51.4 85C51.4 85 36.4 68.2 28 65.6C28 65.6 14.6 58.8 -10 66.6"}
+ ,
+ {"stroke":"#4c0000", "width":2,
+ "path":"M24.8 64.2C24.8 64.2 -0.4 56.2 -15.8 60.4C-15.8 60.4 -34.2 62.4 -42.6 76.2"}
+ ,
+ {"stroke":"#4c0000", "width":2,
+ "path":"M21.2 63C21.2 63 4.2 55.8 -10.6 53.6C-10.6 53.6 -27.2 51 -43.8 58.2C-43.8 58.2 -56 64.2 -61.4 74.4"}
+ ,
+ {"stroke":"#4c0000", "width":2,
+ "path":"M22.2 63.4C22.2 63.4 6.8 52.4 5.8 51C5.8 51 -1.2 40 -14.2 39.6C-14.2 39.6 -35.6 40.4 -52.8 48.4"}
+ ,
+ {"fill": "#000000",
+ "path":"M20.895 54.407C22.437 55.87 49.4 84.8 49.4 84.8C84.6 121.401 56.6 87.2 56.6 87.2C49 82.4 39.8 63.6 39.8 63.6C38.6 60.8 53.8 70.8 53.8 70.8C57.8 71.6 71.4 90.8 71.4 90.8C64.6 88.4 69.4 95.6 69.4 95.6C72.2 97.6 92.601 113.201 92.601 113.201C96.201 117.201 100.201 118.801 100.201 118.801C114.201 113.601 107.801 126.801 107.801 126.801C110.201 133.601 115.801 122.001 115.801 122.001C127.001 105.2 110.601 107.601 110.601 107.601C80.6 110.401 73.8 94.4 73.8 94.4C71.4 92 80.2 94.4 80.2 94.4C88.601 96.4 73 82 73 82C75.4 82 84.6 88.8 84.6 88.8C95.001 98 97.001 96 97.001 96C115.001 87.2 125.401 94.8 125.401 94.8C127.401 96.4 121.801 103.2 123.401 108.401C125.001 113.601 129.801 126.001 129.801 126.001C127.401 127.601 127.801 138.401 127.801 138.401C144.601 161.601 135.001 159.601 135.001 159.601C119.401 159.201 134.201 166.801 134.201 166.801C137.401 168.801 146.201 176.001 146.201 176.001C143.401 174.801 141.801 180.001 141.801 180.001C146.601 184.001 143.801 188.801 143.801 188.801C137.801 190.001 136.601 194.001 136.601 194.001C143.401 202.001 133.401 202.401 133.401 202.401C137.001 206.801 132.201 218.801 132.201 218.801C127.401 218.801 121.001 224.401 121.001 224.401C123.401 229.201 113.001 234.801 113.001 234.801C104.601 236.401 107.401 243.201 107.401 243.201C99.401 249.201 97.001 265.201 97.001 265.201C96.201 275.601 93.801 278.801 99.001 276.801C104.201 274.801 103.401 262.401 103.401 262.401C98.601 246.801 141.401 230.801 141.401 230.801C145.401 229.201 146.201 224.001 146.201 224.001C148.201 224.401 157.001 232.001 157.001 232.001C164.601 243.201 165.001 234.001 165.001 234.001C166.201 230.401 164.601 224.401 164.601 224.401C170.601 202.801 156.601 196.401 156.601 196.401C146.601 162.801 160.601 171.201 160.601 171.201C163.401 176.801 174.201 182.001 174.201 182.001L177.801 179.601C176.201 174.801 184.601 168.801 184.601 168.801C187.401 175.201 193.401 167.201 193.401 167.201C197.001 142.801 209.401 157.201 209.401 157.201C213.401 158.401 214.601 151.601 214.601 151.601C218.201 141.201 214.601 127.601 214.601 127.601C218.201 127.201 227.801 133.201 227.801 133.201C230.601 129.601 221.401 112.801 225.401 115.201C229.401 117.601 233.801 119.201 233.801 119.201C234.601 117.201 224.601 104.801 224.601 104.801C220.201 102 215.001 81.6 215.001 81.6C222.201 85.2 212.201 70 212.201 70C212.201 66.8 218.201 55.6 218.201 55.6C217.401 48.8 218.201 49.2 218.201 49.2C221.001 50.4 229.001 52 222.201 45.6C215.401 39.2 223.001 34.4 223.001 34.4C227.401 31.6 213.801 32 213.801 32C208.601 27.6 209.001 23.6 209.001 23.6C217.001 25.6 202.601 11.2 200.201 7.6C197.801 4 207.401 -1.2 207.401 -1.2C220.601 -4.8 209.001 -8 209.001 -8C189.401 -7.6 200.201 -18.4 200.201 -18.4C206.201 -18 204.601 -20.4 204.601 -20.4C199.401 -21.6 189.801 -28 189.801 -28C185.801 -31.6 189.401 -30.8 189.401 -30.8C206.201 -29.6 177.401 -40.8 177.401 -40.8C185.401 -40.8 167.401 -51.2 167.401 -51.2C165.401 -52.8 162.201 -60.4 162.201 -60.4C156.201 -65.6 151.401 -72.4 151.401 -72.4C151.001 -76.8 146.201 -81.6 146.201 -81.6C134.601 -95.2 129.001 -94.8 129.001 -94.8C114.201 -98.4 109.001 -97.6 109.001 -97.6L56.2 -93.2C29.8 -80.4 37.6 -59.4 37.6 -59.4C44 -51 53.2 -54.8 53.2 -54.8C57.8 -61 69.4 -58.8 69.4 -58.8C89.801 -55.6 87.201 -59.2 87.201 -59.2C84.801 -63.8 68.6 -70 68.4 -70.6C68.2 -71.2 59.4 -74.6 59.4 -74.6C56.4 -75.8 52 -85 52 -85C48.8 -88.4 64.6 -82.6 64.6 -82.6C63.4 -81.6 70.8 -77.6 70.8 -77.6C88.201 -78.6 98.801 -67.8 98.801 -67.8C109.601 -51.2 109.801 -59.4 109.801 -59.4C112.601 -68.8 100.801 -90 100.801 -90C101.201 -92 109.401 -85.4 109.401 -85.4C110.801 -87.4 111.601 -81.6 111.601 -81.6C111.801 -79.2 115.601 -71.2 115.601 -71.2C118.401 -58.2 122.001 -65.6 122.001 -65.6L126.601 -56.2C128.001 -53.6 122.001 -46 122.001 -46C121.801 -43.2 122.601 -43.4 117.001 -35.8C111.401 -28.2 114.801 -23.8 114.801 -23.8C113.401 -17.2 122.201 -17.6 122.201 -17.6C124.801 -15.4 128.201 -15.4 128.201 -15.4C130.001 -13.4 132.401 -14 132.401 -14C134.001 -17.8 140.201 -15.8 140.201 -15.8C141.601 -18.2 149.801 -18.6 149.801 -18.6C150.801 -21.2 151.201 -22.8 154.601 -23.4C158.001 -24 133.401 -67 133.401 -67C139.801 -67.8 131.601 -80.2 131.601 -80.2C129.401 -86.8 140.801 -72.2 143.001 -70.8C145.201 -69.4 146.201 -67.2 144.601 -67.4C143.001 -67.6 141.201 -65.4 142.601 -65.2C144.001 -65 157.001 -50 160.401 -39.8C163.801 -29.6 169.801 -25.6 176.001 -19.6C182.201 -13.6 181.401 10.6 181.401 10.6C181.001 19.4 187.001 30 187.001 30C189.001 33.8 184.801 52 184.801 52C182.801 54.2 184.201 55 184.201 55C185.201 56.2 192.001 69.4 192.001 69.4C190.201 69.2 193.801 72.8 193.801 72.8C199.001 78.8 192.601 75.8 192.601 75.8C186.601 74.2 193.601 84 193.601 84C194.801 85.8 185.801 81.2 185.801 81.2C176.601 80.6 188.201 87.8 188.201 87.8C196.801 95 185.401 90.6 185.401 90.6C180.801 88.8 184.001 95.6 184.001 95.6C187.201 97.2 204.401 104.2 204.401 104.2C204.801 108.001 201.801 113.001 201.801 113.001C202.201 117.001 200.001 120.401 200.001 120.401C198.801 128.601 198.201 129.401 198.201 129.401C194.001 129.601 186.601 143.401 186.601 143.401C184.801 146.001 174.601 158.001 174.601 158.001C172.601 165.001 154.601 157.801 154.601 157.801C148.001 161.201 150.001 157.801 150.001 157.801C149.601 155.601 154.401 149.601 154.401 149.601C161.401 147.001 158.801 136.201 158.801 136.201C162.801 134.801 151.601 132.001 151.801 130.801C152.001 129.601 157.801 128.201 157.801 128.201C165.801 126.201 161.401 123.801 161.401 123.801C160.801 119.801 163.801 114.201 163.801 114.201C175.401 113.401 163.801 97.2 163.801 97.2C153.001 89.6 152.001 83.8 152.001 83.8C164.601 75.6 156.401 63.2 156.601 59.6C156.801 56 158.001 34.4 158.001 34.4C156.001 28.2 153.001 14.6 153.001 14.6C155.201 9.4 162.601 -3.2 162.601 -3.2C165.401 -7.4 174.201 -12.2 172.001 -15.2C169.801 -18.2 162.001 -16.4 162.001 -16.4C154.201 -17.8 154.801 -12.6 154.801 -12.6C153.201 -11.6 152.401 -6.6 152.401 -6.6C151.68 1.333 142.801 7.6 142.801 7.6C131.601 13.8 140.801 17.8 140.801 17.8C146.801 24.4 137.001 24.6 137.001 24.6C126.001 22.8 134.201 33 134.201 33C145.001 45.8 142.001 48.6 142.001 48.6C131.801 49.6 144.401 58.8 144.401 58.8C144.401 58.8 143.601 56.8 143.801 58.6C144.001 60.4 147.001 64.6 147.801 66.6C148.601 68.6 144.601 68.8 144.601 68.8C145.201 78.4 129.801 74.2 129.801 74.2C129.801 74.2 129.801 74.2 128.201 74.4C126.601 74.6 115.401 73.8 109.601 71.6C103.801 69.4 97.001 69.4 97.001 69.4C97.001 69.4 93.001 71.2 85.4 71C77.8 70.8 69.8 73.6 69.8 73.6C65.4 73.2 74 68.8 74.2 69C74.4 69.2 80 63.6 72 64.2C50.203 65.835 39.4 55.6 39.4 55.6C37.4 54.2 34.8 51.4 34.8 51.4C24.8 49.4 36.2 63.8 36.2 63.8C37.4 65.2 36 66.2 36 66.2C35.2 64.6 27.4 59.2 27.4 59.2C24.589 58.227 23.226 56.893 20.895 54.407z"}
+ ,
+ {"fill": "#4c0000",
+ "path":"M-3 42.8C-3 42.8 8.6 48.4 11.2 51.2C13.8 54 27.8 65.4 27.8 65.4C27.8 65.4 22.4 63.4 19.8 61.6C17.2 59.8 6.4 51.6 6.4 51.6C6.4 51.6 2.6 45.6 -3 42.8z"}
+ ,
+ {"fill": "#99cc32",
+ "path":"M-61.009 11.603C-60.672 11.455 -61.196 8.743 -61.4 8.2C-62.422 5.474 -71.4 4 -71.4 4C-71.627 5.365 -71.682 6.961 -71.576 8.599C-71.576 8.599 -66.708 14.118 -61.009 11.603z"}
+ ,
+ {"fill": "#659900",
+ "path":"M-61.009 11.403C-61.458 11.561 -61.024 8.669 -61.2 8.2C-62.222 5.474 -71.4 3.9 -71.4 3.9C-71.627 5.265 -71.682 6.861 -71.576 8.499C-71.576 8.499 -67.308 13.618 -61.009 11.403z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-65.4 11.546C-66.025 11.546 -66.531 10.406 -66.531 9C-66.531 7.595 -66.025 6.455 -65.4 6.455C-64.775 6.455 -64.268 7.595 -64.268 9C-64.268 10.406 -64.775 11.546 -65.4 11.546z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-65.4 9z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-111 109.601C-111 109.601 -116.6 119.601 -91.8 113.601C-91.8 113.601 -77.8 112.401 -75.4 110.001C-74.2 110.801 -65.834 113.734 -63 114.401C-56.2 116.001 -47.8 106 -47.8 106C-47.8 106 -43.2 95.5 -40.4 95.5C-37.6 95.5 -40.8 97.1 -40.8 97.1C-40.8 97.1 -47.4 107.201 -47 108.801C-47 108.801 -52.2 128.801 -68.2 129.601C-68.2 129.601 -84.35 130.551 -83 136.401C-83 136.401 -74.2 134.001 -71.8 136.401C-71.8 136.401 -61 136.001 -69 142.401L-75.8 154.001C-75.8 154.001 -75.66 157.919 -85.8 154.401C-95.6 151.001 -105.9 138.101 -105.9 138.101C-105.9 138.101 -121.85 123.551 -111 109.601z"}
+ ,
+ {"fill": "#e59999",
+ "path":"M-112.2 113.601C-112.2 113.601 -114.2 123.201 -77.4 112.801C-77.4 112.801 -73 112.801 -70.6 113.601C-68.2 114.401 -56.2 117.201 -54.2 116.001C-54.2 116.001 -61.4 129.601 -73 128.001C-73 128.001 -86.2 129.601 -85.8 134.401C-85.8 134.401 -81.8 141.601 -77 144.001C-77 144.001 -74.2 146.401 -74.6 149.601C-75 152.801 -77.8 154.401 -79.8 155.201C-81.8 156.001 -85 152.801 -86.6 152.801C-88.2 152.801 -96.6 146.401 -101 141.601C-105.4 136.801 -113.8 124.801 -113.4 122.001C-113 119.201 -112.2 113.601 -112.2 113.601z"}
+ ,
+ {"fill": "#b26565",
+ "path":"M-109 131.051C-106.4 135.001 -103.2 139.201 -101 141.601C-96.6 146.401 -88.2 152.801 -86.6 152.801C-85 152.801 -81.8 156.001 -79.8 155.201C-77.8 154.401 -75 152.801 -74.6 149.601C-74.2 146.401 -77 144.001 -77 144.001C-80.066 142.468 -82.806 138.976 -84.385 136.653C-84.385 136.653 -84.2 139.201 -89.4 138.401C-94.6 137.601 -99.8 134.801 -101.4 131.601C-103 128.401 -105.4 126.001 -103.8 129.601C-102.2 133.201 -99.8 136.801 -98.2 137.201C-96.6 137.601 -97 138.801 -99.4 138.401C-101.8 138.001 -104.6 137.601 -109 132.401z"}
+ ,
+ {"fill": "#992600",
+ "path":"M-111.6 110.001C-111.6 110.001 -109.8 96.4 -108.6 92.4C-108.6 92.4 -109.4 85.6 -107 81.4C-104.6 77.2 -102.6 71 -99.6 65.6C-96.6 60.2 -96.4 56.2 -92.4 54.6C-88.4 53 -82.4 44.4 -79.6 43.4C-76.8 42.4 -77 43.2 -77 43.2C-77 43.2 -70.2 28.4 -56.6 32.4C-56.6 32.4 -72.8 29.6 -57 20.2C-57 20.2 -61.8 21.3 -58.5 14.3C-56.299 9.632 -56.8 16.4 -67.8 28.2C-67.8 28.2 -72.8 36.8 -78 39.8C-83.2 42.8 -95.2 49.8 -96.4 53.6C-97.6 57.4 -100.8 63.2 -102.8 64.8C-104.8 66.4 -107.6 70.6 -108 74C-108 74 -109.2 78 -110.6 79.2C-112 80.4 -112.2 83.6 -112.2 85.6C-112.2 87.6 -114.2 90.4 -114 92.8C-114 92.8 -113.2 111.801 -113.6 113.801L-111.6 110.001z"}
+ ,
+ {"fill": "#ffffff",
+ "path":"M-120.2 114.601C-120.2 114.601 -122.2 113.201 -126.6 119.201C-126.6 119.201 -119.3 152.201 -119.3 153.601C-119.3 153.601 -118.2 151.501 -119.5 144.301C-120.8 137.101 -121.7 124.401 -121.7 124.401L-120.2 114.601z"}
+ ,
+ {"fill": "#992600",
+ "path":"M-98.6 54C-98.6 54 -116.2 57.2 -115.8 86.4L-116.6 111.201C-116.6 111.201 -117.8 85.6 -119 84C-120.2 82.4 -116.2 71.2 -119.4 77.2C-119.4 77.2 -133.4 91.2 -125.4 112.401C-125.4 112.401 -123.9 115.701 -126.9 111.101C-126.9 111.101 -131.5 98.5 -130.4 92.1C-130.4 92.1 -130.2 89.9 -128.3 87.1C-128.3 87.1 -119.7 75.4 -117 73.1C-117 73.1 -115.2 58.7 -99.8 53.5C-99.8 53.5 -94.1 51.2 -98.6 54z"}
+ ,
+ {"fill": "#000000",
+ "path":"M40.8 -12.2C41.46 -12.554 41.451 -13.524 42.031 -13.697C43.18 -14.041 43.344 -15.108 43.862 -15.892C44.735 -17.211 44.928 -18.744 45.51 -20.235C45.782 -20.935 45.809 -21.89 45.496 -22.55C44.322 -25.031 43.62 -27.48 42.178 -29.906C41.91 -30.356 41.648 -31.15 41.447 -31.748C40.984 -33.132 39.727 -34.123 38.867 -35.443C38.579 -35.884 39.104 -36.809 38.388 -36.893C37.491 -36.998 36.042 -37.578 35.809 -36.552C35.221 -33.965 36.232 -31.442 37.2 -29C36.418 -28.308 36.752 -27.387 36.904 -26.62C37.614 -23.014 36.416 -19.662 35.655 -16.188C35.632 -16.084 35.974 -15.886 35.946 -15.824C34.724 -13.138 33.272 -10.693 31.453 -8.312C30.695 -7.32 29.823 -6.404 29.326 -5.341C28.958 -4.554 28.55 -3.588 28.8 -2.6C25.365 0.18 23.115 4.025 20.504 7.871C20.042 8.551 20.333 9.76 20.884 10.029C21.697 10.427 22.653 9.403 23.123 8.557C23.512 7.859 23.865 7.209 24.356 6.566C24.489 6.391 24.31 5.972 24.445 5.851C27.078 3.504 28.747 0.568 31.2 -1.8C33.15 -2.129 34.687 -3.127 36.435 -4.14C36.743 -4.319 37.267 -4.07 37.557 -4.265C39.31 -5.442 39.308 -7.478 39.414 -9.388C39.464 -10.272 39.66 -11.589 40.8 -12.2z"}
+ ,
+ {"fill": "#000000",
+ "path":"M31.959 -16.666C32.083 -16.743 31.928 -17.166 32.037 -17.382C32.199 -17.706 32.602 -17.894 32.764 -18.218C32.873 -18.434 32.71 -18.814 32.846 -18.956C35.179 -21.403 35.436 -24.427 34.4 -27.4C35.424 -28.02 35.485 -29.282 35.06 -30.129C34.207 -31.829 34.014 -33.755 33.039 -35.298C32.237 -36.567 30.659 -37.811 29.288 -36.508C28.867 -36.108 28.546 -35.321 28.824 -34.609C28.888 -34.446 29.173 -34.3 29.146 -34.218C29.039 -33.894 28.493 -33.67 28.487 -33.398C28.457 -31.902 27.503 -30.391 28.133 -29.062C28.905 -27.433 29.724 -25.576 30.4 -23.8C29.166 -21.684 30.199 -19.235 28.446 -17.358C28.31 -17.212 28.319 -16.826 28.441 -16.624C28.733 -16.138 29.139 -15.732 29.625 -15.44C29.827 -15.319 30.175 -15.317 30.375 -15.441C30.953 -15.803 31.351 -16.29 31.959 -16.666z"}
+ ,
+ {"fill": "#000000",
+ "path":"M94.771 -26.977C96.16 -25.185 96.45 -22.39 94.401 -21C94.951 -17.691 98.302 -19.67 100.401 -20.2C100.292 -20.588 100.519 -20.932 100.802 -20.937C101.859 -20.952 102.539 -21.984 103.601 -21.8C104.035 -23.357 105.673 -24.059 106.317 -25.439C108.043 -29.134 107.452 -33.407 104.868 -36.653C104.666 -36.907 104.883 -37.424 104.759 -37.786C104.003 -39.997 101.935 -40.312 100.001 -41C98.824 -44.875 98.163 -48.906 96.401 -52.6C94.787 -52.85 94.089 -54.589 92.752 -55.309C91.419 -56.028 90.851 -54.449 90.892 -53.403C90.899 -53.198 91.351 -52.974 91.181 -52.609C91.105 -52.445 90.845 -52.334 90.845 -52.2C90.846 -52.065 91.067 -51.934 91.201 -51.8C90.283 -50.98 88.86 -50.503 88.565 -49.358C87.611 -45.648 90.184 -42.523 91.852 -39.322C92.443 -38.187 91.707 -36.916 90.947 -35.708C90.509 -35.013 90.617 -33.886 90.893 -33.03C91.645 -30.699 93.236 -28.96 94.771 -26.977z"}
+ ,
+ {"fill": "#000000",
+ "path":"M57.611 -8.591C56.124 -6.74 52.712 -4.171 55.629 -2.243C55.823 -2.114 56.193 -2.11 56.366 -2.244C58.387 -3.809 60.39 -4.712 62.826 -5.294C62.95 -5.323 63.224 -4.856 63.593 -5.017C65.206 -5.72 67.216 -5.662 68.4 -7C72.167 -6.776 75.732 -7.892 79.123 -9.2C80.284 -9.648 81.554 -10.207 82.755 -10.709C84.131 -11.285 85.335 -12.213 86.447 -13.354C86.58 -13.49 86.934 -13.4 87.201 -13.4C87.161 -14.263 88.123 -14.39 88.37 -15.012C88.462 -15.244 88.312 -15.64 88.445 -15.742C90.583 -17.372 91.503 -19.39 90.334 -21.767C90.049 -22.345 89.8 -22.963 89.234 -23.439C88.149 -24.35 87.047 -23.496 86 -23.8C85.841 -23.172 85.112 -23.344 84.726 -23.146C83.867 -22.707 82.534 -23.292 81.675 -22.854C80.313 -22.159 79.072 -21.99 77.65 -21.613C77.338 -21.531 76.56 -21.627 76.4 -21C76.266 -21.134 76.118 -21.368 76.012 -21.346C74.104 -20.95 72.844 -20.736 71.543 -19.044C71.44 -18.911 70.998 -19.09 70.839 -18.955C69.882 -18.147 69.477 -16.913 68.376 -16.241C68.175 -16.118 67.823 -16.286 67.629 -16.157C66.983 -15.726 66.616 -15.085 65.974 -14.638C65.645 -14.409 65.245 -14.734 65.277 -14.99C65.522 -16.937 66.175 -18.724 65.6 -20.6C67.677 -23.12 70.194 -25.069 72 -27.8C72.015 -29.966 72.707 -32.112 72.594 -34.189C72.584 -34.382 72.296 -35.115 72.17 -35.462C71.858 -36.316 72.764 -37.382 71.92 -38.106C70.516 -39.309 69.224 -38.433 68.4 -37C66.562 -36.61 64.496 -35.917 62.918 -37.151C61.911 -37.938 61.333 -38.844 60.534 -39.9C59.549 -41.202 59.884 -42.638 59.954 -44.202C59.96 -44.33 59.645 -44.466 59.645 -44.6C59.646 -44.735 59.866 -44.866 60 -45C59.294 -45.626 59.019 -46.684 58 -47C58.305 -48.092 57.629 -48.976 56.758 -49.278C54.763 -49.969 53.086 -48.057 51.194 -47.984C50.68 -47.965 50.213 -49.003 49.564 -49.328C49.132 -49.544 48.428 -49.577 48.066 -49.311C47.378 -48.807 46.789 -48.693 46.031 -48.488C44.414 -48.052 43.136 -46.958 41.656 -46.103C40.171 -45.246 39.216 -43.809 38.136 -42.489C37.195 -41.337 37.059 -38.923 38.479 -38.423C40.322 -37.773 41.626 -40.476 43.592 -40.15C43.904 -40.099 44.11 -39.788 44 -39.4C44.389 -39.291 44.607 -39.52 44.8 -39.8C45.658 -38.781 46.822 -38.444 47.76 -37.571C48.73 -36.667 50.476 -37.085 51.491 -36.088C53.02 -34.586 52.461 -31.905 54.4 -30.6C53.814 -29.287 53.207 -28.01 52.872 -26.583C52.59 -25.377 53.584 -24.18 54.795 -24.271C56.053 -24.365 56.315 -25.124 56.8 -26.2C57.067 -25.933 57.536 -25.636 57.495 -25.42C57.038 -23.033 56.011 -21.04 55.553 -18.609C55.494 -18.292 55.189 -18.09 54.8 -18.2C54.332 -14.051 50.28 -11.657 47.735 -8.492C47.332 -7.99 47.328 -6.741 47.737 -6.338C49.14 -4.951 51.1 -6.497 52.8 -7C53.013 -8.206 53.872 -9.148 55.204 -9.092C55.46 -9.082 55.695 -9.624 56.019 -9.754C56.367 -9.892 56.869 -9.668 57.155 -9.866C58.884 -11.061 60.292 -12.167 62.03 -13.356C62.222 -13.487 62.566 -13.328 62.782 -13.436C63.107 -13.598 63.294 -13.985 63.617 -14.17C63.965 -14.37 64.207 -14.08 64.4 -13.8C63.754 -13.451 63.75 -12.494 63.168 -12.292C62.393 -12.024 61.832 -11.511 61.158 -11.064C60.866 -10.871 60.207 -11.119 60.103 -10.94C59.505 -9.912 58.321 -9.474 57.611 -8.591z"}
+ ,
+ {"fill": "#000000",
+ "path":"M2.2 -58C2.2 -58 -7.038 -60.872 -18.2 -35.2C-18.2 -35.2 -20.6 -30 -23 -28C-25.4 -26 -36.6 -22.4 -38.6 -18.4L-49 -2.4C-49 -2.4 -34.2 -18.4 -31 -20.8C-31 -20.8 -23 -29.2 -26.2 -22.4C-26.2 -22.4 -40.2 -11.6 -39 -2.4C-39 -2.4 -44.6 12 -45.4 14C-45.4 14 -29.4 -18 -27 -19.2C-24.6 -20.4 -23.4 -20.4 -24.6 -16.8C-25.8 -13.2 -26.2 3.2 -29 5.2C-29 5.2 -21 -15.2 -21.8 -18.4C-21.8 -18.4 -18.6 -22 -16.2 -16.8L-17.4 -0.8L-13 11.2C-13 11.2 -15.4 0 -13.8 -15.6C-13.8 -15.6 -15.8 -26 -11.8 -20.4C-7.8 -14.8 1.8 -8.8 1.8 -4C1.8 -4 -3.4 -21.6 -12.6 -26.4L-16.6 -20.4L-17.8 -22.4C-17.8 -22.4 -21.4 -23.2 -17 -30C-12.6 -36.8 -13 -37.6 -13 -37.6C-13 -37.6 -6.6 -30.4 -5 -30.4C-5 -30.4 8.2 -38 9.4 -13.6C9.4 -13.6 16.2 -28 7 -34.8C7 -34.8 -7.8 -36.8 -6.6 -42L0.6 -54.4C4.2 -59.6 2.6 -56.8 2.6 -56.8z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-17.8 -41.6C-17.8 -41.6 -30.6 -41.6 -33.8 -36.4L-41 -26.8C-41 -26.8 -23.8 -36.8 -19.8 -38C-15.8 -39.2 -17.8 -41.6 -17.8 -41.6z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-57.8 -35.2C-57.8 -35.2 -59.8 -34 -60.2 -31.2C-60.6 -28.4 -63 -28 -62.2 -25.2C-61.4 -22.4 -59.4 -20 -59.4 -24C-59.4 -28 -57.8 -30 -57 -31.2C-56.2 -32.4 -54.6 -36.8 -57.8 -35.2z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-66.6 26C-66.6 26 -75 22 -78.2 18.4C-81.4 14.8 -80.948 19.966 -85.8 19.6C-91.647 19.159 -90.6 3.2 -90.6 3.2L-94.6 10.8C-94.6 10.8 -95.8 25.2 -87.8 22.8C-83.893 21.628 -82.6 23.2 -84.2 24C-85.8 24.8 -78.6 25.2 -81.4 26.8C-84.2 28.4 -69.8 23.2 -72.2 33.6L-66.6 26z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-79.2 40.4C-79.2 40.4 -94.6 44.8 -98.2 35.2C-98.2 35.2 -103 37.6 -100.8 40.6C-98.6 43.6 -97.4 44 -97.4 44C-97.4 44 -92 45.2 -92.6 46C-93.2 46.8 -95.6 50.2 -95.6 50.2C-95.6 50.2 -85.4 44.2 -79.2 40.4z"}
+ ,
+ {"fill": "#ffffff",
+ "path":"M149.201 118.601C148.774 120.735 147.103 121.536 145.201 122.201C143.284 121.243 140.686 118.137 138.801 120.201C138.327 119.721 137.548 119.661 137.204 118.999C136.739 118.101 137.011 117.055 136.669 116.257C136.124 114.985 135.415 113.619 135.601 112.201C137.407 111.489 138.002 109.583 137.528 107.82C137.459 107.563 137.03 107.366 137.23 107.017C137.416 106.694 137.734 106.467 138.001 106.2C137.866 106.335 137.721 106.568 137.61 106.548C137 106.442 137.124 105.805 137.254 105.418C137.839 103.672 139.853 103.408 141.201 104.6C141.457 104.035 141.966 104.229 142.401 104.2C142.351 103.621 142.759 103.094 142.957 102.674C143.475 101.576 145.104 102.682 145.901 102.07C146.977 101.245 148.04 100.546 149.118 101.149C150.927 102.162 152.636 103.374 153.835 105.115C154.41 105.949 154.65 107.23 154.592 108.188C154.554 108.835 153.173 108.483 152.83 109.412C152.185 111.16 154.016 111.679 154.772 113.017C154.97 113.366 154.706 113.67 154.391 113.768C153.98 113.896 153.196 113.707 153.334 114.16C154.306 117.353 151.55 118.031 149.201 118.601z"}
+ ,
+ {"fill": "#ffffff",
+ "path":"M139.6 138.201C139.593 136.463 137.992 134.707 139.201 133.001C139.336 133.135 139.467 133.356 139.601 133.356C139.736 133.356 139.867 133.135 140.001 133.001C141.496 135.217 145.148 136.145 145.006 138.991C144.984 139.438 143.897 140.356 144.801 141.001C142.988 142.349 142.933 144.719 142.001 146.601C140.763 146.315 139.551 145.952 138.401 145.401C138.753 143.915 138.636 142.231 139.456 140.911C139.89 140.213 139.603 139.134 139.6 138.201z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-26.6 129.201C-26.6 129.201 -43.458 139.337 -29.4 124.001C-20.6 114.401 -10.6 108.801 -10.6 108.801C-10.6 108.801 -0.2 104.4 3.4 103.2C7 102 22.2 96.8 25.4 96.4C28.6 96 38.2 92 45 96C51.8 100 59.8 104.4 59.8 104.4C59.8 104.4 43.4 96 39.8 98.4C36.2 100.8 29 100.4 23 103.6C23 103.6 8.2 108.001 5 110.001C1.8 112.001 -8.6 123.601 -10.2 122.801C-11.8 122.001 -9.8 121.601 -8.6 118.801C-7.4 116.001 -9.4 114.401 -17.4 120.801C-25.4 127.201 -26.6 129.201 -26.6 129.201z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-19.195 123.234C-19.195 123.234 -17.785 110.194 -9.307 111.859C-9.307 111.859 -1.081 107.689 1.641 105.721C1.641 105.721 9.78 104.019 11.09 103.402C29.569 94.702 44.288 99.221 44.835 98.101C45.381 96.982 65.006 104.099 68.615 108.185C69.006 108.628 58.384 102.588 48.686 100.697C40.413 99.083 18.811 100.944 7.905 106.48C4.932 107.989 -4.013 113.773 -6.544 113.662C-9.075 113.55 -19.195 123.234 -19.195 123.234z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-23 148.801C-23 148.801 -38.2 146.401 -21.4 144.801C-21.4 144.801 -3.4 142.801 0.6 137.601C0.6 137.601 14.2 128.401 17 128.001C19.8 127.601 49.8 120.401 50.2 118.001C50.6 115.601 56.2 115.601 57.8 116.401C59.4 117.201 58.6 118.401 55.8 119.201C53 120.001 21.8 136.401 15.4 137.601C9 138.801 -2.6 146.401 -7.4 147.601C-12.2 148.801 -23 148.801 -23 148.801z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-3.48 141.403C-3.48 141.403 -12.062 140.574 -3.461 139.755C-3.461 139.755 5.355 136.331 7.403 133.668C7.403 133.668 14.367 128.957 15.8 128.753C17.234 128.548 31.194 124.861 31.399 123.633C31.604 122.404 65.67 109.823 70.09 113.013C73.001 115.114 63.1 113.437 53.466 117.847C52.111 118.467 18.258 133.054 14.981 133.668C11.704 134.283 5.765 138.174 3.307 138.788C0.85 139.403 -3.48 141.403 -3.48 141.403z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-11.4 143.601C-11.4 143.601 -6.2 143.201 -7.4 144.801C-8.6 146.401 -11 145.601 -11 145.601L-11.4 143.601z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-18.6 145.201C-18.6 145.201 -13.4 144.801 -14.6 146.401C-15.8 148.001 -18.2 147.201 -18.2 147.201L-18.6 145.201z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-29 146.801C-29 146.801 -23.8 146.401 -25 148.001C-26.2 149.601 -28.6 148.801 -28.6 148.801L-29 146.801z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-36.6 147.601C-36.6 147.601 -31.4 147.201 -32.6 148.801C-33.8 150.401 -36.2 149.601 -36.2 149.601L-36.6 147.601z"}
+ ,
+ {"fill": "#000000",
+ "path":"M1.8 108.001C1.8 108.001 6.2 108.001 5 109.601C3.8 111.201 0.6 110.801 0.6 110.801L1.8 108.001z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-8.2 113.601C-8.2 113.601 -1.694 111.46 -4.2 114.801C-5.4 116.401 -7.8 115.601 -7.8 115.601L-8.2 113.601z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-19.4 118.401C-19.4 118.401 -14.2 118.001 -15.4 119.601C-16.6 121.201 -19 120.401 -19 120.401L-19.4 118.401z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-27 124.401C-27 124.401 -21.8 124.001 -23 125.601C-24.2 127.201 -26.6 126.401 -26.6 126.401L-27 124.401z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-33.8 129.201C-33.8 129.201 -28.6 128.801 -29.8 130.401C-31 132.001 -33.4 131.201 -33.4 131.201L-33.8 129.201z"}
+ ,
+ {"fill": "#000000",
+ "path":"M5.282 135.598C5.282 135.598 12.203 135.066 10.606 137.195C9.009 139.325 5.814 138.26 5.814 138.26L5.282 135.598z"}
+ ,
+ {"fill": "#000000",
+ "path":"M15.682 130.798C15.682 130.798 22.603 130.266 21.006 132.395C19.409 134.525 16.214 133.46 16.214 133.46L15.682 130.798z"}
+ ,
+ {"fill": "#000000",
+ "path":"M26.482 126.398C26.482 126.398 33.403 125.866 31.806 127.995C30.209 130.125 27.014 129.06 27.014 129.06L26.482 126.398z"}
+ ,
+ {"fill": "#000000",
+ "path":"M36.882 121.598C36.882 121.598 43.803 121.066 42.206 123.195C40.609 125.325 37.414 124.26 37.414 124.26L36.882 121.598z"}
+ ,
+ {"fill": "#000000",
+ "path":"M9.282 103.598C9.282 103.598 16.203 103.066 14.606 105.195C13.009 107.325 9.014 107.06 9.014 107.06L9.282 103.598z"}
+ ,
+ {"fill": "#000000",
+ "path":"M19.282 100.398C19.282 100.398 26.203 99.866 24.606 101.995C23.009 104.125 18.614 103.86 18.614 103.86L19.282 100.398z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-3.4 140.401C-3.4 140.401 1.8 140.001 0.6 141.601C-0.6 143.201 -3 142.401 -3 142.401L-3.4 140.401z"}
+ ,
+ {"fill": "#992600",
+ "path":"M-76.6 41.2C-76.6 41.2 -81 50 -81.4 53.2C-81.4 53.2 -80.6 44.4 -79.4 42.4C-78.2 40.4 -76.6 41.2 -76.6 41.2z"}
+ ,
+ {"fill": "#992600",
+ "path":"M-95 55.2C-95 55.2 -98.2 69.6 -97.8 72.4C-97.8 72.4 -99 60.8 -98.6 59.6C-98.2 58.4 -95 55.2 -95 55.2z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-74.2 -19.4L-74.4 -16.2L-76.6 -16C-76.6 -16 -62.4 -3.4 -61.8 4.2C-61.8 4.2 -61 -4 -74.2 -19.4z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-70.216 -18.135C-70.647 -18.551 -70.428 -19.296 -70.836 -19.556C-71.645 -20.072 -69.538 -20.129 -69.766 -20.845C-70.149 -22.051 -69.962 -22.072 -70.084 -23.348C-70.141 -23.946 -69.553 -25.486 -69.168 -25.926C-67.722 -27.578 -69.046 -30.51 -67.406 -32.061C-67.102 -32.35 -66.726 -32.902 -66.441 -33.32C-65.782 -34.283 -64.598 -34.771 -63.648 -35.599C-63.33 -35.875 -63.531 -36.702 -62.962 -36.61C-62.248 -36.495 -61.007 -36.625 -61.052 -35.784C-61.165 -33.664 -62.494 -31.944 -63.774 -30.276C-63.323 -29.572 -63.781 -28.937 -64.065 -28.38C-65.4 -25.76 -65.211 -22.919 -65.385 -20.079C-65.39 -19.994 -65.697 -19.916 -65.689 -19.863C-65.336 -17.528 -64.752 -15.329 -63.873 -13.1C-63.507 -12.17 -63.036 -11.275 -62.886 -10.348C-62.775 -9.662 -62.672 -8.829 -63.08 -8.124C-61.045 -5.234 -62.354 -2.583 -61.185 0.948C-60.978 1.573 -59.286 3.487 -59.749 3.326C-62.262 2.455 -62.374 2.057 -62.551 1.304C-62.697 0.681 -63.027 -0.696 -63.264 -1.298C-63.328 -1.462 -63.499 -3.346 -63.577 -3.468C-65.09 -5.85 -63.732 -5.674 -65.102 -8.032C-66.53 -8.712 -67.496 -9.816 -68.619 -10.978C-68.817 -11.182 -67.674 -11.906 -67.855 -12.119C-68.947 -13.408 -70.1 -14.175 -69.764 -15.668C-69.609 -16.358 -69.472 -17.415 -70.216 -18.135z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-73.8 -16.4C-73.8 -16.4 -73.4 -9.6 -71 -8C-68.6 -6.4 -69.8 -7.2 -73 -8.4C-76.2 -9.6 -75 -10.4 -75 -10.4C-75 -10.4 -77.8 -10 -75.4 -8C-73 -6 -69.4 -3.6 -71 -3.6C-72.6 -3.6 -80.2 -7.6 -80.2 -10.4C-80.2 -13.2 -81.2 -17.3 -81.2 -17.3C-81.2 -17.3 -80.1 -18.1 -75.3 -18C-75.3 -18 -73.9 -17.3 -73.8 -16.4z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M-74.6 2.2C-74.6 2.2 -83.12 -0.591 -101.6 2.8C-101.6 2.8 -92.569 0.722 -73.8 3C-63.5 4.25 -74.6 2.2 -74.6 2.2z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M-72.502 2.129C-72.502 2.129 -80.748 -1.389 -99.453 0.392C-99.453 0.392 -90.275 -0.897 -71.774 2.995C-61.62 5.131 -72.502 2.129 -72.502 2.129z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M-70.714 2.222C-70.714 2.222 -78.676 -1.899 -97.461 -1.514C-97.461 -1.514 -88.213 -2.118 -70.052 3.14C-60.086 6.025 -70.714 2.222 -70.714 2.222z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M-69.444 2.445C-69.444 2.445 -76.268 -1.862 -93.142 -2.96C-93.142 -2.96 -84.803 -2.79 -68.922 3.319C-60.206 6.672 -69.444 2.445 -69.444 2.445z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M45.84 12.961C45.84 12.961 44.91 13.605 45.124 12.424C45.339 11.243 73.547 -1.927 77.161 -1.677C77.161 -1.677 46.913 11.529 45.84 12.961z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M42.446 13.6C42.446 13.6 41.57 14.315 41.691 13.121C41.812 11.927 68.899 -3.418 72.521 -3.452C72.521 -3.452 43.404 12.089 42.446 13.6z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M39.16 14.975C39.16 14.975 38.332 15.747 38.374 14.547C38.416 13.348 58.233 -2.149 68.045 -4.023C68.045 -4.023 50.015 4.104 39.16 14.975z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M36.284 16.838C36.284 16.838 35.539 17.532 35.577 16.453C35.615 15.373 53.449 1.426 62.28 -0.26C62.28 -0.26 46.054 7.054 36.284 16.838z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M4.6 164.801C4.6 164.801 -10.6 162.401 6.2 160.801C6.2 160.801 24.2 158.801 28.2 153.601C28.2 153.601 41.8 144.401 44.6 144.001C47.4 143.601 63.8 140.001 64.2 137.601C64.6 135.201 70.6 132.801 72.2 133.601C73.8 134.401 73.8 143.601 71 144.401C68.2 145.201 49.4 152.401 43 153.601C36.6 154.801 25 162.401 20.2 163.601C15.4 164.801 4.6 164.801 4.6 164.801z"}
+ ,
+ {"fill": "#000000",
+ "path":"M77.6 127.401C77.6 127.401 74.6 129.001 73.4 131.601C73.4 131.601 67 142.201 52.8 145.401C52.8 145.401 29.8 154.401 22 156.401C22 156.401 8.6 161.401 1.2 160.601C1.2 160.601 -5.8 160.801 0.4 162.401C0.4 162.401 20.6 160.401 24 158.601C24 158.601 39.6 153.401 42.6 150.801C45.6 148.201 63.8 143.201 66 141.201C68.2 139.201 78 130.801 77.6 127.401z"}
+ ,
+ {"fill": "#000000",
+ "path":"M18.882 158.911C18.882 158.911 24.111 158.685 22.958 160.234C21.805 161.784 19.357 160.91 19.357 160.91L18.882 158.911z"}
+ ,
+ {"fill": "#000000",
+ "path":"M11.68 160.263C11.68 160.263 16.908 160.037 15.756 161.586C14.603 163.136 12.155 162.263 12.155 162.263L11.68 160.263z"}
+ ,
+ {"fill": "#000000",
+ "path":"M1.251 161.511C1.251 161.511 6.48 161.284 5.327 162.834C4.174 164.383 1.726 163.51 1.726 163.51L1.251 161.511z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-6.383 162.055C-6.383 162.055 -1.154 161.829 -2.307 163.378C-3.46 164.928 -5.908 164.054 -5.908 164.054L-6.383 162.055z"}
+ ,
+ {"fill": "#000000",
+ "path":"M35.415 151.513C35.415 151.513 42.375 151.212 40.84 153.274C39.306 155.336 36.047 154.174 36.047 154.174L35.415 151.513z"}
+ ,
+ {"fill": "#000000",
+ "path":"M45.73 147.088C45.73 147.088 51.689 143.787 51.155 148.849C50.885 151.405 46.362 149.749 46.362 149.749L45.73 147.088z"}
+ ,
+ {"fill": "#000000",
+ "path":"M54.862 144.274C54.862 144.274 62.021 140.573 60.287 146.035C59.509 148.485 55.493 146.935 55.493 146.935L54.862 144.274z"}
+ ,
+ {"fill": "#000000",
+ "path":"M64.376 139.449C64.376 139.449 68.735 134.548 69.801 141.21C70.207 143.748 65.008 142.11 65.008 142.11L64.376 139.449z"}
+ ,
+ {"fill": "#000000",
+ "path":"M26.834 155.997C26.834 155.997 32.062 155.77 30.91 157.32C29.757 158.869 27.308 157.996 27.308 157.996L26.834 155.997z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M62.434 34.603C62.434 34.603 61.708 35.268 61.707 34.197C61.707 33.127 79.191 19.863 88.034 18.479C88.034 18.479 71.935 25.208 62.434 34.603z"}
+ ,
+ {"fill": "#000000",
+ "path":"M65.4 98.4C65.4 98.4 87.401 120.801 96.601 124.401C96.601 124.401 105.801 135.601 101.801 161.601C101.801 161.601 98.601 169.201 95.401 148.401C95.401 148.401 98.601 123.201 87.401 139.201C87.401 139.201 79 129.301 85.4 129.601C85.4 129.601 88.601 131.601 89.001 130.001C89.401 128.401 81.4 114.801 64.2 100.4C47 86 65.4 98.4 65.4 98.4z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M7 137.201C7 137.201 6.8 135.401 8.6 136.201C10.4 137.001 104.601 143.201 136.201 167.201C136.201 167.201 91.001 144.001 7 137.201z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M17.4 132.801C17.4 132.801 17.2 131.001 19 131.801C20.8 132.601 157.401 131.601 181.001 164.001C181.001 164.001 159.001 138.801 17.4 132.801z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M29 128.801C29 128.801 28.8 127.001 30.6 127.801C32.4 128.601 205.801 115.601 229.401 148.001C229.401 148.001 219.801 122.401 29 128.801z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M39 124.001C39 124.001 38.8 122.201 40.6 123.001C42.4 123.801 164.601 85.2 188.201 117.601C188.201 117.601 174.801 93 39 124.001z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M-19 146.801C-19 146.801 -19.2 145.001 -17.4 145.801C-15.6 146.601 2.2 148.801 4.2 187.601C4.2 187.601 -3 145.601 -19 146.801z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M-27.8 148.401C-27.8 148.401 -28 146.601 -26.2 147.401C-24.4 148.201 -10.2 143.601 -13 182.401C-13 182.401 -11.8 147.201 -27.8 148.401z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M-35.8 148.801C-35.8 148.801 -36 147.001 -34.2 147.801C-32.4 148.601 -17 149.201 -29.4 171.601C-29.4 171.601 -19.8 147.601 -35.8 148.801z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M11.526 104.465C11.526 104.465 11.082 106.464 12.631 105.247C28.699 92.622 61.141 33.72 116.826 28.086C116.826 28.086 78.518 15.976 11.526 104.465z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M22.726 102.665C22.726 102.665 21.363 101.472 23.231 100.847C25.099 100.222 137.541 27.72 176.826 35.686C176.826 35.686 149.719 28.176 22.726 102.665z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M1.885 108.767C1.885 108.767 1.376 110.366 3.087 109.39C12.062 104.27 15.677 47.059 59.254 45.804C59.254 45.804 26.843 31.09 1.885 108.767z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M-18.038 119.793C-18.038 119.793 -19.115 121.079 -17.162 120.825C-6.916 119.493 14.489 78.222 58.928 83.301C58.928 83.301 26.962 68.955 -18.038 119.793z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M-6.8 113.667C-6.8 113.667 -7.611 115.136 -5.742 114.511C4.057 111.237 17.141 66.625 61.729 63.078C61.729 63.078 27.603 55.135 -6.8 113.667z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M-25.078 124.912C-25.078 124.912 -25.951 125.954 -24.369 125.748C-16.07 124.669 1.268 91.24 37.264 95.354C37.264 95.354 11.371 83.734 -25.078 124.912z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M-32.677 130.821C-32.677 130.821 -33.682 131.866 -32.091 131.748C-27.923 131.439 2.715 98.36 21.183 113.862C21.183 113.862 9.168 95.139 -32.677 130.821z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M36.855 98.898C36.855 98.898 35.654 97.543 37.586 97.158C39.518 96.774 160.221 39.061 198.184 51.927C198.184 51.927 172.243 41.053 36.855 98.898z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M3.4 163.201C3.4 163.201 3.2 161.401 5 162.201C6.8 163.001 22.2 163.601 9.8 186.001C9.8 186.001 19.4 162.001 3.4 163.201z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M13.8 161.601C13.8 161.601 13.6 159.801 15.4 160.601C17.2 161.401 35 163.601 37 202.401C37 202.401 29.8 160.401 13.8 161.601z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M20.6 160.001C20.6 160.001 20.4 158.201 22.2 159.001C24 159.801 48.6 163.201 72.2 195.601C72.2 195.601 36.6 158.801 20.6 160.001z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M28.225 157.972C28.225 157.972 27.788 156.214 29.678 156.768C31.568 157.322 52.002 155.423 90.099 189.599C90.099 189.599 43.924 154.656 28.225 157.972z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M38.625 153.572C38.625 153.572 38.188 151.814 40.078 152.368C41.968 152.922 76.802 157.423 128.499 192.399C128.499 192.399 54.324 150.256 38.625 153.572z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M-1.8 142.001C-1.8 142.001 -2 140.201 -0.2 141.001C1.6 141.801 55 144.401 85.4 171.201C85.4 171.201 50.499 146.426 -1.8 142.001z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M-11.8 146.001C-11.8 146.001 -12 144.201 -10.2 145.001C-8.4 145.801 16.2 149.201 39.8 181.601C39.8 181.601 4.2 144.801 -11.8 146.001z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M49.503 148.962C49.503 148.962 48.938 147.241 50.864 147.655C52.79 148.068 87.86 150.004 141.981 181.098C141.981 181.098 64.317 146.704 49.503 148.962z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M57.903 146.562C57.903 146.562 57.338 144.841 59.264 145.255C61.19 145.668 96.26 147.604 150.381 178.698C150.381 178.698 73.317 143.904 57.903 146.562z"}
+ ,
+ {"fill": "#ffffff", "stroke":"#000000", "width":0.1,
+ "path":"M67.503 141.562C67.503 141.562 66.938 139.841 68.864 140.255C70.79 140.668 113.86 145.004 203.582 179.298C203.582 179.298 82.917 138.904 67.503 141.562z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-43.8 148.401C-43.8 148.401 -38.6 148.001 -39.8 149.601C-41 151.201 -43.4 150.401 -43.4 150.401L-43.8 148.401z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-13 162.401C-13 162.401 -7.8 162.001 -9 163.601C-10.2 165.201 -12.6 164.401 -12.6 164.401L-13 162.401z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-21.8 162.001C-21.8 162.001 -16.6 161.601 -17.8 163.201C-19 164.801 -21.4 164.001 -21.4 164.001L-21.8 162.001z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-117.169 150.182C-117.169 150.182 -112.124 151.505 -113.782 152.624C-115.439 153.744 -117.446 152.202 -117.446 152.202L-117.169 150.182z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-115.169 140.582C-115.169 140.582 -110.124 141.905 -111.782 143.024C-113.439 144.144 -115.446 142.602 -115.446 142.602L-115.169 140.582z"}
+ ,
+ {"fill": "#000000",
+ "path":"M-122.369 136.182C-122.369 136.182 -117.324 137.505 -118.982 138.624C-120.639 139.744 -122.646 138.202 -122.646 138.202L-122.369 136.182z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-42.6 211.201C-42.6 211.201 -44.2 211.201 -48.2 213.201C-50.2 213.201 -61.4 216.801 -67 226.801C-67 226.801 -54.6 217.201 -42.6 211.201z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M45.116 303.847C45.257 304.105 45.312 304.525 45.604 304.542C46.262 304.582 47.495 304.883 47.37 304.247C46.522 299.941 45.648 295.004 41.515 293.197C40.876 292.918 39.434 293.331 39.36 294.215C39.233 295.739 39.116 297.088 39.425 298.554C39.725 299.975 41.883 299.985 42.8 298.601C43.736 300.273 44.168 302.116 45.116 303.847z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M34.038 308.581C34.786 309.994 34.659 311.853 36.074 312.416C36.814 312.71 38.664 311.735 38.246 310.661C37.444 308.6 37.056 306.361 35.667 304.55C35.467 304.288 35.707 303.755 35.547 303.427C34.953 302.207 33.808 301.472 32.4 301.801C31.285 304.004 32.433 306.133 33.955 307.842C34.091 307.994 33.925 308.37 34.038 308.581z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-5.564 303.391C-5.672 303.014 -5.71 302.551 -5.545 302.23C-5.014 301.197 -4.221 300.075 -4.558 299.053C-4.906 297.997 -6.022 298.179 -6.672 298.748C-7.807 299.742 -7.856 301.568 -8.547 302.927C-8.743 303.313 -8.692 303.886 -9.133 304.277C-9.607 304.698 -10.047 306.222 -9.951 306.793C-9.898 307.106 -10.081 317.014 -9.859 316.751C-9.24 316.018 -6.19 306.284 -6.121 305.392C-6.064 304.661 -5.332 304.196 -5.564 303.391z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-31.202 296.599C-28.568 294.1 -25.778 291.139 -26.22 287.427C-26.336 286.451 -28.111 286.978 -28.298 287.824C-29.1 291.449 -31.139 294.11 -33.707 296.502C-35.903 298.549 -37.765 304.893 -38 305.401C-34.303 300.145 -32.046 297.399 -31.202 296.599z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-44.776 290.635C-44.253 290.265 -44.555 289.774 -44.338 289.442C-43.385 287.984 -42.084 286.738 -42.066 285C-42.063 284.723 -42.441 284.414 -42.776 284.638C-43.053 284.822 -43.395 284.952 -43.503 285.082C-45.533 287.531 -46.933 290.202 -48.376 293.014C-48.559 293.371 -49.703 297.862 -49.39 297.973C-49.151 298.058 -47.431 293.877 -47.221 293.763C-45.958 293.077 -45.946 291.462 -44.776 290.635z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-28.043 310.179C-27.599 309.31 -26.023 308.108 -26.136 307.219C-26.254 306.291 -25.786 304.848 -26.698 305.536C-27.955 306.484 -31.404 307.833 -31.674 313.641C-31.7 314.212 -28.726 311.519 -28.043 310.179z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-13.6 293.001C-13.2 292.333 -12.492 292.806 -12.033 292.543C-11.385 292.171 -10.774 291.613 -10.482 290.964C-9.512 288.815 -7.743 286.995 -7.6 284.601C-9.091 283.196 -9.77 285.236 -10.4 286.201C-11.723 284.554 -12.722 286.428 -14.022 286.947C-14.092 286.975 -14.305 286.628 -14.38 286.655C-15.557 287.095 -16.237 288.176 -17.235 288.957C-17.406 289.091 -17.811 288.911 -17.958 289.047C-18.61 289.65 -19.583 289.975 -19.863 290.657C-20.973 293.364 -24.113 295.459 -26 303.001C-25.619 303.91 -21.488 296.359 -21.001 295.661C-20.165 294.465 -20.047 297.322 -18.771 296.656C-18.72 296.629 -18.534 296.867 -18.4 297.001C-18.206 296.721 -17.988 296.492 -17.6 296.601C-17.6 296.201 -17.734 295.645 -17.533 295.486C-16.296 294.509 -16.38 293.441 -15.6 292.201C-15.142 292.99 -14.081 292.271 -13.6 293.001z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M46.2 347.401C46.2 347.401 53.6 327.001 49.2 315.801C49.2 315.801 60.6 337.401 56 348.601C56 348.601 55.6 338.201 51.6 333.201C51.6 333.201 47.6 346.001 46.2 347.401z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M31.4 344.801C31.4 344.801 36.8 336.001 28.8 317.601C28.8 317.601 28 338.001 21.2 349.001C21.2 349.001 35.4 328.801 31.4 344.801z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M21.4 342.801C21.4 342.801 21.2 322.801 21.6 319.801C21.6 319.801 17.8 336.401 7.6 346.001C7.6 346.001 22 334.001 21.4 342.801z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M11.8 310.801C11.8 310.801 17.8 324.401 7.8 342.801C7.8 342.801 14.2 330.601 9.4 323.601C9.4 323.601 12 320.201 11.8 310.801z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-7.4 342.401C-7.4 342.401 -8.4 326.801 -6.6 324.601C-6.6 324.601 -6.4 318.201 -6.8 317.201C-6.8 317.201 -2.8 311.001 -2.6 318.401C-2.6 318.401 -1.2 326.201 1.6 330.801C1.6 330.801 5.2 336.201 5 342.601C5 342.601 -5 312.401 -7.4 342.401z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-11 314.801C-11 314.801 -17.6 325.601 -19.4 344.601C-19.4 344.601 -20.8 338.401 -17 324.001C-17 324.001 -12.8 308.601 -11 314.801z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-32.8 334.601C-32.8 334.601 -27.8 329.201 -26.4 324.201C-26.4 324.201 -22.8 308.401 -29.2 317.001C-29.2 317.001 -29 325.001 -37.2 332.401C-37.2 332.401 -32.4 330.001 -32.8 334.601z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-38.6 329.601C-38.6 329.601 -35.2 312.201 -34.4 311.401C-34.4 311.401 -32.6 308.001 -35.4 311.201C-35.4 311.201 -44.2 330.401 -48.2 337.001C-48.2 337.001 -40.2 327.801 -38.6 329.601z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-44.4 313.001C-44.4 313.001 -32.8 290.601 -54.6 316.401C-54.6 316.401 -43.6 306.601 -44.4 313.001z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M-59.8 298.401C-59.8 298.401 -55 279.601 -52.4 279.801C-52.4 279.801 -44.2 270.801 -50.8 281.401C-50.8 281.401 -56.8 291.001 -56.2 300.801C-56.2 300.801 -56.8 291.201 -59.8 298.401z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M270.5 287C270.5 287 258.5 277 256 273.5C256 273.5 269.5 292 269.5 299C269.5 299 272 291.5 270.5 287z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M276 265C276 265 255 250 251.5 242.5C251.5 242.5 278 272 278 276.5C278 276.5 278.5 267.5 276 265z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M293 111C293 111 281 103 279.5 105C279.5 105 290 111.5 292.5 120C292.5 120 291 111 293 111z"}
+ ,
+ {"fill": "#cccccc",
+ "path":"M301.5 191.5L284 179.5C284 179.5 303 196.5 303.5 200.5L301.5 191.5z"}
+ ,
+ {"stroke":"#000000",
+ "path":"M-89.25 169L-67.25 173.75"}
+ ,
+ {"stroke":"#000000",
+ "path":"M-39 331C-39 331 -39.5 327.5 -48.5 338"}
+ ,
+ {"stroke":"#000000",
+ "path":"M-33.5 336C-33.5 336 -31.5 329.5 -38 334"}
+ ,
+ {"stroke":"#000000",
+ "path":"M20.5 344.5C20.5 344.5 22 333.5 10.5 346.5"}
+]; \ No newline at end of file
diff --git a/examples/quick/canvas/tiger/tiger.qml b/examples/quick/canvas/tiger/tiger.qml
new file mode 100644
index 0000000000..2eb1bb2106
--- /dev/null
+++ b/examples/quick/canvas/tiger/tiger.qml
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../contents"
+import "tiger.js" as Tiger
+Item {
+ id:container
+ width:360
+ height:600
+
+ Column {
+ spacing:5
+ anchors.fill:parent
+ Text { font.pointSize:25; text:"Tiger with SVG path"; anchors.horizontalCenter:parent.horizontalCenter}
+
+ Canvas {
+ id:canvas
+ width:360
+ height:360
+ smooth:true
+ renderTarget:Canvas.FramebufferObject
+ renderStrategy: Canvas.Cooperative
+ property string strokeStyle:"steelblue"
+ property string fillStyle:"yellow"
+ property bool fill:true
+ property bool stroke:true
+ property real alpha:alphaCtrl.value
+ property real scaleX : scaleXCtrl.value
+ property real scaleY : scaleYCtrl.value
+ property real rotate : rotateCtrl.value
+ property int frame:0
+
+ onFillChanged: requestPaint();
+ onStrokeChanged: requestPaint();
+ onAlphaChanged: requestPaint();
+ onScaleXChanged: requestPaint();
+ onScaleYChanged: requestPaint();
+ onRotateChanged: requestPaint();
+
+ onPainted : {
+ canvas.frame++;
+ if (canvas.frame < Tiger.tiger.length)
+ requestPaint();
+ }
+ onPaint: {
+ var ctx = canvas.getContext('2d');
+ ctx.save();
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
+ ctx.globalAlpha = canvas.alpha;
+ ctx.scale(canvas.scaleX, canvas.scaleY);
+ ctx.rotate(canvas.rotate);
+ ctx.globalCompositeOperation = "source-over";
+ ctx.translate(canvas.width/2, canvas.height/2);
+ ctx.strokeStyle = Qt.rgba(.3, .3, .3,1);
+ ctx.lineWidth = 1;
+
+
+ for (var i = 0; i < canvas.frame && i < Tiger.tiger.length; i++) {
+ if (Tiger.tiger[i].width != undefined)
+ ctx.lineWidth = Tiger.tiger[i].width;
+
+ if (Tiger.tiger[i].path != undefined)
+ ctx.path = Tiger.tiger[i].path;
+
+ if (Tiger.tiger[i].fill != undefined) {
+ ctx.fillStyle = Tiger.tiger[i].fill;
+ ctx.fill();
+ }
+
+ if (Tiger.tiger[i].stroke != undefined) {
+ ctx.strokeStyle = Tiger.tiger[i].stroke;
+ ctx.stroke();
+ }
+ }
+ ctx.restore();
+ }
+ }
+ Rectangle {
+ id:controls
+ width:360
+ height:160
+ Column {
+ spacing:3
+ Slider {id:scaleXCtrl; width:300; height:30; min:0.1; max:10; init:0.5; name:"ScaleX"}
+ Slider {id:scaleYCtrl; width:300; height:30; min:0.1; max:10; init:0.5; name:"ScaleY"}
+ Slider {id:rotateCtrl; width:300; height:30; min:0; max:Math.PI*2; init:0; name:"Rotate"}
+ Slider {id:alphaCtrl; width:300; height:30; min:0; max:1; init:1; name:"Alpha"}
+ }
+ }
+ }
+}
diff --git a/examples/quick/canvas/twitterfriends/TwitterUser.qml b/examples/quick/canvas/twitterfriends/TwitterUser.qml
new file mode 100644
index 0000000000..8b906216ef
--- /dev/null
+++ b/examples/quick/canvas/twitterfriends/TwitterUser.qml
@@ -0,0 +1,294 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id:twitterUser
+ property variant friends : [];
+ property string name : "";
+ property string twitterId : "";
+ property string image : "";
+ property string url : "";
+ property string desc : "";
+ width : 0;
+ height : 0;
+ property int posX:0;
+ property int posY:0;
+ property bool hasFocus : false;
+ property variant canvas;
+ property variant manager;
+ property variant linkColor;
+ property bool selected : false;
+
+ Rectangle {
+ id:twitterStatus
+ x:twitterUser.width
+ y:twitterUser.height
+ width:250
+ height:60
+ opacity: 0
+ border.color:"steelblue"
+ border.width:3
+ Column {
+ spacing:2
+ Text {color:"steelblue"; font.pointSize:15; width:250; height:30; text:twitterUser.name; wrapMode: Text.WrapAnywhere}
+ Text {color:"steelblue"; font.pointSize:8; width:250; height:30; text:twitterUser.url; wrapMode: Text.WrapAnywhere}
+ }
+ }
+
+ function moved() {
+ twitterUser.posX = twitterUser.x;
+ twitterUser.posY = twitterUser.y;
+ twitterUser.canvas.requestPaint();
+ }
+
+ onXChanged: moved();
+ onYChanged: moved();
+
+ MouseArea {
+ anchors.fill:parent
+ drag.target : twitterUser
+ drag.axis : Drag.XandYAxis
+
+ onClicked: {
+ if (!twitterUser.selected) {
+ twitterUser.selected = true;
+ twitterStatus.opacity = 1;
+ twitterStatus.visible = true;
+ } else {
+ twitterUser.selected = false;
+ twitterStatus.opacity = 0;
+ }
+ }
+
+ onDoubleClicked : {
+ twitterStatus.opacity = 0;
+ twitterUser.selected = false;
+ twitterUser.hasFocus = true;
+ twitterUser.canvas.twitterName = twitterUser.name;
+ twitterUser.canvas.twitterId = twitterUser.twitterId;
+ twitterUser.canvas.loading = true;
+ twitterUser.createFriends();
+ }
+ }
+
+ function show(ctx, layoutChanged) {
+ var w = canvas.width;
+ var h = canvas.height;
+ if (twitterUser.hasFocus) {
+ twitterUser.width = 60
+ twitterUser.height = 60
+ twitterUser.posX = w/2;
+ twitterUser.posY = h/2;
+ } else {
+ twitterUser.width = 40
+ twitterUser.height = 40
+ }
+
+
+ if (twitterUser.hasFocus) {
+ if (layoutChanged)
+ twitterUser.layoutFriends();
+ twitterUser.linkFriends(ctx);
+ twitterUser.showFriends(ctx);
+ ctx.shadowOffsetX = 5;
+ ctx.shadowOffsetY = 5;
+ ctx.shadowBlur = 7;
+ ctx.shadowColor = "blue";
+ ctx.globalAlpha = 1;
+ } else {
+ ctx.shadowOffsetX = 5;
+ ctx.shadowOffsetY = 5;
+ ctx.shadowBlur = 7;
+ ctx.shadowColor = twitterUser.linkColor;
+ ctx.globalAlpha = 0.6;
+ }
+
+ if (twitterUser.canvas.isImageLoaded(twitterUser.image)) {
+ ctx.drawImage(twitterUser.image, twitterUser.posX, twitterUser.posY, twitterUser.width, twitterUser.height);
+ }
+// ctx.font = "15px";
+// var nameSize = ctx.measureText(twitterUser.name).width;
+// ctx.fillText(twitterUser.name, twitterUser.posX + nameSize/2 - twitterUser.width/2, twitterUser.posY + twitterUser.height/2 + 10);
+ }
+ function dump() {
+ console.log("name:" + twitterUser.name
+ + " x:" + twitterUser.posX
+ + " y:" + twitterUser.posY
+ + " width:" + twitterUser.width
+ + " height:" + twitterUser.height
+ + " id:" + twitterUser.twitterId
+ + " image:" + twitterUser.image
+ + " url:" + twitterUser.url + "\n" + twitterUser.desc);
+ }
+
+ function layoutFriends() {
+ var w = canvas.width;
+ var h = canvas.height;
+ for (var i=0; i < twitterUser.friends.length; i++) {
+ var friend = manager.getById(twitterUser.friends[i]);
+ if (friend) {
+ friend.x = Math.random() *w;
+ friend.y = Math.random() *h;
+ }
+ }
+ }
+
+ function showFriends(ctx) {
+ var w = canvas.width;
+ var h = canvas.height;
+ for (var i=0; i < twitterUser.friends.length && i < 15; i++) {
+ var friend = manager.getById(twitterUser.friends[i]);
+ if (friend && twitterUser.canvas.isImageLoaded(friend.image)) {
+ friend.hasFocus = false;
+ friend.show(ctx, false);
+ }
+ }
+ }
+
+ function linkFriends(ctx) {
+ var w = canvas.width;
+ var h = canvas.height;
+ for (var i=0; i < twitterUser.friends.length && i < 15; i++) {
+ var friend = manager.getById(twitterUser.friends[i]);
+ if (friend && twitterUser.canvas.isImageLoaded(friend.image)) {
+ if (!friend.linkColor)
+ friend.linkColor = Qt.rgba( ((Math.random() * 200) +55)/255
+ , ((Math.random() * 200) +55)/255
+ , ((Math.random() * 200) +55)/255, 0.8);
+ ctx.strokeStyle = friend.linkColor;
+ ctx.lineWidth = 8;
+ ctx.beginPath();
+ ctx.moveTo(twitterUser.posX + twitterUser.width/2, twitterUser.posY + twitterUser.height/2);
+ ctx.lineTo(friend.x + friend.width/2, friend.y + friend.height/2);
+ ctx.stroke();
+ }
+ }
+ }
+
+
+ function create(url) {
+ var x = new XMLHttpRequest;
+ x.open("GET", url);
+
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ var user = eval('(' + x.responseText +')')[0];
+ twitterUser.name = user.name;
+ twitterUser.twitterId = user.id;
+ twitterUser.image = user.profile_image_url;
+ twitterUser.canvas.loadImage(twitterUser.image);
+ twitterUser.url = user.url;
+ twitterUser.desc = user.description;
+ twitterUser.createFriends();
+ }
+ }
+ x.send();
+ }
+
+ function createByName(name) {
+ if (twitterUser.name === "" && twitterUser.twitterId === "") {
+ twitterUser.name = name;
+ var userUrl = "http://api.twitter.com/1/users/lookup.json?stringify_ids=true&screen_name=" + name;
+ twitterUser.create(userUrl);
+ }
+ }
+
+ function createById(id) {
+ if (twitterUser.name === "" && twitterUser.twitterId === "") {
+ twitterUser.twitterId = id;
+ var userUrl = "http://api.twitter.com/1/users/lookup.json?stringify_ids=true&user_id=" + id;
+ twitterUser.create(userUrl);
+ }
+ }
+
+ function createFriends() {
+ if (twitterUser.friends.length === 0) {
+ var x = new XMLHttpRequest;
+ var friendsUrl = "https://api.twitter.com/1/friends/ids.json?cursor=-1&stringify_ids=true&user_id=" + twitterUser.twitterId;
+ x.open("GET", friendsUrl);
+
+ x.onreadystatechange = function() {
+ if (x.readyState == XMLHttpRequest.DONE) {
+ twitterUser.friends = eval('(' + x.responseText +')').ids;
+ var doRequest = false;
+ var userUrl = "http://api.twitter.com/1/users/lookup.json?stringify_ids=true&user_id=";
+
+ for (var i=0; i<twitterUser.friends.length && i < 100; i++) {
+ var friend = manager.getById(twitterUser.friends[i]);
+ if (!friend) {
+ userUrl += "," + twitterUser.friends[i];
+ doRequest = true;
+ }
+ }
+
+ if (!doRequest) return;
+
+ var xx = new XMLHttpRequest;
+ xx.open("GET", userUrl);
+ xx.onreadystatechange = function() {
+ if (xx.readyState == XMLHttpRequest.DONE) {
+ var friendUsers = eval('(' + xx.responseText +')');
+ for(var i=0; i<friendUsers.length; i++) {
+ var friend = manager.createTwitterUser(twitterUser.canvas);
+ friend.name = friendUsers[i].name;
+ friend.twitterId = friendUsers[i].id;
+ friend.image = friendUsers[i].profile_image_url ? friendUsers[i].profile_image_url : "";
+ friend.url = friendUsers[i].url ? friendUsers[i].url : "";
+ friend.desc = friendUsers[i].description ? friendUsers[i].description : "";
+ friend.manager = twitterUser.manager;
+ twitterUser.canvas.loadImage(friend.image);
+ }
+
+ if (twitterUser.hasFocus && twitterUser.canvas) {
+ twitterUser.canvas.layoutChanged = true;
+ twitterUser.canvas.loading = false;
+ twitterUser.canvas.requestPaint();
+ }
+ }
+ }
+ xx.send();
+ }
+ }
+ x.send();
+ }
+ }
+} \ No newline at end of file
diff --git a/examples/quick/canvas/twitterfriends/cache.js b/examples/quick/canvas/twitterfriends/cache.js
new file mode 100644
index 0000000000..6c8a1cd71a
--- /dev/null
+++ b/examples/quick/canvas/twitterfriends/cache.js
@@ -0,0 +1,42 @@
+var UserCache = function() {
+ this._users = [];
+}
+
+
+UserCache.prototype.getById = function(id){
+ for (var i=0; i < this._users.length; i++){
+ var user = this._users[i];
+ if (user.twitterId == id) {
+ return user;
+ }
+ }
+}
+UserCache.prototype.getByName = function(name){
+ for (var i=0; i < this._users.length; i++){
+ var user = this._users[i];
+ if (user.name == name)
+ return user;
+ }
+}
+
+UserCache.prototype.add = function(user){
+ this._users[this._users.length] = user;
+}
+
+
+var cache = new UserCache;
+
+function getById(id) {
+ return cache.getById(id);
+}
+
+function getByName(name) {
+ return cache.getByName(name);
+}
+
+function createTwitterUser(canvas) {
+ var user = Qt.createQmlObject("import QtQuick 2.0; TwitterUser{}", canvas);
+ user.canvas = canvas;
+ cache.add(user);
+ return user;
+}
diff --git a/examples/quick/canvas/twitterfriends/twitter.qml b/examples/quick/canvas/twitterfriends/twitter.qml
new file mode 100644
index 0000000000..9dc2bcc939
--- /dev/null
+++ b/examples/quick/canvas/twitterfriends/twitter.qml
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../contents"
+import "cache.js" as TwitterUserCache
+Rectangle {
+ width:360
+ height:600
+ color:"black"
+ QtObject {
+ id:twitterManager
+ function getById(id) {
+ return TwitterUserCache.cache.getById(id);
+ }
+
+ function getByName(name) {
+ return TwitterUserCache.cache.getByName(name);
+ }
+
+ function createTwitterUser(canvas) {
+ return TwitterUserCache.createTwitterUser(canvas);
+ }
+ }
+ Rectangle {
+ id:inputContainer
+ width:parent.width-4
+ height:40
+ anchors.top:parent.top
+ anchors.topMargin:4
+ anchors.horizontalCenter:parent.horizontalCenter
+ radius:8
+ border.color:"steelblue"
+ Text {
+ text:inputName.text == "" ? "Enter your twitter name..." : ""
+ id:inputLabel
+ anchors.centerIn:parent
+ font.pointSize:12
+ opacity:.5
+ color:"steelblue"
+ }
+ TextInput {
+ id:inputName
+ anchors.centerIn:parent
+ font.pointSize : 20
+ opacity:1
+ color:"steelblue"
+ width:parent.width-6
+ height:parent.height-6
+ text:""
+ autoScroll:true
+ focus:true
+ selectByMouse:true
+ onAccepted : {canvas.twitterName = text; canvas.requestPaint();}
+ }
+ }
+ Canvas {
+ id:canvas
+ width:parent.width
+ anchors.top :inputContainer.bottom
+ anchors.bottom : parent.bottom
+ smooth:true
+ renderTarget:Canvas.Image
+ renderStrategy: Canvas.Immediate
+
+ property bool layoutChanged:true
+ property string twitterName:""
+ property string twitterId:""
+ property bool loading:false
+
+ onLoadingChanged: requestPaint();
+ onWidthChanged: { layoutChanged = true; requestPaint();}
+ onHeightChanged: { layoutChanged = true; requestPaint();}
+ onTwitterNameChanged: inputName.text = twitterName;
+ onImageLoaded:requestPaint();
+ onPaint: {
+ var ctx = canvas.getContext('2d');
+ ctx.save();
+ ctx.fillStyle="black";
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+
+ if (canvas.twitterName != "" || canvas.twitterId != "") {
+ var user = canvas.twitterId ? TwitterUserCache.getById(canvas.twitterId) : TwitterUserCache.getByName(canvas.twitterName);
+ if (!user) {
+ user = TwitterUserCache.createTwitterUser(canvas);
+ user.hasFocus = true;
+ user.manager = twitterManager;
+ user.createByName(canvas.twitterName);
+ canvas.loading = true;
+ }
+
+ if (canvas.loading) {
+ ctx.font = "40px";
+ ctx.fillStyle = "steelblue";
+ ctx.fillText("Loading...", canvas.width/2 - 80, canvas.height/2);
+ } else {
+ user.show(ctx, layoutChanged);
+ }
+ layoutChanged = false;
+ }
+ ctx.restore();
+ }
+ }
+}
diff --git a/examples/quick/draganddrop/draganddrop.pro b/examples/quick/draganddrop/draganddrop.pro
new file mode 100644
index 0000000000..3f535312e0
--- /dev/null
+++ b/examples/quick/draganddrop/draganddrop.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+
+QT += quick qml
+SOURCES += main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/draganddrop
+qml.files = draganddrop.qml tiles views
+qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/draganddrop
+INSTALLS += target qml
+
diff --git a/examples/quick/draganddrop/draganddrop.qml b/examples/quick/draganddrop/draganddrop.qml
new file mode 100644
index 0000000000..88e6d5e021
--- /dev/null
+++ b/examples/quick/draganddrop/draganddrop.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../../shared" as Examples
+
+/*!
+ \title QtQuick Examples - Drag and Drop
+ \example qtquick/draganddrop
+ \brief This is a collection of QML drag and drop examples
+ \image qml-draganddrop-example.png
+
+ This is a collection of small QML examples relating to drag and drop functionality.
+
+ Tiles adds drag and drog to simple rectangles, which you can drag into a specific grid.
+
+ GridView adds drag and drog to a GridView, allowing you to reorder the list.
+*/
+
+Item {
+ height: 480
+ width: 320
+ Examples.LauncherList {
+ id: ll
+ anchors.fill: parent
+ Component.onCompleted: {
+ addExample("Tiles", "", Qt.resolvedUrl("tiles/tiles.qml"));
+ addExample("GridView", "", Qt.resolvedUrl("views/gridview.qml"));
+ }
+ }
+}
diff --git a/examples/quick/draganddrop/draganddrop.qmlproject b/examples/quick/draganddrop/draganddrop.qmlproject
new file mode 100644
index 0000000000..b8b15c3444
--- /dev/null
+++ b/examples/quick/draganddrop/draganddrop.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.0
+
+Project {
+ mainFile: "draganddrop.qml"
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/draganddrop/main.cpp b/examples/quick/draganddrop/main.cpp
new file mode 100644
index 0000000000..0d74fbfe2e
--- /dev/null
+++ b/examples/quick/draganddrop/main.cpp
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "../../shared/shared.h"
+DECLARATIVE_EXAMPLE_MAIN(draganddrop)
diff --git a/examples/quick/draganddrop/tiles/DragTile.qml b/examples/quick/draganddrop/tiles/DragTile.qml
new file mode 100644
index 0000000000..1f4a8c2bea
--- /dev/null
+++ b/examples/quick/draganddrop/tiles/DragTile.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: root
+ property string colorKey
+
+ width: 64; height: 64
+
+ MouseArea {
+ id: mouseArea
+
+ width: 64; height: 64
+ anchors.centerIn: parent
+
+ drag.target: tile
+
+ onReleased: parent = tile.Drag.target !== null ? tile.Drag.target : root
+
+ Rectangle {
+ id: tile
+
+ width: 64; height: 64
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ color: colorKey
+
+ Drag.keys: [ colorKey ]
+ Drag.active: mouseArea.drag.active
+ Drag.hotSpot.x: 32
+ Drag.hotSpot.y: 32
+
+ Text {
+ anchors.fill: parent
+ color: "white"
+ font.pixelSize: 48
+ text: modelData + 1
+ horizontalAlignment:Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ states: State {
+ when: mouseArea.drag.active
+ ParentChange { target: tile; parent: root }
+ AnchorChanges { target: tile; anchors.verticalCenter: undefined; anchors.horizontalCenter: undefined }
+ }
+ }
+ }
+}
+
diff --git a/examples/quick/draganddrop/tiles/DropTile.qml b/examples/quick/draganddrop/tiles/DropTile.qml
new file mode 100644
index 0000000000..98fedeb775
--- /dev/null
+++ b/examples/quick/draganddrop/tiles/DropTile.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+DropArea {
+ id: dragTarget
+
+ property string colorKey
+ property alias dropProxy: dragTarget
+
+ width: 64; height: 64
+ keys: [ colorKey ]
+
+ Rectangle {
+ id: dropRectangle
+
+ anchors.fill: parent
+ color: colorKey
+
+ states: [
+ State {
+ when: dragTarget.containsDrag
+ PropertyChanges {
+ target: dropRectangle
+ color: "grey"
+ }
+ }
+ ]
+ }
+}
diff --git a/examples/quick/draganddrop/tiles/tiles.qml b/examples/quick/draganddrop/tiles/tiles.qml
new file mode 100644
index 0000000000..0b5647bc2b
--- /dev/null
+++ b/examples/quick/draganddrop/tiles/tiles.qml
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ width: 320
+ height: 480
+
+ color: "black"
+
+ Grid {
+ id: redDestination
+
+ anchors.left: redSource.right; anchors.top: parent.top;
+ anchors.margins: 5
+ width: 64*3
+ height: 64*3
+ opacity: 0.5
+ columns: 3
+
+ Repeater {
+ model: 9;
+ delegate: DropTile { colorKey: "red" }
+ }
+ }
+
+ Grid {
+ anchors.right: blueSource.left; anchors.bottom: parent.bottom;
+ anchors.margins: 5
+ width: 64*3
+ height: 64*3
+
+ opacity: 0.5
+
+ columns: 3
+
+ Repeater {
+ model: 9
+ delegate: DropTile { colorKey: "blue" }
+ }
+ }
+
+ Column {
+ id: redSource
+
+ anchors.left: parent.left; anchors.top: parent.top; anchors.bottom: parent.bottom
+ anchors.margins: 5
+ width: 64
+ spacing: -16
+
+ Repeater {
+ model: 9
+ delegate: DragTile { colorKey: "red" }
+ }
+ }
+ Column {
+ id: blueSource
+
+ anchors.right: parent.right; anchors.top: parent.top; anchors.bottom: parent.bottom
+ anchors.margins: 5
+ width: 64
+ spacing: -16
+
+ Repeater {
+ model: 9
+ delegate: DragTile { colorKey: "blue" }
+ }
+ }
+}
diff --git a/examples/quick/draganddrop/views/gridview.qml b/examples/quick/draganddrop/views/gridview.qml
new file mode 100644
index 0000000000..b18078f48d
--- /dev/null
+++ b/examples/quick/draganddrop/views/gridview.qml
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+GridView {
+ id: root
+ width: 320; height: 480
+ cellWidth: 80; cellHeight: 80
+
+ displaced: Transition {
+ NumberAnimation { properties: "x,y"; easing.type: Easing.OutQuad }
+ }
+
+ model: VisualDataModel {
+ id: visualModel
+ model: ListModel {
+ id: colorModel
+ ListElement { color: "blue" }
+ ListElement { color: "green" }
+ ListElement { color: "red" }
+ ListElement { color: "yellow" }
+ ListElement { color: "orange" }
+ ListElement { color: "purple" }
+ ListElement { color: "cyan" }
+ ListElement { color: "magenta" }
+ ListElement { color: "chartreuse" }
+ ListElement { color: "aquamarine" }
+ ListElement { color: "indigo" }
+ ListElement { color: "black" }
+ ListElement { color: "lightsteelblue" }
+ ListElement { color: "violet" }
+ ListElement { color: "grey" }
+ ListElement { color: "springgreen" }
+ ListElement { color: "salmon" }
+ ListElement { color: "blanchedalmond" }
+ ListElement { color: "forestgreen" }
+ ListElement { color: "pink" }
+ ListElement { color: "navy" }
+ ListElement { color: "goldenrod" }
+ ListElement { color: "crimson" }
+ ListElement { color: "teal" }
+ }
+
+ delegate: MouseArea {
+ id: delegateRoot
+
+ property int visualIndex: VisualDataModel.itemsIndex
+
+ width: 80; height: 80
+ drag.target: icon
+
+ Rectangle {
+ id: icon
+ width: 72; height: 72
+ anchors {
+ horizontalCenter: parent.horizontalCenter;
+ verticalCenter: parent.verticalCenter
+ }
+ color: model.color
+ radius: 3
+
+ Drag.active: delegateRoot.drag.active
+ Drag.source: delegateRoot
+ Drag.hotSpot.x: 36
+ Drag.hotSpot.y: 36
+
+ states: [
+ State {
+ when: icon.Drag.active
+ ParentChange {
+ target: icon
+ parent: root
+ }
+
+ AnchorChanges {
+ target: icon;
+ anchors.horizontalCenter: undefined;
+ anchors.verticalCenter: undefined
+ }
+ }
+ ]
+ }
+
+ DropArea {
+ anchors { fill: parent; margins: 15 }
+
+ onEntered: visualModel.items.move(drag.source.visualIndex, delegateRoot.visualIndex)
+ }
+ }
+ }
+}
diff --git a/examples/quick/imageelements/animatedsprite.qml b/examples/quick/imageelements/animatedsprite.qml
new file mode 100644
index 0000000000..337456f785
--- /dev/null
+++ b/examples/quick/imageelements/animatedsprite.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+ Rectangle {
+ anchors.fill: parent
+ color: "white"
+ }
+ AnimatedSprite {
+ id: sprite
+ width: 170
+ height: 170
+ anchors.centerIn: parent
+ source: "content/speaker.png"
+ frameCount: 60
+ frameSync: true
+ frameWidth: 170
+ frameHeight: 170
+ loops: 3
+ }
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: {
+ if (!sprite.running)
+ sprite.start();
+ if (!sprite.paused)
+ sprite.pause();
+ if ( mouse.button == Qt.LeftButton ) {
+ sprite.advance(1);
+ } else {
+ sprite.advance(-1);
+ }
+ }
+ }
+}
diff --git a/examples/quick/imageelements/borderimage.qml b/examples/quick/imageelements/borderimage.qml
new file mode 100644
index 0000000000..30120fe60d
--- /dev/null
+++ b/examples/quick/imageelements/borderimage.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ id: page
+ width: 320
+ height: 480
+
+ BorderImageSelector {
+ id: selector
+ curIdx: 0
+ maxIdx: 3
+ gridWidth: 240
+ flickable: mainFlickable
+ width: parent.width
+ height: 64
+ }
+
+ Flickable {
+ id: mainFlickable
+ width: parent.width
+ anchors.bottom: parent.bottom
+ anchors.top: selector.bottom
+ interactive: false //Animated through selector control
+ contentX: -120
+ Behavior on contentX { NumberAnimation {}}
+ contentWidth: 1030
+ contentHeight: 420
+ Grid {
+ anchors.centerIn: parent; spacing: 20
+
+ MyBorderImage {
+ minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 200
+ source: "content/colors.png"; margin: 30
+ }
+
+ MyBorderImage {
+ minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 200
+ source: "content/colors.png"; margin: 30
+ horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat
+ }
+
+ MyBorderImage {
+ minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 200
+ source: "content/colors.png"; margin: 30
+ horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat
+ }
+
+ MyBorderImage {
+ minWidth: 120; maxWidth: 240; minHeight: 120; maxHeight: 200
+ source: "content/colors.png"; margin: 30
+ horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round
+ }
+
+ MyBorderImage {
+ minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
+ source: "content/bw.png"; margin: 10
+ }
+
+ MyBorderImage {
+ minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
+ source: "content/bw.png"; margin: 10
+ horizontalMode: BorderImage.Repeat; verticalMode: BorderImage.Repeat
+ }
+
+ MyBorderImage {
+ minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
+ source: "content/bw.png"; margin: 10
+ horizontalMode: BorderImage.Stretch; verticalMode: BorderImage.Repeat
+ }
+
+ MyBorderImage {
+ minWidth: 60; maxWidth: 200; minHeight: 40; maxHeight: 200
+ source: "content/bw.png"; margin: 10
+ horizontalMode: BorderImage.Round; verticalMode: BorderImage.Round
+ }
+ }
+ }
+}
diff --git a/examples/quick/imageelements/content/BearSheet.png b/examples/quick/imageelements/content/BearSheet.png
new file mode 100644
index 0000000000..a084bf0f1e
--- /dev/null
+++ b/examples/quick/imageelements/content/BearSheet.png
Binary files differ
diff --git a/examples/quick/imageelements/content/BorderImageSelector.qml b/examples/quick/imageelements/content/BorderImageSelector.qml
new file mode 100644
index 0000000000..f3a534b3cd
--- /dev/null
+++ b/examples/quick/imageelements/content/BorderImageSelector.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: selector
+ property int curIdx: 0
+ property int maxIdx: 3
+ property int gridWidth: 240
+ property Flickable flickable
+ width: parent.width
+ height: 64
+ function advance(steps) {
+ var nextIdx = curIdx + steps
+ if (nextIdx < 0 || nextIdx > maxIdx)
+ return;
+ flickable.contentX += gridWidth * steps;
+ curIdx += steps;
+ }
+ Image {
+ source: "../../../shared/images/back.png"
+ MouseArea{
+ anchors.fill: parent
+ onClicked: selector.advance(-1)
+ }
+ anchors.left: parent.left
+ anchors.leftMargin: 8
+ anchors.verticalCenter: parent.verticalCenter
+ opacity: selector.curIdx == 0 ? 0.2 : 1.0
+ Behavior on opacity {NumberAnimation{}}
+ }
+ Image {
+ source: "../../../shared/images/back.png"
+ mirror: true
+ MouseArea{
+ anchors.fill: parent
+ onClicked: selector.advance(1)
+ }
+ opacity: selector.curIdx == selector.maxIdx ? 0.2 : 1.0
+ Behavior on opacity {NumberAnimation{}}
+ anchors.right: parent.right
+ anchors.rightMargin: 8
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ Repeater {
+ model: [ "Scale", "Repeat", "Scale/Repeat", "Round" ]
+ delegate: Text {
+ text: model.modelData
+ anchors.verticalCenter: parent.verticalCenter
+
+ x: (index - selector.curIdx) * 80 + 140
+ Behavior on x { NumberAnimation{} }
+
+ opacity: selector.curIdx == index ? 1.0 : 0.0
+ Behavior on opacity { NumberAnimation{} }
+ }
+ }
+}
diff --git a/examples/quick/imageelements/content/ImageCell.qml b/examples/quick/imageelements/content/ImageCell.qml
new file mode 100644
index 0000000000..fcc6b47af5
--- /dev/null
+++ b/examples/quick/imageelements/content/ImageCell.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+Item {
+ property alias mode: image.fillMode
+ property alias caption: captionItem.text
+
+ width: parent.cellWidth; height: parent.cellHeight
+
+ Image {
+ id: image
+ width: parent.width; height: parent.height - captionItem.height
+ source: "qt-logo.png"
+ clip: true // only makes a difference if mode is PreserveAspectCrop
+ smooth: true
+ }
+
+ Text {
+ id: captionItem
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom
+ }
+}
diff --git a/examples/quick/imageelements/content/MyBorderImage.qml b/examples/quick/imageelements/content/MyBorderImage.qml
new file mode 100644
index 0000000000..93880f12bb
--- /dev/null
+++ b/examples/quick/imageelements/content/MyBorderImage.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: container
+
+ property alias horizontalMode: image.horizontalTileMode
+ property alias verticalMode: image.verticalTileMode
+ property alias source: image.source
+
+ property int minWidth
+ property int minHeight
+ property int maxWidth
+ property int maxHeight
+ property int margin
+
+ width: 240; height: 200
+
+ BorderImage {
+ id: image; anchors.centerIn: parent
+
+ SequentialAnimation on width {
+ loops: Animation.Infinite
+ NumberAnimation {
+ from: container.minWidth; to: container.maxWidth
+ duration: 2000; easing.type: Easing.InOutQuad
+ }
+ NumberAnimation {
+ from: container.maxWidth; to: container.minWidth
+ duration: 2000; easing.type: Easing.InOutQuad
+ }
+ }
+
+ SequentialAnimation on height {
+ loops: Animation.Infinite
+ NumberAnimation {
+ from: container.minHeight; to: container.maxHeight
+ duration: 2000; easing.type: Easing.InOutQuad
+ }
+ NumberAnimation {
+ from: container.maxHeight; to: container.minHeight
+ duration: 2000; easing.type: Easing.InOutQuad
+ }
+ }
+
+ border.top: container.margin
+ border.left: container.margin
+ border.bottom: container.margin
+ border.right: container.margin
+ }
+}
diff --git a/examples/quick/imageelements/content/ShadowRectangle.qml b/examples/quick/imageelements/content/ShadowRectangle.qml
new file mode 100644
index 0000000000..e6fd13bb26
--- /dev/null
+++ b/examples/quick/imageelements/content/ShadowRectangle.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ property alias color : rectangle.color
+
+ BorderImage {
+ anchors.fill: rectangle
+ anchors { leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8 }
+ border { left: 10; top: 10; right: 10; bottom: 10 }
+ source: "shadow.png"; smooth: true
+ }
+
+ Rectangle { id: rectangle; anchors.fill: parent }
+}
diff --git a/examples/quick/imageelements/content/bw.png b/examples/quick/imageelements/content/bw.png
new file mode 100644
index 0000000000..486eaae96e
--- /dev/null
+++ b/examples/quick/imageelements/content/bw.png
Binary files differ
diff --git a/examples/quick/imageelements/content/colors-round.sci b/examples/quick/imageelements/content/colors-round.sci
new file mode 100644
index 0000000000..506f6f5f99
--- /dev/null
+++ b/examples/quick/imageelements/content/colors-round.sci
@@ -0,0 +1,7 @@
+border.left:30
+border.top:30
+border.right:30
+border.bottom:30
+horizontalTileRule:Round
+verticalTileRule:Round
+source:colors.png
diff --git a/examples/quick/imageelements/content/colors-stretch.sci b/examples/quick/imageelements/content/colors-stretch.sci
new file mode 100644
index 0000000000..e4989a723c
--- /dev/null
+++ b/examples/quick/imageelements/content/colors-stretch.sci
@@ -0,0 +1,5 @@
+border.left:30
+border.top:30
+border.right:30
+border.bottom:30
+source:colors.png
diff --git a/examples/quick/imageelements/content/colors.png b/examples/quick/imageelements/content/colors.png
new file mode 100644
index 0000000000..dfb62f3d64
--- /dev/null
+++ b/examples/quick/imageelements/content/colors.png
Binary files differ
diff --git a/examples/quick/imageelements/content/qt-logo.png b/examples/quick/imageelements/content/qt-logo.png
new file mode 100644
index 0000000000..14ddf2a028
--- /dev/null
+++ b/examples/quick/imageelements/content/qt-logo.png
Binary files differ
diff --git a/examples/quick/imageelements/content/shadow.png b/examples/quick/imageelements/content/shadow.png
new file mode 100644
index 0000000000..431af8545d
--- /dev/null
+++ b/examples/quick/imageelements/content/shadow.png
Binary files differ
diff --git a/examples/quick/imageelements/content/speaker.png b/examples/quick/imageelements/content/speaker.png
new file mode 100644
index 0000000000..fb0e857859
--- /dev/null
+++ b/examples/quick/imageelements/content/speaker.png
Binary files differ
diff --git a/examples/quick/imageelements/image.qml b/examples/quick/imageelements/image.qml
new file mode 100644
index 0000000000..ccefaf6b74
--- /dev/null
+++ b/examples/quick/imageelements/image.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ width: 320
+ height: 480
+ Grid {
+ property int cellWidth: (width - (spacing * (columns - 1))) / columns
+ property int cellHeight: (height - (spacing * (rows - 1))) / rows
+
+ anchors.fill: parent
+ anchors.margins: 30
+
+ columns: 2
+ rows: 3
+ spacing: 30
+
+ ImageCell { mode: Image.Stretch; caption: "Stretch" }
+ ImageCell { mode: Image.PreserveAspectFit; caption: "PreserveAspectFit" }
+ ImageCell { mode: Image.PreserveAspectCrop; caption: "PreserveAspectCrop" }
+
+ ImageCell { mode: Image.Tile; caption: "Tile" }
+ ImageCell { mode: Image.TileHorizontally; caption: "TileHorizontally" }
+ ImageCell { mode: Image.TileVertically; caption: "TileVertically" }
+ }
+}
diff --git a/examples/quick/imageelements/imageelements.pro b/examples/quick/imageelements/imageelements.pro
new file mode 100644
index 0000000000..89abac6e25
--- /dev/null
+++ b/examples/quick/imageelements/imageelements.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+
+QT += quick qml
+SOURCES += main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/imageelements
+qml.files = borderimage.qml content imageelements.qml image.qml shadows.qml simplesprite.qml spriteimage.qml
+qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qtquick/imageelements
+INSTALLS += target qml
+
diff --git a/examples/quick/imageelements/imageelements.qml b/examples/quick/imageelements/imageelements.qml
new file mode 100644
index 0000000000..bb23ef6979
--- /dev/null
+++ b/examples/quick/imageelements/imageelements.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../../shared"
+
+/*!
+ \title QML Examples - Image Elements
+ \example declarative/imageelements
+ \brief This is a collection of QML examples
+ \image qml-imageelements-example.png
+
+ This is a collection of small QML examples relating to image elements.
+
+ BorderImage shows off the various scaling modes of the BorderImage item.
+
+ Image shows off the various tiling modes of the Image item.
+
+ Shadows shows how to create a drop shadow for a rectangle using a BorderImage.
+
+ AnimatedSprite shows a simple use for the AnimatedSprite element.
+
+ SpriteSequence demonstrates using the SpriteSequence element to draw an animated and slightly interactive bear.
+*/
+
+Item {
+ height: 480
+ width: 320
+ LauncherList {
+ id: ll
+ anchors.fill: parent
+ Component.onCompleted: {
+ addExample("BorderImage", "An image with scaled borders", Qt.resolvedUrl("borderimage.qml"));
+ addExample("Image", "A showcase of the options available to Image", Qt.resolvedUrl("image.qml"));
+ addExample("Shadows", "Rectangles with a drop-shadow effect", Qt.resolvedUrl("shadows.qml"));
+ addExample("AnimatedSprite", "A simple sprite-based animation", Qt.resolvedUrl("animatedsprite.qml"));
+ addExample("SpriteSequence", "A sprite-based animation with complex transitions", Qt.resolvedUrl("spritesequence.qml"));
+ }
+ }
+}
diff --git a/examples/quick/imageelements/imageelements.qmlproject b/examples/quick/imageelements/imageelements.qmlproject
new file mode 100644
index 0000000000..4292a0c112
--- /dev/null
+++ b/examples/quick/imageelements/imageelements.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "imageelements.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/imageelements/main.cpp b/examples/quick/imageelements/main.cpp
new file mode 100644
index 0000000000..72850f93c1
--- /dev/null
+++ b/examples/quick/imageelements/main.cpp
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "../../shared/shared.h"
+DECLARATIVE_EXAMPLE_MAIN(imageelements)
diff --git a/examples/quick/imageelements/shadows.qml b/examples/quick/imageelements/shadows.qml
new file mode 100644
index 0000000000..aa5022ab36
--- /dev/null
+++ b/examples/quick/imageelements/shadows.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ id: window
+
+ width: 480; height: 320
+ color: "gray"
+
+ ShadowRectangle {
+ anchors.centerIn: parent; width: 250; height: 250
+ color: "lightsteelblue"
+ }
+
+ ShadowRectangle {
+ anchors.centerIn: parent; width: 200; height: 200
+ color: "steelblue"
+ }
+
+ ShadowRectangle {
+ anchors.centerIn: parent; width: 150; height: 150
+ color: "thistle"
+ }
+}
diff --git a/examples/quick/imageelements/spritesequence.qml b/examples/quick/imageelements/spritesequence.qml
new file mode 100644
index 0000000000..01f34e5c7a
--- /dev/null
+++ b/examples/quick/imageelements/spritesequence.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+Item {
+ width: 320
+ height: 480
+ MouseArea {
+ onClicked: anim.start();
+ anchors.fill: parent
+ }
+ SequentialAnimation {
+ id: anim
+ ScriptAction { script: image.goalSprite = "falling"; }
+ NumberAnimation { target: image; property: "y"; to: 480; duration: 12000; }
+ ScriptAction { script: {image.goalSprite = ""; image.jumpTo("still");} }
+ PropertyAction { target: image; property: "y"; value: 0 }
+ }
+ SpriteSequence {
+ id: image
+ width: 256
+ height: 256
+ anchors.horizontalCenter: parent.horizontalCenter
+ interpolate: false
+ goalSprite: ""
+ Sprite{
+ name: "still"
+ source: "content/BearSheet.png"
+ frameCount: 1
+ frameWidth: 256
+ frameHeight: 256
+ frameDuration: 100
+ to: {"still":1, "blink":0.1, "floating":0}
+ }
+ Sprite{
+ name: "blink"
+ source: "content/BearSheet.png"
+ frameCount: 3
+ frameX: 256
+ frameY: 1536
+ frameWidth: 256
+ frameHeight: 256
+ frameDuration: 100
+ to: {"still":1}
+ }
+ Sprite{
+ name: "floating"
+ source: "content/BearSheet.png"
+ frameCount: 9
+ frameX: 0
+ frameY: 0
+ frameWidth: 256
+ frameHeight: 256
+ frameDuration: 160
+ to: {"still":0, "flailing":1}
+ }
+ Sprite{
+ name: "flailing"
+ source: "content/BearSheet.png"
+ frameCount: 8
+ frameX: 0
+ frameY: 768
+ frameWidth: 256
+ frameHeight: 256
+ frameDuration: 160
+ to: {"falling":1}
+ }
+ Sprite{
+ name: "falling"
+ source: "content/BearSheet.png"
+ frameCount: 5
+ frameY: 1280
+ frameWidth: 256
+ frameHeight: 256
+ frameDuration: 160
+ to: {"falling":1}
+ }
+ }
+}
diff --git a/examples/quick/keyinteraction/focus/Core/ContextMenu.qml b/examples/quick/keyinteraction/focus/Core/ContextMenu.qml
new file mode 100644
index 0000000000..dc68aa2b30
--- /dev/null
+++ b/examples/quick/keyinteraction/focus/Core/ContextMenu.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+FocusScope {
+ id: container
+
+ property bool open: false
+
+ Item {
+ anchors.fill: parent
+
+ Rectangle {
+ anchors.fill: parent
+ color: "#D1DBBD"
+ focus: true
+ Keys.onRightPressed: mainView.focus = true
+
+ Text {
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; margins: 30 }
+ color: "black"
+ font.pixelSize: 14
+ text: "Context Menu"
+ }
+ }
+ }
+}
diff --git a/examples/quick/keyinteraction/focus/Core/GridMenu.qml b/examples/quick/keyinteraction/focus/Core/GridMenu.qml
new file mode 100644
index 0000000000..75bbe682af
--- /dev/null
+++ b/examples/quick/keyinteraction/focus/Core/GridMenu.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+FocusScope {
+ property alias interactive: gridView.interactive
+
+ onActiveFocusChanged: {
+ if (activeFocus)
+ mainView.state = ""
+ }
+
+ Rectangle {
+ anchors.fill: parent
+ clip: true
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#193441" }
+ GradientStop { position: 1.0; color: Qt.darker("#193441") }
+ }
+
+ GridView {
+ id: gridView
+ anchors.fill: parent; anchors.leftMargin: 20; anchors.rightMargin: 20
+ cellWidth: 152; cellHeight: 152
+ focus: true
+ model: 12
+
+ KeyNavigation.down: listMenu
+ KeyNavigation.left: contextMenu
+
+ delegate: Item {
+ id: container
+ width: GridView.view.cellWidth; height: GridView.view.cellHeight
+
+ Rectangle {
+ id: content
+ color: "transparent"
+ smooth: true
+ anchors.fill: parent; anchors.margins: 20; radius: 10
+
+ Rectangle { color: "#91AA9D"; anchors.fill: parent; anchors.margins: 3; radius: 8; smooth: true }
+ Image { source: "images/qt-logo.png"; anchors.centerIn: parent; smooth: true }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+
+ onClicked: {
+ container.GridView.view.currentIndex = index
+ container.forceActiveFocus()
+ }
+ }
+
+ states: State {
+ name: "active"; when: container.activeFocus
+ PropertyChanges { target: content; color: "#FCFFF5"; scale: 1.1 }
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "scale"; duration: 100 }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quick/keyinteraction/focus/Core/ListMenu.qml b/examples/quick/keyinteraction/focus/Core/ListMenu.qml
new file mode 100644
index 0000000000..7a62f33428
--- /dev/null
+++ b/examples/quick/keyinteraction/focus/Core/ListMenu.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+FocusScope {
+ clip: true
+
+ onActiveFocusChanged: {
+ if (activeFocus)
+ mainView.state = "showListViews"
+ }
+
+ ListView {
+ id: list1
+ y: activeFocus ? 10 : 40; width: parent.width / 3; height: parent.height - 20
+ focus: true
+ KeyNavigation.up: gridMenu; KeyNavigation.left: contextMenu; KeyNavigation.right: list2
+ model: 10; cacheBuffer: 200
+ delegate: ListViewDelegate {}
+
+ Behavior on y {
+ NumberAnimation { duration: 600; easing.type: Easing.OutQuint }
+ }
+ }
+
+ ListView {
+ id: list2
+ y: activeFocus ? 10 : 40; x: parseInt(parent.width / 3); width: parent.width / 3; height: parent.height - 20
+ KeyNavigation.up: gridMenu; KeyNavigation.left: list1; KeyNavigation.right: list3
+ model: 10; cacheBuffer: 200
+ delegate: ListViewDelegate {}
+
+ Behavior on y {
+ NumberAnimation { duration: 600; easing.type: Easing.OutQuint }
+ }
+ }
+
+ ListView {
+ id: list3
+ y: activeFocus ? 10 : 40; x: parseInt(2 * parent.width / 3); width: parent.width / 3; height: parent.height - 20
+ KeyNavigation.up: gridMenu; KeyNavigation.left: list2
+ model: 10; cacheBuffer: 200
+ delegate: ListViewDelegate {}
+
+ Behavior on y {
+ NumberAnimation { duration: 600; easing.type: Easing.OutQuint }
+ }
+ }
+
+ Rectangle { width: parent.width; height: 1; color: "#D1DBBD" }
+
+ Rectangle {
+ y: 1; width: parent.width; height: 10
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#3E606F" }
+ GradientStop { position: 1.0; color: "transparent" }
+ }
+ }
+
+ Rectangle {
+ y: parent.height - 10; width: parent.width; height: 10
+ gradient: Gradient {
+ GradientStop { position: 1.0; color: "#3E606F" }
+ GradientStop { position: 0.0; color: "transparent" }
+ }
+ }
+}
diff --git a/examples/quick/keyinteraction/focus/Core/ListViewDelegate.qml b/examples/quick/keyinteraction/focus/Core/ListViewDelegate.qml
new file mode 100644
index 0000000000..b28b02616d
--- /dev/null
+++ b/examples/quick/keyinteraction/focus/Core/ListViewDelegate.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: container
+ width: ListView.view.width; height: 60; anchors.leftMargin: 10; anchors.rightMargin: 10
+
+ Rectangle {
+ id: content
+ anchors.centerIn: parent; width: container.width - 40; height: container.height - 10
+ color: "transparent"
+ smooth: true
+ radius: 10
+
+ Rectangle { anchors.fill: parent; anchors.margins: 3; color: "#91AA9D"; smooth: true; radius: 8 }
+ }
+
+ Text {
+ id: label
+ anchors.centerIn: content
+ text: "List element " + (index + 1)
+ color: "#193441"
+ font.pixelSize: 14
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ hoverEnabled: true
+
+ onClicked: {
+ container.ListView.view.currentIndex = index
+ container.forceActiveFocus()
+ }
+ }
+
+ states: State {
+ name: "active"; when: container.activeFocus
+ PropertyChanges { target: content; color: "#FCFFF5"; scale: 1.1 }
+ PropertyChanges { target: label; font.pixelSize: 16 }
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "scale"; duration: 100 }
+ }
+}
diff --git a/examples/quick/keyinteraction/focus/Core/images/arrow.png b/examples/quick/keyinteraction/focus/Core/images/arrow.png
new file mode 100644
index 0000000000..14978c2e56
--- /dev/null
+++ b/examples/quick/keyinteraction/focus/Core/images/arrow.png
Binary files differ
diff --git a/examples/quick/keyinteraction/focus/Core/images/qt-logo.png b/examples/quick/keyinteraction/focus/Core/images/qt-logo.png
new file mode 100644
index 0000000000..14ddf2a028
--- /dev/null
+++ b/examples/quick/keyinteraction/focus/Core/images/qt-logo.png
Binary files differ
diff --git a/examples/quick/keyinteraction/focus/focus.qml b/examples/quick/keyinteraction/focus/focus.qml
new file mode 100644
index 0000000000..9300ad4f6e
--- /dev/null
+++ b/examples/quick/keyinteraction/focus/focus.qml
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "Core"
+
+Rectangle {
+ id: window
+
+ width: 800; height: 480
+ color: "#3E606F"
+
+ FocusScope {
+ id: mainView
+
+ width: parent.width; height: parent.height
+ focus: true
+
+ GridMenu {
+ id: gridMenu
+ width: parent.width; height: 320
+
+ focus: true
+ interactive: parent.activeFocus
+ }
+
+ ListMenu {
+ id: listMenu
+ y: 320; width: parent.width; height: 320
+ }
+
+ Rectangle {
+ id: shade
+ anchors.fill: parent
+ color: "black"
+ opacity: 0
+ }
+
+ states: State {
+ name: "showListViews"
+ PropertyChanges { target: gridMenu; y: -160 }
+ PropertyChanges { target: listMenu; y: 160 }
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "y"; duration: 600; easing.type: Easing.OutQuint }
+ }
+ }
+
+ Image {
+ source: "Core/images/arrow.png"
+ rotation: 90
+ anchors.verticalCenter: parent.verticalCenter
+
+ MouseArea {
+ anchors.fill: parent; anchors.margins: -10
+ onClicked: contextMenu.focus = true
+ }
+ }
+
+ ContextMenu { id: contextMenu; x: -265; width: 260; height: parent.height }
+
+ states: State {
+ name: "contextMenuOpen"
+ when: !mainView.activeFocus
+ PropertyChanges { target: contextMenu; x: 0; open: true }
+ PropertyChanges { target: mainView; x: 130 }
+ PropertyChanges { target: shade; opacity: 0.25 }
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "x,opacity"; duration: 600; easing.type: Easing.OutQuint }
+ }
+}
diff --git a/examples/quick/modelviews/abstractitemmodel/abstractitemmodel.pro b/examples/quick/modelviews/abstractitemmodel/abstractitemmodel.pro
new file mode 100644
index 0000000000..f786d9356f
--- /dev/null
+++ b/examples/quick/modelviews/abstractitemmodel/abstractitemmodel.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+TARGET = abstractitemmodel
+DEPENDPATH += .
+INCLUDEPATH += .
+QT += qml quick
+
+HEADERS = model.h
+SOURCES = main.cpp \
+ model.cpp
+RESOURCES += abstractitemmodel.qrc
diff --git a/examples/quick/modelviews/abstractitemmodel/abstractitemmodel.qrc b/examples/quick/modelviews/abstractitemmodel/abstractitemmodel.qrc
new file mode 100644
index 0000000000..4ae861cb3d
--- /dev/null
+++ b/examples/quick/modelviews/abstractitemmodel/abstractitemmodel.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>view.qml</file>
+</qresource>
+</RCC>
+
diff --git a/examples/quick/modelviews/abstractitemmodel/main.cpp b/examples/quick/modelviews/abstractitemmodel/main.cpp
new file mode 100644
index 0000000000..f5930ce840
--- /dev/null
+++ b/examples/quick/modelviews/abstractitemmodel/main.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "model.h"
+
+#include <QGuiApplication>
+#include <qqmlengine.h>
+#include <qqmlcontext.h>
+#include <qqml.h>
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/qquickview.h>
+
+//![0]
+int main(int argc, char ** argv)
+{
+ QGuiApplication app(argc, argv);
+
+ AnimalModel model;
+ model.addAnimal(Animal("Wolf", "Medium"));
+ model.addAnimal(Animal("Polar bear", "Large"));
+ model.addAnimal(Animal("Quoll", "Small"));
+
+ QQuickView view;
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", &model);
+//![0]
+
+ view.setSource(QUrl("qrc:view.qml"));
+ view.show();
+
+ return app.exec();
+}
+
diff --git a/examples/quick/modelviews/abstractitemmodel/model.cpp b/examples/quick/modelviews/abstractitemmodel/model.cpp
new file mode 100644
index 0000000000..8f7649c0d4
--- /dev/null
+++ b/examples/quick/modelviews/abstractitemmodel/model.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "model.h"
+
+Animal::Animal(const QString &type, const QString &size)
+ : m_type(type), m_size(size)
+{
+}
+
+QString Animal::type() const
+{
+ return m_type;
+}
+
+QString Animal::size() const
+{
+ return m_size;
+}
+
+//![0]
+AnimalModel::AnimalModel(QObject *parent)
+ : QAbstractListModel(parent)
+{
+ QHash<int, QByteArray> roles;
+ roles[TypeRole] = "type";
+ roles[SizeRole] = "size";
+ setRoleNames(roles);
+}
+//![0]
+
+void AnimalModel::addAnimal(const Animal &animal)
+{
+ beginInsertRows(QModelIndex(), rowCount(), rowCount());
+ m_animals << animal;
+ endInsertRows();
+}
+
+int AnimalModel::rowCount(const QModelIndex & parent) const {
+ return m_animals.count();
+}
+
+QVariant AnimalModel::data(const QModelIndex & index, int role) const {
+ if (index.row() < 0 || index.row() >= m_animals.count())
+ return QVariant();
+
+ const Animal &animal = m_animals[index.row()];
+ if (role == TypeRole)
+ return animal.type();
+ else if (role == SizeRole)
+ return animal.size();
+ return QVariant();
+}
+
diff --git a/examples/quick/modelviews/abstractitemmodel/model.h b/examples/quick/modelviews/abstractitemmodel/model.h
new file mode 100644
index 0000000000..1378c4487e
--- /dev/null
+++ b/examples/quick/modelviews/abstractitemmodel/model.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QAbstractListModel>
+#include <QStringList>
+
+//![0]
+class Animal
+{
+public:
+ Animal(const QString &type, const QString &size);
+//![0]
+
+ QString type() const;
+ QString size() const;
+
+private:
+ QString m_type;
+ QString m_size;
+//![1]
+};
+
+class AnimalModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ enum AnimalRoles {
+ TypeRole = Qt::UserRole + 1,
+ SizeRole
+ };
+
+ AnimalModel(QObject *parent = 0);
+//![1]
+
+ void addAnimal(const Animal &animal);
+
+ int rowCount(const QModelIndex & parent = QModelIndex()) const;
+
+ QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
+
+private:
+ QList<Animal> m_animals;
+//![2]
+};
+//![2]
+
+
diff --git a/examples/quick/modelviews/abstractitemmodel/view.qml b/examples/quick/modelviews/abstractitemmodel/view.qml
new file mode 100644
index 0000000000..64f5871d4b
--- /dev/null
+++ b/examples/quick/modelviews/abstractitemmodel/view.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+//![0]
+ListView {
+ width: 200; height: 250
+
+ model: myModel
+ delegate: Text { text: "Animal: " + type + ", " + size }
+}
+//![0]
+
diff --git a/examples/quick/modelviews/gridview/gridview-example.qml b/examples/quick/modelviews/gridview/gridview-example.qml
new file mode 100644
index 0000000000..ea3bb5cec9
--- /dev/null
+++ b/examples/quick/modelviews/gridview/gridview-example.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 300; height: 400
+ color: "white"
+
+ ListModel {
+ id: appModel
+ ListElement { name: "Music"; icon: "pics/AudioPlayer_48.png" }
+ ListElement { name: "Movies"; icon: "pics/VideoPlayer_48.png" }
+ ListElement { name: "Camera"; icon: "pics/Camera_48.png" }
+ ListElement { name: "Calendar"; icon: "pics/DateBook_48.png" }
+ ListElement { name: "Messaging"; icon: "pics/EMail_48.png" }
+ ListElement { name: "Todo List"; icon: "pics/TodoList_48.png" }
+ ListElement { name: "Contacts"; icon: "pics/AddressBook_48.png" }
+ }
+
+ Component {
+ id: appDelegate
+
+ Item {
+ width: 100; height: 100
+
+ Image {
+ id: myIcon
+ y: 20; anchors.horizontalCenter: parent.horizontalCenter
+ source: icon
+ }
+ Text {
+ anchors { top: myIcon.bottom; horizontalCenter: parent.horizontalCenter }
+ text: name
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: parent.GridView.view.currentIndex = index
+ }
+ }
+ }
+
+ Component {
+ id: appHighlight
+ Rectangle { width: 80; height: 80; color: "lightsteelblue" }
+ }
+
+ GridView {
+ anchors.fill: parent
+ cellWidth: 100; cellHeight: 100
+ highlight: appHighlight
+ focus: true
+ model: appModel
+ delegate: appDelegate
+ }
+}
diff --git a/examples/quick/modelviews/gridview/pics/AddressBook_48.png b/examples/quick/modelviews/gridview/pics/AddressBook_48.png
new file mode 100644
index 0000000000..1ab7c8eec1
--- /dev/null
+++ b/examples/quick/modelviews/gridview/pics/AddressBook_48.png
Binary files differ
diff --git a/examples/quick/modelviews/gridview/pics/AudioPlayer_48.png b/examples/quick/modelviews/gridview/pics/AudioPlayer_48.png
new file mode 100644
index 0000000000..f4b8689f87
--- /dev/null
+++ b/examples/quick/modelviews/gridview/pics/AudioPlayer_48.png
Binary files differ
diff --git a/examples/quick/modelviews/gridview/pics/Camera_48.png b/examples/quick/modelviews/gridview/pics/Camera_48.png
new file mode 100644
index 0000000000..c76b524945
--- /dev/null
+++ b/examples/quick/modelviews/gridview/pics/Camera_48.png
Binary files differ
diff --git a/examples/quick/modelviews/gridview/pics/DateBook_48.png b/examples/quick/modelviews/gridview/pics/DateBook_48.png
new file mode 100644
index 0000000000..58f5787fb8
--- /dev/null
+++ b/examples/quick/modelviews/gridview/pics/DateBook_48.png
Binary files differ
diff --git a/examples/quick/modelviews/gridview/pics/EMail_48.png b/examples/quick/modelviews/gridview/pics/EMail_48.png
new file mode 100644
index 0000000000..d6d84a61be
--- /dev/null
+++ b/examples/quick/modelviews/gridview/pics/EMail_48.png
Binary files differ
diff --git a/examples/quick/modelviews/gridview/pics/TodoList_48.png b/examples/quick/modelviews/gridview/pics/TodoList_48.png
new file mode 100644
index 0000000000..0988448d9b
--- /dev/null
+++ b/examples/quick/modelviews/gridview/pics/TodoList_48.png
Binary files differ
diff --git a/examples/quick/modelviews/gridview/pics/VideoPlayer_48.png b/examples/quick/modelviews/gridview/pics/VideoPlayer_48.png
new file mode 100644
index 0000000000..52638c50a7
--- /dev/null
+++ b/examples/quick/modelviews/gridview/pics/VideoPlayer_48.png
Binary files differ
diff --git a/examples/quick/modelviews/listview/content/PetsModel.qml b/examples/quick/modelviews/listview/content/PetsModel.qml
new file mode 100644
index 0000000000..4f2087d95e
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/PetsModel.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+ListModel {
+ ListElement {
+ name: "Polly"
+ type: "Parrot"
+ age: 12
+ size: "Small"
+ }
+ ListElement {
+ name: "Penny"
+ type: "Turtle"
+ age: 4
+ size: "Small"
+ }
+ ListElement {
+ name: "Warren"
+ type: "Rabbit"
+ age: 2
+ size: "Small"
+ }
+ ListElement {
+ name: "Spot"
+ type: "Dog"
+ age: 9
+ size: "Medium"
+ }
+ ListElement {
+ name: "Schrödinger"
+ type: "Cat"
+ age: 2
+ size: "Medium"
+ }
+ ListElement {
+ name: "Joey"
+ type: "Kangaroo"
+ age: 1
+ size: "Medium"
+ }
+ ListElement {
+ name: "Kimba"
+ type: "Bunny"
+ age: 65
+ size: "Large"
+ }
+ ListElement {
+ name: "Rover"
+ type: "Dog"
+ age: 5
+ size: "Large"
+ }
+ ListElement {
+ name: "Tiny"
+ type: "Elephant"
+ age: 15
+ size: "Large"
+ }
+}
diff --git a/examples/quick/modelviews/listview/content/PressAndHoldButton.qml b/examples/quick/modelviews/listview/content/PressAndHoldButton.qml
new file mode 100644
index 0000000000..b20d8f64f1
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/PressAndHoldButton.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Image {
+ id: container
+
+ property int repeatDelay: 300
+ property int repeatDuration: 75
+ property bool pressed: false
+
+ signal clicked
+
+ scale: pressed ? 0.9 : 1
+
+ function release() {
+ autoRepeatClicks.stop()
+ container.pressed = false
+ }
+
+ SequentialAnimation on pressed {
+ id: autoRepeatClicks
+ running: false
+
+ PropertyAction { target: container; property: "pressed"; value: true }
+ ScriptAction { script: container.clicked() }
+ PauseAnimation { duration: repeatDelay }
+
+ SequentialAnimation {
+ loops: Animation.Infinite
+ ScriptAction { script: container.clicked() }
+ PauseAnimation { duration: repeatDuration }
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+
+ onPressed: autoRepeatClicks.start()
+ onReleased: container.release()
+ onCanceled: container.release()
+ }
+}
+
diff --git a/examples/quick/modelviews/listview/content/RecipesModel.qml b/examples/quick/modelviews/listview/content/RecipesModel.qml
new file mode 100644
index 0000000000..86210ba436
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/RecipesModel.qml
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+ListModel {
+ ListElement {
+ title: "Pancakes"
+ picture: "content/pics/pancakes.jpg"
+ ingredients: "<html>
+ <ul>
+ <li> 1 cup (150g) self-raising flour
+ <li> 1 tbs caster sugar
+ <li> 3/4 cup (185ml) milk
+ <li> 1 egg
+ </ul>
+ </html>"
+ method: "<html>
+ <ol>
+ <li> Sift flour and sugar together into a bowl. Add a pinch of salt.
+ <li> Beat milk and egg together, then add to dry ingredients. Beat until smooth.
+ <li> Pour mixture into a pan on medium heat and cook until bubbles appear on the surface.
+ <li> Turn over and cook other side until golden.
+ </ol>
+ </html>"
+ }
+ ListElement {
+ title: "Fruit Salad"
+ picture: "content/pics/fruit-salad.jpg"
+ ingredients: "* Seasonal Fruit"
+ method: "* Chop fruit and place in a bowl."
+ }
+ ListElement {
+ title: "Vegetable Soup"
+ picture: "content/pics/vegetable-soup.jpg"
+ ingredients: "<html>
+ <ul>
+ <li> 1 onion
+ <li> 1 turnip
+ <li> 1 potato
+ <li> 1 carrot
+ <li> 1 head of celery
+ <li> 1 1/2 litres of water
+ </ul>
+ </html>"
+ method: "<html>
+ <ol>
+ <li> Chop vegetables.
+ <li> Boil in water until vegetables soften.
+ <li> Season with salt and pepper to taste.
+ </ol>
+ </html>"
+ }
+ ListElement {
+ title: "Hamburger"
+ picture: "content/pics/hamburger.jpg"
+ ingredients: "<html>
+ <ul>
+ <li> 500g minced beef
+ <li> Seasoning
+ <li> lettuce, tomato, onion, cheese
+ <li> 1 hamburger bun for each burger
+ </ul>
+ </html>"
+ method: "<html>
+ <ol>
+ <li> Mix the beef, together with seasoning, in a food processor.
+ <li> Shape the beef into burgers.
+ <li> Grill the burgers for about 5 mins on each side (until cooked through)
+ <li> Serve each burger on a bun with ketchup, cheese, lettuce, tomato and onion.
+ </ol>
+ </html>"
+ }
+ ListElement {
+ title: "Lemonade"
+ picture: "content/pics/lemonade.jpg"
+ ingredients: "<html>
+ <ul>
+ <li> 1 cup Lemon Juice
+ <li> 1 cup Sugar
+ <li> 6 Cups of Water (2 cups warm water, 4 cups cold water)
+ </ul>
+ </html>"
+ method: "<html>
+ <ol>
+ <li> Pour 2 cups of warm water into a pitcher and stir in sugar until it dissolves.
+ <li> Pour in lemon juice, stir again, and add 4 cups of cold water.
+ <li> Chill or serve over ice cubes.
+ </ol>
+ </html>"
+ }
+}
diff --git a/examples/quick/modelviews/listview/content/TextButton.qml b/examples/quick/modelviews/listview/content/TextButton.qml
new file mode 100644
index 0000000000..980ee21553
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/TextButton.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+
+ property alias text: label.text
+
+ signal clicked
+
+ width: label.width + 20; height: label.height + 6
+ smooth: true
+ radius: 10
+
+ gradient: Gradient {
+ GradientStop { id: gradientStop; position: 0.0; color: palette.light }
+ GradientStop { position: 1.0; color: palette.button }
+ }
+
+ SystemPalette { id: palette }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: { container.clicked() }
+ }
+
+ Text {
+ id: label
+ anchors.centerIn: parent
+ }
+
+ states: State {
+ name: "pressed"
+ when: mouseArea.pressed
+ PropertyChanges { target: gradientStop; color: palette.dark }
+ }
+}
+
diff --git a/examples/quick/modelviews/listview/content/ToggleButton.qml b/examples/quick/modelviews/listview/content/ToggleButton.qml
new file mode 100644
index 0000000000..52f4988f03
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/ToggleButton.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ property alias label: text.text
+ property bool active: false
+ signal toggled
+ width: 149
+ height: 30
+ radius: 3
+ color: active ? "green" : "lightgray"
+ border.width: 1
+ Text { id: text; anchors.centerIn: parent; font.pixelSize: 14 }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { active = !active; root.toggled() }
+ }
+}
diff --git a/examples/quick/modelviews/listview/content/pics/arrow-down.png b/examples/quick/modelviews/listview/content/pics/arrow-down.png
new file mode 100644
index 0000000000..29d1d4439a
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/pics/arrow-down.png
Binary files differ
diff --git a/examples/quick/modelviews/listview/content/pics/arrow-up.png b/examples/quick/modelviews/listview/content/pics/arrow-up.png
new file mode 100644
index 0000000000..e437312217
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/pics/arrow-up.png
Binary files differ
diff --git a/examples/quick/modelviews/listview/content/pics/fruit-salad.jpg b/examples/quick/modelviews/listview/content/pics/fruit-salad.jpg
new file mode 100644
index 0000000000..da5a6b10a2
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/pics/fruit-salad.jpg
Binary files differ
diff --git a/examples/quick/modelviews/listview/content/pics/hamburger.jpg b/examples/quick/modelviews/listview/content/pics/hamburger.jpg
new file mode 100644
index 0000000000..d0a15be1bf
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/pics/hamburger.jpg
Binary files differ
diff --git a/examples/quick/modelviews/listview/content/pics/lemonade.jpg b/examples/quick/modelviews/listview/content/pics/lemonade.jpg
new file mode 100644
index 0000000000..db445c9ac8
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/pics/lemonade.jpg
Binary files differ
diff --git a/examples/quick/modelviews/listview/content/pics/list-delete.png b/examples/quick/modelviews/listview/content/pics/list-delete.png
new file mode 100644
index 0000000000..df2a147d24
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/pics/list-delete.png
Binary files differ
diff --git a/examples/quick/modelviews/listview/content/pics/minus-sign.png b/examples/quick/modelviews/listview/content/pics/minus-sign.png
new file mode 100644
index 0000000000..d6f233d739
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/pics/minus-sign.png
Binary files differ
diff --git a/examples/quick/modelviews/listview/content/pics/moreDown.png b/examples/quick/modelviews/listview/content/pics/moreDown.png
new file mode 100644
index 0000000000..31a35d5c20
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/pics/moreDown.png
Binary files differ
diff --git a/examples/quick/modelviews/listview/content/pics/moreUp.png b/examples/quick/modelviews/listview/content/pics/moreUp.png
new file mode 100644
index 0000000000..fefb9c9098
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/pics/moreUp.png
Binary files differ
diff --git a/examples/quick/modelviews/listview/content/pics/pancakes.jpg b/examples/quick/modelviews/listview/content/pics/pancakes.jpg
new file mode 100644
index 0000000000..60c439638e
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/pics/pancakes.jpg
Binary files differ
diff --git a/examples/quick/modelviews/listview/content/pics/plus-sign.png b/examples/quick/modelviews/listview/content/pics/plus-sign.png
new file mode 100644
index 0000000000..40df1134f8
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/pics/plus-sign.png
Binary files differ
diff --git a/examples/quick/modelviews/listview/content/pics/vegetable-soup.jpg b/examples/quick/modelviews/listview/content/pics/vegetable-soup.jpg
new file mode 100644
index 0000000000..9dce332041
--- /dev/null
+++ b/examples/quick/modelviews/listview/content/pics/vegetable-soup.jpg
Binary files differ
diff --git a/examples/quick/modelviews/listview/dynamiclist.qml b/examples/quick/modelviews/listview/dynamiclist.qml
new file mode 100644
index 0000000000..ee7c6329bc
--- /dev/null
+++ b/examples/quick/modelviews/listview/dynamiclist.qml
@@ -0,0 +1,203 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import "content"
+
+// This example shows how items can be dynamically added to and removed from
+// a ListModel, and how these list modifications can be animated.
+
+Rectangle {
+ id: container
+ width: 500; height: 400
+ color: "#343434"
+
+ // The model:
+ ListModel {
+ id: fruitModel
+
+ ListElement {
+ name: "Apple"; cost: 2.45
+ attributes: [
+ ListElement { description: "Core" },
+ ListElement { description: "Deciduous" }
+ ]
+ }
+ ListElement {
+ name: "Banana"; cost: 1.95
+ attributes: [
+ ListElement { description: "Tropical" },
+ ListElement { description: "Seedless" }
+ ]
+ }
+ ListElement {
+ name: "Cumquat"; cost: 3.25
+ attributes: [
+ ListElement { description: "Citrus" }
+ ]
+ }
+ ListElement {
+ name: "Durian"; cost: 9.95
+ attributes: [
+ ListElement { description: "Tropical" },
+ ListElement { description: "Smelly" }
+ ]
+ }
+ }
+
+ // The delegate for each fruit in the model:
+ Component {
+ id: listDelegate
+
+ Item {
+ id: delegateItem
+ width: listView.width; height: 55
+ clip: true
+
+ Row {
+ anchors.verticalCenter: parent.verticalCenter
+ spacing: 10
+
+ Column {
+ Image {
+ source: "content/pics/arrow-up.png"
+ MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index-1, 1) }
+ }
+ Image { source: "content/pics/arrow-down.png"
+ MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index, index+1, 1) }
+ }
+ }
+
+ Column {
+ anchors.verticalCenter: parent.verticalCenter
+
+ Text {
+ text: name
+ font.pixelSize: 15
+ color: "white"
+ }
+ Row {
+ spacing: 5
+ Repeater {
+ model: attributes
+ Text { text: description; color: "White" }
+ }
+ }
+ }
+ }
+
+ Row {
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+ spacing: 10
+
+ PressAndHoldButton {
+ anchors.verticalCenter: parent.verticalCenter
+ source: "content/pics/plus-sign.png"
+ onClicked: fruitModel.setProperty(index, "cost", cost + 0.25)
+ }
+
+ Text {
+ id: costText
+ anchors.verticalCenter: parent.verticalCenter
+ text: '$' + Number(cost).toFixed(2)
+ font.pixelSize: 15
+ color: "white"
+ font.bold: true
+ }
+
+ PressAndHoldButton {
+ anchors.verticalCenter: parent.verticalCenter
+ source: "content/pics/minus-sign.png"
+ onClicked: fruitModel.setProperty(index, "cost", Math.max(0,cost-0.25))
+ }
+
+ Image {
+ source: "content/pics/list-delete.png"
+ MouseArea { anchors.fill:parent; onClicked: fruitModel.remove(index) }
+ }
+ }
+
+ // Animate adding and removing of items:
+
+ ListView.onAdd: SequentialAnimation {
+ PropertyAction { target: delegateItem; property: "height"; value: 0 }
+ NumberAnimation { target: delegateItem; property: "height"; to: 55; duration: 250; easing.type: Easing.InOutQuad }
+ }
+
+ ListView.onRemove: SequentialAnimation {
+ PropertyAction { target: delegateItem; property: "ListView.delayRemove"; value: true }
+ NumberAnimation { target: delegateItem; property: "height"; to: 0; duration: 250; easing.type: Easing.InOutQuad }
+
+ // Make sure delayRemove is set back to false so that the item can be destroyed
+ PropertyAction { target: delegateItem; property: "ListView.delayRemove"; value: false }
+ }
+ }
+ }
+
+ // The view:
+ ListView {
+ id: listView
+ anchors.fill: parent; anchors.margins: 20
+ model: fruitModel
+ delegate: listDelegate
+ }
+
+ Row {
+ anchors { left: parent.left; bottom: parent.bottom; margins: 20 }
+ spacing: 10
+
+ TextButton {
+ text: "Add an item"
+ onClicked: {
+ fruitModel.append({
+ "name": "Pizza Margarita",
+ "cost": 5.95,
+ "attributes": [{"description": "Cheese"}, {"description": "Tomato"}]
+ })
+ }
+ }
+
+ TextButton {
+ text: "Remove all items"
+ onClicked: fruitModel.clear()
+ }
+ }
+}
+
diff --git a/examples/quick/modelviews/listview/expandingdelegates.qml b/examples/quick/modelviews/listview/expandingdelegates.qml
new file mode 100644
index 0000000000..43a9662422
--- /dev/null
+++ b/examples/quick/modelviews/listview/expandingdelegates.qml
@@ -0,0 +1,202 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+// This example illustrates expanding a list item to show a more detailed view.
+
+Rectangle {
+ id: page
+ width: 400; height: 240
+ color: "black"
+
+ // Delegate for the recipes. This delegate has two modes:
+ // 1. List mode (default), which just shows the picture and title of the recipe.
+ // 2. Details mode, which also shows the ingredients and method.
+ Component {
+ id: recipeDelegate
+
+ Item {
+ id: recipe
+
+ // Create a property to contain the visibility of the details.
+ // We can bind multiple element's opacity to this one property,
+ // rather than having a "PropertyChanges" line for each element we
+ // want to fade.
+ property real detailsOpacity : 0
+
+ width: listView.width
+ height: 70
+
+ // A simple rounded rectangle for the background
+ Rectangle {
+ id: background
+ x: 2; y: 2; width: parent.width - x*2; height: parent.height - y*2
+ color: "ivory"
+ border.color: "orange"
+ radius: 5
+ }
+
+ // This mouse region covers the entire delegate.
+ // When clicked it changes mode to 'Details'. If we are already
+ // in Details mode, then no change will happen.
+ MouseArea {
+ anchors.fill: parent
+ onClicked: recipe.state = 'Details';
+ }
+
+ // Lay out the page: picture, title and ingredients at the top, and method at the
+ // bottom. Note that elements that should not be visible in the list
+ // mode have their opacity set to recipe.detailsOpacity.
+ Row {
+ id: topLayout
+ x: 10; y: 10; height: recipeImage.height; width: parent.width
+ spacing: 10
+
+ Image {
+ id: recipeImage
+ width: 50; height: 50
+ source: picture
+ }
+
+ Column {
+ width: background.width - recipeImage.width - 20; height: recipeImage.height
+ spacing: 5
+
+ Text {
+ text: title
+ font.bold: true; font.pointSize: 16
+ }
+
+ Text {
+ text: "Ingredients"
+ font.pointSize: 12; font.bold: true
+ opacity: recipe.detailsOpacity
+ }
+
+ Text {
+ text: ingredients
+ wrapMode: Text.WordWrap
+ width: parent.width
+ opacity: recipe.detailsOpacity
+ }
+ }
+ }
+
+ Item {
+ id: details
+ x: 10; width: parent.width - 20
+ anchors { top: topLayout.bottom; topMargin: 10; bottom: parent.bottom; bottomMargin: 10 }
+ opacity: recipe.detailsOpacity
+
+ Text {
+ id: methodTitle
+ anchors.top: parent.top
+ text: "Method"
+ font.pointSize: 12; font.bold: true
+ }
+
+ Flickable {
+ id: flick
+ width: parent.width
+ anchors { top: methodTitle.bottom; bottom: parent.bottom }
+ contentHeight: methodText.height
+ clip: true
+
+ Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width }
+ }
+
+ Image {
+ anchors { right: flick.right; top: flick.top }
+ source: "content/pics/moreUp.png"
+ opacity: flick.atYBeginning ? 0 : 1
+ }
+
+ Image {
+ anchors { right: flick.right; bottom: flick.bottom }
+ source: "content/pics/moreDown.png"
+ opacity: flick.atYEnd ? 0 : 1
+ }
+ }
+
+ // A button to close the detailed view, i.e. set the state back to default ('').
+ TextButton {
+ y: 10
+ anchors { right: background.right; rightMargin: 10 }
+ opacity: recipe.detailsOpacity
+ text: "Close"
+
+ onClicked: recipe.state = '';
+ }
+
+ states: State {
+ name: "Details"
+
+ PropertyChanges { target: background; color: "white" }
+ PropertyChanges { target: recipeImage; width: 130; height: 130 } // Make picture bigger
+ PropertyChanges { target: recipe; detailsOpacity: 1; x: 0 } // Make details visible
+ PropertyChanges { target: recipe; height: listView.height } // Fill the entire list area with the detailed view
+
+ // Move the list so that this item is at the top.
+ PropertyChanges { target: recipe.ListView.view; explicit: true; contentY: recipe.y }
+
+ // Disallow flicking while we're in detailed view
+ PropertyChanges { target: recipe.ListView.view; interactive: false }
+ }
+
+ transitions: Transition {
+ // Make the state changes smooth
+ ParallelAnimation {
+ ColorAnimation { property: "color"; duration: 500 }
+ NumberAnimation { duration: 300; properties: "detailsOpacity,x,contentY,height,width" }
+ }
+ }
+ }
+ }
+
+ // The actual list
+ ListView {
+ id: listView
+ anchors.fill: parent
+ model: RecipesModel {}
+ delegate: recipeDelegate
+ }
+}
diff --git a/examples/quick/modelviews/listview/highlight.qml b/examples/quick/modelviews/listview/highlight.qml
new file mode 100644
index 0000000000..d8f76080e6
--- /dev/null
+++ b/examples/quick/modelviews/listview/highlight.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This example shows how to create your own highlight delegate for a ListView
+// that uses a SpringAnimation to provide custom movement when the
+// highlight bar is moved between items.
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ width: 200; height: 300
+
+ // Define a delegate component. A component will be
+ // instantiated for each visible item in the list.
+ Component {
+ id: petDelegate
+ Item {
+ id: wrapper
+ width: 200; height: 55
+ Column {
+ Text { text: 'Name: ' + name }
+ Text { text: 'Type: ' + type }
+ Text { text: 'Age: ' + age }
+ }
+ // indent the item if it is the current item
+ states: State {
+ name: "Current"
+ when: wrapper.ListView.isCurrentItem
+ PropertyChanges { target: wrapper; x: 20 }
+ }
+ transitions: Transition {
+ NumberAnimation { properties: "x"; duration: 200 }
+ }
+ }
+ }
+
+ // Define a highlight with customised movement between items.
+ Component {
+ id: highlightBar
+ Rectangle {
+ width: 200; height: 50
+ color: "#FFFF88"
+ y: listView.currentItem.y;
+ Behavior on y { SpringAnimation { spring: 2; damping: 0.1 } }
+ }
+ }
+
+ ListView {
+ id: listView
+ width: 200; height: parent.height
+
+ model: PetsModel {}
+ delegate: petDelegate
+ focus: true
+
+ // Set the highlight delegate. Note we must also set highlightFollowsCurrentItem
+ // to false so the highlight delegate can control how the highlight is moved.
+ highlight: highlightBar
+ highlightFollowsCurrentItem: false
+ }
+}
diff --git a/examples/quick/modelviews/listview/highlightranges.qml b/examples/quick/modelviews/listview/highlightranges.qml
new file mode 100644
index 0000000000..a536ddcbb2
--- /dev/null
+++ b/examples/quick/modelviews/listview/highlightranges.qml
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ id: root
+ property int current: 0
+ width: 600; height: 300
+
+ // This example shows the same model in three different ListView items,
+ // with different highlight ranges. The highlight ranges are set by the
+ // preferredHighlightBegin and preferredHighlightEnd properties in ListView.
+ //
+ // The first ListView does not set a highlight range, so its currentItem
+ // can move freely within the visible area. If it moves outside the
+ // visible area, the view is automatically scrolled to keep the current
+ // item visible.
+ //
+ // The second ListView sets a highlight range which attempts to keep the
+ // current item within the the bounds of the range. However,
+ // items will not scroll beyond the beginning or end of the view,
+ // forcing the highlight to move outside the range at the ends.
+ //
+ // The third ListView sets the highlightRangeMode to StrictlyEnforceRange
+ // and sets a range smaller than the height of an item. This
+ // forces the current item to change when the view is flicked,
+ // since the highlight is unable to move.
+ //
+ // All ListViews bind their currentIndex to the root.current property.
+ // The first ListView sets root.current whenever its currentIndex changes
+ // due to keyboard interaction.
+ // Flicking the third ListView with the mouse also changes root.current.
+
+ ListView {
+ id: list1
+ width: 200; height: parent.height
+ model: PetsModel {}
+ delegate: petDelegate
+
+ highlight: Rectangle { color: "lightsteelblue" }
+ currentIndex: root.current
+ onCurrentIndexChanged: root.current = currentIndex
+ focus: true
+ }
+
+ ListView {
+ id: list2
+ x: list1.width
+ width: 200; height: parent.height
+ model: PetsModel {}
+ delegate: petDelegate
+
+ highlight: Rectangle { color: "yellow" }
+ currentIndex: root.current
+ preferredHighlightBegin: 80; preferredHighlightEnd: 220
+ highlightRangeMode: ListView.ApplyRange
+ }
+
+ ListView {
+ id: list3
+ x: list1.width + list2.width
+ width: 200; height: parent.height
+ model: PetsModel {}
+ delegate: petDelegate
+
+ highlight: Rectangle { color: "yellow" }
+ currentIndex: root.current
+ onCurrentIndexChanged: root.current = currentIndex
+ preferredHighlightBegin: 125; preferredHighlightEnd: 125
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ }
+
+ // The delegate for each list
+ Component {
+ id: petDelegate
+ Column {
+ width: 200
+ Text { text: 'Name: ' + name }
+ Text { text: 'Type: ' + type }
+ Text { text: 'Age: ' + age }
+ }
+ }
+}
diff --git a/examples/quick/modelviews/listview/sections.qml b/examples/quick/modelviews/listview/sections.qml
new file mode 100644
index 0000000000..2e63a86bb6
--- /dev/null
+++ b/examples/quick/modelviews/listview/sections.qml
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This example shows how a ListView can be separated into sections using
+// the ListView.section attached property.
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ id: container
+ width: 300
+ height: 360
+
+ ListModel {
+ id: animalsModel
+ ListElement { name: "Ant"; size: "Tiny" }
+ ListElement { name: "Flea"; size: "Tiny" }
+ ListElement { name: "Parrot"; size: "Small" }
+ ListElement { name: "Guinea pig"; size: "Small" }
+ ListElement { name: "Rat"; size: "Small" }
+ ListElement { name: "Butterfly"; size: "Small" }
+ ListElement { name: "Dog"; size: "Medium" }
+ ListElement { name: "Cat"; size: "Medium" }
+ ListElement { name: "Pony"; size: "Medium" }
+ ListElement { name: "Koala"; size: "Medium" }
+ ListElement { name: "Horse"; size: "Large" }
+ ListElement { name: "Tiger"; size: "Large" }
+ ListElement { name: "Giraffe"; size: "Large" }
+ ListElement { name: "Elephant"; size: "Huge" }
+ ListElement { name: "Whale"; size: "Huge" }
+ }
+
+//! [0]
+ // The delegate for each section header
+ Component {
+ id: sectionHeading
+ Rectangle {
+ width: container.width
+ height: childrenRect.height
+ color: "lightsteelblue"
+
+ Text {
+ text: section
+ font.bold: true
+ font.pixelSize: 20
+ }
+ }
+ }
+
+ ListView {
+ id: view
+ anchors.top: parent.top
+ anchors.bottom: buttonBar.top
+ width: parent.width
+ model: animalsModel
+ delegate: Text { text: name; font.pixelSize: 18 }
+
+ section.property: "size"
+ section.criteria: ViewSection.FullString
+ section.delegate: sectionHeading
+ }
+//! [0]
+
+ Row {
+ id: buttonBar
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 1
+ spacing: 1
+ ToggleButton {
+ label: "CurrentLabelAtStart"
+ onToggled: {
+ if (active)
+ view.section.labelPositioning |= ViewSection.CurrentLabelAtStart
+ else
+ view.section.labelPositioning &= ~ViewSection.CurrentLabelAtStart
+ }
+ }
+ ToggleButton {
+ label: "NextLabelAtEnd"
+ onToggled: {
+ if (active)
+ view.section.labelPositioning |= ViewSection.NextLabelAtEnd
+ else
+ view.section.labelPositioning &= ~ViewSection.NextLabelAtEnd
+ }
+ }
+ }
+}
+
diff --git a/examples/quick/modelviews/modelviews.pro b/examples/quick/modelviews/modelviews.pro
new file mode 100644
index 0000000000..7748da0471
--- /dev/null
+++ b/examples/quick/modelviews/modelviews.pro
@@ -0,0 +1,8 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ abstractitemmodel \
+ objectlistmodel \
+ stringlistmodel
+
+
diff --git a/examples/quick/modelviews/modelviews.qml b/examples/quick/modelviews/modelviews.qml
new file mode 100644
index 0000000000..f11608bcc7
--- /dev/null
+++ b/examples/quick/modelviews/modelviews.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../../shared"
+
+Item {
+ height: 480
+ width: 480
+ LauncherList {
+ id: ll
+ anchors.fill: parent
+ Component.onCompleted: {
+ addExample("Dynamic List", "A ListView harboring dynamic data", Qt.resolvedUrl("listview/dynamiclist.qml"));
+ addExample("Expanding Delegates", "Delegates that expand to fill the list when clicked", Qt.resolvedUrl("listview/expandingdelegates.qml"));
+ addExample("Highlight", "Adding a highlight to the current item", Qt.resolvedUrl("listview/highlight.qml"));
+ addExample("Sections", "A ListView with section headers", Qt.resolvedUrl("listview/sections.qml"));
+ addExample("GridView", "A view laid out in a grid", Qt.resolvedUrl("gridview/gridview-example.qml"));
+ addExample("PathView", "A view laid out along a path", Qt.resolvedUrl("pathview/pathview-example.qml"));
+ addExample("Package", "Using a package to transition items between views", Qt.resolvedUrl("package/view.qml"));
+ addExample("Parallax", "Adds a background and a parallax effect to a ListView", Qt.resolvedUrl("parallax/parallax.qml"));
+ addExample("Slideshow", "A model demonstrating delayed image loading", Qt.resolvedUrl("visualdatamodel/slideshow.qml"));
+ addExample("Sorted Model", "Two views on a model, one of which is sorted", Qt.resolvedUrl("visualdatamodel/sortedmodel.qml"));
+ addExample("VisualItemModel", "A model that consists of the actual Items", Qt.resolvedUrl("visualitemmodel/visualitemmodel.qml"));
+ }
+ }
+}
diff --git a/examples/quick/modelviews/modelviews.qmlproject b/examples/quick/modelviews/modelviews.qmlproject
new file mode 100644
index 0000000000..40f9e568fd
--- /dev/null
+++ b/examples/quick/modelviews/modelviews.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "modelviews.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/modelviews/objectlistmodel/dataobject.cpp b/examples/quick/modelviews/objectlistmodel/dataobject.cpp
new file mode 100644
index 0000000000..7216283616
--- /dev/null
+++ b/examples/quick/modelviews/objectlistmodel/dataobject.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QDebug>
+#include "dataobject.h"
+
+DataObject::DataObject(QObject *parent)
+ : QObject(parent)
+{
+}
+
+DataObject::DataObject(const QString &name, const QString &color, QObject *parent)
+ : QObject(parent), m_name(name), m_color(color)
+{
+}
+
+QString DataObject::name() const
+{
+ return m_name;
+}
+
+void DataObject::setName(const QString &name)
+{
+ if (name != m_name) {
+ m_name = name;
+ emit nameChanged();
+ }
+}
+
+QString DataObject::color() const
+{
+ return m_color;
+}
+
+void DataObject::setColor(const QString &color)
+{
+ if (color != m_color) {
+ m_color = color;
+ emit colorChanged();
+ }
+}
diff --git a/examples/quick/modelviews/objectlistmodel/dataobject.h b/examples/quick/modelviews/objectlistmodel/dataobject.h
new file mode 100644
index 0000000000..bea92a273c
--- /dev/null
+++ b/examples/quick/modelviews/objectlistmodel/dataobject.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DATAOBJECT_H
+#define DATAOBJECT_H
+
+#include <QObject>
+
+//![0]
+class DataObject : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+ Q_PROPERTY(QString color READ color WRITE setColor NOTIFY colorChanged)
+//![0]
+
+public:
+ DataObject(QObject *parent=0);
+ DataObject(const QString &name, const QString &color, QObject *parent=0);
+
+ QString name() const;
+ void setName(const QString &name);
+
+ QString color() const;
+ void setColor(const QString &color);
+
+signals:
+ void nameChanged();
+ void colorChanged();
+
+private:
+ QString m_name;
+ QString m_color;
+//![1]
+};
+//![1]
+
+#endif // DATAOBJECT_H
diff --git a/examples/quick/modelviews/objectlistmodel/main.cpp b/examples/quick/modelviews/objectlistmodel/main.cpp
new file mode 100644
index 0000000000..bb3895f7c0
--- /dev/null
+++ b/examples/quick/modelviews/objectlistmodel/main.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+
+#include <qqmlengine.h>
+#include <qqmlcontext.h>
+#include <qqml.h>
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/qquickview.h>
+
+#include "dataobject.h"
+
+/*
+ This example illustrates exposing a QList<QObject*> as a
+ model in QML
+*/
+
+//![0]
+int main(int argc, char ** argv)
+{
+ QGuiApplication app(argc, argv);
+
+ QList<QObject*> dataList;
+ dataList.append(new DataObject("Item 1", "red"));
+ dataList.append(new DataObject("Item 2", "green"));
+ dataList.append(new DataObject("Item 3", "blue"));
+ dataList.append(new DataObject("Item 4", "yellow"));
+
+ QQuickView view;
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
+//![0]
+
+ view.setSource(QUrl("qrc:view.qml"));
+ view.show();
+
+ return app.exec();
+}
+
diff --git a/examples/quick/modelviews/objectlistmodel/objectlistmodel.pro b/examples/quick/modelviews/objectlistmodel/objectlistmodel.pro
new file mode 100644
index 0000000000..7f323c3999
--- /dev/null
+++ b/examples/quick/modelviews/objectlistmodel/objectlistmodel.pro
@@ -0,0 +1,6 @@
+QT += qml quick
+
+SOURCES += main.cpp \
+ dataobject.cpp
+HEADERS += dataobject.h
+RESOURCES += objectlistmodel.qrc
diff --git a/examples/quick/modelviews/objectlistmodel/objectlistmodel.qmlproject b/examples/quick/modelviews/objectlistmodel/objectlistmodel.qmlproject
new file mode 100644
index 0000000000..2bb4016996
--- /dev/null
+++ b/examples/quick/modelviews/objectlistmodel/objectlistmodel.qmlproject
@@ -0,0 +1,14 @@
+import QmlProject 1.0
+
+Project {
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/modelviews/objectlistmodel/objectlistmodel.qrc b/examples/quick/modelviews/objectlistmodel/objectlistmodel.qrc
new file mode 100644
index 0000000000..17e9301471
--- /dev/null
+++ b/examples/quick/modelviews/objectlistmodel/objectlistmodel.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>view.qml</file>
+</qresource>
+</RCC>
diff --git a/examples/quick/modelviews/objectlistmodel/view.qml b/examples/quick/modelviews/objectlistmodel/view.qml
new file mode 100644
index 0000000000..3954e79829
--- /dev/null
+++ b/examples/quick/modelviews/objectlistmodel/view.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//![0]
+ListView {
+ width: 100; height: 100
+
+ model: myModel
+ delegate: Rectangle {
+ height: 25
+ width: 100
+ color: model.modelData.color
+ Text { text: name }
+ }
+}
+//![0]
diff --git a/examples/quick/modelviews/package/Delegate.qml b/examples/quick/modelviews/package/Delegate.qml
new file mode 100644
index 0000000000..97c7840cb4
--- /dev/null
+++ b/examples/quick/modelviews/package/Delegate.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//![0]
+Package {
+ Text { id: listDelegate; width: 200; height: 25; text: 'Empty'; Package.name: 'list' }
+ Text { id: gridDelegate; width: 100; height: 50; text: 'Empty'; Package.name: 'grid' }
+
+ Rectangle {
+ id: wrapper
+ width: 200; height: 25
+ color: 'lightsteelblue'
+
+ Text { text: display; anchors.centerIn: parent }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ if (wrapper.state == 'inList')
+ wrapper.state = 'inGrid';
+ else
+ wrapper.state = 'inList';
+ }
+ }
+
+ state: 'inList'
+ states: [
+ State {
+ name: 'inList'
+ ParentChange { target: wrapper; parent: listDelegate }
+ },
+ State {
+ name: 'inGrid'
+ ParentChange {
+ target: wrapper; parent: gridDelegate
+ x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ ParentAnimation {
+ NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
+ }
+ }
+ ]
+ }
+}
+//![0]
diff --git a/examples/quick/modelviews/package/view.qml b/examples/quick/modelviews/package/view.qml
new file mode 100644
index 0000000000..7ba6664ae2
--- /dev/null
+++ b/examples/quick/modelviews/package/view.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ color: "white"
+ width: 400
+ height: 200
+
+ ListModel {
+ id: myModel
+ ListElement { display: "One" }
+ ListElement { display: "Two" }
+ ListElement { display: "Three" }
+ ListElement { display: "Four" }
+ ListElement { display: "Five" }
+ ListElement { display: "Six" }
+ ListElement { display: "Seven" }
+ ListElement { display: "Eight" }
+ }
+ //![0]
+ VisualDataModel {
+ id: visualModel
+ delegate: Delegate {}
+ model: myModel
+ }
+
+ ListView {
+ width: 200; height:200
+ model: visualModel.parts.list
+ }
+ GridView {
+ x: 200; width: 200; height:200
+ cellHeight: 50
+ model: visualModel.parts.grid
+ }
+ //![0]
+ Text {
+ anchors.bottom: parent.bottom
+ text: "Tap a delegate to move between views"
+ }
+}
diff --git a/examples/quick/modelviews/parallax/content/Clock.qml b/examples/quick/modelviews/parallax/content/Clock.qml
new file mode 100644
index 0000000000..7f0e8cba83
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/Clock.qml
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id : clock
+ width: {
+ if (ListView.view && ListView.view.width >= 200)
+ return ListView.view.width / Math.floor(ListView.view.width / 200.0);
+ else
+ return 200;
+ }
+
+ height: {
+ if (ListView.view && ListView.view.height >= 240)
+ return ListView.view.height;
+ else
+ return 240;
+ }
+
+ property alias city: cityLabel.text
+ property int hours
+ property int minutes
+ property int seconds
+ property real shift
+ property bool night: false
+ property bool internationalTime: true //Unset for local time
+
+ function timeChanged() {
+ var date = new Date;
+ hours = internationalTime ? date.getUTCHours() + Math.floor(clock.shift) : date.getHours()
+ night = ( hours < 7 || hours > 19 )
+ minutes = internationalTime ? date.getUTCMinutes() + ((clock.shift % 1) * 60) : date.getMinutes()
+ seconds = date.getUTCSeconds();
+ }
+
+ Timer {
+ interval: 100; running: true; repeat: true;
+ onTriggered: clock.timeChanged()
+ }
+
+ Item {
+ anchors.centerIn: parent
+ width: 200; height: 240
+
+ Image { id: background; source: "clock.png"; visible: clock.night == false }
+ Image { source: "clock-night.png"; visible: clock.night == true }
+
+
+ Image {
+ x: 92.5; y: 27
+ source: "hour.png"
+ smooth: true
+ transform: Rotation {
+ id: hourRotation
+ origin.x: 7.5; origin.y: 73;
+ angle: (clock.hours * 30) + (clock.minutes * 0.5)
+ Behavior on angle {
+ SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
+ }
+ }
+ }
+
+ Image {
+ x: 93.5; y: 17
+ source: "minute.png"
+ smooth: true
+ transform: Rotation {
+ id: minuteRotation
+ origin.x: 6.5; origin.y: 83;
+ angle: clock.minutes * 6
+ Behavior on angle {
+ SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
+ }
+ }
+ }
+
+ Image {
+ x: 97.5; y: 20
+ source: "second.png"
+ smooth: true
+ transform: Rotation {
+ id: secondRotation
+ origin.x: 2.5; origin.y: 80;
+ angle: clock.seconds * 6
+ Behavior on angle {
+ SpringAnimation { spring: 2; damping: 0.2; modulus: 360 }
+ }
+ }
+ }
+
+ Image {
+ anchors.centerIn: background; source: "center.png"
+ }
+
+ Text {
+ id: cityLabel
+ y: 210; anchors.horizontalCenter: parent.horizontalCenter
+ color: "white"
+ font.family: "Helvetica"
+ font.bold: true; font.pixelSize: 16
+ style: Text.Raised; styleColor: "black"
+ }
+ }
+}
diff --git a/examples/quick/modelviews/parallax/content/ParallaxView.qml b/examples/quick/modelviews/parallax/content/ParallaxView.qml
new file mode 100644
index 0000000000..2acf50dcef
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/ParallaxView.qml
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property alias background: background.source
+ property int currentIndex: 0
+ default property alias content: visualModel.children
+
+ Image {
+ id: background
+ fillMode: Image.TileHorizontally
+ x: -list.contentX / 2
+ width: Math.max(list.contentWidth, parent.width)
+ }
+
+ ListView {
+ id: list
+ anchors.fill: parent
+
+ currentIndex: root.currentIndex
+ onCurrentIndexChanged: root.currentIndex = currentIndex
+
+ orientation: Qt.Horizontal
+ boundsBehavior: Flickable.DragOverBounds
+ model: VisualItemModel { id: visualModel }
+
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ snapMode: ListView.SnapOneItem
+ }
+
+ ListView {
+ id: selector
+
+ height: 50
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: Math.min(count * 50, parent.width - 20)
+ interactive: width == parent.width - 20
+ orientation: Qt.Horizontal
+
+ currentIndex: root.currentIndex
+ onCurrentIndexChanged: root.currentIndex = currentIndex
+
+ model: visualModel.children
+ delegate: Item {
+ width: 50; height: 50
+ id: delegateRoot
+
+ Image {
+ id: image
+ source: modelData.icon
+ smooth: true
+ scale: 0.8
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { root.currentIndex = index }
+ }
+
+ states: State {
+ name: "Selected"
+ when: delegateRoot.ListView.isCurrentItem == true
+ PropertyChanges {
+ target: image
+ scale: 1
+ y: -5
+ }
+ }
+ transitions: Transition {
+ NumberAnimation { properties: "scale,y" }
+ }
+ }
+
+ Rectangle {
+ color: "#60FFFFFF"
+ x: -10; y: -10; z: -1
+ width: parent.width + 20; height: parent.height + 20
+ radius: 10
+ }
+ }
+}
diff --git a/examples/quick/modelviews/parallax/content/QuitButton.qml b/examples/quick/modelviews/parallax/content/QuitButton.qml
new file mode 100644
index 0000000000..702b892d23
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/QuitButton.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+Image {
+ source: "quit.png"
+ scale: quitMouse.pressed ? 0.8 : 1.0
+ smooth: quitMouse.pressed
+ MouseArea {
+ id: quitMouse
+ anchors.fill: parent
+ anchors.margins: -10
+ onClicked: Qt.quit()
+ }
+}
diff --git a/examples/quick/modelviews/parallax/content/Smiley.qml b/examples/quick/modelviews/parallax/content/Smiley.qml
new file mode 100644
index 0000000000..982b6c5d2b
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/Smiley.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+// This is taken from the declarative animation/basics/property-animation.qml
+// example
+
+Item {
+ id: window
+ width: 320; height: 480
+
+ Image {
+ anchors.horizontalCenter: parent.horizontalCenter
+ y: smiley.minHeight + 58
+ source: "pics/shadow.png"
+
+ scale: smiley.y * 0.5 / (smiley.minHeight - smiley.maxHeight)
+ }
+
+ Image {
+ id: smiley
+ property int maxHeight: window.height / 3
+ property int minHeight: 2 * window.height / 3
+
+ anchors.horizontalCenter: parent.horizontalCenter
+ y: minHeight
+ source: "pics/face-smile.png"
+
+ SequentialAnimation on y {
+ loops: Animation.Infinite
+
+ NumberAnimation {
+ from: smiley.minHeight; to: smiley.maxHeight
+ easing.type: Easing.OutExpo; duration: 300
+ }
+
+ NumberAnimation {
+ from: smiley.maxHeight; to: smiley.minHeight
+ easing.type: Easing.OutBounce; duration: 1000
+ }
+
+ PauseAnimation { duration: 500 }
+ }
+ }
+}
+
diff --git a/examples/quick/modelviews/parallax/content/background.png b/examples/quick/modelviews/parallax/content/background.png
new file mode 100644
index 0000000000..a885950862
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/background.png
Binary files differ
diff --git a/examples/quick/modelviews/parallax/content/center.png b/examples/quick/modelviews/parallax/content/center.png
new file mode 100644
index 0000000000..7fbd802a44
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/center.png
Binary files differ
diff --git a/examples/quick/modelviews/parallax/content/clock-night.png b/examples/quick/modelviews/parallax/content/clock-night.png
new file mode 100644
index 0000000000..cc7151a397
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/clock-night.png
Binary files differ
diff --git a/examples/quick/modelviews/parallax/content/clock.png b/examples/quick/modelviews/parallax/content/clock.png
new file mode 100644
index 0000000000..462edacc0e
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/clock.png
Binary files differ
diff --git a/examples/quick/modelviews/parallax/content/hour.png b/examples/quick/modelviews/parallax/content/hour.png
new file mode 100644
index 0000000000..f8061a1235
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/hour.png
Binary files differ
diff --git a/examples/quick/modelviews/parallax/content/minute.png b/examples/quick/modelviews/parallax/content/minute.png
new file mode 100644
index 0000000000..1297ec7c2b
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/minute.png
Binary files differ
diff --git a/examples/quick/modelviews/parallax/content/pics/background.jpg b/examples/quick/modelviews/parallax/content/pics/background.jpg
new file mode 100644
index 0000000000..61cca2f138
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/pics/background.jpg
Binary files differ
diff --git a/examples/quick/modelviews/parallax/content/pics/face-smile.png b/examples/quick/modelviews/parallax/content/pics/face-smile.png
new file mode 100644
index 0000000000..3d66d72578
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/pics/face-smile.png
Binary files differ
diff --git a/examples/quick/modelviews/parallax/content/pics/home-page.png b/examples/quick/modelviews/parallax/content/pics/home-page.png
new file mode 100644
index 0000000000..bd090c3708
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/pics/home-page.png
Binary files differ
diff --git a/examples/quick/modelviews/parallax/content/pics/home-page.svg b/examples/quick/modelviews/parallax/content/pics/home-page.svg
new file mode 100644
index 0000000000..4f16958844
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/pics/home-page.svg
@@ -0,0 +1,445 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48"
+ height="48"
+ overflow="visible"
+ enable-background="new 0 0 128 129.396"
+ xml:space="preserve"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docname="go-home.svg"
+ sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/actions"
+ version="1.0"
+ inkscape:export-filename="/home/tigert/My Downloads/go-home.png"
+ inkscape:export-xdpi="90.000000"
+ inkscape:export-ydpi="90.000000"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata
+ id="metadata367"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><cc:license
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/" /><dc:title>Go Home</dc:title><dc:creator><cc:Agent><dc:title>Jakub Steiner</dc:title></cc:Agent></dc:creator><dc:source>http://jimmac.musichall.cz</dc:source><dc:subject><rdf:Bag><rdf:li>home</rdf:li><rdf:li>return</rdf:li><rdf:li>go</rdf:li><rdf:li>default</rdf:li><rdf:li>user</rdf:li><rdf:li>directory</rdf:li></rdf:Bag></dc:subject><dc:contributor><cc:Agent><dc:title>Tuomas Kuosmanen</dc:title></cc:Agent></dc:contributor></cc:Work><cc:License
+ rdf:about="http://creativecommons.org/licenses/publicdomain/"><cc:permits
+ rdf:resource="http://creativecommons.org/ns#Reproduction" /><cc:permits
+ rdf:resource="http://creativecommons.org/ns#Distribution" /><cc:permits
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /></cc:License></rdf:RDF></metadata><defs
+ id="defs365"><inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ id="perspective92" /><radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient5031"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" /><linearGradient
+ inkscape:collect="always"
+ id="linearGradient5060"><stop
+ style="stop-color:black;stop-opacity:1;"
+ offset="0"
+ id="stop5062" /><stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5064" /></linearGradient><radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5060"
+ id="radialGradient5029"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)"
+ cx="605.71429"
+ cy="486.64789"
+ fx="605.71429"
+ fy="486.64789"
+ r="117.14286" /><linearGradient
+ id="linearGradient5048"><stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="0"
+ id="stop5050" /><stop
+ id="stop5056"
+ offset="0.5"
+ style="stop-color:black;stop-opacity:1;" /><stop
+ style="stop-color:black;stop-opacity:0;"
+ offset="1"
+ id="stop5052" /></linearGradient><linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient5048"
+ id="linearGradient5027"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)"
+ x1="302.85715"
+ y1="366.64789"
+ x2="302.85715"
+ y2="609.50507" /><linearGradient
+ id="linearGradient2406"><stop
+ style="stop-color:#7c7e79;stop-opacity:1;"
+ offset="0"
+ id="stop2408" /><stop
+ id="stop2414"
+ offset="0.1724138"
+ style="stop-color:#848681;stop-opacity:1;" /><stop
+ style="stop-color:#898c86;stop-opacity:1;"
+ offset="1"
+ id="stop2410" /></linearGradient><linearGradient
+ inkscape:collect="always"
+ id="linearGradient2390"><stop
+ style="stop-color:#919191;stop-opacity:1;"
+ offset="0"
+ id="stop2392" /><stop
+ style="stop-color:#919191;stop-opacity:0;"
+ offset="1"
+ id="stop2394" /></linearGradient><linearGradient
+ inkscape:collect="always"
+ id="linearGradient2378"><stop
+ style="stop-color:#575757;stop-opacity:1;"
+ offset="0"
+ id="stop2380" /><stop
+ style="stop-color:#575757;stop-opacity:0;"
+ offset="1"
+ id="stop2382" /></linearGradient><linearGradient
+ inkscape:collect="always"
+ id="linearGradient2368"><stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop2370" /><stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop2372" /></linearGradient><linearGradient
+ inkscape:collect="always"
+ id="linearGradient2349"><stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop2351" /><stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop2353" /></linearGradient><linearGradient
+ id="linearGradient2341"><stop
+ id="stop2343"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:1;" /><stop
+ id="stop2345"
+ offset="1"
+ style="stop-color:#000000;stop-opacity:0;" /></linearGradient><linearGradient
+ id="linearGradient2329"><stop
+ style="stop-color:#000000;stop-opacity:0.18556701;"
+ offset="0"
+ id="stop2331" /><stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="1"
+ id="stop2333" /></linearGradient><linearGradient
+ inkscape:collect="always"
+ id="linearGradient2319"><stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop2321" /><stop
+ style="stop-color:#000000;stop-opacity:0;"
+ offset="1"
+ id="stop2323" /></linearGradient><linearGradient
+ id="linearGradient2307"><stop
+ style="stop-color:#edd400;stop-opacity:1;"
+ offset="0"
+ id="stop2309" /><stop
+ style="stop-color:#998800;stop-opacity:1;"
+ offset="1"
+ id="stop2311" /></linearGradient><linearGradient
+ inkscape:collect="always"
+ id="linearGradient2299"><stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="0"
+ id="stop2301" /><stop
+ style="stop-color:#ffffff;stop-opacity:0;"
+ offset="1"
+ id="stop2303" /></linearGradient><linearGradient
+ id="XMLID_2_"
+ gradientUnits="userSpaceOnUse"
+ x1="80.223602"
+ y1="117.5205"
+ x2="48.046001"
+ y2="59.7995"
+ gradientTransform="matrix(0.314683,0.000000,0.000000,0.314683,4.128264,3.742874)">
+ <stop
+ offset="0"
+ style="stop-color:#CCCCCC"
+ id="stop17" />
+ <stop
+ offset="0.9831"
+ style="stop-color:#FFFFFF"
+ id="stop19" />
+ <midPointStop
+ offset="0"
+ style="stop-color:#CCCCCC"
+ id="midPointStop48" />
+ <midPointStop
+ offset="0.5"
+ style="stop-color:#CCCCCC"
+ id="midPointStop50" />
+ <midPointStop
+ offset="0.9831"
+ style="stop-color:#FFFFFF"
+ id="midPointStop52" />
+ </linearGradient><linearGradient
+ inkscape:collect="always"
+ xlink:href="#XMLID_2_"
+ id="linearGradient1514"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.336922,0.000000,0.000000,0.166888,17.98288,15.46151)"
+ x1="52.006104"
+ y1="166.1331"
+ x2="14.049017"
+ y2="-42.218513" /><linearGradient
+ id="XMLID_39_"
+ gradientUnits="userSpaceOnUse"
+ x1="64.387703"
+ y1="65.124001"
+ x2="64.387703"
+ y2="35.569"
+ gradientTransform="matrix(0.354101,0.000000,0.000000,0.354101,1.638679,-8.364921e-2)">
+ <stop
+ offset="0"
+ style="stop-color:#FFFFFF"
+ id="stop336" />
+ <stop
+ offset="0.8539"
+ style="stop-color:#FF6200"
+ id="stop338" />
+ <stop
+ offset="1"
+ style="stop-color:#F25D00"
+ id="stop340" />
+ <midPointStop
+ offset="0"
+ style="stop-color:#FFFFFF"
+ id="midPointStop335" />
+ <midPointStop
+ offset="0.5"
+ style="stop-color:#FFFFFF"
+ id="midPointStop337" />
+ <midPointStop
+ offset="0.8539"
+ style="stop-color:#FF6200"
+ id="midPointStop339" />
+ <midPointStop
+ offset="0.5"
+ style="stop-color:#FF6200"
+ id="midPointStop341" />
+ <midPointStop
+ offset="1"
+ style="stop-color:#F25D00"
+ id="midPointStop343" />
+ </linearGradient><radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2299"
+ id="radialGradient2305"
+ cx="7.5326638"
+ cy="24.202574"
+ fx="7.5326638"
+ fy="24.202574"
+ r="8.2452128"
+ gradientTransform="matrix(4.100086,-1.627292e-17,2.125447e-14,4.201322,-25.41506,-78.53967)"
+ gradientUnits="userSpaceOnUse" /><radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2307"
+ id="radialGradient2313"
+ cx="19.985598"
+ cy="36.77816"
+ fx="19.985598"
+ fy="36.77816"
+ r="1.0821035"
+ gradientTransform="matrix(1.125263,0.000000,0.000000,0.982744,-3.428678,0.565787)"
+ gradientUnits="userSpaceOnUse" /><radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2319"
+ id="radialGradient2325"
+ cx="20.443665"
+ cy="37.425829"
+ fx="20.443665"
+ fy="37.425829"
+ r="1.0821035"
+ gradientTransform="matrix(1.125263,0.000000,0.000000,0.982744,-3.428678,0.731106)"
+ gradientUnits="userSpaceOnUse" /><linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2329"
+ id="linearGradient2335"
+ x1="17.602522"
+ y1="26.057423"
+ x2="17.682528"
+ y2="32.654099"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.898789,0,0,1.071914,0.478025,-2.080838)" /><radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2341"
+ id="radialGradient2339"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(4.100086,1.627292e-17,2.125447e-14,-4.201322,-5.198109,105.3535)"
+ cx="11.68129"
+ cy="19.554111"
+ fx="11.68129"
+ fy="19.554111"
+ r="8.2452126" /><radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2349"
+ id="radialGradient2355"
+ cx="24.023088"
+ cy="40.56913"
+ fx="24.023088"
+ fy="40.56913"
+ r="16.28684"
+ gradientTransform="matrix(1.000000,0.000000,0.000000,0.431250,1.157278e-15,23.07369)"
+ gradientUnits="userSpaceOnUse" /><radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2368"
+ id="radialGradient2374"
+ cx="29.913452"
+ cy="30.442923"
+ fx="29.913452"
+ fy="30.442923"
+ r="4.0018832"
+ gradientTransform="matrix(3.751495,-2.191984e-22,1.723265e-22,3.147818,-82.00907,-65.70704)"
+ gradientUnits="userSpaceOnUse" /><radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2378"
+ id="radialGradient2384"
+ cx="24.195112"
+ cy="10.577631"
+ fx="24.195112"
+ fy="10.577631"
+ r="15.242914"
+ gradientTransform="matrix(1.125263,-3.585417e-8,4.269819e-8,1.340059,-3.006704,1.355395)"
+ gradientUnits="userSpaceOnUse" /><linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2390"
+ id="linearGradient2396"
+ x1="30.603519"
+ y1="37.337803"
+ x2="30.603519"
+ y2="36.112415"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.263867,0,0,0.859794,-6.499556,8.390924)" /><linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient2406"
+ id="linearGradient2412"
+ x1="17.850183"
+ y1="28.939463"
+ x2="19.040216"
+ y2="41.03223"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.888785,0,0,1.08932,2.41099,-1.524336)" /></defs><sodipodi:namedview
+ inkscape:cy="-2.3755359"
+ inkscape:cx="25.234802"
+ inkscape:zoom="1"
+ inkscape:window-height="691"
+ inkscape:window-width="872"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ borderopacity="0.21568627"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:showpageshadow="false"
+ inkscape:window-x="466"
+ inkscape:window-y="157"
+ inkscape:current-layer="svg2"
+ fill="#555753"
+ showgrid="false"
+ stroke="#a40000"
+ showguides="true"
+ inkscape:guide-bbox="true" />
+ <g
+ style="display:inline"
+ id="g5022"
+ transform="matrix(2.158196e-2,0,0,1.859457e-2,43.12251,41.63767)"><rect
+ y="-150.69685"
+ x="-1559.2523"
+ height="478.35718"
+ width="1339.6335"
+ id="rect4173"
+ style="opacity:0.40206185;color:black;fill:url(#linearGradient5027);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /><path
+ sodipodi:nodetypes="cccc"
+ id="path5058"
+ d="M -219.61876,-150.68038 C -219.61876,-150.68038 -219.61876,327.65041 -219.61876,327.65041 C -76.744594,328.55086 125.78146,220.48075 125.78138,88.454235 C 125.78138,-43.572302 -33.655436,-150.68036 -219.61876,-150.68038 z "
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient5029);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /><path
+ style="opacity:0.40206185;color:black;fill:url(#radialGradient5031);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M -1559.2523,-150.68038 C -1559.2523,-150.68038 -1559.2523,327.65041 -1559.2523,327.65041 C -1702.1265,328.55086 -1904.6525,220.48075 -1904.6525,88.454235 C -1904.6525,-43.572302 -1745.2157,-150.68036 -1559.2523,-150.68038 z "
+ id="path5018"
+ sodipodi:nodetypes="cccc" /></g><path
+ style="color:#000000;fill:url(#linearGradient1514);fill-opacity:1;fill-rule:nonzero;stroke:#757575;stroke-width:1.0000006;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 21.619576,8.1833733 L 27.577035,8.1833733 C 28.416767,8.1833733 41.46351,23.618701 41.46351,24.524032 L 41.019989,43.020777 C 41.019989,43.92611 40.343959,44.654954 39.504227,44.654954 L 8.0469496,44.654954 C 7.2072167,44.654954 6.5311871,43.92611 6.5311871,43.020777 L 6.5876651,24.524032 C 6.5876651,23.618701 20.779844,8.1833733 21.619576,8.1833733 z "
+ id="rect1512"
+ sodipodi:nodetypes="ccccccccc" /><path
+ style="fill:none"
+ id="path5"
+ d="M 46.963575,45.735573 L 1.6386762,45.735573 L 1.6386762,0.41067554 L 46.963575,0.41067554 L 46.963575,45.735573 z " /><path
+ style="fill:url(#linearGradient2335);fill-opacity:1;fill-rule:evenodd"
+ id="path2327"
+ d="M 23,29 L 22.954256,44.090942 L 11.111465,44.090942 L 11,29 L 23,29 z "
+ clip-rule="evenodd"
+ sodipodi:nodetypes="ccccc" /><path
+ sodipodi:nodetypes="ccccccccc"
+ id="path2357"
+ d="M 21.780459,9.405584 L 27.339556,9.405584 C 28.123138,9.405584 40.340425,23.805172 40.340425,24.649756 L 39.993267,42.862067 C 39.993267,43.321326 39.84953,43.515532 39.480892,43.515532 L 8.0936894,43.529812 C 7.7250517,43.529812 7.5097258,43.449894 7.5097258,43.076262 L 7.7250676,24.649756 C 7.7250676,23.805172 20.99688,9.405584 21.780459,9.405584 z "
+ style="opacity:0.3125;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1.00000012;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /><path
+ clip-rule="evenodd"
+ d="M 7.2075295,27.943053 L 7.1532728,30.538247 L 25.521437,17.358993 L 40.807832,28.513421 L 40.879142,28.201707 L 24.508686,12.297576 L 7.2075295,27.943053 z "
+ id="path23"
+ style="opacity:0.2;fill:url(#radialGradient2384);fill-opacity:1;fill-rule:evenodd"
+ sodipodi:nodetypes="ccccccc" /><path
+ clip-rule="evenodd"
+ d="M 22,30 L 22,44.090942 L 12.188971,44.090942 L 12,30 L 22,30 z "
+ id="path188"
+ style="fill:url(#linearGradient2412);fill-opacity:1;fill-rule:evenodd"
+ sodipodi:nodetypes="ccccc" /><path
+ style="opacity:0.40909089;fill:url(#radialGradient2325);fill-opacity:1;fill-rule:evenodd"
+ id="path2315"
+ d="M 19.576856,36.44767 C 20.249646,36.44767 20.793472,36.922275 20.793472,37.506177 C 20.793472,38.095988 20.249646,38.574532 19.576856,38.574532 C 18.904584,38.574532 18.35817,38.095988 18.35817,37.506177 C 18.358685,36.922275 18.904584,36.44767 19.576856,36.44767 z "
+ clip-rule="evenodd" /><path
+ clip-rule="evenodd"
+ d="M 19.462314,35.932229 C 20.135103,35.932229 20.678929,36.406834 20.678929,36.990736 C 20.678929,37.580545 20.135103,38.059089 19.462314,38.059089 C 18.790041,38.059089 18.243627,37.580545 18.243627,36.990736 C 18.244142,36.406834 18.790041,35.932229 19.462314,35.932229 z "
+ id="path217"
+ style="fill:url(#radialGradient2313);fill-opacity:1;fill-rule:evenodd" /><path
+ d="M 24.447748,11.559337 L 43.374808,28.729205 L 43.869487,29.121196 L 44.273163,28.949811 L 43.900293,28.188138 L 43.622679,27.964702 L 24.447748,12.392396 L 5.0582327,28.135731 L 4.8206309,28.279851 L 4.603921,28.986637 L 5.0373408,29.115885 L 5.4218948,28.807462 L 24.447748,11.559337 z "
+ id="path342"
+ style="fill:url(#XMLID_39_)"
+ sodipodi:nodetypes="ccccccccccccc" /><path
+ style="fill:#ef2929;stroke:#a40000"
+ id="path362"
+ d="M 24.330168,2.2713382 L 2.4484294,20.372675 L 1.8237005,27.538603 L 3.8236367,29.602926 C 3.8236367,29.602926 24.231018,12.445641 24.44773,12.274963 L 44.08027,29.818223 L 45.978694,27.494226 L 44.362903,20.382852 L 24.44773,2.1668788 L 24.330168,2.2713382 z "
+ sodipodi:nodetypes="cccccccccc" />
+<path
+ style="opacity:0.40909089;color:#000000;fill:url(#radialGradient2305);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 2.8413446,20.613129 L 2.5497894,27.236494 L 24.369219,8.980075 L 24.298891,3.0867443 L 2.8413446,20.613129 z "
+ id="path1536"
+ sodipodi:nodetypes="ccccc" /><path
+ sodipodi:nodetypes="ccccc"
+ id="path2337"
+ d="M 24.483763,8.7509884 L 24.583223,2.9098867 L 43.912186,20.56184 L 45.403998,27.062652 L 24.483763,8.7509884 z "
+ style="opacity:0.13636367;color:#000000;fill:url(#radialGradient2339);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /><path
+ style="opacity:0.31818183;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:0.99999934;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 27.102228,27.719824 L 36.142223,27.719824 C 36.912818,27.719824 37.53319,28.340194 37.53319,29.110791 L 37.525229,38.190012 C 37.525229,38.960608 36.928907,39.455981 36.158311,39.455981 L 27.102228,39.455981 C 26.331631,39.455981 25.711261,38.835608 25.711261,38.065012 L 25.711261,29.110791 C 25.711261,28.340194 26.331631,27.719824 27.102228,27.719824 z "
+ id="rect2361"
+ sodipodi:nodetypes="ccccccccc" /><rect
+ style="opacity:1;color:#000000;fill:#3465a4;fill-opacity:1;fill-rule:nonzero;stroke:#757575;stroke-width:0.9999994;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="rect3263"
+ width="10.001333"
+ height="9.9624557"
+ x="26.507767"
+ y="28.514256"
+ rx="0.38128215"
+ ry="0.38128215" /><path
+ style="opacity:0.39772728;color:#000000;fill:url(#radialGradient2374);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999958;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 27.107118,34.408261 C 30.725101,34.739438 32.634842,32.962557 35.97527,32.855521 L 36,29.00603 L 27.088388,29 L 27.107118,34.408261 z "
+ id="rect2363"
+ sodipodi:nodetypes="ccccc" /></svg> \ No newline at end of file
diff --git a/examples/quick/modelviews/parallax/content/pics/shadow.png b/examples/quick/modelviews/parallax/content/pics/shadow.png
new file mode 100644
index 0000000000..8270565e87
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/pics/shadow.png
Binary files differ
diff --git a/examples/quick/modelviews/parallax/content/pics/yast-joystick.png b/examples/quick/modelviews/parallax/content/pics/yast-joystick.png
new file mode 100644
index 0000000000..858cea0301
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/pics/yast-joystick.png
Binary files differ
diff --git a/examples/quick/modelviews/parallax/content/pics/yast-wol.png b/examples/quick/modelviews/parallax/content/pics/yast-wol.png
new file mode 100644
index 0000000000..7712180a3b
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/pics/yast-wol.png
Binary files differ
diff --git a/examples/quick/modelviews/parallax/content/quit.png b/examples/quick/modelviews/parallax/content/quit.png
new file mode 100644
index 0000000000..b822057d4e
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/quit.png
Binary files differ
diff --git a/examples/quick/modelviews/parallax/content/second.png b/examples/quick/modelviews/parallax/content/second.png
new file mode 100644
index 0000000000..4aa9fb5e8e
--- /dev/null
+++ b/examples/quick/modelviews/parallax/content/second.png
Binary files differ
diff --git a/examples/quick/modelviews/parallax/parallax.qml b/examples/quick/modelviews/parallax/parallax.qml
new file mode 100644
index 0000000000..30578e510e
--- /dev/null
+++ b/examples/quick/modelviews/parallax/parallax.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ width: 320; height: 480
+
+ ParallaxView {
+ id: parallax
+ anchors.fill: parent
+ background: "content/pics/background.jpg"
+
+ Item {
+ property url icon: "content/pics/yast-wol.png"
+ width: 320; height: 480
+ Clock { anchors.centerIn: parent }
+ }
+
+ Item {
+ property url icon: "content/pics/home-page.png"
+ width: 320; height: 480
+ Smiley { }
+ }
+
+ Item {
+ property url icon: "content/pics/yast-joystick.png"
+ width: 320; height: 480
+
+ Loader {
+ anchors { top: parent.top; topMargin: 10; horizontalCenter: parent.horizontalCenter }
+ width: 300; height: 400
+ clip: true;
+ source: "../../samegame/samegame.qml"
+ }
+ }
+ }
+}
diff --git a/examples/quick/modelviews/pathview/pathview-example.qml b/examples/quick/modelviews/pathview/pathview-example.qml
new file mode 100644
index 0000000000..6161343830
--- /dev/null
+++ b/examples/quick/modelviews/pathview/pathview-example.qml
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 400; height: 240
+ color: "white"
+
+ ListModel {
+ id: appModel
+ ListElement { name: "Music"; icon: "pics/AudioPlayer_48.png" }
+ ListElement { name: "Movies"; icon: "pics/VideoPlayer_48.png" }
+ ListElement { name: "Camera"; icon: "pics/Camera_48.png" }
+ ListElement { name: "Calendar"; icon: "pics/DateBook_48.png" }
+ ListElement { name: "Messaging"; icon: "pics/EMail_48.png" }
+ ListElement { name: "Todo List"; icon: "pics/TodoList_48.png" }
+ ListElement { name: "Contacts"; icon: "pics/AddressBook_48.png" }
+ }
+
+ Component {
+ id: appDelegate
+ Item {
+ width: 100; height: 100
+ scale: PathView.iconScale
+
+ Image {
+ id: myIcon
+ y: 20; anchors.horizontalCenter: parent.horizontalCenter
+ source: icon
+ smooth: true
+ }
+ Text {
+ anchors { top: myIcon.bottom; horizontalCenter: parent.horizontalCenter }
+ text: name
+ smooth: true
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: view.currentIndex = index
+ }
+ }
+ }
+
+ Component {
+ id: appHighlight
+ Rectangle { width: 80; height: 80; color: "lightsteelblue" }
+ }
+
+ PathView {
+ id: view
+ anchors.fill: parent
+ highlight: appHighlight
+ preferredHighlightBegin: 0.5
+ preferredHighlightEnd: 0.5
+ focus: true
+ model: appModel
+ delegate: appDelegate
+ path: Path {
+ startX: 10
+ startY: 50
+ PathAttribute { name: "iconScale"; value: 0.5 }
+ PathQuad { x: 200; y: 150; controlX: 50; controlY: 200 }
+ PathAttribute { name: "iconScale"; value: 1.0 }
+ PathQuad { x: 390; y: 50; controlX: 350; controlY: 200 }
+ PathAttribute { name: "iconScale"; value: 0.5 }
+ }
+ }
+}
diff --git a/examples/quick/modelviews/pathview/pics/AddressBook_48.png b/examples/quick/modelviews/pathview/pics/AddressBook_48.png
new file mode 100644
index 0000000000..1ab7c8eec1
--- /dev/null
+++ b/examples/quick/modelviews/pathview/pics/AddressBook_48.png
Binary files differ
diff --git a/examples/quick/modelviews/pathview/pics/AudioPlayer_48.png b/examples/quick/modelviews/pathview/pics/AudioPlayer_48.png
new file mode 100644
index 0000000000..f4b8689f87
--- /dev/null
+++ b/examples/quick/modelviews/pathview/pics/AudioPlayer_48.png
Binary files differ
diff --git a/examples/quick/modelviews/pathview/pics/Camera_48.png b/examples/quick/modelviews/pathview/pics/Camera_48.png
new file mode 100644
index 0000000000..c76b524945
--- /dev/null
+++ b/examples/quick/modelviews/pathview/pics/Camera_48.png
Binary files differ
diff --git a/examples/quick/modelviews/pathview/pics/DateBook_48.png b/examples/quick/modelviews/pathview/pics/DateBook_48.png
new file mode 100644
index 0000000000..58f5787fb8
--- /dev/null
+++ b/examples/quick/modelviews/pathview/pics/DateBook_48.png
Binary files differ
diff --git a/examples/quick/modelviews/pathview/pics/EMail_48.png b/examples/quick/modelviews/pathview/pics/EMail_48.png
new file mode 100644
index 0000000000..d6d84a61be
--- /dev/null
+++ b/examples/quick/modelviews/pathview/pics/EMail_48.png
Binary files differ
diff --git a/examples/quick/modelviews/pathview/pics/TodoList_48.png b/examples/quick/modelviews/pathview/pics/TodoList_48.png
new file mode 100644
index 0000000000..0988448d9b
--- /dev/null
+++ b/examples/quick/modelviews/pathview/pics/TodoList_48.png
Binary files differ
diff --git a/examples/quick/modelviews/pathview/pics/VideoPlayer_48.png b/examples/quick/modelviews/pathview/pics/VideoPlayer_48.png
new file mode 100644
index 0000000000..52638c50a7
--- /dev/null
+++ b/examples/quick/modelviews/pathview/pics/VideoPlayer_48.png
Binary files differ
diff --git a/examples/quick/modelviews/stringlistmodel/main.cpp b/examples/quick/modelviews/stringlistmodel/main.cpp
new file mode 100644
index 0000000000..12859316a3
--- /dev/null
+++ b/examples/quick/modelviews/stringlistmodel/main.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QStringList>
+
+#include <qqmlengine.h>
+#include <qqmlcontext.h>
+#include <qqml.h>
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/qquickview.h>
+
+
+/*
+ This example illustrates exposing a QStringList as a
+ model in QML
+*/
+
+int main(int argc, char ** argv)
+{
+ QGuiApplication app(argc, argv);
+
+//![0]
+ QStringList dataList;
+ dataList.append("Item 1");
+ dataList.append("Item 2");
+ dataList.append("Item 3");
+ dataList.append("Item 4");
+
+ QQuickView view;
+ QQmlContext *ctxt = view.rootContext();
+ ctxt->setContextProperty("myModel", QVariant::fromValue(dataList));
+//![0]
+
+ view.setSource(QUrl("qrc:view.qml"));
+ view.show();
+
+ return app.exec();
+}
+
diff --git a/examples/quick/modelviews/stringlistmodel/stringlistmodel.pro b/examples/quick/modelviews/stringlistmodel/stringlistmodel.pro
new file mode 100644
index 0000000000..19e62cd1b7
--- /dev/null
+++ b/examples/quick/modelviews/stringlistmodel/stringlistmodel.pro
@@ -0,0 +1,4 @@
+QT += qml quick
+
+SOURCES += main.cpp
+RESOURCES += stringlistmodel.qrc
diff --git a/examples/quick/modelviews/stringlistmodel/stringlistmodel.qrc b/examples/quick/modelviews/stringlistmodel/stringlistmodel.qrc
new file mode 100644
index 0000000000..17e9301471
--- /dev/null
+++ b/examples/quick/modelviews/stringlistmodel/stringlistmodel.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>view.qml</file>
+</qresource>
+</RCC>
diff --git a/examples/quick/modelviews/stringlistmodel/view.qml b/examples/quick/modelviews/stringlistmodel/view.qml
new file mode 100644
index 0000000000..945763c295
--- /dev/null
+++ b/examples/quick/modelviews/stringlistmodel/view.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+//![0]
+
+ListView {
+ width: 100; height: 100
+
+ model: myModel
+ delegate: Rectangle {
+ height: 25
+ width: 100
+ Text { text: modelData }
+ }
+}
+//![0]
diff --git a/examples/quick/modelviews/visualdatamodel/dragselection.qml b/examples/quick/modelviews/visualdatamodel/dragselection.qml
new file mode 100644
index 0000000000..c3186a5ad8
--- /dev/null
+++ b/examples/quick/modelviews/visualdatamodel/dragselection.qml
@@ -0,0 +1,200 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ width: 320
+ height: 480
+
+ property bool dragging: false
+
+ Component {
+ id: packageDelegate
+ Package {
+ id: packageRoot
+
+ MouseArea {
+ id: visibleContainer
+ Package.name: "visible"
+
+ width: 64
+ height: 64
+ enabled: packageRoot.VisualDataModel.inSelected
+
+ drag.target: draggable
+
+ Item {
+ id: draggable
+
+ width: 64
+ height: 64
+
+ Drag.active: visibleContainer.drag.active
+
+ anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter }
+
+ states: State {
+ when: visibleContainer.drag.active
+ AnchorChanges { target: draggable; anchors { horizontalCenter: undefined; verticalCenter: undefined} }
+ ParentChange { target: selectionView; parent: draggable; x: 0; y: 0 }
+ PropertyChanges { target: root; dragging: true }
+ ParentChange { target: draggable; parent: root }
+ }
+ }
+ DropArea {
+ anchors.fill: parent
+ onEntered: selectedItems.move(0, visualModel.items.get(packageRoot.VisualDataModel.itemsIndex), selectedItems.count)
+ }
+ }
+ Item {
+ id: selectionContainer
+ Package.name: "selection"
+
+ width: 64
+ height: 64
+
+ visible: PathView.onPath
+ }
+ Rectangle {
+ id: content
+ parent: visibleContainer
+
+ width: 58
+ height: 58
+
+ radius: 8
+
+ gradient: Gradient {
+ GradientStop { id: gradientStart; position: 0.0; color: "#8AC953" }
+ GradientStop { id: gradientEnd; position: 1.0; color: "#8BC953" }
+ }
+
+ border.width: 2
+ border.color: "#007423"
+
+ state: root.dragging && packageRoot.VisualDataModel.inSelected ? "selected" : "visible"
+
+ Text {
+ anchors.fill: parent
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ color: "white"
+ text: modelData
+ font.pixelSize: 18
+ }
+
+ Rectangle {
+ anchors { right: parent.right; top: parent.top; margins: 3 }
+ width: 12; height: 12
+ color: packageRoot.VisualDataModel.inSelected ? "black" : "white"
+ radius: 6
+
+ border.color: "white"
+ border.width: 2
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: packageRoot.VisualDataModel.inSelected = !packageRoot.VisualDataModel.inSelected
+ }
+ }
+
+ states: [
+ State {
+ name: "selected"
+ ParentChange { target: content; parent: selectionContainer; x: 3; y: 3 }
+ PropertyChanges { target: packageRoot; VisualDataModel.inItems: visibleContainer.drag.active }
+ PropertyChanges { target: gradientStart; color: "#017423" }
+ PropertyChanges { target: gradientStart; color: "#007423" }
+ }, State {
+ name: "visible"
+ PropertyChanges { target: packageRoot; VisualDataModel.inItems: true }
+ ParentChange { target: content; parent: visibleContainer; x: 3; y: 3 }
+ PropertyChanges { target: gradientStart; color: "#8AC953" }
+ PropertyChanges { target: gradientStart; color: "#8BC953" }
+ }
+ ]
+ transitions: Transition {
+ PropertyAction { target: packageRoot; properties: "VisualDataModel.inItems" }
+ ParentAnimation {
+ target: content
+ NumberAnimation { target: content; properties: "x,y"; duration: 500 }
+ }
+ ColorAnimation { targets: [gradientStart, gradientEnd]; duration: 500 }
+ }
+ }
+ }
+ }
+
+ VisualDataModel {
+ id: visualModel
+ model: 35
+ delegate: packageDelegate
+
+ groups: VisualDataGroup { id: selectedItems; name: "selected" }
+
+ Component.onCompleted: parts.selection.filterOnGroup = "selected"
+ }
+
+ PathView {
+ id: selectionView
+
+ height: 64
+ width: 64
+
+ model: visualModel.parts.selection
+
+ path: Path {
+ startX: 0
+ startY: 0
+ PathLine { x: 64; y: 64 }
+ }
+ }
+
+ GridView {
+ id: itemsView
+ anchors { fill: parent }
+ cellWidth: 64
+ cellHeight: 64
+ model: visualModel.parts.visible
+ }
+}
diff --git a/examples/quick/modelviews/visualdatamodel/slideshow.qml b/examples/quick/modelviews/visualdatamodel/slideshow.qml
new file mode 100644
index 0000000000..040c6be307
--- /dev/null
+++ b/examples/quick/modelviews/visualdatamodel/slideshow.qml
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.XmlListModel 2.0
+
+Rectangle {
+ id: root
+
+ property Item displayItem: null
+
+ width: 300; height: 400
+
+ color: "black"
+
+ VisualDataModel {
+ id: visualModel
+
+ model: XmlListModel {
+ source: "http://api.flickr.com/services/feeds/photos_public.gne?format=rss2"
+ query: "/rss/channel/item"
+ namespaceDeclarations: "declare namespace media=\"http://search.yahoo.com/mrss/\";"
+
+ XmlRole { name: "imagePath"; query: "media:thumbnail/@url/string()" }
+ XmlRole { name: "url"; query: "media:content/@url/string()" }
+ }
+
+ delegate: Item {
+ id: delegateItem
+
+ width: 76; height: 76
+
+ Rectangle {
+ id: image
+ x: 0; y: 0; width: 76; height: 76
+ border.width: 1
+ border.color: "white"
+ color: "black"
+
+ Image {
+ anchors.fill: parent
+ anchors.leftMargin: 1
+ anchors.topMargin: 1
+
+ source: imagePath
+ fillMode: Image.PreserveAspectFit
+
+ }
+
+ MouseArea {
+ id: clickArea
+ anchors.fill: parent
+
+ onClicked: root.displayItem = root.displayItem !== delegateItem ? delegateItem : null
+ }
+
+ states: [
+ State {
+ when: root.displayItem === delegateItem
+ name: "inDisplay";
+ ParentChange { target: image; parent: imageContainer; x: 75; y: 75; width: 150; height: 150 }
+ PropertyChanges { target: image; z: 2 }
+ PropertyChanges { target: delegateItem; VisualDataModel.inItems: false }
+ },
+ State {
+ when: root.displayItem !== delegateItem
+ name: "inList";
+ ParentChange { target: image; parent: delegateItem; x: 2; y: 2; width: 75; height: 75 }
+ PropertyChanges { target: image; z: 1 }
+ PropertyChanges { target: delegateItem; VisualDataModel.inItems: true }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "inList"
+ SequentialAnimation {
+ PropertyAction { target: delegateItem; property: "VisualDataModel.inPersistedItems"; value: true }
+ ParentAnimation {
+ target: image;
+ via: root
+ NumberAnimation { target: image; properties: "x,y,width,height"; duration: 1000 }
+ }
+ }
+ }, Transition {
+ from: "inDisplay"
+ SequentialAnimation {
+ ParentAnimation {
+ target: image
+ NumberAnimation { target: image; properties: "x,y,width,height"; duration: 1000 }
+ }
+ PropertyAction { target: delegateItem; property: "VisualDataModel.inPersistedItems"; value: false }
+ }
+ }
+ ]
+ }
+ }
+ }
+
+
+ PathView {
+ id: imagePath
+
+ anchors { left: parent.left; top: imageContainer.bottom; right: parent.right; bottom: parent.bottom }
+ model: visualModel
+
+ pathItemCount: 7
+ path: Path {
+ startX: -50; startY: 0
+ PathQuad { x: 150; y: 50; controlX: 0; controlY: 50 }
+ PathQuad { x: 350; y: 0; controlX: 300; controlY: 50 }
+ }
+ }
+
+ Item {
+ id: imageContainer
+ anchors { fill: parent; bottomMargin: 100 }
+ }
+}
diff --git a/examples/quick/modelviews/visualdatamodel/sortedmodel.qml b/examples/quick/modelviews/visualdatamodel/sortedmodel.qml
new file mode 100644
index 0000000000..8d3b0a58e5
--- /dev/null
+++ b/examples/quick/modelviews/visualdatamodel/sortedmodel.qml
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 480; height: 640
+
+ Component {
+ id: numberDelegate
+
+ Text {
+ id: numberText
+ anchors { left: parent.left; right: parent.right }
+ text: number
+
+ horizontalAlignment: Text.AlignHCenter
+ font.pixelSize: 18
+
+ Text {
+ anchors { left: parent.left; baseline: parent.baseline }
+ text: index
+
+ horizontalAlignment: Text.AlignLeft
+ font.pixelSize: 12
+ }
+ Text {
+ anchors { right: parent.right; baseline: parent.baseline }
+ text: numberText.VisualDataModel.itemsIndex
+
+ horizontalAlignment: Text.AlignRight
+ font.pixelSize: 12
+ }
+ }
+ }
+
+ ListView {
+ anchors {
+ left: parent.left; top: parent.top;
+ right: parent.horizontalCenter; bottom: button.top
+ leftMargin: 2; topMargin: 2; rightMargin: 1; bottomMargin: 2
+ }
+
+ model: ListModel {
+ id: unsortedModel
+ }
+ delegate: numberDelegate
+ }
+ ListView {
+ anchors {
+ left: parent.horizontalCenter; top: parent.top;
+ right: parent.right; bottom: button.top
+ leftMargin: 1; topMargin: 2; rightMargin: 2; bottomMargin: 2
+ }
+ model: VisualDataModel {
+ model: unsortedModel
+ delegate: numberDelegate
+
+ items.onChanged: {
+ for (var i = 0; i < inserted.length; ++i) {
+ for (var j = inserted[i].index; j < inserted[i].index + inserted[i].count; ++j) {
+ var number = items.get(j).model.number
+ for (var l = 0, k = 0; l < unsortedModel.count; ++l) {
+ if (l == inserted[k].index) {
+ l += inserted[k].count - 1
+ ++k
+ } else if (number < items.get(l).model.number) {
+ items.move(j, l, 1)
+ break
+ }
+ }
+ inserted[i].index += 1;
+ inserted[i].count -= 1;
+ }
+ }
+ }
+ }
+ }
+
+ Rectangle {
+ id: button
+
+ anchors { left: parent.left; right: parent.right; bottom: parent.bottom; margins: 2 }
+ height: moreText.implicitHeight + 4
+
+ color: "black"
+
+ Text {
+ id: moreText
+
+ anchors.fill: parent
+ text: "More"
+ color: "white"
+ font.pixelSize: 18
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ MouseArea {
+ anchors.fill: parent
+
+ onClicked: unsortedModel.append({ "number": Math.floor(Math.random() * 100) })
+ }
+ }
+}
diff --git a/examples/quick/modelviews/visualdatamodel/visualdatamodel.qmlproject b/examples/quick/modelviews/visualdatamodel/visualdatamodel.qmlproject
new file mode 100644
index 0000000000..2bb4016996
--- /dev/null
+++ b/examples/quick/modelviews/visualdatamodel/visualdatamodel.qmlproject
@@ -0,0 +1,14 @@
+import QmlProject 1.0
+
+Project {
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/modelviews/visualitemmodel/visualitemmodel.qml b/examples/quick/modelviews/visualitemmodel/visualitemmodel.qml
new file mode 100644
index 0000000000..2e012adec6
--- /dev/null
+++ b/examples/quick/modelviews/visualitemmodel/visualitemmodel.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// This example demonstrates placing items in a view using
+// a VisualItemModel
+
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ color: "lightgray"
+ width: 320
+ height: 480
+ property bool printDestruction: false
+
+ VisualItemModel {
+ id: itemModel
+
+ Rectangle {
+ width: view.width; height: view.height
+ color: "#FFFEF0"
+ Text { text: "Page 1"; font.bold: true; anchors.centerIn: parent }
+
+ Component.onDestruction: if (printDestruction) print("destroyed 1")
+ }
+ Rectangle {
+ width: view.width; height: view.height
+ color: "#F0FFF7"
+ Text { text: "Page 2"; font.bold: true; anchors.centerIn: parent }
+
+ Component.onDestruction: if (printDestruction) print("destroyed 2")
+ }
+ Rectangle {
+ width: view.width; height: view.height
+ color: "#F4F0FF"
+ Text { text: "Page 3"; font.bold: true; anchors.centerIn: parent }
+
+ Component.onDestruction: if (printDestruction) print("destroyed 3")
+ }
+ }
+
+ ListView {
+ id: view
+ anchors { fill: parent; bottomMargin: 30 }
+ model: itemModel
+ preferredHighlightBegin: 0; preferredHighlightEnd: 0
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ orientation: ListView.Horizontal
+ snapMode: ListView.SnapOneItem; flickDeceleration: 2000
+ cacheBuffer: 200
+ }
+
+ Rectangle {
+ width: root.width; height: 30
+ anchors { top: view.bottom; bottom: parent.bottom }
+ color: "gray"
+
+ Row {
+ anchors.centerIn: parent
+ spacing: 20
+
+ Repeater {
+ model: itemModel.count
+
+ Rectangle {
+ width: 5; height: 5
+ radius: 3
+ color: view.currentIndex == index ? "blue" : "white"
+
+ MouseArea {
+ width: 20; height: 20
+ anchors.centerIn: parent
+ onClicked: view.currentIndex = index
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quick/mousearea/mousearea-example.qml b/examples/quick/mousearea/mousearea-example.qml
new file mode 100644
index 0000000000..30e3e62864
--- /dev/null
+++ b/examples/quick/mousearea/mousearea-example.qml
@@ -0,0 +1,176 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: box
+ width: 400; height: 300
+
+ Rectangle {
+ id: redSquare
+ width: 120; height: 120
+ anchors.top: parent.top; anchors.left: parent.left; anchors.margins: 10
+ color: "red"
+
+ Text { text: "Click"; font.pixelSize: 16; anchors.centerIn: parent }
+
+ MouseArea {
+ anchors.fill: parent
+ hoverEnabled: true
+ property string buttonID
+
+ acceptedButtons: Qt.AllButtons
+ // Value 'All.Buttons' is eqivalent to:
+ // 'Qt::LeftButton | Qt::RightButton | Qt::MiddleButton .... | Qt::ExtraButton24'
+
+ onEntered: info.text = 'Entered'
+ onExited: info.text = 'Exited (pressed=' + pressed + ')'
+
+ onPressed: {
+ if (mouse.button == Qt.LeftButton)
+ buttonID = 'LeftButton'
+ else if (mouse.button == Qt.RightButton)
+ buttonID = 'RightButton'
+ else if (mouse.button == Qt.MidButton)
+ buttonID = 'MiddleButton'
+ else if (mouse.button == Qt.BackButton)
+ buttonID = 'BackButton'
+ else if (mouse.button == Qt.ForwardButton)
+ buttonID = 'ForwardButton'
+ else if (mouse.button == Qt.TaskButton)
+ buttonID = 'TaskButton'
+ else if (mouse.button == Qt.ExtraButton4)
+ buttonID = 'ExtraButton4'
+ else if (mouse.button == Qt.ExtraButton5)
+ buttonID = 'ExtraButton5'
+ else if (mouse.button == Qt.ExtraButton6)
+ buttonID = 'ExtraButton6'
+ else if (mouse.button == Qt.ExtraButton7)
+ buttonID = 'ExtraButton7'
+ else if (mouse.button == Qt.ExtraButton8)
+ buttonID = 'ExtraButton8'
+ else if (mouse.button == Qt.ExtraButton9)
+ buttonID = 'ExtraButton9'
+ else if (mouse.button == Qt.ExtraButton10)
+ buttonID = 'ExtraButton10'
+ else if (mouse.button == Qt.ExtraButton11)
+ buttonID = 'ExtraButton11'
+ else if (mouse.button == Qt.ExtraButton12)
+ buttonID = 'ExtraButton12'
+ else if (mouse.button == Qt.ExtraButton13)
+ buttonID = 'ExtraButton13'
+ else if (mouse.button == Qt.ExtraButton14)
+ buttonID = 'ExtraButton14'
+ else if (mouse.button == Qt.ExtraButton15)
+ buttonID = 'ExtraButton15'
+ else if (mouse.button == Qt.ExtraButton16)
+ buttonID = 'ExtraButton16'
+ else if (mouse.button == Qt.ExtraButton17)
+ buttonID = 'ExtraButton17'
+ else if (mouse.button == Qt.ExtraButton18)
+ buttonID = 'ExtraButton18'
+ else if (mouse.button == Qt.ExtraButton19)
+ buttonID = 'ExtraButton19'
+ else if (mouse.button == Qt.ExtraButton20)
+ buttonID = 'ExtraButton20'
+ else if (mouse.button == Qt.ExtraButton21)
+ buttonID = 'ExtraButton21'
+ else if (mouse.button == Qt.ExtraButton22)
+ buttonID = 'ExtraButton22'
+ else if (mouse.button == Qt.ExtraButton23)
+ buttonID = 'ExtraButton23'
+ else if (mouse.button == Qt.ExtraButton24)
+ buttonID = 'ExtraButton24'
+
+ info.text = 'Pressed (' + buttonID + ' shift='
+ + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')'
+ var posInBox = redSquare.mapToItem(box, mouse.x, mouse.y)
+ posInfo.text = + mouse.x + ',' + mouse.y + ' in square'
+ + ' (' + posInBox.x + ',' + posInBox.y + ' in window)'
+ }
+
+ onReleased: {
+ btn.text = 'Released (isClick=' + mouse.isClick + ' wasHeld=' + mouse.wasHeld + ')'
+ posInfo.text = ''
+ }
+
+ onPressAndHold: btn.text = 'Press and hold'
+ onClicked: btn.text = 'Clicked (wasHeld=' + mouse.wasHeld + ')'
+ onDoubleClicked: btn.text = 'Double clicked'
+ }
+ }
+
+ Rectangle {
+ id: blueSquare
+ width: 120; height: 120
+ x: box.width - width - 10; y: 10 // making this item draggable, so don't use anchors
+ color: "blue"
+
+ Text { text: "Drag"; font.pixelSize: 16; color: "white"; anchors.centerIn: parent }
+
+ MouseArea {
+ anchors.fill: parent
+ drag.target: blueSquare
+ drag.axis: Drag.XandYAxis
+ drag.minimumX: 0
+ drag.maximumX: box.width - parent.width
+ drag.minimumY: 0
+ drag.maximumY: box.height - parent.width
+ }
+ }
+
+ Text {
+ id: info
+ anchors.bottom: btn.top; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 20
+
+ onTextChanged: console.log(text)
+ }
+
+ Text {
+ id: btn
+ anchors.bottom: posInfo.top; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 20
+ }
+
+ Text {
+ id: posInfo
+ anchors.bottom: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 20
+ }
+}
diff --git a/examples/quick/openglunderqml/main.cpp b/examples/quick/openglunderqml/main.cpp
new file mode 100644
index 0000000000..3b682deaec
--- /dev/null
+++ b/examples/quick/openglunderqml/main.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+
+#include <QtQuick/QQuickView>
+
+#include "squircle.h"
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+ qmlRegisterType<Squircle>("QtQuick", 2, 0, "Squircle");
+
+ QQuickView view;
+ view.setSource(QUrl("main.qml"));
+ view.show();
+
+ return app.exec();
+
+}
diff --git a/examples/quick/openglunderqml/main.qml b/examples/quick/openglunderqml/main.qml
new file mode 100644
index 0000000000..1485cbbdb8
--- /dev/null
+++ b/examples/quick/openglunderqml/main.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+
+ width: 400
+ height: 300
+
+ Squircle {
+ SequentialAnimation on t {
+ NumberAnimation { to: 1; duration: 2500; easing.type: Easing.InQuad }
+ NumberAnimation { to: 0; duration: 2500; easing.type: Easing.OutQuad }
+ loops: Animation.Infinite
+ running: true
+ }
+ }
+
+ Rectangle {
+ color: Qt.rgba(1, 1, 1, 0.8);
+ radius: 10
+ border.width: 1
+ border.color: "white"
+ anchors.fill: label
+ anchors.margins: -10
+ }
+
+ Text {
+ id: label
+ color: "black"
+ wrapMode: Text.WordWrap
+ text: "The background here is a squircle rendered with raw OpenGL using the 'beforeRender()' signal in QQuickCanvas. This text label and its border is rendered using QML"
+ anchors.right: parent.right
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ anchors.margins: 20
+ }
+
+}
diff --git a/examples/quick/openglunderqml/openglunderqml.pro b/examples/quick/openglunderqml/openglunderqml.pro
new file mode 100644
index 0000000000..64a58b3729
--- /dev/null
+++ b/examples/quick/openglunderqml/openglunderqml.pro
@@ -0,0 +1,6 @@
+QT += qml quick
+
+HEADERS += squircle.h
+SOURCES += squircle.cpp main.cpp
+
+OTHER_FILES += main.qml
diff --git a/examples/quick/openglunderqml/squircle.cpp b/examples/quick/openglunderqml/squircle.cpp
new file mode 100644
index 0000000000..b56f0baaf6
--- /dev/null
+++ b/examples/quick/openglunderqml/squircle.cpp
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "squircle.h"
+
+#include <QtQuick/qsgengine.h>
+#include <QtQuick/qquickcanvas.h>
+#include <QOpenGLShaderProgram>
+
+Squircle::Squircle()
+ : m_program(0)
+{
+ setFlag(ItemHasContents);
+}
+
+void Squircle::itemChange(ItemChange change, const ItemChangeData &)
+{
+ // The ItemSceneChange event is sent when we are first attached to a canvas.
+ if (change == ItemSceneChange) {
+ QQuickCanvas *c = canvas();
+
+ // Connect our the beforeRendering signal to our paint function.
+ // Since this call is executed on the rendering thread it must be
+ // a Qt::DirectConnection
+ connect(c, SIGNAL(beforeRendering()), this, SLOT(paint()), Qt::DirectConnection);
+
+ // If we allow QML to do the clearing, they would clear what we paint
+ // and nothing would show.
+ c->setClearBeforeRendering(false);
+ }
+}
+
+
+void Squircle::paint()
+{
+ if (!m_program) {
+ m_program = new QOpenGLShaderProgram();
+ m_program->addShaderFromSourceCode(QOpenGLShader::Vertex,
+ "attribute highp vec4 vertices;"
+ "varying highp vec2 coords;"
+ "void main() {"
+ " gl_Position = vertices;"
+ " coords = vertices.xy;"
+ "}");
+ m_program->addShaderFromSourceCode(QOpenGLShader::Fragment,
+ "uniform lowp float t;"
+ "varying highp vec2 coords;"
+ "void main() {"
+ " lowp float i = 1. - (pow(coords.x, 4.) + pow(coords.y, 4.));"
+ " i = smoothstep(t - 0.3, t + 0.3, i);"
+ " gl_FragColor = vec4(coords / 2. + .5, i, i);"
+ "}");
+
+ m_program->bindAttributeLocation("vertices", 0);
+ m_program->link();
+ }
+
+ m_program->bind();
+
+ m_program->enableAttributeArray(0);
+
+ float values[] = {
+ -1, -1,
+ 1, -1,
+ -1, 1,
+ 1, 1
+ };
+ m_program->setAttributeArray(0, GL_FLOAT, values, 2);
+ m_program->setUniformValue("t", (float) m_t);
+
+ glDisable(GL_DEPTH_TEST);
+
+ glClearColor(0, 0, 0, 1);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+ m_program->disableAttributeArray(0);
+ m_program->release();
+}
+
+
diff --git a/examples/quick/openglunderqml/squircle.h b/examples/quick/openglunderqml/squircle.h
new file mode 100644
index 0000000000..283131a662
--- /dev/null
+++ b/examples/quick/openglunderqml/squircle.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SQUIRCLE_H
+#define SQUIRCLE_H
+
+#include <QtQuick/QQuickItem>
+#include <QtGui/QOpenGLShaderProgram>
+
+class Squircle : public QQuickItem
+{
+ Q_OBJECT
+
+ Q_PROPERTY(qreal t READ t WRITE setT NOTIFY tChanged)
+
+public:
+ Squircle();
+
+ qreal t() const { return m_t; }
+ void setT(qreal t) { m_t = t; emit tChanged(); }
+
+ void itemChange(ItemChange change, const ItemChangeData &);
+
+signals:
+ void tChanged();
+
+public slots:
+ void paint();
+
+private:
+ QOpenGLShaderProgram *m_program;
+
+ qreal m_t;
+ bool m_render_under;
+ bool m_render_over;
+};
+
+#endif // SQUIRCLE_H
diff --git a/examples/quick/painteditem/painteditem.pro b/examples/quick/painteditem/painteditem.pro
new file mode 100644
index 0000000000..e3afd6b0f0
--- /dev/null
+++ b/examples/quick/painteditem/painteditem.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+
+SUBDIRS = \
+ smile \
+ textballoons
diff --git a/examples/quick/painteditem/smile/main.cpp b/examples/quick/painteditem/smile/main.cpp
new file mode 100644
index 0000000000..1c7888b10b
--- /dev/null
+++ b/examples/quick/painteditem/smile/main.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QPainter>
+#include <QtQml/qqml.h>
+#include <QtQuick/qquickview.h>
+#include <QtQuick/qquickpainteditem.h>
+class MyPaintItem : public QQuickPaintedItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QString face READ face WRITE setFace NOTIFY faceChanged)
+public:
+ MyPaintItem()
+ : QQuickPaintedItem()
+ , m_face(QLatin1String(":-)"))
+ {
+ setAntialiasing(true);
+ }
+ QString face() const {return m_face;}
+ void setFace(const QString &face) {
+ if (m_face != face) {
+ m_face = face;
+ emit faceChanged();
+ }
+ }
+ virtual void paint(QPainter *p)
+ {
+ QRectF rect(0, 0, width(), height());
+ rect.adjust(10, 10, -10, -10);
+ p->setPen(QPen(Qt::black, 20));
+ p->setBrush(Qt::yellow);
+ p->drawEllipse(rect);
+ p->setPen(Qt::black);
+ p->setFont(QFont(QLatin1String("Times"), qRound(rect.height() / 2)));
+ p->drawText(rect, Qt::AlignCenter, m_face);
+ }
+signals:
+ void faceChanged();
+private:
+ QString m_face;
+};
+
+int main(int argc, char ** argv)
+{
+ QGuiApplication app(argc, argv);
+
+ qmlRegisterType<MyPaintItem>("MyModule", 1, 0, "MyPaintItem");
+
+ QQuickView view;
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.setSource(QUrl::fromLocalFile("smile.qml"));
+ view.show();
+ view.raise();
+
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/examples/quick/painteditem/smile/smile.pro b/examples/quick/painteditem/smile/smile.pro
new file mode 100644
index 0000000000..b1af4ee0ad
--- /dev/null
+++ b/examples/quick/painteditem/smile/smile.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+TARGET = painteditem
+
+QT += qml quick
+
+macx: CONFIG -= app_bundle
+
+SOURCES += main.cpp
+
+CONFIG += console
+
diff --git a/examples/quick/painteditem/smile/smile.qml b/examples/quick/painteditem/smile/smile.qml
new file mode 100644
index 0000000000..33919bc04f
--- /dev/null
+++ b/examples/quick/painteditem/smile/smile.qml
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import MyModule 1.0
+
+Rectangle {
+ width: 500
+ height: 500
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#00249a" }
+ GradientStop { position: 0.7; color: "#ffd94f" }
+ GradientStop { position: 1.0; color: "#ffa322" }
+ }
+ MyPaintItem {
+ renderTarget:PaintedItem.Image
+ clip:true
+ width:240
+ height:240
+ anchors.left : parent.left
+ anchors.top :parent.top
+ anchors.margins: 10
+ smooth: true
+ MouseArea {
+ anchors.fill:parent
+ onClicked: {
+ if (parent.face == ":-)")
+ parent.face = ":-(";
+ else
+ parent.face = ":-)";
+ parent.update()
+ }
+ }
+ }
+ MyPaintItem {
+ clip:true
+ renderTarget:PaintedItem.Image
+ width:240
+ height:240
+ anchors.right : parent.right
+ anchors.top :parent.top
+ anchors.margins: 10
+ smooth: true
+ MouseArea {
+ anchors.fill:parent
+ onClicked: {
+ if (parent.face == ":-)")
+ parent.face = ":-(";
+ else
+ parent.face = ":-)";
+ parent.update()
+ }
+ }
+ }
+ MyPaintItem {
+ clip:true
+ renderTarget:PaintedItem.Image
+ width:240
+ height:240
+ anchors.left : parent.left
+ anchors.bottom :parent.bottom
+ anchors.margins: 10
+ smooth: true
+ MouseArea {
+ anchors.fill:parent
+ onClicked: {
+ if (parent.face == ":-)")
+ parent.face = ":-(";
+ else
+ parent.face = ":-)";
+ parent.update()
+ }
+ }
+ }
+ MyPaintItem {
+ clip:true
+ renderTarget:PaintedItem.Image
+ width:240
+ height:240
+ anchors.right : parent.right
+ anchors.bottom :parent.bottom
+ anchors.margins: 10
+ smooth: true
+ MouseArea {
+ anchors.fill:parent
+ onClicked: {
+ if (parent.face == ":-)")
+ parent.face = ":-(";
+ else
+ parent.face = ":-)";
+ parent.update()
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/examples/quick/painteditem/textballoons/TextBalloonPlugin/plugin.h b/examples/quick/painteditem/textballoons/TextBalloonPlugin/plugin.h
new file mode 100644
index 0000000000..c500c1c525
--- /dev/null
+++ b/examples/quick/painteditem/textballoons/TextBalloonPlugin/plugin.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QQmlExtensionPlugin>
+
+#include "../textballoon.h"
+
+class TextBalloonPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" FILE "textballoon.json")
+public:
+ void registerTypes(const char *uri)
+ {
+ qmlRegisterType<TextBalloon>(uri, 1, 0, "TextBalloon");
+ }
+};
diff --git a/examples/quick/painteditem/textballoons/TextBalloonPlugin/qmldir b/examples/quick/painteditem/textballoons/TextBalloonPlugin/qmldir
new file mode 100644
index 0000000000..e8a08ae9d3
--- /dev/null
+++ b/examples/quick/painteditem/textballoons/TextBalloonPlugin/qmldir
@@ -0,0 +1 @@
+plugin qmltextballoonplugin
diff --git a/examples/quick/painteditem/textballoons/textballoon.cpp b/examples/quick/painteditem/textballoons/textballoon.cpp
new file mode 100644
index 0000000000..d097adfe1b
--- /dev/null
+++ b/examples/quick/painteditem/textballoons/textballoon.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "textballoon.h"
+
+//! [0]
+TextBalloon::TextBalloon(QQuickItem *parent)
+ : QQuickPaintedItem(parent)
+ , rightAligned(false)
+{
+}
+//! [0]
+
+//! [1]
+void TextBalloon::paint(QPainter *painter)
+{
+ QBrush brush(QColor("#007430"));
+
+ painter->setBrush(brush);
+ painter->setPen(Qt::NoPen);
+ painter->setRenderHint(QPainter::Antialiasing);
+
+ painter->drawRoundedRect(0, 0, boundingRect().width(), boundingRect().height() - 10, 10, 10);
+
+ if (rightAligned)
+ {
+ const QPointF points[3] = {
+ QPointF(boundingRect().width() - 10.0, boundingRect().height() - 10.0),
+ QPointF(boundingRect().width() - 20.0, boundingRect().height()),
+ QPointF(boundingRect().width() - 30.0, boundingRect().height() - 10.0),
+ };
+ painter->drawConvexPolygon(points, 3);
+ }
+ else
+ {
+ const QPointF points[3] = {
+ QPointF(10.0, boundingRect().height() - 10.0),
+ QPointF(20.0, boundingRect().height()),
+ QPointF(30.0, boundingRect().height() - 10.0),
+ };
+ painter->drawConvexPolygon(points, 3);
+ }
+}
+//! [1]
+
+bool TextBalloon::isRightAligned()
+{
+ return this->rightAligned;
+}
+
+void TextBalloon::setRightAligned(bool rightAligned)
+{
+ this->rightAligned = rightAligned;
+}
diff --git a/examples/quick/painteditem/textballoons/textballoon.h b/examples/quick/painteditem/textballoons/textballoon.h
new file mode 100644
index 0000000000..93ed0a7105
--- /dev/null
+++ b/examples/quick/painteditem/textballoons/textballoon.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TEXTBALLOON_H
+#define TEXTBALLOON_H
+
+#include <QtQuick>
+
+//! [0]
+class TextBalloon : public QQuickPaintedItem
+{
+ Q_OBJECT
+ Q_PROPERTY(bool rightAligned READ isRightAligned WRITE setRightAligned NOTIFY rightAlignedChanged)
+
+ public:
+ TextBalloon(QQuickItem *parent = 0);
+ void paint(QPainter *painter);
+
+ bool isRightAligned();
+ void setRightAligned(bool rightAligned);
+
+ private:
+ bool rightAligned;
+
+ signals:
+ void rightAlignedChanged();
+};
+//! [0]
+
+#endif
diff --git a/examples/quick/painteditem/textballoons/textballoon.json b/examples/quick/painteditem/textballoons/textballoon.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/examples/quick/painteditem/textballoons/textballoon.json
@@ -0,0 +1 @@
+{}
diff --git a/examples/quick/painteditem/textballoons/textballoons.pro b/examples/quick/painteditem/textballoons/textballoons.pro
new file mode 100644
index 0000000000..d612048ee8
--- /dev/null
+++ b/examples/quick/painteditem/textballoons/textballoons.pro
@@ -0,0 +1,25 @@
+TEMPLATE = lib
+CONFIG += qt plugin
+QT += qml quick
+
+TARGET = qmltextballoonplugin
+
+HEADERS += TextBalloonPlugin/plugin.h \
+ textballoon.h
+
+SOURCES += textballoon.cpp
+
+OTHER_FILES += textballoon.json
+
+DESTDIR = TextBalloonPlugin
+
+qdeclarativesources.files += \
+ TextBalloonPlugin/qmldir
+
+qdeclarativesources.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/painteditem/textballoons/TextBalloonPlugin
+
+sources.files = textballoons.qml
+sources.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/painteditem/textballoons
+target.path += $$[QT_INSTALL_EXAMPLES]/qtdeclarative/qml/painteditem/textballoons/TextBalloonPlugin
+
+INSTALLS = qdeclarativesources sources target
diff --git a/examples/quick/painteditem/textballoons/textballoons.qml b/examples/quick/painteditem/textballoons/textballoons.qml
new file mode 100644
index 0000000000..b00ce2bfed
--- /dev/null
+++ b/examples/quick/painteditem/textballoons/textballoons.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the demonstration applications of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import TextBalloonPlugin 1.0
+
+Item {
+ height: 480
+ width: 640
+
+ //! [0]
+ ListModel {
+ id: balloonModel
+ ListElement {
+ balloonWidth: 200
+ }
+ ListElement {
+ balloonWidth: 350
+ }
+ }
+
+ ListView {
+ anchors.bottom: controls.top
+ anchors.bottomMargin: 2
+ anchors.top: parent.top
+ id: balloonView
+ delegate: TextBalloon {
+ anchors.right: index % 2 == 0 ? undefined : parent.right
+ height: 60
+ rightAligned: index % 2 == 0 ? false : true
+ width: balloonWidth
+ }
+ model: balloonModel
+ spacing: 5
+ width: parent.width
+ }
+ //! [0]
+
+ //! [1]
+ Rectangle {
+ id: controls
+
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.margins: 1
+ anchors.right: parent.right
+ border.width: 2
+ color: "white"
+ height: parent.height * 0.15
+
+ Text {
+ anchors.centerIn: parent
+ text: "Add another balloon"
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ hoverEnabled: true
+ onClicked: {
+ balloonModel.append({"balloonWidth": Math.floor(Math.random() * 300 + 100)})
+ balloonView.positionViewAtIndex(balloonView.count -1, ListView.End)
+ }
+ onEntered: {
+ parent.color = "#8ac953"
+ }
+ onExited: {
+ parent.color = "white"
+ }
+ }
+ }
+ //! [1]
+}
diff --git a/examples/quick/positioners/content/Button.qml b/examples/quick/positioners/content/Button.qml
new file mode 100644
index 0000000000..ee3aa9057e
--- /dev/null
+++ b/examples/quick/positioners/content/Button.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: page
+
+ property string text
+ property string icon
+ signal clicked
+
+ border.color: "black"; color: "steelblue"; radius: 5
+ width: pix.width + textelement.width + 13
+ height: pix.height + 10
+
+ Image { id: pix; x: 5; y:5; source: parent.icon }
+
+ Text {
+ id: textelement
+ text: page.text; color: "white"
+ x: pix.width + pix.x + 3
+ anchors.verticalCenter: pix.verticalCenter
+ }
+
+ MouseArea {
+ id: mr
+ anchors.fill: parent
+ onClicked: { parent.focus = true; page.clicked() }
+ }
+
+ states: State {
+ name: "pressed"; when: mr.pressed
+ PropertyChanges { target: textelement; x: 5 }
+ PropertyChanges { target: pix; x: textelement.x + textelement.width + 3 }
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "x,left"; easing.type: Easing.InOutQuad; duration: 200 }
+ }
+}
diff --git a/examples/quick/positioners/content/add.png b/examples/quick/positioners/content/add.png
new file mode 100644
index 0000000000..1ee45423e3
--- /dev/null
+++ b/examples/quick/positioners/content/add.png
Binary files differ
diff --git a/examples/quick/positioners/content/del.png b/examples/quick/positioners/content/del.png
new file mode 100644
index 0000000000..8d2eaed523
--- /dev/null
+++ b/examples/quick/positioners/content/del.png
Binary files differ
diff --git a/examples/quick/positioners/positioners-attachedproperties.qml b/examples/quick/positioners/positioners-attachedproperties.qml
new file mode 100644
index 0000000000..a05927f5ea
--- /dev/null
+++ b/examples/quick/positioners/positioners-attachedproperties.qml
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 400
+ height: 100
+
+ // Create row with four rectangles, the fourth one is hidden
+ Row {
+ id: row
+
+ Rectangle {
+ id: red
+ color: "red"
+ width: 100
+ height: 100
+
+ // When mouse is clicked, display the values of the positioner
+ MouseArea {
+ anchors.fill: parent
+ onClicked: row.showInfo(red.Positioner)
+ }
+ }
+
+ Rectangle {
+ id: green
+ color: "green"
+ width: 100
+ height: 100
+
+ // When mouse is clicked, display the values of the positioner
+ MouseArea {
+ anchors.fill: parent
+ onClicked: row.showInfo(green.Positioner)
+ }
+ }
+
+ Rectangle {
+ id: blue
+ color: "blue"
+ width: 100
+ height: 100
+
+ // When mouse is clicked, display the values of the positioner
+ MouseArea {
+ anchors.fill: parent
+ onClicked: row.showInfo(blue.Positioner)
+ }
+ }
+
+ // This rectangle is not visible, so it doesn't have a positioner value
+ Rectangle {
+ color: "black"
+ width: 100
+ height: 100
+ visible: false
+ }
+
+ // Print the index of the child item in the positioner and convenience
+ // properties showing if it's the first or last item.
+ function showInfo(positioner) {
+ console.log("Item Index = " + positioner.index)
+ console.log(" isFirstItem = " + positioner.isFirstItem)
+ console.log(" isLastItem = " + positioner.isLastItem)
+ }
+ }
+}
diff --git a/examples/quick/positioners/positioners.qml b/examples/quick/positioners/positioners.qml
new file mode 100644
index 0000000000..6627ad7dd4
--- /dev/null
+++ b/examples/quick/positioners/positioners.qml
@@ -0,0 +1,268 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ id: page
+ width: 320; height: 480
+ Flickable {
+ anchors.fill: parent
+ contentWidth: 420; contentHeight: 420
+
+ Column {
+ id: layout1
+ y: 0
+ move: Transition {
+ NumberAnimation { properties: "y"; easing.type: Easing.OutBounce }
+ }
+ add: Transition {
+ NumberAnimation { properties: "y"; easing.type: Easing.OutQuad }
+ }
+
+ Rectangle { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueV1
+ visible: opacity != 0
+ width: 100; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ }
+
+ Rectangle { color: "green"; width: 100; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueV2
+ visible: opacity != 0
+ width: 100; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ }
+
+ Rectangle { color: "orange"; width: 100; height: 50; border.color: "black"; radius: 15 }
+ }
+
+ Row {
+ id: layout2
+ y: 300
+ move: Transition {
+ NumberAnimation { properties: "x"; easing.type: Easing.OutBounce }
+ }
+ add: Transition {
+ NumberAnimation { properties: "x"; easing.type: Easing.OutQuad }
+ }
+
+ Rectangle { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueH1
+ visible: opacity != 0
+ width: 50; height: 100
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ }
+
+ Rectangle { color: "green"; width: 50; height: 100; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueH2
+ visible: opacity != 0
+ width: 50; height: 100
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ }
+
+ Rectangle { color: "orange"; width: 50; height: 100; border.color: "black"; radius: 15 }
+ }
+
+ Button {
+ x: 135; y: 90
+ text: "Remove"
+ icon: "del.png"
+
+ onClicked: {
+ blueH2.opacity = 0
+ blueH1.opacity = 0
+ blueV1.opacity = 0
+ blueV2.opacity = 0
+ blueG1.opacity = 0
+ blueG2.opacity = 0
+ blueG3.opacity = 0
+ blueF1.opacity = 0
+ blueF2.opacity = 0
+ blueF3.opacity = 0
+ }
+ }
+
+ Button {
+ x: 145; y: 140
+ text: "Add"
+ icon: "add.png"
+
+ onClicked: {
+ blueH2.opacity = 1
+ blueH1.opacity = 1
+ blueV1.opacity = 1
+ blueV2.opacity = 1
+ blueG1.opacity = 1
+ blueG2.opacity = 1
+ blueG3.opacity = 1
+ blueF1.opacity = 1
+ blueF2.opacity = 1
+ blueF3.opacity = 1
+ }
+ }
+
+ Grid {
+ x: 260; y: 0
+ columns: 3
+
+ move: Transition {
+ NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce }
+ }
+
+ add: Transition {
+ NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce }
+ }
+
+ Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueG1
+ visible: opacity != 0
+ width: 50; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ }
+
+ Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueG2
+ visible: opacity != 0
+ width: 50; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ }
+
+ Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueG3
+ visible: opacity != 0
+ width: 50; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ }
+
+ Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 }
+ Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 }
+ Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 }
+ }
+
+ Flow {
+ id: layout4
+ x: 260; y: 250; width: 150
+
+ move: Transition {
+ NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce }
+ }
+
+ add: Transition {
+ NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce }
+ }
+
+ Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueF1
+ visible: opacity != 0
+ width: 60; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ }
+
+ Rectangle { color: "green"; width: 30; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueF2
+ visible: opacity != 0
+ width: 60; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ }
+
+ Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 }
+
+ Rectangle {
+ id: blueF3
+ visible: opacity != 0
+ width: 40; height: 50
+ color: "lightsteelblue"
+ border.color: "black"
+ radius: 15
+ Behavior on opacity { NumberAnimation {} }
+ }
+
+ Rectangle { color: "red"; width: 80; height: 50; border.color: "black"; radius: 15 }
+ }
+
+ }
+}
diff --git a/examples/quick/quick.pro b/examples/quick/quick.pro
new file mode 100644
index 0000000000..529f65ac25
--- /dev/null
+++ b/examples/quick/quick.pro
@@ -0,0 +1,17 @@
+TEMPLATE = subdirs
+SUBDIRS = accessibility \
+ animation \
+ draganddrop
+ #canvas \
+ #imageelements \
+ #keyinteraction \
+ #modelviews \
+ #mousearea \
+ #openglunderqml \
+ #painteditem \
+ #positioners \
+ #righttoleft \
+ #shadereffects \
+ #text \
+ #threading \
+ #touchinteraction
diff --git a/examples/quick/righttoleft/layoutdirection/layoutdirection.qml b/examples/quick/righttoleft/layoutdirection/layoutdirection.qml
new file mode 100644
index 0000000000..0c65647d5b
--- /dev/null
+++ b/examples/quick/righttoleft/layoutdirection/layoutdirection.qml
@@ -0,0 +1,246 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ property bool mirror
+ property int direction: Qt.application.layoutDirection
+ LayoutMirroring.enabled: mirror
+ LayoutMirroring.childrenInherit: true
+ width: column.width + 80
+ height: column.height + 40
+ Column {
+ id: column
+ width: 190
+ spacing: 10
+ anchors.centerIn: parent
+
+ Text {
+ text: "Row"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ Row {
+ layoutDirection: root.direction
+ spacing: 10
+ move: Transition {
+ NumberAnimation {
+ properties: "x"
+ }
+ }
+ Repeater {
+ model: 4
+ Loader {
+ property int value: index
+ sourceComponent: positionerDelegate
+ }
+ }
+ }
+
+ Text {
+ text: "Grid"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ Grid {
+ layoutDirection: root.direction
+ spacing: 10; columns: 4
+ move: Transition {
+ NumberAnimation {
+ properties: "x"
+ }
+ }
+ Repeater {
+ model: 11
+ Loader {
+ property int value: index
+ sourceComponent: positionerDelegate
+ }
+ }
+ }
+
+ Text {
+ text: "Flow"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ Flow {
+ layoutDirection: root.direction
+ spacing: 10; width: parent.width
+ move: Transition {
+ NumberAnimation {
+ properties: "x"
+ }
+ }
+ Repeater {
+ model: 10
+ Loader {
+ property int value: index
+ sourceComponent: positionerDelegate
+ }
+ }
+ }
+
+ Text {
+ text: "ListView"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ ListView {
+ id: listView
+ clip: true
+ width: parent.width; height: 40
+ layoutDirection: root.direction
+ orientation: Qt.Horizontal
+ model: 48
+ delegate: viewDelegate
+ }
+
+ Text {
+ text: "GridView"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ GridView {
+ clip: true
+ width: 200; height: 160
+ cellWidth: 50; cellHeight: 50
+ layoutDirection: root.direction
+ model: 48
+ delegate: viewDelegate
+ }
+
+ Rectangle {
+ height: 50; width: parent.width
+ color: mouseArea.pressed ? "black" : "gray"
+ Column {
+ anchors.centerIn: parent
+ Text {
+ text: root.direction ? "Right to left" : "Left to right"
+ color: "white"
+ font.pixelSize: 16
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Text {
+ text: "(click here to toggle)"
+ color: "white"
+ font.pixelSize: 10
+ font.italic: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: {
+ if (root.direction == Qt.LeftToRight) {
+ root.direction = Qt.RightToLeft;
+ } else {
+ root.direction = Qt.LeftToRight;
+ }
+ }
+ }
+ }
+
+ Rectangle {
+ height: 50; width: parent.width
+ color: mouseArea2.pressed ? "black" : "gray"
+ Column {
+ anchors.centerIn: parent
+ Text {
+ text: root.mirror ? "Mirrored" : "Not mirrored"
+ color: "white"
+ font.pixelSize: 16
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Text {
+ text: "(click here to toggle)"
+ color: "white"
+ font.pixelSize: 10
+ font.italic: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ MouseArea {
+ id: mouseArea2
+ anchors.fill: parent
+ onClicked: {
+ root.mirror = !root.mirror;
+ }
+ }
+ }
+ }
+
+ Component {
+ id: positionerDelegate
+ Rectangle {
+ width: 40; height: 40
+ color: Qt.rgba(0.8/(parent.value+1),0.8/(parent.value+1),0.8/(parent.value+1),1.0)
+ Text {
+ text: parent.parent.value+1
+ color: "white"
+ font.pixelSize: 18
+ anchors.centerIn: parent
+ }
+ }
+ }
+ Component {
+ id: viewDelegate
+ Item {
+ width: (listView.effectiveLayoutDirection == Qt.LeftToRight ? (index == 48 - 1) : (index == 0)) ? 40 : 50
+ Rectangle {
+ width: 40; height: 40
+ color: Qt.rgba(0.5+(48 - index)*Math.random()/48,
+ 0.3+index*Math.random()/48,
+ 0.3*Math.random(),
+ 1.0)
+ Text {
+ text: index+1
+ color: "white"
+ font.pixelSize: 18
+ anchors.centerIn: parent
+ }
+ }
+ }
+ }
+}
+
diff --git a/examples/quick/righttoleft/layoutdirection/layoutdirection.qmlproject b/examples/quick/righttoleft/layoutdirection/layoutdirection.qmlproject
new file mode 100644
index 0000000000..33cbb3c9e2
--- /dev/null
+++ b/examples/quick/righttoleft/layoutdirection/layoutdirection.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "layoutdirection.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/righttoleft/layoutmirroring/layoutmirroring.qml b/examples/quick/righttoleft/layoutmirroring/layoutmirroring.qml
new file mode 100644
index 0000000000..5c4739bd57
--- /dev/null
+++ b/examples/quick/righttoleft/layoutmirroring/layoutmirroring.qml
@@ -0,0 +1,313 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ property bool mirror: Qt.application.layoutDirection == Qt.RightToLeft
+ LayoutMirroring.enabled: mirror
+ LayoutMirroring.childrenInherit: true
+ width: 400
+ height: 875
+ color: "lightsteelblue"
+
+ Column {
+ spacing: 10
+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: 10 }
+
+ Text {
+ text: "Positioners"
+ anchors.left: parent.left
+ }
+
+ Column {
+ id: positioners
+ spacing: 5
+ anchors.left: parent.left
+ Row {
+ id: row
+ spacing: 4
+ property string text: "THISISROW"
+ anchors.left: parent.left
+ Repeater {
+ model: parent.text.length
+ delegate: positionerDelegate
+ }
+ }
+ Flow {
+ id: flow
+ spacing: 4
+ width: 90
+ property string text: "THISISFLOW"
+ anchors.left: parent.left
+ Repeater {
+ model: parent.text.length
+ delegate: positionerDelegate
+ }
+ }
+ Grid {
+ id: grid
+ spacing: 4
+ columns: 6
+ property string text: "THISISGRID"
+ anchors.left: parent.left
+ Repeater {
+ model: parent.text.length
+ delegate: positionerDelegate
+ }
+ }
+ Component {
+ id: positionerDelegate
+ Text {
+ color: "white"
+ font.pixelSize: 20
+ text: parent.text[index]
+ Rectangle {
+ z: -1
+ opacity: 0.7
+ color: "black"
+ anchors.fill: parent
+ }
+ }
+ }
+ }
+
+ Text {
+ text: "Text alignment"
+ anchors.left: parent.left
+ }
+
+ Rectangle {
+ id: textStrings
+ width: 148
+ height: 85
+ color: "white"
+ anchors.left: parent.left
+ Column {
+ spacing: 5
+ width: parent.width
+ anchors { fill: parent; margins: 5 }
+ Text {
+ id: englishText
+ width: parent.width
+ text: "English text"
+ }
+ Text {
+ id: arabicText
+ width: parent.width
+ text: "النص العربي"
+ }
+ Text {
+ id: leftAlignedText
+ width: parent.width
+ text: "Text aligned to left"
+ horizontalAlignment: Text.AlignLeft
+ }
+ Text {
+ id: rightAlignedText
+ width: parent.width
+ text: "Text aligned to right"
+ horizontalAlignment: Text.AlignRight
+ }
+ }
+ }
+
+ Text {
+ text: "Model views"
+ anchors.left: parent.left
+ }
+
+ Column {
+ id: views
+ spacing: 10
+ anchors.left: parent.left
+ ListView {
+ id: listView
+ z: -1
+ clip: true
+ model: text.length
+ width: 360; height: 45
+ orientation: Qt.Horizontal
+ property string text: "LISTVIEWLISTVIEWLISTVIEWLISTVIEWLISTVIEWLISTVIEW"
+ delegate: Rectangle {
+ color: "black"
+ width: 45; height: 45
+ Rectangle {
+ anchors { fill: parent; margins: 1 }
+ color: "red"
+ }
+ Text {
+ text: listView.text[index]
+ font.pixelSize: 30
+ anchors.centerIn: parent
+ }
+ }
+ }
+ GridView {
+ id: gridView
+ z: -1
+ clip: true
+ model: text.length
+ width: 180; height: 90
+ cellWidth: 45; cellHeight: 45
+ property string text: "GRIDVIEWGRIDVIEWGRIDVIEWGRIDVIEWGRIDVIEWGRIDVIEW"
+ anchors.left: parent.left
+ delegate: Rectangle {
+ color: "black"
+ width: 45; height: 45
+ Rectangle {
+ anchors { fill: parent; margins: 1 }
+ color: "red"
+ }
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 30
+ text: gridView.text[index]
+ }
+ }
+ }
+ }
+
+ Text {
+ text: "Item x"
+ anchors.left: parent.left
+ }
+ Rectangle {
+ id: items
+ color: Qt.rgba(0.2, 0.2, 0.2, 0.6)
+ width: 275; height: 95
+ anchors.left: parent.left
+ Rectangle {
+ y: 5; x: 5
+ width: 130; height: 40
+ Text {
+ text: "Item with x: 5\n(not mirrored)"
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle {
+ color: Qt.rgba(0.7, 0.7, 0.7)
+ y: 50; x: mirror(5)
+ width: 130; height: 40
+ function mirror(value) {
+ return LayoutMirroring.enabled ? (parent.width - width - value) : value;
+ }
+ Text {
+ text: "Item with x: " + parent.x + "\n(manually mirrored)"
+ anchors.centerIn: parent
+ }
+ }
+ }
+ Text {
+ text: "Item anchors"
+ anchors.left: parent.left
+ }
+
+ Rectangle {
+ id: anchoredItems
+ color: Qt.rgba(0.2, 0.2, 0.2, 0.6)
+ width: 270; height: 170
+ anchors.left: parent.left
+ Rectangle {
+ id: blackRectangle
+ color: "black"
+ width: 180; height: 90
+ anchors { horizontalCenter: parent.horizontalCenter; horizontalCenterOffset: 30 }
+ Text {
+ text: "Horizontal center anchored\nwith offset 30\nto the horizontal center\nof the parent."
+ color: "white"
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle {
+ id: whiteRectangle
+ color: "white"
+ width: 120; height: 70
+ anchors { left: parent.left; bottom: parent.bottom }
+ Text {
+ text: "Left side anchored\nto the left side\nof the parent."
+ color: "black"
+ anchors.centerIn: parent
+ }
+ }
+ Rectangle {
+ id: grayRectangle
+ color: Qt.rgba(0.7, 0.7, 0.7)
+ width: 140; height: 90
+ anchors { right: parent.right; bottom: parent.bottom }
+ Text {
+ text: "Right side anchored\nto the right side\nof the parent."
+ anchors.centerIn: parent
+ }
+ }
+ }
+ Rectangle {
+ id: mirrorButton
+ color: mouseArea2.pressed ? "black" : "gray"
+ height: 50; width: parent.width
+ anchors.left: parent.left
+ Column {
+ anchors.centerIn: parent
+ Text {
+ text: root.mirror ? "Mirrored" : "Not mirrored"
+ color: "white"
+ font.pixelSize: 16
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Text {
+ text: "(click here to toggle)"
+ color: "white"
+ font.pixelSize: 10
+ font.italic: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ MouseArea {
+ id: mouseArea2
+ anchors.fill: parent
+ onClicked: {
+ root.mirror = !root.mirror;
+ }
+ }
+ }
+ }
+}
+
diff --git a/examples/quick/righttoleft/layoutmirroring/layoutmirroring.qmlproject b/examples/quick/righttoleft/layoutmirroring/layoutmirroring.qmlproject
new file mode 100644
index 0000000000..72bc04a8a9
--- /dev/null
+++ b/examples/quick/righttoleft/layoutmirroring/layoutmirroring.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "layoutmirroring.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/righttoleft/textalignment/textalignment.qml b/examples/quick/righttoleft/textalignment/textalignment.qml
new file mode 100644
index 0000000000..ef5b97bb1a
--- /dev/null
+++ b/examples/quick/righttoleft/textalignment/textalignment.qml
@@ -0,0 +1,427 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ color: "white"
+ width: containerColumn.width
+ height: containerColumn.height + containerColumn.anchors.topMargin
+
+ property bool mirror: false
+ property variant horizontalAlignment: undefined
+
+ property variant editorType: ["Plain Text", "Styled Text", "Plain Rich Text", "Italic Rich Text", "Plain TextEdit", "Italic TextEdit", "TextInput"]
+ property variant text: ["", " ", "Hello world!", "مرحبا العالم!", "Hello world! Hello!\nHello world! Hello!", "مرحبا العالم! مرحبا! مرحبا العالم! مرحبا!" ,"مرحبا العالم! مرحبا! مرحبا Hello world!\nالعالم! مرحبا!"]
+ property variant description: ["empty text", "white-space-only text", "left-to-right text", "right-to-left text", "multi-line left-to-right text", "multi-line right-to-left text", "multi-line bidi text"]
+ property variant textComponents: [plainTextComponent, styledTextComponent, richTextComponent, italicRichTextComponent, plainTextEdit, italicTextEdit, textInput]
+
+ function shortText(horizontalAlignment) {
+
+ // all the different QML editors have
+ // the same alignment values
+ switch (horizontalAlignment) {
+ case Text.AlignLeft:
+ return "L";
+ case Text.AlignRight:
+ return "R";
+ case Text.AlignHCenter:
+ return "C";
+ case Text.AlignJustify:
+ return "J";
+ default:
+ return "Error";
+ }
+ }
+ Column {
+ id: containerColumn
+ spacing: 10
+ width: editorTypeRow.width
+ anchors { top: parent.top; topMargin: 5 }
+ Row {
+ id: editorTypeRow
+ Repeater {
+ model: editorType.length
+ Item {
+ width: editorColumn.width
+ height: editorColumn.height
+ Column {
+ id: editorColumn
+ spacing: 5
+ width: textColumn.width+10
+ Text {
+ text: root.editorType[index]
+ font.pixelSize: 16
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Column {
+ id: textColumn
+ spacing: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ Repeater {
+ model: textComponents.length
+ delegate: textComponents[index]
+ }
+ }
+ }
+ }
+ }
+ }
+ Column {
+ spacing: 2
+ width: parent.width
+ Rectangle {
+ // button
+ height: 50; width: parent.width
+ color: mouseArea.pressed ? "black" : "lightgray"
+ Column {
+ anchors.centerIn: parent
+ Text {
+ text: root.mirror ? "Mirrored" : "Not mirrored"
+ color: "white"
+ font.pixelSize: 16
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Text {
+ text: "(click here to toggle)"
+ color: "white"
+ font.pixelSize: 10
+ font.italic: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ MouseArea {
+ id: mouseArea
+ property int index: 0
+ anchors.fill: parent
+ onClicked: root.mirror = !root.mirror
+ }
+ }
+ Rectangle {
+ // button
+ height: 50; width: parent.width
+ color: mouseArea2.pressed ? "black" : "gray"
+ Column {
+ anchors.centerIn: parent
+ Text {
+ text: {
+ if (root.horizontalAlignment == undefined)
+ return "Implict alignment";
+ switch (root.horizontalAlignment) {
+ case Text.AlignLeft:
+ return "Left alignment";
+ case Text.AlignRight:
+ return "Right alignment";
+ case Text.AlignHCenter:
+ return "Center alignment";
+ case Text.AlignJustify:
+ return "Justify alignment";
+ }
+ }
+ color: "white"
+ font.pixelSize: 16
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Text {
+ text: "(click here to toggle)"
+ color: "white"
+ font.pixelSize: 10
+ font.italic: true
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ MouseArea {
+ id: mouseArea2
+ property int index: 0
+ anchors.fill: parent
+ onClicked: {
+ if (index < 0) {
+ root.horizontalAlignment = undefined;
+ } else {
+ root.horizontalAlignment = Math.pow(2, index);
+ }
+ index = (index + 2) % 5 - 1;
+ }
+ }
+ }
+ }
+ }
+
+ Component {
+ id: plainTextComponent
+ Text {
+ width: 180
+ text: root.text[index]
+ font.pixelSize: 24
+ wrapMode: Text.WordWrap
+ horizontalAlignment: root.horizontalAlignment
+ LayoutMirroring.enabled: root.mirror
+ textFormat: Text.RichText
+ Rectangle {
+ z: -1
+ color: Qt.rgba(0.8, 0.2, 0.2, 0.3)
+ anchors.fill: parent
+ }
+ Text {
+ text: root.description[index]
+ color: Qt.rgba(1,1,1,1.0)
+ anchors.centerIn: parent
+ Rectangle {
+ z: -1
+ color: Qt.rgba(0.3, 0, 0, 0.3)
+ anchors { fill: parent; margins: -3 }
+ }
+ }
+ Text {
+ color: "white"
+ text: shortText(parent.horizontalAlignment)
+ anchors { top: parent.top; right: parent.right; margins: 2 }
+ }
+ }
+ }
+
+ Component {
+ id: styledTextComponent
+ Text {
+ width: 180
+ text: root.text[index]
+ font.pixelSize: 24
+ wrapMode: Text.WordWrap
+ horizontalAlignment: root.horizontalAlignment
+ LayoutMirroring.enabled: root.mirror
+ textFormat: Text.RichText
+ style: Text.Sunken
+ styleColor: "white"
+ Rectangle {
+ z: -1
+ color: Qt.rgba(0.8, 0.2, 0.2, 0.3)
+ anchors.fill: parent
+ }
+ Text {
+ text: root.description[index]
+ color: Qt.rgba(1,1,1,1.0)
+ anchors.centerIn: parent
+ Rectangle {
+ z: -1
+ color: Qt.rgba(0.3, 0, 0, 0.3)
+ anchors { fill: parent; margins: -3 }
+ }
+ }
+ Text {
+ color: "white"
+ text: shortText(parent.horizontalAlignment)
+ anchors { top: parent.top; right: parent.right; margins: 2 }
+ }
+ }
+ }
+
+ Component {
+ id: richTextComponent
+ Text {
+ width: 180
+ text: root.text[index]
+ font.pixelSize: 24
+ wrapMode: Text.WordWrap
+ horizontalAlignment: root.horizontalAlignment
+ LayoutMirroring.enabled: root.mirror
+ textFormat: Text.RichText
+ Rectangle {
+ z: -1
+ color: Qt.rgba(0.8, 0.2, 0.2, 0.3)
+ anchors.fill: parent
+ }
+ Text {
+ text: root.description[index]
+ color: Qt.rgba(1,1,1,1.0)
+ anchors.centerIn: parent
+ Rectangle {
+ z: -1
+ color: Qt.rgba(0.3, 0, 0, 0.3)
+ anchors { fill: parent; margins: -3 }
+ }
+ }
+ Text {
+ color: "white"
+ text: shortText(parent.horizontalAlignment)
+ anchors { top: parent.top; right: parent.right; margins: 2 }
+ }
+ }
+ }
+
+ Component {
+ id: italicRichTextComponent
+ Text {
+ width: 180
+ text: "<i>" + root.text[index] + "</i>"
+ font.pixelSize: 24
+ wrapMode: Text.WordWrap
+ horizontalAlignment: root.horizontalAlignment
+ LayoutMirroring.enabled: root.mirror
+ textFormat: Text.RichText
+ property variant backgroundColor: Qt.rgba(0.8, 0.2, 0.2, 0.3)
+ Rectangle {
+ z: -1
+ color: parent.backgroundColor
+ anchors.fill: parent
+ }
+ Text {
+ text: root.description[index]
+ color: Qt.rgba(1,1,1,1.0)
+ anchors.centerIn: parent
+ Rectangle {
+ z: -1
+ color: Qt.rgba(0.3, 0, 0, 0.3)
+ anchors { fill: parent; margins: -3 }
+ }
+ }
+ Text {
+ color: "white"
+ text: shortText(parent.horizontalAlignment)
+ anchors { top: parent.top; right: parent.right; margins: 2 }
+ }
+ }
+ }
+
+ Component {
+ id: plainTextEdit
+ TextEdit {
+ width: 180
+ text: root.text[index]
+ font.pixelSize: 24
+ cursorVisible: true
+ wrapMode: TextEdit.WordWrap
+ horizontalAlignment: root.horizontalAlignment
+ LayoutMirroring.enabled: root.mirror
+ Rectangle {
+ z: -1
+ color: Qt.rgba(0.5, 0.5, 0.2, 0.3)
+ anchors.fill: parent
+ }
+ Text {
+ text: root.description[index]
+ color: Qt.rgba(1,1,1,1.0)
+ anchors.centerIn: parent
+ Rectangle {
+ z: -1
+ color: Qt.rgba(0.3, 0, 0, 0.3)
+ anchors { fill: parent; margins: -3 }
+ }
+ }
+ Text {
+ color: "white"
+ text: shortText(parent.horizontalAlignment)
+ anchors { top: parent.top; right: parent.right; margins: 2 }
+ }
+ }
+ }
+
+ Component {
+ id: italicTextEdit
+ TextEdit {
+ width: 180
+ text: "<i>" + root.text[index] + "<i>"
+ font.pixelSize: 24
+ cursorVisible: true
+ wrapMode: TextEdit.WordWrap
+ textFormat: TextEdit.RichText
+ horizontalAlignment: root.horizontalAlignment
+ LayoutMirroring.enabled: root.mirror
+ Rectangle {
+ z: -1
+ color: Qt.rgba(0.5, 0.5, 0.2, 0.3)
+ anchors.fill: parent
+ }
+ Text {
+ text: root.description[index]
+ color: Qt.rgba(1,1,1,1.0)
+ anchors.centerIn: parent
+ Rectangle {
+ z: -1
+ color: Qt.rgba(0.3, 0, 0, 0.3)
+ anchors { fill: parent; margins: -3 }
+ }
+ }
+ Text {
+ color: "white"
+ text: shortText(parent.horizontalAlignment)
+ anchors { top: parent.top; right: parent.right; margins: 2 }
+ }
+ }
+ }
+
+ Component {
+ id: textInput
+ Item {
+ width: 180
+ height: textInput.text.length > 20 ? 3*textInput.height : textInput.height
+ TextInput {
+ id: textInput
+ width: 180
+ text: root.text[index]
+ font.pixelSize: 24
+ cursorVisible: true
+ horizontalAlignment: root.horizontalAlignment
+ LayoutMirroring.enabled: root.mirror
+ Rectangle {
+ z: -1
+ color: Qt.rgba(0.6, 0.4, 0.2, 0.3)
+ anchors.fill: parent
+ }
+ Text {
+ text: root.description[index]
+ color: Qt.rgba(1,1,1,1.0)
+ anchors.centerIn: parent
+ Rectangle {
+ z: -1
+ color: Qt.rgba(0.3, 0, 0, 0.3)
+ anchors { fill: parent; margins: -3 }
+ }
+ }
+ Text {
+ color: "white"
+ text: shortText(parent.horizontalAlignment)
+ anchors { top: parent.top; right: parent.right; margins: 2 }
+ }
+ }
+ }
+ }
+}
+
diff --git a/examples/quick/righttoleft/textalignment/textalignment.qmlproject b/examples/quick/righttoleft/textalignment/textalignment.qmlproject
new file mode 100644
index 0000000000..e4b5061364
--- /dev/null
+++ b/examples/quick/righttoleft/textalignment/textalignment.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "textalignment.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/shadereffects/content/Slider.qml b/examples/quick/shadereffects/content/Slider.qml
new file mode 100644
index 0000000000..ff5f628b14
--- /dev/null
+++ b/examples/quick/shadereffects/content/Slider.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQuick module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ property real value: bar.x / (foo.width - bar.width)
+ Item {
+ id: foo
+ width: parent.width - 4
+ height: 6
+ anchors.centerIn: parent
+
+ Rectangle {
+ height: parent.height
+ anchors.left: parent.left
+ anchors.right: bar.horizontalCenter
+ color: "blue"
+ radius: 3
+ }
+ Rectangle {
+ height: parent.height
+ anchors.left: bar.horizontalCenter
+ anchors.right: parent.right
+ color: "gray"
+ radius: 3
+ }
+ Rectangle {
+ anchors.fill: parent
+ color: "transparent"
+ radius: 3
+ border.width: 2
+ border.color: "black"
+ }
+
+ Rectangle {
+ id: bar
+ y: -7
+ width: 20
+ height: 20
+ radius: 15
+ color: "white"
+ border.width: 2
+ border.color: "black"
+ MouseArea {
+ anchors.fill: parent
+ drag.target: parent
+ drag.axis: Drag.XAxis
+ drag.minimumX: 0
+ drag.maximumX: foo.width - parent.width
+ }
+ }
+ }
+}
+
diff --git a/examples/quick/shadereffects/content/face-smile.png b/examples/quick/shadereffects/content/face-smile.png
new file mode 100644
index 0000000000..3d66d72578
--- /dev/null
+++ b/examples/quick/shadereffects/content/face-smile.png
Binary files differ
diff --git a/examples/quick/shadereffects/content/qt-logo.png b/examples/quick/shadereffects/content/qt-logo.png
new file mode 100644
index 0000000000..7d3e97eb36
--- /dev/null
+++ b/examples/quick/shadereffects/content/qt-logo.png
Binary files differ
diff --git a/examples/quick/shadereffects/shadereffects.qml b/examples/quick/shadereffects/shadereffects.qml
new file mode 100644
index 0000000000..b820c8131e
--- /dev/null
+++ b/examples/quick/shadereffects/shadereffects.qml
@@ -0,0 +1,315 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQuick module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Image {
+ width: 320
+ height: 480
+/*!
+ \title QML Examples - Shader Effects
+ \example declarative/shadereffects
+ \image qml-shadereffects-example.png
+ \brief This is a shader effects example
+
+ This example demonstrates a couple of visual effects that you can perform
+ with shaders in QtQuick 2.0
+*/
+ source: "../snake/content/pics/background.png"
+
+ Flickable {
+ anchors.fill: parent
+ contentWidth: 640
+ contentHeight: 360
+
+ ShaderEffectSource {
+ id: theSource
+ sourceItem: theItem
+ smooth: true
+ }
+
+ function saturate(x) {
+ return Math.min(Math.max(x, 0), 1)
+ }
+
+ function sliderToColor(x) {
+ return Qt.rgba(saturate(Math.max(2 - 6 * x, 6 * x - 4)),
+ saturate(Math.min(6 * x, 4 - 6 * x)),
+ saturate(Math.min(6 * x - 2, 6 - 6 * x)))
+ }
+
+ Grid {
+ anchors.centerIn: parent
+ columns: 3
+
+ Item {
+ id: theItem
+ width: 180
+ height: 180
+ ListView {
+ anchors.centerIn: parent
+ width: 160
+ height: 140
+ clip: true
+ snapMode: ListView.SnapOneItem
+ model: VisualItemModel {
+ Text {
+ width: 160
+ height: 140
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: 120
+ font.family: "Times"
+ color: "blue"
+ text: "Qt"
+ }
+ Image {
+ width: 160
+ height: 140
+ source: "content/qt-logo.png"
+ smooth: true
+ }
+ Image {
+ width: 160
+ height: 140
+ source: "content/face-smile.png"
+ smooth: true
+ }
+ }
+ }
+ }
+ ShaderEffect {
+ width: 180
+ height: 180
+ property variant source: theSource
+ property real amplitude: 0.04 * wobbleSlider.value
+ property real frequency: 20
+ property real time: 0
+ NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 }
+ fragmentShader:
+ "uniform lowp float qt_Opacity;" +
+ "uniform highp float amplitude;" +
+ "uniform highp float frequency;" +
+ "uniform highp float time;" +
+ "uniform sampler2D source;" +
+ "varying highp vec2 qt_TexCoord0;" +
+ "void main() {" +
+ " highp vec2 p = sin(time + frequency * qt_TexCoord0);" +
+ " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;" +
+ "}"
+ Slider {
+ id: wobbleSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
+ }
+ }
+ ShaderEffect {
+ width: 180
+ height: 180
+ property variant source: theSource
+ property variant shadow: ShaderEffectSource {
+ smooth: true
+ sourceItem: ShaderEffect {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(0.0, 1.0 / height)
+ property variant source: ShaderEffectSource {
+ smooth: true
+ sourceItem: ShaderEffect {
+ width: theItem.width
+ height: theItem.height
+ property variant delta: Qt.size(1.0 / width, 0.0)
+ property variant source: theSource
+ fragmentShader: "
+ uniform lowp float qt_Opacity;
+ uniform sampler2D source;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
+ }"
+ }
+ }
+ fragmentShader: "
+ uniform lowp float qt_Opacity;
+ uniform sampler2D source;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor =(0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta)
+ + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta)
+ + 0.2466 * texture2D(source, qt_TexCoord0)
+ + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta)
+ + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity;
+ }"
+ }
+ }
+ property real angle: 0
+ property variant offset: Qt.point(15.0 * Math.cos(angle), 15.0 * Math.sin(angle))
+ NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 }
+ property variant delta: Qt.size(offset.x / width, offset.y / height)
+ property real darkness: shadowSlider.value
+ fragmentShader: "
+ uniform lowp float qt_Opacity;
+ uniform highp vec2 offset;
+ uniform sampler2D source;
+ uniform sampler2D shadow;
+ uniform highp float darkness;
+ uniform highp vec2 delta;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ lowp vec4 fg = texture2D(source, qt_TexCoord0);
+ lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta);
+ gl_FragColor = (fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a)) * qt_Opacity;
+ }"
+ Slider {
+ id: shadowSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
+ }
+ }
+ ShaderEffect {
+ width: 180
+ height: 180
+ property variant source: theSource
+ property variant delta: Qt.size(0.5 / width, 0.5 / height)
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform highp vec2 delta;
+ uniform highp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ lowp vec4 tl = texture2D(source, qt_TexCoord0 - delta);
+ lowp vec4 tr = texture2D(source, qt_TexCoord0 + vec2(delta.x, -delta.y));
+ lowp vec4 bl = texture2D(source, qt_TexCoord0 - vec2(delta.x, -delta.y));
+ lowp vec4 br = texture2D(source, qt_TexCoord0 + delta);
+ lowp vec4 gx = (tl + bl) - (tr + br);
+ lowp vec4 gy = (tl + tr) - (bl + br);
+ gl_FragColor.xyz = vec3(0.);
+ gl_FragColor.w = clamp(dot(sqrt(gx * gx + gy * gy), vec4(1.)), 0., 1.) * qt_Opacity;
+ }"
+ }
+ ShaderEffect {
+ width: 180
+ height: 180
+ property variant source: theSource
+ property color tint: sliderToColor(colorizeSlider.value)
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform lowp vec4 tint;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ lowp vec4 c = texture2D(source, qt_TexCoord0);
+ lowp float lo = min(min(c.x, c.y), c.z);
+ lowp float hi = max(max(c.x, c.y), c.z);
+ gl_FragColor = qt_Opacity * vec4(mix(vec3(lo), vec3(hi), tint.xyz), c.w);
+ }"
+ Slider {
+ id: colorizeSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
+ }
+ }
+ ShaderEffect {
+ width: 180
+ height: 180
+ mesh: Qt.size(10, 10)
+ property variant source: theSource
+ property real bend: 0
+ property real minimize: 0
+ property real side: genieSlider.value
+ SequentialAnimation on bend {
+ loops: Animation.Infinite
+ NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1600 }
+ NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1000 }
+ }
+ SequentialAnimation on minimize {
+ loops: Animation.Infinite
+ PauseAnimation { duration: 300 }
+ NumberAnimation { to: 1; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1000 }
+ NumberAnimation { to: 0; duration: 700; easing.type: Easing.InOutSine }
+ PauseAnimation { duration: 1300 }
+ }
+ vertexShader: "
+ uniform highp mat4 qt_Matrix;
+ uniform highp float bend;
+ uniform highp float minimize;
+ uniform highp float side;
+ uniform highp float width;
+ uniform highp float height;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ highp vec4 pos = qt_Vertex;
+ pos.y = mix(qt_Vertex.y, height, minimize);
+ highp float t = pos.y / height;
+ t = (3. - 2. * t) * t * t;
+ pos.x = mix(qt_Vertex.x, side * width, t * bend);
+ gl_Position = qt_Matrix * pos;
+ }"
+ Slider {
+ id: genieSlider
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ height: 40
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quick/text/fonts/availableFonts.qml b/examples/quick/text/fonts/availableFonts.qml
new file mode 100644
index 0000000000..0b87259556
--- /dev/null
+++ b/examples/quick/text/fonts/availableFonts.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 480; height: 640; color: "steelblue"
+
+ ListView {
+ anchors.fill: parent; model: Qt.fontFamilies()
+
+ delegate: Item {
+ height: 40; width: ListView.view.width
+ Text {
+ anchors.centerIn: parent
+ text: modelData; font.family: modelData; font.pixelSize: 24; color: "white"
+ }
+ }
+ }
+}
diff --git a/examples/quick/text/fonts/banner.qml b/examples/quick/text/fonts/banner.qml
new file mode 100644
index 0000000000..6c9aa25fa1
--- /dev/null
+++ b/examples/quick/text/fonts/banner.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: screen
+
+ property int pixelSize: screen.height * 1.25
+ property color textColor: "lightsteelblue"
+ property string text: "Hello world! "
+
+ width: 640; height: 320
+ color: "steelblue"
+
+ Row {
+ y: -screen.height / 4.5
+
+ NumberAnimation on x { from: 0; to: -text.width; duration: 6000; loops: Animation.Infinite }
+ Text { id: text; font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text }
+ Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text }
+ Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text }
+ }
+}
diff --git a/examples/quick/text/fonts/content/fonts/tarzeau_ocr_a.ttf b/examples/quick/text/fonts/content/fonts/tarzeau_ocr_a.ttf
new file mode 100644
index 0000000000..cf93f9651f
--- /dev/null
+++ b/examples/quick/text/fonts/content/fonts/tarzeau_ocr_a.ttf
Binary files differ
diff --git a/examples/quick/text/fonts/fonts.qml b/examples/quick/text/fonts/fonts.qml
new file mode 100644
index 0000000000..78cef25eae
--- /dev/null
+++ b/examples/quick/text/fonts/fonts.qml
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ property string myText: "The quick brown fox jumps over the lazy dog."
+
+ width: 800; height: 480
+ color: "steelblue"
+
+ FontLoader { id: fixedFont; name: "Courier" }
+ FontLoader { id: localFont; source: "content/fonts/tarzeau_ocr_a.ttf" }
+ FontLoader { id: webFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" }
+
+ Column {
+ anchors { fill: parent; leftMargin: 10; rightMargin: 10 }
+ spacing: 15
+
+ Text {
+ text: myText
+ color: "lightsteelblue"
+ width: parent.width
+ elide: Text.ElideRight
+ font.family: "Times"; font.pointSize: 42
+ }
+ Text {
+ text: myText
+ color: "lightsteelblue"
+ width: parent.width
+ elide: Text.ElideLeft
+ font { family: "Times"; pointSize: 42; capitalization: Font.AllUppercase }
+ }
+ Text {
+ text: myText
+ color: "lightsteelblue"
+ width: parent.width
+ elide: Text.ElideMiddle
+ font { family: fixedFont.name; pointSize: 42; weight: Font.Bold; capitalization: Font.AllLowercase }
+ }
+ Text {
+ text: myText
+ color: "lightsteelblue"
+ width: parent.width
+ elide: Text.ElideRight
+ font { family: fixedFont.name; pointSize: 42; italic: true; capitalization: Font.SmallCaps }
+ }
+ Text {
+ text: myText
+ color: "lightsteelblue"
+ width: parent.width
+ elide: Text.ElideLeft
+ font { family: localFont.name; pointSize: 42; capitalization: Font.Capitalize }
+ }
+ Text {
+ text: {
+ if (webFont.status == FontLoader.Ready) myText
+ else if (webFont.status == FontLoader.Loading) "Loading..."
+ else if (webFont.status == FontLoader.Error) "Error loading font"
+ }
+ color: "lightsteelblue"
+ width: parent.width
+ elide: Text.ElideMiddle
+ font.family: webFont.name; font.pointSize: 42
+ }
+ }
+}
diff --git a/examples/quick/text/fonts/hello.qml b/examples/quick/text/fonts/hello.qml
new file mode 100644
index 0000000000..d9479fb208
--- /dev/null
+++ b/examples/quick/text/fonts/hello.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: screen
+
+ width: 800; height: 480
+ color: "black"
+
+ Item {
+ id: container
+ x: screen.width / 2; y: screen.height / 2
+
+ Text {
+ id: text
+ anchors.centerIn: parent
+ color: "white"
+ text: "Hello world!"
+ font.pixelSize: 60
+ smooth: true
+
+ SequentialAnimation on font.letterSpacing {
+ loops: Animation.Infinite;
+ NumberAnimation { from: 0; to: 150; easing.type: Easing.InQuad; duration: 3000 }
+ ScriptAction {
+ script: {
+ container.y = (screen.height / 4) + (Math.random() * screen.height / 2)
+ container.x = (screen.width / 4) + (Math.random() * screen.width / 2)
+ }
+ }
+ }
+
+ SequentialAnimation on opacity {
+ loops: Animation.Infinite;
+ NumberAnimation { from: 1; to: 0; duration: 2600 }
+ PauseAnimation { duration: 400 }
+ }
+ }
+ }
+}
diff --git a/examples/quick/text/imgtag/TextWithImage.qml b/examples/quick/text/imgtag/TextWithImage.qml
new file mode 100644
index 0000000000..bc09aa2a52
--- /dev/null
+++ b/examples/quick/text/imgtag/TextWithImage.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Text {
+ width: parent.width
+ font.pointSize: 14
+ wrapMode: Text.WordWrap
+ textFormat: Text.StyledText
+ horizontalAlignment: main.hAlign
+
+ Rectangle {
+ border.color: "#efefef"
+ color: "transparent"
+ anchors.fill: parent
+ }
+}
diff --git a/examples/quick/text/imgtag/images/face-sad.png b/examples/quick/text/imgtag/images/face-sad.png
new file mode 100644
index 0000000000..24188b7985
--- /dev/null
+++ b/examples/quick/text/imgtag/images/face-sad.png
Binary files differ
diff --git a/examples/quick/text/imgtag/images/face-smile-big.png b/examples/quick/text/imgtag/images/face-smile-big.png
new file mode 100644
index 0000000000..d05e0bf21e
--- /dev/null
+++ b/examples/quick/text/imgtag/images/face-smile-big.png
Binary files differ
diff --git a/examples/quick/text/imgtag/images/face-smile.png b/examples/quick/text/imgtag/images/face-smile.png
new file mode 100644
index 0000000000..e5e1d1353c
--- /dev/null
+++ b/examples/quick/text/imgtag/images/face-smile.png
Binary files differ
diff --git a/examples/quick/text/imgtag/images/heart200.png b/examples/quick/text/imgtag/images/heart200.png
new file mode 100644
index 0000000000..cedd3ea608
--- /dev/null
+++ b/examples/quick/text/imgtag/images/heart200.png
Binary files differ
diff --git a/examples/quick/text/imgtag/images/qtlogo.png b/examples/quick/text/imgtag/images/qtlogo.png
new file mode 100644
index 0000000000..996719a4c6
--- /dev/null
+++ b/examples/quick/text/imgtag/images/qtlogo.png
Binary files differ
diff --git a/examples/quick/text/imgtag/images/starfish_2.png b/examples/quick/text/imgtag/images/starfish_2.png
new file mode 100644
index 0000000000..132c20ffd0
--- /dev/null
+++ b/examples/quick/text/imgtag/images/starfish_2.png
Binary files differ
diff --git a/examples/quick/text/imgtag/imgtag.qml b/examples/quick/text/imgtag/imgtag.qml
new file mode 100644
index 0000000000..9d181af2cb
--- /dev/null
+++ b/examples/quick/text/imgtag/imgtag.qml
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: main
+ width: 320; height: 480
+ focus: true
+
+ property var hAlign: Text.AlignLeft
+
+ Flickable {
+ anchors.fill: parent
+ contentWidth: parent.width
+ contentHeight: col.height + 20
+
+ Column {
+ id: col
+ x: 10; y: 10
+ spacing: 20
+ width: parent.width - 20
+
+ TextWithImage {
+ text: "This is a <b>happy</b> face<img src=\"images/face-smile.png\">"
+ }
+ TextWithImage {
+ text: "This is a <b>very<img src=\"images/face-smile-big.png\" align=\"middle\"/>happy</b> face aligned in the middle."
+ }
+ TextWithImage {
+ elide: Text.ElideRight
+ maximumLineCount: 2
+ text: "This is a sad face aligned to the top. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc rutrum dui pretium ipsum malesuada venenatis. Nulla sed turpis risus. Integer sit amet odio quis mauris varius venenatis<img src=\"images/face-sad.png\" align=\"top\">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc rutrum dui pretium ipsum malesuada venenatis. Nulla sed turpis risus. Integer sit amet odio quis mauris varius venenatis."
+ }
+ TextWithImage {
+ text: "This is a tiny<img src=\"images/face-smile.png\" width=\"15\" height=\"15\">happy face."
+ }
+ TextWithImage {
+ text: "This is a starfish<img src=\"images/starfish_2.png\" width=\"50\" height=\"50\" align=\"top\">aligned to the top and another one<img src=\"images/heart200.png\" width=\"50\" height=\"50\">aligned to the bottom."
+ }
+ TextWithImage {
+ text: "Qt logos<img src=\"images/qtlogo.png\" width=\"55\" height=\"60\" align=\"middle\"><img src=\"images/qtlogo.png\" width=\"37\" height=\"40\" align=\"middle\"><img src=\"images/qtlogo.png\" width=\"18\" height=\"20\" align=\"middle\">aligned in the middle with different sizes."
+ }
+ TextWithImage {
+ text: "Some hearts<img src=\"images/heart200.png\" width=\"20\" height=\"20\" align=\"bottom\"><img src=\"images/heart200.png\" width=\"30\" height=\"30\" align=\"bottom\"> <img src=\"images/heart200.png\" width=\"40\" height=\"40\"><img src=\"images/heart200.png\" width=\"50\" height=\"50\" align=\"bottom\">with different sizes."
+ }
+ TextWithImage {
+ text: "Resized image<img width=\"80\" height=\"76\" align=\"middle\" src=\"http://files.app4mobile.com/wp-content/uploads/2011/08/nokia-n9-price-specification-features-us-europe-india.jpg\">from the internet."
+ }
+ TextWithImage {
+ text: "Image<img align=\"middle\" src=\"http://qt.gitorious.org/images/sites/qt/logo.png\">from the internet."
+ }
+ TextWithImage {
+ height: 120
+ verticalAlignment: Text.AlignVCenter
+ text: "This is a <b>happy</b> face<img src=\"images/face-smile.png\"> with an explicit height."
+ }
+ }
+ }
+
+ Keys.onUpPressed: main.hAlign = Text.AlignHCenter
+ Keys.onLeftPressed: main.hAlign = Text.AlignLeft
+ Keys.onRightPressed: main.hAlign = Text.AlignRight
+}
diff --git a/examples/quick/text/styledtext-layout.qml b/examples/quick/text/styledtext-layout.qml
new file mode 100644
index 0000000000..4571330568
--- /dev/null
+++ b/examples/quick/text/styledtext-layout.qml
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: main
+ width: 320; height: 480
+ focus: true
+
+ property real offset: 0
+ property real margin: 10
+
+ Keys.onLeftPressed: myText.horizontalAlignment = Text.AlignLeft
+ Keys.onUpPressed: myText.horizontalAlignment = Text.AlignHCenter
+ Keys.onRightPressed: myText.horizontalAlignment = Text.AlignRight
+ Keys.onDownPressed: myText.horizontalAlignment = Text.AlignJustify
+
+ Text {
+ id: myText
+ anchors.fill: parent
+ anchors.margins: 10
+ wrapMode: Text.WordWrap
+ font.family: "Times New Roman"
+ font.pixelSize: 13
+ textFormat: Text.StyledText
+ horizontalAlignment: Text.AlignJustify
+
+ text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer at ante dui sed eu egestas est facilis <a href=\"www.nokia.com\">www.nokia.com</a>.<br/>Curabitur ante est, pulvinar quis adipiscing a, iaculis id ipsum. Phasellus id neque id velit facilisis cursus ac sit amet nibh. Donec enim arcu, pharetra non semper nec, iaculis eget elit. Nunc blandit condimentum odio vel egestas.<br><ul type=\"bullet\"><li>Coffee<ol type=\"a\"><li>Espresso<li><b>Cappuccino</b><li><i>Flat White</i><li>Latte</ol><li>Juice<ol type=\"1\"><li>Orange</li><li>Apple</li><li>Pineapple</li><li>Tomato</li></ol></li></ul><p><font color=\"#434343\"><i>Proin consectetur <b>sapien</b> in ipsum lacinia sit amet mattis orci interdum. Quisque vitae accumsan lectus. Ut nisi turpis, sollicitudin ut dignissim id, fermentum ac est. Maecenas nec libero leo. Sed ac leo eget ipsum ultricies viverra sit amet eu orci. Praesent et tortor risus, viverra accumsan sapien. Sed faucibus eleifend lectus, sed euismod urna porta eu. Aenean ultricies lectus ut orci dictum quis convallis nisi ultrices. Nunc elit mi, iaculis a porttitor rutrum, venenatis malesuada nisi. Suspendisse turpis quam, euismod non imperdiet et, rutrum nec ligula. Lorem ipsum dolor sit amet, consectetur adipiscing elit."
+
+ onLineLaidOut: {
+ line.width = width / 2 - (2 * margin)
+ if (line.number === 30) {
+ main.offset = line.y
+ }
+ if (line.number >= 30) {
+ line.x = width / 2 + margin
+ line.y -= main.offset
+ }
+ if ((line.y + line.height) > rect.y && line.y < (rect.y + rect.height)) {
+ if (line.number < 30)
+ line.width = Math.min((rect.x - line.x), line.width)
+ else {
+ line.x = Math.max((rect.x + rect.width), width / 2 + margin)
+ line.width = Math.min((width - margin - line.x), line.width)
+ }
+ }
+ }
+
+ Item {
+ id: rect
+ x: 28; y: 20
+ width: 60; height: 60
+
+ Rectangle {
+ anchors { fill: parent; leftMargin: 2; rightMargin: 2 }
+ color: "lightsteelblue"; opacity: 0.3
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ drag.target: rect
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: mouse.button == Qt.RightButton ? myText.font.pixelSize -= 1 : myText.font.pixelSize += 1
+ onPositionChanged: myText.doLayout()
+ }
+ }
+ }
+
+}
diff --git a/examples/quick/text/text.qml b/examples/quick/text/text.qml
new file mode 100644
index 0000000000..9bfd290059
--- /dev/null
+++ b/examples/quick/text/text.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../../shared"
+
+Item {
+ height: 480
+ width: 480
+ LauncherList {
+ id: ll
+ anchors.fill: parent
+ Component.onCompleted: {
+ addExample("Hello", "An Animated Hello World", Qt.resolvedUrl("fonts/hello.qml"));
+ addExample("Fonts", "Using various fonts with a Text element", Qt.resolvedUrl("fonts/fonts.qml"));
+ addExample("Available Fonts", "A list of your available fonts", Qt.resolvedUrl("fonts/availableFonts.qml"));
+ addExample("Banner", "Large, scrolling text", Qt.resolvedUrl("fonts/banner.qml"));
+ }
+ }
+}
diff --git a/examples/quick/text/text.qmlproject b/examples/quick/text/text.qmlproject
new file mode 100644
index 0000000000..c08d9b9a89
--- /dev/null
+++ b/examples/quick/text/text.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "text.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/text/textselection/pics/endHandle.png b/examples/quick/text/textselection/pics/endHandle.png
new file mode 100644
index 0000000000..1a4bc5d7a0
--- /dev/null
+++ b/examples/quick/text/textselection/pics/endHandle.png
Binary files differ
diff --git a/examples/quick/text/textselection/pics/endHandle.sci b/examples/quick/text/textselection/pics/endHandle.sci
new file mode 100644
index 0000000000..4f51f24278
--- /dev/null
+++ b/examples/quick/text/textselection/pics/endHandle.sci
@@ -0,0 +1,5 @@
+border.left: 0
+border.top: 6
+border.bottom: 6
+border.right: 6
+source: endHandle.png
diff --git a/examples/quick/text/textselection/pics/startHandle.png b/examples/quick/text/textselection/pics/startHandle.png
new file mode 100644
index 0000000000..deedcd5c91
--- /dev/null
+++ b/examples/quick/text/textselection/pics/startHandle.png
Binary files differ
diff --git a/examples/quick/text/textselection/pics/startHandle.sci b/examples/quick/text/textselection/pics/startHandle.sci
new file mode 100644
index 0000000000..f9eae204c1
--- /dev/null
+++ b/examples/quick/text/textselection/pics/startHandle.sci
@@ -0,0 +1,5 @@
+border.left: 6
+border.top: 6
+border.bottom: 6
+border.right: 0
+source: startHandle.png
diff --git a/examples/quick/text/textselection/textselection.qml b/examples/quick/text/textselection/textselection.qml
new file mode 100644
index 0000000000..7938ce5bf7
--- /dev/null
+++ b/examples/quick/text/textselection/textselection.qml
@@ -0,0 +1,211 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+Rectangle {
+ id: editor
+ color: "lightGrey"
+ width: 640; height: 480
+
+ Rectangle {
+ color: "white"
+ anchors.fill: parent
+ anchors.margins: 20
+
+ BorderImage {
+ id: startHandle
+ source: "pics/startHandle.sci"
+ opacity: 0.0
+ width: 10
+ x: edit.positionToRectangle(edit.selectionStart).x - flick.contentX-width
+ y: edit.positionToRectangle(edit.selectionStart).y - flick.contentY
+ height: edit.positionToRectangle(edit.selectionStart).height
+ }
+
+ BorderImage {
+ id: endHandle
+ source: "pics/endHandle.sci"
+ opacity: 0.0
+ width: 10
+ x: edit.positionToRectangle(edit.selectionEnd).x - flick.contentX
+ y: edit.positionToRectangle(edit.selectionEnd).y - flick.contentY
+ height: edit.positionToRectangle(edit.selectionEnd).height
+ }
+
+ Flickable {
+ id: flick
+
+ anchors.fill: parent
+ contentWidth: edit.paintedWidth
+ contentHeight: edit.paintedHeight
+ interactive: true
+ clip: true
+
+ function ensureVisible(r) {
+ if (contentX >= r.x)
+ contentX = r.x;
+ else if (contentX+width <= r.x+r.width)
+ contentX = r.x+r.width-width;
+ if (contentY >= r.y)
+ contentY = r.y;
+ else if (contentY+height <= r.y+r.height)
+ contentY = r.y+r.height-height;
+ }
+
+ TextEdit {
+ id: edit
+ width: flick.width
+ height: flick.height
+ focus: true
+ wrapMode: TextEdit.Wrap
+ textFormat: TextEdit.RichText
+
+ onCursorRectangleChanged: flick.ensureVisible(cursorRectangle)
+
+ text: "<h1>Text Selection</h1>"
+ +"<p>This example is a whacky text selection mechanisms, showing how these can be implemented in the TextEdit element, to cater for whatever style is appropriate for the target platform."
+ +"<p><b>Press-and-hold</b> to select a word, then drag the selection handles."
+ +"<p><b>Drag outside the selection</b> to scroll the text."
+ +"<p><b>Click inside the selection</b> to cut/copy/paste/cancel selection."
+ +"<p>It's too whacky to let you paste if there is no current selection."
+
+ }
+ }
+
+ Item {
+ id: menu
+ opacity: 0.0
+ width: 100
+ height: 120
+ anchors.centerIn: parent
+
+ Rectangle {
+ border.width: 1
+ border.color: "darkBlue"
+ radius: 15
+ color: "#806080FF"
+ anchors.fill: parent
+ }
+
+ Column {
+ anchors.centerIn: parent
+ spacing: 8
+
+ Rectangle {
+ border.width: 1
+ border.color: "darkBlue"
+ color: "#ff7090FF"
+ width: 60
+ height: 16
+
+ Text { anchors.centerIn: parent; text: "Cut" }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { edit.cut(); editor.state = "" }
+ }
+ }
+
+ Rectangle {
+ border.width: 1
+ border.color: "darkBlue"
+ color: "#ff7090FF"
+ width: 60
+ height: 16
+
+ Text { anchors.centerIn: parent; text: "Copy" }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { edit.copy(); editor.state = "selection" }
+ }
+ }
+
+ Rectangle {
+ border.width: 1
+ border.color: "darkBlue"
+ color: "#ff7090FF"
+ width: 60
+ height: 16
+
+ Text { anchors.centerIn: parent; text: "Paste" }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { edit.paste(); edit.cursorPosition = edit.selectionEnd; editor.state = "" }
+ }
+ }
+
+ Rectangle {
+ border.width: 1
+ border.color: "darkBlue"
+ color: "#ff7090FF"
+ width: 60
+ height: 16
+
+ Text { anchors.centerIn: parent; text: "Deselect" }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ edit.cursorPosition = edit.selectionEnd;
+ edit.deselect();
+ editor.state = ""
+ }
+ }
+ }
+ }
+ }
+ }
+
+ states: [
+ State {
+ name: "selection"
+ PropertyChanges { target: startHandle; opacity: 1.0 }
+ PropertyChanges { target: endHandle; opacity: 1.0 }
+ },
+ State {
+ name: "menu"
+ PropertyChanges { target: startHandle; opacity: 0.5 }
+ PropertyChanges { target: endHandle; opacity: 0.5 }
+ PropertyChanges { target: menu; opacity: 1.0 }
+ }
+ ]
+}
diff --git a/examples/quick/threading/threadedlistmodel/dataloader.js b/examples/quick/threading/threadedlistmodel/dataloader.js
new file mode 100644
index 0000000000..4d2aab323d
--- /dev/null
+++ b/examples/quick/threading/threadedlistmodel/dataloader.js
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ![0]
+WorkerScript.onMessage = function(msg) {
+ if (msg.action == 'appendCurrentTime') {
+ var data = {'time': new Date().toTimeString()};
+ msg.model.append(data);
+ msg.model.sync(); // updates the changes to the list
+ }
+}
+// ![0]
diff --git a/examples/quick/threading/threadedlistmodel/threadedlistmodel.qmlproject b/examples/quick/threading/threadedlistmodel/threadedlistmodel.qmlproject
new file mode 100644
index 0000000000..e7c8e69f14
--- /dev/null
+++ b/examples/quick/threading/threadedlistmodel/threadedlistmodel.qmlproject
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QmlProject 1.1
+
+Project {
+ mainFile: "timedisplay.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/threading/threadedlistmodel/timedisplay.qml b/examples/quick/threading/threadedlistmodel/timedisplay.qml
new file mode 100644
index 0000000000..48d0f659e5
--- /dev/null
+++ b/examples/quick/threading/threadedlistmodel/timedisplay.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// ![0]
+import QtQuick 2.0
+
+Rectangle {
+ color: "white"
+ width: 200
+ height: 300
+
+ ListView {
+ anchors.fill: parent
+ model: listModel
+ delegate: Component {
+ Text { text: time }
+ }
+
+ ListModel { id: listModel }
+
+ WorkerScript {
+ id: worker
+ source: "dataloader.js"
+ }
+
+ Timer {
+ id: timer
+ interval: 2000; repeat: true
+ running: true
+ triggeredOnStart: true
+
+ onTriggered: {
+ var msg = {'action': 'appendCurrentTime', 'model': listModel};
+ worker.sendMessage(msg);
+ }
+ }
+ }
+}
+// ![0]
diff --git a/examples/quick/threading/workerscript/workerscript.js b/examples/quick/threading/workerscript/workerscript.js
new file mode 100644
index 0000000000..f76471f920
--- /dev/null
+++ b/examples/quick/threading/workerscript/workerscript.js
@@ -0,0 +1,15 @@
+var lastx = 0;
+var lasty = 0;
+
+WorkerScript.onMessage = function(message) {
+ var ydiff = message.y - lasty;
+ var xdiff = message.x - lastx;
+
+ var total = Math.sqrt(ydiff * ydiff + xdiff * xdiff);
+
+ lastx = message.x;
+ lasty = message.y;
+
+ WorkerScript.sendMessage( {xmove: xdiff, ymove: ydiff, move: total} );
+}
+
diff --git a/examples/quick/threading/workerscript/workerscript.qml b/examples/quick/threading/workerscript/workerscript.qml
new file mode 100644
index 0000000000..7fced8166c
--- /dev/null
+++ b/examples/quick/threading/workerscript/workerscript.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 480; height: 320
+
+ WorkerScript {
+ id: myWorker
+ source: "workerscript.js"
+
+ onMessage: {
+ console.log("Moved " + messageObject.xmove + " along the X axis.");
+ console.log("Moved " + messageObject.ymove + " along the Y axis.");
+ console.log("Moved " + messageObject.move + " pixels.");
+ }
+ }
+
+ Rectangle {
+ width: 200; height: 200
+ anchors.left: parent.left; anchors.leftMargin: 20
+ color: "red"
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: myWorker.sendMessage( { rectangle: "red", x: mouse.x, y: mouse.y } );
+ }
+ }
+
+ Rectangle {
+ width: 200; height: 200
+ anchors.right: parent.right; anchors.rightMargin: 20
+ color: "blue"
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: myWorker.sendMessage( { rectangle: "blue", x: mouse.x, y: mouse.y } );
+ }
+ }
+
+ Text {
+ text: "Click a Rectangle!"
+ anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom; bottomMargin: 50 }
+ }
+}
diff --git a/examples/quick/threading/workerscript/workerscript.qmlproject b/examples/quick/threading/workerscript/workerscript.qmlproject
new file mode 100644
index 0000000000..6d7a91feeb
--- /dev/null
+++ b/examples/quick/threading/workerscript/workerscript.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "workerscript.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/quick/touchinteraction/flickable/content/Day.qml b/examples/quick/touchinteraction/flickable/content/Day.qml
new file mode 100644
index 0000000000..7fe625c305
--- /dev/null
+++ b/examples/quick/touchinteraction/flickable/content/Day.qml
@@ -0,0 +1,153 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Component {
+ Item {
+ property variant stickies
+
+ id: page
+ width: ListView.view.width+40; height: ListView.view.height
+
+
+ Image {
+ source: "cork.jpg"
+ width: page.ListView.view.width
+ height: page.ListView.view.height
+ fillMode: Image.PreserveAspectCrop
+ clip: true
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: page.focus = false;
+ }
+
+ Text {
+ text: name; x: 15; y: 8; height: 40; width: 370
+ font.pixelSize: 18; font.bold: true; color: "white"
+ style: Text.Outline; styleColor: "black"
+ }
+
+ Repeater {
+ model: notes
+ Item {
+ id: stickyPage
+
+ property int randomX: Math.random() * (page.ListView.view.width-0.5*stickyImage.width) +100
+ property int randomY: Math.random() * (page.ListView.view.height-0.5*stickyImage.height) +50
+
+ x: randomX; y: randomY
+
+ rotation: -flickable.horizontalVelocity / 100;
+ Behavior on rotation {
+ SpringAnimation { spring: 2.0; damping: 0.15 }
+ }
+
+ Item {
+ id: sticky
+ scale: 0.7
+
+ Image {
+ id: stickyImage
+ x: 8 + -width * 0.6 / 2; y: -20
+ source: "note-yellow.png"
+ scale: 0.6; transformOrigin: Item.TopLeft
+ smooth: true
+ }
+
+ TextEdit {
+ id: myText
+ x: -104; y: 36; width: 215; height: 200
+ smooth: true
+ font.pixelSize: 24
+ readOnly: false
+ rotation: -8
+ text: noteText
+ }
+
+ Item {
+ x: stickyImage.x; y: -20
+ width: stickyImage.width * stickyImage.scale
+ height: stickyImage.height * stickyImage.scale
+
+ MouseArea {
+ id: mouse
+ anchors.fill: parent
+ drag.target: stickyPage
+ drag.axis: Drag.XandYAxis
+ drag.minimumY: 0
+ drag.maximumY: page.height - 80
+ drag.minimumX: 100
+ drag.maximumX: page.width - 140
+ onClicked: { myText.focus = true; myText.openSoftwareInputPanel(); }
+ }
+ }
+ }
+
+ Image {
+ x: -width / 2; y: -height * 0.5 / 2
+ source: "tack.png"
+ scale: 0.7; transformOrigin: Item.TopLeft
+ }
+
+ states: State {
+ name: "pressed"
+ when: mouse.pressed
+ PropertyChanges { target: sticky; rotation: 8; scale: 1 }
+ PropertyChanges { target: page; z: 8 }
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "rotation,scale"; duration: 200 }
+ }
+ }
+ }
+ }
+}
+
+
+
+
+
+
+
+
diff --git a/examples/quick/touchinteraction/flickable/content/cork.jpg b/examples/quick/touchinteraction/flickable/content/cork.jpg
new file mode 100644
index 0000000000..160bc002bf
--- /dev/null
+++ b/examples/quick/touchinteraction/flickable/content/cork.jpg
Binary files differ
diff --git a/examples/quick/touchinteraction/flickable/content/note-yellow.png b/examples/quick/touchinteraction/flickable/content/note-yellow.png
new file mode 100644
index 0000000000..8ddecc8b03
--- /dev/null
+++ b/examples/quick/touchinteraction/flickable/content/note-yellow.png
Binary files differ
diff --git a/examples/quick/touchinteraction/flickable/content/tack.png b/examples/quick/touchinteraction/flickable/content/tack.png
new file mode 100644
index 0000000000..cef2d1cd23
--- /dev/null
+++ b/examples/quick/touchinteraction/flickable/content/tack.png
Binary files differ
diff --git a/examples/quick/touchinteraction/flickable/corkboards.qml b/examples/quick/touchinteraction/flickable/corkboards.qml
new file mode 100644
index 0000000000..dc3aa6b378
--- /dev/null
+++ b/examples/quick/touchinteraction/flickable/corkboards.qml
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ width: 800; height: 480
+ color: "#464646"
+
+ ListModel {
+ id: list
+
+ ListElement {
+ name: "Sunday"
+ notes: [
+ ListElement { noteText: "Lunch" },
+ ListElement { noteText: "Birthday Party" }
+ ]
+ }
+
+ ListElement {
+ name: "Monday"
+ notes: [
+ ListElement { noteText: "Pickup kids from\nschool\n4.30pm" },
+ ListElement { noteText: "Checkout Qt" }, ListElement { noteText: "Read email" }
+ ]
+ }
+
+ ListElement {
+ name: "Tuesday"
+ notes: [
+ ListElement { noteText: "Walk dog" },
+ ListElement { noteText: "Buy newspaper" }
+ ]
+ }
+
+ ListElement {
+ name: "Wednesday"
+ notes: [ ListElement { noteText: "Cook dinner" } ]
+ }
+
+ ListElement {
+ name: "Thursday"
+ notes: [
+ ListElement { noteText: "Meeting\n5.30pm" },
+ ListElement { noteText: "Weed garden" }
+ ]
+ }
+
+ ListElement {
+ name: "Friday"
+ notes: [
+ ListElement { noteText: "More work" },
+ ListElement { noteText: "Grocery shopping" }
+ ]
+ }
+
+ ListElement {
+ name: "Saturday"
+ notes: [
+ ListElement { noteText: "Drink" },
+ ListElement { noteText: "Download Qt\nPlay with QML" }
+ ]
+ }
+ }
+
+ ListView {
+ id: flickable
+
+ anchors.fill: parent
+ focus: true
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ orientation: ListView.Horizontal
+ snapMode: ListView.SnapOneItem
+ model: list
+ delegate: Day { }
+ }
+}
diff --git a/examples/quick/touchinteraction/multipointtouch/bearwhack.qml b/examples/quick/touchinteraction/multipointtouch/bearwhack.qml
new file mode 100644
index 0000000000..db46473c05
--- /dev/null
+++ b/examples/quick/touchinteraction/multipointtouch/bearwhack.qml
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+import "content"
+
+Item {
+ id: root
+ height: 640
+ width: 320
+ Item {
+ id: startScreen
+ anchors.fill: parent
+ z: 1000
+ Image {
+ source: "content/title.png"
+ anchors.centerIn: parent
+ }
+ MouseArea{
+ anchors.fill: parent
+ onClicked: {//Game Start
+ parent.visible = false;
+ }
+ }
+ }
+ Rectangle {
+ id: bg
+ anchors.fill: parent
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "DarkBlue" }
+ GradientStop { position: 0.8; color: "SkyBlue" }
+ GradientStop { position: 0.81; color: "ForestGreen" }
+ GradientStop { position: 1.0; color: "DarkGreen" }
+ }
+ }
+
+ BearWhackParticleSystem {
+ id: particleSystem
+ anchors.fill: parent
+ running: !startScreen.visible
+ }
+
+ property int score: 0
+
+ Text {
+ anchors.right: parent.right
+ anchors.margins: 4
+ anchors.top: parent.top
+ color: "white"
+ function padded(num) {
+ var ret = num.toString();
+ while (ret.length < 6)
+ ret = "0" + ret;
+ return ret;
+ }
+ text: "Score: " + padded(score)
+ }
+ MultiPointTouchArea {
+ anchors.fill: parent
+ touchPoints: [//Support up to 4 touches at once?
+ AugmentedTouchPoint{ system: particleSystem },
+ AugmentedTouchPoint{ system: particleSystem },
+ AugmentedTouchPoint{ system: particleSystem },
+ AugmentedTouchPoint{ system: particleSystem }
+ ]
+ }
+ MouseArea{
+ anchors.fill: parent
+ id: ma
+ onPressedChanged: {
+ if (pressed) {
+ timer.restart();
+ sgoal.enabled = true;
+ particleSystem.explode(mouseX,mouseY);
+ }
+ }
+ Timer {
+ id: timer
+ interval: 100
+ running: false
+ repeat: false
+ onTriggered: sgoal.enabled = false
+ }
+ SpriteGoal {
+ id: sgoal
+ x: ma.mouseX - 16
+ y: ma.mouseY - 16
+ width: 32
+ height: 32
+ system: particleSystem
+ parent: particleSystem
+ goalState: "falling"
+ enabled: false
+ }
+ }
+}
diff --git a/examples/quick/touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml b/examples/quick/touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml
new file mode 100644
index 0000000000..aede1a8f4e
--- /dev/null
+++ b/examples/quick/touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+TouchPoint {
+ id: container
+ property ParticleSystem system
+ onPressedChanged: {
+ if (pressed) {
+ timer.restart();
+ child.enabled = true;
+ system.explode(x,y);
+ }
+ }
+ property QtObject obj: Timer {
+ id: timer
+ interval: 100
+ running: false
+ repeat: false
+ onTriggered: child.enabled = false
+ }
+ property Item child: SpriteGoal {
+ enabled: false
+ x: container.area.x - 16
+ y: container.area.y - 16
+ width: container.area.width + 32
+ height: container.area.height + 32 //+32 so it doesn't have to hit the exact center
+ system: container.system
+ parent: container.system
+ goalState: "falling"
+ }
+}
diff --git a/examples/quick/touchinteraction/multipointtouch/content/Bear0.png b/examples/quick/touchinteraction/multipointtouch/content/Bear0.png
new file mode 100644
index 0000000000..64a02cec8e
--- /dev/null
+++ b/examples/quick/touchinteraction/multipointtouch/content/Bear0.png
Binary files differ
diff --git a/examples/quick/touchinteraction/multipointtouch/content/Bear1.png b/examples/quick/touchinteraction/multipointtouch/content/Bear1.png
new file mode 100644
index 0000000000..3b88f3b32e
--- /dev/null
+++ b/examples/quick/touchinteraction/multipointtouch/content/Bear1.png
Binary files differ
diff --git a/examples/quick/touchinteraction/multipointtouch/content/Bear2.png b/examples/quick/touchinteraction/multipointtouch/content/Bear2.png
new file mode 100644
index 0000000000..337b636070
--- /dev/null
+++ b/examples/quick/touchinteraction/multipointtouch/content/Bear2.png
Binary files differ
diff --git a/examples/quick/touchinteraction/multipointtouch/content/Bear3.png b/examples/quick/touchinteraction/multipointtouch/content/Bear3.png
new file mode 100644
index 0000000000..f0e68590f4
--- /dev/null
+++ b/examples/quick/touchinteraction/multipointtouch/content/Bear3.png
Binary files differ
diff --git a/examples/quick/touchinteraction/multipointtouch/content/BearB.png b/examples/quick/touchinteraction/multipointtouch/content/BearB.png
new file mode 100644
index 0000000000..c9a84ae1d4
--- /dev/null
+++ b/examples/quick/touchinteraction/multipointtouch/content/BearB.png
Binary files differ
diff --git a/examples/quick/touchinteraction/multipointtouch/content/BearWhackParticleSystem.qml b/examples/quick/touchinteraction/multipointtouch/content/BearWhackParticleSystem.qml
new file mode 100644
index 0000000000..bed03e99aa
--- /dev/null
+++ b/examples/quick/touchinteraction/multipointtouch/content/BearWhackParticleSystem.qml
@@ -0,0 +1,180 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+ParticleSystem {
+ id: particleSystem
+ function explode(x,y) {
+ fireEmitter.burst(100,x,y);
+ }
+
+ Emitter {
+ id: emitter
+ group: "bears"
+ width: parent.width
+ emitRate: 1
+ NumberAnimation on emitRate {
+ id: goFaster
+ from: 1
+ to: 16
+ running: particleSystem.running
+ loops: 1
+ duration: 60000 * 5
+ easing.type: Easing.Linear
+ }
+ lifeSpan: 4000 + 800*(16-emitRate)
+ maximumEmitted: 128
+ size: 64
+ speed: PointDirection{ y: 40 + 10 * emitter.emitRate }
+ }
+
+ Emitter {
+ id: fireEmitter
+ enabled: false
+ maximumEmitted: 6000
+ group: "flame"
+ emitRate: 1000
+ size: 16
+ endSize: 8
+ speed: CumulativeDirection { AngleDirection {angleVariation: 180; magnitudeVariation: 120;} PointDirection { y: -60 }}
+ lifeSpan: 400
+ }
+ Emitter {
+ id: heartEmitter
+ enabled: false
+ maximumEmitted: 6000
+ group: "hearts"
+ emitRate: 1000
+ size: 16
+ endSize: 8
+ speed: AngleDirection {angleVariation: 180; magnitudeVariation: 180;}
+ lifeSpan: 600
+ }
+ Emitter {
+ id: bloodEmitter
+ enabled: false
+ maximumEmitted: 6000
+ group: "blood"
+ emitRate: 1000
+ size: 16
+ endSize: 8
+ speed: CumulativeDirection { AngleDirection {angleVariation: 180; magnitudeVariation: 80;} PointDirection { y: 40 }}
+ lifeSpan: 600
+ }
+
+ Affector {
+ width: parent.width
+ height: 64
+ once: true
+ y: parent.height - 32
+ groups: "bears"
+ onAffectParticles: {
+ for (var i=0;i<particles.length; i++) {
+ if (particles[i].animationIndex != 0) {
+ score++;
+ bloodEmitter.burst(100, particles[i].x, particles[i].y);
+ } else {
+ score--;
+ heartEmitter.burst(100, particles[i].x, particles[i].y);
+ }
+ particles[i].update = 1.0;
+ particles[i].t -= 1000.0;
+ }
+ }
+ }
+ ImageParticle {
+ groups: ["flame"]
+ source: "blur-circle.png"
+ z: 4
+ colorVariation: 0.1
+ color: "#ffa24d"
+ alpha: 0.4
+ }
+ ImageParticle {
+ groups: ["blood"]
+ color: "red"
+ z: 2
+ source: "blur-circle3.png"
+ alpha: 0.2
+ }
+ ImageParticle {
+ groups: ["hearts"]
+ color: "#ff66AA"
+ z: 3
+ source: "heart-blur.png"
+ alpha: 0.4
+ autoRotation: true
+ }
+ ImageParticle {
+ groups: ["bears"]
+ z: 1
+ spritesInterpolate: false
+ sprites:[
+ Sprite{
+ name: "floating"
+ source: "Bear1.png"
+ frameCount: 9
+ frameWidth: 256
+ frameHeight: 256
+ frameDuration: 80
+ to: {"still":0, "flailing":0}
+ },
+ Sprite{
+ name: "flailing"
+ source: "Bear2.png"
+ frameCount: 8
+ frameWidth: 256
+ frameHeight: 256
+ frameDuration: 80
+ to: {"falling":1}
+ },
+ Sprite{
+ name: "falling"
+ source: "Bear3.png"
+ frameCount: 5
+ frameWidth: 256
+ frameHeight: 256
+ frameDuration: 80
+ to: {"falling":1}
+ }
+ ]
+ }
+}
diff --git a/examples/quick/touchinteraction/multipointtouch/content/ParticleFlame.qml b/examples/quick/touchinteraction/multipointtouch/content/ParticleFlame.qml
new file mode 100644
index 0000000000..9788c5c665
--- /dev/null
+++ b/examples/quick/touchinteraction/multipointtouch/content/ParticleFlame.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Particles 2.0
+
+ParticleSystem {
+ property alias color: img.color
+ property alias emitting: emitter.enabled
+ ImageParticle {
+ id: img
+ source: "blur-circle.png"
+ colorVariation: 0.1
+ color: "#ff521d"
+ alpha: 0
+ }
+ Emitter {
+ id: emitter
+ speedFromMovement: 20
+ emitRate: 80
+ lifeSpan: 1500
+ speed: PointDirection{ y: -90; yVariation: 50; }
+ acceleration: PointDirection{ xVariation: 100; yVariation: 90; }
+ size: 51
+ sizeVariation: 53
+ endSize: 64
+ }
+}
diff --git a/examples/quick/touchinteraction/multipointtouch/content/blur-circle.png b/examples/quick/touchinteraction/multipointtouch/content/blur-circle.png
new file mode 100644
index 0000000000..1b03cd0b2c
--- /dev/null
+++ b/examples/quick/touchinteraction/multipointtouch/content/blur-circle.png
Binary files differ
diff --git a/examples/quick/touchinteraction/multipointtouch/content/blur-circle3.png b/examples/quick/touchinteraction/multipointtouch/content/blur-circle3.png
new file mode 100644
index 0000000000..dbc39cb16e
--- /dev/null
+++ b/examples/quick/touchinteraction/multipointtouch/content/blur-circle3.png
Binary files differ
diff --git a/examples/quick/touchinteraction/multipointtouch/content/heart-blur.png b/examples/quick/touchinteraction/multipointtouch/content/heart-blur.png
new file mode 100644
index 0000000000..dbc38804ee
--- /dev/null
+++ b/examples/quick/touchinteraction/multipointtouch/content/heart-blur.png
Binary files differ
diff --git a/examples/quick/touchinteraction/multipointtouch/content/title.png b/examples/quick/touchinteraction/multipointtouch/content/title.png
new file mode 100644
index 0000000000..d630ea2643
--- /dev/null
+++ b/examples/quick/touchinteraction/multipointtouch/content/title.png
Binary files differ
diff --git a/examples/quick/touchinteraction/multipointtouch/multiflame.qml b/examples/quick/touchinteraction/multipointtouch/multiflame.qml
new file mode 100644
index 0000000000..72a0ce21f8
--- /dev/null
+++ b/examples/quick/touchinteraction/multipointtouch/multiflame.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ width: 360
+ height: 480
+ color: "black"
+
+ MultiPointTouchArea {
+ anchors.fill: parent
+ minimumTouchPoints: 1
+ maximumTouchPoints: 5
+ touchPoints: [
+ TouchPoint { id: touch1 },
+ TouchPoint { id: touch2 },
+ TouchPoint { id: touch11 },
+ TouchPoint { id: touch21 },
+ TouchPoint { id: touch31 }
+ ]
+ }
+
+ ParticleFlame {
+ color: "red"
+ x: touch1.x
+ y: touch1.y
+ emitting: touch1.pressed
+ }
+ ParticleFlame {
+ color: "green"
+ x: touch2.x
+ y: touch2.y
+ emitting: touch2.pressed
+ }
+ ParticleFlame {
+ color: "yellow"
+ x: touch11.x
+ y: touch11.y
+ emitting: touch11.pressed
+ }
+ ParticleFlame {
+ color: "blue"
+ x: touch21.x
+ y: touch21.y
+ emitting: touch21.pressed
+ }
+ ParticleFlame {
+ color: "violet"
+ x: touch31.x
+ y: touch31.y
+ emitting: touch31.pressed
+ }
+}
diff --git a/examples/quick/touchinteraction/pincharea/flickresize.qml b/examples/quick/touchinteraction/pincharea/flickresize.qml
new file mode 100644
index 0000000000..037766e4a0
--- /dev/null
+++ b/examples/quick/touchinteraction/pincharea/flickresize.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 640
+ height: 360
+ color: "gray"
+
+ Flickable {
+ id: flick
+ anchors.fill: parent
+ contentWidth: 500
+ contentHeight: 500
+
+ PinchArea {
+ width: Math.max(flick.contentWidth, flick.width)
+ height: Math.max(flick.contentHeight, flick.height)
+
+ property real initialWidth
+ property real initialHeight
+ onPinchStarted: {
+ initialWidth = flick.contentWidth
+ initialHeight = flick.contentHeight
+ }
+
+ onPinchUpdated: {
+ // adjust content pos due to drag
+ flick.contentX += pinch.previousCenter.x - pinch.center.x
+ flick.contentY += pinch.previousCenter.y - pinch.center.y
+
+ // resize content
+ flick.resizeContent(initialWidth * pinch.scale, initialHeight * pinch.scale, pinch.center)
+ }
+
+ onPinchFinished: {
+ // Move its content within bounds.
+ flick.returnToBounds()
+ }
+
+ Rectangle {
+ width: flick.contentWidth
+ height: flick.contentHeight
+ color: "white"
+ Image {
+ anchors.fill: parent
+ source: "qt-logo.jpg"
+ MouseArea {
+ anchors.fill: parent
+ onDoubleClicked: {
+ flick.contentWidth = 500
+ flick.contentHeight = 500
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/quick/touchinteraction/pincharea/qt-logo.jpg b/examples/quick/touchinteraction/pincharea/qt-logo.jpg
new file mode 100644
index 0000000000..4014b4659c
--- /dev/null
+++ b/examples/quick/touchinteraction/pincharea/qt-logo.jpg
Binary files differ
diff --git a/examples/quick/touchinteraction/touchinteraction.qml b/examples/quick/touchinteraction/touchinteraction.qml
new file mode 100644
index 0000000000..b4a930c495
--- /dev/null
+++ b/examples/quick/touchinteraction/touchinteraction.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "../../shared"
+
+Item {
+ height: 480
+ width: 320
+ LauncherList {
+ id: ll
+ anchors.fill: parent
+ Component.onCompleted: {
+ addExample("Multipoint Flames", "Create multiple flames with multiple fingers", Qt.resolvedUrl("multipointtouch/multiflame.qml"));
+ addExample("Bear-Whack", "Use multiple touches to knock all the bears down", Qt.resolvedUrl("multipointtouch/bearwhack.qml"));
+ addExample("Flick Resize", "Manipulate images using pinch gestures", Qt.resolvedUrl("pincharea/flickresize.qml"));
+ }
+ }
+}
diff --git a/examples/quick/touchinteraction/touchinteraction.qmlproject b/examples/quick/touchinteraction/touchinteraction.qmlproject
new file mode 100644
index 0000000000..a9aa9d2e81
--- /dev/null
+++ b/examples/quick/touchinteraction/touchinteraction.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "touchinteraction.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/shared/Button.qml b/examples/shared/Button.qml
new file mode 100644
index 0000000000..a899a1410b
--- /dev/null
+++ b/examples/shared/Button.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: container
+
+ property string text: "Button"
+ property string subText: "Just a button"
+ signal clicked
+
+ width: buttonLabel.width + 20; height: col.height + 12
+
+ MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() }
+
+ Column {
+ spacing: 2
+ id: col
+ Text {
+ id: buttonLabel; text: container.text; color: "black"; font.pixelSize: 24
+ }
+ Text {
+ id: buttonLabel2; text: container.subText; color: "black"; font.pixelSize: 12
+ }
+ }
+}
diff --git a/examples/shared/LauncherList.qml b/examples/shared/LauncherList.qml
new file mode 100644
index 0000000000..492290dc3e
--- /dev/null
+++ b/examples/shared/LauncherList.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+ListView {
+ //model is a list of {"name":"somename", "url":"file:///some/url/mainfile.qml"}
+ //function used to add to model A) to enforce scheme B) to allow Qt.resolveUrl in url assignments
+ function addExample(name, desc, url)
+ {
+ myModel.append({"name":name, "description":desc, "url":url})
+ }
+ function hideExample()
+ {
+ ei.visible = false;
+ }
+
+ clip: true
+ delegate: SimpleLauncherDelegate{exampleItem: ei}
+ model: ListModel {id:myModel}
+ Item {
+ id: ei
+ visible: false
+ clip: true
+ property url exampleUrl
+ onExampleUrlChanged: visible = (exampleUrl == '' ? false : true);//Setting exampleUrl automatically shows example
+ anchors.fill: parent
+ anchors.bottomMargin: 40
+ Rectangle {
+ id: bg
+ anchors.fill: parent
+ color: "white"
+ }
+ MouseArea{
+ anchors.fill: parent
+ enabled: ei.visible
+ //Eats mouse events
+ }
+ Loader{
+ source: ei.exampleUrl
+ anchors.fill: parent
+ }
+ }
+ Rectangle {
+ id: bar
+ visible: ei.visible
+ anchors.bottom: parent.bottom
+ width: parent.width
+ height: 40
+ MouseArea{
+ anchors.fill: parent
+ enabled: ei.visible
+ //Eats mouse events
+ }
+ Image {
+ source: "images/back.png"
+ anchors.verticalCenter: parent.verticalCenter
+ x: 4
+ MouseArea {
+ anchors.fill: parent
+ anchors.margins: -10
+ onClicked: ei.exampleUrl = "";
+ }
+ }
+ }
+}
diff --git a/examples/shared/README b/examples/shared/README
new file mode 100644
index 0000000000..bf16f238c7
--- /dev/null
+++ b/examples/shared/README
@@ -0,0 +1,11 @@
+These files are shared between multiple examples as a set of common and
+reusuable components. While they do demonstrate the building of reusable
+components in QML, they are not official examples themselves.
+Consequently they do not have entries in the Qt documentation, and are
+documented only through the code comments within the files. Developers
+new to QML are strongly encouraged to go through the official examples
+before delving into this directory.
+
+For most application use, see the Qt Quick Components project to find
+ready-made Components you can use in your own projects. Qt Declarative
+examples do not use them only to avoid external dependencies.
diff --git a/examples/shared/SimpleLauncherDelegate.qml b/examples/shared/SimpleLauncherDelegate.qml
new file mode 100644
index 0000000000..c3708fe259
--- /dev/null
+++ b/examples/shared/SimpleLauncherDelegate.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+
+Item {
+ id: container
+ property Item exampleItem
+ width: ListView.view.width
+ height: 64
+ Button {
+ anchors.fill: parent
+ text: name
+ subText: description
+ onClicked: exampleItem.exampleUrl = url;
+ }
+}
diff --git a/examples/shared/images/back.png b/examples/shared/images/back.png
new file mode 100644
index 0000000000..506ac42fcf
--- /dev/null
+++ b/examples/shared/images/back.png
Binary files differ
diff --git a/examples/shared/qmldir b/examples/shared/qmldir
new file mode 100644
index 0000000000..2f1e56aefb
--- /dev/null
+++ b/examples/shared/qmldir
@@ -0,0 +1,3 @@
+Button 2.0 Button.qml
+LauncherList 2.0 LauncherList.qml
+SimpleLauncherDelegate 2.0 SimpleLauncherDelegate.qml
diff --git a/examples/shared/shared.h b/examples/shared/shared.h
new file mode 100644
index 0000000000..e6d0130ec8
--- /dev/null
+++ b/examples/shared/shared.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QGuiApplication>
+#include <QQuickView>
+#define DECLARATIVE_EXAMPLE_MAIN(NAME) int main(int argc, char* argv[]) \
+{\
+ QGuiApplication app(argc,argv);\
+ QQuickView view;\
+ view.setSource(QUrl::fromLocalFile(#NAME ".qml"));\
+ view.show();\
+ return app.exec();\
+}
diff --git a/examples/shared/shared.pro b/examples/shared/shared.pro
new file mode 100644
index 0000000000..d6ce120f41
--- /dev/null
+++ b/examples/shared/shared.pro
@@ -0,0 +1,9 @@
+#just install the files, all QML for now
+TEMPLATE = aux
+
+qml.files = images \
+ LauncherList.qml \
+ SimpleLauncherDelegate.qml \
+ Button.qml
+qml.path = $$[QT_INSTALL_EXAMPLES]/qtdeclarative/shared
+INSTALLS = qml
diff --git a/examples/tutorials/dynamicview/dynamicview1/PetsModel.qml b/examples/tutorials/dynamicview/dynamicview1/PetsModel.qml
new file mode 100644
index 0000000000..f07613c968
--- /dev/null
+++ b/examples/tutorials/dynamicview/dynamicview1/PetsModel.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 2.0
+
+ListModel {
+ ListElement {
+ name: "Polly"
+ type: "Parrot"
+ age: 12
+ size: "Small"
+ }
+ ListElement {
+ name: "Penny"
+ type: "Turtle"
+ age: 4
+ size: "Small"
+ }
+//![0]
+ ListElement {
+ name: "Warren"
+ type: "Rabbit"
+ age: 2
+ size: "Small"
+ }
+ ListElement {
+ name: "Spot"
+ type: "Dog"
+ age: 9
+ size: "Medium"
+ }
+ ListElement {
+ name: "Schrödinger"
+ type: "Cat"
+ age: 2
+ size: "Medium"
+ }
+ ListElement {
+ name: "Joey"
+ type: "Kangaroo"
+ age: 1
+ size: "Medium"
+ }
+ ListElement {
+ name: "Kimba"
+ type: "Bunny"
+ age: 65
+ size: "Large"
+ }
+ ListElement {
+ name: "Rover"
+ type: "Dog"
+ age: 5
+ size: "Large"
+ }
+ ListElement {
+ name: "Tiny"
+ type: "Elephant"
+ age: 15
+ size: "Large"
+ }
+//![1]
+}
+//![1]
diff --git a/examples/tutorials/dynamicview/dynamicview1/dynamicview.qml b/examples/tutorials/dynamicview/dynamicview1/dynamicview.qml
new file mode 100644
index 0000000000..1a9dd453ce
--- /dev/null
+++ b/examples/tutorials/dynamicview/dynamicview1/dynamicview.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ width: 300; height: 400
+
+//![1]
+ Component {
+ id: dragDelegate
+
+ Rectangle {
+ id: content
+
+ anchors { left: parent.left; right: parent.right }
+ height: column.implicitHeight + 4
+
+ border.width: 1
+ border.color: "lightsteelblue"
+
+ radius: 2
+
+ Column {
+ id: column
+ anchors { fill: parent; margins: 2 }
+
+ Text { text: 'Name: ' + name }
+ Text { text: 'Type: ' + type }
+ Text { text: 'Age: ' + age }
+ Text { text: 'Size: ' + size }
+ }
+ }
+ }
+//![1]
+//![2]
+ ListView {
+ id: view
+
+ anchors { fill: parent; margins: 2 }
+
+ model: PetsModel {}
+ delegate: dragDelegate
+
+ spacing: 4
+ cacheBuffer: 50
+ }
+//![2]
+}
+//![0]
diff --git a/examples/tutorials/dynamicview/dynamicview2/PetsModel.qml b/examples/tutorials/dynamicview/dynamicview2/PetsModel.qml
new file mode 100644
index 0000000000..4f2087d95e
--- /dev/null
+++ b/examples/tutorials/dynamicview/dynamicview2/PetsModel.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+ListModel {
+ ListElement {
+ name: "Polly"
+ type: "Parrot"
+ age: 12
+ size: "Small"
+ }
+ ListElement {
+ name: "Penny"
+ type: "Turtle"
+ age: 4
+ size: "Small"
+ }
+ ListElement {
+ name: "Warren"
+ type: "Rabbit"
+ age: 2
+ size: "Small"
+ }
+ ListElement {
+ name: "Spot"
+ type: "Dog"
+ age: 9
+ size: "Medium"
+ }
+ ListElement {
+ name: "Schrödinger"
+ type: "Cat"
+ age: 2
+ size: "Medium"
+ }
+ ListElement {
+ name: "Joey"
+ type: "Kangaroo"
+ age: 1
+ size: "Medium"
+ }
+ ListElement {
+ name: "Kimba"
+ type: "Bunny"
+ age: 65
+ size: "Large"
+ }
+ ListElement {
+ name: "Rover"
+ type: "Dog"
+ age: 5
+ size: "Large"
+ }
+ ListElement {
+ name: "Tiny"
+ type: "Elephant"
+ age: 15
+ size: "Large"
+ }
+}
diff --git a/examples/tutorials/dynamicview/dynamicview2/dynamicview.qml b/examples/tutorials/dynamicview/dynamicview2/dynamicview.qml
new file mode 100644
index 0000000000..9e654a685c
--- /dev/null
+++ b/examples/tutorials/dynamicview/dynamicview2/dynamicview.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ width: 300; height: 400
+
+//![0]
+ Component {
+ id: dragDelegate
+
+//![1]
+ MouseArea {
+ id: dragArea
+
+ property bool held: false
+
+ anchors { left: parent.left; right: parent.right }
+ height: content.height
+
+ drag.target: held ? content : undefined
+ drag.axis: Drag.YAxis
+
+ onPressAndHold: held = true
+ onReleased: held = false
+
+ Rectangle {
+ id: content
+//![1]
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ verticalCenter: parent.verticalCenter
+ }
+ width: dragArea.width; height: column.implicitHeight + 4
+
+ border.width: 1
+ border.color: "lightsteelblue"
+//![3]
+ color: dragArea.held ? "lightsteelblue" : "white"
+ Behavior on color { ColorAnimation { duration: 100 } }
+//![3]
+ radius: 2
+//![4]
+ states: State {
+ when: dragArea.held
+
+ ParentChange { target: content; parent: root }
+ AnchorChanges {
+ target: content
+ anchors { horizontalCenter: undefined; verticalCenter: undefined }
+ }
+ }
+//![4]
+ Column {
+ id: column
+ anchors { fill: parent; margins: 2 }
+
+ Text { text: 'Name: ' + name }
+ Text { text: 'Type: ' + type }
+ Text { text: 'Age: ' + age }
+ Text { text: 'Size: ' + size }
+ }
+//![2]
+ }
+ }
+//![2]
+ }
+//![0]
+
+ ListView {
+ id: view
+
+ anchors { fill: parent; margins: 2 }
+
+ model: PetsModel {}
+ delegate: dragDelegate
+
+ spacing: 4
+ cacheBuffer: 50
+ }
+}
diff --git a/examples/tutorials/dynamicview/dynamicview3/PetsModel.qml b/examples/tutorials/dynamicview/dynamicview3/PetsModel.qml
new file mode 100644
index 0000000000..4f2087d95e
--- /dev/null
+++ b/examples/tutorials/dynamicview/dynamicview3/PetsModel.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+ListModel {
+ ListElement {
+ name: "Polly"
+ type: "Parrot"
+ age: 12
+ size: "Small"
+ }
+ ListElement {
+ name: "Penny"
+ type: "Turtle"
+ age: 4
+ size: "Small"
+ }
+ ListElement {
+ name: "Warren"
+ type: "Rabbit"
+ age: 2
+ size: "Small"
+ }
+ ListElement {
+ name: "Spot"
+ type: "Dog"
+ age: 9
+ size: "Medium"
+ }
+ ListElement {
+ name: "Schrödinger"
+ type: "Cat"
+ age: 2
+ size: "Medium"
+ }
+ ListElement {
+ name: "Joey"
+ type: "Kangaroo"
+ age: 1
+ size: "Medium"
+ }
+ ListElement {
+ name: "Kimba"
+ type: "Bunny"
+ age: 65
+ size: "Large"
+ }
+ ListElement {
+ name: "Rover"
+ type: "Dog"
+ age: 5
+ size: "Large"
+ }
+ ListElement {
+ name: "Tiny"
+ type: "Elephant"
+ age: 15
+ size: "Large"
+ }
+}
diff --git a/examples/tutorials/dynamicview/dynamicview3/dynamicview.qml b/examples/tutorials/dynamicview/dynamicview3/dynamicview.qml
new file mode 100644
index 0000000000..5a579f78d9
--- /dev/null
+++ b/examples/tutorials/dynamicview/dynamicview3/dynamicview.qml
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+//![0]
+Rectangle {
+ id: root
+
+ width: 300; height: 400
+
+ Component {
+ id: dragDelegate
+
+ MouseArea {
+ id: dragArea
+
+ property bool held: false
+
+ anchors { left: parent.left; right: parent.right }
+ height: content.height
+
+ drag.target: held ? content : undefined
+ drag.axis: Drag.YAxis
+
+ onPressAndHold: held = true
+ onReleased: held = false
+
+ Rectangle {
+ id: content
+//![0]
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ verticalCenter: parent.verticalCenter
+ }
+ width: dragArea.width; height: column.implicitHeight + 4
+
+ border.width: 1
+ border.color: "lightsteelblue"
+
+ color: dragArea.held ? "lightsteelblue" : "white"
+ Behavior on color { ColorAnimation { duration: 100 } }
+
+ radius: 2
+//![1]
+ Drag.active: dragArea.held
+ Drag.source: dragArea
+ Drag.hotSpot.x: width / 2
+ Drag.hotSpot.y: height / 2
+//![1]
+ states: State {
+ when: dragArea.held
+
+ ParentChange { target: content; parent: root }
+ AnchorChanges {
+ target: content
+ anchors { horizontalCenter: undefined; verticalCenter: undefined }
+ }
+ }
+
+ Column {
+ id: column
+ anchors { fill: parent; margins: 2 }
+
+ Text { text: 'Name: ' + name }
+ Text { text: 'Type: ' + type }
+ Text { text: 'Age: ' + age }
+ Text { text: 'Size: ' + size }
+ }
+//![2]
+ }
+//![3]
+ DropArea {
+ anchors { fill: parent; margins: 10 }
+
+ onEntered: {
+ visualModel.items.move(
+ drag.source.VisualDataModel.itemsIndex,
+ dragArea.VisualDataModel.itemsIndex)
+ }
+ }
+//![3]
+ }
+ }
+//![2]
+//![4]
+ VisualDataModel {
+ id: visualModel
+
+ model: PetsModel {}
+ delegate: dragDelegate
+ }
+
+ ListView {
+ id: view
+
+ anchors { fill: parent; margins: 2 }
+
+ model: visualModel
+
+ spacing: 4
+ cacheBuffer: 50
+ }
+//![4]
+//![5]
+}
+//![5]
diff --git a/examples/tutorials/dynamicview/dynamicview4/ListSelector.qml b/examples/tutorials/dynamicview/dynamicview4/ListSelector.qml
new file mode 100644
index 0000000000..c6b8287beb
--- /dev/null
+++ b/examples/tutorials/dynamicview/dynamicview4/ListSelector.qml
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: selector
+
+ property alias list: view.model
+ property alias selectedIndex: view.currentIndex
+ property alias label: labelText.text
+ property bool expanded
+
+ width: 100; height: labelText.implicitHeight + 26
+
+ Rectangle {
+ anchors { left: parent.left; right: parent.right; bottom: parent.bottom; }
+
+ height: labelText.implicitHeight + 4 + (expanded ? 20 * view.count : 20)
+ Behavior on height { NumberAnimation { duration: 300 } }
+
+ radius: 2
+ border.width: 1
+ border.color: "yellow"
+ color: "yellow"
+
+ MouseArea {
+ anchors.fill: parent
+
+ onClicked: selector.expanded = !selector.expanded
+
+ Text {
+ id: labelText
+ anchors { left: parent.left; top: parent.top; margins: 2 }
+ }
+
+ Rectangle {
+ anchors {
+ left: parent.left; top: labelText.bottom;
+ right: parent.right; bottom: parent.bottom;
+ margins: 2
+ leftMargin: 10
+ }
+
+ radius: 2
+ color: "white"
+
+ ListView {
+ id: view
+
+ anchors.fill: parent
+
+ clip: true
+
+ delegate: Text {
+ anchors { left: parent.left; right: parent.right }
+ height: 20
+
+ verticalAlignment: Text.AlignVCenter
+
+ text: modelData
+
+ MouseArea {
+ anchors.fill: parent
+
+ onClicked: {
+ view.currentIndex = index
+ selector.expanded = !selector.expanded
+ }
+ }
+ }
+ highlight: Rectangle {
+ anchors { left: parent.left; right: parent.right }
+ height: 20
+ radius: 2
+
+ color: "yellow"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/tutorials/dynamicview/dynamicview4/PetsModel.qml b/examples/tutorials/dynamicview/dynamicview4/PetsModel.qml
new file mode 100644
index 0000000000..4f2087d95e
--- /dev/null
+++ b/examples/tutorials/dynamicview/dynamicview4/PetsModel.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+ListModel {
+ ListElement {
+ name: "Polly"
+ type: "Parrot"
+ age: 12
+ size: "Small"
+ }
+ ListElement {
+ name: "Penny"
+ type: "Turtle"
+ age: 4
+ size: "Small"
+ }
+ ListElement {
+ name: "Warren"
+ type: "Rabbit"
+ age: 2
+ size: "Small"
+ }
+ ListElement {
+ name: "Spot"
+ type: "Dog"
+ age: 9
+ size: "Medium"
+ }
+ ListElement {
+ name: "Schrödinger"
+ type: "Cat"
+ age: 2
+ size: "Medium"
+ }
+ ListElement {
+ name: "Joey"
+ type: "Kangaroo"
+ age: 1
+ size: "Medium"
+ }
+ ListElement {
+ name: "Kimba"
+ type: "Bunny"
+ age: 65
+ size: "Large"
+ }
+ ListElement {
+ name: "Rover"
+ type: "Dog"
+ age: 5
+ size: "Large"
+ }
+ ListElement {
+ name: "Tiny"
+ type: "Elephant"
+ age: 15
+ size: "Large"
+ }
+}
diff --git a/examples/tutorials/dynamicview/dynamicview4/dynamicview.qml b/examples/tutorials/dynamicview/dynamicview4/dynamicview.qml
new file mode 100644
index 0000000000..9bd4e0c438
--- /dev/null
+++ b/examples/tutorials/dynamicview/dynamicview4/dynamicview.qml
@@ -0,0 +1,219 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+
+ width: 300; height: 400
+
+ Component {
+ id: dragDelegate
+
+ MouseArea {
+ id: dragArea
+
+ property bool held: false
+
+ anchors { left: parent.left; right: parent.right }
+ height: content.height
+
+ enabled: visualModel.sortOrder == visualModel.lessThan.length
+
+ drag.target: held ? content : undefined
+ drag.axis: Drag.YAxis
+
+ onPressAndHold: held = true
+ onReleased: held = false
+
+ Rectangle {
+ id: content
+
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ verticalCenter: parent.verticalCenter
+ }
+ width: dragArea.width; height: column.implicitHeight + 4
+
+ border.width: 1
+ border.color: "lightsteelblue"
+
+ color: dragArea.held ? "lightsteelblue" : "white"
+ Behavior on color { ColorAnimation { duration: 100 } }
+
+ radius: 2
+
+ Drag.active: dragArea.held
+ Drag.source: dragArea
+ Drag.hotSpot.x: width / 2
+ Drag.hotSpot.y: height / 2
+
+ states: State {
+ when: dragArea.held
+
+ ParentChange { target: content; parent: root }
+ AnchorChanges {
+ target: content
+ anchors { horizontalCenter: undefined; verticalCenter: undefined }
+ }
+ }
+
+ Column {
+ id: column
+ anchors { fill: parent; margins: 2 }
+
+ Text { text: 'Name: ' + name }
+ Text { text: 'Type: ' + type }
+ Text { text: 'Age: ' + age }
+ Text { text: 'Size: ' + size }
+ }
+ }
+
+ DropArea {
+ anchors { fill: parent; margins: 10 }
+
+ onEntered: {
+ visualModel.items.move(
+ drag.source.VisualDataModel.itemsIndex,
+ dragArea.VisualDataModel.itemsIndex)
+ }
+ }
+ }
+ }
+//![0]
+ VisualDataModel {
+ id: visualModel
+//![4]
+ property var lessThan: [
+ function(left, right) { return left.name < right.name },
+ function(left, right) { return left.type < right.type },
+ function(left, right) { return left.age < right.age },
+ function(left, right) {
+ if (left.size == "Small")
+ return true
+ else if (right.size == "Small")
+ return false
+ else if (left.size == "Medium")
+ return true
+ else
+ return false
+ }
+ ]
+//![4]
+//![6]
+
+ property int sortOrder: orderSelector.selectedIndex
+ onSortOrderChanged: items.setGroups(0, items.count, "unsorted")
+
+//![6]
+//![3]
+ function insertPosition(lessThan, item) {
+ var lower = 0
+ var upper = items.count
+ while (lower < upper) {
+ var middle = Math.floor(lower + (upper - lower) / 2)
+ var result = lessThan(item.model, items.get(middle).model);
+ if (result) {
+ upper = middle
+ } else {
+ lower = middle + 1
+ }
+ }
+ return lower
+ }
+
+ function sort(lessThan) {
+ while (unsortedItems.count > 0) {
+ var item = unsortedItems.get(0)
+ var index = insertPosition(lessThan, item)
+
+ item.groups = "items"
+ items.move(item.itemsIndex, index)
+ }
+ }
+//![3]
+
+//![1]
+ items.includeByDefault: false
+//![5]
+ groups: VisualDataGroup {
+ id: unsortedItems
+ name: "unsorted"
+
+ includeByDefault: true
+//![1]
+ onChanged: {
+ if (visualModel.sortOrder == visualModel.lessThan.length)
+ setGroups(0, count, "items")
+ else
+ visualModel.sort(visualModel.lessThan[visualModel.sortOrder])
+ }
+//![2]
+ }
+//![2]
+//![5]
+ model: PetsModel {}
+ delegate: dragDelegate
+ }
+//![0]
+ ListView {
+ id: view
+
+ anchors {
+ left: parent.left; top: parent.top; right: parent.right; bottom: orderSelector.top;
+ margins: 2
+ }
+
+ model: visualModel
+
+ spacing: 4
+ cacheBuffer: 50
+ }
+
+ ListSelector {
+ id: orderSelector
+
+ anchors { left: parent.left; right: parent.right; bottom: parent.bottom; margins: 2 }
+
+ label: "Sort By"
+ list: [ "Name", "Type", "Age", "Size", "Custom" ]
+ }
+}
diff --git a/examples/tutorials/extending/chapter1-basics/app.qml b/examples/tutorials/extending/chapter1-basics/app.qml
new file mode 100644
index 0000000000..6f0c1d3a23
--- /dev/null
+++ b/examples/tutorials/extending/chapter1-basics/app.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Charts 1.0
+import QtQuick 2.0
+
+Item {
+ width: 300; height: 200
+
+ PieChart {
+ id: aPieChart
+ anchors.centerIn: parent
+ width: 100; height: 100
+ name: "A simple pie chart"
+ color: "red"
+ }
+
+ Text {
+ anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 }
+ text: aPieChart.name
+ }
+}
+//![0]
diff --git a/examples/tutorials/extending/chapter1-basics/chapter1-basics.pro b/examples/tutorials/extending/chapter1-basics/chapter1-basics.pro
new file mode 100644
index 0000000000..8ed66f8b66
--- /dev/null
+++ b/examples/tutorials/extending/chapter1-basics/chapter1-basics.pro
@@ -0,0 +1,5 @@
+QT += qml quick
+
+HEADERS += piechart.h
+SOURCES += piechart.cpp \
+ main.cpp
diff --git a/examples/tutorials/extending/chapter1-basics/main.cpp b/examples/tutorials/extending/chapter1-basics/main.cpp
new file mode 100644
index 0000000000..ed9e412bd6
--- /dev/null
+++ b/examples/tutorials/extending/chapter1-basics/main.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+#include "piechart.h"
+#include <QtQuick/QQuickView>
+#include <QGuiApplication>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
+
+ QQuickView view;
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.setSource(QUrl::fromLocalFile("app.qml"));
+ view.show();
+ return app.exec();
+}
+//![0]
diff --git a/examples/tutorials/extending/chapter1-basics/piechart.cpp b/examples/tutorials/extending/chapter1-basics/piechart.cpp
new file mode 100644
index 0000000000..bc81d6a3a0
--- /dev/null
+++ b/examples/tutorials/extending/chapter1-basics/piechart.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "piechart.h"
+#include <QPainter>
+
+//![0]
+PieChart::PieChart(QQuickItem *parent)
+ : QQuickPaintedItem(parent)
+{
+}
+//![0]
+
+QString PieChart::name() const
+{
+ return m_name;
+}
+
+void PieChart::setName(const QString &name)
+{
+ m_name = name;
+}
+
+QColor PieChart::color() const
+{
+ return m_color;
+}
+
+void PieChart::setColor(const QColor &color)
+{
+ m_color = color;
+}
+
+//![1]
+void PieChart::paint(QPainter *painter)
+{
+ QPen pen(m_color, 2);
+ painter->setPen(pen);
+ painter->setRenderHints(QPainter::HighQualityAntialiasing, true);
+ painter->drawPie(boundingRect(), 90 * 16, 290 * 16);
+}
+//![1]
+
diff --git a/examples/tutorials/extending/chapter1-basics/piechart.h b/examples/tutorials/extending/chapter1-basics/piechart.h
new file mode 100644
index 0000000000..71a8786e7d
--- /dev/null
+++ b/examples/tutorials/extending/chapter1-basics/piechart.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef PIECHART_H
+#define PIECHART_H
+
+//![0]
+#include <QtQuick/QQuickPaintedItem>
+#include <QColor>
+
+class PieChart : public QQuickPaintedItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(QColor color READ color WRITE setColor)
+
+public:
+ PieChart(QQuickItem *parent = 0);
+
+ QString name() const;
+ void setName(const QString &name);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ void paint(QPainter *painter);
+
+private:
+ QString m_name;
+ QColor m_color;
+};
+//![0]
+
+#endif
+
diff --git a/examples/tutorials/extending/chapter2-methods/app.qml b/examples/tutorials/extending/chapter2-methods/app.qml
new file mode 100644
index 0000000000..eee0933734
--- /dev/null
+++ b/examples/tutorials/extending/chapter2-methods/app.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Charts 1.0
+import QtQuick 2.0
+
+Item {
+ width: 300; height: 200
+
+ PieChart {
+ id: aPieChart
+ anchors.centerIn: parent
+ width: 100; height: 100
+ color: "red"
+
+ onChartCleared: console.log("The chart has been cleared")
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: aPieChart.clearChart()
+ }
+
+ Text {
+ anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 }
+ text: "Click anywhere to clear the chart"
+ }
+}
+//![0]
diff --git a/examples/tutorials/extending/chapter2-methods/chapter2-methods.pro b/examples/tutorials/extending/chapter2-methods/chapter2-methods.pro
new file mode 100644
index 0000000000..8ed66f8b66
--- /dev/null
+++ b/examples/tutorials/extending/chapter2-methods/chapter2-methods.pro
@@ -0,0 +1,5 @@
+QT += qml quick
+
+HEADERS += piechart.h
+SOURCES += piechart.cpp \
+ main.cpp
diff --git a/examples/tutorials/extending/chapter2-methods/main.cpp b/examples/tutorials/extending/chapter2-methods/main.cpp
new file mode 100644
index 0000000000..ed9e412bd6
--- /dev/null
+++ b/examples/tutorials/extending/chapter2-methods/main.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+#include "piechart.h"
+#include <QtQuick/QQuickView>
+#include <QGuiApplication>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
+
+ QQuickView view;
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.setSource(QUrl::fromLocalFile("app.qml"));
+ view.show();
+ return app.exec();
+}
+//![0]
diff --git a/examples/tutorials/extending/chapter2-methods/piechart.cpp b/examples/tutorials/extending/chapter2-methods/piechart.cpp
new file mode 100644
index 0000000000..71be74e943
--- /dev/null
+++ b/examples/tutorials/extending/chapter2-methods/piechart.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "piechart.h"
+#include <QPainter>
+
+PieChart::PieChart(QQuickItem *parent)
+ : QQuickPaintedItem(parent)
+{
+}
+
+QString PieChart::name() const
+{
+ return m_name;
+}
+
+void PieChart::setName(const QString &name)
+{
+ m_name = name;
+}
+
+QColor PieChart::color() const
+{
+ return m_color;
+}
+
+void PieChart::setColor(const QColor &color)
+{
+ m_color = color;
+}
+
+void PieChart::paint(QPainter *painter)
+{
+ QPen pen(m_color, 2);
+ painter->setPen(pen);
+ painter->setRenderHints(QPainter::HighQualityAntialiasing, true);
+ painter->drawPie(boundingRect(), 90 * 16, 290 * 16);
+}
+
+//![0]
+void PieChart::clearChart()
+{
+ setColor(QColor(Qt::transparent));
+ update();
+
+ emit chartCleared();
+}
+//![0]
diff --git a/examples/tutorials/extending/chapter2-methods/piechart.h b/examples/tutorials/extending/chapter2-methods/piechart.h
new file mode 100644
index 0000000000..7650d6e8d7
--- /dev/null
+++ b/examples/tutorials/extending/chapter2-methods/piechart.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef PIECHART_H
+#define PIECHART_H
+
+#include <QtQuick/QQuickPaintedItem>
+#include <QColor>
+
+//![0]
+class PieChart : public QQuickPaintedItem
+{
+//![0]
+ Q_OBJECT
+ Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(QColor color READ color WRITE setColor)
+
+//![1]
+public:
+//![1]
+
+ PieChart(QQuickItem *parent = 0);
+
+ QString name() const;
+ void setName(const QString &name);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ void paint(QPainter *painter);
+
+//![2]
+ Q_INVOKABLE void clearChart();
+
+signals:
+ void chartCleared();
+//![2]
+
+private:
+ QString m_name;
+ QColor m_color;
+
+//![3]
+};
+//![3]
+
+#endif
+
diff --git a/examples/tutorials/extending/chapter3-bindings/app.qml b/examples/tutorials/extending/chapter3-bindings/app.qml
new file mode 100644
index 0000000000..4ad929132c
--- /dev/null
+++ b/examples/tutorials/extending/chapter3-bindings/app.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Charts 1.0
+import QtQuick 2.0
+
+Item {
+ width: 300; height: 200
+
+ Row {
+ anchors.centerIn: parent
+ spacing: 20
+
+ PieChart {
+ id: chartA
+ width: 100; height: 100
+ color: "red"
+ }
+
+ PieChart {
+ id: chartB
+ width: 100; height: 100
+ color: chartA.color
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { chartA.color = "blue" }
+ }
+
+ Text {
+ anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 }
+ text: "Click anywhere to change the chart color"
+ }
+}
+//![0]
diff --git a/examples/tutorials/extending/chapter3-bindings/chapter3-bindings.pro b/examples/tutorials/extending/chapter3-bindings/chapter3-bindings.pro
new file mode 100644
index 0000000000..8ed66f8b66
--- /dev/null
+++ b/examples/tutorials/extending/chapter3-bindings/chapter3-bindings.pro
@@ -0,0 +1,5 @@
+QT += qml quick
+
+HEADERS += piechart.h
+SOURCES += piechart.cpp \
+ main.cpp
diff --git a/examples/tutorials/extending/chapter3-bindings/main.cpp b/examples/tutorials/extending/chapter3-bindings/main.cpp
new file mode 100644
index 0000000000..ed9e412bd6
--- /dev/null
+++ b/examples/tutorials/extending/chapter3-bindings/main.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+#include "piechart.h"
+#include <QtQuick/QQuickView>
+#include <QGuiApplication>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
+
+ QQuickView view;
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.setSource(QUrl::fromLocalFile("app.qml"));
+ view.show();
+ return app.exec();
+}
+//![0]
diff --git a/examples/tutorials/extending/chapter3-bindings/piechart.cpp b/examples/tutorials/extending/chapter3-bindings/piechart.cpp
new file mode 100644
index 0000000000..2a392125da
--- /dev/null
+++ b/examples/tutorials/extending/chapter3-bindings/piechart.cpp
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "piechart.h"
+#include <QPainter>
+
+PieChart::PieChart(QQuickItem *parent)
+ : QQuickPaintedItem(parent)
+{
+}
+
+QString PieChart::name() const
+{
+ return m_name;
+}
+
+void PieChart::setName(const QString &name)
+{
+ m_name = name;
+}
+
+QColor PieChart::color() const
+{
+ return m_color;
+}
+
+//![0]
+void PieChart::setColor(const QColor &color)
+{
+ if (color != m_color) {
+ m_color = color;
+ update(); // repaint with the new color
+ emit colorChanged();
+ }
+}
+//![0]
+
+void PieChart::paint(QPainter *painter)
+{
+ QPen pen(m_color, 2);
+ painter->setPen(pen);
+ painter->setRenderHints(QPainter::HighQualityAntialiasing, true);
+ painter->drawPie(boundingRect(), 90 * 16, 290 * 16);
+}
+
+void PieChart::clearChart()
+{
+ setColor(QColor(Qt::transparent));
+ update();
+}
diff --git a/examples/tutorials/extending/chapter3-bindings/piechart.h b/examples/tutorials/extending/chapter3-bindings/piechart.h
new file mode 100644
index 0000000000..77075b5727
--- /dev/null
+++ b/examples/tutorials/extending/chapter3-bindings/piechart.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef PIECHART_H
+#define PIECHART_H
+
+#include <QColor>
+#include <QtQuick/QQuickPaintedItem>
+
+//![0]
+class PieChart : public QQuickPaintedItem
+{
+//![0]
+ Q_OBJECT
+ Q_PROPERTY(QString name READ name WRITE setName)
+
+//![1]
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+public:
+//![1]
+
+ PieChart(QQuickItem *parent = 0);
+
+ QString name() const;
+ void setName(const QString &name);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ void paint(QPainter *painter);
+
+ Q_INVOKABLE void clearChart();
+
+//![2]
+signals:
+ void colorChanged();
+//![2]
+
+private:
+ QString m_name;
+ QColor m_color;
+
+//![3]
+};
+//![3]
+
+#endif
+
diff --git a/examples/tutorials/extending/chapter4-customPropertyTypes/app.qml b/examples/tutorials/extending/chapter4-customPropertyTypes/app.qml
new file mode 100644
index 0000000000..06490773f4
--- /dev/null
+++ b/examples/tutorials/extending/chapter4-customPropertyTypes/app.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Charts 1.0
+import QtQuick 2.0
+
+Item {
+ width: 300; height: 200
+
+ PieChart {
+ id: chart
+ anchors.centerIn: parent
+ width: 100; height: 100
+
+ pieSlice: PieSlice {
+ anchors.fill: parent
+ color: "red"
+ }
+ }
+
+ Component.onCompleted: console.log("The pie is colored " + chart.pieSlice.color)
+}
+//![0]
diff --git a/examples/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro b/examples/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro
new file mode 100644
index 0000000000..23eb222ea3
--- /dev/null
+++ b/examples/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro
@@ -0,0 +1,7 @@
+QT += qml quick
+
+HEADERS += piechart.h \
+ pieslice.h
+SOURCES += piechart.cpp \
+ pieslice.cpp \
+ main.cpp
diff --git a/examples/tutorials/extending/chapter4-customPropertyTypes/main.cpp b/examples/tutorials/extending/chapter4-customPropertyTypes/main.cpp
new file mode 100644
index 0000000000..537ea766fc
--- /dev/null
+++ b/examples/tutorials/extending/chapter4-customPropertyTypes/main.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "piechart.h"
+#include "pieslice.h"
+
+#include <QtQuick/QQuickView>
+#include <QGuiApplication>
+
+//![0]
+int main(int argc, char *argv[])
+{
+//![0]
+ QGuiApplication app(argc, argv);
+
+ qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
+
+//![1]
+ qmlRegisterType<PieSlice>("Charts", 1, 0, "PieSlice");
+//![1]
+
+ QQuickView view;
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.setSource(QUrl::fromLocalFile("app.qml"));
+ view.show();
+ return app.exec();
+
+//![2]
+}
+//![2]
diff --git a/examples/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp b/examples/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp
new file mode 100644
index 0000000000..3cf9bdc00c
--- /dev/null
+++ b/examples/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "piechart.h"
+#include "pieslice.h"
+
+PieChart::PieChart(QQuickItem *parent)
+ : QQuickItem(parent)
+{
+}
+
+QString PieChart::name() const
+{
+ return m_name;
+}
+
+void PieChart::setName(const QString &name)
+{
+ m_name = name;
+}
+
+PieSlice *PieChart::pieSlice() const
+{
+ return m_pieSlice;
+}
+
+//![0]
+void PieChart::setPieSlice(PieSlice *pieSlice)
+{
+ m_pieSlice = pieSlice;
+ pieSlice->setParentItem(this);
+}
+//![0]
+
diff --git a/examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h b/examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h
new file mode 100644
index 0000000000..b89db5a2b1
--- /dev/null
+++ b/examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef PIECHART_H
+#define PIECHART_H
+
+#include <QtQuick/QQuickItem>
+
+class PieSlice;
+
+//![0]
+class PieChart : public QQuickItem
+{
+ Q_OBJECT
+ Q_PROPERTY(PieSlice* pieSlice READ pieSlice WRITE setPieSlice)
+//![0]
+ Q_PROPERTY(QString name READ name WRITE setName)
+
+//![1]
+public:
+//![1]
+
+ PieChart(QQuickItem *parent = 0);
+
+ QString name() const;
+ void setName(const QString &name);
+
+//![2]
+ PieSlice *pieSlice() const;
+ void setPieSlice(PieSlice *pieSlice);
+//![2]
+
+private:
+ QString m_name;
+ PieSlice *m_pieSlice;
+
+//![3]
+};
+//![3]
+
+#endif
+
diff --git a/examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp b/examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp
new file mode 100644
index 0000000000..654a46fc8d
--- /dev/null
+++ b/examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "pieslice.h"
+
+#include <QPainter>
+
+PieSlice::PieSlice(QQuickItem *parent)
+ : QQuickPaintedItem(parent)
+{
+}
+
+QColor PieSlice::color() const
+{
+ return m_color;
+}
+
+void PieSlice::setColor(const QColor &color)
+{
+ m_color = color;
+}
+
+void PieSlice::paint(QPainter *painter)
+{
+ QPen pen(m_color, 2);
+ painter->setPen(pen);
+ painter->setRenderHints(QPainter::HighQualityAntialiasing, true);
+ painter->drawPie(boundingRect(), 90 * 16, 290 * 16);
+}
+
diff --git a/examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.h b/examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.h
new file mode 100644
index 0000000000..8fc445d471
--- /dev/null
+++ b/examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef PIESLICE_H
+#define PIESLICE_H
+
+#include <QtQuick/QQuickPaintedItem>
+#include <QColor>
+
+//![0]
+class PieSlice : public QQuickPaintedItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor color READ color WRITE setColor)
+
+public:
+ PieSlice(QQuickItem *parent = 0);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ void paint(QPainter *painter);
+
+private:
+ QColor m_color;
+};
+//![0]
+
+#endif
+
diff --git a/examples/tutorials/extending/chapter5-listproperties/app.qml b/examples/tutorials/extending/chapter5-listproperties/app.qml
new file mode 100644
index 0000000000..37b0626948
--- /dev/null
+++ b/examples/tutorials/extending/chapter5-listproperties/app.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+//![0]
+import Charts 1.0
+import QtQuick 2.0
+
+Item {
+ width: 300; height: 200
+
+ PieChart {
+ anchors.centerIn: parent
+ width: 100; height: 100
+
+ slices: [
+ PieSlice {
+ anchors.fill: parent
+ color: "red"
+ fromAngle: 0; angleSpan: 110
+ },
+ PieSlice {
+ anchors.fill: parent
+ color: "black"
+ fromAngle: 110; angleSpan: 50
+ },
+ PieSlice {
+ anchors.fill: parent
+ color: "blue"
+ fromAngle: 160; angleSpan: 100
+ }
+ ]
+ }
+}
+//![0]
diff --git a/examples/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro b/examples/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro
new file mode 100644
index 0000000000..23eb222ea3
--- /dev/null
+++ b/examples/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro
@@ -0,0 +1,7 @@
+QT += qml quick
+
+HEADERS += piechart.h \
+ pieslice.h
+SOURCES += piechart.cpp \
+ pieslice.cpp \
+ main.cpp
diff --git a/examples/tutorials/extending/chapter5-listproperties/main.cpp b/examples/tutorials/extending/chapter5-listproperties/main.cpp
new file mode 100644
index 0000000000..59587733eb
--- /dev/null
+++ b/examples/tutorials/extending/chapter5-listproperties/main.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "piechart.h"
+#include "pieslice.h"
+
+#include <QtQuick/QQuickView>
+#include <QGuiApplication>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
+ qmlRegisterType<PieSlice>("Charts", 1, 0, "PieSlice");
+
+ QQuickView view;
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.setSource(QUrl::fromLocalFile("app.qml"));
+ view.show();
+ return app.exec();
+}
diff --git a/examples/tutorials/extending/chapter5-listproperties/piechart.cpp b/examples/tutorials/extending/chapter5-listproperties/piechart.cpp
new file mode 100644
index 0000000000..910916508e
--- /dev/null
+++ b/examples/tutorials/extending/chapter5-listproperties/piechart.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "piechart.h"
+#include "pieslice.h"
+
+PieChart::PieChart(QQuickItem *parent)
+ : QQuickItem(parent)
+{
+}
+
+QString PieChart::name() const
+{
+ return m_name;
+}
+
+void PieChart::setName(const QString &name)
+{
+ m_name = name;
+}
+
+//![0]
+QQmlListProperty<PieSlice> PieChart::slices()
+{
+ return QQmlListProperty<PieSlice>(this, 0, &PieChart::append_slice);
+}
+
+void PieChart::append_slice(QQmlListProperty<PieSlice> *list, PieSlice *slice)
+{
+ PieChart *chart = qobject_cast<PieChart *>(list->object);
+ if (chart) {
+ slice->setParentItem(chart);
+ chart->m_slices.append(slice);
+ }
+}
+//![0]
diff --git a/examples/tutorials/extending/chapter5-listproperties/piechart.h b/examples/tutorials/extending/chapter5-listproperties/piechart.h
new file mode 100644
index 0000000000..6c17bc1258
--- /dev/null
+++ b/examples/tutorials/extending/chapter5-listproperties/piechart.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef PIECHART_H
+#define PIECHART_H
+
+#include <QtQuick/QQuickItem>
+
+class PieSlice;
+
+//![0]
+class PieChart : public QQuickItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices)
+//![0]
+ Q_PROPERTY(QString name READ name WRITE setName)
+
+//![1]
+public:
+//![1]
+ PieChart(QQuickItem *parent = 0);
+
+ QString name() const;
+ void setName(const QString &name);
+
+//![2]
+ QQmlListProperty<PieSlice> slices();
+
+private:
+ static void append_slice(QQmlListProperty<PieSlice> *list, PieSlice *slice);
+
+ QString m_name;
+ QList<PieSlice *> m_slices;
+};
+//![2]
+
+#endif
+
diff --git a/examples/tutorials/extending/chapter5-listproperties/pieslice.cpp b/examples/tutorials/extending/chapter5-listproperties/pieslice.cpp
new file mode 100644
index 0000000000..5bca2d58d8
--- /dev/null
+++ b/examples/tutorials/extending/chapter5-listproperties/pieslice.cpp
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "pieslice.h"
+
+#include <QPainter>
+
+PieSlice::PieSlice(QQuickItem *parent)
+ : QQuickPaintedItem(parent)
+{
+}
+
+QColor PieSlice::color() const
+{
+ return m_color;
+}
+
+void PieSlice::setColor(const QColor &color)
+{
+ m_color = color;
+}
+
+int PieSlice::fromAngle() const
+{
+ return m_fromAngle;
+}
+
+void PieSlice::setFromAngle(int angle)
+{
+ m_fromAngle = angle;
+}
+
+int PieSlice::angleSpan() const
+{
+ return m_angleSpan;
+}
+
+void PieSlice::setAngleSpan(int angle)
+{
+ m_angleSpan = angle;
+}
+
+void PieSlice::paint(QPainter *painter)
+{
+ QPen pen(m_color, 2);
+ painter->setPen(pen);
+ painter->setRenderHints(QPainter::HighQualityAntialiasing, true);
+ painter->drawPie(boundingRect(), m_fromAngle * 16, m_angleSpan * 16);
+}
+
diff --git a/examples/tutorials/extending/chapter5-listproperties/pieslice.h b/examples/tutorials/extending/chapter5-listproperties/pieslice.h
new file mode 100644
index 0000000000..f6497fcbae
--- /dev/null
+++ b/examples/tutorials/extending/chapter5-listproperties/pieslice.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef PIESLICE_H
+#define PIESLICE_H
+
+#include <QtQuick/QQuickPaintedItem>
+#include <QColor>
+
+//![0]
+class PieSlice : public QQuickPaintedItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor color READ color WRITE setColor)
+ Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle)
+ Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan)
+//![0]
+
+public:
+ PieSlice(QQuickItem *parent = 0);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ int fromAngle() const;
+ void setFromAngle(int angle);
+
+ int angleSpan() const;
+ void setAngleSpan(int span);
+
+ void paint(QPainter *painter);
+
+private:
+ QColor m_color;
+ int m_fromAngle;
+ int m_angleSpan;
+};
+
+#endif
+
diff --git a/examples/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir b/examples/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir
new file mode 100644
index 0000000000..72650d8243
--- /dev/null
+++ b/examples/tutorials/extending/chapter6-plugins/ChartsPlugin/qmldir
@@ -0,0 +1 @@
+plugin chartsplugin \ No newline at end of file
diff --git a/examples/tutorials/extending/chapter6-plugins/app.qml b/examples/tutorials/extending/chapter6-plugins/app.qml
new file mode 100644
index 0000000000..b6eac44e27
--- /dev/null
+++ b/examples/tutorials/extending/chapter6-plugins/app.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import QtQuick 2.0
+import "ChartsPlugin" 1.0
+
+Item {
+ width: 300; height: 200
+
+ PieChart {
+ anchors.centerIn: parent
+ width: 100; height: 100
+
+ slices: [
+ PieSlice {
+ anchors.fill: parent
+ color: "red"
+ fromAngle: 0; angleSpan: 110
+ },
+ PieSlice {
+ anchors.fill: parent
+ color: "black"
+ fromAngle: 110; angleSpan: 50
+ },
+ PieSlice {
+ anchors.fill: parent
+ color: "blue"
+ fromAngle: 160; angleSpan: 100
+ }
+ ]
+ }
+}
+
diff --git a/examples/tutorials/extending/chapter6-plugins/chapter6-plugins.pro b/examples/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
new file mode 100644
index 0000000000..75f88b2eaa
--- /dev/null
+++ b/examples/tutorials/extending/chapter6-plugins/chapter6-plugins.pro
@@ -0,0 +1,18 @@
+TEMPLATE = lib
+CONFIG += qt plugin
+QT += qml quick
+
+DESTDIR = ChartsPlugin
+TARGET = chartsplugin
+
+OBJECTS_DIR = tmp
+MOC_DIR = tmp
+
+HEADERS += piechart.h \
+ pieslice.h \
+ chartsplugin.h
+
+SOURCES += piechart.cpp \
+ pieslice.cpp \
+ chartsplugin.cpp
+
diff --git a/examples/tutorials/extending/chapter6-plugins/chartsplugin.cpp b/examples/tutorials/extending/chapter6-plugins/chartsplugin.cpp
new file mode 100644
index 0000000000..0cead527b8
--- /dev/null
+++ b/examples/tutorials/extending/chapter6-plugins/chartsplugin.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "chartsplugin.h"
+//![0]
+#include "piechart.h"
+#include "pieslice.h"
+#include <qqml.h>
+
+void ChartsPlugin::registerTypes(const char *uri)
+{
+ qmlRegisterType<PieChart>(uri, 1, 0, "PieChart");
+ qmlRegisterType<PieSlice>(uri, 1, 0, "PieSlice");
+}
+
+//![0]
+
diff --git a/examples/tutorials/extending/chapter6-plugins/chartsplugin.h b/examples/tutorials/extending/chapter6-plugins/chartsplugin.h
new file mode 100644
index 0000000000..4db1b01987
--- /dev/null
+++ b/examples/tutorials/extending/chapter6-plugins/chartsplugin.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef CHARTSPLUGIN_H
+#define CHARTSPLUGIN_H
+
+//![0]
+#include <QQmlExtensionPlugin>
+
+class ChartsPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" FILE "chartsplugin.json")
+
+public:
+ void registerTypes(const char *uri);
+};
+//![0]
+
+#endif
+
diff --git a/examples/tutorials/extending/chapter6-plugins/chartsplugin.json b/examples/tutorials/extending/chapter6-plugins/chartsplugin.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/examples/tutorials/extending/chapter6-plugins/chartsplugin.json
@@ -0,0 +1 @@
+{}
diff --git a/examples/tutorials/extending/chapter6-plugins/piechart.cpp b/examples/tutorials/extending/chapter6-plugins/piechart.cpp
new file mode 100644
index 0000000000..b188e39d81
--- /dev/null
+++ b/examples/tutorials/extending/chapter6-plugins/piechart.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "piechart.h"
+#include "pieslice.h"
+
+PieChart::PieChart(QQuickItem *parent)
+ : QQuickItem(parent)
+{
+}
+
+QString PieChart::name() const
+{
+ return m_name;
+}
+
+void PieChart::setName(const QString &name)
+{
+ m_name = name;
+}
+
+QQmlListProperty<PieSlice> PieChart::slices()
+{
+ return QQmlListProperty<PieSlice>(this, 0, &PieChart::append_slice);
+}
+
+void PieChart::append_slice(QQmlListProperty<PieSlice> *list, PieSlice *slice)
+{
+ PieChart *chart = qobject_cast<PieChart *>(list->object);
+ if (chart) {
+ slice->setParentItem(chart);
+ chart->m_slices.append(slice);
+ }
+}
+
diff --git a/examples/tutorials/extending/chapter6-plugins/piechart.h b/examples/tutorials/extending/chapter6-plugins/piechart.h
new file mode 100644
index 0000000000..2ee8108784
--- /dev/null
+++ b/examples/tutorials/extending/chapter6-plugins/piechart.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef PIECHART_H
+#define PIECHART_H
+
+#include <QtQuick/QQuickItem>
+
+class PieSlice;
+
+class PieChart : public QQuickItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices)
+ Q_PROPERTY(QString name READ name WRITE setName)
+
+public:
+ PieChart(QQuickItem *parent = 0);
+
+ QString name() const;
+ void setName(const QString &name);
+
+ QQmlListProperty<PieSlice> slices();
+
+private:
+ static void append_slice(QQmlListProperty<PieSlice> *list, PieSlice *slice);
+
+ QString m_name;
+ QList<PieSlice *> m_slices;
+};
+
+#endif
+
diff --git a/examples/tutorials/extending/chapter6-plugins/pieslice.cpp b/examples/tutorials/extending/chapter6-plugins/pieslice.cpp
new file mode 100644
index 0000000000..5bca2d58d8
--- /dev/null
+++ b/examples/tutorials/extending/chapter6-plugins/pieslice.cpp
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "pieslice.h"
+
+#include <QPainter>
+
+PieSlice::PieSlice(QQuickItem *parent)
+ : QQuickPaintedItem(parent)
+{
+}
+
+QColor PieSlice::color() const
+{
+ return m_color;
+}
+
+void PieSlice::setColor(const QColor &color)
+{
+ m_color = color;
+}
+
+int PieSlice::fromAngle() const
+{
+ return m_fromAngle;
+}
+
+void PieSlice::setFromAngle(int angle)
+{
+ m_fromAngle = angle;
+}
+
+int PieSlice::angleSpan() const
+{
+ return m_angleSpan;
+}
+
+void PieSlice::setAngleSpan(int angle)
+{
+ m_angleSpan = angle;
+}
+
+void PieSlice::paint(QPainter *painter)
+{
+ QPen pen(m_color, 2);
+ painter->setPen(pen);
+ painter->setRenderHints(QPainter::HighQualityAntialiasing, true);
+ painter->drawPie(boundingRect(), m_fromAngle * 16, m_angleSpan * 16);
+}
+
diff --git a/examples/tutorials/extending/chapter6-plugins/pieslice.h b/examples/tutorials/extending/chapter6-plugins/pieslice.h
new file mode 100644
index 0000000000..8a636fb3e7
--- /dev/null
+++ b/examples/tutorials/extending/chapter6-plugins/pieslice.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef PIESLICE_H
+#define PIESLICE_H
+
+#include <QtQuick/QQuickPaintedItem>
+#include <QColor>
+
+class PieSlice : public QQuickPaintedItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor color READ color WRITE setColor)
+ Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle)
+ Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan)
+
+public:
+ PieSlice(QQuickItem *parent = 0);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ int fromAngle() const;
+ void setFromAngle(int angle);
+
+ int angleSpan() const;
+ void setAngleSpan(int span);
+
+ void paint(QPainter *painter);
+
+private:
+ QColor m_color;
+ int m_fromAngle;
+ int m_angleSpan;
+};
+
+#endif
+
diff --git a/examples/tutorials/extending/extending.pro b/examples/tutorials/extending/extending.pro
new file mode 100644
index 0000000000..967473fda0
--- /dev/null
+++ b/examples/tutorials/extending/extending.pro
@@ -0,0 +1,10 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ chapter1-basics \
+ chapter2-methods \
+ chapter3-bindings \
+ chapter4-customPropertyTypes \
+ chapter5-listproperties \
+ chapter6-plugins
+
diff --git a/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp b/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp
index c8538958ac..776af5629b 100644
--- a/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp
+++ b/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp
@@ -49,6 +49,3 @@ void DialogPlugin::registerTypes(const char *uri)
qmlRegisterType<Directory>(uri, 1, 0, "Directory");
qmlRegisterType<File>(uri,1,0,"File");
}
-
-//FileDialog is the plugin name (same as the TARGET in the project file) and DialogPlugin is the plugin classs
-Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin); \ No newline at end of file
diff --git a/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.h b/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.h
index 1aed6abc8e..fcaa210457 100644
--- a/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.h
+++ b/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.h
@@ -46,6 +46,7 @@
class DialogPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" FILE "dialogplugin.json")
public:
//registerTypes is inherited from QQmlExtensionPlugin
diff --git a/examples/tutorials/gettingStartedQml/filedialog/dialogplugin.json b/examples/tutorials/gettingStartedQml/filedialog/dialogplugin.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/examples/tutorials/gettingStartedQml/filedialog/dialogplugin.json
@@ -0,0 +1 @@
+{}
diff --git a/examples/tutorials/helloworld/Cell.qml b/examples/tutorials/helloworld/Cell.qml
new file mode 100644
index 0000000000..7140dcb2c1
--- /dev/null
+++ b/examples/tutorials/helloworld/Cell.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 2.0
+
+//![1]
+Item {
+ id: container
+//![4]
+ property alias cellColor: rectangle.color
+//![4]
+//![5]
+ signal clicked(color cellColor)
+//![5]
+
+ width: 40; height: 25
+//![1]
+
+//![2]
+ Rectangle {
+ id: rectangle
+ border.color: "white"
+ anchors.fill: parent
+ }
+//![2]
+
+//![3]
+ MouseArea {
+ anchors.fill: parent
+ onClicked: container.clicked(container.cellColor)
+ }
+//![3]
+}
+//![0]
diff --git a/examples/tutorials/helloworld/tutorial1.qml b/examples/tutorials/helloworld/tutorial1.qml
new file mode 100644
index 0000000000..f0eb42d696
--- /dev/null
+++ b/examples/tutorials/helloworld/tutorial1.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+//![3]
+import QtQuick 2.0
+//![3]
+
+//![1]
+Rectangle {
+ id: page
+ width: 500; height: 200
+ color: "lightgray"
+//![1]
+
+//![2]
+ Text {
+ id: helloText
+ text: "Hello world!"
+ y: 30
+ anchors.horizontalCenter: page.horizontalCenter
+ font.pointSize: 24; font.bold: true
+ }
+//![2]
+}
+//![0]
diff --git a/examples/tutorials/helloworld/tutorial2.qml b/examples/tutorials/helloworld/tutorial2.qml
new file mode 100644
index 0000000000..c5c045aace
--- /dev/null
+++ b/examples/tutorials/helloworld/tutorial2.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 2.0
+
+Rectangle {
+ id: page
+ width: 500; height: 200
+ color: "lightgray"
+
+ Text {
+ id: helloText
+ text: "Hello world!"
+ y: 30
+ anchors.horizontalCenter: page.horizontalCenter
+ font.pointSize: 24; font.bold: true
+ }
+
+ Grid {
+ id: colorPicker
+ x: 4; anchors.bottom: page.bottom; anchors.bottomMargin: 4
+ rows: 2; columns: 3; spacing: 3
+
+//![1]
+ Cell { cellColor: "red"; onClicked: helloText.color = cellColor }
+//![1]
+ Cell { cellColor: "green"; onClicked: helloText.color = cellColor }
+ Cell { cellColor: "blue"; onClicked: helloText.color = cellColor }
+ Cell { cellColor: "yellow"; onClicked: helloText.color = cellColor }
+ Cell { cellColor: "steelblue"; onClicked: helloText.color = cellColor }
+ Cell { cellColor: "black"; onClicked: helloText.color = cellColor }
+ }
+}
+//![0]
diff --git a/examples/tutorials/helloworld/tutorial3.qml b/examples/tutorials/helloworld/tutorial3.qml
new file mode 100644
index 0000000000..c804bfca1d
--- /dev/null
+++ b/examples/tutorials/helloworld/tutorial3.qml
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 2.0
+
+Rectangle {
+ id: page
+ width: 500; height: 200
+ color: "lightgray"
+
+ Text {
+ id: helloText
+ text: "Hello world!"
+ y: 30
+ anchors.horizontalCenter: page.horizontalCenter
+ font.pointSize: 24; font.bold: true
+
+//![1]
+ MouseArea { id: mouseArea; anchors.fill: parent }
+//![1]
+
+//![2]
+ states: State {
+ name: "down"; when: mouseArea.pressed == true
+ PropertyChanges { target: helloText; y: 160; rotation: 180; color: "red" }
+ }
+//![2]
+
+//![3]
+ transitions: Transition {
+ from: ""; to: "down"; reversible: true
+ ParallelAnimation {
+ NumberAnimation { properties: "y,rotation"; duration: 500; easing.type: Easing.InOutQuad }
+ ColorAnimation { duration: 500 }
+ }
+ }
+//![3]
+ }
+
+ Grid {
+ id: colorPicker
+ x: 4; anchors.bottom: page.bottom; anchors.bottomMargin: 4
+ rows: 2; columns: 3; spacing: 3
+
+ Cell { cellColor: "red"; onClicked: helloText.color = cellColor }
+ Cell { cellColor: "green"; onClicked: helloText.color = cellColor }
+ Cell { cellColor: "blue"; onClicked: helloText.color = cellColor }
+ Cell { cellColor: "yellow"; onClicked: helloText.color = cellColor }
+ Cell { cellColor: "steelblue"; onClicked: helloText.color = cellColor }
+ Cell { cellColor: "black"; onClicked: helloText.color = cellColor }
+ }
+}
+//![0]
diff --git a/examples/tutorials/samegame/samegame1/Block.qml b/examples/tutorials/samegame/samegame1/Block.qml
new file mode 100644
index 0000000000..32ef8c2bba
--- /dev/null
+++ b/examples/tutorials/samegame/samegame1/Block.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 2.0
+
+Item {
+ id: block
+
+ Image {
+ id: img
+ anchors.fill: parent
+ source: "../shared/pics/redStone.png"
+ }
+}
+//![0]
diff --git a/examples/tutorials/samegame/samegame1/Button.qml b/examples/tutorials/samegame/samegame1/Button.qml
new file mode 100644
index 0000000000..6d1d1268de
--- /dev/null
+++ b/examples/tutorials/samegame/samegame1/Button.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+
+ property string text: "Button"
+
+ signal clicked
+
+ width: buttonLabel.width + 20; height: buttonLabel.height + 5
+ border { width: 1; color: Qt.darker(activePalette.button) }
+ smooth: true
+ radius: 8
+
+ // color the button with a gradient
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: {
+ if (mouseArea.pressed)
+ return activePalette.dark
+ else
+ return activePalette.light
+ }
+ }
+ GradientStop { position: 1.0; color: activePalette.button }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: container.clicked();
+ }
+
+ Text {
+ id: buttonLabel
+ anchors.centerIn: container
+ color: activePalette.buttonText
+ text: container.text
+ }
+}
+//![0]
diff --git a/examples/tutorials/samegame/samegame1/samegame.qml b/examples/tutorials/samegame/samegame1/samegame.qml
new file mode 100644
index 0000000000..73e2cc31fd
--- /dev/null
+++ b/examples/tutorials/samegame/samegame1/samegame.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 2.0
+
+Rectangle {
+ id: screen
+
+ width: 490; height: 720
+
+ SystemPalette { id: activePalette }
+
+ Item {
+ width: parent.width
+ anchors { top: parent.top; bottom: toolBar.top }
+
+ Image {
+ id: background
+ anchors.fill: parent
+ source: "../shared/pics/background.jpg"
+ fillMode: Image.PreserveAspectCrop
+ }
+ }
+
+ Rectangle {
+ id: toolBar
+ width: parent.width; height: 30
+ color: activePalette.window
+ anchors.bottom: screen.bottom
+
+ Button {
+ anchors { left: parent.left; verticalCenter: parent.verticalCenter }
+ text: "New Game"
+ onClicked: console.log("This doesn't do anything yet...")
+ }
+
+ Text {
+ id: score
+ anchors { right: parent.right; verticalCenter: parent.verticalCenter }
+ text: "Score: Who knows?"
+ }
+ }
+}
+//![0]
diff --git a/examples/tutorials/samegame/samegame1/samegame1.qmlproject b/examples/tutorials/samegame/samegame1/samegame1.qmlproject
new file mode 100644
index 0000000000..42ffacf4f8
--- /dev/null
+++ b/examples/tutorials/samegame/samegame1/samegame1.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "samegame.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/tutorials/samegame/samegame2/Block.qml b/examples/tutorials/samegame/samegame2/Block.qml
new file mode 100644
index 0000000000..8056b39480
--- /dev/null
+++ b/examples/tutorials/samegame/samegame2/Block.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: block
+
+ Image {
+ id: img
+ anchors.fill: parent
+ source: "../shared/pics/redStone.png"
+ }
+}
diff --git a/examples/tutorials/samegame/samegame2/Button.qml b/examples/tutorials/samegame/samegame2/Button.qml
new file mode 100644
index 0000000000..248c20cf0f
--- /dev/null
+++ b/examples/tutorials/samegame/samegame2/Button.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+
+ property string text: "Button"
+
+ signal clicked
+
+ width: buttonLabel.width + 20; height: buttonLabel.height + 5
+ border { width: 1; color: Qt.darker(activePalette.button) }
+ smooth: true
+ radius: 8
+
+ // color the button with a gradient
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: {
+ if (mouseArea.pressed)
+ return activePalette.dark
+ else
+ return activePalette.light
+ }
+ }
+ GradientStop { position: 1.0; color: activePalette.button }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: container.clicked();
+ }
+
+ Text {
+ id: buttonLabel
+ anchors.centerIn: container
+ color: activePalette.buttonText
+ text: container.text
+ }
+}
diff --git a/examples/tutorials/samegame/samegame2/samegame.js b/examples/tutorials/samegame/samegame2/samegame.js
new file mode 100644
index 0000000000..c749dc17b1
--- /dev/null
+++ b/examples/tutorials/samegame/samegame2/samegame.js
@@ -0,0 +1,63 @@
+//![0]
+var blockSize = 40;
+var maxColumn = 10;
+var maxRow = 15;
+var maxIndex = maxColumn * maxRow;
+var board = new Array(maxIndex);
+var component;
+
+//Index function used instead of a 2D array
+function index(column, row) {
+ return column + (row * maxColumn);
+}
+
+function startNewGame() {
+ //Delete blocks from previous game
+ for (var i = 0; i < maxIndex; i++) {
+ if (board[i] != null)
+ board[i].destroy();
+ }
+
+ //Calculate board size
+ maxColumn = Math.floor(background.width / blockSize);
+ maxRow = Math.floor(background.height / blockSize);
+ maxIndex = maxRow * maxColumn;
+
+ //Initialize Board
+ board = new Array(maxIndex);
+ for (var column = 0; column < maxColumn; column++) {
+ for (var row = 0; row < maxRow; row++) {
+ board[index(column, row)] = null;
+ createBlock(column, row);
+ }
+ }
+}
+
+function createBlock(column, row) {
+ if (component == null)
+ component = Qt.createComponent("Block.qml");
+
+ // Note that if Block.qml was not a local file, component.status would be
+ // Loading and we should wait for the component's statusChanged() signal to
+ // know when the file is downloaded and ready before calling createObject().
+ if (component.status == Component.Ready) {
+ var dynamicObject = component.createObject(background);
+ if (dynamicObject == null) {
+ console.log("error creating block");
+ console.log(component.errorString());
+ return false;
+ }
+ dynamicObject.x = column * blockSize;
+ dynamicObject.y = row * blockSize;
+ dynamicObject.width = blockSize;
+ dynamicObject.height = blockSize;
+ board[index(column, row)] = dynamicObject;
+ } else {
+ console.log("error loading block component");
+ console.log(component.errorString());
+ return false;
+ }
+ return true;
+}
+//![0]
+
diff --git a/examples/tutorials/samegame/samegame2/samegame.qml b/examples/tutorials/samegame/samegame2/samegame.qml
new file mode 100644
index 0000000000..c50010e97d
--- /dev/null
+++ b/examples/tutorials/samegame/samegame2/samegame.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+//![2]
+import "samegame.js" as SameGame
+//![2]
+
+Rectangle {
+ id: screen
+
+ width: 490; height: 720
+
+ SystemPalette { id: activePalette }
+
+ Item {
+ width: parent.width
+ anchors { top: parent.top; bottom: toolBar.top }
+
+ Image {
+ id: background
+ anchors.fill: parent
+ source: "../shared/pics/background.jpg"
+ fillMode: Image.PreserveAspectCrop
+ }
+ }
+
+ Rectangle {
+ id: toolBar
+ width: parent.width; height: 32
+ color: activePalette.window
+ anchors.bottom: screen.bottom
+
+//![1]
+ Button {
+ anchors { left: parent.left; verticalCenter: parent.verticalCenter }
+ text: "New Game"
+ onClicked: SameGame.startNewGame()
+ }
+//![1]
+
+ Text {
+ id: score
+ anchors { right: parent.right; verticalCenter: parent.verticalCenter }
+ text: "Score: Who knows?"
+ }
+ }
+}
diff --git a/examples/tutorials/samegame/samegame2/samegame2.qmlproject b/examples/tutorials/samegame/samegame2/samegame2.qmlproject
new file mode 100644
index 0000000000..42ffacf4f8
--- /dev/null
+++ b/examples/tutorials/samegame/samegame2/samegame2.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "samegame.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/tutorials/samegame/samegame3/Block.qml b/examples/tutorials/samegame/samegame3/Block.qml
new file mode 100644
index 0000000000..9c41048fcb
--- /dev/null
+++ b/examples/tutorials/samegame/samegame3/Block.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 2.0
+
+Item {
+ id: block
+
+ property int type: 0
+
+ Image {
+ id: img
+
+ anchors.fill: parent
+ source: {
+ if (type == 0)
+ return "../shared/pics/redStone.png";
+ else if (type == 1)
+ return "../shared/pics/blueStone.png";
+ else
+ return "../shared/pics/greenStone.png";
+ }
+ }
+}
+//![0]
diff --git a/examples/tutorials/samegame/samegame3/Button.qml b/examples/tutorials/samegame/samegame3/Button.qml
new file mode 100644
index 0000000000..248c20cf0f
--- /dev/null
+++ b/examples/tutorials/samegame/samegame3/Button.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+
+ property string text: "Button"
+
+ signal clicked
+
+ width: buttonLabel.width + 20; height: buttonLabel.height + 5
+ border { width: 1; color: Qt.darker(activePalette.button) }
+ smooth: true
+ radius: 8
+
+ // color the button with a gradient
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: {
+ if (mouseArea.pressed)
+ return activePalette.dark
+ else
+ return activePalette.light
+ }
+ }
+ GradientStop { position: 1.0; color: activePalette.button }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: container.clicked();
+ }
+
+ Text {
+ id: buttonLabel
+ anchors.centerIn: container
+ color: activePalette.buttonText
+ text: container.text
+ }
+}
diff --git a/examples/tutorials/samegame/samegame3/Dialog.qml b/examples/tutorials/samegame/samegame3/Dialog.qml
new file mode 100644
index 0000000000..df1fa37d6a
--- /dev/null
+++ b/examples/tutorials/samegame/samegame3/Dialog.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+
+ function show(text) {
+ dialogText.text = text;
+ container.opacity = 1;
+ }
+
+ function hide() {
+ container.opacity = 0;
+ }
+
+ width: dialogText.width + 20
+ height: dialogText.height + 20
+ opacity: 0
+
+ Text {
+ id: dialogText
+ anchors.centerIn: parent
+ text: ""
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: hide();
+ }
+}
+//![0]
diff --git a/examples/tutorials/samegame/samegame3/samegame.js b/examples/tutorials/samegame/samegame3/samegame.js
new file mode 100644
index 0000000000..df5bdfb049
--- /dev/null
+++ b/examples/tutorials/samegame/samegame3/samegame.js
@@ -0,0 +1,174 @@
+/* This script file handles the game logic */
+var maxColumn = 10;
+var maxRow = 15;
+var maxIndex = maxColumn * maxRow;
+var board = new Array(maxIndex);
+var component;
+
+//Index function used instead of a 2D array
+function index(column, row) {
+ return column + (row * maxColumn);
+}
+
+function startNewGame() {
+ //Calculate board size
+ maxColumn = Math.floor(gameCanvas.width / gameCanvas.blockSize);
+ maxRow = Math.floor(gameCanvas.height / gameCanvas.blockSize);
+ maxIndex = maxRow * maxColumn;
+
+ //Close dialogs
+ dialog.hide();
+
+ //Initialize Board
+ board = new Array(maxIndex);
+ gameCanvas.score = 0;
+ for (var column = 0; column < maxColumn; column++) {
+ for (var row = 0; row < maxRow; row++) {
+ board[index(column, row)] = null;
+ createBlock(column, row);
+ }
+ }
+}
+
+function createBlock(column, row) {
+ if (component == null)
+ component = Qt.createComponent("Block.qml");
+
+ // Note that if Block.qml was not a local file, component.status would be
+ // Loading and we should wait for the component's statusChanged() signal to
+ // know when the file is downloaded and ready before calling createObject().
+ if (component.status == Component.Ready) {
+ var dynamicObject = component.createObject(gameCanvas);
+ if (dynamicObject == null) {
+ console.log("error creating block");
+ console.log(component.errorString());
+ return false;
+ }
+ dynamicObject.type = Math.floor(Math.random() * 3);
+ dynamicObject.x = column * gameCanvas.blockSize;
+ dynamicObject.y = row * gameCanvas.blockSize;
+ dynamicObject.width = gameCanvas.blockSize;
+ dynamicObject.height = gameCanvas.blockSize;
+ board[index(column, row)] = dynamicObject;
+ } else {
+ console.log("error loading block component");
+ console.log(component.errorString());
+ return false;
+ }
+ return true;
+}
+
+var fillFound; //Set after a floodFill call to the number of blocks found
+var floodBoard; //Set to 1 if the floodFill reaches off that node
+
+//![1]
+function handleClick(xPos, yPos) {
+ var column = Math.floor(xPos / gameCanvas.blockSize);
+ var row = Math.floor(yPos / gameCanvas.blockSize);
+ if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
+ return;
+ if (board[index(column, row)] == null)
+ return;
+ //If it's a valid block, remove it and all connected (does nothing if it's not connected)
+ floodFill(column, row, -1);
+ if (fillFound <= 0)
+ return;
+ gameCanvas.score += (fillFound - 1) * (fillFound - 1);
+ shuffleDown();
+ victoryCheck();
+}
+//![1]
+
+function floodFill(column, row, type) {
+ if (board[index(column, row)] == null)
+ return;
+ var first = false;
+ if (type == -1) {
+ first = true;
+ type = board[index(column, row)].type;
+
+ //Flood fill initialization
+ fillFound = 0;
+ floodBoard = new Array(maxIndex);
+ }
+ if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
+ return;
+ if (floodBoard[index(column, row)] == 1 || (!first && type != board[index(column, row)].type))
+ return;
+ floodBoard[index(column, row)] = 1;
+ floodFill(column + 1, row, type);
+ floodFill(column - 1, row, type);
+ floodFill(column, row + 1, type);
+ floodFill(column, row - 1, type);
+ if (first == true && fillFound == 0)
+ return; //Can't remove single blocks
+ board[index(column, row)].opacity = 0;
+ board[index(column, row)] = null;
+ fillFound += 1;
+}
+
+function shuffleDown() {
+ //Fall down
+ for (var column = 0; column < maxColumn; column++) {
+ var fallDist = 0;
+ for (var row = maxRow - 1; row >= 0; row--) {
+ if (board[index(column, row)] == null) {
+ fallDist += 1;
+ } else {
+ if (fallDist > 0) {
+ var obj = board[index(column, row)];
+ obj.y += fallDist * gameCanvas.blockSize;
+ board[index(column, row + fallDist)] = obj;
+ board[index(column, row)] = null;
+ }
+ }
+ }
+ }
+ //Fall to the left
+ var fallDist = 0;
+ for (var column = 0; column < maxColumn; column++) {
+ if (board[index(column, maxRow - 1)] == null) {
+ fallDist += 1;
+ } else {
+ if (fallDist > 0) {
+ for (var row = 0; row < maxRow; row++) {
+ var obj = board[index(column, row)];
+ if (obj == null)
+ continue;
+ obj.x -= fallDist * gameCanvas.blockSize;
+ board[index(column - fallDist, row)] = obj;
+ board[index(column, row)] = null;
+ }
+ }
+ }
+ }
+}
+
+//![2]
+function victoryCheck() {
+ //Award bonus points if no blocks left
+ var deservesBonus = true;
+ for (var column = maxColumn - 1; column >= 0; column--)
+ if (board[index(column, maxRow - 1)] != null)
+ deservesBonus = false;
+ if (deservesBonus)
+ gameCanvas.score += 500;
+
+ //Check whether game has finished
+ if (deservesBonus || !(floodMoveCheck(0, maxRow - 1, -1)))
+ dialog.show("Game Over. Your score is " + gameCanvas.score);
+}
+//![2]
+
+//only floods up and right, to see if it can find adjacent same-typed blocks
+function floodMoveCheck(column, row, type) {
+ if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
+ return false;
+ if (board[index(column, row)] == null)
+ return false;
+ var myType = board[index(column, row)].type;
+ if (type == myType)
+ return true;
+ return floodMoveCheck(column + 1, row, myType) || floodMoveCheck(column, row - 1, board[index(column, row)].type);
+}
+
diff --git a/examples/tutorials/samegame/samegame3/samegame.qml b/examples/tutorials/samegame/samegame3/samegame.qml
new file mode 100644
index 0000000000..f14829ef63
--- /dev/null
+++ b/examples/tutorials/samegame/samegame3/samegame.qml
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 2.0
+import "samegame.js" as SameGame
+
+Rectangle {
+ id: screen
+
+ width: 490; height: 720
+
+ SystemPalette { id: activePalette }
+
+ Item {
+ width: parent.width
+ anchors { top: parent.top; bottom: toolBar.top }
+
+ Image {
+ id: background
+ anchors.fill: parent
+ source: "../shared/pics/background.jpg"
+ fillMode: Image.PreserveAspectCrop
+ }
+
+//![1]
+ Item {
+ id: gameCanvas
+
+ property int score: 0
+ property int blockSize: 40
+
+ width: parent.width - (parent.width % blockSize)
+ height: parent.height - (parent.height % blockSize)
+ anchors.centerIn: parent
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: SameGame.handleClick(mouse.x, mouse.y)
+ }
+ }
+//![1]
+ }
+
+//![2]
+ Dialog {
+ id: dialog
+ anchors.centerIn: parent
+ z: 100
+ }
+//![2]
+
+ Rectangle {
+ id: toolBar
+ width: parent.width; height: 30
+ color: activePalette.window
+ anchors.bottom: screen.bottom
+
+ Button {
+ anchors { left: parent.left; verticalCenter: parent.verticalCenter }
+ text: "New Game"
+ onClicked: SameGame.startNewGame()
+ }
+
+ Text {
+ id: score
+ anchors { right: parent.right; verticalCenter: parent.verticalCenter }
+ text: "Score: Who knows?"
+ }
+ }
+}
+//![0]
diff --git a/examples/tutorials/samegame/samegame3/samegame3.qmlproject b/examples/tutorials/samegame/samegame3/samegame3.qmlproject
new file mode 100644
index 0000000000..42ffacf4f8
--- /dev/null
+++ b/examples/tutorials/samegame/samegame3/samegame3.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "samegame.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/tutorials/samegame/samegame4/content/BoomBlock.qml
new file mode 100644
index 0000000000..3786b9c0d1
--- /dev/null
+++ b/examples/tutorials/samegame/samegame4/content/BoomBlock.qml
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.labs.particles 1.0
+
+Item {
+ id: block
+
+ property int type: 0
+ property bool dying: false
+
+ //![1]
+ property bool spawned: false
+
+ Behavior on x {
+ enabled: spawned;
+ SpringAnimation{ spring: 2; damping: 0.2 }
+ }
+ Behavior on y {
+ SpringAnimation{ spring: 2; damping: 0.2 }
+ }
+ //![1]
+
+ //![2]
+ Image {
+ id: img
+
+ anchors.fill: parent
+ source: {
+ if (type == 0)
+ return "../../shared/pics/redStone.png";
+ else if (type == 1)
+ return "../../shared/pics/blueStone.png";
+ else
+ return "../../shared/pics/greenStone.png";
+ }
+ opacity: 0
+
+ Behavior on opacity {
+ NumberAnimation { properties:"opacity"; duration: 200 }
+ }
+ }
+ //![2]
+
+ //![3]
+ Particles {
+ id: particles
+
+ width: 1; height: 1
+ anchors.centerIn: parent
+
+ emissionRate: 0
+ lifeSpan: 700; lifeSpanDeviation: 600
+ angle: 0; angleDeviation: 360;
+ velocity: 100; velocityDeviation: 30
+ source: {
+ if (type == 0)
+ return "../../shared/pics/redStar.png";
+ else if (type == 1)
+ return "../../shared/pics/blueStar.png";
+ else
+ return "../../shared/pics/greenStar.png";
+ }
+ }
+ //![3]
+
+ //![4]
+ states: [
+ State {
+ name: "AliveState"
+ when: spawned == true && dying == false
+ PropertyChanges { target: img; opacity: 1 }
+ },
+
+ State {
+ name: "DeathState"
+ when: dying == true
+ StateChangeScript { script: particles.burst(50); }
+ PropertyChanges { target: img; opacity: 0 }
+ StateChangeScript { script: block.destroy(1000); }
+ }
+ ]
+ //![4]
+}
diff --git a/examples/tutorials/samegame/samegame4/content/Button.qml b/examples/tutorials/samegame/samegame4/content/Button.qml
new file mode 100644
index 0000000000..248c20cf0f
--- /dev/null
+++ b/examples/tutorials/samegame/samegame4/content/Button.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: container
+
+ property string text: "Button"
+
+ signal clicked
+
+ width: buttonLabel.width + 20; height: buttonLabel.height + 5
+ border { width: 1; color: Qt.darker(activePalette.button) }
+ smooth: true
+ radius: 8
+
+ // color the button with a gradient
+ gradient: Gradient {
+ GradientStop {
+ position: 0.0
+ color: {
+ if (mouseArea.pressed)
+ return activePalette.dark
+ else
+ return activePalette.light
+ }
+ }
+ GradientStop { position: 1.0; color: activePalette.button }
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ onClicked: container.clicked();
+ }
+
+ Text {
+ id: buttonLabel
+ anchors.centerIn: container
+ color: activePalette.buttonText
+ text: container.text
+ }
+}
diff --git a/examples/tutorials/samegame/samegame4/content/Dialog.qml b/examples/tutorials/samegame/samegame4/content/Dialog.qml
new file mode 100644
index 0000000000..984b3ddb6a
--- /dev/null
+++ b/examples/tutorials/samegame/samegame4/content/Dialog.qml
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+//![0]
+Rectangle {
+ id: container
+//![0]
+
+//![1]
+ property string inputText: textInput.text
+ signal closed
+
+ function show(text) {
+ dialogText.text = text;
+ container.opacity = 1;
+ textInput.opacity = 0;
+ }
+
+ function showWithInput(text) {
+ show(text);
+ textInput.opacity = 1;
+ textInput.focus = true;
+ textInput.text = ""
+ }
+
+ function hide() {
+ textInput.focus = false;
+ container.opacity = 0;
+ container.closed();
+ }
+//![1]
+
+ width: dialogText.width + textInput.width + 20
+ height: dialogText.height + 20
+ opacity: 0
+ visible: opacity > 0
+
+ Text {
+ id: dialogText
+ anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: 10 }
+ text: ""
+ }
+
+//![2]
+ TextInput {
+ id: textInput
+ anchors { verticalCenter: parent.verticalCenter; left: dialogText.right }
+ width: 80
+ text: ""
+
+ onAccepted: container.hide() // close dialog when Enter is pressed
+ }
+//![2]
+
+ MouseArea {
+ anchors.fill: parent
+
+ onClicked: {
+ if (textInput.text == "" && textInput.opacity > 0)
+ textInput.openSoftwareInputPanel();
+ else
+ hide();
+ }
+ }
+
+//![3]
+}
+//![3]
diff --git a/examples/tutorials/samegame/samegame4/content/samegame.js b/examples/tutorials/samegame/samegame4/content/samegame.js
new file mode 100755
index 0000000000..7bb7243914
--- /dev/null
+++ b/examples/tutorials/samegame/samegame4/content/samegame.js
@@ -0,0 +1,226 @@
+/* This script file handles the game logic */
+.import QtQuick.LocalStorage 2.0 as Sql
+
+var maxColumn = 10;
+var maxRow = 15;
+var maxIndex = maxColumn * maxRow;
+var board = new Array(maxIndex);
+var component;
+var scoresURL = "";
+var gameDuration;
+
+//Index function used instead of a 2D array
+function index(column, row) {
+ return column + (row * maxColumn);
+}
+
+function startNewGame() {
+ //Delete blocks from previous game
+ for (var i = 0; i < maxIndex; i++) {
+ if (board[i] != null)
+ board[i].destroy();
+ }
+
+ //Calculate board size
+ maxColumn = Math.floor(gameCanvas.width / gameCanvas.blockSize);
+ maxRow = Math.floor(gameCanvas.height / gameCanvas.blockSize);
+ maxIndex = maxRow * maxColumn;
+
+ //Close dialogs
+ nameInputDialog.hide();
+ dialog.hide();
+
+ //Initialize Board
+ board = new Array(maxIndex);
+ gameCanvas.score = 0;
+ for (var column = 0; column < maxColumn; column++) {
+ for (var row = 0; row < maxRow; row++) {
+ board[index(column, row)] = null;
+ createBlock(column, row);
+ }
+ }
+
+ gameDuration = new Date();
+}
+
+function createBlock(column, row) {
+ if (component == null)
+ component = Qt.createComponent("content/BoomBlock.qml");
+
+ // Note that if Block.qml was not a local file, component.status would be
+ // Loading and we should wait for the component's statusChanged() signal to
+ // know when the file is downloaded and ready before calling createObject().
+ if (component.status == Component.Ready) {
+ var dynamicObject = component.createObject(gameCanvas);
+ if (dynamicObject == null) {
+ console.log("error creating block");
+ console.log(component.errorString());
+ return false;
+ }
+ dynamicObject.type = Math.floor(Math.random() * 3);
+ dynamicObject.x = column * gameCanvas.blockSize;
+ dynamicObject.y = row * gameCanvas.blockSize;
+ dynamicObject.width = gameCanvas.blockSize;
+ dynamicObject.height = gameCanvas.blockSize;
+ dynamicObject.spawned = true;
+ board[index(column, row)] = dynamicObject;
+ } else {
+ console.log("error loading block component");
+ console.log(component.errorString());
+ return false;
+ }
+ return true;
+}
+
+var fillFound; //Set after a floodFill call to the number of blocks found
+var floodBoard; //Set to 1 if the floodFill reaches off that node
+
+function handleClick(xPos, yPos) {
+ var column = Math.floor(xPos / gameCanvas.blockSize);
+ var row = Math.floor(yPos / gameCanvas.blockSize);
+ if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
+ return;
+ if (board[index(column, row)] == null)
+ return;
+ //If it's a valid block, remove it and all connected (does nothing if it's not connected)
+ floodFill(column, row, -1);
+ if (fillFound <= 0)
+ return;
+ gameCanvas.score += (fillFound - 1) * (fillFound - 1);
+ shuffleDown();
+ victoryCheck();
+}
+
+function floodFill(column, row, type) {
+ if (board[index(column, row)] == null)
+ return;
+ var first = false;
+ if (type == -1) {
+ first = true;
+ type = board[index(column, row)].type;
+
+ //Flood fill initialization
+ fillFound = 0;
+ floodBoard = new Array(maxIndex);
+ }
+ if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
+ return;
+ if (floodBoard[index(column, row)] == 1 || (!first && type != board[index(column, row)].type))
+ return;
+ floodBoard[index(column, row)] = 1;
+ floodFill(column + 1, row, type);
+ floodFill(column - 1, row, type);
+ floodFill(column, row + 1, type);
+ floodFill(column, row - 1, type);
+ if (first == true && fillFound == 0)
+ return; //Can't remove single blocks
+ board[index(column, row)].dying = true;
+ board[index(column, row)] = null;
+ fillFound += 1;
+}
+
+function shuffleDown() {
+ //Fall down
+ for (var column = 0; column < maxColumn; column++) {
+ var fallDist = 0;
+ for (var row = maxRow - 1; row >= 0; row--) {
+ if (board[index(column, row)] == null) {
+ fallDist += 1;
+ } else {
+ if (fallDist > 0) {
+ var obj = board[index(column, row)];
+ obj.y = (row + fallDist) * gameCanvas.blockSize;
+ board[index(column, row + fallDist)] = obj;
+ board[index(column, row)] = null;
+ }
+ }
+ }
+ }
+ //Fall to the left
+ fallDist = 0;
+ for (column = 0; column < maxColumn; column++) {
+ if (board[index(column, maxRow - 1)] == null) {
+ fallDist += 1;
+ } else {
+ if (fallDist > 0) {
+ for (row = 0; row < maxRow; row++) {
+ obj = board[index(column, row)];
+ if (obj == null)
+ continue;
+ obj.x = (column - fallDist) * gameCanvas.blockSize;
+ board[index(column - fallDist, row)] = obj;
+ board[index(column, row)] = null;
+ }
+ }
+ }
+ }
+}
+
+//![3]
+function victoryCheck() {
+//![3]
+ //Award bonus points if no blocks left
+ var deservesBonus = true;
+ for (var column = maxColumn - 1; column >= 0; column--)
+ if (board[index(column, maxRow - 1)] != null)
+ deservesBonus = false;
+ if (deservesBonus)
+ gameCanvas.score += 500;
+
+//![4]
+ //Check whether game has finished
+ if (deservesBonus || !(floodMoveCheck(0, maxRow - 1, -1))) {
+ gameDuration = new Date() - gameDuration;
+ nameInputDialog.showWithInput("You won! Please enter your name: ");
+ }
+}
+//![4]
+
+//only floods up and right, to see if it can find adjacent same-typed blocks
+function floodMoveCheck(column, row, type) {
+ if (column >= maxColumn || column < 0 || row >= maxRow || row < 0)
+ return false;
+ if (board[index(column, row)] == null)
+ return false;
+ var myType = board[index(column, row)].type;
+ if (type == myType)
+ return true;
+ return floodMoveCheck(column + 1, row, myType) || floodMoveCheck(column, row - 1, board[index(column, row)].type);
+}
+
+//![2]
+function saveHighScore(name) {
+ if (scoresURL != "")
+ sendHighScore(name);
+
+ var db = Sql.openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores", 100);
+ var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)";
+ var data = [name, gameCanvas.score, maxColumn + "x" + maxRow, Math.floor(gameDuration / 1000)];
+ db.transaction(function(tx) {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)');
+ tx.executeSql(dataStr, data);
+
+ var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "12x17" ORDER BY score desc LIMIT 10');
+ var r = "\nHIGH SCORES for a standard sized grid\n\n"
+ for (var i = 0; i < rs.rows.length; i++) {
+ r += (i + 1) + ". " + rs.rows.item(i).name + ' got ' + rs.rows.item(i).score + ' points in ' + rs.rows.item(i).time + ' seconds.\n';
+ }
+ dialog.show(r);
+ });
+}
+//![2]
+
+//![1]
+function sendHighScore(name) {
+ var postman = new XMLHttpRequest()
+ var postData = "name=" + name + "&score=" + gameCanvas.score + "&gridSize=" + maxColumn + "x" + maxRow + "&time=" + Math.floor(gameDuration / 1000);
+ postman.open("POST", scoresURL, true);
+ postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ postman.onreadystatechange = function() {
+ if (postman.readyState == postman.DONE) {
+ dialog.show("Your score has been uploaded.");
+ }
+ }
+ postman.send(postData);
+}
+//![1]
diff --git a/examples/tutorials/samegame/samegame4/highscores/README b/examples/tutorials/samegame/samegame4/highscores/README
new file mode 100644
index 0000000000..eaa00fae37
--- /dev/null
+++ b/examples/tutorials/samegame/samegame4/highscores/README
@@ -0,0 +1 @@
+The SameGame example can interface with a simple PHP script to store XML high score data on a remote server. We do not have a publically accessible server available for this use, but if you have access to a PHP capable webserver you can copy the files (score_data.xml, score.php, score_style.xsl) to it and alter the highscore_server variable at the top of the samegame.js file to point to it.
diff --git a/examples/tutorials/samegame/samegame4/highscores/score_data.xml b/examples/tutorials/samegame/samegame4/highscores/score_data.xml
new file mode 100755
index 0000000000..c3fd90d9cf
--- /dev/null
+++ b/examples/tutorials/samegame/samegame4/highscores/score_data.xml
@@ -0,0 +1,2 @@
+<record><score>1000000</score><name>Alan the Tester</name><gridSize>0x0</gridSize><seconds>0</seconds></record>
+<record><score>6213</score><name>Alan</name><gridSize>12x17</gridSize><seconds>51</seconds></record>
diff --git a/examples/tutorials/samegame/samegame4/highscores/score_style.xsl b/examples/tutorials/samegame/samegame4/highscores/score_style.xsl
new file mode 100755
index 0000000000..670354c965
--- /dev/null
+++ b/examples/tutorials/samegame/samegame4/highscores/score_style.xsl
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:template match="/">
+ <html>
+ <head><title>SameGame High Scores</title></head>
+ <body>
+ <h2>SameGame High Scores</h2>
+ <table border="1">
+ <tr bgcolor="lightsteelblue">
+ <th>Name</th>
+ <th>Score</th>
+ <th>Grid Size</th>
+ <th>Time, s</th>
+ </tr>
+ <xsl:for-each select="records/record">
+ <xsl:sort select="score" data-type="number" order="descending"/>
+ <tr>
+ <td><xsl:value-of select="name"/></td>
+ <td><xsl:value-of select="score"/></td>
+ <td><xsl:value-of select="gridSize"/></td>
+ <td><xsl:value-of select="seconds"/></td>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </body>
+ </html>
+</xsl:template>
+</xsl:stylesheet>
diff --git a/examples/tutorials/samegame/samegame4/highscores/scores.php b/examples/tutorials/samegame/samegame4/highscores/scores.php
new file mode 100755
index 0000000000..daf480e21b
--- /dev/null
+++ b/examples/tutorials/samegame/samegame4/highscores/scores.php
@@ -0,0 +1,31 @@
+<?php
+ $score = $_POST["score"];
+ echo "<html>";
+ echo "<head><title>SameGame High Scores</title></head><body>";
+ if($score > 0){#Sending in a new high score
+ $name = $_POST["name"];
+ $grid = $_POST["gridSize"];
+ $time = $_POST["time"];
+ if($name == "")
+ $name = "Anonymous";
+ $file = fopen("score_data.xml", "a");
+ $ret = fwrite($file, "<record><score>". $score . "</score><name>"
+ . $name . "</name><gridSize>" . $grid . "</gridSize><seconds>"
+ . $time . "</seconds></record>\n");
+ echo "Your score has been recorded. Thanks for playing!";
+ if($ret == False)
+ echo "<br/> There was an error though, so don't expect to see that score again.";
+ }else{#Read high score list
+ #Now uses XSLT to display. So just print the file. With XML cruft added.
+ #Note that firefox at least won't apply the XSLT on a php file. So redirecting
+ $file = fopen("scores.xml", "w");
+ $ret = fwrite($file, '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n"
+ . '<?xml-stylesheet type="text/xsl" href="score_style.xsl"?>' . "\n"
+ . "<records>\n" . file_get_contents("score_data.xml") . "</records>\n");
+ if($ret == False)
+ echo "There was an internal error. Sorry.";
+ else
+ echo '<script type="text/javascript">window.location.replace("scores.xml")</script>';
+ }
+ echo "</body></html>";
+?>
diff --git a/examples/tutorials/samegame/samegame4/samegame.qml b/examples/tutorials/samegame/samegame4/samegame.qml
new file mode 100644
index 0000000000..c21b8de8bd
--- /dev/null
+++ b/examples/tutorials/samegame/samegame4/samegame.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+import "content/samegame.js" as SameGame
+
+Rectangle {
+ id: screen
+
+ width: 490; height: 720
+
+ SystemPalette { id: activePalette }
+
+ Item {
+ width: parent.width
+ anchors { top: parent.top; bottom: toolBar.top }
+
+ Image {
+ id: background
+ anchors.fill: parent
+ source: "../shared/pics/background.jpg"
+ fillMode: Image.PreserveAspectCrop
+ }
+
+ Item {
+ id: gameCanvas
+ property int score: 0
+ property int blockSize: 40
+
+ anchors.centerIn: parent
+ width: parent.width - (parent.width % blockSize);
+ height: parent.height - (parent.height % blockSize);
+
+ MouseArea {
+ anchors.fill: parent; onClicked: SameGame.handleClick(mouse.x,mouse.y);
+ }
+ }
+ }
+
+ Dialog {
+ id: dialog
+ anchors.centerIn: parent
+ z: 100
+ }
+
+ //![0]
+ Dialog {
+ id: nameInputDialog
+ anchors.centerIn: parent
+ z: 100
+
+ onClosed: {
+ if (nameInputDialog.inputText != "")
+ SameGame.saveHighScore(nameInputDialog.inputText);
+ }
+ }
+ //![0]
+
+ Rectangle {
+ id: toolBar
+ width: parent.width; height: 30
+ color: activePalette.window
+ anchors.bottom: screen.bottom
+
+ Button {
+ anchors { left: parent.left; verticalCenter: parent.verticalCenter }
+ text: "New Game"
+ onClicked: SameGame.startNewGame()
+ }
+
+ Text {
+ id: score
+ anchors { right: parent.right; verticalCenter: parent.verticalCenter }
+ text: "Score: " + gameCanvas.score
+ }
+ }
+}
diff --git a/examples/tutorials/samegame/samegame4/samegame4.qmlproject b/examples/tutorials/samegame/samegame4/samegame4.qmlproject
new file mode 100644
index 0000000000..42ffacf4f8
--- /dev/null
+++ b/examples/tutorials/samegame/samegame4/samegame4.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "samegame.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/tutorials/samegame/shared/pics/background.jpg b/examples/tutorials/samegame/shared/pics/background.jpg
new file mode 100644
index 0000000000..903d395c8d
--- /dev/null
+++ b/examples/tutorials/samegame/shared/pics/background.jpg
Binary files differ
diff --git a/examples/tutorials/samegame/shared/pics/blueStar.png b/examples/tutorials/samegame/shared/pics/blueStar.png
new file mode 100644
index 0000000000..ff9588f80a
--- /dev/null
+++ b/examples/tutorials/samegame/shared/pics/blueStar.png
Binary files differ
diff --git a/examples/tutorials/samegame/shared/pics/blueStone.png b/examples/tutorials/samegame/shared/pics/blueStone.png
new file mode 100644
index 0000000000..20e43c75b6
--- /dev/null
+++ b/examples/tutorials/samegame/shared/pics/blueStone.png
Binary files differ
diff --git a/examples/tutorials/samegame/shared/pics/greenStar.png b/examples/tutorials/samegame/shared/pics/greenStar.png
new file mode 100644
index 0000000000..cd06854719
--- /dev/null
+++ b/examples/tutorials/samegame/shared/pics/greenStar.png
Binary files differ
diff --git a/examples/tutorials/samegame/shared/pics/greenStone.png b/examples/tutorials/samegame/shared/pics/greenStone.png
new file mode 100644
index 0000000000..b568a1900c
--- /dev/null
+++ b/examples/tutorials/samegame/shared/pics/greenStone.png
Binary files differ
diff --git a/examples/tutorials/samegame/shared/pics/redStar.png b/examples/tutorials/samegame/shared/pics/redStar.png
new file mode 100644
index 0000000000..0a4dffe583
--- /dev/null
+++ b/examples/tutorials/samegame/shared/pics/redStar.png
Binary files differ
diff --git a/examples/tutorials/samegame/shared/pics/redStone.png b/examples/tutorials/samegame/shared/pics/redStone.png
new file mode 100644
index 0000000000..36b09a2686
--- /dev/null
+++ b/examples/tutorials/samegame/shared/pics/redStone.png
Binary files differ
diff --git a/examples/tutorials/samegame/shared/pics/star.png b/examples/tutorials/samegame/shared/pics/star.png
new file mode 100644
index 0000000000..defbde53ca
--- /dev/null
+++ b/examples/tutorials/samegame/shared/pics/star.png
Binary files differ
diff --git a/examples/tutorials/samegame/shared/pics/yellowStone.png b/examples/tutorials/samegame/shared/pics/yellowStone.png
new file mode 100644
index 0000000000..b1ce76212c
--- /dev/null
+++ b/examples/tutorials/samegame/shared/pics/yellowStone.png
Binary files differ
diff --git a/examples/tutorials/ui-components/dialcontrol/content/Dial.qml b/examples/tutorials/ui-components/dialcontrol/content/Dial.qml
new file mode 100644
index 0000000000..c61adee364
--- /dev/null
+++ b/examples/tutorials/ui-components/dialcontrol/content/Dial.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: root
+ property real value : 0
+
+ width: 210; height: 210
+
+ Image { source: "background.png" }
+
+//! [needle_shadow]
+ Image {
+ x: 96
+ y: 35
+ source: "needle_shadow.png"
+ transform: Rotation {
+ origin.x: 9; origin.y: 67
+ angle: needleRotation.angle
+ }
+ }
+//! [needle_shadow]
+//! [needle]
+ Image {
+ id: needle
+ x: 98; y: 33
+ smooth: true
+ source: "needle.png"
+ transform: Rotation {
+ id: needleRotation
+ origin.x: 5; origin.y: 65
+ //! [needle angle]
+ angle: Math.min(Math.max(-130, root.value*2.6 - 130), 133)
+ Behavior on angle {
+ SpringAnimation {
+ spring: 1.4
+ damping: .15
+ }
+ }
+ //! [needle angle]
+ }
+ }
+//! [needle]
+//! [overlay]
+ Image { x: 21; y: 18; source: "overlay.png" }
+//! [overlay]
+}
diff --git a/examples/tutorials/ui-components/dialcontrol/content/QuitButton.qml b/examples/tutorials/ui-components/dialcontrol/content/QuitButton.qml
new file mode 100644
index 0000000000..702b892d23
--- /dev/null
+++ b/examples/tutorials/ui-components/dialcontrol/content/QuitButton.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+Image {
+ source: "quit.png"
+ scale: quitMouse.pressed ? 0.8 : 1.0
+ smooth: quitMouse.pressed
+ MouseArea {
+ id: quitMouse
+ anchors.fill: parent
+ anchors.margins: -10
+ onClicked: Qt.quit()
+ }
+}
diff --git a/examples/tutorials/ui-components/dialcontrol/content/background.png b/examples/tutorials/ui-components/dialcontrol/content/background.png
new file mode 100644
index 0000000000..75d555d7ab
--- /dev/null
+++ b/examples/tutorials/ui-components/dialcontrol/content/background.png
Binary files differ
diff --git a/examples/tutorials/ui-components/dialcontrol/content/needle.png b/examples/tutorials/ui-components/dialcontrol/content/needle.png
new file mode 100644
index 0000000000..2d19f75039
--- /dev/null
+++ b/examples/tutorials/ui-components/dialcontrol/content/needle.png
Binary files differ
diff --git a/examples/tutorials/ui-components/dialcontrol/content/needle_shadow.png b/examples/tutorials/ui-components/dialcontrol/content/needle_shadow.png
new file mode 100644
index 0000000000..8d8a928cc5
--- /dev/null
+++ b/examples/tutorials/ui-components/dialcontrol/content/needle_shadow.png
Binary files differ
diff --git a/examples/tutorials/ui-components/dialcontrol/content/overlay.png b/examples/tutorials/ui-components/dialcontrol/content/overlay.png
new file mode 100644
index 0000000000..3860a7b590
--- /dev/null
+++ b/examples/tutorials/ui-components/dialcontrol/content/overlay.png
Binary files differ
diff --git a/examples/tutorials/ui-components/dialcontrol/content/quit.png b/examples/tutorials/ui-components/dialcontrol/content/quit.png
new file mode 100644
index 0000000000..b822057d4e
--- /dev/null
+++ b/examples/tutorials/ui-components/dialcontrol/content/quit.png
Binary files differ
diff --git a/examples/tutorials/ui-components/dialcontrol/dialcontrol.qml b/examples/tutorials/ui-components/dialcontrol/dialcontrol.qml
new file mode 100644
index 0000000000..d645b34aa4
--- /dev/null
+++ b/examples/tutorials/ui-components/dialcontrol/dialcontrol.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//! [imports]
+import QtQuick 2.0
+import "content"
+//! [imports]
+
+//! [0]
+Rectangle {
+ color: "#545454"
+ width: 300; height: 300
+
+ // Dial with a slider to adjust it
+ Dial {
+ id: dial
+ anchors.centerIn: parent
+ value: slider.x * 100 / (container.width - 34)
+ }
+
+ Rectangle {
+ id: container
+ anchors { bottom: parent.bottom; left: parent.left
+ right: parent.right; leftMargin: 20; rightMargin: 20
+ bottomMargin: 10
+ }
+ height: 16
+
+ radius: 8
+ opacity: 0.7
+ smooth: true
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "gray" }
+ GradientStop { position: 1.0; color: "white" }
+ }
+
+ Rectangle {
+ id: slider
+ x: 1; y: 1; width: 30; height: 14
+ radius: 6
+ smooth: true
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "#424242" }
+ GradientStop { position: 1.0; color: "black" }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ anchors.margins: -16 // Increase mouse area a lot outside the slider
+ drag.target: parent; drag.axis: Drag.XAxis
+ drag.minimumX: 2; drag.maximumX: container.width - 32
+ }
+ }
+ }
+ QuitButton {
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.margins: 10
+ }
+}
+//! [0]
diff --git a/examples/tutorials/ui-components/flipable/content/5_heart.png b/examples/tutorials/ui-components/flipable/content/5_heart.png
new file mode 100644
index 0000000000..fb59d81453
--- /dev/null
+++ b/examples/tutorials/ui-components/flipable/content/5_heart.png
Binary files differ
diff --git a/examples/tutorials/ui-components/flipable/content/9_club.png b/examples/tutorials/ui-components/flipable/content/9_club.png
new file mode 100644
index 0000000000..2545001904
--- /dev/null
+++ b/examples/tutorials/ui-components/flipable/content/9_club.png
Binary files differ
diff --git a/examples/tutorials/ui-components/flipable/content/Card.qml b/examples/tutorials/ui-components/flipable/content/Card.qml
new file mode 100644
index 0000000000..6006ea14fc
--- /dev/null
+++ b/examples/tutorials/ui-components/flipable/content/Card.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Flipable {
+ id: container
+
+ property alias source: frontImage.source
+ property bool flipped: true
+ property int xAxis: 0
+ property int yAxis: 0
+ property int angle: 0
+
+ width: front.width; height: front.height
+
+ front: Image { id: frontImage; smooth: true }
+ back: Image { source: "back.png"; smooth: true }
+
+ state: "back"
+
+ MouseArea { anchors.fill: parent; onClicked: container.flipped = !container.flipped }
+
+ transform: Rotation {
+ id: rotation; origin.x: container.width / 2; origin.y: container.height / 2
+ axis.x: container.xAxis; axis.y: container.yAxis; axis.z: 0
+ }
+
+ states: State {
+ name: "back"; when: container.flipped
+ PropertyChanges { target: rotation; angle: container.angle }
+ }
+
+ transitions: Transition {
+ ParallelAnimation {
+ NumberAnimation { target: rotation; properties: "angle"; duration: 600 }
+ SequentialAnimation {
+ NumberAnimation { target: container; property: "scale"; to: 0.75; duration: 300 }
+ NumberAnimation { target: container; property: "scale"; to: 1.0; duration: 300 }
+ }
+ }
+ }
+}
diff --git a/examples/tutorials/ui-components/flipable/content/back.png b/examples/tutorials/ui-components/flipable/content/back.png
new file mode 100644
index 0000000000..f715d7487e
--- /dev/null
+++ b/examples/tutorials/ui-components/flipable/content/back.png
Binary files differ
diff --git a/examples/tutorials/ui-components/flipable/flipable.qml b/examples/tutorials/ui-components/flipable/flipable.qml
new file mode 100644
index 0000000000..4af64afc53
--- /dev/null
+++ b/examples/tutorials/ui-components/flipable/flipable.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ id: window
+
+ width: 480; height: 320
+ color: "darkgreen"
+
+ Row {
+ anchors.centerIn: parent; spacing: 30
+ Card { source: "content/9_club.png"; angle: 180; yAxis: 1 }
+ Card { source: "content/5_heart.png"; angle: 540; xAxis: 1 }
+ }
+}
diff --git a/examples/tutorials/ui-components/progressbar/content/ProgressBar.qml b/examples/tutorials/ui-components/progressbar/content/ProgressBar.qml
new file mode 100644
index 0000000000..c9be8d7336
--- /dev/null
+++ b/examples/tutorials/ui-components/progressbar/content/ProgressBar.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: progressbar
+
+ property int minimum: 0
+ property int maximum: 100
+ property int value: 0
+ property alias color: gradient1.color
+ property alias secondColor: gradient2.color
+
+ width: 250; height: 23
+ clip: true
+
+ BorderImage {
+ source: "background.png"
+ width: parent.width; height: parent.height
+ border { left: 4; top: 4; right: 4; bottom: 4 }
+ }
+
+ Rectangle {
+ id: highlight
+
+ property int widthDest: ((progressbar.width * (value - minimum)) / (maximum - minimum) - 6)
+
+ width: highlight.widthDest
+ Behavior on width { SmoothedAnimation { velocity: 1200 } }
+
+ anchors { left: parent.left; top: parent.top; bottom: parent.bottom; margins: 3 }
+ radius: 1
+ gradient: Gradient {
+ GradientStop { id: gradient1; position: 0.0 }
+ GradientStop { id: gradient2; position: 1.0 }
+ }
+
+ }
+ Text {
+ anchors { right: highlight.right; rightMargin: 6; verticalCenter: parent.verticalCenter }
+ color: "white"
+ font.bold: true
+ text: Math.floor((value - minimum) / (maximum - minimum) * 100) + '%'
+ }
+}
diff --git a/examples/tutorials/ui-components/progressbar/content/background.png b/examples/tutorials/ui-components/progressbar/content/background.png
new file mode 100644
index 0000000000..9044226f85
--- /dev/null
+++ b/examples/tutorials/ui-components/progressbar/content/background.png
Binary files differ
diff --git a/examples/tutorials/ui-components/progressbar/main.qml b/examples/tutorials/ui-components/progressbar/main.qml
new file mode 100644
index 0000000000..367e4c1265
--- /dev/null
+++ b/examples/tutorials/ui-components/progressbar/main.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ id: main
+
+ width: 600; height: 405
+ color: "#edecec"
+
+ Flickable {
+ anchors.fill: parent
+ contentHeight: column.height + 20
+
+ Column {
+ id: column
+ x: 10; y: 10
+ spacing: 10
+
+ Repeater {
+ model: 25
+
+ ProgressBar {
+ property int r: Math.floor(Math.random() * 5000 + 1000)
+ width: main.width - 20
+
+ NumberAnimation on value { duration: r; from: 0; to: 100; loops: Animation.Infinite }
+ ColorAnimation on color { duration: r; from: "lightsteelblue"; to: "thistle"; loops: Animation.Infinite }
+ ColorAnimation on secondColor { duration: r; from: "steelblue"; to: "#CD96CD"; loops: Animation.Infinite }
+ }
+ }
+ }
+ }
+}
diff --git a/examples/tutorials/ui-components/scrollbar/ScrollBar.qml b/examples/tutorials/ui-components/scrollbar/ScrollBar.qml
new file mode 100644
index 0000000000..a3d0d3841c
--- /dev/null
+++ b/examples/tutorials/ui-components/scrollbar/ScrollBar.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: scrollBar
+
+ // 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.
+ // orientation can be either Qt.Vertical or Qt.Horizontal
+ property real position
+ property real pageSize
+ property variant orientation : Qt.Vertical
+
+ // A light, semi-transparent background
+ Rectangle {
+ id: background
+ anchors.fill: parent
+ radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1)
+ color: "white"
+ opacity: 0.3
+ }
+
+ // Size the bar to the required size, depending upon the orientation.
+ Rectangle {
+ x: orientation == Qt.Vertical ? 1 : (scrollBar.position * (scrollBar.width-2) + 1)
+ y: orientation == Qt.Vertical ? (scrollBar.position * (scrollBar.height-2) + 1) : 1
+ width: orientation == Qt.Vertical ? (parent.width-2) : (scrollBar.pageSize * (scrollBar.width-2))
+ height: orientation == Qt.Vertical ? (scrollBar.pageSize * (scrollBar.height-2)) : (parent.height-2)
+ radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1)
+ color: "black"
+ opacity: 0.7
+ }
+}
diff --git a/examples/tutorials/ui-components/scrollbar/main.qml b/examples/tutorials/ui-components/scrollbar/main.qml
new file mode 100644
index 0000000000..a7d602b437
--- /dev/null
+++ b/examples/tutorials/ui-components/scrollbar/main.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ width: 640
+ height: 480
+
+ // Create a flickable to view a large image.
+ Flickable {
+ id: view
+ anchors.fill: parent
+ contentWidth: picture.width
+ contentHeight: picture.height
+
+ Image {
+ id: picture
+ source: "pics/niagara_falls.jpg"
+ asynchronous: true
+ }
+
+ // Only show the scrollbars when the view is moving.
+ states: State {
+ name: "ShowBars"
+ when: view.movingVertically || view.movingHorizontally
+ PropertyChanges { target: verticalScrollBar; opacity: 1 }
+ PropertyChanges { target: horizontalScrollBar; opacity: 1 }
+ }
+
+ transitions: Transition {
+ NumberAnimation { properties: "opacity"; duration: 400 }
+ }
+ }
+
+ // Attach scrollbars to the right and bottom edges of the view.
+ ScrollBar {
+ id: verticalScrollBar
+ width: 12; height: view.height-12
+ anchors.right: view.right
+ opacity: 0
+ orientation: Qt.Vertical
+ position: view.visibleArea.yPosition
+ pageSize: view.visibleArea.heightRatio
+ }
+
+ ScrollBar {
+ id: horizontalScrollBar
+ width: view.width-12; height: 12
+ anchors.bottom: view.bottom
+ opacity: 0
+ orientation: Qt.Horizontal
+ position: view.visibleArea.xPosition
+ pageSize: view.visibleArea.widthRatio
+ }
+}
diff --git a/examples/tutorials/ui-components/scrollbar/pics/niagara_falls.jpg b/examples/tutorials/ui-components/scrollbar/pics/niagara_falls.jpg
new file mode 100644
index 0000000000..e625c0d3e6
--- /dev/null
+++ b/examples/tutorials/ui-components/scrollbar/pics/niagara_falls.jpg
Binary files differ
diff --git a/examples/tutorials/ui-components/scrollbar/scrollbar.qmlproject b/examples/tutorials/ui-components/scrollbar/scrollbar.qmlproject
new file mode 100644
index 0000000000..e5a8bf02ca
--- /dev/null
+++ b/examples/tutorials/ui-components/scrollbar/scrollbar.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "main.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/tutorials/ui-components/searchbox/SearchBox.qml b/examples/tutorials/ui-components/searchbox/SearchBox.qml
new file mode 100644
index 0000000000..6f6f486412
--- /dev/null
+++ b/examples/tutorials/ui-components/searchbox/SearchBox.qml
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+FocusScope {
+ id: focusScope
+ width: 250; height: 28
+
+ BorderImage {
+ source: "images/lineedit-bg.png"
+ width: parent.width; height: parent.height
+ border { left: 4; top: 4; right: 4; bottom: 4 }
+ }
+
+ BorderImage {
+ source: "images/lineedit-bg-focus.png"
+ width: parent.width; height: parent.height
+ border { left: 4; top: 4; right: 4; bottom: 4 }
+ visible: parent.activeFocus ? true : false
+ }
+
+ Text {
+ id: typeSomething
+ anchors.fill: parent; anchors.leftMargin: 8
+ verticalAlignment: Text.AlignVCenter
+ text: "Type something..."
+ color: "gray"
+ font.italic: true
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { focusScope.focus = true; textInput.openSoftwareInputPanel(); }
+ }
+
+ TextInput {
+ id: textInput
+ anchors { left: parent.left; leftMargin: 8; right: clear.left; rightMargin: 8; verticalCenter: parent.verticalCenter }
+ focus: true
+ selectByMouse: true
+ }
+
+ Image {
+ id: clear
+ anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter }
+ source: "images/clear.png"
+ opacity: 0
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: { textInput.text = ''; focusScope.focus = true; textInput.openSoftwareInputPanel(); }
+ }
+ }
+
+ states: State {
+ name: "hasText"; when: textInput.text != ''
+ PropertyChanges { target: typeSomething; opacity: 0 }
+ PropertyChanges { target: clear; opacity: 1 }
+ }
+
+ transitions: [
+ Transition {
+ from: ""; to: "hasText"
+ NumberAnimation { exclude: typeSomething; properties: "opacity" }
+ },
+ Transition {
+ from: "hasText"; to: ""
+ NumberAnimation { properties: "opacity" }
+ }
+ ]
+}
diff --git a/examples/tutorials/ui-components/searchbox/images/clear.png b/examples/tutorials/ui-components/searchbox/images/clear.png
new file mode 100644
index 0000000000..91eb270695
--- /dev/null
+++ b/examples/tutorials/ui-components/searchbox/images/clear.png
Binary files differ
diff --git a/examples/tutorials/ui-components/searchbox/images/lineedit-bg-focus.png b/examples/tutorials/ui-components/searchbox/images/lineedit-bg-focus.png
new file mode 100644
index 0000000000..bbfac38d2d
--- /dev/null
+++ b/examples/tutorials/ui-components/searchbox/images/lineedit-bg-focus.png
Binary files differ
diff --git a/examples/tutorials/ui-components/searchbox/images/lineedit-bg.png b/examples/tutorials/ui-components/searchbox/images/lineedit-bg.png
new file mode 100644
index 0000000000..9044226f85
--- /dev/null
+++ b/examples/tutorials/ui-components/searchbox/images/lineedit-bg.png
Binary files differ
diff --git a/examples/tutorials/ui-components/searchbox/main.qml b/examples/tutorials/ui-components/searchbox/main.qml
new file mode 100644
index 0000000000..6e9731cf9c
--- /dev/null
+++ b/examples/tutorials/ui-components/searchbox/main.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Rectangle {
+ id: page
+ width: 500; height: 250
+ color: "#edecec"
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: page.focus = false;
+ }
+ Column {
+ anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter }
+ spacing: 10
+
+ SearchBox { id: search1; KeyNavigation.tab: search2; KeyNavigation.backtab: search3; focus: true }
+ SearchBox { id: search2; KeyNavigation.tab: search3; KeyNavigation.backtab: search1 }
+ SearchBox { id: search3; KeyNavigation.tab: search1; KeyNavigation.backtab: search2 }
+ }
+}
diff --git a/examples/tutorials/ui-components/searchbox/searchbox.qmlproject b/examples/tutorials/ui-components/searchbox/searchbox.qmlproject
new file mode 100644
index 0000000000..e5a8bf02ca
--- /dev/null
+++ b/examples/tutorials/ui-components/searchbox/searchbox.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "main.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/tutorials/ui-components/slideswitch/content/Switch.qml b/examples/tutorials/ui-components/slideswitch/content/Switch.qml
new file mode 100644
index 0000000000..981fc16673
--- /dev/null
+++ b/examples/tutorials/ui-components/slideswitch/content/Switch.qml
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//![0]
+import QtQuick 2.0
+
+Item {
+ id: toggleswitch
+ width: background.width; height: background.height
+
+//![1]
+ property bool on: false
+//![1]
+
+//![2]
+ function toggle() {
+ if (toggleswitch.state == "on")
+ toggleswitch.state = "off";
+ else
+ toggleswitch.state = "on";
+ }
+//![2]
+
+//![3]
+ function releaseSwitch() {
+ if (knob.x == 1) {
+ if (toggleswitch.state == "off") return;
+ }
+ if (knob.x == 78) {
+ if (toggleswitch.state == "on") return;
+ }
+ toggle();
+ }
+//![3]
+
+//![4]
+ Image {
+ id: background
+ source: "background.png"
+ MouseArea { anchors.fill: parent; onClicked: toggle() }
+ }
+//![4]
+
+//![5]
+ Image {
+ id: knob
+ x: 1; y: 2
+ source: "knob.png"
+
+ MouseArea {
+ anchors.fill: parent
+ drag.target: knob; drag.axis: Drag.XAxis; drag.minimumX: 1; drag.maximumX: 78
+ onClicked: toggle()
+ onReleased: releaseSwitch()
+ }
+ }
+//![5]
+
+//![6]
+ states: [
+ State {
+ name: "on"
+ PropertyChanges { target: knob; x: 78 }
+ PropertyChanges { target: toggleswitch; on: true }
+ },
+ State {
+ name: "off"
+ PropertyChanges { target: knob; x: 1 }
+ PropertyChanges { target: toggleswitch; on: false }
+ }
+ ]
+//![6]
+
+//![7]
+ transitions: Transition {
+ NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad; duration: 200 }
+ }
+//![7]
+}
+//![0]
diff --git a/examples/tutorials/ui-components/slideswitch/content/background.png b/examples/tutorials/ui-components/slideswitch/content/background.png
new file mode 100644
index 0000000000..d736815870
--- /dev/null
+++ b/examples/tutorials/ui-components/slideswitch/content/background.png
Binary files differ
diff --git a/examples/tutorials/ui-components/slideswitch/content/background.svg b/examples/tutorials/ui-components/slideswitch/content/background.svg
new file mode 100644
index 0000000000..f920d3e47a
--- /dev/null
+++ b/examples/tutorials/ui-components/slideswitch/content/background.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+]>
+<svg version="1.1"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ x="0px" y="0px" width="130px" height="56px" viewBox="0 0 130 56" enable-background="new 0 0 130 56" xml:space="preserve">
+<defs>
+</defs>
+<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-37.5005" y1="-66" x2="-37.5005" y2="-121.9985" gradientTransform="matrix(1 0 0 -1 102.5 -66)">
+ <stop offset="0.0056" style="stop-color:#000000"/>
+ <stop offset="1" style="stop-color:#EAECEF"/>
+</linearGradient>
+<path fill="url(#SVGID_1_)" d="M101.998,55.998H28c-15.439,0-28-12.562-28-28C0,12.56,12.561,0,28,0h73.998
+ c15.439,0,28,12.559,28,27.998C129.998,43.438,117.438,55.998,101.998,55.998L101.998,55.998z"/>
+<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="-5.5" y1="-132.1338" x2="-69.5002" y2="-55.8613" gradientTransform="matrix(1 0 0 -1 102.5 -66)">
+ <stop offset="0.0056" style="stop-color:#000000"/>
+ <stop offset="1" style="stop-color:#828385"/>
+</linearGradient>
+<path fill="url(#SVGID_2_)" d="M127.999,27.998c0,14.359-11.642,26-26,26h-74c-14.359,0-26-11.641-26-26l0,0
+ c0-14.359,11.641-26,26-26h74C116.357,1.998,127.999,13.639,127.999,27.998L127.999,27.998z"/>
+</svg>
diff --git a/examples/tutorials/ui-components/slideswitch/content/knob.png b/examples/tutorials/ui-components/slideswitch/content/knob.png
new file mode 100644
index 0000000000..ee0a436f84
--- /dev/null
+++ b/examples/tutorials/ui-components/slideswitch/content/knob.png
Binary files differ
diff --git a/examples/tutorials/ui-components/slideswitch/content/knob.svg b/examples/tutorials/ui-components/slideswitch/content/knob.svg
new file mode 100644
index 0000000000..fb6933718e
--- /dev/null
+++ b/examples/tutorials/ui-components/slideswitch/content/knob.svg
@@ -0,0 +1,867 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ x="0px"
+ y="0px"
+ width="52px"
+ height="52px"
+ viewBox="0 0 52 52"
+ enable-background="new 0 0 52 52"
+ xml:space="preserve"
+ id="svg3883"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ sodipodi:docname="knob_on.svg"
+ sodipodi:docbase="/local/axel/embeddedwidgets/embeddedstories/skins/svgslideswitch/MetallicBrush"><metadata
+ id="metadata4200"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><sodipodi:namedview
+ inkscape:window-height="640"
+ inkscape:window-width="937"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:zoom="8.3653846"
+ inkscape:cx="26.000002"
+ inkscape:cy="26"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:current-layer="svg3883" />
+<defs
+ id="defs3885">
+</defs>
+<linearGradient
+ id="SVGID_1_"
+ gradientUnits="userSpaceOnUse"
+ x1="-59.7866"
+ y1="-115.917"
+ x2="-93.2123"
+ y2="-76.0818"
+ gradientTransform="matrix(1,0,0,-1,102.5,-70)">
+ <stop
+ offset="0.0056"
+ style="stop-color:#000000"
+ id="stop3888" />
+ <stop
+ offset="1"
+ style="stop-color:#EAECEF"
+ id="stop3890" />
+</linearGradient>
+<circle
+ cx="26"
+ cy="26"
+ r="26"
+ id="circle3892"
+ style="fill:url(#SVGID_1_)"
+ sodipodi:cx="26"
+ sodipodi:cy="26"
+ sodipodi:rx="26"
+ sodipodi:ry="26"
+ transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
+<linearGradient
+ id="SVGID_2_"
+ gradientUnits="userSpaceOnUse"
+ x1="-100.5"
+ y1="-96"
+ x2="-52.5"
+ y2="-96"
+ gradientTransform="matrix(1,0,0,-1,102.5,-70)">
+ <stop
+ offset="0.0056"
+ style="stop-color:#8AADCE"
+ id="stop3895" />
+ <stop
+ offset="0.5"
+ style="stop-color:#EAECEF"
+ id="stop3897" />
+ <stop
+ offset="0.6043"
+ style="stop-color:#E7EAED"
+ id="stop3899" />
+ <stop
+ offset="0.6751"
+ style="stop-color:#DEE4E7"
+ id="stop3901" />
+ <stop
+ offset="0.7358"
+ style="stop-color:#CFD9DD"
+ id="stop3903" />
+ <stop
+ offset="0.791"
+ style="stop-color:#B9CACF"
+ id="stop3905" />
+ <stop
+ offset="0.8425"
+ style="stop-color:#9EB6BD"
+ id="stop3907" />
+ <stop
+ offset="0.891"
+ style="stop-color:#7B9EA7"
+ id="stop3909" />
+ <stop
+ offset="0.9374"
+ style="stop-color:#53828C"
+ id="stop3911" />
+ <stop
+ offset="0.9809"
+ style="stop-color:#25626E"
+ id="stop3913" />
+ <stop
+ offset="1"
+ style="stop-color:#0E525F"
+ id="stop3915" />
+</linearGradient>
+<circle
+ cx="26"
+ cy="26"
+ r="24"
+ id="circle3917"
+ style="fill:url(#SVGID_2_)"
+ sodipodi:cx="26"
+ sodipodi:cy="26"
+ sodipodi:rx="24"
+ sodipodi:ry="24"
+ transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
+<linearGradient
+ id="SVGID_3_"
+ gradientUnits="userSpaceOnUse"
+ x1="-98.6328"
+ y1="-96"
+ x2="-54.3672"
+ y2="-96"
+ gradientTransform="matrix(1,0,0,-1,102.5,-70)">
+ <stop
+ offset="0.0056"
+ style="stop-color:#8AADCE"
+ id="stop3920" />
+ <stop
+ offset="0.073"
+ style="stop-color:#8FAECB"
+ id="stop3922" />
+ <stop
+ offset="0.5"
+ style="stop-color:#EAECEF"
+ id="stop3924" />
+ <stop
+ offset="0.5902"
+ style="stop-color:#E7E9ED"
+ id="stop3926" />
+ <stop
+ offset="0.618"
+ style="stop-color:#E4E7EB"
+ id="stop3928" />
+ <stop
+ offset="0.6697"
+ style="stop-color:#E0E4E9"
+ id="stop3930" />
+ <stop
+ offset="0.7211"
+ style="stop-color:#D4DCE1"
+ id="stop3932" />
+ <stop
+ offset="0.7722"
+ style="stop-color:#C0CFD5"
+ id="stop3934" />
+ <stop
+ offset="0.809"
+ style="stop-color:#ADC2C9"
+ id="stop3936" />
+ <stop
+ offset="1"
+ style="stop-color:#0E525F"
+ id="stop3938" />
+</linearGradient>
+<circle
+ cx="26"
+ cy="26"
+ r="22.132999"
+ id="circle3940"
+ style="fill:url(#SVGID_3_)"
+ sodipodi:cx="26"
+ sodipodi:cy="26"
+ sodipodi:rx="22.132999"
+ sodipodi:ry="22.132999"
+ transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
+<linearGradient
+ id="SVGID_4_"
+ gradientUnits="userSpaceOnUse"
+ x1="-96.7671"
+ y1="-96"
+ x2="-56.2324"
+ y2="-96"
+ gradientTransform="matrix(1,0,0,-1,102.5,-70)">
+ <stop
+ offset="0.0056"
+ style="stop-color:#8AADCE"
+ id="stop3943" />
+ <stop
+ offset="0.073"
+ style="stop-color:#86A7C4"
+ id="stop3945" />
+ <stop
+ offset="0.5"
+ style="stop-color:#EAECEF"
+ id="stop3947" />
+ <stop
+ offset="0.577"
+ style="stop-color:#E7EAED"
+ id="stop3949" />
+ <stop
+ offset="0.618"
+ style="stop-color:#E1E6EA"
+ id="stop3951" />
+ <stop
+ offset="0.6697"
+ style="stop-color:#DDE3E8"
+ id="stop3953" />
+ <stop
+ offset="0.7211"
+ style="stop-color:#D1DBE1"
+ id="stop3955" />
+ <stop
+ offset="0.7722"
+ style="stop-color:#BDCDD5"
+ id="stop3957" />
+ <stop
+ offset="0.809"
+ style="stop-color:#AAC0CA"
+ id="stop3959" />
+ <stop
+ offset="1"
+ style="stop-color:#0E525F"
+ id="stop3961" />
+</linearGradient>
+<circle
+ cx="26"
+ cy="26"
+ r="20.267"
+ id="circle3963"
+ style="fill:url(#SVGID_4_)"
+ sodipodi:cx="26"
+ sodipodi:cy="26"
+ sodipodi:rx="20.267"
+ sodipodi:ry="20.267"
+ transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
+<linearGradient
+ id="SVGID_5_"
+ gradientUnits="userSpaceOnUse"
+ x1="-94.8999"
+ y1="-96"
+ x2="-58.0996"
+ y2="-96"
+ gradientTransform="matrix(1,0,0,-1,102.5,-70)">
+ <stop
+ offset="0.0056"
+ style="stop-color:#8AADCE"
+ id="stop3966" />
+ <stop
+ offset="0.073"
+ style="stop-color:#7E9FBC"
+ id="stop3968" />
+ <stop
+ offset="0.5"
+ style="stop-color:#EAECEF"
+ id="stop3970" />
+ <stop
+ offset="0.5709"
+ style="stop-color:#E6E9ED"
+ id="stop3972" />
+ <stop
+ offset="0.618"
+ style="stop-color:#DFE4E9"
+ id="stop3974" />
+ <stop
+ offset="0.6687"
+ style="stop-color:#DBE1E7"
+ id="stop3976" />
+ <stop
+ offset="0.7193"
+ style="stop-color:#CFD9E0"
+ id="stop3978" />
+ <stop
+ offset="0.7695"
+ style="stop-color:#BBCCD6"
+ id="stop3980" />
+ <stop
+ offset="0.809"
+ style="stop-color:#A6BECA"
+ id="stop3982" />
+ <stop
+ offset="1"
+ style="stop-color:#0E525F"
+ id="stop3984" />
+</linearGradient>
+<circle
+ cx="26"
+ cy="26"
+ r="18.4"
+ id="circle3986"
+ style="fill:url(#SVGID_5_)"
+ sodipodi:cx="26"
+ sodipodi:cy="26"
+ sodipodi:rx="18.4"
+ sodipodi:ry="18.4"
+ transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
+<linearGradient
+ id="SVGID_6_"
+ gradientUnits="userSpaceOnUse"
+ x1="-93.0332"
+ y1="-96"
+ x2="-59.9668"
+ y2="-96"
+ gradientTransform="matrix(1,0,0,-1,102.5,-70)">
+ <stop
+ offset="0.0056"
+ style="stop-color:#8AADCE"
+ id="stop3989" />
+ <stop
+ offset="0.073"
+ style="stop-color:#7697B4"
+ id="stop3991" />
+ <stop
+ offset="0.5"
+ style="stop-color:#EAECEF"
+ id="stop3993" />
+ <stop
+ offset="0.5636"
+ style="stop-color:#E6E9ED"
+ id="stop3995" />
+ <stop
+ offset="0.618"
+ style="stop-color:#DCE2E8"
+ id="stop3997" />
+ <stop
+ offset="0.6687"
+ style="stop-color:#D8DFE6"
+ id="stop3999" />
+ <stop
+ offset="0.7193"
+ style="stop-color:#CCD7E0"
+ id="stop4001" />
+ <stop
+ offset="0.7695"
+ style="stop-color:#B8CAD5"
+ id="stop4003" />
+ <stop
+ offset="0.809"
+ style="stop-color:#A3BCCA"
+ id="stop4005" />
+ <stop
+ offset="1"
+ style="stop-color:#0E525F"
+ id="stop4007" />
+</linearGradient>
+<circle
+ cx="26"
+ cy="26"
+ r="16.533001"
+ id="circle4009"
+ style="fill:url(#SVGID_6_)"
+ sodipodi:cx="26"
+ sodipodi:cy="26"
+ sodipodi:rx="16.533001"
+ sodipodi:ry="16.533001"
+ transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
+<linearGradient
+ id="SVGID_7_"
+ gradientUnits="userSpaceOnUse"
+ x1="-91.167"
+ y1="-96"
+ x2="-61.833"
+ y2="-96"
+ gradientTransform="matrix(1,0,0,-1,102.5,-70)">
+ <stop
+ offset="0.0056"
+ style="stop-color:#8AADCE"
+ id="stop4012" />
+ <stop
+ offset="0.073"
+ style="stop-color:#6D8FAD"
+ id="stop4014" />
+ <stop
+ offset="0.5"
+ style="stop-color:#EAECEF"
+ id="stop4016" />
+ <stop
+ offset="0.5605"
+ style="stop-color:#E5E8EC"
+ id="stop4018" />
+ <stop
+ offset="0.618"
+ style="stop-color:#DAE1E7"
+ id="stop4020" />
+ <stop
+ offset="0.6679"
+ style="stop-color:#D6DEE5"
+ id="stop4022" />
+ <stop
+ offset="0.7175"
+ style="stop-color:#CAD6DF"
+ id="stop4024" />
+ <stop
+ offset="0.7669"
+ style="stop-color:#B6C9D6"
+ id="stop4026" />
+ <stop
+ offset="0.809"
+ style="stop-color:#9FBACB"
+ id="stop4028" />
+ <stop
+ offset="1"
+ style="stop-color:#0E525F"
+ id="stop4030" />
+</linearGradient>
+<circle
+ cx="26"
+ cy="26"
+ r="14.667"
+ id="circle4032"
+ style="fill:url(#SVGID_7_)"
+ sodipodi:cx="26"
+ sodipodi:cy="26"
+ sodipodi:rx="14.667"
+ sodipodi:ry="14.667"
+ transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
+<linearGradient
+ id="SVGID_8_"
+ gradientUnits="userSpaceOnUse"
+ x1="-89.2998"
+ y1="-96"
+ x2="-63.7002"
+ y2="-96"
+ gradientTransform="matrix(1,0,0,-1,102.5,-70)">
+ <stop
+ offset="0.0056"
+ style="stop-color:#8AADCE"
+ id="stop4035" />
+ <stop
+ offset="0.073"
+ style="stop-color:#6587A5"
+ id="stop4037" />
+ <stop
+ offset="0.5"
+ style="stop-color:#EAECEF"
+ id="stop4039" />
+ <stop
+ offset="0.5588"
+ style="stop-color:#E4E8EC"
+ id="stop4041" />
+ <stop
+ offset="0.618"
+ style="stop-color:#D8DFE7"
+ id="stop4043" />
+ <stop
+ offset="0.6675"
+ style="stop-color:#D4DCE5"
+ id="stop4045" />
+ <stop
+ offset="0.7167"
+ style="stop-color:#C8D5E0"
+ id="stop4047" />
+ <stop
+ offset="0.7657"
+ style="stop-color:#B4C8D6"
+ id="stop4049" />
+ <stop
+ offset="0.809"
+ style="stop-color:#9CB8CB"
+ id="stop4051" />
+ <stop
+ offset="1"
+ style="stop-color:#0E525F"
+ id="stop4053" />
+</linearGradient>
+<circle
+ cx="26"
+ cy="26"
+ r="12.8"
+ id="circle4055"
+ style="fill:url(#SVGID_8_)"
+ sodipodi:cx="26"
+ sodipodi:cy="26"
+ sodipodi:rx="12.8"
+ sodipodi:ry="12.8"
+ transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
+<linearGradient
+ id="SVGID_9_"
+ gradientUnits="userSpaceOnUse"
+ x1="-87.4331"
+ y1="-96"
+ x2="-65.5664"
+ y2="-96"
+ gradientTransform="matrix(1,0,0,-1,102.5,-70)">
+ <stop
+ offset="0.0056"
+ style="stop-color:#8AADCE"
+ id="stop4058" />
+ <stop
+ offset="0.073"
+ style="stop-color:#5D809D"
+ id="stop4060" />
+ <stop
+ offset="0.5"
+ style="stop-color:#EAECEF"
+ id="stop4062" />
+ <stop
+ offset="0.5567"
+ style="stop-color:#E3E7EC"
+ id="stop4064" />
+ <stop
+ offset="0.618"
+ style="stop-color:#D5DDE6"
+ id="stop4066" />
+ <stop
+ offset="0.6671"
+ style="stop-color:#D1DAE4"
+ id="stop4068" />
+ <stop
+ offset="0.7159"
+ style="stop-color:#C5D3DF"
+ id="stop4070" />
+ <stop
+ offset="0.7645"
+ style="stop-color:#B1C6D6"
+ id="stop4072" />
+ <stop
+ offset="0.809"
+ style="stop-color:#98B5CB"
+ id="stop4074" />
+ <stop
+ offset="1"
+ style="stop-color:#0E525F"
+ id="stop4076" />
+</linearGradient>
+<circle
+ cx="26"
+ cy="26"
+ r="10.933"
+ id="circle4078"
+ style="fill:url(#SVGID_9_)"
+ sodipodi:cx="26"
+ sodipodi:cy="26"
+ sodipodi:rx="10.933"
+ sodipodi:ry="10.933"
+ transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
+<linearGradient
+ id="SVGID_10_"
+ gradientUnits="userSpaceOnUse"
+ x1="-85.5659"
+ y1="-96"
+ x2="-67.4336"
+ y2="-96"
+ gradientTransform="matrix(1,0,0,-1,102.5,-70)">
+ <stop
+ offset="0.0056"
+ style="stop-color:#8AADCE"
+ id="stop4081" />
+ <stop
+ offset="0.073"
+ style="stop-color:#547896"
+ id="stop4083" />
+ <stop
+ offset="0.5"
+ style="stop-color:#EAECEF"
+ id="stop4085" />
+ <stop
+ offset="0.5588"
+ style="stop-color:#E1E6EB"
+ id="stop4087" />
+ <stop
+ offset="0.618"
+ style="stop-color:#D3DCE5"
+ id="stop4089" />
+ <stop
+ offset="0.6663"
+ style="stop-color:#CFD9E3"
+ id="stop4091" />
+ <stop
+ offset="0.7143"
+ style="stop-color:#C3D2DF"
+ id="stop4093" />
+ <stop
+ offset="0.7621"
+ style="stop-color:#AFC5D7"
+ id="stop4095" />
+ <stop
+ offset="0.809"
+ style="stop-color:#94B3CC"
+ id="stop4097" />
+ <stop
+ offset="1"
+ style="stop-color:#0E525F"
+ id="stop4099" />
+</linearGradient>
+<circle
+ cx="26"
+ cy="26"
+ r="9.066"
+ id="circle4101"
+ style="fill:url(#SVGID_10_)"
+ sodipodi:cx="26"
+ sodipodi:cy="26"
+ sodipodi:rx="9.066"
+ sodipodi:ry="9.066"
+ transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
+<linearGradient
+ id="SVGID_11_"
+ gradientUnits="userSpaceOnUse"
+ x1="-83.7002"
+ y1="-96"
+ x2="-69.2998"
+ y2="-96"
+ gradientTransform="matrix(1,0,0,-1,102.5,-70)">
+ <stop
+ offset="0.0056"
+ style="stop-color:#8AADCE"
+ id="stop4104" />
+ <stop
+ offset="0.073"
+ style="stop-color:#4C708E"
+ id="stop4106" />
+ <stop
+ offset="0.5"
+ style="stop-color:#EAECEF"
+ id="stop4108" />
+ <stop
+ offset="0.5625"
+ style="stop-color:#DEE4EA"
+ id="stop4110" />
+ <stop
+ offset="0.618"
+ style="stop-color:#D0DAE4"
+ id="stop4112" />
+ <stop
+ offset="0.6663"
+ style="stop-color:#CCD7E2"
+ id="stop4114" />
+ <stop
+ offset="0.7143"
+ style="stop-color:#C0D0DE"
+ id="stop4116" />
+ <stop
+ offset="0.7621"
+ style="stop-color:#ACC3D6"
+ id="stop4118" />
+ <stop
+ offset="0.809"
+ style="stop-color:#91B1CC"
+ id="stop4120" />
+ <stop
+ offset="1"
+ style="stop-color:#0E525F"
+ id="stop4122" />
+</linearGradient>
+<circle
+ cx="26"
+ cy="26"
+ r="7.1999998"
+ id="circle4124"
+ style="fill:url(#SVGID_11_)"
+ sodipodi:cx="26"
+ sodipodi:cy="26"
+ sodipodi:rx="7.1999998"
+ sodipodi:ry="7.1999998"
+ transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
+<linearGradient
+ id="SVGID_12_"
+ gradientUnits="userSpaceOnUse"
+ x1="-81.833"
+ y1="-96"
+ x2="-71.167"
+ y2="-96"
+ gradientTransform="matrix(1,0,0,-1,102.5,-70)">
+ <stop
+ offset="0.0056"
+ style="stop-color:#8AADCE"
+ id="stop4127" />
+ <stop
+ offset="0.073"
+ style="stop-color:#446986"
+ id="stop4129" />
+ <stop
+ offset="0.5"
+ style="stop-color:#EAECEF"
+ id="stop4131" />
+ <stop
+ offset="0.5757"
+ style="stop-color:#D9E0E8"
+ id="stop4133" />
+ <stop
+ offset="0.618"
+ style="stop-color:#CED8E3"
+ id="stop4135" />
+ <stop
+ offset="0.6655"
+ style="stop-color:#CAD5E2"
+ id="stop4137" />
+ <stop
+ offset="0.7129"
+ style="stop-color:#BECEDD"
+ id="stop4139" />
+ <stop
+ offset="0.7601"
+ style="stop-color:#AAC1D6"
+ id="stop4141" />
+ <stop
+ offset="0.807"
+ style="stop-color:#8EB0CC"
+ id="stop4143" />
+ <stop
+ offset="0.809"
+ style="stop-color:#8DAFCC"
+ id="stop4145" />
+ <stop
+ offset="1"
+ style="stop-color:#0E525F"
+ id="stop4147" />
+</linearGradient>
+<circle
+ cx="26"
+ cy="26"
+ r="5.3330002"
+ id="circle4149"
+ style="fill:url(#SVGID_12_)"
+ sodipodi:cx="26"
+ sodipodi:cy="26"
+ sodipodi:rx="5.3330002"
+ sodipodi:ry="5.3330002"
+ transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
+<linearGradient
+ id="SVGID_13_"
+ gradientUnits="userSpaceOnUse"
+ x1="-79.9658"
+ y1="-96"
+ x2="-73.0342"
+ y2="-96"
+ gradientTransform="matrix(1,0,0,-1,102.5,-70)">
+ <stop
+ offset="0.0056"
+ style="stop-color:#8AADCE"
+ id="stop4152" />
+ <stop
+ offset="0.073"
+ style="stop-color:#3B617F"
+ id="stop4154" />
+ <stop
+ offset="0.5"
+ style="stop-color:#EAECEF"
+ id="stop4156" />
+ <stop
+ offset="0.6087"
+ style="stop-color:#CED9E3"
+ id="stop4158" />
+ <stop
+ offset="0.618"
+ style="stop-color:#CBD7E2"
+ id="stop4160" />
+ <stop
+ offset="0.6655"
+ style="stop-color:#C7D4E1"
+ id="stop4162" />
+ <stop
+ offset="0.7129"
+ style="stop-color:#BBCDDD"
+ id="stop4164" />
+ <stop
+ offset="0.7601"
+ style="stop-color:#A7C0D6"
+ id="stop4166" />
+ <stop
+ offset="0.807"
+ style="stop-color:#8BAECD"
+ id="stop4168" />
+ <stop
+ offset="0.809"
+ style="stop-color:#8AADCD"
+ id="stop4170" />
+ <stop
+ offset="1"
+ style="stop-color:#0E525F"
+ id="stop4172" />
+</linearGradient>
+<circle
+ cx="26"
+ cy="26"
+ r="3.4660001"
+ id="circle4174"
+ style="fill:url(#SVGID_13_)"
+ sodipodi:cx="26"
+ sodipodi:cy="26"
+ sodipodi:rx="3.4660001"
+ sodipodi:ry="3.4660001"
+ transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
+<linearGradient
+ id="SVGID_14_"
+ gradientUnits="userSpaceOnUse"
+ x1="-78.1001"
+ y1="-96"
+ x2="-74.9004"
+ y2="-96"
+ gradientTransform="matrix(1,0,0,-1,102.5,-70)">
+ <stop
+ offset="0.0056"
+ style="stop-color:#8AADCE"
+ id="stop4177" />
+ <stop
+ offset="0.073"
+ style="stop-color:#335977"
+ id="stop4179" />
+ <stop
+ offset="0.5"
+ style="stop-color:#EAECEF"
+ id="stop4181" />
+ <stop
+ offset="0.618"
+ style="stop-color:#C9D5E1"
+ id="stop4183" />
+ <stop
+ offset="0.6648"
+ style="stop-color:#C5D3E0"
+ id="stop4185" />
+ <stop
+ offset="0.7114"
+ style="stop-color:#B9CBDC"
+ id="stop4187" />
+ <stop
+ offset="0.758"
+ style="stop-color:#A5BFD6"
+ id="stop4189" />
+ <stop
+ offset="0.8042"
+ style="stop-color:#89ADCE"
+ id="stop4191" />
+ <stop
+ offset="0.809"
+ style="stop-color:#86ABCD"
+ id="stop4193" />
+ <stop
+ offset="1"
+ style="stop-color:#0E525F"
+ id="stop4195" />
+</linearGradient>
+<circle
+ cx="26"
+ cy="26"
+ r="1.6"
+ id="circle4197"
+ style="fill:url(#SVGID_14_)"
+ sodipodi:cx="26"
+ sodipodi:cy="26"
+ sodipodi:rx="1.6"
+ sodipodi:ry="1.6"
+ transform="matrix(0.923077,0,0,0.923077,2,1.999996)" />
+</svg> \ No newline at end of file
diff --git a/examples/tutorials/ui-components/slideswitch/slideswitch.qml b/examples/tutorials/ui-components/slideswitch/slideswitch.qml
new file mode 100644
index 0000000000..60a331407c
--- /dev/null
+++ b/examples/tutorials/ui-components/slideswitch/slideswitch.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ color: "white"
+ width: 400; height: 250
+
+//![0]
+ Switch { anchors.centerIn: parent; on: false }
+//![0]
+}
diff --git a/examples/tutorials/ui-components/spinner/content/Spinner.qml b/examples/tutorials/ui-components/spinner/content/Spinner.qml
new file mode 100644
index 0000000000..d7bbeb33ee
--- /dev/null
+++ b/examples/tutorials/ui-components/spinner/content/Spinner.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Image {
+ property alias model: view.model
+ property alias delegate: view.delegate
+ property alias currentIndex: view.currentIndex
+ property real itemHeight: 30
+
+ source: "spinner-bg.png"
+ clip: true
+
+ PathView {
+ id: view
+ anchors.fill: parent
+
+ pathItemCount: height/itemHeight
+ preferredHighlightBegin: 0.5
+ preferredHighlightEnd: 0.5
+ highlight: Image { source: "spinner-select.png"; width: view.width; height: itemHeight+4 }
+ dragMargin: view.width/2
+
+ path: Path {
+ startX: view.width/2; startY: -itemHeight/2
+ PathLine { x: view.width/2; y: view.pathItemCount*itemHeight + itemHeight }
+ }
+ }
+
+ Keys.onDownPressed: view.incrementCurrentIndex()
+ Keys.onUpPressed: view.decrementCurrentIndex()
+}
diff --git a/examples/tutorials/ui-components/spinner/content/spinner-bg.png b/examples/tutorials/ui-components/spinner/content/spinner-bg.png
new file mode 100644
index 0000000000..b3556f1f9f
--- /dev/null
+++ b/examples/tutorials/ui-components/spinner/content/spinner-bg.png
Binary files differ
diff --git a/examples/tutorials/ui-components/spinner/content/spinner-select.png b/examples/tutorials/ui-components/spinner/content/spinner-select.png
new file mode 100644
index 0000000000..95a17a1fe2
--- /dev/null
+++ b/examples/tutorials/ui-components/spinner/content/spinner-select.png
Binary files differ
diff --git a/examples/tutorials/ui-components/spinner/main.qml b/examples/tutorials/ui-components/spinner/main.qml
new file mode 100644
index 0000000000..7584c98396
--- /dev/null
+++ b/examples/tutorials/ui-components/spinner/main.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import "content"
+
+Rectangle {
+ width: 240; height: 320
+
+ Column {
+ y: 20; x: 20; spacing: 20
+
+ Spinner {
+ id: spinner
+ width: 200; height: 240
+ focus: true
+ model: 20
+ itemHeight: 30
+ delegate: Text { font.pixelSize: 25; text: index; height: 30 }
+ }
+
+ Text { text: "Current item index: " + spinner.currentIndex }
+ }
+}
diff --git a/examples/tutorials/ui-components/spinner/spinner.qmlproject b/examples/tutorials/ui-components/spinner/spinner.qmlproject
new file mode 100644
index 0000000000..e5a8bf02ca
--- /dev/null
+++ b/examples/tutorials/ui-components/spinner/spinner.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "main.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/tutorials/ui-components/tabwidget/TabWidget.qml b/examples/tutorials/ui-components/tabwidget/TabWidget.qml
new file mode 100644
index 0000000000..560ed1f58a
--- /dev/null
+++ b/examples/tutorials/ui-components/tabwidget/TabWidget.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: tabWidget
+
+ // Setting the default property to stack.children means any child items
+ // of the TabWidget are actually added to the 'stack' item's children.
+ // See the "Property Binding"
+ // documentation for details on default properties.
+ default property alias content: stack.children
+
+ property int current: 0
+
+ onCurrentChanged: setOpacities()
+ Component.onCompleted: setOpacities()
+
+ function setOpacities() {
+ for (var i = 0; i < stack.children.length; ++i) {
+ stack.children[i].opacity = (i == current ? 1 : 0)
+ }
+ }
+
+ Row {
+ id: header
+
+ Repeater {
+ model: stack.children.length
+ delegate: Rectangle {
+ width: tabWidget.width / stack.children.length; height: 36
+
+ Rectangle {
+ width: parent.width; height: 1
+ anchors { bottom: parent.bottom; bottomMargin: 1 }
+ color: "#acb2c2"
+ }
+ BorderImage {
+ anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 }
+ border { left: 7; right: 7 }
+ source: "tab.png"
+ visible: tabWidget.current == index
+ }
+ Text {
+ horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter
+ anchors.fill: parent
+ text: stack.children[index].title
+ elide: Text.ElideRight
+ font.bold: tabWidget.current == index
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: tabWidget.current = index
+ }
+ }
+ }
+ }
+
+ Item {
+ id: stack
+ width: tabWidget.width
+ anchors.top: header.bottom; anchors.bottom: tabWidget.bottom
+ }
+}
diff --git a/examples/tutorials/ui-components/tabwidget/main.qml b/examples/tutorials/ui-components/tabwidget/main.qml
new file mode 100644
index 0000000000..df99c11b7d
--- /dev/null
+++ b/examples/tutorials/ui-components/tabwidget/main.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+TabWidget {
+ id: tabs
+ width: 640; height: 480
+
+ Rectangle {
+ property string title: "Red"
+ anchors.fill: parent
+ color: "#e3e3e3"
+
+ Rectangle {
+ anchors.fill: parent; anchors.margins: 20
+ color: "#ff7f7f"
+ Text {
+ width: parent.width - 20
+ anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter
+ text: "Roses are red"
+ font.pixelSize: 20
+ wrapMode: Text.WordWrap
+ }
+ }
+ }
+
+ Rectangle {
+ property string title: "Green"
+ anchors.fill: parent
+ color: "#e3e3e3"
+
+ Rectangle {
+ anchors.fill: parent; anchors.margins: 20
+ color: "#7fff7f"
+ Text {
+ width: parent.width - 20
+ anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter
+ text: "Flower stems are green"
+ font.pixelSize: 20
+ wrapMode: Text.WordWrap
+ }
+ }
+ }
+
+ Rectangle {
+ property string title: "Blue"
+ anchors.fill: parent; color: "#e3e3e3"
+
+ Rectangle {
+ anchors.fill: parent; anchors.margins: 20
+ color: "#7f7fff"
+ Text {
+ width: parent.width - 20
+ anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter
+ text: "Violets are blue"
+ font.pixelSize: 20
+ wrapMode: Text.WordWrap
+ }
+ }
+ }
+}
diff --git a/examples/tutorials/ui-components/tabwidget/tab.png b/examples/tutorials/ui-components/tabwidget/tab.png
new file mode 100644
index 0000000000..ad8021605f
--- /dev/null
+++ b/examples/tutorials/ui-components/tabwidget/tab.png
Binary files differ
diff --git a/examples/tutorials/ui-components/tabwidget/tabwidget.qmlproject b/examples/tutorials/ui-components/tabwidget/tabwidget.qmlproject
new file mode 100644
index 0000000000..e5a8bf02ca
--- /dev/null
+++ b/examples/tutorials/ui-components/tabwidget/tabwidget.qmlproject
@@ -0,0 +1,16 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "main.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+}
diff --git a/examples/window/Window.qml b/examples/window/Window.qml
new file mode 100644
index 0000000000..48478458c6
--- /dev/null
+++ b/examples/window/Window.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Window 2.0 as Window
+
+Window.Window {
+ width: 640
+ height: 480
+ visible: true //It's false by default
+ property Component self
+ Component.onCompleted: self = Qt.createComponent("Window.qml")
+ Text{
+ text: "Hello World!"
+ anchors.centerIn: parent
+ }
+ MouseArea{
+ anchors.fill: parent
+ onClicked: self.createObject();
+ }
+}
diff --git a/examples/window/screen/screenInfo.qml b/examples/window/screen/screenInfo.qml
new file mode 100644
index 0000000000..54299ba4e0
--- /dev/null
+++ b/examples/window/screen/screenInfo.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Window 2.0 as Window
+
+Item {
+ id: root
+ width: 400
+ height: 200
+ Item {
+ id: main
+ state: "orientation " + Window.Screen.orientation
+
+ property bool landscapeWindow: Window.Screen.primaryOrientation == Qt.LandscapeOrientation
+ property real baseWidth: landscapeWindow ? root.height : root.width
+ property real baseHeight: landscapeWindow ? root.width : root.height
+ property real rotationDelta: landscapeWindow ? -90 : 0
+
+ rotation: rotationDelta
+ width: main.baseWidth
+ height: main.baseHeight
+ anchors.centerIn: parent
+
+ Text {
+ text: "Screen is " + Window.Screen.width + "x" + Window.Screen.height + " and primarily orientation " + Window.Screen.primaryOrientation
+ anchors.centerIn:parent
+ }
+
+
+ states: [
+ State {
+ name: "orientation " + Qt.LandscapeOrientation
+ PropertyChanges { target: main; rotation: 90 + rotationDelta; width: main.baseHeight; height: main.baseWidth }
+ },
+ State {
+ name: "orientation " + Qt.InvertedPortraitOrientation
+ PropertyChanges { target: main; rotation: 180 + rotationDelta; }
+ },
+ State {
+ name: "orientation " + Qt.InvertedLandscapeOrientation
+ PropertyChanges { target: main; rotation: 270 + rotationDelta; width: main.baseHeight; height: main.baseWidth }
+ }
+ ]
+
+ transitions: Transition {
+ SequentialAnimation {
+ RotationAnimation { direction: RotationAnimation.Shortest; duration: 300; easing.type: Easing.InOutQuint }
+ NumberAnimation { properties: "x,y,width,height"; duration: 300; easing.type: Easing.InOutQuint }
+ }
+ }
+ }
+}
diff --git a/examples/window/standalone.qml b/examples/window/standalone.qml
new file mode 100644
index 0000000000..335cf7b635
--- /dev/null
+++ b/examples/window/standalone.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Window 2.0 as Window
+
+Item {
+ width: 640
+ height: 480
+ Text {
+ anchors.centerIn: parent
+ text: "First Window"
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: Qt.quit()
+ }
+ Window.Window {
+ width: 640
+ height: 480
+ x: 640
+ y: 480
+ visible: true
+ color: "green"
+ Text {
+ anchors.centerIn: parent
+ text: "Second Window"
+ }
+ MouseArea{
+ anchors.fill: parent
+ onClicked: Qt.quit()
+ }
+ }
+}
diff --git a/examples/window/window.cpp b/examples/window/window.cpp
new file mode 100644
index 0000000000..2112ab8f45
--- /dev/null
+++ b/examples/window/window.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/QGuiApplication>
+#include <QtQml/QQmlEngine>
+#include <QtQml/QQmlComponent>
+#include <QtCore/QUrl>
+#include <QDebug>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(QUrl::fromLocalFile("Window.qml"));
+ if ( component.isReady() )
+ component.create();
+ else
+ qWarning() << component.errorString();
+ return app.exec();
+}
diff --git a/examples/window/window.pro b/examples/window/window.pro
new file mode 100644
index 0000000000..c4518418f6
--- /dev/null
+++ b/examples/window/window.pro
@@ -0,0 +1,5 @@
+TEMPLATE = app
+CONFIG += qt
+QT += qml
+
+SOURCES += window.cpp