From a6065d60f158ffad7a94877883af69731da94295 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 29 Nov 2012 16:02:34 +0100 Subject: centralize and fixup example sources install targets follow respective change in qtbase Change-Id: I27502eb7ebea973e19ec5f7c3ec0e2338556f6e0 Reviewed-by: Oswald Buddenhagen Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> --- .qmake.conf | 1 + examples/demos/calqlatr/calqlatr.pro | 11 - examples/demos/calqlatr/calqlatr.qml | 110 ---- examples/demos/calqlatr/calqlatr.qmlproject | 16 - examples/demos/calqlatr/content/Button.qml | 80 --- examples/demos/calqlatr/content/Display.qml | 124 ----- examples/demos/calqlatr/content/NumberPad.qml | 69 --- examples/demos/calqlatr/content/StyleLabel.qml | 50 -- examples/demos/calqlatr/content/audio/touch.wav | Bin 950 -> 0 bytes examples/demos/calqlatr/content/calculator.js | 143 ----- .../demos/calqlatr/content/images/icon-back.png | Bin 328 -> 0 bytes .../demos/calqlatr/content/images/icon-close.png | Bin 488 -> 0 bytes .../calqlatr/content/images/icon-settings.png | Bin 503 -> 0 bytes examples/demos/calqlatr/content/images/logo.png | Bin 5950 -> 0 bytes .../calqlatr/content/images/paper-edge-left.png | Bin 12401 -> 0 bytes .../calqlatr/content/images/paper-edge-right.png | Bin 12967 -> 0 bytes .../demos/calqlatr/content/images/paper-grip.png | Bin 298 -> 0 bytes .../content/images/settings-selected-a.png | Bin 2326 -> 0 bytes .../content/images/settings-selected-b.png | Bin 2334 -> 0 bytes .../demos/calqlatr/content/images/touch-green.png | Bin 4808 -> 0 bytes .../demos/calqlatr/content/images/touch-white.png | Bin 4601 -> 0 bytes .../doc/images/qml-calqlatr-demo-small.png | Bin 37120 -> 0 bytes examples/demos/calqlatr/doc/src/calqlatr.qdoc | 39 -- examples/demos/calqlatr/main.cpp | 41 -- examples/demos/clocks/clocks.qml | 88 ---- examples/demos/clocks/content/Clock.qml | 140 ----- examples/demos/clocks/content/arrow.png | Bin 692 -> 0 bytes examples/demos/clocks/content/background.png | Bin 46895 -> 0 bytes examples/demos/clocks/content/center.png | Bin 765 -> 0 bytes examples/demos/clocks/content/clock-night.png | Bin 23359 -> 0 bytes examples/demos/clocks/content/clock.png | Bin 20653 -> 0 bytes examples/demos/clocks/content/hour.png | Bin 625 -> 0 bytes examples/demos/clocks/content/minute.png | Bin 625 -> 0 bytes examples/demos/clocks/content/quit.png | Bin 583 -> 0 bytes examples/demos/clocks/content/second.png | Bin 303 -> 0 bytes examples/demos/demos.pro | 11 - examples/demos/maroon/content/BuildButton.qml | 90 ---- examples/demos/maroon/content/GameCanvas.qml | 240 --------- examples/demos/maroon/content/GameOverScreen.qml | 115 ---- examples/demos/maroon/content/InfoBar.qml | 84 --- examples/demos/maroon/content/NewGameScreen.qml | 111 ---- examples/demos/maroon/content/SoundEffect.qml | 53 -- .../demos/maroon/content/audio/bomb-action.wav | Bin 20972 -> 0 bytes .../demos/maroon/content/audio/catch-action.wav | Bin 13274 -> 0 bytes examples/demos/maroon/content/audio/catch.wav | Bin 8638 -> 0 bytes examples/demos/maroon/content/audio/currency.wav | Bin 15790 -> 0 bytes .../demos/maroon/content/audio/factory-action.wav | Bin 4936 -> 0 bytes .../demos/maroon/content/audio/melee-action.wav | Bin 17798 -> 0 bytes .../maroon/content/audio/projectile-action.wav | Bin 2562 -> 0 bytes .../demos/maroon/content/audio/shooter-action.wav | Bin 27554 -> 0 bytes examples/demos/maroon/content/gfx/background.png | Bin 5802 -> 0 bytes examples/demos/maroon/content/gfx/bomb-action.png | Bin 23974 -> 0 bytes examples/demos/maroon/content/gfx/bomb-idle.png | Bin 12238 -> 0 bytes examples/demos/maroon/content/gfx/bomb.png | Bin 4067 -> 0 bytes examples/demos/maroon/content/gfx/button-help.png | Bin 8916 -> 0 bytes examples/demos/maroon/content/gfx/button-play.png | Bin 13945 -> 0 bytes examples/demos/maroon/content/gfx/catch-action.png | Bin 6760 -> 0 bytes examples/demos/maroon/content/gfx/catch.png | Bin 4771 -> 0 bytes examples/demos/maroon/content/gfx/cloud.png | Bin 3398 -> 0 bytes examples/demos/maroon/content/gfx/currency.png | Bin 1889 -> 0 bytes examples/demos/maroon/content/gfx/dialog-bomb.png | Bin 3751 -> 0 bytes .../demos/maroon/content/gfx/dialog-factory.png | Bin 3946 -> 0 bytes examples/demos/maroon/content/gfx/dialog-melee.png | Bin 4392 -> 0 bytes .../demos/maroon/content/gfx/dialog-pointer.png | Bin 911 -> 0 bytes .../demos/maroon/content/gfx/dialog-shooter.png | Bin 3737 -> 0 bytes examples/demos/maroon/content/gfx/dialog.png | Bin 3362 -> 0 bytes .../demos/maroon/content/gfx/factory-action.png | Bin 22440 -> 0 bytes examples/demos/maroon/content/gfx/factory-idle.png | Bin 12729 -> 0 bytes examples/demos/maroon/content/gfx/factory.png | Bin 4138 -> 0 bytes examples/demos/maroon/content/gfx/grid.png | Bin 2830 -> 0 bytes examples/demos/maroon/content/gfx/help.png | Bin 38255 -> 0 bytes examples/demos/maroon/content/gfx/lifes.png | Bin 1675 -> 0 bytes examples/demos/maroon/content/gfx/logo-bubble.png | Bin 7706 -> 0 bytes examples/demos/maroon/content/gfx/logo-fish.png | Bin 3477 -> 0 bytes examples/demos/maroon/content/gfx/logo.png | Bin 18332 -> 0 bytes examples/demos/maroon/content/gfx/melee-action.png | Bin 7797 -> 0 bytes examples/demos/maroon/content/gfx/melee-idle.png | Bin 22832 -> 0 bytes examples/demos/maroon/content/gfx/melee.png | Bin 4046 -> 0 bytes examples/demos/maroon/content/gfx/mob-idle.png | Bin 6181 -> 0 bytes examples/demos/maroon/content/gfx/mob.png | Bin 2391 -> 0 bytes examples/demos/maroon/content/gfx/points.png | Bin 1561 -> 0 bytes .../demos/maroon/content/gfx/projectile-action.png | Bin 6257 -> 0 bytes examples/demos/maroon/content/gfx/projectile.png | Bin 801 -> 0 bytes examples/demos/maroon/content/gfx/scores.png | Bin 1535 -> 0 bytes .../demos/maroon/content/gfx/shooter-action.png | Bin 18121 -> 0 bytes examples/demos/maroon/content/gfx/shooter-idle.png | Bin 11929 -> 0 bytes examples/demos/maroon/content/gfx/shooter.png | Bin 4137 -> 0 bytes examples/demos/maroon/content/gfx/sunlight.png | Bin 248412 -> 0 bytes examples/demos/maroon/content/gfx/text-1.png | Bin 2777 -> 0 bytes examples/demos/maroon/content/gfx/text-2.png | Bin 4959 -> 0 bytes examples/demos/maroon/content/gfx/text-3.png | Bin 5063 -> 0 bytes examples/demos/maroon/content/gfx/text-blank.png | Bin 1326 -> 0 bytes .../demos/maroon/content/gfx/text-gameover.png | Bin 1515 -> 0 bytes examples/demos/maroon/content/gfx/text-go.png | Bin 4230 -> 0 bytes examples/demos/maroon/content/gfx/wave.png | Bin 2763 -> 0 bytes examples/demos/maroon/content/logic.js | 264 ---------- examples/demos/maroon/content/mobs/MobBase.qml | 262 ---------- examples/demos/maroon/content/towers/Bomb.qml | 133 ----- examples/demos/maroon/content/towers/Factory.qml | 114 ---- examples/demos/maroon/content/towers/Melee.qml | 83 --- examples/demos/maroon/content/towers/Ranged.qml | 128 ----- examples/demos/maroon/content/towers/TowerBase.qml | 72 --- examples/demos/maroon/main.cpp | 41 -- examples/demos/maroon/maroon.pro | 11 - examples/demos/maroon/maroon.qml | 233 --------- examples/demos/maroon/maroon.qmlproject | 16 - .../photoviewer/PhotoViewerCore/AlbumDelegate.qml | 147 ------ .../photoviewer/PhotoViewerCore/BusyIndicator.qml | 50 -- .../demos/photoviewer/PhotoViewerCore/Button.qml | 72 --- .../photoviewer/PhotoViewerCore/EditableButton.qml | 85 --- .../photoviewer/PhotoViewerCore/PhotoDelegate.qml | 189 ------- .../photoviewer/PhotoViewerCore/ProgressBar.qml | 57 -- .../demos/photoviewer/PhotoViewerCore/RssModel.qml | 57 -- examples/demos/photoviewer/PhotoViewerCore/Tag.qml | 91 ---- .../PhotoViewerCore/images/box-shadow.png | Bin 588 -> 0 bytes .../photoviewer/PhotoViewerCore/images/busy.png | Bin 2629 -> 0 bytes .../PhotoViewerCore/images/cardboard.png | Bin 8844 -> 0 bytes examples/demos/photoviewer/PhotoViewerCore/qmldir | 8 - .../photoviewer/PhotoViewerCore/script/script.js | 27 - examples/demos/photoviewer/i18n/base.ts | 30 -- examples/demos/photoviewer/i18n/qml_fr.qm | Bin 268 -> 0 bytes examples/demos/photoviewer/i18n/qml_fr.ts | 30 -- examples/demos/photoviewer/photoviewer.qml | 110 ---- examples/demos/photoviewer/photoviewer.qmlproject | 20 - examples/demos/rssnews/content/BusyIndicator.qml | 53 -- .../demos/rssnews/content/CategoryDelegate.qml | 82 --- examples/demos/rssnews/content/NewsDelegate.qml | 71 --- examples/demos/rssnews/content/RssFeeds.qml | 59 --- examples/demos/rssnews/content/ScrollBar.qml | 107 ---- examples/demos/rssnews/content/images/busy.png | Bin 2629 -> 0 bytes .../demos/rssnews/content/images/scrollbar.png | Bin 161 -> 0 bytes examples/demos/rssnews/rssnews.qml | 112 ---- examples/demos/rssnews/rssnews.qmlproject | 16 - examples/demos/samegame/content/Block.qml | 114 ---- examples/demos/samegame/content/BlockEmitter.qml | 57 -- examples/demos/samegame/content/Button.qml | 70 --- examples/demos/samegame/content/GameArea.qml | 226 -------- examples/demos/samegame/content/LogoAnimation.qml | 102 ---- examples/demos/samegame/content/MenuEmitter.qml | 53 -- examples/demos/samegame/content/PaintEmitter.qml | 98 ---- examples/demos/samegame/content/PrimaryPack.qml | 122 ----- examples/demos/samegame/content/PuzzleBlock.qml | 111 ---- examples/demos/samegame/content/SamegameText.qml | 49 -- examples/demos/samegame/content/SimpleBlock.qml | 108 ---- examples/demos/samegame/content/SmokeText.qml | 83 --- .../samegame/content/gfx/background-puzzle.png | Bin 86666 -> 0 bytes examples/demos/samegame/content/gfx/background.png | Bin 101018 -> 0 bytes examples/demos/samegame/content/gfx/bar.png | Bin 10970 -> 0 bytes .../demos/samegame/content/gfx/blue-puzzle.png | Bin 2219 -> 0 bytes examples/demos/samegame/content/gfx/blue.png | Bin 1018 -> 0 bytes .../samegame/content/gfx/bubble-highscore.png | Bin 2276 -> 0 bytes .../demos/samegame/content/gfx/bubble-puzzle.png | Bin 2811 -> 0 bytes examples/demos/samegame/content/gfx/but-game-1.png | Bin 2728 -> 0 bytes examples/demos/samegame/content/gfx/but-game-2.png | Bin 3378 -> 0 bytes examples/demos/samegame/content/gfx/but-game-3.png | Bin 1423 -> 0 bytes examples/demos/samegame/content/gfx/but-game-4.png | Bin 2096 -> 0 bytes .../demos/samegame/content/gfx/but-game-new.png | Bin 3662 -> 0 bytes examples/demos/samegame/content/gfx/but-menu.png | Bin 2391 -> 0 bytes .../demos/samegame/content/gfx/but-puzzle-next.png | Bin 3658 -> 0 bytes examples/demos/samegame/content/gfx/but-quit.png | Bin 2100 -> 0 bytes .../demos/samegame/content/gfx/green-puzzle.png | Bin 2271 -> 0 bytes examples/demos/samegame/content/gfx/green.png | Bin 1024 -> 0 bytes examples/demos/samegame/content/gfx/icon-fail.png | Bin 6549 -> 0 bytes examples/demos/samegame/content/gfx/icon-ok.png | Bin 7190 -> 0 bytes examples/demos/samegame/content/gfx/icon-time.png | Bin 1159 -> 0 bytes examples/demos/samegame/content/gfx/logo-a.png | Bin 1814 -> 0 bytes examples/demos/samegame/content/gfx/logo-e.png | Bin 1725 -> 0 bytes examples/demos/samegame/content/gfx/logo-g.png | Bin 1765 -> 0 bytes examples/demos/samegame/content/gfx/logo-m.png | Bin 1743 -> 0 bytes examples/demos/samegame/content/gfx/logo-s.png | Bin 1791 -> 0 bytes examples/demos/samegame/content/gfx/logo.png | Bin 3608 -> 0 bytes .../demos/samegame/content/gfx/particle-brick.png | Bin 861 -> 0 bytes .../demos/samegame/content/gfx/particle-paint.png | Bin 714 -> 0 bytes .../demos/samegame/content/gfx/particle-smoke.png | Bin 5409 -> 0 bytes examples/demos/samegame/content/gfx/red-puzzle.png | Bin 2218 -> 0 bytes examples/demos/samegame/content/gfx/red.png | Bin 1018 -> 0 bytes .../samegame/content/gfx/text-highscore-new.png | Bin 6767 -> 0 bytes .../demos/samegame/content/gfx/text-highscore.png | Bin 3179 -> 0 bytes .../demos/samegame/content/gfx/text-no-winner.png | Bin 6321 -> 0 bytes examples/demos/samegame/content/gfx/text-p1-go.png | Bin 5395 -> 0 bytes .../demos/samegame/content/gfx/text-p1-won.png | Bin 5618 -> 0 bytes examples/demos/samegame/content/gfx/text-p1.png | Bin 1751 -> 0 bytes examples/demos/samegame/content/gfx/text-p2-go.png | Bin 5874 -> 0 bytes .../demos/samegame/content/gfx/text-p2-won.png | Bin 6177 -> 0 bytes examples/demos/samegame/content/gfx/text-p2.png | Bin 2381 -> 0 bytes .../demos/samegame/content/gfx/yellow-puzzle.png | Bin 2239 -> 0 bytes examples/demos/samegame/content/gfx/yellow.png | Bin 1008 -> 0 bytes .../demos/samegame/content/levels/TemplateBase.qml | 70 --- examples/demos/samegame/content/levels/level0.qml | 59 --- examples/demos/samegame/content/levels/level1.qml | 59 --- examples/demos/samegame/content/levels/level2.qml | 61 --- examples/demos/samegame/content/levels/level3.qml | 60 --- examples/demos/samegame/content/levels/level4.qml | 58 -- examples/demos/samegame/content/levels/level5.qml | 59 --- examples/demos/samegame/content/levels/level6.qml | 60 --- examples/demos/samegame/content/levels/level7.qml | 58 -- examples/demos/samegame/content/levels/level8.qml | 59 --- examples/demos/samegame/content/levels/level9.qml | 62 --- examples/demos/samegame/content/samegame.js | 581 --------------------- examples/demos/samegame/main.cpp | 41 -- examples/demos/samegame/samegame.pro | 11 - examples/demos/samegame/samegame.qml | 371 ------------- examples/demos/samegame/samegame.qmlproject | 16 - examples/demos/samegame/settings.js | 56 -- examples/demos/stocqt/content/Button.qml | 59 --- examples/demos/stocqt/content/DatePicker.qml | 122 ----- examples/demos/stocqt/content/StockChart.qml | 324 ------------ examples/demos/stocqt/content/StockListModel.qml | 147 ------ examples/demos/stocqt/content/StockListView.qml | 87 --- examples/demos/stocqt/content/StockModel.qml | 160 ------ examples/demos/stocqt/content/StockSettings.qml | 317 ----------- examples/demos/stocqt/content/StockView.qml | 129 ----- .../stocqt/content/images/icon-calendar-anim.png | Bin 1088 -> 0 bytes .../demos/stocqt/content/images/icon-calendar.png | Bin 884 -> 0 bytes .../demos/stocqt/content/images/icon-items.png | Bin 887 -> 0 bytes .../demos/stocqt/content/images/icon-settings.png | Bin 1066 -> 0 bytes examples/demos/stocqt/content/images/logo.png | Bin 4266 -> 0 bytes .../demos/stocqt/content/images/stock-selected.png | Bin 6480 -> 0 bytes .../demos/stocqt/content/images/wheel-touch.png | Bin 4767 -> 0 bytes examples/demos/stocqt/content/images/wheel.png | Bin 36223 -> 0 bytes examples/demos/stocqt/main.cpp | 41 -- examples/demos/stocqt/stocqt.pro | 11 - examples/demos/stocqt/stocqt.qml | 101 ---- examples/demos/stocqt/stocqt.qmlproject | 16 - examples/demos/tweetsearch/content/FlipBar.qml | 173 ------ examples/demos/tweetsearch/content/LineInput.qml | 98 ---- examples/demos/tweetsearch/content/ListFooter.qml | 154 ------ examples/demos/tweetsearch/content/ListHeader.qml | 81 --- .../demos/tweetsearch/content/SearchDelegate.qml | 121 ----- .../demos/tweetsearch/content/TweetDelegate.qml | 189 ------- examples/demos/tweetsearch/content/TweetsModel.qml | 91 ---- .../tweetsearch/content/resources/anonymous.png | Bin 1788 -> 0 bytes .../content/resources/bird-anim-sprites.png | Bin 11079 -> 0 bytes .../tweetsearch/content/resources/icon-clear.png | Bin 1166 -> 0 bytes .../tweetsearch/content/resources/icon-loading.png | Bin 1542 -> 0 bytes .../tweetsearch/content/resources/icon-refresh.png | Bin 1202 -> 0 bytes .../tweetsearch/content/resources/icon-search.png | Bin 1284 -> 0 bytes examples/demos/tweetsearch/content/tweetsearch.js | 19 - examples/demos/tweetsearch/main.cpp | 41 -- examples/demos/tweetsearch/tweetsearch.pro | 11 - examples/demos/tweetsearch/tweetsearch.qml | 130 ----- examples/demos/tweetsearch/tweetsearch.qmlproject | 16 - examples/examples.pro | 15 +- examples/localstorage/doc/src/localstorage.qdoc | 38 -- examples/localstorage/localstorage.pro | 7 - examples/localstorage/localstorage/hello.qml | 78 --- .../localstorage/localstorage/localstorage.pro | 11 - .../localstorage/localstorage/localstorage.qml | 54 -- .../localstorage/localstorage.qmlproject | 16 - examples/localstorage/localstorage/main.cpp | 41 -- examples/particles/affectors/affectors.pro | 11 - examples/particles/affectors/affectors.qml | 63 --- examples/particles/affectors/affectors.qmlproject | 16 - .../particles/affectors/content/GreyButton.qml | 81 --- examples/particles/affectors/content/age.qml | 99 ---- examples/particles/affectors/content/attractor.qml | 190 ------- .../particles/affectors/content/customaffector.qml | 167 ------ examples/particles/affectors/content/friction.qml | 111 ---- examples/particles/affectors/content/gravity.qml | 105 ---- examples/particles/affectors/content/groupgoal.qml | 203 ------- examples/particles/affectors/content/move.qml | 147 ------ .../particles/affectors/content/spritegoal.qml | 212 -------- .../particles/affectors/content/turbulence.qml | 132 ----- examples/particles/affectors/content/wander.qml | 98 ---- .../affectors/doc/images/qml-affectors-example.png | Bin 22074 -> 0 bytes .../particles/affectors/doc/src/affectors.qdoc | 113 ---- examples/particles/affectors/main.cpp | 41 -- .../customparticle/content/blurparticles.qml | 142 ----- .../customparticle/content/fragmentshader.qml | 116 ---- .../customparticle/content/imagecolors.qml | 126 ----- .../particles/customparticle/customparticle.pro | 11 - .../particles/customparticle/customparticle.qml | 56 -- .../customparticle/customparticle.qmlproject | 16 - .../doc/images/qml-customparticle-example.png | Bin 123781 -> 0 bytes .../customparticle/doc/src/customparticle.qdoc | 54 -- examples/particles/customparticle/main.cpp | 41 -- .../particles/emitters/content/burstandpulse.qml | 110 ---- .../particles/emitters/content/customemitter.qml | 96 ---- examples/particles/emitters/content/emitmask.qml | 74 --- .../particles/emitters/content/maximumemitted.qml | 82 --- .../emitters/content/shapeanddirection.qml | 112 ---- .../particles/emitters/content/trailemitter.qml | 176 ------- .../emitters/content/velocityfrommotion.qml | 312 ----------- .../emitters/doc/images/qml-emitters-example.png | Bin 54749 -> 0 bytes examples/particles/emitters/doc/src/emitters.qdoc | 60 --- examples/particles/emitters/emitters.pro | 11 - examples/particles/emitters/emitters.qml | 60 --- examples/particles/emitters/emitters.qmlproject | 16 - examples/particles/emitters/main.cpp | 41 -- .../particles/imageparticle/content/allatonce.qml | 100 ---- .../particles/imageparticle/content/colored.qml | 88 ---- .../particles/imageparticle/content/colortable.qml | 86 --- .../imageparticle/content/deformation.qml | 125 ----- .../particles/imageparticle/content/rotation.qml | 73 --- .../particles/imageparticle/content/sharing.qml | 205 -------- .../particles/imageparticle/content/sprites.qml | 116 ---- .../doc/images/qml-imageparticle-example.png | Bin 274020 -> 0 bytes .../imageparticle/doc/src/imageparticle.qdoc | 62 --- examples/particles/imageparticle/imageparticle.pro | 11 - examples/particles/imageparticle/imageparticle.qml | 60 --- .../imageparticle/imageparticle.qmlproject | 16 - examples/particles/imageparticle/main.cpp | 41 -- examples/particles/images/_explo.png | Bin 81528 -> 0 bytes examples/particles/images/backgroundLeaves.jpg | Bin 78665 -> 0 bytes examples/particles/images/bear_tiles.png | Bin 40349 -> 0 bytes examples/particles/images/candle.png | Bin 1348 -> 0 bytes examples/particles/images/colortable.png | Bin 704 -> 0 bytes examples/particles/images/finalfrontier.png | Bin 695061 -> 0 bytes examples/particles/images/flower.png | Bin 4683 -> 0 bytes examples/particles/images/matchmask.png | Bin 2369 -> 0 bytes examples/particles/images/meteor.png | Bin 83169 -> 0 bytes examples/particles/images/meteor_explo.png | Bin 219946 -> 0 bytes examples/particles/images/meteors.png | Bin 132137 -> 0 bytes examples/particles/images/nullRock.png | Bin 140 -> 0 bytes examples/particles/images/particle.png | Bin 861 -> 0 bytes examples/particles/images/particle2.png | Bin 3909 -> 0 bytes examples/particles/images/particle3.png | Bin 3186 -> 0 bytes examples/particles/images/particle4.png | Bin 1799 -> 0 bytes examples/particles/images/particleA.png | Bin 3541 -> 0 bytes examples/particles/images/portal_bg.png | Bin 96858 -> 0 bytes examples/particles/images/realLeaf1.png | Bin 15625 -> 0 bytes examples/particles/images/realLeaf2.png | Bin 13660 -> 0 bytes examples/particles/images/realLeaf3.png | Bin 23809 -> 0 bytes examples/particles/images/realLeaf4.png | Bin 23655 -> 0 bytes examples/particles/images/rocket.png | Bin 7315 -> 0 bytes examples/particles/images/rocket2.png | Bin 1918 -> 0 bytes examples/particles/images/sizeInOut.png | Bin 251 -> 0 bytes examples/particles/images/snowflake.png | Bin 189327 -> 0 bytes examples/particles/images/sparkleSize.png | Bin 378 -> 0 bytes examples/particles/images/star.png | Bin 1550 -> 0 bytes examples/particles/images/starfish_0.png | Bin 15972 -> 0 bytes examples/particles/images/starfish_1.png | Bin 15746 -> 0 bytes examples/particles/images/starfish_2.png | Bin 16067 -> 0 bytes examples/particles/images/starfish_3.png | Bin 16201 -> 0 bytes examples/particles/images/starfish_4.png | Bin 14698 -> 0 bytes examples/particles/images/starfish_mask.png | Bin 11301 -> 0 bytes .../particles/itemparticle/content/Delegate.qml | 88 ---- .../particles/itemparticle/content/Delegate2.qml | 79 --- .../itemparticle/content/ExpandingDelegate.qml | 205 -------- .../particles/itemparticle/content/RssModel.qml | 56 -- examples/particles/itemparticle/content/bubble.png | Bin 3413 -> 0 bytes examples/particles/itemparticle/content/script.js | 27 - examples/particles/itemparticle/delegates.qml | 91 ---- examples/particles/itemparticle/particleview.qml | 276 ---------- examples/particles/particles.pro | 13 - .../particles/system/content/dynamiccomparison.qml | 139 ----- .../particles/system/content/dynamicemitters.qml | 140 ----- .../particles/system/content/multiplepainters.qml | 96 ---- examples/particles/system/content/startstop.qml | 86 --- .../particles/system/content/timedgroupchanges.qml | 127 ----- .../system/doc/images/qml-system-example.png | Bin 172685 -> 0 bytes examples/particles/system/doc/src/system.qdoc | 59 --- examples/particles/system/main.cpp | 41 -- examples/particles/system/system.pro | 11 - examples/particles/system/system.qml | 58 -- examples/particles/system/system.qmlproject | 16 - examples/qml/imageprovider/imageprovider.pro | 16 +- .../networkaccessmanagerfactory.pro | 7 +- examples/qml/plugins/plugins.pro | 13 +- examples/qml/qml.pro | 13 +- examples/qml/referenceexamples/adding/adding.pro | 6 +- .../qml/referenceexamples/attached/attached.pro | 6 +- examples/qml/referenceexamples/binding/binding.pro | 8 +- .../qml/referenceexamples/coercion/coercion.pro | 6 +- examples/qml/referenceexamples/default/default.pro | 6 +- .../qml/referenceexamples/extended/extended.pro | 6 +- examples/qml/referenceexamples/grouped/grouped.pro | 6 +- examples/qml/referenceexamples/methods/methods.pro | 6 +- .../referenceexamples/properties/properties.pro | 6 +- .../qml/referenceexamples/referenceexamples.pro | 4 - examples/qml/referenceexamples/signal/signal.pro | 6 +- .../referenceexamples/valuesource/valuesource.pro | 6 +- examples/qml/shell/shell.pro | 6 +- examples/qml/xmlhttprequest/main.cpp | 4 +- examples/qml/xmlhttprequest/xmlhttprequest.pro | 7 +- examples/qml/xmlhttprequest/xmlhttprequest.qml | 2 +- examples/qmltest/qmltest/qmltest.pro | 8 +- examples/quick/accessibility/accessibility.pro | 8 +- examples/quick/accessibility/main.cpp | 2 +- examples/quick/animation/animation.pro | 8 +- examples/quick/animation/animation.qml | 2 +- examples/quick/animation/main.cpp | 2 +- examples/quick/canvas/canvas.pro | 8 +- examples/quick/canvas/canvas.qml | 2 +- examples/quick/canvas/main.cpp | 2 +- examples/quick/customitems/customitems.pro | 21 +- .../maskedmousearea/maskedmousearea.pro | 6 +- .../quick/customitems/painteditem/painteditem.pro | 16 +- examples/quick/demos/calqlatr/calqlatr.pro | 9 + examples/quick/demos/calqlatr/calqlatr.qml | 110 ++++ examples/quick/demos/calqlatr/calqlatr.qmlproject | 16 + examples/quick/demos/calqlatr/content/Button.qml | 80 +++ examples/quick/demos/calqlatr/content/Display.qml | 124 +++++ .../quick/demos/calqlatr/content/NumberPad.qml | 69 +++ .../quick/demos/calqlatr/content/StyleLabel.qml | 50 ++ .../quick/demos/calqlatr/content/audio/touch.wav | Bin 0 -> 950 bytes .../quick/demos/calqlatr/content/calculator.js | 143 +++++ .../demos/calqlatr/content/images/icon-back.png | Bin 0 -> 328 bytes .../demos/calqlatr/content/images/icon-close.png | Bin 0 -> 488 bytes .../calqlatr/content/images/icon-settings.png | Bin 0 -> 503 bytes .../quick/demos/calqlatr/content/images/logo.png | Bin 0 -> 5950 bytes .../calqlatr/content/images/paper-edge-left.png | Bin 0 -> 12401 bytes .../calqlatr/content/images/paper-edge-right.png | Bin 0 -> 12967 bytes .../demos/calqlatr/content/images/paper-grip.png | Bin 0 -> 298 bytes .../content/images/settings-selected-a.png | Bin 0 -> 2326 bytes .../content/images/settings-selected-b.png | Bin 0 -> 2334 bytes .../demos/calqlatr/content/images/touch-green.png | Bin 0 -> 4808 bytes .../demos/calqlatr/content/images/touch-white.png | Bin 0 -> 4601 bytes .../doc/images/qml-calqlatr-demo-small.png | Bin 0 -> 37120 bytes .../quick/demos/calqlatr/doc/src/calqlatr.qdoc | 39 ++ examples/quick/demos/calqlatr/main.cpp | 41 ++ examples/quick/demos/clocks/clocks.qml | 88 ++++ examples/quick/demos/clocks/content/Clock.qml | 140 +++++ examples/quick/demos/clocks/content/arrow.png | Bin 0 -> 692 bytes examples/quick/demos/clocks/content/background.png | Bin 0 -> 46895 bytes examples/quick/demos/clocks/content/center.png | Bin 0 -> 765 bytes .../quick/demos/clocks/content/clock-night.png | Bin 0 -> 23359 bytes examples/quick/demos/clocks/content/clock.png | Bin 0 -> 20653 bytes examples/quick/demos/clocks/content/hour.png | Bin 0 -> 625 bytes examples/quick/demos/clocks/content/minute.png | Bin 0 -> 625 bytes examples/quick/demos/clocks/content/quit.png | Bin 0 -> 583 bytes examples/quick/demos/clocks/content/second.png | Bin 0 -> 303 bytes examples/quick/demos/demos.pro | 11 + .../quick/demos/maroon/content/BuildButton.qml | 90 ++++ examples/quick/demos/maroon/content/GameCanvas.qml | 240 +++++++++ .../quick/demos/maroon/content/GameOverScreen.qml | 115 ++++ examples/quick/demos/maroon/content/InfoBar.qml | 84 +++ .../quick/demos/maroon/content/NewGameScreen.qml | 111 ++++ .../quick/demos/maroon/content/SoundEffect.qml | 53 ++ .../demos/maroon/content/audio/bomb-action.wav | Bin 0 -> 20972 bytes .../demos/maroon/content/audio/catch-action.wav | Bin 0 -> 13274 bytes .../quick/demos/maroon/content/audio/catch.wav | Bin 0 -> 8638 bytes .../quick/demos/maroon/content/audio/currency.wav | Bin 0 -> 15790 bytes .../demos/maroon/content/audio/factory-action.wav | Bin 0 -> 4936 bytes .../demos/maroon/content/audio/melee-action.wav | Bin 0 -> 17798 bytes .../maroon/content/audio/projectile-action.wav | Bin 0 -> 2562 bytes .../demos/maroon/content/audio/shooter-action.wav | Bin 0 -> 27554 bytes .../quick/demos/maroon/content/gfx/background.png | Bin 0 -> 5802 bytes .../quick/demos/maroon/content/gfx/bomb-action.png | Bin 0 -> 23974 bytes .../quick/demos/maroon/content/gfx/bomb-idle.png | Bin 0 -> 12238 bytes examples/quick/demos/maroon/content/gfx/bomb.png | Bin 0 -> 4067 bytes .../quick/demos/maroon/content/gfx/button-help.png | Bin 0 -> 8916 bytes .../quick/demos/maroon/content/gfx/button-play.png | Bin 0 -> 13945 bytes .../demos/maroon/content/gfx/catch-action.png | Bin 0 -> 6760 bytes examples/quick/demos/maroon/content/gfx/catch.png | Bin 0 -> 4771 bytes examples/quick/demos/maroon/content/gfx/cloud.png | Bin 0 -> 3398 bytes .../quick/demos/maroon/content/gfx/currency.png | Bin 0 -> 1889 bytes .../quick/demos/maroon/content/gfx/dialog-bomb.png | Bin 0 -> 3751 bytes .../demos/maroon/content/gfx/dialog-factory.png | Bin 0 -> 3946 bytes .../demos/maroon/content/gfx/dialog-melee.png | Bin 0 -> 4392 bytes .../demos/maroon/content/gfx/dialog-pointer.png | Bin 0 -> 911 bytes .../demos/maroon/content/gfx/dialog-shooter.png | Bin 0 -> 3737 bytes examples/quick/demos/maroon/content/gfx/dialog.png | Bin 0 -> 3362 bytes .../demos/maroon/content/gfx/factory-action.png | Bin 0 -> 22440 bytes .../demos/maroon/content/gfx/factory-idle.png | Bin 0 -> 12729 bytes .../quick/demos/maroon/content/gfx/factory.png | Bin 0 -> 4138 bytes examples/quick/demos/maroon/content/gfx/grid.png | Bin 0 -> 2830 bytes examples/quick/demos/maroon/content/gfx/help.png | Bin 0 -> 38255 bytes examples/quick/demos/maroon/content/gfx/lifes.png | Bin 0 -> 1675 bytes .../quick/demos/maroon/content/gfx/logo-bubble.png | Bin 0 -> 7706 bytes .../quick/demos/maroon/content/gfx/logo-fish.png | Bin 0 -> 3477 bytes examples/quick/demos/maroon/content/gfx/logo.png | Bin 0 -> 18332 bytes .../demos/maroon/content/gfx/melee-action.png | Bin 0 -> 7797 bytes .../quick/demos/maroon/content/gfx/melee-idle.png | Bin 0 -> 22832 bytes examples/quick/demos/maroon/content/gfx/melee.png | Bin 0 -> 4046 bytes .../quick/demos/maroon/content/gfx/mob-idle.png | Bin 0 -> 6181 bytes examples/quick/demos/maroon/content/gfx/mob.png | Bin 0 -> 2391 bytes examples/quick/demos/maroon/content/gfx/points.png | Bin 0 -> 1561 bytes .../demos/maroon/content/gfx/projectile-action.png | Bin 0 -> 6257 bytes .../quick/demos/maroon/content/gfx/projectile.png | Bin 0 -> 801 bytes examples/quick/demos/maroon/content/gfx/scores.png | Bin 0 -> 1535 bytes .../demos/maroon/content/gfx/shooter-action.png | Bin 0 -> 18121 bytes .../demos/maroon/content/gfx/shooter-idle.png | Bin 0 -> 11929 bytes .../quick/demos/maroon/content/gfx/shooter.png | Bin 0 -> 4137 bytes .../quick/demos/maroon/content/gfx/sunlight.png | Bin 0 -> 248412 bytes examples/quick/demos/maroon/content/gfx/text-1.png | Bin 0 -> 2777 bytes examples/quick/demos/maroon/content/gfx/text-2.png | Bin 0 -> 4959 bytes examples/quick/demos/maroon/content/gfx/text-3.png | Bin 0 -> 5063 bytes .../quick/demos/maroon/content/gfx/text-blank.png | Bin 0 -> 1326 bytes .../demos/maroon/content/gfx/text-gameover.png | Bin 0 -> 1515 bytes .../quick/demos/maroon/content/gfx/text-go.png | Bin 0 -> 4230 bytes examples/quick/demos/maroon/content/gfx/wave.png | Bin 0 -> 2763 bytes examples/quick/demos/maroon/content/logic.js | 264 ++++++++++ .../quick/demos/maroon/content/mobs/MobBase.qml | 262 ++++++++++ .../quick/demos/maroon/content/towers/Bomb.qml | 133 +++++ .../quick/demos/maroon/content/towers/Factory.qml | 114 ++++ .../quick/demos/maroon/content/towers/Melee.qml | 83 +++ .../quick/demos/maroon/content/towers/Ranged.qml | 128 +++++ .../demos/maroon/content/towers/TowerBase.qml | 72 +++ examples/quick/demos/maroon/main.cpp | 41 ++ examples/quick/demos/maroon/maroon.pro | 9 + examples/quick/demos/maroon/maroon.qml | 233 +++++++++ examples/quick/demos/maroon/maroon.qmlproject | 16 + .../photoviewer/PhotoViewerCore/AlbumDelegate.qml | 147 ++++++ .../photoviewer/PhotoViewerCore/BusyIndicator.qml | 50 ++ .../demos/photoviewer/PhotoViewerCore/Button.qml | 72 +++ .../photoviewer/PhotoViewerCore/EditableButton.qml | 85 +++ .../photoviewer/PhotoViewerCore/PhotoDelegate.qml | 189 +++++++ .../photoviewer/PhotoViewerCore/ProgressBar.qml | 57 ++ .../demos/photoviewer/PhotoViewerCore/RssModel.qml | 57 ++ .../demos/photoviewer/PhotoViewerCore/Tag.qml | 91 ++++ .../PhotoViewerCore/images/box-shadow.png | Bin 0 -> 588 bytes .../photoviewer/PhotoViewerCore/images/busy.png | Bin 0 -> 2629 bytes .../PhotoViewerCore/images/cardboard.png | Bin 0 -> 8844 bytes .../quick/demos/photoviewer/PhotoViewerCore/qmldir | 8 + .../photoviewer/PhotoViewerCore/script/script.js | 27 + examples/quick/demos/photoviewer/i18n/base.ts | 30 ++ examples/quick/demos/photoviewer/i18n/qml_fr.qm | Bin 0 -> 268 bytes examples/quick/demos/photoviewer/i18n/qml_fr.ts | 30 ++ examples/quick/demos/photoviewer/photoviewer.qml | 110 ++++ .../quick/demos/photoviewer/photoviewer.qmlproject | 20 + .../quick/demos/rssnews/content/BusyIndicator.qml | 53 ++ .../demos/rssnews/content/CategoryDelegate.qml | 82 +++ .../quick/demos/rssnews/content/NewsDelegate.qml | 71 +++ examples/quick/demos/rssnews/content/RssFeeds.qml | 59 +++ examples/quick/demos/rssnews/content/ScrollBar.qml | 107 ++++ .../quick/demos/rssnews/content/images/busy.png | Bin 0 -> 2629 bytes .../demos/rssnews/content/images/scrollbar.png | Bin 0 -> 161 bytes examples/quick/demos/rssnews/rssnews.qml | 112 ++++ examples/quick/demos/rssnews/rssnews.qmlproject | 16 + examples/quick/demos/samegame/content/Block.qml | 114 ++++ .../quick/demos/samegame/content/BlockEmitter.qml | 57 ++ examples/quick/demos/samegame/content/Button.qml | 70 +++ examples/quick/demos/samegame/content/GameArea.qml | 226 ++++++++ .../quick/demos/samegame/content/LogoAnimation.qml | 102 ++++ .../quick/demos/samegame/content/MenuEmitter.qml | 53 ++ .../quick/demos/samegame/content/PaintEmitter.qml | 98 ++++ .../quick/demos/samegame/content/PrimaryPack.qml | 122 +++++ .../quick/demos/samegame/content/PuzzleBlock.qml | 111 ++++ .../quick/demos/samegame/content/SamegameText.qml | 49 ++ .../quick/demos/samegame/content/SimpleBlock.qml | 108 ++++ .../quick/demos/samegame/content/SmokeText.qml | 83 +++ .../samegame/content/gfx/background-puzzle.png | Bin 0 -> 86666 bytes .../demos/samegame/content/gfx/background.png | Bin 0 -> 101018 bytes examples/quick/demos/samegame/content/gfx/bar.png | Bin 0 -> 10970 bytes .../demos/samegame/content/gfx/blue-puzzle.png | Bin 0 -> 2219 bytes examples/quick/demos/samegame/content/gfx/blue.png | Bin 0 -> 1018 bytes .../samegame/content/gfx/bubble-highscore.png | Bin 0 -> 2276 bytes .../demos/samegame/content/gfx/bubble-puzzle.png | Bin 0 -> 2811 bytes .../demos/samegame/content/gfx/but-game-1.png | Bin 0 -> 2728 bytes .../demos/samegame/content/gfx/but-game-2.png | Bin 0 -> 3378 bytes .../demos/samegame/content/gfx/but-game-3.png | Bin 0 -> 1423 bytes .../demos/samegame/content/gfx/but-game-4.png | Bin 0 -> 2096 bytes .../demos/samegame/content/gfx/but-game-new.png | Bin 0 -> 3662 bytes .../quick/demos/samegame/content/gfx/but-menu.png | Bin 0 -> 2391 bytes .../demos/samegame/content/gfx/but-puzzle-next.png | Bin 0 -> 3658 bytes .../quick/demos/samegame/content/gfx/but-quit.png | Bin 0 -> 2100 bytes .../demos/samegame/content/gfx/green-puzzle.png | Bin 0 -> 2271 bytes .../quick/demos/samegame/content/gfx/green.png | Bin 0 -> 1024 bytes .../quick/demos/samegame/content/gfx/icon-fail.png | Bin 0 -> 6549 bytes .../quick/demos/samegame/content/gfx/icon-ok.png | Bin 0 -> 7190 bytes .../quick/demos/samegame/content/gfx/icon-time.png | Bin 0 -> 1159 bytes .../quick/demos/samegame/content/gfx/logo-a.png | Bin 0 -> 1814 bytes .../quick/demos/samegame/content/gfx/logo-e.png | Bin 0 -> 1725 bytes .../quick/demos/samegame/content/gfx/logo-g.png | Bin 0 -> 1765 bytes .../quick/demos/samegame/content/gfx/logo-m.png | Bin 0 -> 1743 bytes .../quick/demos/samegame/content/gfx/logo-s.png | Bin 0 -> 1791 bytes examples/quick/demos/samegame/content/gfx/logo.png | Bin 0 -> 3608 bytes .../demos/samegame/content/gfx/particle-brick.png | Bin 0 -> 861 bytes .../demos/samegame/content/gfx/particle-paint.png | Bin 0 -> 714 bytes .../demos/samegame/content/gfx/particle-smoke.png | Bin 0 -> 5409 bytes .../demos/samegame/content/gfx/red-puzzle.png | Bin 0 -> 2218 bytes examples/quick/demos/samegame/content/gfx/red.png | Bin 0 -> 1018 bytes .../samegame/content/gfx/text-highscore-new.png | Bin 0 -> 6767 bytes .../demos/samegame/content/gfx/text-highscore.png | Bin 0 -> 3179 bytes .../demos/samegame/content/gfx/text-no-winner.png | Bin 0 -> 6321 bytes .../demos/samegame/content/gfx/text-p1-go.png | Bin 0 -> 5395 bytes .../demos/samegame/content/gfx/text-p1-won.png | Bin 0 -> 5618 bytes .../quick/demos/samegame/content/gfx/text-p1.png | Bin 0 -> 1751 bytes .../demos/samegame/content/gfx/text-p2-go.png | Bin 0 -> 5874 bytes .../demos/samegame/content/gfx/text-p2-won.png | Bin 0 -> 6177 bytes .../quick/demos/samegame/content/gfx/text-p2.png | Bin 0 -> 2381 bytes .../demos/samegame/content/gfx/yellow-puzzle.png | Bin 0 -> 2239 bytes .../quick/demos/samegame/content/gfx/yellow.png | Bin 0 -> 1008 bytes .../demos/samegame/content/levels/TemplateBase.qml | 70 +++ .../quick/demos/samegame/content/levels/level0.qml | 59 +++ .../quick/demos/samegame/content/levels/level1.qml | 59 +++ .../quick/demos/samegame/content/levels/level2.qml | 61 +++ .../quick/demos/samegame/content/levels/level3.qml | 60 +++ .../quick/demos/samegame/content/levels/level4.qml | 58 ++ .../quick/demos/samegame/content/levels/level5.qml | 59 +++ .../quick/demos/samegame/content/levels/level6.qml | 60 +++ .../quick/demos/samegame/content/levels/level7.qml | 58 ++ .../quick/demos/samegame/content/levels/level8.qml | 59 +++ .../quick/demos/samegame/content/levels/level9.qml | 62 +++ examples/quick/demos/samegame/content/samegame.js | 581 +++++++++++++++++++++ examples/quick/demos/samegame/main.cpp | 41 ++ examples/quick/demos/samegame/samegame.pro | 9 + examples/quick/demos/samegame/samegame.qml | 371 +++++++++++++ examples/quick/demos/samegame/samegame.qmlproject | 16 + examples/quick/demos/samegame/settings.js | 56 ++ examples/quick/demos/stocqt/content/Button.qml | 59 +++ examples/quick/demos/stocqt/content/DatePicker.qml | 122 +++++ examples/quick/demos/stocqt/content/StockChart.qml | 324 ++++++++++++ .../quick/demos/stocqt/content/StockListModel.qml | 147 ++++++ .../quick/demos/stocqt/content/StockListView.qml | 87 +++ examples/quick/demos/stocqt/content/StockModel.qml | 160 ++++++ .../quick/demos/stocqt/content/StockSettings.qml | 317 +++++++++++ examples/quick/demos/stocqt/content/StockView.qml | 129 +++++ .../stocqt/content/images/icon-calendar-anim.png | Bin 0 -> 1088 bytes .../demos/stocqt/content/images/icon-calendar.png | Bin 0 -> 884 bytes .../demos/stocqt/content/images/icon-items.png | Bin 0 -> 887 bytes .../demos/stocqt/content/images/icon-settings.png | Bin 0 -> 1066 bytes .../quick/demos/stocqt/content/images/logo.png | Bin 0 -> 4266 bytes .../demos/stocqt/content/images/stock-selected.png | Bin 0 -> 6480 bytes .../demos/stocqt/content/images/wheel-touch.png | Bin 0 -> 4767 bytes .../quick/demos/stocqt/content/images/wheel.png | Bin 0 -> 36223 bytes examples/quick/demos/stocqt/main.cpp | 41 ++ examples/quick/demos/stocqt/stocqt.pro | 9 + examples/quick/demos/stocqt/stocqt.qml | 101 ++++ examples/quick/demos/stocqt/stocqt.qmlproject | 16 + .../quick/demos/tweetsearch/content/FlipBar.qml | 173 ++++++ .../quick/demos/tweetsearch/content/LineInput.qml | 98 ++++ .../quick/demos/tweetsearch/content/ListFooter.qml | 154 ++++++ .../quick/demos/tweetsearch/content/ListHeader.qml | 81 +++ .../demos/tweetsearch/content/SearchDelegate.qml | 121 +++++ .../demos/tweetsearch/content/TweetDelegate.qml | 189 +++++++ .../demos/tweetsearch/content/TweetsModel.qml | 91 ++++ .../tweetsearch/content/resources/anonymous.png | Bin 0 -> 1788 bytes .../content/resources/bird-anim-sprites.png | Bin 0 -> 11079 bytes .../tweetsearch/content/resources/icon-clear.png | Bin 0 -> 1166 bytes .../tweetsearch/content/resources/icon-loading.png | Bin 0 -> 1542 bytes .../tweetsearch/content/resources/icon-refresh.png | Bin 0 -> 1202 bytes .../tweetsearch/content/resources/icon-search.png | Bin 0 -> 1284 bytes .../quick/demos/tweetsearch/content/tweetsearch.js | 19 + examples/quick/demos/tweetsearch/main.cpp | 41 ++ examples/quick/demos/tweetsearch/tweetsearch.pro | 9 + examples/quick/demos/tweetsearch/tweetsearch.qml | 130 +++++ .../quick/demos/tweetsearch/tweetsearch.qmlproject | 16 + examples/quick/draganddrop/draganddrop.pro | 8 +- examples/quick/draganddrop/draganddrop.qml | 2 +- examples/quick/draganddrop/main.cpp | 2 +- examples/quick/imageelements/imageelements.pro | 8 +- examples/quick/imageelements/imageelements.qml | 2 +- examples/quick/imageelements/main.cpp | 2 +- examples/quick/keyinteraction/keyinteraction.pro | 8 +- examples/quick/keyinteraction/keyinteraction.qml | 2 +- examples/quick/keyinteraction/main.cpp | 2 +- .../quick/localstorage/doc/src/localstorage.qdoc | 38 ++ examples/quick/localstorage/localstorage.pro | 2 + examples/quick/localstorage/localstorage/hello.qml | 78 +++ .../localstorage/localstorage/localstorage.pro | 9 + .../localstorage/localstorage/localstorage.qml | 54 ++ .../localstorage/localstorage.qmlproject | 16 + examples/quick/localstorage/localstorage/main.cpp | 41 ++ examples/quick/modelviews/browser.prx | 18 + examples/quick/modelviews/main.cpp | 2 +- examples/quick/modelviews/modelviews.pro | 25 +- examples/quick/modelviews/modelviews.qml | 2 +- examples/quick/mousearea/main.cpp | 2 +- examples/quick/mousearea/mousearea.pro | 11 +- examples/quick/particles/affectors/affectors.pro | 9 + examples/quick/particles/affectors/affectors.qml | 63 +++ .../quick/particles/affectors/affectors.qmlproject | 16 + .../particles/affectors/content/GreyButton.qml | 81 +++ examples/quick/particles/affectors/content/age.qml | 99 ++++ .../particles/affectors/content/attractor.qml | 190 +++++++ .../particles/affectors/content/customaffector.qml | 167 ++++++ .../quick/particles/affectors/content/friction.qml | 111 ++++ .../quick/particles/affectors/content/gravity.qml | 105 ++++ .../particles/affectors/content/groupgoal.qml | 203 +++++++ .../quick/particles/affectors/content/move.qml | 147 ++++++ .../particles/affectors/content/spritegoal.qml | 212 ++++++++ .../particles/affectors/content/turbulence.qml | 132 +++++ .../quick/particles/affectors/content/wander.qml | 98 ++++ .../affectors/doc/images/qml-affectors-example.png | Bin 0 -> 22074 bytes .../particles/affectors/doc/src/affectors.qdoc | 113 ++++ examples/quick/particles/affectors/main.cpp | 41 ++ .../customparticle/content/blurparticles.qml | 142 +++++ .../customparticle/content/fragmentshader.qml | 116 ++++ .../customparticle/content/imagecolors.qml | 126 +++++ .../particles/customparticle/customparticle.pro | 9 + .../particles/customparticle/customparticle.qml | 56 ++ .../customparticle/customparticle.qmlproject | 16 + .../doc/images/qml-customparticle-example.png | Bin 0 -> 123781 bytes .../customparticle/doc/src/customparticle.qdoc | 54 ++ examples/quick/particles/customparticle/main.cpp | 41 ++ .../particles/emitters/content/burstandpulse.qml | 110 ++++ .../particles/emitters/content/customemitter.qml | 96 ++++ .../quick/particles/emitters/content/emitmask.qml | 74 +++ .../particles/emitters/content/maximumemitted.qml | 82 +++ .../emitters/content/shapeanddirection.qml | 112 ++++ .../particles/emitters/content/trailemitter.qml | 176 +++++++ .../emitters/content/velocityfrommotion.qml | 312 +++++++++++ .../emitters/doc/images/qml-emitters-example.png | Bin 0 -> 54749 bytes .../quick/particles/emitters/doc/src/emitters.qdoc | 60 +++ examples/quick/particles/emitters/emitters.pro | 9 + examples/quick/particles/emitters/emitters.qml | 60 +++ .../quick/particles/emitters/emitters.qmlproject | 16 + examples/quick/particles/emitters/main.cpp | 41 ++ .../particles/imageparticle/content/allatonce.qml | 100 ++++ .../particles/imageparticle/content/colored.qml | 88 ++++ .../particles/imageparticle/content/colortable.qml | 86 +++ .../imageparticle/content/deformation.qml | 125 +++++ .../particles/imageparticle/content/rotation.qml | 73 +++ .../particles/imageparticle/content/sharing.qml | 205 ++++++++ .../particles/imageparticle/content/sprites.qml | 116 ++++ .../doc/images/qml-imageparticle-example.png | Bin 0 -> 274020 bytes .../imageparticle/doc/src/imageparticle.qdoc | 62 +++ .../particles/imageparticle/imageparticle.pro | 9 + .../particles/imageparticle/imageparticle.qml | 60 +++ .../imageparticle/imageparticle.qmlproject | 16 + examples/quick/particles/imageparticle/main.cpp | 41 ++ examples/quick/particles/images/_explo.png | Bin 0 -> 81528 bytes .../quick/particles/images/backgroundLeaves.jpg | Bin 0 -> 78665 bytes examples/quick/particles/images/bear_tiles.png | Bin 0 -> 40349 bytes examples/quick/particles/images/candle.png | Bin 0 -> 1348 bytes examples/quick/particles/images/colortable.png | Bin 0 -> 704 bytes examples/quick/particles/images/finalfrontier.png | Bin 0 -> 695061 bytes examples/quick/particles/images/flower.png | Bin 0 -> 4683 bytes examples/quick/particles/images/matchmask.png | Bin 0 -> 2369 bytes examples/quick/particles/images/meteor.png | Bin 0 -> 83169 bytes examples/quick/particles/images/meteor_explo.png | Bin 0 -> 219946 bytes examples/quick/particles/images/meteors.png | Bin 0 -> 132137 bytes examples/quick/particles/images/nullRock.png | Bin 0 -> 140 bytes examples/quick/particles/images/particle.png | Bin 0 -> 861 bytes examples/quick/particles/images/particle2.png | Bin 0 -> 3909 bytes examples/quick/particles/images/particle3.png | Bin 0 -> 3186 bytes examples/quick/particles/images/particle4.png | Bin 0 -> 1799 bytes examples/quick/particles/images/particleA.png | Bin 0 -> 3541 bytes examples/quick/particles/images/portal_bg.png | Bin 0 -> 96858 bytes examples/quick/particles/images/realLeaf1.png | Bin 0 -> 15625 bytes examples/quick/particles/images/realLeaf2.png | Bin 0 -> 13660 bytes examples/quick/particles/images/realLeaf3.png | Bin 0 -> 23809 bytes examples/quick/particles/images/realLeaf4.png | Bin 0 -> 23655 bytes examples/quick/particles/images/rocket.png | Bin 0 -> 7315 bytes examples/quick/particles/images/rocket2.png | Bin 0 -> 1918 bytes examples/quick/particles/images/sizeInOut.png | Bin 0 -> 251 bytes examples/quick/particles/images/snowflake.png | Bin 0 -> 189327 bytes examples/quick/particles/images/sparkleSize.png | Bin 0 -> 378 bytes examples/quick/particles/images/star.png | Bin 0 -> 1550 bytes examples/quick/particles/images/starfish_0.png | Bin 0 -> 15972 bytes examples/quick/particles/images/starfish_1.png | Bin 0 -> 15746 bytes examples/quick/particles/images/starfish_2.png | Bin 0 -> 16067 bytes examples/quick/particles/images/starfish_3.png | Bin 0 -> 16201 bytes examples/quick/particles/images/starfish_4.png | Bin 0 -> 14698 bytes examples/quick/particles/images/starfish_mask.png | Bin 0 -> 11301 bytes .../particles/itemparticle/content/Delegate.qml | 88 ++++ .../particles/itemparticle/content/Delegate2.qml | 79 +++ .../itemparticle/content/ExpandingDelegate.qml | 205 ++++++++ .../particles/itemparticle/content/RssModel.qml | 56 ++ .../particles/itemparticle/content/bubble.png | Bin 0 -> 3413 bytes .../quick/particles/itemparticle/content/script.js | 27 + .../quick/particles/itemparticle/delegates.qml | 91 ++++ .../quick/particles/itemparticle/particleview.qml | 276 ++++++++++ examples/quick/particles/particles.pro | 14 + .../particles/system/content/dynamiccomparison.qml | 139 +++++ .../particles/system/content/dynamicemitters.qml | 140 +++++ .../particles/system/content/multiplepainters.qml | 96 ++++ .../quick/particles/system/content/startstop.qml | 86 +++ .../particles/system/content/timedgroupchanges.qml | 127 +++++ .../system/doc/images/qml-system-example.png | Bin 0 -> 172685 bytes .../quick/particles/system/doc/src/system.qdoc | 59 +++ examples/quick/particles/system/main.cpp | 41 ++ examples/quick/particles/system/system.pro | 9 + examples/quick/particles/system/system.qml | 58 ++ examples/quick/particles/system/system.qmlproject | 16 + examples/quick/positioners/main.cpp | 2 +- examples/quick/positioners/positioners.pro | 8 +- examples/quick/positioners/positioners.qml | 2 +- examples/quick/quick.pro | 14 +- examples/quick/righttoleft/main.cpp | 2 +- examples/quick/righttoleft/righttoleft.pro | 8 +- examples/quick/righttoleft/righttoleft.qml | 2 +- .../scenegraph/customgeometry/customgeometry.pro | 9 +- .../scenegraph/openglunderqml/openglunderqml.pro | 10 +- examples/quick/scenegraph/scenegraph.pro | 5 - .../scenegraph/simplematerial/simplematerial.pro | 10 +- examples/quick/shadereffects/main.cpp | 2 +- examples/quick/shadereffects/shadereffects.pro | 8 +- examples/quick/shared/Button.qml | 64 +++ examples/quick/shared/LauncherList.qml | 107 ++++ examples/quick/shared/README | 11 + examples/quick/shared/SimpleLauncherDelegate.qml | 53 ++ examples/quick/shared/images/back.png | Bin 0 -> 404 bytes examples/quick/shared/qmldir | 3 + examples/quick/shared/shared.h | 82 +++ examples/quick/text/main.cpp | 2 +- examples/quick/text/text.pro | 8 +- examples/quick/text/text.qml | 2 +- examples/quick/threading/main.cpp | 2 +- examples/quick/threading/threading.pro | 8 +- examples/quick/threading/threading.qml | 2 +- examples/quick/touchinteraction/main.cpp | 2 +- .../quick/touchinteraction/touchinteraction.pro | 8 +- .../quick/touchinteraction/touchinteraction.qml | 2 +- .../dynamicview/dynamicview1/PetsModel.qml | 102 ++++ .../dynamicview/dynamicview1/dynamicview.qml | 90 ++++ .../dynamicview/dynamicview2/PetsModel.qml | 98 ++++ .../dynamicview/dynamicview2/dynamicview.qml | 121 +++++ .../dynamicview/dynamicview3/PetsModel.qml | 98 ++++ .../dynamicview/dynamicview3/dynamicview.qml | 143 +++++ .../dynamicview/dynamicview4/ListSelector.qml | 120 +++++ .../dynamicview/dynamicview4/PetsModel.qml | 98 ++++ .../dynamicview/dynamicview4/dynamicview.qml | 219 ++++++++ .../tutorials/extending/chapter1-basics/app.qml | 60 +++ .../extending/chapter1-basics/chapter1-basics.pro | 5 + .../tutorials/extending/chapter1-basics/main.cpp | 57 ++ .../extending/chapter1-basics/piechart.cpp | 79 +++ .../tutorials/extending/chapter1-basics/piechart.h | 71 +++ .../tutorials/extending/chapter2-methods/app.qml | 66 +++ .../chapter2-methods/chapter2-methods.pro | 5 + .../tutorials/extending/chapter2-methods/main.cpp | 57 ++ .../extending/chapter2-methods/piechart.cpp | 84 +++ .../extending/chapter2-methods/piechart.h | 84 +++ .../tutorials/extending/chapter3-bindings/app.qml | 74 +++ .../chapter3-bindings/chapter3-bindings.pro | 5 + .../tutorials/extending/chapter3-bindings/main.cpp | 57 ++ .../extending/chapter3-bindings/piechart.cpp | 86 +++ .../extending/chapter3-bindings/piechart.h | 84 +++ .../extending/chapter4-customPropertyTypes/app.qml | 60 +++ .../chapter4-customPropertyTypes.pro | 7 + .../chapter4-customPropertyTypes/main.cpp | 66 +++ .../chapter4-customPropertyTypes/piechart.cpp | 70 +++ .../chapter4-customPropertyTypes/piechart.h | 78 +++ .../chapter4-customPropertyTypes/pieslice.cpp | 66 +++ .../chapter4-customPropertyTypes/pieslice.h | 66 +++ .../extending/chapter5-listproperties/app.qml | 70 +++ .../chapter5-listproperties.pro | 7 + .../extending/chapter5-listproperties/main.cpp | 58 ++ .../extending/chapter5-listproperties/piechart.cpp | 72 +++ .../extending/chapter5-listproperties/piechart.h | 75 +++ .../extending/chapter5-listproperties/pieslice.cpp | 86 +++ .../extending/chapter5-listproperties/pieslice.h | 76 +++ .../extending/chapter6-plugins/Charts/qmldir | 2 + .../tutorials/extending/chapter6-plugins/app.qml | 69 +++ .../chapter6-plugins/chapter6-plugins.pro | 18 + .../extending/chapter6-plugins/chartsplugin.cpp | 53 ++ .../extending/chapter6-plugins/chartsplugin.h | 57 ++ .../extending/chapter6-plugins/piechart.cpp | 71 +++ .../extending/chapter6-plugins/piechart.h | 69 +++ .../extending/chapter6-plugins/pieslice.cpp | 86 +++ .../extending/chapter6-plugins/pieslice.h | 74 +++ examples/quick/tutorials/extending/extending.pro | 10 + .../tutorials/gettingStartedQml/core/Button.qml | 108 ++++ .../tutorials/gettingStartedQml/core/EditMenu.qml | 105 ++++ .../gettingStartedQml/core/FileDialog.qml | 164 ++++++ .../tutorials/gettingStartedQml/core/FileMenu.qml | 233 +++++++++ .../tutorials/gettingStartedQml/core/MenuBar.qml | 144 +++++ .../tutorials/gettingStartedQml/core/TextArea.qml | 87 +++ .../quick/tutorials/gettingStartedQml/core/qmldir | 7 + .../gettingStartedQml/filedialog/dialogPlugin.cpp | 51 ++ .../gettingStartedQml/filedialog/dialogPlugin.h | 57 ++ .../gettingStartedQml/filedialog/directory.cpp | 218 ++++++++ .../gettingStartedQml/filedialog/directory.h | 107 ++++ .../gettingStartedQml/filedialog/file.cpp | 60 +++ .../tutorials/gettingStartedQml/filedialog/file.h | 66 +++ .../gettingStartedQml/filedialog/filedialog.pro | 22 + .../tutorials/gettingStartedQml/filedialog/qmldir | 1 + .../gettingStartedQml/gettingStartedQml.pro | 10 + .../tutorials/gettingStartedQml/images/arrow.png | Bin 0 -> 583 bytes .../gettingStartedQml/parts/part0/Button.qml | 55 ++ .../gettingStartedQml/parts/part1/Button.qml | 97 ++++ .../gettingStartedQml/parts/part1/EditMenu.qml | 76 +++ .../gettingStartedQml/parts/part1/FileMenu.qml | 91 ++++ .../gettingStartedQml/parts/part1/SimpleButton.qml | 73 +++ .../parts/part1/pics/qml-texteditor1_button.png | Bin 0 -> 1670 bytes .../parts/part1/pics/qml-texteditor1_editmenu.png | Bin 0 -> 6177 bytes .../parts/part1/pics/qml-texteditor1_filemenu.png | Bin 0 -> 6062 bytes .../part1/pics/qml-texteditor1_simplebutton.png | Bin 0 -> 1055 bytes .../parts/part1/qml-texteditor.qmlproject | 14 + .../gettingStartedQml/parts/part2/Button.qml | 99 ++++ .../gettingStartedQml/parts/part2/EditMenu.qml | 77 +++ .../gettingStartedQml/parts/part2/FileMenu.qml | 92 ++++ .../gettingStartedQml/parts/part2/MenuBar.qml | 140 +++++ .../parts/part2/pics/qml-texteditor2_menubar.png | Bin 0 -> 6079 bytes .../parts/part2/qml-texteditor2.qmlproject | 14 + .../gettingStartedQml/parts/part3/Button.qml | 99 ++++ .../gettingStartedQml/parts/part3/EditMenu.qml | 77 +++ .../gettingStartedQml/parts/part3/FileMenu.qml | 92 ++++ .../gettingStartedQml/parts/part3/MenuBar.qml | 140 +++++ .../gettingStartedQml/parts/part3/TextArea.qml | 80 +++ .../gettingStartedQml/parts/part3/TextEditor.qml | 68 +++ .../gettingStartedQml/parts/part3/images/arrow.png | Bin 0 -> 583 bytes .../part3/pics/qml-texteditor3_texteditor.png | Bin 0 -> 59345 bytes .../parts/part3/qml-texteditor3.qmlproject | 14 + .../gettingStartedQml/parts/part4/Button.qml | 109 ++++ .../gettingStartedQml/parts/part4/EditMenu.qml | 81 +++ .../gettingStartedQml/parts/part4/FileMenu.qml | 96 ++++ .../gettingStartedQml/parts/part4/MenuBar.qml | 146 ++++++ .../gettingStartedQml/parts/part4/SimpleButton.qml | 59 +++ .../gettingStartedQml/parts/part4/TextArea.qml | 80 +++ .../gettingStartedQml/parts/part4/TextEditor.qml | 146 ++++++ .../gettingStartedQml/parts/part4/images/arrow.png | Bin 0 -> 583 bytes .../part4/pics/qml-texteditor4_texteditor.png | Bin 0 -> 63629 bytes .../parts/part4/qml-texteditor4.qmlproject | 14 + .../gettingStartedQml/parts/part5/TextEditor.qml | 127 +++++ .../gettingStartedQml/parts/part5/core/Button.qml | 109 ++++ .../parts/part5/core/EditMenu.qml | 110 ++++ .../parts/part5/core/FileDialog.qml | 171 ++++++ .../parts/part5/core/FileMenu.qml | 233 +++++++++ .../gettingStartedQml/parts/part5/core/MenuBar.qml | 145 +++++ .../parts/part5/core/TextArea.qml | 86 +++ .../gettingStartedQml/parts/part5/core/qmldir | 11 + .../parts/part5/filedialog/dialogPlugin.cpp | 57 ++ .../parts/part5/filedialog/dialogPlugin.h | 57 ++ .../parts/part5/filedialog/directory.cpp | 219 ++++++++ .../parts/part5/filedialog/directory.h | 108 ++++ .../parts/part5/filedialog/file.cpp | 56 ++ .../parts/part5/filedialog/file.h | 67 +++ .../parts/part5/filedialog/filedialog.pro | 17 + .../parts/part5/filedialog/qmldir | 1 + .../gettingStartedQml/parts/part5/images/arrow.png | Bin 0 -> 583 bytes .../parts/part5/pics/qml-texteditor5_editmenu.png | Bin 0 -> 65123 bytes .../parts/part5/pics/qml-texteditor5_filemenu.png | Bin 0 -> 21367 bytes .../parts/part5/pics/qml-texteditor5_newfile.png | Bin 0 -> 76693 bytes .../parts/part5/qml-texteditor5.qmlproject | 14 + .../pics/qml-texteditor5_editmenu.png | Bin 0 -> 65123 bytes .../pics/qml-texteditor5_filemenu.png | Bin 0 -> 21367 bytes .../pics/qml-texteditor5_newfile.png | Bin 0 -> 76693 bytes .../tutorials/gettingStartedQml/texteditor.qml | 132 +++++ examples/quick/tutorials/helloworld/Cell.qml | 72 +++ examples/quick/tutorials/helloworld/tutorial1.qml | 63 +++ examples/quick/tutorials/helloworld/tutorial2.qml | 72 +++ examples/quick/tutorials/helloworld/tutorial3.qml | 91 ++++ .../quick/tutorials/samegame/samegame1/Block.qml | 53 ++ .../quick/tutorials/samegame/samegame1/Button.qml | 83 +++ .../tutorials/samegame/samegame1/samegame.qml | 82 +++ .../samegame/samegame1/samegame1.qmlproject | 16 + .../quick/tutorials/samegame/samegame2/Block.qml | 51 ++ .../quick/tutorials/samegame/samegame2/Button.qml | 81 +++ .../quick/tutorials/samegame/samegame2/samegame.js | 63 +++ .../tutorials/samegame/samegame2/samegame.qml | 85 +++ .../samegame/samegame2/samegame2.qmlproject | 16 + .../quick/tutorials/samegame/samegame3/Block.qml | 63 +++ .../quick/tutorials/samegame/samegame3/Button.qml | 81 +++ .../quick/tutorials/samegame/samegame3/Dialog.qml | 71 +++ .../quick/tutorials/samegame/samegame3/samegame.js | 174 ++++++ .../tutorials/samegame/samegame3/samegame.qml | 109 ++++ .../samegame/samegame3/samegame3.qmlproject | 16 + .../samegame/samegame4/content/BoomBlock.qml | 122 +++++ .../samegame/samegame4/content/Button.qml | 81 +++ .../samegame/samegame4/content/Dialog.qml | 107 ++++ .../samegame/samegame4/content/samegame.js | 226 ++++++++ .../tutorials/samegame/samegame4/highscores/README | 1 + .../samegame/samegame4/highscores/score_data.xml | 2 + .../samegame/samegame4/highscores/score_style.xsl | 28 + .../samegame/samegame4/highscores/scores.php | 31 ++ .../tutorials/samegame/samegame4/samegame.qml | 115 ++++ .../samegame/samegame4/samegame4.qmlproject | 16 + .../tutorials/samegame/shared/pics/background.jpg | Bin 0 -> 36473 bytes .../tutorials/samegame/shared/pics/blueStar.png | Bin 0 -> 278 bytes .../tutorials/samegame/shared/pics/blueStone.png | Bin 0 -> 3054 bytes .../tutorials/samegame/shared/pics/greenStar.png | Bin 0 -> 273 bytes .../tutorials/samegame/shared/pics/greenStone.png | Bin 0 -> 2932 bytes .../tutorials/samegame/shared/pics/redStar.png | Bin 0 -> 274 bytes .../tutorials/samegame/shared/pics/redStone.png | Bin 0 -> 2902 bytes .../quick/tutorials/samegame/shared/pics/star.png | Bin 0 -> 262 bytes .../tutorials/samegame/shared/pics/yellowStone.png | Bin 0 -> 3056 bytes examples/quick/tutorials/tutorials.pro | 8 + .../slideswitch/doc/src/example-slideswitch.qdoc | 2 +- examples/quick/window/screen/screenInfo.qml | 90 ++++ examples/quick/window/window.pro | 6 + examples/quick/window/window/Window.qml | 58 ++ examples/quick/window/window/nogui.qml | 50 ++ examples/quick/window/window/standalone.qml | 128 +++++ examples/quick/window/window/twowindows.qml | 89 ++++ examples/quick/window/window/window.cpp | 58 ++ examples/quick/window/window/window.pro | 11 + examples/shared/Button.qml | 64 --- examples/shared/LauncherList.qml | 107 ---- examples/shared/README | 11 - examples/shared/SimpleLauncherDelegate.qml | 53 -- examples/shared/images/back.png | Bin 404 -> 0 bytes examples/shared/qmldir | 3 - examples/shared/shared.h | 82 --- examples/shared/shared.pro | 9 - .../dynamicview/dynamicview1/PetsModel.qml | 102 ---- .../dynamicview/dynamicview1/dynamicview.qml | 90 ---- .../dynamicview/dynamicview2/PetsModel.qml | 98 ---- .../dynamicview/dynamicview2/dynamicview.qml | 121 ----- .../dynamicview/dynamicview3/PetsModel.qml | 98 ---- .../dynamicview/dynamicview3/dynamicview.qml | 143 ----- .../dynamicview/dynamicview4/ListSelector.qml | 120 ----- .../dynamicview/dynamicview4/PetsModel.qml | 98 ---- .../dynamicview/dynamicview4/dynamicview.qml | 219 -------- .../tutorials/extending/chapter1-basics/app.qml | 60 --- .../extending/chapter1-basics/chapter1-basics.pro | 5 - .../tutorials/extending/chapter1-basics/main.cpp | 57 -- .../extending/chapter1-basics/piechart.cpp | 79 --- .../tutorials/extending/chapter1-basics/piechart.h | 71 --- .../tutorials/extending/chapter2-methods/app.qml | 66 --- .../chapter2-methods/chapter2-methods.pro | 5 - .../tutorials/extending/chapter2-methods/main.cpp | 57 -- .../extending/chapter2-methods/piechart.cpp | 84 --- .../extending/chapter2-methods/piechart.h | 84 --- .../tutorials/extending/chapter3-bindings/app.qml | 74 --- .../chapter3-bindings/chapter3-bindings.pro | 5 - .../tutorials/extending/chapter3-bindings/main.cpp | 57 -- .../extending/chapter3-bindings/piechart.cpp | 86 --- .../extending/chapter3-bindings/piechart.h | 84 --- .../extending/chapter4-customPropertyTypes/app.qml | 60 --- .../chapter4-customPropertyTypes.pro | 7 - .../chapter4-customPropertyTypes/main.cpp | 66 --- .../chapter4-customPropertyTypes/piechart.cpp | 70 --- .../chapter4-customPropertyTypes/piechart.h | 78 --- .../chapter4-customPropertyTypes/pieslice.cpp | 66 --- .../chapter4-customPropertyTypes/pieslice.h | 66 --- .../extending/chapter5-listproperties/app.qml | 70 --- .../chapter5-listproperties.pro | 7 - .../extending/chapter5-listproperties/main.cpp | 58 -- .../extending/chapter5-listproperties/piechart.cpp | 72 --- .../extending/chapter5-listproperties/piechart.h | 75 --- .../extending/chapter5-listproperties/pieslice.cpp | 86 --- .../extending/chapter5-listproperties/pieslice.h | 76 --- .../extending/chapter6-plugins/Charts/qmldir | 2 - .../tutorials/extending/chapter6-plugins/app.qml | 69 --- .../chapter6-plugins/chapter6-plugins.pro | 18 - .../extending/chapter6-plugins/chartsplugin.cpp | 53 -- .../extending/chapter6-plugins/chartsplugin.h | 57 -- .../extending/chapter6-plugins/piechart.cpp | 71 --- .../extending/chapter6-plugins/piechart.h | 69 --- .../extending/chapter6-plugins/pieslice.cpp | 86 --- .../extending/chapter6-plugins/pieslice.h | 74 --- examples/tutorials/extending/extending.pro | 10 - .../tutorials/gettingStartedQml/core/Button.qml | 108 ---- .../tutorials/gettingStartedQml/core/EditMenu.qml | 105 ---- .../gettingStartedQml/core/FileDialog.qml | 164 ------ .../tutorials/gettingStartedQml/core/FileMenu.qml | 233 --------- .../tutorials/gettingStartedQml/core/MenuBar.qml | 144 ----- .../tutorials/gettingStartedQml/core/TextArea.qml | 87 --- examples/tutorials/gettingStartedQml/core/qmldir | 7 - .../gettingStartedQml/filedialog/dialogPlugin.cpp | 51 -- .../gettingStartedQml/filedialog/dialogPlugin.h | 57 -- .../gettingStartedQml/filedialog/directory.cpp | 218 -------- .../gettingStartedQml/filedialog/directory.h | 107 ---- .../gettingStartedQml/filedialog/file.cpp | 60 --- .../tutorials/gettingStartedQml/filedialog/file.h | 66 --- .../gettingStartedQml/filedialog/filedialog.pro | 22 - .../tutorials/gettingStartedQml/filedialog/qmldir | 1 - .../gettingStartedQml/gettingStartedQml.pro | 8 - .../tutorials/gettingStartedQml/images/arrow.png | Bin 583 -> 0 bytes .../gettingStartedQml/parts/part0/Button.qml | 55 -- .../gettingStartedQml/parts/part1/Button.qml | 97 ---- .../gettingStartedQml/parts/part1/EditMenu.qml | 76 --- .../gettingStartedQml/parts/part1/FileMenu.qml | 91 ---- .../gettingStartedQml/parts/part1/SimpleButton.qml | 73 --- .../parts/part1/pics/qml-texteditor1_button.png | Bin 1670 -> 0 bytes .../parts/part1/pics/qml-texteditor1_editmenu.png | Bin 6177 -> 0 bytes .../parts/part1/pics/qml-texteditor1_filemenu.png | Bin 6062 -> 0 bytes .../part1/pics/qml-texteditor1_simplebutton.png | Bin 1055 -> 0 bytes .../parts/part1/qml-texteditor.qmlproject | 14 - .../gettingStartedQml/parts/part2/Button.qml | 99 ---- .../gettingStartedQml/parts/part2/EditMenu.qml | 77 --- .../gettingStartedQml/parts/part2/FileMenu.qml | 92 ---- .../gettingStartedQml/parts/part2/MenuBar.qml | 140 ----- .../parts/part2/pics/qml-texteditor2_menubar.png | Bin 6079 -> 0 bytes .../parts/part2/qml-texteditor2.qmlproject | 14 - .../gettingStartedQml/parts/part3/Button.qml | 99 ---- .../gettingStartedQml/parts/part3/EditMenu.qml | 77 --- .../gettingStartedQml/parts/part3/FileMenu.qml | 92 ---- .../gettingStartedQml/parts/part3/MenuBar.qml | 140 ----- .../gettingStartedQml/parts/part3/TextArea.qml | 80 --- .../gettingStartedQml/parts/part3/TextEditor.qml | 68 --- .../gettingStartedQml/parts/part3/images/arrow.png | Bin 583 -> 0 bytes .../part3/pics/qml-texteditor3_texteditor.png | Bin 59345 -> 0 bytes .../parts/part3/qml-texteditor3.qmlproject | 14 - .../gettingStartedQml/parts/part4/Button.qml | 109 ---- .../gettingStartedQml/parts/part4/EditMenu.qml | 81 --- .../gettingStartedQml/parts/part4/FileMenu.qml | 96 ---- .../gettingStartedQml/parts/part4/MenuBar.qml | 146 ------ .../gettingStartedQml/parts/part4/SimpleButton.qml | 59 --- .../gettingStartedQml/parts/part4/TextArea.qml | 80 --- .../gettingStartedQml/parts/part4/TextEditor.qml | 146 ------ .../gettingStartedQml/parts/part4/images/arrow.png | Bin 583 -> 0 bytes .../part4/pics/qml-texteditor4_texteditor.png | Bin 63629 -> 0 bytes .../parts/part4/qml-texteditor4.qmlproject | 14 - .../gettingStartedQml/parts/part5/TextEditor.qml | 127 ----- .../gettingStartedQml/parts/part5/core/Button.qml | 109 ---- .../parts/part5/core/EditMenu.qml | 110 ---- .../parts/part5/core/FileDialog.qml | 171 ------ .../parts/part5/core/FileMenu.qml | 233 --------- .../gettingStartedQml/parts/part5/core/MenuBar.qml | 145 ----- .../parts/part5/core/TextArea.qml | 86 --- .../gettingStartedQml/parts/part5/core/qmldir | 11 - .../parts/part5/filedialog/dialogPlugin.cpp | 57 -- .../parts/part5/filedialog/dialogPlugin.h | 57 -- .../parts/part5/filedialog/directory.cpp | 219 -------- .../parts/part5/filedialog/directory.h | 108 ---- .../parts/part5/filedialog/file.cpp | 56 -- .../parts/part5/filedialog/file.h | 67 --- .../parts/part5/filedialog/filedialog.pro | 17 - .../parts/part5/filedialog/qmldir | 1 - .../gettingStartedQml/parts/part5/images/arrow.png | Bin 583 -> 0 bytes .../parts/part5/pics/qml-texteditor5_editmenu.png | Bin 65123 -> 0 bytes .../parts/part5/pics/qml-texteditor5_filemenu.png | Bin 21367 -> 0 bytes .../parts/part5/pics/qml-texteditor5_newfile.png | Bin 76693 -> 0 bytes .../parts/part5/qml-texteditor5.qmlproject | 14 - .../pics/qml-texteditor5_editmenu.png | Bin 65123 -> 0 bytes .../pics/qml-texteditor5_filemenu.png | Bin 21367 -> 0 bytes .../pics/qml-texteditor5_newfile.png | Bin 76693 -> 0 bytes .../tutorials/gettingStartedQml/texteditor.qml | 132 ----- examples/tutorials/helloworld/Cell.qml | 72 --- examples/tutorials/helloworld/tutorial1.qml | 63 --- examples/tutorials/helloworld/tutorial2.qml | 72 --- examples/tutorials/helloworld/tutorial3.qml | 91 ---- examples/tutorials/samegame/samegame1/Block.qml | 53 -- examples/tutorials/samegame/samegame1/Button.qml | 83 --- examples/tutorials/samegame/samegame1/samegame.qml | 82 --- .../samegame/samegame1/samegame1.qmlproject | 16 - examples/tutorials/samegame/samegame2/Block.qml | 51 -- examples/tutorials/samegame/samegame2/Button.qml | 81 --- examples/tutorials/samegame/samegame2/samegame.js | 63 --- examples/tutorials/samegame/samegame2/samegame.qml | 85 --- .../samegame/samegame2/samegame2.qmlproject | 16 - examples/tutorials/samegame/samegame3/Block.qml | 63 --- examples/tutorials/samegame/samegame3/Button.qml | 81 --- examples/tutorials/samegame/samegame3/Dialog.qml | 71 --- examples/tutorials/samegame/samegame3/samegame.js | 174 ------ examples/tutorials/samegame/samegame3/samegame.qml | 109 ---- .../samegame/samegame3/samegame3.qmlproject | 16 - .../samegame/samegame4/content/BoomBlock.qml | 122 ----- .../samegame/samegame4/content/Button.qml | 81 --- .../samegame/samegame4/content/Dialog.qml | 107 ---- .../samegame/samegame4/content/samegame.js | 226 -------- .../tutorials/samegame/samegame4/highscores/README | 1 - .../samegame/samegame4/highscores/score_data.xml | 2 - .../samegame/samegame4/highscores/score_style.xsl | 28 - .../samegame/samegame4/highscores/scores.php | 31 -- examples/tutorials/samegame/samegame4/samegame.qml | 115 ---- .../samegame/samegame4/samegame4.qmlproject | 16 - .../tutorials/samegame/shared/pics/background.jpg | Bin 36473 -> 0 bytes .../tutorials/samegame/shared/pics/blueStar.png | Bin 278 -> 0 bytes .../tutorials/samegame/shared/pics/blueStone.png | Bin 3054 -> 0 bytes .../tutorials/samegame/shared/pics/greenStar.png | Bin 273 -> 0 bytes .../tutorials/samegame/shared/pics/greenStone.png | Bin 2932 -> 0 bytes .../tutorials/samegame/shared/pics/redStar.png | Bin 274 -> 0 bytes .../tutorials/samegame/shared/pics/redStone.png | Bin 2902 -> 0 bytes examples/tutorials/samegame/shared/pics/star.png | Bin 262 -> 0 bytes .../tutorials/samegame/shared/pics/yellowStone.png | Bin 3056 -> 0 bytes examples/tutorials/tutorials.pro | 7 - examples/window/screen/screenInfo.qml | 90 ---- examples/window/window.pro | 9 - examples/window/window/Window.qml | 58 -- examples/window/window/nogui.qml | 50 -- examples/window/window/standalone.qml | 128 ----- examples/window/window/twowindows.qml | 89 ---- examples/window/window/window.cpp | 58 -- examples/window/window/window.pro | 11 - qtdeclarative.pro | 1 - .../doc/src/cppintegration/extending-tutorial.qdoc | 106 ++-- src/quick/doc/src/advtutorial.qdoc | 2 +- src/quick/doc/src/dynamicview-tutorial.qdoc | 4 +- src/quick/doc/src/tutorial.qdoc | 2 +- 1144 files changed, 28083 insertions(+), 28194 deletions(-) delete mode 100644 examples/demos/calqlatr/calqlatr.pro delete mode 100644 examples/demos/calqlatr/calqlatr.qml delete mode 100644 examples/demos/calqlatr/calqlatr.qmlproject delete mode 100644 examples/demos/calqlatr/content/Button.qml delete mode 100644 examples/demos/calqlatr/content/Display.qml delete mode 100644 examples/demos/calqlatr/content/NumberPad.qml delete mode 100644 examples/demos/calqlatr/content/StyleLabel.qml delete mode 100644 examples/demos/calqlatr/content/audio/touch.wav delete mode 100644 examples/demos/calqlatr/content/calculator.js delete mode 100644 examples/demos/calqlatr/content/images/icon-back.png delete mode 100644 examples/demos/calqlatr/content/images/icon-close.png delete mode 100644 examples/demos/calqlatr/content/images/icon-settings.png delete mode 100644 examples/demos/calqlatr/content/images/logo.png delete mode 100644 examples/demos/calqlatr/content/images/paper-edge-left.png delete mode 100644 examples/demos/calqlatr/content/images/paper-edge-right.png delete mode 100644 examples/demos/calqlatr/content/images/paper-grip.png delete mode 100644 examples/demos/calqlatr/content/images/settings-selected-a.png delete mode 100644 examples/demos/calqlatr/content/images/settings-selected-b.png delete mode 100644 examples/demos/calqlatr/content/images/touch-green.png delete mode 100644 examples/demos/calqlatr/content/images/touch-white.png delete mode 100644 examples/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png delete mode 100644 examples/demos/calqlatr/doc/src/calqlatr.qdoc delete mode 100644 examples/demos/calqlatr/main.cpp delete mode 100644 examples/demos/clocks/clocks.qml delete mode 100644 examples/demos/clocks/content/Clock.qml delete mode 100644 examples/demos/clocks/content/arrow.png delete mode 100644 examples/demos/clocks/content/background.png delete mode 100644 examples/demos/clocks/content/center.png delete mode 100644 examples/demos/clocks/content/clock-night.png delete mode 100644 examples/demos/clocks/content/clock.png delete mode 100644 examples/demos/clocks/content/hour.png delete mode 100644 examples/demos/clocks/content/minute.png delete mode 100644 examples/demos/clocks/content/quit.png delete mode 100644 examples/demos/clocks/content/second.png delete mode 100644 examples/demos/demos.pro delete mode 100644 examples/demos/maroon/content/BuildButton.qml delete mode 100644 examples/demos/maroon/content/GameCanvas.qml delete mode 100644 examples/demos/maroon/content/GameOverScreen.qml delete mode 100644 examples/demos/maroon/content/InfoBar.qml delete mode 100644 examples/demos/maroon/content/NewGameScreen.qml delete mode 100644 examples/demos/maroon/content/SoundEffect.qml delete mode 100644 examples/demos/maroon/content/audio/bomb-action.wav delete mode 100644 examples/demos/maroon/content/audio/catch-action.wav delete mode 100644 examples/demos/maroon/content/audio/catch.wav delete mode 100644 examples/demos/maroon/content/audio/currency.wav delete mode 100644 examples/demos/maroon/content/audio/factory-action.wav delete mode 100644 examples/demos/maroon/content/audio/melee-action.wav delete mode 100644 examples/demos/maroon/content/audio/projectile-action.wav delete mode 100644 examples/demos/maroon/content/audio/shooter-action.wav delete mode 100644 examples/demos/maroon/content/gfx/background.png delete mode 100644 examples/demos/maroon/content/gfx/bomb-action.png delete mode 100644 examples/demos/maroon/content/gfx/bomb-idle.png delete mode 100644 examples/demos/maroon/content/gfx/bomb.png delete mode 100644 examples/demos/maroon/content/gfx/button-help.png delete mode 100644 examples/demos/maroon/content/gfx/button-play.png delete mode 100644 examples/demos/maroon/content/gfx/catch-action.png delete mode 100644 examples/demos/maroon/content/gfx/catch.png delete mode 100644 examples/demos/maroon/content/gfx/cloud.png delete mode 100644 examples/demos/maroon/content/gfx/currency.png delete mode 100644 examples/demos/maroon/content/gfx/dialog-bomb.png delete mode 100644 examples/demos/maroon/content/gfx/dialog-factory.png delete mode 100644 examples/demos/maroon/content/gfx/dialog-melee.png delete mode 100644 examples/demos/maroon/content/gfx/dialog-pointer.png delete mode 100644 examples/demos/maroon/content/gfx/dialog-shooter.png delete mode 100644 examples/demos/maroon/content/gfx/dialog.png delete mode 100644 examples/demos/maroon/content/gfx/factory-action.png delete mode 100644 examples/demos/maroon/content/gfx/factory-idle.png delete mode 100644 examples/demos/maroon/content/gfx/factory.png delete mode 100644 examples/demos/maroon/content/gfx/grid.png delete mode 100644 examples/demos/maroon/content/gfx/help.png delete mode 100644 examples/demos/maroon/content/gfx/lifes.png delete mode 100644 examples/demos/maroon/content/gfx/logo-bubble.png delete mode 100644 examples/demos/maroon/content/gfx/logo-fish.png delete mode 100644 examples/demos/maroon/content/gfx/logo.png delete mode 100644 examples/demos/maroon/content/gfx/melee-action.png delete mode 100644 examples/demos/maroon/content/gfx/melee-idle.png delete mode 100644 examples/demos/maroon/content/gfx/melee.png delete mode 100644 examples/demos/maroon/content/gfx/mob-idle.png delete mode 100644 examples/demos/maroon/content/gfx/mob.png delete mode 100644 examples/demos/maroon/content/gfx/points.png delete mode 100644 examples/demos/maroon/content/gfx/projectile-action.png delete mode 100644 examples/demos/maroon/content/gfx/projectile.png delete mode 100644 examples/demos/maroon/content/gfx/scores.png delete mode 100644 examples/demos/maroon/content/gfx/shooter-action.png delete mode 100644 examples/demos/maroon/content/gfx/shooter-idle.png delete mode 100644 examples/demos/maroon/content/gfx/shooter.png delete mode 100644 examples/demos/maroon/content/gfx/sunlight.png delete mode 100644 examples/demos/maroon/content/gfx/text-1.png delete mode 100644 examples/demos/maroon/content/gfx/text-2.png delete mode 100644 examples/demos/maroon/content/gfx/text-3.png delete mode 100644 examples/demos/maroon/content/gfx/text-blank.png delete mode 100644 examples/demos/maroon/content/gfx/text-gameover.png delete mode 100644 examples/demos/maroon/content/gfx/text-go.png delete mode 100644 examples/demos/maroon/content/gfx/wave.png delete mode 100644 examples/demos/maroon/content/logic.js delete mode 100644 examples/demos/maroon/content/mobs/MobBase.qml delete mode 100644 examples/demos/maroon/content/towers/Bomb.qml delete mode 100644 examples/demos/maroon/content/towers/Factory.qml delete mode 100644 examples/demos/maroon/content/towers/Melee.qml delete mode 100644 examples/demos/maroon/content/towers/Ranged.qml delete mode 100644 examples/demos/maroon/content/towers/TowerBase.qml delete mode 100644 examples/demos/maroon/main.cpp delete mode 100644 examples/demos/maroon/maroon.pro delete mode 100644 examples/demos/maroon/maroon.qml delete mode 100644 examples/demos/maroon/maroon.qmlproject delete mode 100644 examples/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml delete mode 100644 examples/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml delete mode 100644 examples/demos/photoviewer/PhotoViewerCore/Button.qml delete mode 100644 examples/demos/photoviewer/PhotoViewerCore/EditableButton.qml delete mode 100644 examples/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml delete mode 100644 examples/demos/photoviewer/PhotoViewerCore/ProgressBar.qml delete mode 100644 examples/demos/photoviewer/PhotoViewerCore/RssModel.qml delete mode 100644 examples/demos/photoviewer/PhotoViewerCore/Tag.qml delete mode 100644 examples/demos/photoviewer/PhotoViewerCore/images/box-shadow.png delete mode 100644 examples/demos/photoviewer/PhotoViewerCore/images/busy.png delete mode 100644 examples/demos/photoviewer/PhotoViewerCore/images/cardboard.png delete mode 100644 examples/demos/photoviewer/PhotoViewerCore/qmldir delete mode 100644 examples/demos/photoviewer/PhotoViewerCore/script/script.js delete mode 100644 examples/demos/photoviewer/i18n/base.ts delete mode 100644 examples/demos/photoviewer/i18n/qml_fr.qm delete mode 100644 examples/demos/photoviewer/i18n/qml_fr.ts delete mode 100644 examples/demos/photoviewer/photoviewer.qml delete mode 100644 examples/demos/photoviewer/photoviewer.qmlproject delete mode 100644 examples/demos/rssnews/content/BusyIndicator.qml delete mode 100644 examples/demos/rssnews/content/CategoryDelegate.qml delete mode 100644 examples/demos/rssnews/content/NewsDelegate.qml delete mode 100644 examples/demos/rssnews/content/RssFeeds.qml delete mode 100644 examples/demos/rssnews/content/ScrollBar.qml delete mode 100644 examples/demos/rssnews/content/images/busy.png delete mode 100644 examples/demos/rssnews/content/images/scrollbar.png delete mode 100644 examples/demos/rssnews/rssnews.qml delete mode 100644 examples/demos/rssnews/rssnews.qmlproject delete mode 100644 examples/demos/samegame/content/Block.qml delete mode 100644 examples/demos/samegame/content/BlockEmitter.qml delete mode 100644 examples/demos/samegame/content/Button.qml delete mode 100644 examples/demos/samegame/content/GameArea.qml delete mode 100644 examples/demos/samegame/content/LogoAnimation.qml delete mode 100644 examples/demos/samegame/content/MenuEmitter.qml delete mode 100644 examples/demos/samegame/content/PaintEmitter.qml delete mode 100644 examples/demos/samegame/content/PrimaryPack.qml delete mode 100644 examples/demos/samegame/content/PuzzleBlock.qml delete mode 100644 examples/demos/samegame/content/SamegameText.qml delete mode 100644 examples/demos/samegame/content/SimpleBlock.qml delete mode 100644 examples/demos/samegame/content/SmokeText.qml delete mode 100644 examples/demos/samegame/content/gfx/background-puzzle.png delete mode 100644 examples/demos/samegame/content/gfx/background.png delete mode 100644 examples/demos/samegame/content/gfx/bar.png delete mode 100644 examples/demos/samegame/content/gfx/blue-puzzle.png delete mode 100644 examples/demos/samegame/content/gfx/blue.png delete mode 100644 examples/demos/samegame/content/gfx/bubble-highscore.png delete mode 100644 examples/demos/samegame/content/gfx/bubble-puzzle.png delete mode 100644 examples/demos/samegame/content/gfx/but-game-1.png delete mode 100644 examples/demos/samegame/content/gfx/but-game-2.png delete mode 100644 examples/demos/samegame/content/gfx/but-game-3.png delete mode 100644 examples/demos/samegame/content/gfx/but-game-4.png delete mode 100644 examples/demos/samegame/content/gfx/but-game-new.png delete mode 100644 examples/demos/samegame/content/gfx/but-menu.png delete mode 100644 examples/demos/samegame/content/gfx/but-puzzle-next.png delete mode 100644 examples/demos/samegame/content/gfx/but-quit.png delete mode 100644 examples/demos/samegame/content/gfx/green-puzzle.png delete mode 100644 examples/demos/samegame/content/gfx/green.png delete mode 100644 examples/demos/samegame/content/gfx/icon-fail.png delete mode 100644 examples/demos/samegame/content/gfx/icon-ok.png delete mode 100644 examples/demos/samegame/content/gfx/icon-time.png delete mode 100644 examples/demos/samegame/content/gfx/logo-a.png delete mode 100644 examples/demos/samegame/content/gfx/logo-e.png delete mode 100644 examples/demos/samegame/content/gfx/logo-g.png delete mode 100644 examples/demos/samegame/content/gfx/logo-m.png delete mode 100644 examples/demos/samegame/content/gfx/logo-s.png delete mode 100644 examples/demos/samegame/content/gfx/logo.png delete mode 100644 examples/demos/samegame/content/gfx/particle-brick.png delete mode 100644 examples/demos/samegame/content/gfx/particle-paint.png delete mode 100644 examples/demos/samegame/content/gfx/particle-smoke.png delete mode 100644 examples/demos/samegame/content/gfx/red-puzzle.png delete mode 100644 examples/demos/samegame/content/gfx/red.png delete mode 100644 examples/demos/samegame/content/gfx/text-highscore-new.png delete mode 100644 examples/demos/samegame/content/gfx/text-highscore.png delete mode 100644 examples/demos/samegame/content/gfx/text-no-winner.png delete mode 100644 examples/demos/samegame/content/gfx/text-p1-go.png delete mode 100644 examples/demos/samegame/content/gfx/text-p1-won.png delete mode 100644 examples/demos/samegame/content/gfx/text-p1.png delete mode 100644 examples/demos/samegame/content/gfx/text-p2-go.png delete mode 100644 examples/demos/samegame/content/gfx/text-p2-won.png delete mode 100644 examples/demos/samegame/content/gfx/text-p2.png delete mode 100644 examples/demos/samegame/content/gfx/yellow-puzzle.png delete mode 100644 examples/demos/samegame/content/gfx/yellow.png delete mode 100644 examples/demos/samegame/content/levels/TemplateBase.qml delete mode 100644 examples/demos/samegame/content/levels/level0.qml delete mode 100644 examples/demos/samegame/content/levels/level1.qml delete mode 100644 examples/demos/samegame/content/levels/level2.qml delete mode 100644 examples/demos/samegame/content/levels/level3.qml delete mode 100644 examples/demos/samegame/content/levels/level4.qml delete mode 100644 examples/demos/samegame/content/levels/level5.qml delete mode 100644 examples/demos/samegame/content/levels/level6.qml delete mode 100644 examples/demos/samegame/content/levels/level7.qml delete mode 100644 examples/demos/samegame/content/levels/level8.qml delete mode 100644 examples/demos/samegame/content/levels/level9.qml delete mode 100755 examples/demos/samegame/content/samegame.js delete mode 100644 examples/demos/samegame/main.cpp delete mode 100644 examples/demos/samegame/samegame.pro delete mode 100644 examples/demos/samegame/samegame.qml delete mode 100644 examples/demos/samegame/samegame.qmlproject delete mode 100644 examples/demos/samegame/settings.js delete mode 100644 examples/demos/stocqt/content/Button.qml delete mode 100644 examples/demos/stocqt/content/DatePicker.qml delete mode 100644 examples/demos/stocqt/content/StockChart.qml delete mode 100644 examples/demos/stocqt/content/StockListModel.qml delete mode 100644 examples/demos/stocqt/content/StockListView.qml delete mode 100644 examples/demos/stocqt/content/StockModel.qml delete mode 100644 examples/demos/stocqt/content/StockSettings.qml delete mode 100644 examples/demos/stocqt/content/StockView.qml delete mode 100644 examples/demos/stocqt/content/images/icon-calendar-anim.png delete mode 100644 examples/demos/stocqt/content/images/icon-calendar.png delete mode 100644 examples/demos/stocqt/content/images/icon-items.png delete mode 100644 examples/demos/stocqt/content/images/icon-settings.png delete mode 100644 examples/demos/stocqt/content/images/logo.png delete mode 100644 examples/demos/stocqt/content/images/stock-selected.png delete mode 100644 examples/demos/stocqt/content/images/wheel-touch.png delete mode 100644 examples/demos/stocqt/content/images/wheel.png delete mode 100644 examples/demos/stocqt/main.cpp delete mode 100644 examples/demos/stocqt/stocqt.pro delete mode 100644 examples/demos/stocqt/stocqt.qml delete mode 100644 examples/demos/stocqt/stocqt.qmlproject delete mode 100644 examples/demos/tweetsearch/content/FlipBar.qml delete mode 100644 examples/demos/tweetsearch/content/LineInput.qml delete mode 100644 examples/demos/tweetsearch/content/ListFooter.qml delete mode 100644 examples/demos/tweetsearch/content/ListHeader.qml delete mode 100644 examples/demos/tweetsearch/content/SearchDelegate.qml delete mode 100644 examples/demos/tweetsearch/content/TweetDelegate.qml delete mode 100644 examples/demos/tweetsearch/content/TweetsModel.qml delete mode 100644 examples/demos/tweetsearch/content/resources/anonymous.png delete mode 100644 examples/demos/tweetsearch/content/resources/bird-anim-sprites.png delete mode 100644 examples/demos/tweetsearch/content/resources/icon-clear.png delete mode 100644 examples/demos/tweetsearch/content/resources/icon-loading.png delete mode 100644 examples/demos/tweetsearch/content/resources/icon-refresh.png delete mode 100644 examples/demos/tweetsearch/content/resources/icon-search.png delete mode 100644 examples/demos/tweetsearch/content/tweetsearch.js delete mode 100644 examples/demos/tweetsearch/main.cpp delete mode 100644 examples/demos/tweetsearch/tweetsearch.pro delete mode 100644 examples/demos/tweetsearch/tweetsearch.qml delete mode 100644 examples/demos/tweetsearch/tweetsearch.qmlproject delete mode 100644 examples/localstorage/doc/src/localstorage.qdoc delete mode 100644 examples/localstorage/localstorage.pro delete mode 100644 examples/localstorage/localstorage/hello.qml delete mode 100644 examples/localstorage/localstorage/localstorage.pro delete mode 100644 examples/localstorage/localstorage/localstorage.qml delete mode 100644 examples/localstorage/localstorage/localstorage.qmlproject delete mode 100644 examples/localstorage/localstorage/main.cpp delete mode 100644 examples/particles/affectors/affectors.pro delete mode 100644 examples/particles/affectors/affectors.qml delete mode 100644 examples/particles/affectors/affectors.qmlproject delete mode 100644 examples/particles/affectors/content/GreyButton.qml delete mode 100644 examples/particles/affectors/content/age.qml delete mode 100644 examples/particles/affectors/content/attractor.qml delete mode 100644 examples/particles/affectors/content/customaffector.qml delete mode 100644 examples/particles/affectors/content/friction.qml delete mode 100644 examples/particles/affectors/content/gravity.qml delete mode 100644 examples/particles/affectors/content/groupgoal.qml delete mode 100644 examples/particles/affectors/content/move.qml delete mode 100644 examples/particles/affectors/content/spritegoal.qml delete mode 100644 examples/particles/affectors/content/turbulence.qml delete mode 100644 examples/particles/affectors/content/wander.qml delete mode 100644 examples/particles/affectors/doc/images/qml-affectors-example.png delete mode 100644 examples/particles/affectors/doc/src/affectors.qdoc delete mode 100644 examples/particles/affectors/main.cpp delete mode 100644 examples/particles/customparticle/content/blurparticles.qml delete mode 100644 examples/particles/customparticle/content/fragmentshader.qml delete mode 100644 examples/particles/customparticle/content/imagecolors.qml delete mode 100644 examples/particles/customparticle/customparticle.pro delete mode 100644 examples/particles/customparticle/customparticle.qml delete mode 100644 examples/particles/customparticle/customparticle.qmlproject delete mode 100644 examples/particles/customparticle/doc/images/qml-customparticle-example.png delete mode 100644 examples/particles/customparticle/doc/src/customparticle.qdoc delete mode 100644 examples/particles/customparticle/main.cpp delete mode 100644 examples/particles/emitters/content/burstandpulse.qml delete mode 100644 examples/particles/emitters/content/customemitter.qml delete mode 100644 examples/particles/emitters/content/emitmask.qml delete mode 100644 examples/particles/emitters/content/maximumemitted.qml delete mode 100644 examples/particles/emitters/content/shapeanddirection.qml delete mode 100644 examples/particles/emitters/content/trailemitter.qml delete mode 100644 examples/particles/emitters/content/velocityfrommotion.qml delete mode 100644 examples/particles/emitters/doc/images/qml-emitters-example.png delete mode 100644 examples/particles/emitters/doc/src/emitters.qdoc delete mode 100644 examples/particles/emitters/emitters.pro delete mode 100644 examples/particles/emitters/emitters.qml delete mode 100644 examples/particles/emitters/emitters.qmlproject delete mode 100644 examples/particles/emitters/main.cpp delete mode 100644 examples/particles/imageparticle/content/allatonce.qml delete mode 100644 examples/particles/imageparticle/content/colored.qml delete mode 100644 examples/particles/imageparticle/content/colortable.qml delete mode 100644 examples/particles/imageparticle/content/deformation.qml delete mode 100644 examples/particles/imageparticle/content/rotation.qml delete mode 100644 examples/particles/imageparticle/content/sharing.qml delete mode 100644 examples/particles/imageparticle/content/sprites.qml delete mode 100644 examples/particles/imageparticle/doc/images/qml-imageparticle-example.png delete mode 100644 examples/particles/imageparticle/doc/src/imageparticle.qdoc delete mode 100644 examples/particles/imageparticle/imageparticle.pro delete mode 100644 examples/particles/imageparticle/imageparticle.qml delete mode 100644 examples/particles/imageparticle/imageparticle.qmlproject delete mode 100644 examples/particles/imageparticle/main.cpp delete mode 100644 examples/particles/images/_explo.png delete mode 100755 examples/particles/images/backgroundLeaves.jpg delete mode 100644 examples/particles/images/bear_tiles.png delete mode 100644 examples/particles/images/candle.png delete mode 100644 examples/particles/images/colortable.png delete mode 100644 examples/particles/images/finalfrontier.png delete mode 100644 examples/particles/images/flower.png delete mode 100644 examples/particles/images/matchmask.png delete mode 100644 examples/particles/images/meteor.png delete mode 100644 examples/particles/images/meteor_explo.png delete mode 100644 examples/particles/images/meteors.png delete mode 100644 examples/particles/images/nullRock.png delete mode 100644 examples/particles/images/particle.png delete mode 100644 examples/particles/images/particle2.png delete mode 100644 examples/particles/images/particle3.png delete mode 100644 examples/particles/images/particle4.png delete mode 100644 examples/particles/images/particleA.png delete mode 100644 examples/particles/images/portal_bg.png delete mode 100644 examples/particles/images/realLeaf1.png delete mode 100644 examples/particles/images/realLeaf2.png delete mode 100644 examples/particles/images/realLeaf3.png delete mode 100644 examples/particles/images/realLeaf4.png delete mode 100644 examples/particles/images/rocket.png delete mode 100644 examples/particles/images/rocket2.png delete mode 100644 examples/particles/images/sizeInOut.png delete mode 100644 examples/particles/images/snowflake.png delete mode 100644 examples/particles/images/sparkleSize.png delete mode 100644 examples/particles/images/star.png delete mode 100644 examples/particles/images/starfish_0.png delete mode 100644 examples/particles/images/starfish_1.png delete mode 100644 examples/particles/images/starfish_2.png delete mode 100644 examples/particles/images/starfish_3.png delete mode 100644 examples/particles/images/starfish_4.png delete mode 100644 examples/particles/images/starfish_mask.png delete mode 100644 examples/particles/itemparticle/content/Delegate.qml delete mode 100644 examples/particles/itemparticle/content/Delegate2.qml delete mode 100644 examples/particles/itemparticle/content/ExpandingDelegate.qml delete mode 100644 examples/particles/itemparticle/content/RssModel.qml delete mode 100644 examples/particles/itemparticle/content/bubble.png delete mode 100644 examples/particles/itemparticle/content/script.js delete mode 100644 examples/particles/itemparticle/delegates.qml delete mode 100644 examples/particles/itemparticle/particleview.qml delete mode 100644 examples/particles/particles.pro delete mode 100644 examples/particles/system/content/dynamiccomparison.qml delete mode 100644 examples/particles/system/content/dynamicemitters.qml delete mode 100644 examples/particles/system/content/multiplepainters.qml delete mode 100644 examples/particles/system/content/startstop.qml delete mode 100644 examples/particles/system/content/timedgroupchanges.qml delete mode 100644 examples/particles/system/doc/images/qml-system-example.png delete mode 100644 examples/particles/system/doc/src/system.qdoc delete mode 100644 examples/particles/system/main.cpp delete mode 100644 examples/particles/system/system.pro delete mode 100644 examples/particles/system/system.qml delete mode 100644 examples/particles/system/system.qmlproject create mode 100644 examples/quick/demos/calqlatr/calqlatr.pro create mode 100644 examples/quick/demos/calqlatr/calqlatr.qml create mode 100644 examples/quick/demos/calqlatr/calqlatr.qmlproject create mode 100644 examples/quick/demos/calqlatr/content/Button.qml create mode 100644 examples/quick/demos/calqlatr/content/Display.qml create mode 100644 examples/quick/demos/calqlatr/content/NumberPad.qml create mode 100644 examples/quick/demos/calqlatr/content/StyleLabel.qml create mode 100644 examples/quick/demos/calqlatr/content/audio/touch.wav create mode 100644 examples/quick/demos/calqlatr/content/calculator.js create mode 100644 examples/quick/demos/calqlatr/content/images/icon-back.png create mode 100644 examples/quick/demos/calqlatr/content/images/icon-close.png create mode 100644 examples/quick/demos/calqlatr/content/images/icon-settings.png create mode 100644 examples/quick/demos/calqlatr/content/images/logo.png create mode 100644 examples/quick/demos/calqlatr/content/images/paper-edge-left.png create mode 100644 examples/quick/demos/calqlatr/content/images/paper-edge-right.png create mode 100644 examples/quick/demos/calqlatr/content/images/paper-grip.png create mode 100644 examples/quick/demos/calqlatr/content/images/settings-selected-a.png create mode 100644 examples/quick/demos/calqlatr/content/images/settings-selected-b.png create mode 100644 examples/quick/demos/calqlatr/content/images/touch-green.png create mode 100644 examples/quick/demos/calqlatr/content/images/touch-white.png create mode 100644 examples/quick/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png create mode 100644 examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc create mode 100644 examples/quick/demos/calqlatr/main.cpp create mode 100644 examples/quick/demos/clocks/clocks.qml create mode 100644 examples/quick/demos/clocks/content/Clock.qml create mode 100644 examples/quick/demos/clocks/content/arrow.png create mode 100644 examples/quick/demos/clocks/content/background.png create mode 100644 examples/quick/demos/clocks/content/center.png create mode 100644 examples/quick/demos/clocks/content/clock-night.png create mode 100644 examples/quick/demos/clocks/content/clock.png create mode 100644 examples/quick/demos/clocks/content/hour.png create mode 100644 examples/quick/demos/clocks/content/minute.png create mode 100644 examples/quick/demos/clocks/content/quit.png create mode 100644 examples/quick/demos/clocks/content/second.png create mode 100644 examples/quick/demos/demos.pro create mode 100644 examples/quick/demos/maroon/content/BuildButton.qml create mode 100644 examples/quick/demos/maroon/content/GameCanvas.qml create mode 100644 examples/quick/demos/maroon/content/GameOverScreen.qml create mode 100644 examples/quick/demos/maroon/content/InfoBar.qml create mode 100644 examples/quick/demos/maroon/content/NewGameScreen.qml create mode 100644 examples/quick/demos/maroon/content/SoundEffect.qml create mode 100644 examples/quick/demos/maroon/content/audio/bomb-action.wav create mode 100644 examples/quick/demos/maroon/content/audio/catch-action.wav create mode 100644 examples/quick/demos/maroon/content/audio/catch.wav create mode 100644 examples/quick/demos/maroon/content/audio/currency.wav create mode 100644 examples/quick/demos/maroon/content/audio/factory-action.wav create mode 100644 examples/quick/demos/maroon/content/audio/melee-action.wav create mode 100644 examples/quick/demos/maroon/content/audio/projectile-action.wav create mode 100644 examples/quick/demos/maroon/content/audio/shooter-action.wav create mode 100644 examples/quick/demos/maroon/content/gfx/background.png create mode 100644 examples/quick/demos/maroon/content/gfx/bomb-action.png create mode 100644 examples/quick/demos/maroon/content/gfx/bomb-idle.png create mode 100644 examples/quick/demos/maroon/content/gfx/bomb.png create mode 100644 examples/quick/demos/maroon/content/gfx/button-help.png create mode 100644 examples/quick/demos/maroon/content/gfx/button-play.png create mode 100644 examples/quick/demos/maroon/content/gfx/catch-action.png create mode 100644 examples/quick/demos/maroon/content/gfx/catch.png create mode 100644 examples/quick/demos/maroon/content/gfx/cloud.png create mode 100644 examples/quick/demos/maroon/content/gfx/currency.png create mode 100644 examples/quick/demos/maroon/content/gfx/dialog-bomb.png create mode 100644 examples/quick/demos/maroon/content/gfx/dialog-factory.png create mode 100644 examples/quick/demos/maroon/content/gfx/dialog-melee.png create mode 100644 examples/quick/demos/maroon/content/gfx/dialog-pointer.png create mode 100644 examples/quick/demos/maroon/content/gfx/dialog-shooter.png create mode 100644 examples/quick/demos/maroon/content/gfx/dialog.png create mode 100644 examples/quick/demos/maroon/content/gfx/factory-action.png create mode 100644 examples/quick/demos/maroon/content/gfx/factory-idle.png create mode 100644 examples/quick/demos/maroon/content/gfx/factory.png create mode 100644 examples/quick/demos/maroon/content/gfx/grid.png create mode 100644 examples/quick/demos/maroon/content/gfx/help.png create mode 100644 examples/quick/demos/maroon/content/gfx/lifes.png create mode 100644 examples/quick/demos/maroon/content/gfx/logo-bubble.png create mode 100644 examples/quick/demos/maroon/content/gfx/logo-fish.png create mode 100644 examples/quick/demos/maroon/content/gfx/logo.png create mode 100644 examples/quick/demos/maroon/content/gfx/melee-action.png create mode 100644 examples/quick/demos/maroon/content/gfx/melee-idle.png create mode 100644 examples/quick/demos/maroon/content/gfx/melee.png create mode 100644 examples/quick/demos/maroon/content/gfx/mob-idle.png create mode 100644 examples/quick/demos/maroon/content/gfx/mob.png create mode 100644 examples/quick/demos/maroon/content/gfx/points.png create mode 100644 examples/quick/demos/maroon/content/gfx/projectile-action.png create mode 100644 examples/quick/demos/maroon/content/gfx/projectile.png create mode 100644 examples/quick/demos/maroon/content/gfx/scores.png create mode 100644 examples/quick/demos/maroon/content/gfx/shooter-action.png create mode 100644 examples/quick/demos/maroon/content/gfx/shooter-idle.png create mode 100644 examples/quick/demos/maroon/content/gfx/shooter.png create mode 100644 examples/quick/demos/maroon/content/gfx/sunlight.png create mode 100644 examples/quick/demos/maroon/content/gfx/text-1.png create mode 100644 examples/quick/demos/maroon/content/gfx/text-2.png create mode 100644 examples/quick/demos/maroon/content/gfx/text-3.png create mode 100644 examples/quick/demos/maroon/content/gfx/text-blank.png create mode 100644 examples/quick/demos/maroon/content/gfx/text-gameover.png create mode 100644 examples/quick/demos/maroon/content/gfx/text-go.png create mode 100644 examples/quick/demos/maroon/content/gfx/wave.png create mode 100644 examples/quick/demos/maroon/content/logic.js create mode 100644 examples/quick/demos/maroon/content/mobs/MobBase.qml create mode 100644 examples/quick/demos/maroon/content/towers/Bomb.qml create mode 100644 examples/quick/demos/maroon/content/towers/Factory.qml create mode 100644 examples/quick/demos/maroon/content/towers/Melee.qml create mode 100644 examples/quick/demos/maroon/content/towers/Ranged.qml create mode 100644 examples/quick/demos/maroon/content/towers/TowerBase.qml create mode 100644 examples/quick/demos/maroon/main.cpp create mode 100644 examples/quick/demos/maroon/maroon.pro create mode 100644 examples/quick/demos/maroon/maroon.qml create mode 100644 examples/quick/demos/maroon/maroon.qmlproject create mode 100644 examples/quick/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml create mode 100644 examples/quick/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml create mode 100644 examples/quick/demos/photoviewer/PhotoViewerCore/Button.qml create mode 100644 examples/quick/demos/photoviewer/PhotoViewerCore/EditableButton.qml create mode 100644 examples/quick/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml create mode 100644 examples/quick/demos/photoviewer/PhotoViewerCore/ProgressBar.qml create mode 100644 examples/quick/demos/photoviewer/PhotoViewerCore/RssModel.qml create mode 100644 examples/quick/demos/photoviewer/PhotoViewerCore/Tag.qml create mode 100644 examples/quick/demos/photoviewer/PhotoViewerCore/images/box-shadow.png create mode 100644 examples/quick/demos/photoviewer/PhotoViewerCore/images/busy.png create mode 100644 examples/quick/demos/photoviewer/PhotoViewerCore/images/cardboard.png create mode 100644 examples/quick/demos/photoviewer/PhotoViewerCore/qmldir create mode 100644 examples/quick/demos/photoviewer/PhotoViewerCore/script/script.js create mode 100644 examples/quick/demos/photoviewer/i18n/base.ts create mode 100644 examples/quick/demos/photoviewer/i18n/qml_fr.qm create mode 100644 examples/quick/demos/photoviewer/i18n/qml_fr.ts create mode 100644 examples/quick/demos/photoviewer/photoviewer.qml create mode 100644 examples/quick/demos/photoviewer/photoviewer.qmlproject create mode 100644 examples/quick/demos/rssnews/content/BusyIndicator.qml create mode 100644 examples/quick/demos/rssnews/content/CategoryDelegate.qml create mode 100644 examples/quick/demos/rssnews/content/NewsDelegate.qml create mode 100644 examples/quick/demos/rssnews/content/RssFeeds.qml create mode 100644 examples/quick/demos/rssnews/content/ScrollBar.qml create mode 100644 examples/quick/demos/rssnews/content/images/busy.png create mode 100644 examples/quick/demos/rssnews/content/images/scrollbar.png create mode 100644 examples/quick/demos/rssnews/rssnews.qml create mode 100644 examples/quick/demos/rssnews/rssnews.qmlproject create mode 100644 examples/quick/demos/samegame/content/Block.qml create mode 100644 examples/quick/demos/samegame/content/BlockEmitter.qml create mode 100644 examples/quick/demos/samegame/content/Button.qml create mode 100644 examples/quick/demos/samegame/content/GameArea.qml create mode 100644 examples/quick/demos/samegame/content/LogoAnimation.qml create mode 100644 examples/quick/demos/samegame/content/MenuEmitter.qml create mode 100644 examples/quick/demos/samegame/content/PaintEmitter.qml create mode 100644 examples/quick/demos/samegame/content/PrimaryPack.qml create mode 100644 examples/quick/demos/samegame/content/PuzzleBlock.qml create mode 100644 examples/quick/demos/samegame/content/SamegameText.qml create mode 100644 examples/quick/demos/samegame/content/SimpleBlock.qml create mode 100644 examples/quick/demos/samegame/content/SmokeText.qml create mode 100644 examples/quick/demos/samegame/content/gfx/background-puzzle.png create mode 100644 examples/quick/demos/samegame/content/gfx/background.png create mode 100644 examples/quick/demos/samegame/content/gfx/bar.png create mode 100644 examples/quick/demos/samegame/content/gfx/blue-puzzle.png create mode 100644 examples/quick/demos/samegame/content/gfx/blue.png create mode 100644 examples/quick/demos/samegame/content/gfx/bubble-highscore.png create mode 100644 examples/quick/demos/samegame/content/gfx/bubble-puzzle.png create mode 100644 examples/quick/demos/samegame/content/gfx/but-game-1.png create mode 100644 examples/quick/demos/samegame/content/gfx/but-game-2.png create mode 100644 examples/quick/demos/samegame/content/gfx/but-game-3.png create mode 100644 examples/quick/demos/samegame/content/gfx/but-game-4.png create mode 100644 examples/quick/demos/samegame/content/gfx/but-game-new.png create mode 100644 examples/quick/demos/samegame/content/gfx/but-menu.png create mode 100644 examples/quick/demos/samegame/content/gfx/but-puzzle-next.png create mode 100644 examples/quick/demos/samegame/content/gfx/but-quit.png create mode 100644 examples/quick/demos/samegame/content/gfx/green-puzzle.png create mode 100644 examples/quick/demos/samegame/content/gfx/green.png create mode 100644 examples/quick/demos/samegame/content/gfx/icon-fail.png create mode 100644 examples/quick/demos/samegame/content/gfx/icon-ok.png create mode 100644 examples/quick/demos/samegame/content/gfx/icon-time.png create mode 100644 examples/quick/demos/samegame/content/gfx/logo-a.png create mode 100644 examples/quick/demos/samegame/content/gfx/logo-e.png create mode 100644 examples/quick/demos/samegame/content/gfx/logo-g.png create mode 100644 examples/quick/demos/samegame/content/gfx/logo-m.png create mode 100644 examples/quick/demos/samegame/content/gfx/logo-s.png create mode 100644 examples/quick/demos/samegame/content/gfx/logo.png create mode 100644 examples/quick/demos/samegame/content/gfx/particle-brick.png create mode 100644 examples/quick/demos/samegame/content/gfx/particle-paint.png create mode 100644 examples/quick/demos/samegame/content/gfx/particle-smoke.png create mode 100644 examples/quick/demos/samegame/content/gfx/red-puzzle.png create mode 100644 examples/quick/demos/samegame/content/gfx/red.png create mode 100644 examples/quick/demos/samegame/content/gfx/text-highscore-new.png create mode 100644 examples/quick/demos/samegame/content/gfx/text-highscore.png create mode 100644 examples/quick/demos/samegame/content/gfx/text-no-winner.png create mode 100644 examples/quick/demos/samegame/content/gfx/text-p1-go.png create mode 100644 examples/quick/demos/samegame/content/gfx/text-p1-won.png create mode 100644 examples/quick/demos/samegame/content/gfx/text-p1.png create mode 100644 examples/quick/demos/samegame/content/gfx/text-p2-go.png create mode 100644 examples/quick/demos/samegame/content/gfx/text-p2-won.png create mode 100644 examples/quick/demos/samegame/content/gfx/text-p2.png create mode 100644 examples/quick/demos/samegame/content/gfx/yellow-puzzle.png create mode 100644 examples/quick/demos/samegame/content/gfx/yellow.png create mode 100644 examples/quick/demos/samegame/content/levels/TemplateBase.qml create mode 100644 examples/quick/demos/samegame/content/levels/level0.qml create mode 100644 examples/quick/demos/samegame/content/levels/level1.qml create mode 100644 examples/quick/demos/samegame/content/levels/level2.qml create mode 100644 examples/quick/demos/samegame/content/levels/level3.qml create mode 100644 examples/quick/demos/samegame/content/levels/level4.qml create mode 100644 examples/quick/demos/samegame/content/levels/level5.qml create mode 100644 examples/quick/demos/samegame/content/levels/level6.qml create mode 100644 examples/quick/demos/samegame/content/levels/level7.qml create mode 100644 examples/quick/demos/samegame/content/levels/level8.qml create mode 100644 examples/quick/demos/samegame/content/levels/level9.qml create mode 100755 examples/quick/demos/samegame/content/samegame.js create mode 100644 examples/quick/demos/samegame/main.cpp create mode 100644 examples/quick/demos/samegame/samegame.pro create mode 100644 examples/quick/demos/samegame/samegame.qml create mode 100644 examples/quick/demos/samegame/samegame.qmlproject create mode 100644 examples/quick/demos/samegame/settings.js create mode 100644 examples/quick/demos/stocqt/content/Button.qml create mode 100644 examples/quick/demos/stocqt/content/DatePicker.qml create mode 100644 examples/quick/demos/stocqt/content/StockChart.qml create mode 100644 examples/quick/demos/stocqt/content/StockListModel.qml create mode 100644 examples/quick/demos/stocqt/content/StockListView.qml create mode 100644 examples/quick/demos/stocqt/content/StockModel.qml create mode 100644 examples/quick/demos/stocqt/content/StockSettings.qml create mode 100644 examples/quick/demos/stocqt/content/StockView.qml create mode 100644 examples/quick/demos/stocqt/content/images/icon-calendar-anim.png create mode 100644 examples/quick/demos/stocqt/content/images/icon-calendar.png create mode 100644 examples/quick/demos/stocqt/content/images/icon-items.png create mode 100644 examples/quick/demos/stocqt/content/images/icon-settings.png create mode 100644 examples/quick/demos/stocqt/content/images/logo.png create mode 100644 examples/quick/demos/stocqt/content/images/stock-selected.png create mode 100644 examples/quick/demos/stocqt/content/images/wheel-touch.png create mode 100644 examples/quick/demos/stocqt/content/images/wheel.png create mode 100644 examples/quick/demos/stocqt/main.cpp create mode 100644 examples/quick/demos/stocqt/stocqt.pro create mode 100644 examples/quick/demos/stocqt/stocqt.qml create mode 100644 examples/quick/demos/stocqt/stocqt.qmlproject create mode 100644 examples/quick/demos/tweetsearch/content/FlipBar.qml create mode 100644 examples/quick/demos/tweetsearch/content/LineInput.qml create mode 100644 examples/quick/demos/tweetsearch/content/ListFooter.qml create mode 100644 examples/quick/demos/tweetsearch/content/ListHeader.qml create mode 100644 examples/quick/demos/tweetsearch/content/SearchDelegate.qml create mode 100644 examples/quick/demos/tweetsearch/content/TweetDelegate.qml create mode 100644 examples/quick/demos/tweetsearch/content/TweetsModel.qml create mode 100644 examples/quick/demos/tweetsearch/content/resources/anonymous.png create mode 100644 examples/quick/demos/tweetsearch/content/resources/bird-anim-sprites.png create mode 100644 examples/quick/demos/tweetsearch/content/resources/icon-clear.png create mode 100644 examples/quick/demos/tweetsearch/content/resources/icon-loading.png create mode 100644 examples/quick/demos/tweetsearch/content/resources/icon-refresh.png create mode 100644 examples/quick/demos/tweetsearch/content/resources/icon-search.png create mode 100644 examples/quick/demos/tweetsearch/content/tweetsearch.js create mode 100644 examples/quick/demos/tweetsearch/main.cpp create mode 100644 examples/quick/demos/tweetsearch/tweetsearch.pro create mode 100644 examples/quick/demos/tweetsearch/tweetsearch.qml create mode 100644 examples/quick/demos/tweetsearch/tweetsearch.qmlproject create mode 100644 examples/quick/localstorage/doc/src/localstorage.qdoc create mode 100644 examples/quick/localstorage/localstorage.pro create mode 100644 examples/quick/localstorage/localstorage/hello.qml create mode 100644 examples/quick/localstorage/localstorage/localstorage.pro create mode 100644 examples/quick/localstorage/localstorage/localstorage.qml create mode 100644 examples/quick/localstorage/localstorage/localstorage.qmlproject create mode 100644 examples/quick/localstorage/localstorage/main.cpp create mode 100644 examples/quick/modelviews/browser.prx create mode 100644 examples/quick/particles/affectors/affectors.pro create mode 100644 examples/quick/particles/affectors/affectors.qml create mode 100644 examples/quick/particles/affectors/affectors.qmlproject create mode 100644 examples/quick/particles/affectors/content/GreyButton.qml create mode 100644 examples/quick/particles/affectors/content/age.qml create mode 100644 examples/quick/particles/affectors/content/attractor.qml create mode 100644 examples/quick/particles/affectors/content/customaffector.qml create mode 100644 examples/quick/particles/affectors/content/friction.qml create mode 100644 examples/quick/particles/affectors/content/gravity.qml create mode 100644 examples/quick/particles/affectors/content/groupgoal.qml create mode 100644 examples/quick/particles/affectors/content/move.qml create mode 100644 examples/quick/particles/affectors/content/spritegoal.qml create mode 100644 examples/quick/particles/affectors/content/turbulence.qml create mode 100644 examples/quick/particles/affectors/content/wander.qml create mode 100644 examples/quick/particles/affectors/doc/images/qml-affectors-example.png create mode 100644 examples/quick/particles/affectors/doc/src/affectors.qdoc create mode 100644 examples/quick/particles/affectors/main.cpp create mode 100644 examples/quick/particles/customparticle/content/blurparticles.qml create mode 100644 examples/quick/particles/customparticle/content/fragmentshader.qml create mode 100644 examples/quick/particles/customparticle/content/imagecolors.qml create mode 100644 examples/quick/particles/customparticle/customparticle.pro create mode 100644 examples/quick/particles/customparticle/customparticle.qml create mode 100644 examples/quick/particles/customparticle/customparticle.qmlproject create mode 100644 examples/quick/particles/customparticle/doc/images/qml-customparticle-example.png create mode 100644 examples/quick/particles/customparticle/doc/src/customparticle.qdoc create mode 100644 examples/quick/particles/customparticle/main.cpp create mode 100644 examples/quick/particles/emitters/content/burstandpulse.qml create mode 100644 examples/quick/particles/emitters/content/customemitter.qml create mode 100644 examples/quick/particles/emitters/content/emitmask.qml create mode 100644 examples/quick/particles/emitters/content/maximumemitted.qml create mode 100644 examples/quick/particles/emitters/content/shapeanddirection.qml create mode 100644 examples/quick/particles/emitters/content/trailemitter.qml create mode 100644 examples/quick/particles/emitters/content/velocityfrommotion.qml create mode 100644 examples/quick/particles/emitters/doc/images/qml-emitters-example.png create mode 100644 examples/quick/particles/emitters/doc/src/emitters.qdoc create mode 100644 examples/quick/particles/emitters/emitters.pro create mode 100644 examples/quick/particles/emitters/emitters.qml create mode 100644 examples/quick/particles/emitters/emitters.qmlproject create mode 100644 examples/quick/particles/emitters/main.cpp create mode 100644 examples/quick/particles/imageparticle/content/allatonce.qml create mode 100644 examples/quick/particles/imageparticle/content/colored.qml create mode 100644 examples/quick/particles/imageparticle/content/colortable.qml create mode 100644 examples/quick/particles/imageparticle/content/deformation.qml create mode 100644 examples/quick/particles/imageparticle/content/rotation.qml create mode 100644 examples/quick/particles/imageparticle/content/sharing.qml create mode 100644 examples/quick/particles/imageparticle/content/sprites.qml create mode 100644 examples/quick/particles/imageparticle/doc/images/qml-imageparticle-example.png create mode 100644 examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc create mode 100644 examples/quick/particles/imageparticle/imageparticle.pro create mode 100644 examples/quick/particles/imageparticle/imageparticle.qml create mode 100644 examples/quick/particles/imageparticle/imageparticle.qmlproject create mode 100644 examples/quick/particles/imageparticle/main.cpp create mode 100644 examples/quick/particles/images/_explo.png create mode 100755 examples/quick/particles/images/backgroundLeaves.jpg create mode 100644 examples/quick/particles/images/bear_tiles.png create mode 100644 examples/quick/particles/images/candle.png create mode 100644 examples/quick/particles/images/colortable.png create mode 100644 examples/quick/particles/images/finalfrontier.png create mode 100644 examples/quick/particles/images/flower.png create mode 100644 examples/quick/particles/images/matchmask.png create mode 100644 examples/quick/particles/images/meteor.png create mode 100644 examples/quick/particles/images/meteor_explo.png create mode 100644 examples/quick/particles/images/meteors.png create mode 100644 examples/quick/particles/images/nullRock.png create mode 100644 examples/quick/particles/images/particle.png create mode 100644 examples/quick/particles/images/particle2.png create mode 100644 examples/quick/particles/images/particle3.png create mode 100644 examples/quick/particles/images/particle4.png create mode 100644 examples/quick/particles/images/particleA.png create mode 100644 examples/quick/particles/images/portal_bg.png create mode 100644 examples/quick/particles/images/realLeaf1.png create mode 100644 examples/quick/particles/images/realLeaf2.png create mode 100644 examples/quick/particles/images/realLeaf3.png create mode 100644 examples/quick/particles/images/realLeaf4.png create mode 100644 examples/quick/particles/images/rocket.png create mode 100644 examples/quick/particles/images/rocket2.png create mode 100644 examples/quick/particles/images/sizeInOut.png create mode 100644 examples/quick/particles/images/snowflake.png create mode 100644 examples/quick/particles/images/sparkleSize.png create mode 100644 examples/quick/particles/images/star.png create mode 100644 examples/quick/particles/images/starfish_0.png create mode 100644 examples/quick/particles/images/starfish_1.png create mode 100644 examples/quick/particles/images/starfish_2.png create mode 100644 examples/quick/particles/images/starfish_3.png create mode 100644 examples/quick/particles/images/starfish_4.png create mode 100644 examples/quick/particles/images/starfish_mask.png create mode 100644 examples/quick/particles/itemparticle/content/Delegate.qml create mode 100644 examples/quick/particles/itemparticle/content/Delegate2.qml create mode 100644 examples/quick/particles/itemparticle/content/ExpandingDelegate.qml create mode 100644 examples/quick/particles/itemparticle/content/RssModel.qml create mode 100644 examples/quick/particles/itemparticle/content/bubble.png create mode 100644 examples/quick/particles/itemparticle/content/script.js create mode 100644 examples/quick/particles/itemparticle/delegates.qml create mode 100644 examples/quick/particles/itemparticle/particleview.qml create mode 100644 examples/quick/particles/particles.pro create mode 100644 examples/quick/particles/system/content/dynamiccomparison.qml create mode 100644 examples/quick/particles/system/content/dynamicemitters.qml create mode 100644 examples/quick/particles/system/content/multiplepainters.qml create mode 100644 examples/quick/particles/system/content/startstop.qml create mode 100644 examples/quick/particles/system/content/timedgroupchanges.qml create mode 100644 examples/quick/particles/system/doc/images/qml-system-example.png create mode 100644 examples/quick/particles/system/doc/src/system.qdoc create mode 100644 examples/quick/particles/system/main.cpp create mode 100644 examples/quick/particles/system/system.pro create mode 100644 examples/quick/particles/system/system.qml create mode 100644 examples/quick/particles/system/system.qmlproject create mode 100644 examples/quick/shared/Button.qml create mode 100644 examples/quick/shared/LauncherList.qml create mode 100644 examples/quick/shared/README create mode 100644 examples/quick/shared/SimpleLauncherDelegate.qml create mode 100644 examples/quick/shared/images/back.png create mode 100644 examples/quick/shared/qmldir create mode 100644 examples/quick/shared/shared.h create mode 100644 examples/quick/tutorials/dynamicview/dynamicview1/PetsModel.qml create mode 100644 examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml create mode 100644 examples/quick/tutorials/dynamicview/dynamicview2/PetsModel.qml create mode 100644 examples/quick/tutorials/dynamicview/dynamicview2/dynamicview.qml create mode 100644 examples/quick/tutorials/dynamicview/dynamicview3/PetsModel.qml create mode 100644 examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml create mode 100644 examples/quick/tutorials/dynamicview/dynamicview4/ListSelector.qml create mode 100644 examples/quick/tutorials/dynamicview/dynamicview4/PetsModel.qml create mode 100644 examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml create mode 100644 examples/quick/tutorials/extending/chapter1-basics/app.qml create mode 100644 examples/quick/tutorials/extending/chapter1-basics/chapter1-basics.pro create mode 100644 examples/quick/tutorials/extending/chapter1-basics/main.cpp create mode 100644 examples/quick/tutorials/extending/chapter1-basics/piechart.cpp create mode 100644 examples/quick/tutorials/extending/chapter1-basics/piechart.h create mode 100644 examples/quick/tutorials/extending/chapter2-methods/app.qml create mode 100644 examples/quick/tutorials/extending/chapter2-methods/chapter2-methods.pro create mode 100644 examples/quick/tutorials/extending/chapter2-methods/main.cpp create mode 100644 examples/quick/tutorials/extending/chapter2-methods/piechart.cpp create mode 100644 examples/quick/tutorials/extending/chapter2-methods/piechart.h create mode 100644 examples/quick/tutorials/extending/chapter3-bindings/app.qml create mode 100644 examples/quick/tutorials/extending/chapter3-bindings/chapter3-bindings.pro create mode 100644 examples/quick/tutorials/extending/chapter3-bindings/main.cpp create mode 100644 examples/quick/tutorials/extending/chapter3-bindings/piechart.cpp create mode 100644 examples/quick/tutorials/extending/chapter3-bindings/piechart.h create mode 100644 examples/quick/tutorials/extending/chapter4-customPropertyTypes/app.qml create mode 100644 examples/quick/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro create mode 100644 examples/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp create mode 100644 examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp create mode 100644 examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h create mode 100644 examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp create mode 100644 examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.h create mode 100644 examples/quick/tutorials/extending/chapter5-listproperties/app.qml create mode 100644 examples/quick/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro create mode 100644 examples/quick/tutorials/extending/chapter5-listproperties/main.cpp create mode 100644 examples/quick/tutorials/extending/chapter5-listproperties/piechart.cpp create mode 100644 examples/quick/tutorials/extending/chapter5-listproperties/piechart.h create mode 100644 examples/quick/tutorials/extending/chapter5-listproperties/pieslice.cpp create mode 100644 examples/quick/tutorials/extending/chapter5-listproperties/pieslice.h create mode 100644 examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir create mode 100644 examples/quick/tutorials/extending/chapter6-plugins/app.qml create mode 100644 examples/quick/tutorials/extending/chapter6-plugins/chapter6-plugins.pro create mode 100644 examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.cpp create mode 100644 examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.h create mode 100644 examples/quick/tutorials/extending/chapter6-plugins/piechart.cpp create mode 100644 examples/quick/tutorials/extending/chapter6-plugins/piechart.h create mode 100644 examples/quick/tutorials/extending/chapter6-plugins/pieslice.cpp create mode 100644 examples/quick/tutorials/extending/chapter6-plugins/pieslice.h create mode 100644 examples/quick/tutorials/extending/extending.pro create mode 100644 examples/quick/tutorials/gettingStartedQml/core/Button.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/core/EditMenu.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/core/FileDialog.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/core/FileMenu.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/core/MenuBar.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/core/TextArea.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/core/qmldir create mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp create mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.h create mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/directory.cpp create mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/directory.h create mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/file.cpp create mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/file.h create mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/filedialog.pro create mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/qmldir create mode 100644 examples/quick/tutorials/gettingStartedQml/gettingStartedQml.pro create mode 100644 examples/quick/tutorials/gettingStartedQml/images/arrow.png create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part0/Button.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part1/Button.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part1/EditMenu.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part1/FileMenu.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part1/SimpleButton.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_button.png create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_editmenu.png create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_filemenu.png create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_simplebutton.png create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part1/qml-texteditor.qmlproject create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part2/Button.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part2/EditMenu.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part2/FileMenu.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part2/MenuBar.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part2/pics/qml-texteditor2_menubar.png create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part2/qml-texteditor2.qmlproject create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part3/Button.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part3/EditMenu.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part3/FileMenu.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part3/MenuBar.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part3/TextArea.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part3/TextEditor.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part3/images/arrow.png create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part3/pics/qml-texteditor3_texteditor.png create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part3/qml-texteditor3.qmlproject create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part4/Button.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part4/EditMenu.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part4/FileMenu.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part4/MenuBar.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part4/SimpleButton.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part4/TextArea.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part4/TextEditor.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part4/images/arrow.png create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part4/pics/qml-texteditor4_texteditor.png create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part4/qml-texteditor4.qmlproject create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/TextEditor.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/core/Button.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/core/EditMenu.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/core/FileDialog.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/core/FileMenu.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/core/MenuBar.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/core/TextArea.qml create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/core/qmldir create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/directory.cpp create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/directory.h create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/file.cpp create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/file.h create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/filedialog.pro create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/qmldir create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/images/arrow.png create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_editmenu.png create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_filemenu.png create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_newfile.png create mode 100644 examples/quick/tutorials/gettingStartedQml/parts/part5/qml-texteditor5.qmlproject create mode 100644 examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_editmenu.png create mode 100644 examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_filemenu.png create mode 100644 examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_newfile.png create mode 100644 examples/quick/tutorials/gettingStartedQml/texteditor.qml create mode 100644 examples/quick/tutorials/helloworld/Cell.qml create mode 100644 examples/quick/tutorials/helloworld/tutorial1.qml create mode 100644 examples/quick/tutorials/helloworld/tutorial2.qml create mode 100644 examples/quick/tutorials/helloworld/tutorial3.qml create mode 100644 examples/quick/tutorials/samegame/samegame1/Block.qml create mode 100644 examples/quick/tutorials/samegame/samegame1/Button.qml create mode 100644 examples/quick/tutorials/samegame/samegame1/samegame.qml create mode 100644 examples/quick/tutorials/samegame/samegame1/samegame1.qmlproject create mode 100644 examples/quick/tutorials/samegame/samegame2/Block.qml create mode 100644 examples/quick/tutorials/samegame/samegame2/Button.qml create mode 100644 examples/quick/tutorials/samegame/samegame2/samegame.js create mode 100644 examples/quick/tutorials/samegame/samegame2/samegame.qml create mode 100644 examples/quick/tutorials/samegame/samegame2/samegame2.qmlproject create mode 100644 examples/quick/tutorials/samegame/samegame3/Block.qml create mode 100644 examples/quick/tutorials/samegame/samegame3/Button.qml create mode 100644 examples/quick/tutorials/samegame/samegame3/Dialog.qml create mode 100644 examples/quick/tutorials/samegame/samegame3/samegame.js create mode 100644 examples/quick/tutorials/samegame/samegame3/samegame.qml create mode 100644 examples/quick/tutorials/samegame/samegame3/samegame3.qmlproject create mode 100644 examples/quick/tutorials/samegame/samegame4/content/BoomBlock.qml create mode 100644 examples/quick/tutorials/samegame/samegame4/content/Button.qml create mode 100644 examples/quick/tutorials/samegame/samegame4/content/Dialog.qml create mode 100755 examples/quick/tutorials/samegame/samegame4/content/samegame.js create mode 100644 examples/quick/tutorials/samegame/samegame4/highscores/README create mode 100755 examples/quick/tutorials/samegame/samegame4/highscores/score_data.xml create mode 100755 examples/quick/tutorials/samegame/samegame4/highscores/score_style.xsl create mode 100755 examples/quick/tutorials/samegame/samegame4/highscores/scores.php create mode 100644 examples/quick/tutorials/samegame/samegame4/samegame.qml create mode 100644 examples/quick/tutorials/samegame/samegame4/samegame4.qmlproject create mode 100644 examples/quick/tutorials/samegame/shared/pics/background.jpg create mode 100644 examples/quick/tutorials/samegame/shared/pics/blueStar.png create mode 100644 examples/quick/tutorials/samegame/shared/pics/blueStone.png create mode 100644 examples/quick/tutorials/samegame/shared/pics/greenStar.png create mode 100644 examples/quick/tutorials/samegame/shared/pics/greenStone.png create mode 100644 examples/quick/tutorials/samegame/shared/pics/redStar.png create mode 100644 examples/quick/tutorials/samegame/shared/pics/redStone.png create mode 100644 examples/quick/tutorials/samegame/shared/pics/star.png create mode 100644 examples/quick/tutorials/samegame/shared/pics/yellowStone.png create mode 100644 examples/quick/tutorials/tutorials.pro create mode 100644 examples/quick/window/screen/screenInfo.qml create mode 100644 examples/quick/window/window.pro create mode 100644 examples/quick/window/window/Window.qml create mode 100644 examples/quick/window/window/nogui.qml create mode 100644 examples/quick/window/window/standalone.qml create mode 100644 examples/quick/window/window/twowindows.qml create mode 100644 examples/quick/window/window/window.cpp create mode 100644 examples/quick/window/window/window.pro delete mode 100644 examples/shared/Button.qml delete mode 100644 examples/shared/LauncherList.qml delete mode 100644 examples/shared/README delete mode 100644 examples/shared/SimpleLauncherDelegate.qml delete mode 100644 examples/shared/images/back.png delete mode 100644 examples/shared/qmldir delete mode 100644 examples/shared/shared.h delete mode 100644 examples/shared/shared.pro delete mode 100644 examples/tutorials/dynamicview/dynamicview1/PetsModel.qml delete mode 100644 examples/tutorials/dynamicview/dynamicview1/dynamicview.qml delete mode 100644 examples/tutorials/dynamicview/dynamicview2/PetsModel.qml delete mode 100644 examples/tutorials/dynamicview/dynamicview2/dynamicview.qml delete mode 100644 examples/tutorials/dynamicview/dynamicview3/PetsModel.qml delete mode 100644 examples/tutorials/dynamicview/dynamicview3/dynamicview.qml delete mode 100644 examples/tutorials/dynamicview/dynamicview4/ListSelector.qml delete mode 100644 examples/tutorials/dynamicview/dynamicview4/PetsModel.qml delete mode 100644 examples/tutorials/dynamicview/dynamicview4/dynamicview.qml delete mode 100644 examples/tutorials/extending/chapter1-basics/app.qml delete mode 100644 examples/tutorials/extending/chapter1-basics/chapter1-basics.pro delete mode 100644 examples/tutorials/extending/chapter1-basics/main.cpp delete mode 100644 examples/tutorials/extending/chapter1-basics/piechart.cpp delete mode 100644 examples/tutorials/extending/chapter1-basics/piechart.h delete mode 100644 examples/tutorials/extending/chapter2-methods/app.qml delete mode 100644 examples/tutorials/extending/chapter2-methods/chapter2-methods.pro delete mode 100644 examples/tutorials/extending/chapter2-methods/main.cpp delete mode 100644 examples/tutorials/extending/chapter2-methods/piechart.cpp delete mode 100644 examples/tutorials/extending/chapter2-methods/piechart.h delete mode 100644 examples/tutorials/extending/chapter3-bindings/app.qml delete mode 100644 examples/tutorials/extending/chapter3-bindings/chapter3-bindings.pro delete mode 100644 examples/tutorials/extending/chapter3-bindings/main.cpp delete mode 100644 examples/tutorials/extending/chapter3-bindings/piechart.cpp delete mode 100644 examples/tutorials/extending/chapter3-bindings/piechart.h delete mode 100644 examples/tutorials/extending/chapter4-customPropertyTypes/app.qml delete mode 100644 examples/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro delete mode 100644 examples/tutorials/extending/chapter4-customPropertyTypes/main.cpp delete mode 100644 examples/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp delete mode 100644 examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h delete mode 100644 examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp delete mode 100644 examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.h delete mode 100644 examples/tutorials/extending/chapter5-listproperties/app.qml delete mode 100644 examples/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro delete mode 100644 examples/tutorials/extending/chapter5-listproperties/main.cpp delete mode 100644 examples/tutorials/extending/chapter5-listproperties/piechart.cpp delete mode 100644 examples/tutorials/extending/chapter5-listproperties/piechart.h delete mode 100644 examples/tutorials/extending/chapter5-listproperties/pieslice.cpp delete mode 100644 examples/tutorials/extending/chapter5-listproperties/pieslice.h delete mode 100644 examples/tutorials/extending/chapter6-plugins/Charts/qmldir delete mode 100644 examples/tutorials/extending/chapter6-plugins/app.qml delete mode 100644 examples/tutorials/extending/chapter6-plugins/chapter6-plugins.pro delete mode 100644 examples/tutorials/extending/chapter6-plugins/chartsplugin.cpp delete mode 100644 examples/tutorials/extending/chapter6-plugins/chartsplugin.h delete mode 100644 examples/tutorials/extending/chapter6-plugins/piechart.cpp delete mode 100644 examples/tutorials/extending/chapter6-plugins/piechart.h delete mode 100644 examples/tutorials/extending/chapter6-plugins/pieslice.cpp delete mode 100644 examples/tutorials/extending/chapter6-plugins/pieslice.h delete mode 100644 examples/tutorials/extending/extending.pro delete mode 100644 examples/tutorials/gettingStartedQml/core/Button.qml delete mode 100644 examples/tutorials/gettingStartedQml/core/EditMenu.qml delete mode 100644 examples/tutorials/gettingStartedQml/core/FileDialog.qml delete mode 100644 examples/tutorials/gettingStartedQml/core/FileMenu.qml delete mode 100644 examples/tutorials/gettingStartedQml/core/MenuBar.qml delete mode 100644 examples/tutorials/gettingStartedQml/core/TextArea.qml delete mode 100644 examples/tutorials/gettingStartedQml/core/qmldir delete mode 100644 examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp delete mode 100644 examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.h delete mode 100644 examples/tutorials/gettingStartedQml/filedialog/directory.cpp delete mode 100644 examples/tutorials/gettingStartedQml/filedialog/directory.h delete mode 100644 examples/tutorials/gettingStartedQml/filedialog/file.cpp delete mode 100644 examples/tutorials/gettingStartedQml/filedialog/file.h delete mode 100644 examples/tutorials/gettingStartedQml/filedialog/filedialog.pro delete mode 100644 examples/tutorials/gettingStartedQml/filedialog/qmldir delete mode 100644 examples/tutorials/gettingStartedQml/gettingStartedQml.pro delete mode 100644 examples/tutorials/gettingStartedQml/images/arrow.png delete mode 100644 examples/tutorials/gettingStartedQml/parts/part0/Button.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part1/Button.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part1/EditMenu.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part1/FileMenu.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part1/SimpleButton.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_button.png delete mode 100644 examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_editmenu.png delete mode 100644 examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_filemenu.png delete mode 100644 examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_simplebutton.png delete mode 100644 examples/tutorials/gettingStartedQml/parts/part1/qml-texteditor.qmlproject delete mode 100644 examples/tutorials/gettingStartedQml/parts/part2/Button.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part2/EditMenu.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part2/FileMenu.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part2/MenuBar.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part2/pics/qml-texteditor2_menubar.png delete mode 100644 examples/tutorials/gettingStartedQml/parts/part2/qml-texteditor2.qmlproject delete mode 100644 examples/tutorials/gettingStartedQml/parts/part3/Button.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part3/EditMenu.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part3/FileMenu.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part3/MenuBar.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part3/TextArea.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part3/TextEditor.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part3/images/arrow.png delete mode 100644 examples/tutorials/gettingStartedQml/parts/part3/pics/qml-texteditor3_texteditor.png delete mode 100644 examples/tutorials/gettingStartedQml/parts/part3/qml-texteditor3.qmlproject delete mode 100644 examples/tutorials/gettingStartedQml/parts/part4/Button.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part4/EditMenu.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part4/FileMenu.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part4/MenuBar.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part4/SimpleButton.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part4/TextArea.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part4/TextEditor.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part4/images/arrow.png delete mode 100644 examples/tutorials/gettingStartedQml/parts/part4/pics/qml-texteditor4_texteditor.png delete mode 100644 examples/tutorials/gettingStartedQml/parts/part4/qml-texteditor4.qmlproject delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/TextEditor.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/core/Button.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/core/EditMenu.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/core/FileDialog.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/core/FileMenu.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/core/MenuBar.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/core/TextArea.qml delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/core/qmldir delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/filedialog/directory.cpp delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/filedialog/directory.h delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/filedialog/file.cpp delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/filedialog/file.h delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/filedialog/filedialog.pro delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/filedialog/qmldir delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/images/arrow.png delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_editmenu.png delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_filemenu.png delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_newfile.png delete mode 100644 examples/tutorials/gettingStartedQml/parts/part5/qml-texteditor5.qmlproject delete mode 100644 examples/tutorials/gettingStartedQml/pics/qml-texteditor5_editmenu.png delete mode 100644 examples/tutorials/gettingStartedQml/pics/qml-texteditor5_filemenu.png delete mode 100644 examples/tutorials/gettingStartedQml/pics/qml-texteditor5_newfile.png delete mode 100644 examples/tutorials/gettingStartedQml/texteditor.qml delete mode 100644 examples/tutorials/helloworld/Cell.qml delete mode 100644 examples/tutorials/helloworld/tutorial1.qml delete mode 100644 examples/tutorials/helloworld/tutorial2.qml delete mode 100644 examples/tutorials/helloworld/tutorial3.qml delete mode 100644 examples/tutorials/samegame/samegame1/Block.qml delete mode 100644 examples/tutorials/samegame/samegame1/Button.qml delete mode 100644 examples/tutorials/samegame/samegame1/samegame.qml delete mode 100644 examples/tutorials/samegame/samegame1/samegame1.qmlproject delete mode 100644 examples/tutorials/samegame/samegame2/Block.qml delete mode 100644 examples/tutorials/samegame/samegame2/Button.qml delete mode 100644 examples/tutorials/samegame/samegame2/samegame.js delete mode 100644 examples/tutorials/samegame/samegame2/samegame.qml delete mode 100644 examples/tutorials/samegame/samegame2/samegame2.qmlproject delete mode 100644 examples/tutorials/samegame/samegame3/Block.qml delete mode 100644 examples/tutorials/samegame/samegame3/Button.qml delete mode 100644 examples/tutorials/samegame/samegame3/Dialog.qml delete mode 100644 examples/tutorials/samegame/samegame3/samegame.js delete mode 100644 examples/tutorials/samegame/samegame3/samegame.qml delete mode 100644 examples/tutorials/samegame/samegame3/samegame3.qmlproject delete mode 100644 examples/tutorials/samegame/samegame4/content/BoomBlock.qml delete mode 100644 examples/tutorials/samegame/samegame4/content/Button.qml delete mode 100644 examples/tutorials/samegame/samegame4/content/Dialog.qml delete mode 100755 examples/tutorials/samegame/samegame4/content/samegame.js delete mode 100644 examples/tutorials/samegame/samegame4/highscores/README delete mode 100755 examples/tutorials/samegame/samegame4/highscores/score_data.xml delete mode 100755 examples/tutorials/samegame/samegame4/highscores/score_style.xsl delete mode 100755 examples/tutorials/samegame/samegame4/highscores/scores.php delete mode 100644 examples/tutorials/samegame/samegame4/samegame.qml delete mode 100644 examples/tutorials/samegame/samegame4/samegame4.qmlproject delete mode 100644 examples/tutorials/samegame/shared/pics/background.jpg delete mode 100644 examples/tutorials/samegame/shared/pics/blueStar.png delete mode 100644 examples/tutorials/samegame/shared/pics/blueStone.png delete mode 100644 examples/tutorials/samegame/shared/pics/greenStar.png delete mode 100644 examples/tutorials/samegame/shared/pics/greenStone.png delete mode 100644 examples/tutorials/samegame/shared/pics/redStar.png delete mode 100644 examples/tutorials/samegame/shared/pics/redStone.png delete mode 100644 examples/tutorials/samegame/shared/pics/star.png delete mode 100644 examples/tutorials/samegame/shared/pics/yellowStone.png delete mode 100644 examples/tutorials/tutorials.pro delete mode 100644 examples/window/screen/screenInfo.qml delete mode 100644 examples/window/window.pro delete mode 100644 examples/window/window/Window.qml delete mode 100644 examples/window/window/nogui.qml delete mode 100644 examples/window/window/standalone.qml delete mode 100644 examples/window/window/twowindows.qml delete mode 100644 examples/window/window/window.cpp delete mode 100644 examples/window/window/window.pro diff --git a/.qmake.conf b/.qmake.conf index 42ba8e45fb..5de255cb69 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1 +1,2 @@ load(qt_build_config) +CONFIG += qt_example_installs diff --git a/examples/demos/calqlatr/calqlatr.pro b/examples/demos/calqlatr/calqlatr.pro deleted file mode 100644 index 6a147f4ce6..0000000000 --- a/examples/demos/calqlatr/calqlatr.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app - -QT += qml quick -SOURCES += main.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/demos/calqlatr -qml.files = calqlatr.qml content -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/demos/calqlatr -sources.files = $$SOURCES calqlatr.pro -sources.path = $$qml.path -INSTALLS += target sources qml diff --git a/examples/demos/calqlatr/calqlatr.qml b/examples/demos/calqlatr/calqlatr.qml deleted file mode 100644 index 7640fbd738..0000000000 --- a/examples/demos/calqlatr/calqlatr.qml +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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/calculator.js" as CalcEngine - - -Rectangle { - id: window - width: 320 - height: 480 - focus: true - color: "#272822" - - onWidthChanged: controller.reload() - - function operatorPressed(operator) { CalcEngine.operatorPressed(operator) } - function digitPressed(digit) { CalcEngine.digitPressed(digit) } - - Item { - id: pad - width: window.width * 0.58 - NumberPad { y: 10; anchors.horizontalCenter: parent.horizontalCenter } - } - - AnimationController { - id: controller - animation: ParallelAnimation { - id: anim - NumberAnimation { target: display; property: "x"; duration: 400; from: -16; to: window.width - display.width; easing.type: Easing.InOutQuad } - NumberAnimation { target: pad; property: "x"; duration: 400; from: window.width - pad.width; to: 0; easing.type: Easing.InOutQuad } - SequentialAnimation { - NumberAnimation { target: pad; property: "scale"; duration: 200; from: 1; to: 0.97; easing.type: Easing.InOutQuad } - NumberAnimation { target: pad; property: "scale"; duration: 200; from: 0.97; to: 1; easing.type: Easing.InOutQuad } - } - } - } - - Display { - id: display - x: -16 - width: window.width * 0.42 - height: parent.height - - MouseArea { - property real startX: 0 - property real oldP: 0 - property bool rewind: false - - anchors.fill: parent - onPositionChanged: { - var reverse = startX > window.width / 2 - var mx = mapToItem(window, mouse.x).x - var p = Math.abs((mx - startX) / (window.width - display.width)) - if (p < oldP) - rewind = reverse ? false : true - else - rewind = reverse ? true : false - controller.progress = reverse ? 1 - p : p - oldP = p - } - onPressed: startX = mapToItem(window, mouse.x).x - onReleased: { - if (rewind) - controller.completeToBeginning() - else - controller.completeToEnd() - } - } - } - -} diff --git a/examples/demos/calqlatr/calqlatr.qmlproject b/examples/demos/calqlatr/calqlatr.qmlproject deleted file mode 100644 index ce2d59d310..0000000000 --- a/examples/demos/calqlatr/calqlatr.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "calqlatr.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/demos/calqlatr/content/Button.qml b/examples/demos/calqlatr/content/Button.qml deleted file mode 100644 index c355c2d105..0000000000 --- a/examples/demos/calqlatr/content/Button.qml +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 text: textItem.text - property alias color: textItem.color - - property bool operator: false - - signal clicked - - width: 30 - height: 50 - - Text { - id: textItem - font.pixelSize: 48 - wrapMode: Text.WordWrap - lineHeight: 0.75 - color: "white" - } - -// Rectangle { -// color: "red" -// opacity: 0.2 -// anchors.fill: mouse -// } - - MouseArea { - id: mouse - anchors.fill: parent - anchors.margins: -5 - onClicked: { - //parent.clicked() - if (operator) - window.operatorPressed(parent.text) - else - window.digitPressed(parent.text) - } - } -} diff --git a/examples/demos/calqlatr/content/Display.qml b/examples/demos/calqlatr/content/Display.qml deleted file mode 100644 index 3c1d9c0cd5..0000000000 --- a/examples/demos/calqlatr/content/Display.qml +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: display - - function displayOperator(operator) - { - listView.model.append({ "operator": operator, "operand": "" }) - } - - function newLine(operator, operand) - { - listView.model.append({ "operator": operator, "operand": operand }) - } - - function appendDigit(digit) - { - if (!listView.model.count) - listView.model.append({ "operator": "", "operand": "" }) - var i = listView.model.count - 1; - listView.model.get(i).operand = listView.model.get(i).operand + digit; - } - - Item { - id: theItem - width: parent.width + 32 - height: parent.height - - Rectangle { - id: rect - x: 16 - color: "white" - height: parent.height - width: display.width - 16 - } - Image { - anchors.right: rect.left - source: "images/paper-edge-left.png" - height: parent.height - fillMode: Image.TileVertically - } - Image { - anchors.left: rect.right - source: "images/paper-edge-right.png" - height: parent.height - fillMode: Image.TileVertically - } - - Image { - source: "images/paper-grip.png" - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - anchors.bottomMargin: 20 - } - - ListView { - id: listView - x: 16; y: 30 - width: display.width - height: display.height - delegate: Item { - height: 20 - width: parent.width - Text { - id: operator - x: 8 - font.pixelSize: 18 - color: "#6da43d" - text: model.operator - } - Text { - id: operand - font.pixelSize: 18 - anchors.right: parent.right - anchors.rightMargin: 26 - text: model.operand - } - } - model: ListModel { } - } - - } - -} diff --git a/examples/demos/calqlatr/content/NumberPad.qml b/examples/demos/calqlatr/content/NumberPad.qml deleted file mode 100644 index 853c7631c9..0000000000 --- a/examples/demos/calqlatr/content/NumberPad.qml +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -Grid { - columns: 3 - columnSpacing: 32 - rowSpacing: 16 - - Button { text: "7" } - Button { text: "8" } - Button { text: "9" } - Button { text: "4" } - Button { text: "5" } - Button { text: "6" } - Button { text: "1" } - Button { text: "2" } - Button { text: "3" } - Button { text: "0" } - Button { text: "." } - Button { text: " " } - Button { text: "±"; color: "#6da43d"; operator: true } - Button { text: "−"; color: "#6da43d"; operator: true } - Button { text: "+"; color: "#6da43d"; operator: true } - Button { text: " "; color: "#6da43d"; operator: true } - Button { text: "÷"; color: "#6da43d"; operator: true } - Button { text: "×"; color: "#6da43d"; operator: true } - Button { text: "C"; color: "#6da43d"; operator: true } - Button { text: " "; color: "#6da43d"; operator: true } - Button { text: "="; color: "#6da43d"; operator: true } -} diff --git a/examples/demos/calqlatr/content/StyleLabel.qml b/examples/demos/calqlatr/content/StyleLabel.qml deleted file mode 100644 index 3bdea86129..0000000000 --- a/examples/demos/calqlatr/content/StyleLabel.qml +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: 64 - font.pixelSize: 14 - font.bold: false - wrapMode: Text.WordWrap - lineHeight: 0.75 - color: "#676764" -} diff --git a/examples/demos/calqlatr/content/audio/touch.wav b/examples/demos/calqlatr/content/audio/touch.wav deleted file mode 100644 index 94cccb7546..0000000000 Binary files a/examples/demos/calqlatr/content/audio/touch.wav and /dev/null differ diff --git a/examples/demos/calqlatr/content/calculator.js b/examples/demos/calqlatr/content/calculator.js deleted file mode 100644 index 843ef39c02..0000000000 --- a/examples/demos/calqlatr/content/calculator.js +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -var curVal = 0 -var memory = 0 -var lastOp = "" -var previousOperator = "" -var digits = "" - -function disabled(op) { - if (op == "." && digits.toString().search(/\./) != -1) { - return true - } else if (op == window.squareRoot && digits.toString().search(/-/) != -1) { - return true - } else { - return false - } -} - -function digitPressed(op) -{ - if (disabled(op)) - return - if (digits.toString().length >= 14) - return - if (lastOp.toString().length == 1 && ((lastOp >= "0" && lastOp <= "9") || lastOp == ".") ) { - digits = digits + op.toString() - display.appendDigit(op.toString()) - } else { - digits = op - display.appendDigit(op.toString()) - } - lastOp = op -} - -function operatorPressed(op) -{ - if (disabled(op)) - return - lastOp = op - - if (previousOperator == "+") { - digits = Number(digits.valueOf()) + Number(curVal.valueOf()) - } else if (previousOperator == "−") { - digits = Number(curVal) - Number(digits.valueOf()) - } else if (previousOperator == "×") { - digits = Number(curVal) * Number(digits.valueOf()) - } else if (previousOperator == "÷") { - digits = Number(Number(curVal) / Number(digits.valueOf())).toString() - } else if (previousOperator == "=") { - } - - if (op == "+" || op == "−" || op == "×" || op == "÷") { - previousOperator = op - curVal = digits.valueOf() - display.displayOperator(previousOperator) - return - } - - if (op == "=") { - display.newLine("=", digits.toString()) - } - - curVal = 0 - previousOperator = "" - - if (op == "1/x") { - digits = (1 / digits.valueOf()).toString() - } else if (op == "x^2") { - digits = (digits.valueOf() * digits.valueOf()).toString() - } else if (op == "Abs") { - digits = (Math.abs(digits.valueOf())).toString() - } else if (op == "Int") { - digits = (Math.floor(digits.valueOf())).toString() - } else if (op == window.plusminus) { - digits = (digits.valueOf() * -1).toString() - } else if (op == window.squareRoot) { - digits = (Math.sqrt(digits.valueOf())).toString() - } else if (op == "mc") { - memory = 0; - } else if (op == "m+") { - memory += digits.valueOf() - } else if (op == "mr") { - digits = memory.toString() - } else if (op == "m-") { - memory = digits.valueOf() - } else if (op == window.leftArrow) { - digits = digits.toString().slice(0, -1) - if (digits.length == 0) { - digits = "0" - } - } else if (op == "Off") { - Qt.quit(); - } else if (op == "C") { - digits = "0" - } else if (op == "AC") { - curVal = 0 - memory = 0 - lastOp = "" - digits ="0" - } - - -} - diff --git a/examples/demos/calqlatr/content/images/icon-back.png b/examples/demos/calqlatr/content/images/icon-back.png deleted file mode 100644 index 2989ee2e35..0000000000 Binary files a/examples/demos/calqlatr/content/images/icon-back.png and /dev/null differ diff --git a/examples/demos/calqlatr/content/images/icon-close.png b/examples/demos/calqlatr/content/images/icon-close.png deleted file mode 100644 index 3e21248232..0000000000 Binary files a/examples/demos/calqlatr/content/images/icon-close.png and /dev/null differ diff --git a/examples/demos/calqlatr/content/images/icon-settings.png b/examples/demos/calqlatr/content/images/icon-settings.png deleted file mode 100644 index 98e662f53f..0000000000 Binary files a/examples/demos/calqlatr/content/images/icon-settings.png and /dev/null differ diff --git a/examples/demos/calqlatr/content/images/logo.png b/examples/demos/calqlatr/content/images/logo.png deleted file mode 100644 index 6bc65610bc..0000000000 Binary files a/examples/demos/calqlatr/content/images/logo.png and /dev/null differ diff --git a/examples/demos/calqlatr/content/images/paper-edge-left.png b/examples/demos/calqlatr/content/images/paper-edge-left.png deleted file mode 100644 index ca29a3ae10..0000000000 Binary files a/examples/demos/calqlatr/content/images/paper-edge-left.png and /dev/null differ diff --git a/examples/demos/calqlatr/content/images/paper-edge-right.png b/examples/demos/calqlatr/content/images/paper-edge-right.png deleted file mode 100644 index 7c2da7b930..0000000000 Binary files a/examples/demos/calqlatr/content/images/paper-edge-right.png and /dev/null differ diff --git a/examples/demos/calqlatr/content/images/paper-grip.png b/examples/demos/calqlatr/content/images/paper-grip.png deleted file mode 100644 index 953c408bca..0000000000 Binary files a/examples/demos/calqlatr/content/images/paper-grip.png and /dev/null differ diff --git a/examples/demos/calqlatr/content/images/settings-selected-a.png b/examples/demos/calqlatr/content/images/settings-selected-a.png deleted file mode 100644 index e08ddface8..0000000000 Binary files a/examples/demos/calqlatr/content/images/settings-selected-a.png and /dev/null differ diff --git a/examples/demos/calqlatr/content/images/settings-selected-b.png b/examples/demos/calqlatr/content/images/settings-selected-b.png deleted file mode 100644 index d9aa7e3431..0000000000 Binary files a/examples/demos/calqlatr/content/images/settings-selected-b.png and /dev/null differ diff --git a/examples/demos/calqlatr/content/images/touch-green.png b/examples/demos/calqlatr/content/images/touch-green.png deleted file mode 100644 index 64dbde66b1..0000000000 Binary files a/examples/demos/calqlatr/content/images/touch-green.png and /dev/null differ diff --git a/examples/demos/calqlatr/content/images/touch-white.png b/examples/demos/calqlatr/content/images/touch-white.png deleted file mode 100644 index bb02b000cf..0000000000 Binary files a/examples/demos/calqlatr/content/images/touch-white.png and /dev/null differ diff --git a/examples/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png b/examples/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png deleted file mode 100644 index af67f63dd1..0000000000 Binary files a/examples/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png and /dev/null differ diff --git a/examples/demos/calqlatr/doc/src/calqlatr.qdoc b/examples/demos/calqlatr/doc/src/calqlatr.qdoc deleted file mode 100644 index 366f01ea2c..0000000000 --- a/examples/demos/calqlatr/doc/src/calqlatr.qdoc +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** 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. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title QML Demo - Calqlatr - \example demos/calqlatr - \brief This is an example calculator written in QML. - \image qml-calqlatr-demo-small.png - \ingroup qmldemos - - This demo implements a simple calculator app, designed for portrait devices. - - This app has the logic implemented in Javascipt and the appearance implemented in QML. -*/ - diff --git a/examples/demos/calqlatr/main.cpp b/examples/demos/calqlatr/main.cpp deleted file mode 100644 index 9000bfc7d7..0000000000 --- a/examples/demos/calqlatr/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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(calqlatr) diff --git a/examples/demos/clocks/clocks.qml b/examples/demos/clocks/clocks.qml deleted file mode 100644 index 020fe32908..0000000000 --- a/examples/demos/clocks/clocks.qml +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 05317b1151..0000000000 --- a/examples/demos/clocks/content/Clock.qml +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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" - 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" - 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" - 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/arrow.png b/examples/demos/clocks/content/arrow.png deleted file mode 100644 index e437312217..0000000000 Binary files a/examples/demos/clocks/content/arrow.png and /dev/null differ diff --git a/examples/demos/clocks/content/background.png b/examples/demos/clocks/content/background.png deleted file mode 100644 index a885950862..0000000000 Binary files a/examples/demos/clocks/content/background.png and /dev/null differ diff --git a/examples/demos/clocks/content/center.png b/examples/demos/clocks/content/center.png deleted file mode 100644 index 7fbd802a44..0000000000 Binary files a/examples/demos/clocks/content/center.png and /dev/null differ diff --git a/examples/demos/clocks/content/clock-night.png b/examples/demos/clocks/content/clock-night.png deleted file mode 100644 index cc7151a397..0000000000 Binary files a/examples/demos/clocks/content/clock-night.png and /dev/null differ diff --git a/examples/demos/clocks/content/clock.png b/examples/demos/clocks/content/clock.png deleted file mode 100644 index 462edacc0e..0000000000 Binary files a/examples/demos/clocks/content/clock.png and /dev/null differ diff --git a/examples/demos/clocks/content/hour.png b/examples/demos/clocks/content/hour.png deleted file mode 100644 index f8061a1235..0000000000 Binary files a/examples/demos/clocks/content/hour.png and /dev/null differ diff --git a/examples/demos/clocks/content/minute.png b/examples/demos/clocks/content/minute.png deleted file mode 100644 index 1297ec7c2b..0000000000 Binary files a/examples/demos/clocks/content/minute.png and /dev/null differ diff --git a/examples/demos/clocks/content/quit.png b/examples/demos/clocks/content/quit.png deleted file mode 100644 index b822057d4e..0000000000 Binary files a/examples/demos/clocks/content/quit.png and /dev/null differ diff --git a/examples/demos/clocks/content/second.png b/examples/demos/clocks/content/second.png deleted file mode 100644 index 4aa9fb5e8e..0000000000 Binary files a/examples/demos/clocks/content/second.png and /dev/null differ diff --git a/examples/demos/demos.pro b/examples/demos/demos.pro deleted file mode 100644 index b243396986..0000000000 --- a/examples/demos/demos.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = calqlatr \ - samegame \ - tweetsearch \ - maroon \ - stocqt - -# install -sources.files = demos.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/demos -INSTALLS += sources diff --git a/examples/demos/maroon/content/BuildButton.qml b/examples/demos/maroon/content/BuildButton.qml deleted file mode 100644 index 49641fcecc..0000000000 --- a/examples/demos/maroon/content/BuildButton.qml +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "logic.js" as Logic - -Item { - id: container - width: 64 - height: 64 - property alias source: img.source - property int index - property int row: 0 - property int col: 0 - property int towerType - property bool canBuild: true - property Item gameCanvas: parent.parent.parent - signal clicked() - - Image { - id: img - opacity: (canBuild && gameCanvas.coins >= Logic.towerData[towerType-1].cost) ? 1.0 : 0.4 - } - Text { - anchors.right: parent.right - font.pointSize: 14 - font.bold: true - color: "#ffffff" - text: Logic.towerData[towerType - 1].cost - } - MouseArea { - anchors.fill: parent - onClicked: { - Logic.buildTower(towerType, col, row) - container.clicked() - } - } - Image { - visible: col == index && row != 0 - source: "gfx/dialog-pointer.png" - anchors.top: parent.bottom - anchors.topMargin: 4 - anchors.horizontalCenter: parent.horizontalCenter - } - Image { - visible: col == index && row == 0 - source: "gfx/dialog-pointer.png" - rotation: 180 - anchors.bottom: parent.top - anchors.bottomMargin: 6 - anchors.horizontalCenter: parent.horizontalCenter - } -} diff --git a/examples/demos/maroon/content/GameCanvas.qml b/examples/demos/maroon/content/GameCanvas.qml deleted file mode 100644 index 5e6e963e84..0000000000 --- a/examples/demos/maroon/content/GameCanvas.qml +++ /dev/null @@ -1,240 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "logic.js" as Logic -import "towers" as Towers - -Item { - id: grid - - property int squareSize: 64 - property int rows: 6 - property int cols: 4 - property Item canvas: grid - property int score: 0 - property int coins: 100 - property int lives: 3 - property int waveNumber: 0 - property int waveProgress: 0 - property var towers - property var mobs - property bool gameRunning: false - property bool gameOver: false - property bool errored: false - property string errorString: "" - - width: cols * squareSize - height: rows * squareSize - - function freshState() { - lives = 3 - coins = 100 - score = 0 - waveNumber = 0 - waveProgress = 0 - gameOver = false - gameRunning = false - towerMenu.shown = false - helpButton.comeBack(); - } - - Text { - id: errorText // Mostly for debug purposes - text: errorString - visible: errored - color: "red" - font.pixelSize: 18 - wrapMode: Text.WordWrap - width: parent.width / 1.2 - height: parent.height / 1.2 - anchors.centerIn: parent - z: 1000 - } - - Timer { - interval: 16 - running: true - repeat: true - onTriggered: Logic.tick() - } - - MouseArea { - id: ma - anchors.fill: parent - onClicked: { - if (towerMenu.visible) - towerMenu.finish() - else - towerMenu.open(mouse.x, mouse.y) - } - } - - Image { - id: towerMenu - visible: false - z: 1500 - scale: 0.9 - opacity: 0.7 - property int dragDistance: 16 - property int targetRow: 0 - property int targetCol: 0 - property bool shown: false - property bool towerExists: false - - function finish() { - shown = false - } - - function open(xp,yp) { - if (!grid.gameRunning) - return - targetRow = Logic.row(yp) - targetCol = Logic.col(xp) - if (targetRow == 0) - towerMenu.y = (targetRow + 1) * grid.squareSize - else - towerMenu.y = (targetRow - 1) * grid.squareSize - towerExists = (grid.towers[Logic.towerIdx(targetCol, targetRow)] != null) - shown = true - helpButton.goAway(); - } - - states: State { - name: "shown"; when: towerMenu.shown && !grid.gameOver - PropertyChanges { target: towerMenu; visible: true; scale: 1; opacity: 1 } - } - - transitions: Transition { - PropertyAction { property: "visible" } - NumberAnimation { properties: "opacity,scale"; duration: 500; easing.type: Easing.OutElastic } - } - - x: -32 - source: "gfx/dialog.png" - Row { - id: buttonRow - height: 100 - anchors.centerIn: parent - spacing: 8 - BuildButton { - row: towerMenu.targetRow; col: towerMenu.targetCol - anchors.verticalCenter: parent.verticalCenter - towerType: 1; index: 0 - canBuild: !towerMenu.towerExists - source: "gfx/dialog-melee.png" - onClicked: towerMenu.finish() - } - BuildButton { - row: towerMenu.targetRow; col: towerMenu.targetCol - anchors.verticalCenter: parent.verticalCenter - towerType: 2; index: 1 - canBuild: !towerMenu.towerExists - source: "gfx/dialog-shooter.png" - onClicked: towerMenu.finish() - } - BuildButton { - row: towerMenu.targetRow; col: towerMenu.targetCol - anchors.verticalCenter: parent.verticalCenter - towerType: 3; index: 2 - canBuild: !towerMenu.towerExists - source: "gfx/dialog-bomb.png" - onClicked: towerMenu.finish() - } - BuildButton { - row: towerMenu.targetRow; col: towerMenu.targetCol - anchors.verticalCenter: parent.verticalCenter - towerType: 4; index: 3 - canBuild: !towerMenu.towerExists - source: "gfx/dialog-factory.png" - onClicked: towerMenu.finish() - } - } - } - - - Keys.onPressed: { // Cheat Codes while Testing - if (event.key == Qt.Key_Up && (event.modifiers & Qt.ShiftModifier)) - grid.coins += 10; - if (event.key == Qt.Key_Left && (event.modifiers & Qt.ShiftModifier)) - grid.lives += 1; - if (event.key == Qt.Key_Down && (event.modifiers & Qt.ShiftModifier)) - Logic.gameState.waveProgress += 1000; - if (event.key == Qt.Key_Right && (event.modifiers & Qt.ShiftModifier)) - Logic.endGame(); - } - - Image { - id: helpButton - z: 1010 - source: "gfx/button-help.png" - function goAway() { - helpMA.enabled = false; - helpButton.opacity = 0; - } - function comeBack() { - helpMA.enabled = true; - helpButton.opacity = 1; - } - Behavior on opacity { NumberAnimation {} } - MouseArea { - id: helpMA - anchors.fill: parent - onClicked: {helpImage.visible = true; helpButton.visible = false;} - } - - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - anchors.bottomMargin: 0 - } - - Image { - id: helpImage - z: 1010 - source: "gfx/help.png" - anchors.fill: parent - visible: false - MouseArea { - anchors.fill: parent - onClicked: helpImage.visible = false; - } - } - -} diff --git a/examples/demos/maroon/content/GameOverScreen.qml b/examples/demos/maroon/content/GameOverScreen.qml deleted file mode 100644 index dfb439fbb9..0000000000 --- a/examples/demos/maroon/content/GameOverScreen.qml +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "logic.js" as Logic - -Item { - id: gameOverScreen - width: 320 - height: 400 - property GameCanvas gameCanvas - - Image { - id: img - source: "gfx/text-gameover.png" - anchors.centerIn: parent - } - - ParticleSystem { - anchors.fill: parent - ImageParticle { - id: cloud - source: "gfx/cloud.png" - alphaVariation: 0.25 - opacity: 0.25 - } - - Wander { - xVariance: 100; - pace: 1; - } - - Emitter { - id: cloudLeft - width: 160 - height: 160 - anchors.right: parent.left - emitRate: 0.5 - lifeSpan: 12000 - velocity: PointDirection{ x: 64; xVariation: 2; yVariation: 2 } - size: 160 - } - - Emitter { - id: cloudRight - width: 160 - height: 160 - anchors.left: parent.right - emitRate: 0.5 - lifeSpan: 12000 - velocity: PointDirection{ x: -64; xVariation: 2; yVariation: 2 } - size: 160 - } - } - - - Text { - visible: gameCanvas != undefined - text: "You saved " + gameCanvas.score + " fishes!" - anchors.top: img.bottom - anchors.topMargin: 12 - anchors.horizontalCenter: parent.horizontalCenter - font.bold: true - color: "#000000" - opacity: 0.5 - } - - Image { - source: "gfx/button-play.png" - anchors.bottom: parent.bottom - anchors.bottomMargin: 0 - MouseArea { - anchors.fill: parent - onClicked: gameCanvas.gameOver = false//This will actually trigger the state change in main.qml - } - } -} diff --git a/examples/demos/maroon/content/InfoBar.qml b/examples/demos/maroon/content/InfoBar.qml deleted file mode 100644 index 36303fc4fe..0000000000 --- a/examples/demos/maroon/content/InfoBar.qml +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 { - height: childrenRect.height - - // Display the number of lives - Row { - anchors.left: parent.left - anchors.leftMargin: 10 - spacing: 5 - Repeater { - id: rep - model: Math.min(10, canvas.lives) - delegate: Image { source: "gfx/lifes.png" } - } - } - - // Display the number of fishes saved - Row { - anchors.right: points.left - anchors.rightMargin: 20 - spacing: 5 - Image { source: "gfx/scores.png" } - Text { - text: canvas.score - font.bold: true - } - } - - // Display the number of coins - Row { - id: points - anchors.right: parent.right - anchors.rightMargin: 10 - spacing: 5 - Image { source: "gfx/points.png" } - Text { - id: pointsLabel - text: canvas.coins - font.bold: true - } - } -} - diff --git a/examples/demos/maroon/content/NewGameScreen.qml b/examples/demos/maroon/content/NewGameScreen.qml deleted file mode 100644 index 495e3aaa8e..0000000000 --- a/examples/demos/maroon/content/NewGameScreen.qml +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 the first screen. -// It shows the logo and emit a startButtonClicked signal -// when the user press the "PLAY" button. - -Item { - id: newGameScreen - width: 320 - height: 480 - - signal startButtonClicked - - Image { - source: "gfx/logo.png" - anchors.top: parent.top - anchors.topMargin: 60 - } - - Image { - source: "gfx/logo-fish.png" - anchors.top: parent.top - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x + 148; to: x + 25; duration: 2000; easing.type: Easing.InOutQuad } - NumberAnimation { from: x + 25; to: x + 148; duration: 1600; easing.type: Easing.InOutQuad } - } - SequentialAnimation on anchors.topMargin { - loops: Animation.Infinite - NumberAnimation { from: 100; to: 60; duration: 1600; easing.type: Easing.InOutQuad } - NumberAnimation { from: 60; to: 100; duration: 2000; easing.type: Easing.InOutQuad } - } - } - - Image { - source: "gfx/logo-bubble.png" - anchors.top: parent.top - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x + 140; to: x + 40; duration: 2000; easing.type: Easing.InOutQuad } - NumberAnimation { from: x + 40; to: x + 140; duration: 1600; easing.type: Easing.InOutQuad } - } - SequentialAnimation on anchors.topMargin { - loops: Animation.Infinite - NumberAnimation { from: 100; to: 60; duration: 1600; easing.type: Easing.InOutQuad } - NumberAnimation { from: 60; to: 100; duration: 2000; easing.type: Easing.InOutQuad } - } - SequentialAnimation on width { - loops: Animation.Infinite - NumberAnimation { from: 140; to: 160; duration: 1000; easing.type: Easing.InOutQuad } - NumberAnimation { from: 160; to: 140; duration: 800; easing.type: Easing.InOutQuad } - } - SequentialAnimation on height { - loops: Animation.Infinite - NumberAnimation { from: 150; to: 140; duration: 800; easing.type: Easing.InOutQuad } - NumberAnimation { from: 140; to: 150; duration: 1000; easing.type: Easing.InOutQuad } - } - } - - Image { - source: "gfx/button-play.png" - anchors.bottom: parent.bottom - anchors.bottomMargin: 60 - MouseArea { - anchors.fill: parent - onClicked: newGameScreen.startButtonClicked() - } - } -} diff --git a/examples/demos/maroon/content/SoundEffect.qml b/examples/demos/maroon/content/SoundEffect.qml deleted file mode 100644 index d286a397c1..0000000000 --- a/examples/demos/maroon/content/SoundEffect.qml +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 -//Proxies a SoundEffect if QtMultimedia is installed -Item { - id: container - property QtObject effect: Qt.createQmlObject("import QtMultimedia 5.0; SoundEffect{ source: '" + container.source + "' }", container); - property url source: "" - onSourceChanged: if (effect != null) effect.source = source; - function play() { - if (effect != null) - effect.play(); - } - -} diff --git a/examples/demos/maroon/content/audio/bomb-action.wav b/examples/demos/maroon/content/audio/bomb-action.wav deleted file mode 100644 index b334dc1e5b..0000000000 Binary files a/examples/demos/maroon/content/audio/bomb-action.wav and /dev/null differ diff --git a/examples/demos/maroon/content/audio/catch-action.wav b/examples/demos/maroon/content/audio/catch-action.wav deleted file mode 100644 index 3e22124abf..0000000000 Binary files a/examples/demos/maroon/content/audio/catch-action.wav and /dev/null differ diff --git a/examples/demos/maroon/content/audio/catch.wav b/examples/demos/maroon/content/audio/catch.wav deleted file mode 100644 index d3eade87f8..0000000000 Binary files a/examples/demos/maroon/content/audio/catch.wav and /dev/null differ diff --git a/examples/demos/maroon/content/audio/currency.wav b/examples/demos/maroon/content/audio/currency.wav deleted file mode 100644 index 0d9ef2c200..0000000000 Binary files a/examples/demos/maroon/content/audio/currency.wav and /dev/null differ diff --git a/examples/demos/maroon/content/audio/factory-action.wav b/examples/demos/maroon/content/audio/factory-action.wav deleted file mode 100644 index a2ace6c221..0000000000 Binary files a/examples/demos/maroon/content/audio/factory-action.wav and /dev/null differ diff --git a/examples/demos/maroon/content/audio/melee-action.wav b/examples/demos/maroon/content/audio/melee-action.wav deleted file mode 100644 index d325af4700..0000000000 Binary files a/examples/demos/maroon/content/audio/melee-action.wav and /dev/null differ diff --git a/examples/demos/maroon/content/audio/projectile-action.wav b/examples/demos/maroon/content/audio/projectile-action.wav deleted file mode 100644 index 4e2284fceb..0000000000 Binary files a/examples/demos/maroon/content/audio/projectile-action.wav and /dev/null differ diff --git a/examples/demos/maroon/content/audio/shooter-action.wav b/examples/demos/maroon/content/audio/shooter-action.wav deleted file mode 100644 index 3e12b9419a..0000000000 Binary files a/examples/demos/maroon/content/audio/shooter-action.wav and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/background.png b/examples/demos/maroon/content/gfx/background.png deleted file mode 100644 index d548b9314e..0000000000 Binary files a/examples/demos/maroon/content/gfx/background.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/bomb-action.png b/examples/demos/maroon/content/gfx/bomb-action.png deleted file mode 100644 index 42da5d789f..0000000000 Binary files a/examples/demos/maroon/content/gfx/bomb-action.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/bomb-idle.png b/examples/demos/maroon/content/gfx/bomb-idle.png deleted file mode 100644 index 3bd62e261d..0000000000 Binary files a/examples/demos/maroon/content/gfx/bomb-idle.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/bomb.png b/examples/demos/maroon/content/gfx/bomb.png deleted file mode 100644 index 380da7d1a5..0000000000 Binary files a/examples/demos/maroon/content/gfx/bomb.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/button-help.png b/examples/demos/maroon/content/gfx/button-help.png deleted file mode 100644 index aecebc1275..0000000000 Binary files a/examples/demos/maroon/content/gfx/button-help.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/button-play.png b/examples/demos/maroon/content/gfx/button-play.png deleted file mode 100644 index 6cdad6c845..0000000000 Binary files a/examples/demos/maroon/content/gfx/button-play.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/catch-action.png b/examples/demos/maroon/content/gfx/catch-action.png deleted file mode 100644 index 78ca9fe1cc..0000000000 Binary files a/examples/demos/maroon/content/gfx/catch-action.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/catch.png b/examples/demos/maroon/content/gfx/catch.png deleted file mode 100644 index b7620fe3de..0000000000 Binary files a/examples/demos/maroon/content/gfx/catch.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/cloud.png b/examples/demos/maroon/content/gfx/cloud.png deleted file mode 100644 index d7c35f8555..0000000000 Binary files a/examples/demos/maroon/content/gfx/cloud.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/currency.png b/examples/demos/maroon/content/gfx/currency.png deleted file mode 100644 index 1571341f6c..0000000000 Binary files a/examples/demos/maroon/content/gfx/currency.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/dialog-bomb.png b/examples/demos/maroon/content/gfx/dialog-bomb.png deleted file mode 100644 index 708d916ad7..0000000000 Binary files a/examples/demos/maroon/content/gfx/dialog-bomb.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/dialog-factory.png b/examples/demos/maroon/content/gfx/dialog-factory.png deleted file mode 100644 index d2e2a48e31..0000000000 Binary files a/examples/demos/maroon/content/gfx/dialog-factory.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/dialog-melee.png b/examples/demos/maroon/content/gfx/dialog-melee.png deleted file mode 100644 index 069d18d477..0000000000 Binary files a/examples/demos/maroon/content/gfx/dialog-melee.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/dialog-pointer.png b/examples/demos/maroon/content/gfx/dialog-pointer.png deleted file mode 100644 index 9b51a090f9..0000000000 Binary files a/examples/demos/maroon/content/gfx/dialog-pointer.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/dialog-shooter.png b/examples/demos/maroon/content/gfx/dialog-shooter.png deleted file mode 100644 index af980caabd..0000000000 Binary files a/examples/demos/maroon/content/gfx/dialog-shooter.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/dialog.png b/examples/demos/maroon/content/gfx/dialog.png deleted file mode 100644 index d528ba78d1..0000000000 Binary files a/examples/demos/maroon/content/gfx/dialog.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/factory-action.png b/examples/demos/maroon/content/gfx/factory-action.png deleted file mode 100644 index 8981678267..0000000000 Binary files a/examples/demos/maroon/content/gfx/factory-action.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/factory-idle.png b/examples/demos/maroon/content/gfx/factory-idle.png deleted file mode 100644 index a145582c8f..0000000000 Binary files a/examples/demos/maroon/content/gfx/factory-idle.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/factory.png b/examples/demos/maroon/content/gfx/factory.png deleted file mode 100644 index bfb9f3fb79..0000000000 Binary files a/examples/demos/maroon/content/gfx/factory.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/grid.png b/examples/demos/maroon/content/gfx/grid.png deleted file mode 100644 index b59555247a..0000000000 Binary files a/examples/demos/maroon/content/gfx/grid.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/help.png b/examples/demos/maroon/content/gfx/help.png deleted file mode 100644 index 4654e4c69b..0000000000 Binary files a/examples/demos/maroon/content/gfx/help.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/lifes.png b/examples/demos/maroon/content/gfx/lifes.png deleted file mode 100644 index 135310b38c..0000000000 Binary files a/examples/demos/maroon/content/gfx/lifes.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/logo-bubble.png b/examples/demos/maroon/content/gfx/logo-bubble.png deleted file mode 100644 index 136151caff..0000000000 Binary files a/examples/demos/maroon/content/gfx/logo-bubble.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/logo-fish.png b/examples/demos/maroon/content/gfx/logo-fish.png deleted file mode 100644 index c41833a0c9..0000000000 Binary files a/examples/demos/maroon/content/gfx/logo-fish.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/logo.png b/examples/demos/maroon/content/gfx/logo.png deleted file mode 100644 index 787ac99ce8..0000000000 Binary files a/examples/demos/maroon/content/gfx/logo.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/melee-action.png b/examples/demos/maroon/content/gfx/melee-action.png deleted file mode 100644 index c53873bfcc..0000000000 Binary files a/examples/demos/maroon/content/gfx/melee-action.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/melee-idle.png b/examples/demos/maroon/content/gfx/melee-idle.png deleted file mode 100644 index 621d9dff54..0000000000 Binary files a/examples/demos/maroon/content/gfx/melee-idle.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/melee.png b/examples/demos/maroon/content/gfx/melee.png deleted file mode 100644 index ab240151f3..0000000000 Binary files a/examples/demos/maroon/content/gfx/melee.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/mob-idle.png b/examples/demos/maroon/content/gfx/mob-idle.png deleted file mode 100644 index dedacc7866..0000000000 Binary files a/examples/demos/maroon/content/gfx/mob-idle.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/mob.png b/examples/demos/maroon/content/gfx/mob.png deleted file mode 100644 index 7569c3525a..0000000000 Binary files a/examples/demos/maroon/content/gfx/mob.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/points.png b/examples/demos/maroon/content/gfx/points.png deleted file mode 100644 index 1d2386dbe7..0000000000 Binary files a/examples/demos/maroon/content/gfx/points.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/projectile-action.png b/examples/demos/maroon/content/gfx/projectile-action.png deleted file mode 100644 index aa2e650aeb..0000000000 Binary files a/examples/demos/maroon/content/gfx/projectile-action.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/projectile.png b/examples/demos/maroon/content/gfx/projectile.png deleted file mode 100644 index c25a0c3890..0000000000 Binary files a/examples/demos/maroon/content/gfx/projectile.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/scores.png b/examples/demos/maroon/content/gfx/scores.png deleted file mode 100644 index af757fe64a..0000000000 Binary files a/examples/demos/maroon/content/gfx/scores.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/shooter-action.png b/examples/demos/maroon/content/gfx/shooter-action.png deleted file mode 100644 index 08e7e300ca..0000000000 Binary files a/examples/demos/maroon/content/gfx/shooter-action.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/shooter-idle.png b/examples/demos/maroon/content/gfx/shooter-idle.png deleted file mode 100644 index 663098d3b0..0000000000 Binary files a/examples/demos/maroon/content/gfx/shooter-idle.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/shooter.png b/examples/demos/maroon/content/gfx/shooter.png deleted file mode 100644 index d44401e055..0000000000 Binary files a/examples/demos/maroon/content/gfx/shooter.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/sunlight.png b/examples/demos/maroon/content/gfx/sunlight.png deleted file mode 100644 index d1c7042117..0000000000 Binary files a/examples/demos/maroon/content/gfx/sunlight.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/text-1.png b/examples/demos/maroon/content/gfx/text-1.png deleted file mode 100644 index 3ea399cc90..0000000000 Binary files a/examples/demos/maroon/content/gfx/text-1.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/text-2.png b/examples/demos/maroon/content/gfx/text-2.png deleted file mode 100644 index 934a481f3b..0000000000 Binary files a/examples/demos/maroon/content/gfx/text-2.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/text-3.png b/examples/demos/maroon/content/gfx/text-3.png deleted file mode 100644 index 47523f55b8..0000000000 Binary files a/examples/demos/maroon/content/gfx/text-3.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/text-blank.png b/examples/demos/maroon/content/gfx/text-blank.png deleted file mode 100644 index 4a687b24dc..0000000000 Binary files a/examples/demos/maroon/content/gfx/text-blank.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/text-gameover.png b/examples/demos/maroon/content/gfx/text-gameover.png deleted file mode 100644 index 4f53ef0b29..0000000000 Binary files a/examples/demos/maroon/content/gfx/text-gameover.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/text-go.png b/examples/demos/maroon/content/gfx/text-go.png deleted file mode 100644 index bfc26f71fc..0000000000 Binary files a/examples/demos/maroon/content/gfx/text-go.png and /dev/null differ diff --git a/examples/demos/maroon/content/gfx/wave.png b/examples/demos/maroon/content/gfx/wave.png deleted file mode 100644 index f97426c4e7..0000000000 Binary files a/examples/demos/maroon/content/gfx/wave.png and /dev/null differ diff --git a/examples/demos/maroon/content/logic.js b/examples/demos/maroon/content/logic.js deleted file mode 100644 index dd76b7e073..0000000000 --- a/examples/demos/maroon/content/logic.js +++ /dev/null @@ -1,264 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -.pragma library // Shared game state -.import QtQuick 2.0 as QQ - -// Game Stuff -var gameState // Local reference -function getGameState() { return gameState; } - -var towerData = [ // Name and cost, stats are in the delegate per instance - { "name": "Melee", "cost": 20 }, - { "name": "Ranged", "cost": 50 }, - { "name": "Bomb", "cost": 75 }, - { "name": "Factory", "cost": 25 } -] - -var waveBaseData = [300, 290, 280, 270, 220, 180, 160, 80, 80, 80, 30, 30, 30, 30]; -var waveData = []; - -var towerComponents = new Array(towerData.length); -var mobComponent = Qt.createComponent("mobs/MobBase.qml"); - -function endGame() -{ - gameState.gameRunning = false; - gameState.gameOver = true; - for (var i = 0; i < gameState.cols; i++) { - for (var j = 0; j < gameState.rows; j++) { - if (gameState.towers[towerIdx(i, j)]) { - gameState.towers[towerIdx(i, j)].destroy(); - gameState.towers[towerIdx(i, j)] = null; - } - } - for (var j in gameState.mobs[i]) - gameState.mobs[i][j].destroy(); - gameState.mobs[i].splice(0,gameState.mobs[i].length); //Leaves queue reusable - } -} - -function startGame(gameCanvas) -{ - waveData = new Array(); - for (var i in waveBaseData) - waveData[i] = waveBaseData[i]; - gameState.freshState(); - for (var i = 0; i < gameCanvas.cols; i++) { - for (var j = 0; j < gameCanvas.rows; j++) - gameState.towers[towerIdx(i, j)] = null; - gameState.mobs[i] = new Array(); - } - gameState.towers[towerIdx(0, 0)] = newTower(3, 0, 0);//Start with a starfish in the corner - gameState.gameRunning = true; - gameState.gameOver = false; -} - -function newGameState(gameCanvas) -{ - for (var i = 0; i < towerComponents.length; i++) { - towerComponents[i] = Qt.createComponent("towers/" + towerData[i].name + ".qml"); - if (towerComponents[i].status == QQ.Component.Error) { - gameCanvas.errored = true; - gameCanvas.errorString += "Loading Tower " + towerData[i].name + "\n" + (towerComponents[i].errorString()); - console.log(towerComponents[i].errorString()); - } - } - gameState = gameCanvas; - gameState.freshState(); - gameState.towers = new Array(gameCanvas.rows * gameCanvas.cols); - gameState.mobs = new Array(gameCanvas.cols); - return gameState; -} - -function row(y) -{ - return Math.floor(y / gameState.squareSize); -} - -function col(x) -{ - return Math.floor(x / gameState.squareSize); -} - -function towerIdx(x, y) -{ - return y + (x * gameState.rows); -} - -function newMob(col) -{ - var ret = mobComponent.createObject(gameState.canvas, - { "col" : col, - "speed" : (Math.min(2.0, 0.10 * (gameState.waveNumber + 1))), - "y" : gameState.canvas.height }); - gameState.mobs[col].push(ret); - return ret; -} - -function newTower(type, row, col) -{ - var ret = towerComponents[type].createObject(gameState.canvas); - ret.row = row; - ret.col = col; - ret.fireCounter = ret.rof; - ret.spawn(); - return ret; -} - -function buildTower(type, x, y) -{ - if (gameState.towers[towerIdx(x,y)] != null) { - if (type <= 0) { - gameState.towers[towerIdx(x,y)].sell(); - gameState.towers[towerIdx(x,y)] = null; - } - } else { - if (gameState.coins < towerData[type - 1].cost) - return; - gameState.towers[towerIdx(x, y)] = newTower(type - 1, y, x); - gameState.coins -= towerData[type - 1].cost; - } -} - -function killMob(col, mob) -{ - if (!mob) - return; - var idx = gameState.mobs[col].indexOf(mob); - if (idx == -1 || !mob.hp) - return; - mob.hp = 0; - mob.die(); - gameState.mobs[col].splice(idx,1); -} - -function killTower(row, col) -{ - var tower = gameState.towers[towerIdx(col, row)]; - if (!tower) - return; - tower.hp = 0; - tower.die(); - gameState.towers[towerIdx(col, row)] = null; -} - -function tick() -{ - if (!gameState.gameRunning) - return; - - // Spawn - gameState.waveProgress += 1; - var i = gameState.waveProgress; - var j = 0; - while (i > 0 && j < waveData.length) - i -= waveData[j++]; - if ( i == 0 ) // Spawn a mob - newMob(Math.floor(Math.random() * gameState.cols)); - if ( j == waveData.length ) { // Next Wave - gameState.waveNumber += 1; - gameState.waveProgress = 0; - var waveModifier = 10; // Constant governing how much faster the next wave is to spawn (not fish speed) - for (var k in waveData ) // Slightly faster - if (waveData[k] > waveModifier) - waveData[k] -= waveModifier; - } - - // Towers Attack - for (var j in gameState.towers) { - var tower = gameState.towers[j]; - if (tower == null) - continue; - if (tower.fireCounter > 0) { - tower.fireCounter -= 1; - continue; - } - var column = tower.col; - for (var k in gameState.mobs[column]) { - var conflict = gameState.mobs[column][k]; - if (conflict.y <= gameState.canvas.height && conflict.y + conflict.height > tower.y - && conflict.y - ((tower.row + 1) * gameState.squareSize) < gameState.squareSize * tower.range) { // In Range - tower.fire(); - tower.fireCounter = tower.rof; - conflict.hit(tower.damage); - } - } - - // Income - if (tower.income) { - gameState.coins += tower.income; - tower.fire(); - tower.fireCounter = tower.rof; - } - } - - // Mobs move - for (var i = 0; i < gameState.cols; i++) { - for (var j = 0; j < gameState.mobs[i].length; j++) { - var mob = gameState.mobs[i][j]; - var newPos = gameState.mobs[i][j].y - gameState.mobs[i][j].speed; - if (newPos < 0) { - gameState.lives -= 1; - killMob(i, mob); - if (gameState.lives <= 0) - endGame(); - continue; - } - var conflict = gameState.towers[towerIdx(i, row(newPos))]; - if (conflict != null) { - if (mob.y < conflict.y + gameState.squareSize) - gameState.mobs[i][j].y += gameState.mobs[i][j].speed * 10; // Moved inside tower, now hurry back out - if (mob.fireCounter > 0) { - mob.fireCounter--; - } else { - gameState.mobs[i][j].fire(); - conflict.hp -= mob.damage; - if (conflict.hp <= 0) - killTower(conflict.row, conflict.col); - mob.fireCounter = mob.rof; - } - } else { - gameState.mobs[i][j].y = newPos; - } - } - } - -} diff --git a/examples/demos/maroon/content/mobs/MobBase.qml b/examples/demos/maroon/content/mobs/MobBase.qml deleted file mode 100644 index d4ece660ed..0000000000 --- a/examples/demos/maroon/content/mobs/MobBase.qml +++ /dev/null @@ -1,262 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "../logic.js" as Logic -import ".." - -Item { - id: container - property string name: "Fish" - property int col: 0 - property real hp: 3 - property real damage: 1 - property real speed: 0.25 - property int rof: 30 //In ticks - property int fireCounter: 0 - property bool dying: false - width: parent ? parent.squareSize : 0 - height: parent ? parent.squareSize : 0 - x: col * width - z: 1001 - function fire() { } - - function die() { - if (dying) - return; - dying = true; - bubble.jumpTo("burst"); - if (fishSprite.currentSprite == "front") - fishSprite.jumpTo(Math.random() > 0.5 ? "left" : "right" ); - fishSwim.start(); - Logic.gameState.score += 1; - killedSound.play(); - bubble.scale = 0.9 - destroy(350); - } - - function inked() { - if (hp > 0) - ink.jumpTo("dirty"); - } - - function hit(dmg) { - hp -= dmg; - - if (hp <= 0) - Logic.killMob(col, container); - } - - Component.onCompleted: spawnSound.play() - - SoundEffect { - id: spawnSound - source: "../audio/catch.wav" - } - SoundEffect { - id: killedSound - source: "../audio/catch-action.wav" - } - - SpriteSequence { - id: fishSprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - Sprite { - name: "left" - source: "../gfx/mob-idle.png" - frameWidth: 64 - frameHeight: 64 - frameCount: 1 - frameDuration: 800 - frameDurationVariation: 400 - to: { "front" : 1 } - } - - Sprite { - name: "front" - source: "../gfx/mob-idle.png" - frameCount: 1 - frameX: 64 - frameWidth: 64 - frameHeight: 64 - frameDuration: 800 - frameDurationVariation: 400 - to: { "left" : 1, "right" : 1 } - } - - Sprite { - name: "right" - source: "../gfx/mob-idle.png" - frameCount: 1 - frameX: 128 - frameWidth: 64 - frameHeight: 64 - frameDuration: 800 - frameDurationVariation: 400 - to: { "front" : 1 } - } - - - Sprite { //WORKAROUND: This prevents the triggering of a rendering error which is currently under investigation. - name: "dummy" - source: "../gfx/melee-idle.png" - frameCount: 8 - frameWidth: 64 - frameHeight: 64 - frameX: 0 - frameDuration: 200 - } - - NumberAnimation on x { - id: fishSwim - running: false - property bool goingLeft: fishSprite.currentSprite == "right" - to: goingLeft ? -360 : 360 - duration: 300 - } - } - - SpriteSequence { - id: bubble - width: 64 - height: 64 - scale: 0.4 + (0.2 * hp) - interpolate: false - goalSprite: "" - - Behavior on scale { - NumberAnimation { duration: 150; easing.type: Easing.OutBack } - } - - Sprite { - name: "big" - source: "../gfx/catch.png" - frameCount: 1 - to: { "burst" : 0 } - } - - Sprite { - name: "burst" - source: "../gfx/catch-action.png" - frameCount: 3 - frameX: 64 - frameDuration: 200 - } - - Sprite { //WORKAROUND: This prevents the triggering of a rendering error which is currently under investigation. - name: "dummy" - source: "../gfx/melee-idle.png" - frameCount: 8 - frameWidth: 64 - frameHeight: 64 - frameX: 0 - frameDuration: 200 - } - SequentialAnimation on width { - loops: Animation.Infinite - NumberAnimation { from: width * 1; to: width * 1.1; duration: 800; easing.type: Easing.InOutQuad } - NumberAnimation { from: width * 1.1; to: width * 1; duration: 1000; easing.type: Easing.InOutQuad } - } - SequentialAnimation on height { - loops: Animation.Infinite - NumberAnimation { from: height * 1; to: height * 1.15; duration: 1200; easing.type: Easing.InOutQuad } - NumberAnimation { from: height * 1.15; to: height * 1; duration: 1000; easing.type: Easing.InOutQuad } - } - } - - SpriteSequence { - id: ink - width: 64 - height: 64 - scale: bubble.scale - goalSprite: "" - - Sprite { - name: "clean" - source: "../gfx/projectile-action.png" - frameCount: 1 - frameX: 0 - frameWidth: 64 - frameHeight: 64 - } - Sprite { - name: "dirty" - source: "../gfx/projectile-action.png" - frameCount: 3 - frameX: 64 - frameWidth: 64 - frameHeight: 64 - frameDuration: 150 - to: {"clean":1} - } - - Sprite { //WORKAROUND: This prevents the triggering of a rendering error which is currently under investigation. - name: "dummy" - source: "../gfx/melee-idle.png" - frameCount: 8 - frameWidth: 64 - frameHeight: 64 - frameX: 0 - frameDuration: 200 - } - SequentialAnimation on width { - loops: Animation.Infinite - NumberAnimation { from: width * 1; to: width * 1.1; duration: 800; easing.type: Easing.InOutQuad } - NumberAnimation { from: width * 1.1; to: width * 1; duration: 1000; easing.type: Easing.InOutQuad } - } - SequentialAnimation on height { - loops: Animation.Infinite - NumberAnimation { from: height * 1; to: height * 1.15; duration: 1200; easing.type: Easing.InOutQuad } - NumberAnimation { from: height * 1.15; to: height * 1; duration: 1000; easing.type: Easing.InOutQuad } - } - - } - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x; to: x - 5; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: x - 5; to: x; duration: 900; easing.type: Easing.InOutQuad } - } -} - diff --git a/examples/demos/maroon/content/towers/Bomb.qml b/examples/demos/maroon/content/towers/Bomb.qml deleted file mode 100644 index 00437f468f..0000000000 --- a/examples/demos/maroon/content/towers/Bomb.qml +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "../logic.js" as Logic -import ".." - -TowerBase { - id: container - hp: 10 - range: 0.4 - rof: 10 - property real detonationRange: 2.5 - - function fire() { - sound.play() - sprite.jumpTo("shoot") - animDelay.start() - } - - function finishFire() { - var sCol = Math.max(0, col - 1) - var eCol = Math.min(Logic.gameState.cols - 1, col + 1) - var killList = new Array() - for (var i = sCol; i <= eCol; i++) { - for (var j = 0; j < Logic.gameState.mobs[i].length; j++) - if (Math.abs(Logic.gameState.mobs[i][j].y - container.y) < Logic.gameState.squareSize * detonationRange) - killList.push(Logic.gameState.mobs[i][j]) - while (killList.length > 0) - Logic.killMob(i, killList.pop()) - } - Logic.killTower(row, col); - } - - Timer { - id: animDelay - running: false - interval: shootState.frameCount * shootState.frameDuration - onTriggered: finishFire() - } - - function die() - { - destroy() // No blink, because we usually meant to die - } - - SoundEffect { - id: sound - source: "../audio/bomb-action.wav" - } - - SpriteSequence { - id: sprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - Sprite { - name: "idle" - source: "../gfx/bomb-idle.png" - frameCount: 4 - frameDuration: 800 - } - - Sprite { - id: shootState - name: "shoot" - source: "../gfx/bomb-action.png" - frameCount: 6 - frameDuration: 155 - to: { "dying" : 1 } // So that if it takes a frame to clean up, it is on the last frame of the explosion - } - - Sprite { - name: "dying" - source: "../gfx/bomb-action.png" - frameCount: 1 - frameX: 64 * 5 - frameWidth: 64 - frameHeight: 64 - frameDuration: 155 - } - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x; to: x + 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: x + 4; to: x; duration: 900; easing.type: Easing.InOutQuad } - } - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { from: y; to: y - 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: y - 4; to: y; duration: 900; easing.type: Easing.InOutQuad } - } - } -} diff --git a/examples/demos/maroon/content/towers/Factory.qml b/examples/demos/maroon/content/towers/Factory.qml deleted file mode 100644 index b34a18498a..0000000000 --- a/examples/demos/maroon/content/towers/Factory.qml +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "../logic.js" as Logic -import ".." - -TowerBase { - id: container - rof: 160 - income: 5 - SpriteSequence { - id: sprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - Sprite { - name: "idle" - source: "../gfx/factory-idle.png" - frameCount: 4 - frameDuration: 200 - } - - Sprite { - name: "action" - source: "../gfx/factory-action.png" - frameCount: 4 - frameDuration: 90 - to: { "idle" : 1 } - } - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x; to: x + 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: x + 4; to: x; duration: 900; easing.type: Easing.InOutQuad } - } - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { from: y; to: y - 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: y - 4; to: y; duration: 900; easing.type: Easing.InOutQuad } - } - } - - SoundEffect { - id: actionSound - source: "../audio/factory-action.wav" - } - - function fire() { - actionSound.play() - sprite.jumpTo("action") - coinLaunch.start() - } - - function spawn() { - coin.target = Logic.gameState.mapToItem(container, 240, -32) - } - - Image { - id: coin - property var target: { "x" : 0, "y" : 0 } - source: "../gfx/currency.png" - visible: false - } - - SequentialAnimation { - id: coinLaunch - PropertyAction { target: coin; property: "visible"; value: true } - ParallelAnimation { - NumberAnimation { target: coin; property: "x"; from: 16; to: coin.target.x } - NumberAnimation { target: coin; property: "y"; from: 16; to: coin.target.y } - } - PropertyAction { target: coin; property: "visible"; value: false } - } -} diff --git a/examples/demos/maroon/content/towers/Melee.qml b/examples/demos/maroon/content/towers/Melee.qml deleted file mode 100644 index 1b49a455aa..0000000000 --- a/examples/demos/maroon/content/towers/Melee.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 ".." - -TowerBase { - hp: 4 - range: 0.1 - damage: 1 - rof: 40 - income: 0 - - SpriteSequence { - id: sprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - Sprite { - name: "idle" - source: "../gfx/melee-idle.png" - frameCount: 8 - frameDuration: 250 - } - - Sprite { - name: "shoot" - source: "../gfx/melee-action.png" - frameCount: 2 - frameDuration: 200 - to: { "idle" : 1 } - } - } - - function fire() { - shootSound.play() - sprite.jumpTo("shoot") - } - - SoundEffect { - id: shootSound - source: "../audio/melee-action.wav" - } -} diff --git a/examples/demos/maroon/content/towers/Ranged.qml b/examples/demos/maroon/content/towers/Ranged.qml deleted file mode 100644 index 33f3354fb6..0000000000 --- a/examples/demos/maroon/content/towers/Ranged.qml +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "../logic.js" as Logic -import ".." - -TowerBase { - id: container - hp: 2 - range: 6 - damage: 0 // By projectile - rof: 40 - income: 0 - property var targetMob - property real realDamage: 1 - function fire() { - proj.x = 32 - proj.width / 2 - proj.y = 0 - targetMob = Logic.gameState.mobs[col][0] - projAnim.to = targetMob.y - container.y -10 - projAnim.start() - shootSound.play() - sprite.jumpTo("shoot") - } - - Image { - id: proj - y: 1000 - SequentialAnimation on y { - id: projAnim - running: false - property real to: 1000 - SmoothedAnimation { - to: projAnim.to - velocity: 400 - } - ScriptAction { - script: { - if (targetMob && targetMob.hit) { - targetMob.hit(realDamage) - targetMob.inked() - projSound.play() - } - } - } - PropertyAction { - value: 1000; - } - } - source: "../gfx/projectile.png" - } - - SoundEffect { - id: shootSound - source: "../audio/shooter-action.wav" - } - SoundEffect { - id: projSound - source: "../audio/projectile-action.wav" - } - - SpriteSequence { - id: sprite - width: 64 - height: 64 - interpolate: false - goalSprite: "" - - Sprite { - name: "idle" - source: "../gfx/shooter-idle.png" - frameCount: 4 - frameDuration: 250 - } - - Sprite { - name: "shoot" - source: "../gfx/shooter-action.png" - frameCount: 5 - frameDuration: 90 - to: { "idle" : 1 } - } - - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { from: x; to: x - 4; duration: 900; easing.type: Easing.InOutQuad } - NumberAnimation { from: x - 4; to: x; duration: 900; easing.type: Easing.InOutQuad } - } - } -} diff --git a/examples/demos/maroon/content/towers/TowerBase.qml b/examples/demos/maroon/content/towers/TowerBase.qml deleted file mode 100644 index 5c71cb051f..0000000000 --- a/examples/demos/maroon/content/towers/TowerBase.qml +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 real hp: 1 - property real range: 0 - property real damage: 0 - property int rof: 100 - property int fireCounter: 0 - property int income: 0 - property int row: 0 - property int col: 0 - - width: parent ? parent.squareSize : 0 - height: parent ? parent.squareSize : 0 - //This is how it is placed on the gameboard, do not modify/animate the X/Y/Z of a TowerBase please - x: col * width - y: row * height - z: 1000 - - function fire() { } - function spawn() { } //After all game properties are set - function die() { stdDeath.start(); destroy(1000); } - function sell() { destroy(); } - - SequentialAnimation on opacity { - id: stdDeath - running: false - loops: 2 - NumberAnimation { from: 1; to: 0; } - NumberAnimation { from: 0; to: 1; } - } -} diff --git a/examples/demos/maroon/main.cpp b/examples/demos/maroon/main.cpp deleted file mode 100644 index da2343e444..0000000000 --- a/examples/demos/maroon/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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(maroon) diff --git a/examples/demos/maroon/maroon.pro b/examples/demos/maroon/maroon.pro deleted file mode 100644 index fa2e4b5709..0000000000 --- a/examples/demos/maroon/maroon.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app - -QT += qml quick -SOURCES += main.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/demos/maroon -qml.files = maroon.qml content -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/demos/maroon -sources.files = $$SOURCES maroon.pro -sources.path = $$qml.path -INSTALLS += sources target qml diff --git a/examples/demos/maroon/maroon.qml b/examples/demos/maroon/maroon.qml deleted file mode 100644 index d7bfcb6a66..0000000000 --- a/examples/demos/maroon/maroon.qml +++ /dev/null @@ -1,233 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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" -import "content/logic.js" as Logic - -Item { - id: root - width: 320 - height: 480 - property var gameState: Logic.newGameState(canvas); - property bool passedSplash: false - - Image { - source:"content/gfx/background.png" - anchors.bottom: view.bottom - - ParticleSystem { - id: particles - anchors.fill: parent - - ImageParticle { - id: bubble - anchors.fill: parent - source: "content/gfx/catch.png" - opacity: 0.25 - } - - Wander { - xVariance: 25; - pace: 25; - } - - Emitter { - width: parent.width - height: 150 - anchors.bottom: parent.bottom - anchors.bottomMargin: 3 - startTime: 15000 - - emitRate: 2 - lifeSpan: 15000 - - acceleration: PointDirection{ y: -6; xVariation: 2; yVariation: 2 } - - size: 24 - sizeVariation: 16 - } - } - } - - Column { - id: view - y: -(height - 480) - width: 320 - - GameOverScreen { gameCanvas: canvas } - - Item { - id: canvasArea - width: 320 - height: 480 - - Row { - height: childrenRect.height - Image { - id: wave - y: 30 - source:"content/gfx/wave.png" - } - Image { - y: 30 - source:"content/gfx/wave.png" - } - NumberAnimation on x { from: 0; to: -(wave.width); duration: 16000; loops: Animation.Infinite } - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { from: y - 2; to: y + 2; duration: 1600; easing.type: Easing.InOutQuad } - NumberAnimation { from: y + 2; to: y - 2; duration: 1600; easing.type: Easing.InOutQuad } - } - } - - Row { - opacity: 0.5 - Image { - id: wave2 - y: 25 - source: "content/gfx/wave.png" - } - Image { - y: 25 - source: "content/gfx/wave.png" - } - NumberAnimation on x { from: -(wave2.width); to: 0; duration: 32000; loops: Animation.Infinite } - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { from: y + 2; to: y - 2; duration: 1600; easing.type: Easing.InOutQuad } - NumberAnimation { from: y - 2; to: y + 2; duration: 1600; easing.type: Easing.InOutQuad } - } - } - - Image { - source: "content/gfx/sunlight.png" - opacity: 0.02 - y: 0 - anchors.horizontalCenter: parent.horizontalCenter - transformOrigin: Item.Top - SequentialAnimation on rotation { - loops: Animation.Infinite - NumberAnimation { from: -10; to: 10; duration: 8000; easing.type: Easing.InOutSine } - NumberAnimation { from: 10; to: -10; duration: 8000; easing.type: Easing.InOutSine } - } - } - - Image { - source: "content/gfx/sunlight.png" - opacity: 0.04 - y: 20 - anchors.horizontalCenter: parent.horizontalCenter - transformOrigin: Item.Top - SequentialAnimation on rotation { - loops: Animation.Infinite - NumberAnimation { from: 10; to: -10; duration: 8000; easing.type: Easing.InOutSine } - NumberAnimation { from: -10; to: 10; duration: 8000; easing.type: Easing.InOutSine } - } - } - - Image { - source: "content/gfx/grid.png" - opacity: 0.5 - } - - GameCanvas { - id: canvas - anchors.bottom: parent.bottom - anchors.bottomMargin: 20 - x: 32 - focus: true - } - - InfoBar { anchors.bottom: canvas.top; anchors.bottomMargin: 6; width: parent.width } - - //3..2..1..go - Timer { - id: countdownTimer - interval: 1000 - running: root.countdown < 5 - repeat: true - onTriggered: root.countdown++ - } - Repeater { - model: ["content/gfx/text-blank.png", "content/gfx/text-3.png", "content/gfx/text-2.png", "content/gfx/text-1.png", "content/gfx/text-go.png"] - delegate: Image { - visible: root.countdown <= index - opacity: root.countdown == index ? 0.5 : 0.1 - scale: root.countdown >= index ? 1.0 : 0.0 - source: modelData - Behavior on opacity { NumberAnimation {} } - Behavior on scale { NumberAnimation {} } - } - } - } - - NewGameScreen { - onStartButtonClicked: root.passedSplash = true - } - } - - property int countdown: 10 - Timer { - id: gameStarter - interval: 4000 - running: false - repeat: false - onTriggered: Logic.startGame(canvas); - } - - states: [ - State { - name: "gameOn"; when: gameState.gameOver == false && passedSplash - PropertyChanges { target: view; y: -(height - 960) } - StateChangeScript { script: root.countdown = 0; } - PropertyChanges { target: gameStarter; running: true } - }, - State { - name: "gameOver"; when: gameState.gameOver == true - PropertyChanges { target: view; y: 0 } - } - ] - - transitions: Transition { - NumberAnimation { properties: "x,y"; duration: 1200; easing.type: Easing.OutQuad } - } -} diff --git a/examples/demos/maroon/maroon.qmlproject b/examples/demos/maroon/maroon.qmlproject deleted file mode 100644 index 752666114f..0000000000 --- a/examples/demos/maroon/maroon.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "maroon.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/examples/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml deleted file mode 100644 index 12902c0413..0000000000 --- a/examples/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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 deleted file mode 100644 index fc832eaed8..0000000000 --- a/examples/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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 deleted file mode 100644 index 6571470e2f..0000000000 --- a/examples/demos/photoviewer/PhotoViewerCore/Button.qml +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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' - border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 - } - - Image { anchors.fill: parent; source: "images/cardboard.png"; antialiasing: true } - - Rectangle { - anchors.fill: container; color: container.tint; visible: container.tint != "" - opacity: 0.25 - } - - Text { id: labelText; font.pixelSize: 15; anchors.centerIn: parent } - - 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 deleted file mode 100644 index 8543bee157..0000000000 --- a/examples/demos/photoviewer/PhotoViewerCore/EditableButton.qml +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - id: container - - property string label - signal clicked - - 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'; - border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 - } - - Image { anchors.fill: parent; source: "images/cardboard.png"; antialiasing: true } - - TextInput { - id: textInput; text: label; font.pixelSize: 15; anchors.centerIn: parent - Keys.onReturnPressed: { - container.label = textInput.text - container.focus = true - } - Keys.onEnterPressed: { - container.label = 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; antialiasing: true - } - - MouseArea { - anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 } - onClicked: { textInput.forceActiveFocus(); Qt.inputMethod.show(); } - } -} diff --git a/examples/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/examples/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml deleted file mode 100644 index e14a1da266..0000000000 --- a/examples/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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' - 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; antialiasing: true - width: w * s; height: h * s; visible: originalImage.status != Image.Ready - Rectangle { - color: "#878787"; antialiasing: true - anchors { fill: parent; topMargin: 3; bottomMargin: 3; leftMargin: 3; rightMargin: 3 } - } - } - Rectangle { - id: border; color: 'white'; anchors.centerIn: parent; antialiasing: true - width: originalImage.paintedWidth + 6; height: originalImage.paintedHeight + 6 - visible: !placeHolder.visible - } - BusyIndicator { anchors.centerIn: parent; on: originalImage.status != Image.Ready } - Image { - id: originalImage; antialiasing: true; - source: "http://" + Script.getImagePath(content); cache: false - fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height - } - Image { - id: hqImage; antialiasing: 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 deleted file mode 100644 index d2f915887f..0000000000 --- a/examples/demos/photoviewer/PhotoViewerCore/ProgressBar.qml +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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 deleted file mode 100644 index 98fcd931dd..0000000000 --- a/examples/demos/photoviewer/PhotoViewerCore/RssModel.qml +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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 deleted file mode 100644 index eeb8c355e3..0000000000 --- a/examples/demos/photoviewer/PhotoViewerCore/Tag.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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 deleted file mode 100644 index 431af8545d..0000000000 Binary files a/examples/demos/photoviewer/PhotoViewerCore/images/box-shadow.png and /dev/null differ diff --git a/examples/demos/photoviewer/PhotoViewerCore/images/busy.png b/examples/demos/photoviewer/PhotoViewerCore/images/busy.png deleted file mode 100644 index 664c2b1491..0000000000 Binary files a/examples/demos/photoviewer/PhotoViewerCore/images/busy.png and /dev/null differ diff --git a/examples/demos/photoviewer/PhotoViewerCore/images/cardboard.png b/examples/demos/photoviewer/PhotoViewerCore/images/cardboard.png deleted file mode 100644 index 1847ab528d..0000000000 Binary files a/examples/demos/photoviewer/PhotoViewerCore/images/cardboard.png and /dev/null differ diff --git a/examples/demos/photoviewer/PhotoViewerCore/qmldir b/examples/demos/photoviewer/PhotoViewerCore/qmldir deleted file mode 100644 index d3c247f21a..0000000000 --- a/examples/demos/photoviewer/PhotoViewerCore/qmldir +++ /dev/null @@ -1,8 +0,0 @@ -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 deleted file mode 100644 index e8ef93a847..0000000000 --- a/examples/demos/photoviewer/PhotoViewerCore/script/script.js +++ /dev/null @@ -1,27 +0,0 @@ -.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 deleted file mode 100644 index 1accfd2f90..0000000000 --- a/examples/demos/photoviewer/i18n/base.ts +++ /dev/null @@ -1,30 +0,0 @@ - - - - - AlbumDelegate - - - Remove - - - - - photoviewer - - - Add - - - - - Edit - - - - - Back - - - - diff --git a/examples/demos/photoviewer/i18n/qml_fr.qm b/examples/demos/photoviewer/i18n/qml_fr.qm deleted file mode 100644 index c24fcbc46c..0000000000 Binary files a/examples/demos/photoviewer/i18n/qml_fr.qm and /dev/null differ diff --git a/examples/demos/photoviewer/i18n/qml_fr.ts b/examples/demos/photoviewer/i18n/qml_fr.ts deleted file mode 100644 index 9f892db616..0000000000 --- a/examples/demos/photoviewer/i18n/qml_fr.ts +++ /dev/null @@ -1,30 +0,0 @@ - - - - - AlbumDelegate - - - Remove - Supprimer - - - - photoviewer - - - Add - Ajouter - - - - Edit - Éditer - - - - Back - Retour - - - diff --git a/examples/demos/photoviewer/photoviewer.qml b/examples/demos/photoviewer/photoviewer.qml deleted file mode 100644 index caeade4594..0000000000 --- a/examples/demos/photoviewer/photoviewer.qml +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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 deleted file mode 100644 index 600bdb10f4..0000000000 --- a/examples/demos/photoviewer/photoviewer.qmlproject +++ /dev/null @@ -1,20 +0,0 @@ -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/rssnews/content/BusyIndicator.qml b/examples/demos/rssnews/content/BusyIndicator.qml deleted file mode 100644 index 20ac08f612..0000000000 --- a/examples/demos/rssnews/content/BusyIndicator.qml +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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 deleted file mode 100644 index a6fea432f8..0000000000 --- a/examples/demos/rssnews/content/CategoryDelegate.qml +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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 deleted file mode 100644 index fe481a0eb0..0000000000 --- a/examples/demos/rssnews/content/NewsDelegate.qml +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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 deleted file mode 100644 index 9a31d2be3e..0000000000 --- a/examples/demos/rssnews/content/RssFeeds.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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 deleted file mode 100644 index 2752b7c56d..0000000000 --- a/examples/demos/rssnews/content/ScrollBar.qml +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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 deleted file mode 100644 index 664c2b1491..0000000000 Binary files a/examples/demos/rssnews/content/images/busy.png and /dev/null differ diff --git a/examples/demos/rssnews/content/images/scrollbar.png b/examples/demos/rssnews/content/images/scrollbar.png deleted file mode 100644 index 0228dcf9eb..0000000000 Binary files a/examples/demos/rssnews/content/images/scrollbar.png and /dev/null differ diff --git a/examples/demos/rssnews/rssnews.qml b/examples/demos/rssnews/rssnews.qml deleted file mode 100644 index 72c7170c93..0000000000 --- a/examples/demos/rssnews/rssnews.qml +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $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" } - highlightMoveVelocity: 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 deleted file mode 100644 index 5becbdaed0..0000000000 --- a/examples/demos/rssnews/rssnews.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -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/Block.qml b/examples/demos/samegame/content/Block.qml deleted file mode 100644 index 85f2e27d2a..0000000000 --- a/examples/demos/samegame/content/Block.qml +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: 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){ - "gfx/red.png"; - } else if (type == 1) { - "gfx/blue.png"; - } else if (type == 2) { - "gfx/green.png"; - } else { - "gfx/yellow.png"; - } - } - opacity: 0 - Behavior on opacity { NumberAnimation { duration: 200 } } - anchors.fill: parent - } - - //Foreground particles - BlockEmitter { - id: particles - system: particleSystem - group: { - if (type == 0){ - "red"; - } else if (type == 1) { - "blue"; - } else if (type == 2) { - "green"; - } else { - "yellow"; - } - } - anchors.fill: parent - } - - //Paint particles on the background - PaintEmitter { - id: particles2 - system: particleSystem - } - - 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); particles2.pulse(100);} } - PropertyChanges { target: img; opacity: 0 } - StateChangeScript { script: block.destroy(1000); } - } - ] -} diff --git a/examples/demos/samegame/content/BlockEmitter.qml b/examples/demos/samegame/content/BlockEmitter.qml deleted file mode 100644 index 7dad509dfd..0000000000 --- a/examples/demos/samegame/content/BlockEmitter.qml +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "../settings.js" as Settings - -Emitter { - property Item block: parent - velocity: TargetDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -40; magnitudeVariation: 40} - acceleration: TargetDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -100;} - shape: EllipseShape{fill:true} - enabled: false; - lifeSpan: 700; lifeSpanVariation: 100 - emitRate: 1000 - maximumEmitted: 100 //only fires 0.1s bursts (still 2x old number) - size: Settings.blockSize * 0.85 - endSize: Settings.blockSize * 0.85 /2 -} diff --git a/examples/demos/samegame/content/Button.qml b/examples/demos/samegame/content/Button.qml deleted file mode 100644 index aab21ec8c6..0000000000 --- a/examples/demos/samegame/content/Button.qml +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 { - property alias imgSrc: image.source - property alias system: emitter.system - property alias group: emitter.group - signal clicked - property bool rotatedButton: false - - width: image.width - height: image.sourceSize.height - Image { - id: image - height: parent.height - width: height/sourceSize.height * sourceSize.width - - anchors.horizontalCenter: parent.horizontalCenter - rotation: rotatedButton ? ((Math.random() * 3 + 2) * (Math.random() <= 0.5 ? -1 : 1)) : 0 - MenuEmitter { - id: emitter - anchors.fill: parent - //shape: MaskShape {source: image.source} - } - } - MouseArea { - anchors.fill: parent - onClicked: {parent.clicked(); emitter.burst(400);} - } -} diff --git a/examples/demos/samegame/content/GameArea.qml b/examples/demos/samegame/content/GameArea.qml deleted file mode 100644 index f3ca98d80e..0000000000 --- a/examples/demos/samegame/content/GameArea.qml +++ /dev/null @@ -1,226 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "samegame.js" as Logic - -Item { - id: gameCanvas - property bool gameOver: true - property int score: 0 - property int highScore: 0 - property int moves: 0 - property string mode: "" - property ParticleSystem ps: particleSystem - //For easy theming - property alias backgroundVisible: bg.visible - property string background: "gfx/background.png" - property string blockFile: "Block.qml" - onBlockFileChanged: Logic.changeBlock(blockFile); - property alias particlePack: auxLoader.source - //For multiplayer - property int score2: 0 - property int curTurn: 1 - property bool autoTurnChange: false - signal swapPlayers - property bool swapping: false - //onSwapPlayers: if (autoTurnChange) Logic.turnChange();//Now implemented below - //For puzzle - property url level - property bool puzzleWon: false - signal puzzleLost //Since root is tracking the puzzle progress - function showPuzzleEnd (won) { - if (won) { - smokeParticle.color = Qt.rgba(0,1,0,0); - puzzleWin.play(); - } else { - smokeParticle.color = Qt.rgba(1,0,0,0); - puzzleFail.play(); - puzzleLost(); - } - } - function showPuzzleGoal (str) { - puzzleTextBubble.opacity = 1; - puzzleTextLabel.text = str; - } - Image { - id: bg - z: -1 - anchors.fill: parent - source: background; - fillMode: Image.PreserveAspectCrop - } - - MouseArea { - anchors.fill: parent; onClicked: { - if (puzzleTextBubble.opacity == 1) { - puzzleTextBubble.opacity = 0; - Logic.finishLoadingMap(); - } else if (!swapping) { - Logic.handleClick(mouse.x,mouse.y); - } - } - } - - Image { - id: highScoreTextBubble - opacity: mode == "arcade" && gameOver && gameCanvas.score == gameCanvas.highScore ? 1 : 0 - Behavior on opacity { NumberAnimation {} } - anchors.centerIn: parent - z: 10 - source: "gfx/bubble-highscore.png" - Image { - anchors.centerIn: parent - source: "gfx/text-highscore-new.png" - rotation: -10 - } - } - - Image { - id: puzzleTextBubble - anchors.centerIn: parent - opacity: 0 - Behavior on opacity { NumberAnimation {} } - z: 10 - source: "gfx/bubble-puzzle.png" - Connections { - target: gameCanvas - onModeChanged: if (mode != "puzzle" && puzzleTextBubble.opacity > 0) puzzleTextBubble.opacity = 0; - } - Text { - id: puzzleTextLabel - width: parent.width - 24 - anchors.centerIn: parent - horizontalAlignment: Text.AlignHCenter - color: "white" - font.pixelSize: 24 - font.bold: true - wrapMode: Text.WordWrap - } - } - onModeChanged: { - p1WonImg.opacity = 0; - p2WonImg.opacity = 0; - } - SmokeText { id: puzzleWin; source: "gfx/icon-ok.png"; system: particleSystem } - SmokeText { id: puzzleFail; source: "gfx/icon-fail.png"; system: particleSystem } - - onSwapPlayers: { - smokeParticle.color = "yellow" - Logic.turnChange(); - if (curTurn == 1) { - p1Text.play(); - } else { - p2Text.play(); - } - clickDelay.running = true; - } - SequentialAnimation { - id: clickDelay - ScriptAction { script: gameCanvas.swapping = true; } - PauseAnimation { duration: 750 } - ScriptAction { script: gameCanvas.swapping = false; } - } - - SmokeText { - id: p1Text; source: "gfx/text-p1-go.png"; - system: particleSystem; playerNum: 1 - opacity: p1WonImg.opacity + p2WonImg.opacity > 0 ? 0 : 1 - } - - SmokeText { - id: p2Text; source: "gfx/text-p2-go.png"; - system: particleSystem; playerNum: 2 - opacity: p1WonImg.opacity + p2WonImg.opacity > 0 ? 0 : 1 - } - - onGameOverChanged: { - if (gameCanvas.mode == "multiplayer") { - if (gameCanvas.score >= gameCanvas.score2) { - p1WonImg.opacity = 1; - } else { - p2WonImg.opacity = 1; - } - } - } - Image { - id: p1WonImg - source: "gfx/text-p1-won.png" - anchors.centerIn: parent - opacity: 0 - Behavior on opacity { NumberAnimation {} } - z: 10 - } - Image { - id: p2WonImg - source: "gfx/text-p2-won.png" - anchors.centerIn: parent - opacity: 0 - Behavior on opacity { NumberAnimation {} } - z: 10 - } - - ParticleSystem{ - id: particleSystem; - anchors.fill: parent - z: 5 - ImageParticle { - id: smokeParticle - groups: ["smoke"] - source: "gfx/particle-smoke.png" - alpha: 0.1 - alphaVariation: 0.1 - color: "yellow" - } - Loader { - id: auxLoader - anchors.fill: parent - source: "PrimaryPack.qml" - onItemChanged: { - if (item && "particleSystem" in item) - item.particleSystem = particleSystem - if (item && "gameArea" in item) - item.gameArea = gameCanvas - } - } - } -} - diff --git a/examples/demos/samegame/content/LogoAnimation.qml b/examples/demos/samegame/content/LogoAnimation.qml deleted file mode 100644 index c879893e92..0000000000 --- a/examples/demos/samegame/content/LogoAnimation.qml +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: container //Positioned where the 48x48 S/G should be - property alias running: mainAnim.running - property ParticleSystem particleSystem - property int dur: 500 - signal boomTime - Image { - id: s1 - source: "gfx/logo-s.png" - y: 0 - } - Image { - id: g1 - source: "gfx/logo-g.png" - y: -128 - } - Column { - Repeater { - model: 2 - Item { - width: 48 - height: 48 - BlockEmitter { - id: emitter - anchors.fill: parent - group: "red" - system: particleSystem - Connections { - target: container - onBoomTime: emitter.pulse(100); - } - } - } - } - } - SequentialAnimation { - id: mainAnim - running: true - loops: -1 - PropertyAction { target: g1; property: "y"; value: -128} - PropertyAction { target: g1; property: "opacity"; value: 1} - PropertyAction { target: s1; property: "y"; value: 0} - PropertyAction { target: s1; property: "opacity"; value: 1} - NumberAnimation { target: g1; property: "y"; from: -96; to: -48; duration: dur} - ParallelAnimation { - NumberAnimation { target: g1; property: "y"; from: -48; to: 0; duration: dur} - NumberAnimation { target: s1; property: "y"; from: 0; to: 48; duration: dur } - } - PauseAnimation { duration: dur } - ScriptAction { script: container.boomTime(); } - ParallelAnimation { - NumberAnimation { target: g1; property: "opacity"; to: 0; duration: dur } - NumberAnimation { target: s1; property: "opacity"; to: 0; duration: dur } - } - PropertyAction { target: s1; property: "y"; value: -128} - PropertyAction { target: s1; property: "opacity"; value: 1} - NumberAnimation { target: s1; property: "y"; from: -96; to: 0; duration: dur * 2} - } -} diff --git a/examples/demos/samegame/content/MenuEmitter.qml b/examples/demos/samegame/content/MenuEmitter.qml deleted file mode 100644 index 16c766068c..0000000000 --- a/examples/demos/samegame/content/MenuEmitter.qml +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -Emitter { - anchors.fill: parent - velocity: AngleDirection{angleVariation: 360; magnitude: 140; magnitudeVariation: 40} - enabled: false; - lifeSpan: 500; - emitRate: 1 - size: 28 - endSize: 14 - group: "yellow" -} diff --git a/examples/demos/samegame/content/PaintEmitter.qml b/examples/demos/samegame/content/PaintEmitter.qml deleted file mode 100644 index 4a67c4a2d2..0000000000 --- a/examples/demos/samegame/content/PaintEmitter.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "../settings.js" as Settings - -Emitter { - property Item block: parent - anchors.fill: parent - shape: EllipseShape { fill: true } - group: { - if (block.type == 0){ - "redspots"; - } else if (block.type == 1) { - "bluespots"; - } else if (block.type == 2) { - "greenspots"; - } else { - "yellowspots"; - } - } - size: Settings.blockSize * 2 - endSize: Settings.blockSize/2 - lifeSpan: 30000 - enabled: false - emitRate: 60 - maximumEmitted: 60 - velocity: PointDirection{ y: 4; yVariation: 4 } - /* Possibly better, but dependent on gerrit change,28212 - property real mainIntensity: 0.8 - property real subIntensity: 0.1 - property real colorVariation: 0.005 - onEmitParticles: {//One group, many colors, for better stacking - for (var i=0; i
Clear in three moves..." - startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , - 0 , 0 , 0 , 0 , 0 , 1 , 1 , 2 , 1 , 1 , - 0 , 0 , 0 , 1 , 1 , 3 , 3 , 3 , 3 , 3 , - 0 , 1 , 1 , 3 , 3 , 3 , 1 , 3 , 1 , 1 , - 1 , 2 , 3 , 3 , 1 , 1 , 3 , 3 , 3 , 3 , - 1 , 3 , 3 , 2 , 3 , 3 , 3 , 3 , 1 , 1 , - 1 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ] -} diff --git a/examples/demos/samegame/content/levels/level1.qml b/examples/demos/samegame/content/levels/level1.qml deleted file mode 100644 index 4bb15cbe6a..0000000000 --- a/examples/demos/samegame/content/levels/level1.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -TemplateBase{ - timeTarget: 10 - goalText: "2 of 10

Clear in 10 seconds..." - startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 1 , 3 , 3 , 3 , 1 , 1 , 1 , 1 , 2 , 2 , - 1 , 2 , 3 , 3 , 3 , 1 , 1 , 1 , 1 , 2 , - 2 , 2 , 1 , 3 , 3 , 3 , 1 , 1 , 1 , 2 , - 2 , 1 , 1 , 1 , 3 , 3 , 3 , 1 , 2 , 2 , - 1 , 1 , 1 , 1 , 1 , 3 , 3 , 3 , 2 , 1 ] -} diff --git a/examples/demos/samegame/content/levels/level2.qml b/examples/demos/samegame/content/levels/level2.qml deleted file mode 100644 index a319479a60..0000000000 --- a/examples/demos/samegame/content/levels/level2.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -TemplateBase{ - scoreTarget: 1200 - timeTarget: 60 - goalText: "3 of 10

Score over 1200 points in one minute..." - mustClear: false - startingGrid: [ 3 , 1 , 2 , 1 , 1 , 2 , 1 , 1 , 3 , 3 , - 1 , 3 , 3 , 2 , 3 , 3 , 1 , 1 , 3 , 1 , - 3 , 1 , 3 , 3 , 2 , 3 , 3 , 3 , 1 , 2 , - 3 , 2 , 2 , 1 , 3 , 3 , 2 , 1 , 1 , 2 , - 3 , 1 , 2 , 2 , 2 , 2 , 2 , 1 , 3 , 1 , - 2 , 3 , 1 , 2 , 2 , 3 , 3 , 1 , 3 , 2 , - 3 , 2 , 1 , 1 , 3 , 3 , 3 , 2 , 2 , 1 , - 1 , 2 , 2 , 3 , 2 , 3 , 3 , 3 , 1 , 1 , - 1 , 3 , 3 , 3 , 1 , 2 , 2 , 3 , 3 , 1 , - 3 , 3 , 2 , 1 , 2 , 2 , 1 , 1 , 1 , 3 , - 2 , 1 , 3 , 2 , 3 , 2 , 3 , 2 , 2 , 1 , - 1 , 3 , 1 , 2 , 1 , 2 , 3 , 1 , 2 , 2 , - 1 , 2 , 2 , 2 , 1 , 1 , 2 , 3 , 1 , 2 ] -} diff --git a/examples/demos/samegame/content/levels/level3.qml b/examples/demos/samegame/content/levels/level3.qml deleted file mode 100644 index 43e82d7694..0000000000 --- a/examples/demos/samegame/content/levels/level3.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -TemplateBase{ - scoreTarget: 3000 - timeTarget: 60 - goalText: "4 of 10
Clear the board with over 3000 points in under a minute..." - startingGrid: [ 3 , 3 , 1 , 1 , 1 , 2 , 2 , 4 , 3 , 3 , - 4 , 3 , 1 , 4 , 2 , 2 , 2 , 4 , 3 , 4 , - 4 , 3 , 3 , 4 , 1 , 1 , 3 , 3 , 4 , 4 , - 3 , 3 , 3 , 3 , 3 , 1 , 3 , 2 , 2 , 4 , - 4 , 4 , 3 , 4 , 3 , 1 , 4 , 4 , 4 , 4 , - 4 , 4 , 3 , 4 , 1 , 1 , 4 , 4 , 3 , 3 , - 4 , 2 , 2 , 2 , 2 , 2 , 4 , 4 , 4 , 1 , - 4 , 4 , 2 , 4 , 2 , 2 , 1 , 1 , 1 , 1 , - 4 , 4 , 2 , 4 , 2 , 2 , 1 , 4 , 4 , 1 , - 4 , 1 , 1 , 4 , 3 , 3 , 4 , 2 , 4 , 1 , - 4 , 1 , 1 , 2 , 3 , 3 , 4 , 2 , 2 , 1 , - 1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , 2 , 1 , - 4 , 1 , 1 , 2 , 2 , 3 , 4 , 3 , 4 , 4 ] -} diff --git a/examples/demos/samegame/content/levels/level4.qml b/examples/demos/samegame/content/levels/level4.qml deleted file mode 100644 index 46ad42f709..0000000000 --- a/examples/demos/samegame/content/levels/level4.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -TemplateBase{ - goalText: "5 of 10

Clear the level..." - startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 1 , 3 , 2 , 1 , 1 , 1 , 1 , 3 , 2 , 3 , - 1 , 2 , 3 , 1 , 3 , 2 , 2 , 1 , 1 , 2 , - 3 , 2 , 2 , 2 , 1 , 1 , 1 , 1 , 3 , 3 , - 2 , 1 , 1 , 3 , 2 , 1 , 1 , 2 , 1 , 3 , - 1 , 3 , 3 , 1 , 2 , 1 , 2 , 1 , 3 , 3 , - 1 , 3 , 2 , 2 , 2 , 1 , 1 , 3 , 2 , 3 , - 1 , 1 , 3 , 2 , 3 , 3 , 2 , 1 , 1 , 1 , - 1 , 2 , 2 , 3 , 2 , 2 , 1 , 3 , 1 , 3 ] -} diff --git a/examples/demos/samegame/content/levels/level5.qml b/examples/demos/samegame/content/levels/level5.qml deleted file mode 100644 index 3716264993..0000000000 --- a/examples/demos/samegame/content/levels/level5.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -TemplateBase{ - moveTarget: 4 - goalText: "6 of 10

Clear in four or less moves..." - startingGrid: [ 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , - 4 , 2 , 2 , 2 , 4 , 3 , 3 , 3 , 4 , 4 , - 4 , 2 , 4 , 4 , 4 , 3 , 2 , 3 , 4 , 4 , - 4 , 2 , 2 , 2 , 4 , 3 , 3 , 3 , 4 , 4 , - 4 , 4 , 4 , 2 , 4 , 3 , 4 , 3 , 4 , 4 , - 4 , 2 , 2 , 2 , 4 , 3 , 4 , 3 , 4 , 4 , - 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , - 4 , 3 , 4 , 3 , 4 , 2 , 2 , 2 , 4 , 3 , - 4 , 3 , 3 , 3 , 4 , 2 , 4 , 4 , 4 , 3 , - 4 , 3 , 3 , 3 , 4 , 2 , 2 , 2 , 4 , 3 , - 4 , 3 , 4 , 3 , 4 , 2 , 4 , 4 , 4 , 4 , - 4 , 3 , 4 , 3 , 4 , 2 , 2 , 2 , 4 , 3 , - 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 ] -} diff --git a/examples/demos/samegame/content/levels/level6.qml b/examples/demos/samegame/content/levels/level6.qml deleted file mode 100644 index 4547b75a37..0000000000 --- a/examples/demos/samegame/content/levels/level6.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -TemplateBase{ - moveTarget: 20 - timeTarget: 40 - goalText: "7 of 10

Clear with 20 moves in 40 seconds (or better)." - startingGrid: [ 1 , 3 , 1 , 1 , 1 , 1 , 2 , 1 , 2 , 2 , - 2 , 1 , 2 , 3 , 3 , 1 , 3 , 1 , 1 , 3 , - 3 , 1 , 1 , 1 , 2 , 2 , 3 , 2 , 3 , 1 , - 1 , 3 , 1 , 1 , 3 , 1 , 1 , 1 , 2 , 3 , - 2 , 1 , 1 , 1 , 3 , 2 , 3 , 3 , 2 , 3 , - 3 , 3 , 3 , 3 , 2 , 2 , 3 , 1 , 3 , 2 , - 2 , 2 , 3 , 2 , 2 , 3 , 2 , 2 , 2 , 2 , - 1 , 2 , 1 , 2 , 1 , 3 , 2 , 3 , 2 , 3 , - 1 , 1 , 2 , 3 , 3 , 3 , 3 , 1 , 1 , 2 , - 3 , 3 , 2 , 2 , 2 , 2 , 3 , 1 , 3 , 1 , - 1 , 2 , 3 , 3 , 3 , 1 , 3 , 2 , 1 , 2 , - 1 , 2 , 1 , 1 , 2 , 3 , 1 , 2 , 1 , 3 , - 3 , 1 , 2 , 2 , 1 , 3 , 3 , 1 , 3 , 2 ] -} diff --git a/examples/demos/samegame/content/levels/level7.qml b/examples/demos/samegame/content/levels/level7.qml deleted file mode 100644 index 5d71d7cb51..0000000000 --- a/examples/demos/samegame/content/levels/level7.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -TemplateBase{ - goalText: "8 of 10

Clear the grid." - startingGrid: [ 2 , 4 , 3 , 2 , 3 , 2 , 3 , 3 , 4 , 3 , - 2 , 2 , 3 , 3 , 1 , 4 , 3 , 3 , 3 , 2 , - 1 , 4 , 2 , 3 , 4 , 3 , 3 , 1 , 1 , 1 , - 2 , 1 , 2 , 4 , 4 , 2 , 2 , 3 , 2 , 1 , - 3 , 4 , 4 , 1 , 3 , 2 , 4 , 2 , 1 , 1 , - 2 , 2 , 3 , 1 , 2 , 4 , 1 , 2 , 1 , 2 , - 1 , 2 , 3 , 2 , 4 , 4 , 3 , 1 , 1 , 2 , - 4 , 4 , 2 , 1 , 2 , 4 , 2 , 2 , 4 , 3 , - 4 , 2 , 4 , 1 , 3 , 4 , 1 , 4 , 2 , 4 , - 4 , 3 , 4 , 1 , 4 , 3 , 1 , 3 , 1 , 1 , - 3 , 3 , 2 , 3 , 2 , 4 , 1 , 2 , 4 , 4 , - 3 , 4 , 2 , 2 , 4 , 3 , 4 , 1 , 3 , 2 , - 4 , 3 , 3 , 4 , 2 , 4 , 1 , 2 , 3 , 2 ] -} diff --git a/examples/demos/samegame/content/levels/level8.qml b/examples/demos/samegame/content/levels/level8.qml deleted file mode 100644 index 9dbb8c2d5f..0000000000 --- a/examples/demos/samegame/content/levels/level8.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -TemplateBase{ - scoreTarget: 1000 - goalText: "9 of 10

Score over 1000 points" - startingGrid: [ 1 , 4 , 4 , 3 , 2 , 1 , 4 , 2 , 4 , 2 , - 2 , 3 , 4 , 4 , 1 , 1 , 1 , 4 , 4 , 4 , - 1 , 3 , 1 , 2 , 2 , 1 , 2 , 1 , 4 , 2 , - 4 , 3 , 4 , 2 , 1 , 4 , 1 , 2 , 2 , 3 , - 3 , 4 , 2 , 4 , 4 , 3 , 2 , 2 , 2 , 1 , - 4 , 4 , 3 , 2 , 4 , 4 , 2 , 1 , 1 , 1 , - 1 , 2 , 1 , 3 , 4 , 1 , 1 , 3 , 2 , 3 , - 3 , 4 , 2 , 2 , 1 , 3 , 2 , 2 , 4 , 2 , - 2 , 4 , 1 , 2 , 2 , 4 , 3 , 3 , 3 , 1 , - 1 , 2 , 2 , 4 , 1 , 2 , 2 , 3 , 3 , 3 , - 4 , 4 , 1 , 4 , 3 , 1 , 3 , 3 , 3 , 4 , - 1 , 2 , 4 , 1 , 2 , 1 , 1 , 4 , 2 , 1 , - 1 , 2 , 3 , 4 , 2 , 4 , 4 , 2 , 1 , 3 ] -} diff --git a/examples/demos/samegame/content/levels/level9.qml b/examples/demos/samegame/content/levels/level9.qml deleted file mode 100644 index 4e8bf19e26..0000000000 --- a/examples/demos/samegame/content/levels/level9.qml +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -TemplateBase{ - scoreTarget: 2000 - timeTarget: 60 - moveTarget: 20 - mustClear: false - goalText: "10 of 10

Score 2000 in one minute with less than 20 moves!" - startingGrid: [ 3 , 2 , 3 , 1 , 3 , 3 , 4 , 1 , 3 , 3 , - 2 , 3 , 2 , 1 , 1 , 2 , 2 , 2 , 4 , 1 , - 2 , 4 , 4 , 4 , 3 , 1 , 4 , 4 , 4 , 1 , - 3 , 1 , 3 , 4 , 4 , 2 , 2 , 2 , 2 , 3 , - 2 , 1 , 4 , 4 , 3 , 3 , 1 , 1 , 3 , 2 , - 3 , 2 , 1 , 4 , 3 , 4 , 1 , 3 , 4 , 2 , - 3 , 3 , 1 , 4 , 4 , 4 , 2 , 1 , 2 , 3 , - 2 , 3 , 4 , 3 , 4 , 1 , 1 , 3 , 2 , 4 , - 4 , 4 , 1 , 2 , 4 , 3 , 2 , 2 , 2 , 4 , - 1 , 4 , 2 , 2 , 1 , 1 , 2 , 1 , 1 , 4 , - 1 , 4 , 3 , 3 , 3 , 1 , 3 , 4 , 4 , 2 , - 3 , 4 , 1 , 1 , 2 , 2 , 2 , 3 , 2 , 1 , - 3 , 3 , 4 , 3 , 1 , 1 , 1 , 4 , 4 , 3 ] -} diff --git a/examples/demos/samegame/content/samegame.js b/examples/demos/samegame/content/samegame.js deleted file mode 100755 index 7b226cb42f..0000000000 --- a/examples/demos/samegame/content/samegame.js +++ /dev/null @@ -1,581 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 script file handles the game logic */ -.pragma library -.import QtQuick.LocalStorage 2.0 as Sql -.import "../settings.js" as Settings - -var maxColumn = 10; -var maxRow = 13; -var types = 3; -var maxIndex = maxColumn*maxRow; -var board = new Array(maxIndex); -var blockSrc = "Block.qml"; -var gameDuration; -var component = Qt.createComponent(blockSrc); -var gameCanvas; -var betweenTurns = false; - -var puzzleLevel = null; -var puzzlePath = ""; - -var gameMode = "arcade"; //Set in new game, then tweaks behaviour of other functions -var gameOver = false; - -function changeBlock(src) -{ - blockSrc = src; - component = Qt.createComponent(blockSrc); -} - -// 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 cleanUp() -{ - if (gameCanvas == undefined) - return; - // Delete blocks from previous game - for (var i = 0; i < maxIndex; i++) { - if (board[i] != null) - board[i].destroy(); - board[i] = null; - } - if (puzzleLevel != null){ - puzzleLevel.destroy(); - puzzleLevel = null; - } - gameCanvas.mode = "" -} - -function startNewGame(gc, mode, map) -{ - gameCanvas = gc; - if (mode == undefined) - gameMode = "arcade"; - else - gameMode = mode; - gameOver = false; - - cleanUp(); - - gc.gameOver = false; - gc.mode = gameMode; - // Calculate board size - maxColumn = Math.floor(gameCanvas.width/Settings.blockSize); - maxRow = Math.floor(gameCanvas.height/Settings.blockSize); - maxIndex = maxRow * maxColumn; - if (gameMode == "arcade") //Needs to be after board sizing - getHighScore(); - - - // Initialize Board - board = new Array(maxIndex); - gameCanvas.score = 0; - gameCanvas.score2 = 0; - gameCanvas.moves = 0; - gameCanvas.curTurn = 1; - if (gameMode == "puzzle") - loadMap(map); - else//Note that we load them in reverse order for correct visual stacking - for (var column = maxColumn - 1; column >= 0; column--) - for (var row = maxRow - 1; row >= 0; row--) - createBlock(column, row); - if (gameMode == "puzzle") - getLevelHistory();//Needs to be after map load - 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 (betweenTurns || gameOver || gameCanvas == undefined) - return; - var column = Math.floor(x/Settings.blockSize); - var row = Math.floor(y/Settings.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; - if (gameMode == "multiplayer" && gameCanvas.curTurn == 2) - gameCanvas.score2 += (fillFound - 1) * (fillFound - 1); - else - gameCanvas.score += (fillFound - 1) * (fillFound - 1); - if (gameMode == "multiplayer" && gameCanvas.curTurn == 2) - shuffleUp(); - else - shuffleDown(); - gameCanvas.moves += 1; - if (gameMode == "endless") - refill(); - else if (gameMode != "multiplayer") - victoryCheck(); - if (gameMode == "multiplayer" && !gc.gameOver){ - betweenTurns = true; - gameCanvas.swapPlayers();//signal, animate and call turnChange() when ready - } -} - -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) * Settings.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) * Settings.blockSize; - board[index(column - fallDist,row)] = obj; - board[index(column, row)] = null; - } - } - } - } -} - - -function shuffleUp() -{ - // Fall up - for (var column = 0; column < maxColumn; column++) { - var fallDist = 0; - for (var row = 0; row < maxRow; row++) { - if (board[index(column,row)] == null) { - fallDist += 1; - } else { - if (fallDist > 0) { - var obj = board[index(column, row)]; - obj.y = (row - fallDist) * Settings.blockSize; - board[index(column, row - fallDist)] = obj; - board[index(column, row)] = null; - } - } - } - } - // Fall to the left (or should it be right, so as to be left for P2?) - fallDist = 0; - for (column = 0; column < maxColumn; column++) { - if (board[index(column, 0)] == 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) * Settings.blockSize; - board[index(column - fallDist,row)] = obj; - board[index(column, row)] = null; - } - } - } - } -} - -function turnChange()//called by ui outside -{ - betweenTurns = false; - if (gameCanvas.curTurn == 1){ - shuffleUp(); - gameCanvas.curTurn = 2; - victoryCheck(); - }else{ - shuffleDown(); - gameCanvas.curTurn = 1; - victoryCheck(); - } -} - -function refill() -{ - for (var column = 0; column < maxColumn; column++) { - for (var row = 0; row < maxRow; row++) { - if (board[index(column, row)] == null) - createBlock(column, row); - } - } -} - -function victoryCheck() -{ - // Awards bonuses for no blocks left - var deservesBonus = true; - if (board[index(0,maxRow - 1)] != null || board[index(0,0)] != null) - deservesBonus = false; - // Checks for game over - if (deservesBonus){ - if (gameCanvas.curTurn = 1) - gameCanvas.score += 1000; - else - gameCanvas.score2 += 1000; - } - gameOver = deservesBonus; - if (gameCanvas.curTurn == 1){ - if (!(floodMoveCheck(0, maxRow - 1, -1))) - gameOver = true; - }else{ - if (!(floodMoveCheck(0, 0, -1, true))) - gameOver = true; - } - if (gameMode == "puzzle"){ - puzzleVictoryCheck(deservesBonus);//Takes it from here - return; - } - if (gameOver) { - var winnerScore = Math.max(gameCanvas.score, gameCanvas.score2); - if (gameMode == "multiplayer"){ - gameCanvas.score = winnerScore; - saveHighScore(gameCanvas.score2); - } - saveHighScore(gameCanvas.score); - gameDuration = new Date() - gameDuration; - gameCanvas.gameOver = true; - } -} - -// Only floods up and right, to see if it can find adjacent same-typed blocks -function floodMoveCheck(column, row, type, goDownInstead) -{ - 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; - if (goDownInstead) - return floodMoveCheck(column + 1, row, myType, goDownInstead) || - floodMoveCheck(column, row + 1, myType, goDownInstead); - else - return floodMoveCheck(column + 1, row, myType) || - floodMoveCheck(column, row - 1, myType); -} - -function createBlock(column,row,type) -{ - // 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){ - if (type == undefined) - type = Math.floor(Math.random() * types); - if (type < 0 || type > 4) { - console.log("Invalid type requested");//TODO: Is this triggered by custom levels much? - return; - } - var dynamicObject = component.createObject(gameCanvas, - {"type": type, - "x": column*Settings.blockSize, - "y": -1*Settings.blockSize, - "width": Settings.blockSize, - "height": Settings.blockSize, - "particleSystem": gameCanvas.ps}); - if (dynamicObject == null){ - console.log("error creating block"); - console.log(component.errorString()); - return false; - } - dynamicObject.y = row*Settings.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 showPuzzleError(str) -{ - //TODO: Nice user visible UI? - console.log(str); -} - -function loadMap(map) -{ - puzzlePath = map; - var levelComp = Qt.createComponent(puzzlePath); - if (levelComp.status != 1){ - console.log("Error loading level"); - showPuzzleError(levelComp.errorString()); - return; - } - puzzleLevel = levelComp.createObject(); - if (puzzleLevel == null || !puzzleLevel.startingGrid instanceof Array) { - showPuzzleError("Bugger!"); - return; - } - gameCanvas.showPuzzleGoal(puzzleLevel.goalText); - //showPuzzleGoal should call finishLoadingMap as the next thing it does, before handling more events -} - -function finishLoadingMap() -{ - for (var i in puzzleLevel.startingGrid) - if (! (puzzleLevel.startingGrid[i] >= 0 && puzzleLevel.startingGrid[i] <= 9) ) - puzzleLevel.startingGrid[i] = 0; - //TODO: Don't allow loading larger levels, leads to cheating - while (puzzleLevel.startingGrid.length > maxIndex) puzzleLevel.startingGrid.shift(); - while (puzzleLevel.startingGrid.length < maxIndex) puzzleLevel.startingGrid.unshift(0); - for (var i in puzzleLevel.startingGrid) - if (puzzleLevel.startingGrid[i] > 0) - createBlock(i % maxColumn, Math.floor(i / maxColumn), puzzleLevel.startingGrid[i] - 1); - - //### Experimental feature - allow levels to contain arbitrary QML scenes as well! - //while (puzzleLevel.children.length) - // puzzleLevel.children[0].parent = gameCanvas; - gameDuration = new Date(); //Don't start until we finish loading -} - -function puzzleVictoryCheck(clearedAll)//gameOver has also been set if no more moves -{ - var won = true; - var soFar = new Date() - gameDuration; - if (puzzleLevel.scoreTarget != -1 && gameCanvas.score < puzzleLevel.scoreTarget){ - won = false; - } if (puzzleLevel.scoreTarget != -1 && gameCanvas.score >= puzzleLevel.scoreTarget && !puzzleLevel.mustClear){ - gameOver = true; - } if (puzzleLevel.timeTarget != -1 && soFar/1000.0 > puzzleLevel.timeTarget){ - gameOver = true; - } if (puzzleLevel.moveTarget != -1 && gameCanvas.moves >= puzzleLevel.moveTarget){ - gameOver = true; - } if (puzzleLevel.mustClear && gameOver && !clearedAll) { - won = false; - } - - if (gameOver) { - gameCanvas.gameOver = true; - gameCanvas.showPuzzleEnd(won); - - if (won) { - // Store progress - saveLevelHistory(); - } - } -} - -function getHighScore() -{ - var db = Sql.LocalStorage.openDatabaseSync( - "SameGame", - "2.0", - "SameGame Local Data", - 100 - ); - db.transaction( - function(tx) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(game 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 + '" AND game = "' + gameMode + '" ORDER BY score desc'); - if (rs.rows.length > 0) - gameCanvas.highScore = rs.rows.item(0).score; - else - gameCanvas.highScore = 0; - } - ); -} - -function saveHighScore(score) -{ - // Offline storage - var db = Sql.LocalStorage.openDatabaseSync( - "SameGame", - "2.0", - "SameGame Local Data", - 100 - ); - var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)"; - var data = [ - gameMode, - score, - maxColumn + "x" + maxRow, - Math.floor(gameDuration / 1000) - ]; - if (score >= gameCanvas.highScore)//Update UI field - gameCanvas.highScore = score; - - db.transaction( - function(tx) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(game TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); - tx.executeSql(dataStr, data); - } - ); -} - -function getLevelHistory() -{ - var db = Sql.LocalStorage.openDatabaseSync( - "SameGame", - "2.0", - "SameGame Local Data", - 100 - ); - db.transaction( - function(tx) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Puzzle(level TEXT, score NUMBER, moves NUMBER, time NUMBER)'); - var rs = tx.executeSql('SELECT * FROM Puzzle WHERE level = "' + puzzlePath + '" ORDER BY score desc'); - if (rs.rows.length > 0) { - gameCanvas.puzzleWon = true; - gameCanvas.highScore = rs.rows.item(0).score; - } else { - gameCanvas.puzzleWon = false; - gameCanvas.highScore = 0; - } - } - ); -} - -function saveLevelHistory() -{ - var db = Sql.LocalStorage.openDatabaseSync( - "SameGame", - "2.0", - "SameGame Local Data", - 100 - ); - var dataStr = "INSERT INTO Puzzle VALUES(?, ?, ?, ?)"; - var data = [ - puzzlePath, - gameCanvas.score, - gameCanvas.moves, - Math.floor(gameDuration / 1000) - ]; - gameCanvas.puzzleWon = true; - - db.transaction( - function(tx) { - tx.executeSql('CREATE TABLE IF NOT EXISTS Puzzle(level TEXT, score NUMBER, moves NUMBER, time NUMBER)'); - tx.executeSql(dataStr, data); - } - ); -} - -function nuke() //For "Debug mode" -{ - for (var row = 1; row <= 5; row++) { - for (var col = 0; col < 5; col++) { - if (board[index(col, maxRow - row)] != null) { - board[index(col, maxRow - row)].dying = true; - board[index(col, maxRow - row)] = null; - } - } - } - if (gameMode == "multiplayer" && gameCanvas.curTurn == 2) - shuffleUp(); - else - shuffleDown(); - if (gameMode == "endless") - refill(); - else - victoryCheck(); -} diff --git a/examples/demos/samegame/main.cpp b/examples/demos/samegame/main.cpp deleted file mode 100644 index 20bf7fad18..0000000000 --- a/examples/demos/samegame/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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(samegame) diff --git a/examples/demos/samegame/samegame.pro b/examples/demos/samegame/samegame.pro deleted file mode 100644 index 2f7afef5a5..0000000000 --- a/examples/demos/samegame/samegame.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app - -QT += qml quick -SOURCES += main.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/demos/samegame -qml.files = samegame.qml content settings.js -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/demos/samegame -sources.files = $$SOURCES samegame.pro -sources.path = $$qml.path -INSTALLS += sources target qml diff --git a/examples/demos/samegame/samegame.qml b/examples/demos/samegame/samegame.qml deleted file mode 100644 index 2b0b82a37c..0000000000 --- a/examples/demos/samegame/samegame.qml +++ /dev/null @@ -1,371 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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/samegame.js" as Logic -import "settings.js" as Settings -import "content" - -Rectangle { - id: root - width: 320; height: 480 - property int acc: 0 - - - function loadPuzzle() { - if (gameCanvas.mode != "") - Logic.cleanUp(); - Logic.startNewGame(gameCanvas,"puzzle","levels/level"+acc+".qml") - } - function nextPuzzle() { - acc = (acc + 1) % 10; - loadPuzzle(); - } - Timer { - id: gameOverTimer - interval: 1500 - running : gameCanvas.gameOver && gameCanvas.mode == "puzzle" //mode will be reset by cleanUp(); - repeat : false - onTriggered: { - Logic.cleanUp(); - nextPuzzle(); - } - } - - Image { - source: "content/gfx/background.png" - anchors.fill: parent - } - - GameArea { - id: gameCanvas - z: 1 - y: Settings.headerHeight - - width: parent.width - height: parent.height - Settings.headerHeight - Settings.footerHeight - - backgroundVisible: root.state == "in-game" - onModeChanged: if (gameCanvas.mode != "puzzle") puzzleWon = false; //UI has stricter constraints on this variable than the game does - Age { - groups: ["redspots", "greenspots", "bluespots", "yellowspots"] - enabled: root.state == "" - system: gameCanvas.ps - } - - onPuzzleLost: acc--;//So that nextPuzzle() reloads the current one - - } - - Item { - id: menu - z: 2 - width: parent.width; - anchors.top: parent.top - anchors.bottom: bottomBar.top - - LogoAnimation { - x: 64 - y: Settings.headerHeight - particleSystem: gameCanvas.ps - running: root.state == "" - } - Row { - x: 112 - y: 20 - Image { source: "content/gfx/logo-a.png" } - Image { source: "content/gfx/logo-m.png" } - Image { source: "content/gfx/logo-e.png" } - } - - Column { - y: 100 + 40 - spacing: Settings.menuButtonSpacing - - Button { - width: root.width - rotatedButton: true - imgSrc: "content/gfx/but-game-1.png" - onClicked: { - if (root.state == "in-game") - return //Prevent double clicking - root.state = "in-game" - gameCanvas.blockFile = "Block.qml" - gameCanvas.background = "gfx/background.png" - arcadeTimer.start(); - } - //Emitted particles don't fade out, because ImageParticle is on the GameArea - system: gameCanvas.ps - group: "green" - Timer { - id: arcadeTimer - interval: Settings.menuDelay - running : false - repeat : false - onTriggered: Logic.startNewGame(gameCanvas) - } - } - - Button { - width: root.width - rotatedButton: true - imgSrc: "content/gfx/but-game-2.png" - onClicked: { - if (root.state == "in-game") - return - root.state = "in-game" - gameCanvas.blockFile = "Block.qml" - gameCanvas.background = "gfx/background.png" - twopTimer.start(); - } - system: gameCanvas.ps - group: "green" - Timer { - id: twopTimer - interval: Settings.menuDelay - running : false - repeat : false - onTriggered: Logic.startNewGame(gameCanvas, "multiplayer") - } - } - - Button { - width: root.width - rotatedButton: true - imgSrc: "content/gfx/but-game-3.png" - onClicked: { - if (root.state == "in-game") - return - root.state = "in-game" - gameCanvas.blockFile = "SimpleBlock.qml" - gameCanvas.background = "gfx/background.png" - endlessTimer.start(); - } - system: gameCanvas.ps - group: "blue" - Timer { - id: endlessTimer - interval: Settings.menuDelay - running : false - repeat : false - onTriggered: Logic.startNewGame(gameCanvas, "endless") - } - } - - Button { - width: root.width - rotatedButton: true - imgSrc: "content/gfx/but-game-4.png" - group: "yellow" - onClicked: { - if (root.state == "in-game") - return - root.state = "in-game" - gameCanvas.blockFile = "PuzzleBlock.qml" - gameCanvas.background = "gfx/background.png" - puzzleTimer.start(); - } - Timer { - id: puzzleTimer - interval: Settings.menuDelay - running : false - repeat : false - onTriggered: loadPuzzle(); - } - system: gameCanvas.ps - } - } - } - - Image { - id: scoreBar - source: "content/gfx/bar.png" - width: parent.width - z: 6 - y: -Settings.headerHeight - height: Settings.headerHeight - Behavior on opacity { NumberAnimation {} } - SamegameText { - id: arcadeScore - anchors { right: parent.right; topMargin: 3; rightMargin: 11; top: parent.top} - text: 'P1: ' + gameCanvas.score - font.pixelSize: Settings.fontPixelSize - textFormat: Text.StyledText - color: "white" - opacity: gameCanvas.mode == "arcade" ? 1 : 0 - Behavior on opacity { NumberAnimation {} } - } - SamegameText { - id: arcadeHighScore - anchors { left: parent.left; topMargin: 3; leftMargin: 11; top: parent.top} - text: 'Highscore: ' + gameCanvas.highScore - opacity: gameCanvas.mode == "arcade" ? 1 : 0 - } - SamegameText { - id: p1Score - anchors { right: parent.right; topMargin: 3; rightMargin: 11; top: parent.top} - text: 'P1: ' + gameCanvas.score - opacity: gameCanvas.mode == "multiplayer" ? 1 : 0 - } - SamegameText { - id: p2Score - anchors { left: parent.left; topMargin: 3; leftMargin: 11; top: parent.top} - text: 'P2: ' + gameCanvas.score2 - opacity: gameCanvas.mode == "multiplayer" ? 1 : 0 - rotation: 180 - } - SamegameText { - id: puzzleMoves - anchors { left: parent.left; topMargin: 3; leftMargin: 11; top: parent.top} - text: 'Moves: ' + gameCanvas.moves - opacity: gameCanvas.mode == "puzzle" ? 1 : 0 - } - SamegameText { - Image { - source: "content/gfx/icon-time.png" - x: -20 - } - id: puzzleTime - anchors { topMargin: 3; top: parent.top; horizontalCenter: parent.horizontalCenter; horizontalCenterOffset: 20} - text: "00:00" - opacity: gameCanvas.mode == "puzzle" ? 1 : 0 - Timer { - interval: 1000 - repeat: true - running: gameCanvas.mode == "puzzle" && !gameCanvas.gameOver - onTriggered: { - var elapsed = Math.floor((new Date() - Logic.gameDuration)/ 1000.0); - var mins = Math.floor(elapsed/60.0); - var secs = (elapsed % 60); - puzzleTime.text = (mins < 10 ? "0" : "") + mins + ":" + (secs < 10 ? "0" : "") + secs; - } - } - } - SamegameText { - id: puzzleScore - anchors { right: parent.right; topMargin: 3; rightMargin: 11; top: parent.top} - text: 'Score: ' + gameCanvas.score - opacity: gameCanvas.mode == "puzzle" ? 1 : 0 - } - } - - Image { - id: bottomBar - width: parent.width - height: Settings.footerHeight - source: "content/gfx/bar.png" - y: parent.height - Settings.footerHeight; - z: 2 - Button { - id: quitButton - height: Settings.toolButtonHeight - imgSrc: "content/gfx/but-quit.png" - onClicked: {Qt.quit(); } - anchors { left: parent.left; verticalCenter: parent.verticalCenter; leftMargin: 11 } - } - Button { - id: menuButton - height: Settings.toolButtonHeight - imgSrc: "content/gfx/but-menu.png" - visible: (root.state == "in-game"); - onClicked: {root.state = ""; Logic.cleanUp(); gameCanvas.mode = ""} - anchors { left: quitButton.right; verticalCenter: parent.verticalCenter; leftMargin: 0 } - } - Button { - id: againButton - height: Settings.toolButtonHeight - imgSrc: "content/gfx/but-game-new.png" - visible: (root.state == "in-game"); - opacity: gameCanvas.gameOver && (gameCanvas.mode == "arcade" || gameCanvas.mode == "multiplayer") - Behavior on opacity{ NumberAnimation {} } - onClicked: {if (gameCanvas.gameOver) { Logic.startNewGame(gameCanvas, gameCanvas.mode);}} - anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 11 } - } - Button { - id: nextButton - height: Settings.toolButtonHeight - imgSrc: "content/gfx/but-puzzle-next.png" - visible: (root.state == "in-game") && gameCanvas.mode == "puzzle" && gameCanvas.puzzleWon - opacity: gameCanvas.puzzleWon ? 1 : 0 - Behavior on opacity{ NumberAnimation {} } - onClicked: {if (gameCanvas.puzzleWon) nextPuzzle();} - anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 11 } - } - } - - Connections { - target: root - onStateChanged: stateChangeAnim.running = true - } - SequentialAnimation { - id: stateChangeAnim - ParallelAnimation { - NumberAnimation { target: bottomBar; property: "y"; to: root.height; duration: Settings.menuDelay/2; easing.type: Easing.OutQuad } - NumberAnimation { target: scoreBar; property: "y"; to: -Settings.headerHeight; duration: Settings.menuDelay/2; easing.type: Easing.OutQuad } - } - ParallelAnimation { - NumberAnimation { target: bottomBar; property: "y"; to: root.height - Settings.footerHeight; duration: Settings.menuDelay/2; easing.type: Easing.OutBounce} - NumberAnimation { target: scoreBar; property: "y"; to: root.state == "" ? -Settings.headerHeight : 0; duration: Settings.menuDelay/2; easing.type: Easing.OutBounce} - } - } - - states: [ - State { - name: "in-game" - PropertyChanges { - target: menu - opacity: 0 - visible: false - } - } - ] - - transitions: [ - Transition { - NumberAnimation {properties: "x,y,opacity"} - } - ] - - //"Debug mode" - focus: true - Keys.onAsteriskPressed: Logic.nuke(); - Keys.onSpacePressed: gameCanvas.puzzleWon = true; -} diff --git a/examples/demos/samegame/samegame.qmlproject b/examples/demos/samegame/samegame.qmlproject deleted file mode 100644 index 42ffacf4f8..0000000000 --- a/examples/demos/samegame/samegame.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -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/samegame/settings.js b/examples/demos/samegame/settings.js deleted file mode 100644 index e09dee9af3..0000000000 --- a/examples/demos/samegame/settings.js +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Research In Motion -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -.pragma library - -//This should be switched over once a proper QML settings API exists - -var menuDelay = 500 - -var headerHeight = 20 // 70 on BB10 -var footerHeight = 44 // 100 on BB10 - -var fontPixelSize = 14 // 55 on BB10 - -var blockSize = 32 // 64 on BB10 - -var toolButtonHeight = 32 // 64 on BB10 - -var menuButtonSpacing = 0 // 15 on BB10 diff --git a/examples/demos/stocqt/content/Button.qml b/examples/demos/stocqt/content/Button.qml deleted file mode 100644 index 0e99c52c51..0000000000 --- a/examples/demos/stocqt/content/Button.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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:button - property bool buttonEnabled:true - radius:5 - width:25 - height:25 - color:buttonEnabled ? "steelblue" : "gray" - MouseArea { - anchors.fill:parent - onClicked: { - if (buttonEnabled) - buttonEnabled = false; - else - buttonEnabled = true; - } - } -} diff --git a/examples/demos/stocqt/content/DatePicker.qml b/examples/demos/stocqt/content/DatePicker.qml deleted file mode 100644 index 82d8788bd9..0000000000 --- a/examples/demos/stocqt/content/DatePicker.qml +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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:"transparent" - width:300 - height:45 - property var _monthNames : [ "JAN", "FEB", "MAR", "APR", "MAY", "JUN","JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ]; - property var date:new Date() - - onDateChanged: { - month.text = root._monthNames[root.date.getMonth()] - day.text = date.getDate(); - year.text = date.getFullYear(); - } - Row { - spacing:20 - anchors.fill:parent - - Rectangle { - height:root.height - width:root.width/3 - 20 - color:"#272822" - radius:5 - - TextInput { - id:month - anchors.centerIn:parent - color:"#ecc089" - font.pointSize:25 - font.bold:true - text:root._monthNames[root.date.getMonth()] - onAccepted : { - for (var i = 0; i < 12; i++) { - if (text === root._monthNames[i]) { - root.date.setMonth(i); - root.date = root.date; - return; - } - } - root.date = root.date; - } - } - } - - Rectangle { - height:root.height - width:root.width/3 - 20 - color:"#272822" - radius:5 - - TextInput { - id:day - anchors.centerIn:parent - color:"#ecc089" - font.pointSize:25 - font.bold:true - text:root.date.getDate() - validator:IntValidator {bottom:1; top:31} - onAccepted: { root.date.setDate(text); root.date = root.date;} - } - } - - Rectangle { - height:root.height - width:root.width/3 - 20 - color:"#272822" - radius:5 - - TextInput { - id:year - anchors.centerIn:parent - color:"#ecc089" - font.pointSize:25 - font.bold:true - text:root.date.getFullYear() - validator:IntValidator {bottom:1995; top:(new Date()).getFullYear()} - onAccepted:{ root.date.setFullYear(text); root.date = root.date;} - } - } - } -} diff --git a/examples/demos/stocqt/content/StockChart.qml b/examples/demos/stocqt/content/StockChart.qml deleted file mode 100644 index c7411679bb..0000000000 --- a/examples/demos/stocqt/content/StockChart.qml +++ /dev/null @@ -1,324 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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:chart - width:320 - height:320 - color:"transparent" - property var _months : [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ] - property var stockModel:null - property var startDate - property var endDate - property var settings - - function update() { - if (settings.chartType === "year") - chart.startDate = new Date(chart.endDate.getFullYear() - 1, chart.endDate.getMonth(), chart.endDate.getDate()); - else if (settings.chartType === "month") - chart.startDate = new Date(chart.endDate.getFullYear() , chart.endDate.getMonth() -1, chart.endDate.getDate()) - else if (settings.chartType === "week") - chart.startDate = new Date(chart.endDate.getFullYear() , chart.endDate.getMonth(), chart.endDate.getDate() - 7) - else - chart.startDate = new Date(1995, 3, 25) - - canvas.requestPaint(); - } - - - Text { - id:fromDate - color:"#6a5b44" - width:50 - font.pointSize: 10 - wrapMode: Text.WordWrap - anchors.left: parent.left - anchors.leftMargin: 20 - anchors.top:parent.top - text:_months[startDate.getMonth()] + "\n" + startDate.getFullYear() - } - - Text { - id:toDate - color:"#6a5b44" - font.pointSize: 10 - width:50 - wrapMode: Text.WordWrap - anchors.right: parent.right - anchors.leftMargin: 20 - anchors.top:parent.top - text:_months[endDate.getMonth()] + "\n" + endDate.getFullYear() - } - - Canvas { - id:canvas - anchors.top : toDate.bottom - width:parent.width - anchors.bottom: parent.bottom - - renderTarget: Canvas.FramebufferObject - 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:0; - -// MouseArea { -// anchors.fill: parent - -// 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 drawBackground(ctx) { - ctx.save(); - ctx.fillStyle = "#272822" - ctx.fillRect(0, 0, canvas.width, canvas.height) - ctx.strokeStyle = "#423a2f" - ctx.beginPath(); - for (var i = 0; i < 10; i++) { - ctx.moveTo(0, i * (canvas.height/10.0)); - ctx.lineTo(canvas.width, i * (canvas.height/10.0)); - } - - for (i = 0; i < 12; i++) { - ctx.moveTo(i * (canvas.width/12.0), 0); - ctx.lineTo(i * (canvas.width/12.0), canvas.height); - } - ctx.stroke(); - - ctx.strokeStyle = "#5c7a37" - ctx.beginPath(); - ctx.moveTo(8 * (canvas.width/12.0), 0); - ctx.lineTo(8 * (canvas.width/12.0), canvas.height); - ctx.stroke(); - - ctx.restore(); - } - - function drawPrice(ctx, from, to, color, price, points, highest) - { - ctx.save(); - ctx.globalAlpha = 0.7; - ctx.strokeStyle = color; - ctx.lineWidth = 1; - ctx.beginPath(); - - var w = canvas.width/points.length; - var end = points.length; - for (var i = 0; i < end; i++) { - var x = points[i].x; - var y = points[i][price]; - y = canvas.height * y/highest; - if (i == 0) { - ctx.moveTo(x+w/2, y); - } else { - ctx.lineTo(x+w/2, y); - } - } - ctx.stroke(); - ctx.restore(); - } - - function drawKLine(ctx, from, to, points, highest) - { - ctx.save(); - ctx.globalAlpha = 0.4; - ctx.lineWidth = 2; - var end = points.length; - for (var i = 0; i < end; i++) { - var x = points[i].x; - var open = canvas.height * points[i].open/highest - canvas.movedY; - var close = canvas.height * points[i].close/highest - canvas.movedY; - var high = canvas.height * points[i].high/highest - canvas.movedY; - var low = canvas.height * 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.restore(); - } - - function drawVolume(ctx, from, to, color, price, points, highest) - { - ctx.save(); - ctx.fillStyle = color; - ctx.globalAlpha = 0.6; - ctx.strokeStyle = Qt.rgba(0.8, 0.8, 0.8, 1); - ctx.lineWidth = 1; - - var end = 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); - } - ctx.restore(); - } - - onPaint: { - var ctx = canvas.getContext("2d"); - - ctx.globalCompositeOperation = "source-over"; - ctx.lineWidth = 1; - - drawBackground(ctx); - if (!stockModel.ready) - return; - - last = stockModel.indexOf(chart.endDate) - first = last - (chart.endDate.getTime() - chart.startDate.getTime())/86400000; - console.log("painting... first:" + first + ", last:" + last); - - var highestPrice = stockModel.highestPrice; - var highestVolume = stockModel.highestVolume; - console.log("highest price:" + highestPrice + ", highest volume:" + highestVolume) - var points = []; - for (var i = 0; i <= last - first; i++) { - var price = stockModel.get(i + first); - points.push({ - x: i*canvas.width/(last-first+1), - open: price.open, - close: price.close, - high:price.high, - low:price.low, - volume:price.volume - }); - } - if (settings.drawHighPrice) - drawPrice(ctx, first, last, settings.highColor,"high", points, highestPrice); - if (settings.drawLowPrice) - drawPrice(ctx, first, last, settings.lowColor,"low", points, highestPrice); - if (settings.drawOpenPrice) - drawPrice(ctx, first, last,settings.openColor,"open", points, highestPrice); - if (settings.drawClosePrice) - drawPrice(ctx, first, last, settings.closeColor,"close", points, highestPrice); - if (settings.drawVolume) - drawVolume(ctx, first, last, settings.volumeColor,"volume", points, highestVolume); - if (settings.drawKLine) - drawKLine(ctx, first, last, points, highestPrice); - } -} -} diff --git a/examples/demos/stocqt/content/StockListModel.qml b/examples/demos/stocqt/content/StockListModel.qml deleted file mode 100644 index b1e0706a3a..0000000000 --- a/examples/demos/stocqt/content/StockListModel.qml +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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/demos/stocqt/content/StockListView.qml b/examples/demos/stocqt/content/StockListView.qml deleted file mode 100644 index c241efb54c..0000000000 --- a/examples/demos/stocqt/content/StockListView.qml +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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:"#423A2F" - - property string currentStockId:"" - property string currentStockName:"" - - ListView { - id:view - anchors.fill:parent - keyNavigationWraps:true - focus:true - snapMode: ListView.SnapToItem - model:StockListModel{} - - onCurrentIndexChanged: { - root.currentStockId = model.get(currentIndex).stockId - root.currentStockName = model.get(currentIndex).name - console.log("current stock:" + root.currentStockId + " - " + root.currentStockName) - } - - delegate:Rectangle { - height:30 - width:parent.width - color:"transparent" - MouseArea { - anchors.fill: parent - onClicked:view.currentIndex = index - } - - Text { - anchors.verticalCenter : parent.top - anchors.verticalCenterOffset : 15 - color:index == view.currentIndex ? "#ECC089" : "#A58963" - font.pointSize:12 - font.bold:true - text:" " + stockId + " - " + name - } - } - - highlight:Image {height:30; width:parent.width; source:"images/stock-selected.png"} - } -} \ No newline at end of file diff --git a/examples/demos/stocqt/content/StockModel.qml b/examples/demos/stocqt/content/StockModel.qml deleted file mode 100644 index b5a78548e4..0000000000 --- a/examples/demos/stocqt/content/StockModel.qml +++ /dev/null @@ -1,160 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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:model - property string stockId:"" - property string stockName:"" - property var startDate - property var endDate - property string stockDataCycle:"d" - property bool ready:false - property real stockPrice:0.0 - property real stockPriceChanged:0.0 - property real highestPrice:0 - property real highestVolume:0 - - signal dataReady - - function indexOf(date) { - var end = new Date(model.get(0).date) - var start = new Date(model.get(model.count - 1).date) - if (end <= date) - return model.count -1; - - if (start >= date) - return 0; - - for (var i = 0; i < model.count; i++) { - var d = new Date(model.get(i).date) - if ( d === date) - return i; - } - return -1; - } - - function requestUrl() { - if (stockId === "") - return; - - if (startDate === undefined) - startDate = new Date(1995, 3, 25) //default: 25 April 1995 - - if (endDate === undefined) - endDate = new Date(); //today - - if (stockDataCycle !== "d" && stockDataCycle !== "w" && stockDataCycle !== "m") - stockDataCycle = "d"; - - /* - 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) - */ - var request = "http://ichart.finance.yahoo.com/table.csv?"; - request += "s=" + stockId; - request += "&a=" + startDate.getDate(); - request += "&b=" + startDate.getMonth(); - request += "&c=" + startDate.getFullYear(); - request += "&d=" + endDate.getDate(); - request += "&e=" + endDate.getMonth(); - request += "&f=" + endDate.getFullYear(); - request += "&g=" + stockDataCycle; - request += "&ignore=.csv"; - return request; - } - - function createStockPrice(r) { - if (highestPrice < r[2]) - highestPrice = r[2]; - if (highestVolume < r[5]) - highestVolume = r[5]; - return { - "date": r[0], - "open":r[1], - "high":r[2], - "low":r[3], - "close":r[4], - "volume":r[5], - "adjusted":r[6] - }; - } - - function updateStock() { - var xhr = new XMLHttpRequest; - - var req = requestUrl(); - console.log("getting " + req + " ....."); - - xhr.open("GET", req); - - - model.ready = false; - model.clear(); - var i = 1; //skip the first line - xhr.onreadystatechange = function() { - if (xhr.readyState === XMLHttpRequest.LOADING || xhr.readyState === XMLHttpRequest.DONE) { - var records = xhr.responseText.split('\n'); - console.log("Updating:" + (records.length - i) + " records for " + model.stockId + " from:" + model.startDate + " to " + model.endDate) - - for (;i < records.length; i++ ) { - var r = records[i].split(','); - if (r.length === 7) - model.append(createStockPrice(r)); - } - - if (xhr.readyState === XMLHttpRequest.DONE) { - if (model.count > 0) { - console.log("done, total:" + model.count); - model.ready = true; - model.stockPrice = model.get(0).adjusted - model.stockPriceChanged = Math.round((model.stockPrice - model.get(2).adjusted) * 100) / 100 - model.dataReady(); //emit signal - } - } - } - } - xhr.send() - } -} diff --git a/examples/demos/stocqt/content/StockSettings.qml b/examples/demos/stocqt/content/StockSettings.qml deleted file mode 100644 index 600747b969..0000000000 --- a/examples/demos/stocqt/content/StockSettings.qml +++ /dev/null @@ -1,317 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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:"#423A2F" - property var startDate : startDatePicker.date; - property var endDate : endDatePicker.date; - - property bool drawHighPrice:highButton.buttonEnabled - property bool drawLowPrice:lowButton.buttonEnabled - property bool drawOpenPrice:openButton.buttonEnabled - property bool drawClosePrice:closeButton.buttonEnabled - property bool drawVolume:volumeButton.buttonEnabled - property bool drawKLine:klineButton.buttonEnabled - - property color highColor:Qt.rgba(1, 0, 0, 1) - property color lowColor:Qt.rgba(0, 1, 0, 1) - property color openColor:Qt.rgba(0, 0, 1, 1) - property color closeColor:"#ecc088" - property color volumeColor:Qt.rgba(0.3, 0.5, 0.7, 1) - - property string chartType:"year" - Image { - id:logo - source:"images/logo.png" - anchors.horizontalCenter : parent.horizontalCenter - anchors.top:parent.top - anchors.topMargin:15 - } - - Text { - id:startDateText - text:"START DATE:" - color:"#76644A" - font.pointSize:15 - anchors.left:parent.left - anchors.leftMargin:20 - anchors.top:logo.bottom - anchors.topMargin:20 - } - - DatePicker { - id:startDatePicker - anchors.left:parent.left - anchors.leftMargin:30 - anchors.top:startDateText.bottom - anchors.topMargin:15 - date : new Date(1995, 3, 25) - } - - Text { - id:endDateText - text:"END DATE:" - color:"#76644A" - font.pointSize:15 - anchors.left:parent.left - anchors.leftMargin:20 - anchors.top:startDatePicker.bottom - anchors.topMargin:20 - } - - DatePicker { - id:endDatePicker - anchors.left:parent.left - anchors.leftMargin:30 - anchors.top:endDateText.bottom - anchors.topMargin:15 - } - - Text { - id:drawOptionsText - text:"DRAW OPTIONS:" - color:"#76644A" - font.pointSize:15 - anchors.left:parent.left - anchors.leftMargin:20 - anchors.top:endDatePicker.bottom - anchors.topMargin:20 - } - Column { - id:drawOptions - anchors.top:drawOptionsText.bottom - anchors.topMargin: 20 - anchors.left: parent.left - anchors.leftMargin: 30 - spacing:2 - Row{ - spacing:10 - Text { - text:"High " - color:"#76644A" - font.pointSize:15 - } - - Button { - id:highButton - buttonEnabled:false - } - - Text { - text:"Low " - color:"#76644A" - font.pointSize:15 - } - - Button { - id:lowButton - buttonEnabled:false - } - - Text { - text:"Open " - color:"#76644A" - font.pointSize:15 - } - Button { - id:openButton - buttonEnabled:false - } - } - Row{ - spacing:10 - Text { - text:"Close " - color:"#76644A" - font.pointSize:15 - } - Button { - id:closeButton - buttonEnabled:true - } - Text { - text:"Volume" - color:"#76644A" - font.pointSize:15 - } - Button { - id:volumeButton - buttonEnabled:true - } - Text { - text:"K Line" - color:"#76644A" - font.pointSize:15 - } - Button { - id:klineButton - buttonEnabled:false - } - } - } - - - Text { - id:chartTypeText - text:"CHART TYPE:" - color:"#76644A" - font.pointSize:15 - anchors.left:parent.left - anchors.leftMargin:20 - anchors.top:drawOptions.bottom - anchors.topMargin:20 - } - Row { - anchors.left: parent.left - anchors.leftMargin: 20 - anchors.top : chartTypeText.bottom - anchors.topMargin: 20 - spacing:10 - Rectangle { - id:yearView - width:70 - height:30 - radius:10 - color:"steelblue" - Text { - anchors.horizontalCenter: parent.horizontalCenter - anchors.fill: parent - font.pointSize: 15 - text:"YEAR" - } - MouseArea { - anchors.fill: parent - onClicked: { - if (root.chartType != "year") { - root.chartType = "year"; - yearView.color = "steelblue" - monthView.color = "gray" - weekView.color = "gray" - allView.color = "gray" - } - } - } - } - Rectangle { - id:monthView - width:70 - radius:10 - height:30 - color:"gray" - Text { - anchors.fill: parent - anchors.horizontalCenter: parent.horizontalCenter - font.pointSize: 15 - color:"#ecc089" - text:"MONTH" - } - MouseArea { - anchors.fill: parent - onClicked: { - if (root.chartType != "month") { - root.chartType = "month"; - yearView.color = "gray" - monthView.color = "steelblue" - weekView.color = "gray" - allView.color = "gray" - } - } - } - - } - Rectangle { - id:weekView - height:30 - width:70 - radius:10 - color:"gray" - Text { - anchors.fill: parent - anchors.horizontalCenter: parent.horizontalCenter - font.pointSize: 15 - color:"#ecc089" - text:"WEEK" - } - MouseArea { - anchors.fill: parent - onClicked: { - if (root.chartType != "week") { - root.chartType = "week"; - yearView.color = "gray" - monthView.color = "gray" - weekView.color = "steelblue" - allView.color = "gray" - } - } - } - } - Rectangle { - id:allView - width:70 - radius:10 - height:30 - color:"gray" - Text { - anchors.horizontalCenter: parent.horizontalCenter - anchors.fill: parent - font.pointSize: 15 - color:"#ecc089" - text:"ALL" - } - MouseArea { - anchors.fill: parent - onClicked: { - if (root.chartType != "all") { - root.chartType = "all"; - yearView.color = "gray" - monthView.color = "gray" - weekView.color = "gray" - allView.color = "steelblue" - } - } - } - } - } -} diff --git a/examples/demos/stocqt/content/StockView.qml b/examples/demos/stocqt/content/StockView.qml deleted file mode 100644 index 49e6c98622..0000000000 --- a/examples/demos/stocqt/content/StockView.qml +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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:"#423A2F" - property var stock:null - property var stocklist:null - property var settings:null - signal listViewClicked - signal settingsClicked - - function update() { - chart.endDate = settings.endDate - chart.update() - } - - Rectangle { - color:"#272822" - anchors.fill:parent - radius:20 - - Image { - source:"images/icon-items.png" - anchors.left:parent.left - anchors.leftMargin:10 - anchors.top:parent.top - anchors.topMargin:10 - MouseArea { - anchors.fill:parent - onClicked:listViewClicked() - } - } - Image { - source:"images/icon-settings.png" - anchors.right:parent.right - anchors.rightMargin:10 - anchors.top:parent.top - anchors.topMargin:10 - MouseArea { - anchors.fill:parent - onClicked:settingsClicked() - } - } - - Text { - id:desc - anchors.left:parent.left - anchors.leftMargin:20 - anchors.top:parent.top - anchors.topMargin:40 - color:"#564c3A" - font.pointSize:15 - text:root.stock.stockId + " - " + root.stock.stockName - } - - Text { - id:price - anchors.left:parent.left - anchors.leftMargin:20 - anchors.top:desc.bottom - anchors.topMargin:5 - color:"#ECC089" - font.pointSize:30 - text:root.stock.stockPrice - } - - Text { - id:priceChange - anchors.left:parent.left - anchors.leftMargin:20 - anchors.top:price.bottom - anchors.topMargin:5 - color: root.stock.stockPriceChanged < 0 ? "#A43D3D" : "#679B3A" - font.pointSize:25 - text: root.stock.stockPriceChanged + " (" + Math.abs(Math.round(root.stock.stockPriceChanged/(root.stock.stockPrice - root.stock.stockPriceChanged) * 100))/100 +"%)" - } - - StockChart { - id:chart - anchors.bottom: parent.bottom - anchors.top : priceChange.bottom - anchors.topMargin: 30 - width:parent.width - stockModel:root.stock - settings:root.settings - } - } -} diff --git a/examples/demos/stocqt/content/images/icon-calendar-anim.png b/examples/demos/stocqt/content/images/icon-calendar-anim.png deleted file mode 100644 index c5164d5183..0000000000 Binary files a/examples/demos/stocqt/content/images/icon-calendar-anim.png and /dev/null differ diff --git a/examples/demos/stocqt/content/images/icon-calendar.png b/examples/demos/stocqt/content/images/icon-calendar.png deleted file mode 100644 index bd2857470b..0000000000 Binary files a/examples/demos/stocqt/content/images/icon-calendar.png and /dev/null differ diff --git a/examples/demos/stocqt/content/images/icon-items.png b/examples/demos/stocqt/content/images/icon-items.png deleted file mode 100644 index f951aa5009..0000000000 Binary files a/examples/demos/stocqt/content/images/icon-items.png and /dev/null differ diff --git a/examples/demos/stocqt/content/images/icon-settings.png b/examples/demos/stocqt/content/images/icon-settings.png deleted file mode 100644 index 222d998289..0000000000 Binary files a/examples/demos/stocqt/content/images/icon-settings.png and /dev/null differ diff --git a/examples/demos/stocqt/content/images/logo.png b/examples/demos/stocqt/content/images/logo.png deleted file mode 100644 index 90c7c3ba3d..0000000000 Binary files a/examples/demos/stocqt/content/images/logo.png and /dev/null differ diff --git a/examples/demos/stocqt/content/images/stock-selected.png b/examples/demos/stocqt/content/images/stock-selected.png deleted file mode 100644 index 5629796b9c..0000000000 Binary files a/examples/demos/stocqt/content/images/stock-selected.png and /dev/null differ diff --git a/examples/demos/stocqt/content/images/wheel-touch.png b/examples/demos/stocqt/content/images/wheel-touch.png deleted file mode 100644 index 11c8120ada..0000000000 Binary files a/examples/demos/stocqt/content/images/wheel-touch.png and /dev/null differ diff --git a/examples/demos/stocqt/content/images/wheel.png b/examples/demos/stocqt/content/images/wheel.png deleted file mode 100644 index 470a675b35..0000000000 Binary files a/examples/demos/stocqt/content/images/wheel.png and /dev/null differ diff --git a/examples/demos/stocqt/main.cpp b/examples/demos/stocqt/main.cpp deleted file mode 100644 index 779d204a24..0000000000 --- a/examples/demos/stocqt/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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(stocqt) diff --git a/examples/demos/stocqt/stocqt.pro b/examples/demos/stocqt/stocqt.pro deleted file mode 100644 index dfa1924946..0000000000 --- a/examples/demos/stocqt/stocqt.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app - -QT += qml quick -SOURCES += main.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/demos/stocqt -qml.files = stocqt.qml content -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/demos/stocqt -sources.files = $$SOURCES stocqt.pro -sources.path = $$qml.path -INSTALLS += sources target qml diff --git a/examples/demos/stocqt/stocqt.qml b/examples/demos/stocqt/stocqt.qml deleted file mode 100644 index 3f8a84a810..0000000000 --- a/examples/demos/stocqt/stocqt.qml +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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" - -ListView { - id:root - width:320 - height:480 - snapMode:ListView.SnapOneItem - focus:false - orientation : ListView.Horizontal - boundsBehavior : Flickable.StopAtBounds - currentIndex : 1 - - StockModel { - id:stock - stockId:listView.currentStockId - stockName: listView.currentStockName - startDate: settings.startDate - endDate:settings.endDate - onStockIdChanged: updateStock() - onStartDateChanged: updateStock() - onEndDateChanged: updateStock() - onDataReady: { - root.currentIndex = 1 - stockView.update() - } - } - - model: VisualItemModel { - StockListView { - id:listView - width:root.width - height:root.height - } - - StockView { - id:stockView - width:root.width - height:root.height - stocklist : listView - settings : settings - stock: stock - - onListViewClicked:root.currentIndex = 0 - onSettingsClicked:root.currentIndex = 2 - } - - StockSettings { - id:settings - width:root.width - height:root.height - onDrawHighPriceChanged: stockView.update() - onDrawLowPriceChanged: stockView.update() - onDrawOpenPriceChanged: stockView.update() - onDrawClosePriceChanged: stockView.update() - onDrawVolumeChanged: stockView.update() - onDrawKLineChanged: stockView.update() - onChartTypeChanged: stockView.update() - } - } -} diff --git a/examples/demos/stocqt/stocqt.qmlproject b/examples/demos/stocqt/stocqt.qmlproject deleted file mode 100644 index 11ab78418a..0000000000 --- a/examples/demos/stocqt/stocqt.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "stocqt.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/demos/tweetsearch/content/FlipBar.qml b/examples/demos/tweetsearch/content/FlipBar.qml deleted file mode 100644 index 06aebcacb1..0000000000 --- a/examples/demos/tweetsearch/content/FlipBar.qml +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 int animDuration: 300 - property Item front: Item {} - property Item back: Item {} - property real factor: 0.1 // amount the edges fold in for the 3D effect - property alias delta: effect.delta - property Item cur: frontShown ? front : back - property Item noncur: frontShown ? back : front - - function swap() { - var tmp = front; - front = back; - back = tmp; - resync(); - } - - width: cur.width - height: cur.height - onFrontChanged: resync(); - onBackChanged: resync(); - - function resync() {//TODO: Are the items ever actually visible? - back.parent = container; - front.parent = container; - frontShown ? back.visible = false : front.visible = false; - } - - property bool frontShown: true - - onFrontShownChanged: { - back.visible = !frontShown - front.visible = frontShown - } - - function flipUp(start) { - effect.visible = true; - effect.sourceA = effect.source1 - effect.sourceB = effect.source2 - if (start == undefined) - start = 1.0; - deltaAnim.from = start; - deltaAnim.to = 0.0 - dAnim.start(); - frontShown = false; - } - - function flipDown(start) { - effect.visible = true; - effect.sourceA = effect.source1 - effect.sourceB = effect.source2 - if (start == undefined) - start = 0.0; - deltaAnim.from = start; - deltaAnim.to = 1.0 - dAnim.start(); - frontShown = true; - } - - ShaderEffect { - id: effect - width: cur.width - height: cur.height - property real factor: container.factor * width - property real delta: 1.0 - - mesh: GridMesh { resolution: Qt.size(8,2) } - - SequentialAnimation on delta { - id: dAnim - running: false - NumberAnimation { - id: deltaAnim - duration: animDuration//expose anim - } - } - - property variant sourceA: source1 - property variant sourceB: source1 - property variant source1: ShaderEffectSource { - sourceItem: front - hideSource: effect.visible - } - - property variant source2: ShaderEffectSource { - sourceItem: back - hideSource: effect.visible - } - - fragmentShader: " - uniform lowp float qt_Opacity; - uniform sampler2D sourceA; - uniform sampler2D sourceB; - uniform highp float delta; - varying highp vec2 qt_TexCoord0; - void main() { - highp vec4 tex = vec4(qt_TexCoord0.x, qt_TexCoord0.y * 2.0, qt_TexCoord0.x, (qt_TexCoord0.y-0.5) * 2.0); - highp float shade = clamp(delta*2.0, 0.5, 1.0); - highp vec4 col; - if (qt_TexCoord0.y < 0.5) { - col = texture2D(sourceA, tex.xy) * (shade); - } else { - col = texture2D(sourceB, tex.zw) * (1.5 - shade); - col.w = 1.0; - } - gl_FragColor = col * qt_Opacity; - } - " - property real h: height - vertexShader: " - uniform highp float delta; - uniform highp float factor; - uniform highp float h; - uniform highp mat4 qt_Matrix; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - varying highp vec2 qt_TexCoord0; - void main() { - highp vec4 pos = qt_Vertex; - if (qt_MultiTexCoord0.y == 0.0) - pos.x += factor * (1. - delta) * (qt_MultiTexCoord0.x * -2.0 + 1.0); - else if (qt_MultiTexCoord0.y == 1.0) - pos.x += factor * (delta) * (qt_MultiTexCoord0.x * -2.0 + 1.0); - else - pos.y = delta * h; - gl_Position = qt_Matrix * pos; - qt_TexCoord0 = qt_MultiTexCoord0; - }" - - } -} diff --git a/examples/demos/tweetsearch/content/LineInput.qml b/examples/demos/tweetsearch/content/LineInput.qml deleted file mode 100644 index 368293e961..0000000000 --- a/examples/demos/tweetsearch/content/LineInput.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: wrapper - - property alias text: input.text - property alias hint: hint.text - property alias prefix: prefix.text - - signal accepted - - Rectangle { - anchors.fill: parent - border.color: "#707070" - color: "#c1c1c1" - radius: 4 - - Text { - id: hint - anchors { fill: parent; leftMargin: 14 } - verticalAlignment: Text.AlignVCenter - text: "Enter word" - font.pixelSize: 18 - color: "#707070" - opacity: input.length ? 0 : 1 - } - - Text { - id: prefix - anchors { left: parent.left; leftMargin: 14; verticalCenter: parent.verticalCenter } - verticalAlignment: Text.AlignVCenter - font.pixelSize: 18 - color: "#707070" - opacity: !hint.opacity - } - - TextInput { - id: input - focus: true - anchors { left: prefix.right; right: parent.right; top: parent.top; bottom: parent.bottom } - verticalAlignment: Text.AlignVCenter - font.pixelSize: 18 - color: "#707070" - onAccepted: wrapper.accepted() - } - - Image { - source: "resources/icon-search.png" - anchors.right: parent.right - anchors.rightMargin: 12 - anchors.verticalCenter: parent.verticalCenter - MouseArea { - anchors { fill: parent; margins: -10 } - onClicked: wrapper.accepted() - } - } - } -} diff --git a/examples/demos/tweetsearch/content/ListFooter.qml b/examples/demos/tweetsearch/content/ListFooter.qml deleted file mode 100644 index 91c1c8b331..0000000000 --- a/examples/demos/tweetsearch/content/ListFooter.qml +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: "#d6d6d6" - width: parent.width - height: childrenRect.height - z: 2 - Connections { - target: mainListView - onAutoSearch: { - if (type == 'tag') { - tagSearch.open() - tagSearch.searchText = str - } else if (type == 'user'){ - userSearch.open() - userSearch.searchText = str - } else { - wordSearch.open() - wordSearch.searchText = str - } - } - } - - Column { - width: parent.width - - SearchDelegate { - id: wordSearch - label: "Search word..." - placeHolder: "Enter word" - onHasOpened: { - tagSearch.close() - userSearch.close() - } - onOk: { - mainListView.positionViewAtBeginning() - mainListView.clear() - tweetsModel.from = "" - tweetsModel.phrase = searchText - } - } - - SearchDelegate { - id: userSearch - label: "From user..." - placeHolder: "@username" - prefix: "@" - onHasOpened:{ - tagSearch.close() - wordSearch.close() - } - onOk: { - mainListView.positionViewAtBeginning() - mainListView.clear() - tweetsModel.phrase = "" - tweetsModel.from = searchText - } - } - - SearchDelegate { - id: tagSearch - label: "Search hashtag..." - placeHolder: "#hashtag" - prefix: "#" - onHasOpened:{ - userSearch.close() - wordSearch.close() - } - onOk: { - mainListView.positionViewAtBeginning() - mainListView.clear() - tweetsModel.from = "" - tweetsModel.phrase = "#" + searchText - } - } - - SpriteSequence { - id: sprite - anchors.horizontalCenter: parent.horizontalCenter - width: 320 - height: 300 - running: true - interpolate: false - Sprite { - name: "bird" - source: "resources/bird-anim-sprites.png" - frameCount: 1 - frameRate: 1 - frameWidth: 320 - frameHeight: 300 - to: { "bird":10, "trill":1, "blink":1 } - } - Sprite { - name: "trill" - source: "resources/bird-anim-sprites.png" - frameCount: 5 - frameRate: 3 - frameWidth: 320 - frameHeight: 300 - to: {"bird":1} - } - Sprite { - name: "blink" - source: "resources/bird-anim-sprites.png" - frameCount: 1 - frameRate: 3 - frameWidth: 320 - frameHeight: 300 - frameX: 1600 - to: {"bird":1} - } - } - } -} diff --git a/examples/demos/tweetsearch/content/ListHeader.qml b/examples/demos/tweetsearch/content/ListHeader.qml deleted file mode 100644 index 2fb673dc7c..0000000000 --- a/examples/demos/tweetsearch/content/ListHeader.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 { - height: 60 - width: parent.width - - property bool refresh: state == "pulled" ? true : false - - Row { - spacing: 6 - height: childrenRect.height - anchors.centerIn: parent - - Image { - id: arrow - source: "resources/icon-refresh.png" - transformOrigin: Item.Center - Behavior on rotation { NumberAnimation { duration: 200 } } - } - - Text { - id: label - anchors.verticalCenter: arrow.verticalCenter - text: "Pull to refresh... " - font.pixelSize: 18 - color: "#999999" - } - } - - states: [ - State { - name: "base"; when: mainListView.contentY >= -120 - PropertyChanges { target: arrow; rotation: 180 } - }, - State { - name: "pulled"; when: mainListView.contentY < -120 - PropertyChanges { target: label; text: "Release to refresh..." } - PropertyChanges { target: arrow; rotation: 0 } - } - ] -} diff --git a/examples/demos/tweetsearch/content/SearchDelegate.qml b/examples/demos/tweetsearch/content/SearchDelegate.qml deleted file mode 100644 index fc0ee0b655..0000000000 --- a/examples/demos/tweetsearch/content/SearchDelegate.qml +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -FlipBar { - id: flipBar - animDuration: 250 - property string label: "" - property string placeHolder: "" - property alias searchText: lineInput.text - property alias prefix: lineInput.prefix - property bool opened: false - signal ok - signal hasOpened - - height: 60 - width: parent.width - - function open() { - flipBar.flipUp() - flipBar.opened = true - lineInput.forceActiveFocus() - flipBar.hasOpened() - } - - function close() { - if (opened) { - flipBar.flipDown() - flipBar.opened = false - } - } - - front: Rectangle { - height: 60 - width: parent.width - color: "#999999" - - Rectangle { color: "#c1c1c1"; width: parent.width; height: 1 } - Rectangle { color: "#707070"; width: parent.width; height: 1; anchors.bottom: parent.bottom } - - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: { - if (!flipBar.opened) - open() - else if (!lineInput.activeFocus) - lineInput.forceActiveFocus() - else - close() - } - } - - Text { - text: flipBar.label - anchors { left: parent.left; leftMargin: 20 } - anchors.verticalCenter: parent.verticalCenter - font.pixelSize: 18 - color: "#ffffff" - } - } - - back: FocusScope { - height: 60 - width: parent.width - Rectangle { - anchors.fill: parent - color: "#999999" - - Rectangle { color: "#c1c1c1"; width: parent.width; height: 1 } - Rectangle { color: "#707070"; width: parent.width; height: 1; anchors.bottom: parent.bottom } - - LineInput { - id: lineInput - hint: flipBar.placeHolder - focus: flipBar.opened - anchors { fill: parent; margins: 6 } - onAccepted: flipBar.ok() - } - } - } - -} diff --git a/examples/demos/tweetsearch/content/TweetDelegate.qml b/examples/demos/tweetsearch/content/TweetDelegate.qml deleted file mode 100644 index c336ae6f8a..0000000000 --- a/examples/demos/tweetsearch/content/TweetDelegate.qml +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "tweetsearch.js" as Helper - -Item { - id: container - property real hm: 1.0 - property int appear: -1 - property real startRotation: 1 - - onAppearChanged: { - container.startRotation = 0.5 - flipBar.animDuration = appear; - delayedAnim.start(); - } - - SequentialAnimation { - id: delayedAnim - PauseAnimation { duration: 50 } - ScriptAction { script: flipBar.flipDown(startRotation); } - } - - width: 320 - height: flipBar.height * hm - - FlipBar { - id: flipBar - - property bool flipped: false - delta: startRotation - - anchors.bottom: parent.bottom - width: container.ListView.view ? container.ListView.view.width : 0 - height: Math.max(72, tweet.y + tweet.height + 10) - - front: Rectangle { - width: container.ListView.view ? container.ListView.view.width : 0 - height: Math.max(72, tweet.y + tweet.height + 10) - color: "#2699bf" - - Rectangle { color: "#33ccff"; width: parent.width; height: 1 } - Rectangle { color: "#1a6680"; width: parent.width; height: 1; anchors.bottom: parent.bottom } - - Image { - id: placeHolder - source: "resources/anonymous.png" - x: 10; y: 9 - visible: avatar.status != Image.Ready - } - - Image { - id: avatar - source: model.userImage - anchors.fill: placeHolder - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: { - flipBar.flipUp() - flipBar.flipped = true - } - } - } - - Text { - id: name - text: Helper.realName(model.name) - anchors { left: avatar.right; leftMargin: 10; top: avatar.top; topMargin: -3 } - font.pixelSize: 12 - font.bold: true - color: "white" - linkColor: "white" - } - - Text { - id: tweet - text: model.statusText - anchors { left: avatar.right; leftMargin: 10; top: name.bottom; topMargin: 0; right: parent.right; rightMargin: 10 } - wrapMode: Text.WordWrap - font.pixelSize: 12 - font.bold: false - color: "#adebff" - linkColor: "white" - onLinkActivated: { - var tag = link.split("http://search.twitter.com/search?q=%23") - var user = link.split("https://twitter.com/") - if (tag[1] != undefined) { - mainListView.positionViewAtBeginning() - mainListView.clear() - mainListView.autoSearch('tag', tag[1]) - tweetsModel.from = "" - tweetsModel.phrase = "#" + tag[1] - } else if (user[1] != undefined) { - mainListView.positionViewAtBeginning() - mainListView.clear() - mainListView.autoSearch('user', user[1]) - tweetsModel.phrase = "" - tweetsModel.from = user[1] - } else - Qt.openUrlExternally(link) - } - } - } - - back: Rectangle { - width: container.ListView.view ? container.ListView.view.width : 0 - height: Math.max(72, tweet.y + tweet.height + 10) - color: "#be4a25" - - Rectangle { color: "#ff6633"; width: parent.width; height: 1 } - Rectangle { color: "#80341a"; width: parent.width; height: 1; anchors.bottom: parent.bottom } - - Image { - id: avatar2 - source: model.userImage - anchors.right: parent.right - anchors.rightMargin: 10 - y: 9 - MouseArea { - anchors.fill: parent - onClicked: { - flipBar.flipDown() - flipBar.flipped = false - } - } - } - - Text { - id: username - text: Helper.twitterName(model.name) - x: 10; anchors { top: avatar2.top; topMargin: -3 } - font.pixelSize: 12 - font.bold: true - color: "white" - linkColor: "white" - } - - Text { - text: model.source + "
" + Helper.formatDate(model.published) + "
" + model.uri - x: 10; anchors { top: username.bottom; topMargin: 0 } - wrapMode: Text.WordWrap - font.pixelSize: 12 - font.bold: false - color: "#ffc2ad" - linkColor: "white" - onLinkActivated: Qt.openUrlExternally(link); - } - } - } -} diff --git a/examples/demos/tweetsearch/content/TweetsModel.qml b/examples/demos/tweetsearch/content/TweetsModel.qml deleted file mode 100644 index df6ecdcd7f..0000000000 --- a/examples/demos/tweetsearch/content/TweetsModel.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -Item { - id: wrapper - - property variant model: xmlModel - property string from : "" - property string phrase : "" - - property string mode : "everyone" - property int status: xmlModel.status - - function reload() { xmlModel.reload(); } - - property bool isLoading: status == XmlListModel.Loading - property bool wasLoading: false - signal isLoaded - - XmlListModel { - id: xmlModel - - onStatusChanged: { - if (status == XmlListModel.Ready && wasLoading == true) - wrapper.isLoaded() - if (status == XmlListModel.Loading) - wasLoading = true; - else - wasLoading = false; - } - - function encodePhrase(x) { return encodeURIComponent(x); } - - source: (from == "" && phrase == "") ? "" : - 'http://search.twitter.com/search.atom?from='+from+"&rpp=10&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: "id"; query: "id/string()" } - XmlRole { name: "content"; query: "content/string()" } - XmlRole { name: "published"; query: "published/string()" } - XmlRole { name: "source"; query: "twitter:source/string()" } - XmlRole { name: "name"; query: "author/name/string()" } - XmlRole { name: "uri"; query: "author/uri/string()" } - XmlRole { name: "image"; query: "link[@rel = 'image']/@href/string()" } - - } -} diff --git a/examples/demos/tweetsearch/content/resources/anonymous.png b/examples/demos/tweetsearch/content/resources/anonymous.png deleted file mode 100644 index 88fba26e90..0000000000 Binary files a/examples/demos/tweetsearch/content/resources/anonymous.png and /dev/null differ diff --git a/examples/demos/tweetsearch/content/resources/bird-anim-sprites.png b/examples/demos/tweetsearch/content/resources/bird-anim-sprites.png deleted file mode 100644 index 4e8d7e6116..0000000000 Binary files a/examples/demos/tweetsearch/content/resources/bird-anim-sprites.png and /dev/null differ diff --git a/examples/demos/tweetsearch/content/resources/icon-clear.png b/examples/demos/tweetsearch/content/resources/icon-clear.png deleted file mode 100644 index 75672f64c7..0000000000 Binary files a/examples/demos/tweetsearch/content/resources/icon-clear.png and /dev/null differ diff --git a/examples/demos/tweetsearch/content/resources/icon-loading.png b/examples/demos/tweetsearch/content/resources/icon-loading.png deleted file mode 100644 index 8dbff8b70f..0000000000 Binary files a/examples/demos/tweetsearch/content/resources/icon-loading.png and /dev/null differ diff --git a/examples/demos/tweetsearch/content/resources/icon-refresh.png b/examples/demos/tweetsearch/content/resources/icon-refresh.png deleted file mode 100644 index b639a638fe..0000000000 Binary files a/examples/demos/tweetsearch/content/resources/icon-refresh.png and /dev/null differ diff --git a/examples/demos/tweetsearch/content/resources/icon-search.png b/examples/demos/tweetsearch/content/resources/icon-search.png deleted file mode 100644 index e41935a6c1..0000000000 Binary files a/examples/demos/tweetsearch/content/resources/icon-search.png and /dev/null differ diff --git a/examples/demos/tweetsearch/content/tweetsearch.js b/examples/demos/tweetsearch/content/tweetsearch.js deleted file mode 100644 index 9b8638f69e..0000000000 --- a/examples/demos/tweetsearch/content/tweetsearch.js +++ /dev/null @@ -1,19 +0,0 @@ -.pragma library - -function twitterName(str) -{ - var s = str.split("(") - return s[0] -} - -function realName(str) -{ - var s = str.split("(") - return s[1].substring(0, s[1].length-1) -} - -function formatDate(date) -{ - var da = new Date(date) - return da.toDateString() -} diff --git a/examples/demos/tweetsearch/main.cpp b/examples/demos/tweetsearch/main.cpp deleted file mode 100644 index 8b1d59679c..0000000000 --- a/examples/demos/tweetsearch/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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(tweetsearch) diff --git a/examples/demos/tweetsearch/tweetsearch.pro b/examples/demos/tweetsearch/tweetsearch.pro deleted file mode 100644 index 36f4377de1..0000000000 --- a/examples/demos/tweetsearch/tweetsearch.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app - -QT += quick qml -SOURCES += main.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/demos/tweetsearch -qml.files = tweetsearch.qml content -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/demos/tweetsearch -sources.files = $$SOURCES tweetsearch.pro -sources.path = $$qml.path -INSTALLS += sources target qml diff --git a/examples/demos/tweetsearch/tweetsearch.qml b/examples/demos/tweetsearch/tweetsearch.qml deleted file mode 100644 index 961ffce36b..0000000000 --- a/examples/demos/tweetsearch/tweetsearch.qml +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: 320 - height: 480 - color: "#d6d6d6" - - property string searchTerms: "" - property int inAnimDur: 250 - property int counter: 0 - property alias isLoading: tweetsModel.isLoading - property var idx - property var ids - - Component.onCompleted: ids = new Array() - - function idInModel(id) - { - for (var j = 0; j < ids.length; j++) - if (ids[j] === id) - return 1 - return 0 - } - - TweetsModel { - id: tweetsModel - onIsLoaded: { - console.debug("Reload") - idx = new Array() - for (var i = 0; i < tweetsModel.model.count; i++) { - var id = tweetsModel.model.get(i).id - if (!idInModel(id)) - idx.push(i) - } - console.debug(idx.length + " new tweets") - main.counter = idx.length - } - } - - Timer { - id: timer - interval: 500; running: main.counter; repeat: true - onTriggered: { - main.counter--; - var id = tweetsModel.model.get(idx[main.counter]).id - mainListView.add( { "statusText": tweetsModel.model.get(main.counter).content, - "name": tweetsModel.model.get(main.counter).name, - "userImage": tweetsModel.model.get(main.counter).image, - "source": tweetsModel.model.get(main.counter).source, - "id": id, - "uri": tweetsModel.model.get(main.counter).uri, - "published": tweetsModel.model.get(main.counter).published } ); - ids.push(id) - } - } - - ListView { - id: mainListView - anchors.fill: parent - delegate: TweetDelegate { } - model: ListModel { id: finalModel } - - add: Transition { - NumberAnimation { property: "hm"; from: 0; to: 1.0; duration: 300; easing.type: Easing.OutQuad } - PropertyAction { property: "appear"; value: 250 } - } - - onDragEnded: if (header.refresh) { tweetsModel.model.reload() } - - ListHeader { - id: header - y: -mainListView.contentY - height - } - - footer: ListFooter { } - - function clear() { - ids = new Array() - model.clear() - } - - function add(obj) { - model.insert(0, obj) - } - - signal autoSearch(string type, string str) // To communicate with Footer instance - } -} diff --git a/examples/demos/tweetsearch/tweetsearch.qmlproject b/examples/demos/tweetsearch/tweetsearch.qmlproject deleted file mode 100644 index 5a0f31117b..0000000000 --- a/examples/demos/tweetsearch/tweetsearch.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "tweetsearch.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 f2b7a2dddf..1bcc66d164 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,16 +1,5 @@ TEMPLATE = subdirs SUBDIRS += \ - demos \ - shared \ - localstorage \ - particles \ + qmltest \ qml \ - quick \ - tutorials \ - window \ - qmltest - -# install -sources.files = shared examples.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/ -INSTALLS += sources + quick diff --git a/examples/localstorage/doc/src/localstorage.qdoc b/examples/localstorage/doc/src/localstorage.qdoc deleted file mode 100644 index 45456abbab..0000000000 --- a/examples/localstorage/doc/src/localstorage.qdoc +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** 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. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ -/*! - \title QtQuick Examples - Local Storage - \example localstorage - \brief This is a collection of QML local storage examples - \image qml-localstorage-example.png - - This is a collection of small QML examples relating to local storage functionality. - - Hello World demos creating a simple SQL table and how to do inserting/selecting operations. - -*/ - diff --git a/examples/localstorage/localstorage.pro b/examples/localstorage/localstorage.pro deleted file mode 100644 index d9058700ff..0000000000 --- a/examples/localstorage/localstorage.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += localstorage - -# install -sources.files = localstorage.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/localstorage -INSTALLS += sources diff --git a/examples/localstorage/localstorage/hello.qml b/examples/localstorage/localstorage/hello.qml deleted file mode 100644 index 5a25052675..0000000000 --- a/examples/localstorage/localstorage/hello.qml +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -Rectangle { - width: 200 - height: 100 - - Text { - text: "?" - anchors.horizontalCenter: parent.horizontalCenter - - function findGreetings() { - var db = LocalStorage.openDatabaseSync("QQmlExampleDB", "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/localstorage.pro b/examples/localstorage/localstorage/localstorage.pro deleted file mode 100644 index 504f9f77c1..0000000000 --- a/examples/localstorage/localstorage/localstorage.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app - -QT += quick qml -SOURCES += main.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/localstorage/localstorage -qml.files = localstorage.qml hello.qml -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/localstorage/localstorage -sources.files = $$SOURCES localstorage.pro -sources.path = $$qml.path -INSTALLS += sources target qml diff --git a/examples/localstorage/localstorage/localstorage.qml b/examples/localstorage/localstorage/localstorage.qml deleted file mode 100644 index c5b045460d..0000000000 --- a/examples/localstorage/localstorage/localstorage.qml +++ /dev/null @@ -1,54 +0,0 @@ - /**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -Item { - height: 480 - width: 320 - Examples.LauncherList { - id: ll - anchors.fill: parent - Component.onCompleted: { - addExample("Hello World", "Simple SQL operations with local storage API", Qt.resolvedUrl("hello.qml")); - } - } -} diff --git a/examples/localstorage/localstorage/localstorage.qmlproject b/examples/localstorage/localstorage/localstorage.qmlproject deleted file mode 100644 index 6835d23503..0000000000 --- a/examples/localstorage/localstorage/localstorage.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - mainFile: "localstorage.qml" - /* Include .qml, .js, and image files from current directory and subdirectories */ - - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} \ No newline at end of file diff --git a/examples/localstorage/localstorage/main.cpp b/examples/localstorage/localstorage/main.cpp deleted file mode 100644 index 0f69fb7fdb..0000000000 --- a/examples/localstorage/localstorage/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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(localstorage) diff --git a/examples/particles/affectors/affectors.pro b/examples/particles/affectors/affectors.pro deleted file mode 100644 index 231be91f01..0000000000 --- a/examples/particles/affectors/affectors.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app - -QT += quick qml -SOURCES += main.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/particles/affectors -qml.files = affectors.qml content -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/particles/affectors -sources.files = $$SOURCES affectors.pro -sources.path = $$qml.path -INSTALLS += sources target qml diff --git a/examples/particles/affectors/affectors.qml b/examples/particles/affectors/affectors.qml deleted file mode 100644 index f8e132c2c0..0000000000 --- a/examples/particles/affectors/affectors.qml +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -Item { - height: 480 - width: 320 - Examples.LauncherList { - id: ll - anchors.fill: parent - Component.onCompleted: { - addExample("Age", "Kills off particles that enter the affector", Qt.resolvedUrl("content/age.qml")); - addExample("Attractor", "Simulates a small black hole", Qt.resolvedUrl("content/attractor.qml")); - addExample("Custom Affector", "Custom falling leaves", Qt.resolvedUrl("content/customaffector.qml")); - addExample("Friction", "Leaves that slow down as they fall", Qt.resolvedUrl("content/friction.qml")); - addExample("Gravity", "Leaves that fall towards the earth as you move it", Qt.resolvedUrl("content/gravity.qml")); - addExample("GroupGoal", "Balls that can be set on fire various ways", Qt.resolvedUrl("content/groupgoal.qml")); - addExample("Move", "Some effects you can get by altering trajectory midway", Qt.resolvedUrl("content/move.qml")); - addExample("SpriteGoal", "A ship that makes asteroids explode", Qt.resolvedUrl("content/spritegoal.qml")); - addExample("Turbulence", "A candle with faint wind", Qt.resolvedUrl("content/turbulence.qml")); - addExample("Wander", "Drifting snow flakes", Qt.resolvedUrl("content/wander.qml")); - } - } -} diff --git a/examples/particles/affectors/affectors.qmlproject b/examples/particles/affectors/affectors.qmlproject deleted file mode 100644 index 2bf3387155..0000000000 --- a/examples/particles/affectors/affectors.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "affectors.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/particles/affectors/content/GreyButton.qml b/examples/particles/affectors/content/GreyButton.qml deleted file mode 100644 index e3d3daa470..0000000000 --- a/examples/particles/affectors/content/GreyButton.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: "" - signal clicked - - width: buttonLabel.width + 20; height: col.height + 12 - - MouseArea { - id: mouseArea; - anchors.fill: parent; - onClicked: container.clicked(); - onPressed: background.color = Qt.darker("lightgrey"); - onReleased: background.color="lightgrey"; - } - - Rectangle { - id: background - anchors.fill: parent - color: "lightgrey" - radius: 4 - border.width: 1 - border.color: Qt.darker(color) - } - - Column { - spacing: 2 - id: col - x: 10 - y: 6 - 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/particles/affectors/content/age.qml b/examples/particles/affectors/content/age.qml deleted file mode 100644 index 9b8d28dc7e..0000000000 --- a/examples/particles/affectors/content/age.qml +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - velocity: 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 - //! [0] - Age { - anchors.fill: parent - system: particles - once: true - lifeLeft: 1200 - advancePosition: false - } - //! [0] - } -} diff --git a/examples/particles/affectors/content/attractor.qml b/examples/particles/affectors/content/attractor.qml deleted file mode 100644 index 5617f6eb86..0000000000 --- a/examples/particles/affectors/content/attractor.qml +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 { - source: "../../images/finalfrontier.png" - anchors.centerIn:parent - } - ParticleSystem { - id: particles - anchors.fill: parent - - Emitter { - group: "stars" - emitRate: 40 - lifeSpan: 4000 - enabled: true - size: 30 - sizeVariation: 10 - velocity: PointDirection { x: 220; xVariation: 40 } - height: parent.height - } - Emitter { - group: "roids" - emitRate: 10 - lifeSpan: 4000 - enabled: true - size: 30 - sizeVariation: 10 - velocity: PointDirection { x: 220; xVariation: 40 } - height: parent.height - } - ImageParticle { - id: stars - groups: ["stars"] - source: "../../images/star.png" - color: "white" - colorVariation: 0.1 - alpha: 0 - } - ImageParticle { - id: roids - groups: ["roids"] - sprites: Sprite { - id: spinState - name: "spinning" - source: "../../images/meteor.png" - frameCount: 35 - frameDuration: 60 - } - } - ImageParticle { - id: shot - groups: ["shot"] - source: "../../images/star.png" - - color: "#0FF06600" - colorVariation: 0.3 - } - ImageParticle { - id: engine - groups: ["engine"] - 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 - } - //! [0] - Attractor { - id: gs; pointX: root.width/2; pointY: root.height/2; strength: 4000000; - affectedParameter: Attractor.Acceleration - proportionalToDistance: Attractor.InverseQuadratic - } - //! [0] - Age { - 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 - //Automatic movement - SequentialAnimation on x { - loops: -1 - NumberAnimation{to: root.width-45; easing.type: Easing.InOutQuad; duration: 2000} - NumberAnimation{to: 0; easing.type: Easing.OutInQuad; duration: 6000} - } - SequentialAnimation on y { - loops: -1 - NumberAnimation{to: root.height-22; easing.type: Easing.OutInQuad; duration: 6000} - NumberAnimation{to: 0; easing.type: Easing.InOutQuad; duration: 2000} - } - } - Emitter { - group: "engine" - emitRate: 200 - lifeSpan: 1000 - size: 10 - endSize: 4 - sizeVariation: 4 - velocity: PointDirection { x: -128; xVariation: 32 } - height: ship.height - y: ship.y - x: ship.x - width: 20 - } - Emitter { - group: "shot" - emitRate: 32 - lifeSpan: 1000 - enabled: true - size: 40 - velocity: PointDirection { x: 256; } - x: ship.x + ship.width - y: ship.y + ship.height/2 - } - } -} - diff --git a/examples/particles/affectors/content/customaffector.qml b/examples/particles/affectors/content/customaffector.qml deleted file mode 100644 index 157bf6afc1..0000000000 --- a/examples/particles/affectors/content/customaffector.qml +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 { - anchors.fill: parent - Emitter { - width: parent.width - emitRate: 4 - lifeSpan: 14000 - size: 80 - velocity: PointDirection { y: 60 } - } - Wander { - anchors.fill: parent - anchors.bottomMargin: 100 - xVariance: 60 - pace: 60 - } - - //! [0] - Affector { - property real coefficient: 0.1 - property real velocity: 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 += velocity * dt; - if (particle.rotation >= maxAngle) - particle.r = -1; - } else if (particle.r == -1) { - particle.rotation -= velocity * dt; - if (particle.rotation <= -1 * maxAngle) - particle.r = 1; - } - */ - //Wobbly movement - for (var i=0; i 1.) - currentSize = 0.; - - highp vec2 pos = qt_ParticlePos - - currentSize / 2. + currentSize * qt_ParticleTex // adjust size - + qt_ParticleVec.xy * t * qt_ParticleData.y // apply velocity 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/320., pos.y/480.); - } - " - //! [0] - 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; - }" - //! [0] - - } -} diff --git a/examples/particles/customparticle/content/imagecolors.qml b/examples/particles/customparticle/content/imagecolors.qml deleted file mode 100644 index 857375a05c..0000000000 --- a/examples/particles/customparticle/content/imagecolors.qml +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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" - } - //! [vertex] - 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, qt_ParticlePos.y); - //Uncomment this next line for each particle to use full texture, instead of the solid color at the center of the particle. - //fTex2 = fTex2 + ((- qt_ParticleData.z / 2. + qt_ParticleData.z) * qt_ParticleTex); //Adjusts size so it's like a chunk of image. - fTex2 = fTex2 / vec2(maxWidth, maxHeight); - highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y; - fFade = min(t*4., (1.-t*t)*.75) * qt_Opacity; - defaultMain(); - } - " - //! [vertex] - property variant particleTexture: particleSource - property variant pictureTexture: pictureSource - //! [fragment] - 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; - }" - //! [fragment] - } - - 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/customparticle/customparticle.pro b/examples/particles/customparticle/customparticle.pro deleted file mode 100644 index 80043799b0..0000000000 --- a/examples/particles/customparticle/customparticle.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app - -QT += quick qml -SOURCES += main.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/particles/customparticle -qml.files = customparticle.qml content -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/particles/customparticle -sources.files = $$SOURCES customparticle.pro -sources.path = $$qml.path -INSTALLS += sources target qml diff --git a/examples/particles/customparticle/customparticle.qml b/examples/particles/customparticle/customparticle.qml deleted file mode 100644 index ee93648132..0000000000 --- a/examples/particles/customparticle/customparticle.qml +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -Item { - height: 480 - width: 320 - Examples.LauncherList { - id: ll - anchors.fill: parent - Component.onCompleted: { - addExample("Blur Particles", "Particles that get blurred over time", Qt.resolvedUrl("content/blurparticles.qml")); - addExample("Fragment Shader", "Particles drawn with a custom fragment shader", Qt.resolvedUrl("content/fragmentshader.qml")); - addExample("Image Colors", "An image explodes into colored particles", Qt.resolvedUrl("content/imagecolors.qml")); - } - } -} diff --git a/examples/particles/customparticle/customparticle.qmlproject b/examples/particles/customparticle/customparticle.qmlproject deleted file mode 100644 index 6ea1849e31..0000000000 --- a/examples/particles/customparticle/customparticle.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "customparticle.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/particles/customparticle/doc/images/qml-customparticle-example.png b/examples/particles/customparticle/doc/images/qml-customparticle-example.png deleted file mode 100644 index e23c6c8efc..0000000000 Binary files a/examples/particles/customparticle/doc/images/qml-customparticle-example.png and /dev/null differ diff --git a/examples/particles/customparticle/doc/src/customparticle.qdoc b/examples/particles/customparticle/doc/src/customparticle.qdoc deleted file mode 100644 index 39c3d7c101..0000000000 --- a/examples/particles/customparticle/doc/src/customparticle.qdoc +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** 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. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title QtQuick.Particles Examples - CustomParticle - \example particles/customparticle - \brief This is a collection of examples using CustomParticle in the QML particle system. - \image qml-customparticle-example.png - - This is a collection of small QML examples relating to using CustomParticle in the particle system. - Each example is a small QML file emphasizing a different way to use CustomParticle. - - Blur Particles adds a blur effect to the particles, which increases over the particle's life time. - It uses a custom vertex shader: - \snippet particles/customparticle/content/blurparticles.qml vertex - to propagate life time simulation to a custom fragement shader: - \snippet particles/customparticle/content/blurparticles.qml fragment - which has access to both the normal image sampler and a blurred sampler, the image plus a ShaderEffect. - - Fragment Shader just uses the particle system as a vertex delivery system. - \snippet particles/customparticle/content/fragmentshader.qml 0 - - Image Colors uses CustomParticle to assign colors to particles based on their location in a picture. - The vertex shader, - \snippet particles/customparticle/content/imagecolors.qml vertex - passes along the starting position for each vertex to the fragment shader, - \snippet particles/customparticle/content/imagecolors.qml fragment - which uses it to determine the color for that particle. - -*/ diff --git a/examples/particles/customparticle/main.cpp b/examples/particles/customparticle/main.cpp deleted file mode 100644 index ec5619c6f0..0000000000 --- a/examples/particles/customparticle/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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(customparticle) diff --git a/examples/particles/emitters/content/burstandpulse.qml b/examples/particles/emitters/content/burstandpulse.qml deleted file mode 100644 index ae526aa5a3..0000000000 --- a/examples/particles/emitters/content/burstandpulse.qml +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: 320 - height: 480 - color: "black" - property bool lastWasPulse: false - Timer { - interval: 3500 - triggeredOnStart: true - running: true - repeat: true - onTriggered: { - //! [0] - if (lastWasPulse) { - burstEmitter.burst(500); - lastWasPulse = false; - } else { - pulseEmitter.pulse(500); - lastWasPulse = true; - } - //! [0] - } - } - ParticleSystem { - id: particles - anchors.fill: parent - ImageParticle { - source: "../../images/star.png" - alpha: 0 - colorVariation: 0.6 - } - - Emitter { - id: burstEmitter - x: parent.width/2 - y: parent.height/3 - emitRate: 1000 - lifeSpan: 2000 - enabled: false - velocity: AngleDirection{magnitude: 64; angleVariation: 360} - size: 24 - sizeVariation: 8 - Text { - anchors.centerIn: parent - color: "white" - font.pixelSize: 18 - text: "Burst" - } - } - Emitter { - id: pulseEmitter - x: parent.width/2 - y: 2*parent.height/3 - emitRate: 1000 - lifeSpan: 2000 - enabled: false - velocity: AngleDirection{magnitude: 64; angleVariation: 360} - size: 24 - sizeVariation: 8 - Text { - anchors.centerIn: parent - color: "white" - font.pixelSize: 18 - text: "Pulse" - } - } - } -} diff --git a/examples/particles/emitters/content/customemitter.qml b/examples/particles/emitters/content/customemitter.qml deleted file mode 100644 index 40b04a56d5..0000000000 --- a/examples/particles/emitters/content/customemitter.qml +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - //! [0] - onEmitParticles: { - for (var i=0; i 400 ? 32 : 16 - } -} diff --git a/examples/particles/imageparticle/content/colored.qml b/examples/particles/imageparticle/content/colored.qml deleted file mode 100644 index 9d72ca7412..0000000000 --- a/examples/particles/imageparticle/content/colored.qml +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - } - - // ![0] - ImageParticle { - anchors.fill: parent - source: "../../images/star.png" - alpha: 0 - alphaVariation: 0.2 - colorVariation: 1.0 - } - // ![0] - - Emitter { - anchors.centerIn: parent - emitRate: 400 - lifeSpan: 2400 - size: 48 - sizeVariation: 8 - velocity: AngleDirection {angleVariation: 180; magnitude: 60} - } - - Turbulence { - anchors.fill: parent - strength: 2 - } - } -} diff --git a/examples/particles/imageparticle/content/colortable.qml b/examples/particles/imageparticle/content/colortable.qml deleted file mode 100644 index 32fc30aa8d..0000000000 --- a/examples/particles/imageparticle/content/colortable.qml +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - - //! [0] - source: "../../images/particle.png" - colorTable: "../../images/colortable.png" - sizeTable: "../../images/colortable.png" - //! [0] - } - - 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 - } - - velocityFromMovement: 20 - - velocity: PointDirection { xVariation: 5; yVariation: 5;} - acceleration: PointDirection { xVariation: 5; yVariation: 5;} - - size: 16 - //endSize: 8 - //sizeVariation: 8 - } -} diff --git a/examples/particles/imageparticle/content/deformation.qml b/examples/particles/imageparticle/content/deformation.qml deleted file mode 100644 index a7a3415165..0000000000 --- a/examples/particles/imageparticle/content/deformation.qml +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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} - - //! [spin] - ImageParticle { - system: sys - groups: ["goingLeft", "goingRight"] - source: "../../images/starfish_4.png" - rotation: 90 - rotationVelocity: 90 - autoRotation: true - } - //! [spin] - //! [deform] - ImageParticle { - system: sys - groups: ["goingDown"] - source: "../../images/starfish_0.png" - rotation: 180 - yVector: PointDirection { y: 0.5; yVariation: 0.25; xVariation: 0.25; } - } - //! [deform] - - 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" - velocity: PointDirection { x: 100 } - lifeSpan: 4000 - emitRate: 1 - size: 128 - } - Emitter { - id: emitB - x: 400 - y: 240 - system: sys - enabled: false - group: "goingLeft" - velocity: PointDirection { x: -100 } - lifeSpan: 4000 - emitRate: 1 - size: 128 - } - Emitter { - id: emitC - x: 0 - y: 360 - system: sys - enabled: false - group: "goingDown" - velocity: PointDirection { x: 100 } - lifeSpan: 4000 - emitRate: 1 - size: 128 - } -} diff --git a/examples/particles/imageparticle/content/rotation.qml b/examples/particles/imageparticle/content/rotation.qml deleted file mode 100644 index 2b1d828c7d..0000000000 --- a/examples/particles/imageparticle/content/rotation.qml +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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" - autoRotation: true //leaving these two settings at default allows you to test going up performance levels - rotation: -90 - } - - Emitter { - anchors.centerIn: parent - system: sys - emitRate: 10 - size: 200 - lifeSpan: 10000 - velocity: 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/content/sharing.qml b/examples/particles/imageparticle/content/sharing.qml deleted file mode 100644 index 433ffe9524..0000000000 --- a/examples/particles/imageparticle/content/sharing.qml +++ /dev/null @@ -1,205 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 } - } - MouseArea { anchors.fill: parent; onClicked: listView.currentIndex = index; } - // 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 customized 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 } } - //! [1] - ImageParticle { - anchors.fill: parent - system: particles - source: "../../images/flower.png" - color: "red" - clip: true - alpha: 1.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 - - ParticleSystem { id: particles } - Emitter { - system: particles - anchors.fill: parent - emitRate: 0 - lifeSpan: 10000 - size: 24 - sizeVariation: 8 - velocity: AngleDirection { angleVariation: 360; magnitude: 3 } - maximumEmitted: 10 - startTime: 5000 - Timer { running: true; interval: 10; onTriggered: parent.emitRate = 1; } - } - - //! [0] - ImageParticle { - anchors.fill: parent - system: particles - source: "../../images/flower.png" - alpha: 0.1 - color: "white" - rotationVariation: 180 - z: -1 - } - //! [0] - } - - 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/content/sprites.qml b/examples/particles/imageparticle/content/sprites.qml deleted file mode 100644 index 0f74ab60f2..0000000000 --- a/examples/particles/imageparticle/content/sprites.qml +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - velocity: 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/imageparticle/doc/images/qml-imageparticle-example.png b/examples/particles/imageparticle/doc/images/qml-imageparticle-example.png deleted file mode 100644 index 9e44abe4fb..0000000000 Binary files a/examples/particles/imageparticle/doc/images/qml-imageparticle-example.png and /dev/null differ diff --git a/examples/particles/imageparticle/doc/src/imageparticle.qdoc b/examples/particles/imageparticle/doc/src/imageparticle.qdoc deleted file mode 100644 index 62c1a06839..0000000000 --- a/examples/particles/imageparticle/doc/src/imageparticle.qdoc +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** 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. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title QtQuick.Particles Examples - Affectors - \example particles/imageparticle - \brief This is a collection of examples using Affectors in the QML particle system. - \image qml-imageparticle-example.png - - This is a collection of small QML examples relating to using Affectors in the particle system. - Each example is a small QML file emphasizing a particular element or feature. - - All at once shows off several of the features of ImageParticle at the same time. - \snippet particles/imageparticle/content/allatonce.qml 0 - - Colored shows a simple ImageParticle with some color variation. - \snippet particles/imageparticle/content/colored.qml 0 - - Color Table sets the color over life on the particles to provide a fixed rainbow effect. - \snippet particles/imageparticle/content/colortable.qml 0 - - Deformation spins and squishes a starfish particle. - \snippet particles/imageparticle/content/deformation.qml spin - \snippet particles/imageparticle/content/deformation.qml deform - - Rotation demonstrates the autoRotate property, so that particles rotate in the direction that they travel. - - Sharing demonstrates what happens when multiple ImageParticles try to render the same particle. - The following ImageParticle renders the particles inside the ListView: - \snippet particles/imageparticle/content/sharing.qml 0 - The following ImageParticle is placed inside the list highlight, and renders the particles above the other ImageParticle. - \snippet particles/imageparticle/content/sharing.qml 1 - Note that because it sets the color and alpha in this ImageParticle, it renders the particles in a different color. - Since it doesn't specify anything about the rotation, it shares the rotation with the other ImageParticle so that the flowers are rotated the same way in both. - Note that you can undo rotation in another ImageParticle, you just need to explicity set rotationVariation to 0. - - Sprites demonstrates using an image particle to render animated sprites instead of static images for each particle. -*/ diff --git a/examples/particles/imageparticle/imageparticle.pro b/examples/particles/imageparticle/imageparticle.pro deleted file mode 100644 index 17d4816138..0000000000 --- a/examples/particles/imageparticle/imageparticle.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app - -QT += quick qml -SOURCES += main.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/particles/imageparticle -qml.files = imageparticle.qml content -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/particles/imageparticle -sources.files = $$SOURCES imageparticle.pro -sources.path = $$qml.path -INSTALLS += sources target qml diff --git a/examples/particles/imageparticle/imageparticle.qml b/examples/particles/imageparticle/imageparticle.qml deleted file mode 100644 index 5f7ca38b13..0000000000 --- a/examples/particles/imageparticle/imageparticle.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -Item { - height: 480 - width: 320 - Examples.LauncherList { - id: ll - anchors.fill: parent - Component.onCompleted: { - addExample("All at once", "Uses all ImageParticle features", Qt.resolvedUrl("content/allatonce.qml")); - addExample("Colored", "Colorized image particles", Qt.resolvedUrl("content/colored.qml")); - addExample("Color Table", "Color-over-life rainbow particles", Qt.resolvedUrl("content/colortable.qml")); - addExample("Deformation", "Deformed particles", Qt.resolvedUrl("content/deformation.qml")); - addExample("Rotation", "Rotated particles", Qt.resolvedUrl("content/rotation.qml")); - addExample("Sharing", "Multiple ImageParticles on the same particles", Qt.resolvedUrl("content/sharing.qml")); - addExample("Sprites", "Particles rendered with sprites", Qt.resolvedUrl("content/sprites.qml")); - } - } -} diff --git a/examples/particles/imageparticle/imageparticle.qmlproject b/examples/particles/imageparticle/imageparticle.qmlproject deleted file mode 100644 index 902cf6519a..0000000000 --- a/examples/particles/imageparticle/imageparticle.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "imageparticle.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/particles/imageparticle/main.cpp b/examples/particles/imageparticle/main.cpp deleted file mode 100644 index 081aec03d7..0000000000 --- a/examples/particles/imageparticle/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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(imageparticle) diff --git a/examples/particles/images/_explo.png b/examples/particles/images/_explo.png deleted file mode 100644 index 4297245d49..0000000000 Binary files a/examples/particles/images/_explo.png and /dev/null differ diff --git a/examples/particles/images/backgroundLeaves.jpg b/examples/particles/images/backgroundLeaves.jpg deleted file mode 100755 index 08be16751d..0000000000 Binary files a/examples/particles/images/backgroundLeaves.jpg and /dev/null differ diff --git a/examples/particles/images/bear_tiles.png b/examples/particles/images/bear_tiles.png deleted file mode 100644 index 6bbb2a9b6d..0000000000 Binary files a/examples/particles/images/bear_tiles.png and /dev/null differ diff --git a/examples/particles/images/candle.png b/examples/particles/images/candle.png deleted file mode 100644 index 8fa3193719..0000000000 Binary files a/examples/particles/images/candle.png and /dev/null differ diff --git a/examples/particles/images/colortable.png b/examples/particles/images/colortable.png deleted file mode 100644 index a62ceeb4a0..0000000000 Binary files a/examples/particles/images/colortable.png and /dev/null differ diff --git a/examples/particles/images/finalfrontier.png b/examples/particles/images/finalfrontier.png deleted file mode 100644 index 2ba1815230..0000000000 Binary files a/examples/particles/images/finalfrontier.png and /dev/null differ diff --git a/examples/particles/images/flower.png b/examples/particles/images/flower.png deleted file mode 100644 index b5c606210e..0000000000 Binary files a/examples/particles/images/flower.png and /dev/null differ diff --git a/examples/particles/images/matchmask.png b/examples/particles/images/matchmask.png deleted file mode 100644 index e575875c55..0000000000 Binary files a/examples/particles/images/matchmask.png and /dev/null differ diff --git a/examples/particles/images/meteor.png b/examples/particles/images/meteor.png deleted file mode 100644 index e8c368aea7..0000000000 Binary files a/examples/particles/images/meteor.png and /dev/null differ diff --git a/examples/particles/images/meteor_explo.png b/examples/particles/images/meteor_explo.png deleted file mode 100644 index e659bfe2cf..0000000000 Binary files a/examples/particles/images/meteor_explo.png and /dev/null differ diff --git a/examples/particles/images/meteors.png b/examples/particles/images/meteors.png deleted file mode 100644 index bada8a1407..0000000000 Binary files a/examples/particles/images/meteors.png and /dev/null differ diff --git a/examples/particles/images/nullRock.png b/examples/particles/images/nullRock.png deleted file mode 100644 index 4076327a1a..0000000000 Binary files a/examples/particles/images/nullRock.png and /dev/null differ diff --git a/examples/particles/images/particle.png b/examples/particles/images/particle.png deleted file mode 100644 index 5c83896d22..0000000000 Binary files a/examples/particles/images/particle.png and /dev/null differ diff --git a/examples/particles/images/particle2.png b/examples/particles/images/particle2.png deleted file mode 100644 index 36349c6c6e..0000000000 Binary files a/examples/particles/images/particle2.png and /dev/null differ diff --git a/examples/particles/images/particle3.png b/examples/particles/images/particle3.png deleted file mode 100644 index 905d8f37b8..0000000000 Binary files a/examples/particles/images/particle3.png and /dev/null differ diff --git a/examples/particles/images/particle4.png b/examples/particles/images/particle4.png deleted file mode 100644 index bc95b703c1..0000000000 Binary files a/examples/particles/images/particle4.png and /dev/null differ diff --git a/examples/particles/images/particleA.png b/examples/particles/images/particleA.png deleted file mode 100644 index c63acdee1f..0000000000 Binary files a/examples/particles/images/particleA.png and /dev/null differ diff --git a/examples/particles/images/portal_bg.png b/examples/particles/images/portal_bg.png deleted file mode 100644 index 3c59eeabb9..0000000000 Binary files a/examples/particles/images/portal_bg.png and /dev/null differ diff --git a/examples/particles/images/realLeaf1.png b/examples/particles/images/realLeaf1.png deleted file mode 100644 index 6cabf29efd..0000000000 Binary files a/examples/particles/images/realLeaf1.png and /dev/null differ diff --git a/examples/particles/images/realLeaf2.png b/examples/particles/images/realLeaf2.png deleted file mode 100644 index bfeca861d5..0000000000 Binary files a/examples/particles/images/realLeaf2.png and /dev/null differ diff --git a/examples/particles/images/realLeaf3.png b/examples/particles/images/realLeaf3.png deleted file mode 100644 index b1071e862b..0000000000 Binary files a/examples/particles/images/realLeaf3.png and /dev/null differ diff --git a/examples/particles/images/realLeaf4.png b/examples/particles/images/realLeaf4.png deleted file mode 100644 index d61d53d10e..0000000000 Binary files a/examples/particles/images/realLeaf4.png and /dev/null differ diff --git a/examples/particles/images/rocket.png b/examples/particles/images/rocket.png deleted file mode 100644 index a171610b03..0000000000 Binary files a/examples/particles/images/rocket.png and /dev/null differ diff --git a/examples/particles/images/rocket2.png b/examples/particles/images/rocket2.png deleted file mode 100644 index 7110f8fdc6..0000000000 Binary files a/examples/particles/images/rocket2.png and /dev/null differ diff --git a/examples/particles/images/sizeInOut.png b/examples/particles/images/sizeInOut.png deleted file mode 100644 index 0a306ea21a..0000000000 Binary files a/examples/particles/images/sizeInOut.png and /dev/null differ diff --git a/examples/particles/images/snowflake.png b/examples/particles/images/snowflake.png deleted file mode 100644 index 490887a82f..0000000000 Binary files a/examples/particles/images/snowflake.png and /dev/null differ diff --git a/examples/particles/images/sparkleSize.png b/examples/particles/images/sparkleSize.png deleted file mode 100644 index 752056541b..0000000000 Binary files a/examples/particles/images/sparkleSize.png and /dev/null differ diff --git a/examples/particles/images/star.png b/examples/particles/images/star.png deleted file mode 100644 index 0d592cfa87..0000000000 Binary files a/examples/particles/images/star.png and /dev/null differ diff --git a/examples/particles/images/starfish_0.png b/examples/particles/images/starfish_0.png deleted file mode 100644 index 8747f0236e..0000000000 Binary files a/examples/particles/images/starfish_0.png and /dev/null differ diff --git a/examples/particles/images/starfish_1.png b/examples/particles/images/starfish_1.png deleted file mode 100644 index 1f3f159d5e..0000000000 Binary files a/examples/particles/images/starfish_1.png and /dev/null differ diff --git a/examples/particles/images/starfish_2.png b/examples/particles/images/starfish_2.png deleted file mode 100644 index c6c7e5a676..0000000000 Binary files a/examples/particles/images/starfish_2.png and /dev/null differ diff --git a/examples/particles/images/starfish_3.png b/examples/particles/images/starfish_3.png deleted file mode 100644 index 307a89f815..0000000000 Binary files a/examples/particles/images/starfish_3.png and /dev/null differ diff --git a/examples/particles/images/starfish_4.png b/examples/particles/images/starfish_4.png deleted file mode 100644 index d61c26545a..0000000000 Binary files a/examples/particles/images/starfish_4.png and /dev/null differ diff --git a/examples/particles/images/starfish_mask.png b/examples/particles/images/starfish_mask.png deleted file mode 100644 index 2ef74f902b..0000000000 Binary files a/examples/particles/images/starfish_mask.png and /dev/null differ diff --git a/examples/particles/itemparticle/content/Delegate.qml b/examples/particles/itemparticle/content/Delegate.qml deleted file mode 100644 index d0292f2467..0000000000 --- a/examples/particles/itemparticle/content/Delegate.qml +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 710c168612..0000000000 --- a/examples/particles/itemparticle/content/Delegate2.qml +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index ee81873a7e..0000000000 --- a/examples/particles/itemparticle/content/ExpandingDelegate.qml +++ /dev/null @@ -1,205 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - antialiasing: true - } - 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 deleted file mode 100644 index ed209a7ce5..0000000000 --- a/examples/particles/itemparticle/content/RssModel.qml +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index c7f479e9e3..0000000000 Binary files a/examples/particles/itemparticle/content/bubble.png and /dev/null differ diff --git a/examples/particles/itemparticle/content/script.js b/examples/particles/itemparticle/content/script.js deleted file mode 100644 index e8ef93a847..0000000000 --- a/examples/particles/itemparticle/content/script.js +++ /dev/null @@ -1,27 +0,0 @@ -.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 deleted file mode 100644 index fa076a2657..0000000000 --- a/examples/particles/itemparticle/delegates.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - velocity: 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 deleted file mode 100644 index 2501e6a713..0000000000 --- a/examples/particles/itemparticle/particleview.qml +++ /dev/null @@ -1,276 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - velocity: 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 - velocity: 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 - velocity: 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 - antialiasing: true - 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 - antialiasing: 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 deleted file mode 100644 index 5592f70ee3..0000000000 --- a/examples/particles/particles.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += affectors \ - customparticle \ - emitters \ - imageparticle \ - system - -#Install shared images too -qml.files = images -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/particles -sources.files = particles.pro -sources.path = $$qml.path -INSTALLS = sources qml diff --git a/examples/particles/system/content/dynamiccomparison.qml b/examples/particles/system/content/dynamiccomparison.qml deleted file mode 100644 index 82591a6f82..0000000000 --- a/examples/particles/system/content/dynamiccomparison.qml +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - velocity: PointDirection {y: 72; yVariation: 24} - lifeSpan: 10000 - emitRate: 1000 - enabled: false - size: 32 - } - - //! [fake] - Item { - id: fakeEmitter - function burst(number) { - while (number > 0) { - var item = fakeParticle.createObject(root); - item.lifeSpan = Math.random() * 5000 + 5000; - item.x = Math.random() * (root.width/2) + (root.width/2); - 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: root.height-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(); } - } - } - } - } - //! [fake] - - //Hooked to a timer, but click for extra bursts that really stress performance - Timer { - interval: 10000 - triggeredOnStart: true - repeat: true - running: true - onTriggered: { - emitter.burst(1000); - fakeEmitter.burst(1000); - } - } - 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/system/content/dynamicemitters.qml b/examples/particles/system/content/dynamicemitters.qml deleted file mode 100644 index bd4bcad397..0000000000 --- a/examples/particles/system/content/dynamicemitters.qml +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - velocity: 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(); - } - } - } - - function customEmit(x,y) { - //! [0] - for (var i=0; i<8; i++) { - var obj = emitterComp.createObject(root); - obj.x = x - obj.y = 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(); - } - //! [0] - } - - Timer { - interval: 10000 - triggeredOnStart: true - running: true - repeat: true - onTriggered: customEmit(Math.random() * 320, Math.random() * 480) - } - MouseArea { - anchors.fill: parent - onClicked: customEmit(mouse.x, mouse.y); - } - - Text { - anchors.horizontalCenter: parent.horizontalCenter - text: "Click Somewhere" - color: "white" - font.pixelSize: 24 - } -} diff --git a/examples/particles/system/content/multiplepainters.qml b/examples/particles/system/content/multiplepainters.qml deleted file mode 100644 index 174f527f1f..0000000000 --- a/examples/particles/system/content/multiplepainters.qml +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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; - } - Text { - anchors.horizontalCenter: parent.horizontalCenter - text: "Click to Toggle" - color: "white" - font.pixelSize: 24 - } - Emitter { - system: sys - y:root.height + 20 - width: root.width - emitRate: 200 - lifeSpan: 4000 - startTime: 4000 - velocity: 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/system/content/startstop.qml b/examples/particles/system/content/startstop.qml deleted file mode 100644 index f0433e1b39..0000000000 --- a/examples/particles/system/content/startstop.qml +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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" - Text { - text: "Left click to start/stop\nRight click to pause/unpause" - color: "white" - font.pixelSize: 24 - } - 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/particles/system/content/timedgroupchanges.qml b/examples/particles/system/content/timedgroupchanges.qml deleted file mode 100644 index 86ea811614..0000000000 --- a/examples/particles/system/content/timedgroupchanges.qml +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - //! [0] - ParticleGroup { - name: "fire" - duration: 2000 - durationVariation: 2000 - to: {"splode":1} - } - //! [0] - //! [1] - ParticleGroup { - name: "splode" - duration: 400 - to: {"dead":1} - TrailEmitter { - group: "works" - emitRatePerParticle: 100 - lifeSpan: 1000 - maximumEmitted: 1200 - size: 8 - velocity: AngleDirection {angle: 270; angleVariation: 45; magnitude: 20; magnitudeVariation: 20;} - acceleration: PointDirection {y:100; yVariation: 20} - } - } - //! [1] - //! [2] - ParticleGroup { - name: "dead" - duration: 1000 - Affector { - once: true - onAffected: worksEmitter.burst(400,x,y) - } - } - //! [2] - - 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 - velocity: PointDirection {y:-100;} - size: 32 - } - - Emitter { - id: worksEmitter - group: "works" - enabled: false - emitRate: 100 - lifeSpan: 1600 - maximumEmitted: 6400 - size: 8 - velocity: 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/system/doc/images/qml-system-example.png b/examples/particles/system/doc/images/qml-system-example.png deleted file mode 100644 index 1a317c4be8..0000000000 Binary files a/examples/particles/system/doc/images/qml-system-example.png and /dev/null differ diff --git a/examples/particles/system/doc/src/system.qdoc b/examples/particles/system/doc/src/system.qdoc deleted file mode 100644 index 8c381a57ec..0000000000 --- a/examples/particles/system/doc/src/system.qdoc +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Free Documentation License Usage -** 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. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title QtQuick.Particles Examples - Affectors - \example particles/system - \brief This is a collection of examples using Affectors in the QML particle system. - \image qml-system-example.png - - This is a collection of small QML examples relating to using Affectors in the particle system. - Each example is a small QML file emphasizing a particular element or feature. - - Dynamic comparison compares using the particle system to getting a similar effect with the following code that dynamically instantiates Image elements. - \snippet particles/system/content/dynamiccomparison.qml fake - Note how the Image elements are not able to be randomly colorized. - - Start and Stop simply sets the running and paused states of a ParticleSystem. While the system does not perform any simulation when stopped or paused, a restart restarts the simulation from the beginning, while unpausing resumes the simulation from where it was. - - Timed group changes is an example that highlights the ParticleGroup element. While normally referring to groups with a string name is sufficent, additional effects can be - done by setting properties on groups. - The first group has a variable duration on it, but always transitions to the second group. - \snippet particles/system/content/timedgroupchanges.qml 0 - The second group has a TrailEmitter on it, and a fixed duration for emitting into the third group. By placing the TrailEmitter as a direct child of the ParticleGroup, it automatically selects that group to follow. - \snippet particles/system/content/timedgroupchanges.qml 1 - The third group has an Affector as a direct child, which makes the affector automatically target this group. The affector means that as soon as particles enter this group, a burst function can be called on another emitter, using the x,y positions of this particle. - \snippet particles/system/content/timedgroupchanges.qml 2 - - If TrailEmitter does not suit your needs for multiple emitters, you can also dynamically create Emitters while still using the same ParticleSystem and image particle - \snippet particles/system/content/dynamicemitters.qml 0 - Note that this effect, a flurry of flying rainbow spears, would be better served with TrailEmitter. It is only done with dynamic emitters in this example to show the concept more simply. - - Multiple Painters shows how to control paint ordering of individual particles. While the paint ordering of particles within one ImagePainter is not strictly defined, ImageParticle elements follow the normal Z-ordering rules for QtQuick items. This example allow you to paint the inside of the particles above the black borders using a pair of ImageParticles each painting different parts of the same logical particle. - -*/ - diff --git a/examples/particles/system/main.cpp b/examples/particles/system/main.cpp deleted file mode 100644 index ea67283822..0000000000 --- a/examples/particles/system/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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(system) diff --git a/examples/particles/system/system.pro b/examples/particles/system/system.pro deleted file mode 100644 index 7cc3165483..0000000000 --- a/examples/particles/system/system.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app - -QT += quick qml -SOURCES += main.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/particles/system -qml.files = system.qml content -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/particles/system -sources.files = $$SOURCES system.pro -sources.path = $$qml.path -INSTALLS += sources target qml diff --git a/examples/particles/system/system.qml b/examples/particles/system/system.qml deleted file mode 100644 index a299d0af27..0000000000 --- a/examples/particles/system/system.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -Item { - height: 480 - width: 320 - Examples.LauncherList { - id: ll - anchors.fill: parent - Component.onCompleted: { - addExample("Dynamic Comparison", "Compares with dynamically created elements", Qt.resolvedUrl("content/dynamiccomparison.qml")); - addExample("StartStop", "Start and stop the simulation", Qt.resolvedUrl("content/startstop.qml")); - addExample("Timed group changes", "Emit into managed groups", Qt.resolvedUrl("content/timedgroupchanges.qml")); - addExample("Dynamic Emitters", "Dynamically instantiated emitters with a single system", Qt.resolvedUrl("content/dynamicemitters.qml")); - addExample("Multiple Painters", "Several ParticlePainters on the same logical particles", Qt.resolvedUrl("content/multiplepainters.qml")); - } - } -} diff --git a/examples/particles/system/system.qmlproject b/examples/particles/system/system.qmlproject deleted file mode 100644 index 1f9df3cecf..0000000000 --- a/examples/particles/system/system.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "system.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } -} diff --git a/examples/qml/imageprovider/imageprovider.pro b/examples/qml/imageprovider/imageprovider.pro index 135f4da627..d1dd321b72 100644 --- a/examples/qml/imageprovider/imageprovider.pro +++ b/examples/qml/imageprovider/imageprovider.pro @@ -7,15 +7,9 @@ TARGET = qmlimageproviderplugin SOURCES += imageprovider.cpp -OTHER_FILES += imageprovider.json +EXAMPLE_FILES = imageprovider-example.qml -sources.files = $$SOURCES imageprovider.qml imageprovider.pro $$OTHER_FILES -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/imageprovider - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/imageprovider/ImageProviderCore - -ImageProviderCore_sources.files = \ - ImageProviderCore/qmldir -ImageProviderCore_sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/imageprovider/ImageProviderCore - -INSTALLS = sources ImageProviderCore_sources target +target.path = $$[QT_INSTALL_EXAMPLES]/qml/imageprovider/ImageProviderCore +qml.files = ImageProviderCore/qmldir +qml.path = $$[QT_INSTALL_EXAMPLES]/qml/imageprovider/ImageProviderCore +INSTALLS = target qml diff --git a/examples/qml/networkaccessmanagerfactory/networkaccessmanagerfactory.pro b/examples/qml/networkaccessmanagerfactory/networkaccessmanagerfactory.pro index 3195dfd7a2..222cc71c46 100644 --- a/examples/qml/networkaccessmanagerfactory/networkaccessmanagerfactory.pro +++ b/examples/qml/networkaccessmanagerfactory/networkaccessmanagerfactory.pro @@ -3,8 +3,5 @@ QT += qml quick network SOURCES += main.cpp RESOURCES += networkaccessmanagerfactory.qrc -sources.files = $$SOURCES $$RESOURCES networkaccessmanagerfactory.pro view.qml -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/networkaccessmanagerfactory -target.path = $$sources.path - -INSTALLS = sources target +target.path = $$[QT_INSTALL_EXAMPLES]/qml/networkaccessmanagerfactory +INSTALLS = target diff --git a/examples/qml/plugins/plugins.pro b/examples/qml/plugins/plugins.pro index 66af7d3c07..6f8cb37f93 100644 --- a/examples/qml/plugins/plugins.pro +++ b/examples/qml/plugins/plugins.pro @@ -7,7 +7,7 @@ TARGET = qmlqtimeexampleplugin SOURCES += plugin.cpp -qdeclarativesources.files += \ +pluginfiles.files += \ imports/TimeExample/qmldir \ imports/TimeExample/center.png \ imports/TimeExample/clock.png \ @@ -15,11 +15,10 @@ qdeclarativesources.files += \ imports/TimeExample/hour.png \ imports/TimeExample/minute.png -qdeclarativesources.path += $$[QT_INSTALL_EXAMPLES]/qtquick/qml/plugins/imports/TimeExample +qml.files = plugins.qml +qml.path += $$[QT_INSTALL_EXAMPLES]/qml/plugins +target.path += $$[QT_INSTALL_EXAMPLES]/qml/plugins/imports/TimeExample +pluginfiles.path += $$[QT_INSTALL_EXAMPLES]/qml/plugins/imports/TimeExample -sources.files += plugins.pro plugin.cpp plugins.qml -sources.path += $$[QT_INSTALL_EXAMPLES]/qtquick/qml/plugins -target.path += $$[QT_INSTALL_EXAMPLES]/qtquick/qml/plugins/imports/TimeExample - -INSTALLS += qdeclarativesources sources target +INSTALLS += target qml pluginfiles diff --git a/examples/qml/qml.pro b/examples/qml/qml.pro index 6bc620fbf0..a66d08a8b7 100644 --- a/examples/qml/qml.pro +++ b/examples/qml/qml.pro @@ -1,12 +1,13 @@ TEMPLATE = subdirs SUBDIRS +=imageprovider \ - plugins \ networkaccessmanagerfactory \ + plugins \ referenceexamples \ - shell + shell \ + xmlhttprequest -#Install -sources.files = qml.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml -INSTALLS += sources +EXAMPLE_FILES = \ + dynamicscene \ + i18n \ + locale diff --git a/examples/qml/referenceexamples/adding/adding.pro b/examples/qml/referenceexamples/adding/adding.pro index a6c2fc65ed..86c830bda9 100644 --- a/examples/qml/referenceexamples/adding/adding.pro +++ b/examples/qml/referenceexamples/adding/adding.pro @@ -5,7 +5,5 @@ SOURCES += main.cpp \ HEADERS += person.h RESOURCES += adding.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/referenceexamples/adding -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS adding.pro example.qml -sources.path = $$target.path -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/qml/referenceexamples/adding +INSTALLS += target diff --git a/examples/qml/referenceexamples/attached/attached.pro b/examples/qml/referenceexamples/attached/attached.pro index 247db55cee..1225a5fcfd 100644 --- a/examples/qml/referenceexamples/attached/attached.pro +++ b/examples/qml/referenceexamples/attached/attached.pro @@ -7,7 +7,5 @@ HEADERS += person.h \ birthdayparty.h RESOURCES += attached.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/referenceexamples/attached -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS attached.pro example.qml -sources.path = $$target.path -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/qml/referenceexamples/attached +INSTALLS += target diff --git a/examples/qml/referenceexamples/binding/binding.pro b/examples/qml/referenceexamples/binding/binding.pro index 86787c7654..3c1f9565ed 100644 --- a/examples/qml/referenceexamples/binding/binding.pro +++ b/examples/qml/referenceexamples/binding/binding.pro @@ -7,9 +7,7 @@ SOURCES += main.cpp \ HEADERS += person.h \ birthdayparty.h \ happybirthdaysong.h - RESOURCES += binding.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/referenceexamples/binding -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS binding.pro example.qml -sources.path = $$target.path -INSTALLS += target sources + +target.path = $$[QT_INSTALL_EXAMPLES]/qml/referenceexamples/binding +INSTALLS += target diff --git a/examples/qml/referenceexamples/coercion/coercion.pro b/examples/qml/referenceexamples/coercion/coercion.pro index e053ac21cb..c501b9cda2 100644 --- a/examples/qml/referenceexamples/coercion/coercion.pro +++ b/examples/qml/referenceexamples/coercion/coercion.pro @@ -7,7 +7,5 @@ HEADERS += person.h \ birthdayparty.h RESOURCES += coercion.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/referenceexamples/coercion -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS coercion.pro example.qml -sources.path = $$target.path -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/qml/referenceexamples/coercion +INSTALLS += target diff --git a/examples/qml/referenceexamples/default/default.pro b/examples/qml/referenceexamples/default/default.pro index 80bee64461..db4b88413b 100644 --- a/examples/qml/referenceexamples/default/default.pro +++ b/examples/qml/referenceexamples/default/default.pro @@ -7,7 +7,5 @@ HEADERS += person.h \ birthdayparty.h RESOURCES += default.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/referenceexamples/default -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS default.pro example.qml -sources.path = $$target.path -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/qml/referenceexamples/default +INSTALLS += target diff --git a/examples/qml/referenceexamples/extended/extended.pro b/examples/qml/referenceexamples/extended/extended.pro index 5b21d90447..b38a1753b9 100644 --- a/examples/qml/referenceexamples/extended/extended.pro +++ b/examples/qml/referenceexamples/extended/extended.pro @@ -5,7 +5,5 @@ SOURCES += main.cpp \ HEADERS += lineedit.h RESOURCES += extended.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/referenceexamples/extended -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS extended.pro example.qml -sources.path = $$target.path -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/qml/referenceexamples/extended +INSTALLS += target diff --git a/examples/qml/referenceexamples/grouped/grouped.pro b/examples/qml/referenceexamples/grouped/grouped.pro index afd1c15668..7014d9680d 100644 --- a/examples/qml/referenceexamples/grouped/grouped.pro +++ b/examples/qml/referenceexamples/grouped/grouped.pro @@ -7,7 +7,5 @@ HEADERS += person.h \ birthdayparty.h RESOURCES += grouped.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/referenceexamples/grouped -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS grouped.pro example.qml -sources.path = $$target.path -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/qml/referenceexamples/grouped +INSTALLS += target diff --git a/examples/qml/referenceexamples/methods/methods.pro b/examples/qml/referenceexamples/methods/methods.pro index a7dd996532..c1be0713e6 100644 --- a/examples/qml/referenceexamples/methods/methods.pro +++ b/examples/qml/referenceexamples/methods/methods.pro @@ -7,7 +7,5 @@ HEADERS += person.h \ birthdayparty.h RESOURCES += methods.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/referenceexamples/methods -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS methods.pro example.qml -sources.path = $$target.path -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/qml/referenceexamples/methods +INSTALLS += target diff --git a/examples/qml/referenceexamples/properties/properties.pro b/examples/qml/referenceexamples/properties/properties.pro index c1cf877e65..cd1ffeddcc 100644 --- a/examples/qml/referenceexamples/properties/properties.pro +++ b/examples/qml/referenceexamples/properties/properties.pro @@ -7,7 +7,5 @@ HEADERS += person.h \ birthdayparty.h RESOURCES += properties.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/referenceexamples/properties -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS properties.pro example.qml -sources.path = $$target.path -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/qml/referenceexamples/properties +INSTALLS += target diff --git a/examples/qml/referenceexamples/referenceexamples.pro b/examples/qml/referenceexamples/referenceexamples.pro index 5f514bc1db..4bfbd488ea 100644 --- a/examples/qml/referenceexamples/referenceexamples.pro +++ b/examples/qml/referenceexamples/referenceexamples.pro @@ -13,7 +13,3 @@ SUBDIRS += \ methods !contains(QT_CONFIG, no-widgets): SUBDIRS += extended - -sources.files = referenceexamples.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/referenceexamples -INSTALLS += sources diff --git a/examples/qml/referenceexamples/signal/signal.pro b/examples/qml/referenceexamples/signal/signal.pro index 5a021ebae0..81692d3676 100644 --- a/examples/qml/referenceexamples/signal/signal.pro +++ b/examples/qml/referenceexamples/signal/signal.pro @@ -7,7 +7,5 @@ HEADERS += person.h \ birthdayparty.h RESOURCES += signal.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/referenceexamples/signal -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS signal.pro example.qml -sources.path = $$target.path -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/qml/referenceexamples/signal +INSTALLS += target diff --git a/examples/qml/referenceexamples/valuesource/valuesource.pro b/examples/qml/referenceexamples/valuesource/valuesource.pro index d7aafb7d10..4ec77ff83b 100644 --- a/examples/qml/referenceexamples/valuesource/valuesource.pro +++ b/examples/qml/referenceexamples/valuesource/valuesource.pro @@ -9,7 +9,5 @@ HEADERS += person.h \ happybirthdaysong.h RESOURCES += valuesource.qrc -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/referenceexamples/valuesource -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS valuesource.pro example.qml -sources.path = $$target.path -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/qml/referenceexamples/valuesource +INSTALLS += target diff --git a/examples/qml/shell/shell.pro b/examples/qml/shell/shell.pro index b57d550d31..da97590189 100644 --- a/examples/qml/shell/shell.pro +++ b/examples/qml/shell/shell.pro @@ -5,7 +5,5 @@ mac:CONFIG -= app_bundle SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/shell -sources.files = $$SOURCES shell.pro -sources.path = $$target.path -INSTALLS += target sources +target.path = $$[QT_INSTALL_EXAMPLES]/qml/shell +INSTALLS += target diff --git a/examples/qml/xmlhttprequest/main.cpp b/examples/qml/xmlhttprequest/main.cpp index 976a462464..25f3759de5 100644 --- a/examples/qml/xmlhttprequest/main.cpp +++ b/examples/qml/xmlhttprequest/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" -DECLARATIVE_EXAMPLE_MAIN(xmlhttprequest) \ No newline at end of file +#include "../../quick/shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(xmlhttprequest) diff --git a/examples/qml/xmlhttprequest/xmlhttprequest.pro b/examples/qml/xmlhttprequest/xmlhttprequest.pro index bb7fae66bf..5af32eeab6 100644 --- a/examples/qml/xmlhttprequest/xmlhttprequest.pro +++ b/examples/qml/xmlhttprequest/xmlhttprequest.pro @@ -3,7 +3,10 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/xmlhttprequest +EXAMPLE_FILES = \ + data.xml + +target.path = $$[QT_INSTALL_EXAMPLES]/qml/xmlhttprequest qml.files = xmlhttprequest.qml get.qml -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qml/xmlhttprequest +qml.path = $$[QT_INSTALL_EXAMPLES]/qml/xmlhttprequest INSTALLS += target qml diff --git a/examples/qml/xmlhttprequest/xmlhttprequest.qml b/examples/qml/xmlhttprequest/xmlhttprequest.qml index b9bf4548cb..b483ac1aa0 100644 --- a/examples/qml/xmlhttprequest/xmlhttprequest.qml +++ b/examples/qml/xmlhttprequest/xmlhttprequest.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../../shared" as Examples +import "../../quick/shared" as Examples Item { height: 480 diff --git a/examples/qmltest/qmltest/qmltest.pro b/examples/qmltest/qmltest/qmltest.pro index dbf032e11c..3ade5f2cbd 100644 --- a/examples/qmltest/qmltest/qmltest.pro +++ b/examples/qmltest/qmltest/qmltest.pro @@ -5,7 +5,7 @@ SOURCES += tst_qmltest.cpp # Note: Normally, tests are auto-installed to a test-specific directory. Overwritten here # so this one will end up in the examples tree. -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/qmltest -sources.files = $$SOURCES qmltest.pro *.qml -sources.path = $$target.path -INSTALLS = sources target +target.path = $$[QT_INSTALL_EXAMPLES]/qmltest +qml.files = tst_basic.qml tst_item.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/qmltest +INSTALLS += target qml diff --git a/examples/quick/accessibility/accessibility.pro b/examples/quick/accessibility/accessibility.pro index 681e44b307..9658a8e70b 100644 --- a/examples/quick/accessibility/accessibility.pro +++ b/examples/quick/accessibility/accessibility.pro @@ -3,9 +3,7 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/accessibility +target.path = $$[QT_INSTALL_EXAMPLES]/quick/accessibility qml.files = accessibility.qml content -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/accessibility -sources.files = $$SOURCES accessibility.pro -sources.path = $$qml.path -INSTALLS += sources target qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/accessibility +INSTALLS += target qml diff --git a/examples/quick/accessibility/main.cpp b/examples/quick/accessibility/main.cpp index 801ccdcf19..51374d0493 100644 --- a/examples/quick/accessibility/main.cpp +++ b/examples/quick/accessibility/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" +#include "../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(accessibility) diff --git a/examples/quick/animation/animation.pro b/examples/quick/animation/animation.pro index edc767d709..58e9226ea5 100644 --- a/examples/quick/animation/animation.pro +++ b/examples/quick/animation/animation.pro @@ -3,10 +3,8 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/animation +target.path = $$[QT_INSTALL_EXAMPLES]/quick/animation qml.files = animation.qml basics behaviors easing pathanimation pathinterpolator states -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/animation -sources.files = $$SOURCES animation.pro -sources.path = $$qml.path -INSTALLS += sources target qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/animation +INSTALLS += target qml diff --git a/examples/quick/animation/animation.qml b/examples/quick/animation/animation.qml index a17967a496..8a1b8558ee 100644 --- a/examples/quick/animation/animation.qml +++ b/examples/quick/animation/animation.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../../shared" as Examples +import "../shared" as Examples Item { height: 480 diff --git a/examples/quick/animation/main.cpp b/examples/quick/animation/main.cpp index faccffc27a..dc5b506888 100644 --- a/examples/quick/animation/main.cpp +++ b/examples/quick/animation/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" +#include "../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(animation) diff --git a/examples/quick/canvas/canvas.pro b/examples/quick/canvas/canvas.pro index 9f024237a2..d721805abd 100644 --- a/examples/quick/canvas/canvas.pro +++ b/examples/quick/canvas/canvas.pro @@ -3,9 +3,7 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/canvas +target.path = $$[QT_INSTALL_EXAMPLES]/quick/canvas qml.files = canvas.qml bezierCurve clip quadraticCurveTo roundedrect smile squircle tiger contents -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/canvas -sources.files = $$SOURCES canvas.pro -sources.path = $$qml.path -INSTALLS += sources target qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/canvas +INSTALLS += target qml diff --git a/examples/quick/canvas/canvas.qml b/examples/quick/canvas/canvas.qml index 65707f7381..e1e8724149 100644 --- a/examples/quick/canvas/canvas.qml +++ b/examples/quick/canvas/canvas.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../../shared" as Examples +import "../shared" as Examples Item { height: 480 diff --git a/examples/quick/canvas/main.cpp b/examples/quick/canvas/main.cpp index acbef7551b..52c62ace12 100644 --- a/examples/quick/canvas/main.cpp +++ b/examples/quick/canvas/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" +#include "../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(canvas) \ No newline at end of file diff --git a/examples/quick/customitems/customitems.pro b/examples/quick/customitems/customitems.pro index a401042d4e..1e0a2aed49 100644 --- a/examples/quick/customitems/customitems.pro +++ b/examples/quick/customitems/customitems.pro @@ -1,17 +1,14 @@ TEMPLATE = subdirs SUBDIRS = \ - #dialcontrol \ - #flipable \ painteditem \ - #progressbar \ - #scrollbar \ - #searchbox \ - #slideswitch \ - #spinner \ - #tabwidget \ maskedmousearea -# install -sources.files = customitems.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/customitems -INSTALLS += sources +EXAMPLE_FILES = \ + dialcontrol \ + flipable \ + progressbar \ + scrollbar \ + searchbox \ + slideswitch \ + spinner \ + tabwidget diff --git a/examples/quick/customitems/maskedmousearea/maskedmousearea.pro b/examples/quick/customitems/maskedmousearea/maskedmousearea.pro index b812508bd7..d44fa59d08 100644 --- a/examples/quick/customitems/maskedmousearea/maskedmousearea.pro +++ b/examples/quick/customitems/maskedmousearea/maskedmousearea.pro @@ -7,9 +7,7 @@ HEADERS += maskedmousearea.h SOURCES += main.cpp \ maskedmousearea.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/customitems/maskedmousearea +target.path = $$[QT_INSTALL_EXAMPLES]/quick/customitems/maskedmousearea qml.files = maskedmousearea.qml images qml.path = $$target.path -sources.files = $$SOURCES $$HEADERS maskedmousearea.pro -sources.path = $$qml.path -INSTALLS += sources target qml +INSTALLS += target qml diff --git a/examples/quick/customitems/painteditem/painteditem.pro b/examples/quick/customitems/painteditem/painteditem.pro index 846ad6307d..dfe6f96923 100644 --- a/examples/quick/customitems/painteditem/painteditem.pro +++ b/examples/quick/customitems/painteditem/painteditem.pro @@ -9,16 +9,12 @@ HEADERS += TextBalloonPlugin/plugin.h \ SOURCES += textballoon.cpp -OTHER_FILES += textballoon.json - DESTDIR = TextBalloonPlugin -INSTALL_PATH = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/customitems/painteditem/ -qdeclarativesources.files += \ - TextBalloonPlugin/qmldir TextBalloonPlugin/plugin.h -qdeclarativesources.path += $$INSTALL_PATH/TextBalloonPlugin -sources.files = textballoons.qml $$SOURCES textballoon.h $$OTHER_FILES painteditem.pro -sources.path = $$INSTALL_PATH -target.path = $$INSTALL_PATH/TextBalloonPlugin +target.path = $$[QT_INSTALL_EXAMPLES]/quick/customitems/painteditem/TextBalloonPlugin +qmldir.files = TextBalloonPlugin/qmldir +qmldir.path = $$[QT_INSTALL_EXAMPLES]/quick/customitems/painteditem/TextBalloonPlugin +qml.files = textballoons.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/customitems/painteditem/ -INSTALLS = qdeclarativesources sources target +INSTALLS += qml qmldir target diff --git a/examples/quick/demos/calqlatr/calqlatr.pro b/examples/quick/demos/calqlatr/calqlatr.pro new file mode 100644 index 0000000000..fec0d6416b --- /dev/null +++ b/examples/quick/demos/calqlatr/calqlatr.pro @@ -0,0 +1,9 @@ +TEMPLATE = app + +QT += qml quick +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/calqlatr +qml.files = calqlatr.qml content +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/calqlatr +INSTALLS += target qml diff --git a/examples/quick/demos/calqlatr/calqlatr.qml b/examples/quick/demos/calqlatr/calqlatr.qml new file mode 100644 index 0000000000..7640fbd738 --- /dev/null +++ b/examples/quick/demos/calqlatr/calqlatr.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/calculator.js" as CalcEngine + + +Rectangle { + id: window + width: 320 + height: 480 + focus: true + color: "#272822" + + onWidthChanged: controller.reload() + + function operatorPressed(operator) { CalcEngine.operatorPressed(operator) } + function digitPressed(digit) { CalcEngine.digitPressed(digit) } + + Item { + id: pad + width: window.width * 0.58 + NumberPad { y: 10; anchors.horizontalCenter: parent.horizontalCenter } + } + + AnimationController { + id: controller + animation: ParallelAnimation { + id: anim + NumberAnimation { target: display; property: "x"; duration: 400; from: -16; to: window.width - display.width; easing.type: Easing.InOutQuad } + NumberAnimation { target: pad; property: "x"; duration: 400; from: window.width - pad.width; to: 0; easing.type: Easing.InOutQuad } + SequentialAnimation { + NumberAnimation { target: pad; property: "scale"; duration: 200; from: 1; to: 0.97; easing.type: Easing.InOutQuad } + NumberAnimation { target: pad; property: "scale"; duration: 200; from: 0.97; to: 1; easing.type: Easing.InOutQuad } + } + } + } + + Display { + id: display + x: -16 + width: window.width * 0.42 + height: parent.height + + MouseArea { + property real startX: 0 + property real oldP: 0 + property bool rewind: false + + anchors.fill: parent + onPositionChanged: { + var reverse = startX > window.width / 2 + var mx = mapToItem(window, mouse.x).x + var p = Math.abs((mx - startX) / (window.width - display.width)) + if (p < oldP) + rewind = reverse ? false : true + else + rewind = reverse ? true : false + controller.progress = reverse ? 1 - p : p + oldP = p + } + onPressed: startX = mapToItem(window, mouse.x).x + onReleased: { + if (rewind) + controller.completeToBeginning() + else + controller.completeToEnd() + } + } + } + +} diff --git a/examples/quick/demos/calqlatr/calqlatr.qmlproject b/examples/quick/demos/calqlatr/calqlatr.qmlproject new file mode 100644 index 0000000000..ce2d59d310 --- /dev/null +++ b/examples/quick/demos/calqlatr/calqlatr.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "calqlatr.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/quick/demos/calqlatr/content/Button.qml b/examples/quick/demos/calqlatr/content/Button.qml new file mode 100644 index 0000000000..c355c2d105 --- /dev/null +++ b/examples/quick/demos/calqlatr/content/Button.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 text: textItem.text + property alias color: textItem.color + + property bool operator: false + + signal clicked + + width: 30 + height: 50 + + Text { + id: textItem + font.pixelSize: 48 + wrapMode: Text.WordWrap + lineHeight: 0.75 + color: "white" + } + +// Rectangle { +// color: "red" +// opacity: 0.2 +// anchors.fill: mouse +// } + + MouseArea { + id: mouse + anchors.fill: parent + anchors.margins: -5 + onClicked: { + //parent.clicked() + if (operator) + window.operatorPressed(parent.text) + else + window.digitPressed(parent.text) + } + } +} diff --git a/examples/quick/demos/calqlatr/content/Display.qml b/examples/quick/demos/calqlatr/content/Display.qml new file mode 100644 index 0000000000..3c1d9c0cd5 --- /dev/null +++ b/examples/quick/demos/calqlatr/content/Display.qml @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: display + + function displayOperator(operator) + { + listView.model.append({ "operator": operator, "operand": "" }) + } + + function newLine(operator, operand) + { + listView.model.append({ "operator": operator, "operand": operand }) + } + + function appendDigit(digit) + { + if (!listView.model.count) + listView.model.append({ "operator": "", "operand": "" }) + var i = listView.model.count - 1; + listView.model.get(i).operand = listView.model.get(i).operand + digit; + } + + Item { + id: theItem + width: parent.width + 32 + height: parent.height + + Rectangle { + id: rect + x: 16 + color: "white" + height: parent.height + width: display.width - 16 + } + Image { + anchors.right: rect.left + source: "images/paper-edge-left.png" + height: parent.height + fillMode: Image.TileVertically + } + Image { + anchors.left: rect.right + source: "images/paper-edge-right.png" + height: parent.height + fillMode: Image.TileVertically + } + + Image { + source: "images/paper-grip.png" + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: 20 + } + + ListView { + id: listView + x: 16; y: 30 + width: display.width + height: display.height + delegate: Item { + height: 20 + width: parent.width + Text { + id: operator + x: 8 + font.pixelSize: 18 + color: "#6da43d" + text: model.operator + } + Text { + id: operand + font.pixelSize: 18 + anchors.right: parent.right + anchors.rightMargin: 26 + text: model.operand + } + } + model: ListModel { } + } + + } + +} diff --git a/examples/quick/demos/calqlatr/content/NumberPad.qml b/examples/quick/demos/calqlatr/content/NumberPad.qml new file mode 100644 index 0000000000..853c7631c9 --- /dev/null +++ b/examples/quick/demos/calqlatr/content/NumberPad.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +Grid { + columns: 3 + columnSpacing: 32 + rowSpacing: 16 + + Button { text: "7" } + Button { text: "8" } + Button { text: "9" } + Button { text: "4" } + Button { text: "5" } + Button { text: "6" } + Button { text: "1" } + Button { text: "2" } + Button { text: "3" } + Button { text: "0" } + Button { text: "." } + Button { text: " " } + Button { text: "±"; color: "#6da43d"; operator: true } + Button { text: "−"; color: "#6da43d"; operator: true } + Button { text: "+"; color: "#6da43d"; operator: true } + Button { text: " "; color: "#6da43d"; operator: true } + Button { text: "÷"; color: "#6da43d"; operator: true } + Button { text: "×"; color: "#6da43d"; operator: true } + Button { text: "C"; color: "#6da43d"; operator: true } + Button { text: " "; color: "#6da43d"; operator: true } + Button { text: "="; color: "#6da43d"; operator: true } +} diff --git a/examples/quick/demos/calqlatr/content/StyleLabel.qml b/examples/quick/demos/calqlatr/content/StyleLabel.qml new file mode 100644 index 0000000000..3bdea86129 --- /dev/null +++ b/examples/quick/demos/calqlatr/content/StyleLabel.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: 64 + font.pixelSize: 14 + font.bold: false + wrapMode: Text.WordWrap + lineHeight: 0.75 + color: "#676764" +} diff --git a/examples/quick/demos/calqlatr/content/audio/touch.wav b/examples/quick/demos/calqlatr/content/audio/touch.wav new file mode 100644 index 0000000000..94cccb7546 Binary files /dev/null and b/examples/quick/demos/calqlatr/content/audio/touch.wav differ diff --git a/examples/quick/demos/calqlatr/content/calculator.js b/examples/quick/demos/calqlatr/content/calculator.js new file mode 100644 index 0000000000..843ef39c02 --- /dev/null +++ b/examples/quick/demos/calqlatr/content/calculator.js @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +var curVal = 0 +var memory = 0 +var lastOp = "" +var previousOperator = "" +var digits = "" + +function disabled(op) { + if (op == "." && digits.toString().search(/\./) != -1) { + return true + } else if (op == window.squareRoot && digits.toString().search(/-/) != -1) { + return true + } else { + return false + } +} + +function digitPressed(op) +{ + if (disabled(op)) + return + if (digits.toString().length >= 14) + return + if (lastOp.toString().length == 1 && ((lastOp >= "0" && lastOp <= "9") || lastOp == ".") ) { + digits = digits + op.toString() + display.appendDigit(op.toString()) + } else { + digits = op + display.appendDigit(op.toString()) + } + lastOp = op +} + +function operatorPressed(op) +{ + if (disabled(op)) + return + lastOp = op + + if (previousOperator == "+") { + digits = Number(digits.valueOf()) + Number(curVal.valueOf()) + } else if (previousOperator == "−") { + digits = Number(curVal) - Number(digits.valueOf()) + } else if (previousOperator == "×") { + digits = Number(curVal) * Number(digits.valueOf()) + } else if (previousOperator == "÷") { + digits = Number(Number(curVal) / Number(digits.valueOf())).toString() + } else if (previousOperator == "=") { + } + + if (op == "+" || op == "−" || op == "×" || op == "÷") { + previousOperator = op + curVal = digits.valueOf() + display.displayOperator(previousOperator) + return + } + + if (op == "=") { + display.newLine("=", digits.toString()) + } + + curVal = 0 + previousOperator = "" + + if (op == "1/x") { + digits = (1 / digits.valueOf()).toString() + } else if (op == "x^2") { + digits = (digits.valueOf() * digits.valueOf()).toString() + } else if (op == "Abs") { + digits = (Math.abs(digits.valueOf())).toString() + } else if (op == "Int") { + digits = (Math.floor(digits.valueOf())).toString() + } else if (op == window.plusminus) { + digits = (digits.valueOf() * -1).toString() + } else if (op == window.squareRoot) { + digits = (Math.sqrt(digits.valueOf())).toString() + } else if (op == "mc") { + memory = 0; + } else if (op == "m+") { + memory += digits.valueOf() + } else if (op == "mr") { + digits = memory.toString() + } else if (op == "m-") { + memory = digits.valueOf() + } else if (op == window.leftArrow) { + digits = digits.toString().slice(0, -1) + if (digits.length == 0) { + digits = "0" + } + } else if (op == "Off") { + Qt.quit(); + } else if (op == "C") { + digits = "0" + } else if (op == "AC") { + curVal = 0 + memory = 0 + lastOp = "" + digits ="0" + } + + +} + diff --git a/examples/quick/demos/calqlatr/content/images/icon-back.png b/examples/quick/demos/calqlatr/content/images/icon-back.png new file mode 100644 index 0000000000..2989ee2e35 Binary files /dev/null and b/examples/quick/demos/calqlatr/content/images/icon-back.png differ diff --git a/examples/quick/demos/calqlatr/content/images/icon-close.png b/examples/quick/demos/calqlatr/content/images/icon-close.png new file mode 100644 index 0000000000..3e21248232 Binary files /dev/null and b/examples/quick/demos/calqlatr/content/images/icon-close.png differ diff --git a/examples/quick/demos/calqlatr/content/images/icon-settings.png b/examples/quick/demos/calqlatr/content/images/icon-settings.png new file mode 100644 index 0000000000..98e662f53f Binary files /dev/null and b/examples/quick/demos/calqlatr/content/images/icon-settings.png differ diff --git a/examples/quick/demos/calqlatr/content/images/logo.png b/examples/quick/demos/calqlatr/content/images/logo.png new file mode 100644 index 0000000000..6bc65610bc Binary files /dev/null and b/examples/quick/demos/calqlatr/content/images/logo.png differ diff --git a/examples/quick/demos/calqlatr/content/images/paper-edge-left.png b/examples/quick/demos/calqlatr/content/images/paper-edge-left.png new file mode 100644 index 0000000000..ca29a3ae10 Binary files /dev/null and b/examples/quick/demos/calqlatr/content/images/paper-edge-left.png differ diff --git a/examples/quick/demos/calqlatr/content/images/paper-edge-right.png b/examples/quick/demos/calqlatr/content/images/paper-edge-right.png new file mode 100644 index 0000000000..7c2da7b930 Binary files /dev/null and b/examples/quick/demos/calqlatr/content/images/paper-edge-right.png differ diff --git a/examples/quick/demos/calqlatr/content/images/paper-grip.png b/examples/quick/demos/calqlatr/content/images/paper-grip.png new file mode 100644 index 0000000000..953c408bca Binary files /dev/null and b/examples/quick/demos/calqlatr/content/images/paper-grip.png differ diff --git a/examples/quick/demos/calqlatr/content/images/settings-selected-a.png b/examples/quick/demos/calqlatr/content/images/settings-selected-a.png new file mode 100644 index 0000000000..e08ddface8 Binary files /dev/null and b/examples/quick/demos/calqlatr/content/images/settings-selected-a.png differ diff --git a/examples/quick/demos/calqlatr/content/images/settings-selected-b.png b/examples/quick/demos/calqlatr/content/images/settings-selected-b.png new file mode 100644 index 0000000000..d9aa7e3431 Binary files /dev/null and b/examples/quick/demos/calqlatr/content/images/settings-selected-b.png differ diff --git a/examples/quick/demos/calqlatr/content/images/touch-green.png b/examples/quick/demos/calqlatr/content/images/touch-green.png new file mode 100644 index 0000000000..64dbde66b1 Binary files /dev/null and b/examples/quick/demos/calqlatr/content/images/touch-green.png differ diff --git a/examples/quick/demos/calqlatr/content/images/touch-white.png b/examples/quick/demos/calqlatr/content/images/touch-white.png new file mode 100644 index 0000000000..bb02b000cf Binary files /dev/null and b/examples/quick/demos/calqlatr/content/images/touch-white.png differ diff --git a/examples/quick/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png b/examples/quick/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png new file mode 100644 index 0000000000..af67f63dd1 Binary files /dev/null and b/examples/quick/demos/calqlatr/doc/images/qml-calqlatr-demo-small.png differ diff --git a/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc b/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc new file mode 100644 index 0000000000..366f01ea2c --- /dev/null +++ b/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** 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. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title QML Demo - Calqlatr + \example demos/calqlatr + \brief This is an example calculator written in QML. + \image qml-calqlatr-demo-small.png + \ingroup qmldemos + + This demo implements a simple calculator app, designed for portrait devices. + + This app has the logic implemented in Javascipt and the appearance implemented in QML. +*/ + diff --git a/examples/quick/demos/calqlatr/main.cpp b/examples/quick/demos/calqlatr/main.cpp new file mode 100644 index 0000000000..9000bfc7d7 --- /dev/null +++ b/examples/quick/demos/calqlatr/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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(calqlatr) diff --git a/examples/quick/demos/clocks/clocks.qml b/examples/quick/demos/clocks/clocks.qml new file mode 100644 index 0000000000..020fe32908 --- /dev/null +++ b/examples/quick/demos/clocks/clocks.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/demos/clocks/content/Clock.qml b/examples/quick/demos/clocks/content/Clock.qml new file mode 100644 index 0000000000..05317b1151 --- /dev/null +++ b/examples/quick/demos/clocks/content/Clock.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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" + 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" + 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" + 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/demos/clocks/content/arrow.png b/examples/quick/demos/clocks/content/arrow.png new file mode 100644 index 0000000000..e437312217 Binary files /dev/null and b/examples/quick/demos/clocks/content/arrow.png differ diff --git a/examples/quick/demos/clocks/content/background.png b/examples/quick/demos/clocks/content/background.png new file mode 100644 index 0000000000..a885950862 Binary files /dev/null and b/examples/quick/demos/clocks/content/background.png differ diff --git a/examples/quick/demos/clocks/content/center.png b/examples/quick/demos/clocks/content/center.png new file mode 100644 index 0000000000..7fbd802a44 Binary files /dev/null and b/examples/quick/demos/clocks/content/center.png differ diff --git a/examples/quick/demos/clocks/content/clock-night.png b/examples/quick/demos/clocks/content/clock-night.png new file mode 100644 index 0000000000..cc7151a397 Binary files /dev/null and b/examples/quick/demos/clocks/content/clock-night.png differ diff --git a/examples/quick/demos/clocks/content/clock.png b/examples/quick/demos/clocks/content/clock.png new file mode 100644 index 0000000000..462edacc0e Binary files /dev/null and b/examples/quick/demos/clocks/content/clock.png differ diff --git a/examples/quick/demos/clocks/content/hour.png b/examples/quick/demos/clocks/content/hour.png new file mode 100644 index 0000000000..f8061a1235 Binary files /dev/null and b/examples/quick/demos/clocks/content/hour.png differ diff --git a/examples/quick/demos/clocks/content/minute.png b/examples/quick/demos/clocks/content/minute.png new file mode 100644 index 0000000000..1297ec7c2b Binary files /dev/null and b/examples/quick/demos/clocks/content/minute.png differ diff --git a/examples/quick/demos/clocks/content/quit.png b/examples/quick/demos/clocks/content/quit.png new file mode 100644 index 0000000000..b822057d4e Binary files /dev/null and b/examples/quick/demos/clocks/content/quit.png differ diff --git a/examples/quick/demos/clocks/content/second.png b/examples/quick/demos/clocks/content/second.png new file mode 100644 index 0000000000..4aa9fb5e8e Binary files /dev/null and b/examples/quick/demos/clocks/content/second.png differ diff --git a/examples/quick/demos/demos.pro b/examples/quick/demos/demos.pro new file mode 100644 index 0000000000..474b5b1bc0 --- /dev/null +++ b/examples/quick/demos/demos.pro @@ -0,0 +1,11 @@ +TEMPLATE = subdirs +SUBDIRS = samegame \ + calqlatr \ + tweetsearch \ + maroon \ + stocqt + +EXAMPLE_FILES = \ + clocks \ + photoviewer \ + rssnews diff --git a/examples/quick/demos/maroon/content/BuildButton.qml b/examples/quick/demos/maroon/content/BuildButton.qml new file mode 100644 index 0000000000..49641fcecc --- /dev/null +++ b/examples/quick/demos/maroon/content/BuildButton.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "logic.js" as Logic + +Item { + id: container + width: 64 + height: 64 + property alias source: img.source + property int index + property int row: 0 + property int col: 0 + property int towerType + property bool canBuild: true + property Item gameCanvas: parent.parent.parent + signal clicked() + + Image { + id: img + opacity: (canBuild && gameCanvas.coins >= Logic.towerData[towerType-1].cost) ? 1.0 : 0.4 + } + Text { + anchors.right: parent.right + font.pointSize: 14 + font.bold: true + color: "#ffffff" + text: Logic.towerData[towerType - 1].cost + } + MouseArea { + anchors.fill: parent + onClicked: { + Logic.buildTower(towerType, col, row) + container.clicked() + } + } + Image { + visible: col == index && row != 0 + source: "gfx/dialog-pointer.png" + anchors.top: parent.bottom + anchors.topMargin: 4 + anchors.horizontalCenter: parent.horizontalCenter + } + Image { + visible: col == index && row == 0 + source: "gfx/dialog-pointer.png" + rotation: 180 + anchors.bottom: parent.top + anchors.bottomMargin: 6 + anchors.horizontalCenter: parent.horizontalCenter + } +} diff --git a/examples/quick/demos/maroon/content/GameCanvas.qml b/examples/quick/demos/maroon/content/GameCanvas.qml new file mode 100644 index 0000000000..5e6e963e84 --- /dev/null +++ b/examples/quick/demos/maroon/content/GameCanvas.qml @@ -0,0 +1,240 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "logic.js" as Logic +import "towers" as Towers + +Item { + id: grid + + property int squareSize: 64 + property int rows: 6 + property int cols: 4 + property Item canvas: grid + property int score: 0 + property int coins: 100 + property int lives: 3 + property int waveNumber: 0 + property int waveProgress: 0 + property var towers + property var mobs + property bool gameRunning: false + property bool gameOver: false + property bool errored: false + property string errorString: "" + + width: cols * squareSize + height: rows * squareSize + + function freshState() { + lives = 3 + coins = 100 + score = 0 + waveNumber = 0 + waveProgress = 0 + gameOver = false + gameRunning = false + towerMenu.shown = false + helpButton.comeBack(); + } + + Text { + id: errorText // Mostly for debug purposes + text: errorString + visible: errored + color: "red" + font.pixelSize: 18 + wrapMode: Text.WordWrap + width: parent.width / 1.2 + height: parent.height / 1.2 + anchors.centerIn: parent + z: 1000 + } + + Timer { + interval: 16 + running: true + repeat: true + onTriggered: Logic.tick() + } + + MouseArea { + id: ma + anchors.fill: parent + onClicked: { + if (towerMenu.visible) + towerMenu.finish() + else + towerMenu.open(mouse.x, mouse.y) + } + } + + Image { + id: towerMenu + visible: false + z: 1500 + scale: 0.9 + opacity: 0.7 + property int dragDistance: 16 + property int targetRow: 0 + property int targetCol: 0 + property bool shown: false + property bool towerExists: false + + function finish() { + shown = false + } + + function open(xp,yp) { + if (!grid.gameRunning) + return + targetRow = Logic.row(yp) + targetCol = Logic.col(xp) + if (targetRow == 0) + towerMenu.y = (targetRow + 1) * grid.squareSize + else + towerMenu.y = (targetRow - 1) * grid.squareSize + towerExists = (grid.towers[Logic.towerIdx(targetCol, targetRow)] != null) + shown = true + helpButton.goAway(); + } + + states: State { + name: "shown"; when: towerMenu.shown && !grid.gameOver + PropertyChanges { target: towerMenu; visible: true; scale: 1; opacity: 1 } + } + + transitions: Transition { + PropertyAction { property: "visible" } + NumberAnimation { properties: "opacity,scale"; duration: 500; easing.type: Easing.OutElastic } + } + + x: -32 + source: "gfx/dialog.png" + Row { + id: buttonRow + height: 100 + anchors.centerIn: parent + spacing: 8 + BuildButton { + row: towerMenu.targetRow; col: towerMenu.targetCol + anchors.verticalCenter: parent.verticalCenter + towerType: 1; index: 0 + canBuild: !towerMenu.towerExists + source: "gfx/dialog-melee.png" + onClicked: towerMenu.finish() + } + BuildButton { + row: towerMenu.targetRow; col: towerMenu.targetCol + anchors.verticalCenter: parent.verticalCenter + towerType: 2; index: 1 + canBuild: !towerMenu.towerExists + source: "gfx/dialog-shooter.png" + onClicked: towerMenu.finish() + } + BuildButton { + row: towerMenu.targetRow; col: towerMenu.targetCol + anchors.verticalCenter: parent.verticalCenter + towerType: 3; index: 2 + canBuild: !towerMenu.towerExists + source: "gfx/dialog-bomb.png" + onClicked: towerMenu.finish() + } + BuildButton { + row: towerMenu.targetRow; col: towerMenu.targetCol + anchors.verticalCenter: parent.verticalCenter + towerType: 4; index: 3 + canBuild: !towerMenu.towerExists + source: "gfx/dialog-factory.png" + onClicked: towerMenu.finish() + } + } + } + + + Keys.onPressed: { // Cheat Codes while Testing + if (event.key == Qt.Key_Up && (event.modifiers & Qt.ShiftModifier)) + grid.coins += 10; + if (event.key == Qt.Key_Left && (event.modifiers & Qt.ShiftModifier)) + grid.lives += 1; + if (event.key == Qt.Key_Down && (event.modifiers & Qt.ShiftModifier)) + Logic.gameState.waveProgress += 1000; + if (event.key == Qt.Key_Right && (event.modifiers & Qt.ShiftModifier)) + Logic.endGame(); + } + + Image { + id: helpButton + z: 1010 + source: "gfx/button-help.png" + function goAway() { + helpMA.enabled = false; + helpButton.opacity = 0; + } + function comeBack() { + helpMA.enabled = true; + helpButton.opacity = 1; + } + Behavior on opacity { NumberAnimation {} } + MouseArea { + id: helpMA + anchors.fill: parent + onClicked: {helpImage.visible = true; helpButton.visible = false;} + } + + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: 0 + } + + Image { + id: helpImage + z: 1010 + source: "gfx/help.png" + anchors.fill: parent + visible: false + MouseArea { + anchors.fill: parent + onClicked: helpImage.visible = false; + } + } + +} diff --git a/examples/quick/demos/maroon/content/GameOverScreen.qml b/examples/quick/demos/maroon/content/GameOverScreen.qml new file mode 100644 index 0000000000..dfb439fbb9 --- /dev/null +++ b/examples/quick/demos/maroon/content/GameOverScreen.qml @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "logic.js" as Logic + +Item { + id: gameOverScreen + width: 320 + height: 400 + property GameCanvas gameCanvas + + Image { + id: img + source: "gfx/text-gameover.png" + anchors.centerIn: parent + } + + ParticleSystem { + anchors.fill: parent + ImageParticle { + id: cloud + source: "gfx/cloud.png" + alphaVariation: 0.25 + opacity: 0.25 + } + + Wander { + xVariance: 100; + pace: 1; + } + + Emitter { + id: cloudLeft + width: 160 + height: 160 + anchors.right: parent.left + emitRate: 0.5 + lifeSpan: 12000 + velocity: PointDirection{ x: 64; xVariation: 2; yVariation: 2 } + size: 160 + } + + Emitter { + id: cloudRight + width: 160 + height: 160 + anchors.left: parent.right + emitRate: 0.5 + lifeSpan: 12000 + velocity: PointDirection{ x: -64; xVariation: 2; yVariation: 2 } + size: 160 + } + } + + + Text { + visible: gameCanvas != undefined + text: "You saved " + gameCanvas.score + " fishes!" + anchors.top: img.bottom + anchors.topMargin: 12 + anchors.horizontalCenter: parent.horizontalCenter + font.bold: true + color: "#000000" + opacity: 0.5 + } + + Image { + source: "gfx/button-play.png" + anchors.bottom: parent.bottom + anchors.bottomMargin: 0 + MouseArea { + anchors.fill: parent + onClicked: gameCanvas.gameOver = false//This will actually trigger the state change in main.qml + } + } +} diff --git a/examples/quick/demos/maroon/content/InfoBar.qml b/examples/quick/demos/maroon/content/InfoBar.qml new file mode 100644 index 0000000000..36303fc4fe --- /dev/null +++ b/examples/quick/demos/maroon/content/InfoBar.qml @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 { + height: childrenRect.height + + // Display the number of lives + Row { + anchors.left: parent.left + anchors.leftMargin: 10 + spacing: 5 + Repeater { + id: rep + model: Math.min(10, canvas.lives) + delegate: Image { source: "gfx/lifes.png" } + } + } + + // Display the number of fishes saved + Row { + anchors.right: points.left + anchors.rightMargin: 20 + spacing: 5 + Image { source: "gfx/scores.png" } + Text { + text: canvas.score + font.bold: true + } + } + + // Display the number of coins + Row { + id: points + anchors.right: parent.right + anchors.rightMargin: 10 + spacing: 5 + Image { source: "gfx/points.png" } + Text { + id: pointsLabel + text: canvas.coins + font.bold: true + } + } +} + diff --git a/examples/quick/demos/maroon/content/NewGameScreen.qml b/examples/quick/demos/maroon/content/NewGameScreen.qml new file mode 100644 index 0000000000..495e3aaa8e --- /dev/null +++ b/examples/quick/demos/maroon/content/NewGameScreen.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 the first screen. +// It shows the logo and emit a startButtonClicked signal +// when the user press the "PLAY" button. + +Item { + id: newGameScreen + width: 320 + height: 480 + + signal startButtonClicked + + Image { + source: "gfx/logo.png" + anchors.top: parent.top + anchors.topMargin: 60 + } + + Image { + source: "gfx/logo-fish.png" + anchors.top: parent.top + + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { from: x + 148; to: x + 25; duration: 2000; easing.type: Easing.InOutQuad } + NumberAnimation { from: x + 25; to: x + 148; duration: 1600; easing.type: Easing.InOutQuad } + } + SequentialAnimation on anchors.topMargin { + loops: Animation.Infinite + NumberAnimation { from: 100; to: 60; duration: 1600; easing.type: Easing.InOutQuad } + NumberAnimation { from: 60; to: 100; duration: 2000; easing.type: Easing.InOutQuad } + } + } + + Image { + source: "gfx/logo-bubble.png" + anchors.top: parent.top + + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { from: x + 140; to: x + 40; duration: 2000; easing.type: Easing.InOutQuad } + NumberAnimation { from: x + 40; to: x + 140; duration: 1600; easing.type: Easing.InOutQuad } + } + SequentialAnimation on anchors.topMargin { + loops: Animation.Infinite + NumberAnimation { from: 100; to: 60; duration: 1600; easing.type: Easing.InOutQuad } + NumberAnimation { from: 60; to: 100; duration: 2000; easing.type: Easing.InOutQuad } + } + SequentialAnimation on width { + loops: Animation.Infinite + NumberAnimation { from: 140; to: 160; duration: 1000; easing.type: Easing.InOutQuad } + NumberAnimation { from: 160; to: 140; duration: 800; easing.type: Easing.InOutQuad } + } + SequentialAnimation on height { + loops: Animation.Infinite + NumberAnimation { from: 150; to: 140; duration: 800; easing.type: Easing.InOutQuad } + NumberAnimation { from: 140; to: 150; duration: 1000; easing.type: Easing.InOutQuad } + } + } + + Image { + source: "gfx/button-play.png" + anchors.bottom: parent.bottom + anchors.bottomMargin: 60 + MouseArea { + anchors.fill: parent + onClicked: newGameScreen.startButtonClicked() + } + } +} diff --git a/examples/quick/demos/maroon/content/SoundEffect.qml b/examples/quick/demos/maroon/content/SoundEffect.qml new file mode 100644 index 0000000000..d286a397c1 --- /dev/null +++ b/examples/quick/demos/maroon/content/SoundEffect.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 +//Proxies a SoundEffect if QtMultimedia is installed +Item { + id: container + property QtObject effect: Qt.createQmlObject("import QtMultimedia 5.0; SoundEffect{ source: '" + container.source + "' }", container); + property url source: "" + onSourceChanged: if (effect != null) effect.source = source; + function play() { + if (effect != null) + effect.play(); + } + +} diff --git a/examples/quick/demos/maroon/content/audio/bomb-action.wav b/examples/quick/demos/maroon/content/audio/bomb-action.wav new file mode 100644 index 0000000000..b334dc1e5b Binary files /dev/null and b/examples/quick/demos/maroon/content/audio/bomb-action.wav differ diff --git a/examples/quick/demos/maroon/content/audio/catch-action.wav b/examples/quick/demos/maroon/content/audio/catch-action.wav new file mode 100644 index 0000000000..3e22124abf Binary files /dev/null and b/examples/quick/demos/maroon/content/audio/catch-action.wav differ diff --git a/examples/quick/demos/maroon/content/audio/catch.wav b/examples/quick/demos/maroon/content/audio/catch.wav new file mode 100644 index 0000000000..d3eade87f8 Binary files /dev/null and b/examples/quick/demos/maroon/content/audio/catch.wav differ diff --git a/examples/quick/demos/maroon/content/audio/currency.wav b/examples/quick/demos/maroon/content/audio/currency.wav new file mode 100644 index 0000000000..0d9ef2c200 Binary files /dev/null and b/examples/quick/demos/maroon/content/audio/currency.wav differ diff --git a/examples/quick/demos/maroon/content/audio/factory-action.wav b/examples/quick/demos/maroon/content/audio/factory-action.wav new file mode 100644 index 0000000000..a2ace6c221 Binary files /dev/null and b/examples/quick/demos/maroon/content/audio/factory-action.wav differ diff --git a/examples/quick/demos/maroon/content/audio/melee-action.wav b/examples/quick/demos/maroon/content/audio/melee-action.wav new file mode 100644 index 0000000000..d325af4700 Binary files /dev/null and b/examples/quick/demos/maroon/content/audio/melee-action.wav differ diff --git a/examples/quick/demos/maroon/content/audio/projectile-action.wav b/examples/quick/demos/maroon/content/audio/projectile-action.wav new file mode 100644 index 0000000000..4e2284fceb Binary files /dev/null and b/examples/quick/demos/maroon/content/audio/projectile-action.wav differ diff --git a/examples/quick/demos/maroon/content/audio/shooter-action.wav b/examples/quick/demos/maroon/content/audio/shooter-action.wav new file mode 100644 index 0000000000..3e12b9419a Binary files /dev/null and b/examples/quick/demos/maroon/content/audio/shooter-action.wav differ diff --git a/examples/quick/demos/maroon/content/gfx/background.png b/examples/quick/demos/maroon/content/gfx/background.png new file mode 100644 index 0000000000..d548b9314e Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/background.png differ diff --git a/examples/quick/demos/maroon/content/gfx/bomb-action.png b/examples/quick/demos/maroon/content/gfx/bomb-action.png new file mode 100644 index 0000000000..42da5d789f Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/bomb-action.png differ diff --git a/examples/quick/demos/maroon/content/gfx/bomb-idle.png b/examples/quick/demos/maroon/content/gfx/bomb-idle.png new file mode 100644 index 0000000000..3bd62e261d Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/bomb-idle.png differ diff --git a/examples/quick/demos/maroon/content/gfx/bomb.png b/examples/quick/demos/maroon/content/gfx/bomb.png new file mode 100644 index 0000000000..380da7d1a5 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/bomb.png differ diff --git a/examples/quick/demos/maroon/content/gfx/button-help.png b/examples/quick/demos/maroon/content/gfx/button-help.png new file mode 100644 index 0000000000..aecebc1275 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/button-help.png differ diff --git a/examples/quick/demos/maroon/content/gfx/button-play.png b/examples/quick/demos/maroon/content/gfx/button-play.png new file mode 100644 index 0000000000..6cdad6c845 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/button-play.png differ diff --git a/examples/quick/demos/maroon/content/gfx/catch-action.png b/examples/quick/demos/maroon/content/gfx/catch-action.png new file mode 100644 index 0000000000..78ca9fe1cc Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/catch-action.png differ diff --git a/examples/quick/demos/maroon/content/gfx/catch.png b/examples/quick/demos/maroon/content/gfx/catch.png new file mode 100644 index 0000000000..b7620fe3de Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/catch.png differ diff --git a/examples/quick/demos/maroon/content/gfx/cloud.png b/examples/quick/demos/maroon/content/gfx/cloud.png new file mode 100644 index 0000000000..d7c35f8555 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/cloud.png differ diff --git a/examples/quick/demos/maroon/content/gfx/currency.png b/examples/quick/demos/maroon/content/gfx/currency.png new file mode 100644 index 0000000000..1571341f6c Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/currency.png differ diff --git a/examples/quick/demos/maroon/content/gfx/dialog-bomb.png b/examples/quick/demos/maroon/content/gfx/dialog-bomb.png new file mode 100644 index 0000000000..708d916ad7 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/dialog-bomb.png differ diff --git a/examples/quick/demos/maroon/content/gfx/dialog-factory.png b/examples/quick/demos/maroon/content/gfx/dialog-factory.png new file mode 100644 index 0000000000..d2e2a48e31 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/dialog-factory.png differ diff --git a/examples/quick/demos/maroon/content/gfx/dialog-melee.png b/examples/quick/demos/maroon/content/gfx/dialog-melee.png new file mode 100644 index 0000000000..069d18d477 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/dialog-melee.png differ diff --git a/examples/quick/demos/maroon/content/gfx/dialog-pointer.png b/examples/quick/demos/maroon/content/gfx/dialog-pointer.png new file mode 100644 index 0000000000..9b51a090f9 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/dialog-pointer.png differ diff --git a/examples/quick/demos/maroon/content/gfx/dialog-shooter.png b/examples/quick/demos/maroon/content/gfx/dialog-shooter.png new file mode 100644 index 0000000000..af980caabd Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/dialog-shooter.png differ diff --git a/examples/quick/demos/maroon/content/gfx/dialog.png b/examples/quick/demos/maroon/content/gfx/dialog.png new file mode 100644 index 0000000000..d528ba78d1 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/dialog.png differ diff --git a/examples/quick/demos/maroon/content/gfx/factory-action.png b/examples/quick/demos/maroon/content/gfx/factory-action.png new file mode 100644 index 0000000000..8981678267 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/factory-action.png differ diff --git a/examples/quick/demos/maroon/content/gfx/factory-idle.png b/examples/quick/demos/maroon/content/gfx/factory-idle.png new file mode 100644 index 0000000000..a145582c8f Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/factory-idle.png differ diff --git a/examples/quick/demos/maroon/content/gfx/factory.png b/examples/quick/demos/maroon/content/gfx/factory.png new file mode 100644 index 0000000000..bfb9f3fb79 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/factory.png differ diff --git a/examples/quick/demos/maroon/content/gfx/grid.png b/examples/quick/demos/maroon/content/gfx/grid.png new file mode 100644 index 0000000000..b59555247a Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/grid.png differ diff --git a/examples/quick/demos/maroon/content/gfx/help.png b/examples/quick/demos/maroon/content/gfx/help.png new file mode 100644 index 0000000000..4654e4c69b Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/help.png differ diff --git a/examples/quick/demos/maroon/content/gfx/lifes.png b/examples/quick/demos/maroon/content/gfx/lifes.png new file mode 100644 index 0000000000..135310b38c Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/lifes.png differ diff --git a/examples/quick/demos/maroon/content/gfx/logo-bubble.png b/examples/quick/demos/maroon/content/gfx/logo-bubble.png new file mode 100644 index 0000000000..136151caff Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/logo-bubble.png differ diff --git a/examples/quick/demos/maroon/content/gfx/logo-fish.png b/examples/quick/demos/maroon/content/gfx/logo-fish.png new file mode 100644 index 0000000000..c41833a0c9 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/logo-fish.png differ diff --git a/examples/quick/demos/maroon/content/gfx/logo.png b/examples/quick/demos/maroon/content/gfx/logo.png new file mode 100644 index 0000000000..787ac99ce8 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/logo.png differ diff --git a/examples/quick/demos/maroon/content/gfx/melee-action.png b/examples/quick/demos/maroon/content/gfx/melee-action.png new file mode 100644 index 0000000000..c53873bfcc Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/melee-action.png differ diff --git a/examples/quick/demos/maroon/content/gfx/melee-idle.png b/examples/quick/demos/maroon/content/gfx/melee-idle.png new file mode 100644 index 0000000000..621d9dff54 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/melee-idle.png differ diff --git a/examples/quick/demos/maroon/content/gfx/melee.png b/examples/quick/demos/maroon/content/gfx/melee.png new file mode 100644 index 0000000000..ab240151f3 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/melee.png differ diff --git a/examples/quick/demos/maroon/content/gfx/mob-idle.png b/examples/quick/demos/maroon/content/gfx/mob-idle.png new file mode 100644 index 0000000000..dedacc7866 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/mob-idle.png differ diff --git a/examples/quick/demos/maroon/content/gfx/mob.png b/examples/quick/demos/maroon/content/gfx/mob.png new file mode 100644 index 0000000000..7569c3525a Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/mob.png differ diff --git a/examples/quick/demos/maroon/content/gfx/points.png b/examples/quick/demos/maroon/content/gfx/points.png new file mode 100644 index 0000000000..1d2386dbe7 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/points.png differ diff --git a/examples/quick/demos/maroon/content/gfx/projectile-action.png b/examples/quick/demos/maroon/content/gfx/projectile-action.png new file mode 100644 index 0000000000..aa2e650aeb Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/projectile-action.png differ diff --git a/examples/quick/demos/maroon/content/gfx/projectile.png b/examples/quick/demos/maroon/content/gfx/projectile.png new file mode 100644 index 0000000000..c25a0c3890 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/projectile.png differ diff --git a/examples/quick/demos/maroon/content/gfx/scores.png b/examples/quick/demos/maroon/content/gfx/scores.png new file mode 100644 index 0000000000..af757fe64a Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/scores.png differ diff --git a/examples/quick/demos/maroon/content/gfx/shooter-action.png b/examples/quick/demos/maroon/content/gfx/shooter-action.png new file mode 100644 index 0000000000..08e7e300ca Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/shooter-action.png differ diff --git a/examples/quick/demos/maroon/content/gfx/shooter-idle.png b/examples/quick/demos/maroon/content/gfx/shooter-idle.png new file mode 100644 index 0000000000..663098d3b0 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/shooter-idle.png differ diff --git a/examples/quick/demos/maroon/content/gfx/shooter.png b/examples/quick/demos/maroon/content/gfx/shooter.png new file mode 100644 index 0000000000..d44401e055 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/shooter.png differ diff --git a/examples/quick/demos/maroon/content/gfx/sunlight.png b/examples/quick/demos/maroon/content/gfx/sunlight.png new file mode 100644 index 0000000000..d1c7042117 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/sunlight.png differ diff --git a/examples/quick/demos/maroon/content/gfx/text-1.png b/examples/quick/demos/maroon/content/gfx/text-1.png new file mode 100644 index 0000000000..3ea399cc90 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/text-1.png differ diff --git a/examples/quick/demos/maroon/content/gfx/text-2.png b/examples/quick/demos/maroon/content/gfx/text-2.png new file mode 100644 index 0000000000..934a481f3b Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/text-2.png differ diff --git a/examples/quick/demos/maroon/content/gfx/text-3.png b/examples/quick/demos/maroon/content/gfx/text-3.png new file mode 100644 index 0000000000..47523f55b8 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/text-3.png differ diff --git a/examples/quick/demos/maroon/content/gfx/text-blank.png b/examples/quick/demos/maroon/content/gfx/text-blank.png new file mode 100644 index 0000000000..4a687b24dc Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/text-blank.png differ diff --git a/examples/quick/demos/maroon/content/gfx/text-gameover.png b/examples/quick/demos/maroon/content/gfx/text-gameover.png new file mode 100644 index 0000000000..4f53ef0b29 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/text-gameover.png differ diff --git a/examples/quick/demos/maroon/content/gfx/text-go.png b/examples/quick/demos/maroon/content/gfx/text-go.png new file mode 100644 index 0000000000..bfc26f71fc Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/text-go.png differ diff --git a/examples/quick/demos/maroon/content/gfx/wave.png b/examples/quick/demos/maroon/content/gfx/wave.png new file mode 100644 index 0000000000..f97426c4e7 Binary files /dev/null and b/examples/quick/demos/maroon/content/gfx/wave.png differ diff --git a/examples/quick/demos/maroon/content/logic.js b/examples/quick/demos/maroon/content/logic.js new file mode 100644 index 0000000000..dd76b7e073 --- /dev/null +++ b/examples/quick/demos/maroon/content/logic.js @@ -0,0 +1,264 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +.pragma library // Shared game state +.import QtQuick 2.0 as QQ + +// Game Stuff +var gameState // Local reference +function getGameState() { return gameState; } + +var towerData = [ // Name and cost, stats are in the delegate per instance + { "name": "Melee", "cost": 20 }, + { "name": "Ranged", "cost": 50 }, + { "name": "Bomb", "cost": 75 }, + { "name": "Factory", "cost": 25 } +] + +var waveBaseData = [300, 290, 280, 270, 220, 180, 160, 80, 80, 80, 30, 30, 30, 30]; +var waveData = []; + +var towerComponents = new Array(towerData.length); +var mobComponent = Qt.createComponent("mobs/MobBase.qml"); + +function endGame() +{ + gameState.gameRunning = false; + gameState.gameOver = true; + for (var i = 0; i < gameState.cols; i++) { + for (var j = 0; j < gameState.rows; j++) { + if (gameState.towers[towerIdx(i, j)]) { + gameState.towers[towerIdx(i, j)].destroy(); + gameState.towers[towerIdx(i, j)] = null; + } + } + for (var j in gameState.mobs[i]) + gameState.mobs[i][j].destroy(); + gameState.mobs[i].splice(0,gameState.mobs[i].length); //Leaves queue reusable + } +} + +function startGame(gameCanvas) +{ + waveData = new Array(); + for (var i in waveBaseData) + waveData[i] = waveBaseData[i]; + gameState.freshState(); + for (var i = 0; i < gameCanvas.cols; i++) { + for (var j = 0; j < gameCanvas.rows; j++) + gameState.towers[towerIdx(i, j)] = null; + gameState.mobs[i] = new Array(); + } + gameState.towers[towerIdx(0, 0)] = newTower(3, 0, 0);//Start with a starfish in the corner + gameState.gameRunning = true; + gameState.gameOver = false; +} + +function newGameState(gameCanvas) +{ + for (var i = 0; i < towerComponents.length; i++) { + towerComponents[i] = Qt.createComponent("towers/" + towerData[i].name + ".qml"); + if (towerComponents[i].status == QQ.Component.Error) { + gameCanvas.errored = true; + gameCanvas.errorString += "Loading Tower " + towerData[i].name + "\n" + (towerComponents[i].errorString()); + console.log(towerComponents[i].errorString()); + } + } + gameState = gameCanvas; + gameState.freshState(); + gameState.towers = new Array(gameCanvas.rows * gameCanvas.cols); + gameState.mobs = new Array(gameCanvas.cols); + return gameState; +} + +function row(y) +{ + return Math.floor(y / gameState.squareSize); +} + +function col(x) +{ + return Math.floor(x / gameState.squareSize); +} + +function towerIdx(x, y) +{ + return y + (x * gameState.rows); +} + +function newMob(col) +{ + var ret = mobComponent.createObject(gameState.canvas, + { "col" : col, + "speed" : (Math.min(2.0, 0.10 * (gameState.waveNumber + 1))), + "y" : gameState.canvas.height }); + gameState.mobs[col].push(ret); + return ret; +} + +function newTower(type, row, col) +{ + var ret = towerComponents[type].createObject(gameState.canvas); + ret.row = row; + ret.col = col; + ret.fireCounter = ret.rof; + ret.spawn(); + return ret; +} + +function buildTower(type, x, y) +{ + if (gameState.towers[towerIdx(x,y)] != null) { + if (type <= 0) { + gameState.towers[towerIdx(x,y)].sell(); + gameState.towers[towerIdx(x,y)] = null; + } + } else { + if (gameState.coins < towerData[type - 1].cost) + return; + gameState.towers[towerIdx(x, y)] = newTower(type - 1, y, x); + gameState.coins -= towerData[type - 1].cost; + } +} + +function killMob(col, mob) +{ + if (!mob) + return; + var idx = gameState.mobs[col].indexOf(mob); + if (idx == -1 || !mob.hp) + return; + mob.hp = 0; + mob.die(); + gameState.mobs[col].splice(idx,1); +} + +function killTower(row, col) +{ + var tower = gameState.towers[towerIdx(col, row)]; + if (!tower) + return; + tower.hp = 0; + tower.die(); + gameState.towers[towerIdx(col, row)] = null; +} + +function tick() +{ + if (!gameState.gameRunning) + return; + + // Spawn + gameState.waveProgress += 1; + var i = gameState.waveProgress; + var j = 0; + while (i > 0 && j < waveData.length) + i -= waveData[j++]; + if ( i == 0 ) // Spawn a mob + newMob(Math.floor(Math.random() * gameState.cols)); + if ( j == waveData.length ) { // Next Wave + gameState.waveNumber += 1; + gameState.waveProgress = 0; + var waveModifier = 10; // Constant governing how much faster the next wave is to spawn (not fish speed) + for (var k in waveData ) // Slightly faster + if (waveData[k] > waveModifier) + waveData[k] -= waveModifier; + } + + // Towers Attack + for (var j in gameState.towers) { + var tower = gameState.towers[j]; + if (tower == null) + continue; + if (tower.fireCounter > 0) { + tower.fireCounter -= 1; + continue; + } + var column = tower.col; + for (var k in gameState.mobs[column]) { + var conflict = gameState.mobs[column][k]; + if (conflict.y <= gameState.canvas.height && conflict.y + conflict.height > tower.y + && conflict.y - ((tower.row + 1) * gameState.squareSize) < gameState.squareSize * tower.range) { // In Range + tower.fire(); + tower.fireCounter = tower.rof; + conflict.hit(tower.damage); + } + } + + // Income + if (tower.income) { + gameState.coins += tower.income; + tower.fire(); + tower.fireCounter = tower.rof; + } + } + + // Mobs move + for (var i = 0; i < gameState.cols; i++) { + for (var j = 0; j < gameState.mobs[i].length; j++) { + var mob = gameState.mobs[i][j]; + var newPos = gameState.mobs[i][j].y - gameState.mobs[i][j].speed; + if (newPos < 0) { + gameState.lives -= 1; + killMob(i, mob); + if (gameState.lives <= 0) + endGame(); + continue; + } + var conflict = gameState.towers[towerIdx(i, row(newPos))]; + if (conflict != null) { + if (mob.y < conflict.y + gameState.squareSize) + gameState.mobs[i][j].y += gameState.mobs[i][j].speed * 10; // Moved inside tower, now hurry back out + if (mob.fireCounter > 0) { + mob.fireCounter--; + } else { + gameState.mobs[i][j].fire(); + conflict.hp -= mob.damage; + if (conflict.hp <= 0) + killTower(conflict.row, conflict.col); + mob.fireCounter = mob.rof; + } + } else { + gameState.mobs[i][j].y = newPos; + } + } + } + +} diff --git a/examples/quick/demos/maroon/content/mobs/MobBase.qml b/examples/quick/demos/maroon/content/mobs/MobBase.qml new file mode 100644 index 0000000000..d4ece660ed --- /dev/null +++ b/examples/quick/demos/maroon/content/mobs/MobBase.qml @@ -0,0 +1,262 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "../logic.js" as Logic +import ".." + +Item { + id: container + property string name: "Fish" + property int col: 0 + property real hp: 3 + property real damage: 1 + property real speed: 0.25 + property int rof: 30 //In ticks + property int fireCounter: 0 + property bool dying: false + width: parent ? parent.squareSize : 0 + height: parent ? parent.squareSize : 0 + x: col * width + z: 1001 + function fire() { } + + function die() { + if (dying) + return; + dying = true; + bubble.jumpTo("burst"); + if (fishSprite.currentSprite == "front") + fishSprite.jumpTo(Math.random() > 0.5 ? "left" : "right" ); + fishSwim.start(); + Logic.gameState.score += 1; + killedSound.play(); + bubble.scale = 0.9 + destroy(350); + } + + function inked() { + if (hp > 0) + ink.jumpTo("dirty"); + } + + function hit(dmg) { + hp -= dmg; + + if (hp <= 0) + Logic.killMob(col, container); + } + + Component.onCompleted: spawnSound.play() + + SoundEffect { + id: spawnSound + source: "../audio/catch.wav" + } + SoundEffect { + id: killedSound + source: "../audio/catch-action.wav" + } + + SpriteSequence { + id: fishSprite + width: 64 + height: 64 + interpolate: false + goalSprite: "" + + Sprite { + name: "left" + source: "../gfx/mob-idle.png" + frameWidth: 64 + frameHeight: 64 + frameCount: 1 + frameDuration: 800 + frameDurationVariation: 400 + to: { "front" : 1 } + } + + Sprite { + name: "front" + source: "../gfx/mob-idle.png" + frameCount: 1 + frameX: 64 + frameWidth: 64 + frameHeight: 64 + frameDuration: 800 + frameDurationVariation: 400 + to: { "left" : 1, "right" : 1 } + } + + Sprite { + name: "right" + source: "../gfx/mob-idle.png" + frameCount: 1 + frameX: 128 + frameWidth: 64 + frameHeight: 64 + frameDuration: 800 + frameDurationVariation: 400 + to: { "front" : 1 } + } + + + Sprite { //WORKAROUND: This prevents the triggering of a rendering error which is currently under investigation. + name: "dummy" + source: "../gfx/melee-idle.png" + frameCount: 8 + frameWidth: 64 + frameHeight: 64 + frameX: 0 + frameDuration: 200 + } + + NumberAnimation on x { + id: fishSwim + running: false + property bool goingLeft: fishSprite.currentSprite == "right" + to: goingLeft ? -360 : 360 + duration: 300 + } + } + + SpriteSequence { + id: bubble + width: 64 + height: 64 + scale: 0.4 + (0.2 * hp) + interpolate: false + goalSprite: "" + + Behavior on scale { + NumberAnimation { duration: 150; easing.type: Easing.OutBack } + } + + Sprite { + name: "big" + source: "../gfx/catch.png" + frameCount: 1 + to: { "burst" : 0 } + } + + Sprite { + name: "burst" + source: "../gfx/catch-action.png" + frameCount: 3 + frameX: 64 + frameDuration: 200 + } + + Sprite { //WORKAROUND: This prevents the triggering of a rendering error which is currently under investigation. + name: "dummy" + source: "../gfx/melee-idle.png" + frameCount: 8 + frameWidth: 64 + frameHeight: 64 + frameX: 0 + frameDuration: 200 + } + SequentialAnimation on width { + loops: Animation.Infinite + NumberAnimation { from: width * 1; to: width * 1.1; duration: 800; easing.type: Easing.InOutQuad } + NumberAnimation { from: width * 1.1; to: width * 1; duration: 1000; easing.type: Easing.InOutQuad } + } + SequentialAnimation on height { + loops: Animation.Infinite + NumberAnimation { from: height * 1; to: height * 1.15; duration: 1200; easing.type: Easing.InOutQuad } + NumberAnimation { from: height * 1.15; to: height * 1; duration: 1000; easing.type: Easing.InOutQuad } + } + } + + SpriteSequence { + id: ink + width: 64 + height: 64 + scale: bubble.scale + goalSprite: "" + + Sprite { + name: "clean" + source: "../gfx/projectile-action.png" + frameCount: 1 + frameX: 0 + frameWidth: 64 + frameHeight: 64 + } + Sprite { + name: "dirty" + source: "../gfx/projectile-action.png" + frameCount: 3 + frameX: 64 + frameWidth: 64 + frameHeight: 64 + frameDuration: 150 + to: {"clean":1} + } + + Sprite { //WORKAROUND: This prevents the triggering of a rendering error which is currently under investigation. + name: "dummy" + source: "../gfx/melee-idle.png" + frameCount: 8 + frameWidth: 64 + frameHeight: 64 + frameX: 0 + frameDuration: 200 + } + SequentialAnimation on width { + loops: Animation.Infinite + NumberAnimation { from: width * 1; to: width * 1.1; duration: 800; easing.type: Easing.InOutQuad } + NumberAnimation { from: width * 1.1; to: width * 1; duration: 1000; easing.type: Easing.InOutQuad } + } + SequentialAnimation on height { + loops: Animation.Infinite + NumberAnimation { from: height * 1; to: height * 1.15; duration: 1200; easing.type: Easing.InOutQuad } + NumberAnimation { from: height * 1.15; to: height * 1; duration: 1000; easing.type: Easing.InOutQuad } + } + + } + + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { from: x; to: x - 5; duration: 900; easing.type: Easing.InOutQuad } + NumberAnimation { from: x - 5; to: x; duration: 900; easing.type: Easing.InOutQuad } + } +} + diff --git a/examples/quick/demos/maroon/content/towers/Bomb.qml b/examples/quick/demos/maroon/content/towers/Bomb.qml new file mode 100644 index 0000000000..00437f468f --- /dev/null +++ b/examples/quick/demos/maroon/content/towers/Bomb.qml @@ -0,0 +1,133 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "../logic.js" as Logic +import ".." + +TowerBase { + id: container + hp: 10 + range: 0.4 + rof: 10 + property real detonationRange: 2.5 + + function fire() { + sound.play() + sprite.jumpTo("shoot") + animDelay.start() + } + + function finishFire() { + var sCol = Math.max(0, col - 1) + var eCol = Math.min(Logic.gameState.cols - 1, col + 1) + var killList = new Array() + for (var i = sCol; i <= eCol; i++) { + for (var j = 0; j < Logic.gameState.mobs[i].length; j++) + if (Math.abs(Logic.gameState.mobs[i][j].y - container.y) < Logic.gameState.squareSize * detonationRange) + killList.push(Logic.gameState.mobs[i][j]) + while (killList.length > 0) + Logic.killMob(i, killList.pop()) + } + Logic.killTower(row, col); + } + + Timer { + id: animDelay + running: false + interval: shootState.frameCount * shootState.frameDuration + onTriggered: finishFire() + } + + function die() + { + destroy() // No blink, because we usually meant to die + } + + SoundEffect { + id: sound + source: "../audio/bomb-action.wav" + } + + SpriteSequence { + id: sprite + width: 64 + height: 64 + interpolate: false + goalSprite: "" + + Sprite { + name: "idle" + source: "../gfx/bomb-idle.png" + frameCount: 4 + frameDuration: 800 + } + + Sprite { + id: shootState + name: "shoot" + source: "../gfx/bomb-action.png" + frameCount: 6 + frameDuration: 155 + to: { "dying" : 1 } // So that if it takes a frame to clean up, it is on the last frame of the explosion + } + + Sprite { + name: "dying" + source: "../gfx/bomb-action.png" + frameCount: 1 + frameX: 64 * 5 + frameWidth: 64 + frameHeight: 64 + frameDuration: 155 + } + + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { from: x; to: x + 4; duration: 900; easing.type: Easing.InOutQuad } + NumberAnimation { from: x + 4; to: x; duration: 900; easing.type: Easing.InOutQuad } + } + SequentialAnimation on y { + loops: Animation.Infinite + NumberAnimation { from: y; to: y - 4; duration: 900; easing.type: Easing.InOutQuad } + NumberAnimation { from: y - 4; to: y; duration: 900; easing.type: Easing.InOutQuad } + } + } +} diff --git a/examples/quick/demos/maroon/content/towers/Factory.qml b/examples/quick/demos/maroon/content/towers/Factory.qml new file mode 100644 index 0000000000..b34a18498a --- /dev/null +++ b/examples/quick/demos/maroon/content/towers/Factory.qml @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "../logic.js" as Logic +import ".." + +TowerBase { + id: container + rof: 160 + income: 5 + SpriteSequence { + id: sprite + width: 64 + height: 64 + interpolate: false + goalSprite: "" + + Sprite { + name: "idle" + source: "../gfx/factory-idle.png" + frameCount: 4 + frameDuration: 200 + } + + Sprite { + name: "action" + source: "../gfx/factory-action.png" + frameCount: 4 + frameDuration: 90 + to: { "idle" : 1 } + } + + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { from: x; to: x + 4; duration: 900; easing.type: Easing.InOutQuad } + NumberAnimation { from: x + 4; to: x; duration: 900; easing.type: Easing.InOutQuad } + } + SequentialAnimation on y { + loops: Animation.Infinite + NumberAnimation { from: y; to: y - 4; duration: 900; easing.type: Easing.InOutQuad } + NumberAnimation { from: y - 4; to: y; duration: 900; easing.type: Easing.InOutQuad } + } + } + + SoundEffect { + id: actionSound + source: "../audio/factory-action.wav" + } + + function fire() { + actionSound.play() + sprite.jumpTo("action") + coinLaunch.start() + } + + function spawn() { + coin.target = Logic.gameState.mapToItem(container, 240, -32) + } + + Image { + id: coin + property var target: { "x" : 0, "y" : 0 } + source: "../gfx/currency.png" + visible: false + } + + SequentialAnimation { + id: coinLaunch + PropertyAction { target: coin; property: "visible"; value: true } + ParallelAnimation { + NumberAnimation { target: coin; property: "x"; from: 16; to: coin.target.x } + NumberAnimation { target: coin; property: "y"; from: 16; to: coin.target.y } + } + PropertyAction { target: coin; property: "visible"; value: false } + } +} diff --git a/examples/quick/demos/maroon/content/towers/Melee.qml b/examples/quick/demos/maroon/content/towers/Melee.qml new file mode 100644 index 0000000000..1b49a455aa --- /dev/null +++ b/examples/quick/demos/maroon/content/towers/Melee.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 ".." + +TowerBase { + hp: 4 + range: 0.1 + damage: 1 + rof: 40 + income: 0 + + SpriteSequence { + id: sprite + width: 64 + height: 64 + interpolate: false + goalSprite: "" + + Sprite { + name: "idle" + source: "../gfx/melee-idle.png" + frameCount: 8 + frameDuration: 250 + } + + Sprite { + name: "shoot" + source: "../gfx/melee-action.png" + frameCount: 2 + frameDuration: 200 + to: { "idle" : 1 } + } + } + + function fire() { + shootSound.play() + sprite.jumpTo("shoot") + } + + SoundEffect { + id: shootSound + source: "../audio/melee-action.wav" + } +} diff --git a/examples/quick/demos/maroon/content/towers/Ranged.qml b/examples/quick/demos/maroon/content/towers/Ranged.qml new file mode 100644 index 0000000000..33f3354fb6 --- /dev/null +++ b/examples/quick/demos/maroon/content/towers/Ranged.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "../logic.js" as Logic +import ".." + +TowerBase { + id: container + hp: 2 + range: 6 + damage: 0 // By projectile + rof: 40 + income: 0 + property var targetMob + property real realDamage: 1 + function fire() { + proj.x = 32 - proj.width / 2 + proj.y = 0 + targetMob = Logic.gameState.mobs[col][0] + projAnim.to = targetMob.y - container.y -10 + projAnim.start() + shootSound.play() + sprite.jumpTo("shoot") + } + + Image { + id: proj + y: 1000 + SequentialAnimation on y { + id: projAnim + running: false + property real to: 1000 + SmoothedAnimation { + to: projAnim.to + velocity: 400 + } + ScriptAction { + script: { + if (targetMob && targetMob.hit) { + targetMob.hit(realDamage) + targetMob.inked() + projSound.play() + } + } + } + PropertyAction { + value: 1000; + } + } + source: "../gfx/projectile.png" + } + + SoundEffect { + id: shootSound + source: "../audio/shooter-action.wav" + } + SoundEffect { + id: projSound + source: "../audio/projectile-action.wav" + } + + SpriteSequence { + id: sprite + width: 64 + height: 64 + interpolate: false + goalSprite: "" + + Sprite { + name: "idle" + source: "../gfx/shooter-idle.png" + frameCount: 4 + frameDuration: 250 + } + + Sprite { + name: "shoot" + source: "../gfx/shooter-action.png" + frameCount: 5 + frameDuration: 90 + to: { "idle" : 1 } + } + + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { from: x; to: x - 4; duration: 900; easing.type: Easing.InOutQuad } + NumberAnimation { from: x - 4; to: x; duration: 900; easing.type: Easing.InOutQuad } + } + } +} diff --git a/examples/quick/demos/maroon/content/towers/TowerBase.qml b/examples/quick/demos/maroon/content/towers/TowerBase.qml new file mode 100644 index 0000000000..5c71cb051f --- /dev/null +++ b/examples/quick/demos/maroon/content/towers/TowerBase.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 real hp: 1 + property real range: 0 + property real damage: 0 + property int rof: 100 + property int fireCounter: 0 + property int income: 0 + property int row: 0 + property int col: 0 + + width: parent ? parent.squareSize : 0 + height: parent ? parent.squareSize : 0 + //This is how it is placed on the gameboard, do not modify/animate the X/Y/Z of a TowerBase please + x: col * width + y: row * height + z: 1000 + + function fire() { } + function spawn() { } //After all game properties are set + function die() { stdDeath.start(); destroy(1000); } + function sell() { destroy(); } + + SequentialAnimation on opacity { + id: stdDeath + running: false + loops: 2 + NumberAnimation { from: 1; to: 0; } + NumberAnimation { from: 0; to: 1; } + } +} diff --git a/examples/quick/demos/maroon/main.cpp b/examples/quick/demos/maroon/main.cpp new file mode 100644 index 0000000000..da2343e444 --- /dev/null +++ b/examples/quick/demos/maroon/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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(maroon) diff --git a/examples/quick/demos/maroon/maroon.pro b/examples/quick/demos/maroon/maroon.pro new file mode 100644 index 0000000000..e193927e72 --- /dev/null +++ b/examples/quick/demos/maroon/maroon.pro @@ -0,0 +1,9 @@ +TEMPLATE = app + +QT += qml quick +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/maroon +qml.files = maroon.qml content +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/maroon +INSTALLS += target qml diff --git a/examples/quick/demos/maroon/maroon.qml b/examples/quick/demos/maroon/maroon.qml new file mode 100644 index 0000000000..d7bfcb6a66 --- /dev/null +++ b/examples/quick/demos/maroon/maroon.qml @@ -0,0 +1,233 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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" +import "content/logic.js" as Logic + +Item { + id: root + width: 320 + height: 480 + property var gameState: Logic.newGameState(canvas); + property bool passedSplash: false + + Image { + source:"content/gfx/background.png" + anchors.bottom: view.bottom + + ParticleSystem { + id: particles + anchors.fill: parent + + ImageParticle { + id: bubble + anchors.fill: parent + source: "content/gfx/catch.png" + opacity: 0.25 + } + + Wander { + xVariance: 25; + pace: 25; + } + + Emitter { + width: parent.width + height: 150 + anchors.bottom: parent.bottom + anchors.bottomMargin: 3 + startTime: 15000 + + emitRate: 2 + lifeSpan: 15000 + + acceleration: PointDirection{ y: -6; xVariation: 2; yVariation: 2 } + + size: 24 + sizeVariation: 16 + } + } + } + + Column { + id: view + y: -(height - 480) + width: 320 + + GameOverScreen { gameCanvas: canvas } + + Item { + id: canvasArea + width: 320 + height: 480 + + Row { + height: childrenRect.height + Image { + id: wave + y: 30 + source:"content/gfx/wave.png" + } + Image { + y: 30 + source:"content/gfx/wave.png" + } + NumberAnimation on x { from: 0; to: -(wave.width); duration: 16000; loops: Animation.Infinite } + SequentialAnimation on y { + loops: Animation.Infinite + NumberAnimation { from: y - 2; to: y + 2; duration: 1600; easing.type: Easing.InOutQuad } + NumberAnimation { from: y + 2; to: y - 2; duration: 1600; easing.type: Easing.InOutQuad } + } + } + + Row { + opacity: 0.5 + Image { + id: wave2 + y: 25 + source: "content/gfx/wave.png" + } + Image { + y: 25 + source: "content/gfx/wave.png" + } + NumberAnimation on x { from: -(wave2.width); to: 0; duration: 32000; loops: Animation.Infinite } + SequentialAnimation on y { + loops: Animation.Infinite + NumberAnimation { from: y + 2; to: y - 2; duration: 1600; easing.type: Easing.InOutQuad } + NumberAnimation { from: y - 2; to: y + 2; duration: 1600; easing.type: Easing.InOutQuad } + } + } + + Image { + source: "content/gfx/sunlight.png" + opacity: 0.02 + y: 0 + anchors.horizontalCenter: parent.horizontalCenter + transformOrigin: Item.Top + SequentialAnimation on rotation { + loops: Animation.Infinite + NumberAnimation { from: -10; to: 10; duration: 8000; easing.type: Easing.InOutSine } + NumberAnimation { from: 10; to: -10; duration: 8000; easing.type: Easing.InOutSine } + } + } + + Image { + source: "content/gfx/sunlight.png" + opacity: 0.04 + y: 20 + anchors.horizontalCenter: parent.horizontalCenter + transformOrigin: Item.Top + SequentialAnimation on rotation { + loops: Animation.Infinite + NumberAnimation { from: 10; to: -10; duration: 8000; easing.type: Easing.InOutSine } + NumberAnimation { from: -10; to: 10; duration: 8000; easing.type: Easing.InOutSine } + } + } + + Image { + source: "content/gfx/grid.png" + opacity: 0.5 + } + + GameCanvas { + id: canvas + anchors.bottom: parent.bottom + anchors.bottomMargin: 20 + x: 32 + focus: true + } + + InfoBar { anchors.bottom: canvas.top; anchors.bottomMargin: 6; width: parent.width } + + //3..2..1..go + Timer { + id: countdownTimer + interval: 1000 + running: root.countdown < 5 + repeat: true + onTriggered: root.countdown++ + } + Repeater { + model: ["content/gfx/text-blank.png", "content/gfx/text-3.png", "content/gfx/text-2.png", "content/gfx/text-1.png", "content/gfx/text-go.png"] + delegate: Image { + visible: root.countdown <= index + opacity: root.countdown == index ? 0.5 : 0.1 + scale: root.countdown >= index ? 1.0 : 0.0 + source: modelData + Behavior on opacity { NumberAnimation {} } + Behavior on scale { NumberAnimation {} } + } + } + } + + NewGameScreen { + onStartButtonClicked: root.passedSplash = true + } + } + + property int countdown: 10 + Timer { + id: gameStarter + interval: 4000 + running: false + repeat: false + onTriggered: Logic.startGame(canvas); + } + + states: [ + State { + name: "gameOn"; when: gameState.gameOver == false && passedSplash + PropertyChanges { target: view; y: -(height - 960) } + StateChangeScript { script: root.countdown = 0; } + PropertyChanges { target: gameStarter; running: true } + }, + State { + name: "gameOver"; when: gameState.gameOver == true + PropertyChanges { target: view; y: 0 } + } + ] + + transitions: Transition { + NumberAnimation { properties: "x,y"; duration: 1200; easing.type: Easing.OutQuad } + } +} diff --git a/examples/quick/demos/maroon/maroon.qmlproject b/examples/quick/demos/maroon/maroon.qmlproject new file mode 100644 index 0000000000..752666114f --- /dev/null +++ b/examples/quick/demos/maroon/maroon.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "maroon.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml new file mode 100644 index 0000000000..12902c0413 --- /dev/null +++ b/examples/quick/demos/photoviewer/PhotoViewerCore/AlbumDelegate.qml @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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/quick/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml new file mode 100644 index 0000000000..fc832eaed8 --- /dev/null +++ b/examples/quick/demos/photoviewer/PhotoViewerCore/BusyIndicator.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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/quick/demos/photoviewer/PhotoViewerCore/Button.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/Button.qml new file mode 100644 index 0000000000..6571470e2f --- /dev/null +++ b/examples/quick/demos/photoviewer/PhotoViewerCore/Button.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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' + border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 + } + + Image { anchors.fill: parent; source: "images/cardboard.png"; antialiasing: true } + + Rectangle { + anchors.fill: container; color: container.tint; visible: container.tint != "" + opacity: 0.25 + } + + Text { id: labelText; font.pixelSize: 15; anchors.centerIn: parent } + + MouseArea { + anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 } + onClicked: container.clicked() + } +} diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/EditableButton.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/EditableButton.qml new file mode 100644 index 0000000000..8543bee157 --- /dev/null +++ b/examples/quick/demos/photoviewer/PhotoViewerCore/EditableButton.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: container + + property string label + signal clicked + + 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'; + border.left: 10; border.top: 10; border.right: 10; border.bottom: 10 + } + + Image { anchors.fill: parent; source: "images/cardboard.png"; antialiasing: true } + + TextInput { + id: textInput; text: label; font.pixelSize: 15; anchors.centerIn: parent + Keys.onReturnPressed: { + container.label = textInput.text + container.focus = true + } + Keys.onEnterPressed: { + container.label = 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; antialiasing: true + } + + MouseArea { + anchors { fill: parent; leftMargin: -20; topMargin: -20; rightMargin: -20; bottomMargin: -20 } + onClicked: { textInput.forceActiveFocus(); Qt.inputMethod.show(); } + } +} diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml new file mode 100644 index 0000000000..e14a1da266 --- /dev/null +++ b/examples/quick/demos/photoviewer/PhotoViewerCore/PhotoDelegate.qml @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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' + 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; antialiasing: true + width: w * s; height: h * s; visible: originalImage.status != Image.Ready + Rectangle { + color: "#878787"; antialiasing: true + anchors { fill: parent; topMargin: 3; bottomMargin: 3; leftMargin: 3; rightMargin: 3 } + } + } + Rectangle { + id: border; color: 'white'; anchors.centerIn: parent; antialiasing: true + width: originalImage.paintedWidth + 6; height: originalImage.paintedHeight + 6 + visible: !placeHolder.visible + } + BusyIndicator { anchors.centerIn: parent; on: originalImage.status != Image.Ready } + Image { + id: originalImage; antialiasing: true; + source: "http://" + Script.getImagePath(content); cache: false + fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height + } + Image { + id: hqImage; antialiasing: 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/quick/demos/photoviewer/PhotoViewerCore/ProgressBar.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/ProgressBar.qml new file mode 100644 index 0000000000..d2f915887f --- /dev/null +++ b/examples/quick/demos/photoviewer/PhotoViewerCore/ProgressBar.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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/quick/demos/photoviewer/PhotoViewerCore/RssModel.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/RssModel.qml new file mode 100644 index 0000000000..98fcd931dd --- /dev/null +++ b/examples/quick/demos/photoviewer/PhotoViewerCore/RssModel.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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/quick/demos/photoviewer/PhotoViewerCore/Tag.qml b/examples/quick/demos/photoviewer/PhotoViewerCore/Tag.qml new file mode 100644 index 0000000000..eeb8c355e3 --- /dev/null +++ b/examples/quick/demos/photoviewer/PhotoViewerCore/Tag.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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/quick/demos/photoviewer/PhotoViewerCore/images/box-shadow.png b/examples/quick/demos/photoviewer/PhotoViewerCore/images/box-shadow.png new file mode 100644 index 0000000000..431af8545d Binary files /dev/null and b/examples/quick/demos/photoviewer/PhotoViewerCore/images/box-shadow.png differ diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/images/busy.png b/examples/quick/demos/photoviewer/PhotoViewerCore/images/busy.png new file mode 100644 index 0000000000..664c2b1491 Binary files /dev/null and b/examples/quick/demos/photoviewer/PhotoViewerCore/images/busy.png differ diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/images/cardboard.png b/examples/quick/demos/photoviewer/PhotoViewerCore/images/cardboard.png new file mode 100644 index 0000000000..1847ab528d Binary files /dev/null and b/examples/quick/demos/photoviewer/PhotoViewerCore/images/cardboard.png differ diff --git a/examples/quick/demos/photoviewer/PhotoViewerCore/qmldir b/examples/quick/demos/photoviewer/PhotoViewerCore/qmldir new file mode 100644 index 0000000000..d3c247f21a --- /dev/null +++ b/examples/quick/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/quick/demos/photoviewer/PhotoViewerCore/script/script.js b/examples/quick/demos/photoviewer/PhotoViewerCore/script/script.js new file mode 100644 index 0000000000..e8ef93a847 --- /dev/null +++ b/examples/quick/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/quick/demos/photoviewer/i18n/base.ts b/examples/quick/demos/photoviewer/i18n/base.ts new file mode 100644 index 0000000000..1accfd2f90 --- /dev/null +++ b/examples/quick/demos/photoviewer/i18n/base.ts @@ -0,0 +1,30 @@ + + + + + AlbumDelegate + + + Remove + + + + + photoviewer + + + Add + + + + + Edit + + + + + Back + + + + diff --git a/examples/quick/demos/photoviewer/i18n/qml_fr.qm b/examples/quick/demos/photoviewer/i18n/qml_fr.qm new file mode 100644 index 0000000000..c24fcbc46c Binary files /dev/null and b/examples/quick/demos/photoviewer/i18n/qml_fr.qm differ diff --git a/examples/quick/demos/photoviewer/i18n/qml_fr.ts b/examples/quick/demos/photoviewer/i18n/qml_fr.ts new file mode 100644 index 0000000000..9f892db616 --- /dev/null +++ b/examples/quick/demos/photoviewer/i18n/qml_fr.ts @@ -0,0 +1,30 @@ + + + + + AlbumDelegate + + + Remove + Supprimer + + + + photoviewer + + + Add + Ajouter + + + + Edit + Éditer + + + + Back + Retour + + + diff --git a/examples/quick/demos/photoviewer/photoviewer.qml b/examples/quick/demos/photoviewer/photoviewer.qml new file mode 100644 index 0000000000..caeade4594 --- /dev/null +++ b/examples/quick/demos/photoviewer/photoviewer.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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/quick/demos/photoviewer/photoviewer.qmlproject b/examples/quick/demos/photoviewer/photoviewer.qmlproject new file mode 100644 index 0000000000..600bdb10f4 --- /dev/null +++ b/examples/quick/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/quick/demos/rssnews/content/BusyIndicator.qml b/examples/quick/demos/rssnews/content/BusyIndicator.qml new file mode 100644 index 0000000000..20ac08f612 --- /dev/null +++ b/examples/quick/demos/rssnews/content/BusyIndicator.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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/quick/demos/rssnews/content/CategoryDelegate.qml b/examples/quick/demos/rssnews/content/CategoryDelegate.qml new file mode 100644 index 0000000000..a6fea432f8 --- /dev/null +++ b/examples/quick/demos/rssnews/content/CategoryDelegate.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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/quick/demos/rssnews/content/NewsDelegate.qml b/examples/quick/demos/rssnews/content/NewsDelegate.qml new file mode 100644 index 0000000000..fe481a0eb0 --- /dev/null +++ b/examples/quick/demos/rssnews/content/NewsDelegate.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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/quick/demos/rssnews/content/RssFeeds.qml b/examples/quick/demos/rssnews/content/RssFeeds.qml new file mode 100644 index 0000000000..9a31d2be3e --- /dev/null +++ b/examples/quick/demos/rssnews/content/RssFeeds.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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/quick/demos/rssnews/content/ScrollBar.qml b/examples/quick/demos/rssnews/content/ScrollBar.qml new file mode 100644 index 0000000000..2752b7c56d --- /dev/null +++ b/examples/quick/demos/rssnews/content/ScrollBar.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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/quick/demos/rssnews/content/images/busy.png b/examples/quick/demos/rssnews/content/images/busy.png new file mode 100644 index 0000000000..664c2b1491 Binary files /dev/null and b/examples/quick/demos/rssnews/content/images/busy.png differ diff --git a/examples/quick/demos/rssnews/content/images/scrollbar.png b/examples/quick/demos/rssnews/content/images/scrollbar.png new file mode 100644 index 0000000000..0228dcf9eb Binary files /dev/null and b/examples/quick/demos/rssnews/content/images/scrollbar.png differ diff --git a/examples/quick/demos/rssnews/rssnews.qml b/examples/quick/demos/rssnews/rssnews.qml new file mode 100644 index 0000000000..72c7170c93 --- /dev/null +++ b/examples/quick/demos/rssnews/rssnews.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $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" } + highlightMoveVelocity: 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/quick/demos/rssnews/rssnews.qmlproject b/examples/quick/demos/rssnews/rssnews.qmlproject new file mode 100644 index 0000000000..5becbdaed0 --- /dev/null +++ b/examples/quick/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/quick/demos/samegame/content/Block.qml b/examples/quick/demos/samegame/content/Block.qml new file mode 100644 index 0000000000..85f2e27d2a --- /dev/null +++ b/examples/quick/demos/samegame/content/Block.qml @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: 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){ + "gfx/red.png"; + } else if (type == 1) { + "gfx/blue.png"; + } else if (type == 2) { + "gfx/green.png"; + } else { + "gfx/yellow.png"; + } + } + opacity: 0 + Behavior on opacity { NumberAnimation { duration: 200 } } + anchors.fill: parent + } + + //Foreground particles + BlockEmitter { + id: particles + system: particleSystem + group: { + if (type == 0){ + "red"; + } else if (type == 1) { + "blue"; + } else if (type == 2) { + "green"; + } else { + "yellow"; + } + } + anchors.fill: parent + } + + //Paint particles on the background + PaintEmitter { + id: particles2 + system: particleSystem + } + + 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); particles2.pulse(100);} } + PropertyChanges { target: img; opacity: 0 } + StateChangeScript { script: block.destroy(1000); } + } + ] +} diff --git a/examples/quick/demos/samegame/content/BlockEmitter.qml b/examples/quick/demos/samegame/content/BlockEmitter.qml new file mode 100644 index 0000000000..7dad509dfd --- /dev/null +++ b/examples/quick/demos/samegame/content/BlockEmitter.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "../settings.js" as Settings + +Emitter { + property Item block: parent + velocity: TargetDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -40; magnitudeVariation: 40} + acceleration: TargetDirection{targetX: block.width/2; targetY: block.height/2; magnitude: -100;} + shape: EllipseShape{fill:true} + enabled: false; + lifeSpan: 700; lifeSpanVariation: 100 + emitRate: 1000 + maximumEmitted: 100 //only fires 0.1s bursts (still 2x old number) + size: Settings.blockSize * 0.85 + endSize: Settings.blockSize * 0.85 /2 +} diff --git a/examples/quick/demos/samegame/content/Button.qml b/examples/quick/demos/samegame/content/Button.qml new file mode 100644 index 0000000000..aab21ec8c6 --- /dev/null +++ b/examples/quick/demos/samegame/content/Button.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 { + property alias imgSrc: image.source + property alias system: emitter.system + property alias group: emitter.group + signal clicked + property bool rotatedButton: false + + width: image.width + height: image.sourceSize.height + Image { + id: image + height: parent.height + width: height/sourceSize.height * sourceSize.width + + anchors.horizontalCenter: parent.horizontalCenter + rotation: rotatedButton ? ((Math.random() * 3 + 2) * (Math.random() <= 0.5 ? -1 : 1)) : 0 + MenuEmitter { + id: emitter + anchors.fill: parent + //shape: MaskShape {source: image.source} + } + } + MouseArea { + anchors.fill: parent + onClicked: {parent.clicked(); emitter.burst(400);} + } +} diff --git a/examples/quick/demos/samegame/content/GameArea.qml b/examples/quick/demos/samegame/content/GameArea.qml new file mode 100644 index 0000000000..f3ca98d80e --- /dev/null +++ b/examples/quick/demos/samegame/content/GameArea.qml @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "samegame.js" as Logic + +Item { + id: gameCanvas + property bool gameOver: true + property int score: 0 + property int highScore: 0 + property int moves: 0 + property string mode: "" + property ParticleSystem ps: particleSystem + //For easy theming + property alias backgroundVisible: bg.visible + property string background: "gfx/background.png" + property string blockFile: "Block.qml" + onBlockFileChanged: Logic.changeBlock(blockFile); + property alias particlePack: auxLoader.source + //For multiplayer + property int score2: 0 + property int curTurn: 1 + property bool autoTurnChange: false + signal swapPlayers + property bool swapping: false + //onSwapPlayers: if (autoTurnChange) Logic.turnChange();//Now implemented below + //For puzzle + property url level + property bool puzzleWon: false + signal puzzleLost //Since root is tracking the puzzle progress + function showPuzzleEnd (won) { + if (won) { + smokeParticle.color = Qt.rgba(0,1,0,0); + puzzleWin.play(); + } else { + smokeParticle.color = Qt.rgba(1,0,0,0); + puzzleFail.play(); + puzzleLost(); + } + } + function showPuzzleGoal (str) { + puzzleTextBubble.opacity = 1; + puzzleTextLabel.text = str; + } + Image { + id: bg + z: -1 + anchors.fill: parent + source: background; + fillMode: Image.PreserveAspectCrop + } + + MouseArea { + anchors.fill: parent; onClicked: { + if (puzzleTextBubble.opacity == 1) { + puzzleTextBubble.opacity = 0; + Logic.finishLoadingMap(); + } else if (!swapping) { + Logic.handleClick(mouse.x,mouse.y); + } + } + } + + Image { + id: highScoreTextBubble + opacity: mode == "arcade" && gameOver && gameCanvas.score == gameCanvas.highScore ? 1 : 0 + Behavior on opacity { NumberAnimation {} } + anchors.centerIn: parent + z: 10 + source: "gfx/bubble-highscore.png" + Image { + anchors.centerIn: parent + source: "gfx/text-highscore-new.png" + rotation: -10 + } + } + + Image { + id: puzzleTextBubble + anchors.centerIn: parent + opacity: 0 + Behavior on opacity { NumberAnimation {} } + z: 10 + source: "gfx/bubble-puzzle.png" + Connections { + target: gameCanvas + onModeChanged: if (mode != "puzzle" && puzzleTextBubble.opacity > 0) puzzleTextBubble.opacity = 0; + } + Text { + id: puzzleTextLabel + width: parent.width - 24 + anchors.centerIn: parent + horizontalAlignment: Text.AlignHCenter + color: "white" + font.pixelSize: 24 + font.bold: true + wrapMode: Text.WordWrap + } + } + onModeChanged: { + p1WonImg.opacity = 0; + p2WonImg.opacity = 0; + } + SmokeText { id: puzzleWin; source: "gfx/icon-ok.png"; system: particleSystem } + SmokeText { id: puzzleFail; source: "gfx/icon-fail.png"; system: particleSystem } + + onSwapPlayers: { + smokeParticle.color = "yellow" + Logic.turnChange(); + if (curTurn == 1) { + p1Text.play(); + } else { + p2Text.play(); + } + clickDelay.running = true; + } + SequentialAnimation { + id: clickDelay + ScriptAction { script: gameCanvas.swapping = true; } + PauseAnimation { duration: 750 } + ScriptAction { script: gameCanvas.swapping = false; } + } + + SmokeText { + id: p1Text; source: "gfx/text-p1-go.png"; + system: particleSystem; playerNum: 1 + opacity: p1WonImg.opacity + p2WonImg.opacity > 0 ? 0 : 1 + } + + SmokeText { + id: p2Text; source: "gfx/text-p2-go.png"; + system: particleSystem; playerNum: 2 + opacity: p1WonImg.opacity + p2WonImg.opacity > 0 ? 0 : 1 + } + + onGameOverChanged: { + if (gameCanvas.mode == "multiplayer") { + if (gameCanvas.score >= gameCanvas.score2) { + p1WonImg.opacity = 1; + } else { + p2WonImg.opacity = 1; + } + } + } + Image { + id: p1WonImg + source: "gfx/text-p1-won.png" + anchors.centerIn: parent + opacity: 0 + Behavior on opacity { NumberAnimation {} } + z: 10 + } + Image { + id: p2WonImg + source: "gfx/text-p2-won.png" + anchors.centerIn: parent + opacity: 0 + Behavior on opacity { NumberAnimation {} } + z: 10 + } + + ParticleSystem{ + id: particleSystem; + anchors.fill: parent + z: 5 + ImageParticle { + id: smokeParticle + groups: ["smoke"] + source: "gfx/particle-smoke.png" + alpha: 0.1 + alphaVariation: 0.1 + color: "yellow" + } + Loader { + id: auxLoader + anchors.fill: parent + source: "PrimaryPack.qml" + onItemChanged: { + if (item && "particleSystem" in item) + item.particleSystem = particleSystem + if (item && "gameArea" in item) + item.gameArea = gameCanvas + } + } + } +} + diff --git a/examples/quick/demos/samegame/content/LogoAnimation.qml b/examples/quick/demos/samegame/content/LogoAnimation.qml new file mode 100644 index 0000000000..c879893e92 --- /dev/null +++ b/examples/quick/demos/samegame/content/LogoAnimation.qml @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: container //Positioned where the 48x48 S/G should be + property alias running: mainAnim.running + property ParticleSystem particleSystem + property int dur: 500 + signal boomTime + Image { + id: s1 + source: "gfx/logo-s.png" + y: 0 + } + Image { + id: g1 + source: "gfx/logo-g.png" + y: -128 + } + Column { + Repeater { + model: 2 + Item { + width: 48 + height: 48 + BlockEmitter { + id: emitter + anchors.fill: parent + group: "red" + system: particleSystem + Connections { + target: container + onBoomTime: emitter.pulse(100); + } + } + } + } + } + SequentialAnimation { + id: mainAnim + running: true + loops: -1 + PropertyAction { target: g1; property: "y"; value: -128} + PropertyAction { target: g1; property: "opacity"; value: 1} + PropertyAction { target: s1; property: "y"; value: 0} + PropertyAction { target: s1; property: "opacity"; value: 1} + NumberAnimation { target: g1; property: "y"; from: -96; to: -48; duration: dur} + ParallelAnimation { + NumberAnimation { target: g1; property: "y"; from: -48; to: 0; duration: dur} + NumberAnimation { target: s1; property: "y"; from: 0; to: 48; duration: dur } + } + PauseAnimation { duration: dur } + ScriptAction { script: container.boomTime(); } + ParallelAnimation { + NumberAnimation { target: g1; property: "opacity"; to: 0; duration: dur } + NumberAnimation { target: s1; property: "opacity"; to: 0; duration: dur } + } + PropertyAction { target: s1; property: "y"; value: -128} + PropertyAction { target: s1; property: "opacity"; value: 1} + NumberAnimation { target: s1; property: "y"; from: -96; to: 0; duration: dur * 2} + } +} diff --git a/examples/quick/demos/samegame/content/MenuEmitter.qml b/examples/quick/demos/samegame/content/MenuEmitter.qml new file mode 100644 index 0000000000..16c766068c --- /dev/null +++ b/examples/quick/demos/samegame/content/MenuEmitter.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +Emitter { + anchors.fill: parent + velocity: AngleDirection{angleVariation: 360; magnitude: 140; magnitudeVariation: 40} + enabled: false; + lifeSpan: 500; + emitRate: 1 + size: 28 + endSize: 14 + group: "yellow" +} diff --git a/examples/quick/demos/samegame/content/PaintEmitter.qml b/examples/quick/demos/samegame/content/PaintEmitter.qml new file mode 100644 index 0000000000..4a67c4a2d2 --- /dev/null +++ b/examples/quick/demos/samegame/content/PaintEmitter.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "../settings.js" as Settings + +Emitter { + property Item block: parent + anchors.fill: parent + shape: EllipseShape { fill: true } + group: { + if (block.type == 0){ + "redspots"; + } else if (block.type == 1) { + "bluespots"; + } else if (block.type == 2) { + "greenspots"; + } else { + "yellowspots"; + } + } + size: Settings.blockSize * 2 + endSize: Settings.blockSize/2 + lifeSpan: 30000 + enabled: false + emitRate: 60 + maximumEmitted: 60 + velocity: PointDirection{ y: 4; yVariation: 4 } + /* Possibly better, but dependent on gerrit change,28212 + property real mainIntensity: 0.8 + property real subIntensity: 0.1 + property real colorVariation: 0.005 + onEmitParticles: {//One group, many colors, for better stacking + for (var i=0; i
Clear in three moves..." + startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , + 0 , 0 , 0 , 0 , 0 , 1 , 1 , 2 , 1 , 1 , + 0 , 0 , 0 , 1 , 1 , 3 , 3 , 3 , 3 , 3 , + 0 , 1 , 1 , 3 , 3 , 3 , 1 , 3 , 1 , 1 , + 1 , 2 , 3 , 3 , 1 , 1 , 3 , 3 , 3 , 3 , + 1 , 3 , 3 , 2 , 3 , 3 , 3 , 3 , 1 , 1 , + 1 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ] +} diff --git a/examples/quick/demos/samegame/content/levels/level1.qml b/examples/quick/demos/samegame/content/levels/level1.qml new file mode 100644 index 0000000000..4bb15cbe6a --- /dev/null +++ b/examples/quick/demos/samegame/content/levels/level1.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +TemplateBase{ + timeTarget: 10 + goalText: "2 of 10

Clear in 10 seconds..." + startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 1 , 3 , 3 , 3 , 1 , 1 , 1 , 1 , 2 , 2 , + 1 , 2 , 3 , 3 , 3 , 1 , 1 , 1 , 1 , 2 , + 2 , 2 , 1 , 3 , 3 , 3 , 1 , 1 , 1 , 2 , + 2 , 1 , 1 , 1 , 3 , 3 , 3 , 1 , 2 , 2 , + 1 , 1 , 1 , 1 , 1 , 3 , 3 , 3 , 2 , 1 ] +} diff --git a/examples/quick/demos/samegame/content/levels/level2.qml b/examples/quick/demos/samegame/content/levels/level2.qml new file mode 100644 index 0000000000..a319479a60 --- /dev/null +++ b/examples/quick/demos/samegame/content/levels/level2.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +TemplateBase{ + scoreTarget: 1200 + timeTarget: 60 + goalText: "3 of 10

Score over 1200 points in one minute..." + mustClear: false + startingGrid: [ 3 , 1 , 2 , 1 , 1 , 2 , 1 , 1 , 3 , 3 , + 1 , 3 , 3 , 2 , 3 , 3 , 1 , 1 , 3 , 1 , + 3 , 1 , 3 , 3 , 2 , 3 , 3 , 3 , 1 , 2 , + 3 , 2 , 2 , 1 , 3 , 3 , 2 , 1 , 1 , 2 , + 3 , 1 , 2 , 2 , 2 , 2 , 2 , 1 , 3 , 1 , + 2 , 3 , 1 , 2 , 2 , 3 , 3 , 1 , 3 , 2 , + 3 , 2 , 1 , 1 , 3 , 3 , 3 , 2 , 2 , 1 , + 1 , 2 , 2 , 3 , 2 , 3 , 3 , 3 , 1 , 1 , + 1 , 3 , 3 , 3 , 1 , 2 , 2 , 3 , 3 , 1 , + 3 , 3 , 2 , 1 , 2 , 2 , 1 , 1 , 1 , 3 , + 2 , 1 , 3 , 2 , 3 , 2 , 3 , 2 , 2 , 1 , + 1 , 3 , 1 , 2 , 1 , 2 , 3 , 1 , 2 , 2 , + 1 , 2 , 2 , 2 , 1 , 1 , 2 , 3 , 1 , 2 ] +} diff --git a/examples/quick/demos/samegame/content/levels/level3.qml b/examples/quick/demos/samegame/content/levels/level3.qml new file mode 100644 index 0000000000..43e82d7694 --- /dev/null +++ b/examples/quick/demos/samegame/content/levels/level3.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +TemplateBase{ + scoreTarget: 3000 + timeTarget: 60 + goalText: "4 of 10
Clear the board with over 3000 points in under a minute..." + startingGrid: [ 3 , 3 , 1 , 1 , 1 , 2 , 2 , 4 , 3 , 3 , + 4 , 3 , 1 , 4 , 2 , 2 , 2 , 4 , 3 , 4 , + 4 , 3 , 3 , 4 , 1 , 1 , 3 , 3 , 4 , 4 , + 3 , 3 , 3 , 3 , 3 , 1 , 3 , 2 , 2 , 4 , + 4 , 4 , 3 , 4 , 3 , 1 , 4 , 4 , 4 , 4 , + 4 , 4 , 3 , 4 , 1 , 1 , 4 , 4 , 3 , 3 , + 4 , 2 , 2 , 2 , 2 , 2 , 4 , 4 , 4 , 1 , + 4 , 4 , 2 , 4 , 2 , 2 , 1 , 1 , 1 , 1 , + 4 , 4 , 2 , 4 , 2 , 2 , 1 , 4 , 4 , 1 , + 4 , 1 , 1 , 4 , 3 , 3 , 4 , 2 , 4 , 1 , + 4 , 1 , 1 , 2 , 3 , 3 , 4 , 2 , 2 , 1 , + 1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , 2 , 1 , + 4 , 1 , 1 , 2 , 2 , 3 , 4 , 3 , 4 , 4 ] +} diff --git a/examples/quick/demos/samegame/content/levels/level4.qml b/examples/quick/demos/samegame/content/levels/level4.qml new file mode 100644 index 0000000000..46ad42f709 --- /dev/null +++ b/examples/quick/demos/samegame/content/levels/level4.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +TemplateBase{ + goalText: "5 of 10

Clear the level..." + startingGrid: [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 1 , 3 , 2 , 1 , 1 , 1 , 1 , 3 , 2 , 3 , + 1 , 2 , 3 , 1 , 3 , 2 , 2 , 1 , 1 , 2 , + 3 , 2 , 2 , 2 , 1 , 1 , 1 , 1 , 3 , 3 , + 2 , 1 , 1 , 3 , 2 , 1 , 1 , 2 , 1 , 3 , + 1 , 3 , 3 , 1 , 2 , 1 , 2 , 1 , 3 , 3 , + 1 , 3 , 2 , 2 , 2 , 1 , 1 , 3 , 2 , 3 , + 1 , 1 , 3 , 2 , 3 , 3 , 2 , 1 , 1 , 1 , + 1 , 2 , 2 , 3 , 2 , 2 , 1 , 3 , 1 , 3 ] +} diff --git a/examples/quick/demos/samegame/content/levels/level5.qml b/examples/quick/demos/samegame/content/levels/level5.qml new file mode 100644 index 0000000000..3716264993 --- /dev/null +++ b/examples/quick/demos/samegame/content/levels/level5.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +TemplateBase{ + moveTarget: 4 + goalText: "6 of 10

Clear in four or less moves..." + startingGrid: [ 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , + 4 , 2 , 2 , 2 , 4 , 3 , 3 , 3 , 4 , 4 , + 4 , 2 , 4 , 4 , 4 , 3 , 2 , 3 , 4 , 4 , + 4 , 2 , 2 , 2 , 4 , 3 , 3 , 3 , 4 , 4 , + 4 , 4 , 4 , 2 , 4 , 3 , 4 , 3 , 4 , 4 , + 4 , 2 , 2 , 2 , 4 , 3 , 4 , 3 , 4 , 4 , + 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , + 4 , 3 , 4 , 3 , 4 , 2 , 2 , 2 , 4 , 3 , + 4 , 3 , 3 , 3 , 4 , 2 , 4 , 4 , 4 , 3 , + 4 , 3 , 3 , 3 , 4 , 2 , 2 , 2 , 4 , 3 , + 4 , 3 , 4 , 3 , 4 , 2 , 4 , 4 , 4 , 4 , + 4 , 3 , 4 , 3 , 4 , 2 , 2 , 2 , 4 , 3 , + 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 ] +} diff --git a/examples/quick/demos/samegame/content/levels/level6.qml b/examples/quick/demos/samegame/content/levels/level6.qml new file mode 100644 index 0000000000..4547b75a37 --- /dev/null +++ b/examples/quick/demos/samegame/content/levels/level6.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +TemplateBase{ + moveTarget: 20 + timeTarget: 40 + goalText: "7 of 10

Clear with 20 moves in 40 seconds (or better)." + startingGrid: [ 1 , 3 , 1 , 1 , 1 , 1 , 2 , 1 , 2 , 2 , + 2 , 1 , 2 , 3 , 3 , 1 , 3 , 1 , 1 , 3 , + 3 , 1 , 1 , 1 , 2 , 2 , 3 , 2 , 3 , 1 , + 1 , 3 , 1 , 1 , 3 , 1 , 1 , 1 , 2 , 3 , + 2 , 1 , 1 , 1 , 3 , 2 , 3 , 3 , 2 , 3 , + 3 , 3 , 3 , 3 , 2 , 2 , 3 , 1 , 3 , 2 , + 2 , 2 , 3 , 2 , 2 , 3 , 2 , 2 , 2 , 2 , + 1 , 2 , 1 , 2 , 1 , 3 , 2 , 3 , 2 , 3 , + 1 , 1 , 2 , 3 , 3 , 3 , 3 , 1 , 1 , 2 , + 3 , 3 , 2 , 2 , 2 , 2 , 3 , 1 , 3 , 1 , + 1 , 2 , 3 , 3 , 3 , 1 , 3 , 2 , 1 , 2 , + 1 , 2 , 1 , 1 , 2 , 3 , 1 , 2 , 1 , 3 , + 3 , 1 , 2 , 2 , 1 , 3 , 3 , 1 , 3 , 2 ] +} diff --git a/examples/quick/demos/samegame/content/levels/level7.qml b/examples/quick/demos/samegame/content/levels/level7.qml new file mode 100644 index 0000000000..5d71d7cb51 --- /dev/null +++ b/examples/quick/demos/samegame/content/levels/level7.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +TemplateBase{ + goalText: "8 of 10

Clear the grid." + startingGrid: [ 2 , 4 , 3 , 2 , 3 , 2 , 3 , 3 , 4 , 3 , + 2 , 2 , 3 , 3 , 1 , 4 , 3 , 3 , 3 , 2 , + 1 , 4 , 2 , 3 , 4 , 3 , 3 , 1 , 1 , 1 , + 2 , 1 , 2 , 4 , 4 , 2 , 2 , 3 , 2 , 1 , + 3 , 4 , 4 , 1 , 3 , 2 , 4 , 2 , 1 , 1 , + 2 , 2 , 3 , 1 , 2 , 4 , 1 , 2 , 1 , 2 , + 1 , 2 , 3 , 2 , 4 , 4 , 3 , 1 , 1 , 2 , + 4 , 4 , 2 , 1 , 2 , 4 , 2 , 2 , 4 , 3 , + 4 , 2 , 4 , 1 , 3 , 4 , 1 , 4 , 2 , 4 , + 4 , 3 , 4 , 1 , 4 , 3 , 1 , 3 , 1 , 1 , + 3 , 3 , 2 , 3 , 2 , 4 , 1 , 2 , 4 , 4 , + 3 , 4 , 2 , 2 , 4 , 3 , 4 , 1 , 3 , 2 , + 4 , 3 , 3 , 4 , 2 , 4 , 1 , 2 , 3 , 2 ] +} diff --git a/examples/quick/demos/samegame/content/levels/level8.qml b/examples/quick/demos/samegame/content/levels/level8.qml new file mode 100644 index 0000000000..9dbb8c2d5f --- /dev/null +++ b/examples/quick/demos/samegame/content/levels/level8.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +TemplateBase{ + scoreTarget: 1000 + goalText: "9 of 10

Score over 1000 points" + startingGrid: [ 1 , 4 , 4 , 3 , 2 , 1 , 4 , 2 , 4 , 2 , + 2 , 3 , 4 , 4 , 1 , 1 , 1 , 4 , 4 , 4 , + 1 , 3 , 1 , 2 , 2 , 1 , 2 , 1 , 4 , 2 , + 4 , 3 , 4 , 2 , 1 , 4 , 1 , 2 , 2 , 3 , + 3 , 4 , 2 , 4 , 4 , 3 , 2 , 2 , 2 , 1 , + 4 , 4 , 3 , 2 , 4 , 4 , 2 , 1 , 1 , 1 , + 1 , 2 , 1 , 3 , 4 , 1 , 1 , 3 , 2 , 3 , + 3 , 4 , 2 , 2 , 1 , 3 , 2 , 2 , 4 , 2 , + 2 , 4 , 1 , 2 , 2 , 4 , 3 , 3 , 3 , 1 , + 1 , 2 , 2 , 4 , 1 , 2 , 2 , 3 , 3 , 3 , + 4 , 4 , 1 , 4 , 3 , 1 , 3 , 3 , 3 , 4 , + 1 , 2 , 4 , 1 , 2 , 1 , 1 , 4 , 2 , 1 , + 1 , 2 , 3 , 4 , 2 , 4 , 4 , 2 , 1 , 3 ] +} diff --git a/examples/quick/demos/samegame/content/levels/level9.qml b/examples/quick/demos/samegame/content/levels/level9.qml new file mode 100644 index 0000000000..4e8bf19e26 --- /dev/null +++ b/examples/quick/demos/samegame/content/levels/level9.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +TemplateBase{ + scoreTarget: 2000 + timeTarget: 60 + moveTarget: 20 + mustClear: false + goalText: "10 of 10

Score 2000 in one minute with less than 20 moves!" + startingGrid: [ 3 , 2 , 3 , 1 , 3 , 3 , 4 , 1 , 3 , 3 , + 2 , 3 , 2 , 1 , 1 , 2 , 2 , 2 , 4 , 1 , + 2 , 4 , 4 , 4 , 3 , 1 , 4 , 4 , 4 , 1 , + 3 , 1 , 3 , 4 , 4 , 2 , 2 , 2 , 2 , 3 , + 2 , 1 , 4 , 4 , 3 , 3 , 1 , 1 , 3 , 2 , + 3 , 2 , 1 , 4 , 3 , 4 , 1 , 3 , 4 , 2 , + 3 , 3 , 1 , 4 , 4 , 4 , 2 , 1 , 2 , 3 , + 2 , 3 , 4 , 3 , 4 , 1 , 1 , 3 , 2 , 4 , + 4 , 4 , 1 , 2 , 4 , 3 , 2 , 2 , 2 , 4 , + 1 , 4 , 2 , 2 , 1 , 1 , 2 , 1 , 1 , 4 , + 1 , 4 , 3 , 3 , 3 , 1 , 3 , 4 , 4 , 2 , + 3 , 4 , 1 , 1 , 2 , 2 , 2 , 3 , 2 , 1 , + 3 , 3 , 4 , 3 , 1 , 1 , 1 , 4 , 4 , 3 ] +} diff --git a/examples/quick/demos/samegame/content/samegame.js b/examples/quick/demos/samegame/content/samegame.js new file mode 100755 index 0000000000..7b226cb42f --- /dev/null +++ b/examples/quick/demos/samegame/content/samegame.js @@ -0,0 +1,581 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 script file handles the game logic */ +.pragma library +.import QtQuick.LocalStorage 2.0 as Sql +.import "../settings.js" as Settings + +var maxColumn = 10; +var maxRow = 13; +var types = 3; +var maxIndex = maxColumn*maxRow; +var board = new Array(maxIndex); +var blockSrc = "Block.qml"; +var gameDuration; +var component = Qt.createComponent(blockSrc); +var gameCanvas; +var betweenTurns = false; + +var puzzleLevel = null; +var puzzlePath = ""; + +var gameMode = "arcade"; //Set in new game, then tweaks behaviour of other functions +var gameOver = false; + +function changeBlock(src) +{ + blockSrc = src; + component = Qt.createComponent(blockSrc); +} + +// 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 cleanUp() +{ + if (gameCanvas == undefined) + return; + // Delete blocks from previous game + for (var i = 0; i < maxIndex; i++) { + if (board[i] != null) + board[i].destroy(); + board[i] = null; + } + if (puzzleLevel != null){ + puzzleLevel.destroy(); + puzzleLevel = null; + } + gameCanvas.mode = "" +} + +function startNewGame(gc, mode, map) +{ + gameCanvas = gc; + if (mode == undefined) + gameMode = "arcade"; + else + gameMode = mode; + gameOver = false; + + cleanUp(); + + gc.gameOver = false; + gc.mode = gameMode; + // Calculate board size + maxColumn = Math.floor(gameCanvas.width/Settings.blockSize); + maxRow = Math.floor(gameCanvas.height/Settings.blockSize); + maxIndex = maxRow * maxColumn; + if (gameMode == "arcade") //Needs to be after board sizing + getHighScore(); + + + // Initialize Board + board = new Array(maxIndex); + gameCanvas.score = 0; + gameCanvas.score2 = 0; + gameCanvas.moves = 0; + gameCanvas.curTurn = 1; + if (gameMode == "puzzle") + loadMap(map); + else//Note that we load them in reverse order for correct visual stacking + for (var column = maxColumn - 1; column >= 0; column--) + for (var row = maxRow - 1; row >= 0; row--) + createBlock(column, row); + if (gameMode == "puzzle") + getLevelHistory();//Needs to be after map load + 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 (betweenTurns || gameOver || gameCanvas == undefined) + return; + var column = Math.floor(x/Settings.blockSize); + var row = Math.floor(y/Settings.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; + if (gameMode == "multiplayer" && gameCanvas.curTurn == 2) + gameCanvas.score2 += (fillFound - 1) * (fillFound - 1); + else + gameCanvas.score += (fillFound - 1) * (fillFound - 1); + if (gameMode == "multiplayer" && gameCanvas.curTurn == 2) + shuffleUp(); + else + shuffleDown(); + gameCanvas.moves += 1; + if (gameMode == "endless") + refill(); + else if (gameMode != "multiplayer") + victoryCheck(); + if (gameMode == "multiplayer" && !gc.gameOver){ + betweenTurns = true; + gameCanvas.swapPlayers();//signal, animate and call turnChange() when ready + } +} + +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) * Settings.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) * Settings.blockSize; + board[index(column - fallDist,row)] = obj; + board[index(column, row)] = null; + } + } + } + } +} + + +function shuffleUp() +{ + // Fall up + for (var column = 0; column < maxColumn; column++) { + var fallDist = 0; + for (var row = 0; row < maxRow; row++) { + if (board[index(column,row)] == null) { + fallDist += 1; + } else { + if (fallDist > 0) { + var obj = board[index(column, row)]; + obj.y = (row - fallDist) * Settings.blockSize; + board[index(column, row - fallDist)] = obj; + board[index(column, row)] = null; + } + } + } + } + // Fall to the left (or should it be right, so as to be left for P2?) + fallDist = 0; + for (column = 0; column < maxColumn; column++) { + if (board[index(column, 0)] == 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) * Settings.blockSize; + board[index(column - fallDist,row)] = obj; + board[index(column, row)] = null; + } + } + } + } +} + +function turnChange()//called by ui outside +{ + betweenTurns = false; + if (gameCanvas.curTurn == 1){ + shuffleUp(); + gameCanvas.curTurn = 2; + victoryCheck(); + }else{ + shuffleDown(); + gameCanvas.curTurn = 1; + victoryCheck(); + } +} + +function refill() +{ + for (var column = 0; column < maxColumn; column++) { + for (var row = 0; row < maxRow; row++) { + if (board[index(column, row)] == null) + createBlock(column, row); + } + } +} + +function victoryCheck() +{ + // Awards bonuses for no blocks left + var deservesBonus = true; + if (board[index(0,maxRow - 1)] != null || board[index(0,0)] != null) + deservesBonus = false; + // Checks for game over + if (deservesBonus){ + if (gameCanvas.curTurn = 1) + gameCanvas.score += 1000; + else + gameCanvas.score2 += 1000; + } + gameOver = deservesBonus; + if (gameCanvas.curTurn == 1){ + if (!(floodMoveCheck(0, maxRow - 1, -1))) + gameOver = true; + }else{ + if (!(floodMoveCheck(0, 0, -1, true))) + gameOver = true; + } + if (gameMode == "puzzle"){ + puzzleVictoryCheck(deservesBonus);//Takes it from here + return; + } + if (gameOver) { + var winnerScore = Math.max(gameCanvas.score, gameCanvas.score2); + if (gameMode == "multiplayer"){ + gameCanvas.score = winnerScore; + saveHighScore(gameCanvas.score2); + } + saveHighScore(gameCanvas.score); + gameDuration = new Date() - gameDuration; + gameCanvas.gameOver = true; + } +} + +// Only floods up and right, to see if it can find adjacent same-typed blocks +function floodMoveCheck(column, row, type, goDownInstead) +{ + 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; + if (goDownInstead) + return floodMoveCheck(column + 1, row, myType, goDownInstead) || + floodMoveCheck(column, row + 1, myType, goDownInstead); + else + return floodMoveCheck(column + 1, row, myType) || + floodMoveCheck(column, row - 1, myType); +} + +function createBlock(column,row,type) +{ + // 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){ + if (type == undefined) + type = Math.floor(Math.random() * types); + if (type < 0 || type > 4) { + console.log("Invalid type requested");//TODO: Is this triggered by custom levels much? + return; + } + var dynamicObject = component.createObject(gameCanvas, + {"type": type, + "x": column*Settings.blockSize, + "y": -1*Settings.blockSize, + "width": Settings.blockSize, + "height": Settings.blockSize, + "particleSystem": gameCanvas.ps}); + if (dynamicObject == null){ + console.log("error creating block"); + console.log(component.errorString()); + return false; + } + dynamicObject.y = row*Settings.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 showPuzzleError(str) +{ + //TODO: Nice user visible UI? + console.log(str); +} + +function loadMap(map) +{ + puzzlePath = map; + var levelComp = Qt.createComponent(puzzlePath); + if (levelComp.status != 1){ + console.log("Error loading level"); + showPuzzleError(levelComp.errorString()); + return; + } + puzzleLevel = levelComp.createObject(); + if (puzzleLevel == null || !puzzleLevel.startingGrid instanceof Array) { + showPuzzleError("Bugger!"); + return; + } + gameCanvas.showPuzzleGoal(puzzleLevel.goalText); + //showPuzzleGoal should call finishLoadingMap as the next thing it does, before handling more events +} + +function finishLoadingMap() +{ + for (var i in puzzleLevel.startingGrid) + if (! (puzzleLevel.startingGrid[i] >= 0 && puzzleLevel.startingGrid[i] <= 9) ) + puzzleLevel.startingGrid[i] = 0; + //TODO: Don't allow loading larger levels, leads to cheating + while (puzzleLevel.startingGrid.length > maxIndex) puzzleLevel.startingGrid.shift(); + while (puzzleLevel.startingGrid.length < maxIndex) puzzleLevel.startingGrid.unshift(0); + for (var i in puzzleLevel.startingGrid) + if (puzzleLevel.startingGrid[i] > 0) + createBlock(i % maxColumn, Math.floor(i / maxColumn), puzzleLevel.startingGrid[i] - 1); + + //### Experimental feature - allow levels to contain arbitrary QML scenes as well! + //while (puzzleLevel.children.length) + // puzzleLevel.children[0].parent = gameCanvas; + gameDuration = new Date(); //Don't start until we finish loading +} + +function puzzleVictoryCheck(clearedAll)//gameOver has also been set if no more moves +{ + var won = true; + var soFar = new Date() - gameDuration; + if (puzzleLevel.scoreTarget != -1 && gameCanvas.score < puzzleLevel.scoreTarget){ + won = false; + } if (puzzleLevel.scoreTarget != -1 && gameCanvas.score >= puzzleLevel.scoreTarget && !puzzleLevel.mustClear){ + gameOver = true; + } if (puzzleLevel.timeTarget != -1 && soFar/1000.0 > puzzleLevel.timeTarget){ + gameOver = true; + } if (puzzleLevel.moveTarget != -1 && gameCanvas.moves >= puzzleLevel.moveTarget){ + gameOver = true; + } if (puzzleLevel.mustClear && gameOver && !clearedAll) { + won = false; + } + + if (gameOver) { + gameCanvas.gameOver = true; + gameCanvas.showPuzzleEnd(won); + + if (won) { + // Store progress + saveLevelHistory(); + } + } +} + +function getHighScore() +{ + var db = Sql.LocalStorage.openDatabaseSync( + "SameGame", + "2.0", + "SameGame Local Data", + 100 + ); + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(game 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 + '" AND game = "' + gameMode + '" ORDER BY score desc'); + if (rs.rows.length > 0) + gameCanvas.highScore = rs.rows.item(0).score; + else + gameCanvas.highScore = 0; + } + ); +} + +function saveHighScore(score) +{ + // Offline storage + var db = Sql.LocalStorage.openDatabaseSync( + "SameGame", + "2.0", + "SameGame Local Data", + 100 + ); + var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)"; + var data = [ + gameMode, + score, + maxColumn + "x" + maxRow, + Math.floor(gameDuration / 1000) + ]; + if (score >= gameCanvas.highScore)//Update UI field + gameCanvas.highScore = score; + + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(game TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); + tx.executeSql(dataStr, data); + } + ); +} + +function getLevelHistory() +{ + var db = Sql.LocalStorage.openDatabaseSync( + "SameGame", + "2.0", + "SameGame Local Data", + 100 + ); + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Puzzle(level TEXT, score NUMBER, moves NUMBER, time NUMBER)'); + var rs = tx.executeSql('SELECT * FROM Puzzle WHERE level = "' + puzzlePath + '" ORDER BY score desc'); + if (rs.rows.length > 0) { + gameCanvas.puzzleWon = true; + gameCanvas.highScore = rs.rows.item(0).score; + } else { + gameCanvas.puzzleWon = false; + gameCanvas.highScore = 0; + } + } + ); +} + +function saveLevelHistory() +{ + var db = Sql.LocalStorage.openDatabaseSync( + "SameGame", + "2.0", + "SameGame Local Data", + 100 + ); + var dataStr = "INSERT INTO Puzzle VALUES(?, ?, ?, ?)"; + var data = [ + puzzlePath, + gameCanvas.score, + gameCanvas.moves, + Math.floor(gameDuration / 1000) + ]; + gameCanvas.puzzleWon = true; + + db.transaction( + function(tx) { + tx.executeSql('CREATE TABLE IF NOT EXISTS Puzzle(level TEXT, score NUMBER, moves NUMBER, time NUMBER)'); + tx.executeSql(dataStr, data); + } + ); +} + +function nuke() //For "Debug mode" +{ + for (var row = 1; row <= 5; row++) { + for (var col = 0; col < 5; col++) { + if (board[index(col, maxRow - row)] != null) { + board[index(col, maxRow - row)].dying = true; + board[index(col, maxRow - row)] = null; + } + } + } + if (gameMode == "multiplayer" && gameCanvas.curTurn == 2) + shuffleUp(); + else + shuffleDown(); + if (gameMode == "endless") + refill(); + else + victoryCheck(); +} diff --git a/examples/quick/demos/samegame/main.cpp b/examples/quick/demos/samegame/main.cpp new file mode 100644 index 0000000000..20bf7fad18 --- /dev/null +++ b/examples/quick/demos/samegame/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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(samegame) diff --git a/examples/quick/demos/samegame/samegame.pro b/examples/quick/demos/samegame/samegame.pro new file mode 100644 index 0000000000..fec2e53018 --- /dev/null +++ b/examples/quick/demos/samegame/samegame.pro @@ -0,0 +1,9 @@ +TEMPLATE = app + +QT += qml quick +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/samegame +qml.files = samegame.qml content settings.js +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/samegame +INSTALLS += target qml diff --git a/examples/quick/demos/samegame/samegame.qml b/examples/quick/demos/samegame/samegame.qml new file mode 100644 index 0000000000..2b0b82a37c --- /dev/null +++ b/examples/quick/demos/samegame/samegame.qml @@ -0,0 +1,371 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/samegame.js" as Logic +import "settings.js" as Settings +import "content" + +Rectangle { + id: root + width: 320; height: 480 + property int acc: 0 + + + function loadPuzzle() { + if (gameCanvas.mode != "") + Logic.cleanUp(); + Logic.startNewGame(gameCanvas,"puzzle","levels/level"+acc+".qml") + } + function nextPuzzle() { + acc = (acc + 1) % 10; + loadPuzzle(); + } + Timer { + id: gameOverTimer + interval: 1500 + running : gameCanvas.gameOver && gameCanvas.mode == "puzzle" //mode will be reset by cleanUp(); + repeat : false + onTriggered: { + Logic.cleanUp(); + nextPuzzle(); + } + } + + Image { + source: "content/gfx/background.png" + anchors.fill: parent + } + + GameArea { + id: gameCanvas + z: 1 + y: Settings.headerHeight + + width: parent.width + height: parent.height - Settings.headerHeight - Settings.footerHeight + + backgroundVisible: root.state == "in-game" + onModeChanged: if (gameCanvas.mode != "puzzle") puzzleWon = false; //UI has stricter constraints on this variable than the game does + Age { + groups: ["redspots", "greenspots", "bluespots", "yellowspots"] + enabled: root.state == "" + system: gameCanvas.ps + } + + onPuzzleLost: acc--;//So that nextPuzzle() reloads the current one + + } + + Item { + id: menu + z: 2 + width: parent.width; + anchors.top: parent.top + anchors.bottom: bottomBar.top + + LogoAnimation { + x: 64 + y: Settings.headerHeight + particleSystem: gameCanvas.ps + running: root.state == "" + } + Row { + x: 112 + y: 20 + Image { source: "content/gfx/logo-a.png" } + Image { source: "content/gfx/logo-m.png" } + Image { source: "content/gfx/logo-e.png" } + } + + Column { + y: 100 + 40 + spacing: Settings.menuButtonSpacing + + Button { + width: root.width + rotatedButton: true + imgSrc: "content/gfx/but-game-1.png" + onClicked: { + if (root.state == "in-game") + return //Prevent double clicking + root.state = "in-game" + gameCanvas.blockFile = "Block.qml" + gameCanvas.background = "gfx/background.png" + arcadeTimer.start(); + } + //Emitted particles don't fade out, because ImageParticle is on the GameArea + system: gameCanvas.ps + group: "green" + Timer { + id: arcadeTimer + interval: Settings.menuDelay + running : false + repeat : false + onTriggered: Logic.startNewGame(gameCanvas) + } + } + + Button { + width: root.width + rotatedButton: true + imgSrc: "content/gfx/but-game-2.png" + onClicked: { + if (root.state == "in-game") + return + root.state = "in-game" + gameCanvas.blockFile = "Block.qml" + gameCanvas.background = "gfx/background.png" + twopTimer.start(); + } + system: gameCanvas.ps + group: "green" + Timer { + id: twopTimer + interval: Settings.menuDelay + running : false + repeat : false + onTriggered: Logic.startNewGame(gameCanvas, "multiplayer") + } + } + + Button { + width: root.width + rotatedButton: true + imgSrc: "content/gfx/but-game-3.png" + onClicked: { + if (root.state == "in-game") + return + root.state = "in-game" + gameCanvas.blockFile = "SimpleBlock.qml" + gameCanvas.background = "gfx/background.png" + endlessTimer.start(); + } + system: gameCanvas.ps + group: "blue" + Timer { + id: endlessTimer + interval: Settings.menuDelay + running : false + repeat : false + onTriggered: Logic.startNewGame(gameCanvas, "endless") + } + } + + Button { + width: root.width + rotatedButton: true + imgSrc: "content/gfx/but-game-4.png" + group: "yellow" + onClicked: { + if (root.state == "in-game") + return + root.state = "in-game" + gameCanvas.blockFile = "PuzzleBlock.qml" + gameCanvas.background = "gfx/background.png" + puzzleTimer.start(); + } + Timer { + id: puzzleTimer + interval: Settings.menuDelay + running : false + repeat : false + onTriggered: loadPuzzle(); + } + system: gameCanvas.ps + } + } + } + + Image { + id: scoreBar + source: "content/gfx/bar.png" + width: parent.width + z: 6 + y: -Settings.headerHeight + height: Settings.headerHeight + Behavior on opacity { NumberAnimation {} } + SamegameText { + id: arcadeScore + anchors { right: parent.right; topMargin: 3; rightMargin: 11; top: parent.top} + text: 'P1: ' + gameCanvas.score + font.pixelSize: Settings.fontPixelSize + textFormat: Text.StyledText + color: "white" + opacity: gameCanvas.mode == "arcade" ? 1 : 0 + Behavior on opacity { NumberAnimation {} } + } + SamegameText { + id: arcadeHighScore + anchors { left: parent.left; topMargin: 3; leftMargin: 11; top: parent.top} + text: 'Highscore: ' + gameCanvas.highScore + opacity: gameCanvas.mode == "arcade" ? 1 : 0 + } + SamegameText { + id: p1Score + anchors { right: parent.right; topMargin: 3; rightMargin: 11; top: parent.top} + text: 'P1: ' + gameCanvas.score + opacity: gameCanvas.mode == "multiplayer" ? 1 : 0 + } + SamegameText { + id: p2Score + anchors { left: parent.left; topMargin: 3; leftMargin: 11; top: parent.top} + text: 'P2: ' + gameCanvas.score2 + opacity: gameCanvas.mode == "multiplayer" ? 1 : 0 + rotation: 180 + } + SamegameText { + id: puzzleMoves + anchors { left: parent.left; topMargin: 3; leftMargin: 11; top: parent.top} + text: 'Moves: ' + gameCanvas.moves + opacity: gameCanvas.mode == "puzzle" ? 1 : 0 + } + SamegameText { + Image { + source: "content/gfx/icon-time.png" + x: -20 + } + id: puzzleTime + anchors { topMargin: 3; top: parent.top; horizontalCenter: parent.horizontalCenter; horizontalCenterOffset: 20} + text: "00:00" + opacity: gameCanvas.mode == "puzzle" ? 1 : 0 + Timer { + interval: 1000 + repeat: true + running: gameCanvas.mode == "puzzle" && !gameCanvas.gameOver + onTriggered: { + var elapsed = Math.floor((new Date() - Logic.gameDuration)/ 1000.0); + var mins = Math.floor(elapsed/60.0); + var secs = (elapsed % 60); + puzzleTime.text = (mins < 10 ? "0" : "") + mins + ":" + (secs < 10 ? "0" : "") + secs; + } + } + } + SamegameText { + id: puzzleScore + anchors { right: parent.right; topMargin: 3; rightMargin: 11; top: parent.top} + text: 'Score: ' + gameCanvas.score + opacity: gameCanvas.mode == "puzzle" ? 1 : 0 + } + } + + Image { + id: bottomBar + width: parent.width + height: Settings.footerHeight + source: "content/gfx/bar.png" + y: parent.height - Settings.footerHeight; + z: 2 + Button { + id: quitButton + height: Settings.toolButtonHeight + imgSrc: "content/gfx/but-quit.png" + onClicked: {Qt.quit(); } + anchors { left: parent.left; verticalCenter: parent.verticalCenter; leftMargin: 11 } + } + Button { + id: menuButton + height: Settings.toolButtonHeight + imgSrc: "content/gfx/but-menu.png" + visible: (root.state == "in-game"); + onClicked: {root.state = ""; Logic.cleanUp(); gameCanvas.mode = ""} + anchors { left: quitButton.right; verticalCenter: parent.verticalCenter; leftMargin: 0 } + } + Button { + id: againButton + height: Settings.toolButtonHeight + imgSrc: "content/gfx/but-game-new.png" + visible: (root.state == "in-game"); + opacity: gameCanvas.gameOver && (gameCanvas.mode == "arcade" || gameCanvas.mode == "multiplayer") + Behavior on opacity{ NumberAnimation {} } + onClicked: {if (gameCanvas.gameOver) { Logic.startNewGame(gameCanvas, gameCanvas.mode);}} + anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 11 } + } + Button { + id: nextButton + height: Settings.toolButtonHeight + imgSrc: "content/gfx/but-puzzle-next.png" + visible: (root.state == "in-game") && gameCanvas.mode == "puzzle" && gameCanvas.puzzleWon + opacity: gameCanvas.puzzleWon ? 1 : 0 + Behavior on opacity{ NumberAnimation {} } + onClicked: {if (gameCanvas.puzzleWon) nextPuzzle();} + anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 11 } + } + } + + Connections { + target: root + onStateChanged: stateChangeAnim.running = true + } + SequentialAnimation { + id: stateChangeAnim + ParallelAnimation { + NumberAnimation { target: bottomBar; property: "y"; to: root.height; duration: Settings.menuDelay/2; easing.type: Easing.OutQuad } + NumberAnimation { target: scoreBar; property: "y"; to: -Settings.headerHeight; duration: Settings.menuDelay/2; easing.type: Easing.OutQuad } + } + ParallelAnimation { + NumberAnimation { target: bottomBar; property: "y"; to: root.height - Settings.footerHeight; duration: Settings.menuDelay/2; easing.type: Easing.OutBounce} + NumberAnimation { target: scoreBar; property: "y"; to: root.state == "" ? -Settings.headerHeight : 0; duration: Settings.menuDelay/2; easing.type: Easing.OutBounce} + } + } + + states: [ + State { + name: "in-game" + PropertyChanges { + target: menu + opacity: 0 + visible: false + } + } + ] + + transitions: [ + Transition { + NumberAnimation {properties: "x,y,opacity"} + } + ] + + //"Debug mode" + focus: true + Keys.onAsteriskPressed: Logic.nuke(); + Keys.onSpacePressed: gameCanvas.puzzleWon = true; +} diff --git a/examples/quick/demos/samegame/samegame.qmlproject b/examples/quick/demos/samegame/samegame.qmlproject new file mode 100644 index 0000000000..42ffacf4f8 --- /dev/null +++ b/examples/quick/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/quick/demos/samegame/settings.js b/examples/quick/demos/samegame/settings.js new file mode 100644 index 0000000000..e09dee9af3 --- /dev/null +++ b/examples/quick/demos/samegame/settings.js @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Research In Motion +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +.pragma library + +//This should be switched over once a proper QML settings API exists + +var menuDelay = 500 + +var headerHeight = 20 // 70 on BB10 +var footerHeight = 44 // 100 on BB10 + +var fontPixelSize = 14 // 55 on BB10 + +var blockSize = 32 // 64 on BB10 + +var toolButtonHeight = 32 // 64 on BB10 + +var menuButtonSpacing = 0 // 15 on BB10 diff --git a/examples/quick/demos/stocqt/content/Button.qml b/examples/quick/demos/stocqt/content/Button.qml new file mode 100644 index 0000000000..0e99c52c51 --- /dev/null +++ b/examples/quick/demos/stocqt/content/Button.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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:button + property bool buttonEnabled:true + radius:5 + width:25 + height:25 + color:buttonEnabled ? "steelblue" : "gray" + MouseArea { + anchors.fill:parent + onClicked: { + if (buttonEnabled) + buttonEnabled = false; + else + buttonEnabled = true; + } + } +} diff --git a/examples/quick/demos/stocqt/content/DatePicker.qml b/examples/quick/demos/stocqt/content/DatePicker.qml new file mode 100644 index 0000000000..82d8788bd9 --- /dev/null +++ b/examples/quick/demos/stocqt/content/DatePicker.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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:"transparent" + width:300 + height:45 + property var _monthNames : [ "JAN", "FEB", "MAR", "APR", "MAY", "JUN","JUL", "AUG", "SEP", "OCT", "NOV", "DEC" ]; + property var date:new Date() + + onDateChanged: { + month.text = root._monthNames[root.date.getMonth()] + day.text = date.getDate(); + year.text = date.getFullYear(); + } + Row { + spacing:20 + anchors.fill:parent + + Rectangle { + height:root.height + width:root.width/3 - 20 + color:"#272822" + radius:5 + + TextInput { + id:month + anchors.centerIn:parent + color:"#ecc089" + font.pointSize:25 + font.bold:true + text:root._monthNames[root.date.getMonth()] + onAccepted : { + for (var i = 0; i < 12; i++) { + if (text === root._monthNames[i]) { + root.date.setMonth(i); + root.date = root.date; + return; + } + } + root.date = root.date; + } + } + } + + Rectangle { + height:root.height + width:root.width/3 - 20 + color:"#272822" + radius:5 + + TextInput { + id:day + anchors.centerIn:parent + color:"#ecc089" + font.pointSize:25 + font.bold:true + text:root.date.getDate() + validator:IntValidator {bottom:1; top:31} + onAccepted: { root.date.setDate(text); root.date = root.date;} + } + } + + Rectangle { + height:root.height + width:root.width/3 - 20 + color:"#272822" + radius:5 + + TextInput { + id:year + anchors.centerIn:parent + color:"#ecc089" + font.pointSize:25 + font.bold:true + text:root.date.getFullYear() + validator:IntValidator {bottom:1995; top:(new Date()).getFullYear()} + onAccepted:{ root.date.setFullYear(text); root.date = root.date;} + } + } + } +} diff --git a/examples/quick/demos/stocqt/content/StockChart.qml b/examples/quick/demos/stocqt/content/StockChart.qml new file mode 100644 index 0000000000..c7411679bb --- /dev/null +++ b/examples/quick/demos/stocqt/content/StockChart.qml @@ -0,0 +1,324 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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:chart + width:320 + height:320 + color:"transparent" + property var _months : [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ] + property var stockModel:null + property var startDate + property var endDate + property var settings + + function update() { + if (settings.chartType === "year") + chart.startDate = new Date(chart.endDate.getFullYear() - 1, chart.endDate.getMonth(), chart.endDate.getDate()); + else if (settings.chartType === "month") + chart.startDate = new Date(chart.endDate.getFullYear() , chart.endDate.getMonth() -1, chart.endDate.getDate()) + else if (settings.chartType === "week") + chart.startDate = new Date(chart.endDate.getFullYear() , chart.endDate.getMonth(), chart.endDate.getDate() - 7) + else + chart.startDate = new Date(1995, 3, 25) + + canvas.requestPaint(); + } + + + Text { + id:fromDate + color:"#6a5b44" + width:50 + font.pointSize: 10 + wrapMode: Text.WordWrap + anchors.left: parent.left + anchors.leftMargin: 20 + anchors.top:parent.top + text:_months[startDate.getMonth()] + "\n" + startDate.getFullYear() + } + + Text { + id:toDate + color:"#6a5b44" + font.pointSize: 10 + width:50 + wrapMode: Text.WordWrap + anchors.right: parent.right + anchors.leftMargin: 20 + anchors.top:parent.top + text:_months[endDate.getMonth()] + "\n" + endDate.getFullYear() + } + + Canvas { + id:canvas + anchors.top : toDate.bottom + width:parent.width + anchors.bottom: parent.bottom + + renderTarget: Canvas.FramebufferObject + 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:0; + +// MouseArea { +// anchors.fill: parent + +// 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 drawBackground(ctx) { + ctx.save(); + ctx.fillStyle = "#272822" + ctx.fillRect(0, 0, canvas.width, canvas.height) + ctx.strokeStyle = "#423a2f" + ctx.beginPath(); + for (var i = 0; i < 10; i++) { + ctx.moveTo(0, i * (canvas.height/10.0)); + ctx.lineTo(canvas.width, i * (canvas.height/10.0)); + } + + for (i = 0; i < 12; i++) { + ctx.moveTo(i * (canvas.width/12.0), 0); + ctx.lineTo(i * (canvas.width/12.0), canvas.height); + } + ctx.stroke(); + + ctx.strokeStyle = "#5c7a37" + ctx.beginPath(); + ctx.moveTo(8 * (canvas.width/12.0), 0); + ctx.lineTo(8 * (canvas.width/12.0), canvas.height); + ctx.stroke(); + + ctx.restore(); + } + + function drawPrice(ctx, from, to, color, price, points, highest) + { + ctx.save(); + ctx.globalAlpha = 0.7; + ctx.strokeStyle = color; + ctx.lineWidth = 1; + ctx.beginPath(); + + var w = canvas.width/points.length; + var end = points.length; + for (var i = 0; i < end; i++) { + var x = points[i].x; + var y = points[i][price]; + y = canvas.height * y/highest; + if (i == 0) { + ctx.moveTo(x+w/2, y); + } else { + ctx.lineTo(x+w/2, y); + } + } + ctx.stroke(); + ctx.restore(); + } + + function drawKLine(ctx, from, to, points, highest) + { + ctx.save(); + ctx.globalAlpha = 0.4; + ctx.lineWidth = 2; + var end = points.length; + for (var i = 0; i < end; i++) { + var x = points[i].x; + var open = canvas.height * points[i].open/highest - canvas.movedY; + var close = canvas.height * points[i].close/highest - canvas.movedY; + var high = canvas.height * points[i].high/highest - canvas.movedY; + var low = canvas.height * 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.restore(); + } + + function drawVolume(ctx, from, to, color, price, points, highest) + { + ctx.save(); + ctx.fillStyle = color; + ctx.globalAlpha = 0.6; + ctx.strokeStyle = Qt.rgba(0.8, 0.8, 0.8, 1); + ctx.lineWidth = 1; + + var end = 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); + } + ctx.restore(); + } + + onPaint: { + var ctx = canvas.getContext("2d"); + + ctx.globalCompositeOperation = "source-over"; + ctx.lineWidth = 1; + + drawBackground(ctx); + if (!stockModel.ready) + return; + + last = stockModel.indexOf(chart.endDate) + first = last - (chart.endDate.getTime() - chart.startDate.getTime())/86400000; + console.log("painting... first:" + first + ", last:" + last); + + var highestPrice = stockModel.highestPrice; + var highestVolume = stockModel.highestVolume; + console.log("highest price:" + highestPrice + ", highest volume:" + highestVolume) + var points = []; + for (var i = 0; i <= last - first; i++) { + var price = stockModel.get(i + first); + points.push({ + x: i*canvas.width/(last-first+1), + open: price.open, + close: price.close, + high:price.high, + low:price.low, + volume:price.volume + }); + } + if (settings.drawHighPrice) + drawPrice(ctx, first, last, settings.highColor,"high", points, highestPrice); + if (settings.drawLowPrice) + drawPrice(ctx, first, last, settings.lowColor,"low", points, highestPrice); + if (settings.drawOpenPrice) + drawPrice(ctx, first, last,settings.openColor,"open", points, highestPrice); + if (settings.drawClosePrice) + drawPrice(ctx, first, last, settings.closeColor,"close", points, highestPrice); + if (settings.drawVolume) + drawVolume(ctx, first, last, settings.volumeColor,"volume", points, highestVolume); + if (settings.drawKLine) + drawKLine(ctx, first, last, points, highestPrice); + } +} +} diff --git a/examples/quick/demos/stocqt/content/StockListModel.qml b/examples/quick/demos/stocqt/content/StockListModel.qml new file mode 100644 index 0000000000..b1e0706a3a --- /dev/null +++ b/examples/quick/demos/stocqt/content/StockListModel.qml @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/demos/stocqt/content/StockListView.qml b/examples/quick/demos/stocqt/content/StockListView.qml new file mode 100644 index 0000000000..c241efb54c --- /dev/null +++ b/examples/quick/demos/stocqt/content/StockListView.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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:"#423A2F" + + property string currentStockId:"" + property string currentStockName:"" + + ListView { + id:view + anchors.fill:parent + keyNavigationWraps:true + focus:true + snapMode: ListView.SnapToItem + model:StockListModel{} + + onCurrentIndexChanged: { + root.currentStockId = model.get(currentIndex).stockId + root.currentStockName = model.get(currentIndex).name + console.log("current stock:" + root.currentStockId + " - " + root.currentStockName) + } + + delegate:Rectangle { + height:30 + width:parent.width + color:"transparent" + MouseArea { + anchors.fill: parent + onClicked:view.currentIndex = index + } + + Text { + anchors.verticalCenter : parent.top + anchors.verticalCenterOffset : 15 + color:index == view.currentIndex ? "#ECC089" : "#A58963" + font.pointSize:12 + font.bold:true + text:" " + stockId + " - " + name + } + } + + highlight:Image {height:30; width:parent.width; source:"images/stock-selected.png"} + } +} \ No newline at end of file diff --git a/examples/quick/demos/stocqt/content/StockModel.qml b/examples/quick/demos/stocqt/content/StockModel.qml new file mode 100644 index 0000000000..b5a78548e4 --- /dev/null +++ b/examples/quick/demos/stocqt/content/StockModel.qml @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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:model + property string stockId:"" + property string stockName:"" + property var startDate + property var endDate + property string stockDataCycle:"d" + property bool ready:false + property real stockPrice:0.0 + property real stockPriceChanged:0.0 + property real highestPrice:0 + property real highestVolume:0 + + signal dataReady + + function indexOf(date) { + var end = new Date(model.get(0).date) + var start = new Date(model.get(model.count - 1).date) + if (end <= date) + return model.count -1; + + if (start >= date) + return 0; + + for (var i = 0; i < model.count; i++) { + var d = new Date(model.get(i).date) + if ( d === date) + return i; + } + return -1; + } + + function requestUrl() { + if (stockId === "") + return; + + if (startDate === undefined) + startDate = new Date(1995, 3, 25) //default: 25 April 1995 + + if (endDate === undefined) + endDate = new Date(); //today + + if (stockDataCycle !== "d" && stockDataCycle !== "w" && stockDataCycle !== "m") + stockDataCycle = "d"; + + /* + 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) + */ + var request = "http://ichart.finance.yahoo.com/table.csv?"; + request += "s=" + stockId; + request += "&a=" + startDate.getDate(); + request += "&b=" + startDate.getMonth(); + request += "&c=" + startDate.getFullYear(); + request += "&d=" + endDate.getDate(); + request += "&e=" + endDate.getMonth(); + request += "&f=" + endDate.getFullYear(); + request += "&g=" + stockDataCycle; + request += "&ignore=.csv"; + return request; + } + + function createStockPrice(r) { + if (highestPrice < r[2]) + highestPrice = r[2]; + if (highestVolume < r[5]) + highestVolume = r[5]; + return { + "date": r[0], + "open":r[1], + "high":r[2], + "low":r[3], + "close":r[4], + "volume":r[5], + "adjusted":r[6] + }; + } + + function updateStock() { + var xhr = new XMLHttpRequest; + + var req = requestUrl(); + console.log("getting " + req + " ....."); + + xhr.open("GET", req); + + + model.ready = false; + model.clear(); + var i = 1; //skip the first line + xhr.onreadystatechange = function() { + if (xhr.readyState === XMLHttpRequest.LOADING || xhr.readyState === XMLHttpRequest.DONE) { + var records = xhr.responseText.split('\n'); + console.log("Updating:" + (records.length - i) + " records for " + model.stockId + " from:" + model.startDate + " to " + model.endDate) + + for (;i < records.length; i++ ) { + var r = records[i].split(','); + if (r.length === 7) + model.append(createStockPrice(r)); + } + + if (xhr.readyState === XMLHttpRequest.DONE) { + if (model.count > 0) { + console.log("done, total:" + model.count); + model.ready = true; + model.stockPrice = model.get(0).adjusted + model.stockPriceChanged = Math.round((model.stockPrice - model.get(2).adjusted) * 100) / 100 + model.dataReady(); //emit signal + } + } + } + } + xhr.send() + } +} diff --git a/examples/quick/demos/stocqt/content/StockSettings.qml b/examples/quick/demos/stocqt/content/StockSettings.qml new file mode 100644 index 0000000000..600747b969 --- /dev/null +++ b/examples/quick/demos/stocqt/content/StockSettings.qml @@ -0,0 +1,317 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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:"#423A2F" + property var startDate : startDatePicker.date; + property var endDate : endDatePicker.date; + + property bool drawHighPrice:highButton.buttonEnabled + property bool drawLowPrice:lowButton.buttonEnabled + property bool drawOpenPrice:openButton.buttonEnabled + property bool drawClosePrice:closeButton.buttonEnabled + property bool drawVolume:volumeButton.buttonEnabled + property bool drawKLine:klineButton.buttonEnabled + + property color highColor:Qt.rgba(1, 0, 0, 1) + property color lowColor:Qt.rgba(0, 1, 0, 1) + property color openColor:Qt.rgba(0, 0, 1, 1) + property color closeColor:"#ecc088" + property color volumeColor:Qt.rgba(0.3, 0.5, 0.7, 1) + + property string chartType:"year" + Image { + id:logo + source:"images/logo.png" + anchors.horizontalCenter : parent.horizontalCenter + anchors.top:parent.top + anchors.topMargin:15 + } + + Text { + id:startDateText + text:"START DATE:" + color:"#76644A" + font.pointSize:15 + anchors.left:parent.left + anchors.leftMargin:20 + anchors.top:logo.bottom + anchors.topMargin:20 + } + + DatePicker { + id:startDatePicker + anchors.left:parent.left + anchors.leftMargin:30 + anchors.top:startDateText.bottom + anchors.topMargin:15 + date : new Date(1995, 3, 25) + } + + Text { + id:endDateText + text:"END DATE:" + color:"#76644A" + font.pointSize:15 + anchors.left:parent.left + anchors.leftMargin:20 + anchors.top:startDatePicker.bottom + anchors.topMargin:20 + } + + DatePicker { + id:endDatePicker + anchors.left:parent.left + anchors.leftMargin:30 + anchors.top:endDateText.bottom + anchors.topMargin:15 + } + + Text { + id:drawOptionsText + text:"DRAW OPTIONS:" + color:"#76644A" + font.pointSize:15 + anchors.left:parent.left + anchors.leftMargin:20 + anchors.top:endDatePicker.bottom + anchors.topMargin:20 + } + Column { + id:drawOptions + anchors.top:drawOptionsText.bottom + anchors.topMargin: 20 + anchors.left: parent.left + anchors.leftMargin: 30 + spacing:2 + Row{ + spacing:10 + Text { + text:"High " + color:"#76644A" + font.pointSize:15 + } + + Button { + id:highButton + buttonEnabled:false + } + + Text { + text:"Low " + color:"#76644A" + font.pointSize:15 + } + + Button { + id:lowButton + buttonEnabled:false + } + + Text { + text:"Open " + color:"#76644A" + font.pointSize:15 + } + Button { + id:openButton + buttonEnabled:false + } + } + Row{ + spacing:10 + Text { + text:"Close " + color:"#76644A" + font.pointSize:15 + } + Button { + id:closeButton + buttonEnabled:true + } + Text { + text:"Volume" + color:"#76644A" + font.pointSize:15 + } + Button { + id:volumeButton + buttonEnabled:true + } + Text { + text:"K Line" + color:"#76644A" + font.pointSize:15 + } + Button { + id:klineButton + buttonEnabled:false + } + } + } + + + Text { + id:chartTypeText + text:"CHART TYPE:" + color:"#76644A" + font.pointSize:15 + anchors.left:parent.left + anchors.leftMargin:20 + anchors.top:drawOptions.bottom + anchors.topMargin:20 + } + Row { + anchors.left: parent.left + anchors.leftMargin: 20 + anchors.top : chartTypeText.bottom + anchors.topMargin: 20 + spacing:10 + Rectangle { + id:yearView + width:70 + height:30 + radius:10 + color:"steelblue" + Text { + anchors.horizontalCenter: parent.horizontalCenter + anchors.fill: parent + font.pointSize: 15 + text:"YEAR" + } + MouseArea { + anchors.fill: parent + onClicked: { + if (root.chartType != "year") { + root.chartType = "year"; + yearView.color = "steelblue" + monthView.color = "gray" + weekView.color = "gray" + allView.color = "gray" + } + } + } + } + Rectangle { + id:monthView + width:70 + radius:10 + height:30 + color:"gray" + Text { + anchors.fill: parent + anchors.horizontalCenter: parent.horizontalCenter + font.pointSize: 15 + color:"#ecc089" + text:"MONTH" + } + MouseArea { + anchors.fill: parent + onClicked: { + if (root.chartType != "month") { + root.chartType = "month"; + yearView.color = "gray" + monthView.color = "steelblue" + weekView.color = "gray" + allView.color = "gray" + } + } + } + + } + Rectangle { + id:weekView + height:30 + width:70 + radius:10 + color:"gray" + Text { + anchors.fill: parent + anchors.horizontalCenter: parent.horizontalCenter + font.pointSize: 15 + color:"#ecc089" + text:"WEEK" + } + MouseArea { + anchors.fill: parent + onClicked: { + if (root.chartType != "week") { + root.chartType = "week"; + yearView.color = "gray" + monthView.color = "gray" + weekView.color = "steelblue" + allView.color = "gray" + } + } + } + } + Rectangle { + id:allView + width:70 + radius:10 + height:30 + color:"gray" + Text { + anchors.horizontalCenter: parent.horizontalCenter + anchors.fill: parent + font.pointSize: 15 + color:"#ecc089" + text:"ALL" + } + MouseArea { + anchors.fill: parent + onClicked: { + if (root.chartType != "all") { + root.chartType = "all"; + yearView.color = "gray" + monthView.color = "gray" + weekView.color = "gray" + allView.color = "steelblue" + } + } + } + } + } +} diff --git a/examples/quick/demos/stocqt/content/StockView.qml b/examples/quick/demos/stocqt/content/StockView.qml new file mode 100644 index 0000000000..49e6c98622 --- /dev/null +++ b/examples/quick/demos/stocqt/content/StockView.qml @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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:"#423A2F" + property var stock:null + property var stocklist:null + property var settings:null + signal listViewClicked + signal settingsClicked + + function update() { + chart.endDate = settings.endDate + chart.update() + } + + Rectangle { + color:"#272822" + anchors.fill:parent + radius:20 + + Image { + source:"images/icon-items.png" + anchors.left:parent.left + anchors.leftMargin:10 + anchors.top:parent.top + anchors.topMargin:10 + MouseArea { + anchors.fill:parent + onClicked:listViewClicked() + } + } + Image { + source:"images/icon-settings.png" + anchors.right:parent.right + anchors.rightMargin:10 + anchors.top:parent.top + anchors.topMargin:10 + MouseArea { + anchors.fill:parent + onClicked:settingsClicked() + } + } + + Text { + id:desc + anchors.left:parent.left + anchors.leftMargin:20 + anchors.top:parent.top + anchors.topMargin:40 + color:"#564c3A" + font.pointSize:15 + text:root.stock.stockId + " - " + root.stock.stockName + } + + Text { + id:price + anchors.left:parent.left + anchors.leftMargin:20 + anchors.top:desc.bottom + anchors.topMargin:5 + color:"#ECC089" + font.pointSize:30 + text:root.stock.stockPrice + } + + Text { + id:priceChange + anchors.left:parent.left + anchors.leftMargin:20 + anchors.top:price.bottom + anchors.topMargin:5 + color: root.stock.stockPriceChanged < 0 ? "#A43D3D" : "#679B3A" + font.pointSize:25 + text: root.stock.stockPriceChanged + " (" + Math.abs(Math.round(root.stock.stockPriceChanged/(root.stock.stockPrice - root.stock.stockPriceChanged) * 100))/100 +"%)" + } + + StockChart { + id:chart + anchors.bottom: parent.bottom + anchors.top : priceChange.bottom + anchors.topMargin: 30 + width:parent.width + stockModel:root.stock + settings:root.settings + } + } +} diff --git a/examples/quick/demos/stocqt/content/images/icon-calendar-anim.png b/examples/quick/demos/stocqt/content/images/icon-calendar-anim.png new file mode 100644 index 0000000000..c5164d5183 Binary files /dev/null and b/examples/quick/demos/stocqt/content/images/icon-calendar-anim.png differ diff --git a/examples/quick/demos/stocqt/content/images/icon-calendar.png b/examples/quick/demos/stocqt/content/images/icon-calendar.png new file mode 100644 index 0000000000..bd2857470b Binary files /dev/null and b/examples/quick/demos/stocqt/content/images/icon-calendar.png differ diff --git a/examples/quick/demos/stocqt/content/images/icon-items.png b/examples/quick/demos/stocqt/content/images/icon-items.png new file mode 100644 index 0000000000..f951aa5009 Binary files /dev/null and b/examples/quick/demos/stocqt/content/images/icon-items.png differ diff --git a/examples/quick/demos/stocqt/content/images/icon-settings.png b/examples/quick/demos/stocqt/content/images/icon-settings.png new file mode 100644 index 0000000000..222d998289 Binary files /dev/null and b/examples/quick/demos/stocqt/content/images/icon-settings.png differ diff --git a/examples/quick/demos/stocqt/content/images/logo.png b/examples/quick/demos/stocqt/content/images/logo.png new file mode 100644 index 0000000000..90c7c3ba3d Binary files /dev/null and b/examples/quick/demos/stocqt/content/images/logo.png differ diff --git a/examples/quick/demos/stocqt/content/images/stock-selected.png b/examples/quick/demos/stocqt/content/images/stock-selected.png new file mode 100644 index 0000000000..5629796b9c Binary files /dev/null and b/examples/quick/demos/stocqt/content/images/stock-selected.png differ diff --git a/examples/quick/demos/stocqt/content/images/wheel-touch.png b/examples/quick/demos/stocqt/content/images/wheel-touch.png new file mode 100644 index 0000000000..11c8120ada Binary files /dev/null and b/examples/quick/demos/stocqt/content/images/wheel-touch.png differ diff --git a/examples/quick/demos/stocqt/content/images/wheel.png b/examples/quick/demos/stocqt/content/images/wheel.png new file mode 100644 index 0000000000..470a675b35 Binary files /dev/null and b/examples/quick/demos/stocqt/content/images/wheel.png differ diff --git a/examples/quick/demos/stocqt/main.cpp b/examples/quick/demos/stocqt/main.cpp new file mode 100644 index 0000000000..779d204a24 --- /dev/null +++ b/examples/quick/demos/stocqt/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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(stocqt) diff --git a/examples/quick/demos/stocqt/stocqt.pro b/examples/quick/demos/stocqt/stocqt.pro new file mode 100644 index 0000000000..f33c4aee01 --- /dev/null +++ b/examples/quick/demos/stocqt/stocqt.pro @@ -0,0 +1,9 @@ +TEMPLATE = app + +QT += qml quick +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/stocqt +qml.files = stocqt.qml content +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/stocqt +INSTALLS += target qml diff --git a/examples/quick/demos/stocqt/stocqt.qml b/examples/quick/demos/stocqt/stocqt.qml new file mode 100644 index 0000000000..3f8a84a810 --- /dev/null +++ b/examples/quick/demos/stocqt/stocqt.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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" + +ListView { + id:root + width:320 + height:480 + snapMode:ListView.SnapOneItem + focus:false + orientation : ListView.Horizontal + boundsBehavior : Flickable.StopAtBounds + currentIndex : 1 + + StockModel { + id:stock + stockId:listView.currentStockId + stockName: listView.currentStockName + startDate: settings.startDate + endDate:settings.endDate + onStockIdChanged: updateStock() + onStartDateChanged: updateStock() + onEndDateChanged: updateStock() + onDataReady: { + root.currentIndex = 1 + stockView.update() + } + } + + model: VisualItemModel { + StockListView { + id:listView + width:root.width + height:root.height + } + + StockView { + id:stockView + width:root.width + height:root.height + stocklist : listView + settings : settings + stock: stock + + onListViewClicked:root.currentIndex = 0 + onSettingsClicked:root.currentIndex = 2 + } + + StockSettings { + id:settings + width:root.width + height:root.height + onDrawHighPriceChanged: stockView.update() + onDrawLowPriceChanged: stockView.update() + onDrawOpenPriceChanged: stockView.update() + onDrawClosePriceChanged: stockView.update() + onDrawVolumeChanged: stockView.update() + onDrawKLineChanged: stockView.update() + onChartTypeChanged: stockView.update() + } + } +} diff --git a/examples/quick/demos/stocqt/stocqt.qmlproject b/examples/quick/demos/stocqt/stocqt.qmlproject new file mode 100644 index 0000000000..11ab78418a --- /dev/null +++ b/examples/quick/demos/stocqt/stocqt.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "stocqt.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/quick/demos/tweetsearch/content/FlipBar.qml b/examples/quick/demos/tweetsearch/content/FlipBar.qml new file mode 100644 index 0000000000..06aebcacb1 --- /dev/null +++ b/examples/quick/demos/tweetsearch/content/FlipBar.qml @@ -0,0 +1,173 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 int animDuration: 300 + property Item front: Item {} + property Item back: Item {} + property real factor: 0.1 // amount the edges fold in for the 3D effect + property alias delta: effect.delta + property Item cur: frontShown ? front : back + property Item noncur: frontShown ? back : front + + function swap() { + var tmp = front; + front = back; + back = tmp; + resync(); + } + + width: cur.width + height: cur.height + onFrontChanged: resync(); + onBackChanged: resync(); + + function resync() {//TODO: Are the items ever actually visible? + back.parent = container; + front.parent = container; + frontShown ? back.visible = false : front.visible = false; + } + + property bool frontShown: true + + onFrontShownChanged: { + back.visible = !frontShown + front.visible = frontShown + } + + function flipUp(start) { + effect.visible = true; + effect.sourceA = effect.source1 + effect.sourceB = effect.source2 + if (start == undefined) + start = 1.0; + deltaAnim.from = start; + deltaAnim.to = 0.0 + dAnim.start(); + frontShown = false; + } + + function flipDown(start) { + effect.visible = true; + effect.sourceA = effect.source1 + effect.sourceB = effect.source2 + if (start == undefined) + start = 0.0; + deltaAnim.from = start; + deltaAnim.to = 1.0 + dAnim.start(); + frontShown = true; + } + + ShaderEffect { + id: effect + width: cur.width + height: cur.height + property real factor: container.factor * width + property real delta: 1.0 + + mesh: GridMesh { resolution: Qt.size(8,2) } + + SequentialAnimation on delta { + id: dAnim + running: false + NumberAnimation { + id: deltaAnim + duration: animDuration//expose anim + } + } + + property variant sourceA: source1 + property variant sourceB: source1 + property variant source1: ShaderEffectSource { + sourceItem: front + hideSource: effect.visible + } + + property variant source2: ShaderEffectSource { + sourceItem: back + hideSource: effect.visible + } + + fragmentShader: " + uniform lowp float qt_Opacity; + uniform sampler2D sourceA; + uniform sampler2D sourceB; + uniform highp float delta; + varying highp vec2 qt_TexCoord0; + void main() { + highp vec4 tex = vec4(qt_TexCoord0.x, qt_TexCoord0.y * 2.0, qt_TexCoord0.x, (qt_TexCoord0.y-0.5) * 2.0); + highp float shade = clamp(delta*2.0, 0.5, 1.0); + highp vec4 col; + if (qt_TexCoord0.y < 0.5) { + col = texture2D(sourceA, tex.xy) * (shade); + } else { + col = texture2D(sourceB, tex.zw) * (1.5 - shade); + col.w = 1.0; + } + gl_FragColor = col * qt_Opacity; + } + " + property real h: height + vertexShader: " + uniform highp float delta; + uniform highp float factor; + uniform highp float h; + uniform highp mat4 qt_Matrix; + attribute highp vec4 qt_Vertex; + attribute highp vec2 qt_MultiTexCoord0; + varying highp vec2 qt_TexCoord0; + void main() { + highp vec4 pos = qt_Vertex; + if (qt_MultiTexCoord0.y == 0.0) + pos.x += factor * (1. - delta) * (qt_MultiTexCoord0.x * -2.0 + 1.0); + else if (qt_MultiTexCoord0.y == 1.0) + pos.x += factor * (delta) * (qt_MultiTexCoord0.x * -2.0 + 1.0); + else + pos.y = delta * h; + gl_Position = qt_Matrix * pos; + qt_TexCoord0 = qt_MultiTexCoord0; + }" + + } +} diff --git a/examples/quick/demos/tweetsearch/content/LineInput.qml b/examples/quick/demos/tweetsearch/content/LineInput.qml new file mode 100644 index 0000000000..368293e961 --- /dev/null +++ b/examples/quick/demos/tweetsearch/content/LineInput.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: wrapper + + property alias text: input.text + property alias hint: hint.text + property alias prefix: prefix.text + + signal accepted + + Rectangle { + anchors.fill: parent + border.color: "#707070" + color: "#c1c1c1" + radius: 4 + + Text { + id: hint + anchors { fill: parent; leftMargin: 14 } + verticalAlignment: Text.AlignVCenter + text: "Enter word" + font.pixelSize: 18 + color: "#707070" + opacity: input.length ? 0 : 1 + } + + Text { + id: prefix + anchors { left: parent.left; leftMargin: 14; verticalCenter: parent.verticalCenter } + verticalAlignment: Text.AlignVCenter + font.pixelSize: 18 + color: "#707070" + opacity: !hint.opacity + } + + TextInput { + id: input + focus: true + anchors { left: prefix.right; right: parent.right; top: parent.top; bottom: parent.bottom } + verticalAlignment: Text.AlignVCenter + font.pixelSize: 18 + color: "#707070" + onAccepted: wrapper.accepted() + } + + Image { + source: "resources/icon-search.png" + anchors.right: parent.right + anchors.rightMargin: 12 + anchors.verticalCenter: parent.verticalCenter + MouseArea { + anchors { fill: parent; margins: -10 } + onClicked: wrapper.accepted() + } + } + } +} diff --git a/examples/quick/demos/tweetsearch/content/ListFooter.qml b/examples/quick/demos/tweetsearch/content/ListFooter.qml new file mode 100644 index 0000000000..91c1c8b331 --- /dev/null +++ b/examples/quick/demos/tweetsearch/content/ListFooter.qml @@ -0,0 +1,154 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: "#d6d6d6" + width: parent.width + height: childrenRect.height + z: 2 + Connections { + target: mainListView + onAutoSearch: { + if (type == 'tag') { + tagSearch.open() + tagSearch.searchText = str + } else if (type == 'user'){ + userSearch.open() + userSearch.searchText = str + } else { + wordSearch.open() + wordSearch.searchText = str + } + } + } + + Column { + width: parent.width + + SearchDelegate { + id: wordSearch + label: "Search word..." + placeHolder: "Enter word" + onHasOpened: { + tagSearch.close() + userSearch.close() + } + onOk: { + mainListView.positionViewAtBeginning() + mainListView.clear() + tweetsModel.from = "" + tweetsModel.phrase = searchText + } + } + + SearchDelegate { + id: userSearch + label: "From user..." + placeHolder: "@username" + prefix: "@" + onHasOpened:{ + tagSearch.close() + wordSearch.close() + } + onOk: { + mainListView.positionViewAtBeginning() + mainListView.clear() + tweetsModel.phrase = "" + tweetsModel.from = searchText + } + } + + SearchDelegate { + id: tagSearch + label: "Search hashtag..." + placeHolder: "#hashtag" + prefix: "#" + onHasOpened:{ + userSearch.close() + wordSearch.close() + } + onOk: { + mainListView.positionViewAtBeginning() + mainListView.clear() + tweetsModel.from = "" + tweetsModel.phrase = "#" + searchText + } + } + + SpriteSequence { + id: sprite + anchors.horizontalCenter: parent.horizontalCenter + width: 320 + height: 300 + running: true + interpolate: false + Sprite { + name: "bird" + source: "resources/bird-anim-sprites.png" + frameCount: 1 + frameRate: 1 + frameWidth: 320 + frameHeight: 300 + to: { "bird":10, "trill":1, "blink":1 } + } + Sprite { + name: "trill" + source: "resources/bird-anim-sprites.png" + frameCount: 5 + frameRate: 3 + frameWidth: 320 + frameHeight: 300 + to: {"bird":1} + } + Sprite { + name: "blink" + source: "resources/bird-anim-sprites.png" + frameCount: 1 + frameRate: 3 + frameWidth: 320 + frameHeight: 300 + frameX: 1600 + to: {"bird":1} + } + } + } +} diff --git a/examples/quick/demos/tweetsearch/content/ListHeader.qml b/examples/quick/demos/tweetsearch/content/ListHeader.qml new file mode 100644 index 0000000000..2fb673dc7c --- /dev/null +++ b/examples/quick/demos/tweetsearch/content/ListHeader.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 { + height: 60 + width: parent.width + + property bool refresh: state == "pulled" ? true : false + + Row { + spacing: 6 + height: childrenRect.height + anchors.centerIn: parent + + Image { + id: arrow + source: "resources/icon-refresh.png" + transformOrigin: Item.Center + Behavior on rotation { NumberAnimation { duration: 200 } } + } + + Text { + id: label + anchors.verticalCenter: arrow.verticalCenter + text: "Pull to refresh... " + font.pixelSize: 18 + color: "#999999" + } + } + + states: [ + State { + name: "base"; when: mainListView.contentY >= -120 + PropertyChanges { target: arrow; rotation: 180 } + }, + State { + name: "pulled"; when: mainListView.contentY < -120 + PropertyChanges { target: label; text: "Release to refresh..." } + PropertyChanges { target: arrow; rotation: 0 } + } + ] +} diff --git a/examples/quick/demos/tweetsearch/content/SearchDelegate.qml b/examples/quick/demos/tweetsearch/content/SearchDelegate.qml new file mode 100644 index 0000000000..fc0ee0b655 --- /dev/null +++ b/examples/quick/demos/tweetsearch/content/SearchDelegate.qml @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +FlipBar { + id: flipBar + animDuration: 250 + property string label: "" + property string placeHolder: "" + property alias searchText: lineInput.text + property alias prefix: lineInput.prefix + property bool opened: false + signal ok + signal hasOpened + + height: 60 + width: parent.width + + function open() { + flipBar.flipUp() + flipBar.opened = true + lineInput.forceActiveFocus() + flipBar.hasOpened() + } + + function close() { + if (opened) { + flipBar.flipDown() + flipBar.opened = false + } + } + + front: Rectangle { + height: 60 + width: parent.width + color: "#999999" + + Rectangle { color: "#c1c1c1"; width: parent.width; height: 1 } + Rectangle { color: "#707070"; width: parent.width; height: 1; anchors.bottom: parent.bottom } + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { + if (!flipBar.opened) + open() + else if (!lineInput.activeFocus) + lineInput.forceActiveFocus() + else + close() + } + } + + Text { + text: flipBar.label + anchors { left: parent.left; leftMargin: 20 } + anchors.verticalCenter: parent.verticalCenter + font.pixelSize: 18 + color: "#ffffff" + } + } + + back: FocusScope { + height: 60 + width: parent.width + Rectangle { + anchors.fill: parent + color: "#999999" + + Rectangle { color: "#c1c1c1"; width: parent.width; height: 1 } + Rectangle { color: "#707070"; width: parent.width; height: 1; anchors.bottom: parent.bottom } + + LineInput { + id: lineInput + hint: flipBar.placeHolder + focus: flipBar.opened + anchors { fill: parent; margins: 6 } + onAccepted: flipBar.ok() + } + } + } + +} diff --git a/examples/quick/demos/tweetsearch/content/TweetDelegate.qml b/examples/quick/demos/tweetsearch/content/TweetDelegate.qml new file mode 100644 index 0000000000..c336ae6f8a --- /dev/null +++ b/examples/quick/demos/tweetsearch/content/TweetDelegate.qml @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "tweetsearch.js" as Helper + +Item { + id: container + property real hm: 1.0 + property int appear: -1 + property real startRotation: 1 + + onAppearChanged: { + container.startRotation = 0.5 + flipBar.animDuration = appear; + delayedAnim.start(); + } + + SequentialAnimation { + id: delayedAnim + PauseAnimation { duration: 50 } + ScriptAction { script: flipBar.flipDown(startRotation); } + } + + width: 320 + height: flipBar.height * hm + + FlipBar { + id: flipBar + + property bool flipped: false + delta: startRotation + + anchors.bottom: parent.bottom + width: container.ListView.view ? container.ListView.view.width : 0 + height: Math.max(72, tweet.y + tweet.height + 10) + + front: Rectangle { + width: container.ListView.view ? container.ListView.view.width : 0 + height: Math.max(72, tweet.y + tweet.height + 10) + color: "#2699bf" + + Rectangle { color: "#33ccff"; width: parent.width; height: 1 } + Rectangle { color: "#1a6680"; width: parent.width; height: 1; anchors.bottom: parent.bottom } + + Image { + id: placeHolder + source: "resources/anonymous.png" + x: 10; y: 9 + visible: avatar.status != Image.Ready + } + + Image { + id: avatar + source: model.userImage + anchors.fill: placeHolder + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: { + flipBar.flipUp() + flipBar.flipped = true + } + } + } + + Text { + id: name + text: Helper.realName(model.name) + anchors { left: avatar.right; leftMargin: 10; top: avatar.top; topMargin: -3 } + font.pixelSize: 12 + font.bold: true + color: "white" + linkColor: "white" + } + + Text { + id: tweet + text: model.statusText + anchors { left: avatar.right; leftMargin: 10; top: name.bottom; topMargin: 0; right: parent.right; rightMargin: 10 } + wrapMode: Text.WordWrap + font.pixelSize: 12 + font.bold: false + color: "#adebff" + linkColor: "white" + onLinkActivated: { + var tag = link.split("http://search.twitter.com/search?q=%23") + var user = link.split("https://twitter.com/") + if (tag[1] != undefined) { + mainListView.positionViewAtBeginning() + mainListView.clear() + mainListView.autoSearch('tag', tag[1]) + tweetsModel.from = "" + tweetsModel.phrase = "#" + tag[1] + } else if (user[1] != undefined) { + mainListView.positionViewAtBeginning() + mainListView.clear() + mainListView.autoSearch('user', user[1]) + tweetsModel.phrase = "" + tweetsModel.from = user[1] + } else + Qt.openUrlExternally(link) + } + } + } + + back: Rectangle { + width: container.ListView.view ? container.ListView.view.width : 0 + height: Math.max(72, tweet.y + tweet.height + 10) + color: "#be4a25" + + Rectangle { color: "#ff6633"; width: parent.width; height: 1 } + Rectangle { color: "#80341a"; width: parent.width; height: 1; anchors.bottom: parent.bottom } + + Image { + id: avatar2 + source: model.userImage + anchors.right: parent.right + anchors.rightMargin: 10 + y: 9 + MouseArea { + anchors.fill: parent + onClicked: { + flipBar.flipDown() + flipBar.flipped = false + } + } + } + + Text { + id: username + text: Helper.twitterName(model.name) + x: 10; anchors { top: avatar2.top; topMargin: -3 } + font.pixelSize: 12 + font.bold: true + color: "white" + linkColor: "white" + } + + Text { + text: model.source + "
" + Helper.formatDate(model.published) + "
" + model.uri + x: 10; anchors { top: username.bottom; topMargin: 0 } + wrapMode: Text.WordWrap + font.pixelSize: 12 + font.bold: false + color: "#ffc2ad" + linkColor: "white" + onLinkActivated: Qt.openUrlExternally(link); + } + } + } +} diff --git a/examples/quick/demos/tweetsearch/content/TweetsModel.qml b/examples/quick/demos/tweetsearch/content/TweetsModel.qml new file mode 100644 index 0000000000..df6ecdcd7f --- /dev/null +++ b/examples/quick/demos/tweetsearch/content/TweetsModel.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +Item { + id: wrapper + + property variant model: xmlModel + property string from : "" + property string phrase : "" + + property string mode : "everyone" + property int status: xmlModel.status + + function reload() { xmlModel.reload(); } + + property bool isLoading: status == XmlListModel.Loading + property bool wasLoading: false + signal isLoaded + + XmlListModel { + id: xmlModel + + onStatusChanged: { + if (status == XmlListModel.Ready && wasLoading == true) + wrapper.isLoaded() + if (status == XmlListModel.Loading) + wasLoading = true; + else + wasLoading = false; + } + + function encodePhrase(x) { return encodeURIComponent(x); } + + source: (from == "" && phrase == "") ? "" : + 'http://search.twitter.com/search.atom?from='+from+"&rpp=10&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: "id"; query: "id/string()" } + XmlRole { name: "content"; query: "content/string()" } + XmlRole { name: "published"; query: "published/string()" } + XmlRole { name: "source"; query: "twitter:source/string()" } + XmlRole { name: "name"; query: "author/name/string()" } + XmlRole { name: "uri"; query: "author/uri/string()" } + XmlRole { name: "image"; query: "link[@rel = 'image']/@href/string()" } + + } +} diff --git a/examples/quick/demos/tweetsearch/content/resources/anonymous.png b/examples/quick/demos/tweetsearch/content/resources/anonymous.png new file mode 100644 index 0000000000..88fba26e90 Binary files /dev/null and b/examples/quick/demos/tweetsearch/content/resources/anonymous.png differ diff --git a/examples/quick/demos/tweetsearch/content/resources/bird-anim-sprites.png b/examples/quick/demos/tweetsearch/content/resources/bird-anim-sprites.png new file mode 100644 index 0000000000..4e8d7e6116 Binary files /dev/null and b/examples/quick/demos/tweetsearch/content/resources/bird-anim-sprites.png differ diff --git a/examples/quick/demos/tweetsearch/content/resources/icon-clear.png b/examples/quick/demos/tweetsearch/content/resources/icon-clear.png new file mode 100644 index 0000000000..75672f64c7 Binary files /dev/null and b/examples/quick/demos/tweetsearch/content/resources/icon-clear.png differ diff --git a/examples/quick/demos/tweetsearch/content/resources/icon-loading.png b/examples/quick/demos/tweetsearch/content/resources/icon-loading.png new file mode 100644 index 0000000000..8dbff8b70f Binary files /dev/null and b/examples/quick/demos/tweetsearch/content/resources/icon-loading.png differ diff --git a/examples/quick/demos/tweetsearch/content/resources/icon-refresh.png b/examples/quick/demos/tweetsearch/content/resources/icon-refresh.png new file mode 100644 index 0000000000..b639a638fe Binary files /dev/null and b/examples/quick/demos/tweetsearch/content/resources/icon-refresh.png differ diff --git a/examples/quick/demos/tweetsearch/content/resources/icon-search.png b/examples/quick/demos/tweetsearch/content/resources/icon-search.png new file mode 100644 index 0000000000..e41935a6c1 Binary files /dev/null and b/examples/quick/demos/tweetsearch/content/resources/icon-search.png differ diff --git a/examples/quick/demos/tweetsearch/content/tweetsearch.js b/examples/quick/demos/tweetsearch/content/tweetsearch.js new file mode 100644 index 0000000000..9b8638f69e --- /dev/null +++ b/examples/quick/demos/tweetsearch/content/tweetsearch.js @@ -0,0 +1,19 @@ +.pragma library + +function twitterName(str) +{ + var s = str.split("(") + return s[0] +} + +function realName(str) +{ + var s = str.split("(") + return s[1].substring(0, s[1].length-1) +} + +function formatDate(date) +{ + var da = new Date(date) + return da.toDateString() +} diff --git a/examples/quick/demos/tweetsearch/main.cpp b/examples/quick/demos/tweetsearch/main.cpp new file mode 100644 index 0000000000..8b1d59679c --- /dev/null +++ b/examples/quick/demos/tweetsearch/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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(tweetsearch) diff --git a/examples/quick/demos/tweetsearch/tweetsearch.pro b/examples/quick/demos/tweetsearch/tweetsearch.pro new file mode 100644 index 0000000000..887c05af88 --- /dev/null +++ b/examples/quick/demos/tweetsearch/tweetsearch.pro @@ -0,0 +1,9 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/tweetsearch +qml.files = tweetsearch.qml content +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/tweetsearch +INSTALLS += target qml diff --git a/examples/quick/demos/tweetsearch/tweetsearch.qml b/examples/quick/demos/tweetsearch/tweetsearch.qml new file mode 100644 index 0000000000..961ffce36b --- /dev/null +++ b/examples/quick/demos/tweetsearch/tweetsearch.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: 320 + height: 480 + color: "#d6d6d6" + + property string searchTerms: "" + property int inAnimDur: 250 + property int counter: 0 + property alias isLoading: tweetsModel.isLoading + property var idx + property var ids + + Component.onCompleted: ids = new Array() + + function idInModel(id) + { + for (var j = 0; j < ids.length; j++) + if (ids[j] === id) + return 1 + return 0 + } + + TweetsModel { + id: tweetsModel + onIsLoaded: { + console.debug("Reload") + idx = new Array() + for (var i = 0; i < tweetsModel.model.count; i++) { + var id = tweetsModel.model.get(i).id + if (!idInModel(id)) + idx.push(i) + } + console.debug(idx.length + " new tweets") + main.counter = idx.length + } + } + + Timer { + id: timer + interval: 500; running: main.counter; repeat: true + onTriggered: { + main.counter--; + var id = tweetsModel.model.get(idx[main.counter]).id + mainListView.add( { "statusText": tweetsModel.model.get(main.counter).content, + "name": tweetsModel.model.get(main.counter).name, + "userImage": tweetsModel.model.get(main.counter).image, + "source": tweetsModel.model.get(main.counter).source, + "id": id, + "uri": tweetsModel.model.get(main.counter).uri, + "published": tweetsModel.model.get(main.counter).published } ); + ids.push(id) + } + } + + ListView { + id: mainListView + anchors.fill: parent + delegate: TweetDelegate { } + model: ListModel { id: finalModel } + + add: Transition { + NumberAnimation { property: "hm"; from: 0; to: 1.0; duration: 300; easing.type: Easing.OutQuad } + PropertyAction { property: "appear"; value: 250 } + } + + onDragEnded: if (header.refresh) { tweetsModel.model.reload() } + + ListHeader { + id: header + y: -mainListView.contentY - height + } + + footer: ListFooter { } + + function clear() { + ids = new Array() + model.clear() + } + + function add(obj) { + model.insert(0, obj) + } + + signal autoSearch(string type, string str) // To communicate with Footer instance + } +} diff --git a/examples/quick/demos/tweetsearch/tweetsearch.qmlproject b/examples/quick/demos/tweetsearch/tweetsearch.qmlproject new file mode 100644 index 0000000000..5a0f31117b --- /dev/null +++ b/examples/quick/demos/tweetsearch/tweetsearch.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "tweetsearch.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/quick/draganddrop/draganddrop.pro b/examples/quick/draganddrop/draganddrop.pro index 7ec3e0e58a..451d03ad32 100644 --- a/examples/quick/draganddrop/draganddrop.pro +++ b/examples/quick/draganddrop/draganddrop.pro @@ -3,9 +3,7 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/draganddrop +target.path = $$[QT_INSTALL_EXAMPLES]/quick/draganddrop qml.files = draganddrop.qml tiles views -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/draganddrop -sources.files = $$SOURCES draganddrop.pro -sources.path = $$qml.path -INSTALLS += sources target qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/draganddrop +INSTALLS += target qml diff --git a/examples/quick/draganddrop/draganddrop.qml b/examples/quick/draganddrop/draganddrop.qml index 300a7abb20..234ea8b806 100644 --- a/examples/quick/draganddrop/draganddrop.qml +++ b/examples/quick/draganddrop/draganddrop.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../../shared" as Examples +import "../shared" as Examples Item { height: 480 diff --git a/examples/quick/draganddrop/main.cpp b/examples/quick/draganddrop/main.cpp index cc08df9ff4..7a7adf2391 100644 --- a/examples/quick/draganddrop/main.cpp +++ b/examples/quick/draganddrop/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" +#include "../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(draganddrop) diff --git a/examples/quick/imageelements/imageelements.pro b/examples/quick/imageelements/imageelements.pro index eddfb7429a..281b44f112 100644 --- a/examples/quick/imageelements/imageelements.pro +++ b/examples/quick/imageelements/imageelements.pro @@ -3,9 +3,7 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/imageelements +target.path = $$[QT_INSTALL_EXAMPLES]/quick/imageelements qml.files = *.qml content -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/imageelements -sources.files = $$SOURCES imageelements.pro -sources.path = $$qml.path -INSTALLS += sources target qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/imageelements +INSTALLS += target qml diff --git a/examples/quick/imageelements/imageelements.qml b/examples/quick/imageelements/imageelements.qml index 22ab45866b..a68ed3e73a 100644 --- a/examples/quick/imageelements/imageelements.qml +++ b/examples/quick/imageelements/imageelements.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../../shared" +import "../shared" Item { height: 480 diff --git a/examples/quick/imageelements/main.cpp b/examples/quick/imageelements/main.cpp index af4674e102..aa624e2229 100644 --- a/examples/quick/imageelements/main.cpp +++ b/examples/quick/imageelements/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" +#include "../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(imageelements) diff --git a/examples/quick/keyinteraction/keyinteraction.pro b/examples/quick/keyinteraction/keyinteraction.pro index 740001362e..a0c65be2d1 100644 --- a/examples/quick/keyinteraction/keyinteraction.pro +++ b/examples/quick/keyinteraction/keyinteraction.pro @@ -3,9 +3,7 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/keyinteraction +target.path = $$[QT_INSTALL_EXAMPLES]/quick/keyinteraction qml.files = keyinteraction.qml focus -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/keyinteraction -sources.files = $$SOURCES keyinteraction.pro -sources.path = $$qml.path -INSTALLS += sources target qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/keyinteraction +INSTALLS += target qml diff --git a/examples/quick/keyinteraction/keyinteraction.qml b/examples/quick/keyinteraction/keyinteraction.qml index 66a003172e..6a227ae08b 100644 --- a/examples/quick/keyinteraction/keyinteraction.qml +++ b/examples/quick/keyinteraction/keyinteraction.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../../shared" as Examples +import "../shared" as Examples Loader {//Just loader, since there's only one. source: "focus/focus.qml" diff --git a/examples/quick/keyinteraction/main.cpp b/examples/quick/keyinteraction/main.cpp index bbef71aec7..e82e1d86cd 100644 --- a/examples/quick/keyinteraction/main.cpp +++ b/examples/quick/keyinteraction/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" +#include "../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(keyinteraction) diff --git a/examples/quick/localstorage/doc/src/localstorage.qdoc b/examples/quick/localstorage/doc/src/localstorage.qdoc new file mode 100644 index 0000000000..45456abbab --- /dev/null +++ b/examples/quick/localstorage/doc/src/localstorage.qdoc @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** 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. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! + \title QtQuick Examples - Local Storage + \example localstorage + \brief This is a collection of QML local storage examples + \image qml-localstorage-example.png + + This is a collection of small QML examples relating to local storage functionality. + + Hello World demos creating a simple SQL table and how to do inserting/selecting operations. + +*/ + diff --git a/examples/quick/localstorage/localstorage.pro b/examples/quick/localstorage/localstorage.pro new file mode 100644 index 0000000000..dd2eb80250 --- /dev/null +++ b/examples/quick/localstorage/localstorage.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS += localstorage diff --git a/examples/quick/localstorage/localstorage/hello.qml b/examples/quick/localstorage/localstorage/hello.qml new file mode 100644 index 0000000000..5a25052675 --- /dev/null +++ b/examples/quick/localstorage/localstorage/hello.qml @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +Rectangle { + width: 200 + height: 100 + + Text { + text: "?" + anchors.horizontalCenter: parent.horizontalCenter + + function findGreetings() { + var db = LocalStorage.openDatabaseSync("QQmlExampleDB", "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/quick/localstorage/localstorage/localstorage.pro b/examples/quick/localstorage/localstorage/localstorage.pro new file mode 100644 index 0000000000..ef90b63546 --- /dev/null +++ b/examples/quick/localstorage/localstorage/localstorage.pro @@ -0,0 +1,9 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/localstorage/localstorage +qml.files = localstorage.qml hello.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/localstorage/localstorage +INSTALLS += target qml diff --git a/examples/quick/localstorage/localstorage/localstorage.qml b/examples/quick/localstorage/localstorage/localstorage.qml new file mode 100644 index 0000000000..c5b045460d --- /dev/null +++ b/examples/quick/localstorage/localstorage/localstorage.qml @@ -0,0 +1,54 @@ + /**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +Item { + height: 480 + width: 320 + Examples.LauncherList { + id: ll + anchors.fill: parent + Component.onCompleted: { + addExample("Hello World", "Simple SQL operations with local storage API", Qt.resolvedUrl("hello.qml")); + } + } +} diff --git a/examples/quick/localstorage/localstorage/localstorage.qmlproject b/examples/quick/localstorage/localstorage/localstorage.qmlproject new file mode 100644 index 0000000000..6835d23503 --- /dev/null +++ b/examples/quick/localstorage/localstorage/localstorage.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + mainFile: "localstorage.qml" + /* Include .qml, .js, and image files from current directory and subdirectories */ + + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} \ No newline at end of file diff --git a/examples/quick/localstorage/localstorage/main.cpp b/examples/quick/localstorage/localstorage/main.cpp new file mode 100644 index 0000000000..0f69fb7fdb --- /dev/null +++ b/examples/quick/localstorage/localstorage/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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(localstorage) diff --git a/examples/quick/modelviews/browser.prx b/examples/quick/modelviews/browser.prx new file mode 100644 index 0000000000..e9beacf0fb --- /dev/null +++ b/examples/quick/modelviews/browser.prx @@ -0,0 +1,18 @@ +TEMPLATE = app +TARGET = modelviews + +QT += quick qml +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/modelviews +qml.files = \ + modelviews.qml \ + gridview \ + listview \ + package \ + parallax \ + pathview \ + visualdatamodel \ + visualitemmodel +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/modelviews +INSTALLS += target qml diff --git a/examples/quick/modelviews/main.cpp b/examples/quick/modelviews/main.cpp index 082001cad2..84d52cbc12 100644 --- a/examples/quick/modelviews/main.cpp +++ b/examples/quick/modelviews/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" +#include "../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(modelviews) diff --git a/examples/quick/modelviews/modelviews.pro b/examples/quick/modelviews/modelviews.pro index 695c010263..101408f28d 100644 --- a/examples/quick/modelviews/modelviews.pro +++ b/examples/quick/modelviews/modelviews.pro @@ -1,19 +1,8 @@ -TEMPLATE = app +TEMPLATE = subdirs -QT += quick qml -SOURCES += main.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/modelviews -qml.files = \ - modelviews.qml \ - gridview \ - listview \ - package \ - parallax \ - pathview \ - visualdatamodel \ - visualitemmodel -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/modelviews -sources.files = $$SOURCES modelviews.pro -sources.path = $$qml.path -INSTALLS += sources target qml +browser.file = browser.prx +SUBDIRS = \ + browser \ +# abstractitemmodel \ # Does not build + objectlistmodel \ + stringlistmodel diff --git a/examples/quick/modelviews/modelviews.qml b/examples/quick/modelviews/modelviews.qml index d86bbf3416..2df91db7ff 100644 --- a/examples/quick/modelviews/modelviews.qml +++ b/examples/quick/modelviews/modelviews.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../../shared" as Examples +import "../shared" as Examples Item { height: 480 diff --git a/examples/quick/mousearea/main.cpp b/examples/quick/mousearea/main.cpp index d7fccf8f6c..34e0b3b396 100644 --- a/examples/quick/mousearea/main.cpp +++ b/examples/quick/mousearea/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" +#include "../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(mousearea) diff --git a/examples/quick/mousearea/mousearea.pro b/examples/quick/mousearea/mousearea.pro index cb876e41b5..eba203ba18 100644 --- a/examples/quick/mousearea/mousearea.pro +++ b/examples/quick/mousearea/mousearea.pro @@ -3,9 +3,10 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/mousearea +EXAMPLE_FILES = \ + mousearea-wheel-example.qml + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/mousearea qml.files = mousearea.qml -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/mousearea -sources.files = $$SOURCES mousearea.pro -sources.path = $$qml.path -INSTALLS += sources target qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/mousearea +INSTALLS += target qml diff --git a/examples/quick/particles/affectors/affectors.pro b/examples/quick/particles/affectors/affectors.pro new file mode 100644 index 0000000000..9d7c3de059 --- /dev/null +++ b/examples/quick/particles/affectors/affectors.pro @@ -0,0 +1,9 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/affectors +qml.files = affectors.qml content +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/affectors +INSTALLS += target qml diff --git a/examples/quick/particles/affectors/affectors.qml b/examples/quick/particles/affectors/affectors.qml new file mode 100644 index 0000000000..f8e132c2c0 --- /dev/null +++ b/examples/quick/particles/affectors/affectors.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +Item { + height: 480 + width: 320 + Examples.LauncherList { + id: ll + anchors.fill: parent + Component.onCompleted: { + addExample("Age", "Kills off particles that enter the affector", Qt.resolvedUrl("content/age.qml")); + addExample("Attractor", "Simulates a small black hole", Qt.resolvedUrl("content/attractor.qml")); + addExample("Custom Affector", "Custom falling leaves", Qt.resolvedUrl("content/customaffector.qml")); + addExample("Friction", "Leaves that slow down as they fall", Qt.resolvedUrl("content/friction.qml")); + addExample("Gravity", "Leaves that fall towards the earth as you move it", Qt.resolvedUrl("content/gravity.qml")); + addExample("GroupGoal", "Balls that can be set on fire various ways", Qt.resolvedUrl("content/groupgoal.qml")); + addExample("Move", "Some effects you can get by altering trajectory midway", Qt.resolvedUrl("content/move.qml")); + addExample("SpriteGoal", "A ship that makes asteroids explode", Qt.resolvedUrl("content/spritegoal.qml")); + addExample("Turbulence", "A candle with faint wind", Qt.resolvedUrl("content/turbulence.qml")); + addExample("Wander", "Drifting snow flakes", Qt.resolvedUrl("content/wander.qml")); + } + } +} diff --git a/examples/quick/particles/affectors/affectors.qmlproject b/examples/quick/particles/affectors/affectors.qmlproject new file mode 100644 index 0000000000..2bf3387155 --- /dev/null +++ b/examples/quick/particles/affectors/affectors.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "affectors.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/quick/particles/affectors/content/GreyButton.qml b/examples/quick/particles/affectors/content/GreyButton.qml new file mode 100644 index 0000000000..e3d3daa470 --- /dev/null +++ b/examples/quick/particles/affectors/content/GreyButton.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: "" + signal clicked + + width: buttonLabel.width + 20; height: col.height + 12 + + MouseArea { + id: mouseArea; + anchors.fill: parent; + onClicked: container.clicked(); + onPressed: background.color = Qt.darker("lightgrey"); + onReleased: background.color="lightgrey"; + } + + Rectangle { + id: background + anchors.fill: parent + color: "lightgrey" + radius: 4 + border.width: 1 + border.color: Qt.darker(color) + } + + Column { + spacing: 2 + id: col + x: 10 + y: 6 + 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/quick/particles/affectors/content/age.qml b/examples/quick/particles/affectors/content/age.qml new file mode 100644 index 0000000000..9b8d28dc7e --- /dev/null +++ b/examples/quick/particles/affectors/content/age.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + velocity: 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 + //! [0] + Age { + anchors.fill: parent + system: particles + once: true + lifeLeft: 1200 + advancePosition: false + } + //! [0] + } +} diff --git a/examples/quick/particles/affectors/content/attractor.qml b/examples/quick/particles/affectors/content/attractor.qml new file mode 100644 index 0000000000..5617f6eb86 --- /dev/null +++ b/examples/quick/particles/affectors/content/attractor.qml @@ -0,0 +1,190 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 { + source: "../../images/finalfrontier.png" + anchors.centerIn:parent + } + ParticleSystem { + id: particles + anchors.fill: parent + + Emitter { + group: "stars" + emitRate: 40 + lifeSpan: 4000 + enabled: true + size: 30 + sizeVariation: 10 + velocity: PointDirection { x: 220; xVariation: 40 } + height: parent.height + } + Emitter { + group: "roids" + emitRate: 10 + lifeSpan: 4000 + enabled: true + size: 30 + sizeVariation: 10 + velocity: PointDirection { x: 220; xVariation: 40 } + height: parent.height + } + ImageParticle { + id: stars + groups: ["stars"] + source: "../../images/star.png" + color: "white" + colorVariation: 0.1 + alpha: 0 + } + ImageParticle { + id: roids + groups: ["roids"] + sprites: Sprite { + id: spinState + name: "spinning" + source: "../../images/meteor.png" + frameCount: 35 + frameDuration: 60 + } + } + ImageParticle { + id: shot + groups: ["shot"] + source: "../../images/star.png" + + color: "#0FF06600" + colorVariation: 0.3 + } + ImageParticle { + id: engine + groups: ["engine"] + 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 + } + //! [0] + Attractor { + id: gs; pointX: root.width/2; pointY: root.height/2; strength: 4000000; + affectedParameter: Attractor.Acceleration + proportionalToDistance: Attractor.InverseQuadratic + } + //! [0] + Age { + 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 + //Automatic movement + SequentialAnimation on x { + loops: -1 + NumberAnimation{to: root.width-45; easing.type: Easing.InOutQuad; duration: 2000} + NumberAnimation{to: 0; easing.type: Easing.OutInQuad; duration: 6000} + } + SequentialAnimation on y { + loops: -1 + NumberAnimation{to: root.height-22; easing.type: Easing.OutInQuad; duration: 6000} + NumberAnimation{to: 0; easing.type: Easing.InOutQuad; duration: 2000} + } + } + Emitter { + group: "engine" + emitRate: 200 + lifeSpan: 1000 + size: 10 + endSize: 4 + sizeVariation: 4 + velocity: PointDirection { x: -128; xVariation: 32 } + height: ship.height + y: ship.y + x: ship.x + width: 20 + } + Emitter { + group: "shot" + emitRate: 32 + lifeSpan: 1000 + enabled: true + size: 40 + velocity: PointDirection { x: 256; } + x: ship.x + ship.width + y: ship.y + ship.height/2 + } + } +} + diff --git a/examples/quick/particles/affectors/content/customaffector.qml b/examples/quick/particles/affectors/content/customaffector.qml new file mode 100644 index 0000000000..157bf6afc1 --- /dev/null +++ b/examples/quick/particles/affectors/content/customaffector.qml @@ -0,0 +1,167 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 { + anchors.fill: parent + Emitter { + width: parent.width + emitRate: 4 + lifeSpan: 14000 + size: 80 + velocity: PointDirection { y: 60 } + } + Wander { + anchors.fill: parent + anchors.bottomMargin: 100 + xVariance: 60 + pace: 60 + } + + //! [0] + Affector { + property real coefficient: 0.1 + property real velocity: 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 += velocity * dt; + if (particle.rotation >= maxAngle) + particle.r = -1; + } else if (particle.r == -1) { + particle.rotation -= velocity * dt; + if (particle.rotation <= -1 * maxAngle) + particle.r = 1; + } + */ + //Wobbly movement + for (var i=0; i 1.) + currentSize = 0.; + + highp vec2 pos = qt_ParticlePos + - currentSize / 2. + currentSize * qt_ParticleTex // adjust size + + qt_ParticleVec.xy * t * qt_ParticleData.y // apply velocity 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/320., pos.y/480.); + } + " + //! [0] + 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; + }" + //! [0] + + } +} diff --git a/examples/quick/particles/customparticle/content/imagecolors.qml b/examples/quick/particles/customparticle/content/imagecolors.qml new file mode 100644 index 0000000000..857375a05c --- /dev/null +++ b/examples/quick/particles/customparticle/content/imagecolors.qml @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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" + } + //! [vertex] + 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, qt_ParticlePos.y); + //Uncomment this next line for each particle to use full texture, instead of the solid color at the center of the particle. + //fTex2 = fTex2 + ((- qt_ParticleData.z / 2. + qt_ParticleData.z) * qt_ParticleTex); //Adjusts size so it's like a chunk of image. + fTex2 = fTex2 / vec2(maxWidth, maxHeight); + highp float t = (qt_Timestamp - qt_ParticleData.x) / qt_ParticleData.y; + fFade = min(t*4., (1.-t*t)*.75) * qt_Opacity; + defaultMain(); + } + " + //! [vertex] + property variant particleTexture: particleSource + property variant pictureTexture: pictureSource + //! [fragment] + 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; + }" + //! [fragment] + } + + 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/quick/particles/customparticle/customparticle.pro b/examples/quick/particles/customparticle/customparticle.pro new file mode 100644 index 0000000000..77db1a6aab --- /dev/null +++ b/examples/quick/particles/customparticle/customparticle.pro @@ -0,0 +1,9 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/customparticle +qml.files = customparticle.qml content +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/customparticle +INSTALLS += target qml diff --git a/examples/quick/particles/customparticle/customparticle.qml b/examples/quick/particles/customparticle/customparticle.qml new file mode 100644 index 0000000000..ee93648132 --- /dev/null +++ b/examples/quick/particles/customparticle/customparticle.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +Item { + height: 480 + width: 320 + Examples.LauncherList { + id: ll + anchors.fill: parent + Component.onCompleted: { + addExample("Blur Particles", "Particles that get blurred over time", Qt.resolvedUrl("content/blurparticles.qml")); + addExample("Fragment Shader", "Particles drawn with a custom fragment shader", Qt.resolvedUrl("content/fragmentshader.qml")); + addExample("Image Colors", "An image explodes into colored particles", Qt.resolvedUrl("content/imagecolors.qml")); + } + } +} diff --git a/examples/quick/particles/customparticle/customparticle.qmlproject b/examples/quick/particles/customparticle/customparticle.qmlproject new file mode 100644 index 0000000000..6ea1849e31 --- /dev/null +++ b/examples/quick/particles/customparticle/customparticle.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "customparticle.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/quick/particles/customparticle/doc/images/qml-customparticle-example.png b/examples/quick/particles/customparticle/doc/images/qml-customparticle-example.png new file mode 100644 index 0000000000..e23c6c8efc Binary files /dev/null and b/examples/quick/particles/customparticle/doc/images/qml-customparticle-example.png differ diff --git a/examples/quick/particles/customparticle/doc/src/customparticle.qdoc b/examples/quick/particles/customparticle/doc/src/customparticle.qdoc new file mode 100644 index 0000000000..39c3d7c101 --- /dev/null +++ b/examples/quick/particles/customparticle/doc/src/customparticle.qdoc @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** 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. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title QtQuick.Particles Examples - CustomParticle + \example particles/customparticle + \brief This is a collection of examples using CustomParticle in the QML particle system. + \image qml-customparticle-example.png + + This is a collection of small QML examples relating to using CustomParticle in the particle system. + Each example is a small QML file emphasizing a different way to use CustomParticle. + + Blur Particles adds a blur effect to the particles, which increases over the particle's life time. + It uses a custom vertex shader: + \snippet particles/customparticle/content/blurparticles.qml vertex + to propagate life time simulation to a custom fragement shader: + \snippet particles/customparticle/content/blurparticles.qml fragment + which has access to both the normal image sampler and a blurred sampler, the image plus a ShaderEffect. + + Fragment Shader just uses the particle system as a vertex delivery system. + \snippet particles/customparticle/content/fragmentshader.qml 0 + + Image Colors uses CustomParticle to assign colors to particles based on their location in a picture. + The vertex shader, + \snippet particles/customparticle/content/imagecolors.qml vertex + passes along the starting position for each vertex to the fragment shader, + \snippet particles/customparticle/content/imagecolors.qml fragment + which uses it to determine the color for that particle. + +*/ diff --git a/examples/quick/particles/customparticle/main.cpp b/examples/quick/particles/customparticle/main.cpp new file mode 100644 index 0000000000..ec5619c6f0 --- /dev/null +++ b/examples/quick/particles/customparticle/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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(customparticle) diff --git a/examples/quick/particles/emitters/content/burstandpulse.qml b/examples/quick/particles/emitters/content/burstandpulse.qml new file mode 100644 index 0000000000..ae526aa5a3 --- /dev/null +++ b/examples/quick/particles/emitters/content/burstandpulse.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: 320 + height: 480 + color: "black" + property bool lastWasPulse: false + Timer { + interval: 3500 + triggeredOnStart: true + running: true + repeat: true + onTriggered: { + //! [0] + if (lastWasPulse) { + burstEmitter.burst(500); + lastWasPulse = false; + } else { + pulseEmitter.pulse(500); + lastWasPulse = true; + } + //! [0] + } + } + ParticleSystem { + id: particles + anchors.fill: parent + ImageParticle { + source: "../../images/star.png" + alpha: 0 + colorVariation: 0.6 + } + + Emitter { + id: burstEmitter + x: parent.width/2 + y: parent.height/3 + emitRate: 1000 + lifeSpan: 2000 + enabled: false + velocity: AngleDirection{magnitude: 64; angleVariation: 360} + size: 24 + sizeVariation: 8 + Text { + anchors.centerIn: parent + color: "white" + font.pixelSize: 18 + text: "Burst" + } + } + Emitter { + id: pulseEmitter + x: parent.width/2 + y: 2*parent.height/3 + emitRate: 1000 + lifeSpan: 2000 + enabled: false + velocity: AngleDirection{magnitude: 64; angleVariation: 360} + size: 24 + sizeVariation: 8 + Text { + anchors.centerIn: parent + color: "white" + font.pixelSize: 18 + text: "Pulse" + } + } + } +} diff --git a/examples/quick/particles/emitters/content/customemitter.qml b/examples/quick/particles/emitters/content/customemitter.qml new file mode 100644 index 0000000000..40b04a56d5 --- /dev/null +++ b/examples/quick/particles/emitters/content/customemitter.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + //! [0] + onEmitParticles: { + for (var i=0; i 400 ? 32 : 16 + } +} diff --git a/examples/quick/particles/imageparticle/content/colored.qml b/examples/quick/particles/imageparticle/content/colored.qml new file mode 100644 index 0000000000..9d72ca7412 --- /dev/null +++ b/examples/quick/particles/imageparticle/content/colored.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + } + + // ![0] + ImageParticle { + anchors.fill: parent + source: "../../images/star.png" + alpha: 0 + alphaVariation: 0.2 + colorVariation: 1.0 + } + // ![0] + + Emitter { + anchors.centerIn: parent + emitRate: 400 + lifeSpan: 2400 + size: 48 + sizeVariation: 8 + velocity: AngleDirection {angleVariation: 180; magnitude: 60} + } + + Turbulence { + anchors.fill: parent + strength: 2 + } + } +} diff --git a/examples/quick/particles/imageparticle/content/colortable.qml b/examples/quick/particles/imageparticle/content/colortable.qml new file mode 100644 index 0000000000..32fc30aa8d --- /dev/null +++ b/examples/quick/particles/imageparticle/content/colortable.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + + //! [0] + source: "../../images/particle.png" + colorTable: "../../images/colortable.png" + sizeTable: "../../images/colortable.png" + //! [0] + } + + 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 + } + + velocityFromMovement: 20 + + velocity: PointDirection { xVariation: 5; yVariation: 5;} + acceleration: PointDirection { xVariation: 5; yVariation: 5;} + + size: 16 + //endSize: 8 + //sizeVariation: 8 + } +} diff --git a/examples/quick/particles/imageparticle/content/deformation.qml b/examples/quick/particles/imageparticle/content/deformation.qml new file mode 100644 index 0000000000..a7a3415165 --- /dev/null +++ b/examples/quick/particles/imageparticle/content/deformation.qml @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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} + + //! [spin] + ImageParticle { + system: sys + groups: ["goingLeft", "goingRight"] + source: "../../images/starfish_4.png" + rotation: 90 + rotationVelocity: 90 + autoRotation: true + } + //! [spin] + //! [deform] + ImageParticle { + system: sys + groups: ["goingDown"] + source: "../../images/starfish_0.png" + rotation: 180 + yVector: PointDirection { y: 0.5; yVariation: 0.25; xVariation: 0.25; } + } + //! [deform] + + 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" + velocity: PointDirection { x: 100 } + lifeSpan: 4000 + emitRate: 1 + size: 128 + } + Emitter { + id: emitB + x: 400 + y: 240 + system: sys + enabled: false + group: "goingLeft" + velocity: PointDirection { x: -100 } + lifeSpan: 4000 + emitRate: 1 + size: 128 + } + Emitter { + id: emitC + x: 0 + y: 360 + system: sys + enabled: false + group: "goingDown" + velocity: PointDirection { x: 100 } + lifeSpan: 4000 + emitRate: 1 + size: 128 + } +} diff --git a/examples/quick/particles/imageparticle/content/rotation.qml b/examples/quick/particles/imageparticle/content/rotation.qml new file mode 100644 index 0000000000..2b1d828c7d --- /dev/null +++ b/examples/quick/particles/imageparticle/content/rotation.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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" + autoRotation: true //leaving these two settings at default allows you to test going up performance levels + rotation: -90 + } + + Emitter { + anchors.centerIn: parent + system: sys + emitRate: 10 + size: 200 + lifeSpan: 10000 + velocity: AngleDirection {angleVariation: 360; magnitudeVariation: 100;} + } + + MouseArea { + anchors.fill: parent + onClicked: { + up.autoRotation = !up.autoRotation + up.rotation = up.autoRotation ? -90 : 0 + } + } +} diff --git a/examples/quick/particles/imageparticle/content/sharing.qml b/examples/quick/particles/imageparticle/content/sharing.qml new file mode 100644 index 0000000000..433ffe9524 --- /dev/null +++ b/examples/quick/particles/imageparticle/content/sharing.qml @@ -0,0 +1,205 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 } + } + MouseArea { anchors.fill: parent; onClicked: listView.currentIndex = index; } + // 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 customized 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 } } + //! [1] + ImageParticle { + anchors.fill: parent + system: particles + source: "../../images/flower.png" + color: "red" + clip: true + alpha: 1.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 + + ParticleSystem { id: particles } + Emitter { + system: particles + anchors.fill: parent + emitRate: 0 + lifeSpan: 10000 + size: 24 + sizeVariation: 8 + velocity: AngleDirection { angleVariation: 360; magnitude: 3 } + maximumEmitted: 10 + startTime: 5000 + Timer { running: true; interval: 10; onTriggered: parent.emitRate = 1; } + } + + //! [0] + ImageParticle { + anchors.fill: parent + system: particles + source: "../../images/flower.png" + alpha: 0.1 + color: "white" + rotationVariation: 180 + z: -1 + } + //! [0] + } + + 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/quick/particles/imageparticle/content/sprites.qml b/examples/quick/particles/imageparticle/content/sprites.qml new file mode 100644 index 0000000000..0f74ab60f2 --- /dev/null +++ b/examples/quick/particles/imageparticle/content/sprites.qml @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + velocity: 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/quick/particles/imageparticle/doc/images/qml-imageparticle-example.png b/examples/quick/particles/imageparticle/doc/images/qml-imageparticle-example.png new file mode 100644 index 0000000000..9e44abe4fb Binary files /dev/null and b/examples/quick/particles/imageparticle/doc/images/qml-imageparticle-example.png differ diff --git a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc new file mode 100644 index 0000000000..62c1a06839 --- /dev/null +++ b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** 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. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title QtQuick.Particles Examples - Affectors + \example particles/imageparticle + \brief This is a collection of examples using Affectors in the QML particle system. + \image qml-imageparticle-example.png + + This is a collection of small QML examples relating to using Affectors in the particle system. + Each example is a small QML file emphasizing a particular element or feature. + + All at once shows off several of the features of ImageParticle at the same time. + \snippet particles/imageparticle/content/allatonce.qml 0 + + Colored shows a simple ImageParticle with some color variation. + \snippet particles/imageparticle/content/colored.qml 0 + + Color Table sets the color over life on the particles to provide a fixed rainbow effect. + \snippet particles/imageparticle/content/colortable.qml 0 + + Deformation spins and squishes a starfish particle. + \snippet particles/imageparticle/content/deformation.qml spin + \snippet particles/imageparticle/content/deformation.qml deform + + Rotation demonstrates the autoRotate property, so that particles rotate in the direction that they travel. + + Sharing demonstrates what happens when multiple ImageParticles try to render the same particle. + The following ImageParticle renders the particles inside the ListView: + \snippet particles/imageparticle/content/sharing.qml 0 + The following ImageParticle is placed inside the list highlight, and renders the particles above the other ImageParticle. + \snippet particles/imageparticle/content/sharing.qml 1 + Note that because it sets the color and alpha in this ImageParticle, it renders the particles in a different color. + Since it doesn't specify anything about the rotation, it shares the rotation with the other ImageParticle so that the flowers are rotated the same way in both. + Note that you can undo rotation in another ImageParticle, you just need to explicity set rotationVariation to 0. + + Sprites demonstrates using an image particle to render animated sprites instead of static images for each particle. +*/ diff --git a/examples/quick/particles/imageparticle/imageparticle.pro b/examples/quick/particles/imageparticle/imageparticle.pro new file mode 100644 index 0000000000..94ed5fc7c3 --- /dev/null +++ b/examples/quick/particles/imageparticle/imageparticle.pro @@ -0,0 +1,9 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/imageparticle +qml.files = imageparticle.qml content +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/imageparticle +INSTALLS += target qml diff --git a/examples/quick/particles/imageparticle/imageparticle.qml b/examples/quick/particles/imageparticle/imageparticle.qml new file mode 100644 index 0000000000..5f7ca38b13 --- /dev/null +++ b/examples/quick/particles/imageparticle/imageparticle.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +Item { + height: 480 + width: 320 + Examples.LauncherList { + id: ll + anchors.fill: parent + Component.onCompleted: { + addExample("All at once", "Uses all ImageParticle features", Qt.resolvedUrl("content/allatonce.qml")); + addExample("Colored", "Colorized image particles", Qt.resolvedUrl("content/colored.qml")); + addExample("Color Table", "Color-over-life rainbow particles", Qt.resolvedUrl("content/colortable.qml")); + addExample("Deformation", "Deformed particles", Qt.resolvedUrl("content/deformation.qml")); + addExample("Rotation", "Rotated particles", Qt.resolvedUrl("content/rotation.qml")); + addExample("Sharing", "Multiple ImageParticles on the same particles", Qt.resolvedUrl("content/sharing.qml")); + addExample("Sprites", "Particles rendered with sprites", Qt.resolvedUrl("content/sprites.qml")); + } + } +} diff --git a/examples/quick/particles/imageparticle/imageparticle.qmlproject b/examples/quick/particles/imageparticle/imageparticle.qmlproject new file mode 100644 index 0000000000..902cf6519a --- /dev/null +++ b/examples/quick/particles/imageparticle/imageparticle.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "imageparticle.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/quick/particles/imageparticle/main.cpp b/examples/quick/particles/imageparticle/main.cpp new file mode 100644 index 0000000000..081aec03d7 --- /dev/null +++ b/examples/quick/particles/imageparticle/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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(imageparticle) diff --git a/examples/quick/particles/images/_explo.png b/examples/quick/particles/images/_explo.png new file mode 100644 index 0000000000..4297245d49 Binary files /dev/null and b/examples/quick/particles/images/_explo.png differ diff --git a/examples/quick/particles/images/backgroundLeaves.jpg b/examples/quick/particles/images/backgroundLeaves.jpg new file mode 100755 index 0000000000..08be16751d Binary files /dev/null and b/examples/quick/particles/images/backgroundLeaves.jpg differ diff --git a/examples/quick/particles/images/bear_tiles.png b/examples/quick/particles/images/bear_tiles.png new file mode 100644 index 0000000000..6bbb2a9b6d Binary files /dev/null and b/examples/quick/particles/images/bear_tiles.png differ diff --git a/examples/quick/particles/images/candle.png b/examples/quick/particles/images/candle.png new file mode 100644 index 0000000000..8fa3193719 Binary files /dev/null and b/examples/quick/particles/images/candle.png differ diff --git a/examples/quick/particles/images/colortable.png b/examples/quick/particles/images/colortable.png new file mode 100644 index 0000000000..a62ceeb4a0 Binary files /dev/null and b/examples/quick/particles/images/colortable.png differ diff --git a/examples/quick/particles/images/finalfrontier.png b/examples/quick/particles/images/finalfrontier.png new file mode 100644 index 0000000000..2ba1815230 Binary files /dev/null and b/examples/quick/particles/images/finalfrontier.png differ diff --git a/examples/quick/particles/images/flower.png b/examples/quick/particles/images/flower.png new file mode 100644 index 0000000000..b5c606210e Binary files /dev/null and b/examples/quick/particles/images/flower.png differ diff --git a/examples/quick/particles/images/matchmask.png b/examples/quick/particles/images/matchmask.png new file mode 100644 index 0000000000..e575875c55 Binary files /dev/null and b/examples/quick/particles/images/matchmask.png differ diff --git a/examples/quick/particles/images/meteor.png b/examples/quick/particles/images/meteor.png new file mode 100644 index 0000000000..e8c368aea7 Binary files /dev/null and b/examples/quick/particles/images/meteor.png differ diff --git a/examples/quick/particles/images/meteor_explo.png b/examples/quick/particles/images/meteor_explo.png new file mode 100644 index 0000000000..e659bfe2cf Binary files /dev/null and b/examples/quick/particles/images/meteor_explo.png differ diff --git a/examples/quick/particles/images/meteors.png b/examples/quick/particles/images/meteors.png new file mode 100644 index 0000000000..bada8a1407 Binary files /dev/null and b/examples/quick/particles/images/meteors.png differ diff --git a/examples/quick/particles/images/nullRock.png b/examples/quick/particles/images/nullRock.png new file mode 100644 index 0000000000..4076327a1a Binary files /dev/null and b/examples/quick/particles/images/nullRock.png differ diff --git a/examples/quick/particles/images/particle.png b/examples/quick/particles/images/particle.png new file mode 100644 index 0000000000..5c83896d22 Binary files /dev/null and b/examples/quick/particles/images/particle.png differ diff --git a/examples/quick/particles/images/particle2.png b/examples/quick/particles/images/particle2.png new file mode 100644 index 0000000000..36349c6c6e Binary files /dev/null and b/examples/quick/particles/images/particle2.png differ diff --git a/examples/quick/particles/images/particle3.png b/examples/quick/particles/images/particle3.png new file mode 100644 index 0000000000..905d8f37b8 Binary files /dev/null and b/examples/quick/particles/images/particle3.png differ diff --git a/examples/quick/particles/images/particle4.png b/examples/quick/particles/images/particle4.png new file mode 100644 index 0000000000..bc95b703c1 Binary files /dev/null and b/examples/quick/particles/images/particle4.png differ diff --git a/examples/quick/particles/images/particleA.png b/examples/quick/particles/images/particleA.png new file mode 100644 index 0000000000..c63acdee1f Binary files /dev/null and b/examples/quick/particles/images/particleA.png differ diff --git a/examples/quick/particles/images/portal_bg.png b/examples/quick/particles/images/portal_bg.png new file mode 100644 index 0000000000..3c59eeabb9 Binary files /dev/null and b/examples/quick/particles/images/portal_bg.png differ diff --git a/examples/quick/particles/images/realLeaf1.png b/examples/quick/particles/images/realLeaf1.png new file mode 100644 index 0000000000..6cabf29efd Binary files /dev/null and b/examples/quick/particles/images/realLeaf1.png differ diff --git a/examples/quick/particles/images/realLeaf2.png b/examples/quick/particles/images/realLeaf2.png new file mode 100644 index 0000000000..bfeca861d5 Binary files /dev/null and b/examples/quick/particles/images/realLeaf2.png differ diff --git a/examples/quick/particles/images/realLeaf3.png b/examples/quick/particles/images/realLeaf3.png new file mode 100644 index 0000000000..b1071e862b Binary files /dev/null and b/examples/quick/particles/images/realLeaf3.png differ diff --git a/examples/quick/particles/images/realLeaf4.png b/examples/quick/particles/images/realLeaf4.png new file mode 100644 index 0000000000..d61d53d10e Binary files /dev/null and b/examples/quick/particles/images/realLeaf4.png differ diff --git a/examples/quick/particles/images/rocket.png b/examples/quick/particles/images/rocket.png new file mode 100644 index 0000000000..a171610b03 Binary files /dev/null and b/examples/quick/particles/images/rocket.png differ diff --git a/examples/quick/particles/images/rocket2.png b/examples/quick/particles/images/rocket2.png new file mode 100644 index 0000000000..7110f8fdc6 Binary files /dev/null and b/examples/quick/particles/images/rocket2.png differ diff --git a/examples/quick/particles/images/sizeInOut.png b/examples/quick/particles/images/sizeInOut.png new file mode 100644 index 0000000000..0a306ea21a Binary files /dev/null and b/examples/quick/particles/images/sizeInOut.png differ diff --git a/examples/quick/particles/images/snowflake.png b/examples/quick/particles/images/snowflake.png new file mode 100644 index 0000000000..490887a82f Binary files /dev/null and b/examples/quick/particles/images/snowflake.png differ diff --git a/examples/quick/particles/images/sparkleSize.png b/examples/quick/particles/images/sparkleSize.png new file mode 100644 index 0000000000..752056541b Binary files /dev/null and b/examples/quick/particles/images/sparkleSize.png differ diff --git a/examples/quick/particles/images/star.png b/examples/quick/particles/images/star.png new file mode 100644 index 0000000000..0d592cfa87 Binary files /dev/null and b/examples/quick/particles/images/star.png differ diff --git a/examples/quick/particles/images/starfish_0.png b/examples/quick/particles/images/starfish_0.png new file mode 100644 index 0000000000..8747f0236e Binary files /dev/null and b/examples/quick/particles/images/starfish_0.png differ diff --git a/examples/quick/particles/images/starfish_1.png b/examples/quick/particles/images/starfish_1.png new file mode 100644 index 0000000000..1f3f159d5e Binary files /dev/null and b/examples/quick/particles/images/starfish_1.png differ diff --git a/examples/quick/particles/images/starfish_2.png b/examples/quick/particles/images/starfish_2.png new file mode 100644 index 0000000000..c6c7e5a676 Binary files /dev/null and b/examples/quick/particles/images/starfish_2.png differ diff --git a/examples/quick/particles/images/starfish_3.png b/examples/quick/particles/images/starfish_3.png new file mode 100644 index 0000000000..307a89f815 Binary files /dev/null and b/examples/quick/particles/images/starfish_3.png differ diff --git a/examples/quick/particles/images/starfish_4.png b/examples/quick/particles/images/starfish_4.png new file mode 100644 index 0000000000..d61c26545a Binary files /dev/null and b/examples/quick/particles/images/starfish_4.png differ diff --git a/examples/quick/particles/images/starfish_mask.png b/examples/quick/particles/images/starfish_mask.png new file mode 100644 index 0000000000..2ef74f902b Binary files /dev/null and b/examples/quick/particles/images/starfish_mask.png differ diff --git a/examples/quick/particles/itemparticle/content/Delegate.qml b/examples/quick/particles/itemparticle/content/Delegate.qml new file mode 100644 index 0000000000..d0292f2467 --- /dev/null +++ b/examples/quick/particles/itemparticle/content/Delegate.qml @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/particles/itemparticle/content/Delegate2.qml b/examples/quick/particles/itemparticle/content/Delegate2.qml new file mode 100644 index 0000000000..710c168612 --- /dev/null +++ b/examples/quick/particles/itemparticle/content/Delegate2.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/particles/itemparticle/content/ExpandingDelegate.qml b/examples/quick/particles/itemparticle/content/ExpandingDelegate.qml new file mode 100644 index 0000000000..ee81873a7e --- /dev/null +++ b/examples/quick/particles/itemparticle/content/ExpandingDelegate.qml @@ -0,0 +1,205 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + antialiasing: true + } + 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/quick/particles/itemparticle/content/RssModel.qml b/examples/quick/particles/itemparticle/content/RssModel.qml new file mode 100644 index 0000000000..ed209a7ce5 --- /dev/null +++ b/examples/quick/particles/itemparticle/content/RssModel.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/particles/itemparticle/content/bubble.png b/examples/quick/particles/itemparticle/content/bubble.png new file mode 100644 index 0000000000..c7f479e9e3 Binary files /dev/null and b/examples/quick/particles/itemparticle/content/bubble.png differ diff --git a/examples/quick/particles/itemparticle/content/script.js b/examples/quick/particles/itemparticle/content/script.js new file mode 100644 index 0000000000..e8ef93a847 --- /dev/null +++ b/examples/quick/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/quick/particles/itemparticle/delegates.qml b/examples/quick/particles/itemparticle/delegates.qml new file mode 100644 index 0000000000..fa076a2657 --- /dev/null +++ b/examples/quick/particles/itemparticle/delegates.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + velocity: 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/quick/particles/itemparticle/particleview.qml b/examples/quick/particles/itemparticle/particleview.qml new file mode 100644 index 0000000000..2501e6a713 --- /dev/null +++ b/examples/quick/particles/itemparticle/particleview.qml @@ -0,0 +1,276 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + velocity: 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 + velocity: 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 + velocity: 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 + antialiasing: true + 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 + antialiasing: 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/quick/particles/particles.pro b/examples/quick/particles/particles.pro new file mode 100644 index 0000000000..9200113be8 --- /dev/null +++ b/examples/quick/particles/particles.pro @@ -0,0 +1,14 @@ +TEMPLATE = subdirs +SUBDIRS += affectors \ + customparticle \ + emitters \ + imageparticle \ + system + +EXAMPLE_FILES = \ + itemparticle + +#Install shared images too +qml.files = images +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/particles +INSTALLS += qml diff --git a/examples/quick/particles/system/content/dynamiccomparison.qml b/examples/quick/particles/system/content/dynamiccomparison.qml new file mode 100644 index 0000000000..82591a6f82 --- /dev/null +++ b/examples/quick/particles/system/content/dynamiccomparison.qml @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + velocity: PointDirection {y: 72; yVariation: 24} + lifeSpan: 10000 + emitRate: 1000 + enabled: false + size: 32 + } + + //! [fake] + Item { + id: fakeEmitter + function burst(number) { + while (number > 0) { + var item = fakeParticle.createObject(root); + item.lifeSpan = Math.random() * 5000 + 5000; + item.x = Math.random() * (root.width/2) + (root.width/2); + 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: root.height-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(); } + } + } + } + } + //! [fake] + + //Hooked to a timer, but click for extra bursts that really stress performance + Timer { + interval: 10000 + triggeredOnStart: true + repeat: true + running: true + onTriggered: { + emitter.burst(1000); + fakeEmitter.burst(1000); + } + } + 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/quick/particles/system/content/dynamicemitters.qml b/examples/quick/particles/system/content/dynamicemitters.qml new file mode 100644 index 0000000000..bd4bcad397 --- /dev/null +++ b/examples/quick/particles/system/content/dynamicemitters.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + velocity: 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(); + } + } + } + + function customEmit(x,y) { + //! [0] + for (var i=0; i<8; i++) { + var obj = emitterComp.createObject(root); + obj.x = x + obj.y = 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(); + } + //! [0] + } + + Timer { + interval: 10000 + triggeredOnStart: true + running: true + repeat: true + onTriggered: customEmit(Math.random() * 320, Math.random() * 480) + } + MouseArea { + anchors.fill: parent + onClicked: customEmit(mouse.x, mouse.y); + } + + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: "Click Somewhere" + color: "white" + font.pixelSize: 24 + } +} diff --git a/examples/quick/particles/system/content/multiplepainters.qml b/examples/quick/particles/system/content/multiplepainters.qml new file mode 100644 index 0000000000..174f527f1f --- /dev/null +++ b/examples/quick/particles/system/content/multiplepainters.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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; + } + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: "Click to Toggle" + color: "white" + font.pixelSize: 24 + } + Emitter { + system: sys + y:root.height + 20 + width: root.width + emitRate: 200 + lifeSpan: 4000 + startTime: 4000 + velocity: 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/quick/particles/system/content/startstop.qml b/examples/quick/particles/system/content/startstop.qml new file mode 100644 index 0000000000..f0433e1b39 --- /dev/null +++ b/examples/quick/particles/system/content/startstop.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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" + Text { + text: "Left click to start/stop\nRight click to pause/unpause" + color: "white" + font.pixelSize: 24 + } + 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/quick/particles/system/content/timedgroupchanges.qml b/examples/quick/particles/system/content/timedgroupchanges.qml new file mode 100644 index 0000000000..86ea811614 --- /dev/null +++ b/examples/quick/particles/system/content/timedgroupchanges.qml @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + //! [0] + ParticleGroup { + name: "fire" + duration: 2000 + durationVariation: 2000 + to: {"splode":1} + } + //! [0] + //! [1] + ParticleGroup { + name: "splode" + duration: 400 + to: {"dead":1} + TrailEmitter { + group: "works" + emitRatePerParticle: 100 + lifeSpan: 1000 + maximumEmitted: 1200 + size: 8 + velocity: AngleDirection {angle: 270; angleVariation: 45; magnitude: 20; magnitudeVariation: 20;} + acceleration: PointDirection {y:100; yVariation: 20} + } + } + //! [1] + //! [2] + ParticleGroup { + name: "dead" + duration: 1000 + Affector { + once: true + onAffected: worksEmitter.burst(400,x,y) + } + } + //! [2] + + 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 + velocity: PointDirection {y:-100;} + size: 32 + } + + Emitter { + id: worksEmitter + group: "works" + enabled: false + emitRate: 100 + lifeSpan: 1600 + maximumEmitted: 6400 + size: 8 + velocity: 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/quick/particles/system/doc/images/qml-system-example.png b/examples/quick/particles/system/doc/images/qml-system-example.png new file mode 100644 index 0000000000..1a317c4be8 Binary files /dev/null and b/examples/quick/particles/system/doc/images/qml-system-example.png differ diff --git a/examples/quick/particles/system/doc/src/system.qdoc b/examples/quick/particles/system/doc/src/system.qdoc new file mode 100644 index 0000000000..8c381a57ec --- /dev/null +++ b/examples/quick/particles/system/doc/src/system.qdoc @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Free Documentation License Usage +** 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. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \title QtQuick.Particles Examples - Affectors + \example particles/system + \brief This is a collection of examples using Affectors in the QML particle system. + \image qml-system-example.png + + This is a collection of small QML examples relating to using Affectors in the particle system. + Each example is a small QML file emphasizing a particular element or feature. + + Dynamic comparison compares using the particle system to getting a similar effect with the following code that dynamically instantiates Image elements. + \snippet particles/system/content/dynamiccomparison.qml fake + Note how the Image elements are not able to be randomly colorized. + + Start and Stop simply sets the running and paused states of a ParticleSystem. While the system does not perform any simulation when stopped or paused, a restart restarts the simulation from the beginning, while unpausing resumes the simulation from where it was. + + Timed group changes is an example that highlights the ParticleGroup element. While normally referring to groups with a string name is sufficent, additional effects can be + done by setting properties on groups. + The first group has a variable duration on it, but always transitions to the second group. + \snippet particles/system/content/timedgroupchanges.qml 0 + The second group has a TrailEmitter on it, and a fixed duration for emitting into the third group. By placing the TrailEmitter as a direct child of the ParticleGroup, it automatically selects that group to follow. + \snippet particles/system/content/timedgroupchanges.qml 1 + The third group has an Affector as a direct child, which makes the affector automatically target this group. The affector means that as soon as particles enter this group, a burst function can be called on another emitter, using the x,y positions of this particle. + \snippet particles/system/content/timedgroupchanges.qml 2 + + If TrailEmitter does not suit your needs for multiple emitters, you can also dynamically create Emitters while still using the same ParticleSystem and image particle + \snippet particles/system/content/dynamicemitters.qml 0 + Note that this effect, a flurry of flying rainbow spears, would be better served with TrailEmitter. It is only done with dynamic emitters in this example to show the concept more simply. + + Multiple Painters shows how to control paint ordering of individual particles. While the paint ordering of particles within one ImagePainter is not strictly defined, ImageParticle elements follow the normal Z-ordering rules for QtQuick items. This example allow you to paint the inside of the particles above the black borders using a pair of ImageParticles each painting different parts of the same logical particle. + +*/ + diff --git a/examples/quick/particles/system/main.cpp b/examples/quick/particles/system/main.cpp new file mode 100644 index 0000000000..ea67283822 --- /dev/null +++ b/examples/quick/particles/system/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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(system) diff --git a/examples/quick/particles/system/system.pro b/examples/quick/particles/system/system.pro new file mode 100644 index 0000000000..f2e3567543 --- /dev/null +++ b/examples/quick/particles/system/system.pro @@ -0,0 +1,9 @@ +TEMPLATE = app + +QT += quick qml +SOURCES += main.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/system +qml.files = system.qml content +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/system +INSTALLS += target qml diff --git a/examples/quick/particles/system/system.qml b/examples/quick/particles/system/system.qml new file mode 100644 index 0000000000..a299d0af27 --- /dev/null +++ b/examples/quick/particles/system/system.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +Item { + height: 480 + width: 320 + Examples.LauncherList { + id: ll + anchors.fill: parent + Component.onCompleted: { + addExample("Dynamic Comparison", "Compares with dynamically created elements", Qt.resolvedUrl("content/dynamiccomparison.qml")); + addExample("StartStop", "Start and stop the simulation", Qt.resolvedUrl("content/startstop.qml")); + addExample("Timed group changes", "Emit into managed groups", Qt.resolvedUrl("content/timedgroupchanges.qml")); + addExample("Dynamic Emitters", "Dynamically instantiated emitters with a single system", Qt.resolvedUrl("content/dynamicemitters.qml")); + addExample("Multiple Painters", "Several ParticlePainters on the same logical particles", Qt.resolvedUrl("content/multiplepainters.qml")); + } + } +} diff --git a/examples/quick/particles/system/system.qmlproject b/examples/quick/particles/system/system.qmlproject new file mode 100644 index 0000000000..1f9df3cecf --- /dev/null +++ b/examples/quick/particles/system/system.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "system.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/quick/positioners/main.cpp b/examples/quick/positioners/main.cpp index d8941b1165..4ee4c82c56 100644 --- a/examples/quick/positioners/main.cpp +++ b/examples/quick/positioners/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" +#include "../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(positioners) diff --git a/examples/quick/positioners/positioners.pro b/examples/quick/positioners/positioners.pro index e219cdea7a..1a7622d0bc 100644 --- a/examples/quick/positioners/positioners.pro +++ b/examples/quick/positioners/positioners.pro @@ -3,9 +3,7 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/positioners +target.path = $$[QT_INSTALL_EXAMPLES]/quick/positioners qml.files = positioners.qml positioners-transitions.qml positioners-attachedproperties.qml -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/positioners -sources.files = $$SOURCES positioners.pro -sources.path = $$qml.path -INSTALLS += sources target qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/positioners +INSTALLS += target qml diff --git a/examples/quick/positioners/positioners.qml b/examples/quick/positioners/positioners.qml index e02848dc16..b020e1be3b 100644 --- a/examples/quick/positioners/positioners.qml +++ b/examples/quick/positioners/positioners.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../../shared" as Examples +import "../shared" as Examples Item { height: 480 diff --git a/examples/quick/quick.pro b/examples/quick/quick.pro index 2f0d430917..cb4f7bfc6b 100644 --- a/examples/quick/quick.pro +++ b/examples/quick/quick.pro @@ -5,6 +5,7 @@ SUBDIRS = accessibility \ canvas \ imageelements \ keyinteraction \ + localstorage \ modelviews \ mousearea \ positioners \ @@ -14,9 +15,12 @@ SUBDIRS = accessibility \ text \ threading \ touchinteraction \ - customitems + tutorials \ + customitems \ + window \ + particles \ + demos -# install -sources.files = quick.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick -INSTALLS += sources +EXAMPLE_FILES = \ + ui-components \ + shared diff --git a/examples/quick/righttoleft/main.cpp b/examples/quick/righttoleft/main.cpp index 1fa9be963a..e1d102cfe3 100644 --- a/examples/quick/righttoleft/main.cpp +++ b/examples/quick/righttoleft/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" +#include "../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(righttoleft) diff --git a/examples/quick/righttoleft/righttoleft.pro b/examples/quick/righttoleft/righttoleft.pro index d22aa0f5ff..e71030e196 100644 --- a/examples/quick/righttoleft/righttoleft.pro +++ b/examples/quick/righttoleft/righttoleft.pro @@ -3,9 +3,7 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/righttoleft +target.path = $$[QT_INSTALL_EXAMPLES]/quick/righttoleft qml.files = righttoleft.qml layoutdirection layoutmirroring textalignment -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/righttoleft -sources.files = $$SOURCES righttoleft.pro -sources.path = $$qml.path -INSTALLS += sources target qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/righttoleft +INSTALLS += target qml diff --git a/examples/quick/righttoleft/righttoleft.qml b/examples/quick/righttoleft/righttoleft.qml index 90f964ac75..7212d47514 100644 --- a/examples/quick/righttoleft/righttoleft.qml +++ b/examples/quick/righttoleft/righttoleft.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../../shared" as Examples +import "../shared" as Examples Item { height: 480 diff --git a/examples/quick/scenegraph/customgeometry/customgeometry.pro b/examples/quick/scenegraph/customgeometry/customgeometry.pro index 5198a3c44a..8044c5c034 100644 --- a/examples/quick/scenegraph/customgeometry/customgeometry.pro +++ b/examples/quick/scenegraph/customgeometry/customgeometry.pro @@ -8,9 +8,8 @@ SOURCES += \ HEADERS += \ beziercurve.h -OTHER_FILES += main.qml +target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/customgeometry +qml.files = main.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/customgeometry -sources.files = $$SOURCES $$HEADERS $$OTHER_FILES customgeometry.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/scenegraph/customgeometry -target.path = $$sources.path -INSTALLS += sources target +INSTALLS += target qml diff --git a/examples/quick/scenegraph/openglunderqml/openglunderqml.pro b/examples/quick/scenegraph/openglunderqml/openglunderqml.pro index f2ad3d0d85..f86dd5f5f3 100644 --- a/examples/quick/scenegraph/openglunderqml/openglunderqml.pro +++ b/examples/quick/scenegraph/openglunderqml/openglunderqml.pro @@ -3,9 +3,7 @@ QT += qml quick HEADERS += squircle.h SOURCES += squircle.cpp main.cpp -OTHER_FILES += main.qml - -sources.files = $$SOURCES $$HEADERS $$OTHER_FILES openglunderqml.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/scenegraph/openglunderqml -target.path = $$sources.path -INSTALLS += sources target +target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/openglunderqml +qml.files = main.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/openglunderqml +INSTALLS += target qml diff --git a/examples/quick/scenegraph/scenegraph.pro b/examples/quick/scenegraph/scenegraph.pro index 22506bcfeb..88b8d03dc3 100644 --- a/examples/quick/scenegraph/scenegraph.pro +++ b/examples/quick/scenegraph/scenegraph.pro @@ -1,7 +1,2 @@ TEMPLATE = subdirs SUBDIRS += customgeometry simplematerial openglunderqml - -# install -sources.files = scenegraph.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/scenegraph -INSTALLS += sources diff --git a/examples/quick/scenegraph/simplematerial/simplematerial.pro b/examples/quick/scenegraph/simplematerial/simplematerial.pro index f8be76132e..ae4fb0fdd0 100644 --- a/examples/quick/scenegraph/simplematerial/simplematerial.pro +++ b/examples/quick/scenegraph/simplematerial/simplematerial.pro @@ -4,10 +4,8 @@ QT += quick SOURCES += \ simplematerial.cpp -OTHER_FILES += \ - main.qml +target.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/simplematerial +qml.files = main.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/scenegraph/simplematerial -sources.files = $$SOURCES $$OTHER_FILES simplematerial.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/scenegraph/simplematerial -target.path = $$sources.path -INSTALLS += sources target +INSTALLS += target qml diff --git a/examples/quick/shadereffects/main.cpp b/examples/quick/shadereffects/main.cpp index 2cbce15465..2bb3224bd1 100644 --- a/examples/quick/shadereffects/main.cpp +++ b/examples/quick/shadereffects/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" +#include "../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(shadereffects) diff --git a/examples/quick/shadereffects/shadereffects.pro b/examples/quick/shadereffects/shadereffects.pro index e85ccad38d..265cb726e2 100644 --- a/examples/quick/shadereffects/shadereffects.pro +++ b/examples/quick/shadereffects/shadereffects.pro @@ -3,9 +3,7 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/shadereffects +target.path = $$[QT_INSTALL_EXAMPLES]/quick/shadereffects qml.files = shadereffects.qml content -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/shadereffects -sources.files = $$SOURCES shadereffects.pro -sources.path = $$qml.path -INSTALLS += sources target qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/shadereffects +INSTALLS += target qml diff --git a/examples/quick/shared/Button.qml b/examples/quick/shared/Button.qml new file mode 100644 index 0000000000..9b2b5f39f4 --- /dev/null +++ b/examples/quick/shared/Button.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: "" + 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/quick/shared/LauncherList.qml b/examples/quick/shared/LauncherList.qml new file mode 100644 index 0000000000..134fed1d8d --- /dev/null +++ b/examples/quick/shared/LauncherList.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 { + //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; + } + + ListView { + clip: true + delegate: SimpleLauncherDelegate{exampleItem: ei} + model: ListModel {id:myModel} + anchors.fill: parent + } + + 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{ + focus: true + 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/quick/shared/README b/examples/quick/shared/README new file mode 100644 index 0000000000..bf16f238c7 --- /dev/null +++ b/examples/quick/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/quick/shared/SimpleLauncherDelegate.qml b/examples/quick/shared/SimpleLauncherDelegate.qml new file mode 100644 index 0000000000..6d647ac94f --- /dev/null +++ b/examples/quick/shared/SimpleLauncherDelegate.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/shared/images/back.png b/examples/quick/shared/images/back.png new file mode 100644 index 0000000000..506ac42fcf Binary files /dev/null and b/examples/quick/shared/images/back.png differ diff --git a/examples/quick/shared/qmldir b/examples/quick/shared/qmldir new file mode 100644 index 0000000000..2f1e56aefb --- /dev/null +++ b/examples/quick/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/quick/shared/shared.h b/examples/quick/shared/shared.h new file mode 100644 index 0000000000..7fd2f08a40 --- /dev/null +++ b/examples/quick/shared/shared.h @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 +#include +#include +#include +#define DECLARATIVE_EXAMPLE_MAIN(NAME) int main(int argc, char* argv[]) \ +{\ + QGuiApplication app(argc,argv);\ + QQuickView view;\ + QDir directory(QCoreApplication::applicationDirPath());\ + if (QGuiApplication::platformName() == QLatin1String("windows")) {\ + if (directory.absolutePath().endsWith("/debug", Qt::CaseInsensitive)\ + || directory.absolutePath().endsWith("/release", Qt::CaseInsensitive))\ + if (!directory.cdUp()) {\ + qWarning("Could not change to parent directory of '%s'",\ + qPrintable(QDir::toNativeSeparators(directory.absolutePath())));\ + return -1;\ + }\ + } else if (QGuiApplication::platformName() == QLatin1String("cocoa")) {\ + if (directory.absolutePath().endsWith(#NAME".app/Contents/MacOS"))\ + for (int i = 0; i < 3; ++i) {\ + if (!directory.cdUp()) {\ + qWarning("Could not change to parent directory of '%s'",\ + qPrintable(QDir::toNativeSeparators(directory.absolutePath())));\ + return -1;\ + }\ + }\ + }\ + const QString fileName(directory.absolutePath() + "/" #NAME ".qml");\ + if (!QFile::exists(fileName)) {\ + qWarning("Could not find file '%s'", qPrintable(QDir::toNativeSeparators(fileName)));\ + return -1;\ + }\ + view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\ + view.setSource(QUrl::fromLocalFile(fileName)); \ + if (QGuiApplication::platformName() == QLatin1String("qnx") || \ + QGuiApplication::platformName() == QLatin1String("eglfs")) {\ + view.setResizeMode(QQuickView::SizeRootObjectToView);\ + view.showFullScreen();\ + } else {\ + view.show();\ + }\ + return app.exec();\ +} diff --git a/examples/quick/text/main.cpp b/examples/quick/text/main.cpp index 0e84b8de2f..9b3c62657b 100644 --- a/examples/quick/text/main.cpp +++ b/examples/quick/text/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" +#include "../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(text) diff --git a/examples/quick/text/text.pro b/examples/quick/text/text.pro index b3734e29f3..2f78548d05 100644 --- a/examples/quick/text/text.pro +++ b/examples/quick/text/text.pro @@ -3,9 +3,7 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/text +target.path = $$[QT_INSTALL_EXAMPLES]/quick/text qml.files = fonts imgtag styledtext-layout.qml text.qml textselection -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/text -sources.files = $$SOURCES text.pro -sources.path = $$qml.path -INSTALLS += sources target qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/text +INSTALLS += target qml diff --git a/examples/quick/text/text.qml b/examples/quick/text/text.qml index 383e65e51c..b506fe53f8 100644 --- a/examples/quick/text/text.qml +++ b/examples/quick/text/text.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../../shared" +import "../shared" Item { height: 480 diff --git a/examples/quick/threading/main.cpp b/examples/quick/threading/main.cpp index 32399c988a..47ea0b5709 100644 --- a/examples/quick/threading/main.cpp +++ b/examples/quick/threading/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" +#include "../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(threading) diff --git a/examples/quick/threading/threading.pro b/examples/quick/threading/threading.pro index 303a13cbaf..fa5488a47e 100644 --- a/examples/quick/threading/threading.pro +++ b/examples/quick/threading/threading.pro @@ -3,9 +3,7 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/threading +target.path = $$[QT_INSTALL_EXAMPLES]/quick/threading qml.files = threading.qml threadedlistmodel workerscript -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/threading -sources.files = $$SOURCES threading.pro -sources.path = $$qml.path -INSTALLS += sources target qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/threading +INSTALLS += target qml diff --git a/examples/quick/threading/threading.qml b/examples/quick/threading/threading.qml index 5a79cd9fa6..011fdc0106 100644 --- a/examples/quick/threading/threading.qml +++ b/examples/quick/threading/threading.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../../shared" as Examples +import "../shared" as Examples Item { height: 480 diff --git a/examples/quick/touchinteraction/main.cpp b/examples/quick/touchinteraction/main.cpp index 68215b5d89..aac3175743 100644 --- a/examples/quick/touchinteraction/main.cpp +++ b/examples/quick/touchinteraction/main.cpp @@ -37,5 +37,5 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "../../shared/shared.h" +#include "../shared/shared.h" DECLARATIVE_EXAMPLE_MAIN(touchinteraction) diff --git a/examples/quick/touchinteraction/touchinteraction.pro b/examples/quick/touchinteraction/touchinteraction.pro index 83919c4e8f..949651c9cf 100644 --- a/examples/quick/touchinteraction/touchinteraction.pro +++ b/examples/quick/touchinteraction/touchinteraction.pro @@ -3,9 +3,7 @@ TEMPLATE = app QT += quick qml SOURCES += main.cpp -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/touchinteraction +target.path = $$[QT_INSTALL_EXAMPLES]/quick/touchinteraction qml.files = flickable multipointtouch pincharea touchinteraction.qml -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/quick/touchinteraction -sources.files = $$SOURCES touchinteraction.pro -sources.path = $$qml.path -INSTALLS += sources target qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/touchinteraction +INSTALLS += target qml diff --git a/examples/quick/touchinteraction/touchinteraction.qml b/examples/quick/touchinteraction/touchinteraction.qml index ab932e895f..c561714d50 100644 --- a/examples/quick/touchinteraction/touchinteraction.qml +++ b/examples/quick/touchinteraction/touchinteraction.qml @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "../../shared" +import "../shared" Item { height: 480 diff --git a/examples/quick/tutorials/dynamicview/dynamicview1/PetsModel.qml b/examples/quick/tutorials/dynamicview/dynamicview1/PetsModel.qml new file mode 100644 index 0000000000..d0f52e16f2 --- /dev/null +++ b/examples/quick/tutorials/dynamicview/dynamicview1/PetsModel.qml @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml b/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml new file mode 100644 index 0000000000..a3d4af5533 --- /dev/null +++ b/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/dynamicview/dynamicview2/PetsModel.qml b/examples/quick/tutorials/dynamicview/dynamicview2/PetsModel.qml new file mode 100644 index 0000000000..22c7487fe1 --- /dev/null +++ b/examples/quick/tutorials/dynamicview/dynamicview2/PetsModel.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/tutorials/dynamicview/dynamicview2/dynamicview.qml b/examples/quick/tutorials/dynamicview/dynamicview2/dynamicview.qml new file mode 100644 index 0000000000..942505265c --- /dev/null +++ b/examples/quick/tutorials/dynamicview/dynamicview2/dynamicview.qml @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/dynamicview/dynamicview3/PetsModel.qml b/examples/quick/tutorials/dynamicview/dynamicview3/PetsModel.qml new file mode 100644 index 0000000000..22c7487fe1 --- /dev/null +++ b/examples/quick/tutorials/dynamicview/dynamicview3/PetsModel.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/tutorials/dynamicview/dynamicview3/dynamicview.qml b/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml new file mode 100644 index 0000000000..5c3da9499c --- /dev/null +++ b/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/dynamicview/dynamicview4/ListSelector.qml b/examples/quick/tutorials/dynamicview/dynamicview4/ListSelector.qml new file mode 100644 index 0000000000..cfc8af216c --- /dev/null +++ b/examples/quick/tutorials/dynamicview/dynamicview4/ListSelector.qml @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/dynamicview/dynamicview4/PetsModel.qml b/examples/quick/tutorials/dynamicview/dynamicview4/PetsModel.qml new file mode 100644 index 0000000000..22c7487fe1 --- /dev/null +++ b/examples/quick/tutorials/dynamicview/dynamicview4/PetsModel.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/tutorials/dynamicview/dynamicview4/dynamicview.qml b/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml new file mode 100644 index 0000000000..83f61a6e2f --- /dev/null +++ b/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml @@ -0,0 +1,219 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/extending/chapter1-basics/app.qml b/examples/quick/tutorials/extending/chapter1-basics/app.qml new file mode 100644 index 0000000000..b5aabc9367 --- /dev/null +++ b/examples/quick/tutorials/extending/chapter1-basics/app.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/extending/chapter1-basics/chapter1-basics.pro b/examples/quick/tutorials/extending/chapter1-basics/chapter1-basics.pro new file mode 100644 index 0000000000..8ed66f8b66 --- /dev/null +++ b/examples/quick/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/quick/tutorials/extending/chapter1-basics/main.cpp b/examples/quick/tutorials/extending/chapter1-basics/main.cpp new file mode 100644 index 0000000000..89c681185b --- /dev/null +++ b/examples/quick/tutorials/extending/chapter1-basics/main.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + qmlRegisterType("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/quick/tutorials/extending/chapter1-basics/piechart.cpp b/examples/quick/tutorials/extending/chapter1-basics/piechart.cpp new file mode 100644 index 0000000000..eabc0a3ffc --- /dev/null +++ b/examples/quick/tutorials/extending/chapter1-basics/piechart.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +//![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/quick/tutorials/extending/chapter1-basics/piechart.h b/examples/quick/tutorials/extending/chapter1-basics/piechart.h new file mode 100644 index 0000000000..c86554942f --- /dev/null +++ b/examples/quick/tutorials/extending/chapter1-basics/piechart.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 +#include + +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/quick/tutorials/extending/chapter2-methods/app.qml b/examples/quick/tutorials/extending/chapter2-methods/app.qml new file mode 100644 index 0000000000..dee65676ab --- /dev/null +++ b/examples/quick/tutorials/extending/chapter2-methods/app.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/extending/chapter2-methods/chapter2-methods.pro b/examples/quick/tutorials/extending/chapter2-methods/chapter2-methods.pro new file mode 100644 index 0000000000..8ed66f8b66 --- /dev/null +++ b/examples/quick/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/quick/tutorials/extending/chapter2-methods/main.cpp b/examples/quick/tutorials/extending/chapter2-methods/main.cpp new file mode 100644 index 0000000000..89c681185b --- /dev/null +++ b/examples/quick/tutorials/extending/chapter2-methods/main.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + qmlRegisterType("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/quick/tutorials/extending/chapter2-methods/piechart.cpp b/examples/quick/tutorials/extending/chapter2-methods/piechart.cpp new file mode 100644 index 0000000000..27b39d0df2 --- /dev/null +++ b/examples/quick/tutorials/extending/chapter2-methods/piechart.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +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/quick/tutorials/extending/chapter2-methods/piechart.h b/examples/quick/tutorials/extending/chapter2-methods/piechart.h new file mode 100644 index 0000000000..2655299f1a --- /dev/null +++ b/examples/quick/tutorials/extending/chapter2-methods/piechart.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 +#include + +//![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/quick/tutorials/extending/chapter3-bindings/app.qml b/examples/quick/tutorials/extending/chapter3-bindings/app.qml new file mode 100644 index 0000000000..1267697ee7 --- /dev/null +++ b/examples/quick/tutorials/extending/chapter3-bindings/app.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/extending/chapter3-bindings/chapter3-bindings.pro b/examples/quick/tutorials/extending/chapter3-bindings/chapter3-bindings.pro new file mode 100644 index 0000000000..8ed66f8b66 --- /dev/null +++ b/examples/quick/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/quick/tutorials/extending/chapter3-bindings/main.cpp b/examples/quick/tutorials/extending/chapter3-bindings/main.cpp new file mode 100644 index 0000000000..89c681185b --- /dev/null +++ b/examples/quick/tutorials/extending/chapter3-bindings/main.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + qmlRegisterType("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/quick/tutorials/extending/chapter3-bindings/piechart.cpp b/examples/quick/tutorials/extending/chapter3-bindings/piechart.cpp new file mode 100644 index 0000000000..ca7f0d701f --- /dev/null +++ b/examples/quick/tutorials/extending/chapter3-bindings/piechart.cpp @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +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/quick/tutorials/extending/chapter3-bindings/piechart.h b/examples/quick/tutorials/extending/chapter3-bindings/piechart.h new file mode 100644 index 0000000000..216a6012e9 --- /dev/null +++ b/examples/quick/tutorials/extending/chapter3-bindings/piechart.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 +#include + +//![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/quick/tutorials/extending/chapter4-customPropertyTypes/app.qml b/examples/quick/tutorials/extending/chapter4-customPropertyTypes/app.qml new file mode 100644 index 0000000000..b96cb554ac --- /dev/null +++ b/examples/quick/tutorials/extending/chapter4-customPropertyTypes/app.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro b/examples/quick/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro new file mode 100644 index 0000000000..23eb222ea3 --- /dev/null +++ b/examples/quick/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/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp b/examples/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp new file mode 100644 index 0000000000..367a252bf9 --- /dev/null +++ b/examples/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 +#include + +//![0] +int main(int argc, char *argv[]) +{ +//![0] + QGuiApplication app(argc, argv); + + qmlRegisterType("Charts", 1, 0, "PieChart"); + +//![1] + qmlRegisterType("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/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp b/examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp new file mode 100644 index 0000000000..9c907593f7 --- /dev/null +++ b/examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h b/examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h new file mode 100644 index 0000000000..0259720091 --- /dev/null +++ b/examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +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/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp b/examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp new file mode 100644 index 0000000000..b104e31c65 --- /dev/null +++ b/examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +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/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.h b/examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.h new file mode 100644 index 0000000000..5dbe3e53cf --- /dev/null +++ b/examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 +#include + +//![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/quick/tutorials/extending/chapter5-listproperties/app.qml b/examples/quick/tutorials/extending/chapter5-listproperties/app.qml new file mode 100644 index 0000000000..4acd456131 --- /dev/null +++ b/examples/quick/tutorials/extending/chapter5-listproperties/app.qml @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro b/examples/quick/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro new file mode 100644 index 0000000000..23eb222ea3 --- /dev/null +++ b/examples/quick/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/quick/tutorials/extending/chapter5-listproperties/main.cpp b/examples/quick/tutorials/extending/chapter5-listproperties/main.cpp new file mode 100644 index 0000000000..7af7dc8037 --- /dev/null +++ b/examples/quick/tutorials/extending/chapter5-listproperties/main.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + qmlRegisterType("Charts", 1, 0, "PieChart"); + qmlRegisterType("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/quick/tutorials/extending/chapter5-listproperties/piechart.cpp b/examples/quick/tutorials/extending/chapter5-listproperties/piechart.cpp new file mode 100644 index 0000000000..91e056a0cb --- /dev/null +++ b/examples/quick/tutorials/extending/chapter5-listproperties/piechart.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 PieChart::slices() +{ + return QQmlListProperty(this, 0, &PieChart::append_slice); +} + +void PieChart::append_slice(QQmlListProperty *list, PieSlice *slice) +{ + PieChart *chart = qobject_cast(list->object); + if (chart) { + slice->setParentItem(chart); + chart->m_slices.append(slice); + } +} +//![0] diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/piechart.h b/examples/quick/tutorials/extending/chapter5-listproperties/piechart.h new file mode 100644 index 0000000000..1234d07e6a --- /dev/null +++ b/examples/quick/tutorials/extending/chapter5-listproperties/piechart.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +class PieSlice; + +//![0] +class PieChart : public QQuickItem +{ + Q_OBJECT + Q_PROPERTY(QQmlListProperty 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 slices(); + +private: + static void append_slice(QQmlListProperty *list, PieSlice *slice); + + QString m_name; + QList m_slices; +}; +//![2] + +#endif + diff --git a/examples/quick/tutorials/extending/chapter5-listproperties/pieslice.cpp b/examples/quick/tutorials/extending/chapter5-listproperties/pieslice.cpp new file mode 100644 index 0000000000..d2a927c01a --- /dev/null +++ b/examples/quick/tutorials/extending/chapter5-listproperties/pieslice.cpp @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +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/quick/tutorials/extending/chapter5-listproperties/pieslice.h b/examples/quick/tutorials/extending/chapter5-listproperties/pieslice.h new file mode 100644 index 0000000000..e1fc76d445 --- /dev/null +++ b/examples/quick/tutorials/extending/chapter5-listproperties/pieslice.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 +#include + +//![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/quick/tutorials/extending/chapter6-plugins/Charts/qmldir b/examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir new file mode 100644 index 0000000000..d9e8471b3c --- /dev/null +++ b/examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir @@ -0,0 +1,2 @@ +module Charts +plugin chartsplugin diff --git a/examples/quick/tutorials/extending/chapter6-plugins/app.qml b/examples/quick/tutorials/extending/chapter6-plugins/app.qml new file mode 100644 index 0000000000..19c39c9d2b --- /dev/null +++ b/examples/quick/tutorials/extending/chapter6-plugins/app.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 Charts 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/quick/tutorials/extending/chapter6-plugins/chapter6-plugins.pro b/examples/quick/tutorials/extending/chapter6-plugins/chapter6-plugins.pro new file mode 100644 index 0000000000..c84b6fe7ff --- /dev/null +++ b/examples/quick/tutorials/extending/chapter6-plugins/chapter6-plugins.pro @@ -0,0 +1,18 @@ +TEMPLATE = lib +CONFIG += qt plugin +QT += qml quick + +DESTDIR = Charts +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/quick/tutorials/extending/chapter6-plugins/chartsplugin.cpp b/examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.cpp new file mode 100644 index 0000000000..df079f767c --- /dev/null +++ b/examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +void ChartsPlugin::registerTypes(const char *uri) +{ + qmlRegisterType(uri, 1, 0, "PieChart"); + qmlRegisterType(uri, 1, 0, "PieSlice"); +} + +//![0] + diff --git a/examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.h b/examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.h new file mode 100644 index 0000000000..09a120666b --- /dev/null +++ b/examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +class ChartsPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + void registerTypes(const char *uri); +}; +//![0] + +#endif + diff --git a/examples/quick/tutorials/extending/chapter6-plugins/piechart.cpp b/examples/quick/tutorials/extending/chapter6-plugins/piechart.cpp new file mode 100644 index 0000000000..5110153acc --- /dev/null +++ b/examples/quick/tutorials/extending/chapter6-plugins/piechart.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 PieChart::slices() +{ + return QQmlListProperty(this, 0, &PieChart::append_slice); +} + +void PieChart::append_slice(QQmlListProperty *list, PieSlice *slice) +{ + PieChart *chart = qobject_cast(list->object); + if (chart) { + slice->setParentItem(chart); + chart->m_slices.append(slice); + } +} + diff --git a/examples/quick/tutorials/extending/chapter6-plugins/piechart.h b/examples/quick/tutorials/extending/chapter6-plugins/piechart.h new file mode 100644 index 0000000000..e292cdbc7a --- /dev/null +++ b/examples/quick/tutorials/extending/chapter6-plugins/piechart.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +class PieSlice; + +class PieChart : public QQuickItem +{ + Q_OBJECT + Q_PROPERTY(QQmlListProperty 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 slices(); + +private: + static void append_slice(QQmlListProperty *list, PieSlice *slice); + + QString m_name; + QList m_slices; +}; + +#endif + diff --git a/examples/quick/tutorials/extending/chapter6-plugins/pieslice.cpp b/examples/quick/tutorials/extending/chapter6-plugins/pieslice.cpp new file mode 100644 index 0000000000..d2a927c01a --- /dev/null +++ b/examples/quick/tutorials/extending/chapter6-plugins/pieslice.cpp @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +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/quick/tutorials/extending/chapter6-plugins/pieslice.h b/examples/quick/tutorials/extending/chapter6-plugins/pieslice.h new file mode 100644 index 0000000000..2ea15302fb --- /dev/null +++ b/examples/quick/tutorials/extending/chapter6-plugins/pieslice.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 +#include + +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/quick/tutorials/extending/extending.pro b/examples/quick/tutorials/extending/extending.pro new file mode 100644 index 0000000000..967473fda0 --- /dev/null +++ b/examples/quick/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/quick/tutorials/gettingStartedQml/core/Button.qml b/examples/quick/tutorials/gettingStartedQml/core/Button.qml new file mode 100644 index 0000000000..a5afcc0297 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/core/Button.qml @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 { + //identifier of the item + id: button + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //attaches to the Text element's text content + property string label + property color textColor: buttonLabel.color + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "lightsteelblue" + property color borderColor: "transparent" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + property real labelSize: 14 + + //set appearance properties + radius: 6 + antialiasing: true + border { width: 2; color: borderColor } + width: buttonWidth; height: buttonHeight + + Text { + id: buttonLabel + anchors.centerIn: parent + text: label //bind the text to the parent's text + color: "#DCDCCC" + font.pointSize: labelSize + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + + //define the clickable area to be the whole rectangle + MouseArea { + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + //animate the color whenever the color property changes + Behavior on color { ColorAnimation{ duration: 55 } } + + //scale the button when pressed + scale: buttonMouseArea.pressed ? 1.1 : 1.00 + //Animate the scale property change + Behavior on scale { NumberAnimation{ duration: 55 } } + +} diff --git a/examples/quick/tutorials/gettingStartedQml/core/EditMenu.qml b/examples/quick/tutorials/gettingStartedQml/core/EditMenu.qml new file mode 100644 index 0000000000..2665442685 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/core/EditMenu.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: editMenu + height: 480; width:1000 + color: "powderblue" + property color buttonBorderColor: "#7A8182" + property color buttonFillColor: "#61BDCACD" + property string menuName:"Edit" + gradient: Gradient { + GradientStop { position: 0.0; color: "#6A7570" } + GradientStop { position: 1.0; color: Qt.darker("#6A7570") } + } + + Rectangle { + id:actionContainer + color:"transparent" + anchors.centerIn: parent + width: parent.width; height: parent.height / 5 + Row { + anchors.centerIn: parent + spacing: parent.width/9 + Button { + id: loadButton + buttonColor: buttonFillColor + label: "Copy" + labelSize: 16 + borderColor: buttonBorderColor + height: actionContainer.height; width: actionContainer.width/6 + onButtonClick: textArea.copy() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button { + id: saveButton + height: actionContainer.height; width: actionContainer.width/6 + buttonColor: buttonFillColor + label: "Paste" + borderColor: buttonBorderColor + labelSize: 16 + onButtonClick: textArea.paste() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button { + id: exitButton + label: "Select All" + height: actionContainer.height; width: actionContainer.width/6 + labelSize: 16 + buttonColor: buttonFillColor + borderColor:buttonBorderColor + onButtonClick: textArea.selectAll() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + } + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/core/FileDialog.qml b/examples/quick/tutorials/gettingStartedQml/core/FileDialog.qml new file mode 100644 index 0000000000..24501efd89 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/core/FileDialog.qml @@ -0,0 +1,164 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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:dialog + height: 200 * partition; width: 200 + color: "transparent" + + signal selectChanged() + signal notifyRefresh() + onNotifyRefresh:dirView.model = directory.files + + property string selectedFile + property int selectedIndex: 0 + + Rectangle { + id: dirBox + radius: 10 + antialiasing: true + anchors.centerIn:parent + height: parent.height -15; width: parent.width -30 + + Rectangle { + id:header + height: parent.height*0.1; width: parent.width + radius:3 + antialiasing: true + z:1 + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + Text { + height: header.height; anchors.centerIn: header + text: "files:" + color: "lightblue" + font.weight: Font.Light + font.italic: true + } + } + GridView { + id:dirView + width:parent.width; height:parent.height*.9 + anchors.top: header.bottom + cellWidth: 100; cellHeight: 75 + model: directory.files + delegate: dirDelegate + clip: true + highlightMoveDuration: 40 + } + Component { + id: dirDelegate + Rectangle { + id:file + color: "transparent" + width: GridView.view.cellWidth; height: GridView.view.cellHeight + + Text { + id:fileName + width: parent.width + anchors.centerIn: parent + text: name + color: "#BDCACD" + font.weight: GridView.view.currentIndex == index ? Font.DemiBold : Font.Normal + font.pointSize: GridView.view.currentIndex == index ? 12 : 10 + elide: Text.ElideMiddle + horizontalAlignment: Text.AlignHCenter + } + Rectangle { + id: selection + width: parent.width; height: parent.height + anchors.centerIn: parent + radius: 10 + antialiasing: true + scale: GridView.view.currentIndex == index ? 1 : 0.5 + opacity: GridView.view.currentIndex == index ? 1 : 0 + Text { + id: overlay + width: parent.width + anchors.centerIn: parent + text: name + color: "#696167" + font.weight: Font.DemiBold + font.pointSize: 12 + elide: Text.ElideMiddle + horizontalAlignment: Text.AlignHCenter + } + Behavior on opacity { NumberAnimation{ duration: 45 } } + Behavior on scale { NumberAnimation{ duration: 45 } } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter("lightsteelblue",1.25) } + GradientStop { position: 0.67; color: Qt.darker("lightsteelblue",1.3) } + } + border.color: "lightsteelblue" + border.width: 1 + } + MouseArea { + id:fileMouseArea + anchors.fill:parent + hoverEnabled: true + + onClicked: { + GridView.view.currentIndex = index + selectedFile = directory.files[index].name + selectChanged() + } + onEntered: { + fileName.color = "lightsteelblue" + fileName.font.weight = Font.DemiBold + } + onExited: { + fileName.font.weight = Font.Normal + fileName.color = "#BDCACD" + } + } + } + } + gradient: Gradient { + GradientStop { position: 0.0; color: "#A5333333" } + GradientStop { position: 1.0; color: "#03333333" } + } + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/core/FileMenu.qml b/examples/quick/tutorials/gettingStartedQml/core/FileMenu.qml new file mode 100644 index 0000000000..37afca62b9 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/core/FileMenu.qml @@ -0,0 +1,233 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "../filedialog" 1.0 + +Rectangle { + id: fileMenu + height: 480; width:1000 + property color buttonBorderColor: "#7F8487" + property color buttonFillColor: "#8FBDCACD" + property string fileContent:directory.fileContent + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //used to divide the screen into parts. + property real partition: 1/3 + + color: "#6C646A" + gradient: Gradient { + GradientStop { position: 0.0; color: "#6C646A" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } + } + + Directory { + id:directory + filename: textInput.text + onDirectoryChanged:fileDialog.notifyRefresh() + } + + Rectangle { + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.left: parent.left + + //the height is a good proportion that creates more space at the top of + //the column of buttons + width: fileMenu.width * partition; height: fileMenu.height + + Column { + anchors.centerIn: parent + spacing: parent.height/32 + Button { + id: saveButton + label: "Save" + borderColor: buttonBorderColor + buttonColor: buttonFillColor + width: actionContainer.width/ 1.3 + height:actionContainer.height / 8 + labelSize:24 + onButtonClick: { + directory.fileContent = textArea.textContent + directory.filename = textInput.text + directory.saveFile() + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button { + id: loadButton + width: actionContainer.width/ 1.3 + height:actionContainer.height/ 8 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + label: "Load" + labelSize:24 + onButtonClick:{ + directory.filename = textInput.text + directory.loadFile() + textArea.textContent = directory.fileContent + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button { + id: newButton + width: actionContainer.width/ 1.3 + height: actionContainer.height/ 8 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + label: "New" + labelSize: 24 + onButtonClick:{ + textArea.textContent = "" + textInput.text = "" + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + + } + Rectangle { + id: space + width: actionContainer.width/ 1.3 + height: actionContainer.height / 16 + color: "transparent" + } + Button { + id: exitButton + width: actionContainer.width/ 1.3 + height: actionContainer.height/ 8 + label: "Exit" + labelSize: 24 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + onButtonClick: Qt.quit() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + } + } + Rectangle { + id:dialogContainer + + width: 2*fileMenu.width * partition; height: fileMenu.height + anchors.right:parent.right + color: "transparent" + + Column { + anchors.centerIn: parent + spacing: parent.height /640 + FileDialog { + id:fileDialog + height: 2*dialogContainer.height * partition + width: dialogContainer.width + onSelectChanged: textInput.text = selectedFile + } + + Rectangle { + id:lowerPartition + height: dialogContainer.height * partition; width: dialogContainer.width + color: "transparent" + + Rectangle { + id: nameField + gradient: Gradient { + GradientStop { position: 0.0; color: "#806F6F6F" } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + radius: 10 + anchors { centerIn:parent; leftMargin: 15; rightMargin: 15; topMargin: 15 } + height: parent.height-15 + width: parent.width -20 + border { color: "#4A4A4A"; width:1 } + + TextInput { + id: textInput + z:2 + anchors { bottom: parent.bottom; topMargin: 10; horizontalCenter: parent.horizontalCenter } + width: parent.width - 10 + height: parent.height -10 + font.pointSize: 40 + color: "lightsteelblue" + focus: true + } + Text { + id: textInstruction + anchors.centerIn: parent + text: "Select file name and press save or load" + font {pointSize: 11; weight: Font.Light; italic: true} + color: "lightblue" + z: 2 + opacity: (textInput.text == "") ? 1 : 0 + } + Text { + id:fieldLabel + anchors { top: parent.top; left: parent.left } + text: " file name: " + font { pointSize: 11; weight: Font.Light; italic: true } + color: "lightblue" + z:2 + } + MouseArea { + anchors.centerIn:parent + width: nameField.width; height: nameField.height + onClicked: { + textInput.text = "" + textInput.focus = true + textInput.forceFocus() + } + } + } + } + } + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/core/MenuBar.qml b/examples/quick/tutorials/gettingStartedQml/core/MenuBar.qml new file mode 100644 index 0000000000..045e00e6c0 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/core/MenuBar.qml @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: menuBar + width: 1000; height:300 + color:"transparent" + property color fileColor: "plum" + property color editColor: "powderblue" + + property real partition: 1/10 + + Column { + anchors.fill: parent + //container for the header and the buttons + z: 1 + Rectangle { + id: labelList + height:menuBar.height*partition + width: menuBar.width + color: "beige" + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + Text { + height: parent.height + anchors { right: labelRow.left ; verticalCenter: parent.bottom } + text: "menu: " + color: "lightblue" + font { weight: Font.Light; italic: true } + } + //row displays its children in a vertical row + Row { + id: labelRow + anchors.centerIn: parent + spacing:40 + Button { + id: fileButton + height: 20; width: 50 + label: "File" + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + labelSize: menuListView.currentIndex == 0? 16:12 + radius: 1 + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: menuListView.currentIndex = 0 + gradient: Gradient { + GradientStop { position: 0.0; color: fileColor } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + } + Button { + id: editButton + height: 20; width: 50 + buttonColor : menuListView.currentIndex == 1? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + labelSize: menuListView.currentIndex == 1? 16:12 + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: menuListView.currentIndex = 1 + gradient: Gradient { + GradientStop { position: 0.0; color: editColor } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + } + } + } + + //list view will display a model according to a delegate + ListView { + id: menuListView + width:menuBar.width; height: 9*menuBar.height*partition + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + } + //a list of visual items already have delegates handling their display + VisualItemModel { + id: menuListModel + + FileMenu { + id:fileMenu + width: menuListView.width; height: menuListView.height + color: fileColor + } + EditMenu { + color: editColor + width: menuListView.width; height: menuListView.height + } + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/core/TextArea.qml b/examples/quick/tutorials/gettingStartedQml/core/TextArea.qml new file mode 100644 index 0000000000..5165533f65 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/core/TextArea.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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:textArea + + function paste() { textEdit.paste() } + function copy() { textEdit.copy() } + function selectAll() { textEdit.selectAll() } + + width :400; height:400 + + property color fontColor: "white" + property alias textContent: textEdit.text + Flickable { + id: flickArea + width: parent.width; height: parent.height + anchors.fill:parent + + boundsBehavior: Flickable.StopAtBounds + flickableDirection: Flickable.HorizontalFlick + interactive: true + //Will move the text Edit area to make the area visible when + //scrolled with keyboard strokes + 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: textEdit + anchors.fill:parent + width:parent.width; height:parent.height + color:fontColor + focus: true + wrapMode: TextEdit.Wrap + font.pointSize:10 + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + selectByMouse: true + } + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/core/qmldir b/examples/quick/tutorials/gettingStartedQml/core/qmldir new file mode 100644 index 0000000000..da1f373433 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/core/qmldir @@ -0,0 +1,7 @@ +Button ./Button.qml +FileDialog ./FileDialog.qml +TextArea ./TextArea.qml +TextEditor ./TextEditor.qml +EditMenu ./EditMenu.qml +MenuBar ./MenuBar.qml +FileMenu ./FileMenu.qml diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp b/examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp new file mode 100644 index 0000000000..a77b93ae33 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "dialogPlugin.h" +#include "directory.h" +#include "file.h" +#include + +void DialogPlugin::registerTypes(const char *uri) +{ + //register the class Directory into QML as a "Directory" element version 1.0 + qmlRegisterType(uri, 1, 0, "Directory"); + qmlRegisterType(uri,1,0,"File"); +} diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.h b/examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.h new file mode 100644 index 0000000000..05e076839a --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 DIALOGPLUGIN_H +#define DIALOGPLUGIN_H + +#include + +class DialogPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + // registerTypes is inherited from QQmlExtensionPlugin + void registerTypes(const char *uri); +}; + +#endif + diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/directory.cpp b/examples/quick/tutorials/gettingStartedQml/filedialog/directory.cpp new file mode 100644 index 0000000000..38a47f0431 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/filedialog/directory.cpp @@ -0,0 +1,218 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "directory.h" +#include + +/* +Directory constructor + +Initialize the saves directory and creates the file list +*/ +Directory::Directory(QObject *parent) : QObject(parent) +{ + m_dir.cd(QDir::currentPath()); + + // go to the saved directory. if not found, create save directory + m_saveDir = "saves"; + if (m_dir.cd(m_saveDir) == 0) { + m_dir.mkdir(m_saveDir); + m_dir.cd(m_saveDir); + } + m_filterList << "*.txt"; + refresh(); +} + +/* +Directory::filesNumber +Return the number of Files +*/ +int Directory::filesCount() const +{ + return m_fileList.size(); +} + +/* +Function called to append data onto list property +*/ +void appendFiles(QQmlListProperty *property, File *file) +{ + Q_UNUSED(property); + Q_UNUSED(file); + //Do nothing. can't add to a directory using this method +} + +/* +Function called to retrieve file in the list using an index +*/ +File *fileAt(QQmlListProperty *property, int index) +{ + return static_cast< QList *>(property->data)->at(index); +} + +/* +Returns the number of files in the list +*/ +int filesSize(QQmlListProperty *property) +{ + return static_cast< QList *>(property->data)->size(); +} + +/* +Function called to empty the list property contents +*/ +void clearFilesPtr(QQmlListProperty *property) +{ + return static_cast< QList *>(property->data)->clear(); +} + +/* +Returns the list of files as a QQmlListProperty. +*/ +QQmlListProperty Directory::files() +{ + refresh(); + return QQmlListProperty(this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr); +} + +/* +Return the name of the currently selected file +*/ +QString Directory::filename() const +{ + return currentFile.name(); +} + +/* +Return the file's content as a string. +*/ +QString Directory::fileContent() const +{ + return m_fileContent; +} + +/* +Set the file name of the current file +*/ +void Directory::setFilename(const QString &str) +{ + if (str != currentFile.name()) { + currentFile.setName(str); + emit filenameChanged(); + } +} + +/* +Set the content of the file as a string +*/ +void Directory::setFileContent(const QString &str) +{ + if (str != m_fileContent) { + m_fileContent = str; + emit fileContentChanged(); + } +} + +/* +Called from QML to save the file using the filename and file content. +Saving makes sure that the file has a .txt extension. +*/ +void Directory::saveFile() +{ + if (currentFile.name().isEmpty()) { + qWarning()<< "Empty filename. no save"; + return; + } + QString extendedName = currentFile.name(); + if (!currentFile.name().endsWith(".txt")) { + extendedName.append(".txt"); + } + QFile file(m_dir.filePath(extendedName)); + if (file.open(QFile::WriteOnly | QFile::Truncate)) { + QTextStream outStream(&file); + outStream << m_fileContent; + } + file.close(); + refresh(); + emit directoryChanged(); +} + +/* +Load the contents of a file. +Only loads files with a .txt extension +*/ +void Directory::loadFile() +{ + m_fileContent.clear(); + QString extendedName = currentFile.name(); + if (!currentFile.name().endsWith(".txt")) { + extendedName.append(".txt"); + } + + QFile file(m_dir.filePath(extendedName)); + if (file.open(QFile::ReadOnly)) { + QTextStream inStream(&file); + m_fileContent = inStream.readAll(); + } + file.close(); +} + +/* +Reloads the content of the files list. This is to ensure that the newly +created files are added onto the list. +*/ +void Directory::refresh() +{ + m_dirFiles = m_dir.entryList(m_filterList,QDir::Files,QDir::Name); + m_fileList.clear(); + + File *file; + for (int i = 0; i < m_dirFiles.size(); ++i) { + file = new File(); + + if (m_dirFiles.at(i).endsWith(".txt")) { + QString name = m_dirFiles.at(i); + file->setName(name.remove(".txt",Qt::CaseSensitive)); + } else { + file->setName(m_dirFiles.at(i)); + } + m_fileList.append(file); + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/directory.h b/examples/quick/tutorials/gettingStartedQml/filedialog/directory.h new file mode 100644 index 0000000000..90c427c1c5 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/filedialog/directory.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 DIRECTORY_H +#define DIRECTORY_H + +#include "file.h" + +#include +#include +#include +#include +#include + +class Directory : public QObject +{ + Q_OBJECT + + // number of files in the directory + Q_PROPERTY(int filesCount READ filesCount) + + // list property containing file names as QString + Q_PROPERTY(QQmlListProperty files READ files CONSTANT) + + // file name of the text file to read/write + Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) + + // text content of the file + Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) + +public: + Directory(QObject *parent = 0); + + // properties' read functions + int filesCount() const; + QString filename() const; + QString fileContent() const; + QQmlListProperty files(); + + // properties' write functions + void setFilename(const QString &str); + void setFileContent(const QString &str); + + // accessible from QML + Q_INVOKABLE void saveFile(); + Q_INVOKABLE void loadFile(); + +signals: + void directoryChanged(); + void filenameChanged(); + void fileContentChanged(); + +private: + QDir m_dir; + QStringList m_dirFiles; + File currentFile; + QString m_saveDir; + QStringList m_filterList; + + //contains the file data in QString format + QString m_fileContent; + + //Registered to QML in a plugin. Accessible from QML as a property of Directory + QList m_fileList; + + //refresh content of the directory + void refresh(); +}; + +#endif diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/file.cpp b/examples/quick/tutorials/gettingStartedQml/filedialog/file.cpp new file mode 100644 index 0000000000..b53c569d56 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/filedialog/file.cpp @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "file.h" + +File::File(QObject *parent) : QObject(parent) +{ +} + +QString File::name() const +{ + return m_name; +} + +void File::setName(const QString &str) +{ + if (str != m_name) { + m_name = str; + emit nameChanged(); + } +} + diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/file.h b/examples/quick/tutorials/gettingStartedQml/filedialog/file.h new file mode 100644 index 0000000000..7a0da05b70 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/filedialog/file.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 FILE_H +#define FILE_H + +#include +#include + +class File : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + +public: + File(QObject *parent = 0); + + QString name() const; + void setName(const QString &str); + +signals: + void nameChanged(); + +private: + QString m_name; +}; + +#endif diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/filedialog.pro b/examples/quick/tutorials/gettingStartedQml/filedialog/filedialog.pro new file mode 100644 index 0000000000..36d88588e4 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/filedialog/filedialog.pro @@ -0,0 +1,22 @@ +TEMPLATE = lib +CONFIG += qt plugin +QT += qml + +DESTDIR += ../plugins +OBJECTS_DIR = tmp +MOC_DIR = tmp + +TARGET = FileDialog + +HEADERS += directory.h \ + file.h \ + dialogPlugin.h + +SOURCES += directory.cpp \ + file.cpp \ + dialogPlugin.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/tutorials/gettingStartedQml/filedialog +qml.files = qmldir +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/tutorials/gettingStartedQml/filedialog +INSTALLS += target qml diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/qmldir b/examples/quick/tutorials/gettingStartedQml/filedialog/qmldir new file mode 100644 index 0000000000..4a8d13d026 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/filedialog/qmldir @@ -0,0 +1 @@ +plugin FileDialog ../plugins diff --git a/examples/quick/tutorials/gettingStartedQml/gettingStartedQml.pro b/examples/quick/tutorials/gettingStartedQml/gettingStartedQml.pro new file mode 100644 index 0000000000..1fc74b69f3 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/gettingStartedQml.pro @@ -0,0 +1,10 @@ +TEMPLATE = subdirs +SUBDIRS = \ + filedialog\ + +EXAMPLE_FILES = \ + core \ + images \ + parts \ + pics \ + texteditor.qml diff --git a/examples/quick/tutorials/gettingStartedQml/images/arrow.png b/examples/quick/tutorials/gettingStartedQml/images/arrow.png new file mode 100644 index 0000000000..14978c2e56 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/images/arrow.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part0/Button.qml b/examples/quick/tutorials/gettingStartedQml/parts/part0/Button.qml new file mode 100644 index 0000000000..f49ca9359f --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part0/Button.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [document] +import QtQuick 2.0 + +Rectangle { + id: simplebutton + color: "grey" + width: 150; height: 75 + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: "button label" + } +} +//! [document] diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part1/Button.qml b/examples/quick/tutorials/gettingStartedQml/parts/part1/Button.qml new file mode 100644 index 0000000000..ab85963593 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part1/Button.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius: 10 + antialiasing: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part1/EditMenu.qml b/examples/quick/tutorials/gettingStartedQml/parts/part1/EditMenu.qml new file mode 100644 index 0000000000..1940aebac3 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part1/EditMenu.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part1/FileMenu.qml b/examples/quick/tutorials/gettingStartedQml/parts/part1/FileMenu.qml new file mode 100644 index 0000000000..abb7fba41b --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part1/FileMenu.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part1/SimpleButton.qml b/examples/quick/tutorials/gettingStartedQml/parts/part1/SimpleButton.qml new file mode 100644 index 0000000000..7559d4a917 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part1/SimpleButton.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 { + + //identifier of the item + id: simplebutton + + //the rectangle's fill color + color: "grey" + + //dimensions of the button + width: 150; height: 75 + + //A text element contains functionalities for creating texts + Text { + id: buttonLabel + + //center the text inside the parent + anchors.centerIn: parent + + //text property binds to the label displayed on the button + text: "button label" + } + + //define the clickable area to be the whole rectangle + MouseArea { + id: buttonMouseArea + anchors.fill: parent //anchor all sides of the mouse area to the rectangle's anchors + + //onClicked handles valid mouse button clicks + onClicked: console.log(buttonLabel.text + " clicked" ) + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_button.png b/examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_button.png new file mode 100644 index 0000000000..aab64bcf39 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_button.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_editmenu.png b/examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_editmenu.png new file mode 100644 index 0000000000..d3ff66f2fd Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_editmenu.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_filemenu.png b/examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_filemenu.png new file mode 100644 index 0000000000..f2e2b0d990 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_filemenu.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_simplebutton.png b/examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_simplebutton.png new file mode 100644 index 0000000000..21ce50929b Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_simplebutton.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part1/qml-texteditor.qmlproject b/examples/quick/tutorials/gettingStartedQml/parts/part1/qml-texteditor.qmlproject new file mode 100644 index 0000000000..2bb4016996 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part1/qml-texteditor.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/tutorials/gettingStartedQml/parts/part2/Button.qml b/examples/quick/tutorials/gettingStartedQml/parts/part2/Button.qml new file mode 100644 index 0000000000..7119feeb08 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part2/Button.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + antialiasing: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part2/EditMenu.qml b/examples/quick/tutorials/gettingStartedQml/parts/part2/EditMenu.qml new file mode 100644 index 0000000000..47a37059b0 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part2/EditMenu.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part2/FileMenu.qml b/examples/quick/tutorials/gettingStartedQml/parts/part2/FileMenu.qml new file mode 100644 index 0000000000..41c7369fc0 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part2/FileMenu.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part2/MenuBar.qml b/examples/quick/tutorials/gettingStartedQml/parts/part2/MenuBar.qml new file mode 100644 index 0000000000..f9a293361e --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part2/MenuBar.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: menuBar + width: 1000 + height:300 + + property color fileColor: "thistle" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "steelblue" + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part2/pics/qml-texteditor2_menubar.png b/examples/quick/tutorials/gettingStartedQml/parts/part2/pics/qml-texteditor2_menubar.png new file mode 100644 index 0000000000..da959a3468 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/parts/part2/pics/qml-texteditor2_menubar.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part2/qml-texteditor2.qmlproject b/examples/quick/tutorials/gettingStartedQml/parts/part2/qml-texteditor2.qmlproject new file mode 100644 index 0000000000..2bb4016996 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part2/qml-texteditor2.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/tutorials/gettingStartedQml/parts/part3/Button.qml b/examples/quick/tutorials/gettingStartedQml/parts/part3/Button.qml new file mode 100644 index 0000000000..7119feeb08 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part3/Button.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 { + + //identifier of the item + id: button + + property string label: "button label" + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + antialiasing: true + border{color: "white"; width: 3} + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part3/EditMenu.qml b/examples/quick/tutorials/gettingStartedQml/parts/part3/EditMenu.qml new file mode 100644 index 0000000000..47a37059b0 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part3/EditMenu.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part3/FileMenu.qml b/examples/quick/tutorials/gettingStartedQml/parts/part3/FileMenu.qml new file mode 100644 index 0000000000..41c7369fc0 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part3/FileMenu.qml @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part3/MenuBar.qml b/examples/quick/tutorials/gettingStartedQml/parts/part3/MenuBar.qml new file mode 100644 index 0000000000..f9a293361e --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part3/MenuBar.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: menuBar + width: 1000 + height:300 + + property color fileColor: "thistle" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "steelblue" + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part3/TextArea.qml b/examples/quick/tutorials/gettingStartedQml/parts/part3/TextArea.qml new file mode 100644 index 0000000000..fa79c71fd9 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part3/TextArea.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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:textArea + + width :400 + height:400 + color: "white" + + Flickable{ + id: flickArea + + width: parent.width + height: parent.height + anchors.fill:parent + + 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: textEditor + anchors.fill:parent + width:parent.width; height:parent.height + color:"midnightblue" + focus: true + + wrapMode: TextEdit.Wrap + + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + } + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part3/TextEditor.qml b/examples/quick/tutorials/gettingStartedQml/parts/part3/TextEditor.qml new file mode 100644 index 0000000000..49be5e84cd --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part3/TextEditor.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: 1000; height: 1000 + border.color:"black" + //the screen is partitioned into the MenuBar and TextArea. 1/3 of the screen is assigned to the MenuBar + property int partition: height/3 + + MenuBar{ + id:menuBar + height: partition + width:parent.width + z: 1 + } + + + TextArea{ + id:textArea + anchors.bottom:parent.bottom + y: partition + color: "azure" + height: partition*2 + width:parent.width + } + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part3/images/arrow.png b/examples/quick/tutorials/gettingStartedQml/parts/part3/images/arrow.png new file mode 100644 index 0000000000..14978c2e56 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/parts/part3/images/arrow.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part3/pics/qml-texteditor3_texteditor.png b/examples/quick/tutorials/gettingStartedQml/parts/part3/pics/qml-texteditor3_texteditor.png new file mode 100644 index 0000000000..d0623b5a79 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/parts/part3/pics/qml-texteditor3_texteditor.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part3/qml-texteditor3.qmlproject b/examples/quick/tutorials/gettingStartedQml/parts/part3/qml-texteditor3.qmlproject new file mode 100644 index 0000000000..2bb4016996 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part3/qml-texteditor3.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/tutorials/gettingStartedQml/parts/part4/Button.qml b/examples/quick/tutorials/gettingStartedQml/parts/part4/Button.qml new file mode 100644 index 0000000000..50d4c9059f --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part4/Button.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 { + + //identifier of the item + id: button + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //attaches to the Text element's text content + property string label + property color textColor: buttonLabel.color + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "gold" + property color borderColor: "white" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + //set appearance properties + radius:10 + antialiasing: true + border.color: "white" + border.width: 3 + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label //"button label" //bind the text to the parent's text + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + //animate the color whenever the color property changes + Behavior on color { ColorAnimation{ duration: 55} } + + //scale the button when pressed + scale: buttonMouseArea.pressed ? 1.1 : 1.00 + //Animate the scale property change + Behavior on scale { NumberAnimation{ duration: 55} } + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part4/EditMenu.qml b/examples/quick/tutorials/gettingStartedQml/parts/part4/EditMenu.qml new file mode 100644 index 0000000000..9613e3aaf5 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part4/EditMenu.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: editMenu + height: 480; width:1000 + color: "powderblue" + property string menuName:"Edit" + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6A6F70" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D67") } + } + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Cut" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Paste" + } + Button{ + id: exitButton + label: "Select All" + buttonColor: "darkgrey" + } + } + } + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part4/FileMenu.qml b/examples/quick/tutorials/gettingStartedQml/parts/part4/FileMenu.qml new file mode 100644 index 0000000000..fd3ccbd710 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part4/FileMenu.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: fileMenu + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //generous amount of screen space that will allow the buttons to fit + height: 480; width:1000 + + color: "#6C646A" + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6C646A" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } + } + + //a sub-rectangle allows the flexibility of setting the row area + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.centerIn: parent + + //the height is a good proportion that creates more space at the top of the row of buttons + width: parent.width; height: parent.height / 5 + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + //exit the application if the exitButton is clicked + onButtonClick:{ + Qt.quit() + } + } + } + } + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part4/MenuBar.qml b/examples/quick/tutorials/gettingStartedQml/parts/part4/MenuBar.qml new file mode 100644 index 0000000000..abd8a313cf --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part4/MenuBar.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: menuBar + width: 1000 + height:300 + + property color fileColor: "plum" + property color editColor: "powderblue" + + //container for the header and the buttons + Rectangle{ + + id: labelList + height:parent.height/10 + width: parent.width + color: "beige" + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + + //default z is 0, items with higher z values are shown on top of items with lower z values + z: 1 + + //row displays its children in a vertical row + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + height: 20 + width: 50 + label: "File" + id: fileButton + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + radius: 1 + + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: { + menuListView.currentIndex = 0 + } + } + Button{ + height: 20 + width: 50 + id: editButton + buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: { + menuListView.currentIndex = 1 + } + + + } + + + } + } + + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part4/SimpleButton.qml b/examples/quick/tutorials/gettingStartedQml/parts/part4/SimpleButton.qml new file mode 100644 index 0000000000..27f6923c1d --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part4/SimpleButton.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: simplebutton + color: "grey" + width: 150; height: 75 + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: "button label" + } + + MouseArea{ + id: buttonMouseArea + anchors.fill: parent + onClicked: console.log(buttonLabel.text + " clicked" ) + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part4/TextArea.qml b/examples/quick/tutorials/gettingStartedQml/parts/part4/TextArea.qml new file mode 100644 index 0000000000..88a60d049c --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part4/TextArea.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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:textArea + + width :400 + height:400 + property color fontColor: "white" + + Flickable{ + id: flickArea + + width: parent.width + height: parent.height + anchors.fill:parent + + 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: textEditor + anchors.fill:parent + width:parent.width; height:parent.height + color:fontColor + focus: true + + wrapMode: TextEdit.Wrap + + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + } + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part4/TextEditor.qml b/examples/quick/tutorials/gettingStartedQml/parts/part4/TextEditor.qml new file mode 100644 index 0000000000..09bcb37cb2 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part4/TextEditor.qml @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: 1000; height: 1000 + property int partition: height/3 + state: "DRAWER_CLOSED" + + + //Item 1: MenuBar on the top portion of the screen + MenuBar{ + id:menuBar + height: partition + //anchors.top:parent.top + width:parent.width + z:1 + } + + + //Item 2: The editable text area + TextArea{ + id:textArea + y:drawer.height + border.color: Qt.darker(color, 1.4) + border.width: 2 + color: "#3F3F3F" + fontColor: "#DCDCCC" + height: partition*2 + width:parent.width + } + + //Item 3: The drawer handle + Rectangle{ + id:drawer + height:15 + width: parent.width + border.color : "#6A6D6A" + border.width: 1 + + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.77; color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#6A6D6A" } + } + + Image{ + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + + Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} + } + + MouseArea{ + id: drawerMouseArea + anchors.fill:parent + onClicked:{ + if (screen.state == "DRAWER_CLOSED"){ + screen.state = "DRAWER_OPEN" + console.log("drawer OPEN") + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + console.log("drawer closed") + } + } + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = Qt.lighter("#6A6D6A") + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = "#6A6D6A" + } + + } + states:[ + State{ + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y:0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State{ + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-partition} + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} + PropertyChanges { target: drawer; y: 0} + PropertyChanges { target: arrowIcon; rotation: 0} + } + + ] + transitions: [ + Transition{ + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } + NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + } + + ] +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part4/images/arrow.png b/examples/quick/tutorials/gettingStartedQml/parts/part4/images/arrow.png new file mode 100644 index 0000000000..14978c2e56 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/parts/part4/images/arrow.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part4/pics/qml-texteditor4_texteditor.png b/examples/quick/tutorials/gettingStartedQml/parts/part4/pics/qml-texteditor4_texteditor.png new file mode 100644 index 0000000000..a195fb87c3 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/parts/part4/pics/qml-texteditor4_texteditor.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part4/qml-texteditor4.qmlproject b/examples/quick/tutorials/gettingStartedQml/parts/part4/qml-texteditor4.qmlproject new file mode 100644 index 0000000000..2bb4016996 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part4/qml-texteditor4.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/tutorials/gettingStartedQml/parts/part5/TextEditor.qml b/examples/quick/tutorials/gettingStartedQml/parts/part5/TextEditor.qml new file mode 100644 index 0000000000..5ce5a89ceb --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/TextEditor.qml @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: screen + width: 1000; height: 1000 + property int partition: height/3 + state: "DRAWER_CLOSED" + + //Item 1: MenuBar on the top portion of the screen + MenuBar{ + id:menuBar + height: screen.partition; width: screen.width + z:1 + } + //Item 2: The editable text area + TextArea{ + id:textArea + y:drawer.height + color: "#3F3F3F" + fontColor: "#DCDCCC" + height: partition*2; width:parent.width + } + //Item 3: The drawer handle + Rectangle{ + id:drawer + height:15; width: parent.width + border.color : "#6A6D6A" + border.width: 1 + z:1 + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.77; color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#6A6D6A" } + } + Image{ + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + + Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} + } + + MouseArea{ + id: drawerMouseArea + anchors.fill:parent + hoverEnabled: true + onEntered: parent.border.color = Qt.lighter("#6A6D6A") + onExited: parent.border.color = "#6A6D6A" + onClicked:{ + if (screen.state == "DRAWER_CLOSED"){ + screen.state = "DRAWER_OPEN" + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + } + } + } + } + + states:[ + State{ + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y: 0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State{ + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-height; } + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} + PropertyChanges { target: drawer; y: 0} + PropertyChanges { target: arrowIcon; rotation: 0} + } + ] + + transitions: [ + Transition{ + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } + NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } + } + ] +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/core/Button.qml b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/Button.qml new file mode 100644 index 0000000000..eca367e859 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/Button.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 { + + //identifier of the item + id: button + + //these properties act as constants, useable outside this QML file + property int buttonHeight: 75 + property int buttonWidth: 150 + + //attaches to the Text element's text content + property string label + property color textColor: buttonLabel.color + + //the color highlight when the mouse hovers on the rectangle + property color onHoverColor: "lightsteelblue" + property color borderColor: "transparent" + + //buttonColor is set to the button's main color + property color buttonColor: "lightblue" + + property real labelSize: 14 + //set appearance properties + radius:6 + antialiasing: true + border.width: 2 + border.color: borderColor + width: buttonWidth; height: buttonHeight + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: label //bind the text to the parent's text + color: "#DCDCCC" + font.pointSize: labelSize + } + + //buttonClick() is callable and a signal handler, onButtonClick is automatically created + signal buttonClick() + + //define the clickable area to be the whole rectangle + MouseArea{ + id: buttonMouseArea + anchors.fill: parent //stretch the area to the parent's dimension + onClicked: buttonClick() + + //if true, then onEntered and onExited called if mouse hovers in the mouse area + //if false, a button must be clicked to detect the mouse hover + hoverEnabled: true + + //display a border if the mouse hovers on the button mouse area + onEntered: parent.border.color = onHoverColor + //remove the border if the mouse exits the button mouse area + onExited: parent.border.color = borderColor + + } + + //change the color of the button when pressed + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + //animate the color whenever the color property changes + Behavior on color { ColorAnimation{ duration: 55} } + + //scale the button when pressed + scale: buttonMouseArea.pressed ? 1.1 : 1.00 + //Animate the scale property change + Behavior on scale { NumberAnimation{ duration: 55} } + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/core/EditMenu.qml b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/EditMenu.qml new file mode 100644 index 0000000000..57e297c509 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/EditMenu.qml @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: editMenu + height: 480; width:1000 + color: "powderblue" + property color buttonBorderColor: "#7A8182" + property color buttonFillColor: "#61BDCACD" + property string menuName:"Edit" + + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6A7570" } + GradientStop { position: 1.0; color: Qt.darker("#6A7570") } + } + + Rectangle{ + id:actionContainer + color:"transparent" + anchors.centerIn: parent + width: parent.width; height: parent.height / 5 + Row{ + anchors.centerIn: parent + spacing: parent.width/9 + Button{ + id: loadButton + buttonColor: buttonFillColor + label: "Copy" + labelSize:16 + borderColor:buttonBorderColor + height: actionContainer.height + width: actionContainer.width/6 + onButtonClick:textArea.copy() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + + Button{ + id: saveButton + height: actionContainer.height + width: actionContainer.width/6 + buttonColor: buttonFillColor + label: "Paste" + borderColor:buttonBorderColor + labelSize:16 + onButtonClick:textArea.paste() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button{ + id: exitButton + label: "Select All" + height: actionContainer.height + width: actionContainer.width/6 + labelSize:16 + buttonColor: buttonFillColor + borderColor:buttonBorderColor + onButtonClick:textArea.selectAll() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + } + } + +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/core/FileDialog.qml b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/FileDialog.qml new file mode 100644 index 0000000000..b73e908464 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/FileDialog.qml @@ -0,0 +1,171 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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:dialog + height: 200 * partition; width: 200 + color: "transparent" + + signal selectChanged() + signal notifyRefresh() + onNotifyRefresh:dirView.model = directory.files + + property string selectedFile + property int selectedIndex: 0 + + Rectangle{ + id: dirBox + radius: 10 + antialiasing: true + anchors.centerIn:parent + height: parent.height -15; width: parent.width -30 + + Rectangle{ + id:header + height:parent.height*0.1 + width: parent.width + radius:3 + antialiasing: true + z:1 + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + Text{ + height: header.height + anchors.centerIn: header + text: "files:" + color: "lightblue" + font.weight: Font.Light + font.italic: true + } + } + GridView{ + id:dirView + width:parent.width + height:parent.height*.9 + anchors.top: header.bottom + cellWidth: 100 + cellHeight: 75 +// highlight: Rectangle { width:cellWidth; height: cellHeight; color: "lightsteelblue" ;radius: 13} + model: directory.files + delegate: dirDelegate + clip: true + highlightMoveDuration:40 + } + + Component{ + id:dirDelegate + + Rectangle{ + id:file + color: "transparent" + width: GridView.view.cellWidth; height: GridView.view.cellHeight + + Text{ + id:fileName + width: parent.width + anchors.centerIn:parent + text: name + color: "#BDCACD" + font.weight: GridView.view.currentIndex == index ? Font.DemiBold : Font.Normal + font.pointSize: GridView.view.currentIndex == index ? 12 : 10 + elide: Text.ElideMiddle + horizontalAlignment: Text.AlignHCenter + } + Rectangle{ + id:selection + width:parent.width; height:parent.height + anchors.centerIn: parent + radius: 10 + antialiasing: true + scale: GridView.view.currentIndex == index ? 1 : 0.5 + opacity: GridView.view.currentIndex == index ? 1 : 0 + Text{ + id:overlay + width: parent.width + anchors.centerIn:parent + text: name + color: "#696167" + font.weight: Font.DemiBold + font.pointSize: 12 + elide: Text.ElideMiddle + horizontalAlignment: Text.AlignHCenter + } + Behavior on opacity{ NumberAnimation{ duration: 45} } + Behavior on scale { NumberAnimation{ duration: 45} } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter("lightsteelblue",1.25) } + GradientStop { position: 0.67; color: Qt.darker("lightsteelblue",1.3) } + } + border.color:"lightsteelblue" + border.width:1 + } + MouseArea{ + id:fileMouseArea + anchors.fill:parent + hoverEnabled: true + + onClicked:{ + GridView.view.currentIndex = index + selectedFile = directory.files[index].name + selectChanged() + } + onEntered:{ + fileName.color = "lightsteelblue" + fileName.font.weight = Font.DemiBold + } + onExited: { + fileName.font.weight = Font.Normal + fileName.color = "#BDCACD" + } + } + } + } + gradient: Gradient{ + GradientStop { position: 0.0; color: "#A5333333" } + GradientStop { position: 1.0; color: "#03333333" } + } + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/core/FileMenu.qml b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/FileMenu.qml new file mode 100644 index 0000000000..c13e753f06 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/FileMenu.qml @@ -0,0 +1,233 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "../filedialog" 1.0 + +Rectangle { + id: fileMenu + height: 480; width:1000 + property color buttonBorderColor: "#7F8487" + property color buttonFillColor: "#8FBDCACD" + property string fileContent:directory.fileContent + + //the menuName is accessible from outside this QML file + property string menuName: "File" + + //used to divide the screen into parts. + property real partition: 1/3 + + color: "#6C646A" + gradient: Gradient{ + GradientStop { position: 0.0; color: "#6C646A" } + GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } + } + + Directory{ + id:directory + filename: textInput.text + onDirectoryChanged:fileDialog.notifyRefresh() + } + + Rectangle{ + id:actionContainer + + //make this rectangle invisible + color:"transparent" + anchors.left: parent.left + + //the height is a good proportion that creates more space at the top of the column of buttons + width: fileMenu.width * partition; height: fileMenu.height + + Column{ + anchors.centerIn: parent + spacing: parent.height/32 + Button{ + id: saveButton + label: "Save" + borderColor: buttonBorderColor + buttonColor: buttonFillColor + width: actionContainer.width/ 1.3 + height:actionContainer.height / 8 + labelSize:24 + onButtonClick:{ + directory.fileContent = textArea.textContent + directory.filename = textInput.text + directory.saveFile() + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + + } + Button{ + id: loadButton + width: actionContainer.width/ 1.3 + height:actionContainer.height/ 8 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + label: "Load" + labelSize:24 + onButtonClick:{ + directory.filename = textInput.text + directory.loadFile() + textArea.textContent = directory.fileContent + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + Button{ + id: newButton + width: actionContainer.width/ 1.3 + height:actionContainer.height/ 8 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + label: "New" + labelSize:24 + onButtonClick:{ + textArea.textContent = "" + textInput.text = "" + } + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + + } + Rectangle{ + id: space + width: actionContainer.width/ 1.3 + height:actionContainer.height / 16 + color:"transparent" + } + Button{ + id: exitButton + width: actionContainer.width/ 1.3 + height:actionContainer.height/ 8 + label: "Exit" + labelSize:24 + buttonColor: buttonFillColor + borderColor: buttonBorderColor + onButtonClick:Qt.quit() + gradient: Gradient { + GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } + GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } + } + } + } + } + + Rectangle{ + id:dialogContainer + + width: 2*fileMenu.width * partition; height: fileMenu.height + anchors.right:parent.right + color:"transparent" + + Column { + anchors.centerIn: parent + spacing: parent.height /640 + FileDialog{ + id:fileDialog + height: 2*dialogContainer.height * partition; width: dialogContainer.width + onSelectChanged: textInput.text = selectedFile + } + + Rectangle{ + id:lowerPartition + height: dialogContainer.height * partition; width: dialogContainer.width + color: "transparent" + + Rectangle{ + id: nameField + gradient: Gradient{ + GradientStop { position: 0.0; color: "#806F6F6F" } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + + radius: 10 + anchors {centerIn:parent; leftMargin: 15; rightMargin: 15; topMargin: 15} + height: parent.height-15; width: parent.width -20 + border {color:"#4A4A4A"; width:1} + + TextInput{ + id: textInput + z:2 + anchors {bottom: parent.bottom; topMargin: 10; horizontalCenter:parent.horizontalCenter} + width: parent.width - 10 + height: parent.height -10 + font.pointSize: 40 + color:"lightsteelblue" + focus:true + } + Text{ + id: textInstruction + anchors.centerIn:parent + text: "Select file name and press save or load" + font {pointSize: 11; weight:Font.Light; italic: true} + color: "lightblue" + z:2 + opacity: (textInput.text == "") ? 1: 0 + } + Text{ + id:fieldLabel + anchors {top: parent.top; left: parent.left} + text: " file name: " + font {pointSize: 11; weight: Font.Light; italic: true} + color: "lightblue" + z:2 + } + MouseArea{ + anchors.centerIn:parent + width: nameField.width; height: nameField.height + onClicked:{ + textInput.text = "" + textInput.focus = true + textInput.forceFocus() + } + } + } + } + } + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/core/MenuBar.qml b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/MenuBar.qml new file mode 100644 index 0000000000..89f21c021d --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/MenuBar.qml @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: menuBar + width: 1000; height:300 + color:"transparent" + property color fileColor: "plum" + property color editColor: "powderblue" + + property real partition: 1/10 + + Column{ + anchors.fill: parent + //container for the header and the buttons + z: 1 + Rectangle{ + id: labelList + height:menuBar.height*partition + width: menuBar.width + color: "beige" + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + Text{ + height: parent.height + anchors {right: labelRow.left ; verticalCenter: parent.bottom} + text: "menu: " + color: "lightblue" + font {weight: Font.Light; italic: true} + } + + //row displays its children in a vertical row + Row{ + id: labelRow + anchors.centerIn: parent + spacing:40 + Button{ + id: fileButton + height: 20; width: 50 + label: "File" + buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) + scale: menuListView.currentIndex == 0? 1.25: 1 + labelSize: menuListView.currentIndex == 0? 16:12 + radius: 1 + //on a button click, change the list's currently selected item to FileMenu + onButtonClick: menuListView.currentIndex = 0 + gradient: Gradient{ + GradientStop { position: 0.0; color: fileColor } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + } + Button{ + id: editButton + height: 20; width: 50 + buttonColor : menuListView.currentIndex == 1? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9) + scale: menuListView.currentIndex == 1? 1.25: 1 + label: "Edit" + radius: 1 + labelSize: menuListView.currentIndex == 1? 16:12 + //on a button click, change the list's currently selected item to EditMenu + onButtonClick: menuListView.currentIndex = 1 + gradient: Gradient{ + GradientStop { position: 0.0; color: editColor } + GradientStop { position: 1.0; color: "#136F6F6F" } + } + } + } + } + + //list view will display a model according to a delegate + ListView{ + id: menuListView + width:menuBar.width; height: 9*menuBar.height*partition + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + } + //a list of visual items already have delegates handling their display + VisualItemModel{ + id: menuListModel + + FileMenu{ + id:fileMenu + width: menuListView.width; height: menuListView.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width; height: menuListView.height + } + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/core/TextArea.qml b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/TextArea.qml new file mode 100644 index 0000000000..a19e53264d --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/TextArea.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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:textArea + + function paste(){ textEdit.paste()} + function copy() { textEdit.copy() } + function selectAll() { textEdit.selectAll() } + + width :400; height:400 + + property color fontColor: "white" + property alias textContent: textEdit.text + Flickable{ + id: flickArea + width: parent.width; height: parent.height + anchors.fill:parent + + boundsBehavior: Flickable.StopAtBounds + flickableDirection: Flickable.HorizontalFlick + interactive: true + //Will move the text Edit area to make the area visible when scrolled with keyboard strokes + 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: textEdit + anchors.fill:parent + width:parent.width; height:parent.height + color:fontColor + focus: true + wrapMode: TextEdit.Wrap + font.pointSize:10 + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + selectByMouse: true + } + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/core/qmldir b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/qmldir new file mode 100644 index 0000000000..b8b0c7c431 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/core/qmldir @@ -0,0 +1,11 @@ + +Button ./Button.qml +FileDialog ./FileDialog.qml +TextArea ./TextArea.qml +TextEditor ./TextEditor.qml +EditMenu ./EditMenu.qml +MenuBar ./MenuBar.qml + + + + diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp new file mode 100644 index 0000000000..d71e622b33 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "dialogPlugin.h" +#include "directory.h" +#include "file.h" +#include + +void DialogPlugin::registerTypes(const char *uri){ + + //register the class Directory into QML as a "Directory" element version 1.0 + qmlRegisterType(uri, 1, 0, "Directory"); + qmlRegisterType(uri,1,0,"File"); + + //qRegisterMetaType > ("QQmlListProperty"); + +} + +//FileDialog is the plugin name (same as the TARGET in the project file) and DialogPlugin is the plugin classs +Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin); diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h new file mode 100644 index 0000000000..82035193c8 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 DIALOGPLUGIN_H +#define DIALOGPLUGIN_H + +#include + +class DialogPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + + public: + //registerTypes is inherited from QQmlExtensionPlugin + void registerTypes(const char *uri); + +}; + +#endif + diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/directory.cpp b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/directory.cpp new file mode 100644 index 0000000000..4cd9d2da85 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/directory.cpp @@ -0,0 +1,219 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "directory.h" +#include + +/* +Directory constructor + +Initialize the saves directory and creates the file list +*/ +Directory::Directory(QObject *parent) : QObject(parent) +{ + + + m_dir.cd( QDir::currentPath()); + + //go to the saved directory. if not found, create save directory + m_saveDir = "saves"; + if (m_dir.cd(m_saveDir) == 0){ + m_dir.mkdir(m_saveDir); + m_dir.cd(m_saveDir); + } + m_filterList << "*.txt"; + + refresh(); +} + +/* +Directory::filesNumber +Return the number of Files +*/ +int Directory:: filesCount() const{ + return m_fileList.size(); +} + +/* +Function called to append data onto list property +*/ +void appendFiles(QQmlListProperty * property, File * file){ + //Do nothing. can't add to a directory using this method +} + +/* +Function called to retrieve file in the list using an index +*/ +File* fileAt(QQmlListProperty * property, int index){ + return static_cast< QList *>(property->data)->at(index); +} + +/* +Returns the number of files in the list +*/ +int filesSize(QQmlListProperty * property){ + return static_cast< QList *>(property->data)->size(); +} + +/* +Function called to empty the list property contents +*/ +void clearFilesPtr(QQmlListProperty *property){ + return static_cast< QList *>(property->data)->clear(); +} + +/* +Returns the list of files as a QQmlListProperty. +*/ +QQmlListProperty Directory::files(){ + + refresh(); +// return QQmlListProperty(this,m_filePtrList); //not recommended in the docs + return QQmlListProperty( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr ); +} + +/* +Return te name of the currently selected file +*/ +QString Directory::filename() const{ + return currentFile.name(); +} + +/* +Return the file's content as a string. +*/ +QString Directory::fileContent() const{ + return m_fileContent; +} + +/* +Set the file name of the current file +*/ +void Directory::setFilename(const QString &str){ + if(str != currentFile.name()){ + currentFile.setName(str); + emit filenameChanged(); + } +} + +/* +Set the content of the file as a string +*/ +void Directory::setFileContent(const QString &str){ + if(str != m_fileContent){ + m_fileContent = str; + emit fileContentChanged(); + } +} + +/* +Called from QML to save the file using the filename and file content. +Saving makes sure that the file has a .txt extension. +*/ +void Directory::saveFile(){ + + if(currentFile.name().size() == 0){ + qWarning()<< "Empty filename. no save"; + return; + } + + QString extendedName = currentFile.name(); + if(!currentFile.name().endsWith(".txt")){ + extendedName.append(".txt"); + } + + QFile file( m_dir.filePath(extendedName) ); + if (file.open(QFile::WriteOnly | QFile::Truncate)){ + QTextStream outStream(&file); + outStream << m_fileContent; + } + file.close(); + refresh(); + emit directoryChanged(); +} + +/* +Load the contents of a file. +Only loads files with a .txt extension +*/ +void Directory::loadFile(){ + + m_fileContent.clear(); + QString extendedName = currentFile.name(); + if(!currentFile.name().endsWith(".txt")){ + extendedName.append(".txt"); + } + + QFile file( m_dir.filePath(extendedName) ); + if (file.open(QFile::ReadOnly )){ + QTextStream inStream(&file); + + QString line; + do{ + line = inStream.read(75); + m_fileContent.append(line); + }while (!line .isNull()); + } + file.close(); +} + +/* +Reloads the content of the files list. This is to ensure that the newly +created files are added onto the list. +*/ +void Directory::refresh(){ + m_dirFiles = m_dir.entryList(m_filterList,QDir::Files,QDir::Name); + m_fileList.clear(); + + File * file; + for(int i = 0; i < m_dirFiles.size() ; i ++){ + + file = new File(); + + if(m_dirFiles.at(i).endsWith(".txt")){ + QString name = m_dirFiles.at(i); + file->setName( name.remove(".txt",Qt::CaseSensitive)); + } + else{ + file->setName(m_dirFiles.at(i)); + } + m_fileList.append(file); + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/directory.h b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/directory.h new file mode 100644 index 0000000000..25b121d5b3 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/directory.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 DIRECTORY_H +#define DIRECTORY_H + +#include "file.h" + +#include +#include +#include +#include +#include + +class Directory : public QObject{ + + Q_OBJECT + + //number of files in the directory + Q_PROPERTY(int filesCount READ filesCount) + + //list property containing file names as QString + Q_PROPERTY(QQmlListProperty files READ files CONSTANT ) + + //file name of the text file to read/write + Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) + + //text content of the file + Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) + + public: + Directory(QObject *parent = 0); + + //properties' read functions + int filesCount() const; + QString filename() const; + QString fileContent() const; + QQmlListProperty files(); + + //properties' write functions + void setFilename(const QString &str); + void setFileContent(const QString &str); + + //accessible from QML + Q_INVOKABLE void saveFile(); + Q_INVOKABLE void loadFile(); + + signals: + void directoryChanged(); + void filenameChanged(); + void fileContentChanged(); + + private: + QDir m_dir; + QStringList m_dirFiles; + File currentFile; + QString m_saveDir; + QStringList m_filterList; + + //contains the file data in QString format + QString m_fileContent; + + //Registered to QML in a plugin. Accessible from QML as a property of Directory + QList m_fileList; + + //refresh content of the directory + void refresh(); +}; + + +#endif diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/file.cpp b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/file.cpp new file mode 100644 index 0000000000..162350eb0f --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/file.cpp @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 "file.h" + +File::File(QObject *parent) : QObject(parent) +{ + m_name = ""; +} + +QString File::name() const{ + return m_name; +} +void File::setName(const QString &str){ + if(str != m_name){ + m_name = str; + emit nameChanged(); + } +} diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/file.h b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/file.h new file mode 100644 index 0000000000..7125a9aae5 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/file.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 FILE_H +#define FILE_H + + +#include +#include + +class File : public QObject{ + + Q_OBJECT + + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + + public: + File(QObject *parent = 0); + + QString name() const; + void setName(const QString &str); + + signals: + void nameChanged(); + + private: + QString m_name; +}; + +#endif diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/filedialog.pro b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/filedialog.pro new file mode 100644 index 0000000000..71abddc7e3 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/filedialog.pro @@ -0,0 +1,17 @@ +TEMPLATE = lib +CONFIG += qt plugin +QT += qml + +DESTDIR += ../plugins +OBJECTS_DIR = tmp +MOC_DIR = tmp + +TARGET = FileDialog + +HEADERS += directory.h \ + file.h \ + dialogPlugin.h + +SOURCES += directory.cpp \ + file.cpp \ + dialogPlugin.cpp diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/qmldir b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/qmldir new file mode 100644 index 0000000000..4a8d13d026 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/filedialog/qmldir @@ -0,0 +1 @@ +plugin FileDialog ../plugins diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/images/arrow.png b/examples/quick/tutorials/gettingStartedQml/parts/part5/images/arrow.png new file mode 100644 index 0000000000..14978c2e56 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/parts/part5/images/arrow.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_editmenu.png b/examples/quick/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_editmenu.png new file mode 100644 index 0000000000..27feed5e82 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_editmenu.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_filemenu.png b/examples/quick/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_filemenu.png new file mode 100644 index 0000000000..4d8f9f22b2 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_filemenu.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_newfile.png b/examples/quick/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_newfile.png new file mode 100644 index 0000000000..680acfe839 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_newfile.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/parts/part5/qml-texteditor5.qmlproject b/examples/quick/tutorials/gettingStartedQml/parts/part5/qml-texteditor5.qmlproject new file mode 100644 index 0000000000..2bb4016996 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/parts/part5/qml-texteditor5.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/tutorials/gettingStartedQml/pics/qml-texteditor5_editmenu.png b/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_editmenu.png new file mode 100644 index 0000000000..27feed5e82 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_editmenu.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_filemenu.png b/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_filemenu.png new file mode 100644 index 0000000000..4d8f9f22b2 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_filemenu.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_newfile.png b/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_newfile.png new file mode 100644 index 0000000000..680acfe839 Binary files /dev/null and b/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_newfile.png differ diff --git a/examples/quick/tutorials/gettingStartedQml/texteditor.qml b/examples/quick/tutorials/gettingStartedQml/texteditor.qml new file mode 100644 index 0000000000..8e09b7fcf9 --- /dev/null +++ b/examples/quick/tutorials/gettingStartedQml/texteditor.qml @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: screen + width: 1000; height: 1000 + property int partition: height/3 + border { width: 1; color: "#DCDCCC"} + state: "DRAWER_CLOSED" + + //Item 1: MenuBar on the top portion of the screen + MenuBar { + id:menuBar + height: screen.partition; width: screen.width + z: 1 + } + + //Item 2: The editable text area + TextArea { + id: textArea + y: drawer.height + color: "#3F3F3F" + fontColor: "#DCDCCC" + height: partition*2; width:parent.width + } + + //Item 3: The drawer handle + Rectangle { + id: drawer + height: 15; width: parent.width + border { color : "#6A6D6A"; width: 1 } + z: 1 + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.77; color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#6A6D6A" } + } + Image { + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + Behavior{ NumberAnimation { property: "rotation"; easing.type: Easing.OutExpo } } + } + + MouseArea { + id: drawerMouseArea + anchors.fill: parent + hoverEnabled: true + onEntered: parent.border.color = Qt.lighter("#6A6D6A") + onExited: parent.border.color = "#6A6D6A" + onClicked: { + if (screen.state == "DRAWER_CLOSED") { + screen.state = "DRAWER_OPEN" + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + } + } + } + } + +//! [states] + states:[ + State { + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y: 0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State { + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-height; } + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height } + PropertyChanges { target: drawer; y: 0 } + PropertyChanges { target: arrowIcon; rotation: 0 } + } + ] +//! [states] + +//! [transitions] + transitions: [ + Transition { + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } + NumberAnimation { target: menuBar; properties: "y"; duration: 100; easing.type: Easing.OutExpo } + NumberAnimation { target: drawer; properties: "y"; duration: 100; easing.type: Easing.OutExpo } + } + ] +//! [transitions] +} diff --git a/examples/quick/tutorials/helloworld/Cell.qml b/examples/quick/tutorials/helloworld/Cell.qml new file mode 100644 index 0000000000..760c468eaa --- /dev/null +++ b/examples/quick/tutorials/helloworld/Cell.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/helloworld/tutorial1.qml b/examples/quick/tutorials/helloworld/tutorial1.qml new file mode 100644 index 0000000000..f55a5d50cd --- /dev/null +++ b/examples/quick/tutorials/helloworld/tutorial1.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: 320; height: 480 + 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/quick/tutorials/helloworld/tutorial2.qml b/examples/quick/tutorials/helloworld/tutorial2.qml new file mode 100644 index 0000000000..fbcae467c3 --- /dev/null +++ b/examples/quick/tutorials/helloworld/tutorial2.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: 320; height: 480 + 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/quick/tutorials/helloworld/tutorial3.qml b/examples/quick/tutorials/helloworld/tutorial3.qml new file mode 100644 index 0000000000..9b95e012a9 --- /dev/null +++ b/examples/quick/tutorials/helloworld/tutorial3.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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: 320; height: 480 + 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/quick/tutorials/samegame/samegame1/Block.qml b/examples/quick/tutorials/samegame/samegame1/Block.qml new file mode 100644 index 0000000000..65cff95dbe --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame1/Block.qml @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/samegame/samegame1/Button.qml b/examples/quick/tutorials/samegame/samegame1/Button.qml new file mode 100644 index 0000000000..6fdc6c707f --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame1/Button.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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) } + antialiasing: 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/quick/tutorials/samegame/samegame1/samegame.qml b/examples/quick/tutorials/samegame/samegame1/samegame.qml new file mode 100644 index 0000000000..ab3aca19a2 --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame1/samegame.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/samegame/samegame1/samegame1.qmlproject b/examples/quick/tutorials/samegame/samegame1/samegame1.qmlproject new file mode 100644 index 0000000000..42ffacf4f8 --- /dev/null +++ b/examples/quick/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/quick/tutorials/samegame/samegame2/Block.qml b/examples/quick/tutorials/samegame/samegame2/Block.qml new file mode 100644 index 0000000000..f4065565b6 --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame2/Block.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/samegame/samegame2/Button.qml b/examples/quick/tutorials/samegame/samegame2/Button.qml new file mode 100644 index 0000000000..db1b52e2cd --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame2/Button.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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) } + antialiasing: 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/quick/tutorials/samegame/samegame2/samegame.js b/examples/quick/tutorials/samegame/samegame2/samegame.js new file mode 100644 index 0000000000..c749dc17b1 --- /dev/null +++ b/examples/quick/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/quick/tutorials/samegame/samegame2/samegame.qml b/examples/quick/tutorials/samegame/samegame2/samegame.qml new file mode 100644 index 0000000000..85f5f39b0c --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame2/samegame.qml @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/samegame/samegame2/samegame2.qmlproject b/examples/quick/tutorials/samegame/samegame2/samegame2.qmlproject new file mode 100644 index 0000000000..42ffacf4f8 --- /dev/null +++ b/examples/quick/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/quick/tutorials/samegame/samegame3/Block.qml b/examples/quick/tutorials/samegame/samegame3/Block.qml new file mode 100644 index 0000000000..55fe7f876a --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame3/Block.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/samegame/samegame3/Button.qml b/examples/quick/tutorials/samegame/samegame3/Button.qml new file mode 100644 index 0000000000..db1b52e2cd --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame3/Button.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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) } + antialiasing: 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/quick/tutorials/samegame/samegame3/Dialog.qml b/examples/quick/tutorials/samegame/samegame3/Dialog.qml new file mode 100644 index 0000000000..f89ad16ba1 --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame3/Dialog.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/samegame/samegame3/samegame.js b/examples/quick/tutorials/samegame/samegame3/samegame.js new file mode 100644 index 0000000000..df5bdfb049 --- /dev/null +++ b/examples/quick/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/quick/tutorials/samegame/samegame3/samegame.qml b/examples/quick/tutorials/samegame/samegame3/samegame.qml new file mode 100644 index 0000000000..26d0212250 --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame3/samegame.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/samegame/samegame3/samegame3.qmlproject b/examples/quick/tutorials/samegame/samegame3/samegame3.qmlproject new file mode 100644 index 0000000000..42ffacf4f8 --- /dev/null +++ b/examples/quick/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/quick/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/quick/tutorials/samegame/samegame4/content/BoomBlock.qml new file mode 100644 index 0000000000..335f4aecf6 --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame4/content/BoomBlock.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/samegame/samegame4/content/Button.qml b/examples/quick/tutorials/samegame/samegame4/content/Button.qml new file mode 100644 index 0000000000..db1b52e2cd --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame4/content/Button.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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) } + antialiasing: 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/quick/tutorials/samegame/samegame4/content/Dialog.qml b/examples/quick/tutorials/samegame/samegame4/content/Dialog.qml new file mode 100644 index 0000000000..ca4d573543 --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame4/content/Dialog.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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) + Qt.inputMethod.show(); + else + hide(); + } + } + +//![3] +} +//![3] diff --git a/examples/quick/tutorials/samegame/samegame4/content/samegame.js b/examples/quick/tutorials/samegame/samegame4/content/samegame.js new file mode 100755 index 0000000000..ad4d39d7b1 --- /dev/null +++ b/examples/quick/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.LocalStorage.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/quick/tutorials/samegame/samegame4/highscores/README b/examples/quick/tutorials/samegame/samegame4/highscores/README new file mode 100644 index 0000000000..eaa00fae37 --- /dev/null +++ b/examples/quick/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/quick/tutorials/samegame/samegame4/highscores/score_data.xml b/examples/quick/tutorials/samegame/samegame4/highscores/score_data.xml new file mode 100755 index 0000000000..c3fd90d9cf --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame4/highscores/score_data.xml @@ -0,0 +1,2 @@ +1000000Alan the Tester0x00 +6213Alan12x1751 diff --git a/examples/quick/tutorials/samegame/samegame4/highscores/score_style.xsl b/examples/quick/tutorials/samegame/samegame4/highscores/score_style.xsl new file mode 100755 index 0000000000..670354c965 --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame4/highscores/score_style.xsl @@ -0,0 +1,28 @@ + + + + + SameGame High Scores + +

SameGame High Scores

+ + + + + + + + + + + + + + + + +
NameScoreGrid SizeTime, s
+ + +
+
diff --git a/examples/quick/tutorials/samegame/samegame4/highscores/scores.php b/examples/quick/tutorials/samegame/samegame4/highscores/scores.php new file mode 100755 index 0000000000..daf480e21b --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame4/highscores/scores.php @@ -0,0 +1,31 @@ +"; + echo "SameGame High Scores"; + 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, "". $score . "" + . $name . "" . $grid . "" + . $time . "\n"); + echo "Your score has been recorded. Thanks for playing!"; + if($ret == False) + echo "
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, '' . "\n" + . '' . "\n" + . "\n" . file_get_contents("score_data.xml") . "\n"); + if($ret == False) + echo "There was an internal error. Sorry."; + else + echo ''; + } + echo ""; +?> diff --git a/examples/quick/tutorials/samegame/samegame4/samegame.qml b/examples/quick/tutorials/samegame/samegame4/samegame.qml new file mode 100644 index 0000000000..e6edcc35b8 --- /dev/null +++ b/examples/quick/tutorials/samegame/samegame4/samegame.qml @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/tutorials/samegame/samegame4/samegame4.qmlproject b/examples/quick/tutorials/samegame/samegame4/samegame4.qmlproject new file mode 100644 index 0000000000..42ffacf4f8 --- /dev/null +++ b/examples/quick/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/quick/tutorials/samegame/shared/pics/background.jpg b/examples/quick/tutorials/samegame/shared/pics/background.jpg new file mode 100644 index 0000000000..903d395c8d Binary files /dev/null and b/examples/quick/tutorials/samegame/shared/pics/background.jpg differ diff --git a/examples/quick/tutorials/samegame/shared/pics/blueStar.png b/examples/quick/tutorials/samegame/shared/pics/blueStar.png new file mode 100644 index 0000000000..ff9588f80a Binary files /dev/null and b/examples/quick/tutorials/samegame/shared/pics/blueStar.png differ diff --git a/examples/quick/tutorials/samegame/shared/pics/blueStone.png b/examples/quick/tutorials/samegame/shared/pics/blueStone.png new file mode 100644 index 0000000000..20e43c75b6 Binary files /dev/null and b/examples/quick/tutorials/samegame/shared/pics/blueStone.png differ diff --git a/examples/quick/tutorials/samegame/shared/pics/greenStar.png b/examples/quick/tutorials/samegame/shared/pics/greenStar.png new file mode 100644 index 0000000000..cd06854719 Binary files /dev/null and b/examples/quick/tutorials/samegame/shared/pics/greenStar.png differ diff --git a/examples/quick/tutorials/samegame/shared/pics/greenStone.png b/examples/quick/tutorials/samegame/shared/pics/greenStone.png new file mode 100644 index 0000000000..b568a1900c Binary files /dev/null and b/examples/quick/tutorials/samegame/shared/pics/greenStone.png differ diff --git a/examples/quick/tutorials/samegame/shared/pics/redStar.png b/examples/quick/tutorials/samegame/shared/pics/redStar.png new file mode 100644 index 0000000000..0a4dffe583 Binary files /dev/null and b/examples/quick/tutorials/samegame/shared/pics/redStar.png differ diff --git a/examples/quick/tutorials/samegame/shared/pics/redStone.png b/examples/quick/tutorials/samegame/shared/pics/redStone.png new file mode 100644 index 0000000000..36b09a2686 Binary files /dev/null and b/examples/quick/tutorials/samegame/shared/pics/redStone.png differ diff --git a/examples/quick/tutorials/samegame/shared/pics/star.png b/examples/quick/tutorials/samegame/shared/pics/star.png new file mode 100644 index 0000000000..defbde53ca Binary files /dev/null and b/examples/quick/tutorials/samegame/shared/pics/star.png differ diff --git a/examples/quick/tutorials/samegame/shared/pics/yellowStone.png b/examples/quick/tutorials/samegame/shared/pics/yellowStone.png new file mode 100644 index 0000000000..b1ce76212c Binary files /dev/null and b/examples/quick/tutorials/samegame/shared/pics/yellowStone.png differ diff --git a/examples/quick/tutorials/tutorials.pro b/examples/quick/tutorials/tutorials.pro new file mode 100644 index 0000000000..fd6117b2d0 --- /dev/null +++ b/examples/quick/tutorials/tutorials.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs +SUBDIRS += gettingStartedQml + +EXAMPLE_FILES = \ + dynamicview \ + extending \ + helloworld \ + samegame diff --git a/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc b/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc index c694e9ad63..4e302e7256 100644 --- a/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc +++ b/examples/quick/ui-components/slideswitch/doc/src/example-slideswitch.qdoc @@ -34,7 +34,7 @@ This example shows how to create a reusable switch component in QML. -The code for this example can be found in the \c examples/tutorials/ui-components/slideswitch directory. +The code for this example can be found in the \c examples/quick/tutorials/ui-components/slideswitch directory. The elements that compose the switch are: diff --git a/examples/quick/window/screen/screenInfo.qml b/examples/quick/window/screen/screenInfo.qml new file mode 100644 index 0000000000..adf92ee028 --- /dev/null +++ b/examples/quick/window/screen/screenInfo.qml @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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/quick/window/window.pro b/examples/quick/window/window.pro new file mode 100644 index 0000000000..93e43fcd65 --- /dev/null +++ b/examples/quick/window/window.pro @@ -0,0 +1,6 @@ +TEMPLATE = subdirs +SUBDIRS += \ + window + +EXAMPLE_FILES = \ + screen diff --git a/examples/quick/window/window/Window.qml b/examples/quick/window/window/Window.qml new file mode 100644 index 0000000000..b7fbf7206c --- /dev/null +++ b/examples/quick/window/window/Window.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +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/quick/window/window/nogui.qml b/examples/quick/window/window/nogui.qml new file mode 100644 index 0000000000..bed055679d --- /dev/null +++ b/examples/quick/window/window/nogui.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 QtQml 2.0 + +/* + This object's only functionality is to exist as a root object and + display nothing, proving that qmlscene can run without windows. + (A QtObject can't even have Component.onCompleted) +*/ +QtObject { + property string philosophy: "hello bleak windowless world" +} diff --git a/examples/quick/window/window/standalone.qml b/examples/quick/window/window/standalone.qml new file mode 100644 index 0000000000..a7a7ed2d7a --- /dev/null +++ b/examples/quick/window/window/standalone.qml @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +Item { + width: 320 + height: 240 + // It's not possible to set an Item's windowTitle. If you want to modify + // window properties, you need to explicitly create a Window. + Text { + id: text1 + anchors.centerIn: parent + text: "First Window\n" + (Qt.application.supportsMultipleWindows ? + "click the button to open a second window" : "only one window is allowed") + } + Rectangle { + border.color: "black" + radius: 4 + anchors.top: text1.bottom + anchors.horizontalCenter: text1.horizontalCenter + width: 100 + height: 30 + TextInput { + id: ti1 + focus: true // but the modal popup will prevent input while it is open + anchors.centerIn: parent + } + } + Rectangle { + border.color: "black" + color: childWindow.visible ? "goldenrod" : "beige" + radius: height / 4 + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.margins: 10 + width: text.implicitWidth + 20 + height: text.implicitHeight + 20 + visible: Qt.application.supportsMultipleWindows + Text { + id: text + text: "Pop up window" + anchors.centerIn: parent + } + MouseArea { + anchors.fill: parent + onClicked: childWindow.visible = !childWindow.visible + } + } + + Window { + id: childWindow + width: 320 + height: 240 + x: 220 + y: 120 + color: "beige" + title: "Second Window" + modality: Qt.ApplicationModal + flags: Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint + Text { + id: text2 + anchors.centerIn: parent + text: "Modal Frameless Stay-on-Top Window" + } + Text { + anchors.top: parent.top + anchors.right: parent.right + anchors.margins: 10 + text: "X" + MouseArea{ + anchors.fill: parent + onClicked: childWindow.visible = false + } + } + Rectangle { + border.color: "black" + radius: 4 + anchors.top: text2.bottom + anchors.horizontalCenter: text2.horizontalCenter + width: 100 + height: 30 + TextInput { + id: ti2 + focus: true + anchors.centerIn: parent + } + } + } +} diff --git a/examples/quick/window/window/twowindows.qml b/examples/quick/window/window/twowindows.qml new file mode 100644 index 0000000000..345598cf12 --- /dev/null +++ b/examples/quick/window/window/twowindows.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 + +QtObject { + property var win1: Window { + width: 320 + height: 240 + x: 0 + y: 0 + visible: true + color: "#ccffff" + title: "First Window" + Text { + anchors.centerIn: parent + text: "First Window" + Text { + id: statusText + anchors.top: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + } + } + MouseArea { + anchors.fill: parent + onClicked: win2.visible = !win2.visible + } + } + property var win2: Window { + width: 320 + height: 240 + x: 220 + y: 120 + visible: true + color: "green" + title: "Second Window: " + color + Rectangle { + anchors.fill: parent + anchors.margins: 10 + Text { + anchors.centerIn: parent + text: "Second Window" + } + MouseArea { + anchors.fill: parent + onClicked: win2.color = "#ffffcc" + } + } + onVisibleChanged: statusText.text = "second window is " + (visible ? "visible" : "invisible") + } +} diff --git a/examples/quick/window/window/window.cpp b/examples/quick/window/window/window.cpp new file mode 100644 index 0000000000..c9e6e90997 --- /dev/null +++ b/examples/quick/window/window/window.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR 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 +#include +#include +#include +#include + +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/quick/window/window/window.pro b/examples/quick/window/window/window.pro new file mode 100644 index 0000000000..e8a022361f --- /dev/null +++ b/examples/quick/window/window/window.pro @@ -0,0 +1,11 @@ +TEMPLATE = app +CONFIG += qt +QT += qml + +SOURCES += window.cpp + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/window/window +qml.files = Window.qml nogui.qml standalone.qml twowindows.qml +qml.path = $$[QT_INSTALL_EXAMPLES]/quick/window/window + +INSTALLS = target qml diff --git a/examples/shared/Button.qml b/examples/shared/Button.qml deleted file mode 100644 index 9b2b5f39f4..0000000000 --- a/examples/shared/Button.qml +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: "" - 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 deleted file mode 100644 index 134fed1d8d..0000000000 --- a/examples/shared/LauncherList.qml +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 { - //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; - } - - ListView { - clip: true - delegate: SimpleLauncherDelegate{exampleItem: ei} - model: ListModel {id:myModel} - anchors.fill: parent - } - - 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{ - focus: true - 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 deleted file mode 100644 index bf16f238c7..0000000000 --- a/examples/shared/README +++ /dev/null @@ -1,11 +0,0 @@ -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 deleted file mode 100644 index 6d647ac94f..0000000000 --- a/examples/shared/SimpleLauncherDelegate.qml +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 506ac42fcf..0000000000 Binary files a/examples/shared/images/back.png and /dev/null differ diff --git a/examples/shared/qmldir b/examples/shared/qmldir deleted file mode 100644 index 2f1e56aefb..0000000000 --- a/examples/shared/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 7fd2f08a40..0000000000 --- a/examples/shared/shared.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 -#include -#include -#include -#define DECLARATIVE_EXAMPLE_MAIN(NAME) int main(int argc, char* argv[]) \ -{\ - QGuiApplication app(argc,argv);\ - QQuickView view;\ - QDir directory(QCoreApplication::applicationDirPath());\ - if (QGuiApplication::platformName() == QLatin1String("windows")) {\ - if (directory.absolutePath().endsWith("/debug", Qt::CaseInsensitive)\ - || directory.absolutePath().endsWith("/release", Qt::CaseInsensitive))\ - if (!directory.cdUp()) {\ - qWarning("Could not change to parent directory of '%s'",\ - qPrintable(QDir::toNativeSeparators(directory.absolutePath())));\ - return -1;\ - }\ - } else if (QGuiApplication::platformName() == QLatin1String("cocoa")) {\ - if (directory.absolutePath().endsWith(#NAME".app/Contents/MacOS"))\ - for (int i = 0; i < 3; ++i) {\ - if (!directory.cdUp()) {\ - qWarning("Could not change to parent directory of '%s'",\ - qPrintable(QDir::toNativeSeparators(directory.absolutePath())));\ - return -1;\ - }\ - }\ - }\ - const QString fileName(directory.absolutePath() + "/" #NAME ".qml");\ - if (!QFile::exists(fileName)) {\ - qWarning("Could not find file '%s'", qPrintable(QDir::toNativeSeparators(fileName)));\ - return -1;\ - }\ - view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\ - view.setSource(QUrl::fromLocalFile(fileName)); \ - if (QGuiApplication::platformName() == QLatin1String("qnx") || \ - QGuiApplication::platformName() == QLatin1String("eglfs")) {\ - view.setResizeMode(QQuickView::SizeRootObjectToView);\ - view.showFullScreen();\ - } else {\ - view.show();\ - }\ - return app.exec();\ -} diff --git a/examples/shared/shared.pro b/examples/shared/shared.pro deleted file mode 100644 index 3bc9bfebbe..0000000000 --- a/examples/shared/shared.pro +++ /dev/null @@ -1,9 +0,0 @@ -#just install the files, all QML for now -TEMPLATE = aux - -qml.files = images \ - LauncherList.qml \ - SimpleLauncherDelegate.qml \ - Button.qml -qml.path = $$[QT_INSTALL_EXAMPLES]/qtquick/shared -INSTALLS = qml diff --git a/examples/tutorials/dynamicview/dynamicview1/PetsModel.qml b/examples/tutorials/dynamicview/dynamicview1/PetsModel.qml deleted file mode 100644 index d0f52e16f2..0000000000 --- a/examples/tutorials/dynamicview/dynamicview1/PetsModel.qml +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index a3d4af5533..0000000000 --- a/examples/tutorials/dynamicview/dynamicview1/dynamicview.qml +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 22c7487fe1..0000000000 --- a/examples/tutorials/dynamicview/dynamicview2/PetsModel.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 942505265c..0000000000 --- a/examples/tutorials/dynamicview/dynamicview2/dynamicview.qml +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 22c7487fe1..0000000000 --- a/examples/tutorials/dynamicview/dynamicview3/PetsModel.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 5c3da9499c..0000000000 --- a/examples/tutorials/dynamicview/dynamicview3/dynamicview.qml +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index cfc8af216c..0000000000 --- a/examples/tutorials/dynamicview/dynamicview4/ListSelector.qml +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 22c7487fe1..0000000000 --- a/examples/tutorials/dynamicview/dynamicview4/PetsModel.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 83f61a6e2f..0000000000 --- a/examples/tutorials/dynamicview/dynamicview4/dynamicview.qml +++ /dev/null @@ -1,219 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index b5aabc9367..0000000000 --- a/examples/tutorials/extending/chapter1-basics/app.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 8ed66f8b66..0000000000 --- a/examples/tutorials/extending/chapter1-basics/chapter1-basics.pro +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 89c681185b..0000000000 --- a/examples/tutorials/extending/chapter1-basics/main.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - qmlRegisterType("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 deleted file mode 100644 index eabc0a3ffc..0000000000 --- a/examples/tutorials/extending/chapter1-basics/piechart.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -//![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 deleted file mode 100644 index c86554942f..0000000000 --- a/examples/tutorials/extending/chapter1-basics/piechart.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 -#include - -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 deleted file mode 100644 index dee65676ab..0000000000 --- a/examples/tutorials/extending/chapter2-methods/app.qml +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 8ed66f8b66..0000000000 --- a/examples/tutorials/extending/chapter2-methods/chapter2-methods.pro +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 89c681185b..0000000000 --- a/examples/tutorials/extending/chapter2-methods/main.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - qmlRegisterType("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 deleted file mode 100644 index 27b39d0df2..0000000000 --- a/examples/tutorials/extending/chapter2-methods/piechart.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -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 deleted file mode 100644 index 2655299f1a..0000000000 --- a/examples/tutorials/extending/chapter2-methods/piechart.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 -#include - -//![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 deleted file mode 100644 index 1267697ee7..0000000000 --- a/examples/tutorials/extending/chapter3-bindings/app.qml +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 8ed66f8b66..0000000000 --- a/examples/tutorials/extending/chapter3-bindings/chapter3-bindings.pro +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 89c681185b..0000000000 --- a/examples/tutorials/extending/chapter3-bindings/main.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - qmlRegisterType("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 deleted file mode 100644 index ca7f0d701f..0000000000 --- a/examples/tutorials/extending/chapter3-bindings/piechart.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -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 deleted file mode 100644 index 216a6012e9..0000000000 --- a/examples/tutorials/extending/chapter3-bindings/piechart.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 -#include - -//![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 deleted file mode 100644 index b96cb554ac..0000000000 --- a/examples/tutorials/extending/chapter4-customPropertyTypes/app.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 23eb222ea3..0000000000 --- a/examples/tutorials/extending/chapter4-customPropertyTypes/chapter4-customPropertyTypes.pro +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index 367a252bf9..0000000000 --- a/examples/tutorials/extending/chapter4-customPropertyTypes/main.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 -#include - -//![0] -int main(int argc, char *argv[]) -{ -//![0] - QGuiApplication app(argc, argv); - - qmlRegisterType("Charts", 1, 0, "PieChart"); - -//![1] - qmlRegisterType("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 deleted file mode 100644 index 9c907593f7..0000000000 --- a/examples/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 0259720091..0000000000 --- a/examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -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 deleted file mode 100644 index b104e31c65..0000000000 --- a/examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -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 deleted file mode 100644 index 5dbe3e53cf..0000000000 --- a/examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 -#include - -//![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 deleted file mode 100644 index 4acd456131..0000000000 --- a/examples/tutorials/extending/chapter5-listproperties/app.qml +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 23eb222ea3..0000000000 --- a/examples/tutorials/extending/chapter5-listproperties/chapter5-listproperties.pro +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index 7af7dc8037..0000000000 --- a/examples/tutorials/extending/chapter5-listproperties/main.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - qmlRegisterType("Charts", 1, 0, "PieChart"); - qmlRegisterType("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 deleted file mode 100644 index 91e056a0cb..0000000000 --- a/examples/tutorials/extending/chapter5-listproperties/piechart.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 PieChart::slices() -{ - return QQmlListProperty(this, 0, &PieChart::append_slice); -} - -void PieChart::append_slice(QQmlListProperty *list, PieSlice *slice) -{ - PieChart *chart = qobject_cast(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 deleted file mode 100644 index 1234d07e6a..0000000000 --- a/examples/tutorials/extending/chapter5-listproperties/piechart.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -class PieSlice; - -//![0] -class PieChart : public QQuickItem -{ - Q_OBJECT - Q_PROPERTY(QQmlListProperty 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 slices(); - -private: - static void append_slice(QQmlListProperty *list, PieSlice *slice); - - QString m_name; - QList m_slices; -}; -//![2] - -#endif - diff --git a/examples/tutorials/extending/chapter5-listproperties/pieslice.cpp b/examples/tutorials/extending/chapter5-listproperties/pieslice.cpp deleted file mode 100644 index d2a927c01a..0000000000 --- a/examples/tutorials/extending/chapter5-listproperties/pieslice.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -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 deleted file mode 100644 index e1fc76d445..0000000000 --- a/examples/tutorials/extending/chapter5-listproperties/pieslice.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 -#include - -//![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/Charts/qmldir b/examples/tutorials/extending/chapter6-plugins/Charts/qmldir deleted file mode 100644 index d9e8471b3c..0000000000 --- a/examples/tutorials/extending/chapter6-plugins/Charts/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -module Charts -plugin chartsplugin diff --git a/examples/tutorials/extending/chapter6-plugins/app.qml b/examples/tutorials/extending/chapter6-plugins/app.qml deleted file mode 100644 index 19c39c9d2b..0000000000 --- a/examples/tutorials/extending/chapter6-plugins/app.qml +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 Charts 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 deleted file mode 100644 index c84b6fe7ff..0000000000 --- a/examples/tutorials/extending/chapter6-plugins/chapter6-plugins.pro +++ /dev/null @@ -1,18 +0,0 @@ -TEMPLATE = lib -CONFIG += qt plugin -QT += qml quick - -DESTDIR = Charts -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 deleted file mode 100644 index df079f767c..0000000000 --- a/examples/tutorials/extending/chapter6-plugins/chartsplugin.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -void ChartsPlugin::registerTypes(const char *uri) -{ - qmlRegisterType(uri, 1, 0, "PieChart"); - qmlRegisterType(uri, 1, 0, "PieSlice"); -} - -//![0] - diff --git a/examples/tutorials/extending/chapter6-plugins/chartsplugin.h b/examples/tutorials/extending/chapter6-plugins/chartsplugin.h deleted file mode 100644 index 09a120666b..0000000000 --- a/examples/tutorials/extending/chapter6-plugins/chartsplugin.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -class ChartsPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - void registerTypes(const char *uri); -}; -//![0] - -#endif - diff --git a/examples/tutorials/extending/chapter6-plugins/piechart.cpp b/examples/tutorials/extending/chapter6-plugins/piechart.cpp deleted file mode 100644 index 5110153acc..0000000000 --- a/examples/tutorials/extending/chapter6-plugins/piechart.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 PieChart::slices() -{ - return QQmlListProperty(this, 0, &PieChart::append_slice); -} - -void PieChart::append_slice(QQmlListProperty *list, PieSlice *slice) -{ - PieChart *chart = qobject_cast(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 deleted file mode 100644 index e292cdbc7a..0000000000 --- a/examples/tutorials/extending/chapter6-plugins/piechart.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -class PieSlice; - -class PieChart : public QQuickItem -{ - Q_OBJECT - Q_PROPERTY(QQmlListProperty 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 slices(); - -private: - static void append_slice(QQmlListProperty *list, PieSlice *slice); - - QString m_name; - QList m_slices; -}; - -#endif - diff --git a/examples/tutorials/extending/chapter6-plugins/pieslice.cpp b/examples/tutorials/extending/chapter6-plugins/pieslice.cpp deleted file mode 100644 index d2a927c01a..0000000000 --- a/examples/tutorials/extending/chapter6-plugins/pieslice.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -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 deleted file mode 100644 index 2ea15302fb..0000000000 --- a/examples/tutorials/extending/chapter6-plugins/pieslice.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 -#include - -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 deleted file mode 100644 index 967473fda0..0000000000 --- a/examples/tutorials/extending/extending.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - chapter1-basics \ - chapter2-methods \ - chapter3-bindings \ - chapter4-customPropertyTypes \ - chapter5-listproperties \ - chapter6-plugins - diff --git a/examples/tutorials/gettingStartedQml/core/Button.qml b/examples/tutorials/gettingStartedQml/core/Button.qml deleted file mode 100644 index a5afcc0297..0000000000 --- a/examples/tutorials/gettingStartedQml/core/Button.qml +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 { - //identifier of the item - id: button - - //these properties act as constants, useable outside this QML file - property int buttonHeight: 75 - property int buttonWidth: 150 - - //attaches to the Text element's text content - property string label - property color textColor: buttonLabel.color - - //the color highlight when the mouse hovers on the rectangle - property color onHoverColor: "lightsteelblue" - property color borderColor: "transparent" - - //buttonColor is set to the button's main color - property color buttonColor: "lightblue" - - property real labelSize: 14 - - //set appearance properties - radius: 6 - antialiasing: true - border { width: 2; color: borderColor } - width: buttonWidth; height: buttonHeight - - Text { - id: buttonLabel - anchors.centerIn: parent - text: label //bind the text to the parent's text - color: "#DCDCCC" - font.pointSize: labelSize - } - - //buttonClick() is callable and a signal handler, onButtonClick is automatically created - signal buttonClick() - - //define the clickable area to be the whole rectangle - MouseArea { - id: buttonMouseArea - anchors.fill: parent //stretch the area to the parent's dimension - onClicked: buttonClick() - - //if true, then onEntered and onExited called if mouse hovers in the mouse area - //if false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - //display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = onHoverColor - //remove the border if the mouse exits the button mouse area - onExited: parent.border.color = borderColor - } - - //change the color of the button when pressed - color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor - //animate the color whenever the color property changes - Behavior on color { ColorAnimation{ duration: 55 } } - - //scale the button when pressed - scale: buttonMouseArea.pressed ? 1.1 : 1.00 - //Animate the scale property change - Behavior on scale { NumberAnimation{ duration: 55 } } - -} diff --git a/examples/tutorials/gettingStartedQml/core/EditMenu.qml b/examples/tutorials/gettingStartedQml/core/EditMenu.qml deleted file mode 100644 index 2665442685..0000000000 --- a/examples/tutorials/gettingStartedQml/core/EditMenu.qml +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: editMenu - height: 480; width:1000 - color: "powderblue" - property color buttonBorderColor: "#7A8182" - property color buttonFillColor: "#61BDCACD" - property string menuName:"Edit" - gradient: Gradient { - GradientStop { position: 0.0; color: "#6A7570" } - GradientStop { position: 1.0; color: Qt.darker("#6A7570") } - } - - Rectangle { - id:actionContainer - color:"transparent" - anchors.centerIn: parent - width: parent.width; height: parent.height / 5 - Row { - anchors.centerIn: parent - spacing: parent.width/9 - Button { - id: loadButton - buttonColor: buttonFillColor - label: "Copy" - labelSize: 16 - borderColor: buttonBorderColor - height: actionContainer.height; width: actionContainer.width/6 - onButtonClick: textArea.copy() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - Button { - id: saveButton - height: actionContainer.height; width: actionContainer.width/6 - buttonColor: buttonFillColor - label: "Paste" - borderColor: buttonBorderColor - labelSize: 16 - onButtonClick: textArea.paste() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - Button { - id: exitButton - label: "Select All" - height: actionContainer.height; width: actionContainer.width/6 - labelSize: 16 - buttonColor: buttonFillColor - borderColor:buttonBorderColor - onButtonClick: textArea.selectAll() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - } - } -} diff --git a/examples/tutorials/gettingStartedQml/core/FileDialog.qml b/examples/tutorials/gettingStartedQml/core/FileDialog.qml deleted file mode 100644 index 24501efd89..0000000000 --- a/examples/tutorials/gettingStartedQml/core/FileDialog.qml +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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:dialog - height: 200 * partition; width: 200 - color: "transparent" - - signal selectChanged() - signal notifyRefresh() - onNotifyRefresh:dirView.model = directory.files - - property string selectedFile - property int selectedIndex: 0 - - Rectangle { - id: dirBox - radius: 10 - antialiasing: true - anchors.centerIn:parent - height: parent.height -15; width: parent.width -30 - - Rectangle { - id:header - height: parent.height*0.1; width: parent.width - radius:3 - antialiasing: true - z:1 - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.98;color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#0e1B20" } - } - Text { - height: header.height; anchors.centerIn: header - text: "files:" - color: "lightblue" - font.weight: Font.Light - font.italic: true - } - } - GridView { - id:dirView - width:parent.width; height:parent.height*.9 - anchors.top: header.bottom - cellWidth: 100; cellHeight: 75 - model: directory.files - delegate: dirDelegate - clip: true - highlightMoveDuration: 40 - } - Component { - id: dirDelegate - Rectangle { - id:file - color: "transparent" - width: GridView.view.cellWidth; height: GridView.view.cellHeight - - Text { - id:fileName - width: parent.width - anchors.centerIn: parent - text: name - color: "#BDCACD" - font.weight: GridView.view.currentIndex == index ? Font.DemiBold : Font.Normal - font.pointSize: GridView.view.currentIndex == index ? 12 : 10 - elide: Text.ElideMiddle - horizontalAlignment: Text.AlignHCenter - } - Rectangle { - id: selection - width: parent.width; height: parent.height - anchors.centerIn: parent - radius: 10 - antialiasing: true - scale: GridView.view.currentIndex == index ? 1 : 0.5 - opacity: GridView.view.currentIndex == index ? 1 : 0 - Text { - id: overlay - width: parent.width - anchors.centerIn: parent - text: name - color: "#696167" - font.weight: Font.DemiBold - font.pointSize: 12 - elide: Text.ElideMiddle - horizontalAlignment: Text.AlignHCenter - } - Behavior on opacity { NumberAnimation{ duration: 45 } } - Behavior on scale { NumberAnimation{ duration: 45 } } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter("lightsteelblue",1.25) } - GradientStop { position: 0.67; color: Qt.darker("lightsteelblue",1.3) } - } - border.color: "lightsteelblue" - border.width: 1 - } - MouseArea { - id:fileMouseArea - anchors.fill:parent - hoverEnabled: true - - onClicked: { - GridView.view.currentIndex = index - selectedFile = directory.files[index].name - selectChanged() - } - onEntered: { - fileName.color = "lightsteelblue" - fileName.font.weight = Font.DemiBold - } - onExited: { - fileName.font.weight = Font.Normal - fileName.color = "#BDCACD" - } - } - } - } - gradient: Gradient { - GradientStop { position: 0.0; color: "#A5333333" } - GradientStop { position: 1.0; color: "#03333333" } - } - } -} diff --git a/examples/tutorials/gettingStartedQml/core/FileMenu.qml b/examples/tutorials/gettingStartedQml/core/FileMenu.qml deleted file mode 100644 index 37afca62b9..0000000000 --- a/examples/tutorials/gettingStartedQml/core/FileMenu.qml +++ /dev/null @@ -1,233 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "../filedialog" 1.0 - -Rectangle { - id: fileMenu - height: 480; width:1000 - property color buttonBorderColor: "#7F8487" - property color buttonFillColor: "#8FBDCACD" - property string fileContent:directory.fileContent - - //the menuName is accessible from outside this QML file - property string menuName: "File" - - //used to divide the screen into parts. - property real partition: 1/3 - - color: "#6C646A" - gradient: Gradient { - GradientStop { position: 0.0; color: "#6C646A" } - GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } - } - - Directory { - id:directory - filename: textInput.text - onDirectoryChanged:fileDialog.notifyRefresh() - } - - Rectangle { - id:actionContainer - - //make this rectangle invisible - color:"transparent" - anchors.left: parent.left - - //the height is a good proportion that creates more space at the top of - //the column of buttons - width: fileMenu.width * partition; height: fileMenu.height - - Column { - anchors.centerIn: parent - spacing: parent.height/32 - Button { - id: saveButton - label: "Save" - borderColor: buttonBorderColor - buttonColor: buttonFillColor - width: actionContainer.width/ 1.3 - height:actionContainer.height / 8 - labelSize:24 - onButtonClick: { - directory.fileContent = textArea.textContent - directory.filename = textInput.text - directory.saveFile() - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - Button { - id: loadButton - width: actionContainer.width/ 1.3 - height:actionContainer.height/ 8 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - label: "Load" - labelSize:24 - onButtonClick:{ - directory.filename = textInput.text - directory.loadFile() - textArea.textContent = directory.fileContent - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - Button { - id: newButton - width: actionContainer.width/ 1.3 - height: actionContainer.height/ 8 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - label: "New" - labelSize: 24 - onButtonClick:{ - textArea.textContent = "" - textInput.text = "" - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - - } - Rectangle { - id: space - width: actionContainer.width/ 1.3 - height: actionContainer.height / 16 - color: "transparent" - } - Button { - id: exitButton - width: actionContainer.width/ 1.3 - height: actionContainer.height/ 8 - label: "Exit" - labelSize: 24 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - onButtonClick: Qt.quit() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - } - } - Rectangle { - id:dialogContainer - - width: 2*fileMenu.width * partition; height: fileMenu.height - anchors.right:parent.right - color: "transparent" - - Column { - anchors.centerIn: parent - spacing: parent.height /640 - FileDialog { - id:fileDialog - height: 2*dialogContainer.height * partition - width: dialogContainer.width - onSelectChanged: textInput.text = selectedFile - } - - Rectangle { - id:lowerPartition - height: dialogContainer.height * partition; width: dialogContainer.width - color: "transparent" - - Rectangle { - id: nameField - gradient: Gradient { - GradientStop { position: 0.0; color: "#806F6F6F" } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - radius: 10 - anchors { centerIn:parent; leftMargin: 15; rightMargin: 15; topMargin: 15 } - height: parent.height-15 - width: parent.width -20 - border { color: "#4A4A4A"; width:1 } - - TextInput { - id: textInput - z:2 - anchors { bottom: parent.bottom; topMargin: 10; horizontalCenter: parent.horizontalCenter } - width: parent.width - 10 - height: parent.height -10 - font.pointSize: 40 - color: "lightsteelblue" - focus: true - } - Text { - id: textInstruction - anchors.centerIn: parent - text: "Select file name and press save or load" - font {pointSize: 11; weight: Font.Light; italic: true} - color: "lightblue" - z: 2 - opacity: (textInput.text == "") ? 1 : 0 - } - Text { - id:fieldLabel - anchors { top: parent.top; left: parent.left } - text: " file name: " - font { pointSize: 11; weight: Font.Light; italic: true } - color: "lightblue" - z:2 - } - MouseArea { - anchors.centerIn:parent - width: nameField.width; height: nameField.height - onClicked: { - textInput.text = "" - textInput.focus = true - textInput.forceFocus() - } - } - } - } - } - } -} diff --git a/examples/tutorials/gettingStartedQml/core/MenuBar.qml b/examples/tutorials/gettingStartedQml/core/MenuBar.qml deleted file mode 100644 index 045e00e6c0..0000000000 --- a/examples/tutorials/gettingStartedQml/core/MenuBar.qml +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: menuBar - width: 1000; height:300 - color:"transparent" - property color fileColor: "plum" - property color editColor: "powderblue" - - property real partition: 1/10 - - Column { - anchors.fill: parent - //container for the header and the buttons - z: 1 - Rectangle { - id: labelList - height:menuBar.height*partition - width: menuBar.width - color: "beige" - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.98;color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#0e1B20" } - } - Text { - height: parent.height - anchors { right: labelRow.left ; verticalCenter: parent.bottom } - text: "menu: " - color: "lightblue" - font { weight: Font.Light; italic: true } - } - //row displays its children in a vertical row - Row { - id: labelRow - anchors.centerIn: parent - spacing:40 - Button { - id: fileButton - height: 20; width: 50 - label: "File" - buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) - scale: menuListView.currentIndex == 0? 1.25: 1 - labelSize: menuListView.currentIndex == 0? 16:12 - radius: 1 - //on a button click, change the list's currently selected item to FileMenu - onButtonClick: menuListView.currentIndex = 0 - gradient: Gradient { - GradientStop { position: 0.0; color: fileColor } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - } - Button { - id: editButton - height: 20; width: 50 - buttonColor : menuListView.currentIndex == 1? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9) - scale: menuListView.currentIndex == 1? 1.25: 1 - label: "Edit" - radius: 1 - labelSize: menuListView.currentIndex == 1? 16:12 - //on a button click, change the list's currently selected item to EditMenu - onButtonClick: menuListView.currentIndex = 1 - gradient: Gradient { - GradientStop { position: 0.0; color: editColor } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - } - } - } - - //list view will display a model according to a delegate - ListView { - id: menuListView - width:menuBar.width; height: 9*menuBar.height*partition - - //the model contains the data - model: menuListModel - - //control the movement of the menu switching - snapMode: ListView.SnapOneItem - orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds - flickDeceleration: 5000 - highlightFollowsCurrentItem: true - highlightMoveDuration:240 - highlightRangeMode: ListView.StrictlyEnforceRange - } - } - //a list of visual items already have delegates handling their display - VisualItemModel { - id: menuListModel - - FileMenu { - id:fileMenu - width: menuListView.width; height: menuListView.height - color: fileColor - } - EditMenu { - color: editColor - width: menuListView.width; height: menuListView.height - } - } -} diff --git a/examples/tutorials/gettingStartedQml/core/TextArea.qml b/examples/tutorials/gettingStartedQml/core/TextArea.qml deleted file mode 100644 index 5165533f65..0000000000 --- a/examples/tutorials/gettingStartedQml/core/TextArea.qml +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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:textArea - - function paste() { textEdit.paste() } - function copy() { textEdit.copy() } - function selectAll() { textEdit.selectAll() } - - width :400; height:400 - - property color fontColor: "white" - property alias textContent: textEdit.text - Flickable { - id: flickArea - width: parent.width; height: parent.height - anchors.fill:parent - - boundsBehavior: Flickable.StopAtBounds - flickableDirection: Flickable.HorizontalFlick - interactive: true - //Will move the text Edit area to make the area visible when - //scrolled with keyboard strokes - 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: textEdit - anchors.fill:parent - width:parent.width; height:parent.height - color:fontColor - focus: true - wrapMode: TextEdit.Wrap - font.pointSize:10 - onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) - selectByMouse: true - } - } -} diff --git a/examples/tutorials/gettingStartedQml/core/qmldir b/examples/tutorials/gettingStartedQml/core/qmldir deleted file mode 100644 index da1f373433..0000000000 --- a/examples/tutorials/gettingStartedQml/core/qmldir +++ /dev/null @@ -1,7 +0,0 @@ -Button ./Button.qml -FileDialog ./FileDialog.qml -TextArea ./TextArea.qml -TextEditor ./TextEditor.qml -EditMenu ./EditMenu.qml -MenuBar ./MenuBar.qml -FileMenu ./FileMenu.qml diff --git a/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp b/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp deleted file mode 100644 index a77b93ae33..0000000000 --- a/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "dialogPlugin.h" -#include "directory.h" -#include "file.h" -#include - -void DialogPlugin::registerTypes(const char *uri) -{ - //register the class Directory into QML as a "Directory" element version 1.0 - qmlRegisterType(uri, 1, 0, "Directory"); - qmlRegisterType(uri,1,0,"File"); -} diff --git a/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.h b/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.h deleted file mode 100644 index 05e076839a..0000000000 --- a/examples/tutorials/gettingStartedQml/filedialog/dialogPlugin.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 DIALOGPLUGIN_H -#define DIALOGPLUGIN_H - -#include - -class DialogPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - // registerTypes is inherited from QQmlExtensionPlugin - void registerTypes(const char *uri); -}; - -#endif - diff --git a/examples/tutorials/gettingStartedQml/filedialog/directory.cpp b/examples/tutorials/gettingStartedQml/filedialog/directory.cpp deleted file mode 100644 index 38a47f0431..0000000000 --- a/examples/tutorials/gettingStartedQml/filedialog/directory.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "directory.h" -#include - -/* -Directory constructor - -Initialize the saves directory and creates the file list -*/ -Directory::Directory(QObject *parent) : QObject(parent) -{ - m_dir.cd(QDir::currentPath()); - - // go to the saved directory. if not found, create save directory - m_saveDir = "saves"; - if (m_dir.cd(m_saveDir) == 0) { - m_dir.mkdir(m_saveDir); - m_dir.cd(m_saveDir); - } - m_filterList << "*.txt"; - refresh(); -} - -/* -Directory::filesNumber -Return the number of Files -*/ -int Directory::filesCount() const -{ - return m_fileList.size(); -} - -/* -Function called to append data onto list property -*/ -void appendFiles(QQmlListProperty *property, File *file) -{ - Q_UNUSED(property); - Q_UNUSED(file); - //Do nothing. can't add to a directory using this method -} - -/* -Function called to retrieve file in the list using an index -*/ -File *fileAt(QQmlListProperty *property, int index) -{ - return static_cast< QList *>(property->data)->at(index); -} - -/* -Returns the number of files in the list -*/ -int filesSize(QQmlListProperty *property) -{ - return static_cast< QList *>(property->data)->size(); -} - -/* -Function called to empty the list property contents -*/ -void clearFilesPtr(QQmlListProperty *property) -{ - return static_cast< QList *>(property->data)->clear(); -} - -/* -Returns the list of files as a QQmlListProperty. -*/ -QQmlListProperty Directory::files() -{ - refresh(); - return QQmlListProperty(this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr); -} - -/* -Return the name of the currently selected file -*/ -QString Directory::filename() const -{ - return currentFile.name(); -} - -/* -Return the file's content as a string. -*/ -QString Directory::fileContent() const -{ - return m_fileContent; -} - -/* -Set the file name of the current file -*/ -void Directory::setFilename(const QString &str) -{ - if (str != currentFile.name()) { - currentFile.setName(str); - emit filenameChanged(); - } -} - -/* -Set the content of the file as a string -*/ -void Directory::setFileContent(const QString &str) -{ - if (str != m_fileContent) { - m_fileContent = str; - emit fileContentChanged(); - } -} - -/* -Called from QML to save the file using the filename and file content. -Saving makes sure that the file has a .txt extension. -*/ -void Directory::saveFile() -{ - if (currentFile.name().isEmpty()) { - qWarning()<< "Empty filename. no save"; - return; - } - QString extendedName = currentFile.name(); - if (!currentFile.name().endsWith(".txt")) { - extendedName.append(".txt"); - } - QFile file(m_dir.filePath(extendedName)); - if (file.open(QFile::WriteOnly | QFile::Truncate)) { - QTextStream outStream(&file); - outStream << m_fileContent; - } - file.close(); - refresh(); - emit directoryChanged(); -} - -/* -Load the contents of a file. -Only loads files with a .txt extension -*/ -void Directory::loadFile() -{ - m_fileContent.clear(); - QString extendedName = currentFile.name(); - if (!currentFile.name().endsWith(".txt")) { - extendedName.append(".txt"); - } - - QFile file(m_dir.filePath(extendedName)); - if (file.open(QFile::ReadOnly)) { - QTextStream inStream(&file); - m_fileContent = inStream.readAll(); - } - file.close(); -} - -/* -Reloads the content of the files list. This is to ensure that the newly -created files are added onto the list. -*/ -void Directory::refresh() -{ - m_dirFiles = m_dir.entryList(m_filterList,QDir::Files,QDir::Name); - m_fileList.clear(); - - File *file; - for (int i = 0; i < m_dirFiles.size(); ++i) { - file = new File(); - - if (m_dirFiles.at(i).endsWith(".txt")) { - QString name = m_dirFiles.at(i); - file->setName(name.remove(".txt",Qt::CaseSensitive)); - } else { - file->setName(m_dirFiles.at(i)); - } - m_fileList.append(file); - } -} diff --git a/examples/tutorials/gettingStartedQml/filedialog/directory.h b/examples/tutorials/gettingStartedQml/filedialog/directory.h deleted file mode 100644 index 90c427c1c5..0000000000 --- a/examples/tutorials/gettingStartedQml/filedialog/directory.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 DIRECTORY_H -#define DIRECTORY_H - -#include "file.h" - -#include -#include -#include -#include -#include - -class Directory : public QObject -{ - Q_OBJECT - - // number of files in the directory - Q_PROPERTY(int filesCount READ filesCount) - - // list property containing file names as QString - Q_PROPERTY(QQmlListProperty files READ files CONSTANT) - - // file name of the text file to read/write - Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) - - // text content of the file - Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) - -public: - Directory(QObject *parent = 0); - - // properties' read functions - int filesCount() const; - QString filename() const; - QString fileContent() const; - QQmlListProperty files(); - - // properties' write functions - void setFilename(const QString &str); - void setFileContent(const QString &str); - - // accessible from QML - Q_INVOKABLE void saveFile(); - Q_INVOKABLE void loadFile(); - -signals: - void directoryChanged(); - void filenameChanged(); - void fileContentChanged(); - -private: - QDir m_dir; - QStringList m_dirFiles; - File currentFile; - QString m_saveDir; - QStringList m_filterList; - - //contains the file data in QString format - QString m_fileContent; - - //Registered to QML in a plugin. Accessible from QML as a property of Directory - QList m_fileList; - - //refresh content of the directory - void refresh(); -}; - -#endif diff --git a/examples/tutorials/gettingStartedQml/filedialog/file.cpp b/examples/tutorials/gettingStartedQml/filedialog/file.cpp deleted file mode 100644 index b53c569d56..0000000000 --- a/examples/tutorials/gettingStartedQml/filedialog/file.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "file.h" - -File::File(QObject *parent) : QObject(parent) -{ -} - -QString File::name() const -{ - return m_name; -} - -void File::setName(const QString &str) -{ - if (str != m_name) { - m_name = str; - emit nameChanged(); - } -} - diff --git a/examples/tutorials/gettingStartedQml/filedialog/file.h b/examples/tutorials/gettingStartedQml/filedialog/file.h deleted file mode 100644 index 7a0da05b70..0000000000 --- a/examples/tutorials/gettingStartedQml/filedialog/file.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 FILE_H -#define FILE_H - -#include -#include - -class File : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - -public: - File(QObject *parent = 0); - - QString name() const; - void setName(const QString &str); - -signals: - void nameChanged(); - -private: - QString m_name; -}; - -#endif diff --git a/examples/tutorials/gettingStartedQml/filedialog/filedialog.pro b/examples/tutorials/gettingStartedQml/filedialog/filedialog.pro deleted file mode 100644 index 36ae0fc7f4..0000000000 --- a/examples/tutorials/gettingStartedQml/filedialog/filedialog.pro +++ /dev/null @@ -1,22 +0,0 @@ -TEMPLATE = lib -CONFIG += qt plugin -QT += qml - -DESTDIR += ../plugins -OBJECTS_DIR = tmp -MOC_DIR = tmp - -TARGET = FileDialog - -HEADERS += directory.h \ - file.h \ - dialogPlugin.h - -SOURCES += directory.cpp \ - file.cpp \ - dialogPlugin.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/tutorials/gettingStartedQml/filedialog -sources.files = $$SOURCES $$HEADERS filedialog.pro -sources.path = $$target.path -INSTALLS = sources target diff --git a/examples/tutorials/gettingStartedQml/filedialog/qmldir b/examples/tutorials/gettingStartedQml/filedialog/qmldir deleted file mode 100644 index 4a8d13d026..0000000000 --- a/examples/tutorials/gettingStartedQml/filedialog/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin FileDialog ../plugins diff --git a/examples/tutorials/gettingStartedQml/gettingStartedQml.pro b/examples/tutorials/gettingStartedQml/gettingStartedQml.pro deleted file mode 100644 index 10ce079896..0000000000 --- a/examples/tutorials/gettingStartedQml/gettingStartedQml.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = \ - filedialog\ - -# install -sources.files = gettingStartedQml.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/tutorials/gettingStartedQml -INSTALLS += sources diff --git a/examples/tutorials/gettingStartedQml/images/arrow.png b/examples/tutorials/gettingStartedQml/images/arrow.png deleted file mode 100644 index 14978c2e56..0000000000 Binary files a/examples/tutorials/gettingStartedQml/images/arrow.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/parts/part0/Button.qml b/examples/tutorials/gettingStartedQml/parts/part0/Button.qml deleted file mode 100644 index f49ca9359f..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part0/Button.qml +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//! [document] -import QtQuick 2.0 - -Rectangle { - id: simplebutton - color: "grey" - width: 150; height: 75 - - Text{ - id: buttonLabel - anchors.centerIn: parent - text: "button label" - } -} -//! [document] diff --git a/examples/tutorials/gettingStartedQml/parts/part1/Button.qml b/examples/tutorials/gettingStartedQml/parts/part1/Button.qml deleted file mode 100644 index ab85963593..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part1/Button.qml +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 { - - //identifier of the item - id: button - - property string label: "button label" - - //these properties act as constants, useable outside this QML file - property int buttonHeight: 75 - property int buttonWidth: 150 - - //the color highlight when the mouse hovers on the rectangle - property color onHoverColor: "gold" - property color borderColor: "white" - - //buttonColor is set to the button's main color - property color buttonColor: "lightblue" - - //set appearance properties - radius: 10 - antialiasing: true - border{color: "white"; width: 3} - width: buttonWidth; height: buttonHeight - - Text{ - id: buttonLabel - anchors.centerIn: parent - text: label - } - - //buttonClick() is callable and a signal handler, onButtonClick is automatically created - signal buttonClick() - onButtonClick: { - console.log(buttonLabel.text + " clicked" ) - } - - //define the clickable area to be the whole rectangle - MouseArea{ - id: buttonMouseArea - anchors.fill: parent //stretch the area to the parent's dimension - onClicked: buttonClick() - - //if true, then onEntered and onExited called if mouse hovers in the mouse area - //if false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - //display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = onHoverColor - //remove the border if the mouse exits the button mouse area - onExited: parent.border.color = borderColor - } - - //change the color of the button when pressed - color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor -} diff --git a/examples/tutorials/gettingStartedQml/parts/part1/EditMenu.qml b/examples/tutorials/gettingStartedQml/parts/part1/EditMenu.qml deleted file mode 100644 index 1940aebac3..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part1/EditMenu.qml +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: editMenu - height: 480; width:1000 - color: "powderblue" - property string menuName:"Edit" - - Rectangle{ - id:actionContainer - color:"transparent" - anchors.centerIn: parent - - width: parent.width; height: parent.height / 5 - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Cut" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Paste" - } - Button{ - id: exitButton - label: "Select All" - buttonColor: "darkgrey" - } - } - } -} diff --git a/examples/tutorials/gettingStartedQml/parts/part1/FileMenu.qml b/examples/tutorials/gettingStartedQml/parts/part1/FileMenu.qml deleted file mode 100644 index abb7fba41b..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part1/FileMenu.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: fileMenu - - //the menuName is accessible from outside this QML file - property string menuName: "File" - - //generous amount of screen space that will allow the buttons to fit - height: 480; width:1000 - - color: "#6C646A" - - //a sub-rectangle allows the flexibility of setting the row area - Rectangle{ - id:actionContainer - - //make this rectangle invisible - color:"transparent" - anchors.centerIn: parent - - //the height is a good proportion that creates more space at the top of the row of buttons - width: parent.width; height: parent.height / 5 - - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Load" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Save" - } - Button{ - id: exitButton - label: "Exit" - buttonColor: "darkgrey" - - //exit the application if the exitButton is clicked - onButtonClick:{ - Qt.quit() - } - } - } - } -} diff --git a/examples/tutorials/gettingStartedQml/parts/part1/SimpleButton.qml b/examples/tutorials/gettingStartedQml/parts/part1/SimpleButton.qml deleted file mode 100644 index 7559d4a917..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part1/SimpleButton.qml +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 { - - //identifier of the item - id: simplebutton - - //the rectangle's fill color - color: "grey" - - //dimensions of the button - width: 150; height: 75 - - //A text element contains functionalities for creating texts - Text { - id: buttonLabel - - //center the text inside the parent - anchors.centerIn: parent - - //text property binds to the label displayed on the button - text: "button label" - } - - //define the clickable area to be the whole rectangle - MouseArea { - id: buttonMouseArea - anchors.fill: parent //anchor all sides of the mouse area to the rectangle's anchors - - //onClicked handles valid mouse button clicks - onClicked: console.log(buttonLabel.text + " clicked" ) - } -} diff --git a/examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_button.png b/examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_button.png deleted file mode 100644 index aab64bcf39..0000000000 Binary files a/examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_button.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_editmenu.png b/examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_editmenu.png deleted file mode 100644 index d3ff66f2fd..0000000000 Binary files a/examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_editmenu.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_filemenu.png b/examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_filemenu.png deleted file mode 100644 index f2e2b0d990..0000000000 Binary files a/examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_filemenu.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_simplebutton.png b/examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_simplebutton.png deleted file mode 100644 index 21ce50929b..0000000000 Binary files a/examples/tutorials/gettingStartedQml/parts/part1/pics/qml-texteditor1_simplebutton.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/parts/part1/qml-texteditor.qmlproject b/examples/tutorials/gettingStartedQml/parts/part1/qml-texteditor.qmlproject deleted file mode 100644 index 2bb4016996..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part1/qml-texteditor.qmlproject +++ /dev/null @@ -1,14 +0,0 @@ -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/tutorials/gettingStartedQml/parts/part2/Button.qml b/examples/tutorials/gettingStartedQml/parts/part2/Button.qml deleted file mode 100644 index 7119feeb08..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part2/Button.qml +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 { - - //identifier of the item - id: button - - property string label: "button label" - - //these properties act as constants, useable outside this QML file - property int buttonHeight: 75 - property int buttonWidth: 150 - - //the color highlight when the mouse hovers on the rectangle - property color onHoverColor: "gold" - property color borderColor: "white" - - //buttonColor is set to the button's main color - property color buttonColor: "lightblue" - - //set appearance properties - radius:10 - antialiasing: true - border{color: "white"; width: 3} - width: buttonWidth; height: buttonHeight - - Text{ - id: buttonLabel - anchors.centerIn: parent - text: label - } - - //buttonClick() is callable and a signal handler, onButtonClick is automatically created - signal buttonClick() - onButtonClick: { - console.log(buttonLabel.text + " clicked" ) - } - - //define the clickable area to be the whole rectangle - MouseArea{ - id: buttonMouseArea - anchors.fill: parent //stretch the area to the parent's dimension - onClicked: buttonClick() - - //if true, then onEntered and onExited called if mouse hovers in the mouse area - //if false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - //display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = onHoverColor - //remove the border if the mouse exits the button mouse area - onExited: parent.border.color = borderColor - - } - - //change the color of the button when pressed - color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part2/EditMenu.qml b/examples/tutorials/gettingStartedQml/parts/part2/EditMenu.qml deleted file mode 100644 index 47a37059b0..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part2/EditMenu.qml +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: editMenu - height: 480; width:1000 - color: "powderblue" - property string menuName:"Edit" - - Rectangle{ - id:actionContainer - color:"transparent" - anchors.centerIn: parent - - width: parent.width; height: parent.height / 5 - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Cut" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Paste" - } - Button{ - id: exitButton - label: "Select All" - buttonColor: "darkgrey" - } - } - } - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part2/FileMenu.qml b/examples/tutorials/gettingStartedQml/parts/part2/FileMenu.qml deleted file mode 100644 index 41c7369fc0..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part2/FileMenu.qml +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: fileMenu - - //the menuName is accessible from outside this QML file - property string menuName: "File" - - //generous amount of screen space that will allow the buttons to fit - height: 480; width:1000 - - color: "#6C646A" - - //a sub-rectangle allows the flexibility of setting the row area - Rectangle{ - id:actionContainer - - //make this rectangle invisible - color:"transparent" - anchors.centerIn: parent - - //the height is a good proportion that creates more space at the top of the row of buttons - width: parent.width; height: parent.height / 5 - - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Load" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Save" - } - Button{ - id: exitButton - label: "Exit" - buttonColor: "darkgrey" - - //exit the application if the exitButton is clicked - onButtonClick:{ - Qt.quit() - } - } - } - } - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part2/MenuBar.qml b/examples/tutorials/gettingStartedQml/parts/part2/MenuBar.qml deleted file mode 100644 index f9a293361e..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part2/MenuBar.qml +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: menuBar - width: 1000 - height:300 - - property color fileColor: "thistle" - property color editColor: "powderblue" - - //container for the header and the buttons - Rectangle{ - - id: labelList - height:parent.height/10 - width: parent.width - color: "steelblue" - - //default z is 0, items with higher z values are shown on top of items with lower z values - z: 1 - - //row displays its children in a vertical row - Row{ - anchors.centerIn: parent - spacing:40 - Button{ - height: 20 - width: 50 - label: "File" - id: fileButton - buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) - scale: menuListView.currentIndex == 0? 1.25: 1 - radius: 1 - - //on a button click, change the list's currently selected item to FileMenu - onButtonClick: { - menuListView.currentIndex = 0 - } - } - Button{ - height: 20 - width: 50 - id: editButton - buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) - scale: menuListView.currentIndex == 1? 1.25: 1 - label: "Edit" - radius: 1 - - //on a button click, change the list's currently selected item to EditMenu - onButtonClick: { - menuListView.currentIndex = 1 - } - - - } - - - } - } - - //a list of visual items already have delegates handling their display - VisualItemModel{ - id: menuListModel - - FileMenu{ - width: menuListView.width - height: menuBar.height - color: fileColor - } - EditMenu{ - color: editColor - width: menuListView.width - height: menuBar.height - - } - } - - //list view will display a model according to a delegate - ListView{ - id: menuListView - anchors.fill:parent - anchors.bottom: parent.bottom - width:parent.width - height: parent.height - - //the model contains the data - model: menuListModel - - //control the movement of the menu switching - snapMode: ListView.SnapOneItem - orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds - flickDeceleration: 5000 - highlightFollowsCurrentItem: true - highlightMoveDuration:240 - highlightRangeMode: ListView.StrictlyEnforceRange - } - - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part2/pics/qml-texteditor2_menubar.png b/examples/tutorials/gettingStartedQml/parts/part2/pics/qml-texteditor2_menubar.png deleted file mode 100644 index da959a3468..0000000000 Binary files a/examples/tutorials/gettingStartedQml/parts/part2/pics/qml-texteditor2_menubar.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/parts/part2/qml-texteditor2.qmlproject b/examples/tutorials/gettingStartedQml/parts/part2/qml-texteditor2.qmlproject deleted file mode 100644 index 2bb4016996..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part2/qml-texteditor2.qmlproject +++ /dev/null @@ -1,14 +0,0 @@ -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/tutorials/gettingStartedQml/parts/part3/Button.qml b/examples/tutorials/gettingStartedQml/parts/part3/Button.qml deleted file mode 100644 index 7119feeb08..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part3/Button.qml +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 { - - //identifier of the item - id: button - - property string label: "button label" - - //these properties act as constants, useable outside this QML file - property int buttonHeight: 75 - property int buttonWidth: 150 - - //the color highlight when the mouse hovers on the rectangle - property color onHoverColor: "gold" - property color borderColor: "white" - - //buttonColor is set to the button's main color - property color buttonColor: "lightblue" - - //set appearance properties - radius:10 - antialiasing: true - border{color: "white"; width: 3} - width: buttonWidth; height: buttonHeight - - Text{ - id: buttonLabel - anchors.centerIn: parent - text: label - } - - //buttonClick() is callable and a signal handler, onButtonClick is automatically created - signal buttonClick() - onButtonClick: { - console.log(buttonLabel.text + " clicked" ) - } - - //define the clickable area to be the whole rectangle - MouseArea{ - id: buttonMouseArea - anchors.fill: parent //stretch the area to the parent's dimension - onClicked: buttonClick() - - //if true, then onEntered and onExited called if mouse hovers in the mouse area - //if false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - //display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = onHoverColor - //remove the border if the mouse exits the button mouse area - onExited: parent.border.color = borderColor - - } - - //change the color of the button when pressed - color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part3/EditMenu.qml b/examples/tutorials/gettingStartedQml/parts/part3/EditMenu.qml deleted file mode 100644 index 47a37059b0..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part3/EditMenu.qml +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: editMenu - height: 480; width:1000 - color: "powderblue" - property string menuName:"Edit" - - Rectangle{ - id:actionContainer - color:"transparent" - anchors.centerIn: parent - - width: parent.width; height: parent.height / 5 - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Cut" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Paste" - } - Button{ - id: exitButton - label: "Select All" - buttonColor: "darkgrey" - } - } - } - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part3/FileMenu.qml b/examples/tutorials/gettingStartedQml/parts/part3/FileMenu.qml deleted file mode 100644 index 41c7369fc0..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part3/FileMenu.qml +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: fileMenu - - //the menuName is accessible from outside this QML file - property string menuName: "File" - - //generous amount of screen space that will allow the buttons to fit - height: 480; width:1000 - - color: "#6C646A" - - //a sub-rectangle allows the flexibility of setting the row area - Rectangle{ - id:actionContainer - - //make this rectangle invisible - color:"transparent" - anchors.centerIn: parent - - //the height is a good proportion that creates more space at the top of the row of buttons - width: parent.width; height: parent.height / 5 - - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Load" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Save" - } - Button{ - id: exitButton - label: "Exit" - buttonColor: "darkgrey" - - //exit the application if the exitButton is clicked - onButtonClick:{ - Qt.quit() - } - } - } - } - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part3/MenuBar.qml b/examples/tutorials/gettingStartedQml/parts/part3/MenuBar.qml deleted file mode 100644 index f9a293361e..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part3/MenuBar.qml +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: menuBar - width: 1000 - height:300 - - property color fileColor: "thistle" - property color editColor: "powderblue" - - //container for the header and the buttons - Rectangle{ - - id: labelList - height:parent.height/10 - width: parent.width - color: "steelblue" - - //default z is 0, items with higher z values are shown on top of items with lower z values - z: 1 - - //row displays its children in a vertical row - Row{ - anchors.centerIn: parent - spacing:40 - Button{ - height: 20 - width: 50 - label: "File" - id: fileButton - buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) - scale: menuListView.currentIndex == 0? 1.25: 1 - radius: 1 - - //on a button click, change the list's currently selected item to FileMenu - onButtonClick: { - menuListView.currentIndex = 0 - } - } - Button{ - height: 20 - width: 50 - id: editButton - buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) - scale: menuListView.currentIndex == 1? 1.25: 1 - label: "Edit" - radius: 1 - - //on a button click, change the list's currently selected item to EditMenu - onButtonClick: { - menuListView.currentIndex = 1 - } - - - } - - - } - } - - //a list of visual items already have delegates handling their display - VisualItemModel{ - id: menuListModel - - FileMenu{ - width: menuListView.width - height: menuBar.height - color: fileColor - } - EditMenu{ - color: editColor - width: menuListView.width - height: menuBar.height - - } - } - - //list view will display a model according to a delegate - ListView{ - id: menuListView - anchors.fill:parent - anchors.bottom: parent.bottom - width:parent.width - height: parent.height - - //the model contains the data - model: menuListModel - - //control the movement of the menu switching - snapMode: ListView.SnapOneItem - orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds - flickDeceleration: 5000 - highlightFollowsCurrentItem: true - highlightMoveDuration:240 - highlightRangeMode: ListView.StrictlyEnforceRange - } - - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part3/TextArea.qml b/examples/tutorials/gettingStartedQml/parts/part3/TextArea.qml deleted file mode 100644 index fa79c71fd9..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part3/TextArea.qml +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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:textArea - - width :400 - height:400 - color: "white" - - Flickable{ - id: flickArea - - width: parent.width - height: parent.height - anchors.fill:parent - - 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: textEditor - anchors.fill:parent - width:parent.width; height:parent.height - color:"midnightblue" - focus: true - - wrapMode: TextEdit.Wrap - - onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) - } - } -} diff --git a/examples/tutorials/gettingStartedQml/parts/part3/TextEditor.qml b/examples/tutorials/gettingStartedQml/parts/part3/TextEditor.qml deleted file mode 100644 index 49be5e84cd..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part3/TextEditor.qml +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: 1000; height: 1000 - border.color:"black" - //the screen is partitioned into the MenuBar and TextArea. 1/3 of the screen is assigned to the MenuBar - property int partition: height/3 - - MenuBar{ - id:menuBar - height: partition - width:parent.width - z: 1 - } - - - TextArea{ - id:textArea - anchors.bottom:parent.bottom - y: partition - color: "azure" - height: partition*2 - width:parent.width - } - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part3/images/arrow.png b/examples/tutorials/gettingStartedQml/parts/part3/images/arrow.png deleted file mode 100644 index 14978c2e56..0000000000 Binary files a/examples/tutorials/gettingStartedQml/parts/part3/images/arrow.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/parts/part3/pics/qml-texteditor3_texteditor.png b/examples/tutorials/gettingStartedQml/parts/part3/pics/qml-texteditor3_texteditor.png deleted file mode 100644 index d0623b5a79..0000000000 Binary files a/examples/tutorials/gettingStartedQml/parts/part3/pics/qml-texteditor3_texteditor.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/parts/part3/qml-texteditor3.qmlproject b/examples/tutorials/gettingStartedQml/parts/part3/qml-texteditor3.qmlproject deleted file mode 100644 index 2bb4016996..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part3/qml-texteditor3.qmlproject +++ /dev/null @@ -1,14 +0,0 @@ -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/tutorials/gettingStartedQml/parts/part4/Button.qml b/examples/tutorials/gettingStartedQml/parts/part4/Button.qml deleted file mode 100644 index 50d4c9059f..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part4/Button.qml +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 { - - //identifier of the item - id: button - - //these properties act as constants, useable outside this QML file - property int buttonHeight: 75 - property int buttonWidth: 150 - - //attaches to the Text element's text content - property string label - property color textColor: buttonLabel.color - - //the color highlight when the mouse hovers on the rectangle - property color onHoverColor: "gold" - property color borderColor: "white" - - //buttonColor is set to the button's main color - property color buttonColor: "lightblue" - - //set appearance properties - radius:10 - antialiasing: true - border.color: "white" - border.width: 3 - width: buttonWidth; height: buttonHeight - - Text{ - id: buttonLabel - anchors.centerIn: parent - text: label //"button label" //bind the text to the parent's text - } - - //buttonClick() is callable and a signal handler, onButtonClick is automatically created - signal buttonClick() - onButtonClick: { - console.log(buttonLabel.text + " clicked" ) - } - - //define the clickable area to be the whole rectangle - MouseArea{ - id: buttonMouseArea - anchors.fill: parent //stretch the area to the parent's dimension - onClicked: buttonClick() - - //if true, then onEntered and onExited called if mouse hovers in the mouse area - //if false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - //display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = onHoverColor - //remove the border if the mouse exits the button mouse area - onExited: parent.border.color = borderColor - - } - - //change the color of the button when pressed - color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor - //animate the color whenever the color property changes - Behavior on color { ColorAnimation{ duration: 55} } - - //scale the button when pressed - scale: buttonMouseArea.pressed ? 1.1 : 1.00 - //Animate the scale property change - Behavior on scale { NumberAnimation{ duration: 55} } - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part4/EditMenu.qml b/examples/tutorials/gettingStartedQml/parts/part4/EditMenu.qml deleted file mode 100644 index 9613e3aaf5..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part4/EditMenu.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: editMenu - height: 480; width:1000 - color: "powderblue" - property string menuName:"Edit" - gradient: Gradient{ - GradientStop { position: 0.0; color: "#6A6F70" } - GradientStop { position: 1.0; color: Qt.darker("#6A6D67") } - } - - Rectangle{ - id:actionContainer - color:"transparent" - anchors.centerIn: parent - - width: parent.width; height: parent.height / 5 - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Cut" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Paste" - } - Button{ - id: exitButton - label: "Select All" - buttonColor: "darkgrey" - } - } - } - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part4/FileMenu.qml b/examples/tutorials/gettingStartedQml/parts/part4/FileMenu.qml deleted file mode 100644 index fd3ccbd710..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part4/FileMenu.qml +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: fileMenu - - //the menuName is accessible from outside this QML file - property string menuName: "File" - - //generous amount of screen space that will allow the buttons to fit - height: 480; width:1000 - - color: "#6C646A" - gradient: Gradient{ - GradientStop { position: 0.0; color: "#6C646A" } - GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } - } - - //a sub-rectangle allows the flexibility of setting the row area - Rectangle{ - id:actionContainer - - //make this rectangle invisible - color:"transparent" - anchors.centerIn: parent - - //the height is a good proportion that creates more space at the top of the row of buttons - width: parent.width; height: parent.height / 5 - - Row{ - anchors.centerIn: parent - spacing: parent.width/6 - Button{ - id: loadButton - buttonColor: "lightgrey" - label: "Load" - } - - Button{ - buttonColor: "grey" - id: saveButton - label: "Save" - } - Button{ - id: exitButton - label: "Exit" - buttonColor: "darkgrey" - - //exit the application if the exitButton is clicked - onButtonClick:{ - Qt.quit() - } - } - } - } - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part4/MenuBar.qml b/examples/tutorials/gettingStartedQml/parts/part4/MenuBar.qml deleted file mode 100644 index abd8a313cf..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part4/MenuBar.qml +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: menuBar - width: 1000 - height:300 - - property color fileColor: "plum" - property color editColor: "powderblue" - - //container for the header and the buttons - Rectangle{ - - id: labelList - height:parent.height/10 - width: parent.width - color: "beige" - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.98;color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#0e1B20" } - } - - //default z is 0, items with higher z values are shown on top of items with lower z values - z: 1 - - //row displays its children in a vertical row - Row{ - anchors.centerIn: parent - spacing:40 - Button{ - height: 20 - width: 50 - label: "File" - id: fileButton - buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) - scale: menuListView.currentIndex == 0? 1.25: 1 - radius: 1 - - //on a button click, change the list's currently selected item to FileMenu - onButtonClick: { - menuListView.currentIndex = 0 - } - } - Button{ - height: 20 - width: 50 - id: editButton - buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) - scale: menuListView.currentIndex == 1? 1.25: 1 - label: "Edit" - radius: 1 - - //on a button click, change the list's currently selected item to EditMenu - onButtonClick: { - menuListView.currentIndex = 1 - } - - - } - - - } - } - - //a list of visual items already have delegates handling their display - VisualItemModel{ - id: menuListModel - - FileMenu{ - width: menuListView.width - height: menuBar.height - color: fileColor - } - EditMenu{ - color: editColor - width: menuListView.width - height: menuBar.height - - } - } - - //list view will display a model according to a delegate - ListView{ - id: menuListView - anchors.fill:parent - anchors.bottom: parent.bottom - width:parent.width - height: parent.height - - //the model contains the data - model: menuListModel - - //control the movement of the menu switching - snapMode: ListView.SnapOneItem - orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds - flickDeceleration: 5000 - highlightFollowsCurrentItem: true - highlightMoveDuration:240 - highlightRangeMode: ListView.StrictlyEnforceRange - } - - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part4/SimpleButton.qml b/examples/tutorials/gettingStartedQml/parts/part4/SimpleButton.qml deleted file mode 100644 index 27f6923c1d..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part4/SimpleButton.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: simplebutton - color: "grey" - width: 150; height: 75 - - Text{ - id: buttonLabel - anchors.centerIn: parent - text: "button label" - } - - MouseArea{ - id: buttonMouseArea - anchors.fill: parent - onClicked: console.log(buttonLabel.text + " clicked" ) - } -} diff --git a/examples/tutorials/gettingStartedQml/parts/part4/TextArea.qml b/examples/tutorials/gettingStartedQml/parts/part4/TextArea.qml deleted file mode 100644 index 88a60d049c..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part4/TextArea.qml +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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:textArea - - width :400 - height:400 - property color fontColor: "white" - - Flickable{ - id: flickArea - - width: parent.width - height: parent.height - anchors.fill:parent - - 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: textEditor - anchors.fill:parent - width:parent.width; height:parent.height - color:fontColor - focus: true - - wrapMode: TextEdit.Wrap - - onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) - } - } -} diff --git a/examples/tutorials/gettingStartedQml/parts/part4/TextEditor.qml b/examples/tutorials/gettingStartedQml/parts/part4/TextEditor.qml deleted file mode 100644 index 09bcb37cb2..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part4/TextEditor.qml +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: 1000; height: 1000 - property int partition: height/3 - state: "DRAWER_CLOSED" - - - //Item 1: MenuBar on the top portion of the screen - MenuBar{ - id:menuBar - height: partition - //anchors.top:parent.top - width:parent.width - z:1 - } - - - //Item 2: The editable text area - TextArea{ - id:textArea - y:drawer.height - border.color: Qt.darker(color, 1.4) - border.width: 2 - color: "#3F3F3F" - fontColor: "#DCDCCC" - height: partition*2 - width:parent.width - } - - //Item 3: The drawer handle - Rectangle{ - id:drawer - height:15 - width: parent.width - border.color : "#6A6D6A" - border.width: 1 - - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.77; color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#6A6D6A" } - } - - Image{ - id: arrowIcon - source: "images/arrow.png" - anchors.horizontalCenter: parent.horizontalCenter - - Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} - } - - MouseArea{ - id: drawerMouseArea - anchors.fill:parent - onClicked:{ - if (screen.state == "DRAWER_CLOSED"){ - screen.state = "DRAWER_OPEN" - console.log("drawer OPEN") - } - else if (screen.state == "DRAWER_OPEN"){ - screen.state = "DRAWER_CLOSED" - console.log("drawer closed") - } - } - - //if true, then onEntered and onExited called if mouse hovers in the mouse area - //if false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - //display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = Qt.lighter("#6A6D6A") - //remove the border if the mouse exits the button mouse area - onExited: parent.border.color = "#6A6D6A" - } - - } - states:[ - State{ - name: "DRAWER_OPEN" - PropertyChanges { target: menuBar; y:0} - PropertyChanges { target: textArea; y: partition + drawer.height} - PropertyChanges { target: drawer; y: partition} - PropertyChanges { target: arrowIcon; rotation: 180} - }, - State{ - name: "DRAWER_CLOSED" - PropertyChanges { target: menuBar; y:-partition} - PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} - PropertyChanges { target: drawer; y: 0} - PropertyChanges { target: arrowIcon; rotation: 0} - } - - ] - transitions: [ - Transition{ - to: "*" - NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } - NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } - NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } - } - - ] -} diff --git a/examples/tutorials/gettingStartedQml/parts/part4/images/arrow.png b/examples/tutorials/gettingStartedQml/parts/part4/images/arrow.png deleted file mode 100644 index 14978c2e56..0000000000 Binary files a/examples/tutorials/gettingStartedQml/parts/part4/images/arrow.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/parts/part4/pics/qml-texteditor4_texteditor.png b/examples/tutorials/gettingStartedQml/parts/part4/pics/qml-texteditor4_texteditor.png deleted file mode 100644 index a195fb87c3..0000000000 Binary files a/examples/tutorials/gettingStartedQml/parts/part4/pics/qml-texteditor4_texteditor.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/parts/part4/qml-texteditor4.qmlproject b/examples/tutorials/gettingStartedQml/parts/part4/qml-texteditor4.qmlproject deleted file mode 100644 index 2bb4016996..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part4/qml-texteditor4.qmlproject +++ /dev/null @@ -1,14 +0,0 @@ -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/tutorials/gettingStartedQml/parts/part5/TextEditor.qml b/examples/tutorials/gettingStartedQml/parts/part5/TextEditor.qml deleted file mode 100644 index 5ce5a89ceb..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/TextEditor.qml +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: screen - width: 1000; height: 1000 - property int partition: height/3 - state: "DRAWER_CLOSED" - - //Item 1: MenuBar on the top portion of the screen - MenuBar{ - id:menuBar - height: screen.partition; width: screen.width - z:1 - } - //Item 2: The editable text area - TextArea{ - id:textArea - y:drawer.height - color: "#3F3F3F" - fontColor: "#DCDCCC" - height: partition*2; width:parent.width - } - //Item 3: The drawer handle - Rectangle{ - id:drawer - height:15; width: parent.width - border.color : "#6A6D6A" - border.width: 1 - z:1 - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.77; color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#6A6D6A" } - } - Image{ - id: arrowIcon - source: "images/arrow.png" - anchors.horizontalCenter: parent.horizontalCenter - - Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} - } - - MouseArea{ - id: drawerMouseArea - anchors.fill:parent - hoverEnabled: true - onEntered: parent.border.color = Qt.lighter("#6A6D6A") - onExited: parent.border.color = "#6A6D6A" - onClicked:{ - if (screen.state == "DRAWER_CLOSED"){ - screen.state = "DRAWER_OPEN" - } - else if (screen.state == "DRAWER_OPEN"){ - screen.state = "DRAWER_CLOSED" - } - } - } - } - - states:[ - State{ - name: "DRAWER_OPEN" - PropertyChanges { target: menuBar; y: 0} - PropertyChanges { target: textArea; y: partition + drawer.height} - PropertyChanges { target: drawer; y: partition} - PropertyChanges { target: arrowIcon; rotation: 180} - }, - State{ - name: "DRAWER_CLOSED" - PropertyChanges { target: menuBar; y:-height; } - PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} - PropertyChanges { target: drawer; y: 0} - PropertyChanges { target: arrowIcon; rotation: 0} - } - ] - - transitions: [ - Transition{ - to: "*" - NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } - NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } - NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } - } - ] -} diff --git a/examples/tutorials/gettingStartedQml/parts/part5/core/Button.qml b/examples/tutorials/gettingStartedQml/parts/part5/core/Button.qml deleted file mode 100644 index eca367e859..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/core/Button.qml +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 { - - //identifier of the item - id: button - - //these properties act as constants, useable outside this QML file - property int buttonHeight: 75 - property int buttonWidth: 150 - - //attaches to the Text element's text content - property string label - property color textColor: buttonLabel.color - - //the color highlight when the mouse hovers on the rectangle - property color onHoverColor: "lightsteelblue" - property color borderColor: "transparent" - - //buttonColor is set to the button's main color - property color buttonColor: "lightblue" - - property real labelSize: 14 - //set appearance properties - radius:6 - antialiasing: true - border.width: 2 - border.color: borderColor - width: buttonWidth; height: buttonHeight - - Text{ - id: buttonLabel - anchors.centerIn: parent - text: label //bind the text to the parent's text - color: "#DCDCCC" - font.pointSize: labelSize - } - - //buttonClick() is callable and a signal handler, onButtonClick is automatically created - signal buttonClick() - - //define the clickable area to be the whole rectangle - MouseArea{ - id: buttonMouseArea - anchors.fill: parent //stretch the area to the parent's dimension - onClicked: buttonClick() - - //if true, then onEntered and onExited called if mouse hovers in the mouse area - //if false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - //display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = onHoverColor - //remove the border if the mouse exits the button mouse area - onExited: parent.border.color = borderColor - - } - - //change the color of the button when pressed - color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor - //animate the color whenever the color property changes - Behavior on color { ColorAnimation{ duration: 55} } - - //scale the button when pressed - scale: buttonMouseArea.pressed ? 1.1 : 1.00 - //Animate the scale property change - Behavior on scale { NumberAnimation{ duration: 55} } - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part5/core/EditMenu.qml b/examples/tutorials/gettingStartedQml/parts/part5/core/EditMenu.qml deleted file mode 100644 index 57e297c509..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/core/EditMenu.qml +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: editMenu - height: 480; width:1000 - color: "powderblue" - property color buttonBorderColor: "#7A8182" - property color buttonFillColor: "#61BDCACD" - property string menuName:"Edit" - - gradient: Gradient{ - GradientStop { position: 0.0; color: "#6A7570" } - GradientStop { position: 1.0; color: Qt.darker("#6A7570") } - } - - Rectangle{ - id:actionContainer - color:"transparent" - anchors.centerIn: parent - width: parent.width; height: parent.height / 5 - Row{ - anchors.centerIn: parent - spacing: parent.width/9 - Button{ - id: loadButton - buttonColor: buttonFillColor - label: "Copy" - labelSize:16 - borderColor:buttonBorderColor - height: actionContainer.height - width: actionContainer.width/6 - onButtonClick:textArea.copy() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - - Button{ - id: saveButton - height: actionContainer.height - width: actionContainer.width/6 - buttonColor: buttonFillColor - label: "Paste" - borderColor:buttonBorderColor - labelSize:16 - onButtonClick:textArea.paste() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - Button{ - id: exitButton - label: "Select All" - height: actionContainer.height - width: actionContainer.width/6 - labelSize:16 - buttonColor: buttonFillColor - borderColor:buttonBorderColor - onButtonClick:textArea.selectAll() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - } - } - -} diff --git a/examples/tutorials/gettingStartedQml/parts/part5/core/FileDialog.qml b/examples/tutorials/gettingStartedQml/parts/part5/core/FileDialog.qml deleted file mode 100644 index b73e908464..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/core/FileDialog.qml +++ /dev/null @@ -1,171 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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:dialog - height: 200 * partition; width: 200 - color: "transparent" - - signal selectChanged() - signal notifyRefresh() - onNotifyRefresh:dirView.model = directory.files - - property string selectedFile - property int selectedIndex: 0 - - Rectangle{ - id: dirBox - radius: 10 - antialiasing: true - anchors.centerIn:parent - height: parent.height -15; width: parent.width -30 - - Rectangle{ - id:header - height:parent.height*0.1 - width: parent.width - radius:3 - antialiasing: true - z:1 - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.98;color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#0e1B20" } - } - Text{ - height: header.height - anchors.centerIn: header - text: "files:" - color: "lightblue" - font.weight: Font.Light - font.italic: true - } - } - GridView{ - id:dirView - width:parent.width - height:parent.height*.9 - anchors.top: header.bottom - cellWidth: 100 - cellHeight: 75 -// highlight: Rectangle { width:cellWidth; height: cellHeight; color: "lightsteelblue" ;radius: 13} - model: directory.files - delegate: dirDelegate - clip: true - highlightMoveDuration:40 - } - - Component{ - id:dirDelegate - - Rectangle{ - id:file - color: "transparent" - width: GridView.view.cellWidth; height: GridView.view.cellHeight - - Text{ - id:fileName - width: parent.width - anchors.centerIn:parent - text: name - color: "#BDCACD" - font.weight: GridView.view.currentIndex == index ? Font.DemiBold : Font.Normal - font.pointSize: GridView.view.currentIndex == index ? 12 : 10 - elide: Text.ElideMiddle - horizontalAlignment: Text.AlignHCenter - } - Rectangle{ - id:selection - width:parent.width; height:parent.height - anchors.centerIn: parent - radius: 10 - antialiasing: true - scale: GridView.view.currentIndex == index ? 1 : 0.5 - opacity: GridView.view.currentIndex == index ? 1 : 0 - Text{ - id:overlay - width: parent.width - anchors.centerIn:parent - text: name - color: "#696167" - font.weight: Font.DemiBold - font.pointSize: 12 - elide: Text.ElideMiddle - horizontalAlignment: Text.AlignHCenter - } - Behavior on opacity{ NumberAnimation{ duration: 45} } - Behavior on scale { NumberAnimation{ duration: 45} } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter("lightsteelblue",1.25) } - GradientStop { position: 0.67; color: Qt.darker("lightsteelblue",1.3) } - } - border.color:"lightsteelblue" - border.width:1 - } - MouseArea{ - id:fileMouseArea - anchors.fill:parent - hoverEnabled: true - - onClicked:{ - GridView.view.currentIndex = index - selectedFile = directory.files[index].name - selectChanged() - } - onEntered:{ - fileName.color = "lightsteelblue" - fileName.font.weight = Font.DemiBold - } - onExited: { - fileName.font.weight = Font.Normal - fileName.color = "#BDCACD" - } - } - } - } - gradient: Gradient{ - GradientStop { position: 0.0; color: "#A5333333" } - GradientStop { position: 1.0; color: "#03333333" } - } - } -} diff --git a/examples/tutorials/gettingStartedQml/parts/part5/core/FileMenu.qml b/examples/tutorials/gettingStartedQml/parts/part5/core/FileMenu.qml deleted file mode 100644 index c13e753f06..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/core/FileMenu.qml +++ /dev/null @@ -1,233 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "../filedialog" 1.0 - -Rectangle { - id: fileMenu - height: 480; width:1000 - property color buttonBorderColor: "#7F8487" - property color buttonFillColor: "#8FBDCACD" - property string fileContent:directory.fileContent - - //the menuName is accessible from outside this QML file - property string menuName: "File" - - //used to divide the screen into parts. - property real partition: 1/3 - - color: "#6C646A" - gradient: Gradient{ - GradientStop { position: 0.0; color: "#6C646A" } - GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } - } - - Directory{ - id:directory - filename: textInput.text - onDirectoryChanged:fileDialog.notifyRefresh() - } - - Rectangle{ - id:actionContainer - - //make this rectangle invisible - color:"transparent" - anchors.left: parent.left - - //the height is a good proportion that creates more space at the top of the column of buttons - width: fileMenu.width * partition; height: fileMenu.height - - Column{ - anchors.centerIn: parent - spacing: parent.height/32 - Button{ - id: saveButton - label: "Save" - borderColor: buttonBorderColor - buttonColor: buttonFillColor - width: actionContainer.width/ 1.3 - height:actionContainer.height / 8 - labelSize:24 - onButtonClick:{ - directory.fileContent = textArea.textContent - directory.filename = textInput.text - directory.saveFile() - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - - } - Button{ - id: loadButton - width: actionContainer.width/ 1.3 - height:actionContainer.height/ 8 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - label: "Load" - labelSize:24 - onButtonClick:{ - directory.filename = textInput.text - directory.loadFile() - textArea.textContent = directory.fileContent - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - Button{ - id: newButton - width: actionContainer.width/ 1.3 - height:actionContainer.height/ 8 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - label: "New" - labelSize:24 - onButtonClick:{ - textArea.textContent = "" - textInput.text = "" - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - - } - Rectangle{ - id: space - width: actionContainer.width/ 1.3 - height:actionContainer.height / 16 - color:"transparent" - } - Button{ - id: exitButton - width: actionContainer.width/ 1.3 - height:actionContainer.height/ 8 - label: "Exit" - labelSize:24 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - onButtonClick:Qt.quit() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - } - } - - Rectangle{ - id:dialogContainer - - width: 2*fileMenu.width * partition; height: fileMenu.height - anchors.right:parent.right - color:"transparent" - - Column { - anchors.centerIn: parent - spacing: parent.height /640 - FileDialog{ - id:fileDialog - height: 2*dialogContainer.height * partition; width: dialogContainer.width - onSelectChanged: textInput.text = selectedFile - } - - Rectangle{ - id:lowerPartition - height: dialogContainer.height * partition; width: dialogContainer.width - color: "transparent" - - Rectangle{ - id: nameField - gradient: Gradient{ - GradientStop { position: 0.0; color: "#806F6F6F" } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - - radius: 10 - anchors {centerIn:parent; leftMargin: 15; rightMargin: 15; topMargin: 15} - height: parent.height-15; width: parent.width -20 - border {color:"#4A4A4A"; width:1} - - TextInput{ - id: textInput - z:2 - anchors {bottom: parent.bottom; topMargin: 10; horizontalCenter:parent.horizontalCenter} - width: parent.width - 10 - height: parent.height -10 - font.pointSize: 40 - color:"lightsteelblue" - focus:true - } - Text{ - id: textInstruction - anchors.centerIn:parent - text: "Select file name and press save or load" - font {pointSize: 11; weight:Font.Light; italic: true} - color: "lightblue" - z:2 - opacity: (textInput.text == "") ? 1: 0 - } - Text{ - id:fieldLabel - anchors {top: parent.top; left: parent.left} - text: " file name: " - font {pointSize: 11; weight: Font.Light; italic: true} - color: "lightblue" - z:2 - } - MouseArea{ - anchors.centerIn:parent - width: nameField.width; height: nameField.height - onClicked:{ - textInput.text = "" - textInput.focus = true - textInput.forceFocus() - } - } - } - } - } - } -} diff --git a/examples/tutorials/gettingStartedQml/parts/part5/core/MenuBar.qml b/examples/tutorials/gettingStartedQml/parts/part5/core/MenuBar.qml deleted file mode 100644 index 89f21c021d..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/core/MenuBar.qml +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: menuBar - width: 1000; height:300 - color:"transparent" - property color fileColor: "plum" - property color editColor: "powderblue" - - property real partition: 1/10 - - Column{ - anchors.fill: parent - //container for the header and the buttons - z: 1 - Rectangle{ - id: labelList - height:menuBar.height*partition - width: menuBar.width - color: "beige" - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.98;color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#0e1B20" } - } - Text{ - height: parent.height - anchors {right: labelRow.left ; verticalCenter: parent.bottom} - text: "menu: " - color: "lightblue" - font {weight: Font.Light; italic: true} - } - - //row displays its children in a vertical row - Row{ - id: labelRow - anchors.centerIn: parent - spacing:40 - Button{ - id: fileButton - height: 20; width: 50 - label: "File" - buttonColor : menuListView.currentIndex == 0? fileColor : Qt.darker(fileColor, 1.5) - scale: menuListView.currentIndex == 0? 1.25: 1 - labelSize: menuListView.currentIndex == 0? 16:12 - radius: 1 - //on a button click, change the list's currently selected item to FileMenu - onButtonClick: menuListView.currentIndex = 0 - gradient: Gradient{ - GradientStop { position: 0.0; color: fileColor } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - } - Button{ - id: editButton - height: 20; width: 50 - buttonColor : menuListView.currentIndex == 1? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9) - scale: menuListView.currentIndex == 1? 1.25: 1 - label: "Edit" - radius: 1 - labelSize: menuListView.currentIndex == 1? 16:12 - //on a button click, change the list's currently selected item to EditMenu - onButtonClick: menuListView.currentIndex = 1 - gradient: Gradient{ - GradientStop { position: 0.0; color: editColor } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - } - } - } - - //list view will display a model according to a delegate - ListView{ - id: menuListView - width:menuBar.width; height: 9*menuBar.height*partition - - //the model contains the data - model: menuListModel - - //control the movement of the menu switching - snapMode: ListView.SnapOneItem - orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds - flickDeceleration: 5000 - highlightFollowsCurrentItem: true - highlightMoveDuration:240 - highlightRangeMode: ListView.StrictlyEnforceRange - } - } - //a list of visual items already have delegates handling their display - VisualItemModel{ - id: menuListModel - - FileMenu{ - id:fileMenu - width: menuListView.width; height: menuListView.height - color: fileColor - } - EditMenu{ - color: editColor - width: menuListView.width; height: menuListView.height - } - } -} diff --git a/examples/tutorials/gettingStartedQml/parts/part5/core/TextArea.qml b/examples/tutorials/gettingStartedQml/parts/part5/core/TextArea.qml deleted file mode 100644 index a19e53264d..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/core/TextArea.qml +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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:textArea - - function paste(){ textEdit.paste()} - function copy() { textEdit.copy() } - function selectAll() { textEdit.selectAll() } - - width :400; height:400 - - property color fontColor: "white" - property alias textContent: textEdit.text - Flickable{ - id: flickArea - width: parent.width; height: parent.height - anchors.fill:parent - - boundsBehavior: Flickable.StopAtBounds - flickableDirection: Flickable.HorizontalFlick - interactive: true - //Will move the text Edit area to make the area visible when scrolled with keyboard strokes - 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: textEdit - anchors.fill:parent - width:parent.width; height:parent.height - color:fontColor - focus: true - wrapMode: TextEdit.Wrap - font.pointSize:10 - onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) - selectByMouse: true - } - } -} diff --git a/examples/tutorials/gettingStartedQml/parts/part5/core/qmldir b/examples/tutorials/gettingStartedQml/parts/part5/core/qmldir deleted file mode 100644 index b8b0c7c431..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/core/qmldir +++ /dev/null @@ -1,11 +0,0 @@ - -Button ./Button.qml -FileDialog ./FileDialog.qml -TextArea ./TextArea.qml -TextEditor ./TextEditor.qml -EditMenu ./EditMenu.qml -MenuBar ./MenuBar.qml - - - - diff --git a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp b/examples/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp deleted file mode 100644 index d71e622b33..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "dialogPlugin.h" -#include "directory.h" -#include "file.h" -#include - -void DialogPlugin::registerTypes(const char *uri){ - - //register the class Directory into QML as a "Directory" element version 1.0 - qmlRegisterType(uri, 1, 0, "Directory"); - qmlRegisterType(uri,1,0,"File"); - - //qRegisterMetaType > ("QQmlListProperty"); - -} - -//FileDialog is the plugin name (same as the TARGET in the project file) and DialogPlugin is the plugin classs -Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin); diff --git a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h b/examples/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h deleted file mode 100644 index 82035193c8..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/dialogPlugin.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 DIALOGPLUGIN_H -#define DIALOGPLUGIN_H - -#include - -class DialogPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - - public: - //registerTypes is inherited from QQmlExtensionPlugin - void registerTypes(const char *uri); - -}; - -#endif - diff --git a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/directory.cpp b/examples/tutorials/gettingStartedQml/parts/part5/filedialog/directory.cpp deleted file mode 100644 index 4cd9d2da85..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/directory.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "directory.h" -#include - -/* -Directory constructor - -Initialize the saves directory and creates the file list -*/ -Directory::Directory(QObject *parent) : QObject(parent) -{ - - - m_dir.cd( QDir::currentPath()); - - //go to the saved directory. if not found, create save directory - m_saveDir = "saves"; - if (m_dir.cd(m_saveDir) == 0){ - m_dir.mkdir(m_saveDir); - m_dir.cd(m_saveDir); - } - m_filterList << "*.txt"; - - refresh(); -} - -/* -Directory::filesNumber -Return the number of Files -*/ -int Directory:: filesCount() const{ - return m_fileList.size(); -} - -/* -Function called to append data onto list property -*/ -void appendFiles(QQmlListProperty * property, File * file){ - //Do nothing. can't add to a directory using this method -} - -/* -Function called to retrieve file in the list using an index -*/ -File* fileAt(QQmlListProperty * property, int index){ - return static_cast< QList *>(property->data)->at(index); -} - -/* -Returns the number of files in the list -*/ -int filesSize(QQmlListProperty * property){ - return static_cast< QList *>(property->data)->size(); -} - -/* -Function called to empty the list property contents -*/ -void clearFilesPtr(QQmlListProperty *property){ - return static_cast< QList *>(property->data)->clear(); -} - -/* -Returns the list of files as a QQmlListProperty. -*/ -QQmlListProperty Directory::files(){ - - refresh(); -// return QQmlListProperty(this,m_filePtrList); //not recommended in the docs - return QQmlListProperty( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr ); -} - -/* -Return te name of the currently selected file -*/ -QString Directory::filename() const{ - return currentFile.name(); -} - -/* -Return the file's content as a string. -*/ -QString Directory::fileContent() const{ - return m_fileContent; -} - -/* -Set the file name of the current file -*/ -void Directory::setFilename(const QString &str){ - if(str != currentFile.name()){ - currentFile.setName(str); - emit filenameChanged(); - } -} - -/* -Set the content of the file as a string -*/ -void Directory::setFileContent(const QString &str){ - if(str != m_fileContent){ - m_fileContent = str; - emit fileContentChanged(); - } -} - -/* -Called from QML to save the file using the filename and file content. -Saving makes sure that the file has a .txt extension. -*/ -void Directory::saveFile(){ - - if(currentFile.name().size() == 0){ - qWarning()<< "Empty filename. no save"; - return; - } - - QString extendedName = currentFile.name(); - if(!currentFile.name().endsWith(".txt")){ - extendedName.append(".txt"); - } - - QFile file( m_dir.filePath(extendedName) ); - if (file.open(QFile::WriteOnly | QFile::Truncate)){ - QTextStream outStream(&file); - outStream << m_fileContent; - } - file.close(); - refresh(); - emit directoryChanged(); -} - -/* -Load the contents of a file. -Only loads files with a .txt extension -*/ -void Directory::loadFile(){ - - m_fileContent.clear(); - QString extendedName = currentFile.name(); - if(!currentFile.name().endsWith(".txt")){ - extendedName.append(".txt"); - } - - QFile file( m_dir.filePath(extendedName) ); - if (file.open(QFile::ReadOnly )){ - QTextStream inStream(&file); - - QString line; - do{ - line = inStream.read(75); - m_fileContent.append(line); - }while (!line .isNull()); - } - file.close(); -} - -/* -Reloads the content of the files list. This is to ensure that the newly -created files are added onto the list. -*/ -void Directory::refresh(){ - m_dirFiles = m_dir.entryList(m_filterList,QDir::Files,QDir::Name); - m_fileList.clear(); - - File * file; - for(int i = 0; i < m_dirFiles.size() ; i ++){ - - file = new File(); - - if(m_dirFiles.at(i).endsWith(".txt")){ - QString name = m_dirFiles.at(i); - file->setName( name.remove(".txt",Qt::CaseSensitive)); - } - else{ - file->setName(m_dirFiles.at(i)); - } - m_fileList.append(file); - } -} diff --git a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/directory.h b/examples/tutorials/gettingStartedQml/parts/part5/filedialog/directory.h deleted file mode 100644 index 25b121d5b3..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/directory.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 DIRECTORY_H -#define DIRECTORY_H - -#include "file.h" - -#include -#include -#include -#include -#include - -class Directory : public QObject{ - - Q_OBJECT - - //number of files in the directory - Q_PROPERTY(int filesCount READ filesCount) - - //list property containing file names as QString - Q_PROPERTY(QQmlListProperty files READ files CONSTANT ) - - //file name of the text file to read/write - Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) - - //text content of the file - Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) - - public: - Directory(QObject *parent = 0); - - //properties' read functions - int filesCount() const; - QString filename() const; - QString fileContent() const; - QQmlListProperty files(); - - //properties' write functions - void setFilename(const QString &str); - void setFileContent(const QString &str); - - //accessible from QML - Q_INVOKABLE void saveFile(); - Q_INVOKABLE void loadFile(); - - signals: - void directoryChanged(); - void filenameChanged(); - void fileContentChanged(); - - private: - QDir m_dir; - QStringList m_dirFiles; - File currentFile; - QString m_saveDir; - QStringList m_filterList; - - //contains the file data in QString format - QString m_fileContent; - - //Registered to QML in a plugin. Accessible from QML as a property of Directory - QList m_fileList; - - //refresh content of the directory - void refresh(); -}; - - -#endif diff --git a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/file.cpp b/examples/tutorials/gettingStartedQml/parts/part5/filedialog/file.cpp deleted file mode 100644 index 162350eb0f..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/file.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 "file.h" - -File::File(QObject *parent) : QObject(parent) -{ - m_name = ""; -} - -QString File::name() const{ - return m_name; -} -void File::setName(const QString &str){ - if(str != m_name){ - m_name = str; - emit nameChanged(); - } -} diff --git a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/file.h b/examples/tutorials/gettingStartedQml/parts/part5/filedialog/file.h deleted file mode 100644 index 7125a9aae5..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/file.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 FILE_H -#define FILE_H - - -#include -#include - -class File : public QObject{ - - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - - public: - File(QObject *parent = 0); - - QString name() const; - void setName(const QString &str); - - signals: - void nameChanged(); - - private: - QString m_name; -}; - -#endif diff --git a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/filedialog.pro b/examples/tutorials/gettingStartedQml/parts/part5/filedialog/filedialog.pro deleted file mode 100644 index 71abddc7e3..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/filedialog.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = lib -CONFIG += qt plugin -QT += qml - -DESTDIR += ../plugins -OBJECTS_DIR = tmp -MOC_DIR = tmp - -TARGET = FileDialog - -HEADERS += directory.h \ - file.h \ - dialogPlugin.h - -SOURCES += directory.cpp \ - file.cpp \ - dialogPlugin.cpp diff --git a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/qmldir b/examples/tutorials/gettingStartedQml/parts/part5/filedialog/qmldir deleted file mode 100644 index 4a8d13d026..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/filedialog/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin FileDialog ../plugins diff --git a/examples/tutorials/gettingStartedQml/parts/part5/images/arrow.png b/examples/tutorials/gettingStartedQml/parts/part5/images/arrow.png deleted file mode 100644 index 14978c2e56..0000000000 Binary files a/examples/tutorials/gettingStartedQml/parts/part5/images/arrow.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_editmenu.png b/examples/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_editmenu.png deleted file mode 100644 index 27feed5e82..0000000000 Binary files a/examples/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_editmenu.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_filemenu.png b/examples/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_filemenu.png deleted file mode 100644 index 4d8f9f22b2..0000000000 Binary files a/examples/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_filemenu.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_newfile.png b/examples/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_newfile.png deleted file mode 100644 index 680acfe839..0000000000 Binary files a/examples/tutorials/gettingStartedQml/parts/part5/pics/qml-texteditor5_newfile.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/parts/part5/qml-texteditor5.qmlproject b/examples/tutorials/gettingStartedQml/parts/part5/qml-texteditor5.qmlproject deleted file mode 100644 index 2bb4016996..0000000000 --- a/examples/tutorials/gettingStartedQml/parts/part5/qml-texteditor5.qmlproject +++ /dev/null @@ -1,14 +0,0 @@ -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/tutorials/gettingStartedQml/pics/qml-texteditor5_editmenu.png b/examples/tutorials/gettingStartedQml/pics/qml-texteditor5_editmenu.png deleted file mode 100644 index 27feed5e82..0000000000 Binary files a/examples/tutorials/gettingStartedQml/pics/qml-texteditor5_editmenu.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/pics/qml-texteditor5_filemenu.png b/examples/tutorials/gettingStartedQml/pics/qml-texteditor5_filemenu.png deleted file mode 100644 index 4d8f9f22b2..0000000000 Binary files a/examples/tutorials/gettingStartedQml/pics/qml-texteditor5_filemenu.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/pics/qml-texteditor5_newfile.png b/examples/tutorials/gettingStartedQml/pics/qml-texteditor5_newfile.png deleted file mode 100644 index 680acfe839..0000000000 Binary files a/examples/tutorials/gettingStartedQml/pics/qml-texteditor5_newfile.png and /dev/null differ diff --git a/examples/tutorials/gettingStartedQml/texteditor.qml b/examples/tutorials/gettingStartedQml/texteditor.qml deleted file mode 100644 index 8e09b7fcf9..0000000000 --- a/examples/tutorials/gettingStartedQml/texteditor.qml +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: screen - width: 1000; height: 1000 - property int partition: height/3 - border { width: 1; color: "#DCDCCC"} - state: "DRAWER_CLOSED" - - //Item 1: MenuBar on the top portion of the screen - MenuBar { - id:menuBar - height: screen.partition; width: screen.width - z: 1 - } - - //Item 2: The editable text area - TextArea { - id: textArea - y: drawer.height - color: "#3F3F3F" - fontColor: "#DCDCCC" - height: partition*2; width:parent.width - } - - //Item 3: The drawer handle - Rectangle { - id: drawer - height: 15; width: parent.width - border { color : "#6A6D6A"; width: 1 } - z: 1 - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.77; color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#6A6D6A" } - } - Image { - id: arrowIcon - source: "images/arrow.png" - anchors.horizontalCenter: parent.horizontalCenter - Behavior{ NumberAnimation { property: "rotation"; easing.type: Easing.OutExpo } } - } - - MouseArea { - id: drawerMouseArea - anchors.fill: parent - hoverEnabled: true - onEntered: parent.border.color = Qt.lighter("#6A6D6A") - onExited: parent.border.color = "#6A6D6A" - onClicked: { - if (screen.state == "DRAWER_CLOSED") { - screen.state = "DRAWER_OPEN" - } - else if (screen.state == "DRAWER_OPEN"){ - screen.state = "DRAWER_CLOSED" - } - } - } - } - -//! [states] - states:[ - State { - name: "DRAWER_OPEN" - PropertyChanges { target: menuBar; y: 0} - PropertyChanges { target: textArea; y: partition + drawer.height} - PropertyChanges { target: drawer; y: partition} - PropertyChanges { target: arrowIcon; rotation: 180} - }, - State { - name: "DRAWER_CLOSED" - PropertyChanges { target: menuBar; y:-height; } - PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height } - PropertyChanges { target: drawer; y: 0 } - PropertyChanges { target: arrowIcon; rotation: 0 } - } - ] -//! [states] - -//! [transitions] - transitions: [ - Transition { - to: "*" - NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type:Easing.OutExpo } - NumberAnimation { target: menuBar; properties: "y"; duration: 100; easing.type: Easing.OutExpo } - NumberAnimation { target: drawer; properties: "y"; duration: 100; easing.type: Easing.OutExpo } - } - ] -//! [transitions] -} diff --git a/examples/tutorials/helloworld/Cell.qml b/examples/tutorials/helloworld/Cell.qml deleted file mode 100644 index 760c468eaa..0000000000 --- a/examples/tutorials/helloworld/Cell.qml +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index f55a5d50cd..0000000000 --- a/examples/tutorials/helloworld/tutorial1.qml +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: 320; height: 480 - 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 deleted file mode 100644 index fbcae467c3..0000000000 --- a/examples/tutorials/helloworld/tutorial2.qml +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: 320; height: 480 - 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 deleted file mode 100644 index 9b95e012a9..0000000000 --- a/examples/tutorials/helloworld/tutorial3.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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: 320; height: 480 - 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 deleted file mode 100644 index 65cff95dbe..0000000000 --- a/examples/tutorials/samegame/samegame1/Block.qml +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 6fdc6c707f..0000000000 --- a/examples/tutorials/samegame/samegame1/Button.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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) } - antialiasing: 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 deleted file mode 100644 index ab3aca19a2..0000000000 --- a/examples/tutorials/samegame/samegame1/samegame.qml +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 42ffacf4f8..0000000000 --- a/examples/tutorials/samegame/samegame1/samegame1.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100644 index f4065565b6..0000000000 --- a/examples/tutorials/samegame/samegame2/Block.qml +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index db1b52e2cd..0000000000 --- a/examples/tutorials/samegame/samegame2/Button.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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) } - antialiasing: 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 deleted file mode 100644 index c749dc17b1..0000000000 --- a/examples/tutorials/samegame/samegame2/samegame.js +++ /dev/null @@ -1,63 +0,0 @@ -//![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 deleted file mode 100644 index 85f5f39b0c..0000000000 --- a/examples/tutorials/samegame/samegame2/samegame.qml +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 42ffacf4f8..0000000000 --- a/examples/tutorials/samegame/samegame2/samegame2.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100644 index 55fe7f876a..0000000000 --- a/examples/tutorials/samegame/samegame3/Block.qml +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index db1b52e2cd..0000000000 --- a/examples/tutorials/samegame/samegame3/Button.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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) } - antialiasing: 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 deleted file mode 100644 index f89ad16ba1..0000000000 --- a/examples/tutorials/samegame/samegame3/Dialog.qml +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index df5bdfb049..0000000000 --- a/examples/tutorials/samegame/samegame3/samegame.js +++ /dev/null @@ -1,174 +0,0 @@ -/* 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 deleted file mode 100644 index 26d0212250..0000000000 --- a/examples/tutorials/samegame/samegame3/samegame.qml +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 42ffacf4f8..0000000000 --- a/examples/tutorials/samegame/samegame3/samegame3.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100644 index 335f4aecf6..0000000000 --- a/examples/tutorials/samegame/samegame4/content/BoomBlock.qml +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index db1b52e2cd..0000000000 --- a/examples/tutorials/samegame/samegame4/content/Button.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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) } - antialiasing: 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 deleted file mode 100644 index ca4d573543..0000000000 --- a/examples/tutorials/samegame/samegame4/content/Dialog.qml +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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) - Qt.inputMethod.show(); - else - hide(); - } - } - -//![3] -} -//![3] diff --git a/examples/tutorials/samegame/samegame4/content/samegame.js b/examples/tutorials/samegame/samegame4/content/samegame.js deleted file mode 100755 index ad4d39d7b1..0000000000 --- a/examples/tutorials/samegame/samegame4/content/samegame.js +++ /dev/null @@ -1,226 +0,0 @@ -/* 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.LocalStorage.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 deleted file mode 100644 index eaa00fae37..0000000000 --- a/examples/tutorials/samegame/samegame4/highscores/README +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100755 index c3fd90d9cf..0000000000 --- a/examples/tutorials/samegame/samegame4/highscores/score_data.xml +++ /dev/null @@ -1,2 +0,0 @@ -1000000Alan the Tester0x00 -6213Alan12x1751 diff --git a/examples/tutorials/samegame/samegame4/highscores/score_style.xsl b/examples/tutorials/samegame/samegame4/highscores/score_style.xsl deleted file mode 100755 index 670354c965..0000000000 --- a/examples/tutorials/samegame/samegame4/highscores/score_style.xsl +++ /dev/null @@ -1,28 +0,0 @@ - - - - - SameGame High Scores - -

SameGame High Scores

- - - - - - - - - - - - - - - - -
NameScoreGrid SizeTime, s
- - -
-
diff --git a/examples/tutorials/samegame/samegame4/highscores/scores.php b/examples/tutorials/samegame/samegame4/highscores/scores.php deleted file mode 100755 index daf480e21b..0000000000 --- a/examples/tutorials/samegame/samegame4/highscores/scores.php +++ /dev/null @@ -1,31 +0,0 @@ -"; - echo "SameGame High Scores"; - 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, "". $score . "" - . $name . "" . $grid . "" - . $time . "\n"); - echo "Your score has been recorded. Thanks for playing!"; - if($ret == False) - echo "
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, '' . "\n" - . '' . "\n" - . "\n" . file_get_contents("score_data.xml") . "\n"); - if($ret == False) - echo "There was an internal error. Sorry."; - else - echo ''; - } - echo ""; -?> diff --git a/examples/tutorials/samegame/samegame4/samegame.qml b/examples/tutorials/samegame/samegame4/samegame.qml deleted file mode 100644 index e6edcc35b8..0000000000 --- a/examples/tutorials/samegame/samegame4/samegame.qml +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 deleted file mode 100644 index 42ffacf4f8..0000000000 --- a/examples/tutorials/samegame/samegame4/samegame4.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100644 index 903d395c8d..0000000000 Binary files a/examples/tutorials/samegame/shared/pics/background.jpg and /dev/null differ diff --git a/examples/tutorials/samegame/shared/pics/blueStar.png b/examples/tutorials/samegame/shared/pics/blueStar.png deleted file mode 100644 index ff9588f80a..0000000000 Binary files a/examples/tutorials/samegame/shared/pics/blueStar.png and /dev/null differ diff --git a/examples/tutorials/samegame/shared/pics/blueStone.png b/examples/tutorials/samegame/shared/pics/blueStone.png deleted file mode 100644 index 20e43c75b6..0000000000 Binary files a/examples/tutorials/samegame/shared/pics/blueStone.png and /dev/null differ diff --git a/examples/tutorials/samegame/shared/pics/greenStar.png b/examples/tutorials/samegame/shared/pics/greenStar.png deleted file mode 100644 index cd06854719..0000000000 Binary files a/examples/tutorials/samegame/shared/pics/greenStar.png and /dev/null differ diff --git a/examples/tutorials/samegame/shared/pics/greenStone.png b/examples/tutorials/samegame/shared/pics/greenStone.png deleted file mode 100644 index b568a1900c..0000000000 Binary files a/examples/tutorials/samegame/shared/pics/greenStone.png and /dev/null differ diff --git a/examples/tutorials/samegame/shared/pics/redStar.png b/examples/tutorials/samegame/shared/pics/redStar.png deleted file mode 100644 index 0a4dffe583..0000000000 Binary files a/examples/tutorials/samegame/shared/pics/redStar.png and /dev/null differ diff --git a/examples/tutorials/samegame/shared/pics/redStone.png b/examples/tutorials/samegame/shared/pics/redStone.png deleted file mode 100644 index 36b09a2686..0000000000 Binary files a/examples/tutorials/samegame/shared/pics/redStone.png and /dev/null differ diff --git a/examples/tutorials/samegame/shared/pics/star.png b/examples/tutorials/samegame/shared/pics/star.png deleted file mode 100644 index defbde53ca..0000000000 Binary files a/examples/tutorials/samegame/shared/pics/star.png and /dev/null differ diff --git a/examples/tutorials/samegame/shared/pics/yellowStone.png b/examples/tutorials/samegame/shared/pics/yellowStone.png deleted file mode 100644 index b1ce76212c..0000000000 Binary files a/examples/tutorials/samegame/shared/pics/yellowStone.png and /dev/null differ diff --git a/examples/tutorials/tutorials.pro b/examples/tutorials/tutorials.pro deleted file mode 100644 index 9cb5c57c3f..0000000000 --- a/examples/tutorials/tutorials.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += gettingStartedQml - -# install -sources.files = tutorials.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/tutorials -INSTALLS += sources diff --git a/examples/window/screen/screenInfo.qml b/examples/window/screen/screenInfo.qml deleted file mode 100644 index adf92ee028..0000000000 --- a/examples/window/screen/screenInfo.qml +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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/window.pro b/examples/window/window.pro deleted file mode 100644 index 5dea5d621f..0000000000 --- a/examples/window/window.pro +++ /dev/null @@ -1,9 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += \ - #screen \ - window - -# install -sources.files = window.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtquick/window -INSTALLS += sources diff --git a/examples/window/window/Window.qml b/examples/window/window/Window.qml deleted file mode 100644 index b7fbf7206c..0000000000 --- a/examples/window/window/Window.qml +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -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/window/nogui.qml b/examples/window/window/nogui.qml deleted file mode 100644 index bed055679d..0000000000 --- a/examples/window/window/nogui.qml +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 QtQml 2.0 - -/* - This object's only functionality is to exist as a root object and - display nothing, proving that qmlscene can run without windows. - (A QtObject can't even have Component.onCompleted) -*/ -QtObject { - property string philosophy: "hello bleak windowless world" -} diff --git a/examples/window/window/standalone.qml b/examples/window/window/standalone.qml deleted file mode 100644 index a7a7ed2d7a..0000000000 --- a/examples/window/window/standalone.qml +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -Item { - width: 320 - height: 240 - // It's not possible to set an Item's windowTitle. If you want to modify - // window properties, you need to explicitly create a Window. - Text { - id: text1 - anchors.centerIn: parent - text: "First Window\n" + (Qt.application.supportsMultipleWindows ? - "click the button to open a second window" : "only one window is allowed") - } - Rectangle { - border.color: "black" - radius: 4 - anchors.top: text1.bottom - anchors.horizontalCenter: text1.horizontalCenter - width: 100 - height: 30 - TextInput { - id: ti1 - focus: true // but the modal popup will prevent input while it is open - anchors.centerIn: parent - } - } - Rectangle { - border.color: "black" - color: childWindow.visible ? "goldenrod" : "beige" - radius: height / 4 - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.margins: 10 - width: text.implicitWidth + 20 - height: text.implicitHeight + 20 - visible: Qt.application.supportsMultipleWindows - Text { - id: text - text: "Pop up window" - anchors.centerIn: parent - } - MouseArea { - anchors.fill: parent - onClicked: childWindow.visible = !childWindow.visible - } - } - - Window { - id: childWindow - width: 320 - height: 240 - x: 220 - y: 120 - color: "beige" - title: "Second Window" - modality: Qt.ApplicationModal - flags: Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint - Text { - id: text2 - anchors.centerIn: parent - text: "Modal Frameless Stay-on-Top Window" - } - Text { - anchors.top: parent.top - anchors.right: parent.right - anchors.margins: 10 - text: "X" - MouseArea{ - anchors.fill: parent - onClicked: childWindow.visible = false - } - } - Rectangle { - border.color: "black" - radius: 4 - anchors.top: text2.bottom - anchors.horizontalCenter: text2.horizontalCenter - width: 100 - height: 30 - TextInput { - id: ti2 - focus: true - anchors.centerIn: parent - } - } - } -} diff --git a/examples/window/window/twowindows.qml b/examples/window/window/twowindows.qml deleted file mode 100644 index 345598cf12..0000000000 --- a/examples/window/window/twowindows.qml +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 - -QtObject { - property var win1: Window { - width: 320 - height: 240 - x: 0 - y: 0 - visible: true - color: "#ccffff" - title: "First Window" - Text { - anchors.centerIn: parent - text: "First Window" - Text { - id: statusText - anchors.top: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - } - } - MouseArea { - anchors.fill: parent - onClicked: win2.visible = !win2.visible - } - } - property var win2: Window { - width: 320 - height: 240 - x: 220 - y: 120 - visible: true - color: "green" - title: "Second Window: " + color - Rectangle { - anchors.fill: parent - anchors.margins: 10 - Text { - anchors.centerIn: parent - text: "Second Window" - } - MouseArea { - anchors.fill: parent - onClicked: win2.color = "#ffffcc" - } - } - onVisibleChanged: statusText.text = "second window is " + (visible ? "visible" : "invisible") - } -} diff --git a/examples/window/window/window.cpp b/examples/window/window/window.cpp deleted file mode 100644 index c9e6e90997..0000000000 --- a/examples/window/window/window.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** 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 Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR 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 -#include -#include -#include -#include - -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/window.pro b/examples/window/window/window.pro deleted file mode 100644 index 7939773b17..0000000000 --- a/examples/window/window/window.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app -CONFIG += qt -QT += qml - -SOURCES += window.cpp -OTHER_FILES = Window.qml nogui.qml standalone.qml twowindows.qml - -target.path = $$[QT_INSTALL_EXAMPLES]/qtquick/window/window -sources.files = $$SOURCES $$OTHER_FILES window.pro -sources.path = $$target.path -INSTALLS = sources target diff --git a/qtdeclarative.pro b/qtdeclarative.pro index 2d70b15764..58c33f27ca 100644 --- a/qtdeclarative.pro +++ b/qtdeclarative.pro @@ -1,2 +1 @@ load(qt_parts) - diff --git a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc index d59a8cd827..8ed3aa8279 100644 --- a/src/qml/doc/src/cppintegration/extending-tutorial.qdoc +++ b/src/qml/doc/src/cppintegration/extending-tutorial.qdoc @@ -44,12 +44,12 @@ examples/quick/tutorials/extending directory. Tutorial chapters: \list 1 -\li \l{examples/tutorials/extending/chapter1-basics}{Creating a New Type} -\li \l{examples/tutorials/extending/chapter2-methods}{Connecting to C++ Methods and Signals} -\li \l{examples/tutorials/extending/chapter3-bindings}{Property Binding} -\li \l{examples/tutorials/extending/chapter4-customPropertyTypes}{Using Custom Property Types} -\li \l{examples/tutorials/extending/chapter5-listproperties}{Using List Property Types} -\li \l{examples/tutorials/extending/chapter6-plugins}{Writing an Extension Plugin} +\li \l{examples/quick/tutorials/extending/chapter1-basics}{Creating a New Type} +\li \l{examples/quick/tutorials/extending/chapter2-methods}{Connecting to C++ Methods and Signals} +\li \l{examples/quick/tutorials/extending/chapter3-bindings}{Property Binding} +\li \l{examples/quick/tutorials/extending/chapter4-customPropertyTypes}{Using Custom Property Types} +\li \l{examples/quick/tutorials/extending/chapter5-listproperties}{Using List Property Types} +\li \l{examples/quick/tutorials/extending/chapter6-plugins}{Writing an Extension Plugin} \li \l{qml-extending-tutorial7.html}{In Summary} \endlist @@ -64,7 +64,7 @@ and \l {qtqml-cppintegration-definetypes.html}{Defining QML Types from C++}. /*! \title Chapter 1: Creating a New Type -\example examples/tutorials/extending/chapter1-basics +\example examples/quick/tutorials/extending/chapter1-basics A common task when extending QML is to provide a new QML type that supports some custom functionality beyond what is provided by the built-in \l {Qt Quick QML Types}{QtQuick types}. @@ -104,7 +104,7 @@ this new class must: Here is our \c PieChart class, defined in \c piechart.h: -\snippet examples/tutorials/extending/chapter1-basics/piechart.h 0 +\snippet examples/quick/tutorials/extending/chapter1-basics/piechart.h 0 The class inherits from QQuickPaintedItem because we want to override QQuickPaintedItem::paint() in perform drawing operations with the QPainter API. @@ -120,15 +120,15 @@ simply sets and returns the \c m_name and \c m_color values as appropriate, and implements \c paint() to draw a simple pie chart. It also turns off the QGraphicsItem::ItemHasNoContents flag to enable painting: -\snippet examples/tutorials/extending/chapter1-basics/piechart.cpp 0 +\snippet examples/quick/tutorials/extending/chapter1-basics/piechart.cpp 0 \dots 0 -\snippet examples/tutorials/extending/chapter1-basics/piechart.cpp 1 +\snippet examples/quick/tutorials/extending/chapter1-basics/piechart.cpp 1 Now that we have defined the \c PieChart type, we will use it from QML. The \c app.qml file creates a \c PieChart item and display the pie chart's details using a standard QML \l Text item: -\snippet examples/tutorials/extending/chapter1-basics/app.qml 0 +\snippet examples/quick/tutorials/extending/chapter1-basics/app.qml 0 Notice that although the color is specified as a string in QML, it is automatically converted to a QColor object for the PieChart \c color property. Automatic conversions are @@ -142,46 +142,46 @@ you don't register the type, \c app.qml won't be able to create a \c PieChart. Here is the application \c main.cpp: -\snippet examples/tutorials/extending/chapter1-basics/main.cpp 0 +\snippet examples/quick/tutorials/extending/chapter1-basics/main.cpp 0 This call to qmlRegisterType() registers the \c PieChart type as a type called "PieChart", in a type namespace called "Charts", with a version of 1.0. Lastly, we write a \c .pro project file that includes the files and the \c declarative library: -\quotefile examples/tutorials/extending/chapter1-basics/chapter1-basics.pro +\quotefile examples/quick/tutorials/extending/chapter1-basics/chapter1-basics.pro Now we can build and run the application: \image extending-tutorial-chapter1.png -Try it yourself with the code in Qt's \c examples/tutorials/extending/chapter1-basics directory. +Try it yourself with the code in Qt's \c examples/quick/tutorials/extending/chapter1-basics directory. */ /*! \title Chapter 2: Connecting to C++ Methods and Signals -\example examples/tutorials/extending/chapter2-methods +\example examples/quick/tutorials/extending/chapter2-methods Suppose we want \c PieChart to have a "clearChart()" method that erases the chart and then emits a "chartCleared" signal. Our \c app.qml would be able to call \c clearChart() and receive \c chartCleared() signals like this: -\snippet examples/tutorials/extending/chapter2-methods/app.qml 0 +\snippet examples/quick/tutorials/extending/chapter2-methods/app.qml 0 \image extending-tutorial-chapter2.png To do this, we add a \c clearChart() method and a \c chartCleared() signal to our C++ class: -\snippet examples/tutorials/extending/chapter2-methods/piechart.h 0 +\snippet examples/quick/tutorials/extending/chapter2-methods/piechart.h 0 \dots -\snippet examples/tutorials/extending/chapter2-methods/piechart.h 1 +\snippet examples/quick/tutorials/extending/chapter2-methods/piechart.h 1 \dots -\snippet examples/tutorials/extending/chapter2-methods/piechart.h 2 +\snippet examples/quick/tutorials/extending/chapter2-methods/piechart.h 2 \dots -\snippet examples/tutorials/extending/chapter2-methods/piechart.h 3 +\snippet examples/quick/tutorials/extending/chapter2-methods/piechart.h 3 The use of Q_INVOKABLE makes the \c clearChart() method available to the Qt Meta-Object system, and in turn, to QML. Note that it could have @@ -191,7 +191,7 @@ slots are also callable from QML. Both of these approaches are valid. The \c clearChart() method simply changes the color to Qt::transparent, repaints the chart, then emits the \c chartCleared() signal: -\snippet examples/tutorials/extending/chapter2-methods/piechart.cpp 0 +\snippet examples/quick/tutorials/extending/chapter2-methods/piechart.cpp 0 Now when we run the application and click the window, the pie chart disappears, and the application outputs: @@ -200,14 +200,14 @@ disappears, and the application outputs: The chart has been cleared \endcode -Try out the example yourself with the updated code in Qt's \c examples/tutorials/extending/chapter2-methods directory. +Try out the example yourself with the updated code in Qt's \c examples/quick/tutorials/extending/chapter2-methods directory. */ /*! \title Chapter 3: Adding Property Bindings -\example examples/tutorials/extending/chapter3-bindings +\example examples/quick/tutorials/extending/chapter3-bindings Property binding is a powerful feature of QML that allows values of different elements to be synchronized automatically. It uses signals to notify and update @@ -216,7 +216,7 @@ other elements' values when property values are changed. Let's enable property bindings for the \c color property. That means if we have code like this: -\snippet examples/tutorials/extending/chapter3-bindings/app.qml 0 +\snippet examples/quick/tutorials/extending/chapter3-bindings/app.qml 0 \image extending-tutorial-chapter3.png @@ -231,17 +231,17 @@ It's easy to enable property binding for the \c color property. We add a \l{Qt's Property System}{NOTIFY} feature to its Q_PROPERTY() declaration to indicate that a "colorChanged" signal is emitted whenever the value changes. -\snippet examples/tutorials/extending/chapter3-bindings/piechart.h 0 +\snippet examples/quick/tutorials/extending/chapter3-bindings/piechart.h 0 \dots -\snippet examples/tutorials/extending/chapter3-bindings/piechart.h 1 +\snippet examples/quick/tutorials/extending/chapter3-bindings/piechart.h 1 \dots -\snippet examples/tutorials/extending/chapter3-bindings/piechart.h 2 +\snippet examples/quick/tutorials/extending/chapter3-bindings/piechart.h 2 \dots -\snippet examples/tutorials/extending/chapter3-bindings/piechart.h 3 +\snippet examples/quick/tutorials/extending/chapter3-bindings/piechart.h 3 Then, we emit this signal in \c setPieSlice(): -\snippet examples/tutorials/extending/chapter3-bindings/piechart.cpp 0 +\snippet examples/quick/tutorials/extending/chapter3-bindings/piechart.cpp 0 It's important for \c setColor() to check that the color value has actually changed before emitting \c colorChanged(). This ensures the signal is not emitted unnecessarily and @@ -259,7 +259,7 @@ custom QML types may see unexpected behavior if bindings are not implemented. /*! \title Chapter 4: Using Custom Property Types -\example examples/tutorials/extending/chapter4-customPropertyTypes +\example examples/quick/tutorials/extending/chapter4-customPropertyTypes The \c PieChart type currently has a string-type property and a color-type property. It could have many other types of properties. For example, it could have an @@ -299,43 +299,43 @@ For example, let's replace the use of the \c property with a type called "PieSlice" that has a \c color property. Instead of assigning a color, we assign an \c PieSlice value which itself contains a \c color: -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/app.qml 0 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/app.qml 0 Like \c PieChart, this new \c PieSlice type inherits from QQuickPaintedItem and declares its properties with Q_PROPERTY(): -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/pieslice.h 0 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/pieslice.h 0 To use it in \c PieChart, we modify the \c color property declaration and associated method signatures: -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h 0 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 0 \dots -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h 1 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 1 \dots -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h 2 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 2 \dots -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/piechart.h 3 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.h 3 There is one thing to be aware of when implementing \c setPieSlice(). The \c PieSlice is a visual item, so it must be set as a child of the \c PieChart using QQuickItem::setParentItem() so that the \c PieChart knows to paint this child item when its contents are drawn: -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp 0 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp 0 Like the \c PieChart type, the \c PieSlice type has to be registered using qmlRegisterType() to be used from QML. As with \c PieChart, we'll add the type to the "Charts" type namespace, version 1.0: -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/main.cpp 0 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 0 \dots -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/main.cpp 1 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 1 \dots -\snippet examples/tutorials/extending/chapter4-customPropertyTypes/main.cpp 2 +\snippet examples/quick/tutorials/extending/chapter4-customPropertyTypes/main.cpp 2 -Try it out with the code in Qt's \c examples/tutorials/extending/chapter4-customPropertyTypes directory. +Try it out with the code in Qt's \c examples/quick/tutorials/extending/chapter4-customPropertyTypes directory. */ @@ -343,13 +343,13 @@ Try it out with the code in Qt's \c examples/tutorials/extending/chapter4-custom /*! \title Chapter 5: Using List Property Types -\example examples/tutorials/extending/chapter5-listproperties +\example examples/quick/tutorials/extending/chapter5-listproperties Right now, a \c PieChart can only have one \c PieSlice. Ideally a chart would have multiple slices, with different colors and sizes. To do this, we could have a \c slices property that accepts a list of \c PieSlice items: -\snippet examples/tutorials/extending/chapter5-listproperties/app.qml 0 +\snippet examples/quick/tutorials/extending/chapter5-listproperties/app.qml 0 \image extending-tutorial-chapter5.png @@ -360,11 +360,11 @@ function with a \c slices() function that returns a list of slices, and add an internal \c append_slice() function (discussed below). We also use a QList to store the internal list of slices as \c m_slices: -\snippet examples/tutorials/extending/chapter5-listproperties/piechart.h 0 +\snippet examples/quick/tutorials/extending/chapter5-listproperties/piechart.h 0 \dots -\snippet examples/tutorials/extending/chapter5-listproperties/piechart.h 1 +\snippet examples/quick/tutorials/extending/chapter5-listproperties/piechart.h 1 \dots -\snippet examples/tutorials/extending/chapter5-listproperties/piechart.h 2 +\snippet examples/quick/tutorials/extending/chapter5-listproperties/piechart.h 2 Although the \c slices property does not have an associated \c WRITE function, it is still modifiable because of the way QQmlListProperty works. @@ -373,7 +373,7 @@ return a QQmlListProperty value and indicate that the internal \c PieChart::append_slice() function is to be called whenever a request is made from QML to add items to the list: -\snippet examples/tutorials/extending/chapter5-listproperties/piechart.cpp 0 +\snippet examples/quick/tutorials/extending/chapter5-listproperties/piechart.cpp 0 The \c append_slice() function simply sets the parent item as before, and adds the new item to the \c m_slices list. As you can see, the append function for a @@ -384,7 +384,7 @@ The \c PieSlice class has also been modified to include \c fromAngle and \c angl properties and to draw the slice according to these values. This is a straightforward modification if you have read the previous pages in this tutorial, so the code is not shown here. -The complete code can be seen in the updated \c examples/tutorials/extending/chapter5-listproperties directory. +The complete code can be seen in the updated \c examples/quick/tutorials/extending/chapter5-listproperties directory. */ @@ -392,7 +392,7 @@ The complete code can be seen in the updated \c examples/tutorials/extending/cha /*! \title Chapter 6: Writing an Extension Plugin -\example examples/tutorials/extending/chapter6-plugins +\example examples/quick/tutorials/extending/chapter6-plugins Currently the \c PieChart and \c PieSlice types are used by \c app.qml, which is displayed using a QQuickView in a C++ application. An alternative @@ -407,22 +407,22 @@ and registers our QML types in the inherited \l{QQmlExtensionPlugin::}{registerT Here is the \c ChartsPlugin definition in \c chartsplugin.h: -\snippet examples/tutorials/extending/chapter6-plugins/chartsplugin.h 0 +\snippet examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.h 0 And its implementation in \c chartsplugin.cpp: -\snippet examples/tutorials/extending/chapter6-plugins/chartsplugin.cpp 0 +\snippet examples/quick/tutorials/extending/chapter6-plugins/chartsplugin.cpp 0 Then, we write a \c .pro project file that defines the project as a plugin library and specifies with DESTDIR that library files should be built into a "lib" subdirectory: -\quotefile examples/tutorials/extending/chapter6-plugins/chapter6-plugins.pro +\quotefile examples/quick/tutorials/extending/chapter6-plugins/chapter6-plugins.pro Finally, we add a \l{qtqml-modules-qmldir.html}{qmldir} file that is parsed by the QML engine. In this file, we specify that a plugin named "chapter6-plugin" (the name of the example project) can be found in the "lib" subdirectory: -\quotefile examples/tutorials/extending/chapter6-plugins/Charts/qmldir +\quotefile examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir Now we have a plugin, and instead of having a main.cpp and an executable, we can build the project and then load the QML file using the \l{Prototyping with qmlscene}{qmlscene tool}, diff --git a/src/quick/doc/src/advtutorial.qdoc b/src/quick/doc/src/advtutorial.qdoc index f5b3e8b7db..d4468d1a6f 100644 --- a/src/quick/doc/src/advtutorial.qdoc +++ b/src/quick/doc/src/advtutorial.qdoc @@ -59,7 +59,7 @@ Tutorial chapters: \li \l {tutorials/samegame/samegame4}{Finishing Touches} \endlist -All the code in this tutorial can be found in Qt's \c examples/tutorials/samegame +All the code in this tutorial can be found in Qt's \c examples/quick/tutorials/samegame directory. */ diff --git a/src/quick/doc/src/dynamicview-tutorial.qdoc b/src/quick/doc/src/dynamicview-tutorial.qdoc index 0b5f2b4f60..3edfdc65c0 100644 --- a/src/quick/doc/src/dynamicview-tutorial.qdoc +++ b/src/quick/doc/src/dynamicview-tutorial.qdoc @@ -45,7 +45,7 @@ Tutorial chapters: \li \l {tutorials/dynamicview/dynamicview4}{Sorting Items} \endlist -All the code in this tutorial can be found in Qt's \c examples/tutorials/dynamicview +All the code in this tutorial can be found in Qt's \c examples/quick/tutorials/dynamicview directory. */ @@ -139,7 +139,7 @@ so that is above other items in the stacking order and isn't obscured as it is d \previouspage QML Dynamic View Ordering Tutorial 2 - Dragging View Items \nextpage QML Dynamic View Ordering Tutorial 4 - Sorting Items -\example examples/tutorials/dynamicview/dynamicview3 +\example examples/quick/tutorials/dynamicview/dynamicview3 The next step in our application to move items within the list as they're dragged so that we can re-order the list. To achieve this we introduce three new elements to our application; diff --git a/src/quick/doc/src/tutorial.qdoc b/src/quick/doc/src/tutorial.qdoc index 67951b0abd..619f754696 100644 --- a/src/quick/doc/src/tutorial.qdoc +++ b/src/quick/doc/src/tutorial.qdoc @@ -41,7 +41,7 @@ with properties and signals, and we will create a simple animation with the help Chapter one starts with a minimal "Hello world" program and the following chapters introduce new concepts. -The tutorial's source code is located in the \c{examples/tutorials/helloworld} directory. +The tutorial's source code is located in the \c{examples/quick/tutorials/helloworld} directory. Tutorial chapters: -- cgit v1.2.3