summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--unix/tclLoadShl.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 9a9b0d2..2a35182 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2001-04-09 Kevin B. Kenny <kennykb@acm.org>
+ * unix/tclLoadShl.c: Added DYNAMIC_PATH to the load flags so that
+ the SHLIB_PATH will be searched for other libraries. [Bug #219140]
+
+2001-04-09 Kevin B. Kenny <kennykb@acm.org>
+
* unix/tcl.m4: Added _REENTRANT to Solaris build so that thread
safe library routines are included.
* unix/configure: Re-ran 'autoconf' with changed tcl.m4
diff --git a/unix/tclLoadShl.c b/unix/tclLoadShl.c
index 3330919..0623986 100644
--- a/unix/tclLoadShl.c
+++ b/unix/tclLoadShl.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclLoadShl.c,v 1.3 1999/04/16 00:48:04 stanton Exp $
+ * RCS: @(#) $Id: tclLoadShl.c,v 1.4 2001/04/09 23:09:58 kennykb Exp $
*/
#include <dl.h>
@@ -73,7 +73,9 @@ TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr)
* when they are build."
*/
- handle = shl_load(fileName, BIND_DEFERRED|BIND_VERBOSE, 0L);
+ handle = shl_load(fileName,
+ BIND_DEFERRED|BIND_VERBOSE|DYNAMIC_PATH,
+ 0L);
if (handle == NULL) {
Tcl_AppendResult(interp, "couldn't load file \"", fileName,
"\": ", Tcl_PosixError(interp), (char *) NULL);
href='/oss-git/Qt.git/diff/doc/src/declarative/pics/spacing_b.png?id=2366667fc97eb6a56203b2dd7dac776ff4164abd'>doc/src/declarative/pics/spacing_b.pngbin0 -> 462 bytes-rw-r--r--doc/src/declarative/pics/trivialListView.pngbin0 -> 2387 bytes-rw-r--r--doc/src/declarative/pics/verticalLayout_example.pngbin0 -> 385 bytes-rw-r--r--doc/src/declarative/pics/verticalLayout_transition.gifbin0 -> 12641 bytes-rw-r--r--doc/src/declarative/pics/webview.pngbin0 -> 126662 bytes-rw-r--r--doc/src/declarative/qmlforcpp.qdoc999
-rw-r--r--doc/src/declarative/qtprogrammers.qdoc121
-rw-r--r--doc/src/declarative/scenegraph.qdoc13
-rw-r--r--doc/src/declarative/tutorial.qdoc19
-rw-r--r--doc/src/declarative/tutorial1.qdoc55
-rw-r--r--doc/src/declarative/tutorial2.qdoc94
-rw-r--r--doc/src/declarative/tutorial3.qdoc83
-rw-r--r--doc/src/diagrams/programs/easingcurve/easingcurve.pro13
-rw-r--r--doc/src/diagrams/programs/easingcurve/main.cpp90
-rw-r--r--doc/src/duiviewer.qdoc80
-rw-r--r--doc/src/examples.qdoc6
-rw-r--r--doc/src/examples/trafficlight.qdoc58
-rw-r--r--doc/src/external-resources.qdoc10
-rw-r--r--doc/src/groups.qdoc23
-rw-r--r--doc/src/images/declarative-anchors_example.pngbin0 -> 3654 bytes-rw-r--r--doc/src/images/declarative-anchors_example2.pngbin0 -> 3819 bytes-rw-r--r--doc/src/images/declarative-image_tile.pngbin0 -> 396 bytes-rw-r--r--doc/src/images/declarative-item_opacity1.pngbin0 -> 464 bytes-rw-r--r--doc/src/images/declarative-item_opacity2.pngbin0 -> 464 bytes-rw-r--r--doc/src/images/declarative-item_stacking1.pngbin0 -> 460 bytes-rw-r--r--doc/src/images/declarative-item_stacking2.pngbin0 -> 461 bytes-rw-r--r--doc/src/images/declarative-item_stacking3.pngbin0 -> 464 bytes-rw-r--r--doc/src/images/declarative-item_stacking4.pngbin0 -> 463 bytes-rw-r--r--doc/src/images/declarative-qtlogo1.pngbin0 -> 3436 bytes-rw-r--r--doc/src/images/declarative-qtlogo2.pngbin0 -> 11023 bytes-rw-r--r--doc/src/images/declarative-qtlogo3.pngbin0 -> 5848 bytes-rw-r--r--doc/src/images/declarative-qtlogo4.pngbin0 -> 11241 bytes-rw-r--r--doc/src/images/declarative-rect.pngbin0 -> 674 bytes-rw-r--r--doc/src/images/declarative-rect_gradient.pngbin0 -> 873 bytes-rw-r--r--doc/src/images/declarative-rect_tint.pngbin0 -> 363 bytes-rw-r--r--doc/src/images/declarative-rotation.pngbin0 -> 645 bytes-rw-r--r--doc/src/images/declarative-scale.pngbin0 -> 336 bytes-rw-r--r--doc/src/images/declarative-scalegrid.pngbin0 -> 4228 bytes-rw-r--r--doc/src/images/declarative-text.pngbin0 -> 3289 bytes-rw-r--r--doc/src/images/declarative-textedit.gifbin0 -> 15286 bytes-rw-r--r--doc/src/images/declarative-textformat.pngbin0 -> 11498 bytes-rw-r--r--doc/src/images/declarative-textstyle.pngbin0 -> 6825 bytes-rw-r--r--doc/src/images/declarative-transformorigin.pngbin0 -> 17468 bytes-rw-r--r--doc/src/images/declarative-tutorial1.pngbin0 -> 3416 bytes-rw-r--r--doc/src/images/declarative-tutorial2.pngbin0 -> 3145 bytes-rw-r--r--doc/src/images/declarative-tutorial3_animation.gifbin0 -> 42486 bytes-rw-r--r--doc/src/images/qeasingcurve-cosinecurve.pngbin0 -> 2544 bytes-rw-r--r--doc/src/images/qeasingcurve-inback.pngbin0 -> 2225 bytes-rw-r--r--doc/src/images/qeasingcurve-inbounce.pngbin0 -> 2378 bytes-rw-r--r--doc/src/images/qeasingcurve-incirc.pngbin0 -> 2138 bytes-rw-r--r--doc/src/images/qeasingcurve-incubic.pngbin0 -> 2230 bytes-rw-r--r--doc/src/images/qeasingcurve-incurve.pngbin0 -> 2325 bytes-rw-r--r--doc/src/images/qeasingcurve-inelastic.pngbin0 -> 2314 bytes-rw-r--r--doc/src/images/qeasingcurve-inexpo.pngbin0 -> 2183 bytes-rw-r--r--doc/src/images/qeasingcurve-inoutback.pngbin0 -> 2460 bytes-rw-r--r--doc/src/images/qeasingcurve-inoutbounce.pngbin0 -> 2522 bytes-rw-r--r--doc/src/images/qeasingcurve-inoutcirc.pngbin0 -> 2352 bytes-rw-r--r--doc/src/images/qeasingcurve-inoutcubic.pngbin0 -> 2410 bytes-rw-r--r--doc/src/images/qeasingcurve-inoutelastic.pngbin0 -> 2485 bytes-rw-r--r--doc/src/images/qeasingcurve-inoutexpo.pngbin0 -> 2383 bytes-rw-r--r--doc/src/images/qeasingcurve-inoutquad.pngbin0 -> 2392 bytes-rw-r--r--doc/src/images/qeasingcurve-inoutquart.pngbin0 -> 2331 bytes-rw-r--r--doc/src/images/qeasingcurve-inoutquint.pngbin0 -> 2244 bytes-rw-r--r--doc/src/images/qeasingcurve-inoutsine.pngbin0 -> 2405 bytes-rw-r--r--doc/src/images/qeasingcurve-inquad.pngbin0 -> 2283 bytes-rw-r--r--doc/src/images/qeasingcurve-inquart.pngbin0 -> 2261 bytes-rw-r--r--doc/src/images/qeasingcurve-inquint.pngbin0 -> 2178 bytes-rw-r--r--doc/src/images/qeasingcurve-insine.pngbin0 -> 2167 bytes-rw-r--r--doc/src/images/qeasingcurve-linear.pngbin0 -> 2165 bytes-rw-r--r--doc/src/images/qeasingcurve-outback.pngbin0 -> 2371 bytes-rw-r--r--doc/src/images/qeasingcurve-outbounce.pngbin0 -> 2481 bytes-rw-r--r--doc/src/images/qeasingcurve-outcirc.pngbin0 -> 2269 bytes-rw-r--r--doc/src/images/qeasingcurve-outcubic.pngbin0 -> 2336 bytes-rw-r--r--doc/src/images/qeasingcurve-outcurve.pngbin0 -> 2389 bytes-rw-r--r--doc/src/images/qeasingcurve-outelastic.pngbin0 -> 2402 bytes-rw-r--r--doc/src/images/qeasingcurve-outexpo.pngbin0 -> 2299 bytes-rw-r--r--doc/src/images/qeasingcurve-outinback.pngbin0 -> 2400 bytes-rw-r--r--doc/src/images/qeasingcurve-outinbounce.pngbin0 -> 2568 bytes-rw-r--r--doc/src/images/qeasingcurve-outincirc.pngbin0 -> 2339 bytes-rw-r--r--doc/src/images/qeasingcurve-outincubic.pngbin0 -> 2393 bytes-rw-r--r--doc/src/images/qeasingcurve-outinelastic.pngbin0 -> 2517 bytes-rw-r--r--doc/src/images/qeasingcurve-outinexpo.pngbin0 -> 2377 bytes-rw-r--r--doc/src/images/qeasingcurve-outinquad.pngbin0 -> 2380 bytes-rw-r--r--doc/src/images/qeasingcurve-outinquart.pngbin0 -> 2319 bytes-rw-r--r--doc/src/images/qeasingcurve-outinquint.pngbin0 -> 2248 bytes-rw-r--r--doc/src/images/qeasingcurve-outinsine.pngbin0 -> 2388 bytes-rw-r--r--doc/src/images/qeasingcurve-outquad.pngbin0 -> 2324 bytes-rw-r--r--doc/src/images/qeasingcurve-outquart.pngbin0 -> 2304 bytes-rw-r--r--doc/src/images/qeasingcurve-outquint.pngbin0 -> 2242 bytes-rw-r--r--doc/src/images/qeasingcurve-outsine.pngbin0 -> 2364 bytes-rw-r--r--doc/src/images/qeasingcurve-sinecurve.pngbin0 -> 2470 bytes-rw-r--r--doc/src/images/statemachine-button-history.pngbin0 -> 91677 bytes-rw-r--r--doc/src/images/statemachine-button-nested.pngbin0 -> 73774 bytes-rw-r--r--doc/src/images/statemachine-button.pngbin0 -> 32767 bytes-rw-r--r--doc/src/images/statemachine-finished.pngbin0 -> 37907 bytes-rw-r--r--doc/src/images/statemachine-nonparallel.pngbin0 -> 68482 bytes-rw-r--r--doc/src/images/statemachine-parallel.pngbin0 -> 99587 bytes-rw-r--r--doc/src/images/trafficlight-example.pngbin0 -> 5325 bytes-rw-r--r--doc/src/index.qdoc1
-rw-r--r--doc/src/snippets/code/src_corelib_tools_qeasingcurve.cpp4
-rw-r--r--doc/src/statemachine.qdoc272
-rw-r--r--examples/animation/animatedtiles/animatedtiles.pro2
-rw-r--r--examples/animation/animatedtiles/animatedtiles.qrc11
-rw-r--r--examples/animation/animatedtiles/images/Time-For-Lunch-2.jpgbin0 -> 32471 bytes-rw-r--r--examples/animation/animatedtiles/images/centered.pngbin0 -> 892 bytes-rw-r--r--examples/animation/animatedtiles/images/ellipse.pngbin0 -> 10767 bytes-rw-r--r--examples/animation/animatedtiles/images/figure8.pngbin0 -> 14050 bytes-rw-r--r--examples/animation/animatedtiles/images/kinetic.pngbin0 -> 6776 bytes-rw-r--r--examples/animation/animatedtiles/images/random.pngbin0 -> 14969 bytes-rw-r--r--examples/animation/animatedtiles/images/tile.pngbin0 -> 16337 bytes-rw-r--r--examples/animation/animatedtiles/main.cpp242
-rw-r--r--examples/animation/animation.pro21
-rw-r--r--examples/animation/appchooser/accessories-dictionary.pngbin0 -> 5396 bytes-rw-r--r--examples/animation/appchooser/akregator.pngbin0 -> 4873 bytes-rw-r--r--examples/animation/appchooser/appchooser.pro9
-rw-r--r--examples/animation/appchooser/appchooser.qrc8
-rw-r--r--examples/animation/appchooser/digikam.pngbin0 -> 3334 bytes-rw-r--r--examples/animation/appchooser/k3b.pngbin0 -> 8220 bytes-rw-r--r--examples/animation/appchooser/main.cpp124
-rw-r--r--examples/animation/easing/animation.h75
-rw-r--r--examples/animation/easing/easing.pro16
-rw-r--r--examples/animation/easing/form.ui201
-rw-r--r--examples/animation/easing/images/qt-logo.pngbin0 -> 5149 bytes-rw-r--r--examples/animation/easing/main.cpp22
-rw-r--r--examples/animation/easing/resources.qrc5
-rw-r--r--examples/animation/easing/window.cpp133
-rw-r--r--examples/animation/easing/window.h49
-rw-r--r--examples/animation/example/example.pro12
-rw-r--r--examples/animation/example/main.cpp23
-rw-r--r--examples/animation/example/mainwindow.cpp220
-rw-r--r--examples/animation/example/mainwindow.h45
-rw-r--r--examples/animation/moveblocks/main.cpp274
-rw-r--r--examples/animation/moveblocks/moveblocks.pro8
-rw-r--r--examples/animation/padnavigator-ng/backside.ui208
-rw-r--r--examples/animation/padnavigator-ng/images/artsfftscope.pngbin0 -> 1294 bytes-rw-r--r--examples/animation/padnavigator-ng/images/blue_angle_swirl.jpgbin0 -> 11826 bytes-rw-r--r--examples/animation/padnavigator-ng/images/kontact_contacts.pngbin0 -> 4382 bytes-rw-r--r--examples/animation/padnavigator-ng/images/kontact_journal.pngbin0 -> 3261 bytes-rw-r--r--examples/animation/padnavigator-ng/images/kontact_mail.pngbin0 -> 3202 bytes-rw-r--r--examples/animation/padnavigator-ng/images/kontact_notes.pngbin0 -> 3893 bytes-rw-r--r--examples/animation/padnavigator-ng/images/kopeteavailable.pngbin0 -> 2380 bytes-rw-r--r--examples/animation/padnavigator-ng/images/metacontact_online.pngbin0 -> 2545 bytes-rw-r--r--examples/animation/padnavigator-ng/images/minitools.pngbin0 -> 2087 bytes-rw-r--r--examples/animation/padnavigator-ng/main.cpp24
-rw-r--r--examples/animation/padnavigator-ng/padnavigator.pro24
-rw-r--r--examples/animation/padnavigator-ng/padnavigator.qrc14
-rw-r--r--examples/animation/padnavigator-ng/panel.cpp216
-rw-r--r--examples/animation/padnavigator-ng/panel.h59
-rw-r--r--examples/animation/padnavigator-ng/roundrectitem.cpp106
-rw-r--r--examples/animation/padnavigator-ng/roundrectitem.h47
-rw-r--r--examples/animation/padnavigator-ng/splashitem.cpp55
-rw-r--r--examples/animation/padnavigator-ng/splashitem.h31
-rw-r--r--examples/animation/photobrowser/main.cpp52
-rw-r--r--examples/animation/photobrowser/menu.cpp125
-rw-r--r--examples/animation/photobrowser/menu.h50
-rw-r--r--examples/animation/photobrowser/photobrowser.pro17
-rw-r--r--examples/animation/photobrowser/river.cpp561
-rw-r--r--examples/animation/photobrowser/river.h81
-rw-r--r--examples/animation/photobrowser/riveritem.cpp95
-rw-r--r--examples/animation/photobrowser/riveritem.h36
-rw-r--r--examples/animation/piemenu/main.cpp26
-rw-r--r--examples/animation/piemenu/piemenu.pro8
-rw-r--r--examples/animation/piemenu/qgraphicspiemenu.cpp220
-rw-r--r--examples/animation/piemenu/qgraphicspiemenu.h74
-rw-r--r--examples/animation/piemenu/qgraphicspiemenu_p.h48
-rw-r--r--examples/animation/piemenu/qgraphicspiemenusection_p.h58
-rw-r--r--examples/animation/piemenu/scene.cpp43
-rw-r--r--examples/animation/piemenu/scene.h30
-rw-r--r--examples/animation/research/memberfunctions/main.cpp48
-rw-r--r--examples/animation/research/memberfunctions/memberfunctions.pro16
-rw-r--r--examples/animation/research/memberfunctions/qvalueanimation.cpp73
-rw-r--r--examples/animation/research/memberfunctions/qvalueanimation.h89
-rw-r--r--examples/animation/research/memberfunctions/qvalueanimation_p.h47
-rw-r--r--examples/animation/research/propertytransform/main.cpp47
-rw-r--r--examples/animation/research/propertytransform/propertytransform.pro14
-rw-r--r--examples/animation/research/propertytransform/qpropertytransform.h78
-rw-r--r--examples/animation/research/sound/main.cpp74
-rw-r--r--examples/animation/research/sound/media/sax.mp3bin0 -> 417844 bytes-rw-r--r--examples/animation/research/sound/sound.pro14
-rw-r--r--examples/animation/research/sound/sound.qrc5
-rw-r--r--examples/animation/states/accessories-dictionary.pngbin0 -> 5396 bytes-rw-r--r--examples/animation/states/akregator.pngbin0 -> 4873 bytes-rw-r--r--examples/animation/states/digikam.pngbin0 -> 3334 bytes-rw-r--r--examples/animation/states/help-browser.pngbin0 -> 6984 bytes-rw-r--r--examples/animation/states/k3b.pngbin0 -> 8220 bytes-rw-r--r--examples/animation/states/kchart.pngbin0 -> 4887 bytes-rw-r--r--examples/animation/states/main.cpp259
-rw-r--r--examples/animation/states/states.pro8
-rw-r--r--examples/animation/states/states.qrc10
-rw-r--r--examples/animation/stickman/animation.cpp152
-rw-r--r--examples/animation/stickman/animation.h40
-rw-r--r--examples/animation/stickman/animations/chillingbin0 -> 6508 bytes-rw-r--r--examples/animation/stickman/animations/dancingbin0 -> 2348 bytes-rw-r--r--examples/animation/stickman/animations/deadbin0 -> 268 bytes-rw-r--r--examples/animation/stickman/animations/jumpingbin0 -> 1308 bytes-rw-r--r--examples/animation/stickman/graphicsview.cpp15
-rw-r--r--examples/animation/stickman/graphicsview.h19
-rw-r--r--examples/animation/stickman/lifecycle.cpp176
-rw-r--r--examples/animation/stickman/lifecycle.h40
-rw-r--r--examples/animation/stickman/main.cpp58
-rw-r--r--examples/animation/stickman/node.cpp42
-rw-r--r--examples/animation/stickman/node.h26
-rw-r--r--examples/animation/stickman/stickman.cpp299
-rw-r--r--examples/animation/stickman/stickman.h59
-rw-r--r--examples/animation/stickman/stickman.pro12
-rw-r--r--examples/animation/sub-attaq/animationmanager.cpp97
-rw-r--r--examples/animation/sub-attaq/animationmanager.h68
-rw-r--r--examples/animation/sub-attaq/boat.cpp293
-rw-r--r--examples/animation/sub-attaq/boat.h100
-rw-r--r--examples/animation/sub-attaq/boat_p.h258
-rw-r--r--examples/animation/sub-attaq/bomb.cpp132
-rw-r--r--examples/animation/sub-attaq/bomb.h81
-rw-r--r--examples/animation/sub-attaq/custompropertyanimation.cpp114
-rw-r--r--examples/animation/sub-attaq/custompropertyanimation.h117
-rw-r--r--examples/animation/sub-attaq/custompropertyanimation_p.h64
-rw-r--r--examples/animation/sub-attaq/data.xml15
-rw-r--r--examples/animation/sub-attaq/graphicsscene.cpp368
-rw-r--r--examples/animation/sub-attaq/graphicsscene.h129
-rw-r--r--examples/animation/sub-attaq/main.cpp57
-rw-r--r--examples/animation/sub-attaq/mainwindow.cpp92
-rw-r--r--examples/animation/sub-attaq/mainwindow.h63
-rw-r--r--examples/animation/sub-attaq/pics/big/background.pngbin0 -> 48858 bytes-rw-r--r--examples/animation/sub-attaq/pics/big/boat.pngbin0 -> 5198 bytes-rw-r--r--examples/animation/sub-attaq/pics/big/bomb.pngbin0 -> 760 bytes-rw-r--r--examples/animation/sub-attaq/pics/big/explosion/boat/step1.pngbin0 -> 5760 bytes-rw-r--r--examples/animation/sub-attaq/pics/big/explosion/boat/step2.pngbin0 -> 9976 bytes-rw-r--r--examples/animation/sub-attaq/pics/big/explosion/boat/step3.pngbin0 -> 12411 bytes-rw-r--r--examples/animation/sub-attaq/pics/big/explosion/boat/step4.pngbin0 -> 15438 bytes-rw-r--r--examples/animation/sub-attaq/pics/big/explosion/submarine/step1.pngbin0 -> 3354 bytes-rw-r--r--examples/animation/sub-attaq/pics/big/explosion/submarine/step2.pngbin0 -> 6205 bytes-rw-r--r--examples/animation/sub-attaq/pics/big/explosion/submarine/step3.pngbin0 -> 6678 bytes-rw-r--r--examples/animation/sub-attaq/pics/big/explosion/submarine/step4.pngbin0 -> 6666 bytes-rw-r--r--examples/animation/sub-attaq/pics/big/submarine.pngbin0 -> 3202 bytes-rw-r--r--examples/animation/sub-attaq/pics/big/surface.pngbin0 -> 575 bytes-rw-r--r--examples/animation/sub-attaq/pics/big/torpedo.pngbin0 -> 951 bytes-rw-r--r--examples/animation/sub-attaq/pics/scalable/background-n810.svg171
-rw-r--r--examples/animation/sub-attaq/pics/scalable/background.svg171
-rw-r--r--examples/animation/sub-attaq/pics/scalable/boat.svg279
-rw-r--r--examples/animation/sub-attaq/pics/scalable/bomb.svg138
-rw-r--r--examples/animation/sub-attaq/pics/scalable/sand.svg103
-rw-r--r--examples/animation/sub-attaq/pics/scalable/see.svg44
-rw-r--r--examples/animation/sub-attaq/pics/scalable/sky.svg45
-rw-r--r--examples/animation/sub-attaq/pics/scalable/sub-attaq.svg1473
-rw-r--r--examples/animation/sub-attaq/pics/scalable/submarine.svg214
-rw-r--r--examples/animation/sub-attaq/pics/scalable/surface.svg49
-rw-r--r--examples/animation/sub-attaq/pics/scalable/torpedo.svg127
-rw-r--r--examples/animation/sub-attaq/pics/small/background.pngbin0 -> 34634 bytes-rw-r--r--examples/animation/sub-attaq/pics/small/boat.pngbin0 -> 2394 bytes-rw-r--r--examples/animation/sub-attaq/pics/small/bomb.pngbin0 -> 760 bytes-rw-r--r--examples/animation/sub-attaq/pics/small/submarine.pngbin0 -> 1338 bytes-rw-r--r--examples/animation/sub-attaq/pics/small/surface.pngbin0 -> 502 bytes-rw-r--r--examples/animation/sub-attaq/pics/small/torpedo.pngbin0 -> 951 bytes-rw-r--r--examples/animation/sub-attaq/pics/welcome/logo-a.pngbin0 -> 5972 bytes-rw-r--r--examples/animation/sub-attaq/pics/welcome/logo-a2.pngbin0 -> 5969 bytes-rw-r--r--examples/animation/sub-attaq/pics/welcome/logo-b.pngbin0 -> 6869 bytes-rw-r--r--examples/animation/sub-attaq/pics/welcome/logo-dash.pngbin0 -> 2255 bytes-rw-r--r--examples/animation/sub-attaq/pics/welcome/logo-excl.pngbin0 -> 2740 bytes-rw-r--r--examples/animation/sub-attaq/pics/welcome/logo-q.pngbin0 -> 7016 bytes-rw-r--r--examples/animation/sub-attaq/pics/welcome/logo-s.pngbin0 -> 5817 bytes-rw-r--r--examples/animation/sub-attaq/pics/welcome/logo-t.pngbin0 -> 3717 bytes-rw-r--r--examples/animation/sub-attaq/pics/welcome/logo-t2.pngbin0 -> 3688 bytes-rw-r--r--examples/animation/sub-attaq/pics/welcome/logo-u.pngbin0 -> 5374 bytes-rw-r--r--examples/animation/sub-attaq/pixmapitem.cpp59
-rw-r--r--examples/animation/sub-attaq/pixmapitem.h63
-rw-r--r--examples/animation/sub-attaq/states.cpp289
-rw-r--r--examples/animation/sub-attaq/states.h158
-rw-r--r--examples/animation/sub-attaq/sub-attaq.pro36
-rw-r--r--examples/animation/sub-attaq/subattaq.qrc38
-rw-r--r--examples/animation/sub-attaq/submarine.cpp219
-rw-r--r--examples/animation/sub-attaq/submarine.h97
-rw-r--r--examples/animation/sub-attaq/submarine_p.h136
-rw-r--r--examples/animation/sub-attaq/torpedo.cpp126
-rw-r--r--examples/animation/sub-attaq/torpedo.h81
-rw-r--r--examples/declarative/animation/animation.qml28
-rw-r--r--examples/declarative/behaviours/MyRect.qml4
-rw-r--r--examples/declarative/behaviours/test.qml37
-rw-r--r--examples/declarative/connections/connections.qml9
-rw-r--r--examples/declarative/contacts/contacts.pro22
-rw-r--r--examples/declarative/contacts/contacts.qml44
-rw-r--r--examples/declarative/contacts/dummydata/contactModel.qml103
-rw-r--r--examples/declarative/contacts/main.cpp80
-rw-r--r--examples/declarative/declarative.pro4
-rw-r--r--examples/declarative/dial/DialLibrary/Dial.qml13
-rw-r--r--examples/declarative/dial/DialLibrary/background.svg385
-rw-r--r--examples/declarative/dial/DialLibrary/needle.svg26
-rw-r--r--examples/declarative/dial/DialLibrary/needle_shadow.svg30
-rw-r--r--examples/declarative/dial/DialLibrary/overlay.svg47
-rw-r--r--examples/declarative/dial/dial.qml14
-rw-r--r--examples/declarative/easing/easing.qml67
-rw-r--r--examples/declarative/follow/follow.qml35
-rw-r--r--examples/declarative/follow/pong.qml55
-rw-r--r--examples/declarative/listview/content/MediaButton.qml21
-rw-r--r--examples/declarative/listview/content/pics/button-pressed.pngbin0 -> 571 bytes-rw-r--r--examples/declarative/listview/content/pics/button.pngbin0 -> 564 bytes-rw-r--r--examples/declarative/listview/content/pics/fruit-salad.jpgbin0 -> 17952 bytes-rw-r--r--examples/declarative/listview/content/pics/hamburger.jpgbin0 -> 8572 bytes-rw-r--r--examples/declarative/listview/content/pics/lemonade.jpgbin0 -> 6645 bytes-rw-r--r--examples/declarative/listview/content/pics/pancakes.jpgbin0 -> 9163 bytes-rw-r--r--examples/declarative/listview/content/pics/vegetable-soup.jpgbin0 -> 8639 bytes-rw-r--r--examples/declarative/listview/dummydata/MyPetsModel.qml51
-rw-r--r--examples/declarative/listview/dummydata/Recipies.qml112
-rw-r--r--examples/declarative/listview/highlight.qml56
-rw-r--r--examples/declarative/listview/listview.qml81
-rw-r--r--examples/declarative/listview/recipes.qml83
-rw-r--r--examples/declarative/minehunt/Description.qml10
-rw-r--r--examples/declarative/minehunt/Explosion.qml6
-rw-r--r--examples/declarative/minehunt/main.cpp312
-rw-r--r--examples/declarative/minehunt/minehunt.pro8
-rw-r--r--examples/declarative/minehunt/minehunt.qml73
-rw-r--r--examples/declarative/minehunt/pics/No-Ones-Laughing-3.jpgbin0 -> 30730 bytes-rw-r--r--examples/declarative/minehunt/pics/bomb-color.pngbin0 -> 284 bytes-rw-r--r--examples/declarative/minehunt/pics/bomb.pngbin0 -> 535 bytes-rw-r--r--examples/declarative/minehunt/pics/cachepix-black.pngbin0 -> 1658 bytes-rw-r--r--examples/declarative/minehunt/pics/cachepix-black.sci5
-rw-r--r--examples/declarative/minehunt/pics/cachepix-boxless.pngbin0 -> 1819 bytes-rw-r--r--examples/declarative/minehunt/pics/cachepix-boxless.sci5
-rw-r--r--examples/declarative/minehunt/pics/flag-color.pngbin0 -> 219 bytes-rw-r--r--examples/declarative/minehunt/pics/flag.pngbin0 -> 196 bytes-rw-r--r--examples/declarative/minehunt/pics/frown.pngbin0 -> 1036 bytes-rw-r--r--examples/declarative/minehunt/pics/glee.pngbin0 -> 1082 bytes-rw-r--r--examples/declarative/minehunt/pics/smile.pngbin0 -> 1028 bytes-rw-r--r--examples/declarative/minehunt/pics/star.pngbin0 -> 2677 bytes-rw-r--r--examples/declarative/mouseregion/mouse.qml24
-rw-r--r--examples/declarative/namespaces/BlueStuff/Rect.qml1
-rw-r--r--examples/declarative/namespaces/Local.qml1
-rw-r--r--examples/declarative/namespaces/components.qml17
-rw-r--r--examples/declarative/namespaces/lib/Chronos/Clock.qml15
-rw-r--r--examples/declarative/namespaces/lib/Chronos/Hand.qml9
-rw-r--r--examples/declarative/namespaces/lib/Chronos/pics/clockface.pngbin0 -> 46895 bytes-rw-r--r--examples/declarative/namespaces/lib/Path/PathLabel.qml1
-rw-r--r--examples/declarative/namespaces/lib/RedStuff/Rect.qml1
-rw-r--r--examples/declarative/namespaces/lib/Wrong/Wrong.qml3
-rw-r--r--examples/declarative/namespaces/library.qml12
-rw-r--r--examples/declarative/namespaces/path.qml18
-rw-r--r--examples/declarative/namespaces/simple.qml5
-rw-r--r--examples/declarative/namespaces/wrong1.qml4
-rw-r--r--examples/declarative/scrollbar/ScrollBar.qml26
-rw-r--r--examples/declarative/scrollbar/display.qml28
-rw-r--r--examples/declarative/scrollbar/pics/niagara_falls.jpgbin0 -> 604121 bytes-rw-r--r--examples/declarative/slideswitch/Switch.qml52
-rw-r--r--examples/declarative/slideswitch/background.svg23
-rw-r--r--examples/declarative/slideswitch/display.qml3
-rw-r--r--examples/declarative/slideswitch/knob.svg867
-rw-r--r--examples/declarative/states/states.qml40
-rw-r--r--examples/declarative/states/transitions.qml68
-rw-r--r--examples/declarative/support/contact.cpp83
-rw-r--r--examples/declarative/support/contact.h141
-rw-r--r--examples/declarative/support/contactmodel.cpp159
-rw-r--r--examples/declarative/support/contactmodel.h55
-rw-r--r--examples/declarative/support/support.pro12
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1_Drawing_an_animation.qml22
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/RemoveButton1.qml4
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/RemoveButton2.qml10
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/RemoveButton3.qml23
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/RemoveButton4.qml65
-rw-r--r--examples/declarative/tutorials/contacts/1_Drawing_and_Animation/RemoveButton5.qml70
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml34
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/Contact3.qml27
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/Contact4.qml27
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/ContactField1.qml17
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/ContactField2.qml19
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/ContactField3.qml35
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/ContactField4.qml35
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/FieldText3.qml93
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/FieldText4.qml98
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/RemoveButton1.qml70
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/RemoveButton2.qml76
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/RemoveButton3.qml76
-rw-r--r--examples/declarative/tutorials/contacts/2_Reuse/RemoveButton4.qml80
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/3_Collections.qml8
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/Button.qml38
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/Contact.qml28
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/ContactField.qml35
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/ContactView1.qml22
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/ContactView2.qml62
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/ContactView3.qml67
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/FieldText.qml98
-rw-r--r--examples/declarative/tutorials/contacts/3_Collections/RemoveButton.qml80
-rw-r--r--examples/declarative/tutorials/contacts/shared/contacts.sqlitebin0 -> 12288 bytes-rw-r--r--examples/declarative/tutorials/contacts/shared/pics/cancel.pngbin0 -> 1038 bytes-rw-r--r--examples/declarative/tutorials/contacts/shared/pics/email.pngbin0 -> 977 bytes-rw-r--r--examples/declarative/tutorials/contacts/shared/pics/new.pngbin0 -> 688 bytes-rw-r--r--examples/declarative/tutorials/contacts/shared/pics/ok.pngbin0 -> 655 bytes-rw-r--r--examples/declarative/tutorials/contacts/shared/pics/phone.pngbin0 -> 624 bytes-rw-r--r--examples/declarative/tutorials/contacts/shared/pics/search.pngbin0 -> 635 bytes-rw-r--r--examples/declarative/tutorials/contacts/shared/pics/trash.pngbin0 -> 989 bytes-rw-r--r--examples/declarative/tutorials/contacts/t8/Button.qml33
-rw-r--r--examples/declarative/tutorials/contacts/t8/Contact.qml80
-rw-r--r--examples/declarative/tutorials/contacts/t8/Field.qml54
-rw-r--r--examples/declarative/tutorials/contacts/t8/FieldRemover.qml57
-rw-r--r--examples/declarative/tutorials/contacts/t8/FieldText.qml89
-rw-r--r--examples/declarative/tutorials/contacts/t8/SearchBar.qml16
-rw-r--r--examples/declarative/tutorials/contacts/t8/contacts.qml133
-rw-r--r--examples/declarative/tutorials/t1/tutorial1.qml3
-rw-r--r--examples/declarative/tutorials/t2/Cell.qml7
-rw-r--r--examples/declarative/tutorials/t2/tutorial2.qml11
-rw-r--r--examples/declarative/tutorials/t3/Cell.qml7
-rw-r--r--examples/declarative/tutorials/t3/tutorial3.qml27
-rw-r--r--examples/declarative/velocity/Day.qml41
-rw-r--r--examples/declarative/velocity/cork.jpgbin0 -> 88766 bytes-rw-r--r--examples/declarative/velocity/sticky.pngbin0 -> 15319 bytes-rw-r--r--examples/declarative/velocity/tack.pngbin0 -> 7282 bytes-rw-r--r--examples/declarative/velocity/velocity.qml81
-rw-r--r--examples/declarative/webview/autosize.qml42
-rw-r--r--examples/declarative/webview/content/SpinSquare.qml12
-rw-r--r--examples/declarative/webview/inline-html.qml13
-rw-r--r--examples/declarative/webview/inline-xhtml.qml14
-rw-r--r--examples/declarative/webview/qml-in-html.qml20
-rw-r--r--examples/declarative/webview/transparent.qml6
-rw-r--r--examples/declarative/xmldata/daringfireball.qml25
-rw-r--r--examples/declarative/xmldata/yahoonews.qml38
-rw-r--r--examples/examples.pro3
-rw-r--r--examples/opengl/hellogl_es2/glwidget.cpp391
-rw-r--r--examples/opengl/hellogl_es2/glwidget.h31
-rw-r--r--examples/statemachine/README36
-rw-r--r--examples/statemachine/citizenquartz/citizenquartz.pro20
-rw-r--r--examples/statemachine/citizenquartz/citizenquartz.qrc5
-rw-r--r--examples/statemachine/citizenquartz/clock.cpp382
-rw-r--r--examples/statemachine/citizenquartz/clock.h60
-rw-r--r--examples/statemachine/citizenquartz/clockbutton.cpp39
-rw-r--r--examples/statemachine/citizenquartz/clockbutton.h25
-rw-r--r--examples/statemachine/citizenquartz/clockdisplay.cpp140
-rw-r--r--examples/statemachine/citizenquartz/clockdisplay.h75
-rw-r--r--examples/statemachine/citizenquartz/images/alarm.pngbin0 -> 434 bytes-rw-r--r--examples/statemachine/citizenquartz/main.cpp23
-rw-r--r--examples/statemachine/citizenquartz/propertyaddstate.cpp46
-rw-r--r--examples/statemachine/citizenquartz/propertyaddstate.h33
-rw-r--r--examples/statemachine/citizenquartz/sound/alarm.wavbin0 -> 3238264 bytes-rw-r--r--examples/statemachine/citizenquartz/timeperiod.h84
-rw-r--r--examples/statemachine/clockticking/clockticking.pro10
-rw-r--r--examples/statemachine/clockticking/main.cpp101
-rw-r--r--examples/statemachine/composition/composition.pro7
-rw-r--r--examples/statemachine/composition/main.cpp74
-rw-r--r--examples/statemachine/eventtransitions/eventtransitions.pro7
-rw-r--r--examples/statemachine/eventtransitions/main.cpp72
-rw-r--r--examples/statemachine/factorial/factorial.pro10
-rw-r--r--examples/statemachine/factorial/main.cpp140
-rw-r--r--examples/statemachine/helloworld/helloworld.pro10
-rw-r--r--examples/statemachine/helloworld/main.cpp48
-rw-r--r--examples/statemachine/pauseandresume/main.cpp72
-rw-r--r--examples/statemachine/pauseandresume/pauseandresume.pro7
-rw-r--r--examples/statemachine/pingpong/main.cpp112
-rw-r--r--examples/statemachine/pingpong/pingpong.pro10
-rw-r--r--examples/statemachine/statemachine.pro17
-rw-r--r--examples/statemachine/trafficlight/main.cpp158
-rw-r--r--examples/statemachine/trafficlight/trafficlight.pro12
-rw-r--r--examples/statemachine/twowaybutton/main.cpp48
-rw-r--r--examples/statemachine/twowaybutton/twowaybutton.pro7
-rw-r--r--mkspecs/features/qt.prf4
-rw-r--r--mkspecs/linux-g++-x11egl/qmake.conf23
-rw-r--r--mkspecs/linux-g++-x11egl/qplatformdefs.h134
-rw-r--r--mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf20
-rw-r--r--mkspecs/qws/linux-arm-gnueabi-g++/qplatformdefs.h42
-rw-r--r--mkspecs/win32-icc/qmake.conf2
-rw-r--r--src/3rdparty/easing/easing.cpp669
-rw-r--r--src/3rdparty/easing/legal.qdoc35
-rw-r--r--src/corelib/animation/animation.pri25
-rw-r--r--src/corelib/animation/qabstractanimation.cpp757
-rw-r--r--src/corelib/animation/qabstractanimation.h141
-rw-r--r--src/corelib/animation/qabstractanimation_p.h141
-rw-r--r--src/corelib/animation/qanimationgroup.cpp274
-rw-r--r--src/corelib/animation/qanimationgroup.h92
-rw-r--r--src/corelib/animation/qanimationgroup_p.h79
-rw-r--r--src/corelib/animation/qparallelanimationgroup.cpp298
-rw-r--r--src/corelib/animation/qparallelanimationgroup.h90
-rw-r--r--src/corelib/animation/qparallelanimationgroup_p.h85
-rw-r--r--src/corelib/animation/qpauseanimation.cpp139
-rw-r--r--src/corelib/animation/qpauseanimation.h88
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp256
-rw-r--r--src/corelib/animation/qpropertyanimation.h94
-rw-r--r--src/corelib/animation/qpropertyanimation_p.h89
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp572
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.h100
-rw-r--r--src/corelib/animation/qsequentialanimationgroup_p.h111
-rw-r--r--src/corelib/animation/qvariantanimation.cpp599
-rw-r--r--src/corelib/animation/qvariantanimation.h136
-rw-r--r--src/corelib/animation/qvariantanimation_p.h143
-rw-r--r--src/corelib/arch/qatomic_bootstrap.h14
-rw-r--r--src/corelib/corelib.pro2
-rw-r--r--src/corelib/global/qglobal.h29
-rw-r--r--src/corelib/kernel/kernel.pri18
-rw-r--r--src/corelib/kernel/qabstractitemmodel.cpp31
-rw-r--r--src/corelib/kernel/qabstractitemmodel.h3
-rw-r--r--src/corelib/kernel/qabstractitemmodel_p.h5
-rw-r--r--src/corelib/kernel/qcoreevent.h9
-rw-r--r--src/corelib/kernel/qmetaobject.cpp89
-rw-r--r--src/corelib/kernel/qmetaobject.h3
-rw-r--r--src/corelib/kernel/qmetaobjectbuilder.cpp2438
-rw-r--r--src/corelib/kernel/qmetaobjectbuilder_p.h269
-rw-r--r--src/corelib/kernel/qobject.cpp9
-rw-r--r--src/corelib/kernel/qobject.h11
-rw-r--r--src/corelib/kernel/qobject_p.h8
-rw-r--r--src/corelib/kernel/qobjectdefs.h4
-rw-r--r--src/corelib/kernel/qvariant_p.h34
-rw-r--r--src/corelib/statemachine/qabstractstate.cpp155
-rw-r--r--src/corelib/statemachine/qabstractstate.h57
-rw-r--r--src/corelib/statemachine/qabstractstate_p.h64
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp281
-rw-r--r--src/corelib/statemachine/qabstracttransition.h69
-rw-r--r--src/corelib/statemachine/qabstracttransition_p.h65
-rw-r--r--src/corelib/statemachine/qactionstate.cpp385
-rw-r--r--src/corelib/statemachine/qactionstate.h85
-rw-r--r--src/corelib/statemachine/qactionstate_p.h55
-rw-r--r--src/corelib/statemachine/qanimationstate.cpp574
-rw-r--r--src/corelib/statemachine/qanimationstate.h63
-rw-r--r--src/corelib/statemachine/qboundevent_p.h52
-rw-r--r--src/corelib/statemachine/qeventtransition.cpp263
-rw-r--r--src/corelib/statemachine/qeventtransition.h68
-rw-r--r--src/corelib/statemachine/qeventtransition_p.h48
-rw-r--r--src/corelib/statemachine/qfinalstate.cpp103
-rw-r--r--src/corelib/statemachine/qfinalstate.h50
-rw-r--r--src/corelib/statemachine/qhistorystate.cpp145
-rw-r--r--src/corelib/statemachine/qhistorystate.h56
-rw-r--r--src/corelib/statemachine/qhistorystate_p.h53
-rw-r--r--src/corelib/statemachine/qsignalevent.h45
-rw-r--r--src/corelib/statemachine/qsignaleventgenerator_p.h55
-rw-r--r--src/corelib/statemachine/qsignaltransition.cpp228
-rw-r--r--src/corelib/statemachine/qsignaltransition.h63
-rw-r--r--src/corelib/statemachine/qsignaltransition_p.h48
-rw-r--r--src/corelib/statemachine/qstate.cpp469
-rw-r--r--src/corelib/statemachine/qstate.h94
-rw-r--r--src/corelib/statemachine/qstate_p.h54
-rw-r--r--src/corelib/statemachine/qstateaction.cpp469
-rw-r--r--src/corelib/statemachine/qstateaction.h121
-rw-r--r--src/corelib/statemachine/qstateaction_p.h92
-rw-r--r--src/corelib/statemachine/qstatefinishedevent.h40
-rw-r--r--src/corelib/statemachine/qstatefinishedtransition.cpp152
-rw-r--r--src/corelib/statemachine/qstatefinishedtransition.h58
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp1847
-rw-r--r--src/corelib/statemachine/qstatemachine.h116
-rw-r--r--src/corelib/statemachine/qstatemachine_p.h175
-rw-r--r--src/corelib/statemachine/qtransition.cpp230
-rw-r--r--src/corelib/statemachine/qtransition.h68
-rw-r--r--src/corelib/statemachine/qtransition_p.h50
-rw-r--r--src/corelib/statemachine/statemachine.pri47
-rw-r--r--src/corelib/tools/qeasingcurve.cpp844
-rw-r--r--src/corelib/tools/qeasingcurve.h114
-rw-r--r--src/corelib/tools/qtimeline.cpp114
-rw-r--r--src/corelib/tools/qtimeline.h7
-rw-r--r--src/corelib/tools/tools.pri2
-rw-r--r--src/declarative/3rdparty/3rdparty.pri2
-rw-r--r--src/declarative/3rdparty/easing.cpp726
-rw-r--r--src/declarative/3rdparty/legal.qdoc35
-rw-r--r--src/declarative/3rdparty/qlistmodelinterface.h122
-rw-r--r--src/declarative/canvas/canvas.pri19
-rw-r--r--src/declarative/canvas/qsimplecanvas.cpp981
-rw-r--r--src/declarative/canvas/qsimplecanvas.h187
-rw-r--r--src/declarative/canvas/qsimplecanvas_graphicsview.cpp180
-rw-r--r--src/declarative/canvas/qsimplecanvas_opengl.cpp456
-rw-r--r--src/declarative/canvas/qsimplecanvas_opengl1.cpp401
-rw-r--r--src/declarative/canvas/qsimplecanvas_p.h196
-rw-r--r--src/declarative/canvas/qsimplecanvas_software.cpp190
-rw-r--r--src/declarative/canvas/qsimplecanvasfilter.cpp323
-rw-r--r--src/declarative/canvas/qsimplecanvasfilter.h113
-rw-r--r--src/declarative/canvas/qsimplecanvasfilter_p.h70
-rw-r--r--src/declarative/canvas/qsimplecanvasitem.cpp1841
-rw-r--r--src/declarative/canvas/qsimplecanvasitem.h300
-rw-r--r--src/declarative/canvas/qsimplecanvasitem_p.h242
-rw-r--r--src/declarative/canvas/qsimplecanvasserver.cpp107
-rw-r--r--src/declarative/canvas/qsimplecanvasserver_p.h71
-rw-r--r--src/declarative/declarative.pro25
-rw-r--r--src/declarative/extra/extra.pri24
-rw-r--r--src/declarative/extra/qfxintegermodel.cpp126
-rw-r--r--src/declarative/extra/qfxintegermodel.h86
-rw-r--r--src/declarative/extra/qmlnumberformatter.cpp214
-rw-r--r--src/declarative/extra/qmlnumberformatter.h92
-rw-r--r--src/declarative/extra/qmlsqlconnection.cpp441
-rw-r--r--src/declarative/extra/qmlsqlconnection.h117
-rw-r--r--src/declarative/extra/qmlsqlquery.cpp696
-rw-r--r--src/declarative/extra/qmlsqlquery.h143
-rw-r--r--src/declarative/extra/qmlxmllistmodel.cpp357
-rw-r--r--src/declarative/extra/qmlxmllistmodel.h139
-rw-r--r--src/declarative/extra/qnumberformat.cpp224
-rw-r--r--src/declarative/extra/qnumberformat.h172
-rw-r--r--src/declarative/fx/fx.pri94
-rw-r--r--src/declarative/fx/qfxanchors.cpp857
-rw-r--r--src/declarative/fx/qfxanchors.h194
-rw-r--r--src/declarative/fx/qfxanchors_p.h105
-rw-r--r--src/declarative/fx/qfxanimatedimageitem.cpp211
-rw-r--r--src/declarative/fx/qfxanimatedimageitem.h100
-rw-r--r--src/declarative/fx/qfxanimatedimageitem_p.h77
-rw-r--r--src/declarative/fx/qfxblendedimage.cpp249
-rw-r--r--src/declarative/fx/qfxblendedimage.h105
-rw-r--r--src/declarative/fx/qfxblurfilter.cpp462
-rw-r--r--src/declarative/fx/qfxblurfilter.h82
-rw-r--r--src/declarative/fx/qfxcomponentinstance.cpp132
-rw-r--r--src/declarative/fx/qfxcomponentinstance.h89
-rw-r--r--src/declarative/fx/qfxcomponentinstance_p.h76
-rw-r--r--src/declarative/fx/qfxcontentwrapper.cpp129
-rw-r--r--src/declarative/fx/qfxcontentwrapper.h90
-rw-r--r--src/declarative/fx/qfxcontentwrapper_p.h71
-rw-r--r--src/declarative/fx/qfxflickable.cpp1113
-rw-r--r--src/declarative/fx/qfxflickable.h195
-rw-r--r--src/declarative/fx/qfxflickable_p.h166
-rw-r--r--src/declarative/fx/qfxfocuspanel.cpp104
-rw-r--r--src/declarative/fx/qfxfocuspanel.h81
-rw-r--r--src/declarative/fx/qfxfocusrealm.cpp72
-rw-r--r--src/declarative/fx/qfxfocusrealm.h67
-rw-r--r--src/declarative/fx/qfxgridview.cpp1469
-rw-r--r--src/declarative/fx/qfxgridview.h148
-rw-r--r--src/declarative/fx/qfxhighlightfilter.cpp315
-rw-r--r--src/declarative/fx/qfxhighlightfilter.h98
-rw-r--r--src/declarative/fx/qfximage.cpp935
-rw-r--r--src/declarative/fx/qfximage.h124
-rw-r--r--src/declarative/fx/qfximage_p.h117
-rw-r--r--src/declarative/fx/qfximageitem.cpp343
-rw-r--r--src/declarative/fx/qfximageitem.h100
-rw-r--r--src/declarative/fx/qfximageitem_p.h95
-rw-r--r--src/declarative/fx/qfxitem.cpp1751
-rw-r--r--src/declarative/fx/qfxitem.h285
-rw-r--r--src/declarative/fx/qfxitem_p.h182
-rw-r--r--src/declarative/fx/qfxkeyactions.cpp930
-rw-r--r--src/declarative/fx/qfxkeyactions.h319
-rw-r--r--src/declarative/fx/qfxkeyproxy.cpp116
-rw-r--r--src/declarative/fx/qfxkeyproxy.h78
-rw-r--r--src/declarative/fx/qfxlayouts.cpp1027
-rw-r--r--src/declarative/fx/qfxlayouts.h171
-rw-r--r--src/declarative/fx/qfxlayouts_p.h100
-rw-r--r--src/declarative/fx/qfxlistview.cpp1680
-rw-r--r--src/declarative/fx/qfxlistview.h157
-rw-r--r--src/declarative/fx/qfxmouseregion.cpp589
-rw-r--r--src/declarative/fx/qfxmouseregion.h162
-rw-r--r--src/declarative/fx/qfxmouseregion_p.h101
-rw-r--r--src/declarative/fx/qfxpainted.cpp193
-rw-r--r--src/declarative/fx/qfxpainted.h84
-rw-r--r--src/declarative/fx/qfxpainted_p.h84
-rw-r--r--src/declarative/fx/qfxparticles.cpp1063
-rw-r--r--src/declarative/fx/qfxparticles.h240
-rw-r--r--src/declarative/fx/qfxpath.cpp745
-rw-r--r--src/declarative/fx/qfxpath.h257
-rw-r--r--src/declarative/fx/qfxpath_p.h79
-rw-r--r--src/declarative/fx/qfxpathview.cpp841
-rw-r--r--src/declarative/fx/qfxpathview.h132
-rw-r--r--src/declarative/fx/qfxpathview_p.h132
-rw-r--r--src/declarative/fx/qfxpixmap.cpp284
-rw-r--r--src/declarative/fx/qfxpixmap.h92
-rw-r--r--src/declarative/fx/qfxrect.cpp851
-rw-r--r--src/declarative/fx/qfxrect.h140
-rw-r--r--src/declarative/fx/qfxrect_p.h107
-rw-r--r--src/declarative/fx/qfxreflectionfilter.cpp358
-rw-r--r--src/declarative/fx/qfxreflectionfilter.h96
-rw-r--r--src/declarative/fx/qfxrepeater.cpp354
-rw-r--r--src/declarative/fx/qfxrepeater.h88
-rw-r--r--src/declarative/fx/qfxrepeater_p.h81
-rw-r--r--src/declarative/fx/qfxscalegrid.cpp216
-rw-r--r--src/declarative/fx/qfxscalegrid.h120
-rw-r--r--src/declarative/fx/qfxshadowfilter.cpp202
-rw-r--r--src/declarative/fx/qfxshadowfilter.h86
-rw-r--r--src/declarative/fx/qfxtext.cpp958
-rw-r--r--src/declarative/fx/qfxtext.h153
-rw-r--r--src/declarative/fx/qfxtext_p.h132
-rw-r--r--src/declarative/fx/qfxtextedit.cpp804
-rw-r--r--src/declarative/fx/qfxtextedit.h187
-rw-r--r--src/declarative/fx/qfxtextedit_p.h102
-rw-r--r--src/declarative/fx/qfxtransform.cpp661
-rw-r--r--src/declarative/fx/qfxtransform.h274
-rw-r--r--src/declarative/fx/qfxvisualitemmodel.cpp690
-rw-r--r--src/declarative/fx/qfxvisualitemmodel.h120
-rw-r--r--src/declarative/fx/qfxwebview.cpp1079
-rw-r--r--src/declarative/fx/qfxwebview.h217
-rw-r--r--src/declarative/fx/qfxwidgetcontainer.cpp108
-rw-r--r--src/declarative/fx/qfxwidgetcontainer.h79
-rw-r--r--src/declarative/opengl/glbasicshaders.cpp707
-rw-r--r--src/declarative/opengl/glbasicshaders.h244
-rw-r--r--src/declarative/opengl/glheaders.h49
-rw-r--r--src/declarative/opengl/glsave.cpp1
-rw-r--r--src/declarative/opengl/glsave.h111
-rw-r--r--src/declarative/opengl/gltexture.cpp321
-rw-r--r--src/declarative/opengl/gltexture.h116
-rw-r--r--src/declarative/opengl/opengl.pri20
-rw-r--r--src/declarative/qml/qml.h98
-rw-r--r--src/declarative/qml/qml.pri63
-rw-r--r--src/declarative/qml/qmlbindablevalue.cpp210
-rw-r--r--src/declarative/qml/qmlbindablevalue.h94
-rw-r--r--src/declarative/qml/qmlboundsignal.cpp158
-rw-r--r--src/declarative/qml/qmlboundsignal_p.h (renamed from demos/boxes/glshaders.h)98
-rw-r--r--src/declarative/qml/qmlclassfactory.cpp47
-rw-r--r--src/declarative/qml/qmlclassfactory_p.h63
-rw-r--r--src/declarative/qml/qmlcompiledcomponent.cpp170
-rw-r--r--src/declarative/qml/qmlcompiledcomponent_p.h80
-rw-r--r--src/declarative/qml/qmlcompiler.cpp1662
-rw-r--r--src/declarative/qml/qmlcompiler_p.h183
-rw-r--r--src/declarative/qml/qmlcomponent.cpp405
-rw-r--r--src/declarative/qml/qmlcomponent.h102
-rw-r--r--src/declarative/qml/qmlcomponent_p.h85
-rw-r--r--src/declarative/qml/qmlcompositetypemanager.cpp359
-rw-r--r--src/declarative/qml/qmlcompositetypemanager_p.h144
-rw-r--r--src/declarative/qml/qmlcontext.cpp405
-rw-r--r--src/declarative/qml/qmlcontext.h104
-rw-r--r--src/declarative/qml/qmlcontext_p.h87
-rw-r--r--src/declarative/qml/qmlcustomparser.cpp96
-rw-r--r--src/declarative/qml/qmlcustomparser.h82
-rw-r--r--src/declarative/qml/qmldom.cpp1372
-rw-r--r--src/declarative/qml/qmldom.h263
-rw-r--r--src/declarative/qml/qmldom_p.h116
-rw-r--r--src/declarative/qml/qmlengine.cpp1295
-rw-r--r--src/declarative/qml/qmlengine.h107
-rw-r--r--src/declarative/qml/qmlengine_p.h215
-rw-r--r--src/declarative/qml/qmlexpression.h115
-rw-r--r--src/declarative/qml/qmlinfo.cpp97
-rw-r--r--src/declarative/qml/qmlinfo.h69
-rw-r--r--src/declarative/qml/qmlinstruction.cpp214
-rw-r--r--src/declarative/qml/qmlinstruction_p.h299
-rw-r--r--src/declarative/qml/qmllist.h125
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp847
-rw-r--r--src/declarative/qml/qmlmetaproperty.h137
-rw-r--r--src/declarative/qml/qmlmetaproperty_p.h75
-rw-r--r--src/declarative/qml/qmlmetatype.cpp1164
-rw-r--r--src/declarative/qml/qmlmetatype.h258
-rw-r--r--src/declarative/qml/qmlparser.cpp167
-rw-r--r--src/declarative/qml/qmlparser_p.h209
-rw-r--r--src/declarative/qml/qmlparserstatus.cpp75
-rw-r--r--src/declarative/qml/qmlparserstatus.h69
-rw-r--r--src/declarative/qml/qmlprivate.cpp48
-rw-r--r--src/declarative/qml/qmlprivate.h365
-rw-r--r--src/declarative/qml/qmlpropertyvaluesource.cpp75
-rw-r--r--src/declarative/qml/qmlpropertyvaluesource.h79
-rw-r--r--src/declarative/qml/qmlproxymetaobject.cpp113
-rw-r--r--src/declarative/qml/qmlproxymetaobject_p.h85
-rw-r--r--src/declarative/qml/qmlrefcount.cpp66
-rw-r--r--src/declarative/qml/qmlrefcount_p.h69
-rw-r--r--src/declarative/qml/qmlstringconverters.cpp212
-rw-r--r--src/declarative/qml/qmlstringconverters_p.h68
-rw-r--r--src/declarative/qml/qmlvme.cpp1345
-rw-r--r--src/declarative/qml/qmlvme_p.h75
-rw-r--r--src/declarative/qml/qmlvmemetaobject.cpp140
-rw-r--r--src/declarative/qml/qmlvmemetaobject_p.h71
-rw-r--r--src/declarative/qml/qmlxmlparser.cpp384
-rw-r--r--src/declarative/qml/qmlxmlparser_p.h88
-rw-r--r--src/declarative/qml/script/generator/generator.pro11
-rw-r--r--src/declarative/qml/script/generator/main.cpp135
-rw-r--r--src/declarative/qml/script/instructions.h32
-rw-r--r--src/declarative/qml/script/keywords.cpp89
-rw-r--r--src/declarative/qml/script/lexer.cpp139
-rw-r--r--src/declarative/qml/script/lexer.h54
-rw-r--r--src/declarative/qml/script/qmlbasicscript.cpp923
-rw-r--r--src/declarative/qml/script/qmlbasicscript.h76
-rw-r--r--src/declarative/qml/script/qmlbasicscript_p.h52
-rw-r--r--src/declarative/qml/script/script.pri11
-rw-r--r--src/declarative/qml/script/tokens.cpp44
-rw-r--r--src/declarative/qml/script/tokens.h36
-rw-r--r--src/declarative/test/qfxtestengine.cpp457
-rw-r--r--src/declarative/test/qfxtestengine.h85
-rw-r--r--src/declarative/test/qfxtestobjects.cpp348
-rw-r--r--src/declarative/test/qfxtestobjects.h212
-rw-r--r--src/declarative/test/qfxtestview.cpp79
-rw-r--r--src/declarative/test/qfxtestview.h74
-rw-r--r--src/declarative/test/test.pri9
-rw-r--r--src/declarative/timeline/gfxeasing.cpp846
-rw-r--r--src/declarative/timeline/gfxeasing.h107
-rw-r--r--src/declarative/timeline/gfxtimeline.cpp946
-rw-r--r--src/declarative/timeline/gfxtimeline.h190
-rw-r--r--src/declarative/timeline/gfxvalueproxy.h83
-rw-r--r--src/declarative/timeline/timeline.pri9
-rw-r--r--src/declarative/util/qbindablemap.cpp179
-rw-r--r--src/declarative/util/qbindablemap.h87
-rw-r--r--src/declarative/util/qfxglobal.h124
-rw-r--r--src/declarative/util/qfxperf.cpp75
-rw-r--r--src/declarative/util/qfxperf.h87
-rw-r--r--src/declarative/util/qfxview.cpp310
-rw-r--r--src/declarative/util/qfxview.h107
-rw-r--r--src/declarative/util/qmlanimation.cpp2292
-rw-r--r--src/declarative/util/qmlanimation.h453
-rw-r--r--src/declarative/util/qmlanimation_p.h374
-rw-r--r--src/declarative/util/qmlbehaviour.cpp248
-rw-r--r--src/declarative/util/qmlbehaviour.h99
-rw-r--r--src/declarative/util/qmlbind.cpp203
-rw-r--r--src/declarative/util/qmlbind.h89
-rw-r--r--src/declarative/util/qmlconnection.cpp290
-rw-r--r--src/declarative/util/qmlconnection.h91
-rw-r--r--src/declarative/util/qmldatetimeformatter.cpp368
-rw-r--r--src/declarative/util/qmldatetimeformatter.h116
-rw-r--r--src/declarative/util/qmlfollow.cpp309
-rw-r--r--src/declarative/util/qmlfollow.h94
-rw-r--r--src/declarative/util/qmlfont.cpp147
-rw-r--r--src/declarative/util/qmlfont.h92
-rw-r--r--src/declarative/util/qmllistaccessor.cpp243
-rw-r--r--src/declarative/util/qmllistaccessor.h82
-rw-r--r--src/declarative/util/qmllistmodel.cpp721
-rw-r--r--src/declarative/util/qmllistmodel.h96
-rw-r--r--src/declarative/util/qmlnullablevalue_p.h67
-rw-r--r--src/declarative/util/qmlopenmetaobject.cpp188
-rw-r--r--src/declarative/util/qmlopenmetaobject.h96
-rw-r--r--src/declarative/util/qmlpackage.cpp148
-rw-r--r--src/declarative/util/qmlpackage.h86
-rw-r--r--src/declarative/util/qmlscript.cpp219
-rw-r--r--src/declarative/util/qmlscript.h80
-rw-r--r--src/declarative/util/qmlsetproperties.cpp247
-rw-r--r--src/declarative/util/qmlsetproperties.h83
-rw-r--r--src/declarative/util/qmlstate.cpp469
-rw-r--r--src/declarative/util/qmlstate.h175
-rw-r--r--src/declarative/util/qmlstate_p.h77
-rw-r--r--src/declarative/util/qmlstategroup.cpp306
-rw-r--r--src/declarative/util/qmlstategroup.h95
-rw-r--r--src/declarative/util/qmlstateoperations.cpp416
-rw-r--r--src/declarative/util/qmlstateoperations.h132
-rw-r--r--src/declarative/util/qmltransition.cpp283
-rw-r--r--src/declarative/util/qmltransition.h98
-rw-r--r--src/declarative/util/qperformancelog.cpp177
-rw-r--r--src/declarative/util/qperformancelog.h176
-rw-r--r--src/declarative/util/util.pri49
-rw-r--r--src/declarative/widgets/graphicslayouts.cpp325
-rw-r--r--src/declarative/widgets/graphicslayouts.h190
-rw-r--r--src/declarative/widgets/graphicswidgets.cpp173
-rw-r--r--src/declarative/widgets/graphicswidgets.h60
-rw-r--r--src/declarative/widgets/widgets.pri10
-rw-r--r--src/gui/animation/animation.pri8
-rw-r--r--src/gui/animation/qitemanimation.cpp361
-rw-r--r--src/gui/animation/qitemanimation.h111
-rw-r--r--src/gui/animation/qitemanimation_p.h83
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp252
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h19
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h12
-rw-r--r--src/gui/graphicsview/qgraphicslayout.h2
-rw-r--r--src/gui/graphicsview/qgraphicslayoutitem.h2
-rw-r--r--src/gui/graphicsview/qgraphicsproxywidget.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsproxywidget.h2
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicswidget.h7
-rw-r--r--src/gui/gui.pro2
-rw-r--r--src/gui/kernel/qaction.h30
-rw-r--r--src/gui/kernel/qapplication.cpp6
-rw-r--r--src/gui/kernel/qevent.cpp41
-rw-r--r--src/gui/kernel/qevent.h5
-rw-r--r--src/gui/kernel/qevent_p.h6
-rw-r--r--src/gui/painting/qdrawhelper.cpp12
-rw-r--r--src/gui/statemachine/qbasickeyeventtransition.cpp174
-rw-r--r--src/gui/statemachine/qbasickeyeventtransition_p.h67
-rw-r--r--src/gui/statemachine/qbasicmouseeventtransition.cpp159
-rw-r--r--src/gui/statemachine/qbasicmouseeventtransition_p.h70
-rw-r--r--src/gui/statemachine/qguistatemachine.cpp514
-rw-r--r--src/gui/statemachine/qkeyeventtransition.cpp156
-rw-r--r--src/gui/statemachine/qkeyeventtransition.h60
-rw-r--r--src/gui/statemachine/qmouseeventtransition.cpp162
-rw-r--r--src/gui/statemachine/qmouseeventtransition.h62
-rw-r--r--src/gui/statemachine/statemachine.pri16
-rw-r--r--src/opengl/gl2paintengineex/qglshader_p.h2
-rw-r--r--src/opengl/opengl.pro4
-rw-r--r--src/opengl/qglextensions.cpp174
-rw-r--r--src/opengl/qglextensions_p.h134
-rw-r--r--src/opengl/qglpixmapfilter.cpp172
-rw-r--r--src/opengl/qglpixmapfilter_p.h29
-rw-r--r--src/opengl/qglshaderprogram.cpp2798
-rw-r--r--src/opengl/qglshaderprogram.h266
-rw-r--r--src/script/qscriptengine_p.cpp5
-rw-r--r--src/script/qscriptenginefwd_p.h1
-rw-r--r--src/script/qscriptextqobject.cpp33
-rw-r--r--src/src.pro4
-rw-r--r--src/tools/moc/generator.cpp16
-rw-r--r--src/tools/moc/keywords.cpp162
-rw-r--r--src/tools/moc/moc.cpp11
-rw-r--r--src/tools/moc/moc.h7
-rw-r--r--src/tools/moc/token.h1
-rw-r--r--src/tools/moc/util/generate_keywords.cpp1
-rw-r--r--tests/auto/auto.pro10
-rw-r--r--tests/auto/declarative/.gitignore3
-rw-r--r--tests/auto/declarative/datetimeformatter/datetimeformatter.pro3
-rw-r--r--tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp83
-rw-r--r--tests/auto/declarative/declarative.pro22
-rw-r--r--tests/auto/declarative/layouts/data/grid-margin.xml9
-rw-r--r--tests/auto/declarative/layouts/data/grid-spacing-margin.xml9
-rw-r--r--tests/auto/declarative/layouts/data/grid-spacing.xml9
-rw-r--r--tests/auto/declarative/layouts/data/grid.xml9
-rw-r--r--tests/auto/declarative/layouts/data/horizontal-margin.xml7
-rw-r--r--tests/auto/declarative/layouts/data/horizontal-spacing-margin.xml7
-rw-r--r--tests/auto/declarative/layouts/data/horizontal-spacing.xml7
-rw-r--r--tests/auto/declarative/layouts/data/horizontal.xml7
-rw-r--r--tests/auto/declarative/layouts/data/vertical-margin.xml7
-rw-r--r--tests/auto/declarative/layouts/data/vertical-spacing-margin.xml7
-rw-r--r--tests/auto/declarative/layouts/data/vertical-spacing.xml7
-rw-r--r--tests/auto/declarative/layouts/data/vertical.xml7
-rw-r--r--tests/auto/declarative/layouts/layouts.pro6
-rw-r--r--tests/auto/declarative/layouts/tst_layouts.cpp392
-rw-r--r--tests/auto/declarative/listview/data/listview.xml14
-rw-r--r--tests/auto/declarative/listview/listview.pro6
-rw-r--r--tests/auto/declarative/listview/tst_listview.cpp484
-rw-r--r--tests/auto/declarative/namespaces/data/Red/Rect.qml2
-rw-r--r--tests/auto/declarative/namespaces/namespaces.pro6
-rw-r--r--tests/auto/declarative/namespaces/tst_namespaces.cpp94
-rw-r--r--tests/auto/declarative/numberformatter/numberformatter.pro3
-rw-r--r--tests/auto/declarative/numberformatter/tst_numberformatter.cpp216
-rw-r--r--tests/auto/declarative/pathview/data/pathview.xml20
-rw-r--r--tests/auto/declarative/pathview/pathview.pro6
-rw-r--r--tests/auto/declarative/pathview/tst_pathview.cpp259
-rw-r--r--tests/auto/declarative/qbindablemap/qbindablemap.pro3
-rw-r--r--tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp72
-rw-r--r--tests/auto/declarative/qfxtext/qfxtext.pro3
-rw-r--r--tests/auto/declarative/qfxtext/tst_qfxtext.cpp412
-rw-r--r--tests/auto/declarative/qfxtextedit/qfxtextedit.pro3
-rw-r--r--tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp326
-rw-r--r--tests/auto/declarative/qmlbindengine/qmlbindengine.pro3
-rw-r--r--tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp123
-rw-r--r--tests/auto/declarative/qmllist/qmllist.pro3
-rw-r--r--tests/auto/declarative/qmllist/tst_qmllist.cpp38
-rw-r--r--tests/auto/declarative/qmllistaccessor/qmllistaccessor.pro3
-rw-r--r--tests/auto/declarative/qmllistaccessor/tst_qmllistaccessor.cpp61
-rw-r--r--tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro3
-rw-r--r--tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp104
-rw-r--r--tests/auto/declarative/qmlparser/qmlparser.pro3
-rw-r--r--tests/auto/declarative/qmlparser/tst_qmlparser.cpp444
-rw-r--r--tests/auto/declarative/repeater/data/repeater.xml7
-rw-r--r--tests/auto/declarative/repeater/repeater.pro6
-rw-r--r--tests/auto/declarative/repeater/tst_repeater.cpp91
-rw-r--r--tests/auto/declarative/simplecanvasitem/data/test.xml12
-rw-r--r--tests/auto/declarative/simplecanvasitem/simplecanvasitem.pro6
-rw-r--r--tests/auto/declarative/simplecanvasitem/tst_simplecanvasitem.cpp79
-rw-r--r--tests/auto/declarative/visual/ListView/basic1/basic1.xml19
-rw-r--r--tests/auto/declarative/visual/ListView/basic1/data/opengl/image0.pngbin0 -> 3759 bytes-rw-r--r--tests/auto/declarative/visual/ListView/basic1/data/opengl/manifest.xml4
-rw-r--r--tests/auto/declarative/visual/ListView/basic1/test1
-rw-r--r--tests/auto/declarative/visual/ListView/basic2/basic2.xml20
-rw-r--r--tests/auto/declarative/visual/ListView/basic2/data/opengl/image0.pngbin0 -> 3759 bytes-rw-r--r--tests/auto/declarative/visual/ListView/basic2/data/opengl/manifest.xml4
-rw-r--r--tests/auto/declarative/visual/ListView/basic2/test1
-rw-r--r--tests/auto/declarative/visual/ListView/basic3/basic3.xml18
-rw-r--r--tests/auto/declarative/visual/ListView/basic3/data/opengl/image0.pngbin0 -> 3759 bytes-rw-r--r--tests/auto/declarative/visual/ListView/basic3/data/opengl/manifest.xml4
-rw-r--r--tests/auto/declarative/visual/ListView/basic3/test1
-rw-r--r--tests/auto/declarative/visual/ListView/basic4/basic4.xml19
-rw-r--r--tests/auto/declarative/visual/ListView/basic4/data/opengl/image0.pngbin0 -> 3759 bytes-rw-r--r--tests/auto/declarative/visual/ListView/basic4/data/opengl/manifest.xml4
-rw-r--r--tests/auto/declarative/visual/ListView/basic4/test1
-rw-r--r--tests/auto/declarative/visual/bindinganimation/bindinganimation.xml19
-rw-r--r--tests/auto/declarative/visual/bindinganimation/data/opengl/image0.pngbin0 -> 817 bytes-rw-r--r--tests/auto/declarative/visual/bindinganimation/data/opengl/manifest-play.xml104
-rw-r--r--tests/auto/declarative/visual/bindinganimation/data/opengl/manifest.xml104
-rw-r--r--tests/auto/declarative/visual/bindinganimation/test1
-rw-r--r--tests/auto/declarative/visual/colorAnimation/colorAnimation.xml18
-rw-r--r--tests/auto/declarative/visual/colorAnimation/image0.pngbin0 -> 947 bytes-rw-r--r--tests/auto/declarative/visual/colorAnimation/manifest-play.xml73
-rw-r--r--tests/auto/declarative/visual/colorAnimation/manifest.xml73
-rw-r--r--tests/auto/declarative/visual/easing/easing.xml70
-rw-r--r--tests/auto/declarative/visual/easing/image0.pngbin0 -> 17530 bytes-rw-r--r--tests/auto/declarative/visual/easing/manifest-play.xml23
-rw-r--r--tests/auto/declarative/visual/easing/manifest.xml23
-rw-r--r--tests/auto/declarative/visual/easing/pics/qtlogo.pngbin0 -> 2738 bytes-rw-r--r--tests/auto/declarative/visual/flickable/Day.qml8
-rw-r--r--tests/auto/declarative/visual/flickable/cork.jpgbin0 -> 88766 bytes-rw-r--r--tests/auto/declarative/visual/flickable/flickable.xml43
-rw-r--r--tests/auto/declarative/visual/flickable/image0.pngbin0 -> 360547 bytes-rw-r--r--tests/auto/declarative/visual/flickable/manifest-fail.xml30
-rw-r--r--tests/auto/declarative/visual/flickable/manifest.xml190
-rw-r--r--tests/auto/declarative/visual/flipable/flipable.xml138
-rw-r--r--tests/auto/declarative/visual/flipable/image0.pngbin0 -> 6184 bytes-rw-r--r--tests/auto/declarative/visual/flipable/manifest-play.xml24
-rw-r--r--tests/auto/declarative/visual/flipable/manifest.xml24
-rw-r--r--tests/auto/declarative/visual/flipable/pics/arrow.pngbin0 -> 546 bytes-rw-r--r--tests/auto/declarative/visual/flipable/pics/face.pngbin0 -> 10112 bytes-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo0.pngbin0 -> 10412 bytes-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo1.pngbin0 -> 11068 bytes-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo10.pngbin0 -> 12539 bytes-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo2.pngbin0 -> 11490 bytes-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo3.pngbin0 -> 11308 bytes-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo4.pngbin0 -> 11322 bytes-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo5.pngbin0 -> 11497 bytes-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo6.pngbin0 -> 11707 bytes-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo7.pngbin0 -> 11101 bytes-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo8.pngbin0 -> 11558 bytes-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo9.pngbin0 -> 10943 bytes-rw-r--r--tests/auto/declarative/visual/pauseAnimation/image0.pngbin0 -> 3209 bytes-rw-r--r--tests/auto/declarative/visual/pauseAnimation/manifest-play.xml138
-rw-r--r--tests/auto/declarative/visual/pauseAnimation/manifest.xml138
-rw-r--r--tests/auto/declarative/visual/pauseAnimation/pauseAnimation.xml13
-rw-r--r--tests/auto/declarative/visual/pauseAnimation/pics/qtlogo.pngbin0 -> 2738 bytes-rw-r--r--tests/auto/declarative/visual/qfxtext/elide/data/opengl/image0.pngbin0 -> 980 bytes-rw-r--r--tests/auto/declarative/visual/qfxtext/elide/data/opengl/manifest.xml4
-rw-r--r--tests/auto/declarative/visual/qfxtext/elide/elide.xml6
-rw-r--r--tests/auto/declarative/visual/qfxtext/elide/test1
-rw-r--r--tests/auto/declarative/visual/repeater/basic1/basic1.xml21
-rw-r--r--tests/auto/declarative/visual/repeater/basic1/data/opengl/image0.pngbin0 -> 3493 bytes-rw-r--r--tests/auto/declarative/visual/repeater/basic1/data/opengl/manifest.xml4
-rw-r--r--tests/auto/declarative/visual/repeater/basic1/test1
-rw-r--r--tests/auto/declarative/visual/repeater/basic2/basic2.xml22
-rw-r--r--tests/auto/declarative/visual/repeater/basic2/data/opengl/image0.pngbin0 -> 3493 bytes-rw-r--r--tests/auto/declarative/visual/repeater/basic2/data/opengl/manifest.xml4
-rw-r--r--tests/auto/declarative/visual/repeater/basic2/test1
-rw-r--r--tests/auto/declarative/visual/repeater/basic3/basic3.xml19
-rw-r--r--tests/auto/declarative/visual/repeater/basic3/data/opengl/image0.pngbin0 -> 3493 bytes-rw-r--r--tests/auto/declarative/visual/repeater/basic3/data/opengl/manifest.xml4
-rw-r--r--tests/auto/declarative/visual/repeater/basic3/test1
-rw-r--r--tests/auto/declarative/visual/repeater/basic4/basic4.xml18
-rw-r--r--tests/auto/declarative/visual/repeater/basic4/data/opengl/image0.pngbin0 -> 3493 bytes-rw-r--r--tests/auto/declarative/visual/repeater/basic4/data/opengl/manifest.xml4
-rw-r--r--tests/auto/declarative/visual/repeater/basic4/test1
-rwxr-xr-xtests/auto/declarative/visual/runtests.sh2
-rw-r--r--tests/auto/declarative/visual/tests11
-rw-r--r--tests/auto/declarative/visual/tst_visual.cpp72
-rw-r--r--tests/auto/declarative/visual/visual.pro5
-rw-r--r--tests/auto/declarative/visual/webview/autosize/data/opengl/image0.pngbin0 -> 5396 bytes-rw-r--r--tests/auto/declarative/visual/webview/autosize/data/opengl/manifest.xml4
-rw-r--r--tests/auto/declarative/visual/webview/autosize/test1
-rw-r--r--tests/auto/dynamicobject/dynamicobject.pro6
-rw-r--r--tests/auto/dynamicobject/qdynamicmetaobject.cpp254
-rw-r--r--tests/auto/dynamicobject/qdynamicmetaobject.h47
-rw-r--r--tests/auto/dynamicobject/qmetaobjectbuilder.cpp2347
-rw-r--r--tests/auto/dynamicobject/qmetaobjectbuilder.h258
-rw-r--r--tests/auto/dynamicobject/tst_qobject.cpp325
-rw-r--r--tests/auto/qanimationgroup/qanimationgroup.pro5
-rw-r--r--tests/auto/qanimationgroup/tst_qanimationgroup.cpp347
-rw-r--r--tests/auto/qanimationstate/qanimationstate.pro5
-rw-r--r--tests/auto/qanimationstate/tst_qanimationstate.cpp625
-rw-r--r--tests/auto/qeasingcurve/qeasingcurve.pro3
-rw-r--r--tests/auto/qeasingcurve/tst_qeasingcurve.cpp488
-rw-r--r--tests/auto/qparallelanimationgroup/qparallelanimationgroup.pro5
-rw-r--r--tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp834
-rw-r--r--tests/auto/qpropertyanimation/qpropertyanimation.pro5
-rw-r--r--tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp831
-rw-r--r--tests/auto/qscriptqobject/tst_qscriptqobject.cpp66
-rw-r--r--tests/auto/qsequentialanimationgroup/qsequentialanimationgroup.pro5
-rw-r--r--tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp1649
-rw-r--r--tests/auto/qstate/qstate.pro5
-rw-r--r--tests/auto/qstate/tst_qstate.cpp372
-rw-r--r--tests/auto/qstatemachine/qstatemachine.pro4
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp2177
-rw-r--r--tests/benchmarks/benchmarks.pro11
-rw-r--r--tests/benchmarks/qanimation/dummyanimation.cpp20
-rw-r--r--tests/benchmarks/qanimation/dummyanimation.h19
-rw-r--r--tests/benchmarks/qanimation/dummyobject.cpp25
-rw-r--r--tests/benchmarks/qanimation/dummyobject.h23
-rw-r--r--tests/benchmarks/qanimation/main.cpp173
-rw-r--r--tests/benchmarks/qanimation/qanimation.pro18
-rw-r--r--tests/benchmarks/qanimation/rectanimation.cpp58
-rw-r--r--tests/benchmarks/qanimation/rectanimation.h30
-rw-r--r--tests/benchmarks/qfxview/main.cpp182
-rw-r--r--tests/benchmarks/qfxview/qfxview.pro16
-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/editor/data.xml44
-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/background.pngbin0 -> 26508 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/background3.pngbin0 -> 37671 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/battery.pngbin0 -> 770 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/calendar-blur.pngbin0 -> 51439 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/calendar.pngbin0 -> 10153 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/callhistory-blur.pngbin0 -> 57023 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/callhistory.pngbin0 -> 13227 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/camera-blur.pngbin0 -> 50955 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/camera.pngbin0 -> 16126 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/contacts-blur.pngbin0 -> 51041 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/contacts.pngbin0 -> 12177 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/file-manager-blur.pngbin0 -> 45164 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/file-manager.pngbin0 -> 8858 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/fire.pngbin0 -> 1124 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-blue.pngbin0 -> 764 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-container.pngbin0 -> 536 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-front.pngbin0 -> 962 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-pink.pngbin0 -> 747 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/flask-yellow.pngbin0 -> 775 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/ice.pngbin0 -> 1112 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/icon-reflection.pngbin0 -> 7123 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/internet-blur.pngbin0 -> 57126 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/internet.pngbin0 -> 24320 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-background1.pngbin0 -> 2831 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-border1.pngbin0 -> 926 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-border3.pngbin0 -> 10153 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/menu-highlight.pngbin0 -> 3421 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/menubar.pngbin0 -> 741 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/messages-blur.pngbin0 -> 44556 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/messages.pngbin0 -> 11426 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/moon.pngbin0 -> 1027 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/sad.pngbin0 -> 1053 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/settings-blur.pngbin0 -> 50199 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/settings.pngbin0 -> 8697 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/signal.pngbin0 -> 739 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/smile.pngbin0 -> 1051 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/star.pngbin0 -> 262 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/sun.pngbin0 -> 1021 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/titlebar.pngbin0 -> 1041 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/pics/wifi.pngbin0 -> 782 bytes-rw-r--r--tests/benchmarks/qfxview/testdata/tatwheel/tat-wheel.xml68
-rw-r--r--tests/benchmarks/qmlxmlparser/main.cpp96
-rw-r--r--tests/benchmarks/qmlxmlparser/qmlxmlparser.pro14
-rw-r--r--tests/benchmarks/qmlxmlparser/testdata/concept2.xml421
-rw-r--r--tests/benchmarks/qvariant/qvariant.pro1
-rw-r--r--tests/benchmarks/qvariant/tst_qvariant.cpp115
-rw-r--r--tools/configure/configureapp.cpp12
-rw-r--r--tools/duiviewer/duiviewer.pro12
-rw-r--r--tools/duiviewer/main.cpp135
-rw-r--r--tools/duiviewer/qfxviewer.cpp361
-rw-r--r--tools/duiviewer/qfxviewer.h71
-rw-r--r--tools/qdoc3/codemarker.cpp109
-rw-r--r--tools/qdoc3/codemarker.h12
-rw-r--r--tools/qdoc3/command.cpp44
-rw-r--r--tools/qdoc3/cppcodemarker.cpp224
-rw-r--r--tools/qdoc3/cppcodemarker.h5
-rw-r--r--tools/qdoc3/cppcodeparser.cpp260
-rw-r--r--tools/qdoc3/cppcodeparser.h12
-rw-r--r--tools/qdoc3/doc.cpp14
-rw-r--r--tools/qdoc3/generator.cpp190
-rw-r--r--tools/qdoc3/generator.h5
-rw-r--r--tools/qdoc3/helpprojectwriter.cpp30
-rw-r--r--tools/qdoc3/htmlgenerator.cpp691
-rw-r--r--tools/qdoc3/htmlgenerator.h29
-rw-r--r--tools/qdoc3/jambiapiparser.cpp5
-rw-r--r--tools/qdoc3/node.cpp106
-rw-r--r--tools/qdoc3/node.h126
-rw-r--r--tools/qdoc3/pagegenerator.cpp59
-rw-r--r--tools/qdoc3/test/classic.css42
-rw-r--r--tools/qdoc3/test/qt-build-docs.qdocconf3
-rw-r--r--tools/qdoc3/test/qt.qdocconf3
-rw-r--r--tools/qdoc3/tree.cpp50
-rw-r--r--tools/qdoc3/webxmlgenerator.cpp4
-rw-r--r--tools/tools.pro1
1209 files changed, 138782 insertions, 1732 deletions
diff --git a/.gitignore b/.gitignore
index 0de9563..9f4144a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,8 +12,11 @@ config.tests/*/*/*
!config.tests/*/*/*[.]*
config.tests/*/*/*[.]app
+callgrind.out.*
+pcviewer.cfg
*~
*.a
+*.la
*.core
*.moc
*.o
@@ -44,6 +47,7 @@ bin/Qt*.dll
bin/assistant*
bin/designer*
bin/dumpcpp*
+bin/duiviewer*
bin/idc*
bin/linguist*
bin/lrelease*
diff --git a/bin/snapshot b/bin/snapshot
new file mode 100644
index 0000000..8cf3be2
--- /dev/null
+++ b/bin/snapshot
@@ -0,0 +1,333 @@
+#!/usr/bin/perl -w
+######################################################################
+#
+#
+######################################################################
+
+# use packages -------------------------------------------------------
+use File::Basename;
+use File::Path;
+use Cwd;
+use Config;
+use strict;
+
+my $targetPath = "";
+my $qtdir = $ENV{"QTDIR"};
+
+my @files = (
+ "3rdparty/easing/easing.cpp",
+ "corelib/tools/qeasingcurve.h",
+ "corelib/tools/qeasingcurve.cpp",
+ "corelib/animation/animation.pri",
+ "corelib/animation/qabstractanimation.cpp",
+ "corelib/animation/qabstractanimation.h",
+ "corelib/animation/qabstractanimation_p.h",
+ "corelib/animation/qvariantanimation.cpp",
+ "corelib/animation/qvariantanimation.h",
+ "corelib/animation/qanimationgroup.cpp",
+ "corelib/animation/qvariantanimation_p.h",
+ "corelib/animation/qanimationgroup.h",
+ "corelib/animation/qanimationgroup_p.h",
+ "corelib/animation/qparallelanimationgroup.cpp",
+ "corelib/animation/qparallelanimationgroup.h",
+ "corelib/animation/qparallelanimationgroup_p.h",
+ "corelib/animation/qpauseanimation.cpp",
+ "corelib/animation/qpauseanimation.h",
+ "corelib/animation/qpropertyanimation.cpp",
+ "corelib/animation/qpropertyanimation.h",
+ "corelib/animation/qpropertyanimation_p.h",
+ "corelib/animation/qsequentialanimationgroup.cpp",
+ "corelib/animation/qsequentialanimationgroup.h",
+ "corelib/animation/qsequentialanimationgroup_p.h",
+ "corelib/statemachine/statemachine.pri",
+ "corelib/statemachine/qabstractstate.cpp",
+ "corelib/statemachine/qabstractstate.h",
+ "corelib/statemachine/qabstractstate_p.h",
+ "corelib/statemachine/qabstracttransition.cpp",
+ "corelib/statemachine/qabstracttransition.h",
+ "corelib/statemachine/qabstracttransition_p.h",
+ "corelib/statemachine/qactionstate.h",
+ "corelib/statemachine/qactionstate_p.h",
+ "corelib/statemachine/qactionstate.cpp",
+ "corelib/statemachine/qanimationstate.cpp",
+ "corelib/statemachine/qanimationstate.h",
+ "corelib/statemachine/qboundevent_p.h",
+ "corelib/statemachine/qeventtransition.cpp",
+ "corelib/statemachine/qeventtransition.h",
+ "corelib/statemachine/qeventtransition_p.h",
+ "corelib/statemachine/qfinalstate.cpp",
+ "corelib/statemachine/qfinalstate.h",
+ "corelib/statemachine/qhistorystate.cpp",
+ "corelib/statemachine/qhistorystate.h",
+ "corelib/statemachine/qhistorystate_p.h",
+ "corelib/statemachine/qsignalevent.h",
+ "corelib/statemachine/qsignaleventgenerator_p.h",
+ "corelib/statemachine/qsignaltransition.cpp",
+ "corelib/statemachine/qsignaltransition.h",
+ "corelib/statemachine/qsignaltransition_p.h",
+ "corelib/statemachine/qstate.cpp",
+ "corelib/statemachine/qstate.h",
+ "corelib/statemachine/qstateaction.cpp",
+ "corelib/statemachine/qstateaction.h",
+ "corelib/statemachine/qstateaction_p.h",
+ "corelib/statemachine/qstatefinishedevent.h",
+ "corelib/statemachine/qstatefinishedtransition.cpp",
+ "corelib/statemachine/qstatefinishedtransition.h",
+ "corelib/statemachine/qstatemachine.cpp",
+ "corelib/statemachine/qstatemachine.h",
+ "corelib/statemachine/qstatemachine_p.h",
+ "corelib/statemachine/qstate_p.h",
+ "corelib/statemachine/qtransition.cpp",
+ "corelib/statemachine/qtransition.h",
+ "corelib/statemachine/qtransition_p.h",
+ "gui/statemachine/qkeyeventtransition.h",
+ "gui/statemachine/qkeyeventtransition.cpp",
+ "gui/statemachine/qbasickeyeventtransition.cpp",
+ "gui/statemachine/qbasickeyeventtransition_p.h",
+ "gui/statemachine/qbasicmouseeventtransition.cpp",
+ "gui/statemachine/qbasicmouseeventtransition_p.h",
+ "gui/statemachine/qguistatemachine.cpp",
+ "gui/statemachine/qkeyeventtransition.cpp",
+ "gui/statemachine/qkeyeventtransition.h",
+ "gui/statemachine/qmouseeventtransition.cpp",
+ "gui/statemachine/qmouseeventtransition.h",
+ "gui/statemachine/statemachine.pri", # needs special handling
+ );
+
+
+while ( @ARGV ) {
+ my $arg = shift @ARGV;
+ if ("$arg" eq "-to") {
+ $targetPath = shift @ARGV;
+ }
+}
+
+if ($targetPath eq "") {
+ die("missing -to option");
+}
+
+my $projectXML = "$targetPath\\files.xml";
+open(OXML, "> " . $projectXML) || die "Could not open $projectXML for writing (no write permission?)";
+
+print "COPYING SOURCES...\n";
+foreach my $files(@files) {
+ copyFile("$qtdir/src/$files","$targetPath/src");
+}
+copyFile("$qtdir/doc/src/animation.qdoc","$targetPath/doc");
+copyFile("$qtdir/doc/src/statemachine.qdoc","$targetPath/doc");
+copyFile("$qtdir/src/3rdparty/easing/legal.qdoc","$targetPath/doc");
+
+copyFile("$qtdir/doc/src/snippets/code/src_corelib_tools_qeasingcurve.cpp","$targetPath/doc/src/snippets/code");
+
+
+my %animation_examples = (
+ easing => [ "easing.pro",
+ "main.cpp",
+ "window.cpp",
+ "window.h",
+ "animation.h",
+ "form.ui",
+ "images/qt-logo.png",
+ "resources.qrc"],
+ moveblocks => [ "moveblocks.pro",
+ "main.cpp" ],
+ animatedtiles => [ "animatedtiles.pro",
+ "animatedtiles.qrc",
+ "main.cpp",
+ "images/*"],
+ "sub-attaq" => ["sub-attaq.pro",
+ "animationmanager.cpp",
+ "animationmanager.h",
+ "boat.cpp",
+ "boat_p.h",
+ "boat.h",
+ "bomb.cpp",
+ "bomb.h",
+ "custompropertyanimation.h",
+ "custompropertyanimation_p.h",
+ "custompropertyanimation.cpp",
+ "graphicsscene.cpp",
+ "graphicsscene.h",
+ "main.cpp",
+ "mainwindow.cpp",
+ "mainwindow.h",
+ "pics/scalable/*",
+ "pics/big/*",
+ "pics/small/*",
+ "pics/welcome/*",
+ "pixmapitem.cpp",
+ "pixmapitem.h",
+ "subattaq.qrc",
+ "submarine.cpp",
+ "submarine.h",
+ "submarine_p.h",
+ "states.cpp",
+ "states.h",
+ "torpedo.cpp",
+ "torpedo.h"],
+ "stickman" => ["stickman.pro",
+ "main.cpp",
+ "animation.cpp",
+ "animation.h",
+ "graphicsview.cpp",
+ "graphicsview.h",
+ "lifecycle.cpp",
+ "lifecycle.h",
+ "node.cpp",
+ "node.h",
+ "stickman.cpp",
+ "stickman.h",
+ "animations/chilling",
+ "animations/dancing",
+ "animations/dead",
+ "animations/jumping"]
+ );
+
+my $exDir;
+print "COPYING EXAMPLES...\n";
+for $exDir ( keys %animation_examples ) {
+ print " $exDir...\n";
+ my $i = 0;
+ for $i ( 0 .. $#{ $animation_examples{$exDir} } ) {
+ my $ex_file = $animation_examples{$exDir}[$i];
+
+ my $copyTargetPath;
+ my $glob = 0;
+ if (index($ex_file,"/") > 0) {
+ my($basefile, $fullPath) = fileparse("$targetPath/examples/$exDir/$ex_file");
+ if ($basefile eq "*") {
+ $glob = 1;
+ }
+ mkpath "$fullPath", 0777 unless(-e "$fullPath");
+ $copyTargetPath = "$fullPath";
+ } else {
+ $copyTargetPath = "$targetPath/examples/$exDir";
+ }
+ my $lastCh = substr($copyTargetPath, length($copyTargetPath) - 1, 1);
+ if ($lastCh eq "/" || $lastCh eq "\\") {
+ chop($copyTargetPath);
+ }
+
+ if ($glob eq 1) {
+ my @globFiles = < $qtdir/examples/animation/$exDir/$ex_file >;
+ foreach my $globFile(@globFiles) {
+ copyFile("$globFile", "$copyTargetPath");
+ }
+ } else {
+ copyFile("$qtdir/examples/animation/$exDir/$ex_file", "$copyTargetPath");
+ }
+ }
+}
+
+close OXML;
+print("Finished!");
+######################################################################
+# Syntax: copyFile(gitfile, destinationPath)
+# Params: gitfile, string, filename to create duplicate for
+# destinationPath, string, destination name of duplicate
+#
+# Purpose: Copies to the solutions area.
+# Returns: --
+# Warning: Dies if script cannot get write access.
+######################################################################
+sub copyFile
+{
+ my ($gitfile, $destinationPath) = @_;
+ # Bi-directional synchronization
+ open( I, "< " . $gitfile ) || die "Could not open $gitfile for reading";
+ local $/;
+ binmode I;
+ my $filecontents = <I>;
+ my ($baseFileName, $path, $ext) = fileparse($gitfile, qr/\.[^.]*/);
+ if ($ext eq ".h" or $ext eq ".cpp" or $ext eq ".qdoc") {
+ # both public and private classes
+ $filecontents =~s/QAbstractAnimation/QtAbstractAnimation/g;
+ $filecontents =~s/QAnimationGroup/QtAnimationGroup/g;
+ $filecontents =~s/QParallelAnimationGroup/QtParallelAnimationGroup/g;
+ $filecontents =~s/QSequentialAnimationGroup/QtSequentialAnimationGroup/g;
+ $filecontents =~s/QEasingCurve/QtEasingCurve/g;
+ $filecontents =~s/QVariantAnimation/QtVariantAnimation/g;
+ $filecontents =~s/QPropertyAnimation/QtPropertyAnimation/g;
+ $filecontents =~s/QItemAnimation/QtItemAnimation/g;
+ $filecontents =~s/QPauseAnimation/QtPauseAnimation/g;
+ $filecontents =~s/QAbstractState/QtAbstractState/g;
+ $filecontents =~s/QAbstractStateGroup/QtAbstractStateGroup/g;
+ $filecontents =~s/QAbstractTransition/QtAbstractTransition/g;
+ $filecontents =~s/QActionState/QtActionState/g;
+ $filecontents =~s/QAnimationState/QtAnimationState/g;
+ $filecontents =~s/QEventTransition/QtEventTransition/g;
+ $filecontents =~s/QFinalState/QtFinalState/g;
+ $filecontents =~s/QHistoryState/QtHistoryState/g;
+ $filecontents =~s/QParallelStateGroup/QtParallelStateGroup/g;
+ $filecontents =~s/QSignalEvent/QtSignalEvent/g;
+ $filecontents =~s/QSignalTransition/QtSignalTransition/g;
+ $filecontents =~s/QState/QtState/g;
+ $filecontents =~s/QStateAction/QtStateAction/g;
+ $filecontents =~s/QStateSetPropertyAction/QtStateSetPropertyAction/g;
+ $filecontents =~s/QStateInvokeMethodAction/QtStateInvokeMethodAction/g;
+ $filecontents =~s/QStateFinishedEvent/QtStateFinishedEvent/g;
+ $filecontents =~s/QStateFinishedTransition/QtStateFinishedTransition/g;
+ $filecontents =~s/QStateMachine/QtStateMachine/g;
+ $filecontents =~s/QTransition/QtTransition/g;
+ $filecontents =~s/QMouseEventTransition/QtMouseEventTransition/g;
+ $filecontents =~s/QKeyEventTransition/QtKeyEventTransition/g;
+ $filecontents =~s/QGraphicsWidget/QtGraphicsWidget/g;
+ $filecontents =~s/Q_CORE_EXPORT/Q_ANIMATION_EXPORT/g;
+ $filecontents =~s/Q_GUI_EXPORT/Q_ANIMATION_EXPORT/g;
+ $filecontents =~s/QBoundEvent/QtBoundEvent/g;
+
+ $filecontents =~s/class Q_GUI_EXPORT/class/g;
+ $filecontents =~s/class Q_AUTOTEST_EXPORT/class/g;
+
+ $filecontents =~s/(#\s*include\s+["])q/${1}qt/g;
+
+ # moc stuff
+ $filecontents =~s/(#\s*include\s+["])moc_q/${1}moc_qt/g;
+
+ $filecontents =~s/\\since 4\.[0-9]//g;
+ $filecontents =~s/\\ingroup [a-z]+//g;
+
+ if (substr($filecontents, 0, 10) eq "/*********") {
+ my $endOfComment = index($filecontents, "*/");
+ $filecontents = substr($filecontents, $endOfComment + 2);
+ }
+ }
+ if ($ext eq ".pri" ) {
+ $filecontents =~s/\$\$PWD\/q/\$\$PWD\/qt/g;
+ $filecontents =~s/animation\/q/\$\$PWD\/qt/g;
+
+ # oooh such a hack this is
+ if ($baseFileName eq "statemachine") {
+ if (index($gitfile, "corelib/statemachine") >= 0) {
+ $baseFileName = "corelib_statemachine";
+ }
+ if (index($gitfile, "gui/statemachine") >= 0) {
+ $baseFileName = "gui_statemachine";
+ }
+
+ }
+
+ }
+
+ if ($ext eq ".pro") {
+ $filecontents = "$filecontents\ninclude(../../src/qtanimationframework.pri)\n";
+ }
+ close I;
+
+ mkpath $destinationPath, 0777 unless(-e "$destinationPath");
+
+ if ($ext eq ".h" or $ext eq ".cpp" or $ext eq ".qdoc") {
+ $baseFileName =~s/^q/qt/g;
+ }
+ my $targetFile = "$destinationPath/$baseFileName$ext";
+ open(O, "> " . $targetFile) || die "Could not open $targetFile for writing (no write permission?)";
+ local $/;
+ binmode O;
+ print O $filecontents;
+ close O;
+
+ my $xmlEntry = substr($targetFile, length($targetPath) + 1);
+ print "$xmlEntry\n";
+ print OXML "<add>$xmlEntry</add>\n";
+}
+
diff --git a/bin/syncqt b/bin/syncqt
index 7a9f1d3..8f797e8 100755
--- a/bin/syncqt
+++ b/bin/syncqt
@@ -23,6 +23,7 @@ my $basedir = $ENV{"QTDIR"};
$basedir =~ s=\\=/=g;
my %modules = ( # path to module name map
"QtGui" => "$basedir/src/gui",
+ "QtAnimation" => "$basedir/src/animation",
"QtOpenGL" => "$basedir/src/opengl",
"QtCore" => "$basedir/src/corelib",
"QtXml" => "$basedir/src/xml",
@@ -30,6 +31,7 @@ my %modules = ( # path to module name map
"QtSql" => "$basedir/src/sql",
"QtNetwork" => "$basedir/src/network",
"QtSvg" => "$basedir/src/svg",
+ "QtDeclarative" => "$basedir/src/declarative",
"QtScript" => "$basedir/src/script",
"QtScriptTools" => "$basedir/src/scripttools",
"Qt3Support" => "$basedir/src/qt3support",
@@ -680,8 +682,10 @@ foreach (@modules_to_sync) {
foreach(split(/ /, "$1")) {
$master_contents .= "#include <QtCore/QtCore>\n" if("$_" eq "core");
$master_contents .= "#include <QtGui/QtGui>\n" if("$_" eq "gui");
+ $master_contents .= "#include <QtAnimation/QtAnimation>\n" if("$_" eq "experimental-animation");
$master_contents .= "#include <QtNetwork/QtNetwork>\n" if("$_" eq "network");
$master_contents .= "#include <QtSvg/QtSvg>\n" if("$_" eq "svg");
+ $master_contents .= "#include <QtDeclarative/QtDeclarative>\n" if("$_" eq "declarative");
$master_contents .= "#include <QtScript/QtScript>\n" if("$_" eq "script");
$master_contents .= "#include <QtScriptTools/QtScriptTools>\n" if("$_" eq "scripttools");
$master_contents .= "#include <Qt3Support/Qt3Support>\n" if("$_" eq "qt3support");
diff --git a/configure b/configure
index 2298d5b..420994c 100755
--- a/configure
+++ b/configure
@@ -600,6 +600,7 @@ CFG_RELEASE_QMAKE=no
CFG_PHONON=auto
CFG_PHONON_BACKEND=yes
CFG_SVG=yes
+CFG_DECLARATIVE=yes
CFG_WEBKIT=auto # (yes|no|auto)
CFG_GFX_AVAILABLE="linuxfb transformed qvfb vnc multiscreen"
@@ -830,7 +831,7 @@ while [ "$#" -gt 0 ]; do
VAL=no
;;
#Qt style yes options
- -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-svg|-webkit|-scripttools|-rpath|-force-pkg-config)
+ -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xinput|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-universal|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-svg|-declarative|-webkit|-scripttools|-rpath|-force-pkg-config)
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
VAL=yes
;;
@@ -1724,6 +1725,17 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
fi
+ ;;
+ declarative)
+ if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
+ CFG_DECLARATIVE="yes"
+ else
+ if [ "$VAL" = "no" ]; then
+ CFG_DECLARATIVE="no"
+ else
+ UNKNOWN_OPT=yes
+ fi
+ fi
;;
webkit)
if [ "$VAL" = "yes" ] || [ "$VAL" = "auto" ]; then
@@ -3066,7 +3078,7 @@ Usage: $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir
[-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend]
[-no-openssl] [-openssl] [-openssl-linked]
[-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit]
- [-no-scripttools] [-scripttools]
+ [-no-scripttools] [-scripttools] [-no-declarative] [-declarative]
[additional platform specific options (see below)]
@@ -3215,6 +3227,9 @@ fi
-no-scripttools .... Do not build the QtScriptTools module.
+ -scripttools ....... Build the QtScriptTools module.
+ -no-declarative .....Do not build the declarative module.
+ + -declarative ....... Build the declarative module.
+
-platform target ... The operating system and compiler you are building
on ($PLATFORM).
@@ -5961,6 +5976,12 @@ else
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SVG"
fi
+if [ "$CFG_DECLARATIVE" = "yes" ]; then
+ QT_CONFIG="$QT_CONFIG declarative"
+else
+ QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DECLARATIVE"
+fi
+
if [ "$CFG_WEBKIT" = "auto" ]; then
CFG_WEBKIT="$canBuildWebKit"
fi
@@ -6846,6 +6867,7 @@ echo "QtXmlPatterns module $CFG_XMLPATTERNS"
echo "Phonon module ....... $CFG_PHONON"
echo "SVG module .......... $CFG_SVG"
echo "WebKit module ....... $CFG_WEBKIT"
+echo "Declarative module .. $CFG_DECLARATIVE"
echo "STL support ......... $CFG_STL"
echo "PCH support ......... $CFG_PRECOMPILE"
echo "MMX/3DNOW/SSE/SSE2.. ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}"
diff --git a/configure.exe b/configure.exe
index ff71f08..54e8a60 100644
--- a/configure.exe
+++ b/configure.exe
Binary files differ
diff --git a/demos/boxes/boxes.pro b/demos/boxes/boxes.pro
index 6c1a331..a7b19a3 100644
--- a/demos/boxes/boxes.pro
+++ b/demos/boxes/boxes.pro
@@ -11,7 +11,6 @@ INCLUDEPATH += .
HEADERS += 3rdparty/fbm.h \
glbuffers.h \
glextensions.h \
- glshaders.h \
gltrianglemesh.h \
qtbox.h \
roundedbox.h \
@@ -21,7 +20,6 @@ HEADERS += 3rdparty/fbm.h \
SOURCES += 3rdparty/fbm.c \
glbuffers.cpp \
glextensions.cpp \
- glshaders.cpp \
main.cpp \
qtbox.cpp \
roundedbox.cpp \
diff --git a/demos/boxes/glextensions.cpp b/demos/boxes/glextensions.cpp
index 59256a8..5f168b6 100644
--- a/demos/boxes/glextensions.cpp
+++ b/demos/boxes/glextensions.cpp
@@ -47,23 +47,6 @@ bool GLExtensionFunctions::resolve(const QGLContext *context)
{
bool ok = true;
- RESOLVE_GL_FUNC(CreateShaderObjectARB)
- RESOLVE_GL_FUNC(ShaderSourceARB)
- RESOLVE_GL_FUNC(CompileShaderARB)
- RESOLVE_GL_FUNC(GetObjectParameterivARB)
- RESOLVE_GL_FUNC(DeleteObjectARB)
- RESOLVE_GL_FUNC(GetInfoLogARB)
- RESOLVE_GL_FUNC(CreateProgramObjectARB)
- RESOLVE_GL_FUNC(AttachObjectARB)
- RESOLVE_GL_FUNC(DetachObjectARB)
- RESOLVE_GL_FUNC(LinkProgramARB)
- RESOLVE_GL_FUNC(UseProgramObjectARB)
- RESOLVE_GL_FUNC(GetUniformLocationARB)
- RESOLVE_GL_FUNC(Uniform1iARB)
- RESOLVE_GL_FUNC(Uniform1fARB)
- RESOLVE_GL_FUNC(Uniform4fARB)
- RESOLVE_GL_FUNC(UniformMatrix4fvARB)
-
RESOLVE_GL_FUNC(GenFramebuffersEXT)
RESOLVE_GL_FUNC(GenRenderbuffersEXT)
RESOLVE_GL_FUNC(BindRenderbufferEXT)
@@ -88,26 +71,6 @@ bool GLExtensionFunctions::resolve(const QGLContext *context)
return ok;
}
-bool GLExtensionFunctions::glslSupported() {
- return CreateShaderObjectARB
- && CreateShaderObjectARB
- && ShaderSourceARB
- && CompileShaderARB
- && GetObjectParameterivARB
- && DeleteObjectARB
- && GetInfoLogARB
- && CreateProgramObjectARB
- && AttachObjectARB
- && DetachObjectARB
- && LinkProgramARB
- && UseProgramObjectARB
- && GetUniformLocationARB
- && Uniform1iARB
- && Uniform1fARB
- && Uniform4fARB
- && UniformMatrix4fvARB;
-}
-
bool GLExtensionFunctions::fboSupported() {
return GenFramebuffersEXT
&& GenRenderbuffersEXT
diff --git a/demos/boxes/glextensions.h b/demos/boxes/glextensions.h
index 74617d6..4755532 100644
--- a/demos/boxes/glextensions.h
+++ b/demos/boxes/glextensions.h
@@ -47,23 +47,6 @@
/*
Functions resolved:
-glCreateShaderObjectARB
-glShaderSourceARB
-glCompileShaderARB
-glGetObjectParameterivARB
-glDeleteObjectARB
-glGetInfoLogARB
-glCreateProgramObjectARB
-glAttachObjectARB
-glDetachObjectARB
-glLinkProgramARB
-glUseProgramObjectARB
-glGetUniformLocationARB
-glUniform1iARB
-glUniform1fARB
-glUniform4fARB
-glUniformMatrix4fvARB
-
glGenFramebuffersEXT
glGenRenderbuffersEXT
glBindRenderbufferEXT
@@ -136,39 +119,6 @@ typedef ptrdiff_t GLsizeiptr;
#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
#endif
-#ifndef GL_ARB_vertex_shader
-#define GL_VERTEX_SHADER_ARB 0x8B31
-#endif
-
-#ifndef GL_ARB_fragment_shader
-#define GL_FRAGMENT_SHADER_ARB 0x8B30
-#endif
-
-#ifndef GL_ARB_shader_objects
-typedef char GLcharARB;
-typedef unsigned int GLhandleARB;
-#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81
-#define GL_OBJECT_LINK_STATUS_ARB 0x8B82
-#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84
-#endif
-
-typedef GLhandleARB (APIENTRY *_glCreateShaderObjectARB) (GLenum);
-typedef void (APIENTRY *_glShaderSourceARB) (GLhandleARB, GLuint, const GLcharARB**, GLint *);
-typedef void (APIENTRY *_glCompileShaderARB) (GLhandleARB);
-typedef void (APIENTRY *_glGetObjectParameterivARB) (GLhandleARB, GLenum, int *);
-typedef void (APIENTRY *_glDeleteObjectARB) (GLhandleARB);
-typedef void (APIENTRY *_glGetInfoLogARB) (GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
-typedef GLhandleARB (APIENTRY *_glCreateProgramObjectARB) ();
-typedef void (APIENTRY *_glAttachObjectARB) (GLhandleARB, GLhandleARB);
-typedef void (APIENTRY *_glDetachObjectARB) (GLhandleARB, GLhandleARB);
-typedef void (APIENTRY *_glLinkProgramARB) (GLhandleARB);
-typedef void (APIENTRY *_glUseProgramObjectARB) (GLhandleARB);
-typedef GLint (APIENTRY *_glGetUniformLocationARB) (GLhandleARB, const GLcharARB *);
-typedef void (APIENTRY *_glUniform1iARB) (GLint, GLint);
-typedef void (APIENTRY *_glUniform1fARB) (GLint, GLfloat);
-typedef void (APIENTRY *_glUniform4fARB) (GLint, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (APIENTRY *_glUniformMatrix4fvARB) (GLint, GLuint, GLboolean, const GLfloat *);
-
typedef void (APIENTRY *_glGenFramebuffersEXT) (GLsizei, GLuint *);
typedef void (APIENTRY *_glGenRenderbuffersEXT) (GLsizei, GLuint *);
typedef void (APIENTRY *_glBindRenderbufferEXT) (GLenum, GLuint);
@@ -194,27 +144,9 @@ struct GLExtensionFunctions
{
bool resolve(const QGLContext *context);
- bool glslSupported();
bool fboSupported();
bool openGL15Supported(); // the rest: multi-texture, 3D-texture, vertex buffer objects
- _glCreateShaderObjectARB CreateShaderObjectARB;
- _glShaderSourceARB ShaderSourceARB;
- _glCompileShaderARB CompileShaderARB;
- _glGetObjectParameterivARB GetObjectParameterivARB;
- _glDeleteObjectARB DeleteObjectARB;
- _glGetInfoLogARB GetInfoLogARB;
- _glCreateProgramObjectARB CreateProgramObjectARB;
- _glAttachObjectARB AttachObjectARB;
- _glDetachObjectARB DetachObjectARB;
- _glLinkProgramARB LinkProgramARB;
- _glUseProgramObjectARB UseProgramObjectARB;
- _glGetUniformLocationARB GetUniformLocationARB;
- _glUniform1iARB Uniform1iARB;
- _glUniform1fARB Uniform1fARB;
- _glUniform4fARB Uniform4fARB;
- _glUniformMatrix4fvARB UniformMatrix4fvARB;
-
_glGenFramebuffersEXT GenFramebuffersEXT;
_glGenRenderbuffersEXT GenRenderbuffersEXT;
_glBindRenderbufferEXT BindRenderbufferEXT;
@@ -243,23 +175,6 @@ inline GLExtensionFunctions &getGLExtensionFunctions()
return funcs;
}
-#define glCreateShaderObjectARB getGLExtensionFunctions().CreateShaderObjectARB
-#define glShaderSourceARB getGLExtensionFunctions().ShaderSourceARB
-#define glCompileShaderARB getGLExtensionFunctions().CompileShaderARB
-#define glGetObjectParameterivARB getGLExtensionFunctions().GetObjectParameterivARB
-#define glDeleteObjectARB getGLExtensionFunctions().DeleteObjectARB
-#define glGetInfoLogARB getGLExtensionFunctions().GetInfoLogARB
-#define glCreateProgramObjectARB getGLExtensionFunctions().CreateProgramObjectARB
-#define glAttachObjectARB getGLExtensionFunctions().AttachObjectARB
-#define glDetachObjectARB getGLExtensionFunctions().DetachObjectARB
-#define glLinkProgramARB getGLExtensionFunctions().LinkProgramARB
-#define glUseProgramObjectARB getGLExtensionFunctions().UseProgramObjectARB
-#define glGetUniformLocationARB getGLExtensionFunctions().GetUniformLocationARB
-#define glUniform1iARB getGLExtensionFunctions().Uniform1iARB
-#define glUniform1fARB getGLExtensionFunctions().Uniform1fARB
-#define glUniform4fARB getGLExtensionFunctions().Uniform4fARB
-#define glUniformMatrix4fvARB getGLExtensionFunctions().UniformMatrix4fvARB
-
#define glGenFramebuffersEXT getGLExtensionFunctions().GenFramebuffersEXT
#define glGenRenderbuffersEXT getGLExtensionFunctions().GenRenderbuffersEXT
#define glBindRenderbufferEXT getGLExtensionFunctions().BindRenderbufferEXT
diff --git a/demos/boxes/glshaders.cpp b/demos/boxes/glshaders.cpp
deleted file mode 100644
index b6999a8..0000000
--- a/demos/boxes/glshaders.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, 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.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "glshaders.h"
-
-#define GLSHADERS_ASSERT_OPENGL(prefix, assertion, returnStatement) \
-if (m_failed || !(assertion)) { \
- if (!m_failed) qCritical(prefix ": The necessary OpenGL functions are not available."); \
- m_failed = true; \
- returnStatement; \
-}
-
-
-GLShader::GLShader(const char *data, int size, GLenum shaderType)
-: m_compileError(false), m_failed(false)
-{
- GLSHADERS_ASSERT_OPENGL("GLShader::GLShader",
- glCreateShaderObjectARB && glShaderSourceARB && glCompileShaderARB && glGetObjectParameterivARB, return)
-
- m_shader = glCreateShaderObjectARB(shaderType);
-
- GLint glSize = size;
- glShaderSourceARB(m_shader, 1, &data, &glSize);
- glCompileShaderARB(m_shader);
- int status;
- glGetObjectParameterivARB(m_shader, GL_OBJECT_COMPILE_STATUS_ARB, &status);
- m_compileError = (status != 1);
-}
-
-GLShader::GLShader(const QString& fileName, GLenum shaderType)
- : m_compileError(false), m_failed(false)
-{
- GLSHADERS_ASSERT_OPENGL("GLShader::GLShader",
- glCreateShaderObjectARB && glShaderSourceARB && glCompileShaderARB && glGetObjectParameterivARB, return)
-
- m_shader = glCreateShaderObjectARB(shaderType);
-
- QFile file(fileName);
- if (file.open(QIODevice::ReadOnly)) {
- QByteArray bytes = file.readAll();
- GLint size = file.size();
- const char *p = bytes.data();
- file.close();
- glShaderSourceARB(m_shader, 1, &p, &size);
- glCompileShaderARB(m_shader);
- int status;
- glGetObjectParameterivARB(m_shader, GL_OBJECT_COMPILE_STATUS_ARB, &status);
- m_compileError = (status != 1);
- } else {
- m_compileError = true;
- }
-}
-
-GLShader::~GLShader()
-{
- GLSHADERS_ASSERT_OPENGL("GLShader::~GLShader", glDeleteObjectARB, return)
-
- glDeleteObjectARB(m_shader);
-}
-
-QString GLShader::log()
-{
- GLSHADERS_ASSERT_OPENGL("GLShader::log", glGetObjectParameterivARB
- && glGetInfoLogARB, return QLatin1String("GLSL not supported."))
-
- int length;
- glGetObjectParameterivARB(m_shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length);
- char *log = new char[length + 1];
- GLsizei glLength = length;
- glGetInfoLogARB(m_shader, glLength, &glLength, log);
- log[glLength] = '\0';
- QString result(log);
- delete log;
- return result;
-}
-
-GLVertexShader::GLVertexShader(const char *data, int size) : GLShader(data, size, GL_VERTEX_SHADER_ARB)
-{
-}
-
-GLVertexShader::GLVertexShader(const QString& fileName) : GLShader(fileName, GL_VERTEX_SHADER_ARB)
-{
-}
-
-GLFragmentShader::GLFragmentShader(const char *data, int size) : GLShader(data, size, GL_FRAGMENT_SHADER_ARB)
-{
-}
-
-GLFragmentShader::GLFragmentShader(const QString& fileName) : GLShader(fileName, GL_FRAGMENT_SHADER_ARB)
-{
-}
-
-GLProgram::GLProgram() : m_linked(false), m_linkError(false), m_failed(false)
-{
- GLSHADERS_ASSERT_OPENGL("GLProgram::GLProgram", glCreateProgramObjectARB, return)
-
- m_program = glCreateProgramObjectARB();
-}
-
-GLProgram::~GLProgram()
-{
- GLSHADERS_ASSERT_OPENGL("GLProgram::~GLProgram", glDeleteObjectARB, return)
-
- glDeleteObjectARB(m_program);
-}
-
-void GLProgram::attach(const GLShader &shader)
-{
- GLSHADERS_ASSERT_OPENGL("GLProgram::attach", glAttachObjectARB, return)
-
- glAttachObjectARB(m_program, shader.m_shader);
- m_linked = m_linkError = false;
-}
-
-void GLProgram::detach(const GLShader &shader)
-{
- GLSHADERS_ASSERT_OPENGL("GLProgram::detach", glDetachObjectARB, return)
-
- glDetachObjectARB(m_program, shader.m_shader);
- m_linked = m_linkError = false;
-}
-
-bool GLProgram::failed()
-{
- if (m_failed || m_linkError)
- return true;
-
- if (m_linked)
- return false;
-
- GLSHADERS_ASSERT_OPENGL("GLProgram::failed", glLinkProgramARB && glGetObjectParameterivARB, return true)
-
- glLinkProgramARB(m_program);
- int status;
- glGetObjectParameterivARB(m_program, GL_OBJECT_LINK_STATUS_ARB, &status);
- m_linkError = !(m_linked = (status == 1));
- return m_linkError;
-}
-
-QString GLProgram::log()
-{
- GLSHADERS_ASSERT_OPENGL("GLProgram::log", glGetObjectParameterivARB && glGetInfoLogARB,
- return QLatin1String("Failed."))
-
- int length;
- glGetObjectParameterivARB(m_program, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length);
- char *log = new char[length + 1];
- GLsizei glLength = length;
- glGetInfoLogARB(m_program, glLength, &glLength, log);
- log[glLength] = '\0';
- QString result(log);
- delete log;
- return result;
-}
-
-void GLProgram::bind()
-{
- GLSHADERS_ASSERT_OPENGL("GLProgram::bind", glUseProgramObjectARB, return)
-
- if (!failed())
- glUseProgramObjectARB(m_program);
-}
-
-void GLProgram::unbind()
-{
- GLSHADERS_ASSERT_OPENGL("GLProgram::bind", glUseProgramObjectARB, return)
-
- glUseProgramObjectARB(0);
-}
-
-bool GLProgram::hasParameter(const QString& name)
-{
- GLSHADERS_ASSERT_OPENGL("GLProgram::hasParameter", glGetUniformLocationARB, return false)
-
- if (!failed()) {
- QByteArray asciiName = name.toAscii();
- return -1 != glGetUniformLocationARB(m_program, asciiName.data());
- }
- return false;
-}
-
-void GLProgram::setInt(const QString& name, int value)
-{
- GLSHADERS_ASSERT_OPENGL("GLProgram::setInt", glGetUniformLocationARB && glUniform1iARB, return)
-
- if (!failed()) {
- QByteArray asciiName = name.toAscii();
- int loc = glGetUniformLocationARB(m_program, asciiName.data());
- glUniform1iARB(loc, value);
- }
-}
-
-void GLProgram::setFloat(const QString& name, float value)
-{
- GLSHADERS_ASSERT_OPENGL("GLProgram::setFloat", glGetUniformLocationARB && glUniform1fARB, return)
-
- if (!failed()) {
- QByteArray asciiName = name.toAscii();
- int loc = glGetUniformLocationARB(m_program, asciiName.data());
- glUniform1fARB(loc, value);
- }
-}
-
-void GLProgram::setColor(const QString& name, QRgb value)
-{
- GLSHADERS_ASSERT_OPENGL("GLProgram::setColor", glGetUniformLocationARB && glUniform4fARB, return)
-
- //qDebug() << "Setting color" << name;
- if (!failed()) {
- QByteArray asciiName = name.toAscii();
- int loc = glGetUniformLocationARB(m_program, asciiName.data());
- //qDebug() << "Location of" << name << "is" << loc;
- QColor color(value);
- glUniform4fARB(loc, color.redF(), color.greenF(), color.blueF(), color.alphaF());
- }
-}
-
-void GLProgram::setMatrix(const QString& name, const gfx::Matrix4x4f &mat)
-{
- GLSHADERS_ASSERT_OPENGL("GLProgram::setMatrix", glGetUniformLocationARB && glUniformMatrix4fvARB, return)
-
- if (!failed()) {
- QByteArray asciiName = name.toAscii();
- int loc = glGetUniformLocationARB(m_program, asciiName.data());
- //qDebug() << "Location of" << name << "is" << loc;
- glUniformMatrix4fvARB(loc, 1, GL_FALSE, mat.bits());
- }
-} \ No newline at end of file
diff --git a/demos/boxes/scene.cpp b/demos/boxes/scene.cpp
index 1040e17..5f1fe14 100644
--- a/demos/boxes/scene.cpp
+++ b/demos/boxes/scene.cpp
@@ -531,11 +531,11 @@ Scene::~Scene()
if (texture) delete texture;
if (m_mainCubemap)
delete m_mainCubemap;
- foreach (GLProgram *program, m_programs)
+ foreach (QGLShaderProgram *program, m_programs)
if (program) delete program;
if (m_vertexShader)
delete m_vertexShader;
- foreach (GLFragmentShader *shader, m_fragmentShaders)
+ foreach (QGLShader *shader, m_fragmentShaders)
if (shader) delete shader;
foreach (GLRenderTargetCube *rt, m_cubemaps)
if (rt) delete rt;
@@ -549,16 +549,18 @@ void Scene::initGL()
{
m_box = new GLRoundedBox(0.25f, 1.0f, 10);
- m_vertexShader = new GLVertexShader(":/res/boxes/basic.vsh");
+ m_vertexShader = new QGLShader(":/res/boxes/basic.vsh", QGLShader::VertexShader);
QStringList list;
list << ":/res/boxes/cubemap_posx.jpg" << ":/res/boxes/cubemap_negx.jpg" << ":/res/boxes/cubemap_posy.jpg"
<< ":/res/boxes/cubemap_negy.jpg" << ":/res/boxes/cubemap_posz.jpg" << ":/res/boxes/cubemap_negz.jpg";
m_environment = new GLTextureCube(list, qMin(1024, m_maxTextureSize));
- m_environmentShader = new GLFragmentShader(environmentShaderText, strlen(environmentShaderText));
- m_environmentProgram = new GLProgram;
- m_environmentProgram->attach(*m_vertexShader);
- m_environmentProgram->attach(*m_environmentShader);
+ m_environmentShader = new QGLShader(QGLShader::FragmentShader);
+ m_environmentShader->setSourceCode(environmentShaderText);
+ m_environmentProgram = new QGLShaderProgram;
+ m_environmentProgram->addShader(m_vertexShader);
+ m_environmentProgram->addShader(m_environmentShader);
+ m_environmentProgram->link();
const int NOISE_SIZE = 128; // for a different size, B and BM in fbm.c must also be changed
m_noise = new GLTexture3D(NOISE_SIZE, NOISE_SIZE, NOISE_SIZE);
@@ -610,19 +612,19 @@ void Scene::initGL()
filter = QStringList("*.fsh");
files = QDir(":/res/boxes/").entryInfoList(filter, QDir::Files | QDir::Readable);
foreach (QFileInfo file, files) {
- GLProgram *program = new GLProgram;
- GLFragmentShader* shader = new GLFragmentShader(file.absoluteFilePath());
+ QGLShaderProgram *program = new QGLShaderProgram;
+ QGLShader* shader = new QGLShader(file.absoluteFilePath(), QGLShader::FragmentShader);
// The program does not take ownership over the shaders, so store them in a vector so they can be deleted afterwards.
- program->attach(*m_vertexShader);
- program->attach(*shader);
- if (program->failed()) {
+ program->addShader(m_vertexShader);
+ program->addShader(shader);
+ if (!program->link()) {
qWarning("Failed to compile and link shader program");
qWarning("Vertex shader log:");
- qWarning() << m_vertexShader->log();
+ qWarning() << m_vertexShader->errors();
qWarning() << "Fragment shader log ( file =" << file.absoluteFilePath() << "):";
- qWarning() << shader->log();
+ qWarning() << shader->errors();
qWarning("Shader program log:");
- qWarning() << program->log();
+ qWarning() << program->errors();
delete shader;
delete program;
@@ -633,13 +635,13 @@ void Scene::initGL()
m_programs << program;
m_renderOptions->addShader(file.baseName());
- program->bind();
- m_cubemaps << (program->hasParameter("env") ? new GLRenderTargetCube(qMin(256, m_maxTextureSize)) : 0);
- program->unbind();
+ program->enable();
+ m_cubemaps << ((program->uniformLocation("env") != -1) ? new GLRenderTargetCube(qMin(256, m_maxTextureSize)) : 0);
+ program->disable();
}
if (m_programs.size() == 0)
- m_programs << new GLProgram;
+ m_programs << new QGLShaderProgram;
m_renderOptions->emitParameterChanged();
}
@@ -674,12 +676,12 @@ void Scene::renderBoxes(const gfx::Matrix4x4f &view, int excludeBox)
// Don't render the environment if the environment texture can't be set for the correct sampler.
if (glActiveTexture) {
m_environment->bind();
- m_environmentProgram->bind();
- m_environmentProgram->setInt("tex", 0);
- m_environmentProgram->setInt("env", 1);
- m_environmentProgram->setInt("noise", 2);
+ m_environmentProgram->enable();
+ m_environmentProgram->setUniformValue("tex", GLint(0));
+ m_environmentProgram->setUniformValue("env", GLint(1));
+ m_environmentProgram->setUniformValue("noise", GLint(2));
m_box->draw();
- m_environmentProgram->unbind();
+ m_environmentProgram->disable();
m_environment->unbind();
}
@@ -707,14 +709,18 @@ void Scene::renderBoxes(const gfx::Matrix4x4f &view, int excludeBox)
else
m_environment->bind();
}
- m_programs[i]->bind();
- m_programs[i]->setInt("tex", 0);
- m_programs[i]->setInt("env", 1);
- m_programs[i]->setInt("noise", 2);
- m_programs[i]->setMatrix("view", view);
- m_programs[i]->setMatrix("invView", invView);
+ m_programs[i]->enable();
+ m_programs[i]->setUniformValue("tex", GLint(0));
+ m_programs[i]->setUniformValue("env", GLint(1));
+ m_programs[i]->setUniformValue("noise", GLint(2));
+ QMatrix4x4 mview;
+ QMatrix4x4 minvview;
+ memcpy(mview.data(), view.bits(), sizeof(float) * 16);
+ memcpy(minvview.data(), invView.bits(), sizeof(float) * 16);
+ m_programs[i]->setUniformValue("view", mview);
+ m_programs[i]->setUniformValue("invView", minvview);
m_box->draw();
- m_programs[i]->unbind();
+ m_programs[i]->disable();
if (glActiveTexture) {
if (m_dynamicCubemap && m_cubemaps[i])
@@ -737,14 +743,18 @@ void Scene::renderBoxes(const gfx::Matrix4x4f &view, int excludeBox)
m_environment->bind();
}
- m_programs[m_currentShader]->bind();
- m_programs[m_currentShader]->setInt("tex", 0);
- m_programs[m_currentShader]->setInt("env", 1);
- m_programs[m_currentShader]->setInt("noise", 2);
- m_programs[m_currentShader]->setMatrix("view", view);
- m_programs[m_currentShader]->setMatrix("invView", invView);
+ m_programs[m_currentShader]->enable();
+ m_programs[m_currentShader]->setUniformValue("tex", GLint(0));
+ m_programs[m_currentShader]->setUniformValue("env", GLint(1));
+ m_programs[m_currentShader]->setUniformValue("noise", GLint(2));
+ QMatrix4x4 mview;
+ QMatrix4x4 minvview;
+ memcpy(mview.data(), view.bits(), sizeof(float) * 16);
+ memcpy(minvview.data(), invView.bits(), sizeof(float) * 16);
+ m_programs[m_currentShader]->setUniformValue("view", mview);
+ m_programs[m_currentShader]->setUniformValue("invView", minvview);
m_box->draw();
- m_programs[m_currentShader]->unbind();
+ m_programs[m_currentShader]->disable();
if (glActiveTexture) {
if (m_dynamicCubemap)
@@ -1021,20 +1031,20 @@ void Scene::toggleDynamicCubemap(int state)
void Scene::setColorParameter(const QString &name, QRgb color)
{
// set the color in all programs
- foreach (GLProgram *program, m_programs) {
- program->bind();
- program->setColor(name, color);
- program->unbind();
+ foreach (QGLShaderProgram *program, m_programs) {
+ program->enable();
+ program->setUniformValue(program->uniformLocation(name), QColor(color));
+ program->disable();
}
}
void Scene::setFloatParameter(const QString &name, float value)
{
// set the color in all programs
- foreach (GLProgram *program, m_programs) {
- program->bind();
- program->setFloat(name, value);
- program->unbind();
+ foreach (QGLShaderProgram *program, m_programs) {
+ program->enable();
+ program->setUniformValue(program->uniformLocation(name), value);
+ program->disable();
}
}
diff --git a/demos/boxes/scene.h b/demos/boxes/scene.h
index 2db9317..c056739 100644
--- a/demos/boxes/scene.h
+++ b/demos/boxes/scene.h
@@ -53,7 +53,6 @@
#include "vector.h"
#include "trackball.h"
#include "glbuffers.h"
-#include "glshaders.h"
#include "qtbox.h"
#define PI 3.14159265358979
@@ -231,11 +230,11 @@ private:
GLTexture3D *m_noise;
GLRenderTargetCube *m_mainCubemap;
QVector<GLRenderTargetCube *> m_cubemaps;
- QVector<GLProgram *> m_programs;
- GLVertexShader *m_vertexShader;
- QVector<GLFragmentShader *> m_fragmentShaders;
- GLFragmentShader *m_environmentShader;
- GLProgram *m_environmentProgram;
+ QVector<QGLShaderProgram *> m_programs;
+ QGLShader *m_vertexShader;
+ QVector<QGLShader *> m_fragmentShaders;
+ QGLShader *m_environmentShader;
+ QGLShaderProgram *m_environmentProgram;
};
diff --git a/demos/declarative/calculator/CalcButton.qml b/demos/declarative/calculator/CalcButton.qml
new file mode 100644
index 0000000..c925314
--- /dev/null
+++ b/demos/declarative/calculator/CalcButton.qml
@@ -0,0 +1,40 @@
+<Item id="Button" width="50" height="30">
+
+ <properties>
+ <Property name="operation" type="string"/>
+ <Property name="toggable" value="false"/>
+ <Property name="toggled" value="false"/>
+ </properties>
+
+ <Script>
+ function buttonClicked(operation) {
+ if (Button.toggable == true) {
+ if (Button.toggled == true) {
+ Button.toggled = false;
+ Button.state = 'Toggled';
+ } else {
+ Button.toggled = true;
+ Button.state = '';
+ }
+ }
+ else
+ doOp(operation);
+ }
+ </Script>
+
+ <Image id="Image" src="pics/button.sci" width="{Button.width}" height="{Button.height}"/>
+ <Image id="ImagePressed" src="pics/button-pressed.sci" width="{Button.width}" height="{Button.height}" opacity="0"/>
+ <Text anchors.centeredIn="{Image}" text="{Button.operation}" color="white" font.bold="true"/>
+ <MouseRegion id="MouseRegion" anchors.fill="{Button}" onClicked="buttonClicked(Button.operation)"/>
+
+ <states>
+ <State name="Pressed" when="{MouseRegion.pressed == true}">
+ <SetProperties target="{ImagePressed}" opacity="1"/>
+ </State>
+ <State name="Toggled" when="{Button.toggled == true}">
+ <SetProperties target="{ImagePressed}" opacity="1"/>
+ </State>
+ </states>
+
+</Item>
+
diff --git a/demos/declarative/calculator/calculator.js b/demos/declarative/calculator/calculator.js
new file mode 100644
index 0000000..774b232
--- /dev/null
+++ b/demos/declarative/calculator/calculator.js
@@ -0,0 +1,87 @@
+
+var curVal = 0;
+var memory = 0;
+var lastOp = "";
+var timer = 0;
+
+function disabled(op) {
+ if (op == "." && CurNum.text.toString().search(/\./) != -1) {
+ return true;
+ } else if (op == "Sqrt" && CurNum.text.toString().search(/-/) != -1) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function doOp(op) {
+ if (disabled(op)) {
+ return;
+ }
+
+ if (op.toString().length==1 && ((op >= "0" && op <= "9") || op==".") ) {
+ if (CurNum.text.toString().length >= 14)
+ return; // No arbitrary length numbers
+ if (lastOp.toString().length == 1 && ((lastOp >= "0" && lastOp <= "9") || lastOp==".") ) {
+ CurNum.text = CurNum.text + op.toString();
+ } else {
+ CurNum.text = op;
+ }
+ lastOp = op;
+ return;
+ }
+ lastOp = op;
+
+ // Pending operations
+ if (CurrentOperation.text == "+") {
+ CurNum.text = Number(CurNum.text.valueOf()) + Number(curVal.valueOf());
+ } else if (CurrentOperation.text == "-") {
+ CurNum.text = Number(curVal) - Number(CurNum.text.valueOf());
+ } else if (CurrentOperation.text == "x") {
+ CurNum.text = Number(curVal) * Number(CurNum.text.valueOf());
+ } else if (CurrentOperation.text == "/") {
+ CurNum.text = Number(Number(curVal) / Number(CurNum.text.valueOf())).toString();
+ } else if (CurrentOperation.text == "=") {
+ }
+
+ if (op == "+" || op == "-" || op == "x" || op == "/") {
+ CurrentOperation.text = op;
+ curVal = CurNum.text.valueOf();
+ return;
+ }
+ curVal = 0;
+ CurrentOperation.text = "";
+
+ // Immediate operations
+ if (op == "1/x") { // reciprocal
+ CurNum.text = (1 / CurNum.text.valueOf()).toString();
+ } else if (op == "^2") { // squared
+ CurNum.text = (CurNum.text.valueOf() * CurNum.text.valueOf()).toString();
+ } else if (op == "Abs") {
+ CurNum.text = (Math.abs(CurNum.text.valueOf())).toString();
+ } else if (op == "Int") {
+ CurNum.text = (Math.floor(CurNum.text.valueOf())).toString();
+ } else if (op == "+/-") { // plus/minus
+ CurNum.text = (CurNum.text.valueOf() * -1).toString();
+ } else if (op == "Sqrt") { // square root
+ CurNum.text = (Math.sqrt(CurNum.text.valueOf())).toString();
+ } else if (op == "MC") { // memory clear
+ memory = 0;
+ } else if (op == "M+") { // memory increment
+ memory += CurNum.text.valueOf();
+ } else if (op == "MR") { // memory recall
+ CurNum.text = memory.toString();
+ } else if (op == "MS") { // memory set
+ memory = CurNum.text.valueOf();
+ } else if (op == "Bksp") {
+ CurNum.text = CurNum.text.toString().slice(0, -1);
+ } else if (op == "C") {
+ CurNum.text = "0";
+ } else if (op == "AC") {
+ curVal = 0;
+ memory = 0;
+ lastOp = "";
+ CurNum.text ="0";
+ }
+}
+
diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml
new file mode 100644
index 0000000..4ada896
--- /dev/null
+++ b/demos/declarative/calculator/calculator.qml
@@ -0,0 +1,83 @@
+<Rect id="MainWindow" width="320" height="270" color="black">
+ <Script src="calculator.js"/>
+
+ <VerticalLayout spacing="2" margin="2">
+ <Rect id="Container" height="60" z="2" width="316" pen.color="white" color="#343434">
+ <Text id="CurNum" font.bold="true" color="white" font.size="16" anchors.right="{Container.right}" anchors.rightMargin="5"
+ anchors.verticalCenter="{Container.verticalCenter}"/>
+ <Text id="CurrentOperation" color="white" font.bold="true" font.size="16" anchors.left="{Container.left}" anchors.leftMargin="5"
+ anchors.verticalCenter="{Container.verticalCenter}"/>
+ </Rect>
+
+ <Item width="320" height="30">
+ <CalcButton id="AdvancedCheckBox" x="55" width="206" operation="Advanced Mode" toggable="true"/>
+ </Item>
+
+ <Item width="320">
+ <Item id="BasicButtons" x="55" width="160" height="160">
+ <CalcButton operation="Bksp" id="Bksp" width="67" opacity="0"/>
+ <CalcButton operation="C" id="C" width="76"/>
+ <CalcButton operation="AC" id="AC" x="78" width="76"/>
+
+ <GridLayout id="NumKeypad" y="32" spacing="2" columns="3">
+ <CalcButton operation="7"/>
+ <CalcButton operation="8"/>
+ <CalcButton operation="9"/>
+ <CalcButton operation="4"/>
+ <CalcButton operation="5"/>
+ <CalcButton operation="6"/>
+ <CalcButton operation="1"/>
+ <CalcButton operation="2"/>
+ <CalcButton operation="3"/>
+ </GridLayout>
+
+ <HorizontalLayout y="128" spacing="2">
+ <CalcButton operation="0" width="50"/>
+ <CalcButton operation="." x="77" width="50"/>
+ <CalcButton operation="=" id="Equals" x="77" width="102"/>
+ </HorizontalLayout>
+
+ <VerticalLayout id="SimpleOperations" x="156" y="0" spacing="2">
+ <CalcButton operation="x"/>
+ <CalcButton operation="/"/>
+ <CalcButton operation="-"/>
+ <CalcButton operation="+"/>
+ </VerticalLayout>
+ </Item>
+
+ <GridLayout id="AdvancedButtons" x="350" spacing="2" columns="2" opacity="0">
+ <CalcButton operation="Abs"/>
+ <CalcButton operation="Int"/>
+ <CalcButton operation="MC"/>
+ <CalcButton operation="Sqrt"/>
+ <CalcButton operation="MR"/>
+ <CalcButton operation="^2"/>
+ <CalcButton operation="MS"/>
+ <CalcButton operation="1/x"/>
+ <CalcButton operation="M+"/>
+ <CalcButton operation="+/-"/>
+ </GridLayout>
+ </Item>
+ </VerticalLayout>
+
+ <states>
+ <State name="Advanced" when="{AdvancedCheckBox.toggled == true}">
+ <SetProperties target="{BasicButtons}" x="0"/>
+ <SetProperties target="{SimpleOperations}" y="32"/>
+ <SetProperties target="{Bksp}" opacity="1"/>
+ <SetProperties target="{C}" x="69" width="67"/>
+ <SetProperties target="{AC}" x="138" width="67"/>
+ <SetProperties target="{Equals}" width="50"/>
+ <SetProperties target="{AdvancedButtons}" x="210" opacity="1"/>
+ </State>
+ </states>
+
+ <transitions>
+ <Transition>
+ <NumericAnimation properties="x,y,width" easing="easeOutBounce" duration="500"/>
+ <NumericAnimation properties="opacity" easing="easeInOutQuad" duration="500"/>
+ </Transition>
+ </transitions>
+
+</Rect>
+
diff --git a/demos/declarative/calculator/pics/button-pressed.png b/demos/declarative/calculator/pics/button-pressed.png
new file mode 100644
index 0000000..1a24cee
--- /dev/null
+++ b/demos/declarative/calculator/pics/button-pressed.png
Binary files differ
diff --git a/demos/declarative/calculator/pics/button-pressed.sci b/demos/declarative/calculator/pics/button-pressed.sci
new file mode 100644
index 0000000..f3bc860
--- /dev/null
+++ b/demos/declarative/calculator/pics/button-pressed.sci
@@ -0,0 +1,5 @@
+gridLeft: 5
+gridTop: 5
+gridBottom: 5
+gridRight: 5
+imageFile: button-pressed.png
diff --git a/demos/declarative/calculator/pics/button.png b/demos/declarative/calculator/pics/button.png
new file mode 100644
index 0000000..88c8bf8
--- /dev/null
+++ b/demos/declarative/calculator/pics/button.png
Binary files differ
diff --git a/demos/declarative/calculator/pics/button.sci b/demos/declarative/calculator/pics/button.sci
new file mode 100644
index 0000000..b1c7929
--- /dev/null
+++ b/demos/declarative/calculator/pics/button.sci
@@ -0,0 +1,5 @@
+gridLeft: 5
+gridTop: 5
+gridBottom: 5
+gridRight: 5
+imageFile: button.png
diff --git a/demos/declarative/calculator/pics/clear.png b/demos/declarative/calculator/pics/clear.png
new file mode 100644
index 0000000..fb07a27c
--- /dev/null
+++ b/demos/declarative/calculator/pics/clear.png
Binary files differ
diff --git a/demos/declarative/mediabrowser/content/LikeOMeter.qml b/demos/declarative/mediabrowser/content/LikeOMeter.qml
new file mode 100644
index 0000000..68584a5
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/LikeOMeter.qml
@@ -0,0 +1,13 @@
+<Item id="Container">
+ <properties>
+ <Property name="rating" value="2"/>
+ </properties>
+
+ <HorizontalLayout>
+ <Star rating="0" onClicked="Container.rating = rating" on="{Container.rating >= 0}"/>
+ <Star rating="1" onClicked="Container.rating = rating" on="{Container.rating >= 1}"/>
+ <Star rating="2" onClicked="Container.rating = rating" on="{Container.rating >= 2}"/>
+ <Star rating="3" onClicked="Container.rating = rating" on="{Container.rating >= 3}"/>
+ <Star rating="4" onClicked="Container.rating = rating" on="{Container.rating >= 4}"/>
+ </HorizontalLayout>
+</Item>
diff --git a/demos/declarative/mediabrowser/content/MediaButton.qml b/demos/declarative/mediabrowser/content/MediaButton.qml
new file mode 100644
index 0000000..c92305a
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/MediaButton.qml
@@ -0,0 +1,21 @@
+<Item id="Container">
+ <signals>
+ <Signal name="clicked"/>
+ </signals>
+
+ <properties>
+ <Property name="text"/>
+ </properties>
+
+ <Image id="Image" src="pics/button.png"/>
+ <Image id="Pressed" src="pics/button-pressed.png" opacity="0"/>
+ <MouseRegion id="MouseRegion" anchors.fill="{Image}" onClicked="Container.clicked.emit();"/>
+ <Text font.bold="true" color="white" anchors.centeredIn="{Image}" text="{Container.text}"/>
+ <width>{Image.width}</width>
+
+ <states>
+ <State name="Pressed" when="{MouseRegion.pressed == true}">
+ <SetProperties target="{Pressed}" opacity="1"/>
+ </State>
+ </states>
+</Item>
diff --git a/demos/declarative/mediabrowser/content/MovieInfoContainer.qml b/demos/declarative/mediabrowser/content/MovieInfoContainer.qml
new file mode 100644
index 0000000..c53fab6
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/MovieInfoContainer.qml
@@ -0,0 +1,60 @@
+<Flipable id="Container">
+ <properties>
+ <Property name="frontContainer" value="{ContainerFront}"/>
+ <Property name="flickableArea" value="{Flickable}"/>
+ <Property name="movieTitle" value="N/A"/>
+ <Property name="movieDescription" value="..."/>
+ <Property name="rating" value="2"/>
+ </properties>
+
+ <signals>
+ <Signal name="closed"/>
+ </signals>
+
+ <transform>
+ <Axis id="Axis" xStart="{Container.width / 2}" xEnd="{Container.width / 2}" yEnd="1" />
+ </transform>
+
+ <front>
+ <Item id="ContainerFront" anchors.fill="{Container}">
+ <Rect anchors.fill="{parent}" color="black" opacity="0.4" pen.color="white" pen.width="2"/>
+
+ <MediaButton id="BackButton" x="630" y="400" text="Back" onClicked="Container.closed.emit()"/>
+ <MediaButton id="MoreButton" x="530" y="400" text="More..." onClicked="Container.state='Back'"/>
+
+ <Text id="TitleText" style="Raised" styleColor="black" color="white" x="320" y="30" width="{parent.width}"
+ text="{Container.movieTitle}" font.size="22"/>
+
+ <LikeOMeter x="320" y="75" rating="{Container.rating}"/>
+
+ <Flickable id="Flickable" x="320" width="380" height="260" y="120" clip="true" viewportWidth="380"
+ viewportHeight="{DescriptionText.height}">
+ <Text id="DescriptionText" wrap="true" color="white" width="{parent.width}"
+ text="{Container.movieDescription}" font.size="12"/>
+ </Flickable>
+
+ <ScrollBar id="ScrollBar" x="720" y="{Flickable.y}" width="7" height="{Flickable.height}" opacity="0"
+ flickableArea="{Flickable}" clip="true"/>
+ </Item>
+ </front>
+
+ <back>
+ <Item anchors.fill="{Container}">
+ <Rect anchors.fill="{parent}" color="black" opacity="0.4" pen.color="white" pen.width="2"/>
+ <MediaButton id="BackButton2" x="630" y="400" text="Back" onClicked="Container.state=''"/>
+ </Item>
+ </back>
+
+ <states>
+ <State name="Back">
+ <SetProperty target="{Axis}" property="rotation" value="180"/>
+ </State>
+ </states>
+
+ <transitions>
+ <Transition>
+ <NumericAnimation easing="easeInOutQuad" properties="rotation" duration="500"/>
+ </Transition>
+ </transitions>
+
+</Flipable>
diff --git a/demos/declarative/mediabrowser/content/MoviesPathView.qml b/demos/declarative/mediabrowser/content/MoviesPathView.qml
new file mode 100644
index 0000000..a13437a
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/MoviesPathView.qml
@@ -0,0 +1,74 @@
+<PathView id="Container">
+
+ <path>
+ <Path startX="-50" startY="40">
+ <PathAttribute name="scale" value="0.4"/>
+ <PathCubic x="400" y="220" control1X="140" control1Y="40" control2X="210" control2Y="220"/>
+ <PathAttribute name="scale" value="0.7"/>
+ <PathCubic x="850" y="40" control2X="660" control2Y="40" control1X="590" control1Y="220"/>
+ <PathAttribute name="scale" value="0.4"/>
+ </Path>
+ </path>
+
+ <delegate>
+ <Component id="MovieDelegate">
+ <Item id="Wrapper" width="220" height="310" scale="{Wrapper.PathView.scale}">
+ <Connection sender="{MovieInfoContainer}" script="if (Wrapper.state == 'Details') Wrapper.state = ''" signal="closed()"/>
+
+ <Script>
+ function movieClicked() {
+ if (MainWindow.minimized == true) {
+ MainWindow.minimized = false;
+ } else {
+ MovieInfoContainer.movieTitle = title;
+ MovieInfoContainer.flickableArea.yPosition = 0;
+ MovieInfoContainer.movieDescription = description;
+ MovieInfoContainer.rating = rating;
+ Wrapper.state = "Details";
+ }
+ }
+ </Script>
+
+ <Rect id="Dvd" anchors.fill="{parent}" color="white">
+ <Image src="{thumb}" width="215" height="305" anchors.centeredIn="{parent}" opaque="true"/>
+ <Image src="pics/reflection.png" anchors.centeredIn="{parent}"/>
+ <Image src="pics/shadow-right.png" x="220"/>
+ <Image src="pics/shadow-bottom.png" y="310"/>
+ <Image src="pics/shadow-corner.png" x="220" y="310"/>
+ </Rect>
+
+ <MouseRegion anchors.fill="{Wrapper}" onClicked="movieClicked()"/>
+
+ <states>
+ <State name="Details">
+ <ParentChange target="{Wrapper}" parent="{MovieInfoContainer.frontContainer}"/>
+ <SetProperties target="{Wrapper}" x="50" y="60" scale="1"/>
+ <SetProperties target="{MovieInfoContainer}" y="20"/>
+ <SetProperties target="{Container}" y="-480"/>
+ <SetProperties target="{CloseButton}" opacity="0"/>
+ <SetProperties target="{CategoryText}" y="-50"/>
+ </State>
+ <State name="Stacked" when="{MainWindow.minimized == true}">
+ <ParentChange target="{Wrapper}" parent="{Stack}"/>
+ <SetProperties target="{Wrapper}" x="0" y="0" scale="0.2"/>
+ <SetProperties target="{CloseButton}" opacity="0"/>
+ <SetProperties target="{CategoryText}" y="-50"/>
+ </State>
+ </states>
+
+ <transitions>
+ <Transition fromState="" toState="Details,Stacked">
+ <ParentChangeAction/>
+ <NumericAnimation properties="x,y,scale,opacity" duration="500" easing="easeInOutQuad"/>
+ </Transition>
+ <Transition fromState="Details,Stacked" toState="">
+ <ParentChangeAction/>
+ <NumericAnimation properties="x,y,scale,opacity" duration="500" easing="easeInOutQuad"/>
+ </Transition>
+ </transitions>
+
+ </Item>
+ </Component>
+ </delegate>
+
+</PathView>
diff --git a/demos/declarative/mediabrowser/content/ScrollBar.qml b/demos/declarative/mediabrowser/content/ScrollBar.qml
new file mode 100644
index 0000000..974f4d0
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/ScrollBar.qml
@@ -0,0 +1,18 @@
+<Item id="Container">
+ <properties>
+ <Property name="flickableArea"/>
+ </properties>
+
+ <Rect radius="5" color="black" opacity="0.3" pen.color="white" pen.width="2" x="0" y="{flickableArea.pageYPosition * Container.height}"
+ width="{parent.width}" height="{flickableArea.pageHeight * Container.height}"/>
+ <states>
+ <State name="show" when="{flickableArea.moving}">
+ <SetProperties target="{Container}" opacity="1" />
+ </State>
+ </states>
+ <transitions>
+ <Transition fromState="*" toState="*">
+ <NumericAnimation target="{Container}" properties="opacity" duration="400"/>
+ </Transition>
+ </transitions>
+</Item>
diff --git a/demos/declarative/mediabrowser/content/Star.qml b/demos/declarative/mediabrowser/content/Star.qml
new file mode 100644
index 0000000..1db29e8
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/Star.qml
@@ -0,0 +1,25 @@
+<Item id="Container" width="24" height="24">
+ <properties>
+ <Property name="rating"/>
+ <Property name="on"/>
+ </properties>
+
+ <signals>
+ <Signal name="clicked"/>
+ </signals>
+
+ <Image id="Image" src="pics/ghns_star.png" x="6" y="7" opacity="0.4" scale="0.5"/>
+ <MouseRegion anchors.fill="{Container}" onClicked="Container.clicked.emit()"/>
+
+ <states>
+ <State name="on" when="{Container.on == true}">
+ <SetProperties target="{Image}" opacity="1" scale="1" x="1" y="0"/>
+ </State>
+ </states>
+ <transitions>
+ <Transition>
+ <NumericAnimation properties="opacity,scale,x,y" easing="easeOutBounce"/>
+ </Transition>
+ </transitions>
+
+</Item>
diff --git a/demos/declarative/mediabrowser/content/pics/background.png b/demos/declarative/mediabrowser/content/pics/background.png
new file mode 100644
index 0000000..5b37072
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/pics/background.png
Binary files differ
diff --git a/demos/declarative/mediabrowser/content/pics/button-pressed.png b/demos/declarative/mediabrowser/content/pics/button-pressed.png
new file mode 100644
index 0000000..e434d32
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/pics/button-pressed.png
Binary files differ
diff --git a/demos/declarative/mediabrowser/content/pics/button.png b/demos/declarative/mediabrowser/content/pics/button.png
new file mode 100644
index 0000000..56a63ce
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/pics/button.png
Binary files differ
diff --git a/demos/declarative/mediabrowser/content/pics/ghns_star.png b/demos/declarative/mediabrowser/content/pics/ghns_star.png
new file mode 100644
index 0000000..4ad43cc
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/pics/ghns_star.png
Binary files differ
diff --git a/demos/declarative/mediabrowser/content/pics/reflection.png b/demos/declarative/mediabrowser/content/pics/reflection.png
new file mode 100644
index 0000000..c143a48
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/pics/reflection.png
Binary files differ
diff --git a/demos/declarative/mediabrowser/content/pics/shadow-bottom.png b/demos/declarative/mediabrowser/content/pics/shadow-bottom.png
new file mode 100644
index 0000000..523f6e7
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/pics/shadow-bottom.png
Binary files differ
diff --git a/demos/declarative/mediabrowser/content/pics/shadow-corner.png b/demos/declarative/mediabrowser/content/pics/shadow-corner.png
new file mode 100644
index 0000000..ef8c856
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/pics/shadow-corner.png
Binary files differ
diff --git a/demos/declarative/mediabrowser/content/pics/shadow-right-screen.png b/demos/declarative/mediabrowser/content/pics/shadow-right-screen.png
new file mode 100644
index 0000000..9856c4f
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/pics/shadow-right-screen.png
Binary files differ
diff --git a/demos/declarative/mediabrowser/content/pics/shadow-right.png b/demos/declarative/mediabrowser/content/pics/shadow-right.png
new file mode 100644
index 0000000..f534a35
--- /dev/null
+++ b/demos/declarative/mediabrowser/content/pics/shadow-right.png
Binary files differ
diff --git a/demos/declarative/mediabrowser/dummydata/MoviesModel.qml b/demos/declarative/mediabrowser/dummydata/MoviesModel.qml
new file mode 100644
index 0000000..87bca37
--- /dev/null
+++ b/demos/declarative/mediabrowser/dummydata/MoviesModel.qml
@@ -0,0 +1,38 @@
+<ListModel id="MoviesModel">
+ <Movie>
+ <title>Repoman</title>
+ <thumb>http://www.impawards.com/1984/posters/repo_man.jpg</thumb>
+ <description>Cult classic. Car repossession. Radiation. Plate O' Shrimp.</description>
+ <rating>2</rating>
+ </Movie>
+ <Movie>
+ <title>Monsters vs Aliens</title>
+ <thumb>http://www.impawards.com/2009/posters/monsters_vs_aliens_ver6.jpg</thumb>
+ <description>Love Monsters? Love Aliens? You're in luck.</description>
+ <rating>1</rating>
+ </Movie>
+ <Movie>
+ <title>Cruel Intentions</title>
+ <thumb>http://impawards.com/1999/posters/cruel_intentions_ver1.jpg</thumb>
+ <description>Modern-day update of Les Liaisons Dangereuses. Better because it has nothing to do with the French.</description>
+ <rating>3</rating>
+ </Movie>
+ <Movie>
+ <title>Lord of War</title>
+ <thumb>http://www.impawards.com/2005/posters/lord_of_war_ver2.jpg</thumb>
+ <description>There are over 500 million fire arms in worldwide circulation. That is one fire arm for every twelve people on the planet. The only question is how do we arm the other eleven?</description>
+ <rating>4</rating>
+ </Movie>
+ <Movie>
+ <title>The Devil's Advocate</title>
+ <thumb>http://impawards.com/1997/posters/devils_advocate_ver1.jpg</thumb>
+ <description>An ambitious your district attorney joins a powerful New York law firm headed by the devil.</description>
+ <rating>4</rating>
+ </Movie>
+ <Movie>
+ <title>Team America: World Police</title>
+ <thumb>http://impawards.com/2004/posters/team_america_world_police.jpg</thumb>
+ <description>Hey terrorist, terrorize this.</description>
+ <rating>1</rating>
+ </Movie>
+</ListModel>
diff --git a/demos/declarative/mediabrowser/mediabrowser.qml b/demos/declarative/mediabrowser/mediabrowser.qml
new file mode 100644
index 0000000..df7baa9
--- /dev/null
+++ b/demos/declarative/mediabrowser/mediabrowser.qml
@@ -0,0 +1,36 @@
+<?qtfx namespacepath:=content ?>
+<Item width="800" height="480" id="MainWindow">
+ <properties>
+ <Property name="minimized" value="false"/>
+ </properties>
+
+ <Item id="Background">
+ <Image src="content/pics/background.png" opaque="true"/>
+
+ <Rect id="Menu" x="-150" width="150" height="480" color="#232323">
+ <Text id="IconText" x="30" y="122" font.bold="true" font.size="9" text="Coming Soon" color="white" style="Raised" styleColor="black"/>
+ <Image src="content/pics/shadow-right-screen.png" x="150" height="480" tile="true"/>
+ </Rect>
+
+ <MovieInfoContainer id="MovieInfoContainer" width="750" x="25" y="500" height="440"/>
+ <MoviesPathView id="MoviesPathView" model="{MoviesModel}" y="60" width="800" height="360"/>
+ <MediaButton id="CloseButton" x="680" y="440" text="Close" onClicked="MainWindow.minimized = true"/>
+
+ <states>
+ <State name="Minimized" when="{MainWindow.minimized == true}">
+ <SetProperties target="{Background}" x="75"/>
+ <SetProperties target="{Menu}" x="-75"/>
+ </State>
+ </states>
+ <transitions>
+ <Transition fromState="*" toState="*">
+ <NumericAnimation properties="x,y,size" duration="500" easing="easeInOutQuad"/>
+ </Transition>
+ </transitions>
+ </Item>
+
+ <Text id="CategoryText" x="300" y="15" text="Coming Soon" font.size="22" color="white" style="Raised" styleColor="black"/>
+ <Item id="Stack" x="50" y="50"/>
+
+</Item>
+
diff --git a/demos/declarative/webbrowser/README b/demos/declarative/webbrowser/README
new file mode 100644
index 0000000..a081e30
--- /dev/null
+++ b/demos/declarative/webbrowser/README
@@ -0,0 +1,5 @@
+For good performance, be sure to use disk cache for remote content:
+
+ duiviewer -cache WebBrowser.qml
+
+Otherwise everything always re-loads over the network.
diff --git a/demos/declarative/webbrowser/WebBrowser.qml b/demos/declarative/webbrowser/WebBrowser.qml
new file mode 100644
index 0000000..08b94e3
--- /dev/null
+++ b/demos/declarative/webbrowser/WebBrowser.qml
@@ -0,0 +1,175 @@
+<?qtfx namespacepath:=content?>
+<Item width="320" height="500" id="webbrowser" state="Normal">
+ <properties><Property name="url" value="http://www.qtsoftware.com"/></properties>
+ <Script>
+ function zoomOut() {
+ webbrowser.state = "ZoomedOut";
+ }
+ function toggleZoom() {
+ if(webbrowser.state == "ZoomedOut") {
+ flick.centerX = webview.mouseX;
+ flick.centerY = webview.mouseY;
+ webbrowser.state = "Normal";
+ } else {
+ zoomOut();
+ }
+ }
+ </Script>
+
+ <Item id="webpanel" anchors.fill="{parent}" clip="true">
+ <Rect color="#555555" anchors.fill="{parent}"/>
+ <Image src="content/pics/softshadow-bottom.png" width="{webpanel.width}" height="16" />
+ <Image src="content/pics/softshadow-top.png" width="{webpanel.width}" anchors.bottom="{footer.top}" height="16" />
+ <RectSoftShadow x="{-flick.xPosition}" y="{-flick.yPosition}"
+ width="{webview.width*webview.scale}" height="{flick.y+webview.height*webview.scale}"/>
+ <Item id="headerspace" width="{parent.width}" height="60" z="1">
+ <Image id="header" width="{parent.width}" state="normal"
+ x="{flick.xPosition &lt; 0
+ ? -flick.xPosition
+ : flick.xPosition &gt; flick.viewportWidth-flick.width
+ ? -flick.xPosition+flick.viewportWidth-flick.width
+ : 0}"
+ y="{flick.yPosition &lt; 0 ? -flick.yPosition : progressoff*(flick.yPosition>height?-height:-flick.yPosition)}"
+ height="60" src="content/pics/header.png">
+ <Text id="header_text" text="{webview.title!='' || webview.progress == 1.0 ? webview.title : 'Loading...'}"
+ color="#000000"
+ font.family="Helvetica" font.size="9" font.bold="true" elide="ElideRight"
+ anchors.left="{header.left}" anchors.right="{header.right}"
+ anchors.leftMargin="4" anchors.rightMargin="4"
+ anchors.top="{header.top}" anchors.topMargin="4" hAlign="AlignHCenter"/>
+ <Item anchors.top="{header_text.bottom}" anchors.topMargin="2" anchors.bottom="{parent.bottom}" width="{parent.width}">
+ <Item id="urlbox" anchors.left="{parent.left}" anchors.leftMargin="12" anchors.right="{parent.right}" anchors.rightMargin="12" height="31" anchors.top="{parent.top}" clip="true">
+ <Image src="content/pics/addressbar.sci" anchors.fill="{urlbox}"/>
+ <Image id="urlboxhl" src="content/pics/addressbar-filled.sci" opacity="{1-header.progressoff}" clip="true" width="{parent.width*webview.progress}" height="{parent.height}"/>
+ <KeyProxy id="proxy" anchors.left="{urlbox.left}" anchors.fill="{urlbox}" focusable="true" targets="{[keyActions,editurl]}"/>
+ <KeyActions id="keyActions" return="webbrowser.url = editurl.text; proxy.focus=false;"/>
+ <TextEdit id="editurl" color="#555555" text="{webview.url == '' ? ' ' : webview.url}"
+ anchors.left="{urlbox.left}" anchors.right="{urlbox.right}" anchors.leftMargin="6"
+ anchors.verticalCenter="{urlbox.verticalCenter}" anchors.verticalCenterOffset="1"
+ font.size="11" wrap="false" opacity="0"/>
+ <Text id="showurl" color="#555555" text="{webview.url == '' ? ' ' : webview.url}"
+ anchors.left="{urlbox.left}" anchors.right="{urlbox.right}" anchors.leftMargin="6"
+ anchors.verticalCenter="{urlbox.verticalCenter}" anchors.verticalCenterOffset="1"
+ font.size="11" />
+ </Item>
+ <MouseRegion anchors.fill="{urlbox}" onClicked="proxy.focus=true"/>
+ </Item>
+ <properties>
+ <Property name="progressoff" value="1" type="Real"/>
+ </properties>
+ <states>
+ <State name="normal" when="{webview.progress == 1.0}">
+ <SetProperty target="{header}" property="progressoff" value="1"/>
+ </State>
+ <State name="progressshown" when="{webview.progress &lt; 1.0}">
+ <SetProperty target="{header}" property="progressoff" value="0"/>
+ </State>
+ </states>
+ <transitions>
+ <Transition>
+ <NumericAnimation target="{header}" properties="progressoff" easing="easeInOutQuad" duration="300"/>
+ </Transition>
+ </transitions>
+ </Image>
+ </Item>
+ <Flickable id="flick"
+ anchors.top="{headerspace.bottom}" anchors.bottom="{footer.top}"
+ anchors.left="{parent.left}" anchors.right="{parent.right}"
+ width="{parent.width}"
+ viewportWidth="{Math.max(parent.width,webview.width*webview.scale)}"
+ viewportHeight="{Math.max(parent.height,webview.height*webview.scale)}"
+ >
+ <properties>
+ <Property name="centerX" value="0" type="Real"/>
+ <Property name="centerY" value="0" type="Real"/>
+ </properties>
+ <WebView id="webview"
+ cacheSize="4000000"
+ smooth="true"
+ url="{webbrowser.url}"
+ onDoubleClick="toggleZoom()"
+ focusable="true"
+ focus="true"
+ idealWidth="{flick.width}"
+ idealHeight="{flick.height/scale}"
+ onUrlChanged="flick.xPosition=0; flick.yPosition=0; zoomOut()"
+ scale="{(width > 0) ? flick.width/width*zoomedout+(1-zoomedout) : 1}"
+ >
+ <properties>
+ <Property name="zoomedout" type="real" value="1"/>
+ </properties>
+ </WebView>
+ <Rect id="webviewTint" anchors.fill="{webview}" color="black" opacity="0">
+ <MouseRegion anchors.fill="{webviewTint}" onClicked="proxy.focus=false"/>
+ </Rect>
+ </Flickable>
+ <Image id="footer" width="{parent.width}" anchors.bottom="{parent.bottom}"
+ height="43" src="content/pics/footer.sci">
+ <Rect y="-1" width="{parent.width}" height="1" color="#555555"/>
+ <Item id="backbutton" anchors.right="{reload.left}" anchors.rightMargin="10" anchors.verticalCenter="{parent.verticalCenter}" width="{back_e.width}" height="{back_e.height}">
+ <Image anchors.fill="{parent}" id="back_e" src="content/pics/back.png" />
+ <Image anchors.fill="{parent}" id="back_d" src="content/pics/back-disabled.png" />
+ <states>
+ <State name="Enabled" when="{webview.back.enabled==true}">
+ <SetProperty target="{back_e}" property="opacity" value="1"/>
+ <SetProperty target="{back_d}" property="opacity" value="0"/>
+ </State>
+ <State name="Disabled" when="{webview.back.enabled==false}">
+ <SetProperty target="{back_e}" property="opacity" value="0"/>
+ <SetProperty target="{back_d}" property="opacity" value="1"/>
+ </State>
+ </states>
+ <transitions>
+ <Transition>
+ <NumericAnimation properties="opacity" easing="easeInOutQuad" duration="300"/>
+ </Transition>
+ </transitions>
+ <MouseRegion anchors.fill="{back_e}" onClicked="if (webview.back.enabled) webview.back.trigger()"/>
+ </Item>
+ <Image id="reload" src="content/pics/reload.png" anchors.horizontalCenter="{parent.horizontalCenter}" anchors.verticalCenter="{parent.verticalCenter}"/>
+ <MouseRegion anchors.fill="{reload}" onClicked="webview.reload.trigger()"/>
+ <Item id="forwardbutton" anchors.left="{reload.right}" anchors.leftMargin="10" anchors.verticalCenter="{parent.verticalCenter}" width="{forward_e.width}" height="{forward_e.height}">
+ <Image anchors.fill="{parent}" anchors.verticalCenter="{parent.verticalCenter}" id="forward_e" src="content/pics/forward.png" />
+ <Image anchors.fill="{parent}" id="forward_d" src="content/pics/forward-disabled.png" />
+ <states>
+ <State name="Enabled" when="{webview.forward.enabled==true}">
+ <SetProperty target="{forward_e}" property="opacity" value="1"/>
+ <SetProperty target="{forward_d}" property="opacity" value="0"/>
+ </State>
+ <State name="Disabled" when="{webview.forward.enabled==false}">
+ <SetProperty target="{forward_e}" property="opacity" value="0"/>
+ <SetProperty target="{forward_d}" property="opacity" value="1"/>
+ </State>
+ </states>
+ <transitions>
+ <Transition>
+ <NumericAnimation properties="opacity" easing="easeInOutQuad" duration="320"/>
+ </Transition>
+ </transitions>
+ <MouseRegion anchors.fill="{parent}" onClicked="if (webview.forward.enabled) webview.forward.trigger()"/>
+ </Item>
+ </Image>
+ </Item>
+ <states>
+ <State name="Normal">
+ <SetProperty target="{webview}" property="zoomedout" value="0"/>
+ <SetProperty target="{flick}" property="xPosition" value="{Math.min(webview.width-flick.width,Math.max(0,flick.centerX-flick.width/2))}"/>
+ <SetProperty target="{flick}" property="yPosition" value="{Math.min(webview.height-flick.height,Math.max(0,flick.centerY-flick.height/2))}"/>
+ </State>
+ <State name="ZoomedOut">
+ <SetProperty target="{webview}" property="zoomedout" value="1"/>
+ </State>
+ </states>
+ <transitions>
+ <Transition>
+ <SequentialAnimation>
+ <SetPropertyAction target="{webview}" property="smooth" value="false" />
+ <ParallelAnimation>
+ <NumericAnimation target="{webview}" properties="zoomedout" easing="easeInOutQuad" duration="200"/>
+ <NumericAnimation target="{flick}" properties="xPosition,yPosition" easing="easeInOutQuad" duration="200"/>
+ </ParallelAnimation>
+ <SetPropertyAction target="{webview}" property="smooth" value="true" />
+ </SequentialAnimation>
+ </Transition>
+ </transitions>
+</Item>
diff --git a/demos/declarative/webbrowser/content/RectSoftShadow.qml b/demos/declarative/webbrowser/content/RectSoftShadow.qml
new file mode 100644
index 0000000..0235842
--- /dev/null
+++ b/demos/declarative/webbrowser/content/RectSoftShadow.qml
@@ -0,0 +1,10 @@
+<Item>
+ <Image src="pics/softshadow-left.sci" x="-16" y="-16"
+ width="16" height="{parent.height+32}" />
+ <Image src="pics/softshadow-right.sci" x="{parent.width}" y="-16"
+ width="16" height="{parent.height+32}" />
+ <Image src="pics/softshadow-top.png" x="0" y="-16"
+ width="{parent.width}" height="16" />
+ <Image src="pics/softshadow-bottom.png" x="0" y="{parent.height}"
+ width="{webview.width*webview.scale}" height="16" />
+</Item>
diff --git a/demos/declarative/webbrowser/content/pics/addressbar-filled.png b/demos/declarative/webbrowser/content/pics/addressbar-filled.png
new file mode 100644
index 0000000..c793a10
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/addressbar-filled.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/addressbar-filled.sci b/demos/declarative/webbrowser/content/pics/addressbar-filled.sci
new file mode 100644
index 0000000..464dbf5
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/addressbar-filled.sci
@@ -0,0 +1,6 @@
+gridLeft: 7
+gridTop: 7
+gridBottom: 7
+gridRight: 7
+imageFile: addressbar-filled.png
+
diff --git a/demos/declarative/webbrowser/content/pics/addressbar.png b/demos/declarative/webbrowser/content/pics/addressbar.png
new file mode 100644
index 0000000..9b8e2c9
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/addressbar.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/addressbar.sci b/demos/declarative/webbrowser/content/pics/addressbar.sci
new file mode 100644
index 0000000..23a2a19
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/addressbar.sci
@@ -0,0 +1,6 @@
+gridLeft: 7
+gridTop: 7
+gridBottom: 7
+gridRight: 7
+imageFile: addressbar.png
+
diff --git a/demos/declarative/webbrowser/content/pics/back-disabled.png b/demos/declarative/webbrowser/content/pics/back-disabled.png
new file mode 100644
index 0000000..0ca0701
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/back-disabled.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/back.png b/demos/declarative/webbrowser/content/pics/back.png
new file mode 100644
index 0000000..3e88a6c
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/back.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/footer.png b/demos/declarative/webbrowser/content/pics/footer.png
new file mode 100644
index 0000000..f5fe95f
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/footer.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/footer.sci b/demos/declarative/webbrowser/content/pics/footer.sci
new file mode 100644
index 0000000..de0ed04
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/footer.sci
@@ -0,0 +1,6 @@
+gridLeft: 10
+gridTop: 0
+gridBottom: 0
+gridRight: 10
+imageFile: footer.png
+
diff --git a/demos/declarative/webbrowser/content/pics/forward-disabled.png b/demos/declarative/webbrowser/content/pics/forward-disabled.png
new file mode 100644
index 0000000..573aaa4
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/forward-disabled.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/forward.png b/demos/declarative/webbrowser/content/pics/forward.png
new file mode 100644
index 0000000..d4eb026
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/forward.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/header.png b/demos/declarative/webbrowser/content/pics/header.png
new file mode 100644
index 0000000..c4aff2e
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/header.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/reload.png b/demos/declarative/webbrowser/content/pics/reload.png
new file mode 100644
index 0000000..fa4d033
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/reload.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/softshadow-bottom.png b/demos/declarative/webbrowser/content/pics/softshadow-bottom.png
new file mode 100644
index 0000000..59c1ba1
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/softshadow-bottom.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/softshadow-left.png b/demos/declarative/webbrowser/content/pics/softshadow-left.png
new file mode 100644
index 0000000..d08f5c7
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/softshadow-left.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/softshadow-left.sci b/demos/declarative/webbrowser/content/pics/softshadow-left.sci
new file mode 100644
index 0000000..82e38f8
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/softshadow-left.sci
@@ -0,0 +1,5 @@
+gridLeft: 0
+gridTop: 16
+gridBottom: 16
+gridRight: 0
+imageFile: softshadow-left.png
diff --git a/demos/declarative/webbrowser/content/pics/softshadow-right.png b/demos/declarative/webbrowser/content/pics/softshadow-right.png
new file mode 100644
index 0000000..1bb29d5
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/softshadow-right.png
Binary files differ
diff --git a/demos/declarative/webbrowser/content/pics/softshadow-right.sci b/demos/declarative/webbrowser/content/pics/softshadow-right.sci
new file mode 100644
index 0000000..e9494ed
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/softshadow-right.sci
@@ -0,0 +1,5 @@
+gridLeft: 0
+gridTop: 16
+gridBottom: 16
+gridRight: 0
+imageFile: softshadow-right.png
diff --git a/demos/declarative/webbrowser/content/pics/softshadow-top.png b/demos/declarative/webbrowser/content/pics/softshadow-top.png
new file mode 100644
index 0000000..ef86738
--- /dev/null
+++ b/demos/declarative/webbrowser/content/pics/softshadow-top.png
Binary files differ
diff --git a/doc/src/animation.qdoc b/doc/src/animation.qdoc
new file mode 100644
index 0000000..081660c
--- /dev/null
+++ b/doc/src/animation.qdoc
@@ -0,0 +1,365 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page animation.html
+ \title The Animation Framework
+ \ingroup architecture
+ \ingroup animation
+ \brief An overview of the Animation Framework
+
+ \keyword Animation
+
+ The animation framework is part of the Kinetic project, and aims
+ to provide an easy way for creating animated and smooth GUI's. By
+ animating Qt properties, the framework provides great freedom for
+ animating widgets and other \l{QObject}s. The framework can also
+ be used with the Graphics View framework.
+
+ In this overview, we explain the basics of its architecture. We
+ also show examples of the most common techniques that the
+ framework allows for animating QObjects and graphics items.
+
+ \tableofcontents
+
+ \section1 The Animation Architecture
+
+ We will in this section take a high-level look at the animation
+ framework's architecture and how it is used to animate Qt
+ properties.
+
+ The animation framework foundation consists of the base class
+ QAbstractAnimation, and its two subclasses QVariantAnimation and
+ QAnimationGroup. QAbstractAnimation is the ancestor of all
+ animations. It represents basic properties that are common for all
+ animations in the framework; notably, the ability to start, stop,
+ and pause an animation. It is also receives the time change
+ notifications.
+
+ The animation framework further provides the QPropertyAnimation
+ class, which inherits QVariantAnimation and performs animation of
+ a Qt property, which is part of Qt's \l{Meta-Object
+ System}{meta-object system}. The class performs an interpolation
+ over the property using an easing curve. So when you want to
+ animate a value, you can declare it as a property and make your
+ class a QObject. Note that this gives us great freedom in
+ animating already existing widgets and other \l{QObject}s.
+
+ Complex animations can be constructed by building a tree structure
+ of \l{QAbstractAnimation}s. The tree is built by using
+ \l{QAnimationGroup}s, which function as containers for other
+ animations. Note also that the groups are subclasses of
+ QAbstractAnimation, so groups can themselves contain other groups.
+
+ The animation framework can be used on its own, but is also
+ designed to be part of the state machine framework (See the
+ \l{The State Machine Framework}{state machine framework} for an
+ introduction to the Qt state machine). The state machine provides
+ a special state that can play an animation. A QState can also set
+ properties when the state is entered or exited, and this special
+ animation state will interpolate between these values when given a
+ QPropertyAnimation. We will look more closely at this later.
+
+ Behind the scenes, the animations are controlled by a global
+ timer, which sends \l{QAbstractAnimation::updateCurrentTime()}{updates} to
+ all animations that are playing.
+
+ For detailed descriptions of the classes' function and roles in
+ the framework, please look up their class descriptions.
+
+ \section1 Animating Qt Properties
+
+ As mentioned in the previous section, the QPropertyAnimation class
+ can interpolate over Qt properties. It is this class that should
+ be used for animation of values; in fact, its superclass,
+ QVariantAnimation, is an abstract class, and cannot be used
+ directly.
+
+ A major reason we chose to animate Qt properties is that it
+ presents us with freedom to animate already existing classes in
+ the Qt API. Notably, the QWidget class (which we can also embed in
+ a QGraphicsView) has properties for its bounds, colors, etc.
+ Let's look at a small example:
+
+ \code
+ QPushButton button("Animated Button");
+ button.show();
+
+ QPropertyAnimation animation(&button, "geometry");
+ animation.setDuration(10000);
+ animation.setStartValue(QRect(0, 0, 100, 30));
+ animation.setEndValue(QRect(250, 250, 100, 30));
+
+ animation.start();
+ \endcode
+
+ This code will move \c button from the top left corner of the
+ screen to the position (250, 250).
+
+ The example above will do a linear interpolation between the
+ start and end value. It is also possible to set values
+ situated between the start and end value. The interpolation
+ will then go by these points.
+
+ \code
+ QPushButton button("Animated Button");
+ button.show();
+
+ QPropertyAnimation animation(&button, "geometry");
+ animation.setDuration(10000);
+
+ animation.setKeyValueAt(0, QRect(0, 0, 100, 30));
+ animation.setKeyValueAt(0.8, QRect(250, 250, 100, 30));
+ animation.setKeyValueAt(1, QRect(0, 0, 100, 30));
+
+ animation.start();
+ \endcode
+
+ In this example, the animation will take the button to (250, 250)
+ in 8 seconds, and then move it back to its original position in
+ the remaining 2 seconds. The movement will be linearly
+ interpolated between these points.
+
+ You also have the possibility to animate values of a QObject
+ that is not declared as a Qt property. The only requirement is
+ that this value has a setter. You can then subclass the class
+ containing the value and declare a property that uses this setter.
+ Note that all Qt properties requires a getter, so you will need to
+ provide a getter yourself if this is not defined.
+
+ \code
+ class MyGraphicsRectItem : public QObject, public QGraphicsRectItem
+ {
+ Q_OBJECT
+ Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry)
+ };
+ \endcode
+
+ In the above code example, we subclass QGraphicsRectItem and
+ define a geometry property. We can now animate the widgets
+ geometry even if QGraphicsRectItem does not provide the geometry
+ property.
+
+ For a general introduction to the Qt property system, see its
+ \l{Qt's Property System}{overview}.
+
+ \section1 Animations and the Graphics View Framework
+
+ When you want to animate \l{QGraphicsItem}s, you also use
+ QPropertyAnimation. But, unfortunetly, QGraphicsItem does not
+ inherit QObject. A good solution is to subclass the graphics item
+ you wish to animate. This class will then also inherit QObject.
+ This way, QPropertyAnimation can be used for \l{QGraphicsItem}s.
+ The example below shows how this is done. Another possibility is
+ to inherit QGraphicsWidget, which already is a QObject.
+
+ \code
+ class Pixmap : public QObject, public QGraphicsPixmapItem
+ {
+ Q_OBJECT
+ Q_PROPERTY(QPointF pos READ pos WRITE setPos)
+ ...
+ \endcode
+
+ As described in the previous section, we need to define
+ properties that we wish to animate.
+
+ Note that QObject must be the first class inherited as the
+ meta-object system demands this.
+
+ \warning The QItemAnimation class, which was initially intended
+ for animating \l{QGraphicsItem}s may be deprecated or removed from
+ the animation framework.
+
+ \omit (need something about the list of animations). \endomit
+
+ \section1 Easing Curves
+
+ As mentioned, QPropertyAnimation performs an interpolation between
+ the start and end property value. In addition to adding more key
+ values to the animation, you can also use an easing curve. Easing
+ curves describe a function that controls how the speed of the
+ interpolation between 0 and 1 should be, and are useful if you
+ want to control the speed of an animation without changing the
+ path of the interpolation.
+
+ \code
+ QPushButton button("Animated Button");
+ button.show();
+
+ QPropertyAnimation animation(&button, "geometry");
+ animation.setDuration(3000);
+ animation.setStartValue(QRect(0, 0, 100, 30));
+ animation.setEndValue(QRect(250, 250, 100, 30));
+
+ animation.setEasingCurve(QEasingCurve::OutBounce);
+
+ animation.start();
+ \endcode
+
+ Here the animation will follow a curve that makes it bounce like a
+ ball as if it was dropped from the start to the end position.
+ QEasingCurve has a large collection of curves for you to choose
+ from. These are defined by the QEasingCurve::Type enum. If you are
+ in need of another curve, you can also implement one yourself, and
+ register it with QEasingCurve.
+
+ \omit Drop this for the first Lab release
+ (Example of custom easing curve (without the actual impl of
+ the function I expect)
+ \endomit
+
+ \section1 Putting Animations Together
+
+ An application will often contain more than one animation. For
+ instance, you might want to move more than one graphics item
+ simultaneously or move them in sequence after each other.
+
+ The subclasses of QAnimationGroup (QSequentialAnimationGroup and
+ QParallelAnimationGroup) are containers for other animations so
+ that these animations can be animated either in sequence or
+ parallel. The QAnimationGroup is an example of an animation that
+ does not animate properties, but it gets notified of time changes
+ periodically. This enables it to forward those time changes to its
+ contained animations, and thereby controlling when its animations
+ are played.
+
+ Let's look at code examples that use both
+ QSequentialAnimationGroup and QParallelAnimationGroup, starting
+ off with the latter.
+
+ \code
+ QPushButton *bonnie = new QPushButton("Bonnie");
+ bonnie.show();
+
+ QPushButton *clyde = new QPushButton("Clyde");
+ clyde.show();
+
+ QPropertyAnimation *anim1 = new QPropertyAnimation(bonnie, "geometry");
+ // Set up anim1
+
+ QPropertyAnimation *anim2 = new QPropertyAnimation(clyde, "geometry");
+ // Set up anim2
+
+ QParallelAnimationGroup *group = new QParallelAnimationGroup;
+ group->addAnimation(anim1);
+ group->addAnimation(anim2);
+
+ group->start();
+ \endcode
+
+ A parallel group plays more than one animation at the same time.
+ Calling its \l{QAbstractAnimation::}{start()} function will start
+ all animations it governs.
+
+ \code
+ QPushButton button("Animated Button");
+ button.show();
+
+ QPropertyAnimation anim1(&button, "geometry");
+ anim1.setDuration(3000);
+ anim1.setStartValue(QRect(0, 0, 100, 30));
+ anim1.setEndValue(QRect(500, 500, 100, 30));
+
+ QPropertyAnimation anim2(&button, "geometry");
+ anim2.setDuration(3000);
+ anim2.setStartValue(QRect(500, 500, 100, 30));
+ anim2.setEndValue(QRect(1000, 500, 100, 30));
+
+ QSequentialAnimationGroup group;
+
+ group.addAnimation(&anim1);
+ group.addAnimation(&anim2);
+
+ group.start();
+ \endcode
+
+ As you no doubt have guessed, QSequentialAnimationGroup plays
+ its animations in sequence. It starts the next animation in
+ the list after the previous is finished.
+
+ Since an animation group is an animation itself, you can add
+ it to another group. This way, you can build a tree structure
+ of animations which specifies when the animations are played
+ in relation to each other.
+
+ \section1 Animations and States
+
+ When using a \l{The State Machine Framework}{state machine}, we
+ have a special state, QAnimationState, that will play one or more
+ animations.
+
+ The QState::addAnimatedTransition() convenience function lets you
+ associate an animation to a state transition. The function will
+ create the QAnimationState for you, and insert it into the state
+ machine. We also have the possibility to associate properties with
+ the states rather than setting the start and end values ourselves.
+ Below is a complete code example that animates the geometry of a
+ QPushButton.
+
+ \code
+ QPushButton *button = new QPushButton("Animated Button");
+ button->show();
+
+ QStateMachine *machine = new QStateMachine;
+
+ QState *state1 = new QState(machine->rootState());
+ state1->setPropertyOnEntry(button, "geometry",
+ QRect(0, 0, 100, 30));
+ machine->setInitialState(state1);
+
+ QState *state2 = new QState(machine->rootState());
+ state2->setPropertyOnEntry(button, "geometry",
+ QRect(250, 250, 100, 30));
+
+ state1->addAnimatedTransition(button, SIGNAL(clicked()), state2,
+ new QPropertyAnimation(button, "geometry"));
+ state2->addAnimatedTransition(button, SIGNAL(clicked()), state1,
+ new QPropertyAnimation(button, "geometry"));
+
+ machine->start();
+ \endcode
+
+ For a more comprehensive example of how to use the state machine
+ framework for animations, see the states example (it lives in the
+ \c{examples/animation/states} directory).
+*/
+
diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc
new file mode 100644
index 0000000..9647a72
--- /dev/null
+++ b/doc/src/declarative/anchor-layout.qdoc
@@ -0,0 +1,68 @@
+/*!
+\page anchor-layout.html
+\target anchor-layout
+\title Anchor-based Layout
+
+In additional to the more traditional Fx layouts \l {xmlGridLayout}{GridLayout}, \l {xmlHorizontalLayout}{HorizontalLayout}, and \l {xmlVerticalLayout}{VerticalLayout}, QML also provides a way to layout items using the concept of anchors. Each visual Fx item can be thought of as having a set of 6 invisible "anchor lines": \e left, \e horizontalCenter, \e right, \e top, \e verticalCenter, and \e bottom.
+
+\image edges_qml.png
+
+The Fx anchoring system allows you to define relationships between the anchor lines of different items. For example, you can write:
+
+\code
+<Rect id="rect1" .../>
+<Rect id="rect2" anchors.left="{rect1.right}" .../>
+\endcode
+
+In this case, the left edge of \e rect2 is bound to the right edge of rect1, producing the following:
+
+\image edge1.png
+
+The anchoring system also allows you to specify margins and offsets. Margins specify the amount of empty space to leave to the outside of an item, while offsets allow you to manipulate positioning using the center anchor lines. Note that margins specified using the anchor layout system only have meaning for anchors; they won't have any effect when using other layouts or absolute positioning.
+
+\image margins_qml.png
+
+The following example specifies a left margin:
+
+\code
+<Rect id="rect1" .../>
+<Rect id="rect2" anchors.left="{rect1.right}" anchors.leftMargin="5".../>
+\endcode
+
+In this case, a margin of 5 pixels is reserved to the left of \e rect2, producing the following:
+
+\image edge2.png
+
+You can specify multiple anchors. For example:
+
+\code
+<Rect id="rect1" .../>
+<Rect id="rect2" anchors.left="{rect1.right}" anchors.top="{rect1.bottom}".../>
+\endcode
+
+\image edge3.png
+
+By specifying multiple horizontal or vertical anchors you can control the size of an item. For example:
+
+\code
+<Rect id="rect1" x="0" .../>
+<Rect id="rect2" anchors.left="{rect1.right}" anchors.right="{rect3.left}".../>
+<Rect id="rect3" x="150" .../>
+\endcode
+
+\image edge4.png
+
+\section1 Limitations
+
+For performance reasons, you can only anchor an item to its siblings and direct parent. For example, the following anchor would be considered invalid and would produce a warning:
+
+\code
+<Item id="group1">
+ <Rect id="rect1" .../>
+</Item>
+<Item id="group2">
+ <Rect id="rect2" anchors.left="{rect1.right}".../> <!-- invalid anchor! -->
+</Item>
+\endcode
+
+*/
diff --git a/doc/src/declarative/animation.qdoc b/doc/src/declarative/animation.qdoc
new file mode 100644
index 0000000..a1ab44b
--- /dev/null
+++ b/doc/src/declarative/animation.qdoc
@@ -0,0 +1,130 @@
+/*!
+\page animation.html
+\target animation
+\title QML Animation
+
+QML supports three different forms of animation - basic property animation,
+states and transitions and property behaviors.
+
+\section1 Property Animation
+
+Animation in QML is done by animating properties of objects.
+
+Any property of a recognizable type can be animated. Currently those types include:
+\list
+\o qreal
+\o int
+\o Most of QVariant's built-in types
+\endlist
+
+Animations can also involve numerous properties on numerous objects.
+
+Other Features:
+\list
+\o Support for a large set of parameterized easing curves. (based on the Penner easing equations)
+\o Animation synchronization
+\endlist
+
+The simplest form of animation is using \c &lt;NumericAnimation/&gt;
+
+The following example creates a bouncing effect:
+\code
+<Rect id="rect" width="120" height="200" color="white">
+ <Image id="img" file="pics/qtlogo.png"
+ x="{60-img.width/2}" y="{200-img.height}">
+ <y>
+ <SequentialAnimation running="true" repeat="true">
+ <NumericAnimation to="{200-img.height}"
+ easing="easeOutBounce(amplitude:100)"
+ duration="2000" />
+ <PauseAnimation duration="1000" />
+ </SequentialAnimation>
+ </y>
+ </Image>
+</Rect>
+\endcode
+
+\image propanim.gif
+
+\target states-transitions
+\section1 States and Transitions
+
+\section2 States
+
+QML states describe user interface configurations, including:
+\list
+\o What UI elements are present
+\o The properties of those elements (including how they behave)
+\o What actions are available
+\endlist
+
+A state can also be thought of as a set of batched changes from a default configuration.
+
+Examples of states in modern UI:
+\list
+\o A Contacts application has a 'View Contact' state and an 'Edit Contact' State. In the first state the information presented is static (using labels), and in the second it is editable (using editors).
+\o A button has a pressed and unpressed state. When pressed the text moves down and to the right, and the button has a slightly darker appearance.
+\endlist
+
+In QML:
+\list
+\o Any object can use states.
+\o There is a default state. The default state can be explicitly set.
+\o A state can affect other the properties of other objects, not just the object owning the state (and not just that object's children).
+\endlist
+
+The following example shows a simple use of states. In the default state \c myrect is positioned at 0,0. In the 'moved' state it is positioned at 50,50.
+
+\code
+<Item>
+ <Rect id="myrect" width="100" height="100"/>
+ <states>
+ <State name="moved">
+ <SetProperty target="{myrect}" property="x" value="50"/>
+ <SetProperty target="{myrect}" property="y" value="50"/>
+ </State>
+ </states>
+</Item>
+\endcode
+
+\section2 Transitions
+
+QML transitions describe animations to perform when state changes occur.
+
+For the previous example, a transition could describe how \c myrect moved from its initial position to its new position:
+
+\code
+<transitions>
+ <Transition>
+ <NumericAnimation properties="x,y" easing="easeOutBounce" duration="200" />
+ </Transition>
+</transitions>
+\endcode
+
+QML transitions can use selectors to determine which state changes a transition should apply to:
+
+\code
+<Transition fromState="*" toState="Details">
+...
+</Transition>
+\endcode
+
+Transitions can happen in parallel, in sequence, or in any combination of the two:;
+
+\code
+<Transition fromState="*" toState="MyState" reversible="true" >
+ <SequentialAnimation>
+ <ColorAnimation duration="1000" />
+ <PauseAnimation duration="1000" />
+ <ParallelAnimation>
+ <NumericAnimation duration="1000" easing="easeOutBounce" target="{box1}" properties="x,y" />
+ <NumericAnimation duration="1000" target="{box2}" properties="x,y" />
+ </ParallelAnimation>
+ </SequentialAnimation>
+</Transition>
+\endcode
+
+\section1 Property Behaviors
+
+\todo Document. Should we remove property behaviour altogether?
+*/
diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc
new file mode 100644
index 0000000..d6dae77
--- /dev/null
+++ b/doc/src/declarative/basictypes.qdoc
@@ -0,0 +1,387 @@
+/*!
+ \page basicxmltypes.html
+ \title Common QML Types
+
+ QML uses a range of property types, which you will see
+ referenced throughout the element documentation. Almost all of them are
+ exactly what you would expect.
+
+ \target basicxmlint
+ \raw HTML
+ <div class="memitem">
+ <div class="memproto">
+ <table class="memname">
+ <tr><td>int</td></tr>
+ </table>
+ </div>
+ <div class="memdoc">
+ \endraw
+
+ ints are whole numbers - things like 0, 10 and -20. The possible int
+ values range from around -2000000000 to around 2000000000, although most
+ elements will only accept a reduced range (which they mention in their
+ documentation).
+
+ int's must be specified using the plain old syntax you learned at school -
+ none of that scientific notation nonsense is supported.
+
+ Setting ints looks like this:
+ \code
+ <Item width="100" height="200" />
+ \endcode
+
+ \raw HTML
+ </div>
+ </div>
+ \endraw
+
+ \target basicxmlbool
+ \raw HTML
+ <br>
+ <div class="memitem">
+ <div class="memproto">
+ <table class="memname">
+ <tr><td>bool</td></tr>
+ </table>
+ </div>
+ <div class="memdoc">
+ \endraw
+
+ bools are a binary true/false value, represented by the strings
+ "true" and "false" in XML.
+
+ Setting bools looks like this:
+ \code
+ <Item focusable="true" clip="false" />
+ \endcode
+
+ \note Technically bool treats an empty string, "false" and "0" as false and
+ everything else as true. Seriously, though, use "true" and "false".
+
+ \raw HTML
+ </div>
+ </div>
+ \endraw
+
+ \target basicxmlreal
+ \raw HTML
+ <br>
+ <div class="memitem">
+ <div class="memproto">
+ <table class="memname">
+ <tr><td>real</td></tr>
+ </table>
+ </div>
+ <div class="memdoc">
+ \endraw
+
+ reals are numbers - either whole numbers like ints, or fractional numbers
+ like 1.2 and -29.8.
+
+ Setting reals looks like this:
+ \code
+ <Item x="-10" y="100.8" />
+ \endcode
+
+ \note In QML all reals are stored in single precision, \l {http://en.wikipedia.org/wiki/IEEE_754}{IEEE floating point} format.
+
+ \raw HTML
+ </div>
+ </div>
+ \endraw
+
+ \target basicxmlstring
+ \raw HTML
+ <br>
+ <div class="memitem">
+ <div class="memproto">
+ <table class="memname">
+ <tr><td>string</td></tr>
+ </table>
+ </div>
+ <div class="memdoc">
+ \endraw
+
+ strings are free form text, like "hello world", "QML is cool" and
+ anything else you can think of.
+
+ Setting a string looks like this:
+ \code
+ <Text text="Hello world!" />
+ \endcode
+
+ \raw HTML
+ </div>
+ </div>
+ \endraw
+
+ \target basicxmlcolor
+ \raw HTML
+ <br>
+ <div class="memitem">
+ <div class="memproto">
+ <table class="memname">
+ <tr><td>color</td></tr>
+ </table>
+ </div>
+ <div class="memdoc">
+ \endraw
+
+ Colors are most commonly specified as an \l {http://www.w3.org/TR/SVG/types.html#ColorKeywords}{SVG color name}. These names include colors like
+ "red", "green" and "lightsteelblue".
+
+ If the color you want isn't part of this list, colors can also be specified
+ in hexidecimal triplets or quads that take the form \c "#RRGGBB" and
+ \c "#AARRGGBB" respectively. For example, the color red corresponds to a
+ triplet of \c "#FF0000" and a slightly transparent blue to a quad of
+ \c "#800000FF".
+
+ Setting a color looks like this:
+ \code
+ <Rect color="steelblue" />
+ <Rect color="#FF0000" />
+ <Rect color="#800000FF" />
+ \endcode
+
+ \raw HTML
+ </div>
+ </div>
+ \endraw
+
+ \target basicxmlpoint
+ \raw HTML
+ <br>
+ <div class="memitem">
+ <div class="memproto">
+ <table class="memname">
+ <tr><td>point</td></tr>
+ </table>
+ </div>
+ <div class="memdoc">
+ \endraw
+
+ Points are specified in \c "x,y" format.
+
+ Setting a point looks like this:
+ \code
+ <Widget pos="50,50"/>
+ \endcode
+
+ \raw HTML
+ </div>
+ </div>
+ \endraw
+
+ \target basicxmlsize
+ \raw HTML
+ <br>
+ <div class="memitem">
+ <div class="memproto">
+ <table class="memname">
+ <tr><td>size</td></tr>
+ </table>
+ </div>
+ <div class="memdoc">
+ \endraw
+
+ Sizes are specified in \c "widthxheight" format.
+
+ Setting a size looks like this:
+ \code
+ <Widget size="50x50"/>
+ \endcode
+
+ \raw HTML
+ </div>
+ </div>
+ \endraw
+
+ \target basicxmlrectangle
+ \raw HTML
+ <br>
+ <div class="memitem">
+ <div class="memproto">
+ <table class="memname">
+ <tr><td>rectangle</td></tr>
+ </table>
+ </div>
+ <div class="memdoc">
+ \endraw
+
+ Rectangles are specified in \c "x,y,widthxheight" format.
+
+ Setting a rectangle looks like this:
+ \code
+ <Widget geometry="50,50,100x100"/>
+ \endcode
+
+ \raw HTML
+ </div>
+ </div>
+ \endraw
+
+ \target basicxmldate
+ \raw HTML
+ <br>
+ <div class="memitem">
+ <div class="memproto">
+ <table class="memname">
+ <tr><td>date</td></tr>
+ </table>
+ </div>
+ <div class="memdoc">
+ \endraw
+
+ Dates are specified in \c "YYYY-MM-DD" format.
+
+ Setting a date looks like this:
+ \code
+ <DatePicker minDate="2000-01-01" maxDate="2020-12-31"/>
+ \endcode
+
+ \raw HTML
+ </div>
+ </div>
+ \endraw
+
+ \target basicxmltime
+ \raw HTML
+ <br>
+ <div class="memitem">
+ <div class="memproto">
+ <table class="memname">
+ <tr><td>time</td></tr>
+ </table>
+ </div>
+ <div class="memdoc">
+ \endraw
+
+ Times are specified in \c "hh:mm:ss" format.
+
+ Setting a time looks like this:
+ \code
+ <TimePicker time="14:22:15"/>
+ \endcode
+
+ \raw HTML
+ </div>
+ </div>
+ \endraw
+
+ \target basicxmlfont
+ \raw HTML
+ <br>
+ <div class="memitem">
+ <div class="memproto">
+ <table class="memname">
+ <tr><td>font</td></tr>
+ </table>
+ </div>
+ <div class="memdoc">
+ \endraw
+
+ The font type has components:
+ \list
+ \o string font.family
+ \o bool font.bold
+ \o bool font.italic
+ \o real font.size
+ \endlist
+
+ Setting a font looks like this:
+ \code
+ <Text font.family="Helvetica" font.size="13" font.bold="true">
+ \endcode
+
+ \raw HTML
+ </div>
+ </div>
+ \endraw
+
+ \target basicxmlaction
+ \raw HTML
+ <br>
+ <div class="memitem">
+ <div class="memproto">
+ <table class="memname">
+ <tr><td>action</td></tr>
+ </table>
+ </div>
+ <div class="memdoc">
+ \endraw
+
+ The action type has all the properties of QAction, in particular:
+ \list
+ \o slot action.trigger - invoke the action
+ \o bool action.enabled - true if the action is enabled
+ \o string action.text - the text associated with the action
+ \endlist
+
+ Actions are used like this:
+
+ \code
+ <MouseRegion onClick="{someitem.someaction.trigger()}">
+ <State name="enabled" when="{someitem.someaction.enabled=='true'}">
+ <Text text="{someitem.someaction.text}">
+ \endcode
+
+ \raw HTML
+ </div>
+ </div>
+ \endraw
+
+ \target basicxmlany
+ \raw HTML
+ <br>
+ <div class="memitem">
+ <div class="memproto">
+ <table class="memname">
+ <tr><td>any</td></tr>
+ </table>
+ </div>
+ <div class="memdoc">
+ \endraw
+
+ The any type can accept any basic type, object or list. Generally this
+ is only used in very special cases. The documentation for elements that
+ use the any type will explain the constraints in that particular case.
+
+ \raw HTML
+ </div>
+ </div>
+ \endraw
+
+ \target basicxmllist
+ \raw HTML
+ <br>
+ <div class="memitem">
+ <div class="memproto">
+ <table class="memname">
+ <tr><td>Lists</td></tr>
+ </table>
+ </div>
+ <div class="memdoc">
+ \endraw
+
+ While not technically a basic type, QML also supports lists of object
+ types. When used from QML, the engine automatically appends each value to the
+ list.
+
+ For example, the \l {xmlItem}{Item} class has a children list property
+ that can be used like this:
+ \code
+ <Item>
+ <children>
+ <Item id="child1" />
+ <Rect id="child2" />
+ <Text id="child3" />
+ </children>
+ </Item>
+ \endcode
+ \c child1, \c child2 and \c child3 will all be added to the children list
+ in the order in which they appear.
+ \raw HTML
+ </div>
+ </div>
+ \endraw
+*/
diff --git a/doc/src/declarative/binding.qdoc b/doc/src/declarative/binding.qdoc
new file mode 100644
index 0000000..b711a08
--- /dev/null
+++ b/doc/src/declarative/binding.qdoc
@@ -0,0 +1,110 @@
+/*!
+\page binding.html
+\title Data Binding
+\target binding
+
+Data binding provides a declarative way of specifying the data associated with objects, as well as the relationship between data of different objects. For example, you could bind the text of a label to the value of a slider: as the value of the slider changed, the label would be automatically updated with the new value.
+
+Bindings are indicated in Qml through the use of brackets: \c {}. For example, the following produces two Rects of equal size (\c rect2 is bound to the size of \c rect1):
+\code
+<Rect id="rect1" width="100" height="100">
+<Rect id="rect2" width="{rect1.width}" height="{rect1.height}">
+\endcode
+
+There is also a special \c <Bind> element, which is typically used to bind from the UI to the underlying UI model (see \l {Passing Data Between C++ and Qml} for an example of this). The bindings above could be expressed using the \c <Bind> element as:
+
+\code
+<Bind target="{rect2}" property="width" value="{rect1.width}"/>
+<Bind target="{rect2}" property="height" value="{rect1.height}"/>
+\endcode
+
+In addition to binding directly to a property, you can also bind to the results of expressions involving properties. For example:
+\code
+<Text text="{contact.firstname + ' ' + contact.lastname}">
+<Image file="{if (contact.gender == 'female') {'pics/female.png'} else {'pics/male.png'}}">
+\endcode
+
+Relevant items can also be bound to the contents of a model - see \l ListView for an example of this.
+
+Data can be bound to C++ objects - see \l {C++ Data Binding}.
+*/
+
+/*!
+\page qtbinding.html
+\target qtbinding
+\title C++ Data Binding
+
+The QML mechanisms of \l {Data Binding} can also be used to bind Qt C++ objects.
+
+The data binding framework is based on Qt's property system (see the Qt documentation for more details on this system). If a binding is meant to be dynamic (where changes in one object are reflected in another object), \c NOTIFY must be specified for the property being tracked. If \c NOTIFY is not specified, any binding to that property will be an 'intialization' binding (the tracking object will be updated only once with the initial value of the tracked object).
+
+Relevant items can also be bound to the contents of a Qt model. For example, ListView can make use of data from a QListModelInterface-derived model. (QListModelInterface is part of the next generation Model/View architecture being developed for Qt.)
+
+
+\section1 Passing Data Between C++ and Qml
+
+Data binding provides one method of data transfer between C++ and Qml.
+
+For example, lets say you want to implement a slider in Qml that changes the screen brightness of the device it is running on. You would start by declaring a brightness property on your QObject-derived class:
+\code
+class MyScreen : public QObject
+{
+ Q_OBJECT
+public:
+ MyScreen(QObject *parent=0);
+
+ Q_PROPERTY(int brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged);
+ int brightness() const;
+ void setBrightness(int b);
+ ...
+
+signals:
+ void brightnessChanged();
+
+private:
+ int m_brightness;
+};
+
+int brightness() const
+{
+ return m_brightness;
+}
+
+void setBrightness(int b)
+{
+ if (b != m_brightness) {
+ m_brightness = b;
+ emit brightnessChanged();
+
+ //set device brightness
+ ...
+ }
+}
+\endcode
+
+\note One important thing to keep in mind is that the changed signal should only be emitted when there is a real change ( \c b \c != \c m_brightness ), or you may get an infinite loop.
+
+Next, make an instance of this class visible to the Qml bind engine:
+\code
+QFxView *view = new QFxView;
+view->setXml("MyUI.qml");
+
+MyScreen *screen = new MyScreen;
+QmlBindContext *ctxt = view->bindContext();
+ctxt->setProperty("screen", screen);
+
+view->execute();
+\endcode
+
+\note Bindings must be made after setXml() but before execute().
+
+Finally, in Qml you can make the appropriate bindings, so in \c "MyUI.qml":
+
+\code
+<Slider value="{screen.brightness}"/>
+<Bind target="{screen}" property="brightness" value="{slider.value}" />
+\endcode
+
+The \l QBindableMap class provides a convenient way to make data visible to the bind engine.
+
+*/
diff --git a/doc/src/declarative/components.qdoc b/doc/src/declarative/components.qdoc
new file mode 100644
index 0000000..b5c5ae7
--- /dev/null
+++ b/doc/src/declarative/components.qdoc
@@ -0,0 +1,74 @@
+/*!
+\page components.html
+\target components
+\title Components
+
+A \b component is a reusable, encapsulated Qml element with a well-defined interface.
+
+Writing and using components allows you to:
+\list
+\o Reuse sections of Qml without copy-and-paste.
+\o Have consistent Look and Feel between different parts of your UI.
+\o Create new Qml elements without writing a new C++ class. (See \l {cppitem}{Creating Qml elements in C++})
+\endlist
+
+Components are placed in \e <Name>.qml files, allowing \e <Name> to then be used as a tag elsewhere. For example, if you have a Slider.qml file, you can then use \c <Slider> to place a slider.
+
+Components may be collected into \l {qmlmodules}{modules}.
+
+\section1 Example: Creating a MyButton Component
+
+This example describes how to create a component from an existing snippet of Qml.
+
+Assume you have an existing UI with a single 'Save' button, defined as follows:
+
+\code
+<Image file="pics/button-background.png">
+ <Text text="Save" anchors.horizontalCenter="{parent.horizontalCenter}" anchors.verticalCenter="{parent.verticalCenter}"/>
+ <MouseRegion anchors.fill="{parent}" onClick="saveData()"/>
+</Image>
+\endcode
+
+For the next release, you plan to add 'Cancel' and 'Reset' buttons. Rather than copying and pasting the above markup, you can create a component:
+
+\list 1
+\o Create a file called MyButton.qml, and copy the relevant Qml snippet into that file.
+\o Make some minor changes to define the component's interface:
+
+\code
+<Image file="pics/button-background.png">
+ <properties><Property name="label"/></properties>
+ <signals><Signal name="click"/></signals>
+ <Text text="{parent.label}" anchors.horizontalCenter="{parent.horizontalCenter}" anchors.verticalCenter="{parent.verticalCenter}"/>
+ <MouseRegion anchors.fill="{parent}" onClick="parent.click.emit()"/>
+</Image>
+\endcode
+
+The \a label property and \a click signal that were added effectively become part of the 'public API' of the MyButton component. In a similar manner, the Text and MouseRegion elements become invisible to anyone using the component. Note that the Text element now binds in its data from \a label, and the MouseRegion emits a generic signal.
+
+\o The component can now be used elsewhere as MyButton:
+
+\code
+<MyButton label="Save" onClick="saveData()"/>
+...
+<MyButton label="Cancel" onClick="cancelData()"/>
+...
+<MyButton label="Reset" onClick="resetData()"/>
+\endcode
+
+\endlist
+
+\section1 Placing .qml Files
+
+Component files should be placed in specific locations in order to be found by the Qml engine:
+
+\list
+\o the run directory
+\o the run directory + "/qml"
+\o the directory of the Qml you are running
+\o the directory of the Qml you are running + "/qml"
+\endlist
+
+In the future library-like directories will be defined (in the meantime the first two options above effectively serve this purpose).
+
+*/
diff --git a/doc/src/declarative/cppitem.qdoc b/doc/src/declarative/cppitem.qdoc
new file mode 100644
index 0000000..959bc6d
--- /dev/null
+++ b/doc/src/declarative/cppitem.qdoc
@@ -0,0 +1,127 @@
+/*!
+\page cppitem.html
+\target cppitem
+\title C++ Components
+
+\section1 Making a C++ object available in QML
+
+In QML, XML tags and attributes correspond to Qt objects and properties. Thus, any Qt object
+can potentially be used as an element in QML. More specifically, to make an object available in QML,
+it should:
+\list
+\o Be a subclass of QObject.
+\o Provide a default constructor.
+\o Declare Q_PROPERTYs.
+\o Be registered via the QML_DECLARE_TYPE and QML_DEFINE_TYPE macros.
+\endlist
+
+\section2 Declaring Q_PROPERTYs
+\target properties
+
+Properties of QObject subclasses are available as properties in QML.
+Like any QObject, these properties are defined by the Q_PROPERTY
+macro in the header file.
+
+Properties should have a NOTIFY function if they can change dynamically and
+if any useful response could be made to them changing in another object. Almost
+all properties will thus need a NOTIFY function.
+
+\code
+ Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged);
+ qreal scale() const;
+ void setScale(qreal);
+ ...
+ signals: void scaleChanged();
+\endcode
+
+The property types currently supported by QML are:
+\list
+\o int
+\o qreal
+\o QString
+\o QColor
+\o QDate, QTime, and QDateTime
+\o QSize and QSizeF
+\o QPoint and QPointF
+\o QRect and QRectF
+\o QPixmap
+\o QIcon
+\o enums registered with Q_ENUMS
+\o flags registered with Q_FLAGS
+\o QVariant
+\o QObject* (or subclass)
+\endlist
+
+Custom property types that provide string-to-type conversion can be used as well, by:
+\list
+\o Registering them as a metatype (Q_DECLARE_METATYPE() and qRegisterMetaType())
+\o Registering a string-to-type convertor function (QML::addCustomStringConvertor()).
+\endlist
+
+\section2 Registering your type
+\target register
+
+In order for your type to be usable in QML, you must register it:
+
+\code
+QML_DECLARE_TYPE(TypeName);
+QML_DEFINE_TYPE(TypeName,QmlName);
+\endcode
+
+These macros make the C++ \e TypeName available from the declarative markup language under the name \e QmlName.
+Of course there's nothing stopping you using the same name for both the C++ and the QML name!
+
+For example:
+\code
+QML_DECLARE_TYPE(MyCircle);
+QML_DEFINE_TYPE(MyCircle,Circle);
+\endcode
+would make the \e MyCircle class accessable though the \c <Circle/> tag in QML.
+
+
+\section1 Creating a new 'Fx' item in C++
+
+You can create a new type of 'Fx' item by:
+\list 1
+\o Creating a subclass of QFxItem,
+\o Adding Q_PROPERTYs appropriate for your item (see \l {properties}{Properties}),
+\o Reimplementing the relevant paint functions,
+\o Registering the type with the QML_DECLARE_TYPE and QML_DEFINE_TYPE macros (see \l {register}{Register}).
+\endlist
+
+\section2 Creating a subclass of QFxItem
+
+To add a new type, you first must add a new C++ class derived from QFxItem.
+You may of course extend existing QFxItem subclasses.
+
+One existing subclass is QFxPainted, which provides
+a simple cached-image painting model.
+
+\section2 Reimplementing paint functions
+
+Two alternative painters are available, offering
+different levels of performance and functionality:
+QPainter, GLPainter.
+
+You can choose to subclass QFxPainted rather than QFxItem,
+and then implement the virtual method:
+
+\code
+ void paint(QPainter *painter);
+\endcode
+
+This paints into an offscreen pixmap which is then painted to the display (transformed,
+etc. as needed). The cost of this offscreen pixmap should be carefully considered, as
+should the specific performance of the painting done in the paint function.
+
+If you require more control, subclass QFxItem instead.
+QFxItem subclasses must implement both simple software canvas painting
+and GL painting:
+\list
+\o \c QFxItem::paintContents(QPainter &) for the simple software canvas,
+\o \c QFxItem::paintGLContents(GLPainter &) for OpenGL.
+\endlist
+
+See the documentation of those functions for detailed subclassing notes.
+
+*/
diff --git a/doc/src/declarative/effects.qdoc b/doc/src/declarative/effects.qdoc
new file mode 100644
index 0000000..c7cd2f6
--- /dev/null
+++ b/doc/src/declarative/effects.qdoc
@@ -0,0 +1,31 @@
+/*!
+\page effects.html
+\target effects
+\title Visual Effects
+
+
+\section1 Basic Effects
+
+These effects are currently supported by all canvas backends.
+
+\list
+\o Scaling (\l Item \bold scale property)
+\o Opacity (\l Item \bold opacity property)
+\o Z-Axis Rotation (\l Item \bold rotation property)
+\endlist
+
+\section1 Advanced Effects
+
+These effects are currently only supported by the OpenGL canvas backend. Support for other
+backends may be added if the performance can be made acceptable.
+
+\list
+\o X/Y-Axis Rotation (see \l Transform)
+\o \l Shadow
+\o \l Blur
+\o \l Reflection
+\o \l Highlights
+\o \l Particles
+\endlist
+
+*/
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
new file mode 100644
index 0000000..076ef13
--- /dev/null
+++ b/doc/src/declarative/elements.qdoc
@@ -0,0 +1,128 @@
+/*!
+\page elements.html
+\target elements
+\title Qml Elements
+
+The following table lists the Qml elements provided by the Qt Declarative module.
+
+\bold {Standard Qt Declarative Elements}
+
+\table
+\header
+\o \bold {States}
+\o \bold {Animation and Transitions}
+\o \bold {Utility}
+\row
+
+\o
+\list
+\o \l StateGroup
+\o \l SetProperty
+\o \l SetProperties
+\o \l ParentChange
+\o \l RunScript
+\endlist
+
+\o
+\list
+\o \l NumericAnimation
+\o \l ColorAnimation
+\o \l VariantAnimation
+\o \l PauseAnimation
+\o \l SequentialAnimation
+\o \l ParallelAnimation
+\o \l SetPropertyAction
+\o \l Transition
+\o \l Behaviour
+\o \l Follow
+\endlist
+
+\o
+\list
+\o \l Script
+\o \l Bind
+\o \l Connection
+\o \l ListModel
+\o \l DateTimeFormatter
+\endlist
+\endtable
+
+\bold {Fluid UI Primitives}
+
+\table
+\header
+\o \bold {Basic Items}
+\o \bold {Utility}
+\o \bold {Widgets}
+
+\row
+\o
+\list
+\o \l Item
+\o \l Image
+\o \l Text
+\o \l TextEdit
+\o \l Rect
+\o \l MouseRegion
+\o \l KeyActions
+\o \l AnimatedImage
+\endlist
+
+\o
+\list
+\o \l Repeater
+\o \l Content
+\o \l FocusPanel
+\o \l FocusRealm
+\o \l KeyProxy
+\o \l ComponentInstance
+\endlist
+
+\o
+\list
+\o \l Flickable
+\o \l Flipable
+\o \l WebView
+\endlist
+
+\header
+\o \bold {Views}
+\o \bold {Layouts}
+\o \bold {Effects}
+
+\row
+\o
+
+\target xmlViews
+\list
+\o \l ListView
+\o \l GridView
+\o \l PathView
+ \list
+ \o \l Path
+ \endlist
+\endlist
+
+\o
+\list
+\o \l VerticalLayout
+\o \l HorizontalLayout
+\o \l GridLayout
+\endlist
+
+\o
+\list
+\o \l Shadow
+\o \l Reflection
+\o \l Blur
+\o \l Highlight
+\o \l Particles
+ \list
+ \o \l ParticleMotionLinear
+ \o \l ParticleMotionGravity
+ \o \l ParticleMotionWander
+ \endlist
+\endlist
+\endtable
+
+*/
diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc
new file mode 100644
index 0000000..17fda4d
--- /dev/null
+++ b/doc/src/declarative/examples.qdoc
@@ -0,0 +1,32 @@
+/*!
+\page qmlexamples.html
+\target qmlexamples
+\title QML Examples
+
+A viewer application is included that allows you to quickly explore many of the
+examples. It has some useful options, revealed by:
+
+\code
+ bin/duiviewer -help
+\endcode
+
+There are several illustrative XML examples available. From your build
+directory,
+
+\code
+ bin/duiviewer $QT_SOURCE_DIR/examples/declarative/mediabrowser/mediabrowser.qml
+\endcode
+
+Many other simple demos can be found under the \c examples/declarative sub
+directory. Some can be run directly using the viewer like those above, and
+others require you to build and run an executable.
+
+Finally, check out the \l {tutorial} to learn a little more about writing your
+own QML-based applications.
+
+\note When running applications that only use the Fluid UI atoms under the
+software rasterizer, a simple canvas backend is used by default. To use
+Graphics View instead, set \c QML_USE_GRAPHICSVIEW=1.
+
+
+*/
diff --git a/doc/src/declarative/focus.qdoc b/doc/src/declarative/focus.qdoc
new file mode 100644
index 0000000..e0d4ca3
--- /dev/null
+++ b/doc/src/declarative/focus.qdoc
@@ -0,0 +1,248 @@
+/*!
+\target qmlfocus
+\page qmlfocus.html
+\title Fluid UI Keyboard Focus
+
+When a key is pressed or released, a key event is generated and delivered to the
+focused fluid UI \l Item. To facilitate the construction of reusable components
+and to address some of the cases unique to fluid UIs, the fluid UI atoms add a
+"realm" based extension to Qt's traditional keyboard focus model.
+
+\section1 Key Handling Overview
+
+When the user presses or releases a key, the following occurs:
+\list 1
+\o Qt receives the key action and generates a key event.
+\o If the Qt widget containing the fluid UI scene has focus, the key event is delivered to the fluid UI scene. Otherwise, regular Qt key handling continues.
+\o The key event is delivered by the scene to the fluid UI \l Item with \e {active focus}. If no fluid UI \l Item has \e {active focus}, the key event is \l {QEvent::ignore()}{ignored} and regular Qt key handling continues.
+\o If the fluid UI \l Item with \e {active focus} accepts the key event, propagation stops. Otherwise the event is "bubbled up", by recursively passing it to each \l Item's parent until either the event is accepted, or the root \l Item is reached.
+
+If the \c {<Rect/>} element in the following example has active focus and the \e A key is pressed, it will bubble up to the \c {<KeyActions/>}. However, pressing the \e B key will bubble up to the root item and thus subsequently be \l {QEvent::ignore()}{ignored}.
+
+\code
+<Item>
+ <KeyActions keyA="print('Key A was pressed')">
+ <Rect />
+ </KeyActions>
+</Item>
+\endcode
+
+\o If the root \l Item is reached, the key event is \l {QEvent::ignore()}{ignored} and regular Qt key handling continues.
+
+\endlist
+
+\section1 Querying the Active Focus Item
+
+Whether or not an \l Item has \e {active focus} can be queried through the
+read-only property \c {Item::activeFocus}. For example, here we have a \l Text
+element whose text is determined by whether or not it has \e {active focus}.
+
+\code
+<Text>
+ <text>{activeFocus?"I have active focus!":"I do not have active focus"}</text>
+</Text>
+\endcode
+
+\section1 Acquiring Focus and Focus Realms
+
+An \l Item requests focus by setting the \c {Item::focus} property to true.
+
+For very simple cases simply setting the \c {Item::focus} property is sometimes
+sufficient. If we run the following example in the \c duiviewer, we see that
+the \c {<KeyActions/>} element has \e {active focus} and pressing the
+\e A, \e B, or \e C keys modifies the text appropriately.
+
+\table
+\row
+\o \code
+ <Rect color="lightsteelblue" width="240" height="25">
+ <Text id="MyText" />
+ <KeyActions focus="true">
+ <keyA>MyText.text = "Key A was pressed"</keyA>
+ <keyB>MyText.text = "Key B was pressed"</keyB>
+ <keyC>MyText.text = "Key C was pressed"</keyC>
+ </KeyActions>
+ </Rect>
+\endcode
+\o \image declarative-qmlfocus1.png
+\endtable
+
+However, were the above example to be used as a self-contained component, this
+simple use of the \c {Item::focus} property is no longer sufficient. The left
+hand side of the following table shows what we would like to be able to write.
+Here we create two instances of our previously defined component, and set the
+second one to have focus. The intention is that when the \e A, \e B, or \e C
+keys are pressed, the second of the two components receives the event and
+reponds accordingly.
+
+\table
+\row
+\o \code
+<Rect color="red" width="240" height="55">
+ <MyWidget />
+ <MyWidget y="30" focus="true"/>
+</Rect>
+\endcode
+\o \code
+<Rect color="red" width="240" height="55">
+ <Rect color="lightsteelblue" width="240" height="25">
+ <Text id="MyText" />
+ <KeyActions focus="true">
+ <keyA>MyText.text = "Key A was pressed"</keyA>
+ <keyB>MyText.text = "Key B was pressed"</keyB>
+ <keyC>MyText.text = "Key C was pressed"</keyC>
+ </KeyActions>
+ </Rect>
+ <Rect y="30" focus="true" color="lightsteelblue" width="240" height="25">
+ <Text id="MyText" />
+ <KeyActions focus="true">
+ <keyA>MyText.text = "Key A was pressed"</keyA>
+ <keyB>MyText.text = "Key B was pressed"</keyB>
+ <keyC>MyText.text = "Key C was pressed"</keyC>
+ </KeyActions>
+ </Rect>
+\endcode
+\endtable
+
+The right hand side of the example shows the expanded code - the equivalent QML
+without the use of the component \c {<MyWidget/>}. From this, the problem is
+evident - there are no less than three elements that have the \c {Item::focus}
+property set to true. Ultimately only one element can have focus, and the
+system has to decide which on. In this case the first appearance of the
+\c {Item::focus} property being set to true on line 4 is selected, and the value
+of \c {Item::focus} in the other two instances is reverted back to false. This
+is exactly the opposite of what was wanted!
+
+This problem is fundamentally one of visibility. The \c {<MyWidget/>}
+components each set their \c {<KeyActions/>} as focused as that is all they can
+do - they don't know how they are going to be used, but they do know that when
+they're in use their \c {<KeyActions/>} element is what needs focus. Likewise
+the code that uses the \c {<MyWidget/>}'s sets the second \c {<MyWidget/>} as
+focused because, while it doesn't know exactly how the \c {<MyWidget/>} is
+implemented, it knows that it wants the second one to be focused. No one piece
+of code knows everything about the other, which is exactly how it should be.
+
+To solve this problem - allowing components to care about what they know about
+and ignore everything else - the fluid UI atoms introduce a concept known as a
+\e {focus realm}. For existing Qt users, a \e {focus realm} is like an
+automatic focus proxy. A \e {focus realm} is created using the \l FocusRealm
+element.
+
+In the next example, a \l FocusRealm is added to the component, and the visual
+result shown.
+
+\table
+\row
+\o \code
+<FocusRealm width="240" height="25">
+ <Rect color="lightsteelblue" width="240" height="25">
+ <Text id="MyText" />
+ <KeyActions focus="true">
+ <keyA>MyText.text = "Key A was pressed"</keyA>
+ <keyB>MyText.text = "Key B was pressed"</keyB>
+ <keyC>MyText.text = "Key C was pressed"</keyC>
+ </KeyActions>
+ </Rect>
+</FocusRealm>
+\endcode
+\o \image declarative-qmlfocus2.png
+\endtable
+
+Conceptually \e {focus realms} are quite simple.
+\list
+\o Within each \e {focus realm} one element may have \c {Item::focus} set to true. If more than one \l Item has the \c {Item::focus} property set, the first is selected and the others are unset, just like when there are no \e {focus realms}.
+\o When a \e {focus realm} receives \e {active focus}, the contained element with \c {Item::focus} set (if any) also gets \e {active focus}. If this element is
+also a \l FocusRealm, the proxying behaviour continues. Both the
+\e {focus realm} and the sub-focused item will have \c {Item::activeFocus} set.
+\endlist
+
+So far the example has the second component statically selected. It is trivial
+now to extend this component to make it clickable, and add it to the original
+application. We still set a one of the widgets as focused by default, but from
+then on clicking the either one gives it focus.
+
+\table
+\row
+\o \code
+<Rect color="red" width="240" height="55">
+ <MyClickableWidget />
+ <MyClickableWidget y="30" focus="true"/>
+</Rect>
+\endcode
+\o \code
+<FocusRealm id="Page" width="240" height="25">
+ <MyWidget focus="true" />
+ <MouseRegion anchors.fill="{parent}" onClick="Page.focus = true" />
+</FocusRealm>
+\endcode
+\endtable
+
+\image declarative-qmlfocus3.png
+
+When a fluid UI atom explicitly relinquishes focus (by setting its
+\c {Item::focus} property to false while it has \e {active focus}), the system
+does not automatically select another element to receive focus. That is, it
+is possible for there to be no currently \e {active focus}.
+
+\section1 Advanced uses of Focus Realms
+
+Focus realms allow focus to allocation to be easily partitioned. Several
+fluid UI atoms use it to this effect.
+
+\l ListView, for example, is itself a focus realm. Generally this isn't
+noticable as \l ListView doesn't usually have manually added visual children.
+By being a focus realm, \l ListView can focus the current list item without
+worrying about how that will effect the rest of the application. This allows
+the current item delegate to react to key presses.
+
+This contrived example shows how this works. Pressing the \c Return key will
+print the name of the current list item.
+
+\table
+\row
+\o \code
+<Rect color="lightsteelblue" width="240" height="320">
+
+ <ListView id="MyView" anchors.fill="{parent}" focus="true">
+ <model>
+ <ListModel>
+ <Row><name>Bob</name></Row>
+ <Row><name>John</name></Row>
+ <Row><name>Michael</name></Row>
+ </ListModel>
+ </model>
+ <delegate>
+ <FocusRealm width="{contents.width}" height="{contents.height}">
+ <Text text="{name}" />
+ <KeyActions return="print(name)" focus="true" />
+ </FocusRealm>
+ </delegate>
+ </ListView>
+
+</Rect>
+\endcode
+\o \image declarative-qmlfocus4.png
+\endtable
+
+While the example is simple, there's a lot going on behind the scenes. Whenever
+the current item changes, the \l ListView sets the delegate's \c {Item::focus}
+property. As the \l ListView is a \e {focus realm}, this doesn't effect the
+rest of the application. However, if the \l ListView itself has
+\e {active focus} this causes the delegate itself to receive \e {active focus}.
+In this example, the root element of the delegate is also a \e {focus realm},
+which in turn gives \e {active focus} to the \c {<KeyActions/>} element that
+actually performs the work of handling the \e {Return} key.
+
+All of the fluid UI view classes, such as \l PathView and \l GridView, behave
+in a similar mannor to allow key handling in their respective delegates.
+
+\section1 Focus Panels
+
+Traditional UIs are composed of many top-level windows. Windows actually
+perform two tasks - they act as the visual bounds for a widget, and they segment
+focus. Each window has a separate focused widget, that becomes (to mix
+terminologies) the \e {active focus} widget when the window is the active
+window.
+
+### Focus panels do basically the same thing.
+*/
diff --git a/doc/src/declarative/index.qdoc b/doc/src/declarative/index.qdoc
new file mode 100644
index 0000000..22195ba
--- /dev/null
+++ b/doc/src/declarative/index.qdoc
@@ -0,0 +1,51 @@
+/*!
+\page qml.html
+\title 'Qt Declarative' Documentation
+
+\target qtdeclarativemainpage
+
+The Qt Declarative module provides a user interface framework for building
+highly dynamic and fluid applications. It is targetted at the sorts of user
+interface and the sorts of hardware in embedded devices such as phones, media
+players, and set-top boxes. It is also appropriate for highly custom desktop
+user-interfaces, or special elements in more traditional desktop
+user-interfaces.
+
+Building fluid applications is done declaratively, rather than procedurally.
+That is, you specify \e what the UI should look like and how it should behave
+in an XML-based format called QML instead of specifying step-by-step \e how to
+build it in a language like C++ or JavaScript. Specifying a UI declaratively
+does not just include the layout of the interface items, but also the way each
+individual item looks and behaves and the overall flow of the application.
+
+Getting Started:
+\list
+\o \l {qmlexamples}{Examples}
+\o \l {tutorial}{Tutorial}
+\o \l {qmlforcpp}{Qt Declarative Markup Language For C++ Programmers}
+\endlist
+
+Core Features:
+\list
+\o \l {binding}{Data Binding}
+\o \l {anchor-layout}{Layout Anchors}
+\o \l {animation}{Animation}
+\o \l {effects}{Visual Effects}
+\o \l {components}{Components}
+\o \l {qmlmodules}{Modules}
+\o \l {qmlfocus}{Keyboard Focus}
+\endlist
+
+QML Reference:
+\list
+\o \l {elements}{Qml Elements}
+\endlist
+
+C++ Reference:
+\list
+\o \l {qtprogrammers}{QML for Qt programmers}
+\o \l {qtbinding}{C++ Data Binding}
+\o \l {cppitem}{C++ Components}
+\endlist
+
+*/
diff --git a/doc/src/declarative/measuring-performance.qdoc b/doc/src/declarative/measuring-performance.qdoc
new file mode 100644
index 0000000..2387335
--- /dev/null
+++ b/doc/src/declarative/measuring-performance.qdoc
@@ -0,0 +1,81 @@
+/*!
+\page optimizing-performance.html
+\target optimizing-performance
+\title Optimizing Performance
+
+The Qt Declarative module includes several tools to help measure performance.
+
+\section1 Performance Logging
+
+The declarative module uses the functionality provided by QPerformanceLog to log performance information. To see this information you can add the following to src.pro:
+
+\code
+DEFINES += Q_ENABLE_PERFORMANCE_LOG
+\endcode
+
+The performance information will be printed to screen on a QML application startup, or when running the viewer can be forced at anytime by pressing 'F3' on the keyboard.
+
+Additional logging can be enabled by adding the relevant categories to qfxperf.h and qfxperf.cpp.
+
+For example, to measure the cost of calculating the size of a text item, you would first define a TextSize category by adding the following:
+
+\code
+//in qfxperf.h
+Q_DECLARE_PERFORMANCE_METRIC(TextSize);
+
+//in qfxperf.cpp
+Q_DEFINE_PERFORMANCE_METRIC(TextSize, "Text Size Calculation");
+\endcode
+
+You could then use this category in the code:
+
+\code
+void QFxText::updateSize()
+{
+ QFxPerfTimer<QFxPerf::TextSize> perf;
+ ...
+}
+\endcode
+
+Because there is no cost for a QFxPerfTimer when Q_ENABLE_PERFORMANCE_LOG is not defined, this line can persist in the code and be used to help detect performance bottlenecks and regressions. See the QPerformanceLog documentation for more information on this performance framework.
+
+\section1 FPS Measurements
+
+When running the viewer, pressing 'F2' on the keyboard while a QML program is running will cause information on cost-per-frame and frames-per-second (FPS) to be printed to the console.
+
+The information printed includes:
+\list
+\o \e repaint(): the total time spent painting.
+\o \e paint(): the time spent by Qt painting.
+\o \e timeBetweenFrames: the total time spent per frame. This number minus repaint() gives a good idea of how much time is spent on things besides painting. A high number here with a low number for repaint() indicates expensive calculations happening each frame.
+\endlist
+
+\section1 Improving Performance
+
+The following tips can help decrease startup time for QML-based appications.
+
+\section2 Images
+
+\list
+\o Use jpg instead of png for photo-like images. On the N810, this can save 150ms for a large (320x480) image.
+
+\o If you are configuring Qt, configure out any image plugins you don't plan to support (mng and svg are the most expensive). On the N810, this can save 75-100ms startup time. For example:
+
+\code
+configure -no-libmng -no-svg -no-libtiff
+\endcode
+
+\o In some cases running pngcrush, optipng, gifsicle or other similar tools can give some improvement.
+
+We are also investigating support for the loading of uncompressed images. This will provide opportunites to decrease startup time at the cost of increased storage space.
+\endlist
+
+\section2 Fonts
+
+\list
+\o Use qpf instead of ttf. When using multiple font sizes and weights on the N810, this can save 125ms startup time compared to a ttf 'clean' run, and 40-50ms on subsequent runs (ttfs are shared by open applications).
+\endlist
+
+*/
+
+*/
diff --git a/doc/src/declarative/modules.qdoc b/doc/src/declarative/modules.qdoc
new file mode 100644
index 0000000..a97b5d7
--- /dev/null
+++ b/doc/src/declarative/modules.qdoc
@@ -0,0 +1,135 @@
+/*!
+\page qmlmodules.html
+\target qmlmodules
+\title Modules of Components
+
+A \bold module is a collection of \l Components, in an XML namespace.
+
+Named component in QML may include a namespace qualification,
+and standard XML namespace scoping is allowed. This allows
+components to be provided by different modules (even if they otherwise
+have the same name).
+
+To use a module:
+
+\code
+<Item xmlns:Clock="http://nokia.com/qml/Clock">
+ <Clock:AnalogClock>
+ ...
+ </Clock:AnalogClock>
+</Item>
+\endcode
+
+To create a modules:
+
+Create the components, with appropriate exported properties, signals, and slots (slots not currently supported),
+in a single directory:
+
+\c Clock/Face.qml: ...
+
+\c Clock/Hand.qml: ...
+
+\c Clock/AnalogClock.qml:
+\code
+<Item xmlns:Clock="http://nokia.com/qml/Clock">
+ <Clock:Face .../>
+ <Clock:Hand .../>
+ <Clock:Hand .../>
+ <Clock:Hand .../>
+ ...
+</Item>
+\endcode
+
+Associate the directory with the namespace:
+
+\code
+ Qml::addNameSpacePath("http://nokia.com/qml/Clock", "/usr/lib/qml/Clock");
+\endcode
+
+Whole blocks of directories can be set:
+
+\code
+ Qml::addNameSpacePath("http://nokia.com/qml", "/usr/lib/qml");
+\endcode
+
+Associations can also be declared in the QML itself as a processing directive:
+
+\code
+ <?qtfx namespacepath:http://nokia.com/qml=/usr/lib/qml ?>
+\endcode
+
+*/
+
+/*
+
+A kludgey way to do unexported components:
+
+Clock/AnalogClock.qml:
+<Item>
+ <properties>
+ <Property name="time" ... />
+ </properties>
+
+ <Component name="Hand"> ... </Component> <!-- invisible compoent -->
+
+ <ComponentInstance component="Hand" size="100"/>
+ <ComponentInstance component="Hand" size="200"/>
+ <ComponentInstance component="Hand" size="300"/>
+</Item>
+
+Another kludgey way (if _ handled specially)):
+
+Clock/_Hand.qml: ...
+
+A non-XML extension to improve syntax (XMLNS blows):
+
+<qml>
+ <using ns="http://nokia.com/qml/Clock"/>
+ <Face .../>
+ ...
+</qml>
+
+*/
+
+/*
+ IMPLEMENTATION
+
+ Fully Qualifying names. CHOICE
+ IF QmlXmlParser qualifies names:
+ QmlXmlParser processes <qml> and <using> tags to create a list of QmlModuleDependency.
+ It uses talks with the same creators as QmlCompiler::compileTypes to qualify the names.
+ Each of QmlMetaType, QmlCustomParser, and the QmlCompiledComponent::classFactory(ies)
+ must know fully-qualified names.
+ Pro: simpler
+ Con: may be harder to regenerate original XML if unqualified name is lost
+ Con: should QmlXmlParser "know" about the type creators?
+ ELSE
+ QmlXmlParser processes <qml> and <using> tags to create a list of QmlModuleDependency,
+ which get stored in the QCompiledComponent.
+ When QmlCompiler::compileTypes creates components, module dependencies are used
+ to find the correct component - turning a name into a fully-qualified name
+ at "ref.className = type" before passing it to the creators. QmlMetaType::typeFunc must allow
+ qualified names even for builtin types, for example, QFxText might be
+ declared with the name Qt:Text. The QML::customParser must also understand
+ the concept, for example ListModel might be declared with the name Qt:ListModel.
+ QmlXmlParser::Object::typeName should be removed (used by DOM?), as redundant.
+ QmlXmlParser::Object::type will not define a fully qualified typename, just a name,
+ so types that are actually the same may have different type id because they
+ were named differently ("Qt:Text" vs "Text"). Need to check if this is a problem,
+ or whether QmlCompiler::output->types should be compressed.
+
+ XML Namespaces. CHOICE CHOSEN
+ The advantage is that the namespaces could be fixed (per version), allowing proper DTDs, etc.
+
+ Attached properties. PROBLEM
+ Type references in JavaScript can be either unqualified, in which case QmlMetaProperty
+ would have to FQ the type, which seems impossible, or qualified, the syntax
+ of which would be odd, like Qt.GridLayout.row or property["Qt:GridLayout.row"].
+
+ Access restrictions. PROBLEM
+ All use of the bind context must prevent direct access between objects that
+ are in different modules (i.e. between types with different module prefixes).
+ Maybe this is accomplishable just from having the right context tree.
+ Components in the same module can refer to their containing components (they
+ need to be careful if they're allowed to be used outside).
+*/
diff --git a/doc/src/declarative/pics/ListViewHighlight.png b/doc/src/declarative/pics/ListViewHighlight.png
new file mode 100644
index 0000000..02bf51d
--- /dev/null
+++ b/doc/src/declarative/pics/ListViewHighlight.png
Binary files differ
diff --git a/doc/src/declarative/pics/ListViewHorizontal.png b/doc/src/declarative/pics/ListViewHorizontal.png
new file mode 100644
index 0000000..63c7c86
--- /dev/null
+++ b/doc/src/declarative/pics/ListViewHorizontal.png
Binary files differ
diff --git a/doc/src/declarative/pics/ListViewVertical.png b/doc/src/declarative/pics/ListViewVertical.png
new file mode 100644
index 0000000..e0b23d9
--- /dev/null
+++ b/doc/src/declarative/pics/ListViewVertical.png
Binary files differ
diff --git a/doc/src/declarative/pics/anchors.svg b/doc/src/declarative/pics/anchors.svg
new file mode 100644
index 0000000..08b00ed
--- /dev/null
+++ b/doc/src/declarative/pics/anchors.svg
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg1910"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ inkscape:export-filename="/home/mbrasser/work/Kinetic/ngui/doc/src/pics/anchors_example2.png"
+ inkscape:export-xdpi="189.65207"
+ inkscape:export-ydpi="189.65207"
+ sodipodi:docbase="/home/mbrasser/work/Kinetic/ngui/doc/src/pics"
+ sodipodi:docname="anchors.svg">
+ <defs
+ id="defs1912" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.979899"
+ inkscape:cx="431.57095"
+ inkscape:cy="413.38853"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1386"
+ inkscape:window-height="971"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata1915">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;stroke:black;stroke-width:0.52033526;stroke-miterlimit:4;stroke-dasharray:1.04067054, 0.52033527;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2807"
+ width="36.245155"
+ height="32.204544"
+ x="390.23157"
+ y="574.62024" />
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;stroke:black;stroke-width:0.44547796;stroke-miterlimit:4;stroke-dasharray:0.89095592, 0.44547796;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2809"
+ width="59.048447"
+ height="14.601732"
+ x="430.82993"
+ y="574.9483" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="399.40982"
+ y="594.76312"
+ id="text3696"><tspan
+ sodipodi:role="line"
+ id="tspan3698"
+ x="399.40982"
+ y="594.76312">pic</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="445.84048"
+ y="586.5423"
+ id="text3700"><tspan
+ sodipodi:role="line"
+ id="tspan3702"
+ x="445.84048"
+ y="586.5423">label</tspan></text>
+ </g>
+</svg>
diff --git a/doc/src/declarative/pics/animatedimageitem.gif b/doc/src/declarative/pics/animatedimageitem.gif
new file mode 100644
index 0000000..85c3cb5
--- /dev/null
+++ b/doc/src/declarative/pics/animatedimageitem.gif
Binary files differ
diff --git a/doc/src/declarative/pics/blur_example.png b/doc/src/declarative/pics/blur_example.png
new file mode 100644
index 0000000..763b112
--- /dev/null
+++ b/doc/src/declarative/pics/blur_example.png
Binary files differ
diff --git a/doc/src/declarative/pics/declarative-qmlfocus1.png b/doc/src/declarative/pics/declarative-qmlfocus1.png
new file mode 100644
index 0000000..fd05146
--- /dev/null
+++ b/doc/src/declarative/pics/declarative-qmlfocus1.png
Binary files differ
diff --git a/doc/src/declarative/pics/declarative-qmlfocus2.png b/doc/src/declarative/pics/declarative-qmlfocus2.png
new file mode 100644
index 0000000..a946e2c
--- /dev/null
+++ b/doc/src/declarative/pics/declarative-qmlfocus2.png
Binary files differ
diff --git a/doc/src/declarative/pics/declarative-qmlfocus3.png b/doc/src/declarative/pics/declarative-qmlfocus3.png
new file mode 100644
index 0000000..ba55f76
--- /dev/null
+++ b/doc/src/declarative/pics/declarative-qmlfocus3.png
Binary files differ
diff --git a/doc/src/declarative/pics/declarative-qmlfocus4.png b/doc/src/declarative/pics/declarative-qmlfocus4.png
new file mode 100644
index 0000000..e21f2a6
--- /dev/null
+++ b/doc/src/declarative/pics/declarative-qmlfocus4.png
Binary files differ
diff --git a/doc/src/declarative/pics/edge1.png b/doc/src/declarative/pics/edge1.png
new file mode 100644
index 0000000..f4bc16d
--- /dev/null
+++ b/doc/src/declarative/pics/edge1.png
Binary files differ
diff --git a/doc/src/declarative/pics/edge2.png b/doc/src/declarative/pics/edge2.png
new file mode 100644
index 0000000..71bda8e
--- /dev/null
+++ b/doc/src/declarative/pics/edge2.png
Binary files differ
diff --git a/doc/src/declarative/pics/edge3.png b/doc/src/declarative/pics/edge3.png
new file mode 100644
index 0000000..51bb894
--- /dev/null
+++ b/doc/src/declarative/pics/edge3.png
Binary files differ
diff --git a/doc/src/declarative/pics/edge4.png b/doc/src/declarative/pics/edge4.png
new file mode 100644
index 0000000..aee3bd1
--- /dev/null
+++ b/doc/src/declarative/pics/edge4.png
Binary files differ
diff --git a/doc/src/declarative/pics/edges.png b/doc/src/declarative/pics/edges.png
new file mode 100644
index 0000000..211b101
--- /dev/null
+++ b/doc/src/declarative/pics/edges.png
Binary files differ
diff --git a/doc/src/declarative/pics/edges.svg b/doc/src/declarative/pics/edges.svg
new file mode 100644
index 0000000..25698ca
--- /dev/null
+++ b/doc/src/declarative/pics/edges.svg
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ sodipodi:docbase="/home/mbrasser"
+ sodipodi:docname="edges.svg">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Mstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Mstart"
+ style="overflow:visible">
+ <path
+ id="path3850"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.4) translate(10,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lstart"
+ style="overflow:visible">
+ <path
+ id="path3856"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.8) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2.8583315"
+ inkscape:cx="372.04724"
+ inkscape:cy="596.15198"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1279"
+ inkscape:window-height="969"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:#0ca9fa;fill-opacity:1;stroke:black;stroke-width:0.04639034;stroke-miterlimit:4;stroke-dasharray:0.09278069, 0.04639034;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1872"
+ width="33.656742"
+ height="39.808346"
+ x="208.86543"
+ y="390.22763"
+ rx="5"
+ ry="5" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 225.51888,380.99149 C 225.51888,439.06733 225.86873,439.06733 225.86873,439.06733"
+ id="path2760" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 242.97392,380.99149 C 242.97392,439.06733 243.32377,439.06733 243.32377,439.06733"
+ id="path3647" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 208.33832,380.99149 C 208.33832,439.06733 208.68817,439.06733 208.68817,439.06733"
+ id="path3649" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 195.91848,409.67956 C 256.44329,409.67956 256.09344,409.67956 256.09344,409.67956"
+ id="path3651" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 195.91848,429.97112 C 256.44329,429.97112 256.09344,429.97112 256.09344,429.97112"
+ id="path3653" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 195.91848,390.78742 C 256.44329,390.78742 256.09344,390.78742 256.09344,390.78742"
+ id="path3655" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="258.54242"
+ y="393.58627"
+ id="text3657"><tspan
+ sodipodi:role="line"
+ id="tspan3659"
+ x="258.54242"
+ y="393.58627"
+ style="font-size:10px">Top</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="258.78955"
+ y="412.28455"
+ id="text3661"><tspan
+ sodipodi:role="line"
+ id="tspan3663"
+ x="258.78955"
+ y="412.28455"
+ style="font-size:10px">VerticalCenter</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="260.18896"
+ y="433.27582"
+ id="text3665"><tspan
+ sodipodi:role="line"
+ id="tspan3667"
+ x="260.18896"
+ y="433.27582"
+ style="font-size:10px">Bottom</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="198.96443"
+ y="376.24954"
+ id="text3669"><tspan
+ sodipodi:role="line"
+ id="tspan3671"
+ x="198.96443"
+ y="376.24954"
+ style="font-size:10px">Left</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="230.55408"
+ y="375.39383"
+ id="text3673"><tspan
+ sodipodi:role="line"
+ id="tspan3675"
+ x="230.55408"
+ y="375.39383"
+ style="font-size:10px">Right</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="186.71951"
+ y="355.25827"
+ id="text3677"><tspan
+ sodipodi:role="line"
+ id="tspan3679"
+ x="186.71951"
+ y="355.25827"
+ style="font-size:10px">HorizontalCenter</tspan></text>
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Mstart)"
+ d="M 224.2567,375.39382 C 227.40539,356.85154 227.75525,357.20139 227.75525,357.20139"
+ id="path3681" />
+ </g>
+</svg>
diff --git a/doc/src/declarative/pics/edges_examples.svg b/doc/src/declarative/pics/edges_examples.svg
new file mode 100644
index 0000000..31e9901
--- /dev/null
+++ b/doc/src/declarative/pics/edges_examples.svg
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg3885"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ inkscape:export-filename="/home/mbrasser/edge4.png"
+ inkscape:export-xdpi="189.65207"
+ inkscape:export-ydpi="189.65207"
+ sodipodi:docbase="/home/mbrasser/work/Kinetic/ngui/doc/src/pics"
+ sodipodi:docname="edges_examples.svg">
+ <defs
+ id="defs3887" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2"
+ inkscape:cx="162.62912"
+ inkscape:cy="591.92069"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="928"
+ inkscape:window-height="624"
+ inkscape:window-x="0"
+ inkscape:window-y="495" />
+ <metadata
+ id="metadata3890">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:#0ca9fa;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3893"
+ width="50"
+ height="50"
+ x="100"
+ y="414.36218" />
+ <rect
+ style="opacity:1;fill:#fa0c2a;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3895"
+ width="104"
+ height="50"
+ x="150"
+ y="414.36218" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="109"
+ y="443.65125"
+ id="text3897"><tspan
+ sodipodi:role="line"
+ id="tspan3899"
+ x="109"
+ y="443.65125">rect1</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="186.54297"
+ y="443.65125"
+ id="text3901"><tspan
+ sodipodi:role="line"
+ id="tspan3903"
+ x="186.54297"
+ y="443.65125">rect2</tspan></text>
+ <rect
+ style="opacity:1;fill:#0ca9fa;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3905"
+ width="50"
+ height="50"
+ x="254"
+ y="414.36218" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="263"
+ y="443.65125"
+ id="text3907"><tspan
+ sodipodi:role="line"
+ id="tspan3909"
+ x="263"
+ y="443.65125">rect3</tspan></text>
+ </g>
+</svg>
diff --git a/doc/src/declarative/pics/edges_qml.png b/doc/src/declarative/pics/edges_qml.png
new file mode 100644
index 0000000..73f22f9
--- /dev/null
+++ b/doc/src/declarative/pics/edges_qml.png
Binary files differ
diff --git a/doc/src/declarative/pics/edges_qml.svg b/doc/src/declarative/pics/edges_qml.svg
new file mode 100644
index 0000000..1814ec6
--- /dev/null
+++ b/doc/src/declarative/pics/edges_qml.svg
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ sodipodi:docbase="/home/mbrasser/work/Kinetic/ngui/doc/src/pics"
+ sodipodi:docname="edges_qml.svg"
+ inkscape:export-filename="/home/mbrasser/edges_qml.png"
+ inkscape:export-xdpi="284.45999"
+ inkscape:export-ydpi="284.45999">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Mstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Mstart"
+ style="overflow:visible">
+ <path
+ id="path3850"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.4) translate(10,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lstart"
+ style="overflow:visible">
+ <path
+ id="path3856"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.8) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2.8583315"
+ inkscape:cx="372.04724"
+ inkscape:cy="596.15198"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1279"
+ inkscape:window-height="969"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:#0ca9fa;fill-opacity:1;stroke:black;stroke-width:0.04639034;stroke-miterlimit:4;stroke-dasharray:0.09278069, 0.04639034;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1872"
+ width="33.656742"
+ height="39.808346"
+ x="208.86543"
+ y="390.22763"
+ rx="5"
+ ry="5" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 225.51888,380.99149 C 225.51888,439.06733 225.86873,439.06733 225.86873,439.06733"
+ id="path2760" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 242.97392,380.99149 C 242.97392,439.06733 243.32377,439.06733 243.32377,439.06733"
+ id="path3647" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 208.33832,380.99149 C 208.33832,439.06733 208.68817,439.06733 208.68817,439.06733"
+ id="path3649" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 195.91848,409.67956 C 256.44329,409.67956 256.09344,409.67956 256.09344,409.67956"
+ id="path3651" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 195.91848,429.97112 C 256.44329,429.97112 256.09344,429.97112 256.09344,429.97112"
+ id="path3653" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 195.91848,390.78742 C 256.44329,390.78742 256.09344,390.78742 256.09344,390.78742"
+ id="path3655" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="258.54242"
+ y="393.58627"
+ id="text3657"><tspan
+ sodipodi:role="line"
+ id="tspan3659"
+ x="258.54242"
+ y="393.58627"
+ style="font-size:10px">top</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="258.78955"
+ y="412.28455"
+ id="text3661"><tspan
+ sodipodi:role="line"
+ id="tspan3663"
+ x="258.78955"
+ y="412.28455"
+ style="font-size:10px">verticalCenter</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="260.18896"
+ y="433.27582"
+ id="text3665"><tspan
+ sodipodi:role="line"
+ id="tspan3667"
+ x="260.18896"
+ y="433.27582"
+ style="font-size:10px">bottom</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="200.96443"
+ y="376.24954"
+ id="text3669"><tspan
+ sodipodi:role="line"
+ id="tspan3671"
+ x="200.96443"
+ y="376.24954"
+ style="font-size:10px">left</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="232.55408"
+ y="375.39383"
+ id="text3673"><tspan
+ sodipodi:role="line"
+ id="tspan3675"
+ x="232.55408"
+ y="375.39383"
+ style="font-size:10px">right</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="190.71951"
+ y="355.25827"
+ id="text3677"><tspan
+ sodipodi:role="line"
+ id="tspan3679"
+ x="190.71951"
+ y="355.25827"
+ style="font-size:10px">horizontalCenter</tspan></text>
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Mstart);stroke-opacity:1"
+ d="M 226.2567,375.39382 C 229.40539,356.85154 229.75525,357.20139 229.75525,357.20139"
+ id="path3681" />
+ </g>
+</svg>
diff --git a/doc/src/declarative/pics/flickable.gif b/doc/src/declarative/pics/flickable.gif
new file mode 100644
index 0000000..f7a3319
--- /dev/null
+++ b/doc/src/declarative/pics/flickable.gif
Binary files differ
diff --git a/doc/src/declarative/pics/flipable.gif b/doc/src/declarative/pics/flipable.gif
new file mode 100644
index 0000000..6386f06
--- /dev/null
+++ b/doc/src/declarative/pics/flipable.gif
Binary files differ
diff --git a/doc/src/declarative/pics/gridLayout_example.png b/doc/src/declarative/pics/gridLayout_example.png
new file mode 100644
index 0000000..6b120e9
--- /dev/null
+++ b/doc/src/declarative/pics/gridLayout_example.png
Binary files differ
diff --git a/doc/src/declarative/pics/gridview.png b/doc/src/declarative/pics/gridview.png
new file mode 100644
index 0000000..d5c8b4b
--- /dev/null
+++ b/doc/src/declarative/pics/gridview.png
Binary files differ
diff --git a/doc/src/declarative/pics/highlight.gif b/doc/src/declarative/pics/highlight.gif
new file mode 100644
index 0000000..fbef256
--- /dev/null
+++ b/doc/src/declarative/pics/highlight.gif
Binary files differ
diff --git a/doc/src/declarative/pics/horizontalLayout_example.png b/doc/src/declarative/pics/horizontalLayout_example.png
new file mode 100644
index 0000000..42f90ec
--- /dev/null
+++ b/doc/src/declarative/pics/horizontalLayout_example.png
Binary files differ
diff --git a/doc/src/declarative/pics/layout-add.gif b/doc/src/declarative/pics/layout-add.gif
new file mode 100644
index 0000000..86e9247
--- /dev/null
+++ b/doc/src/declarative/pics/layout-add.gif
Binary files differ
diff --git a/doc/src/declarative/pics/layout-move.gif b/doc/src/declarative/pics/layout-move.gif
new file mode 100644
index 0000000..1825c22
--- /dev/null
+++ b/doc/src/declarative/pics/layout-move.gif
Binary files differ
diff --git a/doc/src/declarative/pics/layout-remove.gif b/doc/src/declarative/pics/layout-remove.gif
new file mode 100644
index 0000000..7086511
--- /dev/null
+++ b/doc/src/declarative/pics/layout-remove.gif
Binary files differ
diff --git a/doc/src/declarative/pics/margins_qml.png b/doc/src/declarative/pics/margins_qml.png
new file mode 100644
index 0000000..d7d73a3
--- /dev/null
+++ b/doc/src/declarative/pics/margins_qml.png
Binary files differ
diff --git a/doc/src/declarative/pics/margins_qml.svg b/doc/src/declarative/pics/margins_qml.svg
new file mode 100644
index 0000000..1f0ff02
--- /dev/null
+++ b/doc/src/declarative/pics/margins_qml.svg
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ sodipodi:docbase="/home/mbrasser/work/Kinetic/ngui/doc/src/pics"
+ sodipodi:docname="margins_qml.svg"
+ inkscape:export-filename="/home/mbrasser/edges_qml.png"
+ inkscape:export-xdpi="284.45999"
+ inkscape:export-ydpi="284.45999">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Send"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Send"
+ style="overflow:visible;">
+ <path
+ id="path2976"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none;"
+ transform="scale(0.2) rotate(180) translate(6,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Sstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Sstart"
+ style="overflow:visible">
+ <path
+ id="path2979"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.2) translate(6,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Mstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Mstart"
+ style="overflow:visible">
+ <path
+ id="path3850"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.4) translate(10,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lstart"
+ style="overflow:visible">
+ <path
+ id="path3856"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.8) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2.8583315"
+ inkscape:cx="372.04724"
+ inkscape:cy="596.15198"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1279"
+ inkscape:window-height="969"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:#0ca9fa;fill-opacity:1;stroke:black;stroke-width:0.04639034;stroke-miterlimit:4;stroke-dasharray:0.09278069, 0.04639034;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1872"
+ width="33.656742"
+ height="39.808346"
+ x="208.86543"
+ y="390.22763"
+ rx="5"
+ ry="5" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1.02602077;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.02602088, 1.02602088;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 252.98692,377.00435 C 252.98692,443.05433 253.31077,443.05433 253.31077,443.05433"
+ id="path3647" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1.02601969;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.02602007, 1.02602007;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 198.35134,377.00433 C 198.35134,443.05431 198.67515,443.05431 198.67515,443.05431"
+ id="path3649" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1.02421367;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.02421381, 1.02421381;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 193.94282,437.97112 C 257.43421,437.97112 257.06721,437.97112 257.06721,437.97112"
+ id="path3653" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1.02421367;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.02421381, 1.02421381;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 193.94282,380.78742 C 257.43421,380.78742 257.06721,380.78742 257.06721,380.78742"
+ id="path3655" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="260.29169"
+ y="388.78741"
+ id="text1911"><tspan
+ sodipodi:role="line"
+ id="tspan1913"
+ x="260.29169"
+ y="388.78741"
+ style="font-size:10px">topMargin</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="259.65204"
+ y="437.27798"
+ id="text1915"><tspan
+ sodipodi:role="line"
+ id="tspan1917"
+ x="259.65204"
+ y="437.27798"
+ style="font-size:10px">bottomMargin</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="170.07939"
+ y="454.4209"
+ id="text1919"><tspan
+ sodipodi:role="line"
+ id="tspan1921"
+ x="170.07939"
+ y="454.4209"
+ style="font-size:10px">leftMargin</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="228.47504"
+ y="454.4209"
+ id="text1923"><tspan
+ sodipodi:role="line"
+ id="tspan1925"
+ x="228.47504"
+ y="454.4209"
+ style="font-size:10px">rightMargin</tspan></text>
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:0.92020172px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Sstart);marker-end:url(#Arrow1Send);stroke-opacity:1"
+ d="M 225.6938,382.51213 C 225.6938,388.91693 225.6938,388.91693 225.6938,388.91693"
+ id="path1929" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:0.92007709px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Sstart);marker-end:url(#Arrow1Send);stroke-opacity:1"
+ d="M 225.6938,430.56703 C 225.6938,436.97192 225.6938,436.97192 225.6938,436.97192"
+ id="path3000" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Sstart);marker-mid:none;marker-end:url(#Arrow1Send);stroke-opacity:1"
+ d="M 201.16631,410.1318 C 207.81355,410.1318 207.81355,410.1318 207.81355,410.1318"
+ id="path3002" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Sstart);marker-mid:none;marker-end:url(#Arrow1Send);stroke-opacity:1"
+ d="M 244.02348,410.1318 C 250.67072,410.1318 250.67072,410.1318 250.67072,410.1318"
+ id="path3889" />
+ </g>
+</svg>
diff --git a/doc/src/declarative/pics/particles.gif b/doc/src/declarative/pics/particles.gif
new file mode 100644
index 0000000..763a8a8
--- /dev/null
+++ b/doc/src/declarative/pics/particles.gif
Binary files differ
diff --git a/doc/src/declarative/pics/pathview.gif b/doc/src/declarative/pics/pathview.gif
new file mode 100644
index 0000000..4052eb2
--- /dev/null
+++ b/doc/src/declarative/pics/pathview.gif
Binary files differ
diff --git a/doc/src/declarative/pics/propanim.gif b/doc/src/declarative/pics/propanim.gif
new file mode 100644
index 0000000..f86406e
--- /dev/null
+++ b/doc/src/declarative/pics/propanim.gif
Binary files differ
diff --git a/doc/src/declarative/pics/qtlogo.png b/doc/src/declarative/pics/qtlogo.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/doc/src/declarative/pics/qtlogo.png
Binary files differ
diff --git a/doc/src/declarative/pics/reflection_example.png b/doc/src/declarative/pics/reflection_example.png
new file mode 100644
index 0000000..fd9bb48
--- /dev/null
+++ b/doc/src/declarative/pics/reflection_example.png
Binary files differ
diff --git a/doc/src/declarative/pics/scalegrid.svg b/doc/src/declarative/pics/scalegrid.svg
new file mode 100644
index 0000000..e386f3d
--- /dev/null
+++ b/doc/src/declarative/pics/scalegrid.svg
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ sodipodi:docbase="/home/mbrasser/work/Kinetic/ngui/doc/src/pics"
+ sodipodi:docname="scalegrid.svg"
+ inkscape:export-filename="/home/mbrasser/work/Kinetic/ngui/doc/src/pics/scalegrid.png"
+ inkscape:export-xdpi="189.65207"
+ inkscape:export-ydpi="189.65207">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="50"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="3.2163554"
+ inkscape:cx="173.89302"
+ inkscape:cy="703.69531"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:grid-bbox="false"
+ inkscape:guide-bbox="false"
+ inkscape:window-width="1409"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="opacity:1;fill:red;fill-opacity:1;stroke:none;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect1876"
+ width="45.104"
+ height="45.137001"
+ x="119.16868"
+ y="301.00308"
+ rx="5"
+ ry="5" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:0.3965202;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.79304035, 0.39652018;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 157.02483,295.52571 C 157.02483,352.04784 157.02483,352.04784 157.02483,352.04784"
+ id="path2766" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:0.39652267;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.79304534, 0.39652268;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 126.2,295.64284 C 126.2,352.16567 126.2,352.16567 126.2,352.16567"
+ id="path2768" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:0.39652267;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.79304534, 0.39652268;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 169.05321,308.25967 C 112.53038,308.25967 112.53038,308.25967 112.53038,308.25967"
+ id="path2770" />
+ <path
+ style="fill:none;fill-opacity:0.75;fill-rule:evenodd;stroke:black;stroke-width:0.39652267;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.79304534, 0.39652268;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 169.08024,339.77238 C 112.55741,339.77238 112.55741,339.77238 112.55741,339.77238"
+ id="path2772" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Arial Black"
+ x="115.2857"
+ y="303.60583"
+ id="text2774"><tspan
+ sodipodi:role="line"
+ id="tspan2776"
+ x="115.2857"
+ y="303.60583">1</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="137.19142"
+ y="303.60583"
+ id="text2782"><tspan
+ sodipodi:role="line"
+ id="tspan2784"
+ x="137.19142"
+ y="303.60583"
+ style="font-family:Arial Black">2</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Arial Black"
+ x="161.56842"
+ y="303.45935"
+ id="text2786"><tspan
+ sodipodi:role="line"
+ id="tspan2788"
+ x="161.56842"
+ y="303.45935">3</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="114.72613"
+ y="327.00702"
+ id="text2790"><tspan
+ sodipodi:role="line"
+ id="tspan2792"
+ x="114.72613"
+ y="327.00702"
+ style="font-family:Arial Black">4</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="137.12404"
+ y="326.86053"
+ id="text2794"><tspan
+ sodipodi:role="line"
+ id="tspan2796"
+ x="137.12404"
+ y="326.86053"
+ style="font-family:Arial Black">5</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="161.49518"
+ y="326.86053"
+ id="text2798"><tspan
+ sodipodi:role="line"
+ id="tspan2800"
+ x="161.49518"
+ y="326.86053"
+ style="font-family:Arial Black">6</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="114.70855"
+ y="351.25809"
+ id="text2802"><tspan
+ sodipodi:role="line"
+ id="tspan2804"
+ x="114.70855"
+ y="351.25809"
+ style="font-family:Arial Black">7</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="137.08595"
+ y="351.1116"
+ id="text2806"><tspan
+ sodipodi:role="line"
+ id="tspan2808"
+ x="137.08595"
+ y="351.1116"
+ style="font-family:Arial Black">8</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="161.58307"
+ y="351.1116"
+ id="text2810"><tspan
+ sodipodi:role="line"
+ id="tspan2812"
+ x="161.58307"
+ y="351.1116"
+ style="font-family:Arial Black">9</tspan></text>
+ </g>
+</svg>
diff --git a/doc/src/declarative/pics/shadow_example.png b/doc/src/declarative/pics/shadow_example.png
new file mode 100644
index 0000000..6214620
--- /dev/null
+++ b/doc/src/declarative/pics/shadow_example.png
Binary files differ
diff --git a/doc/src/declarative/pics/spacing_a.png b/doc/src/declarative/pics/spacing_a.png
new file mode 100644
index 0000000..ff07e2e
--- /dev/null
+++ b/doc/src/declarative/pics/spacing_a.png
Binary files differ
diff --git a/doc/src/declarative/pics/spacing_b.png b/doc/src/declarative/pics/spacing_b.png
new file mode 100644
index 0000000..94304ee
--- /dev/null
+++ b/doc/src/declarative/pics/spacing_b.png
Binary files differ
diff --git a/doc/src/declarative/pics/trivialListView.png b/doc/src/declarative/pics/trivialListView.png
new file mode 100644
index 0000000..175e455
--- /dev/null
+++ b/doc/src/declarative/pics/trivialListView.png
Binary files differ
diff --git a/doc/src/declarative/pics/verticalLayout_example.png b/doc/src/declarative/pics/verticalLayout_example.png
new file mode 100644
index 0000000..458dc7f
--- /dev/null
+++ b/doc/src/declarative/pics/verticalLayout_example.png
Binary files differ
diff --git a/doc/src/declarative/pics/verticalLayout_transition.gif b/doc/src/declarative/pics/verticalLayout_transition.gif
new file mode 100644
index 0000000..ed61adb
--- /dev/null
+++ b/doc/src/declarative/pics/verticalLayout_transition.gif
Binary files differ
diff --git a/doc/src/declarative/pics/webview.png b/doc/src/declarative/pics/webview.png
new file mode 100644
index 0000000..0d24586
--- /dev/null
+++ b/doc/src/declarative/pics/webview.png
Binary files differ
diff --git a/doc/src/declarative/qmlforcpp.qdoc b/doc/src/declarative/qmlforcpp.qdoc
new file mode 100644
index 0000000..7aa2560
--- /dev/null
+++ b/doc/src/declarative/qmlforcpp.qdoc
@@ -0,0 +1,999 @@
+/*!
+ \page qmlforcpp.html
+ \target qmlforcpp
+ \title Qt Declarative Markup Language For C++ Programmers
+
+ This page describes the QML format and how to use and extend it from C++.
+
+ The QML syntax declaratively describes in XML how to construct an in memory
+ object tree. QML is usually used to describe a visual scene graph - using
+ \l {graphicsview}{GraphicsView} or the \l {fxprimitives}{Fx Primitives} - but it is not conceptually
+ limited to this: the QML format is an abstract XML description of \b any
+ object tree.
+
+ QML also includes property bindings. Bindings are ECMAScript expressions
+ of a properties value. Whenever the value of the expression changes -
+ either for the first time at startup or subsequently thereafter - the
+ property is automatically updated with the new value.
+
+ \section1 Loading and using QML Files
+
+ QmlComponent is used to load a QML file and to create object instances.
+
+ In QML a component is the unit of instantiation, and the most basic unit
+ of scope. A component is like a template for how to construct an object
+ tree. One component can create multiple instances of this tree, but the
+ template remains constant.
+
+ The following code uses the C++ interface to create 100 red rectangles
+ based on a simple declarative component description.
+ \raw html
+ <table border="0">
+ <tr>
+ <td>
+ \endraw
+ \code
+ QmlComponent redRectangle("<Rect color=\"red\" width=\"100\" height=\"100\" />");
+ for (int ii = 0; ii < 100; ++ii) {
+ QObject *rectangle = redRectangle.create();
+ // ... do something with the rectangle ...
+ }
+ \endcode
+ \raw html
+ </td>
+ </tr>
+ </table>
+ \endraw
+
+ Each independent XML file describes a QML component, but it is
+ also possible to create sub-components within a QML file as will be
+ shown later.
+
+ \section1 QML Format 101
+
+ This is some sample QML code.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <Image id="myRect" x="10" y="10" width="100" height="100" src="background.png">
+ <Text width="100">
+ <height>50</height>
+ <color>white</color>
+ <font.fontSize>16</font.fontSize>
+ Hello world!
+ </Text>
+ </Image>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ In QML, XML tags and attributes correspond to Qt objects and properties.
+ The general rule of thumb is any tag or attribute name that starts with a
+ capital letter refers to a class, and names that start with a lower case
+ letter to properties. It is not possible to access a property that starts
+ with a capital letter from QML.
+
+ The QML snippet shown above instantiates one \c Image instance and one
+ \c Text instance and sets properties on both. \b Everything in QML
+ ultimately comes down to either instantiating an object instance, or
+ assigning a property a value. QML relies heavily on Qt's meta object system
+ and can only instantiate classes that derive from QObject.
+
+ Setting properties can be done in two ways: as an XML attribute directly on
+ the class tag that created the the object, or as sub-tags.
+ Although syntactically different, their behaviour is identical. The two QML
+ snippets below behave exactly the same.
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <Rect x="10" y="10" />
+ \endcode
+\raw HTML
+ </td>
+ <td>
+\endraw
+ \code
+ <Rect>
+ <x>10</x>
+ <y>10</y>
+ </Rect>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+ Arbitrary mixing and matching between the two is allowed.
+
+ QML can set properties that are more complex than just simple types like
+ integers and strings. Properties can be object pointers or Qt interface pointers
+ or even lists of object or Qt interface pointers! QML is typesafe, and will
+ ensure that only the valid types are assigned to properties.
+
+ Assigning an object to a property is as simple as assigning a basic
+ integer. Attempting to assign an object to a property when type coercian
+ fails will produce an error. The following shows an example of valid and of
+ invalid QML and the corresponding C++ classes.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ class Image : public QObject
+ {
+ ...
+ Q_PROPERTY(ImageFilter *filter READ filter WRITE setFilter)
+ };
+
+ class ImageFilter : public QObject
+ {
+ ...
+ };
+ \endcode
+\raw HTML
+ </td>
+ <td>
+\endraw
+ \code
+ <!-- OK -->
+ <Image>
+ <filter>
+ <ImageFilter />
+ </filter>
+ </Image>
+
+ <!-- NOT OK: Image cannot be cast into ImageFilter -->
+ <Image>
+ <filter>
+ <Image />
+ </filter>
+ </Image>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ Classes can also define an optional default property. The default property
+ is used for assignment if no explicit property has been specified.
+ In the example below, the string "Hello World!" will be assigned to
+ the \c Text element's default property - which happens to be the \c text
+ property. Both lines do the same thing, one explicitly and one implicitly.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <Text text="Hello World!" />
+ <Text>Hello World!</Text>
+ \endcode
+\raw HTML
+ </td>
+ <td>
+\endraw
+ \code
+ class Text : public QObject
+ {
+ ...
+ Q_PROPERTY(QString text READ text WRITE setText)
+ Q_CLASSINFO("DefaultProperty", "text")
+ };
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ Any object property can be the default, even complex properties like lists
+ of objects. The default property of the \c Rect class is the \c children
+ property, a list of \c Item's. In the following example, as both \c Image
+ and \c Text inherit from \c Item the \c Image and \c Text instances are
+ added to the parent's \c children property.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <Rect>
+ <Image />
+ <Text />
+ </Rect>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ Properties that return read-only object pointers can be used recursively.
+ This can be used, for example, to group properties together. The
+ \c Text element has a \c font property that returns an object with a number
+ of sub-properties such as \c family, \c bold, \c italic and \c size.
+ QML makes it easy to interact with these grouped properties, as the
+ following shows - everything you would expect to work, just does.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ class Text : public ...
+ {
+ ...
+ Q_PROPERTY(Font *font READ font);
+ };
+ class Font : public QObject
+ {
+ ...
+ Q_PROPERTY(QString family READ family WRITE setFamily);
+ Q_PROPERTY(bool bold READ bold WRITE setBold);
+ Q_PROPERTY(bool italic READ italic WRITE setItalic);
+ Q_PROPERTY(int size READ size WRITE setSize);
+ };
+ \endcode
+\raw HTML
+ </td>
+ <td>
+\endraw
+ \code
+ <Text font.family="helvetica">
+ <font>
+ <bold>true</bold>
+ <italic>true</italic>
+ </font>
+ <font.size>12</font.size>
+ </Text>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ \section1 Defining QML Types
+
+ The QML engine has no intrinsic knowledge of any class types. Instead
+ the programmer must define the C++ types, and their corresponding QML
+ name. There are three ways of adding known types to the QML engine:
+ \list
+ \o
+ \code
+ #define QML_DECLARE_TYPE(T)
+ #define QML_DEFINE_TYPE(T,QmlName)
+ \endcode
+ Adding these macros to your library or executable automatically makes the
+ C++ type \a T available from the declarative markup language under the
+ name \a QmlName. Of course there's nothing stopping you using the same
+ name for both the C++ and the QML name!<br>
+ Most types are added to the QML engine using these macros. The only
+ requirement is that \a T inherits QObject and has a default constructor.
+ \o
+ \code
+ #define QML_DEFINE_CUSTOM_PARSER(QmlName, CustomParserClass)
+ \endcode
+ Custom parsers define a way to translate between declarative XML and an
+ object instance in the case the default object model lets you down. Free
+ form lists (\c {<ListModel>} are an example of a custom parser.
+ Custom parsers implement the \l QmlCustomParser interface.
+
+ Custom parsers give a developer very fine grain control over how a type is
+ instantiated from the XML that describes it. During the
+ compilation phase, the custom parser is presented with the XML via a
+ QXmlStreamReader and must
+ compile this down into an opaque blob that is returned to the compiler.
+ When, at runtime, the type is instantiated, the opaque blob is passed into
+ the custom parser, which must return a QObject derived type.
+
+ \o QML::ClassFactory
+
+ The QML engine calls the class factory as a last resort when trying to
+ create a type. The class factory returns a \l QmlComponent instance for
+ the type if it can create it. This allows "on the fly" types to be created.
+ For example, a class factory is used to support automatic instantiation of
+ .qml template files.
+ \endlist
+
+ \section1 Property Binding
+
+ Assigning constant values and trees to properties will only get you so
+ far. Property binding allows a property's value to be dependant on the
+ value of other properties and data. Whenever these dependencies change,
+ the property's value is automatically updated.
+
+ Property bindings are ECMAScript expressions and can be applied to any
+ object property. C++ classes don't have to do anything special to get
+ binding support other than define appropriate properties. Property binding
+ expressions are differentiated from regular constant literals by surrounding
+ them in braces.
+
+ Here's a simple example that stacks a red, blue and green rectangle.
+ Bindings are used to ensure that the height of each is kept equal to it's
+ parent's. Were the root rectangle's height property to change, the child
+ rectangles height would be updated automatically.
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <Rect color="red" width="100">
+ <Rect color="blue" width="50" height="{parent.height}">
+ <Rect color="green" width="25" height="{parent.height}">
+ </Rect>
+ </Rect>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+ Binding expressions execute in a context. A context behaves as a scope and
+ defines how the expression resolves property and variable names. Although
+ the two expressions in the last example are the same, the value of \c parent
+ resolves differently because each executes in a different context. Although
+ QML generally takes care of everything for the programmer, a thorough
+ understanding of bind contexts is important in some of the more complex QML
+ structures.
+
+ Every expression is executed in a bind context, encapsulated by the
+ QmlBindContext C++ class. As covered in the class documentation, a
+ bind context contains a map of names to values, and a list of default
+ objects. When resolving a name, the name to value map is searched first.
+ If the name cannot be found, the default object's are iterated in turn and
+ the context attempts to resolve the name as a property of one of the default
+ objects.
+
+ There are generally two contexts involved in the execution of a binding.
+ The first is the "object context" - a bind context associated with the
+ closest instantiated object and containing just one default object, and
+ that's instantiated object itself. The effect of the object
+ context is pretty simple - names in the binding expression resolve to
+ properties on the object first. It is important to note - particularly in
+ the case of grouped properties - the object context is that of the
+ instantiated object, the consequences of which are shown below.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <!-- OK --> <!-- NOT OK: Text has no italic property -->
+ <Text> <Text>
+ <font> <font>
+ <bold>{font.italic}</bold> <bold>{italic}</bold>
+ </font> </font>
+ </Text> </Text>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ The second context is the "component context". Each QML component (and
+ consequently each QML file) is created in its own unique binding context.
+ Like the object context, the component context contains just one default
+ object - but in this case it is the component's root object. An example
+ will illustrate best - the resultant text will read "background.png".
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <Image src="background.png">
+ <Text text="{src}" />
+ </Image>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ If the name is not found in either of these contexts, the context heirarchy
+ is searched parent-by-parent until the name is either found, or the
+ heirarchy is exhausted.
+
+ The first property binding example shown involved fixing the height of three
+ rectangles. It did this by fixing the height of each rectangle to its
+ parent, rather than fixing them all to a single common point. Here's the
+ example rewritten to do just that.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <Rect color="red" width="100">
+ <Rect color="blue" width="50" height="{parent.height}">
+ <Rect color="green" width="25" height="{parent.parent.height}">
+ </Rect>
+ </Rect>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ Clearly this sort of fragile relationship is undesirable and unmanageable -
+ moving the green rectangle to be a sibling of the blue or introducing a
+ further rectangle between the two would break the example.
+
+ To address this problem, QML includes a way to directly reference any object
+ within a component (or parent component for that matter), called "ids".
+ Developers assign an object an id, and can then reference it directly by
+ name. Developers assign an object an id by setting the special \c id
+ property. Every object automatically has this magical property (if the
+ object also has an actual property called \c id, that gets set too). As
+ an id allows an object to be referenced directly, it must be unique within
+ a component. Any number of id's can exist, but they must all begin with
+ a capital letter. An id of "Root" is valid, while an id of "root" is not.
+ \note This is not technically true - lowercase id names do work, but are
+ slower. Support will probably be removed for them eventually.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <Rect id="Root" color="red" width="{GreenRect.width + 75}">
+ <Rect color="blue" width="{GreenRect.width + 25}" height="{Root.height}">
+ <Rect id="GreenRect" color="green" width="25" height="{Root.height}">
+ </Rect>
+ </Rect>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ To relate id's back to QmlBindContext, id's exist as properties on the
+ component context.
+
+ Bind expressions can reference any object property. The QML bind engine
+ relies on the presence of the NOTIFY signal in the Q_PROPERTY declaration
+ on a class to alert it that a property's value has changed. If this is
+ omitted, the bind expression can still access the property's value, but
+ the expression will not be updated if the value changes. The following is
+ an example of a QML friendly property declaration.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ class Example : public QObject
+ {
+ Q_OBJECT
+ Q_PROPERTY(int sample READ sample WRITE setSample NOTIFY sampleChanged)
+ public:
+ int sample() const;
+ void setSample(int);
+ signals:
+ void sampleChanged(int);
+ };
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ While generally no changes are needed to a C++ class to use property
+ binding, sometimes more advanced interaction between the binding engine and
+ an object is desirable. To facilitate this, there is a special exception
+ in the bind engine for allowing an object to access the binding directly.
+
+ If a binding is assigned to a property with a type of QmlBindableValue
+ pointer (ie. QmlBindableValue *), each time the binding value changes,
+ a QmlBindableValue instance is assigned to that property. The
+ QmlBindableValue instance allows the object to read the binding and to
+ evaluate the binding's current value.
+
+ \section1 Signal Properties
+
+ In addition to reading and writing regular properties, QML allows you to
+ easily associate ECMAScript with signals. Consider the following example,
+ in which Button is a made-up type with a clicked() signal.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <Button text="Hello world!" onClicked="print(text)" />
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ Clicking on the button causes "Hello world!" to be printed to the console
+ (or lost forever if you're running Windows).
+
+ Like properties, signals automatically become available in QML without
+ any additional work. As illustrated signals are mapped into QML as special
+ "signal properties", using the name "on<Signal Name>" where the first
+ character of the signal's name is uppercased. If more than one signal of
+ the same name is exist on a class, only the first is available (see the
+ \l {xmlConnection}{<Connection>} element for more general signal connections).
+
+ An important observation to make here is the lack of braces. While both
+ property bindings and signal properties involve executing ECMAScript code,
+ property bindings dynamically update the property value (hence the braces),
+ whereas with signal properties the constant script "value" is actually
+ assigned to the signal property. Trying to bind a value to a signal
+ property will not work!
+
+ Signal parameters are also available to the executing script, as shown
+ below, as long as you remember to name the parameters of your signal
+ in C++ (see QMetaMethod::parameterNames()).
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <Example>
+ <onDoSomething>
+ for(var ii = 0; ii &lt; count; ++ii)
+ print(message)
+ </onDoSomething>
+ </Example>
+ \endcode
+\raw HTML
+ </td>
+ <td>
+\endraw
+ \code
+ class Example : public QObject
+ {
+ Q_OBJECT
+ signals:
+ void doSomething(int count, const QString &message);
+ };
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ Just like property bindings, signal scripts are executed in a context. The
+ signal script context is identical in scope to the "object context" under
+ property binding, with the exception that it has the signal parameters
+ bound in.
+
+ In addition to scripts, it is possible to assign objects to signal properties.
+ This automatically connects the signal to the object's default method. A
+ default method is defined just like a default property, though the special
+ "DefaultMethod" class info.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ Q_CLASSINFO("DefaultMethod", "myMethod(int)");
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ This is useful in achieving several use cases, like that below which moves
+ the button when it is clicked.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <Button id="MyButton">
+ <onClicked>
+ <NumericAnimation target="{MyButton}" property="x" to="100" />
+ </onClicked>
+ </Button>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+
+ If the class itself actually defines a property called "on<Name>", this will
+ be assigned the string value and the signal handling behaviour will be
+ disabled.
+
+ \section1 Attached Properties
+
+ Attached properties allow unrelated types to annotate another type with some
+ additional properties. Some APIs or operations are inherintly imperative,
+ and attached properties help out when translating these APIs into the
+ declarative QML language.
+
+ Qt's QGridLayout is one such example.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <QGridLayout>
+ <QLabel QGridLayout.row="0" QGridLayout.column="0" text="Name:"/>
+ <QLineEdit QGridLayout.row="0" QGridLayout.column="1" />
+
+ <QLabel QGridLayout.row="1" QGridLayout.column="0" text="Occupation:"/>
+ <QLineEdit QGridLayout.row="1" QGridLayout.column="1" />
+ </QGridLayout>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ Attached properties are identified by the use of a class name, in the
+ case shown \c QGridLayout, as a grouped property specifier. To prevent
+ ambiguity with actual class instantiations, attached properties must
+ always be specified to include a period but can otherwise be used just like
+ regular properties.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <!-- OK --> <!-- NOT OK: Creates a QGridLayout, rather than assigning attached property -->
+ <QLabel> <QLabel>
+ <QGridLayout.row>0</QGridLayout.row> <QGridLayout>
+ </QLabel> <row>0</row>
+ </QGridLayout>
+ </QLabel>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ C++ types provide attached properties by declaring the public function \c qmlAttachedProperties like this example.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ static QObject *Type::qmlAttachedProperties(QObject *);
+ \endcode
+\raw HTML
+ </td>
+ <td>
+\endraw
+ \code
+ class Example : public QObject
+ {
+ Q_OBJECT
+ public:
+ static QObject *qmlAttachedProperties(QObject *);
+ };
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ When an attached property is accessed, the QML engine will call this method
+ to create an attachment object, passing in the object instance that the
+ attached property applies to. The attachment object should define all
+ the attached properties, and is generally parented to the provided object
+ instance to avoid memory leaks. The QML engine does not save this object,
+ so it is necessary for the attached property function to ensure that
+ multiple calls for the same instance object return the same attached object.
+
+ While conceptually simple, implementing an attachment object is not quite
+ so easy. The \c qmlAttachedProperties function is static - attachment
+ objects are not associated with any particular instance. How the values
+ of the attached properties apply to the behaviour they are controlling is
+ entirely implementation dependent. An additional consequence of this is
+ that \b any object can attach \b any attached property. The following is
+ perfectly valid, although the attached property has no actual effect:
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <FancyGridLayout>
+ <Item>
+ <Button QGridLayout.row="1" />
+ </Item>
+ </FancyGridLayout>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ The property has no effect because the (made-up) FancyGridLayout type defines the meaning
+ of the \c row attached property only to apply to its direct children. It
+ is possible that other types may have attached properties that affect
+ objects that aren't their direct children.
+
+ Attached properties are an advanced feature that should be used with
+ caution.
+
+ \note We may implement a convenience wrapper that makes using attached
+ properties easier for the common "attach to children" case.
+
+ \section1 Property Value Sources
+
+ Intrinsically, the QML engine can assign a property either a static value,
+ such as a number of object tree, or a property binding. It is possible for
+ advanced users to extend the engine to assign other "types" of values to
+ properties. These "types" are known as property value sources.
+
+ Consider the following \l {fxprimitives}{Fx Primitives} example.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ <Rect width="100" height="100" color="red">
+ <x>
+ <NumericAnimation running="true" repeat="true" from="0" to="100" />
+ </x>
+ </Rect>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ Here the \c x property of the rectangle will be animated from 0 to 100.
+ To support this, the NumericAnimation class inherits the
+ QmlPropertyValueSource class. If a type inherits this class and is assigned
+ to a property for which type assignment would otherwise fail (ie. the
+ property itself doesn't have a type of QmlPropertyValueSource *), the QML
+ engine will automatically set the property as the target of the value
+ source.
+
+ \section1 Extending types in QML
+
+ QML is designed to allow you to build fully working types without writing
+ a line of C++ code. This is, for example, used extensively when designing
+ applications using the \l {fxprimitives}{Fx Primitives}. To create new types, it is
+ necessary to be able to define new signals, slots and properties in QML.
+
+ \note slots are not yet supported
+
+ Any object is extensible in this way under QML, using the special
+ \c properties and \c signals properties. Like \c id, these two properties
+ are automatically available on all types under QML and accessible from
+ other QML files or directly from C++.
+
+ In this example, a Button is extended to have an additional
+ "text2" property (which always returns "Hello world!") and an additional
+ signal "clicked2" that is also emitted when the button is clicked. Not
+ a very useful extension, but an extension nonetheless.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ QmlComponent component(xmlData);
+ QObject *object = component.create();
+ // Will print "Hello world!"
+ qDebug() << object->property("text2");
+ // Will be emitted whenever the button is clicked
+ QObject::connect(object, SIGNAL(clicked2()), this, SLOT(...));
+ \endcode
+\raw HTML
+ </td>
+ <td>
+\endraw
+ \code
+ <Button text="Hello!">
+ <properties>
+ <Property name="text2" type="string" />
+ </properties>
+ <signals>
+ <Signal name="clicked2" />
+ </signals>
+ <text2>Hello world!</text2>
+ <onClicked>clicked2.emit()</onClicked>
+ </Button>
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ Any number of properties and signals can be added to an existing type. The
+ \c Property and \c Signal elements have the following properties that can
+ be set:
+ \table
+ \header \o Tag \o Property \o Description
+ \row \o Property \o name \o The name of the property
+ \row \o Property \o type \o The type of the property. The available types are: \list \o int \o bool \o double \o real \o string \o color \o date \o variant \endlist The default is variant.
+ \row \o Property \o value \o The initial value of the property. Setting this is just a shortcut for setting the property normally, as shown in the example above.
+ \row \o Property \o onValueChanged \o A special signal property that is emitted each time the property value changes.
+ \row \o Property \o default \o Set this as the object's default property
+ \row \o Signal \o name \o The name of the signal.
+ \endtable
+
+ If the type itself actually defines a property called \c properties or
+ \c signals, the respective extension will be disabled for that type and
+ the types own properties will be set.
+
+ \section1 Parser Status
+
+ Generally using QML is a breeze - you implement your classes in C++, add
+ the appropriate properties, signals and slots and off you go. The QML
+ engine takes care of instantiating your classes and setting the properties
+ and everything works fine.
+
+ However, sometimes it is helpful to know a little more about the status of
+ the QML parser. For example, it might be beneficial from a performance
+ standpoint to delay initializing some data structures until all the
+ properties have been set.
+
+ To assist with this, the QML engine defines an interface class called
+ QmlParserStatus. The interface defines a number of virtual methods that are
+ invoked at various stages of the component instantiation. To receive
+ these notifications, all a class has to do is to inherit the interface, and
+ notify the Qt meta system using the Q_INTERFACES() macro. For example,
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ class Example : public QObject, public QmlParserStatus
+ {
+ Q_OBJECT
+ Q_INTERFACES(QmlParserStatus)
+ public:
+ virtual void componentComplete()
+ {
+ qDebug() << "Woohoo! Now to do my costly initialization";
+ }
+ };
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ \section1 Extended Type Definitions
+
+ QML requires that types have the appropriate properties and signals to
+ work well within the declarative environment. In the case of existing
+ types, it is sometimes necessary to add signals, properties or slots to a
+ target class to make it more QML friendly but the original type cannot be
+ modified. For these cases, the QML engine supports extended type
+ definitions.
+
+ An extended type definition allows the programmer to supply an additional
+ type - known as the extension type - when registering the target class
+ whose properties, signals and slots are transparently merged with the
+ original target class when used from within QML.
+
+ An extension class is a regular QObject, with a constructor that takes a
+ QObject pointer. When needed (extension classes are delay created
+ until the first extension attribute is accessed) the extension
+ class is created and the target object is passed in as the parent. When
+ an extension attribute on the original is accessed, the appropriate signal,
+ property or slots on the extension object is used instead.
+
+ When an extended type is installed, the
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ #define QML_DEFINE_EXTENDED_TYPE(T,QmlName,ExtendedTypeName)
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+ macro should be used instead of the regular \c QML_DEFINE_TYPE.
+
+ This example shows the addition of a read-only \c textLength property to
+ QLabel being implemented as an extension.
+
+\raw HTML
+ <table border="0">
+ <tr>
+ <td>
+\endraw
+ \code
+ class QLabelExtension : public QObject
+ {
+ Q_OBJECT
+ Q_PROPERTY(int textLength READ textLength)
+ public:
+ QWidgetExtension(QObject *parent) : QObject(parent) {}
+ int textLength() const {
+ return static_cast<QLabel *>(parent())->text().count();
+ }
+ };
+ QML_DEFINE_EXTENDED_TYPE(QLabel,QLabel,QLabelExtension);
+ \endcode
+\raw HTML
+ </td>
+ <td>
+\endraw
+ \code
+ <QLabel id="Label1" text="Hello World!" />
+ <QLabel text="{'Label1 text length:' + Label1.textLength}" />
+ \endcode
+\raw HTML
+ </td>
+ </tr>
+ </table>
+\endraw
+
+ Attributes defined through extensions are inherited, just like attributes
+ defined on a normal class. Any types that inherit from \c QLabel, will
+ also have the \c textLength property. Derived types can include additional
+ extensions which are merged together, but only a single extension can be
+ specified for each single C++ class.
+
+ Extended type definitions can even be used to add an attached properties
+ function to a type - just declare the \c qmlAttachedProperties function on
+ the extension object.
+
+*/
+
diff --git a/doc/src/declarative/qtprogrammers.qdoc b/doc/src/declarative/qtprogrammers.qdoc
new file mode 100644
index 0000000..92caa3f
--- /dev/null
+++ b/doc/src/declarative/qtprogrammers.qdoc
@@ -0,0 +1,121 @@
+/*!
+\page qtprogrammers.html
+\target qtprogrammers
+\title QML for Qt programmers
+
+\section1 Overview
+
+While QML does not require Qt knowledge to use, if you \e are already familar with Qt,
+much of your knowledge is directly relevant to learning and using QML. Of course,
+an application with a UI defined in QML also uses Qt for all the non-UI logic.
+
+\section1 Familiar Concepts
+
+QML provides direct access to the following concepts from Qt:
+
+\list
+ \o QAction - the \l {basicxmlaction}{action} type
+ \o QObject signals and slots - available as functions to call in JavaScript
+ \o QObject properties - available as variables in JavaScript
+ \o QWidget - QFxView is a QML-displaying widget
+ \o Qt models - used directly in data binding (currently only next generation QListModelInterface)
+\endlist
+
+Qt knowledge is \e required for \l {cppitem}{writing elements in C++}.
+
+
+\section1 QML Items compared with QWidgets
+
+QML Items are very similar to QWidgets: they define the look and feel of the user interface. (Note that while QWidgets
+haven't traditionally been used to define the look and feel of view delegates, QML Items can be used for this as well.)
+
+There are three structurally different types of QWidget:
+
+\list
+ \o Simple widgets that are not used as parents (QLabel, QCheckBox, QToolButton, etc.)
+ \o Parent widgets that are normally used as parents to other widgets (QGroupBox, QStackedWidget, QTabWidget, etc.)
+ \o Compound widgets that are internally composed of child widgets (QComboBox, QSpinBox, QFileDialog, QTabWidget, etc.)
+\endlist
+
+QML Items also serve these purposes. Each is considered separately below.
+
+\section2 Simple Widgets
+
+The most important rule to remember while implementing a new QFxItem in C++
+is that it should not contain any look and feel policies - leave that to the
+QML usage of the item.
+
+As an example, imagine you wanted a reusable Button item. If you therefore
+decided to write a QFxItem subclass to implement a button,
+just as QToolButton subclasses QWidget for this purpose, following the rule above, your
+"QFxButton" would not have any appearance - just the notions of enabled, triggering, etc.
+
+But there is already an object in Qt that does this: QAction.
+
+QAction is the UI-agnostic essence of QPushButton, QCheckBox, QMenu items, QToolButton,
+and other visual widgets that are commonly bound to a QAction.
+
+So, the job of implementing a checkbox abstraction for QML is already done - it's QAction.
+The look and feel of an action - the appearance of the button, the transition between states,
+and exactly how it respond to mouse, key, or touch input, should all be left for definition
+in QML.
+
+It is illustrative to note that QFxTextEdit is built upon QTextControl,
+QFxWebView is built upon QWebPage, and ListView uses QListModelInterface,
+just as QTextEdit, QWebView, and QListView are built upon
+those same UI-agnostic components.
+
+The encapsulation of the look and feel that QWidgets gives is important, and for this
+the QML concept of \l components serves the same purpose. If you are building a complete
+suite of applications which should have a consistent look and feel, you should build
+a set of reusable components with the look and feel you desire.
+
+So, to implement your reusable button, you would simply build a QML component.
+
+
+\section2 Parent Widgets
+
+Parent widgets each provide a generic way to interface to one or more arbitrary other widgets.
+A QTabWidget provides an interface to multiple "pages", one of which is visible at any time,
+and a mechnism for selecting among them (the QTabBar). A QScollArea provides scrollbars around
+a widget that is otherwise too large to fit in available space.
+
+Nearly all such components can be created directly in QML. Only a few cases
+which require very particular event handling, such as Flickable, require C++ implementations.
+
+As an example, imagine you decided to make a generic tab widget item to be used
+through your application suite wherever information is in such quantity that it
+needs to be divided up into pages.
+
+To do this in QML, ... \todo example of container definition.
+
+A significant difference in the parenting concept with QML compare to QWidgets
+is that while child items are positioned relative to their parents,
+there is no requirement that they be wholy contained ("clipped") to
+the parent (although the clipped property of the child Item does allow
+this where it is needed).
+This difference has rather far-reaching consequences, for example:
+
+\list
+ \o A shadow or highlight around a widget could be a child of that widget.
+ \o Particle effects can flow outside the object where they originate.
+ \o Transitioning animations can "hide" items by visibly moving them beyond the screen bounds.
+\endlist
+
+
+\section2 Compound Widgets
+
+Some widgets provide functionality by composing other widgets as an "implementation detail",
+providing a higher level API to the composition. QSpinBox for example is a line edit and some
+buttons to increase/decrease the edited value. QFileDialog uses a whole host of widgets to
+give the user a way of finding and selecting a file name.
+
+When developing reusable QML Items, you may choose to do the same: build an item composed
+of other items you have already defined.
+
+The only caveat when doing this is to consider the possible animations and transitions that
+users of the compound item might wish to employ. For example, a spinbox might need to smoothly
+transition from an arbitrary Text item, or characters within a Text item, so your spinbox
+item would need to be sufficiently flexible to allow such animation.
+
+*/
diff --git a/doc/src/declarative/scenegraph.qdoc b/doc/src/declarative/scenegraph.qdoc
new file mode 100644
index 0000000..2340324
--- /dev/null
+++ b/doc/src/declarative/scenegraph.qdoc
@@ -0,0 +1,13 @@
+/*!
+ \page graphicsview.html
+ \target graphicsview
+ \title GraphicsView
+
+*/
+
+/*!
+ \page fxprimitives.html
+ \target fxprimitives
+ \title FX Primitives
+
+*/
diff --git a/doc/src/declarative/tutorial.qdoc b/doc/src/declarative/tutorial.qdoc
new file mode 100644
index 0000000..6fe3929
--- /dev/null
+++ b/doc/src/declarative/tutorial.qdoc
@@ -0,0 +1,19 @@
+/*!
+\page tutorial.html
+\title Tutorial
+
+This tutorial gives an introduction to QML and the Fluid UI atoms. It doesn't cover everything; the emphasis is on teaching the key principles, and features are introduced as needed.
+
+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 $QTDIR/examples/declarative/tutorials directory.
+
+Tutorial chapters:
+
+\list
+\o \l {tutorial1}{Tutorial 1}
+\o \l {tutorial2}{Tutorial 2}
+\o \l {tutorial3}{Tutorial 3}
+\endlist
+
+*/
diff --git a/doc/src/declarative/tutorial1.qdoc b/doc/src/declarative/tutorial1.qdoc
new file mode 100644
index 0000000..15edaff
--- /dev/null
+++ b/doc/src/declarative/tutorial1.qdoc
@@ -0,0 +1,55 @@
+/*!
+\page tutorial1.html
+\title Tutorial 1 - Hello World!
+\target tutorial1
+
+This first program is a simple "Hello world" example. The picture below is a screenshot of this program.
+
+\image declarative-tutorial1.png
+
+Here is the QML code for the application:
+
+\code
+<Rect id="Page" width="480" height="200" color="white">
+ <Text id="HelloText" text="Hello world!" font.size="24" font.bold="true" y="30" anchors.horizontalCenter="{Page.horizontalCenter}"/>
+</Rect>
+\endcode
+
+\section1 Walkthrough
+
+\section2 Rect element
+
+\code
+<Rect id="Page" width="480" height="200" color="white">
+\endcode
+
+First, we declare a root element of type \l {xmlRect}{Rect}. It is one of the basic building blocks you can use to create an application in QML.
+We give it an id to be able to refer to it later. In this case, we call it \e Page. We also set the \c width, \c height and \c color properties.
+The \l {xmlRect}{Rect} element contains many other properties (such as \c x and \c y), but these are left at their default values.
+
+\section2 Text element
+
+\code
+<Text id="HelloText" text="Hello world!" y="30" font.size="24" font.bold="true" anchors.horizontalCenter="{Page.horizontalCenter}"/>
+\endcode
+
+We add a text element as a child of our root element to display the text 'Hello world!'.
+
+The \c y property is used to position the text vertically at 30 pixels from the top of its parent.
+
+The \c font.size and \c font.bold properties are related to fonts and use the 'dot' notation (see \l {declarative}{Declarative UI} ).
+
+The \c anchors.horizontalCenter property refers to the horizontal center of an element. In this case, we bind the center of our text element to the center of the \e Page element. We use braces to indicate that \c Page.horizontalCenter is a bound ECMAScript expression that needs to be evaluated. It also means that if the center of \e Page changes (for example if it is resized) our text will be re-centered automatically (see \l binding).
+
+\section2 Viewing the example
+
+To view what you have created, run the duiviewer (located in the \c bin directory) with your filename as the first argument. For example, to run the provided completed Tutorial 1 example from the install location, you would type:
+
+\code
+bin/duiviewer examples/tutorials/t1/tutorial1.qml
+\endcode
+
+[\l tutorial] [Next: \l tutorial2]
+
+*/
+
diff --git a/doc/src/declarative/tutorial2.qdoc b/doc/src/declarative/tutorial2.qdoc
new file mode 100644
index 0000000..8898e68
--- /dev/null
+++ b/doc/src/declarative/tutorial2.qdoc
@@ -0,0 +1,94 @@
+/*!
+\page tutorial2.html
+\title Tutorial 2 - Some colors
+\target tutorial2
+
+This chapter adds a color picker to change the color of the text.
+
+\image declarative-tutorial2.png
+
+Our color picker is made of many cells with different colors. To avoid writing the same code many times, we first create a new \c Cell component with a color property (see \l components).
+
+Here is the QML code for \c Cell.qml:
+
+\code
+<Item id="CellContainer" width="40" height="25">
+ <properties>
+ <Property name="color"/>
+ </properties>
+ <Rect anchors.fill="{parent}" color="{CellContainer.color}"/>
+ <MouseRegion anchors.fill="{parent}" onClick="HelloText.color = CellContainer.color" />
+</Item>
+\endcode
+
+Then, we use our \c Cell component to create the color picker in the QML code for the application:
+
+\code
+<Rect id="Page" width="480" height="200" color="white">
+ <Text id="HelloText" text="Hello world!" font.size="24" font.bold="true" y="30" anchors.horizontalCenter="{Page.horizontalCenter}"/>
+ <GridLayout id="ColorPicker" x="0" anchors.bottom="{Page.bottom}" width="120" height="50" columns="3" rows="2">
+ <Cell color="#ff0000"/>
+ <Cell color="#00ff00"/>
+ <Cell color="#0000ff"/>
+ <Cell color="#ffff00"/>
+ <Cell color="#00ffff"/>
+ <Cell color="#ff00ff"/>
+ </GridLayout>
+</Rect>
+\endcode
+
+\section1 Walkthrough
+
+\section2 The Cell Component
+
+\code
+<Item id="CellContainer" width="40" height="25">
+\endcode
+
+The root element of our component is an \c Item. It is the most basic 'Fx' element in Qml and is often used as a container for other elements.
+
+\code
+<properties>
+ <Property name="color"/>
+</properties>
+\endcode
+
+We declare a \c color property. This property is accessible from \i outside our component, this allows us to instantiate the cells with different colors.
+
+\code
+<Rect anchors.fill="{parent}" color="{CellContainer.color}"/>
+\endcode
+
+Our cell component is basically a colored rectangle.
+
+The \c anchors.fill property is a convenient way to set the size of an element. In this case the \c Rect will have the same size as its parent.
+
+We bind the \c color property of this \c Rect to the color property of our component.
+
+\code
+<MouseRegion anchors.fill="{parent}" onClick="HelloText.color = CellContainer.color" />
+\endcode
+
+In order to change the color of the text when clicking on a cell, we create a \c MouseRegion element with the same size as its parent.
+
+The \c onClick property sets the \c color property of the element named \i HelloText to our cell color.
+
+\section2 The main QML file
+
+\code
+<GridLayout id="ColorPicker" x="0" anchors.bottom="{Page.bottom}" width="120" height="50" columns="3" rows="2">
+ <Cell color="#ff0000"/>
+ <Cell color="#00ff00"/>
+ <Cell color="#0000ff"/>
+ <Cell color="#ffff00"/>
+ <Cell color="#00ffff"/>
+ <Cell color="#ff00ff"/>
+</GridLayout>
+\endcode
+
+In the main QML file, the only thing we have to do is to create a color picker by putting 6 cells with different colors in a grid layout.
+
+[Previous: \l tutorial1] [Next: \l tutorial3]
+
+*/
+
diff --git a/doc/src/declarative/tutorial3.qdoc b/doc/src/declarative/tutorial3.qdoc
new file mode 100644
index 0000000..91ab9f0
--- /dev/null
+++ b/doc/src/declarative/tutorial3.qdoc
@@ -0,0 +1,83 @@
+/*!
+\page tutorial3.html
+\title Tutorial 3 - States
+\target tutorial3
+
+In this chapter, we make this example a little bit more dynamic by introducing states.
+
+We want our text to jump at the bottom of the screen and become red when clicked.
+
+\image declarative-tutorial3_animation.gif
+
+Here is the QML code:
+
+\code
+<Rect id="Page" width="480" height="200" color="white">
+ <Text id="HelloText" text="Hello world!" font.size="24" font.bold="true" y="30" anchors.horizontalCenter="{Page.horizontalCenter}">
+ <states>
+ <State name="down" when="{MouseRegion.pressed == true}">
+ <SetProperty target="{HelloText}" property="y" value="160"/>
+ <SetProperty target="{HelloText}" property="color" value="red"/>
+ </State>
+ </states>
+ <transitions>
+ <Transition fromState="*" toState="down" reversible="true">
+ <ParallelAnimation>
+ <NumericAnimation properties="y" duration="500" easing="easeOutBounce"/>
+ <ColorAnimation duration="500"/>
+ </ParallelAnimation>
+ </Transition>
+ </transitions>
+ </Text>
+ <MouseRegion id="MouseRegion" anchors.fill="{HelloText}"/>
+ <GridLayout id="ColorPicker" x="0" anchors.bottom="{Page.bottom}" width="120" height="50" columns="3" rows="2">
+ <Cell color="#ff0000"/>
+ <Cell color="#00ff00"/>
+ <Cell color="#0000ff"/>
+ <Cell color="#ffff00"/>
+ <Cell color="#00ffff"/>
+ <Cell color="#ff00ff"/>
+ </GridLayout>
+</Rect>
+\endcode
+
+\section1 Walkthrough
+
+\code
+<states>
+ <State name="down" when="{MouseRegion.pressed == true}">
+ <SetProperty target="{HelloText}" property="y" value="160"/>
+ <SetProperty target="{HelloText}" property="color" value="red"/>
+ </State>
+</states>
+\endcode
+
+First, we create a new state \e down for our text element. This state will be activated when \l {xmlMouseRegion}{MouseRegion} is pressed, and deactivated when it is released.
+
+The \e down state includes a set of property changes from our implicit \e {default state} (the items as they were initially defined in the QML). Specifically, we set the \c y property of the text to 160 and the \c color to red.
+
+\code
+<Transition fromState="*" toState="down" reversible="true">
+\endcode
+
+Because we don't want the text to appear at the bottom instantly but rather move smoothly, we add a transition between our two states.
+
+\c fromState and \c toState define the states between which the transition will run. In this case, we want a transition from any state to our \e down state.
+
+Because we want the same transition to be run in reverse when changing back from the \e down state to the default state, we set \c reversible to \c true. This is equivalent to writing the two transitions separately.
+
+\code
+<ParallelAnimation>
+ <NumericAnimation properties="y" duration="500" easing="easeOutBounce"/>
+ <ColorAnimation duration="500"/>
+</ParallelAnimation>
+\endcode
+
+The \c ParallelAnimation element makes sure that the two animations (color and position) will start at the same time. We could also run them one after the other by using \c SequentialAnimation instead.
+
+For more details on states and transitions, see \l {states-transitions}{States and Transitions}.
+
+[Previous: \l tutorial2] [\l tutorial]
+
+*/
+
diff --git a/doc/src/diagrams/programs/easingcurve/easingcurve.pro b/doc/src/diagrams/programs/easingcurve/easingcurve.pro
new file mode 100644
index 0000000..0b80127
--- /dev/null
+++ b/doc/src/diagrams/programs/easingcurve/easingcurve.pro
@@ -0,0 +1,13 @@
+######################################################################
+# Automatically generated by qmake (2.01a) fr 13. feb 13:26:38 2009
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+SOURCES += main.cpp
+
+CONFIG += console \ No newline at end of file
diff --git a/doc/src/diagrams/programs/easingcurve/main.cpp b/doc/src/diagrams/programs/easingcurve/main.cpp
new file mode 100644
index 0000000..98e9d37
--- /dev/null
+++ b/doc/src/diagrams/programs/easingcurve/main.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+void createCurveIcons();
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ createCurveIcons();
+ return app.exit();
+}
+
+void createCurveIcons()
+{
+ QDir dir(QDir::current());
+ if (dir.dirName() == QLatin1String("debug") || dir.dirName() == QLatin1String("release")) {
+ dir.cdUp();
+ }
+ dir.cdUp();
+ dir.cdUp();
+ dir.cdUp();
+ QSize iconSize(128, 128);
+ QPixmap pix(iconSize);
+ QPainter painter(&pix);
+ QLinearGradient gradient(0,0, 0, iconSize.height());
+ gradient.setColorAt(0.0, QColor(240, 240, 240));
+ gradient.setColorAt(1.0, QColor(224, 224, 224));
+ QBrush brush(gradient);
+ const QMetaObject &mo = QEasingCurve::staticMetaObject;
+ QMetaEnum metaEnum = mo.enumerator(mo.indexOfEnumerator("Type"));
+ QFont oldFont = painter.font();
+ // Skip QEasingCurve::Custom
+ QString output(QString::fromAscii("%1/images").arg(dir.absolutePath()));
+ printf("Generating images to %s\n", qPrintable(output));
+ for (int i = 0; i < QEasingCurve::NCurveTypes - 1; ++i) {
+ painter.setFont(oldFont);
+ QString name(QLatin1String(metaEnum.key(i)));
+ painter.fillRect(QRect(QPoint(0, 0), iconSize), brush);
+ QEasingCurve curve((QEasingCurve::Type)i);
+ painter.setPen(QColor(0, 0, 255, 64));
+ qreal xAxis = iconSize.height()/1.5;
+ qreal yAxis = iconSize.width()/3;
+ painter.drawLine(0, xAxis, iconSize.width(), xAxis); // hor
+ painter.drawLine(yAxis, 0, yAxis, iconSize.height()); // ver
+
+ qreal curveScale = iconSize.height()/2;
+
+ painter.drawLine(yAxis - 2, xAxis - curveScale, yAxis + 2, xAxis - curveScale); // hor
+ painter.drawLine(yAxis + curveScale, xAxis + 2, yAxis + curveScale, xAxis - 2); // ver
+ painter.drawText(yAxis + curveScale - 8, xAxis - curveScale - 4, QLatin1String("(1,1)"));
+
+ painter.drawText(yAxis + 42, xAxis + 10, QLatin1String("progress"));
+ painter.drawText(15, xAxis - curveScale - 10, QLatin1String("ease"));
+
+ painter.setPen(QPen(Qt::red, 1, Qt::DotLine));
+ painter.drawLine(yAxis, xAxis - curveScale, yAxis + curveScale, xAxis - curveScale); // hor
+ painter.drawLine(yAxis + curveScale, xAxis, yAxis + curveScale, xAxis - curveScale); // ver
+
+ QPoint currentPos(yAxis, xAxis);
+
+ painter.setPen(Qt::black);
+ QFont font = oldFont;
+ font.setPixelSize(oldFont.pixelSize() + 15);
+ painter.setFont(font);
+ painter.drawText(0, iconSize.height() - 20, iconSize.width(), 20, Qt::AlignHCenter, name);
+
+ for (qreal t = 0; t < 1.0; t+=1.0/curveScale) {
+ QPoint to;
+ to.setX(yAxis + curveScale * t);
+ to.setY(xAxis - curveScale * curve.valueForProgress(t));
+ painter.drawLine(currentPos, to);
+ currentPos = to;
+ }
+ QString fileName(QString::fromAscii("qeasingcurve-%1.png").arg(name.toLower()));
+ printf("%s\n", qPrintable(fileName));
+ pix.save(QString::fromAscii("%1/%2").arg(output).arg(fileName), "PNG");
+ }
+}
+
+
diff --git a/doc/src/duiviewer.qdoc b/doc/src/duiviewer.qdoc
new file mode 100644
index 0000000..f967f87
--- /dev/null
+++ b/doc/src/duiviewer.qdoc
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page duiviewer.html
+ \title Declarative UI Viewer (duiviewer)
+ \ingroup qttools
+ \keyword duiviewer
+
+ This page documents the \e{Declarative UI Viewer} for the Qt GUI
+ toolkit. The \c duiviewer reads an XML format declarative user interface definition
+ (\c .qml) file
+ and displays the user interface it describes.
+
+ \section1 Options
+
+ When run with the \c -help option, duiviewer shows available options.
+
+ \section1 Dummy Data
+
+ One use of duiviewer is to allow QML files to be viewed stand-alone,
+ rather than being loaded from within a Qt program. Qt applications will
+ usually bind objects and properties into the execution context before
+ running the QML. To stand-in for such bindings, you can provide dummy
+ data: create a directory called "dummydata" in the same directory as
+ the target QML file and create files there with the "qml" extension.
+ All such files will be loaded as QML objects and bound to the root
+ context as a property with the name of the file (without ".qml").
+
+ For example, if the Qt application has a "clock.time" property
+ that is a qreal from 0 to 86400 representing the number of seconds since
+ midnight, dummy data for this could be provided by \c dummydata/clock.qml:
+ \code
+ <Object>
+ <properties>
+ <Property name="time" value="12345"/>
+ </properties>
+ </Object>
+ \endcode
+ Any QML can be used in the dummy data files. You could even animate the
+ fictional data!
+*/
diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc
index e3c2291..b750aa0 100644
--- a/doc/src/examples.qdoc
+++ b/doc/src/examples.qdoc
@@ -307,6 +307,12 @@
\o \l{sql/sqlwidgetmapper}{SQL Widget Mapper}\raisedaster
\endlist
+ \section1 State Machine
+
+ \list
+ \o \l{statemachine/trafficlight}{Traffic Light}\raisedaster
+ \endlist
+
\section1 Threads
\list
diff --git a/doc/src/examples/trafficlight.qdoc b/doc/src/examples/trafficlight.qdoc
new file mode 100644
index 0000000..16ee8ad
--- /dev/null
+++ b/doc/src/examples/trafficlight.qdoc
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example statemachine/trafficlight
+ \title Traffic Light Example
+
+ The Traffic Light example shows how to use \l{The State Machine Framework}
+ to implement the control flow of a traffic light.
+
+ \image trafficlight-example.png
+
+ In this example we write a TrafficLightWidget class. The traffic light has
+ three lights: Red, yellow and green. The traffic light transitions from
+ one light to another (red to yellow to green to yellow to red again) at
+ certain intervals.
+
+ \snippet examples/statemachine/trafficlight/main.cpp 0
+
+ The LightWidget class represents a single light of the traffic light. It
+ provides a setOn() function to turn the light on or off. It paints itself
+ in the color that's passed to the constructor.
+
+ \snippet examples/statemachine/trafficlight/main.cpp 2
+
+ The TrafficLightWidget class represents the visual part of the traffic
+ light; it's a widget that contains three lights, and provides accessor
+ functions for these.
+
+ \snippet examples/statemachine/trafficlight/main.cpp 1
+
+ The LightState class represents a state that turns a light on when the
+ state is entered, and off when the state is exited. The class is a timer,
+ and as we shall see the timeout is used to transition from one LightState
+ to another.
+
+ \snippet examples/statemachine/trafficlight/main.cpp 3
+
+ The TrafficLight class combines the TrafficLightWidget with control flow
+ based on the LightState class. The state graph has four states:
+ red-to-yellow, yellow-to-green, green-to-yellow and yellow-to-red. The
+ initial state is red-to-yellow; when the state's timer times out, the
+ state machine transitions to yellow-to-green. The same process repeats
+ through the other states.
+
+ \snippet examples/statemachine/trafficlight/main.cpp 4
+
+ The main() function constructs a TrafficLight and shows it.
+
+*/
diff --git a/doc/src/external-resources.qdoc b/doc/src/external-resources.qdoc
index f48c3d7..3bfb5af 100644
--- a/doc/src/external-resources.qdoc
+++ b/doc/src/external-resources.qdoc
@@ -334,6 +334,16 @@
*/
/*!
+ \externalpage http://www.w3.org/TR/scxml/
+ \title State Chart XML: State Machine Notation for Control Abstraction
+*/
+
+/*!
+ \externalpage http://www.wisdom.weizmann.ac.il/~dharel/SCANNED.PAPERS/Statecharts.pdf
+ \title Statecharts: A visual formalism for complex systems
+*/
+
+/*!
\externalpage http://www.gnu.org/licenses/gpl.html
\title GNU General Public License
*/
diff --git a/doc/src/groups.qdoc b/doc/src/groups.qdoc
index c9cedc4..0411c3a 100644
--- a/doc/src/groups.qdoc
+++ b/doc/src/groups.qdoc
@@ -69,6 +69,18 @@
*/
/*!
+ \group animations
+ \ingroup groups
+
+ \title Animation Framework
+ \brief Classes for animations, states and transitions.
+
+ These classes provide a framework for creating both simple and complex
+ animations. The Animation Framework also provides states and animated
+ transitions, making it easy to create animated stateful forms.
+*/
+
+/*!
\group abstractwidgets
\title Abstract Widget Classes
\ingroup groups
@@ -597,3 +609,14 @@
These classes are relevant to developers who are working with Qt Script's
debugging features.
*/
+
+/*!
+ \group statemachine
+ \ingroup groups
+
+ \title State Machine Classes
+ \brief Classes for constructing and executing state graphs.
+
+ These classes are provided by \l{The State Machine Framework} for creating
+ event-driven state machines.
+*/
diff --git a/doc/src/images/declarative-anchors_example.png b/doc/src/images/declarative-anchors_example.png
new file mode 100644
index 0000000..293cd4b
--- /dev/null
+++ b/doc/src/images/declarative-anchors_example.png
Binary files differ
diff --git a/doc/src/images/declarative-anchors_example2.png b/doc/src/images/declarative-anchors_example2.png
new file mode 100644
index 0000000..6d3be7d
--- /dev/null
+++ b/doc/src/images/declarative-anchors_example2.png
Binary files differ
diff --git a/doc/src/images/declarative-image_tile.png b/doc/src/images/declarative-image_tile.png
new file mode 100644
index 0000000..b946a6d
--- /dev/null
+++ b/doc/src/images/declarative-image_tile.png
Binary files differ
diff --git a/doc/src/images/declarative-item_opacity1.png b/doc/src/images/declarative-item_opacity1.png
new file mode 100644
index 0000000..cde973b
--- /dev/null
+++ b/doc/src/images/declarative-item_opacity1.png
Binary files differ
diff --git a/doc/src/images/declarative-item_opacity2.png b/doc/src/images/declarative-item_opacity2.png
new file mode 100644
index 0000000..8627360
--- /dev/null
+++ b/doc/src/images/declarative-item_opacity2.png
Binary files differ
diff --git a/doc/src/images/declarative-item_stacking1.png b/doc/src/images/declarative-item_stacking1.png
new file mode 100644
index 0000000..18f4148
--- /dev/null
+++ b/doc/src/images/declarative-item_stacking1.png
Binary files differ
diff --git a/doc/src/images/declarative-item_stacking2.png b/doc/src/images/declarative-item_stacking2.png
new file mode 100644
index 0000000..7a71bcd
--- /dev/null
+++ b/doc/src/images/declarative-item_stacking2.png
Binary files differ
diff --git a/doc/src/images/declarative-item_stacking3.png b/doc/src/images/declarative-item_stacking3.png
new file mode 100644
index 0000000..cde973b
--- /dev/null
+++ b/doc/src/images/declarative-item_stacking3.png
Binary files differ
diff --git a/doc/src/images/declarative-item_stacking4.png b/doc/src/images/declarative-item_stacking4.png
new file mode 100644
index 0000000..3fdf627
--- /dev/null
+++ b/doc/src/images/declarative-item_stacking4.png
Binary files differ
diff --git a/doc/src/images/declarative-qtlogo1.png b/doc/src/images/declarative-qtlogo1.png
new file mode 100644
index 0000000..940d159
--- /dev/null
+++ b/doc/src/images/declarative-qtlogo1.png
Binary files differ
diff --git a/doc/src/images/declarative-qtlogo2.png b/doc/src/images/declarative-qtlogo2.png
new file mode 100644
index 0000000..b1d128a
--- /dev/null
+++ b/doc/src/images/declarative-qtlogo2.png
Binary files differ
diff --git a/doc/src/images/declarative-qtlogo3.png b/doc/src/images/declarative-qtlogo3.png
new file mode 100644
index 0000000..3f2f93f
--- /dev/null
+++ b/doc/src/images/declarative-qtlogo3.png
Binary files differ
diff --git a/doc/src/images/declarative-qtlogo4.png b/doc/src/images/declarative-qtlogo4.png
new file mode 100644
index 0000000..7c8aa64
--- /dev/null
+++ b/doc/src/images/declarative-qtlogo4.png
Binary files differ
diff --git a/doc/src/images/declarative-rect.png b/doc/src/images/declarative-rect.png
new file mode 100644
index 0000000..173759a
--- /dev/null
+++ b/doc/src/images/declarative-rect.png
Binary files differ
diff --git a/doc/src/images/declarative-rect_gradient.png b/doc/src/images/declarative-rect_gradient.png
new file mode 100644
index 0000000..f79d579
--- /dev/null
+++ b/doc/src/images/declarative-rect_gradient.png
Binary files differ
diff --git a/doc/src/images/declarative-rect_tint.png b/doc/src/images/declarative-rect_tint.png
new file mode 100644
index 0000000..3a44013
--- /dev/null
+++ b/doc/src/images/declarative-rect_tint.png
Binary files differ
diff --git a/doc/src/images/declarative-rotation.png b/doc/src/images/declarative-rotation.png
new file mode 100644
index 0000000..994011b
--- /dev/null
+++ b/doc/src/images/declarative-rotation.png
Binary files differ
diff --git a/doc/src/images/declarative-scale.png b/doc/src/images/declarative-scale.png
new file mode 100644
index 0000000..bab729e
--- /dev/null
+++ b/doc/src/images/declarative-scale.png
Binary files differ
diff --git a/doc/src/images/declarative-scalegrid.png b/doc/src/images/declarative-scalegrid.png
new file mode 100644
index 0000000..32d87125
--- /dev/null
+++ b/doc/src/images/declarative-scalegrid.png
Binary files differ
diff --git a/doc/src/images/declarative-text.png b/doc/src/images/declarative-text.png
new file mode 100644
index 0000000..c1a4112
--- /dev/null
+++ b/doc/src/images/declarative-text.png
Binary files differ
diff --git a/doc/src/images/declarative-textedit.gif b/doc/src/images/declarative-textedit.gif
new file mode 100644
index 0000000..7186eb9
--- /dev/null
+++ b/doc/src/images/declarative-textedit.gif
Binary files differ
diff --git a/doc/src/images/declarative-textformat.png b/doc/src/images/declarative-textformat.png
new file mode 100644
index 0000000..ade1b45
--- /dev/null
+++ b/doc/src/images/declarative-textformat.png
Binary files differ
diff --git a/doc/src/images/declarative-textstyle.png b/doc/src/images/declarative-textstyle.png
new file mode 100644
index 0000000..858c1bc
--- /dev/null
+++ b/doc/src/images/declarative-textstyle.png
Binary files differ
diff --git a/doc/src/images/declarative-transformorigin.png b/doc/src/images/declarative-transformorigin.png
new file mode 100644
index 0000000..fbb3b9b
--- /dev/null
+++ b/doc/src/images/declarative-transformorigin.png
Binary files differ
diff --git a/doc/src/images/declarative-tutorial1.png b/doc/src/images/declarative-tutorial1.png
new file mode 100644
index 0000000..a936054
--- /dev/null
+++ b/doc/src/images/declarative-tutorial1.png
Binary files differ
diff --git a/doc/src/images/declarative-tutorial2.png b/doc/src/images/declarative-tutorial2.png
new file mode 100644
index 0000000..7871589
--- /dev/null
+++ b/doc/src/images/declarative-tutorial2.png
Binary files differ
diff --git a/doc/src/images/declarative-tutorial3_animation.gif b/doc/src/images/declarative-tutorial3_animation.gif
new file mode 100644
index 0000000..0465e61
--- /dev/null
+++ b/doc/src/images/declarative-tutorial3_animation.gif
Binary files differ
diff --git a/doc/src/images/qeasingcurve-cosinecurve.png b/doc/src/images/qeasingcurve-cosinecurve.png
new file mode 100644
index 0000000..b27e763
--- /dev/null
+++ b/doc/src/images/qeasingcurve-cosinecurve.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inback.png b/doc/src/images/qeasingcurve-inback.png
new file mode 100644
index 0000000..8506c0f
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inback.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inbounce.png b/doc/src/images/qeasingcurve-inbounce.png
new file mode 100644
index 0000000..275b38c
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inbounce.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-incirc.png b/doc/src/images/qeasingcurve-incirc.png
new file mode 100644
index 0000000..b985e9c
--- /dev/null
+++ b/doc/src/images/qeasingcurve-incirc.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-incubic.png b/doc/src/images/qeasingcurve-incubic.png
new file mode 100644
index 0000000..e417ee1
--- /dev/null
+++ b/doc/src/images/qeasingcurve-incubic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-incurve.png b/doc/src/images/qeasingcurve-incurve.png
new file mode 100644
index 0000000..d9a9340
--- /dev/null
+++ b/doc/src/images/qeasingcurve-incurve.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inelastic.png b/doc/src/images/qeasingcurve-inelastic.png
new file mode 100644
index 0000000..b242fd3
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inelastic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inexpo.png b/doc/src/images/qeasingcurve-inexpo.png
new file mode 100644
index 0000000..f06316c
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inexpo.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutback.png b/doc/src/images/qeasingcurve-inoutback.png
new file mode 100644
index 0000000..9fd1446
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inoutback.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutbounce.png b/doc/src/images/qeasingcurve-inoutbounce.png
new file mode 100644
index 0000000..fb65f31
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inoutbounce.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutcirc.png b/doc/src/images/qeasingcurve-inoutcirc.png
new file mode 100644
index 0000000..123cc54
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inoutcirc.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutcubic.png b/doc/src/images/qeasingcurve-inoutcubic.png
new file mode 100644
index 0000000..b07695c
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inoutcubic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutelastic.png b/doc/src/images/qeasingcurve-inoutelastic.png
new file mode 100644
index 0000000..65851e1
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inoutelastic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutexpo.png b/doc/src/images/qeasingcurve-inoutexpo.png
new file mode 100644
index 0000000..7cbfb13
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inoutexpo.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutquad.png b/doc/src/images/qeasingcurve-inoutquad.png
new file mode 100644
index 0000000..c5eed06
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inoutquad.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutquart.png b/doc/src/images/qeasingcurve-inoutquart.png
new file mode 100644
index 0000000..3b66c0d
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inoutquart.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutquint.png b/doc/src/images/qeasingcurve-inoutquint.png
new file mode 100644
index 0000000..c74efe9
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inoutquint.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inoutsine.png b/doc/src/images/qeasingcurve-inoutsine.png
new file mode 100644
index 0000000..5964f31
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inoutsine.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inquad.png b/doc/src/images/qeasingcurve-inquad.png
new file mode 100644
index 0000000..3373310
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inquad.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inquart.png b/doc/src/images/qeasingcurve-inquart.png
new file mode 100644
index 0000000..28086d8
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inquart.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-inquint.png b/doc/src/images/qeasingcurve-inquint.png
new file mode 100644
index 0000000..330aa85
--- /dev/null
+++ b/doc/src/images/qeasingcurve-inquint.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-insine.png b/doc/src/images/qeasingcurve-insine.png
new file mode 100644
index 0000000..63d9238
--- /dev/null
+++ b/doc/src/images/qeasingcurve-insine.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-linear.png b/doc/src/images/qeasingcurve-linear.png
new file mode 100644
index 0000000..2a05885
--- /dev/null
+++ b/doc/src/images/qeasingcurve-linear.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outback.png b/doc/src/images/qeasingcurve-outback.png
new file mode 100644
index 0000000..7cb34c6
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outback.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outbounce.png b/doc/src/images/qeasingcurve-outbounce.png
new file mode 100644
index 0000000..932fc16
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outbounce.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outcirc.png b/doc/src/images/qeasingcurve-outcirc.png
new file mode 100644
index 0000000..a1a6cb6
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outcirc.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outcubic.png b/doc/src/images/qeasingcurve-outcubic.png
new file mode 100644
index 0000000..aa1d604
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outcubic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outcurve.png b/doc/src/images/qeasingcurve-outcurve.png
new file mode 100644
index 0000000..a949ae4
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outcurve.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outelastic.png b/doc/src/images/qeasingcurve-outelastic.png
new file mode 100644
index 0000000..2a9ba39
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outelastic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outexpo.png b/doc/src/images/qeasingcurve-outexpo.png
new file mode 100644
index 0000000..e771c2e
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outexpo.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinback.png b/doc/src/images/qeasingcurve-outinback.png
new file mode 100644
index 0000000..7523727
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outinback.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinbounce.png b/doc/src/images/qeasingcurve-outinbounce.png
new file mode 100644
index 0000000..ab73d02
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outinbounce.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outincirc.png b/doc/src/images/qeasingcurve-outincirc.png
new file mode 100644
index 0000000..ec4b8d3
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outincirc.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outincubic.png b/doc/src/images/qeasingcurve-outincubic.png
new file mode 100644
index 0000000..8b8ae68
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outincubic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinelastic.png b/doc/src/images/qeasingcurve-outinelastic.png
new file mode 100644
index 0000000..89dde2c
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outinelastic.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinexpo.png b/doc/src/images/qeasingcurve-outinexpo.png
new file mode 100644
index 0000000..5909901
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outinexpo.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinquad.png b/doc/src/images/qeasingcurve-outinquad.png
new file mode 100644
index 0000000..7ddefee
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outinquad.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinquart.png b/doc/src/images/qeasingcurve-outinquart.png
new file mode 100644
index 0000000..00ef597
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outinquart.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinquint.png b/doc/src/images/qeasingcurve-outinquint.png
new file mode 100644
index 0000000..361bfaa4
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outinquint.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outinsine.png b/doc/src/images/qeasingcurve-outinsine.png
new file mode 100644
index 0000000..1737041
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outinsine.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outquad.png b/doc/src/images/qeasingcurve-outquad.png
new file mode 100644
index 0000000..6f27cbd
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outquad.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outquart.png b/doc/src/images/qeasingcurve-outquart.png
new file mode 100644
index 0000000..d45a0b8
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outquart.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outquint.png b/doc/src/images/qeasingcurve-outquint.png
new file mode 100644
index 0000000..6e7df0e
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outquint.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-outsine.png b/doc/src/images/qeasingcurve-outsine.png
new file mode 100644
index 0000000..7546a0d
--- /dev/null
+++ b/doc/src/images/qeasingcurve-outsine.png
Binary files differ
diff --git a/doc/src/images/qeasingcurve-sinecurve.png b/doc/src/images/qeasingcurve-sinecurve.png
new file mode 100644
index 0000000..ca67d44
--- /dev/null
+++ b/doc/src/images/qeasingcurve-sinecurve.png
Binary files differ
diff --git a/doc/src/images/statemachine-button-history.png b/doc/src/images/statemachine-button-history.png
new file mode 100644
index 0000000..cd66478
--- /dev/null
+++ b/doc/src/images/statemachine-button-history.png
Binary files differ
diff --git a/doc/src/images/statemachine-button-nested.png b/doc/src/images/statemachine-button-nested.png
new file mode 100644
index 0000000..60360d1
--- /dev/null
+++ b/doc/src/images/statemachine-button-nested.png
Binary files differ
diff --git a/doc/src/images/statemachine-button.png b/doc/src/images/statemachine-button.png
new file mode 100644
index 0000000..75d9e53
--- /dev/null
+++ b/doc/src/images/statemachine-button.png
Binary files differ
diff --git a/doc/src/images/statemachine-finished.png b/doc/src/images/statemachine-finished.png
new file mode 100644
index 0000000..802621e
--- /dev/null
+++ b/doc/src/images/statemachine-finished.png
Binary files differ
diff --git a/doc/src/images/statemachine-nonparallel.png b/doc/src/images/statemachine-nonparallel.png
new file mode 100644
index 0000000..1fe60d8
--- /dev/null
+++ b/doc/src/images/statemachine-nonparallel.png
Binary files differ
diff --git a/doc/src/images/statemachine-parallel.png b/doc/src/images/statemachine-parallel.png
new file mode 100644
index 0000000..1868792
--- /dev/null
+++ b/doc/src/images/statemachine-parallel.png
Binary files differ
diff --git a/doc/src/images/trafficlight-example.png b/doc/src/images/trafficlight-example.png
new file mode 100644
index 0000000..3431542
--- /dev/null
+++ b/doc/src/images/trafficlight-example.png
Binary files differ
diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc
index 49dfafd..cf75381 100644
--- a/doc/src/index.qdoc
+++ b/doc/src/index.qdoc
@@ -194,6 +194,7 @@
<li><a href="qtxmlpatterns.html">XML Patterns: XQuery &amp; XPath</a></li>
<li><a href="phonon-module.html">Phonon Multimedia Framework</a></li>
<li><a href="qtscripttools.html">Script Tools Module</a></li>
+ <li><a href="qml.html">Qt Markup Language</a></li>
<li><a href="activeqt.html">ActiveQt Framework</a></li>
</ul>
</td>
diff --git a/doc/src/snippets/code/src_corelib_tools_qeasingcurve.cpp b/doc/src/snippets/code/src_corelib_tools_qeasingcurve.cpp
new file mode 100644
index 0000000..65358ea
--- /dev/null
+++ b/doc/src/snippets/code/src_corelib_tools_qeasingcurve.cpp
@@ -0,0 +1,4 @@
+//! [0]
+qreal myEasingFunction(qreal progress);
+//! [0]
+
diff --git a/doc/src/statemachine.qdoc b/doc/src/statemachine.qdoc
new file mode 100644
index 0000000..c79839f
--- /dev/null
+++ b/doc/src/statemachine.qdoc
@@ -0,0 +1,272 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page statemachine-api.html
+ \title The State Machine Framework
+ \brief An overview of the State Machine framework for constructing and executing state graphs.
+
+ \tableofcontents
+
+ The State Machine framework provides classes for creating and executing
+ state graphs. The concepts and notation are based on those from Harel's
+ \l{Statecharts: A visual formalism for complex systems}{Statecharts}, which
+ is also the basis of UML state diagrams. The semantics of state machine
+ execution are based on \l{State Chart XML: State Machine Notation for
+ Control Abstraction}{State Chart XML (SCXML)}.
+
+ Statecharts provide a graphical way of modeling how a system reacts to
+ stimuli. This is done by defining the possible \e states that the system can
+ be in, and how the system can move from one state to another (\e transitions
+ between states). A key characteristic of event-driven systems (such as Qt
+ applications) is that behavior often depends not only on the last or current
+ event, but also the events that preceded it. With statecharts, this
+ information is easy to express.
+
+ The State Machine framework provides an API and execution model that can be
+ used to effectively embed the elements and semantics of statecharts in Qt
+ applications. The framework integrates tightly with Qt's existing event
+ system and meta-object system; for example, transitions between states can
+ be triggered by signals, and states can be configured to set properties and
+ invoke methods on QObjects.
+
+ \section1 A Simple State Machine
+
+ To demonstrate the core functionality of the State Machine API, let's look
+ at a small example: A state machine with three states, \c s1, \c s2 and \c
+ s3. The state machine is controlled by a single QPushButton; when the button
+ is clicked, the machine transitions to another state. Initially, the state
+ machine is in state \c s1. The statechart for this machine is as follows:
+
+ \img statemachine-button.png
+ \omit
+ \caption This is a caption
+ \endomit
+
+ The following snippet shows the code needed to create such a state machine.
+
+ \code
+ QStateMachine machine;
+ QState *s1 = new QState();
+ QState *s2 = new QState();
+ QState *s3 = new QState();
+
+ s1->addTransition(button, SIGNAL(clicked()), s2);
+ s2->addTransition(button, SIGNAL(clicked()), s3);
+ s3->addTransition(button, SIGNAL(clicked()), s1);
+
+ machine.addState(s1);
+ machine.addState(s2);
+ machine.addState(s3);
+ machine.setInitialState(s1);
+
+ machine.start();
+ \endcode
+
+ Once the state machine has been set up, you need to start it by calling
+ QStateMachine::start(). The state machine executes asynchronously, i.e. it
+ becomes part of your application's event loop.
+
+ The above state machine is perfectly fine, but it doesn't \e do anything; it
+ merely transitions from one state to another. The
+ QState::setPropertyOnEntry() function can be used to have a state set a
+ property of a QObject when the state is entered. In the following snippet,
+ the value that should be assigned to a QLabel's text property is specified
+ for each state:
+
+ \code
+ s1->setPropertyOnEntry(label, "text", "In state s1");
+ s2->setPropertyOnEntry(label, "text", "In state s2");
+ s3->setPropertyOnEntry(label, "text", "In state s3");
+ \endcode
+
+ When any of the states is entered, the label's text will be changed
+ accordingly.
+
+ The QState::invokeMethodOnEntry() function can be used to have a state
+ invoke a method (a slot) of a QObject when the state is entered. In the
+ following snippet, the button's showMaximized() slot will be called when
+ state \c s3 is entered:
+
+ \code
+ s2->invokeMethodOnEntry(button, "showMaximized");
+ \endcode
+
+ \section1 Sharing Transitions By Grouping States
+
+ The state machine defined in the previous section never finishes. In order
+ for a state machine to be able to finish, it needs to have a top-level \e
+ final state. When the state machine enters a top-level final state, the
+ machine will emit the finished() signal and halt.
+
+ Assume we wanted the user to be able to quit the application at any time by
+ clicking a Quit button. In order to achieve this, we need to create a final
+ state and make it the target of a transition associated with the Quit
+ button's clicked() signal. We could add a transition from each of \c s1, \c
+ s2 and \c s3; however, this seems redundant, and one would also have to
+ remember to add such a transition from every new state that is added in the
+ future.
+
+ We can achieve the same behavior (namely that clicking the Quit button quits
+ the state machine, regardless of which state the state machine is in) by
+ grouping states \c s1, \c s2 and \c s3. This is done by creating a new
+ top-level state and making the three original states children of the new
+ state. The following diagram shows the new state machine.
+
+ \img statemachine-button-nested.png
+ \omit
+ \caption This is a caption
+ \endomit
+
+ The three original states have been renamed \c s11, \c s12 and \c s13 to
+ reflect that they are now children of the new top-level state, \c s1. Child
+ states implicitly inherit the transitions of their parent state. This means
+ it is now sufficient to add a single transition from \c s1 to the final
+ state \c s2. New states added to \c s1 will also automatically inherit this
+ transition.
+
+ All that's needed to group states is to specify the proper parent when the
+ state is created. You also need to specify which of the child states is the
+ initial one (i.e. which child state the state machine should enter when the
+ parent state is the target of a transition).
+
+ \code
+ QState *s1 = new QState();
+ QState *s11 = new QState(s1);
+ QState *s12 = new QState(s1);
+ QState *s13 = new QState(s1);
+ s1->setInitialState(s11);
+ machine.addState(s1);
+ \endcode
+
+ \code
+ QFinalState *s2 = new QFinalState();
+ s1->addTransition(quitButton, SIGNAL(clicked()), s2);
+ machine.addState(s2);
+
+ QObject::connect(&machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit()));
+ \endcode
+
+ In this case we want the application to quit when the state machine is
+ finished, so the machine's finished() signal is connected to the
+ application's quit() slot.
+
+ A child state can override an inherited transition. For example, the
+ following code adds a transition that effectively causes the Quit button to
+ be ignored when the state machine is in state \c s12.
+
+ \code
+ s12>addTransition(quitButton, SIGNAL(clicked()), s12);
+ \endcode
+
+ \section1 Using History States to Save and Restore the Current State
+
+ Imagine that we wanted to add an "interrupt" mechanism to the example
+ discussed in the previous section; the user should be able to click a button
+ to have the state machine perform some non-related task, after which the
+ state machine should resume whatever it was doing before (i.e. return to the
+ old state, which is one of \c s11, \c s12 and \c s13 in this case).
+
+ Such behavior can easily be modeled using \e{history states}. A history
+ state (QHistoryState object) is a pseudo-state that represents the child
+ state that the parent state was in the last time the parent state was
+ exited.
+
+ A history state is created as a child of the state for which we wish to
+ record the current child state; when the state machine detects the presence
+ of such a state at runtime, it automatically records the current (real)
+ child state when the parent state is exited. A transition to the history
+ state is in fact a transition to the child state that the state machine had
+ previously saved; the state machine automatically "forwards" the transition
+ to the real child state.
+
+ The following diagram shows the state machine after the interrupt mechanism
+ has been added.
+
+ \img statemachine-button-history.png
+ \omit
+ \caption This is a caption
+ \endomit
+
+ The following code shows how it can be implemented; in this example we
+ simply display a message box when \c s3 is entered, then immediately return
+ to the previous child state of \c s1 via the history state.
+
+ \code
+ QHistoryState *s1h = s1->addHistoryState();
+
+ QState *s3 = new QState();
+ s3->setPropertyOnEntry(label, "text", "In s3");
+ QMessageBox mbox;
+ mbox.addButton(QMessageBox::Ok);
+ mbox.setText("Interrupted!");
+ mbox.setIcon(QMessageBox::Information);
+ s3->invokeMethodOnEntry(&mbox, "exec");
+ s3->addTransition(s1h);
+ machine.addState(s3);
+
+ s1->addTransition(interruptButton, SIGNAL(clicked()), s3);
+ \endcode
+
+ \section1 Using Parallel States to Avoid a Combinatorial Explosion of States
+
+ Assume that you wanted to model a set of mutually exclusive properties of a
+ car in a single state machine. Let's say the properties we are interested in
+ are Clean vs Dirty, and Moving vs Not moving. It would take four mutually
+ exclusive states and eight transitions to be able to represent and freely
+ move between all possible combinations.
+
+ \img statemachine-nonparallel.png
+ \omit
+ \caption This is a caption
+ \endomit
+
+ If we added a third property (say, Red vs Blue), the total number of states
+ would double, to eight; and if we added a fourth property (say, Enclosed vs
+ Convertible), the total number of states would double again, to 16.
+
+ Using parallel states, the total number of states and transitions grows
+ linearly as we add more properties, instead of exponentially. Furthermore,
+ states can be added to or removed from the parallel state without affecting
+ any of their sibling states.
+
+ \img statemachine-parallel.png
+ \omit
+ \caption This is a caption
+ \endomit
+
+ To create a parallel state group, pass QState::ParallelStateGroup to the
+ QState constructor.
+
+ \code
+ QState *s1 = new QState(QState::ParallelStateGroup);
+ // s11 and s12 will be entered in parallel
+ QState *s11 = new QState(s1);
+ QState *s12 = new QState(s1);
+ \endcode
+
+ \section1 Detecting that a Composite State has Finished
+
+ A child state can be final; when a final child state is entered, a
+ QStateFinishedEvent is generated for the parent state. You can use the
+ QStateFinishedTransition class to trigger a transition based on this event.
+
+ \img statemachine-finished.png
+ \omit
+ \caption This is a caption
+ \endomit
+
+ This is useful when you want to hide the internal details of a state;
+ i.e. the only thing the outside world should be able to do is enter the
+ state, and get a notification when the state has finished (i.e. when a final
+ child state has been entered).
+
+ */
diff --git a/examples/animation/animatedtiles/animatedtiles.pro b/examples/animation/animatedtiles/animatedtiles.pro
new file mode 100644
index 0000000..9e9062c
--- /dev/null
+++ b/examples/animation/animatedtiles/animatedtiles.pro
@@ -0,0 +1,2 @@
+SOURCES += main.cpp
+RESOURCES += animatedtiles.qrc
diff --git a/examples/animation/animatedtiles/animatedtiles.qrc b/examples/animation/animatedtiles/animatedtiles.qrc
new file mode 100644
index 0000000..c43a979
--- /dev/null
+++ b/examples/animation/animatedtiles/animatedtiles.qrc
@@ -0,0 +1,11 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>images/Time-For-Lunch-2.jpg</file>
+ <file>images/centered.png</file>
+ <file>images/ellipse.png</file>
+ <file>images/figure8.png</file>
+ <file>images/kinetic.png</file>
+ <file>images/random.png</file>
+ <file>images/tile.png</file>
+</qresource>
+</RCC>
diff --git a/examples/animation/animatedtiles/images/Time-For-Lunch-2.jpg b/examples/animation/animatedtiles/images/Time-For-Lunch-2.jpg
new file mode 100644
index 0000000..c57a555
--- /dev/null
+++ b/examples/animation/animatedtiles/images/Time-For-Lunch-2.jpg
Binary files differ
diff --git a/examples/animation/animatedtiles/images/centered.png b/examples/animation/animatedtiles/images/centered.png
new file mode 100644
index 0000000..e416156
--- /dev/null
+++ b/examples/animation/animatedtiles/images/centered.png
Binary files differ
diff --git a/examples/animation/animatedtiles/images/ellipse.png b/examples/animation/animatedtiles/images/ellipse.png
new file mode 100644
index 0000000..2c3ba88
--- /dev/null
+++ b/examples/animation/animatedtiles/images/ellipse.png
Binary files differ
diff --git a/examples/animation/animatedtiles/images/figure8.png b/examples/animation/animatedtiles/images/figure8.png
new file mode 100644
index 0000000..6b05804
--- /dev/null
+++ b/examples/animation/animatedtiles/images/figure8.png
Binary files differ
diff --git a/examples/animation/animatedtiles/images/kinetic.png b/examples/animation/animatedtiles/images/kinetic.png
new file mode 100644
index 0000000..55cfa55
--- /dev/null
+++ b/examples/animation/animatedtiles/images/kinetic.png
Binary files differ
diff --git a/examples/animation/animatedtiles/images/random.png b/examples/animation/animatedtiles/images/random.png
new file mode 100644
index 0000000..415d96f
--- /dev/null
+++ b/examples/animation/animatedtiles/images/random.png
Binary files differ
diff --git a/examples/animation/animatedtiles/images/tile.png b/examples/animation/animatedtiles/images/tile.png
new file mode 100644
index 0000000..c8f39d8
--- /dev/null
+++ b/examples/animation/animatedtiles/images/tile.png
Binary files differ
diff --git a/examples/animation/animatedtiles/main.cpp b/examples/animation/animatedtiles/main.cpp
new file mode 100644
index 0000000..e4a774c
--- /dev/null
+++ b/examples/animation/animatedtiles/main.cpp
@@ -0,0 +1,242 @@
+#include <QtGui>
+#ifdef QT_EXPERIMENTAL_SOLUTION
+# include "qgraphicswidget.h"
+# include "qstate.h"
+# include "qstatemachine.h"
+# include "qgraphicswidget.h"
+# include "qparallelanimationgroup.h"
+# include "qpropertyanimation.h"
+#else
+#include <QtCore/qstate.h>
+#endif
+
+class Pixmap : public QObject, public QGraphicsPixmapItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QPointF pos READ pos WRITE setPos)
+public:
+ Pixmap(const QPixmap &pix)
+ : QObject(), QGraphicsPixmapItem(pix)
+ {
+ setCacheMode(DeviceCoordinateCache);
+ }
+};
+
+class Button : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ Button(const QPixmap &pixmap, QGraphicsItem *parent = 0)
+ : QGraphicsWidget(parent), _pix(pixmap)
+ {
+ setAcceptHoverEvents(true);
+ setCacheMode(DeviceCoordinateCache);
+ }
+
+ QRectF boundingRect() const
+ {
+ return QRectF(-65, -65, 130, 130);
+ }
+
+ QPainterPath shape() const
+ {
+ QPainterPath path;
+ path.addEllipse(boundingRect());
+ return path;
+ }
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
+ {
+ bool down = option->state & QStyle::State_Sunken;
+ QRectF r = boundingRect();
+ QLinearGradient grad(r.topLeft(), r.bottomRight());
+ grad.setColorAt(down ? 1 : 0, option->state & QStyle::State_MouseOver ? Qt::white : Qt::lightGray);
+ grad.setColorAt(down ? 0 : 1, Qt::darkGray);
+ painter->setPen(Qt::darkGray);
+ painter->setBrush(grad);
+ painter->drawEllipse(r);
+ QLinearGradient grad2(r.topLeft(), r.bottomRight());
+ grad.setColorAt(down ? 1 : 0, Qt::darkGray);
+ grad.setColorAt(down ? 0 : 1, Qt::lightGray);
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(grad);
+ if (down)
+ painter->translate(2, 2);
+ painter->drawEllipse(r.adjusted(5, 5, -5, -5));
+ painter->drawPixmap(-_pix.width()/2, -_pix.height()/2, _pix);
+ }
+
+signals:
+ void pressed();
+
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *)
+ {
+ emit pressed();
+ update();
+ }
+
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *)
+ {
+ update();
+ }
+
+private:
+ QPixmap _pix;
+};
+
+class View : public QGraphicsView
+{
+public:
+ View(QGraphicsScene *scene) : QGraphicsView(scene) { }
+
+protected:
+ void resizeEvent(QResizeEvent *event)
+ {
+ QGraphicsView::resizeEvent(event);
+ fitInView(sceneRect(), Qt::KeepAspectRatio);
+ }
+};
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ QPixmap kineticPix(":/images/kinetic.png");
+ QPixmap bgPix(":/images/Time-For-Lunch-2.jpg");
+
+ QGraphicsScene scene(-350, -350, 700, 700);
+
+ QList<Pixmap *> items;
+ for (int i = 0; i < 64; ++i) {
+ Pixmap *item = new Pixmap(kineticPix);
+ item->setOffset(-kineticPix.width()/2, -kineticPix.height()/2);
+ item->setZValue(i);
+ items << item;
+ scene.addItem(item);
+ }
+
+ // Buttons
+ QGraphicsItem *buttonParent = new QGraphicsRectItem;
+ Button *ellipseButton = new Button(QPixmap(":/images/ellipse.png"), buttonParent);
+ Button *figure8Button = new Button(QPixmap(":/images/figure8.png"), buttonParent);
+ Button *randomButton = new Button(QPixmap(":/images/random.png"), buttonParent);
+ Button *tiledButton = new Button(QPixmap(":/images/tile.png"), buttonParent);
+ Button *centeredButton = new Button(QPixmap(":/images/centered.png"), buttonParent);
+
+ ellipseButton->setPos(-100, -100);
+ figure8Button->setPos(100, -100);
+ randomButton->setPos(0, 0);
+ tiledButton->setPos(-100, 100);
+ centeredButton->setPos(100, 100);
+
+ scene.addItem(buttonParent);
+ buttonParent->scale(0.75, 0.75);
+ buttonParent->setPos(200, 200);
+ buttonParent->setZValue(65);
+
+ // States
+ QState *rootState = new QState;
+ QState *ellipseState = new QState(rootState);
+ QState *figure8State = new QState(rootState);
+ QState *randomState = new QState(rootState);
+ QState *tiledState = new QState(rootState);
+ QState *centeredState = new QState(rootState);
+
+ // Values
+ for (int i = 0; i < 64; ++i) {
+ Pixmap *item = items.at(i);
+ // Ellipse
+ ellipseState->setPropertyOnEntry(item, "pos",
+ QPointF(cos((i / 63.0) * 6.28) * 250,
+ sin((i / 63.0) * 6.28) * 250));
+
+ // Figure 8
+ figure8State->setPropertyOnEntry(item, "pos",
+ QPointF(sin((i / 63.0) * 6.28) * 250,
+ sin(((i * 2)/63.0) * 6.28) * 250));
+
+ // Random
+ randomState->setPropertyOnEntry(item, "pos",
+ QPointF(-250 + qrand() % 500,
+ -250 + qrand() % 500));
+
+ // Tiled
+ tiledState->setPropertyOnEntry(item, "pos",
+ QPointF(((i % 8) - 4) * kineticPix.width() + kineticPix.width() / 2,
+ ((i / 8) - 4) * kineticPix.height() + kineticPix.height() / 2));
+
+ // Centered
+ centeredState->setPropertyOnEntry(item, "pos", QPointF());
+ }
+
+ // Ui
+ View *view = new View(&scene);
+ view->setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Animated Tiles"));
+ view->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
+ view->setBackgroundBrush(bgPix);
+ view->setCacheMode(QGraphicsView::CacheBackground);
+ view->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
+ view->show();
+
+ QStateMachine states;
+ states.addState(rootState);
+ states.setInitialState(rootState);
+ rootState->setInitialState(centeredState);
+
+ // rootState->addTransition(ellipseButton, SIGNAL(pressed()), ellipseState);
+ QParallelAnimationGroup *group = new QParallelAnimationGroup;
+ for (int i = 0; i < 64; ++i) {
+ QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
+ anim->setDuration(750 + i * 25);
+ anim->setEasingCurve(QEasingCurve::InOutBack);
+ group->addAnimation(anim);
+ }
+ rootState->addAnimatedTransition(ellipseButton, SIGNAL(pressed()), ellipseState, group);
+
+ group = new QParallelAnimationGroup;
+ for (int i = 0; i < 64; ++i) {
+ QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
+ anim->setDuration(750 + i * 25);
+ anim->setEasingCurve(QEasingCurve::InOutBack);
+ group->addAnimation(anim);
+ }
+ rootState->addAnimatedTransition(figure8Button, SIGNAL(pressed()), figure8State, group);
+
+ group = new QParallelAnimationGroup;
+ for (int i = 0; i < 64; ++i) {
+ QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
+ anim->setDuration(750 + i * 25);
+ anim->setEasingCurve(QEasingCurve::InOutBack);
+ group->addAnimation(anim);
+ }
+ rootState->addAnimatedTransition(randomButton, SIGNAL(pressed()), randomState, group);
+
+ group = new QParallelAnimationGroup;
+ for (int i = 0; i < 64; ++i) {
+ QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
+ anim->setDuration(750 + i * 25);
+ anim->setEasingCurve(QEasingCurve::InOutBack);
+ group->addAnimation(anim);
+ }
+ rootState->addAnimatedTransition(tiledButton, SIGNAL(pressed()), tiledState, group);
+
+ group = new QParallelAnimationGroup;
+ for (int i = 0; i < 64; ++i) {
+ QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
+ anim->setDuration(750 + i * 25);
+ anim->setEasingCurve(QEasingCurve::InOutBack);
+ group->addAnimation(anim);
+ }
+ rootState->addAnimatedTransition(centeredButton, SIGNAL(pressed()), centeredState, group);
+
+ states.start();
+ QTimer timer;
+ timer.start(125);
+ timer.setSingleShot(true);
+ rootState->addAnimatedTransition(&timer, SIGNAL(timeout()), ellipseState, group);
+
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/examples/animation/animation.pro b/examples/animation/animation.pro
new file mode 100644
index 0000000..d5121a1
--- /dev/null
+++ b/examples/animation/animation.pro
@@ -0,0 +1,21 @@
+TEMPLATE = \
+ subdirs
+SUBDIRS += \
+ animatedtiles \
+ appchooser \
+ easing \
+ example \
+ moveblocks \
+ padnavigator-ng \
+ photobrowser \
+ piemenu \
+ selectbutton \
+ states \
+ stickman \
+ sub-attaq
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/animation
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS animation.pro README
+sources.path = $$[QT_INSTALL_EXAMPLES]/animation
+INSTALLS += target sources
diff --git a/examples/animation/appchooser/accessories-dictionary.png b/examples/animation/appchooser/accessories-dictionary.png
new file mode 100644
index 0000000..e9bd55d
--- /dev/null
+++ b/examples/animation/appchooser/accessories-dictionary.png
Binary files differ
diff --git a/examples/animation/appchooser/akregator.png b/examples/animation/appchooser/akregator.png
new file mode 100644
index 0000000..a086f45
--- /dev/null
+++ b/examples/animation/appchooser/akregator.png
Binary files differ
diff --git a/examples/animation/appchooser/appchooser.pro b/examples/animation/appchooser/appchooser.pro
new file mode 100644
index 0000000..8cda19a
--- /dev/null
+++ b/examples/animation/appchooser/appchooser.pro
@@ -0,0 +1,9 @@
+# Input
+SOURCES += main.cpp
+RESOURCES += appchooser.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/animation/appchooser
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS appchooser.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/animation/appchooser
+INSTALLS += target sources
diff --git a/examples/animation/appchooser/appchooser.qrc b/examples/animation/appchooser/appchooser.qrc
new file mode 100644
index 0000000..28a3e1c
--- /dev/null
+++ b/examples/animation/appchooser/appchooser.qrc
@@ -0,0 +1,8 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>accessories-dictionary.png</file>
+ <file>akregator.png</file>
+ <file>digikam.png</file>
+ <file>k3b.png</file>
+</qresource>
+</RCC>
diff --git a/examples/animation/appchooser/digikam.png b/examples/animation/appchooser/digikam.png
new file mode 100644
index 0000000..9de9fb2
--- /dev/null
+++ b/examples/animation/appchooser/digikam.png
Binary files differ
diff --git a/examples/animation/appchooser/k3b.png b/examples/animation/appchooser/k3b.png
new file mode 100644
index 0000000..bbcafcf
--- /dev/null
+++ b/examples/animation/appchooser/k3b.png
Binary files differ
diff --git a/examples/animation/appchooser/main.cpp b/examples/animation/appchooser/main.cpp
new file mode 100644
index 0000000..536bbb6
--- /dev/null
+++ b/examples/animation/appchooser/main.cpp
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore>
+#include <QtGui>
+#ifdef QT_EXPERIMENTAL_SOLUTION
+#include "qtgraphicswidget.h"
+#endif
+
+
+class Pixmap : public QGraphicsWidget
+{
+ Q_OBJECT
+
+public:
+ Pixmap(const QPixmap &pix, QGraphicsItem *parent = 0)
+ : QGraphicsWidget(parent), orig(pix), p(pix)
+ {
+ }
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+ {
+ painter->drawPixmap(QPointF(), p);
+ }
+
+ virtual void mousePressEvent(QGraphicsSceneMouseEvent * )
+ {
+ emit clicked();
+ }
+
+ virtual void setGeometry(const QRectF &rect)
+ {
+ QGraphicsWidget::setGeometry(rect);
+
+ if (rect.size().width() > orig.size().width())
+ p = orig.scaled(rect.size().toSize());
+ else
+ p = orig;
+ }
+
+Q_SIGNALS:
+ void clicked();
+
+private:
+ QPixmap orig;
+ QPixmap p;
+};
+
+void createStateAndTransition(QObject *o1, const QRect &selectedRect, QState *parent)
+{
+ QState *state = new QState(parent);
+ state->setPropertyOnEntry(o1, "geometry", selectedRect);
+
+ QPropertyAnimation *animation = new QPropertyAnimation(o1, "geometry");
+ parent->addAnimatedTransition(o1, SIGNAL(clicked()), state, animation);
+}
+
+int main(int argc, char **argv)
+{
+ Q_INIT_RESOURCE(appchooser);
+
+ QApplication app(argc, argv);
+
+ Pixmap *p1 = new Pixmap(QPixmap(":/digikam.png"));
+ Pixmap *p2 = new Pixmap(QPixmap(":/akregator.png"));
+ Pixmap *p3 = new Pixmap(QPixmap(":/accessories-dictionary.png"));
+ Pixmap *p4 = new Pixmap(QPixmap(":/k3b.png"));
+
+ p1->setObjectName("p1");
+ p2->setObjectName("p2");
+ p3->setObjectName("p3");
+ p4->setObjectName("p4");
+
+ p1->setGeometry(QRectF(0.0, 0.0, 64.0, 64.0));
+ p2->setGeometry(QRectF(236.0, 0.0, 64.0, 64.0));
+ p3->setGeometry(QRectF(236.0, 236.0, 64.0, 64.0));
+ p4->setGeometry(QRectF(0.0, 236.0, 64.0, 64.0));
+
+ QGraphicsScene scene(0, 0, 300, 300);
+ scene.setBackgroundBrush(Qt::white);
+ scene.addItem(p1);
+ scene.addItem(p2);
+ scene.addItem(p3);
+ scene.addItem(p4);
+
+ QGraphicsView window(&scene);
+ window.setFrameStyle(0);
+ window.setAlignment(Qt::AlignLeft | Qt::AlignTop);
+ window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ window.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+ QStateMachine machine;
+ machine.setGlobalRestorePolicy(QState::RestoreProperties);
+
+ QState *group = new QState(machine.rootState());
+ group->setObjectName("group");
+ QRect selectedRect(86, 86, 128, 128);
+
+ QState *idleState = new QState(group);
+ group->setInitialState(idleState);
+
+ createStateAndTransition(p1, selectedRect, group);
+ createStateAndTransition(p2, selectedRect, group);
+ createStateAndTransition(p3, selectedRect, group);
+ createStateAndTransition(p4, selectedRect, group);
+
+ machine.setInitialState(group);
+ machine.start();
+
+ window.resize(300, 300);
+ window.show();
+
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/examples/animation/easing/animation.h b/examples/animation/easing/animation.h
new file mode 100644
index 0000000..db67810
--- /dev/null
+++ b/examples/animation/easing/animation.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ANIMATION_H
+#define ANIMATION_H
+
+#include <QtGui>
+
+#if defined(QT_EXPERIMENTAL_SOLUTION)
+# include "qpropertyanimation.h"
+#else
+# include <QtCore/qpropertyanimation.h>
+#endif
+
+class Animation : public QPropertyAnimation {
+public:
+ enum PathType {
+ LinearPath,
+ CirclePath,
+ NPathTypes
+ };
+ Animation(QObject *target, const QByteArray &prop)
+ : QPropertyAnimation(target, prop)
+ {
+ setPathType(LinearPath);
+ }
+
+ void setPathType(PathType pathType)
+ {
+ if (pathType >= NPathTypes)
+ qWarning("Unknown pathType %d", pathType);
+
+ m_pathType = pathType;
+ m_path = QPainterPath();
+ }
+
+ void updateCurrentTime(int msecs)
+ {
+ if (m_pathType == CirclePath) {
+ if (m_path.isEmpty()) {
+ QPointF to = endValue().toPointF();
+ QPointF from = startValue().toPointF();
+ m_path.moveTo(from);
+ m_path.addEllipse(QRectF(from, to));
+ }
+ int dura = duration();
+ const qreal progress = ((dura == 0) ? 1 : ((((currentTime() - 1) % dura) + 1) / qreal(dura)));
+
+ qreal easedProgress = easingCurve().valueForProgress(progress);
+ if (easedProgress > 1.0) {
+ easedProgress -= 1.0;
+ } else if (easedProgress < 0) {
+ easedProgress += 1.0;
+ }
+ QPointF pt = m_path.pointAtPercent(easedProgress);
+ updateCurrentValue(pt);
+ emit valueChanged(pt);
+ } else {
+ QPropertyAnimation::updateCurrentTime(msecs);
+ }
+ }
+
+ QPainterPath m_path;
+ PathType m_pathType;
+};
+
+#endif // ANIMATION_H
diff --git a/examples/animation/easing/easing.pro b/examples/animation/easing/easing.pro
new file mode 100644
index 0000000..fa5b22d
--- /dev/null
+++ b/examples/animation/easing/easing.pro
@@ -0,0 +1,16 @@
+######################################################################
+# Automatically generated by qmake (2.01a) to 2. okt 23:22:11 2008
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += window.h animation.h
+SOURCES += main.cpp window.cpp
+
+FORMS += form.ui
+
+RESOURCES = resources.qrc
diff --git a/examples/animation/easing/form.ui b/examples/animation/easing/form.ui
new file mode 100644
index 0000000..b60ade8
--- /dev/null
+++ b/examples/animation/easing/form.ui
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>545</width>
+ <height>471</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Easing curves</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0" colspan="2">
+ <widget class="QListWidget" name="easingCurvePicker">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>120</height>
+ </size>
+ </property>
+ <property name="verticalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ <property name="movement">
+ <enum>QListView::Static</enum>
+ </property>
+ <property name="isWrapping" stdset="0">
+ <bool>false</bool>
+ </property>
+ <property name="viewMode">
+ <enum>QListView::IconMode</enum>
+ </property>
+ <property name="selectionRectVisible">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Path type</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QRadioButton" name="lineRadio">
+ <property name="text">
+ <string>Line</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <attribute name="buttonGroup">
+ <string>buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="circleRadio">
+ <property name="text">
+ <string>Circle</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string>buttonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Properties</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Period</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QDoubleSpinBox" name="periodSpinBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimum">
+ <double>-1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="value">
+ <double>-1.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Amplitude</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QDoubleSpinBox" name="amplitudeSpinBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimum">
+ <double>-1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="value">
+ <double>-1.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Overshoot</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QDoubleSpinBox" name="overshootSpinBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="minimum">
+ <double>-1.000000000000000</double>
+ </property>
+ <property name="singleStep">
+ <double>0.100000000000000</double>
+ </property>
+ <property name="value">
+ <double>-1.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1">
+ <widget class="QGraphicsView" name="graphicsView">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+ <buttongroups>
+ <buttongroup name="buttonGroup"/>
+ </buttongroups>
+</ui>
diff --git a/examples/animation/easing/images/qt-logo.png b/examples/animation/easing/images/qt-logo.png
new file mode 100644
index 0000000..14ddf2a
--- /dev/null
+++ b/examples/animation/easing/images/qt-logo.png
Binary files differ
diff --git a/examples/animation/easing/main.cpp b/examples/animation/easing/main.cpp
new file mode 100644
index 0000000..139f2da
--- /dev/null
+++ b/examples/animation/easing/main.cpp
@@ -0,0 +1,22 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "window.h"
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ Window w;
+ w.resize(400, 400);
+ w.show();
+ return app.exec();
+}
diff --git a/examples/animation/easing/resources.qrc b/examples/animation/easing/resources.qrc
new file mode 100644
index 0000000..7e112d3
--- /dev/null
+++ b/examples/animation/easing/resources.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+ <qresource>
+ <file>images/qt-logo.png</file>
+ </qresource>
+ </RCC> \ No newline at end of file
diff --git a/examples/animation/easing/window.cpp b/examples/animation/easing/window.cpp
new file mode 100644
index 0000000..c6ea360
--- /dev/null
+++ b/examples/animation/easing/window.cpp
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include "window.h"
+
+Window::Window(QWidget *parent)
+ : QWidget(parent), m_iconSize(64, 64)
+{
+ m_ui.setupUi(this);
+ QButtonGroup *buttonGroup = qFindChild<QButtonGroup *>(this); // ### workaround for uic in 4.4
+ m_ui.easingCurvePicker->setIconSize(m_iconSize);
+ m_ui.easingCurvePicker->setMinimumHeight(m_iconSize.height() + 50);
+ buttonGroup->setId(m_ui.lineRadio, 0);
+ buttonGroup->setId(m_ui.circleRadio, 1);
+
+ QEasingCurve dummy;
+ m_ui.periodSpinBox->setValue(dummy.period());
+ m_ui.amplitudeSpinBox->setValue(dummy.amplitude());
+ m_ui.overshootSpinBox->setValue(dummy.overshoot());
+
+ connect(m_ui.easingCurvePicker, SIGNAL(currentRowChanged(int)), this, SLOT(curveChanged(int)));
+ connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(pathChanged(int)));
+ connect(m_ui.periodSpinBox, SIGNAL(valueChanged(double)), this, SLOT(periodChanged(double)));
+ connect(m_ui.amplitudeSpinBox, SIGNAL(valueChanged(double)), this, SLOT(amplitudeChanged(double)));
+ connect(m_ui.overshootSpinBox, SIGNAL(valueChanged(double)), this, SLOT(overshootChanged(double)));
+ createCurveIcons();
+
+ QPixmap pix(QLatin1String(":/images/qt-logo.png"));
+ m_item = new PixmapItem(pix);
+ m_scene.addItem(m_item);
+ m_ui.graphicsView->setScene(&m_scene);
+
+ m_anim = new Animation(m_item, "pos");
+ m_anim->setEasingCurve(QEasingCurve::OutBounce);
+ m_ui.easingCurvePicker->setCurrentRow(int(QEasingCurve::OutBounce));
+
+ startAnimation();
+}
+
+void Window::createCurveIcons()
+{
+ QPixmap pix(m_iconSize);
+ QPainter painter(&pix);
+ QLinearGradient gradient(0,0, 0, m_iconSize.height());
+ gradient.setColorAt(0.0, QColor(240, 240, 240));
+ gradient.setColorAt(1.0, QColor(224, 224, 224));
+ QBrush brush(gradient);
+ const QMetaObject &mo = QEasingCurve::staticMetaObject;
+ QMetaEnum metaEnum = mo.enumerator(mo.indexOfEnumerator("Type"));
+ // Skip QEasingCurve::Custom
+ for (int i = 0; i < QEasingCurve::NCurveTypes - 1; ++i) {
+ painter.fillRect(QRect(QPoint(0, 0), m_iconSize), brush);
+ QEasingCurve curve((QEasingCurve::Type)i);
+ painter.setPen(QColor(0, 0, 255, 64));
+ qreal xAxis = m_iconSize.height()/1.5;
+ qreal yAxis = m_iconSize.width()/3;
+ painter.drawLine(0, xAxis, m_iconSize.width(), xAxis);
+ painter.drawLine(yAxis, 0, yAxis, m_iconSize.height());
+ painter.setPen(Qt::black);
+
+ qreal curveScale = m_iconSize.height()/2;
+ QPoint currentPos(yAxis, xAxis);
+
+ for (qreal t = 0; t < 1.0; t+=1.0/curveScale) {
+ QPoint to;
+ to.setX(yAxis + curveScale * t);
+ to.setY(xAxis - curveScale * curve.valueForProgress(t));
+ painter.drawLine(currentPos, to);
+ currentPos = to;
+ }
+ QListWidgetItem *item = new QListWidgetItem;
+ item->setIcon(QIcon(pix));
+ item->setText(metaEnum.key(i));
+ m_ui.easingCurvePicker->addItem(item);
+ }
+}
+
+void Window::startAnimation()
+{
+ m_anim->setStartValue(QPointF(0, 0));
+ m_anim->setEndValue(QPointF(100, 100));
+ m_anim->setDuration(2000);
+ m_anim->setIterationCount(-1); // forever
+ m_anim->start();
+}
+
+void Window::curveChanged(int row)
+{
+ QEasingCurve::Type curveType = (QEasingCurve::Type)row;
+ m_anim->setEasingCurve(curveType);
+ m_anim->setCurrentTime(0);
+
+ bool isElastic = curveType >= QEasingCurve::InElastic && curveType <= QEasingCurve::OutInElastic;
+ bool isBounce = curveType >= QEasingCurve::InBounce && curveType <= QEasingCurve::OutInBounce;
+ m_ui.periodSpinBox->setEnabled(isElastic);
+ m_ui.amplitudeSpinBox->setEnabled(isElastic || isBounce);
+ m_ui.overshootSpinBox->setEnabled(curveType >= QEasingCurve::InBack && curveType <= QEasingCurve::OutInBack);
+}
+
+void Window::pathChanged(int index)
+{
+ m_anim->setPathType((Animation::PathType)index);
+}
+
+void Window::periodChanged(double value)
+{
+ QEasingCurve curve = m_anim->easingCurve();
+ curve.setPeriod(value);
+ m_anim->setEasingCurve(curve);
+}
+
+void Window::amplitudeChanged(double value)
+{
+ QEasingCurve curve = m_anim->easingCurve();
+ curve.setAmplitude(value);
+ m_anim->setEasingCurve(curve);
+}
+
+void Window::overshootChanged(double value)
+{
+ QEasingCurve curve = m_anim->easingCurve();
+ curve.setOvershoot(value);
+ m_anim->setEasingCurve(curve);
+}
+
diff --git a/examples/animation/easing/window.h b/examples/animation/easing/window.h
new file mode 100644
index 0000000..4ba6eb6
--- /dev/null
+++ b/examples/animation/easing/window.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "ui_form.h"
+#include "animation.h"
+
+class PixmapItem : public QObject, public QGraphicsPixmapItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QPointF pos READ pos WRITE setPos)
+public:
+ PixmapItem(const QPixmap &pix) : QGraphicsPixmapItem(pix)
+ {
+ }
+};
+
+class Window : public QWidget {
+ Q_OBJECT
+public:
+ Window(QWidget *parent = 0);
+private slots:
+ void curveChanged(int row);
+ void pathChanged(int index);
+ void periodChanged(double);
+ void amplitudeChanged(double);
+ void overshootChanged(double);
+
+private:
+ void createCurveIcons();
+ void startAnimation();
+
+ Ui::Form m_ui;
+ QGraphicsScene m_scene;
+ PixmapItem *m_item;
+ Animation *m_anim;
+ QSize m_iconSize;
+
+
+};
diff --git a/examples/animation/example/example.pro b/examples/animation/example/example.pro
new file mode 100644
index 0000000..bc79b82
--- /dev/null
+++ b/examples/animation/example/example.pro
@@ -0,0 +1,12 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Thu Sep 25 14:03:47 2008
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += mainwindow.h
+SOURCES += main.cpp mainwindow.cpp
diff --git a/examples/animation/example/main.cpp b/examples/animation/example/main.cpp
new file mode 100644
index 0000000..d5f5607
--- /dev/null
+++ b/examples/animation/example/main.cpp
@@ -0,0 +1,23 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+ //Q_INIT_RESOURCE(example);
+ QApplication app(argc, argv);
+ MainWindow w;
+ w.show();
+ return app.exec();
+}
+
diff --git a/examples/animation/example/mainwindow.cpp b/examples/animation/example/mainwindow.cpp
new file mode 100644
index 0000000..dfb5c70
--- /dev/null
+++ b/examples/animation/example/mainwindow.cpp
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include "mainwindow.h"
+
+MainWindow::MainWindow() : QMainWindow(0)
+{
+ // Text edit and button
+ listWidget = new QListWidget;
+ new QListWidgetItem("Rachel", listWidget);
+ new QListWidgetItem("Andreas", listWidget);
+ new QListWidgetItem("David", listWidget);
+ new QListWidgetItem("Olivier", listWidget);
+ new QListWidgetItem("Andy", listWidget);
+ new QListWidgetItem("Martial", listWidget);
+ new QListWidgetItem("Kazou", listWidget);
+ new QListWidgetItem("Fred", listWidget);
+ new QListWidgetItem("Ingrid", listWidget);
+ QGraphicsProxyWidget *listProxy = new QGraphicsProxyWidget;
+ listProxy->setWidget(listWidget);
+
+ labelWidget = new QLabel;
+ QGraphicsProxyWidget *labelProxy = new QGraphicsProxyWidget;
+ labelProxy->setWidget(labelWidget);
+ labelWidget->setAttribute(Qt::WA_NoSystemBackground);
+
+ label2Widget = new QLabel;
+ label2Widget->setAlignment(Qt::AlignCenter);
+ QGraphicsProxyWidget *label2Proxy = new QGraphicsProxyWidget;
+ label2Proxy->setWidget(label2Widget);
+ label2Widget->setAttribute(Qt::WA_NoSystemBackground);
+
+ editWidget = new QLineEdit;
+ QGraphicsProxyWidget *editProxy = new QGraphicsProxyWidget;
+ editProxy->setWidget(editWidget);
+ editWidget->setAttribute(Qt::WA_NoSystemBackground);
+
+ // Parent widget
+ QGraphicsWidget *widget = new QGraphicsWidget;
+ // Parent widget
+ QGraphicsWidget *widget2 = new QGraphicsWidget;
+
+ QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout(Qt::Vertical, widget);
+ vLayout->addItem(listProxy);
+ vLayout->addItem(widget2);
+ widget->setLayout(vLayout);
+
+ QPushButton *button = new QPushButton;
+ QGraphicsProxyWidget *buttonProxy = new QGraphicsProxyWidget;
+ buttonProxy->setWidget(button);
+
+ QPushButton *button2 = new QPushButton;
+ QGraphicsProxyWidget *buttonProxy2 = new QGraphicsProxyWidget;
+ buttonProxy2->setWidget(button2);
+
+ QPushButton *button3 = new QPushButton;
+ QGraphicsProxyWidget *buttonProxy3 = new QGraphicsProxyWidget;
+ buttonProxy3->setWidget(button3);
+
+ QPushButton *button4 = new QPushButton;
+ QGraphicsProxyWidget *buttonProxy4 = new QGraphicsProxyWidget;
+ buttonProxy4->setWidget(button4);
+
+ QGraphicsLinearLayout *hLayout = new QGraphicsLinearLayout(Qt::Horizontal, widget2);
+ hLayout->addItem(buttonProxy);
+ hLayout->addItem(buttonProxy2);
+ hLayout->addItem(buttonProxy3);
+ widget2->setLayout(hLayout);
+
+ scene = new QGraphicsScene(0, 0, 700, 600);
+ scene->setBackgroundBrush(scene->palette().window());
+ scene->addItem(widget);
+ scene->addItem(editProxy);
+ scene->addItem(label2Proxy);
+ scene->addItem(labelProxy);
+ scene->addItem(buttonProxy4);
+
+ machine = new QStateMachine();
+
+ group = new QState(machine->rootState());
+ state1 = new QState(group);
+ state2 = new QState(group);
+ state3 = new QState(group);
+ group->setInitialState(state1);
+
+ machine->setInitialState(group);
+
+ // State 1
+ state1->setPropertyOnEntry(button, "text", "Edit");
+ state1->setPropertyOnEntry(button2, "text", "Add");
+ state1->setPropertyOnEntry(button3, "text", "Remove");
+ state1->setPropertyOnEntry(button4, "text", "Accept");
+ state1->addTransition(button2, SIGNAL(clicked()), state3);
+ state1->setPropertyOnEntry(listProxy, "geometry", QRectF(0, 0, 700, 560));
+ state1->setPropertyOnEntry(widget, "geometry", QRectF(0, 0, 700, 600));
+ state1->setPropertyOnEntry(editProxy, "opacity", double(0));
+ state1->setPropertyOnEntry(labelProxy, "opacity", double(0));
+ state1->setPropertyOnEntry(label2Proxy, "opacity", double(0));
+ state1->setPropertyOnEntry(buttonProxy4, "opacity", double(0));
+ state1->setPropertyOnEntry(labelWidget, "text", "Name : ");
+ state1->setPropertyOnEntry(label2Widget, "text", "Edit a contact");
+ state1->setPropertyOnEntry(label2Proxy, "geometry", QRectF(375, -50, 300, 30));
+ state1->setPropertyOnEntry(labelProxy, "geometry", QRectF(350, 300, 100, 30));
+ state1->setPropertyOnEntry(editProxy, "geometry", QRectF(750, 300, 250, 30));
+ state1->setPropertyOnEntry(buttonProxy4, "geometry", QRectF(500, 350, 80, 25));
+
+ // State 2
+ state2->setPropertyOnEntry(button, "text", "Close Editing");
+ state2->setPropertyOnEntry(listProxy, "geometry", QRectF(0, 0, 350, 560));
+ state2->addTransition(button2, SIGNAL(clicked()), state3);
+ state2->addTransition(button4, SIGNAL(clicked()), state1);
+
+ state2->setPropertyOnEntry(editProxy, "opacity", double(1));
+ state2->setPropertyOnEntry(labelProxy, "opacity", double(1));
+ state2->setPropertyOnEntry(label2Proxy, "opacity", double(1));
+ state2->setPropertyOnEntry(buttonProxy4, "opacity", double(1));
+
+ state2->setPropertyOnEntry(label2Proxy, "geometry", QRectF(375, 250, 300, 30));
+ state2->setPropertyOnEntry(editProxy, "geometry", QRectF(440, 300, 260, 30));
+
+ // State 3
+ state3->setPropertyOnEntry(button4, "text", "Create New");
+ state3->setPropertyOnEntry(listProxy, "geometry", QRectF(0, 0, 350, 560));
+ state3->addTransition(button4, SIGNAL(clicked()), state1);
+ state3->addTransition(button, SIGNAL(clicked()), state1);
+ state3->setPropertyOnEntry(editProxy, "opacity", double(1));
+ state3->setPropertyOnEntry(labelProxy, "opacity", double(1));
+ state3->setPropertyOnEntry(label2Proxy, "opacity", double(1));
+ state3->setPropertyOnEntry(buttonProxy4, "opacity", double(1));
+
+ state3->setPropertyOnEntry(label2Proxy, "geometry", QRectF(375, 250, 300, 30));
+ state3->setPropertyOnEntry(editProxy, "geometry", QRectF(440, 300, 260, 30));
+
+ {
+ QAnimationGroup *animationGroup = new QParallelAnimationGroup;
+ QVariantAnimation *anim = new QPropertyAnimation(labelProxy, "opacity");
+ animationGroup->addAnimation(anim);
+ anim = new QPropertyAnimation(label2Proxy, "geometry");
+ animationGroup->addAnimation(anim);
+ anim = new QPropertyAnimation(editProxy, "geometry");
+ animationGroup->addAnimation(anim);
+ anim = new QPropertyAnimation(listProxy, "geometry");
+ animationGroup->addAnimation(anim);
+
+ state1->addAnimatedTransition(button, SIGNAL(clicked()), state2, animationGroup);
+ }
+
+ {
+ QVariantAnimation *anim;
+ QAnimationGroup *animationGroup = new QParallelAnimationGroup;
+ anim = new QPropertyAnimation(label2Proxy, "geometry");
+ animationGroup->addAnimation(anim);
+ anim = new QPropertyAnimation(editProxy, "geometry");
+ animationGroup->addAnimation(anim);
+ anim = new QPropertyAnimation(listProxy, "geometry");
+ animationGroup->addAnimation(anim);
+ state2->addAnimatedTransition(button, SIGNAL(clicked()), state1, animationGroup);
+ }
+
+ currentState = state1;
+
+ view = new QGraphicsView(scene);
+
+ setCentralWidget(view);
+
+ state3->invokeMethodOnEntry(this, "onEnterState3");
+ state2->invokeMethodOnEntry(this, "onEnterState2");
+ state1->invokeMethodOnEntry(this, "onEnterState1");
+
+ connect(listWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(onItemClicked(QListWidgetItem*)));
+ connect(button3, SIGNAL(clicked()), this, SLOT(onRemoveClicked()));
+
+ machine->start();
+}
+
+void MainWindow::onEnterState2()
+{
+ currentState = state2;
+ if (listWidget->currentItem())
+ editWidget->setText(listWidget->currentItem()->text());
+}
+
+void MainWindow::onEnterState1()
+{
+ if (currentState == state2 && listWidget->currentItem())
+ listWidget->currentItem()->setText(editWidget->text());
+ if (currentState == state3 && !editWidget->text().isNull()) {
+ new QListWidgetItem(editWidget->text(), listWidget);
+ editWidget->clear();
+ }
+ currentState = state1;
+}
+
+void MainWindow::onEnterState3()
+{
+ currentState = state3;
+}
+
+void MainWindow::onItemClicked(QListWidgetItem*)
+{
+ if (currentState == state2)
+ {
+ editWidget->setText(listWidget->currentItem()->text());
+ editWidget->clear();
+ }
+}
+
+void MainWindow::onRemoveClicked()
+{
+ QListWidgetItem *listItem = listWidget->takeItem(listWidget->currentRow());
+ delete listItem;
+}
diff --git a/examples/animation/example/mainwindow.h b/examples/animation/example/mainwindow.h
new file mode 100644
index 0000000..6be7463
--- /dev/null
+++ b/examples/animation/example/mainwindow.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __MAINWINDOW__H__
+#define __MAINWINDOW__H__
+
+#include <QtGui>
+
+class MainWindow : public QMainWindow
+{
+Q_OBJECT
+public:
+ MainWindow();
+
+private slots :
+ void onEnterState3();
+ void onEnterState2();
+ void onEnterState1();
+ void onItemClicked(QListWidgetItem*);
+ void onRemoveClicked();
+private:
+ QListWidget *listWidget;
+ QLabel *labelWidget;
+ QLabel *label2Widget;
+ QLineEdit *editWidget;
+ QGraphicsScene *scene;
+ QGraphicsView *view;
+ QState *state1;
+ QState *state2;
+ QState *state3;
+ QState *currentState;
+ QState *group;
+ QStateMachine *machine;
+};
+
+#endif //__MAINWINDOW__H__
+
diff --git a/examples/animation/moveblocks/main.cpp b/examples/animation/moveblocks/main.cpp
new file mode 100644
index 0000000..f4c754d
--- /dev/null
+++ b/examples/animation/moveblocks/main.cpp
@@ -0,0 +1,274 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore>
+#include <QtGui>
+#if defined(QT_EXPERIMENTAL_SOLUTION)
+#include "qstatemachine.h"
+#include "qabstracttransition.h"
+#include "qanimationstate.h"
+#include "qpropertyanimation.h"
+#include "qsequentialanimationgroup.h"
+#include "qparallelanimationgroup.h"
+#include "qgraphicswidget.h"
+#endif
+#include <time.h>
+
+class StateSwitchEvent: public QEvent
+{
+public:
+ StateSwitchEvent()
+ : QEvent(Type(StateSwitchType))
+ {
+ }
+
+ StateSwitchEvent(int rand)
+ : QEvent(Type(StateSwitchType)),
+ m_rand(rand)
+ {
+ }
+
+ enum { StateSwitchType = QEvent::User + 256 };
+
+ int rand() const { return m_rand; }
+
+private:
+ int m_rand;
+};
+
+
+class QGraphicsRectWidget : public QGraphicsWidget
+{
+public:
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *,
+ QWidget *)
+ {
+ painter->fillRect(rect(), Qt::blue);
+ }
+};
+
+class StateSwitchTransition: public QAbstractTransition
+{
+public:
+ StateSwitchTransition(int rand)
+ : QAbstractTransition(),
+ m_rand(rand)
+ {
+ }
+
+protected:
+ virtual bool eventTest(QEvent *event) const
+ {
+ return (event->type() == QEvent::Type(StateSwitchEvent::StateSwitchType))
+ && (static_cast<StateSwitchEvent *>(event)->rand() == m_rand);
+ }
+
+ virtual void onTransition() {}
+
+private:
+ int m_rand;
+};
+
+class StateSwitcher : public QState
+{
+ Q_OBJECT
+public:
+ StateSwitcher(QStateMachine *machine)
+ : QState(machine->rootState()), m_machine(machine),
+ m_stateCount(0), m_lastIndex(0)
+ { }
+
+ virtual void onEntry()
+ {
+ int n;
+ while ((n = (qrand() % m_stateCount + 1)) == m_lastIndex)
+ { }
+ m_lastIndex = n;
+ m_machine->postEvent(new StateSwitchEvent(n));
+ }
+ virtual void onExit() {}
+
+ void addState(QState *state, QAbstractAnimation *animation) {
+ StateSwitchTransition *trans = new StateSwitchTransition(++m_stateCount);
+ trans->setTargetState(state);
+ addAnimatedTransition(trans, animation);
+ }
+
+
+private:
+ QStateMachine *m_machine;
+ int m_stateCount;
+ int m_lastIndex;
+};
+
+QState *createGeometryState(QObject *w1, const QRect &rect1,
+ QObject *w2, const QRect &rect2,
+ QObject *w3, const QRect &rect3,
+ QObject *w4, const QRect &rect4,
+ QState *parent)
+{
+ QState *result = new QState(parent);
+ result->setPropertyOnEntry(w1, "geometry", rect1);
+ result->setPropertyOnEntry(w1, "geometry", rect1);
+ result->setPropertyOnEntry(w2, "geometry", rect2);
+ result->setPropertyOnEntry(w3, "geometry", rect3);
+ result->setPropertyOnEntry(w4, "geometry", rect4);
+
+ return result;
+}
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+#if 0
+ QWidget window;
+ QPalette palette;
+ palette.setBrush(QPalette::Window, Qt::black);
+ window.setPalette(palette);
+ QPushButton *button1 = new QPushButton("A", &window);
+ QPushButton *button2 = new QPushButton("B", &window);
+ QPushButton *button3 = new QPushButton("C", &window);
+ QPushButton *button4 = new QPushButton("D", &window);
+
+ button1->setObjectName("button1");
+ button2->setObjectName("button2");
+ button3->setObjectName("button3");
+ button4->setObjectName("button4");
+#else
+ QGraphicsRectWidget *button1 = new QGraphicsRectWidget;
+ QGraphicsRectWidget *button2 = new QGraphicsRectWidget;
+ QGraphicsRectWidget *button3 = new QGraphicsRectWidget;
+ QGraphicsRectWidget *button4 = new QGraphicsRectWidget;
+ button2->setZValue(1);
+ button3->setZValue(2);
+ button4->setZValue(3);
+ QGraphicsScene scene(0, 0, 300, 300);
+ scene.setBackgroundBrush(Qt::black);
+ scene.addItem(button1);
+ scene.addItem(button2);
+ scene.addItem(button3);
+ scene.addItem(button4);
+
+ QGraphicsView window(&scene);
+ window.setFrameStyle(0);
+ window.setAlignment(Qt::AlignLeft | Qt::AlignTop);
+ window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ window.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+#endif
+ QStateMachine machine;
+
+ QState *group = new QState();
+ group->setObjectName("group");
+ QTimer timer;
+ timer.setInterval(1250);
+ timer.setSingleShot(true);
+ group->invokeMethodOnEntry(&timer, "start");
+
+ QState *state1;
+ QState *state2;
+ QState *state3;
+ QState *state4;
+ QState *state5;
+ QState *state6;
+ QState *state7;
+
+ state1 = createGeometryState(button1, QRect(100, 0, 50, 50),
+ button2, QRect(150, 0, 50, 50),
+ button3, QRect(200, 0, 50, 50),
+ button4, QRect(250, 0, 50, 50),
+ group);
+ state2 = createGeometryState(button1, QRect(250, 100, 50, 50),
+ button2, QRect(250, 150, 50, 50),
+ button3, QRect(250, 200, 50, 50),
+ button4, QRect(250, 250, 50, 50),
+ group);
+ state3 = createGeometryState(button1, QRect(150, 250, 50, 50),
+ button2, QRect(100, 250, 50, 50),
+ button3, QRect(50, 250, 50, 50),
+ button4, QRect(0, 250, 50, 50),
+ group);
+ state4 = createGeometryState(button1, QRect(0, 150, 50, 50),
+ button2, QRect(0, 100, 50, 50),
+ button3, QRect(0, 50, 50, 50),
+ button4, QRect(0, 0, 50, 50),
+ group);
+ state5 = createGeometryState(button1, QRect(100, 100, 50, 50),
+ button2, QRect(150, 100, 50, 50),
+ button3, QRect(100, 150, 50, 50),
+ button4, QRect(150, 150, 50, 50),
+ group);
+ state6 = createGeometryState(button1, QRect(50, 50, 50, 50),
+ button2, QRect(200, 50, 50, 50),
+ button3, QRect(50, 200, 50, 50),
+ button4, QRect(200, 200, 50, 50),
+ group);
+ state7 = createGeometryState(button1, QRect(0, 0, 50, 50),
+ button2, QRect(250, 0, 50, 50),
+ button3, QRect(0, 250, 50, 50),
+ button4, QRect(250, 250, 50, 50),
+ group);
+ group->setInitialState(state1);
+
+ QParallelAnimationGroup animationGroup;
+ QSequentialAnimationGroup *subGroup;
+
+ QPropertyAnimation *anim = new QPropertyAnimation(button4, "geometry");
+ anim->setDuration(1000);
+ anim->setEasingCurve(QEasingCurve::OutElastic);
+ animationGroup.addAnimation(anim);
+
+ subGroup = new QSequentialAnimationGroup(&animationGroup);
+ subGroup->addPause(100);
+ anim = new QPropertyAnimation(button3, "geometry");
+ anim->setDuration(1000);
+ anim->setEasingCurve(QEasingCurve::OutElastic);
+ subGroup->addAnimation(anim);
+
+ subGroup = new QSequentialAnimationGroup(&animationGroup);
+ subGroup->addPause(150);
+ anim = new QPropertyAnimation(button2, "geometry");
+ anim->setDuration(1000);
+ anim->setEasingCurve(QEasingCurve::OutElastic);
+ subGroup->addAnimation(anim);
+
+ subGroup = new QSequentialAnimationGroup(&animationGroup);
+ subGroup->addPause(200);
+ anim = new QPropertyAnimation(button1, "geometry");
+ anim->setDuration(1000);
+ anim->setEasingCurve(QEasingCurve::OutElastic);
+ subGroup->addAnimation(anim);
+
+ StateSwitcher *stateSwitcher = new StateSwitcher(&machine);
+ stateSwitcher->setObjectName("stateSwitcher");
+ group->addTransition(&timer, SIGNAL(timeout()), stateSwitcher);
+ stateSwitcher->addState(state1, &animationGroup);
+ stateSwitcher->addState(state2, &animationGroup);
+ stateSwitcher->addState(state3, &animationGroup);
+ stateSwitcher->addState(state4, &animationGroup);
+ stateSwitcher->addState(state5, &animationGroup);
+ stateSwitcher->addState(state6, &animationGroup);
+ stateSwitcher->addState(state7, &animationGroup);
+
+ machine.addState(group);
+ machine.setInitialState(group);
+ machine.start();
+
+
+ window.resize(300, 300);
+ window.show();
+
+ qsrand(time(0));
+
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/examples/animation/moveblocks/moveblocks.pro b/examples/animation/moveblocks/moveblocks.pro
new file mode 100644
index 0000000..7a82ca5
--- /dev/null
+++ b/examples/animation/moveblocks/moveblocks.pro
@@ -0,0 +1,8 @@
+# Input
+SOURCES += main.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/animation/moveblocks
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS states.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/animation/moveblocks
+INSTALLS += target sources
diff --git a/examples/animation/padnavigator-ng/backside.ui b/examples/animation/padnavigator-ng/backside.ui
new file mode 100644
index 0000000..afa488c
--- /dev/null
+++ b/examples/animation/padnavigator-ng/backside.ui
@@ -0,0 +1,208 @@
+<ui version="4.0" >
+ <class>BackSide</class>
+ <widget class="QWidget" name="BackSide" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>378</width>
+ <height>385</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>BackSide</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2" >
+ <item>
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Settings</string>
+ </property>
+ <property name="flat" >
+ <bool>true</bool>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Title:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLineEdit" name="hostName" >
+ <property name="text" >
+ <string>Pad Navigator Example</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Modified:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>Extent</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <item>
+ <widget class="QSlider" name="horizontalSlider" >
+ <property name="value" >
+ <number>42</number>
+ </property>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBox" >
+ <property name="value" >
+ <number>42</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QDateTimeEdit" name="dateTimeEdit" />
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2" >
+ <property name="title" >
+ <string>Other input</string>
+ </property>
+ <property name="flat" >
+ <bool>true</bool>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2" >
+ <item>
+ <widget class="QTreeWidget" name="treeWidget" >
+ <column>
+ <property name="text" >
+ <string>Widgets On Graphics View</string>
+ </property>
+ </column>
+ <item>
+ <property name="text" >
+ <string>QGraphicsProxyWidget</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsWidget</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QObject</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>QGraphicsItem</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayoutItem</string>
+ </property>
+ </item>
+ </item>
+ </item>
+ <item>
+ <property name="text" >
+ <string>QGraphicsGridLayout</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayout</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayoutItem</string>
+ </property>
+ </item>
+ </item>
+ </item>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLinearLayout</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayout</string>
+ </property>
+ <item>
+ <property name="text" >
+ <string>QGraphicsLayoutItem</string>
+ </property>
+ </item>
+ </item>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>groupBox</tabstop>
+ <tabstop>hostName</tabstop>
+ <tabstop>dateTimeEdit</tabstop>
+ <tabstop>horizontalSlider</tabstop>
+ <tabstop>spinBox</tabstop>
+ <tabstop>groupBox_2</tabstop>
+ <tabstop>treeWidget</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>horizontalSlider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>spinBox</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>184</x>
+ <y>125</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>275</x>
+ <y>127</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spinBox</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>horizontalSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>272</x>
+ <y>114</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>190</x>
+ <y>126</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/examples/animation/padnavigator-ng/images/artsfftscope.png b/examples/animation/padnavigator-ng/images/artsfftscope.png
new file mode 100644
index 0000000..b4b8775
--- /dev/null
+++ b/examples/animation/padnavigator-ng/images/artsfftscope.png
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/blue_angle_swirl.jpg b/examples/animation/padnavigator-ng/images/blue_angle_swirl.jpg
new file mode 100644
index 0000000..5bf0deb
--- /dev/null
+++ b/examples/animation/padnavigator-ng/images/blue_angle_swirl.jpg
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/kontact_contacts.png b/examples/animation/padnavigator-ng/images/kontact_contacts.png
new file mode 100644
index 0000000..6fb4cc8
--- /dev/null
+++ b/examples/animation/padnavigator-ng/images/kontact_contacts.png
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/kontact_journal.png b/examples/animation/padnavigator-ng/images/kontact_journal.png
new file mode 100644
index 0000000..b1fedb6
--- /dev/null
+++ b/examples/animation/padnavigator-ng/images/kontact_journal.png
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/kontact_mail.png b/examples/animation/padnavigator-ng/images/kontact_mail.png
new file mode 100644
index 0000000..672f8fa
--- /dev/null
+++ b/examples/animation/padnavigator-ng/images/kontact_mail.png
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/kontact_notes.png b/examples/animation/padnavigator-ng/images/kontact_notes.png
new file mode 100644
index 0000000..229bf73
--- /dev/null
+++ b/examples/animation/padnavigator-ng/images/kontact_notes.png
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/kopeteavailable.png b/examples/animation/padnavigator-ng/images/kopeteavailable.png
new file mode 100644
index 0000000..2eaf41a
--- /dev/null
+++ b/examples/animation/padnavigator-ng/images/kopeteavailable.png
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/metacontact_online.png b/examples/animation/padnavigator-ng/images/metacontact_online.png
new file mode 100644
index 0000000..6a398dd
--- /dev/null
+++ b/examples/animation/padnavigator-ng/images/metacontact_online.png
Binary files differ
diff --git a/examples/animation/padnavigator-ng/images/minitools.png b/examples/animation/padnavigator-ng/images/minitools.png
new file mode 100644
index 0000000..0248c9d
--- /dev/null
+++ b/examples/animation/padnavigator-ng/images/minitools.png
Binary files differ
diff --git a/examples/animation/padnavigator-ng/main.cpp b/examples/animation/padnavigator-ng/main.cpp
new file mode 100644
index 0000000..5b35b62
--- /dev/null
+++ b/examples/animation/padnavigator-ng/main.cpp
@@ -0,0 +1,24 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "panel.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Q_INIT_RESOURCE(padnavigator);
+
+ Panel panel(3, 3);
+ panel.show();
+
+ return app.exec();
+}
diff --git a/examples/animation/padnavigator-ng/padnavigator.pro b/examples/animation/padnavigator-ng/padnavigator.pro
new file mode 100644
index 0000000..0d094c6
--- /dev/null
+++ b/examples/animation/padnavigator-ng/padnavigator.pro
@@ -0,0 +1,24 @@
+HEADERS += \
+ panel.h \
+ roundrectitem.h \
+ splashitem.h
+
+SOURCES += \
+ panel.cpp \
+ roundrectitem.cpp \
+ splashitem.cpp \
+ main.cpp
+
+RESOURCES += \
+ padnavigator.qrc
+
+FORMS += \
+ backside.ui
+
+contains(QT_CONFIG, opengl):QT += opengl
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/padnavigator
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS padnavigator.pro images
+sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/padnavigator
+INSTALLS += target sources
diff --git a/examples/animation/padnavigator-ng/padnavigator.qrc b/examples/animation/padnavigator-ng/padnavigator.qrc
new file mode 100644
index 0000000..30ee8e1
--- /dev/null
+++ b/examples/animation/padnavigator-ng/padnavigator.qrc
@@ -0,0 +1,14 @@
+<RCC>
+ <qresource>
+ <file>images/blue_angle_swirl.jpg</file>
+ <file>images/artsfftscope.png</file>
+ <file>images/kontact_contacts.png</file>
+ <file>images/kontact_journal.png</file>
+ <file>images/kontact_mail.png</file>
+ <file>images/kontact_notes.png</file>
+ <file>images/kopeteavailable.png</file>
+ <file>images/metacontact_online.png</file>
+ <file>images/minitools.png</file>
+ <file>images/blue_angle_swirl.jpg</file>
+ </qresource>
+</RCC>
diff --git a/examples/animation/padnavigator-ng/panel.cpp b/examples/animation/padnavigator-ng/panel.cpp
new file mode 100644
index 0000000..94dbdec
--- /dev/null
+++ b/examples/animation/padnavigator-ng/panel.cpp
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include "panel.h"
+#include "roundrectitem.h"
+#include "splashitem.h"
+#include "ui_backside.h"
+
+#ifndef QT_NO_OPENGL
+#include <QtOpenGL/QtOpenGL>
+#else
+#endif
+#include <QtGui/QtGui>
+
+Panel::Panel(int width, int height)
+ : selectedIndex(0),
+ grid(width*height),
+ width(width),
+ height(height),
+ flipped(false),
+ flippingGroup(0),
+ rotationXanim(0),
+ rotationYanim(0)
+{
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ setCacheMode(CacheBackground);
+ setViewportUpdateMode(FullViewportUpdate);
+ setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
+ setBackgroundBrush(QPixmap(":/images/blue_angle_swirl.jpg"));
+#ifndef QT_NO_OPENGL
+ setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
+#endif
+
+ QRectF bounds((-width / 2.0) * 150, (-height / 2.0) * 150, width * 150, height * 150);
+
+ setScene(new QGraphicsScene(bounds, this));
+
+ baseItem = new RoundRectItem(bounds, QColor(226, 255, 92, 64));
+ scene()->addItem(baseItem);
+
+ QWidget *embed = new QWidget;
+ ui = new Ui_BackSide;
+ ui->setupUi(embed);
+ ui->hostName->setFocus();
+
+ backItem = new RoundRectItem(bounds, embed->palette().window(), embed);
+ backItem->setYRotation(180);
+ backItem->setParentItem(baseItem);
+
+ selectionItem = new RoundRectItem(QRectF(-60, -60, 120, 120), Qt::gray);
+ selectionItem->setParentItem(baseItem);
+ selectionItem->setZValue(-1);
+ selectionItem->setPos(posForLocation(0));
+
+ int currentIndex = 0;
+ for (int y = 0; y < height; ++y) {
+ for (int x = 0; x < width; ++x) {
+ RoundRectItem *item = new RoundRectItem(QRectF(-54, -54, 108, 108),
+ QColor(214, 240, 110, 128));
+ item->setPos(posForLocation(currentIndex));
+
+ item->setParentItem(baseItem);
+ item->setFlag(QGraphicsItem::ItemIsFocusable);
+ grid[currentIndex++] = item;
+
+ switch (qrand() % 9) {
+ case 0: item->setPixmap(QPixmap(":/images/kontact_contacts.png")); break;
+ case 1: item->setPixmap(QPixmap(":/images/kontact_journal.png")); break;
+ case 2: item->setPixmap(QPixmap(":/images/kontact_notes.png")); break;
+ case 3: item->setPixmap(QPixmap(":/images/kopeteavailable.png")); break;
+ case 4: item->setPixmap(QPixmap(":/images/metacontact_online.png")); break;
+ case 5: item->setPixmap(QPixmap(":/images/minitools.png")); break;
+ case 6: item->setPixmap(QPixmap(":/images/kontact_journal.png")); break;
+ case 7: item->setPixmap(QPixmap(":/images/kontact_contacts.png")); break;
+ case 8: item->setPixmap(QPixmap(":/images/kopeteavailable.png")); break;
+ default:
+ break;
+ }
+
+ connect(item, SIGNAL(activated()), this, SLOT(flip()));
+ }
+ }
+
+ grid.first()->setFocus();
+
+ connect(backItem, SIGNAL(activated()),
+ this, SLOT(flip()));
+
+ splash = new SplashItem;
+ splash->setZValue(5);
+ splash->setPos(-splash->rect().width() / 2, scene()->sceneRect().top());
+ scene()->addItem(splash);
+
+ splash->grabKeyboard();
+
+ //initialize the position
+ baseItem->setYRotation(selectionItem->x()/6.);
+ baseItem->setXRotation(selectionItem->y()/6.);
+
+ setWindowTitle(tr("Pad Navigator Example"));
+}
+
+Panel::~Panel()
+{
+}
+
+void Panel::keyPressEvent(QKeyEvent *event)
+{
+ if (splash->isVisible() || event->key() == Qt::Key_Return || flipped) {
+ QGraphicsView::keyPressEvent(event);
+ return;
+ }
+
+ selectedIndex = (selectedIndex + grid.count() + (event->key() == Qt::Key_Right) - (event->key() == Qt::Key_Left)
+ + width * ((event->key() == Qt::Key_Down) - (event->key() == Qt::Key_Up))) % grid.count();
+ grid[selectedIndex]->setFocus();
+
+ const QPointF pos = posForLocation(selectedIndex);
+
+ const double angleY = pos.x() / 6.,
+ angleX = pos.y() / 6.;
+
+ QAnimationGroup *group = new QParallelAnimationGroup();
+
+ QVariantAnimation *anim = new QPropertyAnimation(baseItem, "xRotation");
+ anim->setEndValue(angleX);
+ anim->setDuration(150);
+ anim->setEasingCurve(QEasingCurve::OutInSine);
+ group->addAnimation(anim);
+
+ anim = new QPropertyAnimation(baseItem, "yRotation");
+ anim->setEndValue(angleY);
+ anim->setDuration(150);
+ anim->setEasingCurve(QEasingCurve::OutInSine);
+ group->addAnimation(anim);
+
+ anim = new QPropertyAnimation(selectionItem, "pos");
+ anim->setEndValue(pos);
+ anim->setDuration(150);
+ anim->setEasingCurve(QEasingCurve::Linear);
+ group->addAnimation(anim);
+
+ group->start(QAbstractAnimation::DeleteWhenStopped);
+}
+
+void Panel::resizeEvent(QResizeEvent *event)
+{
+ QGraphicsView::resizeEvent(event);
+ fitInView(scene()->sceneRect(), Qt::KeepAspectRatio);
+}
+
+void Panel::flip()
+{
+ grid[selectedIndex]->setFocus();
+
+ if (flippingGroup == 0) {
+ flippingGroup = new QParallelAnimationGroup(this);
+
+ const qreal zoomOut = qreal(.75);
+
+ //slight scaling down while flipping
+ QVariantAnimation *anim = new QPropertyAnimation(baseItem, "yScale");
+ anim->setKeyValueAt(qreal(.5), zoomOut);
+ anim->setEndValue(1);
+ anim->setEasingCurve(QEasingCurve::OutInSine);
+ anim->setDuration(500);
+ flippingGroup->addAnimation(anim);
+
+ anim = new QPropertyAnimation(baseItem, "xScale");
+ anim->setKeyValueAt(qreal(.5), zoomOut);
+ anim->setEndValue(1);
+ anim->setEasingCurve(QEasingCurve::OutInSine);
+ anim->setDuration(500);
+ flippingGroup->addAnimation(anim);
+
+ rotationXanim = new QPropertyAnimation(baseItem, "xRotation");
+ rotationXanim->setEndValue(0);
+ rotationXanim->setDuration(500);
+ flippingGroup->addAnimation(rotationXanim);
+
+ rotationYanim = new QPropertyAnimation(baseItem, "yRotation");
+ rotationYanim->setEndValue(180);
+ rotationYanim->setDuration(500);
+ flippingGroup->addAnimation(rotationYanim);
+ }
+
+ if (flippingGroup->currentTime() != 0 && flippingGroup->direction() == QAbstractAnimation::Forward) {
+ flippingGroup->setDirection(QAbstractAnimation::Backward);
+ } else {
+ flippingGroup->setDirection(QAbstractAnimation::Forward);
+ if (flippingGroup->currentTime() == 0) {
+ //we always make sure when it is at the beginning
+ rotationXanim->setStartValue(baseItem->xRotation());
+ rotationYanim->setStartValue(baseItem->yRotation());
+ }
+ }
+ flippingGroup->start();
+ flipped = !flipped;
+}
+
+QPointF Panel::posForLocation(int index) const
+{
+ const int x = index % width,
+ y = index / width;
+ return QPointF(x * 150, y * 150)
+ - QPointF((width - 1) * 75, (height - 1) * 75);
+}
diff --git a/examples/animation/padnavigator-ng/panel.h b/examples/animation/padnavigator-ng/panel.h
new file mode 100644
index 0000000..cbceed1
--- /dev/null
+++ b/examples/animation/padnavigator-ng/panel.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/qgraphicsview.h>
+#ifdef QT_EXPERIMENTAL_SOLUTION
+#include "qtgraphicswidget.h"
+#else
+#include <QtGui/qgraphicswidget.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+class Ui_BackSide;
+QT_END_NAMESPACE;
+
+class RoundRectItem;
+class QAnimationGroup;
+class QPropertyAnimation;
+
+class Panel : public QGraphicsView
+{
+ Q_OBJECT
+public:
+ Panel(int width, int height);
+ ~Panel();
+
+protected:
+ void keyPressEvent(QKeyEvent *event);
+ void resizeEvent(QResizeEvent *event);
+
+private Q_SLOTS:
+ void flip();
+
+private:
+ QPointF posForLocation(int index) const;
+
+ QGraphicsWidget *selectionItem;
+ QGraphicsWidget *baseItem;
+ RoundRectItem *backItem;
+ QGraphicsWidget *splash;
+ int selectedIndex;
+
+ QVector<QGraphicsItem*> grid;
+
+ int width;
+ int height;
+ bool flipped;
+ Ui_BackSide *ui;
+
+ QAnimationGroup *flippingGroup;
+ QPropertyAnimation *rotationXanim, *rotationYanim;
+};
diff --git a/examples/animation/padnavigator-ng/roundrectitem.cpp b/examples/animation/padnavigator-ng/roundrectitem.cpp
new file mode 100644
index 0000000..e498538
--- /dev/null
+++ b/examples/animation/padnavigator-ng/roundrectitem.cpp
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include "roundrectitem.h"
+
+#include <QtGui/QtGui>
+
+RoundRectItem::RoundRectItem(const QRectF &rect, const QBrush &brush, QWidget *embeddedWidget)
+ : QGraphicsWidget(),
+ brush(brush),
+ proxyWidget(0),
+ m_rect(rect)
+{
+ if (embeddedWidget) {
+ proxyWidget = new QGraphicsProxyWidget(this);
+ proxyWidget->setFocusPolicy(Qt::StrongFocus);
+ proxyWidget->setWidget(embeddedWidget);
+ }
+}
+
+void RoundRectItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ const bool widgetHidden = parentItem() == 0 || qAbs(static_cast<QGraphicsWidget*>(parentItem())->yRotation()) < 90;
+
+ if (proxyWidget) {
+ if (widgetHidden) {
+ proxyWidget->hide();
+ } else {
+ if (!proxyWidget->isVisible()) {
+ proxyWidget->setGeometry(boundingRect().adjusted(25, 25, -25, -25));
+ proxyWidget->show();
+ proxyWidget->setFocus();
+ }
+ painter->setBrush(brush);
+ painter->setPen(QPen(Qt::black, 1));
+ painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
+ painter->drawRoundRect(m_rect);
+ }
+ } else if (widgetHidden) {
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(QColor(0, 0, 0, 64));
+ painter->drawRoundRect(m_rect.translated(2, 2));
+
+ QLinearGradient gradient(m_rect.topLeft(), m_rect.bottomRight());
+ const QColor col = brush.color();
+ gradient.setColorAt(0, col);
+ gradient.setColorAt(1, col.dark(200));
+ painter->setBrush(gradient);
+ painter->setPen(QPen(Qt::black, 1));
+ painter->drawRoundRect(m_rect);
+ if (!pix.isNull()) {
+ painter->scale(qreal(1.95), qreal(1.95));
+ painter->drawPixmap(-pix.width() / 2, -pix.height() / 2, pix);
+ }
+ }
+
+}
+
+QRectF RoundRectItem::boundingRect() const
+{
+ qreal penW = qreal(.5);
+ qreal shadowW = 2;
+ return m_rect.adjusted(-penW, -penW, penW + shadowW, penW + shadowW);
+}
+
+void RoundRectItem::setPixmap(const QPixmap &pixmap)
+{
+ pix = pixmap;
+ if (scene() && isVisible())
+ update();
+}
+
+void RoundRectItem::keyPressEvent(QKeyEvent *event)
+{
+ if (event->isAutoRepeat() || event->key() != Qt::Key_Return) {
+ QGraphicsWidget::keyPressEvent(event);
+ return;
+ }
+
+ if (!proxyWidget) {
+ setXScale(qreal(.9));
+ setYScale(qreal(.9));
+ }
+ emit activated();
+}
+
+void RoundRectItem::keyReleaseEvent(QKeyEvent *event)
+{
+ if (event->isAutoRepeat() || event->key() != Qt::Key_Return) {
+ QGraphicsWidget::keyReleaseEvent(event);
+ return;
+ }
+
+ if (!proxyWidget) {
+ setXScale(1);
+ setYScale(1);
+ }
+}
diff --git a/examples/animation/padnavigator-ng/roundrectitem.h b/examples/animation/padnavigator-ng/roundrectitem.h
new file mode 100644
index 0000000..56a6d3c
--- /dev/null
+++ b/examples/animation/padnavigator-ng/roundrectitem.h
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qobject.h>
+#include <QtGui/qbrush.h>
+#ifdef QT_EXPERIMENTAL_SOLUTION
+#include "qtgraphicswidget.h"
+#else
+#include <QtGui/qgraphicswidget.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+class QGraphicsProxyWidget;
+QT_END_NAMESPACE;
+
+class RoundRectItem : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ RoundRectItem(const QRectF &rect, const QBrush &brush, QWidget *embeddedWidget = 0);
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
+ QRectF boundingRect() const;
+
+ void setPixmap(const QPixmap &pixmap);
+
+Q_SIGNALS:
+ void activated();
+
+protected:
+ void keyPressEvent(QKeyEvent *event);
+ void keyReleaseEvent(QKeyEvent *event);
+
+private:
+ QRectF m_rect;
+ QBrush brush;
+ QPixmap pix;
+ QGraphicsProxyWidget *proxyWidget;
+};
diff --git a/examples/animation/padnavigator-ng/splashitem.cpp b/examples/animation/padnavigator-ng/splashitem.cpp
new file mode 100644
index 0000000..84a8945
--- /dev/null
+++ b/examples/animation/padnavigator-ng/splashitem.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include "splashitem.h"
+
+#include <QtGui/QtGui>
+
+SplashItem::SplashItem(QGraphicsItem *parent)
+ : QGraphicsWidget(parent)
+{
+
+ text = tr("Welcome to the Pad Navigator Example. You can use the"
+ " keyboard arrows to navigate the icons, and press enter"
+ " to activate an item. Please press any key to continue.");
+ resize(400, 175);
+}
+
+void SplashItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ painter->setPen(QPen(Qt::black, 2));
+ painter->setBrush(QColor(245, 245, 255, 220));
+ painter->setClipRect(rect());
+ painter->drawRoundRect(3, -100 + 3, 400 - 6, 250 - 6);
+
+ QRectF textRect = rect().adjusted(10, 10, -10, -10);
+ int flags = Qt::AlignTop | Qt::AlignLeft | Qt::TextWordWrap;
+
+ QFont font;
+ font.setPixelSize(18);
+ painter->setPen(Qt::black);
+ painter->setFont(font);
+ painter->drawText(textRect, flags, text);
+}
+
+void SplashItem::keyPressEvent(QKeyEvent * /* event */)
+{
+ QVariantAnimation *anim = new QPropertyAnimation(this, "pos");
+ anim->setEndValue(QPointF(x(), scene()->sceneRect().top() - rect().height()));
+ anim->setDuration(350);
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+
+ anim = new QPropertyAnimation(this, "opacity");
+ anim->setEndValue(0);
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+
+ connect(anim, SIGNAL(finished()), SLOT(close()));
+}
diff --git a/examples/animation/padnavigator-ng/splashitem.h b/examples/animation/padnavigator-ng/splashitem.h
new file mode 100644
index 0000000..6428b69
--- /dev/null
+++ b/examples/animation/padnavigator-ng/splashitem.h
@@ -0,0 +1,31 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qobject.h>
+#ifdef QT_EXPERIMENTAL_SOLUTION
+#include "qtgraphicswidget.h"
+#else
+#include <QtGui/qgraphicswidget.h>
+#endif
+
+class SplashItem : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ SplashItem(QGraphicsItem *parent = 0);
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+protected:
+ void keyPressEvent(QKeyEvent *event);
+
+private:
+ QString text;
+};
diff --git a/examples/animation/photobrowser/main.cpp b/examples/animation/photobrowser/main.cpp
new file mode 100644
index 0000000..98f2a9e
--- /dev/null
+++ b/examples/animation/photobrowser/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "river.h"
+#include "menu.h"
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ if (app.arguments().size() == 1) {
+ qWarning("you have to specifiy a path to look for the photos");
+ return 0;
+ }
+
+
+ QGraphicsScene scene;
+ scene.setSceneRect(QRectF(QPointF(), River::fixedSize()));
+
+ QGraphicsView view(&scene);
+ view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+ const int fw = view.frameWidth() * 2;
+ view.setFixedSize(River::fixedSize() + QSize(fw,fw));
+
+ River river(app.arguments()[1]);
+ scene.addItem(&river);
+
+ Menu menu(&river);
+ menu.addAction(QLatin1String("River Mode"), &river, SLOT(setRiverMode()));
+ menu.addAction(QLatin1String("Grid Mode"), &river, SLOT(setGridMode()));
+ menu.addAction(QLatin1String("Cover Flow"), &river, SLOT(setCoverMode()));
+ menu.addAction(QLatin1String("Hide Menu"), &menu, SLOT(hide()));
+ menu.addAction(QLatin1String("Exit"), &app, SLOT(quit()));
+ menu.setZValue(2);
+ menu.setFocus();
+
+ river.menu = &menu;
+ view.show();
+
+ return app.exec();
+}
diff --git a/examples/animation/photobrowser/menu.cpp b/examples/animation/photobrowser/menu.cpp
new file mode 100644
index 0000000..d4efe9c
--- /dev/null
+++ b/examples/animation/photobrowser/menu.cpp
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include "menu.h"
+
+Menu::Menu(QGraphicsItem *parent) : QGraphicsWidget(parent), m_selected(0)
+{
+ setFlag(QGraphicsItem::ItemIsFocusable);
+ m_selection = new QGraphicsRectItem(this);
+ QLinearGradient linearGrad(QPointF(0, 0), QPointF(0,50));
+ linearGrad.setColorAt(0, QColor(255,255,255,128));
+ linearGrad.setColorAt(1, QColor(255,255,255,16));
+ m_selection->setBrush(linearGrad);
+ m_selection->setPen(QPen(Qt::transparent));
+}
+
+Menu::~Menu()
+{
+}
+
+
+MenuAction *Menu::addAction(const QString &text, QObject *receiver, const char* slot)
+{
+ MenuAction *action = new MenuAction(text, this);
+ if (!m_actions.isEmpty()) {
+ MenuAction *last = m_actions.last();
+ action->setPos(last->pos() + last->boundingRect().bottomLeft());
+ }
+ m_actions.append(action);
+ if (m_selection->boundingRect().width() < action->boundingRect().width())
+ m_selection->setRect(action->boundingRect());
+
+ QObject::connect(action, SIGNAL(triggered()), receiver, slot);
+ return action;
+}
+
+QRectF Menu::boundingRect() const
+{
+ QRectF res;
+ foreach (MenuAction *a, m_actions)
+ res |= a->boundingRect();
+ return res;
+}
+
+void Menu::keyPressEvent (QKeyEvent * event)
+{
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ hide();
+ break;
+ case Qt::Key_Up:
+ m_selected -= 2;
+ case Qt::Key_Down:
+ if (!m_actions.isEmpty()) {
+ m_selected = (m_selected + 1 + m_actions.count()) % m_actions.count();
+ QItemAnimation *anim = new QItemAnimation(m_selection, QItemAnimation::Position);
+ anim->setEndValue(m_actions.at(m_selected)->pos());
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ }
+ break;
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ if (!m_actions.isEmpty()) {
+ QItemAnimation *anim = new QItemAnimation(m_selection, QItemAnimation::RotationX);
+ anim->setEndValue(m_selection->xRotation() < 180 ? qreal(360) : qreal(0));
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ m_actions.at(m_selected)->trigger();
+ hide();
+ }
+ break;
+ default:
+ QGraphicsItem::keyPressEvent(event);
+ }
+}
+
+void Menu::show()
+{
+ QItemAnimation *anim = new QItemAnimation(this, QItemAnimation::Opacity);
+ anim->setEndValue(qreal(1.));
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ anim = new QItemAnimation(m_selection, QItemAnimation::ScaleFactorX);
+ anim->setEndValue(qreal(1));
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ anim = new QItemAnimation(m_selection, QItemAnimation::ScaleFactorY);
+ anim->setEndValue(qreal(1));
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ setFocus();
+}
+
+void Menu::hide()
+{
+ QItemAnimation *anim = new QItemAnimation(m_selection, QItemAnimation::ScaleFactorX);
+ anim->setEndValue(qreal(.1));
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ anim = new QItemAnimation(m_selection, QItemAnimation::ScaleFactorY);
+ anim->setEndValue(qreal(.1));
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ anim = new QItemAnimation(this, QItemAnimation::Opacity);
+ anim->setEndValue(qreal(0));
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ parentItem()->setFocus();
+}
+
+
+MenuAction::MenuAction(const QString &text, Menu * parent)
+ : QGraphicsTextItem(text,parent)
+{
+ QFont f = font();
+ f.setPointSize(18);
+ setFont(f);
+ setDefaultTextColor(Qt::white);
+}
+
+void MenuAction::trigger()
+{
+ emit triggered();
+}
diff --git a/examples/animation/photobrowser/menu.h b/examples/animation/photobrowser/menu.h
new file mode 100644
index 0000000..9514cfe
--- /dev/null
+++ b/examples/animation/photobrowser/menu.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __MENU__H__
+#define __MENU__H__
+
+#include <QtGui>
+
+class MenuAction;
+
+class Menu : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ Menu(QGraphicsItem *parent);
+ ~Menu();
+
+ MenuAction *addAction(const QString&, QObject *receiver = 0, const char* slot = 0 );
+
+ QRectF boundingRect() const;
+ void keyPressEvent ( QKeyEvent * event );
+public slots:
+ void show();
+ void hide();
+private:
+ QList<MenuAction*> m_actions;
+ QGraphicsRectItem *m_selection;
+ int m_selected;
+};
+
+class MenuAction : public QGraphicsTextItem
+{
+ Q_OBJECT
+public:
+ MenuAction(const QString &text, Menu * parent);
+ void trigger();
+signals:
+ void triggered();
+};
+
+
+#endif //__RIVERITEM__H__
diff --git a/examples/animation/photobrowser/photobrowser.pro b/examples/animation/photobrowser/photobrowser.pro
new file mode 100644
index 0000000..21f03d6
--- /dev/null
+++ b/examples/animation/photobrowser/photobrowser.pro
@@ -0,0 +1,17 @@
+######################################################################
+# Automatically generated by qmake (2.01a) ven. 22. août 13:09:33 2008
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+SOURCES += main.cpp \
+ river.cpp \
+ riveritem.cpp \
+ menu.cpp
+HEADERS += river.h \
+ riveritem.h \
+ menu.h
diff --git a/examples/animation/photobrowser/river.cpp b/examples/animation/photobrowser/river.cpp
new file mode 100644
index 0000000..f3dd0746
--- /dev/null
+++ b/examples/animation/photobrowser/river.cpp
@@ -0,0 +1,561 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include "river.h"
+#include "riveritem.h"
+
+#include "qvariantanimation.h"
+
+#include <QtCore/QDebug>
+#include <QtGui/QKeyEvent>
+#include <QtGui/QGraphicsScene>
+#include <QtGui/QPainter>
+
+
+#define GRID_ROW_COUNT 3
+#define GRID_COLUMN_COUNT 2
+#define GRID_DIMENSIONS (GRID_ROW_COUNT * GRID_COLUMN_COUNT)
+#define ITEM_COUNT 12
+
+#define RIVER_MAGNIFY(ITEM) (qreal(0.50) + (ITEM)->zValue()*2 )
+#define GRID_MAGNIFY qreal(1.5)
+#define GRID_CURRENT_MAGNIFY 2
+
+River::River(const QString &path) :
+m_images(QDir(path).entryInfoList(QStringList() << QLatin1String("*.jpg") << QLatin1String("*.png"))),
+m_currentImage(0), m_mode(RiverMode), m_selectedItem(-1) , m_topLeftIndex(-1)
+{
+ setFocusPolicy(Qt::StrongFocus);
+ setGeometry(QRectF( QPointF(), fixedSize()));
+
+
+ for (int i = 0; i < ITEM_COUNT; ++i) {
+ RiverItem * item = new RiverItem(this);
+
+ //here we also randomize the x position (not when looping)
+ const int x = qrand() % fixedSize().width();
+ item->setPos(x, -1);
+
+ m_items.insert(m_currentImage, item);
+ addUnusedRiverItem(item);
+ }
+
+}
+
+QPointF River::gridItemPosition(int row, int col) const
+{
+ if (col < 0) {
+ col += GRID_COLUMN_COUNT;
+ row --;
+ }
+ return QPointF(rect().width()*(col*2 + 1)/(GRID_COLUMN_COUNT*2),
+ rect().height()*(row*2 + 1)/(GRID_ROW_COUNT*2));
+}
+
+QPixmap River::pixmap(int index) const
+{
+ if (index < 0 || index >= m_images.size())
+ return QPixmap();
+
+ if (m_pixmaps.size() <= index) {
+ m_pixmaps.resize(index+1);
+ }
+
+ if (m_pixmaps.at(index).isNull()) {
+ m_pixmaps[index] = QPixmap(m_images.at(index).absoluteFilePath());
+ }
+
+ return m_pixmaps.at(index);
+}
+
+void River::addUnusedRiverItem(RiverItem * item)
+{
+ if (m_images.isEmpty())
+ return;
+
+ QRectF realItemRect = item->mapToParent(item->boundingRect()).boundingRect();
+
+ int y = item->pos().y();
+ int x = item->pos().x();
+ if (x >= fixedSize().width() || x < -realItemRect.width() || y < 0) {
+ //we set the new pixmap
+
+ m_items.remove(m_items.key(item));
+
+ while (m_items.contains(m_currentImage))
+ m_currentImage = (m_currentImage + 1 ) % m_images.size();
+
+ item->setPixmap(pixmap(m_currentImage));
+
+ m_items.insert(m_currentImage, item);
+ //this manages looping as well
+ m_currentImage = (m_currentImage + 1 ) % m_images.size();
+
+ item->setZValue(qreal(qrand()%100)/200.0);
+
+ QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
+ anim->setEndValue(RIVER_MAGNIFY(item));
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
+ anim->setEndValue(RIVER_MAGNIFY(item));
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+
+ realItemRect = item->mapToParent(item->boundingRect()).boundingRect();
+
+ y = -realItemRect.y() + qrand() % (fixedSize().height() - int(realItemRect.height()));
+ if (x >= fixedSize().width()) {
+ x = -realItemRect.width()/2;
+ }
+ }
+
+ item->setPos(x, y);
+
+ const QPointF target(QPointF(fixedSize().width() + realItemRect.width()/2, y));
+
+ const int distance = target.x() - x;
+
+ const int duration = (40 - 50*item->zValue() ) * distance;
+ QItemAnimation *a = new QItemAnimation(item, QItemAnimation::Position, scene());
+ a->setEndValue(target);
+ a->setDuration(duration);
+ a->start(QAbstractAnimation::DeleteWhenStopped);
+ connect(a, SIGNAL(finished()), SLOT(animationFinished()));
+}
+
+void River::animationFinished()
+{
+ QItemAnimation *anim = qobject_cast<QItemAnimation*>(sender());
+ if (!anim || anim->propertyName() != QItemAnimation::Position)
+ return;
+
+ /*RiverItem *item = static_cast<RiverItem*>(anim->graphicsItem());
+ if (m_mode != RiverMode) {*/
+ /*int key = m_items.key(item);
+ if (key < m_topLeftIndex || key >= m_topLeftIndex + GRID_DIMENSIONS) {
+ delete item;
+ m_items.remove(key);
+ }*/
+ //return;
+
+ //}
+
+ addUnusedRiverItem(static_cast<RiverItem*>(anim->targetItem()));
+}
+
+void River::switchPaused()
+{
+ const bool paused = m_pausedAnimations.isEmpty();
+ if (paused)
+ m_pausedAnimations = scene()->findChildren<QItemAnimation*>();
+
+ foreach(QItemAnimation *anim, m_pausedAnimations) {
+ if (paused)
+ anim->pause();
+ else
+ anim->resume();
+ }
+
+ if (!paused)
+ m_pausedAnimations.clear();
+}
+
+void River::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
+{
+ painter->fillRect(option->rect, Qt::black);
+}
+
+void River::setMode(Mode m)
+{
+ if (m_mode == m)
+ return;
+
+ Mode oldMode = m_mode;
+ m_mode = m;
+ switch(m)
+ {
+ case RiverMode:
+ m_mode = oldMode; //some animation may be stopt, and we don't want that animationFinished we were in that mode yet
+ foreach (RiverItem *item, m_items) {
+ const int x = qrand() % fixedSize().width();
+ const int y = qrand() % fixedSize().width();
+ QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
+ anim->setEndValue(RIVER_MAGNIFY(item));
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
+ anim->setEndValue(RIVER_MAGNIFY(item));
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ anim = new QItemAnimation(item, QItemAnimation::Position, scene());
+ anim->setEndValue(QPointF(x, y));
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ connect(anim, SIGNAL(finished()), SLOT(animationFinished()));
+ }
+ m_mode = m;
+ break;
+
+ case GridMode:
+
+ if (oldMode == GridFullScreenMode) {
+ currentItem()->setFullScreen(false, GRID_CURRENT_MAGNIFY);
+ } else {
+ m_topLeftIndex = -GRID_DIMENSIONS;
+ foreach (RiverItem *item, m_items) {
+ QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
+ anim->setEndValue(GRID_MAGNIFY);
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
+ anim->setEndValue(GRID_MAGNIFY);
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ }
+ adjustGrid(m_currentImage - GRID_DIMENSIONS + 1);
+ setCurrentItem(m_topLeftIndex);
+ }
+ break;
+ case GridFullScreenMode:
+ //let's put the current item fullscreen
+ currentItem()->setFullScreen(true, GRID_CURRENT_MAGNIFY);
+ break;
+ case CoverMode:
+ m_gridItem = m_items.values();
+ setCurrentItem(m_gridItem.count()/2);
+ default:
+ break;
+ }
+}
+
+River::Mode River::mode() const
+{
+ return m_mode;
+}
+
+QSize River::fixedSize()
+{
+ return QSize(352, 416);
+}
+
+//the name of this method is not that good...
+void River::makeCenterAvailable(qreal size)
+{
+ QRectF center(QPointF(), QSizeF(size, size));
+ center.moveCenter(rect().center());
+
+ const QList<QGraphicsItem*> list = scene()->items(center);
+
+ foreach(QGraphicsItem *item, m_items) {
+
+ if (!list.contains(item))
+ continue;
+
+ QPointF pos = item->pos();
+
+ if (pos.y() < rect().center().y()) {
+ //item is above center
+ pos.ry() = center.top() - item->boundingRect().height() - 1;
+ } else {
+ //item is below the center
+ pos.ry() = center.bottom() + 1;
+ }
+ QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::Position, scene());
+ anim->setEndValue(pos);
+ anim->setDuration(150);
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ }
+}
+
+
+//this is there just to test small interaction
+void River::keyPressEvent ( QKeyEvent * keyEvent )
+{
+ switch(keyEvent->key())
+ {
+ case Qt::Key_O:
+ {
+ QItemAnimation *anim = new QItemAnimation(this, QItemAnimation::Opacity, scene());
+ anim->setDuration(2000);
+ anim->setEndValue(qreal(.5));
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ }
+ break;
+ case Qt::Key_N:
+ //that's a test
+ makeCenterAvailable(60);
+ break;
+ case Qt::Key_P:
+ switchPaused();
+ break;
+ case Qt::Key_V:
+ setMode(GridMode);
+ break;
+ case Qt::Key_R:
+ setMode(RiverMode);
+ break;
+ case Qt::Key_C:
+ setMode(CoverMode);
+ break;
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
+ if (m_mode == RiverMode) {
+ setMode(GridMode);
+ } else if (m_mode == GridMode) {
+ setMode(GridFullScreenMode);
+ } else if (m_mode == GridFullScreenMode) {
+ setMode(GridMode);
+ }
+ break;
+ case Qt::Key_Escape:
+ if (m_mode == GridFullScreenMode) {
+ setMode(GridMode);
+ } else if (m_mode == GridMode || m_mode == CoverMode) {
+ setMode(RiverMode);
+ } else if (m_mode == RiverMode) {
+ menu->show();
+ }
+ break;
+ case Qt::Key_Right:
+ if (m_mode == GridMode) {
+ navigateBy(+1);
+ } else if (m_mode == CoverMode) {
+ setCurrentItem(m_selectedItem + 1);
+ }
+ break;
+ case Qt::Key_Left:
+ if (m_mode == GridMode) {
+ navigateBy(-1);
+ } else if (m_mode == CoverMode) {
+ setCurrentItem(m_selectedItem - 1);
+ }
+ break;
+ case Qt::Key_Down:
+ if (m_mode == GridMode) {
+ navigateBy(GRID_COLUMN_COUNT);
+ }
+ break;
+ case Qt::Key_Up:
+ if (m_mode == GridMode) {
+ navigateBy(-GRID_COLUMN_COUNT);
+ }
+ break;
+// case Qt::Key_PageUp:
+ case Qt::Key_M:
+ menu->show();
+ break;
+ case Qt::Key_Space:
+ if (m_mode == GridMode) {
+ RiverItem *item = currentItem();
+ if(!item)
+ break;
+
+ //stupid sequence.
+ QPointF pos = item->pos();
+ QAnimationGroup *group = new QSequentialAnimationGroup();
+ //item->animator()->beginSequence();
+
+ QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::Position, scene());
+ anim->setEndValue(pos);
+ group->addAnimation(anim);
+ anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
+ anim->setEndValue(qreal(1.));
+ anim->setDuration(500);
+ group->addAnimation(anim);
+ anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
+ anim->setEndValue(qreal(1.));
+ anim->setDuration(500);
+ group->addAnimation(anim);
+ anim = new QItemAnimation(item, QItemAnimation::RotationX, scene());
+ anim->setEndValue(qreal(0));
+ group->addAnimation(anim);
+ group->start(QAbstractAnimation::DeleteWhenStopped);
+ }
+ default:
+ break;
+ }
+
+ QGraphicsItem::keyPressEvent(keyEvent);
+}
+
+
+void River::setGridMode()
+{
+ setMode(GridMode);
+}
+
+void River::setRiverMode()
+{
+ setMode(RiverMode);
+}
+
+void River::setCoverMode()
+{
+ setMode(CoverMode);
+}
+
+
+void River::adjustGrid(int newTopLeft)
+{
+ for (int i = newTopLeft ; i < newTopLeft + GRID_DIMENSIONS; i++) {
+ if (!m_items.contains(i)) {
+ RiverItem *item = createItem(i);
+ int row = (i - m_topLeftIndex) / GRID_COLUMN_COUNT;
+ int col = (i - m_topLeftIndex) % GRID_COLUMN_COUNT;
+ item->setPos(gridItemPosition(row, col));
+ item->setXScale(0);
+ item->setYScale(0);
+ QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
+ anim->setEndValue(GRID_MAGNIFY);
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
+ anim->setEndValue(GRID_MAGNIFY);
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ }
+ }
+ newTopLeft = newTopLeft - newTopLeft % GRID_COLUMN_COUNT;
+
+ QHash<int, RiverItem *>::iterator it = m_items.begin();
+ while (it != m_items.constEnd()) {
+ const int imageIdx = it.key();
+ RiverItem *item = *it;
+ QSizeF itemSize = item->boundingRect().size();
+ if ((imageIdx >= newTopLeft && imageIdx < newTopLeft + GRID_DIMENSIONS)
+ || boundingRect().adjusted(-itemSize.width()/2, -itemSize.height()/2, itemSize.width()/2, itemSize.height()/2)
+ .contains(item->pos())) {
+ int row = (imageIdx-newTopLeft) / GRID_COLUMN_COUNT;
+ int col = (imageIdx-newTopLeft) % GRID_COLUMN_COUNT;
+ QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::Position, scene());
+ anim->setEndValue(gridItemPosition(row, col));
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ ++it;
+ } else {
+ ++it; /* ### ideally we should remove the items, but this cause the photobrowser to crash
+ because the QItemAnimations are not notified the item is deleted
+ delete item;
+ it = m_items.erase(it);
+ */
+ }
+ }
+
+ m_topLeftIndex = newTopLeft;
+}
+
+
+RiverItem *River::createItem(int imageIndex)
+{
+ Q_ASSERT(!m_items.contains(imageIndex));
+ RiverItem * item = new RiverItem(this);
+ item->setPixmap(pixmap(imageIndex));
+ m_items.insert(imageIndex,item);
+ return item;
+}
+
+void River::setCurrentItem(int newCurrentItem)
+{
+ if (m_mode == CoverMode)
+ {
+ m_selectedItem = newCurrentItem;
+ for (int i = 0; i < m_gridItem.count(); i++) {
+ QVariantAnimation *anim;
+ RiverItem *item = m_gridItem.at(i);
+
+ qreal rotation = 0;
+ qreal width = boundingRect().width() / 2;
+ qreal x = width;
+ qreal scale = 3;
+ qreal z = 1;
+ qreal y = boundingRect().height()/2;
+
+ if (i < newCurrentItem - 4) {
+ item->setVisible(false);
+ item->setPos(QPointF(0, y));
+ continue;
+ } else if(i > newCurrentItem + 4) {
+ item->setVisible(false);
+ item->setPos(QPointF(boundingRect().width(), y));
+ continue;
+ } else if (i < newCurrentItem) {
+ x = (i - newCurrentItem + 4) * width/7;
+ rotation = -75;
+ scale = 2;
+ z = 1.+qreal(i-newCurrentItem)/10.;
+ } else if (i > newCurrentItem) {
+ x = width + (i - newCurrentItem + 3) * width/7;
+ rotation = 75;
+ scale = 2;
+ z = 1.-qreal(i-newCurrentItem)/8.;
+ }
+
+ item->setVisible(true);
+ item->setZValue(z);
+
+ anim = new QItemAnimation(item, QItemAnimation::RotationY, scene());
+ anim->setEndValue(rotation);
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+
+ anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
+ anim->setEndValue(scale);
+ anim->start(QVariantAnimation::DeleteWhenStopped);
+
+ anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
+ anim->setEndValue(scale);
+ anim->start(QVariantAnimation::DeleteWhenStopped);
+
+ anim = new QItemAnimation(item, QItemAnimation::Position, scene());
+ anim->setEndValue(QPointF(x,y));
+ anim->start(QVariantAnimation::DeleteWhenStopped);
+ }
+ return;
+ }
+
+
+ //deselect the current item
+ if (m_selectedItem >= 0 && m_items.contains(m_selectedItem)) {
+ RiverItem *item = m_items.value(m_selectedItem);
+ item->setZValue(qreal(qrand()%100)/200.0);
+ QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
+ anim->setEndValue(GRID_MAGNIFY);
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
+ anim->setEndValue(GRID_MAGNIFY);
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ }
+
+ if (newCurrentItem < 0) {
+ m_selectedItem = newCurrentItem;
+ return;
+ }
+
+ //ensure visible;
+ if (newCurrentItem < m_topLeftIndex) {
+ adjustGrid(newCurrentItem);
+ } else if (newCurrentItem >= m_topLeftIndex + GRID_DIMENSIONS) {
+ adjustGrid(newCurrentItem - GRID_DIMENSIONS + GRID_COLUMN_COUNT);
+ }
+
+ //select the new one
+ m_selectedItem = newCurrentItem;
+ RiverItem *item = currentItem();
+ Q_ASSERT(item);
+ item->setZValue(1);
+
+ QItemAnimation *anim = new QItemAnimation(item, QItemAnimation::ScaleFactorX, scene());
+ anim->setEndValue(GRID_CURRENT_MAGNIFY);
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+ anim = new QItemAnimation(item, QItemAnimation::ScaleFactorY, scene());
+ anim->setEndValue(GRID_CURRENT_MAGNIFY);
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+}
+
+void River::navigateBy(int offset)
+{
+ int newSelection = m_selectedItem + offset;
+ const int imageCount = m_images.size();
+ while (newSelection < 0)
+ newSelection += imageCount;
+ newSelection %= imageCount;
+ setCurrentItem(newSelection);
+}
diff --git a/examples/animation/photobrowser/river.h b/examples/animation/photobrowser/river.h
new file mode 100644
index 0000000..25bf62a
--- /dev/null
+++ b/examples/animation/photobrowser/river.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __RIVER__H__
+#define __RIVER__H__
+
+#include <QtCore/QDirIterator>
+#include <QtGui/QGraphicsWidget>
+
+#include "menu.h"
+
+class RiverItem;
+
+class River : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ enum Mode
+ {
+ RiverMode,
+ GridMode,
+ GridFullScreenMode,
+ CoverMode
+ };
+
+ River(const QString &path);
+ void addUnusedRiverItem(RiverItem * item);
+
+ static QSize fixedSize();
+
+ void switchPaused();
+
+ void setMode(Mode m);
+ Mode mode() const;
+
+ Menu *menu;
+
+protected:
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+ void keyPressEvent ( QKeyEvent * keyEvent );
+ void makeCenterAvailable(qreal size);
+ QPointF gridItemPosition(int row, int col) const;
+ QPixmap pixmap(int index) const;
+
+protected slots:
+ void animationFinished();
+public slots:
+ void setRiverMode();
+ void setGridMode();
+ void setCoverMode();
+
+private:
+ const QFileInfoList m_images;
+ int m_currentImage;
+ mutable QVector<QPixmap> m_pixmaps;
+ QHash<int, RiverItem*> m_items;
+ QList<RiverItem*> m_gridItem;
+ QList<QItemAnimation*> m_pausedAnimations;
+ Mode m_mode;
+
+ void adjustGrid(int topRight);
+ RiverItem *currentItem() { return m_items.value(m_selectedItem); }
+ RiverItem *createItem(int imageIndex);
+ void setCurrentItem(int currentItem);
+ void navigateBy(int offset);
+
+ int m_selectedItem;
+ int m_topLeftIndex;
+
+};
+
+
+#endif //__RIVERITEM__H__
diff --git a/examples/animation/photobrowser/riveritem.cpp b/examples/animation/photobrowser/riveritem.cpp
new file mode 100644
index 0000000..f6523a7
--- /dev/null
+++ b/examples/animation/photobrowser/riveritem.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include "riveritem.h"
+#include "river.h"
+
+RiverItem::RiverItem(QGraphicsItem *parent) : QGraphicsPixmapItem(parent), m_fullscreen(false)
+{
+ setCacheMode(DeviceCoordinateCache);
+}
+
+RiverItem::~RiverItem()
+{
+}
+
+void RiverItem::setPixmap(const QPixmap &pix)
+{
+ const QSize oldSize = pixmap().size();
+ const QSize newSize = pix.size();
+ QGraphicsPixmapItem::setPixmap(pix);
+
+ if (newSize != oldSize) {
+ setOffset(-newSize.width()/2, -newSize.height()/2);
+ const qreal scaleFactor = qreal(River::fixedSize().height())/(qreal(pix.height()*7));
+ setTransform(QTransform().scale(scaleFactor, scaleFactor));
+ prepareGeometryChange();
+ }
+}
+
+
+void RiverItem::setFullScreen(bool b, qreal originScaleFactor)
+{
+ if (m_fullscreen == b)
+ return;
+
+ m_fullscreen = b;
+
+ QPointF newPos;
+ qreal rotationZ;
+ qreal scaleX, scaleY;
+
+ if (b) {
+ const QSizeF basePixmapSize = transform().map(boundingRect()).boundingRect().size();
+
+ newPos = parentItem()->boundingRect().center();
+ rotationZ = 90;
+ scaleY = qreal(River::fixedSize().width()) / basePixmapSize.height() * yScale();
+ scaleX = qreal(River::fixedSize().height()) / basePixmapSize.width() * xScale();
+
+ if (m_nonFSPos.isNull()) {
+ m_nonFSPos = pos(); //let's save our current (non fullscreen) position
+ }
+
+ } else {
+ Q_ASSERT(!m_nonFSPos.isNull());
+ rotationZ = 0;
+ scaleX = originScaleFactor;
+ scaleY = originScaleFactor;
+ newPos = m_nonFSPos;
+ }
+
+ QAnimationGroup *group = new QParallelAnimationGroup(scene());
+ QItemAnimation *anim = new QItemAnimation(this, QItemAnimation::Position);
+ anim->setEndValue(newPos);
+ group->addAnimation(anim);
+ anim = new QItemAnimation(this, QItemAnimation::RotationZ);
+ anim->setEndValue(rotationZ);
+ group->addAnimation(anim);
+ anim = new QItemAnimation(this, QItemAnimation::ScaleFactorX);
+ anim->setEndValue(scaleX);
+ group->addAnimation(anim);
+ anim = new QItemAnimation(this, QItemAnimation::ScaleFactorY);
+ anim->setEndValue(scaleY);
+ group->addAnimation(anim);
+ group->start(QAbstractAnimation::DeleteWhenStopped);
+}
+
+void RiverItem::mousePressEvent(QGraphicsSceneMouseEvent*)
+{
+ //just let it rotate on itself
+ QItemAnimation *anim = new QItemAnimation(this, QItemAnimation::RotationY);
+ anim->setEndValue(yRotation() < 180 ? 360 : 0);
+ anim->setDuration(500);
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+}
+
+
diff --git a/examples/animation/photobrowser/riveritem.h b/examples/animation/photobrowser/riveritem.h
new file mode 100644
index 0000000..39fdcc2
--- /dev/null
+++ b/examples/animation/photobrowser/riveritem.h
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __RIVERITEM__H__
+#define __RIVERITEM__H__
+
+#include <QtGui/QGraphicsPixmapItem>
+
+class RiverItemAnimator;
+
+class RiverItem : public QGraphicsPixmapItem
+{
+public:
+ RiverItem(QGraphicsItem *parent);
+ ~RiverItem();
+
+ void setPixmap(const QPixmap &);
+ void setFullScreen(bool b, qreal originScaleFactor);
+
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent*);
+
+private:
+ QPointF m_nonFSPos; //to save the position when not in fullscreen
+ bool m_fullscreen;
+};
+
+#endif //__RIVERITEM__H__
diff --git a/examples/animation/piemenu/main.cpp b/examples/animation/piemenu/main.cpp
new file mode 100644
index 0000000..28f62d0
--- /dev/null
+++ b/examples/animation/piemenu/main.cpp
@@ -0,0 +1,26 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include "scene.h"
+#include "qgraphicspiemenu.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ Scene scene;
+
+ QGraphicsView view(&scene);
+ view.show();
+
+ return app.exec();
+}
diff --git a/examples/animation/piemenu/piemenu.pro b/examples/animation/piemenu/piemenu.pro
new file mode 100644
index 0000000..4d7a067
--- /dev/null
+++ b/examples/animation/piemenu/piemenu.pro
@@ -0,0 +1,8 @@
+SOURCES += \
+ main.cpp \
+ qgraphicspiemenu.cpp \
+ scene.cpp
+HEADERS += \
+ qgraphicspiemenu.h \
+ qgraphicspiemenu_p.h \
+ scene.h
diff --git a/examples/animation/piemenu/qgraphicspiemenu.cpp b/examples/animation/piemenu/qgraphicspiemenu.cpp
new file mode 100644
index 0000000..c913423
--- /dev/null
+++ b/examples/animation/piemenu/qgraphicspiemenu.cpp
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include "qgraphicspiemenu.h"
+#include "qgraphicspiemenu_p.h"
+
+#include <QtGui/qaction.h>
+
+QGraphicsPieMenu::QGraphicsPieMenu(QGraphicsItem *parent)
+ : QGraphicsWidget(parent), d_ptr(new QGraphicsPieMenuPrivate)
+{
+ d_ptr->q_ptr = this;
+ d_ptr->machine = new QStateMachine();
+ d_ptr->popupState = new QState(d_ptr->machine->rootState());
+ d_ptr->machine->setInitialState(d_ptr->popupState);
+ d_ptr->menuAction = new QAction(this);
+}
+
+QGraphicsPieMenu::QGraphicsPieMenu(const QString &title, QGraphicsItem *parent)
+ : QGraphicsWidget(parent), d_ptr(new QGraphicsPieMenuPrivate)
+{
+ d_ptr->q_ptr = this;
+ d_ptr->machine = new QStateMachine();
+ d_ptr->popupState = new QState(d_ptr->machine->rootState());
+ d_ptr->machine->setInitialState(d_ptr->popupState);
+ d_ptr->menuAction = new QAction(this);
+ setTitle(title);
+}
+
+QGraphicsPieMenu::QGraphicsPieMenu(const QIcon &icon, const QString &title, QGraphicsItem *parent)
+ : QGraphicsWidget(parent), d_ptr(new QGraphicsPieMenuPrivate)
+{
+ d_ptr->q_ptr = this;
+ d_ptr->machine = new QStateMachine();
+ d_ptr->popupState = new QState(d_ptr->machine->rootState());
+ d_ptr->machine->setInitialState(d_ptr->popupState);
+ d_ptr->menuAction = new QAction(this);
+ setIcon(icon);
+ setTitle(title);
+}
+
+QGraphicsPieMenu::~QGraphicsPieMenu()
+{
+ delete d_ptr;
+}
+
+QAction *QGraphicsPieMenu::addAction(const QString &text)
+{
+ QAction *action = new QAction(text, this);
+ addAction(action);
+ return action;
+}
+
+QAction *QGraphicsPieMenu::addAction(const QIcon &icon, const QString &text)
+{
+ QAction *action = new QAction(icon, text, this);
+ addAction(action);
+ return action;
+}
+
+QAction *QGraphicsPieMenu::addAction(const QString &text, const QObject *receiver, const char *member, const QKeySequence &shortcut)
+{
+ QAction *action = new QAction(text, this);
+ action->setShortcut(shortcut);
+ connect(action, SIGNAL(triggered(bool)), receiver, member);
+ addAction(action);
+ return action;
+}
+
+QAction *QGraphicsPieMenu::addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char *member, const QKeySequence &shortcut)
+{
+ QAction *action = new QAction(icon, text, this);
+ action->setShortcut(shortcut);
+ connect(action, SIGNAL(triggered(bool)), receiver, member);
+ addAction(action);
+ return action;
+}
+
+QAction *QGraphicsPieMenu::addMenu(QGraphicsPieMenu *menu)
+{
+ QAction *action = menu->menuAction();
+ addAction(action);
+ return action;
+}
+
+QGraphicsPieMenu *QGraphicsPieMenu::addMenu(const QString &title)
+{
+ QGraphicsPieMenu *menu = new QGraphicsPieMenu(title, this);
+ addMenu(menu);
+ return menu;
+}
+
+QGraphicsPieMenu *QGraphicsPieMenu::addMenu(const QIcon &icon, const QString &title)
+{
+ QGraphicsPieMenu *menu = new QGraphicsPieMenu(icon, title, this);
+ addMenu(menu);
+ return menu;
+}
+
+QAction *QGraphicsPieMenu::addSeparator()
+{
+ QAction *action = new QAction(this);
+ action->setSeparator(true);
+ addAction(action);
+ return action;
+}
+
+QAction *QGraphicsPieMenu::insertMenu(QAction *before, QGraphicsPieMenu *menu)
+{
+ QAction *action = menu->menuAction();
+ insertAction(before, action);
+ return action;
+}
+
+QAction *QGraphicsPieMenu::insertSeparator(QAction *before)
+{
+ QAction *action = new QAction(this);
+ action->setSeparator(true);
+ insertAction(before, action);
+ return action;
+}
+
+QAction *QGraphicsPieMenu::menuAction() const
+{
+ return d_func()->menuAction;
+}
+
+bool QGraphicsPieMenu::isEmpty() const
+{
+ // ### d->actions
+ QList<QAction *> actionList = actions();
+ bool ret = true;
+ for (int i = 0; ret && i < actionList.size(); ++i) {
+ const QAction *action = actionList.at(i);
+ if (!action->isSeparator() && action->isVisible()) {
+ ret = false;
+ break;
+ }
+ }
+ return ret;
+}
+
+void QGraphicsPieMenu::clear()
+{
+ // ### d->actions
+ QList<QAction *> actionList = actions();
+ for(int i = 0; i < actionList.size(); i++) {
+ QAction *action = actionList.at(i);
+ removeAction(action);
+ if (action->parent() == this && action->associatedGraphicsWidgets().isEmpty())
+ delete action;
+ }
+}
+
+void QGraphicsPieMenu::popup(const QPointF &pos)
+{
+ Q_UNUSED(pos);
+ Q_D(QGraphicsPieMenu);
+ d->machine->start();
+}
+
+QAction *QGraphicsPieMenu::exec()
+{
+ return exec(pos());
+}
+
+QAction *QGraphicsPieMenu::exec(const QPointF &pos)
+{
+ Q_UNUSED(pos);
+ return 0;
+}
+
+QAction *QGraphicsPieMenu::exec(QList<QAction *> actions, const QPointF &pos)
+{
+ QGraphicsPieMenu menu;
+ for (QList<QAction *>::ConstIterator it = actions.constBegin(); it != actions.constEnd(); ++it)
+ menu.addAction(*it);
+ return menu.exec(pos);
+}
+
+QString QGraphicsPieMenu::title() const
+{
+ Q_D(const QGraphicsPieMenu);
+ return d->title;
+}
+
+void QGraphicsPieMenu::setTitle(const QString &title)
+{
+ Q_D(QGraphicsPieMenu);
+ d->title = title;
+ updateGeometry();
+}
+
+QIcon QGraphicsPieMenu::icon() const
+{
+ Q_D(const QGraphicsPieMenu);
+ return d->icon;
+}
+
+void QGraphicsPieMenu::setIcon(const QIcon &icon)
+{
+ Q_D(QGraphicsPieMenu);
+ d->icon = icon;
+ updateGeometry();
+}
+
+QSizeF QGraphicsPieMenu::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ Q_UNUSED(which);
+ Q_UNUSED(constraint);
+ return QSizeF(1, 1);
+}
diff --git a/examples/animation/piemenu/qgraphicspiemenu.h b/examples/animation/piemenu/qgraphicspiemenu.h
new file mode 100644
index 0000000..68b4ba9
--- /dev/null
+++ b/examples/animation/piemenu/qgraphicspiemenu.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGRAPHICSPIEMENU_H
+#define QGRAPHICSPIEMENU_H
+
+#include <QtGui/qgraphicswidget.h>
+
+class QGraphicsPieMenuPrivate;
+class QGraphicsPieMenu : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ QGraphicsPieMenu(QGraphicsItem *parent = 0);
+ QGraphicsPieMenu(const QString &title, QGraphicsItem *parent = 0);
+ QGraphicsPieMenu(const QIcon &icon, const QString &title, QGraphicsItem *parent = 0);
+ ~QGraphicsPieMenu();
+
+#ifdef Q_NO_USING_KEYWORD
+ inline void addAction(QAction *action) { QGraphicsWidget::addAction(action); }
+#else
+ using QGraphicsWidget::addAction;
+#endif
+ QAction *addAction(const QString &text);
+ QAction *addAction(const QIcon &icon, const QString &text);
+ QAction *addAction(const QString &text, const QObject *receiver, const char *member, const QKeySequence &shortcut = 0);
+ QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char *member, const QKeySequence &shortcut = 0);
+ QAction *addMenu(QGraphicsPieMenu *menu);
+ QGraphicsPieMenu *addMenu(const QString &title);
+ QGraphicsPieMenu *addMenu(const QIcon &icon, const QString &title);
+ QAction *addSeparator();
+ QAction *insertMenu(QAction *before, QGraphicsPieMenu *menu);
+ QAction *insertSeparator(QAction *before);
+
+ QAction *menuAction() const;
+
+ bool isEmpty() const;
+ void clear();
+
+ void popup(const QPointF &pos);
+ QAction *exec();
+ QAction *exec(const QPointF &pos);
+ static QAction *exec(QList<QAction *> actions, const QPointF &pos);
+
+ QString title() const;
+ void setTitle(const QString &title);
+
+ QIcon icon() const;
+ void setIcon(const QIcon &icon);
+
+Q_SIGNALS:
+ void aboutToShow();
+ void aboutToHide();
+ void triggered(QAction *action);
+ void hovered(QAction *action);
+
+protected:
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
+
+private:
+ Q_DISABLE_COPY(QGraphicsPieMenu)
+ Q_DECLARE_PRIVATE(QGraphicsPieMenu)
+ QGraphicsPieMenuPrivate *d_ptr;
+};
+
+#endif
diff --git a/examples/animation/piemenu/qgraphicspiemenu_p.h b/examples/animation/piemenu/qgraphicspiemenu_p.h
new file mode 100644
index 0000000..87a749c
--- /dev/null
+++ b/examples/animation/piemenu/qgraphicspiemenu_p.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGRAPHICSPIEMENU_P_H
+#define QGRAPHICSPIEMENU_P_H
+
+#include "qgraphicspiemenu.h"
+#include "qgraphicspiemenusection_p.h"
+
+#include <QtGui/qicon.h>
+#include <QtCore/qstate.h>
+#include <QtCore/qtransition.h>
+#include <QtCore/qstatemachine.h>
+
+class QAction;
+class QEventLoop;
+class QGraphicsPieMenuSection;
+
+class QGraphicsPieMenuPrivate
+{
+ Q_DECLARE_PUBLIC(QGraphicsPieMenu);
+public:
+ void init(const QIcon &icon = QIcon(), const QString &title = QString());
+
+ QIcon icon;
+ QString title;
+ QStateMachine *machine;
+ QState *popupState;
+ //QTransition *transition;
+ QList<QGraphicsPieMenuSection *> sections;
+
+ QEventLoop *eventLoop;
+
+ QAction *menuAction;
+ QGraphicsPieMenu *q_ptr;
+
+ void updatePopupState();
+};
+
+#endif
diff --git a/examples/animation/piemenu/qgraphicspiemenusection_p.h b/examples/animation/piemenu/qgraphicspiemenusection_p.h
new file mode 100644
index 0000000..328f742
--- /dev/null
+++ b/examples/animation/piemenu/qgraphicspiemenusection_p.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGRAPHICSPIEMENUSECTION_H
+#define QGRAPHICSPIEMENUSECTION_H
+
+#include <QtGui/qgraphicswidget.h>
+#include <QtGui/qpainter.h>
+
+class QGraphicsPieMenuSection : public QGraphicsWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal rotation READ rotation WRITE setRotation)
+public:
+ QGraphicsPieMenuSection(QGraphicsItem *parent = 0)
+ : QGraphicsWidget(parent), rot(0)
+ { }
+
+ qreal rotation() const
+ {
+ return rot;
+ }
+ void setRotation(qreal rotation)
+ {
+ rot = rotation;
+ setTransform(QTransform().rotate(rot));
+ }
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0)
+ {
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+ painter->setPen(QPen(Qt::black, 1));
+ painter->setBrush(QBrush(Qt::gray));
+ painter->drawPie(QRectF(-100, -100, 200, 200), 0, -30 * 16);
+ }
+
+protected:
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &size = QSizeF()) const
+ {
+ Q_UNUSED(which);
+ Q_UNUSED(size);
+ return QSizeF(100, 30);
+ }
+
+private:
+ qreal rot;
+};
+
+#endif
diff --git a/examples/animation/piemenu/scene.cpp b/examples/animation/piemenu/scene.cpp
new file mode 100644
index 0000000..08aad06
--- /dev/null
+++ b/examples/animation/piemenu/scene.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include "qgraphicspiemenu.h"
+#include "scene.h"
+
+#include <QtGui/qaction.h>
+#include <QtGui/qgraphicssceneevent.h>
+
+Scene::Scene(qreal x, qreal y, qreal width, qreal height, QObject *parent)
+ : QGraphicsScene(x, y, width, height, parent)
+{
+}
+
+Scene::Scene(const QRectF &sceneRect, QObject *parent)
+ : QGraphicsScene(sceneRect, parent)
+{
+}
+
+Scene::Scene(QObject *parent)
+ : QGraphicsScene(parent)
+{
+}
+
+Scene::~Scene()
+{
+}
+
+void Scene::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ QGraphicsPieMenu *menu = new QGraphicsPieMenu;
+ for (int i = 0; i < 5; ++i)
+ menu->addAction(new QAction(QString("Item %1").arg(i), menu));
+ menu->popup(event->scenePos());
+}
diff --git a/examples/animation/piemenu/scene.h b/examples/animation/piemenu/scene.h
new file mode 100644
index 0000000..676f55f
--- /dev/null
+++ b/examples/animation/piemenu/scene.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SCENE_H
+#define SCENE_H
+
+#include <QtGui/qgraphicsscene.h>
+
+class Scene : public QGraphicsScene
+{
+ Q_OBJECT
+public:
+ Scene(qreal x, qreal y, qreal width, qreal height, QObject *parent = 0);
+ Scene(const QRectF &sceneRect, QObject *parent = 0);
+ Scene(QObject *parent = 0);
+ ~Scene();
+
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *event);
+};
+
+#endif
diff --git a/examples/animation/research/memberfunctions/main.cpp b/examples/animation/research/memberfunctions/main.cpp
new file mode 100644
index 0000000..9142f29
--- /dev/null
+++ b/examples/animation/research/memberfunctions/main.cpp
@@ -0,0 +1,48 @@
+#include <QtGui>
+#include "qvalueanimation.h"
+
+AbstractProperty *qGraphicsItemProperty(QGraphicsItem *item, const char *property)
+{
+ if (qstrcmp(property, "pos") == 0) {
+ return new MemberFunctionProperty<QGraphicsItem, QPointF>(item, &QGraphicsItem::pos, &QGraphicsItem::setPos);
+ }
+ return 0;
+}
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+
+ QGraphicsItem *item = new QGraphicsRectItem(QRectF(0,0, 200, 100));
+ scene.addItem(item);
+
+ QValueAnimation *posAnim = new QValueAnimation;
+ posAnim->setStartValue(QPointF(0,0));
+ posAnim->setEndValue(QPointF(400, 0));
+ posAnim->setDuration(1000);
+ // Alternative 1
+ //posAnim->setMemberFunction(item, &QGraphicsItem::pos, &QGraphicsItem::setPos);
+
+ // Alternative 2
+ //posAnim->setProperty(qMemberFunctionProperty(item, &QGraphicsItem::pos, &QGraphicsItem::setPos));
+
+ // Alternative 3
+ posAnim->setProperty(qGraphicsItemProperty(item, "pos"));
+
+ // Alternative 4, (by implementing the qGraphicsItemProperty QGraphicsItem::property())
+ //posAnim->setProperty(item->property("pos"));
+
+ // can also do this, which abstracts away the whole property thing.
+ // i.e. this interface can also be used for QObject-properties:
+ //posAnim->setAnimationProperty(animationProperty);
+
+ posAnim->start();
+
+ view.resize(800,600);
+ view.show();
+ return app.exec();
+}
+
diff --git a/examples/animation/research/memberfunctions/memberfunctions.pro b/examples/animation/research/memberfunctions/memberfunctions.pro
new file mode 100644
index 0000000..6b67895
--- /dev/null
+++ b/examples/animation/research/memberfunctions/memberfunctions.pro
@@ -0,0 +1,16 @@
+######################################################################
+# Automatically generated by qmake (2.01a) fr 26. sep 13:21:57 2008
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+SOURCES += main.cpp \
+ qvalueanimation.cpp
+HEADERS += qvalueanimation.h
+
+CONFIG += console
+
diff --git a/examples/animation/research/memberfunctions/qvalueanimation.cpp b/examples/animation/research/memberfunctions/qvalueanimation.cpp
new file mode 100644
index 0000000..2fe9be9
--- /dev/null
+++ b/examples/animation/research/memberfunctions/qvalueanimation.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+
+
+#include "qvalueanimation.h"
+#include "qvalueanimation_p.h"
+
+QT_BEGIN_NAMESPACE
+
+
+void QValueAnimationPrivate::initDefaultStartValue()
+{
+ Q_Q(QValueAnimation);
+ if (animProp && !q->startValue().isValid()
+ && ((currentTime == 0 && (currentIteration || currentIteration == 0))
+ || (currentTime == duration && currentIteration == (iterationCount - 1)))) {
+ setDefaultStartValue(animProp->read());
+ }
+}
+
+
+QValueAnimation::QValueAnimation(QObject *parent) : QVariantAnimation(*new QValueAnimationPrivate, parent)
+{
+}
+
+QValueAnimation::~QValueAnimation()
+{
+}
+
+void QValueAnimation::setProperty(AbstractProperty *animProp)
+{
+ Q_D(QValueAnimation);
+ d->animProp = animProp;
+}
+
+/*!
+ \reimp
+ */
+void QValueAnimation::updateCurrentValue(const QVariant &value)
+{
+ Q_D(QValueAnimation);
+ if (state() == QAbstractAnimation::Stopped)
+ return;
+
+ d->animProp->write(value);
+}
+
+
+/*!
+ \reimp
+*/
+void QValueAnimation::updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState)
+{
+ Q_D(QValueAnimation);
+ // Initialize start value
+ if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running)
+ d->initDefaultStartValue();
+}
+
+
+
+#include "moc_qvalueanimation.cpp"
+
+QT_END_NAMESPACE
diff --git a/examples/animation/research/memberfunctions/qvalueanimation.h b/examples/animation/research/memberfunctions/qvalueanimation.h
new file mode 100644
index 0000000..a4aa213
--- /dev/null
+++ b/examples/animation/research/memberfunctions/qvalueanimation.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVALUEANIMATION_H
+#define QVALUEANIMATION_H
+
+#if defined(QT_EXPERIMENTAL_SOLUTION)
+# include "qvariantanimation.h"
+#else
+# include <QtCore/qvariantanimation.h>
+#endif
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QGraphicsItem;
+class QValueAnimationPrivate;
+
+QT_MODULE(Gui)
+
+struct AbstractProperty {
+ virtual void write(const QVariant &value) = 0;
+ virtual QVariant read() const = 0;
+};
+
+# define CALL_MEMBER_FN(object,ptrToMember) ((object)->*(ptrToMember))
+template <typename Target, typename T>
+class MemberFunctionProperty : public AbstractProperty {
+public:
+ typedef void (Target::*RefWrite)(const T &);
+ typedef T (Target::*ValRead)(void) const;
+
+ MemberFunctionProperty(Target *target, ValRead readFunc, RefWrite writeFunc)
+ : m_target(target), m_readFn(readFunc), m_writeFn(writeFunc) {}
+
+ virtual void write(const QVariant &value) {
+ CALL_MEMBER_FN(m_target, m_writeFn)(qVariantValue<T>(value));
+ }
+
+ virtual QVariant read() const {
+ if (m_readFn)
+ return qVariantFromValue<T>(CALL_MEMBER_FN(m_target, m_readFn)());
+ return QVariant();
+ }
+
+private:
+ Target *m_target;
+ ValRead m_readFn;
+ RefWrite m_writeFn;
+};
+
+
+class QValueAnimation : public QVariantAnimation
+{
+ Q_OBJECT
+
+public:
+ QValueAnimation(QObject *parent = 0);
+ ~QValueAnimation();
+
+ template <typename Target, typename T>
+ void setMemberFunction(Target *target,
+ T (Target::*readFunc)(void) const, // ### useValRead typedef
+ void (Target::*writeFunc)(const T &) // ### use RefWrite typedef
+ ) {
+ // ### ownership of MemberFunctionProperty
+ AbstractProperty *animProp = new MemberFunctionProperty<Target, T>(target, readFunc, writeFunc);
+ setProperty(animProp);
+ }
+
+ void updateCurrentValue(const QVariant &value);
+ void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState);
+ void setProperty(AbstractProperty *animProp);
+
+private:
+ Q_DISABLE_COPY(QValueAnimation);
+ Q_DECLARE_PRIVATE(QValueAnimation);
+};
+
+#endif // QVALUEANIMATION_H
diff --git a/examples/animation/research/memberfunctions/qvalueanimation_p.h b/examples/animation/research/memberfunctions/qvalueanimation_p.h
new file mode 100644
index 0000000..e6e7682
--- /dev/null
+++ b/examples/animation/research/memberfunctions/qvalueanimation_p.h
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVALUEANIMATION_P_H
+#define QVALUEANIMATION_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of QIODevice. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qvariantanimation_p.h> //###
+
+QT_BEGIN_NAMESPACE
+
+class QValueAnimationPrivate : public QVariantAnimationPrivate
+{
+ Q_DECLARE_PUBLIC(QValueAnimation)
+public:
+ QValueAnimationPrivate() : QVariantAnimationPrivate(), animProp(0)
+ {
+ }
+
+ void initDefaultStartValue();
+
+ AbstractProperty *animProp;
+
+ //###TODO
+};
+
+QT_END_NAMESPACE
+
+#endif //QVALUEANIMATION_P_H
diff --git a/examples/animation/research/propertytransform/main.cpp b/examples/animation/research/propertytransform/main.cpp
new file mode 100644
index 0000000..80002c9
--- /dev/null
+++ b/examples/animation/research/propertytransform/main.cpp
@@ -0,0 +1,47 @@
+#include <QtGui>
+
+#include "qpropertytransform.h"
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+
+ QGraphicsItem *item = new QGraphicsRectItem(QRectF(0,0, 200, 100));
+ scene.addItem(item);
+ QPropertyTransform transform;
+ transform.setTargetItem(item);
+
+ QAnimationGroup *group = new QAnimationGroup(QAnimationGroup::Parallel, &scene);
+ QPropertyAnimation *scaleAnim = new QPropertyAnimation(&transform, "scaleX");
+ scaleAnim->setStartValue(1.0);
+ scaleAnim->setTargetValue(2.0);
+ scaleAnim->setDuration(10000);
+ group->add(scaleAnim);
+
+ QPropertyAnimation *scaleAnim2 = new QPropertyAnimation(&transform, "scaleY");
+ scaleAnim2->setStartValue(.0);
+ scaleAnim2->setTargetValue(2.0);
+ scaleAnim2->setDuration(10000);
+ QEasingCurve curve(QEasingCurve::InElastic);
+ curve.setPeriod(2);
+ curve.setAmplitude(2);
+
+ //scaleAnim2->setEasingCurve(curve);
+ //scaleAnim2->setEasingCurve(QEasingCurve(QEasingCurve::OutElastic , 2, 2 ));
+ group->add(scaleAnim2);
+
+ QPropertyAnimation *rotAnim = new QPropertyAnimation(&transform, "rotation");
+ rotAnim->setStartValue(0);
+ rotAnim->setTargetValue(90);
+ rotAnim->setDuration(10000);
+ group->add(rotAnim);
+
+ group->start();
+
+ view.resize(800,600);
+ view.show();
+ return app.exec();
+}
diff --git a/examples/animation/research/propertytransform/propertytransform.pro b/examples/animation/research/propertytransform/propertytransform.pro
new file mode 100644
index 0000000..94c36b8
--- /dev/null
+++ b/examples/animation/research/propertytransform/propertytransform.pro
@@ -0,0 +1,14 @@
+######################################################################
+# Automatically generated by qmake (2.01a) fr 26. sep 13:21:57 2008
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+SOURCES += main.cpp
+HEADERS += qpropertytransform.h
+CONFIG += console
+
diff --git a/examples/animation/research/propertytransform/qpropertytransform.h b/examples/animation/research/propertytransform/qpropertytransform.h
new file mode 100644
index 0000000..e052625
--- /dev/null
+++ b/examples/animation/research/propertytransform/qpropertytransform.h
@@ -0,0 +1,78 @@
+#include <QtCore/QObject>
+#include <QtCore/QPoint>
+#include <QtGui/QGraphicsItem>
+#include <QtGui/QTransform>
+#include <QtCore/QDebug>
+
+/**
+ * Experimental.
+ * Pros:
+ * 1. Does not add ugly/confusing API to QGraphicsItem.
+ *
+ * Cons:
+ * 1. apply() /m_item->setTransform() is called too many times. (FIXED NOW?)
+ *
+ *
+ */
+class QPropertyTransform : public QObject {
+ Q_OBJECT
+public:
+ Q_PROPERTY(QPointF center READ center WRITE setCenter);
+ Q_PROPERTY(qreal rotation READ rotation WRITE setRotation);
+ Q_PROPERTY(qreal scaleX READ scaleX WRITE setScaleX);
+ Q_PROPERTY(qreal scaleY READ scaleY WRITE setScaleY);
+public:
+ QPropertyTransform() : m_item(0), m_rotationZ(0), m_scaleX(1.), m_scaleY(1.) {}
+
+ void setTargetItem(QGraphicsItem *item) {
+ m_item = item;
+ }
+
+ void setCenter(const QPointF &center) {
+ m_center = center;
+ apply();
+ }
+
+ QPointF center() const { return m_center; }
+
+ void setRotation(qreal rotation) {
+ m_rotationZ = rotation;
+ apply();
+ }
+
+ qreal rotation() const { return m_rotationZ; }
+
+ void setScaleX(qreal scale) {
+ m_scaleX = scale;
+ apply();
+ }
+
+ qreal scaleX() const { return m_scaleX; }
+
+ void setScaleY(qreal scale) {
+ m_scaleY = scale;
+ apply();
+ }
+
+ qreal scaleY() const { return m_scaleY; }
+
+private:
+ QTransform transform() const {
+ return QTransform().translate(m_center.x(), m_center.y())
+ .rotate(m_rotationZ)
+ .scale(m_scaleX, m_scaleY)
+ .translate(-m_center.x(), -m_center.y());
+ }
+
+ void apply() {
+ if (m_item)
+ m_item->setTransform(transform());
+ }
+
+ QGraphicsItem *m_item;
+ QPointF m_center;
+ qreal m_rotationZ;
+ qreal m_scaleX;
+ qreal m_scaleY;
+};
+
diff --git a/examples/animation/research/sound/main.cpp b/examples/animation/research/sound/main.cpp
new file mode 100644
index 0000000..2c9fa47
--- /dev/null
+++ b/examples/animation/research/sound/main.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+//The purpose of this example is to show that it is possible to have your own
+// animation with undefined duration
+
+#include <QtGui/QtGui>
+#include <phonon>
+
+class SoundAnimation : public QAbstractAnimation
+{
+public:
+ SoundAnimation(const QString &file)
+ {
+ //in an idea case we should also control the errors
+ Phonon::createPath(&m_media, &m_audio);
+ m_media.setCurrentSource(file);
+ connect(&m_media, SIGNAL(finished()), SLOT(stop()));
+ }
+
+ int duration() const
+ {
+ return -1;
+ }
+
+ void updateCurrentTime(int msecs)
+ {
+ //nothing to do here...
+ qDebug() << "updateCurrentTime" << msecs;
+ }
+
+ void updateState(State state)
+ {
+ switch(state)
+ {
+ case Running:
+ m_media.play();
+ break;
+ case Stopped:
+ m_media.stop();
+ break;
+ case Paused:
+ m_media.pause();
+ break;
+ }
+ }
+
+
+private:
+ Phonon::MediaObject m_media;
+ Phonon::AudioOutput m_audio;
+
+};
+
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ Q_INIT_RESOURCE(sound);
+
+ SoundAnimation anim(QLatin1String(":/media/sax.mp3"));
+ app.connect(&anim, SIGNAL(finished()), SLOT(quit()));
+ anim.start();
+
+ return app.exec();
+} \ No newline at end of file
diff --git a/examples/animation/research/sound/media/sax.mp3 b/examples/animation/research/sound/media/sax.mp3
new file mode 100644
index 0000000..0a078b1
--- /dev/null
+++ b/examples/animation/research/sound/media/sax.mp3
Binary files differ
diff --git a/examples/animation/research/sound/sound.pro b/examples/animation/research/sound/sound.pro
new file mode 100644
index 0000000..0ad3050
--- /dev/null
+++ b/examples/animation/research/sound/sound.pro
@@ -0,0 +1,14 @@
+######################################################################
+# Automatically generated by qmake (2.01a) mer. 21. janv. 13:53:26 2009
+######################################################################
+
+TEMPLATE = app
+QT += phonon
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+RESOURCES = sound.qrc
+
+# Input
+SOURCES += main.cpp
diff --git a/examples/animation/research/sound/sound.qrc b/examples/animation/research/sound/sound.qrc
new file mode 100644
index 0000000..8919142
--- /dev/null
+++ b/examples/animation/research/sound/sound.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+<file>media/sax.mp3</file>
+</qresource>
+</RCC>
diff --git a/examples/animation/states/accessories-dictionary.png b/examples/animation/states/accessories-dictionary.png
new file mode 100644
index 0000000..e9bd55d
--- /dev/null
+++ b/examples/animation/states/accessories-dictionary.png
Binary files differ
diff --git a/examples/animation/states/akregator.png b/examples/animation/states/akregator.png
new file mode 100644
index 0000000..a086f45
--- /dev/null
+++ b/examples/animation/states/akregator.png
Binary files differ
diff --git a/examples/animation/states/digikam.png b/examples/animation/states/digikam.png
new file mode 100644
index 0000000..9de9fb2
--- /dev/null
+++ b/examples/animation/states/digikam.png
Binary files differ
diff --git a/examples/animation/states/help-browser.png b/examples/animation/states/help-browser.png
new file mode 100644
index 0000000..db92faa
--- /dev/null
+++ b/examples/animation/states/help-browser.png
Binary files differ
diff --git a/examples/animation/states/k3b.png b/examples/animation/states/k3b.png
new file mode 100644
index 0000000..bbcafcf
--- /dev/null
+++ b/examples/animation/states/k3b.png
Binary files differ
diff --git a/examples/animation/states/kchart.png b/examples/animation/states/kchart.png
new file mode 100644
index 0000000..1dd115b
--- /dev/null
+++ b/examples/animation/states/kchart.png
Binary files differ
diff --git a/examples/animation/states/main.cpp b/examples/animation/states/main.cpp
new file mode 100644
index 0000000..5c004a2
--- /dev/null
+++ b/examples/animation/states/main.cpp
@@ -0,0 +1,259 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the $MODULE$ of the Qt Toolkit.
+**
+** $TROLLTECH_DUAL_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#if defined(QT_EXPERIMENTAL_SOLUTION)
+# include "qstate.h"
+# include "qstatemachine.h"
+# include "qtransition.h"
+# include "qparallelanimationgroup.h"
+# include "qsequentialanimationgroup.h"
+# include "qpropertyanimation.h"
+#endif
+
+class Pixmap : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ Pixmap(const QPixmap &pix) : QGraphicsWidget(), p(pix)
+ {
+ setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ }
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+ {
+ painter->drawPixmap(QPointF(), p);
+ }
+
+protected:
+ QSizeF sizeHint(Qt::SizeHint, const QSizeF & = QSizeF())
+ {
+ return QSizeF(p.width(), p.height());
+ }
+
+private:
+ QPixmap p;
+};
+
+int main(int argc, char *argv[])
+{
+ Q_INIT_RESOURCE(states);
+
+ QApplication app(argc, argv);
+
+ // Text edit and button
+ QTextEdit *edit = new QTextEdit;
+ edit->setText("asdf lkjha yuoiqwe asd iuaysd u iasyd uiy "
+ "asdf lkjha yuoiqwe asd iuaysd u iasyd uiy "
+ "asdf lkjha yuoiqwe asd iuaysd u iasyd uiy "
+ "asdf lkjha yuoiqwe asd iuaysd u iasyd uiy!");
+
+ QPushButton *button = new QPushButton;
+ QGraphicsProxyWidget *buttonProxy = new QGraphicsProxyWidget;
+ buttonProxy->setWidget(button);
+ QGraphicsProxyWidget *editProxy = new QGraphicsProxyWidget;
+ editProxy->setWidget(edit);
+
+ QGroupBox *box = new QGroupBox;
+ box->setFlat(true);
+ box->setTitle("Options");
+
+ QVBoxLayout *layout2 = new QVBoxLayout;
+ box->setLayout(layout2);
+ layout2->addWidget(new QRadioButton("Herring"));
+ layout2->addWidget(new QRadioButton("Blue Parrot"));
+ layout2->addWidget(new QRadioButton("Petunias"));
+ layout2->addStretch();
+
+ QGraphicsProxyWidget *boxProxy = new QGraphicsProxyWidget;
+ boxProxy->setWidget(box);
+
+ // Parent widget
+ QGraphicsWidget *widget = new QGraphicsWidget;
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, widget);
+ layout->addItem(editProxy);
+ layout->addItem(buttonProxy);
+ widget->setLayout(layout);
+
+ Pixmap *p1 = new Pixmap(QPixmap(":/digikam.png"));
+ Pixmap *p2 = new Pixmap(QPixmap(":/akregator.png"));
+ Pixmap *p3 = new Pixmap(QPixmap(":/accessories-dictionary.png"));
+ Pixmap *p4 = new Pixmap(QPixmap(":/k3b.png"));
+ Pixmap *p5 = new Pixmap(QPixmap(":/help-browser.png"));
+ Pixmap *p6 = new Pixmap(QPixmap(":/kchart.png"));
+
+ QGraphicsScene scene(0, 0, 400, 300);
+ scene.setBackgroundBrush(scene.palette().window());
+ scene.addItem(widget);
+ scene.addItem(boxProxy);
+ scene.addItem(p1);
+ scene.addItem(p2);
+ scene.addItem(p3);
+ scene.addItem(p4);
+ scene.addItem(p5);
+ scene.addItem(p6);
+
+ QStateMachine machine;
+ QState *root = machine.rootState();
+ QState *state1 = new QState(root);
+ QState *state2 = new QState(root);
+ QState *state3 = new QState(root);
+ machine.setInitialState(state1);
+
+ // State 1
+ state1->setPropertyOnEntry(button, "text", "Switch to state 2");
+ state1->setPropertyOnEntry(widget, "geometry", QRectF(0, 0, 400, 150));
+ state1->setPropertyOnEntry(box, "geometry", QRect(-200, 150, 200, 150));
+ state1->setPropertyOnEntry(p1, "geometry", QRectF(68, 185, 64, 64));
+ state1->setPropertyOnEntry(p2, "geometry", QRectF(168, 185, 64, 64));
+ state1->setPropertyOnEntry(p3, "geometry", QRectF(268, 185, 64, 64));
+ state1->setPropertyOnEntry(p4, "geometry", QRectF(68-150, 48-150, 64, 64));
+ state1->setPropertyOnEntry(p5, "geometry", QRectF(168, 48-150, 64, 64));
+ state1->setPropertyOnEntry(p6, "geometry", QRectF(268+150, 48-150, 64, 64));
+ state1->setPropertyOnEntry(p1, "zRotation", qreal(0));
+ state1->setPropertyOnEntry(p2, "zRotation", qreal(0));
+ state1->setPropertyOnEntry(p3, "zRotation", qreal(0));
+ state1->setPropertyOnEntry(p4, "zRotation", qreal(-270));
+ state1->setPropertyOnEntry(p5, "zRotation", qreal(-90));
+ state1->setPropertyOnEntry(p6, "zRotation", qreal(270));
+ state1->setPropertyOnEntry(boxProxy, "opacity", qreal(0));
+ state1->setPropertyOnEntry(p1, "opacity", qreal(1));
+ state1->setPropertyOnEntry(p2, "opacity", qreal(1));
+ state1->setPropertyOnEntry(p3, "opacity", qreal(1));
+ state1->setPropertyOnEntry(p4, "opacity", qreal(0));
+ state1->setPropertyOnEntry(p5, "opacity", qreal(0));
+ state1->setPropertyOnEntry(p6, "opacity", qreal(0));
+
+ // State 2
+ state2->setPropertyOnEntry(button, "text", "Switch to state 3");
+ state2->setPropertyOnEntry(widget, "geometry", QRectF(200, 150, 200, 150));
+ state2->setPropertyOnEntry(box, "geometry", QRect(9, 150, 190, 150));
+ state2->setPropertyOnEntry(p1, "geometry", QRectF(68-150, 185+150, 64, 64));
+ state2->setPropertyOnEntry(p2, "geometry", QRectF(168, 185+150, 64, 64));
+ state2->setPropertyOnEntry(p3, "geometry", QRectF(268+150, 185+150, 64, 64));
+ state2->setPropertyOnEntry(p4, "geometry", QRectF(64, 48, 64, 64));
+ state2->setPropertyOnEntry(p5, "geometry", QRectF(168, 48, 64, 64));
+ state2->setPropertyOnEntry(p6, "geometry", QRectF(268, 48, 64, 64));
+ state2->setPropertyOnEntry(p1, "zRotation", qreal(-270));
+ state2->setPropertyOnEntry(p2, "zRotation", qreal(90));
+ state2->setPropertyOnEntry(p3, "zRotation", qreal(270));
+ state2->setPropertyOnEntry(p4, "zRotation", qreal(0));
+ state2->setPropertyOnEntry(p5, "zRotation", qreal(0));
+ state2->setPropertyOnEntry(p6, "zRotation", qreal(0));
+ state2->setPropertyOnEntry(boxProxy, "opacity", qreal(1));
+ state2->setPropertyOnEntry(p1, "opacity", qreal(0));
+ state2->setPropertyOnEntry(p2, "opacity", qreal(0));
+ state2->setPropertyOnEntry(p3, "opacity", qreal(0));
+ state2->setPropertyOnEntry(p4, "opacity", qreal(1));
+ state2->setPropertyOnEntry(p5, "opacity", qreal(1));
+ state2->setPropertyOnEntry(p6, "opacity", qreal(1));
+
+ // State 3
+ state3->setPropertyOnEntry(button, "text", "Switch to state 1");
+ state3->setPropertyOnEntry(p1, "geometry", QRectF(5, 5, 64, 64));
+ state3->setPropertyOnEntry(p2, "geometry", QRectF(5, 5 + 64 + 5, 64, 64));
+ state3->setPropertyOnEntry(p3, "geometry", QRectF(5, 5 + (64 + 5) + 64, 64, 64));
+ state3->setPropertyOnEntry(p4, "geometry", QRectF(5 + 64 + 5, 5, 64, 64));
+ state3->setPropertyOnEntry(p5, "geometry", QRectF(5 + 64 + 5, 5 + 64 + 5, 64, 64));
+ state3->setPropertyOnEntry(p6, "geometry", QRectF(5 + 64 + 5, 5 + (64 + 5) + 64, 64, 64));
+ state3->setPropertyOnEntry(widget, "geometry", QRectF(138, 5, 400 - 138, 200));
+ state3->setPropertyOnEntry(box, "geometry", QRect(5, 205, 400, 90));
+ state3->setPropertyOnEntry(p1, "opacity", qreal(1));
+ state3->setPropertyOnEntry(p2, "opacity", qreal(1));
+ state3->setPropertyOnEntry(p3, "opacity", qreal(1));
+ state3->setPropertyOnEntry(p4, "opacity", qreal(1));
+ state3->setPropertyOnEntry(p5, "opacity", qreal(1));
+ state3->setPropertyOnEntry(p6, "opacity", qreal(1));
+
+ QParallelAnimationGroup animation1;
+
+ QSequentialAnimationGroup *animation1SubGroup;
+ animation1SubGroup = new QSequentialAnimationGroup(&animation1);
+ animation1SubGroup->addPause(250);
+ animation1SubGroup->addAnimation(new QPropertyAnimation(box, "geometry"));
+
+ animation1.addAnimation(new QPropertyAnimation(widget, "geometry"));
+ animation1.addAnimation(new QPropertyAnimation(p1, "geometry"));
+ animation1.addAnimation(new QPropertyAnimation(p2, "geometry"));
+ animation1.addAnimation(new QPropertyAnimation(p3, "geometry"));
+ animation1.addAnimation(new QPropertyAnimation(p4, "geometry"));
+ animation1.addAnimation(new QPropertyAnimation(p5, "geometry"));
+ animation1.addAnimation(new QPropertyAnimation(p6, "geometry"));
+ animation1.addAnimation(new QPropertyAnimation(p1, "zRotation"));
+ animation1.addAnimation(new QPropertyAnimation(p2, "zRotation"));
+ animation1.addAnimation(new QPropertyAnimation(p3, "zRotation"));
+ animation1.addAnimation(new QPropertyAnimation(p4, "zRotation"));
+ animation1.addAnimation(new QPropertyAnimation(p5, "zRotation"));
+ animation1.addAnimation(new QPropertyAnimation(p6, "zRotation"));
+ animation1.addAnimation(new QPropertyAnimation(p1, "opacity"));
+ animation1.addAnimation(new QPropertyAnimation(p2, "opacity"));
+ animation1.addAnimation(new QPropertyAnimation(p3, "opacity"));
+ animation1.addAnimation(new QPropertyAnimation(p4, "opacity"));
+ animation1.addAnimation(new QPropertyAnimation(p5, "opacity"));
+ animation1.addAnimation(new QPropertyAnimation(p6, "opacity"));
+
+ QParallelAnimationGroup animation2;
+ animation2.addAnimation(new QPropertyAnimation(box, "geometry"));
+ animation2.addAnimation(new QPropertyAnimation(widget, "geometry"));
+ animation2.addAnimation(new QPropertyAnimation(p1, "geometry"));
+ animation2.addAnimation(new QPropertyAnimation(p2, "geometry"));
+ animation2.addAnimation(new QPropertyAnimation(p3, "geometry"));
+ animation2.addAnimation(new QPropertyAnimation(p4, "geometry"));
+ animation2.addAnimation(new QPropertyAnimation(p5, "geometry"));
+ animation2.addAnimation(new QPropertyAnimation(p6, "geometry"));
+ animation2.addAnimation(new QPropertyAnimation(p1, "zRotation"));
+ animation2.addAnimation(new QPropertyAnimation(p2, "zRotation"));
+ animation2.addAnimation(new QPropertyAnimation(p3, "zRotation"));
+ animation2.addAnimation(new QPropertyAnimation(p4, "zRotation"));
+ animation2.addAnimation(new QPropertyAnimation(p5, "zRotation"));
+ animation2.addAnimation(new QPropertyAnimation(p6, "zRotation"));
+ animation2.addAnimation(new QPropertyAnimation(p1, "opacity"));
+ animation2.addAnimation(new QPropertyAnimation(p2, "opacity"));
+ animation2.addAnimation(new QPropertyAnimation(p3, "opacity"));
+ animation2.addAnimation(new QPropertyAnimation(p4, "opacity"));
+ animation2.addAnimation(new QPropertyAnimation(p5, "opacity"));
+ animation2.addAnimation(new QPropertyAnimation(p6, "opacity"));
+
+ QParallelAnimationGroup animation3;
+ animation3.addAnimation(new QPropertyAnimation(box, "geometry"));
+ animation3.addAnimation(new QPropertyAnimation(widget, "geometry"));
+ animation3.addAnimation(new QPropertyAnimation(p1, "geometry"));
+ animation3.addAnimation(new QPropertyAnimation(p2, "geometry"));
+ animation3.addAnimation(new QPropertyAnimation(p3, "geometry"));
+ animation3.addAnimation(new QPropertyAnimation(p4, "geometry"));
+ animation3.addAnimation(new QPropertyAnimation(p5, "geometry"));
+ animation3.addAnimation(new QPropertyAnimation(p6, "geometry"));
+ animation3.addAnimation(new QPropertyAnimation(p1, "zRotation"));
+ animation3.addAnimation(new QPropertyAnimation(p2, "zRotation"));
+ animation3.addAnimation(new QPropertyAnimation(p3, "zRotation"));
+ animation3.addAnimation(new QPropertyAnimation(p4, "zRotation"));
+ animation3.addAnimation(new QPropertyAnimation(p5, "zRotation"));
+ animation3.addAnimation(new QPropertyAnimation(p6, "zRotation"));
+ animation3.addAnimation(new QPropertyAnimation(p1, "opacity"));
+ animation3.addAnimation(new QPropertyAnimation(p2, "opacity"));
+ animation3.addAnimation(new QPropertyAnimation(p3, "opacity"));
+ animation3.addAnimation(new QPropertyAnimation(p4, "opacity"));
+ animation3.addAnimation(new QPropertyAnimation(p5, "opacity"));
+ animation3.addAnimation(new QPropertyAnimation(p6, "opacity"));
+
+ state1->addAnimatedTransition(button, SIGNAL(clicked()), state2, &animation1);
+ state2->addAnimatedTransition(button, SIGNAL(clicked()), state3, &animation2);
+ state3->addAnimatedTransition(button, SIGNAL(clicked()), state1, &animation3);
+
+ machine.start();
+
+ QGraphicsView view(&scene);
+ view.show();
+
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/examples/animation/states/states.pro b/examples/animation/states/states.pro
new file mode 100644
index 0000000..f4d1e0b
--- /dev/null
+++ b/examples/animation/states/states.pro
@@ -0,0 +1,8 @@
+SOURCES += main.cpp
+RESOURCES += states.qrc
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/animation/states
+sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS states.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/animation/states
+INSTALLS += target sources
diff --git a/examples/animation/states/states.qrc b/examples/animation/states/states.qrc
new file mode 100644
index 0000000..60ab3f7
--- /dev/null
+++ b/examples/animation/states/states.qrc
@@ -0,0 +1,10 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>accessories-dictionary.png</file>
+ <file>akregator.png</file>
+ <file>digikam.png</file>
+ <file>help-browser.png</file>
+ <file>k3b.png</file>
+ <file>kchart.png</file>
+</qresource>
+</RCC>
diff --git a/examples/animation/stickman/animation.cpp b/examples/animation/stickman/animation.cpp
new file mode 100644
index 0000000..998632a
--- /dev/null
+++ b/examples/animation/stickman/animation.cpp
@@ -0,0 +1,152 @@
+#include "animation.h"
+
+#include <QPointF>
+#include <QIODevice>
+#include <QDataStream>
+
+class Frame
+{
+public:
+ Frame() {
+ }
+
+ int nodeCount() const
+ {
+ return m_nodePositions.size();
+ }
+
+ void setNodeCount(int nodeCount)
+ {
+ while (nodeCount > m_nodePositions.size())
+ m_nodePositions.append(QPointF());
+
+ while (nodeCount < m_nodePositions.size())
+ m_nodePositions.removeLast();
+ }
+
+ QPointF nodePos(int idx) const
+ {
+ return m_nodePositions.at(idx);
+ }
+
+ void setNodePos(int idx, const QPointF &pos)
+ {
+ m_nodePositions[idx] = pos;
+ }
+
+private:
+ QList<QPointF> m_nodePositions;
+};
+
+Animation::Animation()
+{
+ m_currentFrame = 0;
+ m_frames.append(new Frame);
+}
+
+Animation::~Animation()
+{
+ qDeleteAll(m_frames);
+}
+
+void Animation::setTotalFrames(int totalFrames)
+{
+ while (m_frames.size() < totalFrames)
+ m_frames.append(new Frame);
+
+ while (totalFrames < m_frames.size())
+ delete m_frames.takeLast();
+}
+
+int Animation::totalFrames() const
+{
+ return m_frames.size();
+}
+
+void Animation::setCurrentFrame(int currentFrame)
+{
+ m_currentFrame = qMax(qMin(currentFrame, totalFrames()-1), 0);
+}
+
+int Animation::currentFrame() const
+{
+ return m_currentFrame;
+}
+
+void Animation::setNodeCount(int nodeCount)
+{
+ Frame *frame = m_frames.at(m_currentFrame);
+ frame->setNodeCount(nodeCount);
+}
+
+int Animation::nodeCount() const
+{
+ Frame *frame = m_frames.at(m_currentFrame);
+ return frame->nodeCount();
+}
+
+void Animation::setNodePos(int idx, const QPointF &pos)
+{
+ Frame *frame = m_frames.at(m_currentFrame);
+ frame->setNodePos(idx, pos);
+}
+
+QPointF Animation::nodePos(int idx) const
+{
+ Frame *frame = m_frames.at(m_currentFrame);
+ return frame->nodePos(idx);
+}
+
+QString Animation::name() const
+{
+ return m_name;
+}
+
+void Animation::setName(const QString &name)
+{
+ m_name = name;
+}
+
+void Animation::save(QIODevice *device) const
+{
+ QDataStream stream(device);
+ stream << m_name;
+ stream << m_frames.size();
+ foreach (Frame *frame, m_frames) {
+ stream << frame->nodeCount();
+ for (int i=0; i<frame->nodeCount(); ++i)
+ stream << frame->nodePos(i);
+ }
+}
+
+void Animation::load(QIODevice *device)
+{
+ if (!m_frames.isEmpty())
+ qDeleteAll(m_frames);
+
+ m_frames.clear();
+
+ QDataStream stream(device);
+ stream >> m_name;
+
+ int frameCount;
+ stream >> frameCount;
+
+ for (int i=0; i<frameCount; ++i) {
+
+ int nodeCount;
+ stream >> nodeCount;
+
+ Frame *frame = new Frame;
+ frame->setNodeCount(nodeCount);
+
+ for (int j=0; j<nodeCount; ++j) {
+ QPointF pos;
+ stream >> pos;
+
+ frame->setNodePos(j, pos);
+ }
+
+ m_frames.append(frame);
+ }
+} \ No newline at end of file
diff --git a/examples/animation/stickman/animation.h b/examples/animation/stickman/animation.h
new file mode 100644
index 0000000..22afab6
--- /dev/null
+++ b/examples/animation/stickman/animation.h
@@ -0,0 +1,40 @@
+#ifndef ANIMATION_H
+#define ANIMATION_H
+
+#include <QPointF>
+#include <QList>
+#include <QString>
+
+class Frame;
+class QIODevice;
+class Animation
+{
+public:
+ Animation();
+ ~Animation();
+
+ void setTotalFrames(int totalFrames);
+ int totalFrames() const;
+
+ void setCurrentFrame(int currentFrame);
+ int currentFrame() const;
+
+ void setNodeCount(int nodeCount);
+ int nodeCount() const;
+
+ void setNodePos(int idx, const QPointF &pos);
+ QPointF nodePos(int idx) const;
+
+ QString name() const;
+ void setName(const QString &name);
+
+ void save(QIODevice *device) const;
+ void load(QIODevice *device);
+
+private:
+ QString m_name;
+ QList<Frame *> m_frames;
+ int m_currentFrame;
+};
+
+#endif
diff --git a/examples/animation/stickman/animations/chilling b/examples/animation/stickman/animations/chilling
new file mode 100644
index 0000000..a81fc7a
--- /dev/null
+++ b/examples/animation/stickman/animations/chilling
Binary files differ
diff --git a/examples/animation/stickman/animations/dancing b/examples/animation/stickman/animations/dancing
new file mode 100644
index 0000000..462f66f
--- /dev/null
+++ b/examples/animation/stickman/animations/dancing
Binary files differ
diff --git a/examples/animation/stickman/animations/dead b/examples/animation/stickman/animations/dead
new file mode 100644
index 0000000..9859b4b
--- /dev/null
+++ b/examples/animation/stickman/animations/dead
Binary files differ
diff --git a/examples/animation/stickman/animations/jumping b/examples/animation/stickman/animations/jumping
new file mode 100644
index 0000000..12661a1
--- /dev/null
+++ b/examples/animation/stickman/animations/jumping
Binary files differ
diff --git a/examples/animation/stickman/graphicsview.cpp b/examples/animation/stickman/graphicsview.cpp
new file mode 100644
index 0000000..1b6afa9
--- /dev/null
+++ b/examples/animation/stickman/graphicsview.cpp
@@ -0,0 +1,15 @@
+#include "graphicsview.h"
+
+#include <QtGui/QKeyEvent>
+
+GraphicsView::GraphicsView(QWidget *parent) : QGraphicsView(parent) {}
+
+void GraphicsView::keyPressEvent(QKeyEvent *e)
+{
+ if (e->key() == Qt::Key_Escape)
+ close();
+
+ emit keyPressed(Qt::Key(e->key()));
+}
+
+
diff --git a/examples/animation/stickman/graphicsview.h b/examples/animation/stickman/graphicsview.h
new file mode 100644
index 0000000..9ea2cfb
--- /dev/null
+++ b/examples/animation/stickman/graphicsview.h
@@ -0,0 +1,19 @@
+#ifndef GRAPHICSVIEW_H
+#define GRAPHICSVIEW
+
+#include <QtGui/QGraphicsView>
+
+class GraphicsView: public QGraphicsView
+{
+ Q_OBJECT
+public:
+ GraphicsView(QWidget *parent = 0);
+
+protected:
+ void keyPressEvent(QKeyEvent *);
+
+signals:
+ void keyPressed(int key);
+};
+
+#endif
diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp
new file mode 100644
index 0000000..3e92aec
--- /dev/null
+++ b/examples/animation/stickman/lifecycle.cpp
@@ -0,0 +1,176 @@
+#include "lifecycle.h"
+#include "stickman.h"
+#include "node.h"
+#include "animation.h"
+#include "graphicsview.h"
+
+#include <QtCore>
+#include <QtGui>
+
+class KeyPressTransition: public QSignalTransition
+{
+public:
+ KeyPressTransition(GraphicsView *receiver, Qt::Key key)
+ : QSignalTransition(receiver, SIGNAL(keyPressed(int))), m_key(key)
+ {
+ }
+ KeyPressTransition(GraphicsView *receiver, Qt::Key key, QAbstractState *target)
+ : QSignalTransition(receiver, SIGNAL(keyPressed(int)), QList<QAbstractState*>() << target), m_key(key)
+ {
+ }
+
+ virtual bool eventTest(QEvent *e) const
+ {
+ if (QSignalTransition::eventTest(e)) {
+ QVariant key = static_cast<QSignalEvent*>(e)->arguments().at(0);
+ return (key.toInt() == int(m_key));
+ }
+
+ return false;
+ }
+private:
+ Qt::Key m_key;
+};
+
+class LightningStrikesTransition: public QEventTransition
+{
+public:
+ LightningStrikesTransition(QAbstractState *target)
+ : QEventTransition(this, QEvent::Timer, QList<QAbstractState*>() << target)
+ {
+ qsrand((uint)QDateTime::currentDateTime().toTime_t());
+ startTimer(1000);
+ }
+
+ virtual bool eventTest(QEvent *e) const
+ {
+ return QEventTransition::eventTest(e) && ((qrand() % 50) == 0);
+ }
+};
+
+LifeCycle::LifeCycle(StickMan *stickMan, GraphicsView *keyReceiver)
+ : m_stickMan(stickMan), m_keyReceiver(keyReceiver)
+{
+ // Create animation group to be used for all transitions
+ m_animationGroup = new QParallelAnimationGroup();
+ const int stickManNodeCount = m_stickMan->nodeCount();
+ for (int i=0; i<stickManNodeCount; ++i) {
+ QPropertyAnimation *pa = new QPropertyAnimation(m_stickMan->node(i), "position");
+ m_animationGroup->addAnimation(pa);
+ }
+
+ // Set up intial state graph
+ m_machine = new QStateMachine();
+ m_machine->setGlobalRestorePolicy(QState::RestoreProperties);
+
+ m_alive = new QState(m_machine->rootState());
+ m_alive->setObjectName("alive");
+
+ // Make it blink when lightning strikes before entering dead animation
+ QState *lightningBlink = new QState(m_machine->rootState());
+ lightningBlink->setRestorePolicy(QState::DoNotRestoreProperties);
+ lightningBlink->setPropertyOnEntry(m_stickMan->scene(), "backgroundBrush", Qt::white);
+ lightningBlink->setPropertyOnEntry(m_stickMan, "penColor", Qt::black);
+ lightningBlink->setPropertyOnEntry(m_stickMan, "fillColor", Qt::white);
+ lightningBlink->setPropertyOnEntry(m_stickMan, "isDead", true);
+
+ m_dead = new QState(m_machine->rootState());
+ m_dead->setRestorePolicy(QState::DoNotRestoreProperties);
+ m_dead->setPropertyOnEntry(m_stickMan->scene(), "backgroundBrush", Qt::black);
+ m_dead->setPropertyOnEntry(m_stickMan, "penColor", Qt::white);
+ m_dead->setPropertyOnEntry(m_stickMan, "fillColor", Qt::black);
+ m_dead->setObjectName("dead");
+
+ // Idle state (sets no properties)
+ m_idle = new QState(m_alive);
+ m_idle->setObjectName("idle");
+ m_alive->setInitialState(m_idle);
+
+ // Lightning strikes at random
+ m_alive->addTransition(new LightningStrikesTransition(lightningBlink));
+ m_alive->addTransition(new KeyPressTransition(m_keyReceiver, Qt::Key_L, lightningBlink));
+ connectByAnimation(m_machine->rootState(), lightningBlink, m_dead);
+
+ m_machine->setInitialState(m_alive);
+}
+
+void LifeCycle::setResetKey(Qt::Key resetKey)
+{
+ // When resetKey is pressed, enter the idle state and do a restoration animation
+ // (requires no animation pointer, since no property is being set in the idle state)
+ m_alive->addAnimatedTransition(new KeyPressTransition(m_keyReceiver, resetKey, m_idle));
+}
+
+void LifeCycle::setDeathAnimation(const QString &fileName)
+{
+ QState *deathAnimation = makeState(m_dead, fileName);
+ m_dead->setInitialState(deathAnimation);
+}
+
+void LifeCycle::start()
+{
+ m_machine->start();
+}
+
+void LifeCycle::connectByAnimation(QState *parentState,
+ QState *s1, QAbstractState *s2,
+ QAbstractTransition *transition)
+{
+ QAnimationState *animationState = new QAnimationState(m_animationGroup, parentState);
+
+ if (transition == 0)
+ s1->addTransition(animationState);
+ else {
+ transition->setTargetStates(QList<QAbstractState*>() << animationState);
+ s1->addTransition(transition);
+ }
+
+ animationState->addFinishedTransition(s2);
+}
+
+void LifeCycle::addActivity(const QString &fileName, Qt::Key key)
+{
+ QState *state = makeState(m_alive, fileName);
+ connectByAnimation(m_alive, m_alive, state, new KeyPressTransition(m_keyReceiver, key));
+}
+
+QState *LifeCycle::makeState(QState *parentState, const QString &animationFileName)
+{
+ QState *topLevel = new QState(parentState);
+
+ Animation animation;
+ {
+ QFile file(animationFileName);
+ if (file.open(QIODevice::ReadOnly))
+ animation.load(&file);
+ }
+
+ const int frameCount = animation.totalFrames();
+ QState *previousState = 0;
+ for (int i=0; i<frameCount; ++i) {
+ QState *frameState = new QState(topLevel);
+
+ animation.setCurrentFrame(i);
+ const int nodeCount = animation.nodeCount();
+ for (int j=0; j<nodeCount; ++j)
+ frameState->setPropertyOnEntry(m_stickMan->node(j), "position", animation.nodePos(j));
+
+ if (previousState == 0)
+ topLevel->setInitialState(frameState);
+ else
+ connectByAnimation(topLevel, previousState, frameState);
+ previousState = frameState;
+ }
+
+ // Loop
+ connectByAnimation(topLevel, previousState, topLevel->initialState());
+
+ return topLevel;
+
+}
+
+LifeCycle::~LifeCycle()
+{
+ delete m_machine;
+ delete m_animationGroup;
+}
diff --git a/examples/animation/stickman/lifecycle.h b/examples/animation/stickman/lifecycle.h
new file mode 100644
index 0000000..8094a76
--- /dev/null
+++ b/examples/animation/stickman/lifecycle.h
@@ -0,0 +1,40 @@
+#ifndef LIFECYCLE_H
+#define LIFECYCLE_H
+
+#include <Qt>
+
+class StickMan;
+class QStateMachine;
+class QAnimationGroup;
+class QState;
+class QAbstractState;
+class QAbstractTransition;
+class GraphicsView;
+class LifeCycle
+{
+public:
+ LifeCycle(StickMan *stickMan, GraphicsView *keyEventReceiver);
+ ~LifeCycle();
+
+ void setDeathAnimation(const QString &fileName);
+ void setResetKey(Qt::Key key);
+ void addActivity(const QString &fileName, Qt::Key key);
+
+ void start();
+
+private:
+ void connectByAnimation(QState *parentState, QState *s1, QAbstractState *s2,
+ QAbstractTransition *transition = 0);
+ QState *makeState(QState *parentState, const QString &animationFileName);
+
+ StickMan *m_stickMan;
+ QStateMachine *m_machine;
+ QAnimationGroup *m_animationGroup;
+ GraphicsView *m_keyReceiver;
+
+ QState *m_alive;
+ QState *m_dead;
+ QState *m_idle;
+};
+
+#endif
diff --git a/examples/animation/stickman/main.cpp b/examples/animation/stickman/main.cpp
new file mode 100644
index 0000000..a094e28
--- /dev/null
+++ b/examples/animation/stickman/main.cpp
@@ -0,0 +1,58 @@
+#include "animation.h"
+#include "node.h"
+#include "lifecycle.h"
+#include "stickman.h"
+#include "graphicsview.h"
+
+#include <QtCore>
+#include <QtGui>
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ StickMan *stickMan = new StickMan;
+ stickMan->setDrawSticks(false);
+
+ QGraphicsTextItem *textItem = new QGraphicsTextItem();
+ textItem->setHtml("<font color=\"white\"><b>Stickman</b>"
+ "<p>"
+ "Tell the stickman what to do!"
+ "</p>"
+ "<p><i>"
+ "<li>Press <font color=\"purple\">J</font> to make the stickman jump.</li>"
+ "<li>Press <font color=\"purple\">D</font> to make the stickman dance.</li>"
+ "<li>Press <font color=\"purple\">C</font> to make him chill out.</li>"
+ "<li>Press <font color=\"purple\">Return</font> to make him return to his original position.</li>"
+ "<li>When you are done, press <font color=\"purple\">Escape</font>.</li>"
+ "</i></p>"
+ "<p>If you are unlucky, the stickman will get struck by lightning, and never jump, dance or chill out again."
+ "</p></font>");
+ qreal w = textItem->boundingRect().width();
+ QRectF stickManBoundingRect = stickMan->mapToScene(stickMan->boundingRect()).boundingRect();
+ textItem->setPos(-w / 2.0, stickManBoundingRect.bottom() + 25.0);
+
+ QGraphicsScene *scene = new QGraphicsScene();
+ scene->addItem(stickMan);
+ scene->addItem(textItem);
+ scene->setBackgroundBrush(Qt::black);
+
+ GraphicsView *view = new GraphicsView();
+ view->setRenderHints(QPainter::Antialiasing);
+ view->setTransformationAnchor(QGraphicsView::NoAnchor);
+ view->setScene(scene);
+ view->showFullScreen();
+ view->setFocus();
+ view->setSceneRect(scene->sceneRect());
+
+ LifeCycle *cycle = new LifeCycle(stickMan, view);
+ cycle->setResetKey(Qt::Key_Return);
+ cycle->setDeathAnimation("animations/dead");
+
+ cycle->addActivity("animations/jumping", Qt::Key_J);
+ cycle->addActivity("animations/dancing", Qt::Key_D);
+ cycle->addActivity("animations/chilling", Qt::Key_C);
+ cycle->start();
+
+ return app.exec();
+}
diff --git a/examples/animation/stickman/node.cpp b/examples/animation/stickman/node.cpp
new file mode 100644
index 0000000..f3468d0
--- /dev/null
+++ b/examples/animation/stickman/node.cpp
@@ -0,0 +1,42 @@
+#include "node.h"
+
+#include <QRectF>
+#include <QPainter>
+#include <QGraphicsSceneMouseEvent>
+
+Node::Node(const QPointF &pos, QGraphicsItem *parent)
+ : QGraphicsItem(parent), m_dragging(false)
+{
+ setPos(pos);
+}
+
+Node::~Node()
+{
+}
+
+QRectF Node::boundingRect() const
+{
+ return QRectF(-6.0, -6.0, 12.0, 12.0);
+}
+
+void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ painter->setPen(Qt::white);
+ painter->drawEllipse(QPointF(0.0, 0.0), 5.0, 5.0);
+}
+
+void Node::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ m_dragging = true;
+}
+
+void Node::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
+{
+ if (m_dragging)
+ setPos(mapToParent(event->pos()));
+}
+
+void Node::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
+ m_dragging = false;
+} \ No newline at end of file
diff --git a/examples/animation/stickman/node.h b/examples/animation/stickman/node.h
new file mode 100644
index 0000000..b796774
--- /dev/null
+++ b/examples/animation/stickman/node.h
@@ -0,0 +1,26 @@
+#ifndef NODE_H
+#define NODE_H
+
+#include <QGraphicsItem>
+
+class Node: public QObject, public QGraphicsItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QPointF position READ pos WRITE setPos);
+public:
+ Node(const QPointF &pos, QGraphicsItem *parent = 0);
+ ~Node();
+
+ QRectF boundingRect() const;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+protected:
+ void mousePressEvent(QGraphicsSceneMouseEvent *);
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *);
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
+
+private:
+ bool m_dragging;
+};
+
+#endif
diff --git a/examples/animation/stickman/stickman.cpp b/examples/animation/stickman/stickman.cpp
new file mode 100644
index 0000000..22d48d3
--- /dev/null
+++ b/examples/animation/stickman/stickman.cpp
@@ -0,0 +1,299 @@
+#include "stickman.h"
+#include "node.h"
+
+#include <QPainter>
+#include <QTimer>
+
+#define _USE_MATH_DEFINES
+#include <math.h>
+
+static const int NodeCount = 16;
+static const qreal Coords[NodeCount * 2] = {
+ 0.0, -150.0, // head, #0
+
+ 0.0, -100.0, // body pentagon, top->bottom, left->right, #1 - 5
+ -50.0, -50.0,
+ 50.0, -50.0,
+ -25.0, 50.0,
+ 25.0, 50.0,
+
+ -100.0, 0.0, // right arm, #6 - 7
+ -125.0, 50.0,
+
+ 100.0, 0.0, // left arm, #8 - 9
+ 125.0, 50.0,
+
+ -35.0, 75.0, // lower body, #10 - 11
+ 35.0, 75.0,
+
+ -25.0, 200.0, // right leg, #12 - 13
+ -30.0, 300.0,
+
+ 25.0, 200.0, // left leg, #14 - 15
+ 30.0, 300.0
+
+};
+
+static const int BoneCount = 24;
+static const int Bones[BoneCount * 2] = {
+ 0, 1, // neck
+
+ 1, 2, // body
+ 1, 3,
+ 1, 4,
+ 1, 5,
+ 2, 3,
+ 2, 4,
+ 2, 5,
+ 3, 4,
+ 3, 5,
+ 4, 5,
+
+ 2, 6, // right arm
+ 6, 7,
+
+ 3, 8, // left arm
+ 8, 9,
+
+ 4, 10, // lower body
+ 4, 11,
+ 5, 10,
+ 5, 11,
+ 10, 11,
+
+ 10, 12, // right leg
+ 12, 13,
+
+ 11, 14, // left leg
+ 14, 15
+
+};
+
+StickMan::StickMan()
+{
+ m_nodes = new Node*[NodeCount];
+ m_sticks = true;
+ m_isDead = false;
+ m_pixmap = QPixmap("images/head.png");
+ m_penColor = Qt::white;
+ m_fillColor = Qt::black;
+
+ // Set up start position of limbs
+ for (int i=0; i<NodeCount; ++i) {
+ m_nodes[i] = new Node(QPointF(Coords[i * 2], Coords[i * 2 + 1]), this);
+ }
+
+ m_perfectBoneLengths = new qreal[BoneCount];
+ for (int i=0; i<BoneCount; ++i) {
+ int n1 = Bones[i * 2];
+ int n2 = Bones[i * 2 + 1];
+
+ Node *node1 = m_nodes[n1];
+ Node *node2 = m_nodes[n2];
+
+ QPointF dist = node1->pos() - node2->pos();
+ m_perfectBoneLengths[i] = sqrt(pow(dist.x(),2) + pow(dist.y(),2));
+ }
+
+ startTimer(10);
+}
+
+StickMan::~StickMan()
+{
+ delete m_nodes;
+}
+
+void StickMan::setDrawSticks(bool on)
+{
+ m_sticks = on;
+ for (int i=0;i<nodeCount();++i) {
+ Node *node = m_nodes[i];
+ node->setVisible(on);
+ }
+}
+
+QRectF StickMan::boundingRect() const
+{
+ // account for head radius=50.0 plus pen which is 5.0, plus jump height :-)
+ return QRectF(-125, -200, 250, 450 + 50).adjusted(-55.0, -55.0, 55.0, 55.0);
+}
+
+int StickMan::nodeCount() const
+{
+ return NodeCount;
+}
+
+Node *StickMan::node(int idx) const
+{
+ const_cast<StickMan *>(this)->prepareGeometryChange();
+ if (idx >= 0 && idx < NodeCount)
+ return m_nodes[idx];
+ else
+ return 0;
+}
+
+void StickMan::timerEvent(QTimerEvent *e)
+{
+ prepareGeometryChange();
+}
+
+void StickMan::stabilize()
+{
+ for (int i=0; i<BoneCount; ++i) {
+ int n1 = Bones[i * 2];
+ int n2 = Bones[i * 2 + 1];
+
+ Node *node1 = m_nodes[n1];
+ Node *node2 = m_nodes[n2];
+
+ QPointF pos1 = node1->pos();
+ QPointF pos2 = node2->pos();
+
+ QPointF dist = pos1 - pos2;
+ qreal length = sqrt(pow(dist.x(),2) + pow(dist.y(),2));
+ qreal diff = (length - m_perfectBoneLengths[i]) / length;
+
+ pos1 -= dist * (0.5 * diff);
+ pos2 += dist * (0.5 * diff);
+
+ node1->setPos(pos1);
+ node2->setPos(pos2);
+
+ }
+}
+
+QPointF StickMan::posFor(int idx) const
+{
+ return m_nodes[idx]->pos();
+}
+
+//#include <QTime>
+void StickMan::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+{
+ /* static int frames = 0;
+ static QTime time;
+ if (frames++ % 100 == 0) {
+ frames = 1;
+ time.restart();
+ }
+
+ if (time.elapsed() > 0) {
+ painter->setPen(Qt::white);
+ painter->drawText(0, 0, QString::number(frames / (time.elapsed() / 1000.0)));
+ }*/
+
+ stabilize();
+ if (m_sticks) {
+ painter->setPen(Qt::white);
+ for (int i=0; i<BoneCount; ++i) {
+ int n1 = Bones[i * 2];
+ int n2 = Bones[i * 2 + 1];
+
+ Node *node1 = m_nodes[n1];
+ Node *node2 = m_nodes[n2];
+
+ painter->drawLine(node1->pos(), node2->pos());
+ }
+ } else {
+ // first bone is neck and will be used for head
+
+ QPainterPath path;
+ path.moveTo(posFor(0));
+ path.lineTo(posFor(1));
+
+ // right arm
+ path.lineTo(posFor(2));
+ path.lineTo(posFor(6));
+ path.lineTo(posFor(7));
+
+ // left arm
+ path.moveTo(posFor(3));
+ path.lineTo(posFor(8));
+ path.lineTo(posFor(9));
+
+ // body
+ path.moveTo(posFor(2));
+ path.lineTo(posFor(4));
+ path.lineTo(posFor(10));
+ path.lineTo(posFor(11));
+ path.lineTo(posFor(5));
+ path.lineTo(posFor(3));
+ path.lineTo(posFor(1));
+
+ // right leg
+ path.moveTo(posFor(10));
+ path.lineTo(posFor(12));
+ path.lineTo(posFor(13));
+
+ // left leg
+ path.moveTo(posFor(11));
+ path.lineTo(posFor(14));
+ path.lineTo(posFor(15));
+
+ painter->setPen(QPen(m_penColor, 5.0, Qt::SolidLine, Qt::RoundCap));
+ painter->drawPath(path);
+
+ {
+ int n1 = Bones[0];
+ int n2 = Bones[1];
+ Node *node1 = m_nodes[n1];
+ Node *node2 = m_nodes[n2];
+
+ QPointF dist = node2->pos() - node1->pos();
+
+ qreal sinAngle = dist.x() / sqrt(pow(dist.x(), 2) + pow(dist.y(), 2));
+ qreal angle = asin(sinAngle) * 180.0 / M_PI;
+
+ QPointF headPos = node1->pos();
+ painter->save();
+ painter->translate(headPos);
+ painter->rotate(-angle);
+
+ painter->setBrush(m_fillColor);
+ painter->drawEllipse(QPointF(0,0), 50.0, 50.0);
+
+ /*painter->drawArc(QRectF(-20.0, 0.0, 40.0, 20.0), 30.0 * 16, 120.0 * 16);
+
+ painter->setBrush(m_penColor);
+ painter->drawEllipse(QPointF(-30.0, -30.0), 2.5, 2.5);
+ painter->drawEllipse(QPointF(30.0, -30.0), 2.5, 2.5);*/
+
+ painter->setBrush(m_penColor);
+ painter->setPen(QPen(m_penColor, 2.5, Qt::SolidLine, Qt::RoundCap));
+
+ // eyes
+ if (m_isDead) {
+ painter->drawLine(-30.0, -30.0, -20.0, -20.0);
+ painter->drawLine(-20.0, -30.0, -30.0, -20.0);
+
+ painter->drawLine(20.0, -30.0, 30.0, -20.0);
+ painter->drawLine(30.0, -30.0, 20.0, -20.0);
+ } else {
+ painter->drawChord(QRectF(-30.0, -30.0, 25.0, 70.0), 30.0*16, 120.0*16);
+ painter->drawChord(QRectF(5.0, -30.0, 25.0, 70.0), 30.0*16, 120.0*16);
+ }
+
+ // mouth
+ if (m_isDead) {
+ painter->drawLine(-28.0, 2.0, 29.0, 2.0);
+ } else {
+ painter->setBrush(QColor(128, 0, 64 ));
+ painter->drawChord(QRectF(-28.0, 2.0-55.0/2.0, 57.0, 55.0), 0.0, -180.0*16);
+ }
+
+ // pupils
+ if (!m_isDead) {
+ painter->setPen(QPen(m_fillColor, 1.0, Qt::SolidLine, Qt::RoundCap));
+ painter->setBrush(m_fillColor);
+ painter->drawEllipse(QPointF(-12.0, -25.0), 5.0, 5.0);
+ painter->drawEllipse(QPointF(22.0, -25.0), 5.0, 5.0);
+ }
+
+
+ painter->restore();
+ }
+ }
+}
+
+
+
diff --git a/examples/animation/stickman/stickman.h b/examples/animation/stickman/stickman.h
new file mode 100644
index 0000000..ae406ca
--- /dev/null
+++ b/examples/animation/stickman/stickman.h
@@ -0,0 +1,59 @@
+#ifndef STICKMAN_H
+#define STICKMAN_H
+
+#include <QGraphicsItem>
+
+const int LimbCount = 16;
+
+class Node;
+class QTimer;
+class StickMan: public QObject, public QGraphicsItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor penColor WRITE setPenColor READ penColor)
+ Q_PROPERTY(QColor fillColor WRITE setFillColor READ fillColor)
+ Q_PROPERTY(bool isDead WRITE setIsDead READ isDead)
+public:
+ StickMan();
+ ~StickMan();
+
+ virtual QRectF boundingRect() const;
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+ int nodeCount() const;
+ Node *node(int idx) const;
+
+ void setDrawSticks(bool on);
+ bool drawSticks() const { return m_sticks; }
+
+ QColor penColor() const { return m_penColor; }
+ void setPenColor(const QColor &color) { m_penColor = color; }
+
+ QColor fillColor() const { return m_fillColor; }
+ void setFillColor(const QColor &color) { m_fillColor = color; }
+
+ bool isDead() const { return m_isDead; }
+ void setIsDead(bool isDead) { m_isDead = isDead; }
+
+public slots:
+ void stabilize();
+
+protected:
+ void timerEvent(QTimerEvent *e);
+
+private:
+ QPointF posFor(int idx) const;
+
+ Node **m_nodes;
+ qreal *m_perfectBoneLengths;
+
+ uint m_sticks : 1;
+ uint m_isDead : 1;
+ uint m_reserved : 30;
+
+ QPixmap m_pixmap;
+ QColor m_penColor;
+ QColor m_fillColor;
+};
+
+#endif // STICKMAN_H
diff --git a/examples/animation/stickman/stickman.pro b/examples/animation/stickman/stickman.pro
new file mode 100644
index 0000000..136cb44
--- /dev/null
+++ b/examples/animation/stickman/stickman.pro
@@ -0,0 +1,12 @@
+######################################################################
+# Automatically generated by qmake (2.01a) ti 3. feb 19:50:14 2009
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += stickman.h animation.h node.h lifecycle.h graphicsview.h
+SOURCES += main.cpp stickman.cpp animation.cpp node.cpp lifecycle.cpp graphicsview.cpp
diff --git a/examples/animation/sub-attaq/animationmanager.cpp b/examples/animation/sub-attaq/animationmanager.cpp
new file mode 100644
index 0000000..9f99426
--- /dev/null
+++ b/examples/animation/sub-attaq/animationmanager.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//Own
+#include "animationmanager.h"
+
+//Qt
+#if defined(QT_EXPERIMENTAL_SOLUTION)
+# include "qabstractanimation.h"
+#else
+# include <QtCore/QAbstractAnimation>
+#endif
+#include <QDebug>
+
+// the universe's only animation manager
+AnimationManager *AnimationManager::instance = 0;
+
+AnimationManager::AnimationManager()
+{
+}
+
+AnimationManager *AnimationManager::self()
+{
+ if (!instance)
+ instance = new AnimationManager;
+ return instance;
+}
+
+void AnimationManager::registerAnimation(QAbstractAnimation *anim)
+{
+ animations.append(anim);
+}
+
+void AnimationManager::unregisterAnimation(QAbstractAnimation *anim)
+{
+ animations.removeAll(anim);
+}
+
+void AnimationManager::unregisterAllAnimations()
+{
+ animations.clear();
+}
+
+void AnimationManager::pauseAll()
+{
+ foreach (QAbstractAnimation* animation, animations)
+ {
+ if (animation->state() == QAbstractAnimation::Running)
+ animation->pause();
+ }
+}
+void AnimationManager::resumeAll()
+{
+ foreach (QAbstractAnimation* animation, animations)
+ {
+ if (animation->state() == QAbstractAnimation::Paused)
+ animation->resume();
+ }
+}
diff --git a/examples/animation/sub-attaq/animationmanager.h b/examples/animation/sub-attaq/animationmanager.h
new file mode 100644
index 0000000..fe92680
--- /dev/null
+++ b/examples/animation/sub-attaq/animationmanager.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ANIMATIONMANAGER_H
+#define ANIMATIONMANAGER_H
+
+#include <QObject>
+
+class QAbstractAnimation;
+
+class AnimationManager : public QObject
+{
+Q_OBJECT
+public:
+ AnimationManager();
+ void registerAnimation(QAbstractAnimation *anim);
+ void unregisterAnimation(QAbstractAnimation *anim);
+ void unregisterAllAnimations();
+ static AnimationManager *self();
+
+public slots:
+ void pauseAll();
+ void resumeAll();
+
+private:
+ static AnimationManager *instance;
+ QList<QAbstractAnimation *> animations;
+};
+
+#endif // ANIMATIONMANAGER_H
diff --git a/examples/animation/sub-attaq/boat.cpp b/examples/animation/sub-attaq/boat.cpp
new file mode 100644
index 0000000..6824f17
--- /dev/null
+++ b/examples/animation/sub-attaq/boat.cpp
@@ -0,0 +1,293 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//Own
+#include "boat.h"
+#include "boat_p.h"
+#include "bomb.h"
+#include "pixmapitem.h"
+#include "graphicsscene.h"
+#include "animationmanager.h"
+#include "custompropertyanimation.h"
+
+//Qt
+#if defined(QT_EXPERIMENTAL_SOLUTION)
+# include "qpropertyanimation.h"
+# include "qstatemachine.h"
+# include "qhistorystate.h"
+# include "qfinalstate.h"
+# include "qstate.h"
+#include "qsequentialanimationgroup.h"
+#include "qanimationstate.h"
+#else
+#include <QPropertyAnimation>
+#include <QStateMachine>
+#include <QHistoryState>
+#include <QFinalState>
+#include <QState>
+#include <QSequentialAnimationGroup>
+#include <QAnimationState>
+#endif
+
+static QAbstractAnimation *setupDestroyAnimation(Boat *boat)
+{
+ QSequentialAnimationGroup *group = new QSequentialAnimationGroup(boat);
+#if QT_VERSION >=0x040500
+ PixmapItem *step1 = new PixmapItem(QString("explosion/boat/step1"),GraphicsScene::Big, boat);
+ step1->setZValue(6);
+ PixmapItem *step2 = new PixmapItem(QString("explosion/boat/step2"),GraphicsScene::Big, boat);
+ step2->setZValue(6);
+ PixmapItem *step3 = new PixmapItem(QString("explosion/boat/step3"),GraphicsScene::Big, boat);
+ step3->setZValue(6);
+ PixmapItem *step4 = new PixmapItem(QString("explosion/boat/step4"),GraphicsScene::Big, boat);
+ step4->setZValue(6);
+ step1->setOpacity(0);
+ step2->setOpacity(0);
+ step3->setOpacity(0);
+ step4->setOpacity(0);
+ CustomPropertyAnimation *anim1 = new CustomPropertyAnimation(boat);
+ anim1->setMemberFunctions((QGraphicsItem*)step1, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity);
+ anim1->setDuration(100);
+ anim1->setEndValue(1);
+ CustomPropertyAnimation *anim2 = new CustomPropertyAnimation(boat);
+ anim2->setMemberFunctions((QGraphicsItem*)step2, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity);
+ anim2->setDuration(100);
+ anim2->setEndValue(1);
+ CustomPropertyAnimation *anim3 = new CustomPropertyAnimation(boat);
+ anim3->setMemberFunctions((QGraphicsItem*)step3, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity);
+ anim3->setDuration(100);
+ anim3->setEndValue(1);
+ CustomPropertyAnimation *anim4 = new CustomPropertyAnimation(boat);
+ anim4->setMemberFunctions((QGraphicsItem*)step4, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity);
+ anim4->setDuration(100);
+ anim4->setEndValue(1);
+ group->addAnimation(anim1);
+ group->addAnimation(anim2);
+ group->addAnimation(anim3);
+ group->addAnimation(anim4);
+#else
+ // work around for a bug where we don't transition if the duration is zero.
+ QtPauseAnimation *anim = new QtPauseAnimation(group);
+ anim->setDuration(1);
+ group->addAnimation(anim);
+#endif
+ AnimationManager::self()->registerAnimation(group);
+ return group;
+}
+
+
+
+Boat::Boat(QGraphicsItem * parent, Qt::WindowFlags wFlags)
+ : QGraphicsWidget(parent,wFlags), speed(0), bombsAlreadyLaunched(0), direction(Boat::None), movementAnimation(0)
+{
+ pixmapItem = new PixmapItem(QString("boat"),GraphicsScene::Big, this);
+ setZValue(4);
+ setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsFocusable);
+ resize(pixmapItem->boundingRect().size());
+
+ //The movement animation used to animate the boat
+ movementAnimation = new QPropertyAnimation(this, "pos");
+ AnimationManager::self()->registerAnimation(movementAnimation);
+
+ //We setup the state machien of the boat
+ QStateMachine *machine = new QStateMachine(this);
+ QState *moving = new QState(machine->rootState());
+ StopState *stopState = new StopState(this,moving);
+ machine->setInitialState(moving);
+ moving->setInitialState(stopState);
+ MoveStateRight *moveStateRight = new MoveStateRight(this,moving);
+ MoveStateLeft *moveStateLeft = new MoveStateLeft(this,moving);
+ LaunchStateRight *launchStateRight = new LaunchStateRight(this,machine->rootState());
+ LaunchStateLeft *launchStateLeft = new LaunchStateLeft(this,machine->rootState());
+
+ //then setup the transitions for the rightMove state
+ KeyStopTransition *leftStopRight = new KeyStopTransition(this,QEvent::KeyPress,Qt::Key_Left);
+ leftStopRight->setTargetState(stopState);
+ KeyMoveTransition *leftMoveRight = new KeyMoveTransition(this,QEvent::KeyPress,Qt::Key_Left);
+ leftMoveRight->setTargetState(moveStateRight);
+ KeyMoveTransition *rightMoveRight = new KeyMoveTransition(this,QEvent::KeyPress,Qt::Key_Right);
+ rightMoveRight->setTargetState(moveStateRight);
+ KeyMoveTransition *rightMoveStop = new KeyMoveTransition(this,QEvent::KeyPress,Qt::Key_Right);
+ rightMoveStop->setTargetState(moveStateRight);
+
+ //then setup the transitions for the leftMove state
+ KeyStopTransition *rightStopLeft = new KeyStopTransition(this,QEvent::KeyPress,Qt::Key_Right);
+ rightStopLeft->setTargetState(stopState);
+ KeyMoveTransition *rightMoveLeft = new KeyMoveTransition(this,QEvent::KeyPress,Qt::Key_Right);
+ rightMoveLeft->setTargetState(moveStateLeft);
+ KeyMoveTransition *leftMoveLeft = new KeyMoveTransition(this,QEvent::KeyPress,Qt::Key_Left);
+ leftMoveLeft->setTargetState(moveStateLeft);
+ KeyMoveTransition *leftMoveStop = new KeyMoveTransition(this,QEvent::KeyPress,Qt::Key_Left);
+ leftMoveStop->setTargetState(moveStateLeft);
+
+ //We set up the right move state
+ moveStateRight->addTransition(leftStopRight);
+ moveStateRight->addTransition(leftMoveRight);
+ moveStateRight->addTransition(rightMoveRight);
+ stopState->addTransition(rightMoveStop);
+
+ //We set up the left move state
+ moveStateLeft->addTransition(rightStopLeft);
+ moveStateLeft->addTransition(leftMoveLeft);
+ moveStateLeft->addTransition(rightMoveLeft);
+ stopState->addTransition(leftMoveStop);
+
+ //The animation is finished, it means we reached the border of the screen, the boat is stopped so we move to the stop state
+ moveStateLeft->addTransition(movementAnimation, SIGNAL(finished()), stopState);
+ moveStateRight->addTransition(movementAnimation, SIGNAL(finished()), stopState);
+
+ //We set up the keys for dropping bombs
+ KeyLaunchTransition *upFireLeft = new KeyLaunchTransition(this,QEvent::KeyPress,Qt::Key_Up);
+ upFireLeft->setTargetState(launchStateRight);
+ KeyLaunchTransition *upFireRight = new KeyLaunchTransition(this,QEvent::KeyPress,Qt::Key_Up);
+ upFireRight->setTargetState(launchStateRight);
+ KeyLaunchTransition *upFireStop = new KeyLaunchTransition(this,QEvent::KeyPress,Qt::Key_Up);
+ upFireStop->setTargetState(launchStateRight);
+ KeyLaunchTransition *downFireLeft = new KeyLaunchTransition(this,QEvent::KeyPress,Qt::Key_Down);
+ downFireLeft->setTargetState(launchStateLeft);
+ KeyLaunchTransition *downFireRight = new KeyLaunchTransition(this,QEvent::KeyPress,Qt::Key_Down);
+ downFireRight->setTargetState(launchStateLeft);
+ KeyLaunchTransition *downFireMove = new KeyLaunchTransition(this,QEvent::KeyPress,Qt::Key_Down);
+ downFireMove->setTargetState(launchStateLeft);
+
+ //We set up transitions for fire up
+ moveStateRight->addTransition(upFireRight);
+ moveStateLeft->addTransition(upFireLeft);
+ stopState->addTransition(upFireStop);
+
+ //We set up transitions for fire down
+ moveStateRight->addTransition(downFireRight);
+ moveStateLeft->addTransition(downFireLeft);
+ stopState->addTransition(downFireMove);
+
+ //Finally the launch state should come back to its original state
+ QHistoryState *historyState = moving->addHistoryState();
+ launchStateLeft->addTransition(historyState);
+ launchStateRight->addTransition(historyState);
+
+ QFinalState *final = new QFinalState(machine->rootState());
+
+ //This state play the destroyed animation
+ QAnimationState *destroyedState = new QAnimationState(machine->rootState());
+ destroyedState->addAnimation(setupDestroyAnimation(this));
+
+ //Play a nice animation when the boat is destroyed
+ moving->addTransition(this, SIGNAL(boatDestroyed()),destroyedState);
+
+ //Transition to final state when the destroyed animation is finished
+ destroyedState->addFinishedTransition(final);
+
+ //The machine has finished to be executed, then the boat is dead
+ connect(machine,SIGNAL(finished()),this, SIGNAL(boatExecutionFinished()));
+
+ machine->start();
+}
+
+void Boat::updateBoatMovement()
+{
+ if (speed == 0 || direction == Boat::None) {
+ movementAnimation->stop();
+ return;
+ }
+
+ movementAnimation->stop();
+ movementAnimation->setStartValue(pos());
+
+ if (direction == Boat::Left) {
+ movementAnimation->setEndValue(QPointF(0,y()));
+ movementAnimation->setDuration(x()/speed*15);
+ }
+ else /*if (direction == Boat::Right)*/ {
+ movementAnimation->setEndValue(QPointF(scene()->width()-size().width(),y()));
+ movementAnimation->setDuration((scene()->width()-size().width()-x())/speed*15);
+ }
+ movementAnimation->start();
+}
+
+void Boat::destroy()
+{
+ movementAnimation->stop();
+ emit boatDestroyed();
+}
+
+int Boat::bombsLaunched() const
+{
+ return bombsAlreadyLaunched;
+}
+
+void Boat::setBombsLaunched(int number)
+{
+ if (number > MAX_BOMB) {
+ qWarning("Boat::setBombsLaunched : It impossible to launch that number of bombs");
+ return;
+ }
+ bombsAlreadyLaunched = number;
+}
+
+int Boat::currentSpeed() const
+{
+ return speed;
+}
+
+void Boat::setCurrentSpeed(int speed)
+{
+ if (speed > 3 || speed < 0) {
+ qWarning("Boat::setCurrentSpeed: The boat can't run on that speed");
+ return;
+ }
+ this->speed = speed;
+}
+
+enum Boat::Movement Boat::currentDirection() const
+{
+ return direction;
+}
+
+void Boat::setCurrentDirection(Movement direction)
+{
+ this->direction = direction;
+}
+
+int Boat::type() const
+{
+ return Type;
+}
diff --git a/examples/animation/sub-attaq/boat.h b/examples/animation/sub-attaq/boat.h
new file mode 100644
index 0000000..4c4a737
--- /dev/null
+++ b/examples/animation/sub-attaq/boat.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __BOAT__H__
+#define __BOAT__H__
+
+//Qt
+#include <QObject>
+#include <QKeyEvent>
+
+#include <QDebug>
+
+#if defined(QT_EXPERIMENTAL_SOLUTION)
+# include "qgraphicswidget.h"
+#else
+# include <QtGui/QGraphicsWidget>
+#endif
+
+class PixmapItem;
+class Bomb;
+class QVariantAnimation;
+
+class Boat : public QGraphicsWidget
+{
+Q_OBJECT
+Q_PROPERTY(QPointF pos READ pos WRITE setPos)
+public:
+ enum Movement {
+ None = 0,
+ Left,
+ Right
+ };
+ enum { Type = UserType + 2 };
+ Boat(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
+ void destroy();
+
+ int bombsLaunched() const;
+ void setBombsLaunched(int number);
+
+ int currentSpeed() const;
+ void setCurrentSpeed(int speed);
+
+ enum Movement currentDirection() const;
+ void setCurrentDirection(Movement direction);
+
+ void updateBoatMovement();
+
+ virtual int type() const;
+
+Q_SIGNALS:
+ void boatDestroyed();
+ void boatExecutionFinished();
+
+private:
+ int speed;
+ int bombsAlreadyLaunched;
+ Movement direction;
+ QVariantAnimation *movementAnimation;
+ PixmapItem *pixmapItem;
+};
+
+#endif //__BOAT__H__
diff --git a/examples/animation/sub-attaq/boat_p.h b/examples/animation/sub-attaq/boat_p.h
new file mode 100644
index 0000000..8dacaba
--- /dev/null
+++ b/examples/animation/sub-attaq/boat_p.h
@@ -0,0 +1,258 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef BOAT_P_H
+#define BOAT_P_H
+
+//Own
+#include "bomb.h"
+#include "graphicsscene.h"
+
+// Qt
+#if defined(QT_EXPERIMENTAL_SOLUTION)
+# include "qkeyeventtransition.h"
+#else
+# include <QtGui/QKeyEventTransition>
+#endif
+
+static const int MAX_BOMB = 5;
+
+
+//These transtion test if we have to stop the boat (i.e current speed is 1)
+class KeyStopTransition : public QKeyEventTransition
+{
+public:
+ KeyStopTransition(Boat *boat, QEvent::Type type, int key)
+ : QKeyEventTransition(boat,type, key)
+ {
+ this->boat = boat;
+ this->key = key;
+#if defined(Q_OS_MAC)
+ setModifiers(Qt::KeypadModifier);
+#endif
+ }
+protected:
+ virtual bool eventTest(QEvent *event) const
+ {
+ Q_UNUSED(event);
+ if (!QKeyEventTransition::eventTest(event))
+ return false;
+ if (boat->currentSpeed() == 1)
+ return true;
+ else
+ return false;
+ }
+private:
+ Boat * boat;
+ int key;
+};
+
+//These transtion test if we have to move the boat (i.e current speed was 0 or another value)
+ class KeyMoveTransition : public QKeyEventTransition
+{
+public:
+ KeyMoveTransition(Boat *boat, QEvent::Type type, int key)
+ : QKeyEventTransition(boat,type, key)
+ {
+ this->boat = boat;
+ this->key = key;
+#if defined(Q_OS_MAC)
+ setModifiers(Qt::KeypadModifier);
+#endif
+ }
+protected:
+ virtual bool eventTest(QEvent *event) const
+ {
+ Q_UNUSED(event);
+ if (!QKeyEventTransition::eventTest(event))
+ return false;
+ if (boat->currentSpeed() >= 0)
+ return true;
+ else
+ return false;
+
+ }
+ void onTransition()
+ {
+ //We decrease the speed if needed
+ if (key == Qt::Key_Left && boat->currentDirection() == Boat::Right)
+ boat->setCurrentSpeed(boat->currentSpeed() - 1);
+ else if (key == Qt::Key_Right && boat->currentDirection() == Boat::Left)
+ boat->setCurrentSpeed(boat->currentSpeed() - 1);
+ else if (boat->currentSpeed() < 3)
+ boat->setCurrentSpeed(boat->currentSpeed() + 1);
+ boat->updateBoatMovement();
+ }
+private:
+ Boat * boat;
+ int key;
+};
+
+//This transition trigger the bombs launch
+ class KeyLaunchTransition : public QKeyEventTransition
+{
+public:
+ KeyLaunchTransition(Boat *boat, QEvent::Type type, int key)
+ : QKeyEventTransition(boat,type, key)
+ {
+ this->boat = boat;
+ this->key = key;
+#if defined(Q_OS_MAC)
+ setModifiers(Qt::KeypadModifier);
+#endif
+ }
+protected:
+ virtual bool eventTest(QEvent *event) const
+ {
+ Q_UNUSED(event);
+ if (!QKeyEventTransition::eventTest(event))
+ return false;
+ //We have enough bomb?
+ if (boat->bombsLaunched() < MAX_BOMB)
+ return true;
+ else
+ return false;
+ }
+private:
+ Boat * boat;
+ int key;
+};
+
+//This state is describing when the boat is moving right
+class MoveStateRight : public QState
+{
+public:
+ MoveStateRight(Boat *boat,QState *parent = 0) : QState(parent)
+ {
+ this->boat = boat;
+ }
+protected:
+ void onEntry()
+ {
+ boat->setCurrentDirection(Boat::Right);
+ boat->updateBoatMovement();
+ }
+private:
+ Boat * boat;
+};
+
+ //This state is describing when the boat is moving left
+class MoveStateLeft : public QState
+{
+public:
+ MoveStateLeft(Boat *boat,QState *parent = 0) : QState(parent)
+ {
+ this->boat = boat;
+ }
+protected:
+ void onEntry()
+ {
+ boat->setCurrentDirection(Boat::Left);
+ boat->updateBoatMovement();
+ }
+private:
+ Boat * boat;
+};
+
+//This state is describing when the boat is in a stand by position
+class StopState : public QState
+{
+public:
+ StopState(Boat *boat,QState *parent = 0) : QState(parent)
+ {
+ this->boat = boat;
+ }
+protected:
+ void onEntry()
+ {
+ boat->setCurrentSpeed(0);
+ boat->setCurrentDirection(Boat::None);
+ boat->updateBoatMovement();
+ }
+private:
+ Boat * boat;
+};
+
+//This state is describing the launch of the torpedo on the right
+class LaunchStateRight : public QState
+{
+public:
+ LaunchStateRight(Boat *boat,QState *parent = 0) : QState(parent)
+ {
+ this->boat = boat;
+ }
+protected:
+ void onEntry()
+ {
+ Bomb *b = new Bomb();
+ b->setPos(boat->x()+boat->size().width(),boat->y());
+ GraphicsScene *scene = static_cast<GraphicsScene *>(boat->scene());
+ scene->addItem(b);
+ b->launch(Bomb::Right);
+ boat->setBombsLaunched(boat->bombsLaunched() + 1);
+ }
+private:
+ Boat * boat;
+};
+
+//This state is describing the launch of the torpedo on the left
+class LaunchStateLeft : public QState
+{
+public:
+ LaunchStateLeft(Boat *boat,QState *parent = 0) : QState(parent)
+ {
+ this->boat = boat;
+ }
+protected:
+ void onEntry()
+ {
+ Bomb *b = new Bomb();
+ b->setPos(boat->x() - b->size().width(), boat->y());
+ GraphicsScene *scene = static_cast<GraphicsScene *>(boat->scene());
+ scene->addItem(b);
+ b->launch(Bomb::Left);
+ boat->setBombsLaunched(boat->bombsLaunched() + 1);
+ }
+private:
+ Boat * boat;
+};
+
+#endif // BOAT_P_H
diff --git a/examples/animation/sub-attaq/bomb.cpp b/examples/animation/sub-attaq/bomb.cpp
new file mode 100644
index 0000000..b6ae5a3
--- /dev/null
+++ b/examples/animation/sub-attaq/bomb.cpp
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//Own
+#include "bomb.h"
+#include "submarine.h"
+#include "pixmapitem.h"
+#include "animationmanager.h"
+
+//Qt
+
+#if defined(QT_EXPERIMENTAL_SOLUTION)
+#include "qpropertyanimation.h"
+#include "qsequentialanimationgroup.h"
+#include "qanimationstate.h"
+#include "qstatemachine.h"
+#include "qfinalstate.h"
+#else
+#include <QtCore/QSequentialAnimationGroup>
+#include <QtCore/QPropertyAnimation>
+#include <QtCore/QAnimationState>
+#include <QtCore/QStateMachine>
+#include <QtCore/QFinalState>
+#endif
+
+Bomb::Bomb(QGraphicsItem * parent, Qt::WindowFlags wFlags)
+ : QGraphicsWidget(parent,wFlags), launchAnimation(0)
+{
+ pixmapItem = new PixmapItem(QString("bomb"),GraphicsScene::Big, this);
+ setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ setFlags(QGraphicsItem::ItemIsMovable);
+ setZValue(2);
+ resize(pixmapItem->boundingRect().size());
+}
+
+void Bomb::launch(Bomb::Direction direction)
+{
+ launchAnimation = new QSequentialAnimationGroup();
+ AnimationManager::self()->registerAnimation(launchAnimation);
+ qreal delta = direction == Right ? 20 : - 20;
+ QPropertyAnimation *anim = new QPropertyAnimation(this, "pos");
+ anim->setEndValue(QPointF(x() + delta,y() - 20));
+ anim->setDuration(150);
+ launchAnimation->addAnimation(anim);
+ anim = new QPropertyAnimation(this, "pos");
+ anim->setEndValue(QPointF(x() + delta*2, y() ));
+ anim->setDuration(150);
+ launchAnimation->addAnimation(anim);
+ anim = new QPropertyAnimation(this, "pos");
+ anim->setEndValue(QPointF(x() + delta*2,scene()->height()));
+ anim->setDuration(y()/2*60);
+ launchAnimation->addAnimation(anim);
+ connect(anim,SIGNAL(valueChanged(const QVariant &)),this,SLOT(onAnimationLaunchValueChanged(const QVariant &)));
+
+ //We setup the state machine of the bomb
+ QStateMachine *machine = new QStateMachine(this);
+
+ //This state is when the launch animation is playing
+ QAnimationState *launched = new QAnimationState(launchAnimation,machine->rootState());
+
+ machine->setInitialState(launched);
+
+ //End
+ QFinalState *final = new QFinalState(machine->rootState());
+
+ //### Add a nice animation when the bomb is destroyed
+ launched->addTransition(this, SIGNAL(bombExplosed()),final);
+
+ //If the animation is finished, then we move to the final state
+ launched->addFinishedTransition(final);
+
+ //The machine has finished to be executed, then the boat is dead
+ connect(machine,SIGNAL(finished()),this, SIGNAL(bombExecutionFinished()));
+
+ machine->start();
+
+}
+
+void Bomb::onAnimationLaunchValueChanged(const QVariant &)
+{
+ foreach (QGraphicsItem * item , collidingItems(Qt::IntersectsItemBoundingRect)) {
+ if (item->type() == SubMarine::Type) {
+ SubMarine *s = static_cast<SubMarine *>(item);
+ destroy();
+ s->destroy();
+ }
+ }
+}
+
+void Bomb::destroy()
+{
+ launchAnimation->stop();
+ emit bombExplosed();
+}
diff --git a/examples/animation/sub-attaq/bomb.h b/examples/animation/sub-attaq/bomb.h
new file mode 100644
index 0000000..9191e6e
--- /dev/null
+++ b/examples/animation/sub-attaq/bomb.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __BOMB__H__
+#define __BOMB__H__
+
+//Qt
+#if defined(QT_EXPERIMENTAL_SOLUTION)
+# include "qanimationgroup.h"
+# include "qgraphicswidget.h"
+#else
+# include <QtGui/QGraphicsWidget>
+# include <QtCore/QAnimationGroup>
+#endif
+
+class PixmapItem;
+
+class Bomb : public QGraphicsWidget
+{
+Q_OBJECT
+Q_PROPERTY(QPointF pos READ pos WRITE setPos)
+public:
+ enum Direction {
+ Left = 0,
+ Right
+ };
+ Bomb(QGraphicsItem * parent = 0, Qt::WindowFlags wFlags = 0);
+ void launch(Direction direction);
+ void destroy();
+
+Q_SIGNALS:
+ void bombExplosed();
+ void bombExecutionFinished();
+
+private slots:
+ void onAnimationLaunchValueChanged(const QVariant &);
+
+private:
+ QAnimationGroup *launchAnimation;
+ PixmapItem *pixmapItem;
+};
+
+#endif //__BOMB__H__
diff --git a/examples/animation/sub-attaq/custompropertyanimation.cpp b/examples/animation/sub-attaq/custompropertyanimation.cpp
new file mode 100644
index 0000000..45997af
--- /dev/null
+++ b/examples/animation/sub-attaq/custompropertyanimation.cpp
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "custompropertyanimation.h"
+#include "custompropertyanimation_p.h"
+
+// Qt
+#include <QtCore/qdebug.h>
+
+QT_BEGIN_NAMESPACE
+
+
+void CustomPropertyAnimationPrivate::initDefaultStartValue()
+{
+ if (!animProp)
+ return;
+ QVariant def = animProp->read();
+ if (def.isValid())
+ convertValues(def.userType());
+ if (animProp && !defaultStartValue.isValid()
+ && ((currentTime == 0 && (currentIteration || currentIteration == 0))
+ || (currentTime == duration && currentIteration == (iterationCount - 1)))) {
+ setDefaultStartValue(def);
+ }
+}
+
+
+CustomPropertyAnimation::CustomPropertyAnimation(QObject *parent) :
+ QVariantAnimation(*new CustomPropertyAnimationPrivate, parent)
+{
+}
+
+CustomPropertyAnimation::~CustomPropertyAnimation()
+{
+}
+
+void CustomPropertyAnimation::setProperty(AbstractProperty *animProp)
+{
+ Q_D(CustomPropertyAnimation);
+ if (d->animProp == animProp)
+ return;
+ delete d->animProp;
+ d->animProp = animProp;
+}
+
+/*!
+ \reimp
+ */
+void CustomPropertyAnimation::updateCurrentValue(const QVariant &value)
+{
+ Q_D(CustomPropertyAnimation);
+ if (!d->animProp || state() == QAbstractAnimation::Stopped)
+ return;
+
+ d->animProp->write(value);
+}
+
+
+/*!
+ \reimp
+*/
+void CustomPropertyAnimation::updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState)
+{
+ Q_D(CustomPropertyAnimation);
+ // Initialize start value
+ if (oldState == QAbstractAnimation::Stopped)
+ d->initDefaultStartValue();
+
+ QVariantAnimation::updateState(oldState, newState);
+}
+
+
+
+#include "moc_custompropertyanimation.cpp"
+
+QT_END_NAMESPACE
diff --git a/examples/animation/sub-attaq/custompropertyanimation.h b/examples/animation/sub-attaq/custompropertyanimation.h
new file mode 100644
index 0000000..ba6ef55
--- /dev/null
+++ b/examples/animation/sub-attaq/custompropertyanimation.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CUSTOMPROPERTYANIMATION_H
+#define CUSTOMPROPERTYANIMATION_H
+
+#if defined(QT_EXPERIMENTAL_SOLUTION)
+# include "qvariantanimation.h"
+#else
+# include <QtCore/qvariantanimation.h>
+#endif
+
+class QGraphicsItem;
+class CustomPropertyAnimationPrivate;
+
+struct AbstractProperty
+{
+ virtual QVariant read() const = 0;
+ virtual void write(const QVariant &value) = 0;
+};
+
+
+class CustomPropertyAnimation : public QVariantAnimation
+{
+ Q_OBJECT
+
+ template <typename Target, typename T, typename T2 = T>
+ class MemberFunctionProperty : public AbstractProperty
+ {
+ public:
+ typedef T (Target::*Getter)(void) const;
+ typedef void (Target::*Setter)(T2);
+
+ MemberFunctionProperty(Target* target, Getter getter, Setter setter)
+ : m_target(target), m_getter(getter), m_setter(setter) {}
+
+ virtual void write(const QVariant &value)
+ {
+ if (m_setter) (m_target->*m_setter)(qVariantValue<T>(value));
+ }
+
+ virtual QVariant read() const
+ {
+ if (m_getter) return qVariantFromValue<T>((m_target->*m_getter)());
+ return QVariant();
+ }
+
+ private:
+ Target *m_target;
+ Getter m_getter;
+ Setter m_setter;
+ };
+
+public:
+ CustomPropertyAnimation(QObject *parent = 0);
+ ~CustomPropertyAnimation();
+
+ template<class Target, typename T>
+ void setMemberFunctions(Target* target, T (Target::*getter)() const, void (Target::*setter)(const T& ))
+ {
+ setProperty(new MemberFunctionProperty<Target, T, const T&>(target, getter, setter));
+ }
+
+ template<class Target, typename T>
+ void setMemberFunctions(Target* target, T (Target::*getter)() const, void (Target::*setter)(T))
+ {
+ setProperty(new MemberFunctionProperty<Target, T>(target, getter, setter));
+ }
+
+ void updateCurrentValue(const QVariant &value);
+ void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState);
+ void setProperty(AbstractProperty *animProp);
+
+private:
+ Q_DISABLE_COPY(CustomPropertyAnimation);
+ Q_DECLARE_PRIVATE(CustomPropertyAnimation);
+};
+
+#endif // CUSTOMPROPERTYANIMATION_H
diff --git a/examples/animation/sub-attaq/custompropertyanimation_p.h b/examples/animation/sub-attaq/custompropertyanimation_p.h
new file mode 100644
index 0000000..89fc757
--- /dev/null
+++ b/examples/animation/sub-attaq/custompropertyanimation_p.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CUSTOMPROPERTYANIMATION_P_H
+#define CUSTOMPROPERTYANIMATION_P_H
+
+#ifdef QT_EXPERIMENTAL_SOLUTION
+# include "qvariantanimation_p.h"
+#else
+# include <private/qvariantanimation_p.h>
+#endif
+
+class CustomPropertyAnimationPrivate : public QVariantAnimationPrivate
+{
+ Q_DECLARE_PUBLIC(CustomPropertyAnimation)
+public:
+ CustomPropertyAnimationPrivate() : QVariantAnimationPrivate(), animProp(0)
+ {
+ }
+
+ void initDefaultStartValue();
+
+ AbstractProperty *animProp;
+};
+
+#endif //QTCUSTOMPROPERTYANIMATION_P_H
diff --git a/examples/animation/sub-attaq/data.xml b/examples/animation/sub-attaq/data.xml
new file mode 100644
index 0000000..41d4754
--- /dev/null
+++ b/examples/animation/sub-attaq/data.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<subattaq>
+ <submarines>
+ <submarine type="0" points="10" name="Q1" />
+ <submarine type="1" points="20" name="Q2" />
+ </submarines>
+ <levels>
+ <level id="0" name="Seaman recruit">
+ <subinstance type="0" nb="2"/>
+ </level>
+ <level id="1" name="Seaman apprentice">
+ <subinstance type="0" nb="4"/>
+ </level>
+ </levels>
+</subattaq>
diff --git a/examples/animation/sub-attaq/graphicsscene.cpp b/examples/animation/sub-attaq/graphicsscene.cpp
new file mode 100644
index 0000000..a7f4c1b
--- /dev/null
+++ b/examples/animation/sub-attaq/graphicsscene.cpp
@@ -0,0 +1,368 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//Own
+#include "graphicsscene.h"
+#include "states.h"
+#include "boat.h"
+#include "submarine.h"
+#include "torpedo.h"
+#include "bomb.h"
+#include "pixmapitem.h"
+#include "custompropertyanimation.h"
+#include "animationmanager.h"
+
+//Qt
+#if defined(QT_EXPERIMENTAL_SOLUTION)
+#include "qpropertyanimation.h"
+#include "qsequentialanimationgroup.h"
+#include "qparallelanimationgroup.h"
+#include "qstatemachine.h"
+#include "qanimationstate.h"
+#include "qfinalstate.h"
+#include "qpauseanimation.h"
+#else
+#include <QPropertyAnimation>
+#include <QSequentialAnimationGroup>
+#include <QParallelAnimationGroup>
+#include <QStateMachine>
+#include <QAnimationState>
+#include <QFinalState>
+#include <QPauseAnimation>
+#endif
+#include <QAction>
+#include <QDir>
+#include <QApplication>
+#include <QMessageBox>
+#include <QGraphicsView>
+#include <QGraphicsSceneMouseEvent>
+#include <QXmlStreamReader>
+
+//helper function that creates an animation for position and inserts it into group
+static CustomPropertyAnimation *addGraphicsItemPosAnimation(QSequentialAnimationGroup *group,
+ QGraphicsItem *item, const QPointF &endPos)
+{
+ CustomPropertyAnimation *ret = new CustomPropertyAnimation(group);
+ ret->setMemberFunctions(item, &QGraphicsItem::pos, &QGraphicsItem::setPos);
+ ret->setEndValue(endPos);
+ ret->setDuration(200);
+ ret->setEasingCurve(QEasingCurve::OutElastic);
+ group->addPause(50);
+ return ret;
+}
+
+//helper function that creates an animation for opacity and inserts it into group
+static void addGraphicsItemFadeoutAnimation(QAnimationGroup *group, QGraphicsItem *item)
+{
+#if QT_VERSION >=0x040500
+ CustomPropertyAnimation *anim = new CustomPropertyAnimation(group);
+ anim->setMemberFunctions(item, &QGraphicsItem::opacity, &QGraphicsItem::setOpacity);
+ anim->setDuration(800);
+ anim->setEndValue(0);
+ anim->setEasingCurve(QEasingCurve::OutQuad);
+#else
+ // work around for a bug where we don't transition if the duration is zero.
+ QtPauseAnimation *anim = new QtPauseAnimation(group);
+ anim->setDuration(1);
+#endif
+}
+
+GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode)
+ : QGraphicsScene(x,y,width,height), mode(mode), newAction(0), quitAction(0), boat(0)
+{
+ backgroundItem = new PixmapItem(QString("background"),mode);
+ backgroundItem->setZValue(1);
+ backgroundItem->setPos(0,0);
+ addItem(backgroundItem);
+
+ PixmapItem *surfaceItem = new PixmapItem(QString("surface"),mode);
+ surfaceItem->setZValue(3);
+ surfaceItem->setPos(0,sealLevel() - surfaceItem->boundingRect().height()/2);
+ addItem(surfaceItem);
+
+ //parse the xml that contain all data of the game
+ QXmlStreamReader reader;
+ QFile file(QDir::currentPath() + "/data.xml");
+ file.open(QIODevice::ReadOnly);
+ reader.setDevice(&file);
+ LevelDescription currentLevel;
+ while (!reader.atEnd()) {
+ reader.readNext();
+ if (reader.tokenType() == QXmlStreamReader::StartElement) {
+ if (reader.name() == "submarine")
+ {
+ SubmarineDescription desc;
+ desc.name = reader.attributes().value("name").toString();
+ desc.points = reader.attributes().value("points").toString().toInt();
+ desc.type = reader.attributes().value("type").toString().toInt();
+ submarinesData.append(desc);
+ }
+ if (reader.name() == "level")
+ {
+ currentLevel.id = reader.attributes().value("id").toString().toInt();
+ currentLevel.name = reader.attributes().value("name").toString();
+ }
+ if (reader.name() == "subinstance")
+ {
+ currentLevel.submarines.append(qMakePair(reader.attributes().value("type").toString().toInt(),reader.attributes().value("nb").toString().toInt()));
+ }
+ }
+ if (reader.tokenType() == QXmlStreamReader::EndElement) {
+ if (reader.name() == "level")
+ {
+ levelsData.insert(currentLevel.id,currentLevel);
+ currentLevel.submarines.clear();
+ }
+ }
+ }
+}
+
+qreal GraphicsScene::sealLevel() const
+{
+ if (mode == Big)
+ return 220;
+ else
+ return 160;
+}
+
+void GraphicsScene::setupScene(const QList<QAction *> &actions)
+{
+ newAction = actions.at(0);
+ quitAction = actions.at(1);
+
+ QGraphicsItem *logo_s = addWelcomeItem(QPixmap(":/logo-s"));
+ QGraphicsItem *logo_u = addWelcomeItem(QPixmap(":/logo-u"));
+ QGraphicsItem *logo_b = addWelcomeItem(QPixmap(":/logo-b"));
+ QGraphicsItem *logo_dash = addWelcomeItem(QPixmap(":/logo-dash"));
+ QGraphicsItem *logo_a = addWelcomeItem(QPixmap(":/logo-a"));
+ QGraphicsItem *logo_t = addWelcomeItem(QPixmap(":/logo-t"));
+ QGraphicsItem *logo_t2 = addWelcomeItem(QPixmap(":/logo-t2"));
+ QGraphicsItem *logo_a2 = addWelcomeItem(QPixmap(":/logo-a2"));
+ QGraphicsItem *logo_q = addWelcomeItem(QPixmap(":/logo-q"));
+ QGraphicsItem *logo_excl = addWelcomeItem(QPixmap(":/logo-excl"));
+ logo_s->setZValue(3);
+ logo_u->setZValue(4);
+ logo_b->setZValue(5);
+ logo_dash->setZValue(6);
+ logo_a->setZValue(7);
+ logo_t->setZValue(8);
+ logo_t2->setZValue(9);
+ logo_a2->setZValue(10);
+ logo_q->setZValue(11);
+ logo_excl->setZValue(12);
+ logo_s->setPos(QPointF(-1000, -1000));
+ logo_u->setPos(QPointF(-800, -1000));
+ logo_b->setPos(QPointF(-600, -1000));
+ logo_dash->setPos(QPointF(-400, -1000));
+ logo_a->setPos(QPointF(1000, 2000));
+ logo_t->setPos(QPointF(800, 2000));
+ logo_t2->setPos(QPointF(600, 2000));
+ logo_a2->setPos(QPointF(400, 2000));
+ logo_q->setPos(QPointF(200, 2000));
+ logo_excl->setPos(QPointF(0, 2000));
+
+ QSequentialAnimationGroup * lettersGroupMoving = new QSequentialAnimationGroup(this);
+ QParallelAnimationGroup * lettersGroupFading = new QParallelAnimationGroup(this);
+
+ //creation of the animations for moving letters
+ addGraphicsItemPosAnimation(lettersGroupMoving, logo_s, QPointF(300, 150));
+ addGraphicsItemPosAnimation(lettersGroupMoving, logo_u, QPointF(350, 150));
+ addGraphicsItemPosAnimation(lettersGroupMoving, logo_b, QPointF(400, 120));
+ addGraphicsItemPosAnimation(lettersGroupMoving, logo_dash, QPointF(460, 150));
+ addGraphicsItemPosAnimation(lettersGroupMoving, logo_a, QPointF(350, 250));
+ addGraphicsItemPosAnimation(lettersGroupMoving, logo_t, QPointF(400, 250));
+ addGraphicsItemPosAnimation(lettersGroupMoving, logo_t2, QPointF(430, 250));
+ addGraphicsItemPosAnimation(lettersGroupMoving, logo_a2, QPointF(465, 250));
+ addGraphicsItemPosAnimation(lettersGroupMoving, logo_q, QPointF(510, 250));
+ addGraphicsItemPosAnimation(lettersGroupMoving, logo_excl, QPointF(570, 220));
+
+ //creation of the animations for fading out the letters
+ addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_s);
+ addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_u);
+ addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_b);
+ addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_dash);
+ addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_a);
+ addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_t);
+ addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_t2);
+ addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_a2);
+ addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_q);
+ addGraphicsItemFadeoutAnimation(lettersGroupFading, logo_excl);
+ connect(lettersGroupFading, SIGNAL(finished()), this, SLOT(onIntroAnimationFinished()));
+
+ QStateMachine *machine = new QStateMachine(this);
+
+ //This state is when the player is playing
+ PlayState *gameState = new PlayState(this,machine->rootState());
+
+ //Final state
+ QFinalState *final = new QFinalState(machine->rootState());
+
+ //Animation when the player enter in the game
+ QAnimationState *animationState = new QAnimationState(lettersGroupMoving, machine->rootState());
+ animationState->addAnimatedTransition(newAction, SIGNAL(triggered()),gameState,lettersGroupFading);
+
+ //New Game is triggered then player start playing
+ gameState->addTransition(newAction, SIGNAL(triggered()),gameState);
+
+ //Wanna quit, then connect to CTRL+Q
+ gameState->addTransition(quitAction, SIGNAL(triggered()),final);
+ animationState->addTransition(quitAction, SIGNAL(triggered()),final);
+
+ //Welcome screen is the initial state
+ machine->setInitialState(animationState);
+
+ machine->start();
+
+ //We reach the final state, then we quit
+ connect(machine,SIGNAL(finished()),this, SLOT(onQuitGameTriggered()));
+}
+
+void GraphicsScene::addItem(Bomb *bomb)
+{
+ bombs.insert(bomb);
+ connect(bomb,SIGNAL(bombExecutionFinished()),this, SLOT(onBombExecutionFinished()));
+ QGraphicsScene::addItem(bomb);
+}
+
+void GraphicsScene::addItem(Torpedo *torpedo)
+{
+ torpedos.insert(torpedo);
+ connect(torpedo,SIGNAL(torpedoExecutionFinished()),this, SLOT(onTorpedoExecutionFinished()));
+ QGraphicsScene::addItem(torpedo);
+}
+
+void GraphicsScene::addItem(SubMarine *submarine)
+{
+ submarines.insert(submarine);
+ connect(submarine,SIGNAL(subMarineExecutionFinished()),this, SLOT(onSubMarineExecutionFinished()));
+ QGraphicsScene::addItem(submarine);
+}
+
+void GraphicsScene::addItem(QGraphicsItem *item)
+{
+ QGraphicsScene::addItem(item);
+}
+
+void GraphicsScene::mousePressEvent (QGraphicsSceneMouseEvent * event)
+{
+ event->ignore();
+}
+
+void GraphicsScene::onQuitGameTriggered()
+{
+ qApp->closeAllWindows();
+}
+
+void GraphicsScene::onBombExecutionFinished()
+{
+ Bomb *bomb = qobject_cast<Bomb *>(sender());
+ bombs.remove(bomb);
+ bomb->deleteLater();
+ if (boat)
+ boat->setBombsLaunched(boat->bombsLaunched() - 1);
+}
+
+void GraphicsScene::onTorpedoExecutionFinished()
+{
+ Torpedo *torpedo = qobject_cast<Torpedo *>(sender());
+ torpedos.remove(torpedo);
+ torpedo->deleteLater();
+}
+
+void GraphicsScene::onSubMarineExecutionFinished()
+{
+ SubMarine *submarine = qobject_cast<SubMarine *>(sender());
+ submarines.remove(submarine);
+ if (submarines.count() == 0) {
+ emit allSubMarineDestroyed(submarine->points());
+ } else {
+ emit subMarineDestroyed(submarine->points());
+ }
+ submarine->deleteLater();
+}
+
+int GraphicsScene::remainingSubMarines() const
+{
+ return submarines.count();
+}
+
+void GraphicsScene::clearScene()
+{
+ foreach (SubMarine *sub,submarines) {
+ sub->destroy();
+ delete sub;
+ }
+
+ foreach (Torpedo *torpedo,torpedos) {
+ torpedo->destroy();
+ delete torpedo;
+ }
+
+ foreach (Bomb *bomb,bombs) {
+ bomb->destroy();
+ delete bomb;
+ }
+
+ submarines.clear();
+ bombs.clear();
+ torpedos.clear();
+
+ AnimationManager::self()->unregisterAllAnimations();
+
+ if (boat) {
+ delete boat;
+ boat = 0;
+ }
+}
+
+QGraphicsPixmapItem *GraphicsScene::addWelcomeItem(const QPixmap &pm)
+{
+ QGraphicsPixmapItem *item = addPixmap(pm);
+ welcomeItems << item;
+ return item;
+}
+
+void GraphicsScene::onIntroAnimationFinished()
+{
+ qDeleteAll(welcomeItems);
+ welcomeItems.clear();
+}
+
diff --git a/examples/animation/sub-attaq/graphicsscene.h b/examples/animation/sub-attaq/graphicsscene.h
new file mode 100644
index 0000000..875f59f
--- /dev/null
+++ b/examples/animation/sub-attaq/graphicsscene.h
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __GRAPHICSSCENE__H__
+#define __GRAPHICSSCENE__H__
+
+//Qt
+#include <QGraphicsScene>
+#include <QSet>
+
+#if defined(QT_EXPERIMENTAL_SOLUTION)
+# include "qstate.h"
+#else
+# include <QState>
+#endif
+
+
+class Boat;
+class SubMarine;
+class Torpedo;
+class Bomb;
+class PixmapItem;
+class QAction;
+
+class GraphicsScene : public QGraphicsScene
+{
+Q_OBJECT
+public:
+ enum Mode {
+ Big = 0,
+ Small
+ };
+
+ struct SubmarineDescription {
+ int type;
+ int points;
+ QString name;
+ };
+
+ struct LevelDescription {
+ int id;
+ QString name;
+ QList<QPair<int,int> > submarines;
+ };
+
+ GraphicsScene(int x, int y, int width, int height, Mode mode = Big);
+ qreal sealLevel() const;
+ void setupScene(const QList<QAction *> &actions);
+ void addItem(Bomb *bomb);
+ void addItem(Torpedo *torpedo);
+ void addItem(SubMarine *submarine);
+ void addItem(QGraphicsItem *item);
+ int remainingSubMarines() const;
+ void clearScene();
+ QGraphicsPixmapItem *addWelcomeItem(const QPixmap &pm);
+
+Q_SIGNALS:
+ void subMarineDestroyed(int);
+ void allSubMarineDestroyed(int);
+
+protected:
+ void mousePressEvent (QGraphicsSceneMouseEvent * event);
+
+private slots:
+ void onQuitGameTriggered();
+ void onBombExecutionFinished();
+ void onTorpedoExecutionFinished();
+ void onSubMarineExecutionFinished();
+ void onIntroAnimationFinished();
+
+private:
+ Mode mode;
+ PixmapItem *backgroundItem;
+ QAction * newAction;
+ QAction * quitAction;
+ Boat *boat;
+ QSet<SubMarine *> submarines;
+ QSet<Bomb *> bombs;
+ QSet<Torpedo *> torpedos;
+ QVector<QGraphicsPixmapItem *> welcomeItems;
+ QVector<SubmarineDescription> submarinesData;
+ QHash<int, LevelDescription> levelsData;
+
+ friend class PauseState;
+ friend class PlayState;
+ friend class LostState;
+ friend class WinState;
+};
+
+#endif //__GRAPHICSSCENE__H__
+
diff --git a/examples/animation/sub-attaq/main.cpp b/examples/animation/sub-attaq/main.cpp
new file mode 100644
index 0000000..ffaa86f
--- /dev/null
+++ b/examples/animation/sub-attaq/main.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Q_INIT_RESOURCE(subattaq);
+
+ qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
+
+ MainWindow w;
+ w.show();
+
+ return app.exec();
+}
diff --git a/examples/animation/sub-attaq/mainwindow.cpp b/examples/animation/sub-attaq/mainwindow.cpp
new file mode 100644
index 0000000..c25b9ef
--- /dev/null
+++ b/examples/animation/sub-attaq/mainwindow.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//Own
+#include "mainwindow.h"
+#include "graphicsscene.h"
+
+#ifndef QT_NO_OPENGL
+ #include <QtOpenGL/QtOpenGL>
+#endif
+//Qt
+#include <QGraphicsView>
+
+MainWindow::MainWindow() : QMainWindow(0)
+{
+ QMenuBar *menuBar = new QMenuBar;
+ QMenu *file = new QMenu(tr("&File"),menuBar);
+
+ QAction *newAction = new QAction(tr("New Game"),file);
+ newAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_N));
+ file->addAction(newAction);
+ QAction *quitAction = new QAction(tr("Quit"),file);
+ quitAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q));
+ file->addAction(quitAction);
+
+ menuBar->addMenu(file);
+ setMenuBar(menuBar);
+
+ QStringList list = QApplication::arguments();
+ if (list.contains("-fullscreen")) {
+ scene = new GraphicsScene(0, 0, 750, 400,GraphicsScene::Small);
+ setWindowState(Qt::WindowFullScreen);
+ } else {
+ scene = new GraphicsScene(0, 0, 880, 630);
+ layout()->setSizeConstraint(QLayout::SetFixedSize);
+ }
+
+ view = new QGraphicsView(scene,this);
+ view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
+ QList<QAction *> actions;
+ actions << newAction << quitAction;
+ scene->setupScene(actions);
+#ifndef QT_NO_OPENGL
+ view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
+#endif
+
+ setCentralWidget(view);
+
+}
+
+MainWindow::~MainWindow()
+{
+}
+
diff --git a/examples/animation/sub-attaq/mainwindow.h b/examples/animation/sub-attaq/mainwindow.h
new file mode 100644
index 0000000..6289b3f
--- /dev/null
+++ b/examples/animation/sub-attaq/mainwindow.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, 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.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __MAINWINDOW__H__
+#define __MAINWINDOW__H__
+
+//Qt
+#include <QMainWindow>
+
+class GraphicsScene;
+class QGraphicsView;
+
+class MainWindow : public QMainWindow
+{
+Q_OBJECT
+public:
+ MainWindow();
+ ~MainWindow();
+
+private:
+ GraphicsScene *scene;
+ QGraphicsView *view;
+};
+
+#endif //__MAINWINDOW__H__
diff --git a/examples/animation/sub-attaq/pics/big/background.png b/examples/animation/sub-attaq/pics/big/background.png
new file mode 100644
index 0000000..9f58157
--- /dev/null
+++ b/examples/animation/sub-attaq/pics/big/background.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/boat.png b/examples/animation/sub-attaq/pics/big/boat.png
new file mode 100644
index 0000000..be82dff
--- /dev/null
+++ b/examples/animation/sub-attaq/pics/big/boat.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/bomb.png b/examples/animation/sub-attaq/pics/big/bomb.png
new file mode 100644
index 0000000..3af5f2f
--- /dev/null
+++ b/examples/animation/sub-attaq/pics/big/bomb.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/boat/step1.png b/examples/animation/sub-attaq/pics/big/explosion/boat/step1.png
new file mode 100644
index 0000000..c9fd8b0
--- /dev/null
+++ b/examples/animation/sub-attaq/pics/big/explosion/boat/step1.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/boat/step2.png b/examples/animation/sub-attaq/pics/big/explosion/boat/step2.png
new file mode 100644
index 0000000..7528f2d
--- /dev/null
+++ b/examples/animation/sub-attaq/pics/big/explosion/boat/step2.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/boat/step3.png b/examples/animation/sub-attaq/pics/big/explosion/boat/step3.png
new file mode 100644
index 0000000..aae9c9c
--- /dev/null
+++ b/examples/animation/sub-attaq/pics/big/explosion/boat/step3.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/boat/step4.png b/examples/animation/sub-attaq/pics/big/explosion/boat/step4.png
new file mode 100644
index 0000000..d697c1b
--- /dev/null
+++ b/examples/animation/sub-attaq/pics/big/explosion/boat/step4.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/submarine/step1.png b/examples/animation/sub-attaq/pics/big/explosion/submarine/step1.png
new file mode 100644
index 0000000..88ca514
--- /dev/null
+++ b/examples/animation/sub-attaq/pics/big/explosion/submarine/step1.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/submarine/step2.png b/examples/animation/sub-attaq/pics/big/explosion/submarine/step2.png
new file mode 100644
index 0000000..524f589
--- /dev/null
+++ b/examples/animation/sub-attaq/pics/big/explosion/submarine/step2.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/submarine/step3.png b/examples/animation/sub-attaq/pics/big/explosion/submarine/step3.png
new file mode 100644
index 0000000..2cca1e8
--- /dev/null
+++ b/examples/animation/sub-attaq/pics/big/explosion/submarine/step3.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/explosion/submarine/step4.png b/examples/animation/sub-attaq/pics/big/explosion/submarine/step4.png
new file mode 100644
index 0000000..82100a8
--- /dev/null
+++ b/examples/animation/sub-attaq/pics/big/explosion/submarine/step4.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/submarine.png b/examples/animation/sub-attaq/pics/big/submarine.png
new file mode 100644
index 0000000..df435dc
--- /dev/null
+++ b/examples/animation/sub-attaq/pics/big/submarine.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/surface.png b/examples/animation/sub-attaq/pics/big/surface.png
new file mode 100644
index 0000000..4eba29e
--- /dev/null
+++ b/examples/animation/sub-attaq/pics/big/surface.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/big/torpedo.png b/examples/animation/sub-attaq/pics/big/torpedo.png
new file mode 100644
index 0000000..f9c2687
--- /dev/null
+++ b/examples/animation/sub-attaq/pics/big/torpedo.png
Binary files differ
diff --git a/examples/animation/sub-attaq/pics/scalable/background-n810.svg b/examples/animation/sub-attaq/pics/scalable/background-n810.svg
new file mode 100644