summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/global/manifest-meta.qdocconf5
-rw-r--r--doc/src/images/animatedtiles-example.pngbin158209 -> 0 bytes
-rw-r--r--doc/src/images/moveblocks-example.pngbin4532 -> 0 bytes
-rw-r--r--doc/src/images/padnavigator-example.pngbin219818 -> 0 bytes
-rw-r--r--doc/src/images/rogue-example.pngbin10364 -> 0 bytes
-rw-r--r--doc/src/images/states-example.pngbin34844 -> 0 bytes
-rw-r--r--doc/src/images/stickman-example.pngbin18867 -> 0 bytes
-rw-r--r--doc/src/images/stickman-example1.pngbin64543 -> 0 bytes
-rw-r--r--doc/src/images/stickman-example2.pngbin37412 -> 0 bytes
-rw-r--r--doc/src/images/stickman-example3.pngbin23591 -> 0 bytes
-rw-r--r--doc/src/images/sub-attaq-demo.pngbin51552 -> 0 bytes
-rw-r--r--doc/src/images/trafficlight-example.pngbin5325 -> 0 bytes
-rw-r--r--doc/src/images/transitions.pngbin4314 -> 0 bytes
-rw-r--r--examples/widgets/.prev_CMakeLists.txt1
-rw-r--r--examples/widgets/CMakeLists.txt1
-rw-r--r--examples/widgets/animation/CMakeLists.txt5
-rw-r--r--examples/widgets/animation/animatedtiles/CMakeLists.txt54
-rw-r--r--examples/widgets/animation/animatedtiles/animatedtiles.pro8
-rw-r--r--examples/widgets/animation/animatedtiles/animatedtiles.qrc11
-rw-r--r--examples/widgets/animation/animatedtiles/images/Time-For-Lunch-2.jpgbin32471 -> 0 bytes
-rw-r--r--examples/widgets/animation/animatedtiles/images/centered.pngbin892 -> 0 bytes
-rw-r--r--examples/widgets/animation/animatedtiles/images/ellipse.pngbin10767 -> 0 bytes
-rw-r--r--examples/widgets/animation/animatedtiles/images/figure8.pngbin14050 -> 0 bytes
-rw-r--r--examples/widgets/animation/animatedtiles/images/kinetic.pngbin5055 -> 0 bytes
-rw-r--r--examples/widgets/animation/animatedtiles/images/random.pngbin14969 -> 0 bytes
-rw-r--r--examples/widgets/animation/animatedtiles/images/tile.pngbin16337 -> 0 bytes
-rw-r--r--examples/widgets/animation/animatedtiles/main.cpp268
-rw-r--r--examples/widgets/animation/animation.pro8
-rw-r--r--examples/widgets/animation/moveblocks/CMakeLists.txt35
-rw-r--r--examples/widgets/animation/moveblocks/main.cpp330
-rw-r--r--examples/widgets/animation/moveblocks/moveblocks.pro7
-rw-r--r--examples/widgets/animation/states/CMakeLists.txt53
-rw-r--r--examples/widgets/animation/states/accessories-dictionary.pngbin5396 -> 0 bytes
-rw-r--r--examples/widgets/animation/states/akregator.pngbin4873 -> 0 bytes
-rw-r--r--examples/widgets/animation/states/digikam.pngbin3334 -> 0 bytes
-rw-r--r--examples/widgets/animation/states/help-browser.pngbin6984 -> 0 bytes
-rw-r--r--examples/widgets/animation/states/k3b.pngbin8220 -> 0 bytes
-rw-r--r--examples/widgets/animation/states/kchart.pngbin4887 -> 0 bytes
-rw-r--r--examples/widgets/animation/states/main.cpp295
-rw-r--r--examples/widgets/animation/states/states.pro8
-rw-r--r--examples/widgets/animation/states/states.qrc10
-rw-r--r--examples/widgets/animation/stickman/CMakeLists.txt57
-rw-r--r--examples/widgets/animation/stickman/animation.cpp193
-rw-r--r--examples/widgets/animation/stickman/animation.h92
-rw-r--r--examples/widgets/animation/stickman/animations/chilling.binbin6508 -> 0 bytes
-rw-r--r--examples/widgets/animation/stickman/animations/dancing.binbin2348 -> 0 bytes
-rw-r--r--examples/widgets/animation/stickman/animations/dead.binbin268 -> 0 bytes
-rw-r--r--examples/widgets/animation/stickman/animations/jumping.binbin1308 -> 0 bytes
-rw-r--r--examples/widgets/animation/stickman/graphicsview.cpp68
-rw-r--r--examples/widgets/animation/stickman/graphicsview.h70
-rw-r--r--examples/widgets/animation/stickman/lifecycle.cpp234
-rw-r--r--examples/widgets/animation/stickman/lifecycle.h91
-rw-r--r--examples/widgets/animation/stickman/main.cpp116
-rw-r--r--examples/widgets/animation/stickman/node.cpp102
-rw-r--r--examples/widgets/animation/stickman/node.h80
-rw-r--r--examples/widgets/animation/stickman/rectbutton.cpp78
-rw-r--r--examples/widgets/animation/stickman/rectbutton.h75
-rw-r--r--examples/widgets/animation/stickman/stickman.cpp329
-rw-r--r--examples/widgets/animation/stickman/stickman.h108
-rw-r--r--examples/widgets/animation/stickman/stickman.pro21
-rw-r--r--examples/widgets/animation/stickman/stickman.qrc8
-rw-r--r--examples/widgets/animation/sub-attaq/.prev_CMakeLists.txt196
-rw-r--r--examples/widgets/animation/sub-attaq/CMakeLists.txt197
-rw-r--r--examples/widgets/animation/sub-attaq/animationmanager.cpp98
-rw-r--r--examples/widgets/animation/sub-attaq/animationmanager.h82
-rw-r--r--examples/widgets/animation/sub-attaq/boat.cpp281
-rw-r--r--examples/widgets/animation/sub-attaq/boat.h103
-rw-r--r--examples/widgets/animation/sub-attaq/boat_p.h246
-rw-r--r--examples/widgets/animation/sub-attaq/bomb.cpp128
-rw-r--r--examples/widgets/animation/sub-attaq/bomb.h76
-rw-r--r--examples/widgets/animation/sub-attaq/data.xml39
-rw-r--r--examples/widgets/animation/sub-attaq/graphicsscene.cpp301
-rw-r--r--examples/widgets/animation/sub-attaq/graphicsscene.h130
-rw-r--r--examples/widgets/animation/sub-attaq/main.cpp64
-rw-r--r--examples/widgets/animation/sub-attaq/mainwindow.cpp84
-rw-r--r--examples/widgets/animation/sub-attaq/mainwindow.h72
-rw-r--r--examples/widgets/animation/sub-attaq/pics/big/background.pngbin48858 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/big/boat.pngbin5198 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/big/bomb.pngbin760 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step1.pngbin5760 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step2.pngbin9976 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step3.pngbin12411 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step4.pngbin15438 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step1.pngbin3354 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step2.pngbin6205 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step3.pngbin6678 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step4.pngbin6666 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/big/submarine.pngbin3202 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/big/surface.pngbin575 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/big/torpedo.pngbin951 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/scalable/background-n810.svg171
-rw-r--r--examples/widgets/animation/sub-attaq/pics/scalable/background.svg171
-rw-r--r--examples/widgets/animation/sub-attaq/pics/scalable/boat.svg279
-rw-r--r--examples/widgets/animation/sub-attaq/pics/scalable/bomb.svg138
-rw-r--r--examples/widgets/animation/sub-attaq/pics/scalable/sand.svg103
-rw-r--r--examples/widgets/animation/sub-attaq/pics/scalable/see.svg44
-rw-r--r--examples/widgets/animation/sub-attaq/pics/scalable/sky.svg45
-rw-r--r--examples/widgets/animation/sub-attaq/pics/scalable/sub-attaq.svg1473
-rw-r--r--examples/widgets/animation/sub-attaq/pics/scalable/submarine.svg214
-rw-r--r--examples/widgets/animation/sub-attaq/pics/scalable/surface.svg49
-rw-r--r--examples/widgets/animation/sub-attaq/pics/scalable/torpedo.svg127
-rw-r--r--examples/widgets/animation/sub-attaq/pics/small/background.pngbin34634 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/small/boat.pngbin2394 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/small/bomb.pngbin760 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/small/submarine.pngbin1338 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/small/surface.pngbin502 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/small/torpedo.pngbin951 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/welcome/logo-a.pngbin5972 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/welcome/logo-a2.pngbin5969 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/welcome/logo-b.pngbin6869 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/welcome/logo-dash.pngbin2255 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/welcome/logo-excl.pngbin2740 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/welcome/logo-q.pngbin7016 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/welcome/logo-s.pngbin5817 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/welcome/logo-t.pngbin3717 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/welcome/logo-t2.pngbin3688 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pics/welcome/logo-u.pngbin5374 -> 0 bytes
-rw-r--r--examples/widgets/animation/sub-attaq/pixmapitem.cpp87
-rw-r--r--examples/widgets/animation/sub-attaq/pixmapitem.h72
-rw-r--r--examples/widgets/animation/sub-attaq/progressitem.cpp77
-rw-r--r--examples/widgets/animation/sub-attaq/progressitem.h70
-rw-r--r--examples/widgets/animation/sub-attaq/qanimationstate.cpp154
-rw-r--r--examples/widgets/animation/sub-attaq/qanimationstate.h85
-rw-r--r--examples/widgets/animation/sub-attaq/states.cpp335
-rw-r--r--examples/widgets/animation/sub-attaq/states.h180
-rw-r--r--examples/widgets/animation/sub-attaq/sub-attaq.pro33
-rw-r--r--examples/widgets/animation/sub-attaq/subattaq.qrc39
-rw-r--r--examples/widgets/animation/sub-attaq/submarine.cpp187
-rw-r--r--examples/widgets/animation/sub-attaq/submarine.h99
-rw-r--r--examples/widgets/animation/sub-attaq/submarine_p.h147
-rw-r--r--examples/widgets/animation/sub-attaq/textinformationitem.cpp64
-rw-r--r--examples/widgets/animation/sub-attaq/textinformationitem.h64
-rw-r--r--examples/widgets/animation/sub-attaq/torpedo.cpp124
-rw-r--r--examples/widgets/animation/sub-attaq/torpedo.h76
-rw-r--r--examples/widgets/doc/images/factorial-example.pngbin4032 -> 0 bytes
-rw-r--r--examples/widgets/doc/images/pingpong-example.pngbin7843 -> 0 bytes
-rw-r--r--examples/widgets/doc/images/trafficlight-example1.pngbin3694 -> 0 bytes
-rw-r--r--examples/widgets/doc/images/trafficlight-example2.pngbin7257 -> 0 bytes
-rw-r--r--examples/widgets/doc/src/animatedtiles.qdoc36
-rw-r--r--examples/widgets/doc/src/eventtransitions.qdoc85
-rw-r--r--examples/widgets/doc/src/factorial.qdoc88
-rw-r--r--examples/widgets/doc/src/moveblocks.qdoc214
-rw-r--r--examples/widgets/doc/src/padnavigator.qdoc586
-rw-r--r--examples/widgets/doc/src/pingpong.qdoc93
-rw-r--r--examples/widgets/doc/src/rogue.qdoc208
-rw-r--r--examples/widgets/doc/src/states.qdoc36
-rw-r--r--examples/widgets/doc/src/stickman.qdoc102
-rw-r--r--examples/widgets/doc/src/sub-attaq.qdoc41
-rw-r--r--examples/widgets/doc/src/trafficlight.qdoc85
-rw-r--r--examples/widgets/doc/src/twowaybutton.qdoc68
-rw-r--r--examples/widgets/graphicsview/CMakeLists.txt1
-rw-r--r--examples/widgets/graphicsview/graphicsview.pro1
-rw-r--r--examples/widgets/graphicsview/padnavigator/.prev_CMakeLists.txt68
-rw-r--r--examples/widgets/graphicsview/padnavigator/CMakeLists.txt69
-rw-r--r--examples/widgets/graphicsview/padnavigator/flippablepad.cpp108
-rw-r--r--examples/widgets/graphicsview/padnavigator/flippablepad.h71
-rw-r--r--examples/widgets/graphicsview/padnavigator/form.ui208
-rw-r--r--examples/widgets/graphicsview/padnavigator/images/artsfftscope.pngbin1291 -> 0 bytes
-rw-r--r--examples/widgets/graphicsview/padnavigator/images/blue_angle_swirl.jpgbin11826 -> 0 bytes
-rw-r--r--examples/widgets/graphicsview/padnavigator/images/kontact_contacts.pngbin4382 -> 0 bytes
-rw-r--r--examples/widgets/graphicsview/padnavigator/images/kontact_journal.pngbin3261 -> 0 bytes
-rw-r--r--examples/widgets/graphicsview/padnavigator/images/kontact_mail.pngbin3202 -> 0 bytes
-rw-r--r--examples/widgets/graphicsview/padnavigator/images/kontact_notes.pngbin3893 -> 0 bytes
-rw-r--r--examples/widgets/graphicsview/padnavigator/images/kopeteavailable.pngbin2380 -> 0 bytes
-rw-r--r--examples/widgets/graphicsview/padnavigator/images/metacontact_online.pngbin2545 -> 0 bytes
-rw-r--r--examples/widgets/graphicsview/padnavigator/images/minitools.pngbin2087 -> 0 bytes
-rw-r--r--examples/widgets/graphicsview/padnavigator/main.cpp65
-rw-r--r--examples/widgets/graphicsview/padnavigator/padnavigator.cpp318
-rw-r--r--examples/widgets/graphicsview/padnavigator/padnavigator.h72
-rw-r--r--examples/widgets/graphicsview/padnavigator/padnavigator.pro27
-rw-r--r--examples/widgets/graphicsview/padnavigator/padnavigator.qrc13
-rw-r--r--examples/widgets/graphicsview/padnavigator/roundrectitem.cpp125
-rw-r--r--examples/widgets/graphicsview/padnavigator/roundrectitem.h85
-rw-r--r--examples/widgets/graphicsview/padnavigator/splashitem.cpp93
-rw-r--r--examples/widgets/graphicsview/padnavigator/splashitem.h71
-rw-r--r--examples/widgets/statemachine/CMakeLists.txt10
-rw-r--r--examples/widgets/statemachine/README6
-rw-r--r--examples/widgets/statemachine/eventtransitions/CMakeLists.txt35
-rw-r--r--examples/widgets/statemachine/eventtransitions/eventtransitions.pro7
-rw-r--r--examples/widgets/statemachine/eventtransitions/main.cpp130
-rw-r--r--examples/widgets/statemachine/factorial/CMakeLists.txt31
-rw-r--r--examples/widgets/statemachine/factorial/factorial.pro10
-rw-r--r--examples/widgets/statemachine/factorial/main.cpp181
-rw-r--r--examples/widgets/statemachine/pingpong/CMakeLists.txt31
-rw-r--r--examples/widgets/statemachine/pingpong/main.cpp149
-rw-r--r--examples/widgets/statemachine/pingpong/pingpong.pro10
-rw-r--r--examples/widgets/statemachine/rogue/CMakeLists.txt37
-rw-r--r--examples/widgets/statemachine/rogue/main.cpp64
-rw-r--r--examples/widgets/statemachine/rogue/movementtransition.h122
-rw-r--r--examples/widgets/statemachine/rogue/rogue.pro10
-rw-r--r--examples/widgets/statemachine/rogue/window.cpp261
-rw-r--r--examples/widgets/statemachine/rogue/window.h100
-rw-r--r--examples/widgets/statemachine/statemachine.pro12
-rw-r--r--examples/widgets/statemachine/trafficlight/CMakeLists.txt35
-rw-r--r--examples/widgets/statemachine/trafficlight/main.cpp200
-rw-r--r--examples/widgets/statemachine/trafficlight/trafficlight.pro9
-rw-r--r--examples/widgets/statemachine/twowaybutton/CMakeLists.txt35
-rw-r--r--examples/widgets/statemachine/twowaybutton/main.cpp91
-rw-r--r--examples/widgets/statemachine/twowaybutton/twowaybutton.pro9
-rw-r--r--examples/widgets/widgets.pro1
-rw-r--r--src/corelib/.prev_CMakeLists.txt13
-rw-r--r--src/corelib/.prev_configure.cmake11
-rw-r--r--src/corelib/CMakeLists.txt13
-rw-r--r--src/corelib/configure.cmake11
-rw-r--r--src/corelib/configure.json12
-rw-r--r--src/corelib/corelib.pro1
-rw-r--r--src/corelib/doc/images/statemachine-button-history.pngbin8493 -> 0 bytes
-rw-r--r--src/corelib/doc/images/statemachine-button-nested.pngbin7051 -> 0 bytes
-rw-r--r--src/corelib/doc/images/statemachine-button.pngbin4233 -> 0 bytes
-rw-r--r--src/corelib/doc/images/statemachine-customevents.pngbin2544 -> 0 bytes
-rw-r--r--src/corelib/doc/images/statemachine-customevents2.pngbin6713 -> 0 bytes
-rw-r--r--src/corelib/doc/images/statemachine-examples.pngbin3326 -> 0 bytes
-rw-r--r--src/corelib/doc/images/statemachine-finished.pngbin5518 -> 0 bytes
-rw-r--r--src/corelib/doc/images/statemachine-nonparallel.pngbin5350 -> 0 bytes
-rw-r--r--src/corelib/doc/images/statemachine-parallel.pngbin8631 -> 0 bytes
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_statemachine_qstatemachine.cpp65
-rw-r--r--src/corelib/doc/snippets/statemachine/eventtest.cpp83
-rw-r--r--src/corelib/doc/snippets/statemachine/main.cpp98
-rw-r--r--src/corelib/doc/snippets/statemachine/main2.cpp103
-rw-r--r--src/corelib/doc/snippets/statemachine/main3.cpp70
-rw-r--r--src/corelib/doc/snippets/statemachine/main4.cpp122
-rw-r--r--src/corelib/doc/snippets/statemachine/main5.cpp182
-rw-r--r--src/corelib/doc/src/animation.qdoc43
-rw-r--r--src/corelib/doc/src/statemachine.qdoc577
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp16
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h8
-rw-r--r--src/corelib/statemachine/qabstractstate.cpp239
-rw-r--r--src/corelib/statemachine/qabstractstate.h88
-rw-r--r--src/corelib/statemachine/qabstractstate_p.h99
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp435
-rw-r--r--src/corelib/statemachine/qabstracttransition.h117
-rw-r--r--src/corelib/statemachine/qabstracttransition_p.h94
-rw-r--r--src/corelib/statemachine/qeventtransition.cpp256
-rw-r--r--src/corelib/statemachine/qeventtransition.h85
-rw-r--r--src/corelib/statemachine/qeventtransition_p.h81
-rw-r--r--src/corelib/statemachine/qfinalstate.cpp141
-rw-r--r--src/corelib/statemachine/qfinalstate.h73
-rw-r--r--src/corelib/statemachine/qfinalstate_p.h72
-rw-r--r--src/corelib/statemachine/qhistorystate.cpp334
-rw-r--r--src/corelib/statemachine/qhistorystate.h95
-rw-r--r--src/corelib/statemachine/qhistorystate_p.h80
-rw-r--r--src/corelib/statemachine/qsignaleventgenerator_p.h78
-rw-r--r--src/corelib/statemachine/qsignaltransition.cpp287
-rw-r--r--src/corelib/statemachine/qsignaltransition.h99
-rw-r--r--src/corelib/statemachine/qsignaltransition_p.h83
-rw-r--r--src/corelib/statemachine/qstate.cpp603
-rw-r--r--src/corelib/statemachine/qstate.h134
-rw-r--r--src/corelib/statemachine/qstate_p.h127
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp3208
-rw-r--r--src/corelib/statemachine/qstatemachine.h199
-rw-r--r--src/corelib/statemachine/qstatemachine_p.h333
-rw-r--r--src/corelib/statemachine/statemachine.pri33
-rw-r--r--src/gui/.prev_CMakeLists.txt1
-rw-r--r--src/gui/CMakeLists.txt1
-rw-r--r--src/gui/kernel/kernel.pri3
-rw-r--r--src/gui/kernel/qguiapplication_p.h1
-rw-r--r--src/gui/kernel/qguistatemachine.cpp (renamed from src/widgets/statemachine/qguistatemachine.cpp)140
-rw-r--r--src/tools/uic/qclass_lib_map.h10
-rw-r--r--src/widgets/.prev_CMakeLists.txt14
-rw-r--r--src/widgets/CMakeLists.txt14
-rw-r--r--src/widgets/kernel/kernel.pri3
-rw-r--r--src/widgets/kernel/qapplication.cpp13
-rw-r--r--src/widgets/kernel/qapplication_p.h3
-rw-r--r--src/widgets/kernel/qwidgetstatemachine.cpp166
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition.cpp204
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition_p.h93
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition.cpp208
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition_p.h96
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.cpp174
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.h79
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.cpp202
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.h83
-rw-r--r--src/widgets/statemachine/statemachine.pri16
-rw-r--r--src/widgets/widgets.pro1
-rw-r--r--tests/auto/corelib/.prev_CMakeLists.txt1
-rw-r--r--tests/auto/corelib/CMakeLists.txt1
-rw-r--r--tests/auto/corelib/corelib.pro1
-rw-r--r--tests/auto/corelib/statemachine/CMakeLists.txt4
-rw-r--r--tests/auto/corelib/statemachine/qstate/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/statemachine/qstate/qstate.pro4
-rw-r--r--tests/auto/corelib/statemachine/qstate/tst_qstate.cpp374
-rw-r--r--tests/auto/corelib/statemachine/qstatemachine/CMakeLists.txt20
-rw-r--r--tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro5
-rw-r--r--tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp6868
-rw-r--r--tests/auto/corelib/statemachine/statemachine.pro4
-rw-r--r--tests/auto/guiapplauncher/examples.txt10
286 files changed, 209 insertions, 31767 deletions
diff --git a/doc/global/manifest-meta.qdocconf b/doc/global/manifest-meta.qdocconf
index f5e5dbf8db..7eb4ca7be1 100644
--- a/doc/global/manifest-meta.qdocconf
+++ b/doc/global/manifest-meta.qdocconf
@@ -103,7 +103,6 @@ manifestmeta.android.names = "Qt3D/Qt 3D: Basic Shapes C++ Example" \
"QtWidgets/Easing Curves Example" \
"QtWidgets/Editable Tree Model Example" \
"QtWidgets/Elided Label Example" \
- "QtWidgets/Event Transitions Example" \
"QtWidgets/Fade Message Effect Example" \
"QtWidgets/Flow Layout Example" \
"QtWidgets/Font Sampler Example" \
@@ -193,8 +192,6 @@ manifestmeta.ios.names = "QtCore/Contiguous Cache Example" \
"QtWidgets/Order Form Example" \
"QtWidgets/Syntax Highlighter Example" \
"QtWidgets/Text Edit" \
- "QtWidgets/Traffic Light Example" \
- "QtWidgets/Two-way Button Example" \
"QtWidgets/Completer Example" \
"QtWidgets/Custom Completer Example" \
"QtWidgets/Undo Framework" \
@@ -242,8 +239,6 @@ manifestmeta.thumbnail.names = "QtCore/Contiguous Cache Example" \
"QtGui/Raster Window Example" \
"QtNetwork/Network Download*" \
"QtWidgets/Dynamic Layouts Example" \
- "QtWidgets/Event Transitions Example" \
- "QtWidgets/Two-way Button Example" \
"QtWidgets/Validators Example" \
"QtDbus/*" \
"QtHelp/*" \
diff --git a/doc/src/images/animatedtiles-example.png b/doc/src/images/animatedtiles-example.png
deleted file mode 100644
index 79e5313d8e..0000000000
--- a/doc/src/images/animatedtiles-example.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/moveblocks-example.png b/doc/src/images/moveblocks-example.png
deleted file mode 100644
index 56353d1810..0000000000
--- a/doc/src/images/moveblocks-example.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/padnavigator-example.png b/doc/src/images/padnavigator-example.png
deleted file mode 100644
index d766557cec..0000000000
--- a/doc/src/images/padnavigator-example.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/rogue-example.png b/doc/src/images/rogue-example.png
deleted file mode 100644
index 7aeb0e54f9..0000000000
--- a/doc/src/images/rogue-example.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/states-example.png b/doc/src/images/states-example.png
deleted file mode 100644
index f87b99bec5..0000000000
--- a/doc/src/images/states-example.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/stickman-example.png b/doc/src/images/stickman-example.png
deleted file mode 100644
index a40f37b7a6..0000000000
--- a/doc/src/images/stickman-example.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/stickman-example1.png b/doc/src/images/stickman-example1.png
deleted file mode 100644
index 1596a6804c..0000000000
--- a/doc/src/images/stickman-example1.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/stickman-example2.png b/doc/src/images/stickman-example2.png
deleted file mode 100644
index 980276adbe..0000000000
--- a/doc/src/images/stickman-example2.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/stickman-example3.png b/doc/src/images/stickman-example3.png
deleted file mode 100644
index 3635ff73f4..0000000000
--- a/doc/src/images/stickman-example3.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/sub-attaq-demo.png b/doc/src/images/sub-attaq-demo.png
deleted file mode 100644
index 5a35ec6ee2..0000000000
--- a/doc/src/images/sub-attaq-demo.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/trafficlight-example.png b/doc/src/images/trafficlight-example.png
deleted file mode 100644
index 3431542ad1..0000000000
--- a/doc/src/images/trafficlight-example.png
+++ /dev/null
Binary files differ
diff --git a/doc/src/images/transitions.png b/doc/src/images/transitions.png
deleted file mode 100644
index b29466f5ab..0000000000
--- a/doc/src/images/transitions.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/.prev_CMakeLists.txt b/examples/widgets/.prev_CMakeLists.txt
index 8eca336c88..ea87c3c027 100644
--- a/examples/widgets/.prev_CMakeLists.txt
+++ b/examples/widgets/.prev_CMakeLists.txt
@@ -17,7 +17,6 @@ add_subdirectory(layouts)
add_subdirectory(painting)
add_subdirectory(richtext)
add_subdirectory(scroller)
-add_subdirectory(statemachine)
add_subdirectory(tools)
add_subdirectory(touch)
add_subdirectory(tutorials)
diff --git a/examples/widgets/CMakeLists.txt b/examples/widgets/CMakeLists.txt
index 6f4ce76e6e..5026a40a80 100644
--- a/examples/widgets/CMakeLists.txt
+++ b/examples/widgets/CMakeLists.txt
@@ -17,7 +17,6 @@ add_subdirectory(layouts)
add_subdirectory(painting)
add_subdirectory(richtext)
add_subdirectory(scroller)
-add_subdirectory(statemachine)
add_subdirectory(tools)
add_subdirectory(touch)
add_subdirectory(tutorials)
diff --git a/examples/widgets/animation/CMakeLists.txt b/examples/widgets/animation/CMakeLists.txt
index 15f62728da..e3382787aa 100644
--- a/examples/widgets/animation/CMakeLists.txt
+++ b/examples/widgets/animation/CMakeLists.txt
@@ -1,8 +1,3 @@
# Generated from animation.pro.
-add_subdirectory(animatedtiles)
add_subdirectory(easing)
-add_subdirectory(moveblocks)
-add_subdirectory(states)
-add_subdirectory(stickman)
-add_subdirectory(sub-attaq)
diff --git a/examples/widgets/animation/animatedtiles/CMakeLists.txt b/examples/widgets/animation/animatedtiles/CMakeLists.txt
deleted file mode 100644
index 318ac77f8f..0000000000
--- a/examples/widgets/animation/animatedtiles/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-# Generated from animatedtiles.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(animatedtiles LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/animation/animatedtiles")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-add_qt_gui_executable(animatedtiles
- main.cpp
-)
-target_link_libraries(animatedtiles PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(animatedtiles_resource_files
- "images/Time-For-Lunch-2.jpg"
- "images/centered.png"
- "images/ellipse.png"
- "images/figure8.png"
- "images/kinetic.png"
- "images/random.png"
- "images/tile.png"
-)
-
-qt6_add_resources(animatedtiles "animatedtiles"
- PREFIX
- "/"
- FILES
- ${animatedtiles_resource_files}
-)
-
-install(TARGETS animatedtiles
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/animation/animatedtiles/animatedtiles.pro b/examples/widgets/animation/animatedtiles/animatedtiles.pro
deleted file mode 100644
index 04c2b8f3d0..0000000000
--- a/examples/widgets/animation/animatedtiles/animatedtiles.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-QT += widgets
-
-SOURCES = main.cpp
-RESOURCES = animatedtiles.qrc
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/animation/animatedtiles
-INSTALLS += target
diff --git a/examples/widgets/animation/animatedtiles/animatedtiles.qrc b/examples/widgets/animation/animatedtiles/animatedtiles.qrc
deleted file mode 100644
index c43a979723..0000000000
--- a/examples/widgets/animation/animatedtiles/animatedtiles.qrc
+++ /dev/null
@@ -1,11 +0,0 @@
-<!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/widgets/animation/animatedtiles/images/Time-For-Lunch-2.jpg b/examples/widgets/animation/animatedtiles/images/Time-For-Lunch-2.jpg
deleted file mode 100644
index c57a555490..0000000000
--- a/examples/widgets/animation/animatedtiles/images/Time-For-Lunch-2.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/animatedtiles/images/centered.png b/examples/widgets/animation/animatedtiles/images/centered.png
deleted file mode 100644
index e416156a0e..0000000000
--- a/examples/widgets/animation/animatedtiles/images/centered.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/animatedtiles/images/ellipse.png b/examples/widgets/animation/animatedtiles/images/ellipse.png
deleted file mode 100644
index 2c3ba881c5..0000000000
--- a/examples/widgets/animation/animatedtiles/images/ellipse.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/animatedtiles/images/figure8.png b/examples/widgets/animation/animatedtiles/images/figure8.png
deleted file mode 100644
index 6b058041c4..0000000000
--- a/examples/widgets/animation/animatedtiles/images/figure8.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/animatedtiles/images/kinetic.png b/examples/widgets/animation/animatedtiles/images/kinetic.png
deleted file mode 100644
index d5fc0af0f2..0000000000
--- a/examples/widgets/animation/animatedtiles/images/kinetic.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/animatedtiles/images/random.png b/examples/widgets/animation/animatedtiles/images/random.png
deleted file mode 100644
index 415d96f856..0000000000
--- a/examples/widgets/animation/animatedtiles/images/random.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/animatedtiles/images/tile.png b/examples/widgets/animation/animatedtiles/images/tile.png
deleted file mode 100644
index c8f39d8d40..0000000000
--- a/examples/widgets/animation/animatedtiles/images/tile.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/animatedtiles/main.cpp b/examples/widgets/animation/animatedtiles/main.cpp
deleted file mode 100644
index 553b620e41..0000000000
--- a/examples/widgets/animation/animatedtiles/main.cpp
+++ /dev/null
@@ -1,268 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets/QtWidgets>
-#include <QtCore/qmath.h>
-#include <QtCore/qrandom.h>
-#include <QtCore/qstate.h>
-
-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 = nullptr)
- : QGraphicsWidget(parent), _pix(pixmap)
- {
- setAcceptHoverEvents(true);
- setCacheMode(DeviceCoordinateCache);
- }
-
- QRectF boundingRect() const override
- {
- return QRectF(-65, -65, 130, 130);
- }
-
- QPainterPath shape() const override
- {
- QPainterPath path;
- path.addEllipse(boundingRect());
- return path;
- }
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *) override
- {
- 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 *) override
- {
- emit pressed();
- update();
- }
-
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override
- {
- update();
- }
-
-private:
- QPixmap _pix;
-};
-
-class View : public QGraphicsView
-{
-public:
- View(QGraphicsScene *scene) : QGraphicsView(scene) { }
-
-protected:
- void resizeEvent(QResizeEvent *event) override
- {
- QGraphicsView::resizeEvent(event);
- fitInView(sceneRect(), Qt::KeepAspectRatio);
- }
-};
-
-int main(int argc, char **argv)
-{
- Q_INIT_RESOURCE(animatedtiles);
-
- 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->setTransform(QTransform::fromScale(0.75, 0.75), true);
- 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 < items.count(); ++i) {
- Pixmap *item = items.at(i);
- // Ellipse
- ellipseState->assignProperty(item, "pos",
- QPointF(qCos((i / 63.0) * 6.28) * 250,
- qSin((i / 63.0) * 6.28) * 250));
-
- // Figure 8
- figure8State->assignProperty(item, "pos",
- QPointF(qSin((i / 63.0) * 6.28) * 250,
- qSin(((i * 2)/63.0) * 6.28) * 250));
-
- // Random
- randomState->assignProperty(item, "pos",
- QPointF(-250 + QRandomGenerator::global()->bounded(500),
- -250 + QRandomGenerator::global()->bounded(500)));
-
- // Tiled
- tiledState->assignProperty(item, "pos",
- QPointF(((i % 8) - 4) * kineticPix.width() + kineticPix.width() / 2,
- ((i / 8) - 4) * kineticPix.height() + kineticPix.height() / 2));
-
- // Centered
- centeredState->assignProperty(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);
-
- QParallelAnimationGroup *group = new QParallelAnimationGroup;
- for (int i = 0; i < items.count(); ++i) {
- QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
- anim->setDuration(750 + i * 25);
- anim->setEasingCurve(QEasingCurve::InOutBack);
- group->addAnimation(anim);
- }
- QAbstractTransition *trans = rootState->addTransition(ellipseButton, &Button::pressed, ellipseState);
- trans->addAnimation(group);
-
- trans = rootState->addTransition(figure8Button, &Button::pressed, figure8State);
- trans->addAnimation(group);
-
- trans = rootState->addTransition(randomButton, &Button::pressed, randomState);
- trans->addAnimation(group);
-
- trans = rootState->addTransition(tiledButton, &Button::pressed, tiledState);
- trans->addAnimation(group);
-
- trans = rootState->addTransition(centeredButton, &Button::pressed, centeredState);
- trans->addAnimation(group);
-
- QTimer timer;
- timer.start(125);
- timer.setSingleShot(true);
- trans = rootState->addTransition(&timer, &QTimer::timeout, ellipseState);
- trans->addAnimation(group);
-
- states.start();
-
-#ifdef QT_KEYPAD_NAVIGATION
- QApplication::setNavigationMode(Qt::NavigationModeCursorAuto);
-#endif
- return app.exec();
-}
-
-#include "main.moc"
diff --git a/examples/widgets/animation/animation.pro b/examples/widgets/animation/animation.pro
index 19b79caf15..3b4aa0f100 100644
--- a/examples/widgets/animation/animation.pro
+++ b/examples/widgets/animation/animation.pro
@@ -1,9 +1,3 @@
TEMPLATE = \
subdirs
-SUBDIRS += \
- animatedtiles \
- easing \
- moveblocks \
- states \
- stickman \
- sub-attaq \
+SUBDIRS += easing
diff --git a/examples/widgets/animation/moveblocks/CMakeLists.txt b/examples/widgets/animation/moveblocks/CMakeLists.txt
deleted file mode 100644
index ed17097f5d..0000000000
--- a/examples/widgets/animation/moveblocks/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Generated from moveblocks.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(moveblocks LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/animation/moveblocks")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-add_qt_gui_executable(moveblocks
- main.cpp
-)
-target_link_libraries(moveblocks PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS moveblocks
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/animation/moveblocks/main.cpp b/examples/widgets/animation/moveblocks/main.cpp
deleted file mode 100644
index d03b57cd5e..0000000000
--- a/examples/widgets/animation/moveblocks/main.cpp
+++ /dev/null
@@ -1,330 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore>
-#include <QtWidgets>
-
-//![15]
-class StateSwitchEvent: public QEvent
-{
-public:
- StateSwitchEvent()
- : QEvent(Type(StateSwitchType))
- {
- }
-
- explicit StateSwitchEvent(int rand)
- : QEvent(Type(StateSwitchType)),
- m_rand(rand)
- {
- }
-
- enum { StateSwitchType = QEvent::User + 256 };
-
- int rand() const { return m_rand; }
-
-private:
- int m_rand;
-};
-//![15]
-
-//![16]
-class QGraphicsRectWidget : public QGraphicsWidget
-{
-public:
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *,
- QWidget *) override
- {
- painter->fillRect(rect(), Qt::blue);
- }
-};
-//![16]
-
-class StateSwitchTransition: public QAbstractTransition
-{
-public:
- StateSwitchTransition(int rand)
- : QAbstractTransition(),
- m_rand(rand)
- {
- }
-
-protected:
-//![14]
- bool eventTest(QEvent *event) override
- {
- return (event->type() == QEvent::Type(StateSwitchEvent::StateSwitchType))
- && (static_cast<StateSwitchEvent *>(event)->rand() == m_rand);
- }
-//![14]
-
- void onTransition(QEvent *) override {}
-
-private:
- int m_rand;
-};
-
-//![10]
-class StateSwitcher : public QState
-{
- Q_OBJECT
-public:
- StateSwitcher(QStateMachine *machine)
- : QState(machine), m_stateCount(0), m_lastIndex(0)
- { }
-//![10]
-
-//![11]
- void onEntry(QEvent *) override
- {
- int n;
- while ((n = QRandomGenerator::global()->bounded(m_stateCount) + 1) == m_lastIndex)
- { }
- m_lastIndex = n;
- machine()->postEvent(new StateSwitchEvent(n));
- }
- void onExit(QEvent *) override {}
-//![11]
-
-//![12]
- void addState(QState *state, QAbstractAnimation *animation) {
- StateSwitchTransition *trans = new StateSwitchTransition(++m_stateCount);
- trans->setTargetState(state);
- addTransition(trans);
- trans->addAnimation(animation);
- }
-//![12]
-
-private:
- int m_stateCount;
- int m_lastIndex;
-};
-
-//![13]
-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->assignProperty(w1, "geometry", rect1);
- result->assignProperty(w2, "geometry", rect2);
- result->assignProperty(w3, "geometry", rect3);
- result->assignProperty(w4, "geometry", rect4);
-
- return result;
-}
-//![13]
-
-
-class GraphicsView : public QGraphicsView
-{
- Q_OBJECT
-public:
- GraphicsView(QGraphicsScene *scene, QWidget *parent = nullptr)
- : QGraphicsView(scene, parent)
- {
- }
-
-protected:
- void resizeEvent(QResizeEvent *event) override
- {
- fitInView(scene()->sceneRect());
- QGraphicsView::resizeEvent(event);
- }
-};
-
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
-//![1]
- 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);
-//![1]
- GraphicsView window(&scene);
- window.setFrameStyle(0);
- window.setAlignment(Qt::AlignLeft | Qt::AlignTop);
- window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- window.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-//![2]
- QStateMachine machine;
-
- QState *group = new QState();
- group->setObjectName("group");
- QTimer timer;
- timer.setInterval(1250);
- timer.setSingleShot(true);
- QObject::connect(group, &QState::entered, &timer, QOverload<>::of(&QTimer::start));
-//![2]
-
-//![3]
- 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);
-//![3]
- 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);
-//![4]
- 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);
-//![4]
-
-//![5]
- QParallelAnimationGroup animationGroup;
- QSequentialAnimationGroup *subGroup;
-
- QPropertyAnimation *anim = new QPropertyAnimation(button4, "geometry");
- anim->setDuration(1000);
- anim->setEasingCurve(QEasingCurve::OutElastic);
- animationGroup.addAnimation(anim);
-//![5]
-
-//![6]
- subGroup = new QSequentialAnimationGroup(&animationGroup);
- subGroup->addPause(100);
- anim = new QPropertyAnimation(button3, "geometry");
- anim->setDuration(1000);
- anim->setEasingCurve(QEasingCurve::OutElastic);
- subGroup->addAnimation(anim);
-//![6]
-
- 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);
-
-//![7]
- StateSwitcher *stateSwitcher = new StateSwitcher(&machine);
- stateSwitcher->setObjectName("stateSwitcher");
- group->addTransition(&timer, &QTimer::timeout, stateSwitcher);
- stateSwitcher->addState(state1, &animationGroup);
- stateSwitcher->addState(state2, &animationGroup);
-//![7]
- stateSwitcher->addState(state3, &animationGroup);
- stateSwitcher->addState(state4, &animationGroup);
- stateSwitcher->addState(state5, &animationGroup);
- stateSwitcher->addState(state6, &animationGroup);
-//![8]
- stateSwitcher->addState(state7, &animationGroup);
-//![8]
-
-//![9]
- machine.addState(group);
- machine.setInitialState(group);
- machine.start();
-//![9]
-
- window.resize(300, 300);
- window.show();
-
- return app.exec();
-}
-
-#include "main.moc"
diff --git a/examples/widgets/animation/moveblocks/moveblocks.pro b/examples/widgets/animation/moveblocks/moveblocks.pro
deleted file mode 100644
index 1397246b3f..0000000000
--- a/examples/widgets/animation/moveblocks/moveblocks.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-QT += widgets
-
-SOURCES = main.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/animation/moveblocks
-INSTALLS += target
diff --git a/examples/widgets/animation/states/CMakeLists.txt b/examples/widgets/animation/states/CMakeLists.txt
deleted file mode 100644
index 6dd9847f03..0000000000
--- a/examples/widgets/animation/states/CMakeLists.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-# Generated from states.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(states LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/animation/states")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-add_qt_gui_executable(states
- main.cpp
-)
-target_link_libraries(states PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(states_resource_files
- "accessories-dictionary.png"
- "akregator.png"
- "digikam.png"
- "help-browser.png"
- "k3b.png"
- "kchart.png"
-)
-
-qt6_add_resources(states "states"
- PREFIX
- "/"
- FILES
- ${states_resource_files}
-)
-
-install(TARGETS states
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/animation/states/accessories-dictionary.png b/examples/widgets/animation/states/accessories-dictionary.png
deleted file mode 100644
index e9bd55d918..0000000000
--- a/examples/widgets/animation/states/accessories-dictionary.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/states/akregator.png b/examples/widgets/animation/states/akregator.png
deleted file mode 100644
index a086f45ab6..0000000000
--- a/examples/widgets/animation/states/akregator.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/states/digikam.png b/examples/widgets/animation/states/digikam.png
deleted file mode 100644
index 9de9fb2f80..0000000000
--- a/examples/widgets/animation/states/digikam.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/states/help-browser.png b/examples/widgets/animation/states/help-browser.png
deleted file mode 100644
index db92faa4e7..0000000000
--- a/examples/widgets/animation/states/help-browser.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/states/k3b.png b/examples/widgets/animation/states/k3b.png
deleted file mode 100644
index bbcafcfba1..0000000000
--- a/examples/widgets/animation/states/k3b.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/states/kchart.png b/examples/widgets/animation/states/kchart.png
deleted file mode 100644
index 1dd115be87..0000000000
--- a/examples/widgets/animation/states/kchart.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/states/main.cpp b/examples/widgets/animation/states/main.cpp
deleted file mode 100644
index 0f61b7457a..0000000000
--- a/examples/widgets/animation/states/main.cpp
+++ /dev/null
@@ -1,295 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-class Pixmap : public QGraphicsObject
-{
- Q_OBJECT
-public:
- Pixmap(const QPixmap &pix) : QGraphicsObject(), p(pix)
- {
- }
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
- {
- painter->drawPixmap(QPointF(), p);
- }
-
- QRectF boundingRect() const override
- {
- return QRectF( QPointF(0, 0), p.size());
- }
-
-private:
- QPixmap p;
-};
-
-class GraphicsView : public QGraphicsView
-{
-public:
- GraphicsView(QGraphicsScene *scene) : QGraphicsView(scene)
- {
- }
-
- void resizeEvent(QResizeEvent *) override
- {
- fitInView(sceneRect(), Qt::KeepAspectRatio);
- }
-};
-
-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 *state1 = new QState(&machine);
- QState *state2 = new QState(&machine);
- QState *state3 = new QState(&machine);
- machine.setInitialState(state1);
-
- // State 1
- state1->assignProperty(button, "text", "Switch to state 2");
- state1->assignProperty(widget, "geometry", QRectF(0, 0, 400, 150));
- state1->assignProperty(box, "geometry", QRect(-200, 150, 200, 150));
- state1->assignProperty(p1, "pos", QPointF(68, 200)); // 185));
- state1->assignProperty(p2, "pos", QPointF(168, 200)); // 185));
- state1->assignProperty(p3, "pos", QPointF(268, 200)); // 185));
- state1->assignProperty(p4, "pos", QPointF(68 - 150, 48 - 150));
- state1->assignProperty(p5, "pos", QPointF(168, 48 - 150));
- state1->assignProperty(p6, "pos", QPointF(268 + 150, 48 - 150));
- state1->assignProperty(p1, "rotation", qreal(0));
- state1->assignProperty(p2, "rotation", qreal(0));
- state1->assignProperty(p3, "rotation", qreal(0));
- state1->assignProperty(p4, "rotation", qreal(-270));
- state1->assignProperty(p5, "rotation", qreal(-90));
- state1->assignProperty(p6, "rotation", qreal(270));
- state1->assignProperty(boxProxy, "opacity", qreal(0));
- state1->assignProperty(p1, "opacity", qreal(1));
- state1->assignProperty(p2, "opacity", qreal(1));
- state1->assignProperty(p3, "opacity", qreal(1));
- state1->assignProperty(p4, "opacity", qreal(0));
- state1->assignProperty(p5, "opacity", qreal(0));
- state1->assignProperty(p6, "opacity", qreal(0));
-
- // State 2
- state2->assignProperty(button, "text", "Switch to state 3");
- state2->assignProperty(widget, "geometry", QRectF(200, 150, 200, 150));
- state2->assignProperty(box, "geometry", QRect(9, 150, 190, 150));
- state2->assignProperty(p1, "pos", QPointF(68 - 150, 185 + 150));
- state2->assignProperty(p2, "pos", QPointF(168, 185 + 150));
- state2->assignProperty(p3, "pos", QPointF(268 + 150, 185 + 150));
- state2->assignProperty(p4, "pos", QPointF(64, 48));
- state2->assignProperty(p5, "pos", QPointF(168, 48));
- state2->assignProperty(p6, "pos", QPointF(268, 48));
- state2->assignProperty(p1, "rotation", qreal(-270));
- state2->assignProperty(p2, "rotation", qreal(90));
- state2->assignProperty(p3, "rotation", qreal(270));
- state2->assignProperty(p4, "rotation", qreal(0));
- state2->assignProperty(p5, "rotation", qreal(0));
- state2->assignProperty(p6, "rotation", qreal(0));
- state2->assignProperty(boxProxy, "opacity", qreal(1));
- state2->assignProperty(p1, "opacity", qreal(0));
- state2->assignProperty(p2, "opacity", qreal(0));
- state2->assignProperty(p3, "opacity", qreal(0));
- state2->assignProperty(p4, "opacity", qreal(1));
- state2->assignProperty(p5, "opacity", qreal(1));
- state2->assignProperty(p6, "opacity", qreal(1));
-
- // State 3
- state3->assignProperty(button, "text", "Switch to state 1");
- state3->assignProperty(p1, "pos", QPointF(0, 5));
- state3->assignProperty(p2, "pos", QPointF(0, 5 + 64 + 5));
- state3->assignProperty(p3, "pos", QPointF(5, 5 + (64 + 5) + 64));
- state3->assignProperty(p4, "pos", QPointF(5 + 64 + 5, 5));
- state3->assignProperty(p5, "pos", QPointF(5 + 64 + 5, 5 + 64 + 5));
- state3->assignProperty(p6, "pos", QPointF(5 + 64 + 5, 5 + (64 + 5) + 64));
- state3->assignProperty(widget, "geometry", QRectF(138, 5, 400 - 138, 200));
- state3->assignProperty(box, "geometry", QRect(5, 205, 400, 90));
- state3->assignProperty(p1, "opacity", qreal(1));
- state3->assignProperty(p2, "opacity", qreal(1));
- state3->assignProperty(p3, "opacity", qreal(1));
- state3->assignProperty(p4, "opacity", qreal(1));
- state3->assignProperty(p5, "opacity", qreal(1));
- state3->assignProperty(p6, "opacity", qreal(1));
-
- QAbstractTransition *t1 = state1->addTransition(button, &QAbstractButton::clicked, state2);
- QSequentialAnimationGroup *animation1SubGroup = new QSequentialAnimationGroup;
- animation1SubGroup->addPause(250);
- animation1SubGroup->addAnimation(new QPropertyAnimation(box, "geometry"));
- t1->addAnimation(animation1SubGroup);
- t1->addAnimation(new QPropertyAnimation(widget, "geometry"));
- t1->addAnimation(new QPropertyAnimation(p1, "pos"));
- t1->addAnimation(new QPropertyAnimation(p2, "pos"));
- t1->addAnimation(new QPropertyAnimation(p3, "pos"));
- t1->addAnimation(new QPropertyAnimation(p4, "pos"));
- t1->addAnimation(new QPropertyAnimation(p5, "pos"));
- t1->addAnimation(new QPropertyAnimation(p6, "pos"));
- t1->addAnimation(new QPropertyAnimation(p1, "rotation"));
- t1->addAnimation(new QPropertyAnimation(p2, "rotation"));
- t1->addAnimation(new QPropertyAnimation(p3, "rotation"));
- t1->addAnimation(new QPropertyAnimation(p4, "rotation"));
- t1->addAnimation(new QPropertyAnimation(p5, "rotation"));
- t1->addAnimation(new QPropertyAnimation(p6, "rotation"));
- t1->addAnimation(new QPropertyAnimation(p1, "opacity"));
- t1->addAnimation(new QPropertyAnimation(p2, "opacity"));
- t1->addAnimation(new QPropertyAnimation(p3, "opacity"));
- t1->addAnimation(new QPropertyAnimation(p4, "opacity"));
- t1->addAnimation(new QPropertyAnimation(p5, "opacity"));
- t1->addAnimation(new QPropertyAnimation(p6, "opacity"));
-
- QAbstractTransition *t2 = state2->addTransition(button, &QAbstractButton::clicked, state3);
- t2->addAnimation(new QPropertyAnimation(box, "geometry"));
- t2->addAnimation(new QPropertyAnimation(widget, "geometry"));
- t2->addAnimation(new QPropertyAnimation(p1, "pos"));
- t2->addAnimation(new QPropertyAnimation(p2, "pos"));
- t2->addAnimation(new QPropertyAnimation(p3, "pos"));
- t2->addAnimation(new QPropertyAnimation(p4, "pos"));
- t2->addAnimation(new QPropertyAnimation(p5, "pos"));
- t2->addAnimation(new QPropertyAnimation(p6, "pos"));
- t2->addAnimation(new QPropertyAnimation(p1, "rotation"));
- t2->addAnimation(new QPropertyAnimation(p2, "rotation"));
- t2->addAnimation(new QPropertyAnimation(p3, "rotation"));
- t2->addAnimation(new QPropertyAnimation(p4, "rotation"));
- t2->addAnimation(new QPropertyAnimation(p5, "rotation"));
- t2->addAnimation(new QPropertyAnimation(p6, "rotation"));
- t2->addAnimation(new QPropertyAnimation(p1, "opacity"));
- t2->addAnimation(new QPropertyAnimation(p2, "opacity"));
- t2->addAnimation(new QPropertyAnimation(p3, "opacity"));
- t2->addAnimation(new QPropertyAnimation(p4, "opacity"));
- t2->addAnimation(new QPropertyAnimation(p5, "opacity"));
- t2->addAnimation(new QPropertyAnimation(p6, "opacity"));
-
- QAbstractTransition *t3 = state3->addTransition(button, &QAbstractButton::clicked, state1);
- t3->addAnimation(new QPropertyAnimation(box, "geometry"));
- t3->addAnimation(new QPropertyAnimation(widget, "geometry"));
- t3->addAnimation(new QPropertyAnimation(p1, "pos"));
- t3->addAnimation(new QPropertyAnimation(p2, "pos"));
- t3->addAnimation(new QPropertyAnimation(p3, "pos"));
- t3->addAnimation(new QPropertyAnimation(p4, "pos"));
- t3->addAnimation(new QPropertyAnimation(p5, "pos"));
- t3->addAnimation(new QPropertyAnimation(p6, "pos"));
- t3->addAnimation(new QPropertyAnimation(p1, "rotation"));
- t3->addAnimation(new QPropertyAnimation(p2, "rotation"));
- t3->addAnimation(new QPropertyAnimation(p3, "rotation"));
- t3->addAnimation(new QPropertyAnimation(p4, "rotation"));
- t3->addAnimation(new QPropertyAnimation(p5, "rotation"));
- t3->addAnimation(new QPropertyAnimation(p6, "rotation"));
- t3->addAnimation(new QPropertyAnimation(p1, "opacity"));
- t3->addAnimation(new QPropertyAnimation(p2, "opacity"));
- t3->addAnimation(new QPropertyAnimation(p3, "opacity"));
- t3->addAnimation(new QPropertyAnimation(p4, "opacity"));
- t3->addAnimation(new QPropertyAnimation(p5, "opacity"));
- t3->addAnimation(new QPropertyAnimation(p6, "opacity"));
-
- machine.start();
-
- GraphicsView view(&scene);
-
- view.show();
-
- return app.exec();
-}
-
-#include "main.moc"
diff --git a/examples/widgets/animation/states/states.pro b/examples/widgets/animation/states/states.pro
deleted file mode 100644
index 491d557a8d..0000000000
--- a/examples/widgets/animation/states/states.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-QT += widgets
-
-SOURCES += main.cpp
-RESOURCES += states.qrc
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/animation/states
-INSTALLS += target
diff --git a/examples/widgets/animation/states/states.qrc b/examples/widgets/animation/states/states.qrc
deleted file mode 100644
index 60ab3f7a60..0000000000
--- a/examples/widgets/animation/states/states.qrc
+++ /dev/null
@@ -1,10 +0,0 @@
-<!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/widgets/animation/stickman/CMakeLists.txt b/examples/widgets/animation/stickman/CMakeLists.txt
deleted file mode 100644
index 07f3d96ea0..0000000000
--- a/examples/widgets/animation/stickman/CMakeLists.txt
+++ /dev/null
@@ -1,57 +0,0 @@
-# Generated from stickman.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(stickman LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/animation/stickman")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-add_qt_gui_executable(stickman
- animation.cpp animation.h
- graphicsview.cpp graphicsview.h
- lifecycle.cpp lifecycle.h
- main.cpp
- node.cpp node.h
- rectbutton.cpp rectbutton.h
- stickman.cpp stickman.h
-)
-target_link_libraries(stickman PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(stickman_resource_files
- "animations/chilling.bin"
- "animations/dancing.bin"
- "animations/dead.bin"
- "animations/jumping.bin"
-)
-
-qt6_add_resources(stickman "stickman"
- PREFIX
- "/"
- FILES
- ${stickman_resource_files}
-)
-
-install(TARGETS stickman
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/animation/stickman/animation.cpp b/examples/widgets/animation/stickman/animation.cpp
deleted file mode 100644
index 77a1875be3..0000000000
--- a/examples/widgets/animation/stickman/animation.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "animation.h"
-
-#include <QIODevice>
-#include <QDataStream>
-
-class Frame
-{
-public:
- Frame() = default;
-
- int nodeCount() const
- {
- return m_nodePositions.size();
- }
-
- void setNodeCount(int nodeCount)
- {
- m_nodePositions.resize(nodeCount);
- }
-
- 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();
-
- setCurrentFrame(m_currentFrame);
-}
-
-int Animation::totalFrames() const
-{
- return m_frames.size();
-}
-
-void Animation::setCurrentFrame(int currentFrame)
-{
- m_currentFrame = qBound(0, currentFrame, totalFrames() - 1);
-}
-
-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();
- for (const Frame *frame : qAsConst(m_frames)) {
- stream << frame->nodeCount();
- for (int i = 0; i < frame->nodeCount(); ++i)
- stream << frame->nodePos(i);
- }
-}
-
-void Animation::load(QIODevice *device)
-{
- 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);
- }
-}
diff --git a/examples/widgets/animation/stickman/animation.h b/examples/widgets/animation/stickman/animation.h
deleted file mode 100644
index 93caff48a2..0000000000
--- a/examples/widgets/animation/stickman/animation.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANIMATION_H
-#define ANIMATION_H
-
-#include <QPointF>
-#include <QString>
-#include <QList>
-
-class Frame;
-QT_BEGIN_NAMESPACE
-class QIODevice;
-QT_END_NAMESPACE
-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/widgets/animation/stickman/animations/chilling.bin b/examples/widgets/animation/stickman/animations/chilling.bin
deleted file mode 100644
index a81fc7a18c..0000000000
--- a/examples/widgets/animation/stickman/animations/chilling.bin
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/stickman/animations/dancing.bin b/examples/widgets/animation/stickman/animations/dancing.bin
deleted file mode 100644
index 462f66f89b..0000000000
--- a/examples/widgets/animation/stickman/animations/dancing.bin
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/stickman/animations/dead.bin b/examples/widgets/animation/stickman/animations/dead.bin
deleted file mode 100644
index 9859b4b4cd..0000000000
--- a/examples/widgets/animation/stickman/animations/dead.bin
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/stickman/animations/jumping.bin b/examples/widgets/animation/stickman/animations/jumping.bin
deleted file mode 100644
index 12661a15f8..0000000000
--- a/examples/widgets/animation/stickman/animations/jumping.bin
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/stickman/graphicsview.cpp b/examples/widgets/animation/stickman/graphicsview.cpp
deleted file mode 100644
index 0f5800cff3..0000000000
--- a/examples/widgets/animation/stickman/graphicsview.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "graphicsview.h"
-#include "stickman.h"
-
-#include <QKeyEvent>
-#include <QGraphicsScene>
-
-void GraphicsView::keyPressEvent(QKeyEvent *e)
-{
- if (e->key() == Qt::Key_Escape)
- close();
- emit keyPressed(Qt::Key(e->key()));
-}
-
-void GraphicsView::resizeEvent(QResizeEvent *e)
-{
- fitInView(scene()->sceneRect());
- QGraphicsView::resizeEvent(e);
-}
diff --git a/examples/widgets/animation/stickman/graphicsview.h b/examples/widgets/animation/stickman/graphicsview.h
deleted file mode 100644
index 29f4c6237e..0000000000
--- a/examples/widgets/animation/stickman/graphicsview.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef GRAPHICSVIEW_H
-#define GRAPHICSVIEW_H
-
-#include <QGraphicsView>
-
-class GraphicsView: public QGraphicsView
-{
- Q_OBJECT
-public:
- using QGraphicsView::QGraphicsView;
-
-protected:
- void resizeEvent(QResizeEvent *e) override;
- void keyPressEvent(QKeyEvent *e) override;
-
-signals:
- void keyPressed(int key);
-};
-
-#endif
diff --git a/examples/widgets/animation/stickman/lifecycle.cpp b/examples/widgets/animation/stickman/lifecycle.cpp
deleted file mode 100644
index 5ad284c590..0000000000
--- a/examples/widgets/animation/stickman/lifecycle.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "lifecycle.h"
-#include "stickman.h"
-#include "node.h"
-#include "animation.h"
-#include "graphicsview.h"
-
-#include <QEventTransition>
-#include <QFile>
-#include <QParallelAnimationGroup>
-#include <QPropertyAnimation>
-#include <QRandomGenerator>
-#include <QSignalTransition>
-#include <QState>
-#include <QStateMachine>
-#include <QTimer>
-
-class KeyPressTransition: public QSignalTransition
-{
-public:
- KeyPressTransition(GraphicsView *receiver, Qt::Key key)
- : QSignalTransition(receiver, &GraphicsView::keyPressed), m_key(key)
- {
- }
- KeyPressTransition(GraphicsView *receiver, Qt::Key key, QAbstractState *target)
- : QSignalTransition(receiver, &GraphicsView::keyPressed), m_key(key)
- {
- setTargetState(target);
- }
-
- bool eventTest(QEvent *e) override
- {
- if (QSignalTransition::eventTest(e)) {
- QVariant key = static_cast<QStateMachine::SignalEvent*>(e)->arguments().at(0);
- return (key.toInt() == int(m_key));
- }
-
- return false;
- }
-private:
- Qt::Key m_key;
-};
-
-//! [4]
-class LightningStrikesTransition: public QEventTransition
-{
-public:
- LightningStrikesTransition(QAbstractState *target)
- : QEventTransition(this, QEvent::Timer)
- {
- setTargetState(target);
- startTimer(1000);
- }
-
- bool eventTest(QEvent *e) override
- {
- return QEventTransition::eventTest(e) && QRandomGenerator::global()->bounded(50) == 0;
- }
-};
-//! [4]
-
-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), "pos");
- m_animationGroup->addAnimation(pa);
- }
-
- // Set up initial state graph
-//! [3]
- m_machine = new QStateMachine();
- m_machine->addDefaultAnimation(m_animationGroup);
-//! [3]
-
- m_alive = new QState(m_machine);
- m_alive->setObjectName("alive");
-
- // Make it blink when lightning strikes before entering dead animation
- QState *lightningBlink = new QState(m_machine);
- lightningBlink->assignProperty(m_stickMan->scene(), "backgroundBrush", QColor(Qt::white));
- lightningBlink->assignProperty(m_stickMan, "penColor", QColor(Qt::black));
- lightningBlink->assignProperty(m_stickMan, "fillColor", QColor(Qt::white));
- lightningBlink->assignProperty(m_stickMan, "isDead", true);
-
-//! [5]
- QTimer *timer = new QTimer(lightningBlink);
- timer->setSingleShot(true);
- timer->setInterval(100);
- QObject::connect(lightningBlink, &QAbstractState::entered,
- timer, QOverload<>::of(&QTimer::start));
- QObject::connect(lightningBlink, &QAbstractState::exited,
- timer, &QTimer::stop);
-//! [5]
-
- m_dead = new QState(m_machine);
- m_dead->assignProperty(m_stickMan->scene(), "backgroundBrush", QColor(Qt::black));
- m_dead->assignProperty(m_stickMan, "penColor", QColor(Qt::white));
- m_dead->assignProperty(m_stickMan, "fillColor", QColor(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));
-//! [0]
- lightningBlink->addTransition(timer, &QTimer::timeout, m_dead);
-//! [0]
-
- m_machine->setInitialState(m_alive);
-}
-
-void LifeCycle::setDeathAnimation(const QString &fileName)
-{
- QState *deathAnimation = makeState(m_dead, fileName);
- m_dead->setInitialState(deathAnimation);
-}
-
-void LifeCycle::start()
-{
- m_machine->start();
-}
-
-void LifeCycle::addActivity(const QString &fileName, Qt::Key key, QObject *sender, const char *signal)
-{
- QState *state = makeState(m_alive, fileName);
- m_alive->addTransition(new KeyPressTransition(m_keyReceiver, key, state));
-
- if (sender && signal)
- m_alive->addTransition(sender, signal, state);
-}
-
-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 = nullptr;
- for (int i = 0; i < frameCount; ++i) {
- animation.setCurrentFrame(i);
-
-//! [1]
- QState *frameState = new QState(topLevel);
- const int nodeCount = animation.nodeCount();
- for (int j = 0; j < nodeCount; ++j)
- frameState->assignProperty(m_stickMan->node(j), "pos", animation.nodePos(j));
-//! [1]
-
- frameState->setObjectName(QString::fromLatin1("frame %0").arg(i));
- if (previousState == nullptr)
- topLevel->setInitialState(frameState);
- else
-//! [2]
- previousState->addTransition(previousState, &QState::propertiesAssigned, frameState);
-//! [2]
-
- previousState = frameState;
- }
-
- // Loop
- previousState->addTransition(previousState, &QState::propertiesAssigned, topLevel->initialState());
-
- return topLevel;
-
-}
-
-LifeCycle::~LifeCycle()
-{
- delete m_machine;
- delete m_animationGroup;
-}
diff --git a/examples/widgets/animation/stickman/lifecycle.h b/examples/widgets/animation/stickman/lifecycle.h
deleted file mode 100644
index 21ab99276d..0000000000
--- a/examples/widgets/animation/stickman/lifecycle.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LIFECYCLE_H
-#define LIFECYCLE_H
-
-#include <Qt>
-
-QT_BEGIN_NAMESPACE
-class QAbstractState;
-class QAbstractTransition;
-class QAnimationGroup;
-class QObject;
-class QState;
-class QStateMachine;
-QT_END_NAMESPACE
-class GraphicsView;
-class StickMan;
-class LifeCycle
-{
-public:
- LifeCycle(StickMan *stickMan, GraphicsView *keyEventReceiver);
- ~LifeCycle();
-
- void setDeathAnimation(const QString &fileName);
- void addActivity(const QString &fileName, Qt::Key key,
- QObject *sender = nullptr, const char *signal = nullptr);
-
- void start();
-
-private:
- 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/widgets/animation/stickman/main.cpp b/examples/widgets/animation/stickman/main.cpp
deleted file mode 100644
index 5142c4fee9..0000000000
--- a/examples/widgets/animation/stickman/main.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "animation.h"
-#include "node.h"
-#include "lifecycle.h"
-#include "stickman.h"
-#include "graphicsview.h"
-#include "rectbutton.h"
-
-#include <QtCore>
-#include <QtWidgets>
-
-int main(int argc, char **argv)
-{
- Q_INIT_RESOURCE(stickman);
- 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>When you are done, press <font color=\"purple\">Escape</font>.</li>"
- "</i></p>"
- "<p>If he is 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;
- scene.addItem(stickMan);
-
- scene.addItem(textItem);
- scene.setBackgroundBrush(Qt::black);
-
- GraphicsView view;
- view.setRenderHints(QPainter::Antialiasing);
- view.setTransformationAnchor(QGraphicsView::NoAnchor);
- view.setScene(&scene);
-
- QRectF sceneRect = scene.sceneRect();
- // making enough room in the scene for stickman to jump and die
- view.resize(sceneRect.width() + 100, sceneRect.height() + 100);
- view.setSceneRect(sceneRect);
-
- view.show();
- view.setFocus();
-
- LifeCycle cycle(stickMan, &view);
- cycle.setDeathAnimation(":/animations/dead.bin");
-
- cycle.addActivity(":/animations/jumping.bin", Qt::Key_J);
- cycle.addActivity(":/animations/dancing.bin", Qt::Key_D);
- cycle.addActivity(":/animations/chilling.bin", Qt::Key_C);
-
- cycle.start();
-
-
- return app.exec();
-}
diff --git a/examples/widgets/animation/stickman/node.cpp b/examples/widgets/animation/stickman/node.cpp
deleted file mode 100644
index 43a9c93de8..0000000000
--- a/examples/widgets/animation/stickman/node.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "node.h"
-#include "stickman.h"
-
-#include <QRectF>
-#include <QPainter>
-#include <QGraphicsSceneMouseEvent>
-
-Node::Node(const QPointF &pos, QGraphicsItem *parent)
- : QGraphicsObject(parent), m_dragging(false)
-{
- setPos(pos);
- setFlag(QGraphicsItem::ItemSendsGeometryChanges);
-}
-
-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);
-}
-
-QVariant Node::itemChange(GraphicsItemChange change, const QVariant &value)
-{
- if (change == QGraphicsItem::ItemPositionChange)
- emit positionChanged();
-
- return QGraphicsObject::itemChange(change, value);
-}
-
-void Node::mousePressEvent(QGraphicsSceneMouseEvent *)
-{
- m_dragging = true;
-}
-
-void Node::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
-{
- if (m_dragging)
- setPos(mapToParent(event->pos()));
-}
-
-void Node::mouseReleaseEvent(QGraphicsSceneMouseEvent *)
-{
- m_dragging = false;
-}
diff --git a/examples/widgets/animation/stickman/node.h b/examples/widgets/animation/stickman/node.h
deleted file mode 100644
index 2b393c60c1..0000000000
--- a/examples/widgets/animation/stickman/node.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef NODE_H
-#define NODE_H
-
-#include <QGraphicsObject>
-
-class Node: public QGraphicsObject
-{
- Q_OBJECT
-public:
- explicit Node(const QPointF &pos, QGraphicsItem *parent = nullptr);
- ~Node();
-
- QRectF boundingRect() const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
-
-signals:
- void positionChanged();
-
-protected:
- QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
-
- void mousePressEvent(QGraphicsSceneMouseEvent *) override;
- void mouseMoveEvent(QGraphicsSceneMouseEvent *) override;
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *) override;
-
-private:
- bool m_dragging;
-};
-
-#endif
diff --git a/examples/widgets/animation/stickman/rectbutton.cpp b/examples/widgets/animation/stickman/rectbutton.cpp
deleted file mode 100644
index 5174d0aeaf..0000000000
--- a/examples/widgets/animation/stickman/rectbutton.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "rectbutton.h"
-#include <QPainter>
-
-RectButton::RectButton(const QString &buttonText) : m_ButtonText(buttonText)
-{
-}
-
-
-void RectButton::mousePressEvent (QGraphicsSceneMouseEvent *)
-{
- emit clicked();
-}
-
-
-QRectF RectButton::boundingRect() const
-{
- return QRectF(0.0, 0.0, 90.0, 40.0);
-}
-
-
-void RectButton::paint(QPainter *painter, const QStyleOptionGraphicsItem * /* option */, QWidget * /* widget */)
-{
- painter->setBrush(Qt::gray);
- painter->drawRoundedRect(boundingRect(), 5, 5);
-
- painter->setPen(Qt::white);
- painter->drawText(20, 25, m_ButtonText);
-}
diff --git a/examples/widgets/animation/stickman/rectbutton.h b/examples/widgets/animation/stickman/rectbutton.h
deleted file mode 100644
index ee6cd3f530..0000000000
--- a/examples/widgets/animation/stickman/rectbutton.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef RECTBUTTON_H
-#define RECTBUTTON_H
-
-#include <QGraphicsObject>
-
-class RectButton : public QGraphicsObject
-{
- Q_OBJECT
-public:
- RectButton(const QString &buttonText);
-
- QRectF boundingRect() const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
-
-protected:
- void mousePressEvent (QGraphicsSceneMouseEvent *event) override;
-
-signals:
- void clicked();
-
-private:
- QString m_ButtonText;
-};
-
-#endif // RECTBUTTON_H
diff --git a/examples/widgets/animation/stickman/stickman.cpp b/examples/widgets/animation/stickman/stickman.cpp
deleted file mode 100644
index 3f373b6b52..0000000000
--- a/examples/widgets/animation/stickman/stickman.cpp
+++ /dev/null
@@ -1,329 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "stickman.h"
-#include "node.h"
-
-#include <QPainter>
-#include <QtMath>
-
-static constexpr 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 constexpr 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()
-{
- // 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);
- connect(m_nodes[i], &Node::positionChanged, this, &StickMan::childPositionChanged);
- }
-
- 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);
-}
-
-void StickMan::childPositionChanged()
-{
- prepareGeometryChange();
-}
-
-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
- return childrenBoundingRect().adjusted(-55.0, -55.0, 55.0, 55.0);
-}
-
-int StickMan::nodeCount() const
-{
- return NodeCount;
-}
-
-Node *StickMan::node(int idx) const
-{
- if (idx >= 0 && idx < NodeCount)
- return m_nodes[idx];
- return nullptr;
-}
-
-void StickMan::timerEvent(QTimerEvent *)
-{
- update();
-}
-
-void StickMan::stabilize()
-{
- static const qreal threshold = 0.001;
-
- 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;
-
- QPointF p = dist * (0.5 * diff);
- if (p.x() > threshold && p.y() > threshold) {
- pos1 -= p;
- pos2 += p;
-
- 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 = qRadiansToDegrees(asin(sinAngle));
-
- QPointF headPos = node1->pos();
- painter->translate(headPos);
- painter->rotate(-angle);
-
- painter->setBrush(m_fillColor);
- painter->drawEllipse(QPointF(0,0), 50.0, 50.0);
-
- 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);
- }
- }
- }
-}
-
-
-
diff --git a/examples/widgets/animation/stickman/stickman.h b/examples/widgets/animation/stickman/stickman.h
deleted file mode 100644
index 63c02abc8f..0000000000
--- a/examples/widgets/animation/stickman/stickman.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef STICKMAN_H
-#define STICKMAN_H
-
-#include <QGraphicsObject>
-
-static const int NodeCount = 16;
-static const int BoneCount = 24;
-
-class Node;
-class StickMan: public QGraphicsObject
-{
- 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();
-
- QRectF boundingRect() const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
-
- 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();
- void childPositionChanged();
-
-protected:
- void timerEvent(QTimerEvent *e) override;
-
-private:
-
- QPointF posFor(int idx) const;
-
- Node *m_nodes[NodeCount];
- qreal m_perfectBoneLengths[BoneCount];
-
- bool m_sticks = true;
- bool m_isDead = false;
-
- QColor m_penColor = Qt::white;
- QColor m_fillColor = Qt::black;
-};
-
-#endif // STICKMAN_H
diff --git a/examples/widgets/animation/stickman/stickman.pro b/examples/widgets/animation/stickman/stickman.pro
deleted file mode 100644
index a803acf624..0000000000
--- a/examples/widgets/animation/stickman/stickman.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-QT += widgets
-
-HEADERS += stickman.h \
- animation.h \
- node.h \
- lifecycle.h \
- graphicsview.h \
- rectbutton.h
-SOURCES += main.cpp \
- stickman.cpp \
- animation.cpp \
- node.cpp \
- lifecycle.cpp \
- graphicsview.cpp \
- rectbutton.cpp
-
-RESOURCES += stickman.qrc
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/animation/stickman
-INSTALLS += target
diff --git a/examples/widgets/animation/stickman/stickman.qrc b/examples/widgets/animation/stickman/stickman.qrc
deleted file mode 100644
index 4cf3ba3828..0000000000
--- a/examples/widgets/animation/stickman/stickman.qrc
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>animations/chilling.bin</file>
- <file>animations/dancing.bin</file>
- <file>animations/dead.bin</file>
- <file>animations/jumping.bin</file>
-</qresource>
-</RCC>
diff --git a/examples/widgets/animation/sub-attaq/.prev_CMakeLists.txt b/examples/widgets/animation/sub-attaq/.prev_CMakeLists.txt
deleted file mode 100644
index 4967673c69..0000000000
--- a/examples/widgets/animation/sub-attaq/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,196 +0,0 @@
-# Generated from sub-attaq.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(sub-attaq LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/animation/sub-attaq")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-add_qt_gui_executable(sub-attaq
- animationmanager.cpp animationmanager.h
- boat.cpp boat.h boat_p.h
- bomb.cpp bomb.h
- graphicsscene.cpp graphicsscene.h
- main.cpp
- mainwindow.cpp mainwindow.h
- pixmapitem.cpp pixmapitem.h
- progressitem.cpp progressitem.h
- qanimationstate.cpp qanimationstate.h
- states.cpp states.h
- submarine.cpp submarine.h submarine_p.h
- textinformationitem.cpp textinformationitem.h
- torpedo.cpp torpedo.h
-)
-target_link_libraries(sub-attaq PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set_source_files_properties("pics/big/background.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/background"
-)
-set_source_files_properties("pics/big/boat.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/boat"
-)
-set_source_files_properties("pics/big/bomb.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/bomb"
-)
-set_source_files_properties("pics/big/explosion/boat/step1.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/boat/step1"
-)
-set_source_files_properties("pics/big/explosion/boat/step2.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/boat/step2"
-)
-set_source_files_properties("pics/big/explosion/boat/step3.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/boat/step3"
-)
-set_source_files_properties("pics/big/explosion/boat/step4.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/boat/step4"
-)
-set_source_files_properties("pics/big/explosion/submarine/step1.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/submarine/step1"
-)
-set_source_files_properties("pics/big/explosion/submarine/step2.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/submarine/step2"
-)
-set_source_files_properties("pics/big/explosion/submarine/step3.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/submarine/step3"
-)
-set_source_files_properties("pics/big/explosion/submarine/step4.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/submarine/step4"
-)
-set_source_files_properties("pics/big/submarine.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/submarine"
-)
-set_source_files_properties("pics/big/surface.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/surface"
-)
-set_source_files_properties("pics/big/torpedo.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/torpedo"
-)
-set_source_files_properties("pics/scalable/boat.svg"
- PROPERTIES QT_RESOURCE_ALIAS "boat"
-)
-set_source_files_properties("pics/scalable/sub-attaq.svg"
- PROPERTIES QT_RESOURCE_ALIAS "all"
-)
-set_source_files_properties("pics/scalable/submarine.svg"
- PROPERTIES QT_RESOURCE_ALIAS "submarine"
-)
-set_source_files_properties("pics/scalable/torpedo.svg"
- PROPERTIES QT_RESOURCE_ALIAS "torpedo"
-)
-set_source_files_properties("pics/small/background.png"
- PROPERTIES QT_RESOURCE_ALIAS "small/background"
-)
-set_source_files_properties("pics/small/boat.png"
- PROPERTIES QT_RESOURCE_ALIAS "small/boat"
-)
-set_source_files_properties("pics/small/bomb.png"
- PROPERTIES QT_RESOURCE_ALIAS "small/bomb"
-)
-set_source_files_properties("pics/small/submarine.png"
- PROPERTIES QT_RESOURCE_ALIAS "small/submarine"
-)
-set_source_files_properties("pics/small/surface.png"
- PROPERTIES QT_RESOURCE_ALIAS "small/surface"
-)
-set_source_files_properties("pics/small/torpedo.png"
- PROPERTIES QT_RESOURCE_ALIAS "small/torpedo"
-)
-set_source_files_properties("pics/welcome/logo-a.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-a"
-)
-set_source_files_properties("pics/welcome/logo-a2.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-a2"
-)
-set_source_files_properties("pics/welcome/logo-b.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-b"
-)
-set_source_files_properties("pics/welcome/logo-dash.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-dash"
-)
-set_source_files_properties("pics/welcome/logo-excl.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-excl"
-)
-set_source_files_properties("pics/welcome/logo-q.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-q"
-)
-set_source_files_properties("pics/welcome/logo-s.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-s"
-)
-set_source_files_properties("pics/welcome/logo-t.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-t"
-)
-set_source_files_properties("pics/welcome/logo-t2.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-t2"
-)
-set_source_files_properties("pics/welcome/logo-u.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-u"
-)
-set(subattaq_resource_files
- "data.xml"
- "pics/big/background.png"
- "pics/big/boat.png"
- "pics/big/bomb.png"
- "pics/big/explosion/boat/step1.png"
- "pics/big/explosion/boat/step2.png"
- "pics/big/explosion/boat/step3.png"
- "pics/big/explosion/boat/step4.png"
- "pics/big/explosion/submarine/step1.png"
- "pics/big/explosion/submarine/step2.png"
- "pics/big/explosion/submarine/step3.png"
- "pics/big/explosion/submarine/step4.png"
- "pics/big/submarine.png"
- "pics/big/surface.png"
- "pics/big/torpedo.png"
- "pics/scalable/boat.svg"
- "pics/scalable/sub-attaq.svg"
- "pics/scalable/submarine.svg"
- "pics/scalable/torpedo.svg"
- "pics/small/background.png"
- "pics/small/boat.png"
- "pics/small/bomb.png"
- "pics/small/submarine.png"
- "pics/small/surface.png"
- "pics/small/torpedo.png"
- "pics/welcome/logo-a.png"
- "pics/welcome/logo-a2.png"
- "pics/welcome/logo-b.png"
- "pics/welcome/logo-dash.png"
- "pics/welcome/logo-excl.png"
- "pics/welcome/logo-q.png"
- "pics/welcome/logo-s.png"
- "pics/welcome/logo-t.png"
- "pics/welcome/logo-t2.png"
- "pics/welcome/logo-u.png"
-)
-
-qt6_add_resources(sub-attaq "subattaq"
- PREFIX
- "/"
- FILES
- ${subattaq_resource_files}
-)
-
-install(TARGETS sub-attaq
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/animation/sub-attaq/CMakeLists.txt b/examples/widgets/animation/sub-attaq/CMakeLists.txt
deleted file mode 100644
index a2249ea03b..0000000000
--- a/examples/widgets/animation/sub-attaq/CMakeLists.txt
+++ /dev/null
@@ -1,197 +0,0 @@
-# Generated from sub-attaq.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(sub-attaq LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/animation/sub-attaq")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS OpenGL) # special case
-
-add_qt_gui_executable(sub-attaq
- animationmanager.cpp animationmanager.h
- boat.cpp boat.h boat_p.h
- bomb.cpp bomb.h
- graphicsscene.cpp graphicsscene.h
- main.cpp
- mainwindow.cpp mainwindow.h
- pixmapitem.cpp pixmapitem.h
- progressitem.cpp progressitem.h
- qanimationstate.cpp qanimationstate.h
- states.cpp states.h
- submarine.cpp submarine.h submarine_p.h
- textinformationitem.cpp textinformationitem.h
- torpedo.cpp torpedo.h
-)
-target_link_libraries(sub-attaq PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set_source_files_properties("pics/big/background.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/background"
-)
-set_source_files_properties("pics/big/boat.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/boat"
-)
-set_source_files_properties("pics/big/bomb.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/bomb"
-)
-set_source_files_properties("pics/big/explosion/boat/step1.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/boat/step1"
-)
-set_source_files_properties("pics/big/explosion/boat/step2.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/boat/step2"
-)
-set_source_files_properties("pics/big/explosion/boat/step3.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/boat/step3"
-)
-set_source_files_properties("pics/big/explosion/boat/step4.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/boat/step4"
-)
-set_source_files_properties("pics/big/explosion/submarine/step1.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/submarine/step1"
-)
-set_source_files_properties("pics/big/explosion/submarine/step2.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/submarine/step2"
-)
-set_source_files_properties("pics/big/explosion/submarine/step3.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/submarine/step3"
-)
-set_source_files_properties("pics/big/explosion/submarine/step4.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/explosion/submarine/step4"
-)
-set_source_files_properties("pics/big/submarine.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/submarine"
-)
-set_source_files_properties("pics/big/surface.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/surface"
-)
-set_source_files_properties("pics/big/torpedo.png"
- PROPERTIES QT_RESOURCE_ALIAS "big/torpedo"
-)
-set_source_files_properties("pics/scalable/boat.svg"
- PROPERTIES QT_RESOURCE_ALIAS "boat"
-)
-set_source_files_properties("pics/scalable/sub-attaq.svg"
- PROPERTIES QT_RESOURCE_ALIAS "all"
-)
-set_source_files_properties("pics/scalable/submarine.svg"
- PROPERTIES QT_RESOURCE_ALIAS "submarine"
-)
-set_source_files_properties("pics/scalable/torpedo.svg"
- PROPERTIES QT_RESOURCE_ALIAS "torpedo"
-)
-set_source_files_properties("pics/small/background.png"
- PROPERTIES QT_RESOURCE_ALIAS "small/background"
-)
-set_source_files_properties("pics/small/boat.png"
- PROPERTIES QT_RESOURCE_ALIAS "small/boat"
-)
-set_source_files_properties("pics/small/bomb.png"
- PROPERTIES QT_RESOURCE_ALIAS "small/bomb"
-)
-set_source_files_properties("pics/small/submarine.png"
- PROPERTIES QT_RESOURCE_ALIAS "small/submarine"
-)
-set_source_files_properties("pics/small/surface.png"
- PROPERTIES QT_RESOURCE_ALIAS "small/surface"
-)
-set_source_files_properties("pics/small/torpedo.png"
- PROPERTIES QT_RESOURCE_ALIAS "small/torpedo"
-)
-set_source_files_properties("pics/welcome/logo-a.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-a"
-)
-set_source_files_properties("pics/welcome/logo-a2.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-a2"
-)
-set_source_files_properties("pics/welcome/logo-b.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-b"
-)
-set_source_files_properties("pics/welcome/logo-dash.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-dash"
-)
-set_source_files_properties("pics/welcome/logo-excl.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-excl"
-)
-set_source_files_properties("pics/welcome/logo-q.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-q"
-)
-set_source_files_properties("pics/welcome/logo-s.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-s"
-)
-set_source_files_properties("pics/welcome/logo-t.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-t"
-)
-set_source_files_properties("pics/welcome/logo-t2.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-t2"
-)
-set_source_files_properties("pics/welcome/logo-u.png"
- PROPERTIES QT_RESOURCE_ALIAS "logo-u"
-)
-set(subattaq_resource_files
- "data.xml"
- "pics/big/background.png"
- "pics/big/boat.png"
- "pics/big/bomb.png"
- "pics/big/explosion/boat/step1.png"
- "pics/big/explosion/boat/step2.png"
- "pics/big/explosion/boat/step3.png"
- "pics/big/explosion/boat/step4.png"
- "pics/big/explosion/submarine/step1.png"
- "pics/big/explosion/submarine/step2.png"
- "pics/big/explosion/submarine/step3.png"
- "pics/big/explosion/submarine/step4.png"
- "pics/big/submarine.png"
- "pics/big/surface.png"
- "pics/big/torpedo.png"
- "pics/scalable/boat.svg"
- "pics/scalable/sub-attaq.svg"
- "pics/scalable/submarine.svg"
- "pics/scalable/torpedo.svg"
- "pics/small/background.png"
- "pics/small/boat.png"
- "pics/small/bomb.png"
- "pics/small/submarine.png"
- "pics/small/surface.png"
- "pics/small/torpedo.png"
- "pics/welcome/logo-a.png"
- "pics/welcome/logo-a2.png"
- "pics/welcome/logo-b.png"
- "pics/welcome/logo-dash.png"
- "pics/welcome/logo-excl.png"
- "pics/welcome/logo-q.png"
- "pics/welcome/logo-s.png"
- "pics/welcome/logo-t.png"
- "pics/welcome/logo-t2.png"
- "pics/welcome/logo-u.png"
-)
-
-qt6_add_resources(sub-attaq "subattaq"
- PREFIX
- "/"
- FILES
- ${subattaq_resource_files}
-)
-
-install(TARGETS sub-attaq
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/animation/sub-attaq/animationmanager.cpp b/examples/widgets/animation/sub-attaq/animationmanager.cpp
deleted file mode 100644
index 261cbd1e1c..0000000000
--- a/examples/widgets/animation/sub-attaq/animationmanager.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Own
-#include "animationmanager.h"
-
-#include <QAbstractAnimation>
-
-AnimationManager *AnimationManager::self()
-{
- // the universe's only animation manager
- static AnimationManager s_instance;
- return &s_instance;
-}
-
-void AnimationManager::registerAnimation(QAbstractAnimation *anim)
-{
- QObject::connect(anim, &QObject::destroyed, this, &AnimationManager::unregisterAnimation_helper);
- animations.append(anim);
-}
-
-void AnimationManager::unregisterAnimation_helper(QObject *obj)
-{
- unregisterAnimation(static_cast<QAbstractAnimation*>(obj));
-}
-
-void AnimationManager::unregisterAnimation(QAbstractAnimation *anim)
-{
- QObject::disconnect(anim, &QObject::destroyed, this, &AnimationManager::unregisterAnimation_helper);
- animations.removeAll(anim);
-}
-
-void AnimationManager::unregisterAllAnimations()
-{
- animations.clear();
-}
-
-void AnimationManager::pauseAll()
-{
- for (QAbstractAnimation *animation : qAsConst(animations)) {
- if (animation->state() == QAbstractAnimation::Running)
- animation->pause();
- }
-}
-void AnimationManager::resumeAll()
-{
- for (QAbstractAnimation *animation : qAsConst(animations)) {
- if (animation->state() == QAbstractAnimation::Paused)
- animation->resume();
- }
-}
diff --git a/examples/widgets/animation/sub-attaq/animationmanager.h b/examples/widgets/animation/sub-attaq/animationmanager.h
deleted file mode 100644
index a097e7508e..0000000000
--- a/examples/widgets/animation/sub-attaq/animationmanager.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ANIMATIONMANAGER_H
-#define ANIMATIONMANAGER_H
-
-#include <QObject>
-
-QT_BEGIN_NAMESPACE
-class QAbstractAnimation;
-QT_END_NAMESPACE
-
-class AnimationManager : public QObject
-{
- Q_OBJECT
- AnimationManager() = default;
- ~AnimationManager() = default;
-public:
- void registerAnimation(QAbstractAnimation *anim);
- void unregisterAnimation(QAbstractAnimation *anim);
- void unregisterAllAnimations();
- static AnimationManager *self();
-
-public slots:
- void pauseAll();
- void resumeAll();
-
-private slots:
- void unregisterAnimation_helper(QObject *obj);
-
-private:
- QList<QAbstractAnimation *> animations;
-};
-
-#endif // ANIMATIONMANAGER_H
diff --git a/examples/widgets/animation/sub-attaq/boat.cpp b/examples/widgets/animation/sub-attaq/boat.cpp
deleted file mode 100644
index d5fa314b60..0000000000
--- a/examples/widgets/animation/sub-attaq/boat.cpp
+++ /dev/null
@@ -1,281 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Own
-#include "boat.h"
-#include "boat_p.h"
-#include "bomb.h"
-#include "graphicsscene.h"
-#include "animationmanager.h"
-#include "qanimationstate.h"
-
-//Qt
-#include <QFinalState>
-#include <QHistoryState>
-#include <QPropertyAnimation>
-#include <QSequentialAnimationGroup>
-#include <QState>
-#include <QStateMachine>
-
-static QAbstractAnimation *setupDestroyAnimation(Boat *boat)
-{
- QSequentialAnimationGroup *group = new QSequentialAnimationGroup(boat);
- for (int i = 1; i <= 4; i++) {
- PixmapItem *step = new PixmapItem(QString("explosion/boat/step%1").arg(i),GraphicsScene::Big, boat);
- step->setZValue(6);
- step->setOpacity(0);
-
- //fade-in
- QPropertyAnimation *anim = new QPropertyAnimation(step, "opacity");
- anim->setEndValue(1);
- anim->setDuration(100);
- group->insertAnimation(i-1, anim);
-
- //and then fade-out
- QPropertyAnimation *anim2 = new QPropertyAnimation(step, "opacity");
- anim2->setEndValue(0);
- anim2->setDuration(100);
- group->addAnimation(anim2);
- }
-
- AnimationManager::self()->registerAnimation(group);
- return group;
-}
-
-
-
-Boat::Boat()
- : PixmapItem(QString("boat"), GraphicsScene::Big),
- speed(0), bombsAlreadyLaunched(0), direction(Boat::None)
-{
- setZValue(4);
- setFlags(QGraphicsItem::ItemIsFocusable);
-
- //The movement animation used to animate the boat
- movementAnimation = new QPropertyAnimation(this, "pos");
-
- //The destroy animation used to explode the boat
- destroyAnimation = setupDestroyAnimation(this);
-
- //We setup the state machine of the boat
- machine = new QStateMachine(this);
- QState *moving = new QState(machine);
- 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);
- LaunchStateLeft *launchStateLeft = new LaunchStateLeft(this, machine);
-
- //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, &QAbstractAnimation::finished, stopState);
- moveStateRight->addTransition(movementAnimation, &QAbstractAnimation::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 = new QHistoryState(moving);
- launchStateLeft->addTransition(historyState);
- launchStateRight->addTransition(historyState);
-
- QFinalState *finalState = new QFinalState(machine);
-
- //This state play the destroyed animation
- QAnimationState *destroyedState = new QAnimationState(machine);
- destroyedState->setAnimation(destroyAnimation);
-
- //Play a nice animation when the boat is destroyed
- moving->addTransition(this, &Boat::boatDestroyed, destroyedState);
-
- //Transition to final state when the destroyed animation is finished
- destroyedState->addTransition(destroyedState, &QAnimationState::animationFinished, finalState);
-
- //The machine has finished to be executed, then the boat is dead
- connect(machine, &QState::finished, this, &Boat::boatExecutionFinished);
-
-}
-
-void Boat::run()
-{
- //We register animations
- AnimationManager::self()->registerAnimation(movementAnimation);
- AnimationManager::self()->registerAnimation(destroyAnimation);
- machine->start();
-}
-
-void Boat::stop()
-{
- movementAnimation->stop();
- machine->stop();
-}
-
-void Boat::updateBoatMovement()
-{
- if (speed == 0 || direction == Boat::None) {
- movementAnimation->stop();
- return;
- }
-
- movementAnimation->stop();
-
- 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/widgets/animation/sub-attaq/boat.h b/examples/widgets/animation/sub-attaq/boat.h
deleted file mode 100644
index 22f2f0f7c1..0000000000
--- a/examples/widgets/animation/sub-attaq/boat.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef BOAT_H
-#define BOAT_H
-
-#include "pixmapitem.h"
-
-QT_BEGIN_NAMESPACE
-class QVariantAnimation;
-class QAbstractAnimation;
-class QStateMachine;
-QT_END_NAMESPACE
-
-class Boat : public PixmapItem
-{
-Q_OBJECT
-public:
- enum Movement {
- None = 0,
- Left,
- Right
- };
- enum { Type = UserType + 2 };
- Boat();
- void destroy();
- void run();
- void stop();
-
- int bombsLaunched() const;
- void setBombsLaunched(int number);
-
- int currentSpeed() const;
- void setCurrentSpeed(int speed);
-
- enum Movement currentDirection() const;
- void setCurrentDirection(Movement direction);
-
- void updateBoatMovement();
-
- int type() const override;
-
-signals:
- void boatDestroyed();
- void boatExecutionFinished();
-
-private:
- int speed;
- int bombsAlreadyLaunched;
- Movement direction;
- QVariantAnimation *movementAnimation;
- QAbstractAnimation *destroyAnimation;
- QStateMachine *machine;
-};
-
-#endif // BOAT_H
diff --git a/examples/widgets/animation/sub-attaq/boat_p.h b/examples/widgets/animation/sub-attaq/boat_p.h
deleted file mode 100644
index bb1a783392..0000000000
--- a/examples/widgets/animation/sub-attaq/boat_p.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef BOAT_P_H
-#define BOAT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-//Own
-#include "bomb.h"
-#include "graphicsscene.h"
-
-// Qt
-#include <QGraphicsRotation>
-#include <QKeyEventTransition>
-#include <QState>
-
-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 *b, QEvent::Type t, int k)
- : QKeyEventTransition(b, t, k), boat(b)
- {
- }
-protected:
- bool eventTest(QEvent *event) override
- {
- if (!QKeyEventTransition::eventTest(event))
- return false;
- return (boat->currentSpeed() == 1);
- }
-private:
- Boat *boat;
-};
-
-//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 *b, QEvent::Type t, int k)
- : QKeyEventTransition(b, t, k), boat(b), key(k)
- {
- }
-protected:
- bool eventTest(QEvent *event) override
- {
- if (!QKeyEventTransition::eventTest(event))
- return false;
- return (boat->currentSpeed() >= 0);
- }
- void onTransition(QEvent *) override
- {
- //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), boat(boat)
- {
- }
-protected:
- bool eventTest(QEvent *event) override
- {
- if (!QKeyEventTransition::eventTest(event))
- return false;
- //We have enough bomb?
- return (boat->bombsLaunched() < MAX_BOMB);
- }
-private:
- Boat *boat;
-};
-
-//This state is describing when the boat is moving right
-class MoveStateRight : public QState
-{
-public:
- explicit MoveStateRight(Boat *boat, QState *parent = nullptr)
- : QState(parent), boat(boat)
- {
- }
-protected:
- void onEntry(QEvent *) override
- {
- boat->setCurrentDirection(Boat::Right);
- boat->updateBoatMovement();
- }
-private:
- Boat *boat;
-};
-
- //This state is describing when the boat is moving left
-class MoveStateLeft : public QState
-{
-public:
- explicit MoveStateLeft(Boat *boat, QState *parent = nullptr)
- : QState(parent), boat(boat)
- {
- }
-protected:
- void onEntry(QEvent *) override
- {
- 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:
- explicit StopState(Boat *boat, QState *parent = nullptr)
- : QState(parent), boat(boat)
- {
- }
-protected:
- void onEntry(QEvent *) override
- {
- 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:
- explicit LaunchStateRight(Boat *boat, QState *parent = nullptr)
- : QState(parent), boat(boat)
- {
- }
-protected:
- void onEntry(QEvent *) override
- {
- 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:
- explicit LaunchStateLeft(Boat *boat, QState *parent = nullptr)
- : QState(parent), boat(boat)
- {
- }
-protected:
- void onEntry(QEvent *) override
- {
- 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/widgets/animation/sub-attaq/bomb.cpp b/examples/widgets/animation/sub-attaq/bomb.cpp
deleted file mode 100644
index 0b9c365662..0000000000
--- a/examples/widgets/animation/sub-attaq/bomb.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Own
-#include "bomb.h"
-#include "submarine.h"
-#include "animationmanager.h"
-#include "qanimationstate.h"
-
-//Qt
-#include <QFinalState>
-#include <QPropertyAnimation>
-#include <QSequentialAnimationGroup>
-#include <QStateMachine>
-
-Bomb::Bomb() : PixmapItem(QString("bomb"), GraphicsScene::Big)
-{
- setZValue(2);
-}
-
-void Bomb::launch(Bomb::Direction direction)
-{
- QSequentialAnimationGroup *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, &QVariantAnimation::valueChanged, this, &Bomb::onAnimationLaunchValueChanged);
- connect(this, &Bomb::bombExploded, launchAnimation, &QAbstractAnimation::stop);
- //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(machine);
- launched->setAnimation(launchAnimation);
-
- //End
- QFinalState *finalState = new QFinalState(machine);
-
- machine->setInitialState(launched);
-
- //### Add a nice animation when the bomb is destroyed
- launched->addTransition(this, &Bomb::bombExploded, finalState);
-
- //If the animation is finished, then we move to the final state
- launched->addTransition(launched, &QAnimationState::animationFinished, finalState);
-
- //The machine has finished to be executed, then the boat is dead
- connect(machine,&QState::finished, this, &Bomb::bombExecutionFinished);
-
- machine->start();
-
-}
-
-void Bomb::onAnimationLaunchValueChanged(const QVariant &)
-{
- const QList<QGraphicsItem *> colItems =
- collidingItems(Qt::IntersectsItemBoundingRect);
- for (QGraphicsItem *item : colItems) {
- if (item->type() == SubMarine::Type) {
- SubMarine *s = static_cast<SubMarine *>(item);
- destroy();
- s->destroy();
- }
- }
-}
-
-void Bomb::destroy()
-{
- emit bombExploded();
-}
diff --git a/examples/widgets/animation/sub-attaq/bomb.h b/examples/widgets/animation/sub-attaq/bomb.h
deleted file mode 100644
index 9ae54b4d81..0000000000
--- a/examples/widgets/animation/sub-attaq/bomb.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef BOMB_H
-#define BOMB_H
-
-#include "pixmapitem.h"
-
-class Bomb : public PixmapItem
-{
-Q_OBJECT
-public:
- enum Direction {
- Left = 0,
- Right
- };
- Bomb();
- void launch(Direction direction);
- void destroy();
-
-signals:
- void bombExploded();
- void bombExecutionFinished();
-
-private slots:
- void onAnimationLaunchValueChanged(const QVariant &);
-};
-
-#endif // BOMB_H
diff --git a/examples/widgets/animation/sub-attaq/data.xml b/examples/widgets/animation/sub-attaq/data.xml
deleted file mode 100644
index 0f30515ddf..0000000000
--- a/examples/widgets/animation/sub-attaq/data.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?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="1"/>
- </level>
- <level id="1" name="Seaman apprentice">
- <subinstance type="0" nb="2"/>
- </level>
- <level id="2" name="Seaman">
- <subinstance type="0" nb="4"/>
- </level>
- <level id="3" name="Petty Officer Third Class">
- <subinstance type="0" nb="6"/>
- </level>
- <level id="4" name="Petty Officer Second Class">
- <subinstance type="0" nb="6"/>
- </level>
- <level id="5" name="Petty Officer First Class">
- <subinstance type="0" nb="8"/>
- </level>
- <level id="6" name="Lieutenant">
- <subinstance type="0" nb="10"/>
- </level>
- <level id="7" name="Commander">
- <subinstance type="0" nb="15"/>
- </level>
- <level id="8" name="Captain">
- <subinstance type="0" nb="12"/>
- </level>
- <level id="9" name="Admiral">
- <subinstance type="0" nb="12"/>
- </level>
- </levels>
-</subattaq>
diff --git a/examples/widgets/animation/sub-attaq/graphicsscene.cpp b/examples/widgets/animation/sub-attaq/graphicsscene.cpp
deleted file mode 100644
index 5248ed9f92..0000000000
--- a/examples/widgets/animation/sub-attaq/graphicsscene.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Own
-#include "graphicsscene.h"
-#include "states.h"
-#include "boat.h"
-#include "submarine.h"
-#include "torpedo.h"
-#include "bomb.h"
-#include "animationmanager.h"
-#include "qanimationstate.h"
-#include "progressitem.h"
-#include "textinformationitem.h"
-
-//Qt
-#include <QAction>
-#include <QApplication>
-#include <QFile>
-#include <QFinalState>
-#include <QParallelAnimationGroup>
-#include <QPropertyAnimation>
-#include <QSequentialAnimationGroup>
-#include <QStateMachine>
-#include <QXmlStreamReader>
-
-GraphicsScene::GraphicsScene(int x, int y, int width, int height, Mode mode, QObject *parent)
- : QGraphicsScene(x, y, width, height, parent), mode(mode), boat(new Boat)
-{
- PixmapItem *backgroundItem = new PixmapItem(QStringLiteral("background"), mode);
- backgroundItem->setZValue(1);
- backgroundItem->setPos(0,0);
- addItem(backgroundItem);
-
- PixmapItem *surfaceItem = new PixmapItem(QStringLiteral("surface"), mode);
- surfaceItem->setZValue(3);
- surfaceItem->setPos(0, sealLevel() - surfaceItem->boundingRect().height() / 2);
- addItem(surfaceItem);
-
- //The item that display score and level
- progressItem = new ProgressItem(backgroundItem);
-
- textInformationItem = new TextInformationItem(backgroundItem);
- textInformationItem->hide();
- //We create the boat
- addItem(boat);
- boat->setPos(this->width()/2, sealLevel() - boat->size().height());
- boat->hide();
-
- //parse the xml that contain all data of the game
- QXmlStreamReader reader;
- QFile file(":data.xml");
- file.open(QIODevice::ReadOnly);
- reader.setDevice(&file);
- LevelDescription currentLevel;
- while (!reader.atEnd()) {
- reader.readNext();
- if (reader.tokenType() == QXmlStreamReader::StartElement) {
- if (reader.name() == u"submarine") {
- SubmarineDescription desc;
- desc.name = reader.attributes().value("name").toString();
- desc.points = reader.attributes().value("points").toInt();
- desc.type = reader.attributes().value("type").toInt();
- submarinesData.append(desc);
- } else if (reader.name() == u"level") {
- currentLevel.id = reader.attributes().value("id").toInt();
- currentLevel.name = reader.attributes().value("name").toString();
- } else if (reader.name() == u"subinstance") {
- currentLevel.submarines.append(qMakePair(reader.attributes().value("type").toInt(),
- reader.attributes().value("nb").toInt()));
- }
- } else if (reader.tokenType() == QXmlStreamReader::EndElement) {
- if (reader.name() == u"level") {
- levelsData.insert(currentLevel.id, currentLevel);
- currentLevel.submarines.clear();
- }
- }
- }
-}
-
-qreal GraphicsScene::sealLevel() const
-{
- return (mode == Big) ? 220 : 160;
-}
-
-void GraphicsScene::setupScene(QAction *newAction, QAction *quitAction)
-{
- static constexpr int nLetters = 10;
- static constexpr struct {
- char const *pix;
- qreal initX, initY;
- qreal destX, destY;
- } logoData[nLetters] = {
- {"s", -1000, -1000, 300, 150 },
- {"u", -800, -1000, 350, 150 },
- {"b", -600, -1000, 400, 120 },
- {"dash", -400, -1000, 460, 150 },
- {"a", 1000, 2000, 350, 250 },
- {"t", 800, 2000, 400, 250 },
- {"t2", 600, 2000, 430, 250 },
- {"a2", 400, 2000, 465, 250 },
- {"q", 200, 2000, 510, 250 },
- {"excl", 0, 2000, 570, 220 } };
-
- QSequentialAnimationGroup *lettersGroupMoving = new QSequentialAnimationGroup(this);
- QParallelAnimationGroup *lettersGroupFading = new QParallelAnimationGroup(this);
-
- for (int i = 0; i < nLetters; ++i) {
- PixmapItem *logo = new PixmapItem(QLatin1String(":/logo-") + logoData[i].pix, this);
- logo->setPos(logoData[i].initX, logoData[i].initY);
- logo->setZValue(i + 3);
- //creation of the animations for moving letters
- QPropertyAnimation *moveAnim = new QPropertyAnimation(logo, "pos", lettersGroupMoving);
- moveAnim->setEndValue(QPointF(logoData[i].destX, logoData[i].destY));
- moveAnim->setDuration(200);
- moveAnim->setEasingCurve(QEasingCurve::OutElastic);
- lettersGroupMoving->addPause(50);
- //creation of the animations for fading out the letters
- QPropertyAnimation *fadeAnim = new QPropertyAnimation(logo, "opacity", lettersGroupFading);
- fadeAnim->setDuration(800);
- fadeAnim->setEndValue(0);
- fadeAnim->setEasingCurve(QEasingCurve::OutQuad);
- }
-
- QStateMachine *machine = new QStateMachine(this);
-
- //This state is when the player is playing
- PlayState *gameState = new PlayState(this, machine);
-
- //Final state
- QFinalState *finalState = new QFinalState(machine);
-
- //Animation when the player enter in the game
- QAnimationState *lettersMovingState = new QAnimationState(machine);
- lettersMovingState->setAnimation(lettersGroupMoving);
-
- //Animation when the welcome screen disappear
- QAnimationState *lettersFadingState = new QAnimationState(machine);
- lettersFadingState->setAnimation(lettersGroupFading);
-
- //if new game then we fade out the welcome screen and start playing
- lettersMovingState->addTransition(newAction, &QAction::triggered, lettersFadingState);
- lettersFadingState->addTransition(lettersFadingState, &QAnimationState::animationFinished, gameState);
-
- //New Game is triggered then player start playing
- gameState->addTransition(newAction, &QAction::triggered, gameState);
-
- //Wanna quit, then connect to CTRL+Q
- gameState->addTransition(quitAction, &QAction::triggered, finalState);
- lettersMovingState->addTransition(quitAction, &QAction::triggered, finalState);
-
- //Welcome screen is the initial state
- machine->setInitialState(lettersMovingState);
-
- machine->start();
-
- //We reach the final state, then we quit
- connect(machine, &QStateMachine::finished, qApp, &QApplication::quit);
-}
-
-void GraphicsScene::addItem(Bomb *bomb)
-{
- bombs.insert(bomb);
- connect(bomb, &Bomb::bombExecutionFinished,
- this, &GraphicsScene::onBombExecutionFinished);
- QGraphicsScene::addItem(bomb);
-}
-
-void GraphicsScene::addItem(Torpedo *torpedo)
-{
- torpedos.insert(torpedo);
- connect(torpedo, &Torpedo::torpedoExecutionFinished,
- this, &GraphicsScene::onTorpedoExecutionFinished);
- QGraphicsScene::addItem(torpedo);
-}
-
-void GraphicsScene::addItem(SubMarine *submarine)
-{
- submarines.insert(submarine);
- connect(submarine, &SubMarine::subMarineExecutionFinished,
- this, &GraphicsScene::onSubMarineExecutionFinished);
- QGraphicsScene::addItem(submarine);
-}
-
-void GraphicsScene::addItem(QGraphicsItem *item)
-{
- QGraphicsScene::addItem(item);
-}
-
-void GraphicsScene::onBombExecutionFinished()
-{
- Bomb *bomb = qobject_cast<Bomb *>(sender());
- if (!bomb)
- return;
- bombs.remove(bomb);
- bomb->deleteLater();
- boat->setBombsLaunched(boat->bombsLaunched() - 1);
-}
-
-void GraphicsScene::onTorpedoExecutionFinished()
-{
- Torpedo *torpedo = qobject_cast<Torpedo *>(sender());
- if (!torpedo)
- return;
- torpedos.remove(torpedo);
- torpedo->deleteLater();
-}
-
-void GraphicsScene::onSubMarineExecutionFinished()
-{
- SubMarine *submarine = qobject_cast<SubMarine *>(sender());
- if (!submarine)
- return;
- submarines.remove(submarine);
- if (submarines.count() == 0)
- emit allSubMarineDestroyed(submarine->points());
- else
- emit subMarineDestroyed(submarine->points());
- submarine->deleteLater();
-}
-
-void GraphicsScene::clearScene()
-{
- for (SubMarine *sub : qAsConst(submarines)) {
- // make sure to not go into onSubMarineExecutionFinished
- sub->disconnect(this);
- sub->destroy();
- sub->deleteLater();
- }
-
- for (Torpedo *torpedo : qAsConst(torpedos)) {
- // make sure to not go into onTorpedoExecutionFinished
- torpedo->disconnect(this);
- torpedo->destroy();
- torpedo->deleteLater();
- }
-
- for (Bomb *bomb : qAsConst(bombs)) {
- // make sure to not go into onBombExecutionFinished
- bomb->disconnect(this);
- bomb->destroy();
- bomb->deleteLater();
- }
-
- submarines.clear();
- bombs.clear();
- torpedos.clear();
-
- AnimationManager::self()->unregisterAllAnimations();
-
- boat->stop();
- boat->hide();
- boat->setEnabled(true);
-}
diff --git a/examples/widgets/animation/sub-attaq/graphicsscene.h b/examples/widgets/animation/sub-attaq/graphicsscene.h
deleted file mode 100644
index ce9ee115ca..0000000000
--- a/examples/widgets/animation/sub-attaq/graphicsscene.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef GRAPHICSSCENE_H
-#define GRAPHICSSCENE_H
-
-//Qt
-#include <QGraphicsScene>
-#include <QSet>
-
-
-class Boat;
-class SubMarine;
-class Torpedo;
-class Bomb;
-class PixmapItem;
-class ProgressItem;
-class TextInformationItem;
-QT_BEGIN_NAMESPACE
-class QAction;
-QT_END_NAMESPACE
-
-class GraphicsScene : public QGraphicsScene
-{
-Q_OBJECT
-public:
- enum Mode {
- Big = 0,
- Small
- };
-
- struct SubmarineDescription {
- int type = 0;
- int points = 0;
- QString name;
- };
-
- struct LevelDescription {
- int id = 0;
- QString name;
- QList<QPair<int, int>> submarines;
- };
-
- GraphicsScene(int x, int y, int width, int height, Mode mode, QObject *parent = nullptr);
- qreal sealLevel() const;
- void setupScene(QAction *newAction, QAction *quitAction);
- void addItem(Bomb *bomb);
- void addItem(Torpedo *torpedo);
- void addItem(SubMarine *submarine);
- void addItem(QGraphicsItem *item);
- void clearScene();
-
-signals:
- void subMarineDestroyed(int);
- void allSubMarineDestroyed(int);
-
-private slots:
- void onBombExecutionFinished();
- void onTorpedoExecutionFinished();
- void onSubMarineExecutionFinished();
-
-private:
- Mode mode;
- ProgressItem *progressItem;
- TextInformationItem *textInformationItem;
- Boat *boat;
- QSet<SubMarine *> submarines;
- QSet<Bomb *> bombs;
- QSet<Torpedo *> torpedos;
- QList<SubmarineDescription> submarinesData;
- QHash<int, LevelDescription> levelsData;
-
- friend class PauseState;
- friend class PlayState;
- friend class LevelState;
- friend class LostState;
- friend class WinState;
- friend class WinTransition;
- friend class UpdateScoreTransition;
-};
-
-#endif // GRAPHICSSCENE_H
-
diff --git a/examples/widgets/animation/sub-attaq/main.cpp b/examples/widgets/animation/sub-attaq/main.cpp
deleted file mode 100644
index 9b28d8c40f..0000000000
--- a/examples/widgets/animation/sub-attaq/main.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Q_INIT_RESOURCE(subattaq);
-
- MainWindow w;
- w.show();
-
- return app.exec();
-}
diff --git a/examples/widgets/animation/sub-attaq/mainwindow.cpp b/examples/widgets/animation/sub-attaq/mainwindow.cpp
deleted file mode 100644
index 0c152c9180..0000000000
--- a/examples/widgets/animation/sub-attaq/mainwindow.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Own
-#include "mainwindow.h"
-#include "graphicsscene.h"
-
-//Qt
-#include <QGraphicsView>
-#include <QApplication>
-#include <QMenu>
-#include <QMenuBar>
-#include <QLayout>
-
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
-{
- QMenu *file = menuBar()->addMenu(tr("&File"));
-
- QAction *newAction = file->addAction(tr("New Game"));
- newAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_N));
- QAction *quitAction = file->addAction(tr("Quit"));
- quitAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q));
-
- if (QApplication::arguments().contains("-fullscreen")) {
- scene = new GraphicsScene(0, 0, 750, 400, GraphicsScene::Small, this);
- setWindowState(Qt::WindowFullScreen);
- } else {
- scene = new GraphicsScene(0, 0, 880, 630, GraphicsScene::Big, this);
- layout()->setSizeConstraint(QLayout::SetFixedSize);
- }
-
- view = new QGraphicsView(scene, this);
- view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
- scene->setupScene(newAction, quitAction);
- setCentralWidget(view);
-}
diff --git a/examples/widgets/animation/sub-attaq/mainwindow.h b/examples/widgets/animation/sub-attaq/mainwindow.h
deleted file mode 100644
index 660acfaa0a..0000000000
--- a/examples/widgets/animation/sub-attaq/mainwindow.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-//Qt
-#include <QMainWindow>
-class GraphicsScene;
-QT_BEGIN_NAMESPACE
-class QGraphicsView;
-QT_END_NAMESPACE
-
-class MainWindow : public QMainWindow
-{
-Q_OBJECT
-public:
- MainWindow(QWidget *parent = nullptr);
-
-private:
- GraphicsScene *scene;
- QGraphicsView *view;
-};
-
-#endif // MAINWINDOW_H
diff --git a/examples/widgets/animation/sub-attaq/pics/big/background.png b/examples/widgets/animation/sub-attaq/pics/big/background.png
deleted file mode 100644
index 9f581571fa..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/big/background.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/big/boat.png b/examples/widgets/animation/sub-attaq/pics/big/boat.png
deleted file mode 100644
index be82dff62a..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/big/boat.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/big/bomb.png b/examples/widgets/animation/sub-attaq/pics/big/bomb.png
deleted file mode 100644
index 3af5f2f29c..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/big/bomb.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step1.png b/examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step1.png
deleted file mode 100644
index c9fd8b0984..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step1.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step2.png b/examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step2.png
deleted file mode 100644
index 7528f2d2da..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step2.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step3.png b/examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step3.png
deleted file mode 100644
index aae9c9c184..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step3.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step4.png b/examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step4.png
deleted file mode 100644
index d697c1bae8..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/big/explosion/boat/step4.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step1.png b/examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step1.png
deleted file mode 100644
index 88ca5144b7..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step1.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step2.png b/examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step2.png
deleted file mode 100644
index 524f5890ee..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step2.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step3.png b/examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step3.png
deleted file mode 100644
index 2cca1e80fe..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step3.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step4.png b/examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step4.png
deleted file mode 100644
index 82100a8260..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/big/explosion/submarine/step4.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/big/submarine.png b/examples/widgets/animation/sub-attaq/pics/big/submarine.png
deleted file mode 100644
index df435dc47d..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/big/submarine.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/big/surface.png b/examples/widgets/animation/sub-attaq/pics/big/surface.png
deleted file mode 100644
index 4eba29e9cd..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/big/surface.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/big/torpedo.png b/examples/widgets/animation/sub-attaq/pics/big/torpedo.png
deleted file mode 100644
index f9c26873f1..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/big/torpedo.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/scalable/background-n810.svg b/examples/widgets/animation/sub-attaq/pics/scalable/background-n810.svg
deleted file mode 100644
index ece9f7aaf1..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/scalable/background-n810.svg
+++ /dev/null
@@ -1,171 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- version="1.0"
- width="744.09448"
- height="1052.3622"
- id="svg2588"
- sodipodi:version="0.32"
- inkscape:version="0.46"
- sodipodi:docname="background-n810.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape">
- <metadata
- id="metadata28">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <sodipodi:namedview
- inkscape:window-height="1141"
- inkscape:window-width="1920"
- inkscape:pageshadow="2"
- inkscape:pageopacity="0.0"
- guidetolerance="10.0"
- gridtolerance="10.0"
- objecttolerance="10.0"
- borderopacity="1.0"
- bordercolor="#666666"
- pagecolor="#ffffff"
- id="base"
- showgrid="false"
- inkscape:zoom="1.2399902"
- inkscape:cx="375"
- inkscape:cy="461.074"
- inkscape:window-x="0"
- inkscape:window-y="0"
- inkscape:current-layer="layer1" />
- <defs
- id="defs2590">
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 526.18109 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="744.09448 : 526.18109 : 1"
- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
- id="perspective30" />
- <linearGradient
- id="linearGradient3746">
- <stop
- id="stop3748"
- style="stop-color:#ffffff;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3750"
- style="stop-color:#0074b7;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <radialGradient
- cx="82.966125"
- cy="-178.42453"
- r="526.79456"
- fx="82.966125"
- fy="-178.42453"
- id="radialGradient3880"
- xlink:href="#linearGradient3746"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1.4952094,0.2388475,-0.1040669,0.3734391,-208.61982,418.216)" />
- <linearGradient
- id="linearGradient3624">
- <stop
- id="stop3626"
- style="stop-color:#3a8daf;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3636"
- style="stop-color:#252525;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="552.98486"
- y1="390.56842"
- x2="549.39465"
- y2="702.3479"
- id="linearGradient3630"
- xlink:href="#linearGradient3624"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(2.3373776,0,0,1.186038,-986.88716,67.776416)" />
- <linearGradient
- id="linearGradient3816">
- <stop
- id="stop3818"
- style="stop-color:#ad8b00;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3820"
- style="stop-color:#ad8b00;stop-opacity:0"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="573"
- y1="755.46222"
- x2="573"
- y2="700.13464"
- id="linearGradient3826"
- xlink:href="#linearGradient3816"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1,0,0,1.2561681,-151.5,-34.518664)" />
- <linearGradient
- id="linearGradient5097">
- <stop
- id="stop5099"
- style="stop-color:#19a2db;stop-opacity:0"
- offset="0" />
- <stop
- id="stop5109"
- style="stop-color:#1379a7;stop-opacity:0.49803922"
- offset="0.30000001" />
- <stop
- id="stop5101"
- style="stop-color:#0e5173;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="590.84674"
- y1="274.57559"
- x2="590.84674"
- y2="334.01376"
- id="linearGradient5103"
- xlink:href="#linearGradient5097"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(-151.5,156.75229)"
- spreadMethod="pad" />
- </defs>
- <g
- id="layer1">
- <rect
- width="1053.5891"
- height="206.64989"
- x="-151.79456"
- y="330.16019"
- id="rect3638"
- style="opacity:1;fill:url(#radialGradient3880);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.1880002;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- width="1054.4708"
- height="364.81519"
- x="-152.23541"
- y="533.48895"
- id="rect3622"
- style="opacity:1;fill:url(#linearGradient3630);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.13464069;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M -152.5,877.11847 C 120.5,865.81296 -202.86309,769.3663 109.5,871.29717 C 172.96247,892.00636 243.5,872.55334 297.5,871.29717 C 351.5,870.041 311.5,859.80335 358.5,876.13354 C 405.5,892.46372 553.5,861.09903 598.5,854.8182 C 643.5,848.53736 756.5,841.79698 795.5,853.10249 C 834.5,864.408 904.5,866.2725 904.5,866.2725 L 901.5,903.95754 L -154.5,902.70137 L -152.5,877.11847 z"
- id="path3814"
- style="fill:url(#linearGradient3826);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
- <path
- d="M 902.20121,894.16261 C 632.01828,889.43035 756.73005,860.2801 614.20403,894.1311 C 596.58819,898.315 408.23621,883.21212 400.43291,894.1311 C 376.86263,927.11261 75.265447,868.1243 34.250926,886.79082 C 31.281885,888.14209 12.514878,884.22134 -12.264082,889.72008 C -48.555335,897.77353 -64.717178,885.62471 -103.31472,890.35697 C -141.91229,895.08922 -145.87102,891.93439 -145.87102,891.93439 L -152.79879,903.10131 L 892.3044,902.5755 L 902.20121,894.16261 z"
- id="path3828"
- style="fill:#ad8b00;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
- </g>
-</svg>
diff --git a/examples/widgets/animation/sub-attaq/pics/scalable/background.svg b/examples/widgets/animation/sub-attaq/pics/scalable/background.svg
deleted file mode 100644
index 0be268010e..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/scalable/background.svg
+++ /dev/null
@@ -1,171 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- version="1.0"
- width="744.09448"
- height="1052.3622"
- id="svg2588"
- sodipodi:version="0.32"
- inkscape:version="0.46"
- sodipodi:docname="background.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape">
- <metadata
- id="metadata28">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <sodipodi:namedview
- inkscape:window-height="1141"
- inkscape:window-width="1920"
- inkscape:pageshadow="2"
- inkscape:pageopacity="0.0"
- guidetolerance="10.0"
- gridtolerance="10.0"
- objecttolerance="10.0"
- borderopacity="1.0"
- bordercolor="#666666"
- pagecolor="#ffffff"
- id="base"
- showgrid="false"
- inkscape:zoom="0.93884027"
- inkscape:cx="473.72605"
- inkscape:cy="538.63678"
- inkscape:window-x="0"
- inkscape:window-y="0"
- inkscape:current-layer="layer1" />
- <defs
- id="defs2590">
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 526.18109 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="744.09448 : 526.18109 : 1"
- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
- id="perspective30" />
- <linearGradient
- id="linearGradient3746">
- <stop
- id="stop3748"
- style="stop-color:#ffffff;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3750"
- style="stop-color:#0074b7;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <radialGradient
- cx="82.966125"
- cy="-178.42453"
- r="526.79456"
- fx="82.966125"
- fy="-178.42453"
- id="radialGradient3880"
- xlink:href="#linearGradient3746"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1.4952094,0.3367191,-0.1040669,0.5264617,-208.61982,282.52272)" />
- <linearGradient
- id="linearGradient3624">
- <stop
- id="stop3626"
- style="stop-color:#3a8daf;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3636"
- style="stop-color:#252525;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="552.98486"
- y1="390.56842"
- x2="549.39465"
- y2="702.3479"
- id="linearGradient3630"
- xlink:href="#linearGradient3624"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(2.3373776,0,0,1.5004634,-986.88716,-154.07447)" />
- <linearGradient
- id="linearGradient3816">
- <stop
- id="stop3818"
- style="stop-color:#ad8b00;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3820"
- style="stop-color:#ad8b00;stop-opacity:0"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="573"
- y1="755.46222"
- x2="573"
- y2="700.13464"
- id="linearGradient3826"
- xlink:href="#linearGradient3816"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1,0,0,1.6033628,-151.5,-294.0167)" />
- <linearGradient
- id="linearGradient5097">
- <stop
- id="stop5099"
- style="stop-color:#19a2db;stop-opacity:0"
- offset="0" />
- <stop
- id="stop5109"
- style="stop-color:#1379a7;stop-opacity:0.49803922"
- offset="0.30000001" />
- <stop
- id="stop5101"
- style="stop-color:#0e5173;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="590.84674"
- y1="274.57559"
- x2="590.84674"
- y2="334.01376"
- id="linearGradient5103"
- xlink:href="#linearGradient5097"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(-151.5,156.75229)"
- spreadMethod="pad" />
- </defs>
- <g
- id="layer1">
- <rect
- width="1053.5891"
- height="291.32797"
- x="-151.79456"
- y="158.38464"
- id="rect3638"
- style="opacity:1;fill:url(#radialGradient3880);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.1880002;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- width="1054.4708"
- height="461.52972"
- x="-152.23541"
- y="435.10107"
- id="rect3622"
- style="opacity:1;fill:url(#linearGradient3630);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.13464069;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M -152.5,869.5896 C 120.5,855.15934 -202.86309,732.0556 109.5,862.15934 C 172.96247,888.59238 243.5,863.7627 297.5,862.15934 C 351.5,860.55598 311.5,847.48872 358.5,868.33244 C 405.5,889.17615 553.5,849.14252 598.5,841.12571 C 643.5,833.1089 756.5,824.50553 795.5,838.9358 C 834.5,853.36606 904.5,855.74589 904.5,855.74589 L 901.5,903.84677 L -154.5,902.24341 L -152.5,869.5896 z"
- id="path3814"
- style="fill:url(#linearGradient3826);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
- <path
- d="M 902.20121,891.3446 C 632.01828,885.30439 756.73005,848.09724 614.20403,891.30439 C 596.58819,896.64468 408.23621,877.36748 400.43291,891.30439 C 376.86263,933.40172 75.265447,858.10952 34.250926,881.93531 C 31.281885,883.66006 12.514878,878.65564 -12.264082,885.67419 C -48.555335,895.95355 -64.717178,880.4469 -103.31472,886.48711 C -141.91229,892.52732 -145.87102,888.50052 -145.87102,888.50052 L -152.79879,902.75389 L 892.3044,902.08275 L 902.20121,891.3446 z"
- id="path3828"
- style="fill:#ad8b00;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
- </g>
-</svg>
diff --git a/examples/widgets/animation/sub-attaq/pics/scalable/boat.svg b/examples/widgets/animation/sub-attaq/pics/scalable/boat.svg
deleted file mode 100644
index 5298821ba8..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/scalable/boat.svg
+++ /dev/null
@@ -1,279 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- version="1.0"
- width="744.09448"
- height="1052.3622"
- id="svg2584">
- <defs
- id="defs2666">
- <linearGradient
- x1="542.5"
- y1="222.59448"
- x2="559"
- y2="222.59448"
- id="linearGradient3387"
- xlink:href="#linearGradient3746"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(-110.6791,190.19124)" />
- <linearGradient
- id="linearGradient3167">
- <stop
- id="stop3169"
- style="stop-color:#464646;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3345"
- style="stop-color:#848788;stop-opacity:1"
- offset="0.44021741" />
- <stop
- id="stop3347"
- style="stop-color:#9ca0a2;stop-opacity:1"
- offset="0.56799388" />
- <stop
- id="stop3171"
- style="stop-color:#b5babd;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="474.23065"
- y1="229.92336"
- x2="474.1944"
- y2="218.27365"
- id="linearGradient3416"
- xlink:href="#linearGradient3167"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(-125.98032,185.95625)" />
- <linearGradient
- id="linearGradient3692">
- <stop
- id="stop3694"
- style="stop-color:#ffffff;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3696"
- style="stop-color:#b6b6b6;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="573.5"
- y1="244.2056"
- x2="578.25"
- y2="216.9556"
- id="linearGradient3972"
- xlink:href="#linearGradient3692"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(-126.5541,188.56624)" />
- <linearGradient
- id="linearGradient3438">
- <stop
- id="stop3440"
- style="stop-color:#939393;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3444"
- style="stop-color:#d6d6d6;stop-opacity:1"
- offset="0.12354442" />
- <stop
- id="stop3446"
- style="stop-color:#dadada;stop-opacity:1"
- offset="0.74055624" />
- <stop
- id="stop3442"
- style="stop-color:#ffffff;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="660.29303"
- y1="256.53284"
- x2="444.79303"
- y2="255.62085"
- id="linearGradient3948"
- xlink:href="#linearGradient3438"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(-126.5541,185.56624)" />
- <linearGradient
- x1="542.5"
- y1="222.59448"
- x2="559"
- y2="222.59448"
- id="linearGradient3990"
- xlink:href="#linearGradient3746"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(-132.8041,190.19124)" />
- <linearGradient
- id="linearGradient3746">
- <stop
- id="stop3748"
- style="stop-color:#ffffff;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3750"
- style="stop-color:#0074b7;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="542.5"
- y1="222.59448"
- x2="559"
- y2="222.59448"
- id="linearGradient3994"
- xlink:href="#linearGradient3746"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(-88.054101,190.19124)" />
- <linearGradient
- id="linearGradient3428">
- <stop
- id="stop3430"
- style="stop-color:#464646;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3432"
- style="stop-color:#848788;stop-opacity:1"
- offset="0.18306103" />
- <stop
- id="stop3434"
- style="stop-color:#9ca0a2;stop-opacity:1"
- offset="0.66368055" />
- <stop
- id="stop3436"
- style="stop-color:#b5babd;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="592.92798"
- y1="199.43727"
- x2="557.05743"
- y2="196.5448"
- id="linearGradient3426"
- xlink:href="#linearGradient3428"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(-102.5217,149.09845)" />
- </defs>
- <g
- id="layer1">
- <g
- id="boat">
- <path
- d="M 296.669,434.15623 C 376.12538,436.50959 448.282,436.46711 542.42304,434.15623 C 542.42304,434.15623 544.22253,425.03531 542.42304,422.57953 C 432.90655,403.86953 296.669,418.12547 296.669,422.57953 L 296.669,434.15623 z"
- id="path3469"
- style="fill:#a9a9a9;fill-opacity:1;fill-rule:nonzero;stroke:#484848;stroke-width:3.4975698;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" />
- <rect
- width="3.4280596"
- height="29.611124"
- x="647.59613"
- y="173.91156"
- transform="matrix(0.9327494,0.3605254,-0.3633626,0.9316478,0,0)"
- id="rect3408"
- style="opacity:1;fill:#333333;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- width="48.499989"
- height="8.5"
- x="318.48221"
- y="405.82172"
- transform="matrix(0.9999952,3.0887777e-3,-3.0887777e-3,0.9999952,0,0)"
- id="rect3376"
- style="opacity:1;fill:url(#linearGradient3416);fill-opacity:1;fill-rule:nonzero;stroke:#484848;stroke-width:2.99999928;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 382.4459,430.66072 C 382.4459,430.66072 420.85999,388.74829 397.4459,385.66072 L 488.4459,397.66072 L 488.4459,432.66072 L 382.4459,430.66072 z"
- id="path3952"
- style="fill:url(#linearGradient3972);fill-opacity:1;fill-rule:evenodd;stroke:#323232;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 301.4459,429.66072 C 301.4459,429.66072 330.46329,468.66072 343.4459,468.66072 C 355.42851,471.91072 507.57644,473.70653 525.4459,465.91072 C 534.58031,461.59104 537.90602,455.58662 539.4459,429.66072 C 473.70193,439.43306 371.2651,439.78219 301.4459,429.66072 z"
- id="path3938"
- style="fill:url(#linearGradient3948);fill-opacity:1;fill-rule:evenodd;stroke:#545454;stroke-width:3.0999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 339.44863,416.12222 L 357.69854,416.17859 L 368.1622,427.96097 L 339.41234,427.87217 L 339.44863,416.12222 z"
- id="rect3378"
- style="fill:#dedede;fill-opacity:1;fill-rule:nonzero;stroke:#484848;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" />
- <rect
- width="13.5"
- height="17"
- x="411.19589"
- y="404.28574"
- id="rect3974"
- style="opacity:1;fill:url(#linearGradient3990);fill-opacity:1;fill-rule:nonzero;stroke:#323232;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- width="13.5"
- height="17"
- x="455.94589"
- y="404.28574"
- id="rect3992"
- style="opacity:1;fill:url(#linearGradient3994);fill-opacity:1;fill-rule:nonzero;stroke:#323232;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 295.6959,421.91072 C 360.77923,430.41072 446.61257,432.91072 541.9459,421.91072 C 541.9459,421.91072 543.74902,428.6076 541.9459,430.41072 C 432.20839,444.14823 295.6959,433.68104 295.6959,430.41072 L 295.6959,421.91072 z"
- id="rect2558"
- style="fill:#dedede;fill-opacity:1;fill-rule:nonzero;stroke:#484848;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" />
- <rect
- width="94.427879"
- height="7.236649"
- x="437.10614"
- y="342.2645"
- transform="matrix(0.9947793,0.1020501,-0.1079723,0.9941539,0,0)"
- id="rect2569"
- style="opacity:1;fill:#c1c1c1;fill-opacity:1;fill-rule:nonzero;stroke:#404040;stroke-width:3.0365274;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- width="13.5"
- height="17"
- x="433.32089"
- y="404.28574"
- id="rect3385"
- style="opacity:1;fill:url(#linearGradient3387);fill-opacity:1;fill-rule:nonzero;stroke:#323232;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 402.86916,380.21847 L 489.80407,388.85485 L 491.52271,394.54919 L 397.58781,384.91281 L 402.86916,380.21847 z"
- id="rect3466"
- style="fill:#dcdcdc;fill-opacity:1;fill-rule:nonzero;stroke:#404040;stroke-width:3.03650045;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1" />
- <rect
- width="34.5"
- height="14.5"
- x="456.4783"
- y="336.94293"
- transform="matrix(0.997157,7.5351915e-2,-7.5351915e-2,0.997157,0,0)"
- id="rect3418"
- style="opacity:1;fill:url(#linearGradient3426);fill-opacity:1;fill-rule:nonzero;stroke:#494949;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <g
- transform="matrix(0.9246214,0.3808874,-0.3808874,0.9246214,-13.252851,-40.129692)"
- id="flag">
- <rect
- width="19.75"
- height="27.75"
- x="193.34448"
- y="-709"
- transform="matrix(0,1,-1,0,0,0)"
- id="rect3389"
- style="opacity:1;fill:#b20000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- width="27.25"
- height="5.75"
- x="681.5"
- y="200.59448"
- id="rect3393"
- style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- width="5.75"
- height="19.5"
- x="691.25"
- y="193.59448"
- id="rect3395"
- style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- width="27.75"
- height="2.5"
- x="681.5"
- y="202.34448"
- id="rect3397"
- style="opacity:1;fill:#000080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- width="3"
- height="19.25"
- x="692.5"
- y="193.59448"
- id="rect3399"
- style="opacity:1;fill:#000080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- </g>
- </g>
- </g>
-</svg>
diff --git a/examples/widgets/animation/sub-attaq/pics/scalable/bomb.svg b/examples/widgets/animation/sub-attaq/pics/scalable/bomb.svg
deleted file mode 100644
index 294771a6dd..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/scalable/bomb.svg
+++ /dev/null
@@ -1,138 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- version="1.0"
- width="744.09448"
- height="1052.3622"
- id="svg3121">
- <defs
- id="defs3123">
- <radialGradient
- cx="-135.625"
- cy="148.71948"
- r="7.625"
- fx="-135.625"
- fy="148.71948"
- id="radialGradient3439"
- xlink:href="#linearGradient3366"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- x1="-132.85063"
- y1="173.6969"
- x2="-145.3662"
- y2="177.59828"
- id="linearGradient3418"
- xlink:href="#linearGradient3366"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(-0.2134297,-0.5943658,0.6658882,-0.2391126,-274.53441,123.00067)" />
- <linearGradient
- x1="-141.85466"
- y1="181.49153"
- x2="-144.95044"
- y2="175.90179"
- id="linearGradient3414"
- xlink:href="#linearGradient3366"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.2134297,-0.5943658,-0.6658882,-0.2391126,-15.893355,122.67824)" />
- <linearGradient
- x1="-149.5"
- y1="177.59448"
- x2="-145.7928"
- y2="180.05936"
- id="linearGradient3410"
- xlink:href="#linearGradient3366"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(-0.6315243,0,0,0.7075182,-227.03781,54.321514)" />
- <linearGradient
- x1="-140.46242"
- y1="177.40488"
- x2="-147.04802"
- y2="172.66473"
- id="linearGradient3406"
- xlink:href="#linearGradient3366"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(-0.6315243,0,0,-0.7075182,-226.40365,274.91611)" />
- <linearGradient
- x1="-147.2406"
- y1="180.95567"
- x2="-140.01878"
- y2="175.57777"
- id="linearGradient3402"
- xlink:href="#linearGradient3366"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.6315243,0,0,-0.7075182,-64.045217,275.07466)" />
- <linearGradient
- x1="-146.98956"
- y1="174.00922"
- x2="-142.60332"
- y2="179.38712"
- id="linearGradient3398"
- xlink:href="#linearGradient3366"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.6315243,0,0,0.7075182,-62.683611,54.187362)" />
- <linearGradient
- id="linearGradient3366">
- <stop
- id="stop3368"
- style="stop-color:#bcbcbc;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3370"
- style="stop-color:#191b1c;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <radialGradient
- cx="-208.95004"
- cy="173.10576"
- r="31.667252"
- fx="-208.95004"
- fy="173.10576"
- id="radialGradient3364"
- xlink:href="#linearGradient3366"
- gradientUnits="userSpaceOnUse" />
- </defs>
- <g
- id="layer1">
- <g
- transform="translate(419.4996,488.13454)"
- id="mine">
- <path
- d="M -167.5843,186.54079 A 31.466251,31.466251 0 1 1 -230.5168,186.54079 A 31.466251,31.466251 0 1 1 -167.5843,186.54079 z"
- transform="matrix(0.6341613,0,0,0.6341613,-18.521242,45.718192)"
- id="path2586"
- style="opacity:1;fill:url(#radialGradient3364);fill-opacity:1;stroke:#131313;stroke-width:3.54799318;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M -155.20193,175.4167 C -157.60085,176.6451 -156.78074,184.26068 -156.78074,184.26068 C -156.78074,184.26068 -148.33787,181.58301 -148.57092,178.60053 C -148.74283,176.40051 -153.23774,174.41092 -155.20193,175.4167 z"
- id="path3382"
- style="fill:url(#linearGradient3398);fill-opacity:1;fill-rule:evenodd;stroke:#131313;stroke-width:2.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M -156.56354,153.84532 C -158.96246,152.61693 -158.14235,145.00135 -158.14235,145.00135 C -158.14235,145.00135 -149.69948,147.67902 -149.93253,150.66149 C -150.10444,152.86151 -154.59935,154.85111 -156.56354,153.84532 z"
- id="path3400"
- style="fill:url(#linearGradient3402);fill-opacity:1;fill-rule:evenodd;stroke:#131313;stroke-width:2.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M -133.88532,153.68678 C -131.48641,152.45838 -132.30652,144.8428 -132.30652,144.8428 C -132.30652,144.8428 -140.74938,147.52047 -140.51633,150.50295 C -140.34442,152.70297 -135.84951,154.69256 -133.88532,153.68678 z"
- id="path3404"
- style="fill:url(#linearGradient3406);fill-opacity:1;fill-rule:evenodd;stroke:#131313;stroke-width:2.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M -134.51948,175.55085 C -132.12057,176.77925 -132.94068,184.39483 -132.94068,184.39483 C -132.94068,184.39483 -141.38355,181.71716 -141.15049,178.73469 C -140.97858,176.53467 -136.48367,174.54507 -134.51948,175.55085 z"
- id="path3408"
- style="fill:url(#linearGradient3410);fill-opacity:1;fill-rule:evenodd;stroke:#131313;stroke-width:2.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M -161.25709,168.78221 C -163.22395,170.62484 -170.11427,165.85236 -170.11427,165.85236 C -170.11427,165.85236 -164.7408,160.23808 -162.01257,161.46538 C -160.00011,162.37068 -159.64667,167.27352 -161.25709,168.78221 z"
- id="path3412"
- style="fill:url(#linearGradient3414);fill-opacity:1;fill-rule:evenodd;stroke:#131313;stroke-width:2.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M -129.17068,169.10464 C -127.20382,170.94727 -120.3135,166.17478 -120.3135,166.17478 C -120.3135,166.17478 -125.68697,160.5605 -128.41519,161.7878 C -130.42766,162.69311 -130.7811,167.59595 -129.17068,169.10464 z"
- id="path3416"
- style="fill:url(#linearGradient3418);fill-opacity:1;fill-rule:evenodd;stroke:#131313;stroke-width:2.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M -126,151.21948 A 6.625,6.625 0 1 1 -139.25,151.21948 A 6.625,6.625 0 1 1 -126,151.21948 z"
- transform="matrix(0.6341613,0,0,0.6341613,-61.039517,68.324922)"
- id="path3426"
- style="opacity:1;fill:url(#radialGradient3439);fill-opacity:1;stroke:#131313;stroke-width:3.54799318;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- </g>
- </g>
-</svg>
diff --git a/examples/widgets/animation/sub-attaq/pics/scalable/sand.svg b/examples/widgets/animation/sub-attaq/pics/scalable/sand.svg
deleted file mode 100644
index 8af11b7a66..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/scalable/sand.svg
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- version="1.0"
- width="744.09448"
- height="1052.3622"
- id="svg2596">
- <defs
- id="defs2598">
- <linearGradient
- id="linearGradient3708">
- <stop
- id="stop3710"
- style="stop-color:#202020;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3712"
- style="stop-color:#ffffff;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="518.26996"
- y1="497.31476"
- x2="533.02924"
- y2="497.31476"
- id="linearGradient3794"
- xlink:href="#linearGradient3708"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- id="linearGradient3718">
- <stop
- id="stop3720"
- style="stop-color:#bcbcbc;stop-opacity:0.28169015"
- offset="0" />
- <stop
- id="stop3722"
- style="stop-color:#bcbcbc;stop-opacity:0"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="516.89508"
- y1="503.50137"
- x2="516.89508"
- y2="543.80646"
- id="linearGradient3792"
- xlink:href="#linearGradient3718"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.9947644,0,0,1.3346457,2.7877039,-166.60153)" />
- <linearGradient
- id="linearGradient3692">
- <stop
- id="stop3694"
- style="stop-color:#ffffff;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3696"
- style="stop-color:#b6b6b6;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="506.95975"
- y1="469.73706"
- x2="525.41608"
- y2="469.73706"
- id="linearGradient3790"
- xlink:href="#linearGradient3692"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- id="linearGradient3816">
- <stop
- id="stop3818"
- style="stop-color:#ad8b00;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3820"
- style="stop-color:#ad8b00;stop-opacity:0"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="573"
- y1="755.46222"
- x2="573"
- y2="700.13464"
- id="linearGradient3826"
- xlink:href="#linearGradient3816"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1,0,0,1.6033628,-150.63569,-350.3846)" />
- </defs>
- <g
- id="layer1">
- <path
- d="M -151.63569,813.2217 C 121.3643,798.79144 -201.99878,675.6877 110.3643,805.79144 C 173.82677,832.22448 244.3643,807.3948 298.3643,805.79144 C 352.3643,804.18808 312.3643,791.12082 359.3643,811.96454 C 406.3643,832.80825 554.3643,792.77462 599.3643,784.75781 C 644.3643,776.741 757.36426,768.13763 796.36426,782.5679 C 835.36426,796.99816 905.36426,799.37799 905.36426,799.37799 L 902.36426,847.47887 L -153.63569,845.87551 L -151.63569,813.2217 z"
- id="path3814"
- style="fill:url(#linearGradient3826);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
- <path
- d="M 908.86426,836.95812 C 635.8643,830.91791 761.87636,793.71076 617.8643,836.91791 C 600.0648,842.2582 409.74894,822.981 401.8643,836.91791 C 378.04825,879.01524 73.306465,803.72304 31.864305,827.54883 C 28.864305,829.27358 9.9016246,824.26916 -15.135695,831.28771 C -51.805335,841.56707 -68.135695,826.06042 -107.1357,832.10063 C -146.1357,838.14084 -150.13569,834.11404 -150.13569,834.11404 L -157.13569,848.36741 L 898.86426,847.69627 L 908.86426,836.95812 z"
- id="path3828"
- style="fill:#ad8b00;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
- </g>
-</svg>
diff --git a/examples/widgets/animation/sub-attaq/pics/scalable/see.svg b/examples/widgets/animation/sub-attaq/pics/scalable/see.svg
deleted file mode 100644
index 0666691215..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/scalable/see.svg
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- version="1.0"
- width="744.09448"
- height="1052.3622"
- id="svg2650">
- <defs
- id="defs2652">
- <linearGradient
- id="linearGradient3624">
- <stop
- id="stop3626"
- style="stop-color:#3a8daf;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3636"
- style="stop-color:#252525;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="552.98486"
- y1="390.56842"
- x2="549.39465"
- y2="702.3479"
- id="linearGradient3630"
- xlink:href="#linearGradient3624"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(2.3373776,0,0,1.5004634,-996.17287,-279.00679)" />
- </defs>
- <g
- id="layer1">
- <rect
- width="1054.4708"
- height="461.52972"
- x="-161.52115"
- y="310.16876"
- id="rect3622"
- style="opacity:1;fill:url(#linearGradient3630);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.13464069;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- </g>
-</svg>
diff --git a/examples/widgets/animation/sub-attaq/pics/scalable/sky.svg b/examples/widgets/animation/sub-attaq/pics/scalable/sky.svg
deleted file mode 100644
index 1546c087a7..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/scalable/sky.svg
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- version="1.0"
- width="744.09448"
- height="1052.3622"
- id="svg2721">
- <defs
- id="defs2723">
- <linearGradient
- id="linearGradient3746">
- <stop
- id="stop3748"
- style="stop-color:#ffffff;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3750"
- style="stop-color:#0074b7;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <radialGradient
- cx="82.966125"
- cy="-178.42453"
- r="526.79456"
- fx="82.966125"
- fy="-178.42453"
- id="radialGradient3880"
- xlink:href="#linearGradient3746"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1.4952094,0.3367191,-0.1040669,0.5264617,-235.04839,425.12197)" />
- </defs>
- <g
- id="layer1">
- <rect
- width="1053.5891"
- height="291.32797"
- x="-178.22313"
- y="300.98392"
- id="rect3638"
- style="opacity:1;fill:url(#radialGradient3880);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.1880002;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- </g>
-</svg>
diff --git a/examples/widgets/animation/sub-attaq/pics/scalable/sub-attaq.svg b/examples/widgets/animation/sub-attaq/pics/scalable/sub-attaq.svg
deleted file mode 100644
index b075179b46..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/scalable/sub-attaq.svg
+++ /dev/null
@@ -1,1473 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="1052.3622"
- height="744.09448"
- id="svg2"
- sodipodi:version="0.32"
- inkscape:version="0.46"
- version="1.0"
- sodipodi:docname="sub-attaq.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape">
- <defs
- id="defs4">
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3366"
- id="radialGradient3439"
- cx="-135.625"
- cy="148.71948"
- fx="-135.625"
- fy="148.71948"
- r="7.625"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3366"
- id="linearGradient3418"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(-0.2134297,-0.5943658,0.6658882,-0.2391126,-274.53441,123.00067)"
- x1="-132.85063"
- y1="173.6969"
- x2="-145.3662"
- y2="177.59828" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3366"
- id="linearGradient3414"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.2134297,-0.5943658,-0.6658882,-0.2391126,-15.893355,122.67824)"
- x1="-141.85466"
- y1="181.49153"
- x2="-144.95044"
- y2="175.90179" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3366"
- id="linearGradient3410"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(-0.6315243,0,0,0.7075182,-227.03781,54.321514)"
- x1="-149.5"
- y1="177.59448"
- x2="-145.7928"
- y2="180.05936" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3366"
- id="linearGradient3406"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(-0.6315243,0,0,-0.7075182,-226.40365,274.91611)"
- x1="-140.46242"
- y1="177.40488"
- x2="-147.04802"
- y2="172.66473" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3366"
- id="linearGradient3402"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.6315243,0,0,-0.7075182,-64.045217,275.07466)"
- x1="-147.2406"
- y1="180.95567"
- x2="-140.01878"
- y2="175.57777" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3366"
- id="linearGradient3398"
- x1="-146.98956"
- y1="174.00922"
- x2="-142.60332"
- y2="179.38712"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.6315243,0,0,0.7075182,-62.683611,54.187362)" />
- <linearGradient
- id="linearGradient3366">
- <stop
- id="stop3368"
- offset="0"
- style="stop-color:#bcbcbc;stop-opacity:1;" />
- <stop
- id="stop3370"
- offset="1"
- style="stop-color:#191b1c;stop-opacity:1;" />
- </linearGradient>
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3366"
- id="radialGradient3364"
- cx="-208.95004"
- cy="173.10576"
- fx="-208.95004"
- fy="173.10576"
- r="31.667252"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- id="linearGradient5097">
- <stop
- style="stop-color:#19a2db;stop-opacity:0;"
- offset="0"
- id="stop5099" />
- <stop
- id="stop5109"
- offset="0.30000001"
- style="stop-color:#1379a7;stop-opacity:0.49803922;" />
- <stop
- style="stop-color:#0e5173;stop-opacity:1;"
- offset="1"
- id="stop5101" />
- </linearGradient>
- <linearGradient
- id="linearGradient3523"
- inkscape:collect="always">
- <stop
- id="stop3525"
- offset="0"
- style="stop-color:#b9b9b9;stop-opacity:1" />
- <stop
- id="stop3527"
- offset="1"
- style="stop-color:#444444;stop-opacity:0;" />
- </linearGradient>
- <linearGradient
- id="linearGradient3438">
- <stop
- style="stop-color:#939393;stop-opacity:1;"
- offset="0"
- id="stop3440" />
- <stop
- id="stop3444"
- offset="0.12354442"
- style="stop-color:#d6d6d6;stop-opacity:1;" />
- <stop
- style="stop-color:#dadada;stop-opacity:1;"
- offset="0.74055624"
- id="stop3446" />
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="1"
- id="stop3442" />
- </linearGradient>
- <linearGradient
- id="linearGradient3428">
- <stop
- id="stop3430"
- offset="0"
- style="stop-color:#464646;stop-opacity:1;" />
- <stop
- style="stop-color:#848788;stop-opacity:1;"
- offset="0.18306103"
- id="stop3432" />
- <stop
- id="stop3434"
- offset="0.66368055"
- style="stop-color:#9ca0a2;stop-opacity:1;" />
- <stop
- id="stop3436"
- offset="1"
- style="stop-color:#b5babd;stop-opacity:1;" />
- </linearGradient>
- <linearGradient
- id="linearGradient4034">
- <stop
- id="stop4036"
- offset="0"
- style="stop-color:#ffffff;stop-opacity:1;" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0.49803922;"
- offset="0.5"
- id="stop4038" />
- <stop
- id="stop4040"
- offset="0.63705367"
- style="stop-color:#ffffff;stop-opacity:0.24705882;" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0.12156863;"
- offset="0.79425853"
- id="stop4042" />
- <stop
- id="stop4044"
- offset="1"
- style="stop-color:#a0a0a0;stop-opacity:1;" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- id="linearGradient4016">
- <stop
- style="stop-color:#283e6a;stop-opacity:1;"
- offset="0"
- id="stop4018" />
- <stop
- style="stop-color:#283e6a;stop-opacity:0;"
- offset="1"
- id="stop4020" />
- </linearGradient>
- <linearGradient
- id="linearGradient4004">
- <stop
- style="stop-color:#dbdbdb;stop-opacity:1;"
- offset="0"
- id="stop4010" />
- <stop
- style="stop-color:#c4c9cb;stop-opacity:1;"
- offset="1"
- id="stop4012" />
- </linearGradient>
- <linearGradient
- id="linearGradient3998">
- <stop
- id="stop4000"
- offset="0"
- style="stop-color:#adadad;stop-opacity:1;" />
- <stop
- id="stop4002"
- offset="1"
- style="stop-color:#ffffff;stop-opacity:1;" />
- </linearGradient>
- <linearGradient
- id="linearGradient3864">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop3866" />
- <stop
- id="stop4028"
- offset="0.5"
- style="stop-color:#ffffff;stop-opacity:0.49803922;" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0.24705882;"
- offset="0.75"
- id="stop4030" />
- <stop
- id="stop4032"
- offset="0.875"
- style="stop-color:#ffffff;stop-opacity:0.12156863;" />
- <stop
- style="stop-color:#a0a0a0;stop-opacity:1;"
- offset="1"
- id="stop3868" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- id="linearGradient3816">
- <stop
- style="stop-color:#ad8b00;stop-opacity:1;"
- offset="0"
- id="stop3818" />
- <stop
- style="stop-color:#ad8b00;stop-opacity:0;"
- offset="1"
- id="stop3820" />
- </linearGradient>
- <linearGradient
- id="linearGradient3746">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop3748" />
- <stop
- style="stop-color:#0074b7;stop-opacity:1;"
- offset="1"
- id="stop3750" />
- </linearGradient>
- <linearGradient
- id="linearGradient3718">
- <stop
- style="stop-color:#bcbcbc;stop-opacity:0.28169015;"
- offset="0"
- id="stop3720" />
- <stop
- style="stop-color:#bcbcbc;stop-opacity:0;"
- offset="1"
- id="stop3722" />
- </linearGradient>
- <linearGradient
- id="linearGradient3708">
- <stop
- style="stop-color:#202020;stop-opacity:1;"
- offset="0"
- id="stop3710" />
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="1"
- id="stop3712" />
- </linearGradient>
- <linearGradient
- id="linearGradient3692">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop3694" />
- <stop
- style="stop-color:#b6b6b6;stop-opacity:1;"
- offset="1"
- id="stop3696" />
- </linearGradient>
- <linearGradient
- id="linearGradient3656">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop3658" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0;"
- offset="1"
- id="stop3660" />
- </linearGradient>
- <linearGradient
- id="linearGradient3624">
- <stop
- style="stop-color:#3a8daf;stop-opacity:1;"
- offset="0"
- id="stop3626" />
- <stop
- id="stop3636"
- offset="1"
- style="stop-color:#252525;stop-opacity:1;" />
- </linearGradient>
- <linearGradient
- id="linearGradient3532">
- <stop
- id="stop3534"
- offset="0"
- style="stop-color:#545454;stop-opacity:1;" />
- <stop
- style="stop-color:#848788;stop-opacity:1;"
- offset="0.44021741"
- id="stop3536" />
- <stop
- id="stop3538"
- offset="0.56799388"
- style="stop-color:#9ca0a2;stop-opacity:1;" />
- <stop
- id="stop3540"
- offset="1"
- style="stop-color:#565d60;stop-opacity:1" />
- </linearGradient>
- <linearGradient
- id="linearGradient3345">
- <stop
- id="stop3348"
- offset="0"
- style="stop-color:#898989;stop-opacity:1;" />
- <stop
- style="stop-color:#9ea1a2;stop-opacity:1;"
- offset="0.44021741"
- id="stop3350" />
- <stop
- id="stop3352"
- offset="0.56799388"
- style="stop-color:#bbbdbf;stop-opacity:1;" />
- <stop
- id="stop3354"
- offset="1"
- style="stop-color:#f0f1f2;stop-opacity:1;" />
- </linearGradient>
- <linearGradient
- id="linearGradient3227">
- <stop
- style="stop-color:#444444;stop-opacity:1;"
- offset="0"
- id="stop3229" />
- <stop
- style="stop-color:#b0b0b0;stop-opacity:1;"
- offset="1"
- id="stop3232" />
- </linearGradient>
- <linearGradient
- id="linearGradient3435">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop3437" />
- <stop
- style="stop-color:#c0c0c0;stop-opacity:0;"
- offset="1"
- id="stop3439" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- id="linearGradient3421">
- <stop
- style="stop-color:#444444;stop-opacity:1;"
- offset="0"
- id="stop3423" />
- <stop
- style="stop-color:#444444;stop-opacity:0;"
- offset="1"
- id="stop3425" />
- </linearGradient>
- <linearGradient
- id="linearGradient3293">
- <stop
- style="stop-color:#c4b434;stop-opacity:1;"
- offset="0"
- id="stop3295" />
- <stop
- style="stop-color:#9b5500;stop-opacity:1;"
- offset="1"
- id="stop3297" />
- </linearGradient>
- <linearGradient
- id="linearGradient3229">
- <stop
- style="stop-color:#125a7a;stop-opacity:1;"
- offset="0"
- id="stop3231" />
- <stop
- style="stop-color:#308fc0;stop-opacity:1;"
- offset="1"
- id="stop3233" />
- </linearGradient>
- <linearGradient
- id="linearGradient3219">
- <stop
- id="stop3221"
- offset="0"
- style="stop-color:#a55b00;stop-opacity:1;" />
- <stop
- id="stop3223"
- offset="1"
- style="stop-color:#f4e45e;stop-opacity:1;" />
- </linearGradient>
- <linearGradient
- id="linearGradient3189">
- <stop
- style="stop-color:#000000;stop-opacity:1;"
- offset="0"
- id="stop3191" />
- <stop
- style="stop-color:#000000;stop-opacity:0;"
- offset="1"
- id="stop3193" />
- </linearGradient>
- <linearGradient
- id="linearGradient3167">
- <stop
- style="stop-color:#464646;stop-opacity:1;"
- offset="0"
- id="stop3169" />
- <stop
- id="stop3345"
- offset="0.44021741"
- style="stop-color:#848788;stop-opacity:1;" />
- <stop
- style="stop-color:#9ca0a2;stop-opacity:1;"
- offset="0.56799388"
- id="stop3347" />
- <stop
- style="stop-color:#b5babd;stop-opacity:1;"
- offset="1"
- id="stop3171" />
- </linearGradient>
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 526.18109 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="744.09448 : 526.18109 : 1"
- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
- id="perspective10" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3167"
- id="linearGradient3175"
- x1="443.95602"
- y1="315.31854"
- x2="443.95602"
- y2="247.85609"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.4908502,0,0,0.4579593,350.98557,542.12189)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3219"
- id="linearGradient3253"
- gradientUnits="userSpaceOnUse"
- x1="325.57214"
- y1="280.13632"
- x2="312.84424"
- y2="257.60013" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3229"
- id="linearGradient3255"
- gradientUnits="userSpaceOnUse"
- x1="310.01578"
- y1="255.47881"
- x2="325.92572"
- y2="280.13632" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3219"
- id="linearGradient3321"
- gradientUnits="userSpaceOnUse"
- x1="325.57214"
- y1="280.13632"
- x2="312.84424"
- y2="257.60013" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3229"
- id="linearGradient3323"
- gradientUnits="userSpaceOnUse"
- x1="310.01578"
- y1="255.47881"
- x2="325.92572"
- y2="280.13632" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3219"
- id="linearGradient3331"
- gradientUnits="userSpaceOnUse"
- x1="325.57214"
- y1="280.13632"
- x2="312.84424"
- y2="257.60013" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3229"
- id="linearGradient3333"
- gradientUnits="userSpaceOnUse"
- x1="310.01578"
- y1="255.47881"
- x2="325.92572"
- y2="280.13632" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3293"
- id="linearGradient3343"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1.3292883,0,0,1.10796,1.5038593,-24.232315)"
- x1="359.5589"
- y1="258.84247"
- x2="370.88239"
- y2="258.84247" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3219"
- id="linearGradient3365"
- gradientUnits="userSpaceOnUse"
- x1="325.57214"
- y1="280.13632"
- x2="312.84424"
- y2="257.60013" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3229"
- id="linearGradient3367"
- gradientUnits="userSpaceOnUse"
- x1="310.01578"
- y1="255.47881"
- x2="325.92572"
- y2="280.13632" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3219"
- id="linearGradient3369"
- gradientUnits="userSpaceOnUse"
- x1="325.57214"
- y1="280.13632"
- x2="312.84424"
- y2="257.60013" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3229"
- id="linearGradient3371"
- gradientUnits="userSpaceOnUse"
- x1="310.01578"
- y1="255.47881"
- x2="325.92572"
- y2="280.13632" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3219"
- id="linearGradient3379"
- gradientUnits="userSpaceOnUse"
- x1="325.57214"
- y1="280.13632"
- x2="312.84424"
- y2="257.60013" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3229"
- id="linearGradient3381"
- gradientUnits="userSpaceOnUse"
- x1="310.01578"
- y1="255.47881"
- x2="325.92572"
- y2="280.13632" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3293"
- id="linearGradient3385"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1.3267302,0,0,1.1332782,-1.5786343,-29.194748)"
- x1="371.79858"
- y1="258.84247"
- x2="364.49646"
- y2="258.84247" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3293"
- id="linearGradient3401"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1.9807835,0,0,1.1280701,-361.45126,-28.553769)"
- x1="371.79858"
- y1="258.84247"
- x2="364.49646"
- y2="258.84247" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3421"
- id="radialGradient3431"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1.1862613,0,0,0.3638703,-186.86143,179.02055)"
- cx="432.3343"
- cy="233.80295"
- fx="432.3343"
- fy="233.80295"
- r="59.056834" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3435"
- id="radialGradient3441"
- cx="290.5"
- cy="244.34448"
- fx="290.5"
- fy="244.34448"
- r="37.5"
- gradientTransform="matrix(0.8202102,0.8202102,-0.7960458,0.7960458,246.73838,-189.686)"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3345"
- id="linearGradient3311"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.466978,0,0,0.4500435,352.00841,540.25044)"
- x1="510.99884"
- y1="161.99408"
- x2="396.48914"
- y2="161.99408" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3421"
- id="radialGradient3339"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.4181493,0,0,0.1282619,386.09461,620.15777)"
- cx="432.3343"
- cy="233.80295"
- fx="432.3343"
- fy="233.80295"
- r="59.056834" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3219"
- id="linearGradient3434"
- gradientUnits="userSpaceOnUse"
- x1="325.57214"
- y1="280.13632"
- x2="312.84424"
- y2="257.60013" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3229"
- id="linearGradient3436"
- gradientUnits="userSpaceOnUse"
- x1="310.01578"
- y1="255.47881"
- x2="325.92572"
- y2="280.13632" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3532"
- id="linearGradient3520"
- x1="525"
- y1="371.09448"
- x2="525"
- y2="395.09448"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.5865192,0,0,0.2518015,339.73218,572.99479)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3624"
- id="linearGradient3630"
- x1="552.98486"
- y1="390.56842"
- x2="549.39465"
- y2="702.3479"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(2.3373776,0,0,1.5004634,-835.38716,-310.82676)" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3656"
- id="radialGradient3662"
- cx="656.19507"
- cy="534.45917"
- fx="656.19507"
- fy="534.45917"
- r="13.227922"
- gradientTransform="matrix(1,0,0,1.2672781,0,-144.63884)"
- gradientUnits="userSpaceOnUse" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3656"
- id="radialGradient3668"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1,0,0,1.2672781,0,-144.63884)"
- cx="656.19507"
- cy="534.45917"
- fx="656.19507"
- fy="534.45917"
- r="13.227922" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3656"
- id="radialGradient3672"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1,0,0,1.2672781,0,-144.63884)"
- cx="656.19507"
- cy="534.45917"
- fx="656.19507"
- fy="534.45917"
- r="13.227922" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3656"
- id="radialGradient3676"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1,0,0,1.2672781,0,-144.63884)"
- cx="656.19507"
- cy="534.45917"
- fx="656.19507"
- fy="534.45917"
- r="13.227922" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3692"
- id="linearGradient3772"
- gradientUnits="userSpaceOnUse"
- x1="506.95975"
- y1="469.73706"
- x2="525.41608"
- y2="469.73706" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3718"
- id="linearGradient3774"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.9947644,0,0,1.3346457,2.7877039,-166.60153)"
- x1="516.89508"
- y1="503.50137"
- x2="516.89508"
- y2="543.80646" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3708"
- id="linearGradient3776"
- gradientUnits="userSpaceOnUse"
- x1="518.26993"
- y1="497.31477"
- x2="533.02923"
- y2="497.31477" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3692"
- id="linearGradient3790"
- gradientUnits="userSpaceOnUse"
- x1="506.95975"
- y1="469.73706"
- x2="525.41608"
- y2="469.73706" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3718"
- id="linearGradient3792"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.9947644,0,0,1.3346457,2.7877039,-166.60153)"
- x1="516.89508"
- y1="503.50137"
- x2="516.89508"
- y2="543.80646" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3708"
- id="linearGradient3794"
- gradientUnits="userSpaceOnUse"
- x1="518.26993"
- y1="497.31477"
- x2="533.02923"
- y2="497.31477" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3656"
- id="radialGradient3804"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1,0,0,1.2672781,0,-144.63884)"
- cx="656.19507"
- cy="534.45917"
- fx="656.19507"
- fy="534.45917"
- r="13.227922" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3656"
- id="radialGradient3808"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1,0,0,1.2672781,0,-144.63884)"
- cx="656.19507"
- cy="534.45917"
- fx="656.19507"
- fy="534.45917"
- r="13.227922" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3227"
- id="linearGradient3812"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1.1223608,0,0,0.3849769,-17.516054,565.40983)"
- x1="543.5"
- y1="205.19257"
- x2="587.52001"
- y2="205.19257" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3816"
- id="linearGradient3826"
- x1="573"
- y1="755.46222"
- x2="573"
- y2="700.13464"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1,0,0,1.6033628,0,-450.76899)" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3864"
- id="radialGradient3874"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(2.9674693,0.8647541,-0.8726553,1.0212484,-15.308759,-74.232772)"
- cx="94.273849"
- cy="89.893486"
- fx="94.273849"
- fy="89.893486"
- r="74.397521" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3746"
- id="radialGradient3880"
- cx="82.966125"
- cy="-178.42453"
- fx="82.966125"
- fy="-178.42453"
- r="526.79456"
- gradientTransform="matrix(1.4952094,0.3367191,-0.1040669,0.5264617,-57.119818,125.77043)"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3438"
- id="linearGradient3948"
- x1="660.29303"
- y1="256.53284"
- x2="444.79303"
- y2="255.62085"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(0,32.526912)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3692"
- id="linearGradient3972"
- x1="573.5"
- y1="244.2056"
- x2="578.25"
- y2="216.9556"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(0,35.526912)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3746"
- id="linearGradient3990"
- x1="542.5"
- y1="222.59448"
- x2="559"
- y2="222.59448"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(-6.25,37.151912)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3746"
- id="linearGradient3994"
- gradientUnits="userSpaceOnUse"
- x1="542.5"
- y1="222.59448"
- x2="559"
- y2="222.59448"
- gradientTransform="translate(38.5,37.151912)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient4016"
- id="linearGradient4022"
- x1="639"
- y1="262.09448"
- x2="667"
- y2="262.09448"
- gradientUnits="userSpaceOnUse" />
- <inkscape:perspective
- id="perspective2578"
- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
- inkscape:vp_z="744.09448 : 526.18109 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_x="0 : 526.18109 : 1"
- sodipodi:type="inkscape:persp3d" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3746"
- id="linearGradient3387"
- gradientUnits="userSpaceOnUse"
- x1="542.5"
- y1="222.59448"
- x2="559"
- y2="222.59448"
- gradientTransform="translate(15.875,37.151912)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3167"
- id="linearGradient3416"
- x1="474.23065"
- y1="229.92336"
- x2="474.1944"
- y2="218.27365"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(0.1004684,32.526757)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3428"
- id="linearGradient3426"
- x1="592.92798"
- y1="199.43727"
- x2="557.05743"
- y2="196.5448"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(12.140805,-13.041887)" />
- <filter
- inkscape:collect="always"
- id="filter3507">
- <feGaussianBlur
- inkscape:collect="always"
- stdDeviation="3.0523171"
- id="feGaussianBlur3509" />
- </filter>
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3523"
- id="linearGradient3521"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1,0,0,-0.7291751,0,521.83983)"
- x1="562.55634"
- y1="285.89896"
- x2="562.55634"
- y2="244.09448" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient5097"
- id="linearGradient5103"
- x1="590.84674"
- y1="274.57559"
- x2="590.84674"
- y2="334.01376"
- gradientUnits="userSpaceOnUse"
- spreadMethod="pad" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3864"
- id="radialGradient5107"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(2.9674693,0.8647541,-0.8726553,1.0212484,-15.308759,-74.232772)"
- cx="94.273849"
- cy="89.893486"
- fx="94.273849"
- fy="89.893486"
- r="74.397521" />
- </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="0.70710678"
- inkscape:cx="532.91407"
- inkscape:cy="457.84365"
- inkscape:document-units="px"
- inkscape:current-layer="layer1"
- showgrid="false"
- inkscape:window-width="1674"
- inkscape:window-height="1000"
- inkscape:window-x="2"
- inkscape:window-y="14"
- showguides="false" />
- <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:url(#radialGradient3880);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.1880002;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect3638"
- width="1053.5891"
- height="291.32797"
- x="-0.29455566"
- y="1.6323624" />
- <path
- style="fill:url(#radialGradient3874);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter3507)"
- d="M 158.37853,75.817898 C 130.95894,49.483192 82.14552,74.615971 85.85382,95.15981 C 49.691853,94.8009 50.214842,139.36083 83.29101,132.16343 C 144.66465,163.16454 159.26268,129.80212 164.6863,136.51386 C 225.60448,157.97672 246.34362,130.65438 265.24417,127.0714 C 294.43981,137.91859 337.16986,121.78798 297.03636,102.77604 C 331.73096,64.597047 277.96882,60.229366 253.07028,70.400868 C 191.09597,33.610112 168.89234,63.292037 158.37853,75.817898 z"
- id="path3872"
- sodipodi:nodetypes="cccccccc"
- transform="matrix(1.5062893,0,0,1.1720951,618.04001,132.36768)" />
- <rect
- style="opacity:1;fill:url(#linearGradient3630);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.13464069;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect3622"
- width="1054.4708"
- height="461.52972"
- x="-0.7354126"
- y="278.34879" />
- <path
- style="fill:url(#linearGradient3826);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="M -0.99999999,712.83731 C 272,698.40705 -51.363087,575.30331 261,705.40705 C 324.46247,731.84009 395,707.01041 449,705.40705 C 503,703.80369 463,690.73643 510,711.58015 C 557,732.42386 705,692.39023 750,684.37342 C 795,676.35661 908,667.75324 947,682.18351 C 986,696.61377 1056,698.9936 1056,698.9936 L 1053,747.09448 L -3,745.49112 L -0.99999999,712.83731 z"
- id="path3814"
- sodipodi:nodetypes="cssssscccc" />
- <rect
- style="opacity:1;fill:url(#linearGradient3520);fill-opacity:1;fill-rule:nonzero;stroke:#1b1e1f;stroke-width:0.56879884;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect3512"
- width="10.557344"
- height="6.0432386"
- x="642.3761"
- y="666.43695" />
- <use
- x="0"
- y="0"
- xlink:href="#path2455"
- id="use3258"
- transform="matrix(0.869168,0,0,-0.869168,81.98751,1246.5374)"
- width="1052.3622"
- height="744.09448" />
- <path
- style="fill:url(#linearGradient3812);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.77744257;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 593.04822,651.68104 C 593.04822,651.68104 653.65569,615.49321 639.065,637.05192 C 624.47431,658.61061 624.47431,658.61061 624.47431,658.61061 L 593.04822,651.68104 z"
- id="path2455" />
- <path
- style="fill:url(#linearGradient3175);fill-opacity:1;fill-rule:evenodd;stroke:#393939;stroke-width:1.90693891;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 485.26939,643.71814 C 443.15507,651.66437 458.5319,680.53556 502.21486,686.27814 C 551.68229,692.78115 568.45042,691.0115 605.34827,686.27814 C 657.60843,679.57406 657.68143,651.78445 605.34827,643.25553 C 553.98131,634.88408 516.10913,637.89923 485.26939,643.71814 z"
- id="path2385"
- sodipodi:nodetypes="cssss" />
- <path
- style="fill:url(#radialGradient3339);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="M 542.18031,648.1112 C 548.56327,665.42741 608.42397,656.72745 586.93551,642.57104 C 586.93551,642.57104 543.33293,648.61096 542.18031,648.1112 z"
- id="path3403"
- sodipodi:nodetypes="ccc" />
- <path
- style="fill:url(#linearGradient3311);fill-opacity:1;fill-rule:evenodd;stroke:#2d2d2d;stroke-width:2.07042313;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 537.39402,641.90906 C 537.39402,656.7605 583.62247,656.30589 583.62247,641.45445 L 583.62247,636.06071 C 583.62247,621.21003 537.39402,613.87461 537.39402,628.72529 L 537.39402,641.90906 z"
- id="path3291"
- sodipodi:nodetypes="cssss" />
- <g
- id="g3235"
- transform="matrix(1.4016868,0,0,1.1319742,112.22001,-99.678822)" />
- <path
- sodipodi:type="arc"
- style="opacity:1;fill:url(#radialGradient3441);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.227;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path3433"
- sodipodi:cx="303.5"
- sodipodi:cy="263.09448"
- sodipodi:rx="37.5"
- sodipodi:ry="40"
- d="M 341,263.09448 A 37.5,40 0 1 1 266,263.09448 A 37.5,40 0 1 1 341,263.09448 z"
- transform="matrix(0.692163,0,1.4106583e-2,0.289185,275.31394,582.37251)" />
- <path
- sodipodi:type="arc"
- style="opacity:1;fill:#444444;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.06500006;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path3458"
- sodipodi:cx="369.5"
- sodipodi:cy="316.09448"
- sodipodi:rx="27.5"
- sodipodi:ry="7"
- d="M 397,316.09448 A 27.5,7 0 1 1 342,316.09448 A 27.5,7 0 1 1 397,316.09448 z"
- transform="matrix(0.5642633,0,0,0.5642633,348.03095,450.47113)" />
- <path
- sodipodi:type="arc"
- style="opacity:1;fill:#444444;fill-opacity:1;fill-rule:nonzero;stroke:#1b1e1f;stroke-width:4.23126984;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path3510"
- sodipodi:cx="369.5"
- sodipodi:cy="316.09448"
- sodipodi:rx="27.5"
- sodipodi:ry="7"
- d="M 397,316.09448 A 27.5,7 0 1 1 342,316.09448 A 27.5,7 0 1 1 397,316.09448 z"
- transform="matrix(0,0.30778,-0.5642633,0,828.66499,563.5944)" />
- <use
- x="0"
- y="0"
- xlink:href="#path3510"
- id="use3544"
- transform="translate(0.5000005,-17.23511)"
- width="1052.3622"
- height="744.09448" />
- <path
- sodipodi:type="arc"
- style="opacity:1;fill:#787878;fill-opacity:1;fill-rule:nonzero;stroke:#1b1e1f;stroke-width:2.38492584;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path3584"
- sodipodi:cx="237.5"
- sodipodi:cy="366.09448"
- sodipodi:rx="8.5"
- sodipodi:ry="8"
- d="M 246,366.09448 A 8.5,8 0 1 1 229,366.09448 A 8.5,8 0 1 1 246,366.09448 z"
- transform="matrix(1.7798114,-4.2997512e-2,1.3318941e-2,0.5513151,196.65666,476.1443)" />
- <path
- style="fill:#a9a9a9;fill-opacity:1;fill-rule:nonzero;stroke:#484848;stroke-width:3.49756980000000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
- d="M 423.2231,281.1169 C 502.67948,283.47026 574.8361,283.42778 668.97714,281.1169 C 668.97714,281.1169 670.77663,271.99598 668.97714,269.5402 C 559.46065,250.8302 423.2231,265.08614 423.2231,269.5402 L 423.2231,281.1169 z"
- id="path3469"
- sodipodi:nodetypes="cccsc" />
- <rect
- style="opacity:1;fill:#333333;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect3408"
- width="3.4280596"
- height="29.611124"
- x="709.89148"
- y="-14.462622"
- transform="matrix(0.9327494,0.3605254,-0.3633626,0.9316478,0,0)" />
- <rect
- style="opacity:1;fill:url(#linearGradient3416);fill-opacity:1;fill-rule:nonzero;stroke:#484848;stroke-width:2.99999928;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect3376"
- width="48.499989"
- height="8.5"
- x="444.56302"
- y="252.39224"
- transform="matrix(0.9999952,3.0887776e-3,-3.0887776e-3,0.9999952,0,0)" />
- <path
- style="fill:url(#linearGradient3972);fill-opacity:1;fill-rule:evenodd;stroke:#323232;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 509,277.62139 C 509,277.62139 547.41409,235.70896 524,232.62139 L 615,244.62139 L 615,279.62139 L 509,277.62139 z"
- id="path3952"
- sodipodi:nodetypes="csccc" />
- <path
- sodipodi:type="arc"
- style="opacity:1;fill:url(#radialGradient3662);fill-opacity:1;fill-rule:nonzero;stroke:#41526b;stroke-width:2.9000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path3654"
- sodipodi:cx="656.19507"
- sodipodi:cy="541.15485"
- sodipodi:rx="12.727922"
- sodipodi:ry="16.263456"
- d="M 668.92299,541.15485 A 12.727922,16.263456 0 1 1 643.46715,541.15485 A 12.727922,16.263456 0 1 1 668.92299,541.15485 z"
- transform="matrix(0.5187874,0,0,0.3968421,374.8524,387.30025)" />
- <path
- sodipodi:type="arc"
- style="opacity:1;fill:url(#radialGradient3668);fill-opacity:1;fill-rule:nonzero;stroke:#41526b;stroke-width:2.9000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path3666"
- sodipodi:cx="656.19507"
- sodipodi:cy="541.15485"
- sodipodi:rx="12.727922"
- sodipodi:ry="16.263456"
- d="M 668.92299,541.15485 A 12.727922,16.263456 0 1 1 643.46715,541.15485 A 12.727922,16.263456 0 1 1 668.92299,541.15485 z"
- transform="matrix(0.5734968,0,0,0.4386917,316.52295,315.62837)" />
- <path
- transform="matrix(0.8598866,0,0,0.5637407,192.52282,220.77351)"
- d="M 668.92299,541.15485 A 12.727922,16.263456 0 1 1 643.46715,541.15485 A 12.727922,16.263456 0 1 1 668.92299,541.15485 z"
- sodipodi:ry="16.263456"
- sodipodi:rx="12.727922"
- sodipodi:cy="541.15485"
- sodipodi:cx="656.19507"
- id="path3670"
- style="opacity:1;fill:url(#radialGradient3672);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.90000010000000020;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- sodipodi:type="arc" />
- <path
- sodipodi:type="arc"
- style="opacity:1;fill:url(#radialGradient3676);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.90000010000000020;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path3674"
- sodipodi:cx="656.19507"
- sodipodi:cy="541.15485"
- sodipodi:rx="12.727922"
- sodipodi:ry="16.263456"
- d="M 668.92299,541.15485 A 12.727922,16.263456 0 1 1 643.46715,541.15485 A 12.727922,16.263456 0 1 1 668.92299,541.15485 z"
- transform="matrix(0.7435991,0,0,0.6264519,225.8301,127.83701)" />
- <g
- id="g3759"
- transform="matrix(0.8830571,0,0,0.8830571,104.83144,103.2985)">
- <path
- d="M 523.9661,469.73706 A 7.7781744,34.648232 0 1 1 508.40975,469.73706 A 7.7781744,34.648232 0 1 1 523.9661,469.73706 z"
- sodipodi:ry="34.648232"
- sodipodi:rx="7.7781744"
- sodipodi:cy="469.73706"
- sodipodi:cx="516.18793"
- id="path3682"
- style="opacity:1;fill:url(#linearGradient3772);fill-opacity:1;fill-rule:nonzero;stroke:#272727;stroke-width:2.9000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- sodipodi:type="arc" />
- <g
- id="g3754">
- <rect
- style="opacity:1;fill:url(#linearGradient3774);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.20000005;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect3716"
- width="33.58757"
- height="59.927299"
- x="498.86386"
- y="497.84454" />
- <path
- style="fill:url(#linearGradient3776);fill-opacity:1;fill-rule:evenodd;stroke:#1f1f1f;stroke-width:1.99788344;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 523.35045,482.89424 C 523.35045,482.89424 532.31256,488.20203 532.02344,500.14638 C 531.73431,512.09072 531.73431,511.73417 531.73431,511.73417 C 531.73431,511.73417 520.70627,493.83104 519.26887,499.77636 L 523.35045,482.89424 z"
- id="path3704"
- sodipodi:nodetypes="cscsc" />
- <path
- sodipodi:nodetypes="cscsc"
- id="path3706"
- d="M 508.50327,482.89424 C 508.50327,482.89424 499.54116,488.20203 499.83028,500.14638 C 500.11941,512.09072 500.11941,511.73417 500.11941,511.73417 C 500.11941,511.73417 511.14745,493.83104 512.58485,499.77636 L 508.50327,482.89424 z"
- style="fill:#bcbcbc;fill-opacity:1;fill-rule:evenodd;stroke:#1f1f1f;stroke-width:1.99788344;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- </g>
- </g>
- <g
- transform="matrix(0.8830571,0,0,0.8830571,192.45885,-66.370546)"
- id="g3778">
- <path
- sodipodi:type="arc"
- style="opacity:1;fill:url(#linearGradient3790);fill-opacity:1;fill-rule:nonzero;stroke:#272727;stroke-width:2.9000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path3780"
- sodipodi:cx="516.18793"
- sodipodi:cy="469.73706"
- sodipodi:rx="7.7781744"
- sodipodi:ry="34.648232"
- d="M 523.9661,469.73706 A 7.7781744,34.648232 0 1 1 508.40975,469.73706 A 7.7781744,34.648232 0 1 1 523.9661,469.73706 z" />
- <g
- id="g3782">
- <rect
- y="497.84454"
- x="498.86386"
- height="59.927299"
- width="33.58757"
- id="rect3784"
- style="opacity:1;fill:url(#linearGradient3792);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.20000005;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- sodipodi:nodetypes="cscsc"
- id="path3786"
- d="M 523.35045,482.89424 C 523.35045,482.89424 532.31256,488.20203 532.02344,500.14638 C 531.73431,512.09072 531.73431,511.73417 531.73431,511.73417 C 531.73431,511.73417 520.70627,493.83104 519.26887,499.77636 L 523.35045,482.89424 z"
- style="fill:url(#linearGradient3794);fill-opacity:1;fill-rule:evenodd;stroke:#1f1f1f;stroke-width:1.99788344;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- style="fill:#bcbcbc;fill-opacity:1;fill-rule:evenodd;stroke:#1f1f1f;stroke-width:1.99788344;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 508.50327,482.89424 C 508.50327,482.89424 499.54116,488.20203 499.83028,500.14638 C 500.11941,512.09072 500.11941,511.73417 500.11941,511.73417 C 500.11941,511.73417 511.14745,493.83104 512.58485,499.77636 L 508.50327,482.89424 z"
- id="path3788"
- sodipodi:nodetypes="cscsc" />
- </g>
- </g>
- <path
- transform="matrix(0.4292897,0,0,0.3283816,384.32775,481.20689)"
- d="M 668.92299,541.15485 A 12.727922,16.263456 0 1 1 643.46715,541.15485 A 12.727922,16.263456 0 1 1 668.92299,541.15485 z"
- sodipodi:ry="16.263456"
- sodipodi:rx="12.727922"
- sodipodi:cy="541.15485"
- sodipodi:cx="656.19507"
- id="path3802"
- style="opacity:1;fill:url(#radialGradient3804);fill-opacity:1;fill-rule:nonzero;stroke:#41526b;stroke-width:2.9000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- sodipodi:type="arc" />
- <path
- sodipodi:type="arc"
- style="opacity:1;fill:url(#radialGradient3808);fill-opacity:1;fill-rule:nonzero;stroke:#41526b;stroke-width:2.9000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="path3806"
- sodipodi:cx="656.19507"
- sodipodi:cy="541.15485"
- sodipodi:rx="12.727922"
- sodipodi:ry="16.263456"
- d="M 668.92299,541.15485 A 12.727922,16.263456 0 1 1 643.46715,541.15485 A 12.727922,16.263456 0 1 1 668.92299,541.15485 z"
- transform="matrix(0.5842998,0,0,0.4469553,299.7804,369.91514)" />
- <path
- style="fill:#ad8b00;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- d="M 1059.5,736.57373 C 786.5,730.53352 912.51207,693.32637 768.5,736.53352 C 750.7005,741.87381 560.38464,722.59661 552.5,736.53352 C 528.68395,778.63085 223.94216,703.33865 182.5,727.16444 C 179.5,728.88919 160.53732,723.88477 135.5,730.90332 C 98.830356,741.18268 82.5,725.67603 43.5,731.71624 C 4.5,737.75645 0.5,733.72965 0.5,733.72965 L -6.5,747.98302 L 1049.5,747.31188 L 1059.5,736.57373 z"
- id="path3828"
- sodipodi:nodetypes="cssssscccc" />
- <rect
- style="opacity:1;fill:url(#linearGradient5103);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect3448"
- width="1053.5891"
- height="67.882248"
- x="-0.29455566"
- y="274.57559" />
- <path
- sodipodi:nodetypes="ccccc"
- id="path3519"
- d="M 428,343.85222 C 428,343.85222 457.01739,315.41439 470,315.41439 C 481.98261,313.04457 634.13054,311.73511 652,317.41962 C 661.13441,320.56943 664.46012,324.9477 666,343.85222 C 600.25603,336.72647 497.8192,336.4719 428,343.85222 z"
- style="opacity:0.43933058;fill:url(#linearGradient3521);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.0999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- style="fill:url(#linearGradient3948);fill-opacity:1;fill-rule:evenodd;stroke:#545454;stroke-width:3.0999999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 428,276.62139 C 428,276.62139 457.01739,315.62139 470,315.62139 C 481.98261,318.87139 634.13054,320.6672 652,312.87139 C 661.13441,308.55171 664.46012,302.54729 666,276.62139 C 600.25603,286.39373 497.8192,286.74286 428,276.62139 z"
- id="path3938"
- sodipodi:nodetypes="ccccc" />
- <path
- style="fill:#dedede;fill-opacity:1;fill-rule:nonzero;stroke:#484848;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
- d="M 466.00273,263.08289 L 484.25264,263.13926 L 494.7163,274.92164 L 465.96644,274.83284 L 466.00273,263.08289 z"
- id="rect3378"
- sodipodi:nodetypes="ccccc" />
- <rect
- style="opacity:1;fill:url(#linearGradient3990);fill-opacity:1;fill-rule:nonzero;stroke:#323232;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect3974"
- width="13.5"
- height="17"
- x="537.75"
- y="251.2464"
- inkscape:transform-center-x="30" />
- <rect
- inkscape:transform-center-x="30"
- y="251.2464"
- x="582.5"
- height="17"
- width="13.5"
- id="rect3992"
- style="opacity:1;fill:url(#linearGradient3994);fill-opacity:1;fill-rule:nonzero;stroke:#323232;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- style="fill:#dedede;fill-opacity:1;fill-rule:nonzero;stroke:#484848;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
- d="M 422.25,268.87139 C 487.33333,277.37139 573.16667,279.87139 668.5,268.87139 C 668.5,268.87139 670.30312,275.56827 668.5,277.37139 C 558.76249,291.1089 422.25,280.64171 422.25,277.37139 L 422.25,268.87139 z"
- id="rect2558"
- sodipodi:nodetypes="cccsc" />
- <rect
- style="opacity:1;fill:#c1c1c1;fill-opacity:1;fill-rule:nonzero;stroke:#404040;stroke-width:3.0365274;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect2569"
- width="94.427879"
- height="7.236649"
- x="546.39832"
- y="177.10637"
- transform="matrix(0.9947793,0.1020501,-0.1079723,0.9941539,0,0)" />
- <rect
- inkscape:transform-center-x="30"
- y="251.2464"
- x="559.875"
- height="17"
- width="13.5"
- id="rect3385"
- style="opacity:1;fill:url(#linearGradient3387);fill-opacity:1;fill-rule:nonzero;stroke:#323232;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <g
- id="g3401"
- transform="matrix(0.9246214,0.3808874,-0.3808874,0.9246214,113.30125,-193.16902)"
- inkscape:transform-center-x="17.590385"
- inkscape:transform-center-y="-15.415449">
- <rect
- inkscape:transform-center-y="-43.888889"
- transform="matrix(0,1,-1,0,0,0)"
- style="opacity:1;fill:#b20000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect3389"
- width="19.75"
- height="27.75"
- x="193.34448"
- y="-709" />
- <rect
- y="200.59448"
- x="681.5"
- height="5.75"
- width="27.25"
- id="rect3393"
- style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- y="193.59448"
- x="691.25"
- height="19.5"
- width="5.75"
- id="rect3395"
- style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- y="202.34448"
- x="681.5"
- height="2.5"
- width="27.75"
- id="rect3397"
- style="opacity:1;fill:#000080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <rect
- y="193.59448"
- x="692.5"
- height="19.25"
- width="3"
- id="rect3399"
- style="opacity:1;fill:#000080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- </g>
- <path
- style="fill:#dcdcdc;fill-opacity:1;fill-rule:nonzero;stroke:#404040;stroke-width:3.03650045;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
- d="M 529.42326,227.17914 L 616.35817,235.81552 L 618.07681,241.50986 L 524.14191,231.87348 L 529.42326,227.17914 z"
- id="rect3466"
- sodipodi:nodetypes="ccccc" />
- <rect
- style="opacity:1;fill:url(#linearGradient3426);fill-opacity:1;fill-rule:nonzero;stroke:#494949;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect3418"
- width="34.5"
- height="14.5"
- x="571.14081"
- y="174.8026"
- transform="matrix(0.997157,7.5351915e-2,-7.5351915e-2,0.997157,0,0)"
- inkscape:transform-center-x="-8"
- inkscape:transform-center-y="2" />
- <g
- id="mine"
- transform="translate(971.11461,237.62715)"
- inkscape:label="#g3441">
- <path
- transform="matrix(0.6341613,0,0,0.6341613,-18.521242,45.718192)"
- d="M -167.5843,186.54079 A 31.466251,31.466251 0 1 1 -230.5168,186.54079 A 31.466251,31.466251 0 1 1 -167.5843,186.54079 z"
- sodipodi:ry="31.466251"
- sodipodi:rx="31.466251"
- sodipodi:cy="186.54079"
- sodipodi:cx="-199.05055"
- id="path2586"
- style="opacity:1;fill:url(#radialGradient3364);fill-opacity:1;stroke:#131313;stroke-width:3.54799318;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- sodipodi:type="arc" />
- <path
- sodipodi:nodetypes="ccss"
- id="path3382"
- d="M -155.20193,175.4167 C -157.60085,176.6451 -156.78074,184.26068 -156.78074,184.26068 C -156.78074,184.26068 -148.33787,181.58301 -148.57092,178.60053 C -148.74283,176.40051 -153.23774,174.41092 -155.20193,175.4167 z"
- style="fill:url(#linearGradient3398);fill-opacity:1;fill-rule:evenodd;stroke:#131313;stroke-width:2.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- sodipodi:nodetypes="ccss"
- id="path3400"
- d="M -156.56354,153.84532 C -158.96246,152.61693 -158.14235,145.00135 -158.14235,145.00135 C -158.14235,145.00135 -149.69948,147.67902 -149.93253,150.66149 C -150.10444,152.86151 -154.59935,154.85111 -156.56354,153.84532 z"
- style="fill:url(#linearGradient3402);fill-opacity:1;fill-rule:evenodd;stroke:#131313;stroke-width:2.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- sodipodi:nodetypes="ccss"
- id="path3404"
- d="M -133.88532,153.68678 C -131.48641,152.45838 -132.30652,144.8428 -132.30652,144.8428 C -132.30652,144.8428 -140.74938,147.52047 -140.51633,150.50295 C -140.34442,152.70297 -135.84951,154.69256 -133.88532,153.68678 z"
- style="fill:url(#linearGradient3406);fill-opacity:1;fill-rule:evenodd;stroke:#131313;stroke-width:2.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- sodipodi:nodetypes="ccss"
- id="path3408"
- d="M -134.51948,175.55085 C -132.12057,176.77925 -132.94068,184.39483 -132.94068,184.39483 C -132.94068,184.39483 -141.38355,181.71716 -141.15049,178.73469 C -140.97858,176.53467 -136.48367,174.54507 -134.51948,175.55085 z"
- style="fill:url(#linearGradient3410);fill-opacity:1;fill-rule:evenodd;stroke:#131313;stroke-width:2.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- sodipodi:nodetypes="ccss"
- id="path3412"
- d="M -161.25709,168.78221 C -163.22395,170.62484 -170.11427,165.85236 -170.11427,165.85236 C -170.11427,165.85236 -164.7408,160.23808 -162.01257,161.46538 C -160.00011,162.37068 -159.64667,167.27352 -161.25709,168.78221 z"
- style="fill:url(#linearGradient3414);fill-opacity:1;fill-rule:evenodd;stroke:#131313;stroke-width:2.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- sodipodi:nodetypes="ccss"
- id="path3416"
- d="M -129.17068,169.10464 C -127.20382,170.94727 -120.3135,166.17478 -120.3135,166.17478 C -120.3135,166.17478 -125.68697,160.5605 -128.41519,161.7878 C -130.42766,162.69311 -130.7811,167.59595 -129.17068,169.10464 z"
- style="fill:url(#linearGradient3418);fill-opacity:1;fill-rule:evenodd;stroke:#131313;stroke-width:2.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- transform="matrix(0.6341613,0,0,0.6341613,-61.039517,68.324922)"
- d="M -126,151.21948 A 6.625,6.625 0 1 1 -139.25,151.21948 A 6.625,6.625 0 1 1 -126,151.21948 z"
- sodipodi:ry="6.625"
- sodipodi:rx="6.625"
- sodipodi:cy="151.21948"
- sodipodi:cx="-132.625"
- id="path3426"
- style="opacity:1;fill:url(#radialGradient3439);fill-opacity:1;stroke:#131313;stroke-width:3.54799318;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- sodipodi:type="arc" />
- </g>
- </g>
-</svg>
diff --git a/examples/widgets/animation/sub-attaq/pics/scalable/submarine.svg b/examples/widgets/animation/sub-attaq/pics/scalable/submarine.svg
deleted file mode 100644
index 8a0ffddbca..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/scalable/submarine.svg
+++ /dev/null
@@ -1,214 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- version="1.0"
- width="744.09448"
- height="1052.3622"
- id="svg2594">
- <defs
- id="defs2596">
- <linearGradient
- id="linearGradient3345">
- <stop
- id="stop3348"
- style="stop-color:#898989;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3350"
- style="stop-color:#9ea1a2;stop-opacity:1"
- offset="0.44021741" />
- <stop
- id="stop3352"
- style="stop-color:#bbbdbf;stop-opacity:1"
- offset="0.56799388" />
- <stop
- id="stop3354"
- style="stop-color:#f0f1f2;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="510.99884"
- y1="161.99408"
- x2="396.48914"
- y2="161.99408"
- id="linearGradient3311"
- xlink:href="#linearGradient3345"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.466978,0,0,0.4500435,231.58508,159.95135)" />
- <linearGradient
- id="linearGradient3532">
- <stop
- id="stop3534"
- style="stop-color:#545454;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3536"
- style="stop-color:#848788;stop-opacity:1"
- offset="0.44021741" />
- <stop
- id="stop3538"
- style="stop-color:#9ca0a2;stop-opacity:1"
- offset="0.56799388" />
- <stop
- id="stop3540"
- style="stop-color:#565d60;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="525"
- y1="371.09448"
- x2="525"
- y2="395.09448"
- id="linearGradient3520"
- xlink:href="#linearGradient3532"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.5865192,0,0,0.2518015,219.30885,192.6957)" />
- <linearGradient
- id="linearGradient3227">
- <stop
- id="stop3229"
- style="stop-color:#444444;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3232"
- style="stop-color:#b0b0b0;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="543.5"
- y1="205.19257"
- x2="587.52002"
- y2="205.19257"
- id="linearGradient3812"
- xlink:href="#linearGradient3227"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1.1223608,0,0,0.3849769,-137.93938,185.11074)" />
- <linearGradient
- id="linearGradient3167">
- <stop
- id="stop3169"
- style="stop-color:#464646;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3345"
- style="stop-color:#848788;stop-opacity:1"
- offset="0.44021741" />
- <stop
- id="stop3347"
- style="stop-color:#9ca0a2;stop-opacity:1"
- offset="0.56799388" />
- <stop
- id="stop3171"
- style="stop-color:#b5babd;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="443.95602"
- y1="315.31854"
- x2="443.95602"
- y2="247.85609"
- id="linearGradient3175"
- xlink:href="#linearGradient3167"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.4908502,0,0,0.4579593,230.56224,161.8228)" />
- <linearGradient
- id="linearGradient3421">
- <stop
- id="stop3423"
- style="stop-color:#444444;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3425"
- style="stop-color:#444444;stop-opacity:0"
- offset="1" />
- </linearGradient>
- <radialGradient
- cx="432.33429"
- cy="233.80295"
- r="59.056835"
- fx="432.33429"
- fy="233.80295"
- id="radialGradient3339"
- xlink:href="#linearGradient3421"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.4181493,0,0,0.1282619,265.67128,239.85868)" />
- <linearGradient
- id="linearGradient3435">
- <stop
- id="stop3437"
- style="stop-color:#ffffff;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3439"
- style="stop-color:#c0c0c0;stop-opacity:0"
- offset="1" />
- </linearGradient>
- <radialGradient
- cx="290.5"
- cy="244.34448"
- r="37.5"
- fx="290.5"
- fy="244.34448"
- id="radialGradient3441"
- xlink:href="#linearGradient3435"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.8202102,0.8202102,-0.7960458,0.7960458,246.73838,-189.686)" />
- </defs>
- <g
- id="submarine">
- <rect
- width="10.557344"
- height="6.0432386"
- x="521.95276"
- y="286.13785"
- id="rect3512"
- style="opacity:1;fill:url(#linearGradient3520);fill-opacity:1;fill-rule:nonzero;stroke:#1b1e1f;stroke-width:0.56879884;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 472.62489,271.38195 C 472.62489,271.38195 533.23236,235.19412 518.64167,256.75283 C 504.05098,278.31152 504.05098,278.31152 504.05098,278.31152 L 472.62489,271.38195 z"
- id="path2455"
- style="fill:url(#linearGradient3812);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.77744257;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 364.84606,263.41905 C 322.73174,271.36528 338.10857,300.23647 381.79153,305.97905 C 431.25896,312.48206 448.02709,310.71241 484.92494,305.97905 C 537.1851,299.27497 537.2581,271.48536 484.92494,262.95644 C 433.55798,254.58499 395.6858,257.60014 364.84606,263.41905 z"
- id="path2385"
- style="fill:url(#linearGradient3175);fill-opacity:1;fill-rule:evenodd;stroke:#393939;stroke-width:1.90693891;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 421.75698,267.81211 C 428.13994,285.12832 488.00064,276.42836 466.51218,262.27195 C 466.51218,262.27195 422.9096,268.31187 421.75698,267.81211 z"
- id="path3403"
- style="fill:url(#radialGradient3339);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
- <path
- d="M 416.97069,261.60997 C 416.97069,276.46141 463.19914,276.0068 463.19914,261.15536 L 463.19914,255.76162 C 463.19914,240.91094 416.97069,233.57552 416.97069,248.4262 L 416.97069,261.60997 z"
- id="path3291"
- style="fill:url(#linearGradient3311);fill-opacity:1;fill-rule:evenodd;stroke:#2d2d2d;stroke-width:2.07042313;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 341,263.09448 A 37.5,40 0 1 1 266,263.09448 A 37.5,40 0 1 1 341,263.09448 z"
- transform="matrix(0.692163,0,1.4106583e-2,0.289185,154.89061,202.07342)"
- id="path3433"
- style="opacity:1;fill:url(#radialGradient3441);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.227;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 397,316.09448 A 27.5,7 0 1 1 342,316.09448 A 27.5,7 0 1 1 397,316.09448 z"
- transform="matrix(0.5642633,0,0,0.5642633,227.60762,70.172035)"
- id="path3458"
- style="opacity:1;fill:#444444;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.06500006;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 397,316.09448 A 27.5,7 0 1 1 342,316.09448 A 27.5,7 0 1 1 397,316.09448 z"
- transform="matrix(0,0.30778,-0.5642633,0,708.24166,183.29531)"
- id="path3510"
- style="opacity:1;fill:#444444;fill-opacity:1;fill-rule:nonzero;stroke:#1b1e1f;stroke-width:4.23126984;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <use
- transform="translate(0.5000044,-17.235115)"
- id="use3544"
- x="0"
- y="0"
- width="1052.3622"
- height="744.09448"
- xlink:href="#path3510" />
- <path
- d="M 246,366.09448 A 8.5,8 0 1 1 229,366.09448 A 8.5,8 0 1 1 246,366.09448 z"
- transform="matrix(1.7798114,-4.2997512e-2,1.3318941e-2,0.5513151,76.233334,95.845205)"
- id="path3584"
- style="opacity:1;fill:#787878;fill-opacity:1;fill-rule:nonzero;stroke:#1b1e1f;stroke-width:2.38492584;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- </g>
-</svg>
diff --git a/examples/widgets/animation/sub-attaq/pics/scalable/surface.svg b/examples/widgets/animation/sub-attaq/pics/scalable/surface.svg
deleted file mode 100644
index 40ed239638..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/scalable/surface.svg
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- version="1.0"
- width="744.09448"
- height="1052.3622"
- id="svg2685">
- <defs
- id="defs2687">
- <linearGradient
- id="linearGradient5097">
- <stop
- id="stop5099"
- style="stop-color:#19a2db;stop-opacity:0"
- offset="0" />
- <stop
- id="stop5109"
- style="stop-color:#1379a7;stop-opacity:0.49803922"
- offset="0.30000001" />
- <stop
- id="stop5101"
- style="stop-color:#0e5173;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="590.84674"
- y1="274.57559"
- x2="590.84674"
- y2="334.01376"
- id="linearGradient5103"
- xlink:href="#linearGradient5097"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(-172.21428,209.55976)"
- spreadMethod="pad" />
- </defs>
- <g
- id="layer1">
- <rect
- width="1053.5891"
- height="67.882248"
- x="-172.50883"
- y="484.13535"
- id="rect3448"
- style="opacity:1;fill:url(#linearGradient5103);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- </g>
-</svg>
diff --git a/examples/widgets/animation/sub-attaq/pics/scalable/torpedo.svg b/examples/widgets/animation/sub-attaq/pics/scalable/torpedo.svg
deleted file mode 100644
index 48e429d2bf..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/scalable/torpedo.svg
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- version="1.0"
- width="744.09448"
- height="1052.3622"
- id="svg2584">
- <defs
- id="defs2586">
- <linearGradient
- id="linearGradient3708">
- <stop
- id="stop3710"
- style="stop-color:#202020;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3712"
- style="stop-color:#ffffff;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="518.26996"
- y1="497.31476"
- x2="533.02924"
- y2="497.31476"
- id="linearGradient3776"
- xlink:href="#linearGradient3708"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- id="linearGradient3718">
- <stop
- id="stop3720"
- style="stop-color:#bcbcbc;stop-opacity:0.28169015"
- offset="0" />
- <stop
- id="stop3722"
- style="stop-color:#bcbcbc;stop-opacity:0"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="516.89508"
- y1="503.50137"
- x2="516.89508"
- y2="543.80646"
- id="linearGradient3774"
- xlink:href="#linearGradient3718"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.9947644,0,0,1.3346457,2.7877039,-166.60153)" />
- <linearGradient
- id="linearGradient3692">
- <stop
- id="stop3694"
- style="stop-color:#ffffff;stop-opacity:1"
- offset="0" />
- <stop
- id="stop3696"
- style="stop-color:#b6b6b6;stop-opacity:1"
- offset="1" />
- </linearGradient>
- <linearGradient
- x1="506.95975"
- y1="469.73706"
- x2="525.41608"
- y2="469.73706"
- id="linearGradient3772"
- xlink:href="#linearGradient3692"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- x1="506.95975"
- y1="469.73706"
- x2="525.41608"
- y2="469.73706"
- id="linearGradient2403"
- xlink:href="#linearGradient3692"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- x1="516.89508"
- y1="503.50137"
- x2="516.89508"
- y2="543.80646"
- id="linearGradient2405"
- xlink:href="#linearGradient3718"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.9947644,0,0,1.3346457,2.7877039,-166.60153)" />
- <linearGradient
- x1="518.26996"
- y1="497.31476"
- x2="533.02924"
- y2="497.31476"
- id="linearGradient2407"
- xlink:href="#linearGradient3708"
- gradientUnits="userSpaceOnUse" />
- </defs>
- <g
- transform="translate(-128.69958,6.6568748)"
- id="torpedo">
- <g
- transform="matrix(0.8830571,0,0,0.8830571,-119.78327,177.67947)"
- id="g3525">
- <path
- d="M 523.9661,469.73706 A 7.7781744,34.648232 0 1 1 508.40975,469.73706 A 7.7781744,34.648232 0 1 1 523.9661,469.73706 z"
- id="path3682"
- style="opacity:1;fill:url(#linearGradient2403);fill-opacity:1;fill-rule:nonzero;stroke:#272727;stroke-width:2.9000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <g
- id="g3754">
- <rect
- width="33.58757"
- height="59.927299"
- x="498.86386"
- y="497.84454"
- id="rect3716"
- style="opacity:1;fill:url(#linearGradient2405);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.20000005;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 523.35045,482.89424 C 523.35045,482.89424 532.31256,488.20203 532.02344,500.14638 C 531.73431,512.09072 531.73431,511.73417 531.73431,511.73417 C 531.73431,511.73417 520.70627,493.83104 519.26887,499.77636 L 523.35045,482.89424 z"
- id="path3704"
- style="fill:url(#linearGradient2407);fill-opacity:1;fill-rule:evenodd;stroke:#1f1f1f;stroke-width:1.99788344;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- d="M 508.50327,482.89424 C 508.50327,482.89424 499.54116,488.20203 499.83028,500.14638 C 500.11941,512.09072 500.11941,511.73417 500.11941,511.73417 C 500.11941,511.73417 511.14745,493.83104 512.58485,499.77636 L 508.50327,482.89424 z"
- id="path3706"
- style="fill:#bcbcbc;fill-opacity:1;fill-rule:evenodd;stroke:#1f1f1f;stroke-width:1.99788344;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- </g>
- </g>
- </g>
-</svg>
diff --git a/examples/widgets/animation/sub-attaq/pics/small/background.png b/examples/widgets/animation/sub-attaq/pics/small/background.png
deleted file mode 100644
index 5ad3db660a..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/small/background.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/small/boat.png b/examples/widgets/animation/sub-attaq/pics/small/boat.png
deleted file mode 100644
index 114ccc310e..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/small/boat.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/small/bomb.png b/examples/widgets/animation/sub-attaq/pics/small/bomb.png
deleted file mode 100644
index 3af5f2f29c..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/small/bomb.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/small/submarine.png b/examples/widgets/animation/sub-attaq/pics/small/submarine.png
deleted file mode 100644
index 0c0c350600..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/small/submarine.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/small/surface.png b/examples/widgets/animation/sub-attaq/pics/small/surface.png
deleted file mode 100644
index 06d0e47a5c..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/small/surface.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/small/torpedo.png b/examples/widgets/animation/sub-attaq/pics/small/torpedo.png
deleted file mode 100644
index f9c26873f1..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/small/torpedo.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/welcome/logo-a.png b/examples/widgets/animation/sub-attaq/pics/welcome/logo-a.png
deleted file mode 100644
index 67dd76dac0..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/welcome/logo-a.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/welcome/logo-a2.png b/examples/widgets/animation/sub-attaq/pics/welcome/logo-a2.png
deleted file mode 100644
index 17668b07de..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/welcome/logo-a2.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/welcome/logo-b.png b/examples/widgets/animation/sub-attaq/pics/welcome/logo-b.png
deleted file mode 100644
index cf6c04560b..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/welcome/logo-b.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/welcome/logo-dash.png b/examples/widgets/animation/sub-attaq/pics/welcome/logo-dash.png
deleted file mode 100644
index 219233ce6b..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/welcome/logo-dash.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/welcome/logo-excl.png b/examples/widgets/animation/sub-attaq/pics/welcome/logo-excl.png
deleted file mode 100644
index 8dd0a2eb86..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/welcome/logo-excl.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/welcome/logo-q.png b/examples/widgets/animation/sub-attaq/pics/welcome/logo-q.png
deleted file mode 100644
index 86e588d4d8..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/welcome/logo-q.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/welcome/logo-s.png b/examples/widgets/animation/sub-attaq/pics/welcome/logo-s.png
deleted file mode 100644
index 7b6a36e93a..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/welcome/logo-s.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/welcome/logo-t.png b/examples/widgets/animation/sub-attaq/pics/welcome/logo-t.png
deleted file mode 100644
index b2e3526bea..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/welcome/logo-t.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/welcome/logo-t2.png b/examples/widgets/animation/sub-attaq/pics/welcome/logo-t2.png
deleted file mode 100644
index b11a77886e..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/welcome/logo-t2.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pics/welcome/logo-u.png b/examples/widgets/animation/sub-attaq/pics/welcome/logo-u.png
deleted file mode 100644
index 24eede887a..0000000000
--- a/examples/widgets/animation/sub-attaq/pics/welcome/logo-u.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/sub-attaq/pixmapitem.cpp b/examples/widgets/animation/sub-attaq/pixmapitem.cpp
deleted file mode 100644
index a8581d881a..0000000000
--- a/examples/widgets/animation/sub-attaq/pixmapitem.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Own
-#include "pixmapitem.h"
-
-//Qt
-#include <QPainter>
-
-PixmapItem::PixmapItem(const QString &fileName, GraphicsScene::Mode mode, QGraphicsItem *parent)
- : QGraphicsObject(parent)
-{
- if (mode == GraphicsScene::Big)
- pix = QPixmap(QStringLiteral(":/big/") + fileName);
- else
- pix = QPixmap(QStringLiteral(":/small/") + fileName);
-}
-
-PixmapItem::PixmapItem(const QString &fileName, QGraphicsScene *scene)
- : QGraphicsObject(), pix(fileName)
-{
- scene->addItem(this);
-}
-
-QSizeF PixmapItem::size() const
-{
- return pix.size();
-}
-
-QRectF PixmapItem::boundingRect() const
-{
- return QRectF(QPointF(0, 0), pix.size());
-}
-
-void PixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
-{
- painter->drawPixmap(0, 0, pix);
-}
-
-
diff --git a/examples/widgets/animation/sub-attaq/pixmapitem.h b/examples/widgets/animation/sub-attaq/pixmapitem.h
deleted file mode 100644
index 45e2ca806f..0000000000
--- a/examples/widgets/animation/sub-attaq/pixmapitem.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PIXMAPITEM_H
-#define PIXMAPITEM_H
-
-//Own
-#include "graphicsscene.h"
-
-//Qt
-#include <QGraphicsObject>
-
-class PixmapItem : public QGraphicsObject
-{
-public:
- PixmapItem(const QString &fileName, GraphicsScene::Mode mode, QGraphicsItem *parent = nullptr);
- PixmapItem(const QString &fileName, QGraphicsScene *scene);
- QSizeF size() const;
- QRectF boundingRect() const override;
- void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override;
-private:
- QPixmap pix;
-};
-
-#endif // PIXMAPITEM_H
diff --git a/examples/widgets/animation/sub-attaq/progressitem.cpp b/examples/widgets/animation/sub-attaq/progressitem.cpp
deleted file mode 100644
index 350dbb7bbd..0000000000
--- a/examples/widgets/animation/sub-attaq/progressitem.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "progressitem.h"
-
-#include <QFont>
-
-ProgressItem::ProgressItem(QGraphicsItem *parent)
- : QGraphicsTextItem(parent)
-{
- setFont(QFont("Comic Sans MS"));
- setPos(parentItem()->boundingRect().topRight() - QPointF(180, -5));
-}
-
-void ProgressItem::setLevel(int level)
-{
- currentLevel = level;
- updateProgress();
-}
-
-void ProgressItem::setScore(int score)
-{
- currentScore = score;
- updateProgress();
-}
-
-void ProgressItem::updateProgress()
-{
- setHtml(QString("Level : %1 Score : %2").arg(currentLevel).arg(currentScore));
-}
diff --git a/examples/widgets/animation/sub-attaq/progressitem.h b/examples/widgets/animation/sub-attaq/progressitem.h
deleted file mode 100644
index f76b168151..0000000000
--- a/examples/widgets/animation/sub-attaq/progressitem.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PROGRESSITEM_H
-#define PROGRESSITEM_H
-
-//Qt
-#include <QGraphicsTextItem>
-
-class ProgressItem : public QGraphicsTextItem
-{
-public:
- ProgressItem(QGraphicsItem *parent = nullptr);
- void setLevel(int level);
- void setScore(int score);
-
-private:
- void updateProgress();
- int currentLevel = 1;
- int currentScore = 0;
-};
-
-#endif // PROGRESSITEM_H
diff --git a/examples/widgets/animation/sub-attaq/qanimationstate.cpp b/examples/widgets/animation/sub-attaq/qanimationstate.cpp
deleted file mode 100644
index 6da085561b..0000000000
--- a/examples/widgets/animation/sub-attaq/qanimationstate.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qanimationstate.h"
-
-#include <QAbstractAnimation>
-
-QT_BEGIN_NAMESPACE
-
-/*!
-\class QAnimationState
-
-\brief The QAnimationState class provides state that handle an animation and emit
-a signal when this animation is finished.
-
-\ingroup statemachine
-
-QAnimationState provides a state that handle an animation. It will start this animation
-when the state is entered and stop it when it is leaved. When the animation has finished the
-state emit animationFinished signal.
-QAnimationState is part of \l{The State Machine Framework}.
-
-\code
-QStateMachine machine;
-QAnimationState *s = new QAnimationState(machine->rootState());
-QPropertyAnimation *animation = new QPropertyAnimation(obj, "pos");
-s->setAnimation(animation);
-QState *s2 = new QState(machine->rootState());
-s->addTransition(s, &QAnimationState::animationFinished, s2);
-machine.start();
-\endcode
-
-\sa QState, {The Animation Framework}
-*/
-
-/*!
- Constructs a new state with the given \a parent state.
-*/
-QAnimationState::QAnimationState(QState *parent)
- : QState(parent), m_animation(nullptr)
-{
-}
-
-/*!
- Destroys the animation state.
-*/
-QAnimationState::~QAnimationState()
-{
-}
-
-/*!
- Set an \a animation for this QAnimationState. If an animation was previously handle by this
- state then it won't emit animationFinished for the old animation. The QAnimationState doesn't
- take the ownership of the animation.
-*/
-void QAnimationState::setAnimation(QAbstractAnimation *animation)
-{
- if (animation == m_animation)
- return;
-
- //Disconnect from the previous animation if exist
- if (m_animation)
- disconnect(m_animation, &QAbstractAnimation::finished, this, &QAnimationState::animationFinished);
-
- m_animation = animation;
-
- if (m_animation) {
- //connect the new animation
- connect(m_animation, &QAbstractAnimation::finished, this, &QAnimationState::animationFinished);
- }
-}
-
-/*!
- Returns the animation handle by this animation state, or \nullptr if there is no animation.
-*/
-QAbstractAnimation* QAnimationState::animation() const
-{
- return m_animation;
-}
-
-/*!
- \reimp
-*/
-void QAnimationState::onEntry(QEvent *)
-{
- if (m_animation)
- m_animation->start();
-}
-
-/*!
- \reimp
-*/
-void QAnimationState::onExit(QEvent *)
-{
- if (m_animation)
- m_animation->stop();
-}
-
-/*!
- \reimp
-*/
-bool QAnimationState::event(QEvent *e)
-{
- return QState::event(e);
-}
-
-QT_END_NAMESPACE
diff --git a/examples/widgets/animation/sub-attaq/qanimationstate.h b/examples/widgets/animation/sub-attaq/qanimationstate.h
deleted file mode 100644
index 24759851ba..0000000000
--- a/examples/widgets/animation/sub-attaq/qanimationstate.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QANIMATIONSTATE_H
-#define QANIMATIONSTATE_H
-
-#include <QState>
-
-QT_BEGIN_NAMESPACE
-
-class QAbstractAnimation;
-
-class QAnimationState : public QState
-{
- Q_OBJECT
-public:
- QAnimationState(QState *parent = nullptr);
- ~QAnimationState();
-
- void setAnimation(QAbstractAnimation *animation);
- QAbstractAnimation* animation() const;
-
-signals:
- void animationFinished();
-
-protected:
- void onEntry(QEvent *) override;
- void onExit(QEvent *) override;
- bool event(QEvent *e) override;
-
-private:
- Q_DISABLE_COPY(QAnimationState)
- QAbstractAnimation *m_animation;
-};
-
-QT_END_NAMESPACE
-
-#endif // QANIMATIONSTATE_H
diff --git a/examples/widgets/animation/sub-attaq/states.cpp b/examples/widgets/animation/sub-attaq/states.cpp
deleted file mode 100644
index c7e2738aad..0000000000
--- a/examples/widgets/animation/sub-attaq/states.cpp
+++ /dev/null
@@ -1,335 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Own
-#include "states.h"
-#include "graphicsscene.h"
-#include "boat.h"
-#include "submarine.h"
-#include "torpedo.h"
-#include "animationmanager.h"
-#include "progressitem.h"
-#include "textinformationitem.h"
-
-//Qt
-#include <QFinalState>
-#include <QGraphicsView>
-#include <QKeyEventTransition>
-#include <QMessageBox>
-#include <QRandomGenerator>
-#include <QStateMachine>
-
-PlayState::PlayState(GraphicsScene *scene, QState *parent)
- : QState(parent), scene(scene), machine(nullptr),
- currentLevel(0), score(0)
-{
-}
-
-PlayState::~PlayState()
-{
- delete machine;
-}
-
-void PlayState::onEntry(QEvent *)
-{
- //We are now playing?
- if (machine) {
- machine->stop();
- //we hide the information
- scene->textInformationItem->hide();
- scene->clearScene();
- currentLevel = 0;
- score = 0;
- delete machine;
- }
-
- machine = new QStateMachine;
-
- //This state is when player is playing
- LevelState *levelState = new LevelState(scene, this, machine);
-
- //This state is when the player is actually playing but the game is not paused
- QState *playingState = new QState(levelState);
- levelState->setInitialState(playingState);
-
- //This state is when the game is paused
- PauseState *pauseState = new PauseState(scene, levelState);
-
- //We have one view, it receive the key press event
- QKeyEventTransition *pressPplay = new QKeyEventTransition(scene->views().at(0), QEvent::KeyPress, Qt::Key_P);
- pressPplay->setTargetState(pauseState);
- QKeyEventTransition *pressPpause = new QKeyEventTransition(scene->views().at(0), QEvent::KeyPress, Qt::Key_P);
- pressPpause->setTargetState(playingState);
-
- //Pause "P" is triggered, the player pause the game
- playingState->addTransition(pressPplay);
-
- //To get back playing when the game has been paused
- pauseState->addTransition(pressPpause);
-
- //This state is when player have lost
- LostState *lostState = new LostState(scene, this, machine);
-
- //This state is when player have won
- WinState *winState = new WinState(scene, this, machine);
-
- //The boat has been destroyed then the game is finished
- levelState->addTransition(scene->boat, &Boat::boatExecutionFinished,lostState);
-
- //This transition check if we won or not
- WinTransition *winTransition = new WinTransition(scene, this, winState);
-
- //The boat has been destroyed then the game is finished
- levelState->addTransition(winTransition);
-
- //This state is an animation when the score changed
- UpdateScoreState *scoreState = new UpdateScoreState(levelState);
-
- //This transition update the score when a submarine die
- UpdateScoreTransition *scoreTransition = new UpdateScoreTransition(scene, this, levelState);
- scoreTransition->setTargetState(scoreState);
-
- //The boat has been destroyed then the game is finished
- playingState->addTransition(scoreTransition);
-
- //We go back to play state
- scoreState->addTransition(playingState);
-
- //We start playing!!!
- machine->setInitialState(levelState);
-
- //Final state
- QFinalState *finalState = new QFinalState(machine);
-
- //This transition is triggered when the player press space after completing a level
- CustomSpaceTransition *spaceTransition = new CustomSpaceTransition(scene->views().at(0), this, QEvent::KeyPress, Qt::Key_Space);
- spaceTransition->setTargetState(levelState);
- winState->addTransition(spaceTransition);
-
- //We lost we should reach the final state
- lostState->addTransition(lostState, &QState::finished, finalState);
-
- machine->start();
-}
-
-LevelState::LevelState(GraphicsScene *scene, PlayState *game, QState *parent) : QState(parent), scene(scene), game(game)
-{
-}
-void LevelState::onEntry(QEvent *)
-{
- initializeLevel();
-}
-
-void LevelState::initializeLevel()
-{
- //we re-init the boat
- scene->boat->setPos(scene->width()/2, scene->sealLevel() - scene->boat->size().height());
- scene->boat->setCurrentSpeed(0);
- scene->boat->setCurrentDirection(Boat::None);
- scene->boat->setBombsLaunched(0);
- scene->boat->show();
- scene->setFocusItem(scene->boat, Qt::OtherFocusReason);
- scene->boat->run();
-
- scene->progressItem->setScore(game->score);
- scene->progressItem->setLevel(game->currentLevel + 1);
-
- const GraphicsScene::LevelDescription currentLevelDescription = scene->levelsData.value(game->currentLevel);
- for (const QPair<int,int> &subContent : currentLevelDescription.submarines) {
-
- GraphicsScene::SubmarineDescription submarineDesc = scene->submarinesData.at(subContent.first);
-
- for (int j = 0; j < subContent.second; ++j ) {
- SubMarine *sub = new SubMarine(submarineDesc.type, submarineDesc.name, submarineDesc.points);
- scene->addItem(sub);
- int random = QRandomGenerator::global()->bounded(15) + 1;
- qreal x = random == 13 || random == 5 ? 0 : scene->width() - sub->size().width();
- qreal y = scene->height() -(QRandomGenerator::global()->bounded(150) + 1) - sub->size().height();
- sub->setPos(x,y);
- sub->setCurrentDirection(x == 0 ? SubMarine::Right : SubMarine::Left);
- sub->setCurrentSpeed(QRandomGenerator::global()->bounded(3) + 1);
- }
- }
-}
-
-/** Pause State */
-PauseState::PauseState(GraphicsScene *scene, QState *parent) : QState(parent), scene(scene)
-{
-}
-
-void PauseState::onEntry(QEvent *)
-{
- AnimationManager::self()->pauseAll();
- scene->boat->setEnabled(false);
-}
-void PauseState::onExit(QEvent *)
-{
- AnimationManager::self()->resumeAll();
- scene->boat->setEnabled(true);
- scene->boat->setFocus();
-}
-
-/** Lost State */
-LostState::LostState(GraphicsScene *scene, PlayState *game, QState *parent) : QState(parent), scene(scene), game(game)
-{
-}
-
-void LostState::onEntry(QEvent *)
-{
- //The message to display
- QString message = QString("You lose on level %1. Your score is %2.").arg(game->currentLevel+1).arg(game->score);
-
- //We set the level back to 0
- game->currentLevel = 0;
-
- //We set the score back to 0
- game->score = 0;
-
- //We clear the scene
- scene->clearScene();
-
- //We inform the player
- scene->textInformationItem->setMessage(message);
- scene->textInformationItem->show();
-}
-
-void LostState::onExit(QEvent *)
-{
- //we hide the information
- scene->textInformationItem->hide();
-}
-
-/** Win State */
-WinState::WinState(GraphicsScene *scene, PlayState *game, QState *parent) : QState(parent), scene(scene), game(game)
-{
-}
-
-void WinState::onEntry(QEvent *)
-{
- //We clear the scene
- scene->clearScene();
-
- QString message;
- if (scene->levelsData.size() - 1 != game->currentLevel) {
- message = QString("You win the level %1. Your score is %2.\nPress Space to continue.").arg(game->currentLevel+1).arg(game->score);
- //We increment the level number
- game->currentLevel++;
- } else {
- message = QString("You finish the game on level %1. Your score is %2.").arg(game->currentLevel+1).arg(game->score);
- //We set the level back to 0
- game->currentLevel = 0;
- //We set the score back to 0
- game->score = 0;
- }
-
- //We inform the player
- scene->textInformationItem->setMessage(message);
- scene->textInformationItem->show();
-}
-
-void WinState::onExit(QEvent *)
-{
- //we hide the information
- scene->textInformationItem->hide();
-}
-
-/** UpdateScore State */
-UpdateScoreState::UpdateScoreState(QState *parent) : QState(parent)
-{
-}
-
-/** Win transition */
-UpdateScoreTransition::UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target)
- : QSignalTransition(scene, &GraphicsScene::subMarineDestroyed),
- game(game), scene(scene)
-{
- setTargetState(target);
-}
-
-bool UpdateScoreTransition::eventTest(QEvent *event)
-{
- if (!QSignalTransition::eventTest(event))
- return false;
- QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(event);
- game->score += se->arguments().at(0).toInt();
- scene->progressItem->setScore(game->score);
- return true;
-}
-
-/** Win transition */
-WinTransition::WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target)
- : QSignalTransition(scene, &GraphicsScene::allSubMarineDestroyed),
- game(game), scene(scene)
-{
- setTargetState(target);
-}
-
-bool WinTransition::eventTest(QEvent *event)
-{
- if (!QSignalTransition::eventTest(event))
- return false;
- QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(event);
- game->score += se->arguments().at(0).toInt();
- scene->progressItem->setScore(game->score);
- return true;
-}
-
-/** Space transition */
-CustomSpaceTransition::CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key)
- : QKeyEventTransition(widget, type, key), game(game)
-{
-}
-
-bool CustomSpaceTransition::eventTest(QEvent *event)
-{
- if (!QKeyEventTransition::eventTest(event))
- return false;
- return (game->currentLevel != 0);
-}
diff --git a/examples/widgets/animation/sub-attaq/states.h b/examples/widgets/animation/sub-attaq/states.h
deleted file mode 100644
index b3651e1c82..0000000000
--- a/examples/widgets/animation/sub-attaq/states.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef STATES_H
-#define STATES_H
-
-//Qt
-#include <QKeyEventTransition>
-#include <QSignalTransition>
-#include <QState>
-
-class GraphicsScene;
-QT_BEGIN_NAMESPACE
-class QStateMachine;
-QT_END_NAMESPACE
-
-class PlayState : public QState
-{
-public:
- explicit PlayState(GraphicsScene *scene, QState *parent = nullptr);
- ~PlayState();
-
- protected:
- void onEntry(QEvent *) override;
-
-private :
- GraphicsScene *scene;
- QStateMachine *machine;
- int currentLevel;
- int score;
-
- friend class UpdateScoreState;
- friend class UpdateScoreTransition;
- friend class WinTransition;
- friend class CustomSpaceTransition;
- friend class WinState;
- friend class LostState;
- friend class LevelState;
-};
-
-class LevelState : public QState
-{
-public:
- LevelState(GraphicsScene *scene, PlayState *game, QState *parent = nullptr);
-protected:
- void onEntry(QEvent *) override;
-private :
- void initializeLevel();
- GraphicsScene *scene;
- PlayState *game;
-};
-
-class PauseState : public QState
-{
-public:
- explicit PauseState(GraphicsScene *scene, QState *parent = nullptr);
-
-protected:
- void onEntry(QEvent *) override;
- void onExit(QEvent *) override;
-private :
- GraphicsScene *scene;
-};
-
-class LostState : public QState
-{
-public:
- LostState(GraphicsScene *scene, PlayState *game, QState *parent = nullptr);
-
-protected:
- void onEntry(QEvent *) override;
- void onExit(QEvent *) override;
-private :
- GraphicsScene *scene;
- PlayState *game;
-};
-
-class WinState : public QState
-{
-public:
- WinState(GraphicsScene *scene, PlayState *game, QState *parent = nullptr);
-
-protected:
- void onEntry(QEvent *) override;
- void onExit(QEvent *) override;
-private :
- GraphicsScene *scene;
- PlayState *game;
-};
-
-class UpdateScoreState : public QState
-{
-public:
- UpdateScoreState(QState *parent);
-private:
-};
-
-//These transtion is used to update the score
-class UpdateScoreTransition : public QSignalTransition
-{
-public:
- UpdateScoreTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
-protected:
- bool eventTest(QEvent *event) override;
-private:
- PlayState *game;
- GraphicsScene *scene;
-};
-
-//These transtion test if we have won the game
-class WinTransition : public QSignalTransition
-{
-public:
- WinTransition(GraphicsScene *scene, PlayState *game, QAbstractState *target);
-protected:
- bool eventTest(QEvent *event) override;
-private:
- PlayState *game;
- GraphicsScene *scene;
-};
-
-//These transtion is true if one level has been completed and the player want to continue
- class CustomSpaceTransition : public QKeyEventTransition
-{
-public:
- CustomSpaceTransition(QWidget *widget, PlayState *game, QEvent::Type type, int key);
-protected:
- bool eventTest(QEvent *event) override;
-private:
- PlayState *game;
-};
-
-#endif // STATES_H
diff --git a/examples/widgets/animation/sub-attaq/sub-attaq.pro b/examples/widgets/animation/sub-attaq/sub-attaq.pro
deleted file mode 100644
index ea44253fa1..0000000000
--- a/examples/widgets/animation/sub-attaq/sub-attaq.pro
+++ /dev/null
@@ -1,33 +0,0 @@
-QT += widgets
-HEADERS += boat.h \
- bomb.h \
- mainwindow.h \
- submarine.h \
- torpedo.h \
- pixmapitem.h \
- graphicsscene.h \
- animationmanager.h \
- states.h \
- boat_p.h \
- submarine_p.h \
- qanimationstate.h \
- progressitem.h \
- textinformationitem.h
-SOURCES += boat.cpp \
- bomb.cpp \
- main.cpp \
- mainwindow.cpp \
- submarine.cpp \
- torpedo.cpp \
- pixmapitem.cpp \
- graphicsscene.cpp \
- animationmanager.cpp \
- states.cpp \
- qanimationstate.cpp \
- progressitem.cpp \
- textinformationitem.cpp
-RESOURCES += subattaq.qrc
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/animation/sub-attaq
-INSTALLS += target
diff --git a/examples/widgets/animation/sub-attaq/subattaq.qrc b/examples/widgets/animation/sub-attaq/subattaq.qrc
deleted file mode 100644
index 80a3af11cc..0000000000
--- a/examples/widgets/animation/sub-attaq/subattaq.qrc
+++ /dev/null
@@ -1,39 +0,0 @@
-<RCC>
- <qresource prefix="/" >
- <file alias="all" >pics/scalable/sub-attaq.svg</file>
- <file alias="submarine" >pics/scalable/submarine.svg</file>
- <file alias="boat" >pics/scalable/boat.svg</file>
- <file alias="torpedo" >pics/scalable/torpedo.svg</file>
- <file alias="logo-s" >pics/welcome/logo-s.png</file>
- <file alias="logo-u" >pics/welcome/logo-u.png</file>
- <file alias="logo-b" >pics/welcome/logo-b.png</file>
- <file alias="logo-dash" >pics/welcome/logo-dash.png</file>
- <file alias="logo-a" >pics/welcome/logo-a.png</file>
- <file alias="logo-t" >pics/welcome/logo-t.png</file>
- <file alias="logo-t2" >pics/welcome/logo-t2.png</file>
- <file alias="logo-a2" >pics/welcome/logo-a2.png</file>
- <file alias="logo-q" >pics/welcome/logo-q.png</file>
- <file alias="logo-excl" >pics/welcome/logo-excl.png</file>
- <file alias="big/background" >pics/big/background.png</file>
- <file alias="big/boat" >pics/big/boat.png</file>
- <file alias="big/bomb" >pics/big/bomb.png</file>
- <file alias="big/submarine" >pics/big/submarine.png</file>
- <file alias="big/surface" >pics/big/surface.png</file>
- <file alias="big/torpedo" >pics/big/torpedo.png</file>
- <file alias="small/background" >pics/small/background.png</file>
- <file alias="small/boat" >pics/small/boat.png</file>
- <file alias="small/bomb" >pics/small/bomb.png</file>
- <file alias="small/submarine" >pics/small/submarine.png</file>
- <file alias="small/surface" >pics/small/surface.png</file>
- <file alias="small/torpedo" >pics/small/torpedo.png</file>
- <file alias="big/explosion/boat/step1" >pics/big/explosion/boat/step1.png</file>
- <file alias="big/explosion/boat/step2" >pics/big/explosion/boat/step2.png</file>
- <file alias="big/explosion/boat/step3" >pics/big/explosion/boat/step3.png</file>
- <file alias="big/explosion/boat/step4" >pics/big/explosion/boat/step4.png</file>
- <file alias="big/explosion/submarine/step1" >pics/big/explosion/submarine/step1.png</file>
- <file alias="big/explosion/submarine/step2" >pics/big/explosion/submarine/step2.png</file>
- <file alias="big/explosion/submarine/step3" >pics/big/explosion/submarine/step3.png</file>
- <file alias="big/explosion/submarine/step4" >pics/big/explosion/submarine/step4.png</file>
- <file>data.xml</file>
- </qresource>
-</RCC>
diff --git a/examples/widgets/animation/sub-attaq/submarine.cpp b/examples/widgets/animation/sub-attaq/submarine.cpp
deleted file mode 100644
index a4ca376045..0000000000
--- a/examples/widgets/animation/sub-attaq/submarine.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Own
-#include "submarine.h"
-#include "submarine_p.h"
-#include "torpedo.h"
-#include "graphicsscene.h"
-#include "animationmanager.h"
-#include "qanimationstate.h"
-
-#include <QFinalState>
-#include <QPropertyAnimation>
-#include <QStateMachine>
-#include <QSequentialAnimationGroup>
-
-static QAbstractAnimation *setupDestroyAnimation(SubMarine *sub)
-{
- QSequentialAnimationGroup *group = new QSequentialAnimationGroup(sub);
- for (int i = 1; i <= 4; ++i) {
- PixmapItem *step = new PixmapItem(QString::fromLatin1("explosion/submarine/step%1").arg(i), GraphicsScene::Big, sub);
- step->setZValue(6);
- step->setOpacity(0);
- QPropertyAnimation *anim = new QPropertyAnimation(step, "opacity", group);
- anim->setDuration(100);
- anim->setEndValue(1);
- }
- AnimationManager::self()->registerAnimation(group);
- return group;
-}
-
-
-SubMarine::SubMarine(int type, const QString &name, int points) : PixmapItem(QString("submarine"), GraphicsScene::Big),
- subType(type), subName(name), subPoints(points), speed(0), direction(SubMarine::None)
-{
- setZValue(5);
- setTransformOriginPoint(boundingRect().center());
-
- graphicsRotation = new QGraphicsRotation(this);
- graphicsRotation->setAxis(Qt::YAxis);
- graphicsRotation->setOrigin(QVector3D(size().width() / 2, size().height() / 2, 0));
- QList<QGraphicsTransform *> r({graphicsRotation});
- setTransformations(r);
-
- //We setup the state machine of the submarine
- QStateMachine *machine = new QStateMachine(this);
-
- //This state is when the boat is moving/rotating
- QState *moving = new QState(machine);
-
- //This state is when the boat is moving from left to right
- MovementState *movement = new MovementState(this, moving);
-
- //This state is when the boat is moving from left to right
- ReturnState *rotation = new ReturnState(this, moving);
-
- //This is the initial state of the moving root state
- moving->setInitialState(movement);
-
- movement->addTransition(this, &SubMarine::subMarineStateChanged, moving);
-
- //This is the initial state of the machine
- machine->setInitialState(moving);
-
- //End
- QFinalState *finalState = new QFinalState(machine);
-
- //If the moving animation is finished we move to the return state
- movement->addTransition(movement, &QAnimationState::animationFinished, rotation);
-
- //If the return animation is finished we move to the moving state
- rotation->addTransition(rotation, &QAnimationState::animationFinished, movement);
-
- //This state play the destroyed animation
- QAnimationState *destroyedState = new QAnimationState(machine);
- destroyedState->setAnimation(setupDestroyAnimation(this));
-
- //Play a nice animation when the submarine is destroyed
- moving->addTransition(this, &SubMarine::subMarineDestroyed, destroyedState);
-
- //Transition to final state when the destroyed animation is finished
- destroyedState->addTransition(destroyedState, &QAnimationState::animationFinished, finalState);
-
- //The machine has finished to be executed, then the submarine is dead
- connect(machine,&QState::finished,this, &SubMarine::subMarineExecutionFinished);
-
- machine->start();
-}
-
-int SubMarine::points() const
-{
- return subPoints;
-}
-
-void SubMarine::setCurrentDirection(SubMarine::Movement direction)
-{
- if (this->direction == direction)
- return;
- if (direction == SubMarine::Right && this->direction == SubMarine::None)
- graphicsRotation->setAngle(180);
- this->direction = direction;
-}
-
-enum SubMarine::Movement SubMarine::currentDirection() const
-{
- return direction;
-}
-
-void SubMarine::setCurrentSpeed(int speed)
-{
- if (speed < 0 || speed > 3)
- qWarning("SubMarine::setCurrentSpeed : The speed is invalid");
- this->speed = speed;
- emit subMarineStateChanged();
-}
-
-int SubMarine::currentSpeed() const
-{
- return speed;
-}
-
-void SubMarine::launchTorpedo(int speed)
-{
- Torpedo *torp = new Torpedo;
- GraphicsScene *scene = static_cast<GraphicsScene *>(this->scene());
- scene->addItem(torp);
- torp->setPos(pos());
- torp->setCurrentSpeed(speed);
- torp->launch();
-}
-
-void SubMarine::destroy()
-{
- emit subMarineDestroyed();
-}
-
-int SubMarine::type() const
-{
- return Type;
-}
diff --git a/examples/widgets/animation/sub-attaq/submarine.h b/examples/widgets/animation/sub-attaq/submarine.h
deleted file mode 100644
index 256683ec70..0000000000
--- a/examples/widgets/animation/sub-attaq/submarine.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SUBMARINE_H
-#define SUBMARINE_H
-
-#include "pixmapitem.h"
-
-#include <QGraphicsRotation>
-
-class SubMarine : public PixmapItem
-{
-Q_OBJECT
-public:
- enum Movement {
- None = 0,
- Left,
- Right
- };
- enum { Type = UserType + 1 };
- SubMarine(int type, const QString &name, int points);
-
- int points() const;
-
- void setCurrentDirection(Movement direction);
- enum Movement currentDirection() const;
-
- void setCurrentSpeed(int speed);
- int currentSpeed() const;
-
- void launchTorpedo(int speed);
- void destroy();
-
- int type() const override;
-
- QGraphicsRotation *rotation() const { return graphicsRotation; }
-
-signals:
- void subMarineDestroyed();
- void subMarineExecutionFinished();
- void subMarineStateChanged();
-
-private:
- int subType;
- QString subName;
- int subPoints;
- int speed;
- Movement direction;
- QGraphicsRotation *graphicsRotation;
-};
-
-#endif // SUBMARINE_H
diff --git a/examples/widgets/animation/sub-attaq/submarine_p.h b/examples/widgets/animation/sub-attaq/submarine_p.h
deleted file mode 100644
index 36807dade3..0000000000
--- a/examples/widgets/animation/sub-attaq/submarine_p.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SUBMARINE_P_H
-#define SUBMARINE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-//Own
-#include "animationmanager.h"
-#include "submarine.h"
-#include "qanimationstate.h"
-
-//Qt
-#include <QPropertyAnimation>
-#include <QRandomGenerator>
-
-//This state is describing when the boat is moving right
-class MovementState : public QAnimationState
-{
-Q_OBJECT
-public:
- explicit MovementState(SubMarine *submarine, QState *parent = nullptr) : QAnimationState(parent)
- {
- movementAnimation = new QPropertyAnimation(submarine, "pos");
- connect(movementAnimation, &QPropertyAnimation::valueChanged,
- this, &MovementState::onAnimationMovementValueChanged);
- setAnimation(movementAnimation);
- AnimationManager::self()->registerAnimation(movementAnimation);
- this->submarine = submarine;
- }
-
-protected slots:
- void onAnimationMovementValueChanged(const QVariant &)
- {
- if (QRandomGenerator::global()->bounded(200) + 1 == 3)
- submarine->launchTorpedo(QRandomGenerator::global()->bounded(3) + 1);
- }
-
-protected:
- void onEntry(QEvent *e) override
- {
- if (submarine->currentDirection() == SubMarine::Left) {
- movementAnimation->setEndValue(QPointF(0,submarine->y()));
- movementAnimation->setDuration(submarine->x()/submarine->currentSpeed()*12);
- }
- else /*if (submarine->currentDirection() == SubMarine::Right)*/ {
- movementAnimation->setEndValue(QPointF(submarine->scene()->width()-submarine->size().width(),submarine->y()));
- movementAnimation->setDuration((submarine->scene()->width()-submarine->size().width()-submarine->x())/submarine->currentSpeed()*12);
- }
- QAnimationState::onEntry(e);
- }
-
-private:
- SubMarine *submarine;
- QPropertyAnimation *movementAnimation;
-};
-
-//This state is describing when the boat is moving right
-class ReturnState : public QAnimationState
-{
-public:
- explicit ReturnState(SubMarine *submarine, QState *parent = nullptr) : QAnimationState(parent)
- {
- returnAnimation = new QPropertyAnimation(submarine->rotation(), "angle");
- returnAnimation->setDuration(500);
- AnimationManager::self()->registerAnimation(returnAnimation);
- setAnimation(returnAnimation);
- this->submarine = submarine;
- }
-
-protected:
- void onEntry(QEvent *e) override
- {
- returnAnimation->stop();
- returnAnimation->setEndValue(submarine->currentDirection() == SubMarine::Right ? 360. : 180.);
- QAnimationState::onEntry(e);
- }
-
- void onExit(QEvent *e) override
- {
- submarine->currentDirection() == SubMarine::Right ? submarine->setCurrentDirection(SubMarine::Left) : submarine->setCurrentDirection(SubMarine::Right);
- QAnimationState::onExit(e);
- }
-
-private:
- SubMarine *submarine;
- QPropertyAnimation *returnAnimation;
-};
-
-#endif // SUBMARINE_P_H
diff --git a/examples/widgets/animation/sub-attaq/textinformationitem.cpp b/examples/widgets/animation/sub-attaq/textinformationitem.cpp
deleted file mode 100644
index 4d4934f63d..0000000000
--- a/examples/widgets/animation/sub-attaq/textinformationitem.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "textinformationitem.h"
-#include "pixmapitem.h"
-
-TextInformationItem::TextInformationItem (QGraphicsItem *parent)
- : QGraphicsTextItem(parent)
-{
- setFont(QFont("Comic Sans MS", 15));
-}
-
-void TextInformationItem::setMessage(const QString &text)
-{
- setHtml(text);
- setPos(parentItem()->boundingRect().center().x() - boundingRect().size().width() / 2,
- parentItem()->boundingRect().center().y());
-}
diff --git a/examples/widgets/animation/sub-attaq/textinformationitem.h b/examples/widgets/animation/sub-attaq/textinformationitem.h
deleted file mode 100644
index 0a0b618460..0000000000
--- a/examples/widgets/animation/sub-attaq/textinformationitem.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TEXTINFORMATIONITEM_H
-#define TEXTINFORMATIONITEM_H
-
-//Qt
-#include <QGraphicsTextItem>
-
-class TextInformationItem : public QGraphicsTextItem
-{
-public:
- TextInformationItem(QGraphicsItem *parent = nullptr);
- void setMessage(const QString &text);
-};
-
-#endif // TEXTINFORMATIONITEM_H
diff --git a/examples/widgets/animation/sub-attaq/torpedo.cpp b/examples/widgets/animation/sub-attaq/torpedo.cpp
deleted file mode 100644
index 7395aa39ac..0000000000
--- a/examples/widgets/animation/sub-attaq/torpedo.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//Own
-#include "torpedo.h"
-#include "boat.h"
-#include "graphicsscene.h"
-#include "animationmanager.h"
-#include "qanimationstate.h"
-
-#include <QPropertyAnimation>
-#include <QStateMachine>
-#include <QFinalState>
-
-Torpedo::Torpedo() : PixmapItem(QString::fromLatin1("torpedo"),GraphicsScene::Big),
- currentSpeed(0)
-{
- setZValue(2);
-}
-
-void Torpedo::launch()
-{
- QPropertyAnimation *launchAnimation = new QPropertyAnimation(this, "pos");
- AnimationManager::self()->registerAnimation(launchAnimation);
- launchAnimation->setEndValue(QPointF(x(), qobject_cast<GraphicsScene *>(scene())->sealLevel() - 15));
- launchAnimation->setEasingCurve(QEasingCurve::InQuad);
- launchAnimation->setDuration(y() / currentSpeed * 10);
- connect(launchAnimation, &QVariantAnimation::valueChanged, this, &Torpedo::onAnimationLaunchValueChanged);
- connect(this, &Torpedo::torpedoExploded, launchAnimation, &QAbstractAnimation::stop);
-
- //We setup the state machine of the torpedo
- QStateMachine *machine = new QStateMachine(this);
-
- //This state is when the launch animation is playing
- QAnimationState *launched = new QAnimationState(machine);
- launched->setAnimation(launchAnimation);
-
- //End
- QFinalState *finalState = new QFinalState(machine);
-
- machine->setInitialState(launched);
-
- //### Add a nice animation when the torpedo is destroyed
- launched->addTransition(this, &Torpedo::torpedoExploded, finalState);
-
- //If the animation is finished, then we move to the final state
- launched->addTransition(launched, &QAnimationState::animationFinished, finalState);
-
- //The machine has finished to be executed, then the boat is dead
- connect(machine, &QState::finished, this, &Torpedo::torpedoExecutionFinished);
-
- machine->start();
-}
-
-void Torpedo::setCurrentSpeed(int speed)
-{
- if (speed < 0) {
- qWarning("Torpedo::setCurrentSpeed : The speed is invalid");
- return;
- }
- currentSpeed = speed;
-}
-
-void Torpedo::onAnimationLaunchValueChanged(const QVariant &)
-{
- const QList<QGraphicsItem *> colItems =
- collidingItems(Qt::IntersectsItemBoundingRect);
- for (QGraphicsItem *item : colItems) {
- if (Boat *b = qgraphicsitem_cast<Boat*>(item))
- b->destroy();
- }
-}
-
-void Torpedo::destroy()
-{
- emit torpedoExploded();
-}
diff --git a/examples/widgets/animation/sub-attaq/torpedo.h b/examples/widgets/animation/sub-attaq/torpedo.h
deleted file mode 100644
index 7ac853d4e9..0000000000
--- a/examples/widgets/animation/sub-attaq/torpedo.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TORPEDO_H
-#define TORPEDO_H
-
-#include "pixmapitem.h"
-
-class Torpedo : public PixmapItem
-{
-Q_OBJECT
-public:
- Torpedo();
- void launch();
- void setCurrentSpeed(int speed);
- void destroy();
-
-signals:
- void torpedoExploded();
- void torpedoExecutionFinished();
-
-private slots:
- void onAnimationLaunchValueChanged(const QVariant &);
-
-private:
- int currentSpeed;
-};
-
-#endif // TORPEDO_H
diff --git a/examples/widgets/doc/images/factorial-example.png b/examples/widgets/doc/images/factorial-example.png
deleted file mode 100644
index 8fb1cc6925..0000000000
--- a/examples/widgets/doc/images/factorial-example.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/doc/images/pingpong-example.png b/examples/widgets/doc/images/pingpong-example.png
deleted file mode 100644
index af707e4633..0000000000
--- a/examples/widgets/doc/images/pingpong-example.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/doc/images/trafficlight-example1.png b/examples/widgets/doc/images/trafficlight-example1.png
deleted file mode 100644
index ec8c7ffedc..0000000000
--- a/examples/widgets/doc/images/trafficlight-example1.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/doc/images/trafficlight-example2.png b/examples/widgets/doc/images/trafficlight-example2.png
deleted file mode 100644
index a12e4db03e..0000000000
--- a/examples/widgets/doc/images/trafficlight-example2.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/doc/src/animatedtiles.qdoc b/examples/widgets/doc/src/animatedtiles.qdoc
deleted file mode 100644
index 9f1d912b0d..0000000000
--- a/examples/widgets/doc/src/animatedtiles.qdoc
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example animation/animatedtiles
- \title Animated Tiles Example
-
- \brief The Animated Tiles example animates items in a graphics scene.
-
- \image animatedtiles-example.png
-*/
-
diff --git a/examples/widgets/doc/src/eventtransitions.qdoc b/examples/widgets/doc/src/eventtransitions.qdoc
deleted file mode 100644
index e74831b14b..0000000000
--- a/examples/widgets/doc/src/eventtransitions.qdoc
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example statemachine/eventtransitions
- \title Event Transitions Example
-
- \brief The Event Transitions example shows how to use event transitions,
- a feature of \l{The State Machine Framework}.
-
- The Event Transitions Example illustrates how states change when a
- user enters or leaves the area of a button. The states are handled by
- a QStateMachine object. The screen consists of a QVBoxLayout with a
- central button.
-
- When the mouse is outside the button, the text in the button displays
- "Outside". When the mouse enters the button, it displays "Inside".
-
- \borderedimage transitions.png
-
- \snippet statemachine/eventtransitions/main.cpp 0
-
- The \c Window class's constructors begins by creating a button.
- This button is added to \c layout, which is a QVBoxLayout object.
- Then two states are created: \c s1 is the state
- "Outside", and \c s2 is the state "Inside".
-
- \snippet statemachine/eventtransitions/main.cpp 1
-
- State \c s1 is the state "Outside" and state \c s2 is state "Inside".
-
- \snippet statemachine/eventtransitions/main.cpp 2
-
- When the button receives an event of type QEvent::Enter and the state
- machine is in state \c s1, the machine will transition to state \c s2.
-
- \snippet statemachine/eventtransitions/main.cpp 3
-
- When the button receives an event of type QEvent::Leave and the state
- machine is in state \c s2, the machine will transition back to state \c
- s1.
-
- \snippet statemachine/eventtransitions/main.cpp 4
-
- Next, state \c s3 is created. \c s3 will be entered when the button
- receives an event of type QEvent::MouseButtonPress and the state machine
- is in state \c s2. When the button receives an event of type
- QEvent::MouseButtonRelease and the state machine is in state \c s3, the
- machine will revert to state \c s2.
-
- \snippet statemachine/eventtransitions/main.cpp 5
-
- Finally, the states are added to the machine as top-level states, the
- initial state is set to be \c s1 ("Outside"), and the machine is started.
-
- \snippet statemachine/eventtransitions/main.cpp 6
-
- The main() function constructs a Window object that displays the QVBoxLayout
- object \c layout with its \c button.
-
-*/
diff --git a/examples/widgets/doc/src/factorial.qdoc b/examples/widgets/doc/src/factorial.qdoc
deleted file mode 100644
index a0ace96cd3..0000000000
--- a/examples/widgets/doc/src/factorial.qdoc
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example statemachine/factorial
- \title Factorial States Example
-
- \brief The Factorial States example shows how to use \l{The State Machine
- Framework} to calculate the factorial of an integer.
-
- The statechart for calculating the factorial looks as follows:
-
- \image factorial-example.png
- \omit
- \caption This is a caption
- \endomit
-
- In other words, the state machine calculates the factorial of 6 and prints
- the result.
-
- \snippet statemachine/factorial/main.cpp 0
-
- The Factorial class is used to hold the data of the computation, \c x and
- \c fac. It also provides a signal that's emitted whenever the value of \c
- x changes.
-
- \snippet statemachine/factorial/main.cpp 1
-
- The FactorialLoopTransition class implements the guard (\c x > 1) and
- calculations (\c fac = \c x * \c fac; \c x = \c x - 1) of the factorial
- loop.
-
- \snippet statemachine/factorial/main.cpp 2
-
- The FactorialDoneTransition class implements the guard (\c x <= 1) that
- terminates the factorial computation. It also prints the final result to
- standard output.
-
- \snippet statemachine/factorial/main.cpp 3
-
- The application's main() function first creates the application object, a
- Factorial object and a state machine.
-
- \snippet statemachine/factorial/main.cpp 4
-
- The \c compute state is created, and the initial values of \c x and \c fac
- are defined. A FactorialLoopTransition object is created and added to the
- state.
-
- \snippet statemachine/factorial/main.cpp 5
-
- A final state, \c done, is created, and a FactorialDoneTransition object
- is created with \c done as its target state. The transition is then added
- to the \c compute state.
-
- \snippet statemachine/factorial/main.cpp 6
-
- The machine's initial state is set to be the \c compute state. We connect
- the QStateMachine::finished() signal to the QCoreApplication::quit() slot,
- so the application will quit when the state machine's work is
- done. Finally, the state machine is started, and the application's event
- loop is entered.
-
- */
diff --git a/examples/widgets/doc/src/moveblocks.qdoc b/examples/widgets/doc/src/moveblocks.qdoc
deleted file mode 100644
index 64045f1c4f..0000000000
--- a/examples/widgets/doc/src/moveblocks.qdoc
+++ /dev/null
@@ -1,214 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example animation/moveblocks
- \title Move Blocks Example
-
- \brief The Move Blocks example shows how to animate items in a
- QGraphicsScene using a QStateMachine with a custom transition.
-
- \image moveblocks-example.png
-
- The example animates the blue blocks that you can see in the image
- above. The animation moves the blocks between four preset positions.
-
- The example consists of the following classes:
-
- \list
- \li \c StateSwitcher inherits QState and can add
- \c {StateSwitchTransition}s to other states.
- When entered, it will randomly transition to one of these
- states.
- \li \c StateSwitchTransition is a custom transition that
- triggers on \c{StateSwitchEvent}s.
- \li \c StateSwitchEvent is a QEvent that triggers \c{StateSwitchTransition}s.
- \li \c QGraphicsRectWidget is a QGraphicsWidget that simply
- paints its background in a solid \l{Qt::}{blue} color.
- \endlist
-
- The blocks are instances of \c QGraphicsRectWidget and are
- animated in a QGraphicsScene. We do this by building a state
- graph, which we insert animations into. The graph is then executed
- in a QStateMachine. All this is done in \c main().
- Let's look at the \c main() function first.
-
- \section1 The \c main() Function
-
- After QApplication has been initialized, we set up the
- QGraphicsScene with its \c{QGraphicsRectWidget}s.
-
- \snippet animation/moveblocks/main.cpp 1
-
- After adding the scene to a QGraphicsView, it is time to build the
- state graph. Let's first look at a statechart of what we are
- trying to build.
-
- \image move-blocks-chart.png
-
- Note that the \c group has seven sub states, but we have only
- included three of them in the diagram. The code that builds this
- graph will be examined line-by-line, and will show how the graph
- works. First off, we construct the \c group state:
-
- \snippet animation/moveblocks/main.cpp 2
-
- The timer is used to add a delay between each time the blocks are
- moved. The timer is started when \c group is entered. As we will
- see later, \c group has a transition back to the \c StateSwitcher
- when the timer times out. \c group is the initial state in the
- machine, so an animation will be scheduled when the example is
- started.
-
- \snippet animation/moveblocks/main.cpp 3
- \dots
- \snippet animation/moveblocks/main.cpp 4
-
- \c createGeometryState() returns a QState that will set the
- geometry of our items upon entry. It also assigns \c group as the
- parent of this state.
-
- A QPropertyAnimation inserted into a transition will use the
- values assigned to a QState (with QState::assignProperty()), i.e.,
- the animation will interpolate between the current values of the
- properties and the values in the target state. We add animated
- transitions to the state graph later.
-
- \snippet animation/moveblocks/main.cpp 5
-
- We move the items in parallel. Each item is added to \c
- animationGroup, which is the animation that is inserted into the
- transitions.
-
- \snippet animation/moveblocks/main.cpp 6
-
- The sequential animation group, \c subGroup, helps us insert a
- delay between the animation of each item.
-
- \snippet animation/moveblocks/main.cpp 7
- \dots
- \snippet animation/moveblocks/main.cpp 8
-
- A StateSwitchTransition is added to the state switcher
- in \c StateSwitcher::addState(). We also add the animation in this
- function. Since QPropertyAnimation uses the values from the
- states, we can insert the same QPropertyAnimation instance in all
- \c {StateSwitchTransition}s.
-
- As mentioned previously, we add a transition to the state switcher
- that triggers when the timer times out.
-
- \snippet animation/moveblocks/main.cpp 9
-
- Finally, we can create the state machine, add our initial state,
- and start execution of the state graph.
-
- \section2 The \c createGeometryState() Function
-
- In \c createGeometryState(), we set up the geometry for each
- graphics item.
-
- \snippet animation/moveblocks/main.cpp 13
-
- As mentioned before, QAbstractTransition will set up an animation
- added with \l{QAbstractTransition::}{addAnimation()} using
- property values set with \l{QState::}{assignProperty()}.
-
- \section1 The StateSwitcher Class
-
- \c StateSwitcher has state switch transitions to each \l{QState}s
- we created with \c createGeometryState(). Its job is to transition
- to one of these states at random when it is entered.
-
- All functions in \c StateSwitcher are inlined. We'll step through
- its definition.
-
- \snippet animation/moveblocks/main.cpp 10
-
- \c StateSwitcher is a state designed for a particular purpose and
- will always be a top-level state. We use \c m_stateCount to keep
- track of how many states we are managing, and \c m_lastIndex to
- remember which state was the last state to which we transitioned.
-
- \snippet animation/moveblocks/main.cpp 11
-
- We select the next state we are going to transition to, and post a
- \c StateSwitchEvent, which we know will trigger the \c
- StateSwitchTransition to the selected state.
-
- \snippet animation/moveblocks/main.cpp 12
-
- This is where the magic happens. We assign a number to each state
- added. This number is given to both a StateSwitchTransition and to
- StateSwitchEvents. As we have seen, state switch events will
- trigger a transition with the same number.
-
- \section1 The StateSwitchTransition Class
-
- \c StateSwitchTransition inherits QAbstractTransition and triggers
- on \c{StateSwitchEvent}s. It contains only inline functions, so
- let's take a look at its \l{QAbstractTransition::}{eventTest()}
- function, which is the only function that we define..
-
- \snippet animation/moveblocks/main.cpp 14
-
- \c eventTest is called by QStateMachine when it checks whether a
- transition should be triggered--a return value of true means that
- it will. We simply check if our assigned number is equal to the
- event's number (in which case we fire away).
-
- \section1 The StateSwitchEvent Class
-
- \c StateSwitchEvent inherits QEvent, and holds a number that has
- been assigned to a state and state switch transition by
- \c StateSwitcher. We have already seen how it is used to trigger
- \c{StateSwitchTransition}s in \c StateSwitcher.
-
- \snippet animation/moveblocks/main.cpp 15
-
- We only have inlined functions in this class, so a look at its
- definition will do.
-
- \section1 The QGraphicsRectWidget Class
-
- QGraphicsRectWidget inherits QGraphicsWidget and simply paints its
- \l{QWidget::}{rect()} blue. We inline \l{QWidget::}{paintEvent()},
- which is the only function we define. Here is the
- QGraphicsRectWidget class definition:
-
- \snippet animation/moveblocks/main.cpp 16
-
- \section1 Moving On
-
- The technique shown in this example works equally well for all
- \l{QPropertyAnimation}s. As long as the value to be animated is a
- Qt property, you can insert an animation of it into a state graph.
-
- QState::addAnimation() takes a QAbstractAnimation, so any type
- of animation can be inserted into the graph.
-*/
-
diff --git a/examples/widgets/doc/src/padnavigator.qdoc b/examples/widgets/doc/src/padnavigator.qdoc
deleted file mode 100644
index 31440b650f..0000000000
--- a/examples/widgets/doc/src/padnavigator.qdoc
+++ /dev/null
@@ -1,586 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example graphicsview/padnavigator
- \title Pad Navigator Example
- \ingroup examples-graphicsview
- \brief Demonstrates how to create animated user interface.
-
- The Pad Navigator Example shows how you can use Graphics View together with
- embedded widgets and Qt's \l{The State Machine Framework}{state machine
- framework} to create a simple but useful, dynamic, animated user interface.
-
- \image padnavigator-example.png
-
- The interface consists of a flippable, rotating pad with icons that can be
- selected using the arrow keys on your keyboard or keypad. Pressing enter
- will flip the pad around and reveal its back side, which has a form
- embedded into a QGraphicsProxyWidget. You can interact with the form, and
- press the enter key to flip back to the front side of the pad at any time.
-
- Graphics View provides the QGraphicsScene class for managing and
- interacting with a large number of custom-made 2D graphical items derived
- from the QGraphicsItem class, and a QGraphicsView widget for visualizing
- the items, with support for zooming and rotation.
-
- This example consists of a \c RoundRectItem class, a \c FlippablePad class,
- a \c PadNavigator class, a \c SplashItem class, and a \c main() function.
-
- \section1 RoundRectItem Class Definition
-
- The \c RoundRectItem class is used by itself to display the icons on the
- pad, and as a base class for \c FlippablePad, the class for the pad itself.
- The role of the class is to paint a round rectangle of a specified size and
- gradient color, and optionally to paint a pixmap icon on top. To support \c
- FlippablePad it also allows filling its contents with a plain window
- background color.
-
- Let's start by reviewing the \c RoundRectItem class declaration.
-
- \snippet graphicsview/padnavigator/roundrectitem.h 0
-
- \c RoundRectItem inherits QGraphicsObject, which makes it easy to control
- its properties using QPropertyAnimation. Its constructor takes a rectangle
- to determine its bounds, and a color.
-
- Besides implementing the mandatory \l{QGraphicsItem::paint()}{paint()} and
- \l{QGraphicsItem::boundingRect()}{boundingRect()} pure virtual functions,
- it also provides the \c pixmap and \c fill properties.
-
- The \c pixmap property sets an optional pixmap that is drawn on top of the
- round rectangle. The \c fill property will, when true, fill the round
- rectangle contents with a fixed QPalette::Window background color.
- Otherwise the contents are filled using a gradient based on the color
- passed to \c RoundRectItem's constructor.
-
- \snippet graphicsview/padnavigator/roundrectitem.h 1
-
- The private data members are:
-
- \list
- \li \c pix: The optional pixmap that is drawn on top of the rectangle.
- \li \c fillRect: Corresponds to the \c fill property.
- \li \c color: The configurable gradient color fill of the rectangle.
- \li \c bounds: The bounds of the rectangle.
- \li \c gradient: A precalculated gradient used to fill the rectangle.
- \endlist
-
- We will now review the \c RoundRectItem implementation. Let's start by
- looking at its constructor:
-
- \snippet graphicsview/padnavigator/roundrectitem.cpp 0
-
- The constructor initializes its member variables and forwards the \c parent
- argument to QGraphicsObject's constructor. It then constructs the linear
- gradient that is used in \l{QGraphicsItem::paint()}{paint()} to draw the
- round rectangle's gradient background. The linear gradient's starting point
- is at the top-left corner of the bounds, and the end is at the bottom-left
- corner. The start color is identical to the color passed as an argument,
- and a slightly darker color is chosen for the final stop.
-
- We store this gradient as a member variable to avoid having to recreate the
- gradient every time the item is repainted.
-
- Finally we set the cache mode
- \l{QGraphicsItem::ItemCoordinateCache}{ItemCoordinateCache}. This mode
- causes the item's rendering to be cached into an off-screen pixmap that
- remains persistent as we move and transform the item. This mode is ideal
- for this example, and works particularly well with OpenGL and OpenGL ES.
-
- \snippet graphicsview/padnavigator/roundrectitem.cpp 1
-
- The \c pixmap property implementation simple returns the member pixmap, or
- sets it and then calls \l{QGraphicsItem::update()}{update()}.
-
- \snippet graphicsview/padnavigator/roundrectitem.cpp 2
-
- As the \l{QGraphicsItem::paint()}{paint()} implementation below draws a
- simple drop shadow down and to the right of the item, we return a slightly
- adjusted rectangle from \l{QGraphicsItem::boundingRect()}{boundingRect()}.
-
- \snippet graphicsview/padnavigator/roundrectitem.cpp 3
-
- The \l{QGraphicsItem::paint()}{paint()} implementation starts by rendering
- a semi transparent black round rectangle drop shadow, two units down and to
- the right of the main item.
-
- \snippet graphicsview/padnavigator/roundrectitem.cpp 4
-
- We then draw the "foreground" round rectangle itself. The fill depends on
- the \c fill property; if true, we will with a plain QPalette::Window color.
- We get the current brush from QApplication::palette(). We assign a single
- unit wide pen for the stroke, assign the brush, and then draw the
- rectangle.
-
- \snippet graphicsview/padnavigator/roundrectitem.cpp 5
-
- If a pixmap has been assigned to the \e pixmap property, we draw this
- pixmap in the center of the rectangle item. The pixmaps are scaled to match
- the size of the icons; in arguably a better approach would have been to
- store the icons with the right size in the first places.
-
- \snippet graphicsview/padnavigator/roundrectitem.cpp 6
-
- Finally, for completeness we include the \c fill property implementation.
- It returns the \c fill member variable's value, and when assigned to, it
- calls \l{QGraphicsItem::update()}{update()}.
-
- As mentioned already, \c RoundRectItem is the base class for \c
- FlippablePad, which is the class representing the tilting pad itself. We
- will proceed to reviewing \c FlippablePad.
-
- \section1 FlippablePad Class Definition
-
- \c FlippablePad is, in addition to its inherited \c RoundRectItem
- responsibilities, responsible for creating and managing a grid of icons.
-
- \snippet graphicsview/padnavigator/flippablepad.h 0
-
- Its declaration is very simple: It inherits \c RoundRectItem and does not
- need any special polymorphic behavior. It's suitable to declare its own
- constructor, and a getter-function that allows \c PadNavigator to access
- the icons in the grid by (row, column).
-
- The example has no "real" behavior or logic of any kind, and because of
- that, the icons do not need to provide any \e behavior or special
- interactions management. In a real application, however, it would be
- natural for the \c FlippablePad and its icons to handle more of the
- navigation logic. In this example, we have chosen to leave this to
- the \c PadNavigator class, which we will get back to below.
-
- We will now review the \c FlippablePad implementation. This implementation
- starts with two helper functions: \c boundsFromSize() and \c
- posForLocation():
-
- \snippet graphicsview/padnavigator/flippablepad.cpp 0
-
- \c boundsForSize() takes a QSize argument, and returns the bounding
- rectangle of the flippable pad item. The QSize determines how many rows and
- columns the icon grid should have. Each icon is given 150x150 units of
- space, and this determines the bounds.
-
- \snippet graphicsview/padnavigator/flippablepad.cpp 1
-
- \c posForLocation() returns the position of an icon given its row and
- column position. Like \c boundsForSize(), the function assumes each icon is
- given 150x150 units of space, and that all icons are centered around the
- flippable pad item's origin (0, 0).
-
- \snippet graphicsview/padnavigator/flippablepad.cpp 2
-
- The \c FlippablePad constructor passes suitable bounds (using \c
- boundsForSize()) and specific color to \c RoundRectItem's constructor.
-
- \snippet graphicsview/padnavigator/flippablepad.cpp 3
-
- It then loads pixmaps from compiled-in resources to use for its icons.
- QDirIterator is very useful in this context, as it allows us to fetch all
- resource "*.png" files inside the \c :/images directory without explicitly
- naming the files.
-
- We also make sure not to load more pixmaps than we need.
-
- \snippet graphicsview/padnavigator/flippablepad.cpp 4
-
- Now that we have the pixmaps, we can create icons, position then and assign
- pixmaps. We start by finding a suitable size and color for the icons, and
- initializing a convenient grid structure for storing the icons. This \c
- iconGrid is also used later to find the icon for a specific (column, row)
- location.
-
- For each row and column in our grid, we proceed to constructing each icon
- as an instance of \c RoundRectItem. The item is placed by using the \c
- posForLocation() helper function. To make room for the slip-behind
- selection item, we give each icon a \l{QGraphicsItem::zValue()}{Z-value} of
- 1. The pixmaps are distributed to the icons in round-robin fasion.
-
- Again, this approach is only suitable for example purposes. In a real-life
- application where each icon represents a specific action, it would be more
- natural to assign the pixmaps directly, or that the icons themselves
- provide suitable pixmaps.
-
- \snippet graphicsview/padnavigator/flippablepad.cpp 5
-
- Finally, the \c iconAt() function returns a pointer to the icon at a
- specific row and column. It makes a somewhat bold assumption that the input
- is valid, which is fair because the \c PadNavigator class only calls this
- function with correct input.
-
- We will now review the \c SplashItem class.
-
- \section1 SplashItem Class Definition
-
- The \c SplashItem class represents the "splash window", a semitransparent
- white overlay with text that appears immediately after the application has
- started, and disappears after pressing any key. The animation is controlled
- by \c PadNavigator; this class is very simple by itself.
-
- \snippet graphicsview/padnavigator/splashitem.h 0
-
- The class declaration shows that \c SplashItem inherits QGraphicsObject to
- allow it to be controlled by QPropertyAnimation. It reimplements the
- mandatory \l{QGraphicsItem::paint()}{paint()} and
- \l{QGraphicsItem::boundingRect()}{boundingRect()} pure virtual functions,
- and keeps a \c text member variable which will contain the information text
- displayed on this splash item.
-
- Let's look at its implementation.
-
- \snippet graphicsview/padnavigator/splashitem.cpp 0
-
- The constructor forwards to QGraphicsObject as expected, assigns a text
- message to the \c text member variable, and enables
- \l{QGraphicsItem::DeviceCoordinateCache}{DeviceCoordinateCache}. This cache
- mode is suitable because the splash item only moves and is never
- transformed, and because it contains text, it's important that it has a
- pixel perfect visual appearance (in constrast to
- \l{QGraphicsItem::ItemCoordinateCache}{ItemCoordinateCache}, where the
- visual appearance is not as good).
-
- We use caching to avoid having to relayout and rerender the text for each
- frame. An alterative approach would be to use the new QStaticText class.
-
- \snippet graphicsview/padnavigator/splashitem.cpp 1
-
- \c SplashItem's bounding rectangle is fixed at (400x175).
-
- \snippet graphicsview/padnavigator/splashitem.cpp 2
-
- The \l{QGraphicsItem::paint()}{paint()} implementation draws a clipped
- round rectangle with a thick 2-unit border and a semi-transparent white
- background. It proceeds to finding a suitable text area by adjusting the
- splash item's bounding rectangle with 10 units in each side. The text is
- rendered inside this rectangle, with top-left alignment, and with word
- wrapping enabled.
-
- The main class now remains. We will proceed to reviewing \c PadNavigator.
-
- \section1 PadNavigator Class Definition
-
- \c PadNavigator represents the main window of our Pad Navigator Example
- application. It creates and controls a somewhat complex state machine, and
- several animations. Its class declaration is very simple:
-
- \snippet graphicsview/padnavigator/padnavigator.h 0
-
- It inherits QGraphicsView and reimplements only one function:
- \l{QGraphicsView::resizeEvent()}{resizeEvent()}, to ensure the scene is
- scaled to fit inside the view when resizing the main window.
-
- The \c PadNavigator constructor takes a QSize argument that determines the
- number or rows and columns in the grid.
-
- It also keeps a private member instance, \c form, which is the generated
- code for the pad's back side item's QGraphicsProxyWidget-embedded form.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 0
-
- \c PadNavigator's constructor is a bit long. In short, its job is to create
- all items, including the \c FlippablePad, the \c SplashItem and the
- QGraphicsProxyWidget \c backItem, and then to set up all animations, states
- and transitions that control the behavior of the application.
-
- It starts out simple, by forwarding to QGraphicsView's constructor.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 1
-
- The first item to be created is \c SplashItem. This is going to be a top-level
- item in the scene, next to \c FlippablePad, and stacked on top of it, so we
- assign it a \l{QGraphicsItem::zValue()}{Z-value} of 1.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 2
-
- Now we construct the \c FlippablePad item, passing its column-row count to
- its constructor.
-
- The pad is controlled by three transformations, and we create one
- QGraphicsRotation object for each of these.
-
- \list
- \li \c flipRotation: Rotates the grid around its Qt::YAxis. This rotation is
- animated from 0 to 180, and eventually back, when enter is pressed on the
- keyboard, flipping the pad around.
- \li \c xRotation: Rotates the grid around its Qt::XAxis. This is used to
- tilt the pad vertically corresponding to which item is currently selected.
- This way, the selected item is always kept in front.
- \li \c yRotation: Rotates the grid around its Qt::YAxis. This is used to
- tilt the pad horizontally corresponding to which item is selected. This
- way, the selected item is always kept in front.
- \endlist
-
- The combination of all three rotations is assigned via
- QGraphicsItem::setTransformations().
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 3
-
- Now we construct the QGraphicsProxyWidget-embedded \c backItem. The proxy
- widget is created as a child of the pad. We create a new QWidget and
- populate it with the \c form member. To ensure the \c hostName line edit is
- the first to receive input focus when this item is shown, we call
- \l{QWidget::setFocus()}{setFocus()} immediately. This will not give the
- widget focus right away; it will only prepare the item to automatically
- receive focus once it is shown.
-
- The QWidget based form is embedded into the proxy widget. The proxy is
- hidden initially; we only want to show it when the pad is rotated at least
- 90 degrees, and we also rotate the proxy itself by 180 degrees. This way we
- give the impression that the proxy widget is "behind" the flipped pad, when
- in fact, it's actually \e{on top of it}.
-
- We enable \l{QGraphicsItem::ItemCoordinateCache}{ItemCoordinateCache} to
- ensure the flip animation can run smoothly.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 4
-
- We now create the selection item. This is simply another instance of \c
- RoundRectItem that is slightly larger than the icons on the pad. We create
- it as an immediate child of the \c FlippablePad, so the selection item is a
- sibling to all the icons. By giving it a
- \l{QGraphicsItem::zValue()}{Z-value} of 0.5 we ensure it will slide between
- the pad and its icons.
-
- What follows now is a series of animation initializations.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 5
-
- We begin with the animations that apply to the splash item. The first
- animation, \c smoothSplashMove, ensures that the "y" property of \c splash
- will be animated with a 250-millisecond duration
- \l{QEasingCurve::InQuad}{InQuad} easing function. \c smoothSplashOpacity
- ensures the opacity of \c splash eases in and out in 250 milliseconds.
-
- The values are assigned by \c PadNavigator's state machine, which is
- created later.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 6
-
- These are the animations that control the selection item's movement and the
- \c xRotation and \c yRotation QGraphicsRotation objects that tilt the pad.
- All animations have a duration of 125 milliseconds, and they all use the
- \l{QEasingCurve::InOutQuad}{InOutQuad} easing function.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 7
-
- We now create the animations that control the flip-effect when you press
- the enter key. The main goal is to rotate the pad by 180 degrees or back.
-
- \list
- \li \c smoothFlipRotation: Animates the main 180 degree rotation of the pad.
- \li \c smoothFlipScale: Scales the pad out and then in again while the pad is rotating.
- \li \c flipAnimation: A parallel animation group that ensures the above animations are run in parallel.
- \endlist
-
- All animations are given a 500 millisecond duration and an
- \l{QEasingCurve::InOutQuad}{InOutQuad} easing function.
-
- It's worth taking a close look at \c smoothFlipScale. This animation's
- start and end values are both 1.0, but at animation step 0.5 the
- animation's value is 0.7. This means that after 50% of the animation's
- duration, or 250 milliseconds, the pad will be scaled down to 0.7x of its
- original size, which gives a great visual effect while flipping.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 8
-
- This section uses a trick to ensure that certain properties are assigned
- precisely when the flip animation passes 50%, or 90 degrees, rotation. In
- short, the pad's icons and selection item are all hidden, the pad's \c fill
- property is enabled, and \c backItem is shown when flipping over. When
- flipping back, the reverse properties are applied.
-
- The way this is achieved is by running a sequential animation in parallel
- to the other animations. This sequence, dubbed \c setVariablesSequence,
- starts with a 250 millisecond pause, and then executes several animations
- with a duration of 0. Each animation will ensure that properties are set
- immediate at this point.
-
- This approach can also be used to call functions or set any other
- properties at a specific time while an animation is running.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 9
-
- We will now create the state machine. The whole \c PadNavigator state
- machinery is controlled by one single state machine that has a
- straight-forward state structure. The state engine itself is created
- as a child of the \c PadNavigator itself. We then create three top level
- states:
-
- \list
- \li \c splashState: The initial state where the splash item is visible.
- \li \c frontState: The base state where the splash is gone and we can see
- the front side of the pad, and navigate the selection item.
- \li \c backState: The flipped state where the \c backItem is visible, and we
- can interact with the QGraphicsProxyWidget-embedded form.
- \endlist
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 10
-
- Each state assigns specific properties to objects on entry. Most
- interesting perhaps is the assignment of the value 0.0 to the pad's \c
- flipRotation angle property when in \c frontState, and 180.0 when in \c
- backState.
-
- At the end of this section we register default animations with the state
- engine; these animations will apply to their respective objects and
- properties for any state transition. Otherwise it's common to assign
- animations to specific transitions.
-
- Specifically, we use default animations to control the selection item's
- movement and tilt rotations. The tilt rotations are set to 0 when the pad
- is flipped, and restored back to their original values when flipped back.
-
- The \c splashState state is set as the initial state. This is required
- before we start the state engine. We proceed with creating some
- transitions.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 11
-
- QEventTransition defines a very flexible transition type. You can use this
- class to trigger a transition based on an object receiving an event of a
- specific type. In this case, we would like to transition from \c
- splashState into \c frontState if \c PadNavigator receives any key press
- event (QEvent::KeyPress).
-
- We register the \c splashItem's animations to this transition to ensure they
- are used to animate the item's movement and opacity.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 12
-
- We use QKeyEventTransition to capture specific key events. In this case, we
- detect that the user presses Qt::Key_Return or Qt::Key_Enter, and use this
- to trigger transitions between \c frontState and backState. We register \c
- flipAnimation, our complex parallel animation group, with these
- transitions.
-
- We continue by defining the states for each of the icons in the grid.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 13
-
- We will use state groups to control transitions between icons. Each icon
- represents a \e substate of \c frontState. We will then define transitions
- between the states by detecting key presses, using QKeyEventTransition.
-
- We start by creating all the substates, and at the same time we create a
- temporary grid structure for the states to make it easier to find which
- states represents icons that are up, down, left and to the right each
- other.
-
- Once the first substate is known, we set this up as the initial substate of
- \c frontState. We will use the (0, 0), or top-left, icon for the initial
- substate. We initialze the selection item's position to be exactly where
- the top-left icon is.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 14
-
- We can now create four transitions for each icon. Each transition ensures
- that we move to the state corresponding to which arrow key has been
- pressed. It's clear from this techinique that we could design any other
- specific transitions to and from each of the sub states depending on these
- and other keys.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 15
-
- Also, for each of the icons, we assign suitable values to the \c xRotation
- and \c yRotation objects' "angle"-properties. If you recall, these
- properties "tilt" the pad corresponding to which item is currently
- selected. We ensure each icon is invisible when the pad is flipped, and
- visible when the pad is not flipped. To ensure the visible property is
- assigned at the right time, we add property-controlling animations to the
- \c setVariableSequence animation defined earlier.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 16
-
- We are now finished with all states, transitions, and animations. We now
- create the scene that will contain all our items. The scene gets a defined
- background pixmap, and we disable item indexing (as most items in this
- scene are animated). We add our \c pad item to the scene, and use its
- bounding rectangle to fixate the scene rectangle. This rectangle is used by
- the view to find a suitable size for the application window.
-
- Then the scene is assigned to the view, or in our case, \c PadNavigator
- itself.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 17
-
- Now that the scene has received its final size, we can position the splash
- item at the very top, find its fade-out position, and add it to the scene.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 18
-
- The view toggles a few necessary properties:
-
- \list
- \li It disables its scroll bars - this application has no use for scroll bars.
- \li It assigns a minimum size. This is necessary to avoid numerical errors
- in our fit-in-view \c resizeEvent() implementation.
- \li It sets \l{QGraphicsView::FullViewportUpdate}{FullViewportUpdate}, to
- ensure QGraphicsView doesn't spend time figuring out precisely what needs
- to be redrawn. This application is very simple - if anything changes,
- everything is updated.
- \li It enables background caching - this makes no performance difference
- with OpenGL, but without OpenGL it avoids unnecessary re-scaling of the
- background pixmap.
- \li It sets render hints that increase rendering quality.
- \li If OpenGL is supported, a QOpenGLWidget viewport is assigned to the view.
- \endlist
-
- Finally, we start the state engine.
-
- \snippet graphicsview/padnavigator/padnavigator.cpp 19
-
- The \l{QGraphicsView::resizeEvent()}{resizeEvent()} implementation calls
- the base implementation, and then calls QGraphicsView::fitInView() to scale
- the scene so that it fits perfectly inside the view.
-
- By resizing the main application window, you can see this effect yourself.
- The scene contents grow when you make the window larger, and shrink when
- you make it smaller, while keeping the aspect ratio intact.
-
- \section1 The main() Function
-
- \snippet graphicsview/padnavigator/main.cpp 0
-
- The \c main function creates the QApplication instance, uses
- Q_INIT_RESOURCE to ensure our compiled-in resources aren't removed by the
- linker, and then creates a 3x3 \c PadNavigator instance and shows it.
-
- Our flippable pad shows up with a suitable splash item once control returns
- to the event loop.
-
- \section1 Performance Notes
-
- The example uses OpenGL if this is available, to achieve optimal
- performance; otherwise perspective tranformations can be quite costly.
-
- Although this example does use QGraphicsProxyWidget to demonstrate
- integration of Qt widget components integrated into Graphics View, using
- QGraphicsProxyWidget comes with a performance penalty, and is therefore not
- recommended for embedded development.
-
- This example uses extensive item caching to avoid rerendering of static
- elements, at the expense of graphics memory.
-*/
diff --git a/examples/widgets/doc/src/pingpong.qdoc b/examples/widgets/doc/src/pingpong.qdoc
deleted file mode 100644
index 9545058500..0000000000
--- a/examples/widgets/doc/src/pingpong.qdoc
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example statemachine/pingpong
- \title Ping Pong States Example
-
- \brief The Ping Pong States example shows how to use parallel states together
- with custom events and transitions in \l{The State Machine Framework}.
-
- This example implements a statechart where two states communicate by
- posting events to the state machine. The state chart looks as follows:
-
- \image pingpong-example.png
- \omit
- \caption This is a caption
- \endomit
-
- The \c pinger and \c ponger states are parallel states, i.e. they are
- entered simultaneously and will take transitions independently of
- eachother.
-
- The \c pinger state will post the first \c ping event upon entry; the \c
- ponger state will respond by posting a \c pong event; this will cause the
- \c pinger state to post a new \c ping event; and so on.
-
- \snippet statemachine/pingpong/main.cpp 0
-
- Two custom events are defined, \c PingEvent and \c PongEvent.
-
- \snippet statemachine/pingpong/main.cpp 1
-
- The \c Pinger class defines a state that posts a \c PingEvent to the state
- machine when the state is entered.
-
- \snippet statemachine/pingpong/main.cpp 2
-
- The \c PingTransition class defines a transition that is triggered by
- events of type \c PingEvent, and that posts a \c PongEvent (with a delay
- of 500 milliseconds) to the state machine when the transition is
- triggered.
-
- \snippet statemachine/pingpong/main.cpp 3
-
- The \c PongTransition class defines a transition that is triggered by
- events of type \c PongEvent, and that posts a \c PingEvent (with a delay
- of 500 milliseconds) to the state machine when the transition is
- triggered.
-
- \snippet statemachine/pingpong/main.cpp 4
-
- The main() function begins by creating a state machine and a parallel
- state group.
-
- \snippet statemachine/pingpong/main.cpp 5
-
- Next, the \c pinger and \c ponger states are created, with the parallel
- state group as their parent state. Note that the transitions are \e
- targetless. When such a transition is triggered, the source state won't be
- exited and re-entered; only the transition's onTransition() function will
- be called, and the state machine's configuration will remain the same,
- which is precisely what we want in this case.
-
- \snippet statemachine/pingpong/main.cpp 6
-
- Finally, the group is added to the state machine, the machine is started,
- and the application event loop is entered.
-
- */
diff --git a/examples/widgets/doc/src/rogue.qdoc b/examples/widgets/doc/src/rogue.qdoc
deleted file mode 100644
index b8b7cb15d6..0000000000
--- a/examples/widgets/doc/src/rogue.qdoc
+++ /dev/null
@@ -1,208 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example statemachine/rogue
- \title Rogue Example
-
- \brief The Rogue example shows how to use the Qt state machine for event
- handling.
-
- \image rogue-example.png
-
- This example implements a simple text based game. Do you see the
- \c{@} in the screenshot? That's you, the rogue. The \c{#}
- characters are walls, and the dots represent floor. In a real
- game, other ASCII characters would represent all kinds of objects
- and creatures, for instance, ancient dragons (\c{D}s) or food
- rations (\c{%}s). But let's not get carried away. In this game,
- the rogue is simply running around in an empty room.
-
- The rogue is moved with the keypad (2, 4, 8, 6). That aside, we
- have implemented a \c quit command that triggers if the player
- types \c {q}. The player is then asked if he/she really wants to
- quit.
-
- Most games have commands that need more than one key press (we
- think of consecutive presses, i.e., not of several keys being
- pressed at the same time). In this game, only the \c quit command
- falls under this category, but for the sake of argument, let's
- imagine a fully-fledged game with a rich set of commands. If we
- were to implement these by catching key events in
- \l{QWidget::}{keyPressEvent()}, we would have to keep a lot of
- class member variables to track the sequence of keys already typed
- (or find some other way of deducing the current state of a
- command). This can easily lead to spaghetti, which is--as we all
- well know, I'm sure--unpleasant. With a state machine, on the
- other hand, separate states can wait for a single key press, and
- that makes our lives a lot simpler.
-
- The example consists of two classes:
-
- \list
- \li \c Window draws the text display of the game and sets
- up the state machine. The window also has a status bar
- above the area in which the rouge moves.
- \li \c MovementTransition is a transition that carries out
- a single move of the rogue.
- \endlist
-
- Before we embark on a code walkthrough, it is necessary to take a
- closer look at the design of the machine. Here is a state chart
- that shows what we want to achieve:
-
- \image rogue-statechart.png
-
- The input state waits for a key press to start a new command.
- When receiving a key it recognizes, it transitions to one of the
- two commands of the game; though, as we will see, movement is
- handled by the transition itself. The quit state waits for the
- player to answer yes or no (by typing \c y or \c n) when asked
- whether he/she really wants to quit the game.
-
- The chart demonstrates how we use one state to wait for a single
- key press. The press received may trigger one of the transitions
- connected to the state.
-
- \section1 Window Class Definition
-
- The \c Window class is a widget that draws the text display of the
- game. It also sets up the state machine, i.e., creates and
- connects the states in the machine. It is the key events from this
- widget that are used by the machine.
-
- \snippet statemachine/rogue/window.h 0
-
- \c Direction specifies the direction in which the rogue is to
- move. We use this in \c movePlayer(), which moves the rogue and
- repaints the window. The game has a status line above the area in
- which the rogue moves. The \c status property contains the text of
- this line. We use a property because the QState class allows
- setting any Qt \l{Qt's Property System}{property} when entered.
- More on this later.
-
- \snippet statemachine/rogue/window.h 1
-
- The \c map is an array with the characters that are currently
- displayed. We set up the array in \c setupMap(), and update it
- when the rogue is moved. \c pX and \c pY is the current position
- of the rogue. \c WIDTH and \c HEIGHT are macros specifying the
- dimensions of the map.
-
- The \c paintEvent() function is left out of this walkthrough. We
- also do not discuss other code that does not concern the state
- machine (the \c setupMap(), \c status(), \c setStatus(), \c
- movePlayer(), and \c sizeHint() functions). If you wish to take a
- look at the code, click on the link for the \c window.cpp file at
- the top of this page.
-
- \section1 Window Class Implementation
-
- Here is the constructor of \c Window:
-
- \snippet statemachine/rogue/window.cpp 0
- \dots
- \snippet statemachine/rogue/window.cpp 1
-
- The player starts off at position (5, 5). We then set up the map
- and statemachine. Let's proceed with the \c buildMachine()
- function:
-
- \snippet statemachine/rogue/window.cpp 2
-
- We enter \c inputState when the machine is started and from the \c
- quitState if the user wants to continue playing. We then set the
- status to a helpful reminder of how to play the game.
-
- First, the \c Movement transition is added to the input state.
- This will enable the rogue to be moved with the keypad. Notice
- that we don't set a target state for the movement transition. This
- will cause the transition to be triggered (and the
- \l{QAbstractTransition::}{onTransition()} function to be invoked),
- but the machine will not leave the \c inputState. If we had set \c
- inputState as the target state, we would first have left and then
- entered the \c inputState again.
-
- \snippet statemachine/rogue/window.cpp 3
-
- When we enter \c quitState, we update the status bar of the
- window.
-
- \c QKeyEventTransition is a utility class that removes the hassle
- of implementing transitions for \l{QKeyEvent}s. We simply need to
- specify the key on which the transition should trigger and the
- target state of the transition.
-
- \snippet statemachine/rogue/window.cpp 4
-
- The transition from \c inputState allows triggering the quit state
- when the player types \c {q}.
-
- \snippet statemachine/rogue/window.cpp 5
-
- The machine is set up, so it's time to start it.
-
- \section1 The MovementTransition Class
-
- \c MovementTransition is triggered when the player request the
- rogue to be moved (by typing 2, 4, 6, or 8) when the machine is in
- the \c inputState.
-
- \snippet statemachine/rogue/movementtransition.h 0
-
- In the constructor, we tell QEventTransition to only send
- \l{QEvent::}{KeyPress} events to the
- \l{QAbstractTransition::}{eventTest()} function:
-
- \snippet statemachine/rogue/movementtransition.h 1
-
- The KeyPress events come wrapped in \l{QStateMachine::WrappedEvent}s. \c event
- must be confirmed to be a wrapped event because Qt uses other
- events internally. After that, it is simply a matter of checking
- which key has been pressed.
-
- Let's move on to the \c onTransition() function:
-
- \snippet statemachine/rogue/movementtransition.h 2
-
- When \c onTransition() is invoked, we know that we have a
- \l{QEvent::}{KeyPress} event with 2, 4, 6, or 8, and can ask \c
- Window to move the player.
-
- \section1 The Roguelike Tradition
-
- You might have been wondering why the game features a rogue. Well,
- these kinds of text based dungeon exploration games date back to a
- game called, yes, "Rogue". Although outflanked by the technology
- of modern 3D computer games, roguelikes have a solid community of
- hard-core, devoted followers.
-
- Playing these games can be surprisingly addictive (despite the
- lack of graphics). Angband, the perhaps most well-known rougelike,
- is found here: \l{http://rephial.org/}.
-*/
-
diff --git a/examples/widgets/doc/src/states.qdoc b/examples/widgets/doc/src/states.qdoc
deleted file mode 100644
index 1ae379f918..0000000000
--- a/examples/widgets/doc/src/states.qdoc
+++ /dev/null
@@ -1,36 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example animation/states
- \title States Example
-
- \brief The States example shows how to use the Qt state machine to play
- animations.
-
- \image states-example.png
-*/
diff --git a/examples/widgets/doc/src/stickman.qdoc b/examples/widgets/doc/src/stickman.qdoc
deleted file mode 100644
index ffc736674b..0000000000
--- a/examples/widgets/doc/src/stickman.qdoc
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example animation/stickman
- \title Stickman Example
-
- \brief The Stickman example shows how to animate transitions in a state
- machine to implement key frame animations.
-
- \image stickman-example.png
-
- In this example, we will write a small application which animates the joints in a skeleton and
- projects a stickman figure on top. The stickman can be either "alive" or "dead", and when in the
- "alive" state, he can be performing different actions defined by key frame animations.
-
- Animations are implemented as composite states. Each child state of the animation state
- represents a frame in the animation by setting the position of each joint in the stickman's
- skeleton to the positions defined for the particular frame. The frames are then bound together
- with animated transitions that trigger on the source state's propertiesAssigned() signal. Thus,
- the machine will enter the state representing the next frame in the animation immediately after
- it has finished animating into the previous frame.
-
- \image stickman-example1.png
-
- The states for an animation is constructed by reading a custom animation file format and
- creating states that assign values to the "position" properties of each of the nodes in the
- skeleton graph.
-
- \snippet animation/stickman/lifecycle.cpp 1
-
- The states are then bound together with signal transitions that listen to the
- propertiesAssigned() signal.
-
- \snippet animation/stickman/lifecycle.cpp 2
-
- The last frame state is given a transition to the first one, so that the animation will loop
- until it is interrupted when a transition out from the animation state is taken. To get smooth
- animations between the different key frames, we set a default animation on the state machine.
- This is a parallel animation group which contains animations for all the "position" properties
- and will be selected by default when taking any transition that leads into a state that assigns
- values to these properties.
-
- \snippet animation/stickman/lifecycle.cpp 3
-
- Several such animation states are constructed, and are placed together as children of a top
- level "alive" state which represents the stickman life cycle. Transitions go from the parent
- state to the child state to ensure that each of the child states inherit them.
-
- \image stickman-example2.png
-
- This saves us the effort of connect every state to every state with identical transitions. The
- state machine makes sure that transitions between the key frame animations are also smooth by
- applying the default animation when interrupting one and starting another.
-
- Finally, there is a transition out from the "alive" state and into the "dead" state. This is
- a custom transition type called LightningSrikesTransition which samples every second and
- triggers at random (one out of fifty times on average.)
-
- \snippet animation/stickman/lifecycle.cpp 4
-
- When it triggers, the machine will first enter a "lightningBlink" state which uses a timer to
- pause for a brief period of time while the background color of the scene is white. This gives us
- a flash effect when the lightning strikes.
-
- \snippet animation/stickman/lifecycle.cpp 5
-
- We start and stop a QTimer object when entering and exiting the state. Then we transition into
- the "dead" state when the timer times out.
-
- \snippet animation/stickman/lifecycle.cpp 0
-
- When the machine is in the "dead" state, it will be unresponsive. This is because the "dead"
- state has no transitions leading out.
-
- \image stickman-example3.png
-
-*/
diff --git a/examples/widgets/doc/src/sub-attaq.qdoc b/examples/widgets/doc/src/sub-attaq.qdoc
deleted file mode 100644
index 994e9d6f90..0000000000
--- a/examples/widgets/doc/src/sub-attaq.qdoc
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example animation/sub-attaq
- \title Sub-Attaq
- \ingroup examples-layout
-
- \brief This example shows Qt's ability to combine \l{The Animation Framework}{the animation framework}
- and \l{The State Machine Framework}{the state machine framework} to create a game.
-
- \image sub-attaq-demo.png
-
- The purpose of the game is to destroy all submarines to win the current level.
- The boat can be controlled using left and right keys. To fire a bomb you can press
- up and down keys.
-*/
diff --git a/examples/widgets/doc/src/trafficlight.qdoc b/examples/widgets/doc/src/trafficlight.qdoc
deleted file mode 100644
index 50c0944101..0000000000
--- a/examples/widgets/doc/src/trafficlight.qdoc
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example statemachine/trafficlight
- \title Traffic Light Example
-
- \brief 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 statemachine/trafficlight/main.cpp 0
-
- The LightWidget class represents a single light of the traffic light. It
- provides an \c on property and two slots, turnOn() and turnOff(), to turn
- the light on and off, respectively. The widget paints itself in the color
- that's passed to the constructor.
-
- \snippet statemachine/trafficlight/main.cpp 1
-
- The TrafficLightWidget class represents the visual part of the traffic
- light; it's a widget that contains three lights arranged vertically, and
- provides accessor functions for these.
-
- \snippet statemachine/trafficlight/main.cpp 2
-
- The createLightState() function creates a state that turns a light on when
- the state is entered, and off when the state is exited. The state uses a
- timer, and as we shall see the timeout is used to transition from one
- LightState to another. Here is the statechart for the light state:
-
- \image trafficlight-example1.png
- \omit
- \caption This is a caption
- \endomit
-
- \snippet statemachine/trafficlight/main.cpp 3
-
- The TrafficLight class combines the TrafficLightWidget with a state
- machine. 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.
- This is what the statechart looks like:
-
- \image trafficlight-example2.png
- \omit
- \caption This is a caption
- \endomit
-
- \snippet statemachine/trafficlight/main.cpp 4
-
- The main() function constructs a TrafficLight and shows it.
-
-*/
diff --git a/examples/widgets/doc/src/twowaybutton.qdoc b/examples/widgets/doc/src/twowaybutton.qdoc
deleted file mode 100644
index 2e1c29199d..0000000000
--- a/examples/widgets/doc/src/twowaybutton.qdoc
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example statemachine/twowaybutton
- \title Two-way Button Example
-
- \brief The Two-way button example shows how to use \l{The State Machine
- Framework} to implement a simple state machine that toggles the current
- state when a button is clicked.
-
- \snippet statemachine/twowaybutton/main.cpp 0
-
- The application's main() function begins by constructing the application
- object, a button and a state machine.
-
- \snippet statemachine/twowaybutton/main.cpp 1
-
- The state machine has two states; \c on and \c off. When either state is
- entered, the text of the button will be set accordingly.
-
- \snippet statemachine/twowaybutton/main.cpp 2
-
- When the state machine is in the \c off state and the button is clicked,
- it will transition to the \c on state; when the state machine is in the \c
- on state and the button is clicked, it will transition to the \c off
- state.
-
- \snippet statemachine/twowaybutton/main.cpp 3
-
- The states are added to the state machine; they become top-level (sibling)
- states.
-
- \snippet statemachine/twowaybutton/main.cpp 4
-
- The initial state is \c off; this is the state the state machine will
- immediately transition to once the state machine is started.
-
- \snippet statemachine/twowaybutton/main.cpp 5
-
- Finally, the button is resized and made visible, and the application event
- loop is entered.
-
-*/
diff --git a/examples/widgets/graphicsview/CMakeLists.txt b/examples/widgets/graphicsview/CMakeLists.txt
index 5ea8d6b2c6..a60ba190ef 100644
--- a/examples/widgets/graphicsview/CMakeLists.txt
+++ b/examples/widgets/graphicsview/CMakeLists.txt
@@ -4,7 +4,6 @@ add_subdirectory(chip)
add_subdirectory(elasticnodes)
add_subdirectory(embeddeddialogs)
add_subdirectory(collidingmice)
-add_subdirectory(padnavigator)
add_subdirectory(basicgraphicslayouts)
add_subdirectory(diagramscene)
add_subdirectory(flowlayout)
diff --git a/examples/widgets/graphicsview/graphicsview.pro b/examples/widgets/graphicsview/graphicsview.pro
index d591450559..8becd8aa9d 100644
--- a/examples/widgets/graphicsview/graphicsview.pro
+++ b/examples/widgets/graphicsview/graphicsview.pro
@@ -4,7 +4,6 @@ SUBDIRS = \
elasticnodes \
embeddeddialogs \
collidingmice \
- padnavigator \
basicgraphicslayouts \
diagramscene \
dragdroprobot \
diff --git a/examples/widgets/graphicsview/padnavigator/.prev_CMakeLists.txt b/examples/widgets/graphicsview/padnavigator/.prev_CMakeLists.txt
deleted file mode 100644
index e00a7d40a5..0000000000
--- a/examples/widgets/graphicsview/padnavigator/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,68 +0,0 @@
-# Generated from padnavigator.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(padnavigator LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/padnavigator")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-add_executable(padnavigator
- flippablepad.cpp flippablepad.h
- form.ui
- main.cpp
- padnavigator.cpp padnavigator.h
- roundrectitem.cpp roundrectitem.h
- splashitem.cpp splashitem.h
-)
-target_link_libraries(padnavigator PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(padnavigator_resource_files
- "images/artsfftscope.png"
- "images/blue_angle_swirl.jpg"
- "images/kontact_contacts.png"
- "images/kontact_journal.png"
- "images/kontact_mail.png"
- "images/kontact_notes.png"
- "images/kopeteavailable.png"
- "images/metacontact_online.png"
- "images/minitools.png"
-)
-
-qt6_add_resources(padnavigator "padnavigator"
- PREFIX
- "/"
- FILES
- ${padnavigator_resource_files}
-)
-
-if(TARGET Qt::OpenGL)
- target_link_libraries(padnavigator PUBLIC
- Qt::OpenGL
- Qt::OpenGLWidgets
- )
-endif()
-
-install(TARGETS padnavigator
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/graphicsview/padnavigator/CMakeLists.txt b/examples/widgets/graphicsview/padnavigator/CMakeLists.txt
deleted file mode 100644
index cb21f80d22..0000000000
--- a/examples/widgets/graphicsview/padnavigator/CMakeLists.txt
+++ /dev/null
@@ -1,69 +0,0 @@
-# Generated from padnavigator.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(padnavigator LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/padnavigator")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS OpenGL) # special case
-
-add_executable(padnavigator
- flippablepad.cpp flippablepad.h
- form.ui
- main.cpp
- padnavigator.cpp padnavigator.h
- roundrectitem.cpp roundrectitem.h
- splashitem.cpp splashitem.h
-)
-target_link_libraries(padnavigator PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(padnavigator_resource_files
- "images/artsfftscope.png"
- "images/blue_angle_swirl.jpg"
- "images/kontact_contacts.png"
- "images/kontact_journal.png"
- "images/kontact_mail.png"
- "images/kontact_notes.png"
- "images/kopeteavailable.png"
- "images/metacontact_online.png"
- "images/minitools.png"
-)
-
-qt6_add_resources(padnavigator "padnavigator"
- PREFIX
- "/"
- FILES
- ${padnavigator_resource_files}
-)
-
-if(TARGET Qt::OpenGL)
- target_link_libraries(padnavigator PUBLIC
- Qt::OpenGL
- Qt::OpenGLWidgets
- )
-endif()
-
-install(TARGETS padnavigator
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/graphicsview/padnavigator/flippablepad.cpp b/examples/widgets/graphicsview/padnavigator/flippablepad.cpp
deleted file mode 100644
index 263909225e..0000000000
--- a/examples/widgets/graphicsview/padnavigator/flippablepad.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "flippablepad.h"
-
-#include <QDirIterator>
-
-//! [0]
-static QRectF boundsFromSize(const QSize &size)
-{
- return QRectF((-size.width() / 2.0) * 150, (-size.height() / 2.0) * 150,
- size.width() * 150, size.height() * 150);
-}
-//! [0]
-
-//! [1]
-static QPointF posForLocation(int column, int row, const QSize &size)
-{
- return QPointF(column * 150, row * 150)
- - QPointF((size.width() - 1) * 75, (size.height() - 1) * 75);
-}
-//! [1]
-
-//! [2]
-FlippablePad::FlippablePad(const QSize &size, QGraphicsItem *parent)
- : RoundRectItem(boundsFromSize(size), QColor(226, 255, 92, 64), parent)
-{
-//! [2]
-//! [3]
- int numIcons = size.width() * size.height();
- QList<QPixmap> pixmaps;
- QDirIterator it(":/images", {"*.png"});
- while (it.hasNext() && pixmaps.size() < numIcons)
- pixmaps << it.next();
-//! [3]
-
-//! [4]
- const QRectF iconRect(-54, -54, 108, 108);
- const QColor iconColor(214, 240, 110, 128);
- iconGrid.resize(size.height());
- int n = 0;
-
- for (int y = 0; y < size.height(); ++y) {
- iconGrid[y].resize(size.width());
- for (int x = 0; x < size.width(); ++x) {
- RoundRectItem *rect = new RoundRectItem(iconRect, iconColor, this);
- rect->setZValue(1);
- rect->setPos(posForLocation(x, y, size));
- rect->setPixmap(pixmaps.at(n++ % pixmaps.size()));
- iconGrid[y][x] = rect;
- }
- }
-}
-//! [4]
-
-//! [5]
-RoundRectItem *FlippablePad::iconAt(int column, int row) const
-{
- return iconGrid[row][column];
-}
-//! [5]
diff --git a/examples/widgets/graphicsview/padnavigator/flippablepad.h b/examples/widgets/graphicsview/padnavigator/flippablepad.h
deleted file mode 100644
index a056eae1c5..0000000000
--- a/examples/widgets/graphicsview/padnavigator/flippablepad.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef FLIPPABLEPAD_H
-#define FLIPPABLEPAD_H
-
-#include "roundrectitem.h"
-
-#include <QList>
-
-//! [0]
-class FlippablePad : public RoundRectItem
-{
-public:
- explicit FlippablePad(const QSize &size, QGraphicsItem *parent = nullptr);
-
- RoundRectItem *iconAt(int column, int row) const;
-
-private:
- QList<QList<RoundRectItem *>> iconGrid;
-};
-//! [0]
-
-#endif // FLIPPABLEPAD_H
diff --git a/examples/widgets/graphicsview/padnavigator/form.ui b/examples/widgets/graphicsview/padnavigator/form.ui
deleted file mode 100644
index fc7d12321e..0000000000
--- a/examples/widgets/graphicsview/padnavigator/form.ui
+++ /dev/null
@@ -1,208 +0,0 @@
-<ui version="4.0" >
- <class>Form</class>
- <widget class="QWidget" name="Form" >
- <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/widgets/graphicsview/padnavigator/images/artsfftscope.png b/examples/widgets/graphicsview/padnavigator/images/artsfftscope.png
deleted file mode 100644
index 4db003f8d2..0000000000
--- a/examples/widgets/graphicsview/padnavigator/images/artsfftscope.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/graphicsview/padnavigator/images/blue_angle_swirl.jpg b/examples/widgets/graphicsview/padnavigator/images/blue_angle_swirl.jpg
deleted file mode 100644
index 5bf0debdbd..0000000000
--- a/examples/widgets/graphicsview/padnavigator/images/blue_angle_swirl.jpg
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/graphicsview/padnavigator/images/kontact_contacts.png b/examples/widgets/graphicsview/padnavigator/images/kontact_contacts.png
deleted file mode 100644
index 6fb4cc8f38..0000000000
--- a/examples/widgets/graphicsview/padnavigator/images/kontact_contacts.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/graphicsview/padnavigator/images/kontact_journal.png b/examples/widgets/graphicsview/padnavigator/images/kontact_journal.png
deleted file mode 100644
index b1fedb6982..0000000000
--- a/examples/widgets/graphicsview/padnavigator/images/kontact_journal.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/graphicsview/padnavigator/images/kontact_mail.png b/examples/widgets/graphicsview/padnavigator/images/kontact_mail.png
deleted file mode 100644
index 672f8fa3ab..0000000000
--- a/examples/widgets/graphicsview/padnavigator/images/kontact_mail.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/graphicsview/padnavigator/images/kontact_notes.png b/examples/widgets/graphicsview/padnavigator/images/kontact_notes.png
deleted file mode 100644
index 229bf73ac6..0000000000
--- a/examples/widgets/graphicsview/padnavigator/images/kontact_notes.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/graphicsview/padnavigator/images/kopeteavailable.png b/examples/widgets/graphicsview/padnavigator/images/kopeteavailable.png
deleted file mode 100644
index 2eaf41afec..0000000000
--- a/examples/widgets/graphicsview/padnavigator/images/kopeteavailable.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/graphicsview/padnavigator/images/metacontact_online.png b/examples/widgets/graphicsview/padnavigator/images/metacontact_online.png
deleted file mode 100644
index 6a398dd10f..0000000000
--- a/examples/widgets/graphicsview/padnavigator/images/metacontact_online.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/graphicsview/padnavigator/images/minitools.png b/examples/widgets/graphicsview/padnavigator/images/minitools.png
deleted file mode 100644
index 0248c9d50a..0000000000
--- a/examples/widgets/graphicsview/padnavigator/images/minitools.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/graphicsview/padnavigator/main.cpp b/examples/widgets/graphicsview/padnavigator/main.cpp
deleted file mode 100644
index c433ab3aa9..0000000000
--- a/examples/widgets/graphicsview/padnavigator/main.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "padnavigator.h"
-
-#include <QtWidgets/QtWidgets>
-
-//! [0]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Q_INIT_RESOURCE(padnavigator);
-
- PadNavigator navigator(QSize(3, 3));
- navigator.show();
- return app.exec();
-}
-//! [0]
diff --git a/examples/widgets/graphicsview/padnavigator/padnavigator.cpp b/examples/widgets/graphicsview/padnavigator/padnavigator.cpp
deleted file mode 100644
index 5088386a26..0000000000
--- a/examples/widgets/graphicsview/padnavigator/padnavigator.cpp
+++ /dev/null
@@ -1,318 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "flippablepad.h"
-#include "padnavigator.h"
-#include "splashitem.h"
-
-#include <QEventTransition>
-#include <QGraphicsProxyWidget>
-#include <QGraphicsRotation>
-#include <QHistoryState>
-#include <QKeyEventTransition>
-#include <QParallelAnimationGroup>
-#include <QPropertyAnimation>
-#include <QSequentialAnimationGroup>
-#include <QStateMachine>
-
-#ifndef QT_NO_OPENGL
-#include <QOpenGLWidget>
-#endif
-
-//! [0]
-PadNavigator::PadNavigator(const QSize &size, QWidget *parent)
- : QGraphicsView(parent)
-{
-//! [0]
-//! [1]
- // Splash item
- SplashItem *splash = new SplashItem;
- splash->setZValue(1);
-//! [1]
-
-//! [2]
- // Pad item
- FlippablePad *pad = new FlippablePad(size);
- QGraphicsRotation *flipRotation = new QGraphicsRotation(pad);
- QGraphicsRotation *xRotation = new QGraphicsRotation(pad);
- QGraphicsRotation *yRotation = new QGraphicsRotation(pad);
- flipRotation->setAxis(Qt::YAxis);
- xRotation->setAxis(Qt::YAxis);
- yRotation->setAxis(Qt::XAxis);
- pad->setTransformations(QList<QGraphicsTransform *>()
- << flipRotation
- << xRotation << yRotation);
-//! [2]
-
-//! [3]
- // Back (proxy widget) item
- QGraphicsProxyWidget *backItem = new QGraphicsProxyWidget(pad);
- QWidget *widget = new QWidget;
- form.setupUi(widget);
- form.hostName->setFocus();
- backItem->setWidget(widget);
- backItem->setVisible(false);
- backItem->setFocus();
- backItem->setCacheMode(QGraphicsItem::ItemCoordinateCache);
- const QRectF r = backItem->rect();
- backItem->setTransform(QTransform()
- .rotate(180, Qt::YAxis)
- .translate(-r.width()/2, -r.height()/2));
-//! [3]
-
-//! [4]
- // Selection item
- RoundRectItem *selectionItem = new RoundRectItem(QRectF(-60, -60, 120, 120), Qt::gray, pad);
- selectionItem->setZValue(0.5);
-//! [4]
-
-//! [5]
- // Splash animations
- QPropertyAnimation *smoothSplashMove = new QPropertyAnimation(splash, "y");
- QPropertyAnimation *smoothSplashOpacity = new QPropertyAnimation(splash, "opacity");
- smoothSplashMove->setEasingCurve(QEasingCurve::InQuad);
- smoothSplashMove->setDuration(250);
- smoothSplashOpacity->setDuration(250);
-//! [5]
-
-//! [6]
- // Selection animation
- QPropertyAnimation *smoothXSelection = new QPropertyAnimation(selectionItem, "x");
- QPropertyAnimation *smoothYSelection = new QPropertyAnimation(selectionItem, "y");
- QPropertyAnimation *smoothXRotation = new QPropertyAnimation(xRotation, "angle");
- QPropertyAnimation *smoothYRotation = new QPropertyAnimation(yRotation, "angle");
- smoothXSelection->setDuration(125);
- smoothYSelection->setDuration(125);
- smoothXRotation->setDuration(125);
- smoothYRotation->setDuration(125);
- smoothXSelection->setEasingCurve(QEasingCurve::InOutQuad);
- smoothYSelection->setEasingCurve(QEasingCurve::InOutQuad);
- smoothXRotation->setEasingCurve(QEasingCurve::InOutQuad);
- smoothYRotation->setEasingCurve(QEasingCurve::InOutQuad);
-//! [6]
-
-//! [7]
- // Flip animation setup
- QPropertyAnimation *smoothFlipRotation = new QPropertyAnimation(flipRotation, "angle");
- QPropertyAnimation *smoothFlipScale = new QPropertyAnimation(pad, "scale");
- QParallelAnimationGroup *flipAnimation = new QParallelAnimationGroup(this);
- smoothFlipScale->setDuration(500);
- smoothFlipRotation->setDuration(500);
- smoothFlipScale->setEasingCurve(QEasingCurve::InOutQuad);
- smoothFlipRotation->setEasingCurve(QEasingCurve::InOutQuad);
- smoothFlipScale->setKeyValueAt(0, qvariant_cast<qreal>(1.0));
- smoothFlipScale->setKeyValueAt(0.5, qvariant_cast<qreal>(0.7));
- smoothFlipScale->setKeyValueAt(1, qvariant_cast<qreal>(1.0));
- flipAnimation->addAnimation(smoothFlipRotation);
- flipAnimation->addAnimation(smoothFlipScale);
-//! [7]
-
-//! [8]
- // Flip animation delayed property assignment
- QSequentialAnimationGroup *setVariablesSequence = new QSequentialAnimationGroup;
- QPropertyAnimation *setFillAnimation = new QPropertyAnimation(pad, "fill");
- QPropertyAnimation *setBackItemVisibleAnimation = new QPropertyAnimation(backItem, "visible");
- QPropertyAnimation *setSelectionItemVisibleAnimation = new QPropertyAnimation(selectionItem, "visible");
- setFillAnimation->setDuration(0);
- setBackItemVisibleAnimation->setDuration(0);
- setSelectionItemVisibleAnimation->setDuration(0);
- setVariablesSequence->addPause(250);
- setVariablesSequence->addAnimation(setBackItemVisibleAnimation);
- setVariablesSequence->addAnimation(setSelectionItemVisibleAnimation);
- setVariablesSequence->addAnimation(setFillAnimation);
- flipAnimation->addAnimation(setVariablesSequence);
-//! [8]
-
-//! [9]
- // Build the state machine
- QStateMachine *stateMachine = new QStateMachine(this);
- QState *splashState = new QState(stateMachine);
- QState *frontState = new QState(stateMachine);
- QHistoryState *historyState = new QHistoryState(frontState);
- QState *backState = new QState(stateMachine);
-//! [9]
-//! [10]
- frontState->assignProperty(pad, "fill", false);
- frontState->assignProperty(splash, "opacity", 0.0);
- frontState->assignProperty(backItem, "visible", false);
- frontState->assignProperty(flipRotation, "angle", qvariant_cast<qreal>(0.0));
- frontState->assignProperty(selectionItem, "visible", true);
- backState->assignProperty(pad, "fill", true);
- backState->assignProperty(backItem, "visible", true);
- backState->assignProperty(xRotation, "angle", qvariant_cast<qreal>(0.0));
- backState->assignProperty(yRotation, "angle", qvariant_cast<qreal>(0.0));
- backState->assignProperty(flipRotation, "angle", qvariant_cast<qreal>(180.0));
- backState->assignProperty(selectionItem, "visible", false);
- stateMachine->addDefaultAnimation(smoothXRotation);
- stateMachine->addDefaultAnimation(smoothYRotation);
- stateMachine->addDefaultAnimation(smoothXSelection);
- stateMachine->addDefaultAnimation(smoothYSelection);
- stateMachine->setInitialState(splashState);
-//! [10]
-
-//! [11]
- // Transitions
- QEventTransition *anyKeyTransition = new QEventTransition(this, QEvent::KeyPress, splashState);
- anyKeyTransition->setTargetState(frontState);
- anyKeyTransition->addAnimation(smoothSplashMove);
- anyKeyTransition->addAnimation(smoothSplashOpacity);
-//! [11]
-
-//! [12]
- QKeyEventTransition *enterTransition = new QKeyEventTransition(this, QEvent::KeyPress,
- Qt::Key_Enter, backState);
- QKeyEventTransition *returnTransition = new QKeyEventTransition(this, QEvent::KeyPress,
- Qt::Key_Return, backState);
- QKeyEventTransition *backEnterTransition = new QKeyEventTransition(this, QEvent::KeyPress,
- Qt::Key_Enter, frontState);
- QKeyEventTransition *backReturnTransition = new QKeyEventTransition(this, QEvent::KeyPress,
- Qt::Key_Return, frontState);
- enterTransition->setTargetState(historyState);
- returnTransition->setTargetState(historyState);
- backEnterTransition->setTargetState(backState);
- backReturnTransition->setTargetState(backState);
- enterTransition->addAnimation(flipAnimation);
- returnTransition->addAnimation(flipAnimation);
- backEnterTransition->addAnimation(flipAnimation);
- backReturnTransition->addAnimation(flipAnimation);
-//! [12]
-
-//! [13]
- // Create substates for each icon; store in temporary grid.
- int columns = size.width();
- int rows = size.height();
- QList<QList<QState *>> stateGrid;
- stateGrid.resize(rows);
- for (int y = 0; y < rows; ++y) {
- stateGrid[y].resize(columns);
- for (int x = 0; x < columns; ++x)
- stateGrid[y][x] = new QState(frontState);
- }
- frontState->setInitialState(stateGrid[0][0]);
- selectionItem->setPos(pad->iconAt(0, 0)->pos());
-//! [13]
-
-//! [14]
- // Enable key navigation using state transitions
- for (int y = 0; y < rows; ++y) {
- for (int x = 0; x < columns; ++x) {
- QState *state = stateGrid[y][x];
- QKeyEventTransition *rightTransition = new QKeyEventTransition(this, QEvent::KeyPress,
- Qt::Key_Right, state);
- QKeyEventTransition *leftTransition = new QKeyEventTransition(this, QEvent::KeyPress,
- Qt::Key_Left, state);
- QKeyEventTransition *downTransition = new QKeyEventTransition(this, QEvent::KeyPress,
- Qt::Key_Down, state);
- QKeyEventTransition *upTransition = new QKeyEventTransition(this, QEvent::KeyPress,
- Qt::Key_Up, state);
- rightTransition->setTargetState(stateGrid[y][(x + 1) % columns]);
- leftTransition->setTargetState(stateGrid[y][((x - 1) + columns) % columns]);
- downTransition->setTargetState(stateGrid[(y + 1) % rows][x]);
- upTransition->setTargetState(stateGrid[((y - 1) + rows) % rows][x]);
-//! [14]
-//! [15]
- RoundRectItem *icon = pad->iconAt(x, y);
- state->assignProperty(xRotation, "angle", -icon->x() / 6.0);
- state->assignProperty(yRotation, "angle", icon->y() / 6.0);
- state->assignProperty(selectionItem, "x", icon->x());
- state->assignProperty(selectionItem, "y", icon->y());
- frontState->assignProperty(icon, "visible", true);
- backState->assignProperty(icon, "visible", false);
-
- QPropertyAnimation *setIconVisibleAnimation = new QPropertyAnimation(icon, "visible");
- setIconVisibleAnimation->setDuration(0);
- setVariablesSequence->addAnimation(setIconVisibleAnimation);
- }
- }
-//! [15]
-
-//! [16]
- // Scene
- QGraphicsScene *scene = new QGraphicsScene(this);
- scene->setBackgroundBrush(QPixmap(":/images/blue_angle_swirl.jpg"));
- scene->setItemIndexMethod(QGraphicsScene::NoIndex);
- scene->addItem(pad);
- scene->setSceneRect(scene->itemsBoundingRect());
- setScene(scene);
-//! [16]
-
-//! [17]
- // Adjust splash item to scene contents
- const QRectF sbr = splash->boundingRect();
- splash->setPos(-sbr.width() / 2, scene->sceneRect().top() - 2);
- frontState->assignProperty(splash, "y", splash->y() - 100.0);
- scene->addItem(splash);
-//! [17]
-
-//! [18]
- // View
- setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- setMinimumSize(50, 50);
- setViewportUpdateMode(FullViewportUpdate);
- setCacheMode(CacheBackground);
- setRenderHints(QPainter::Antialiasing
- | QPainter::SmoothPixmapTransform
- | QPainter::TextAntialiasing);
-#ifndef QT_NO_OPENGL
- setViewport(new QOpenGLWidget);
-#endif
-
- stateMachine->start();
-//! [18]
-}
-
-//! [19]
-void PadNavigator::resizeEvent(QResizeEvent *event)
-{
- QGraphicsView::resizeEvent(event);
- fitInView(scene()->sceneRect(), Qt::KeepAspectRatio);
-}
-//! [19]
diff --git a/examples/widgets/graphicsview/padnavigator/padnavigator.h b/examples/widgets/graphicsview/padnavigator/padnavigator.h
deleted file mode 100644
index 0fe9ad045d..0000000000
--- a/examples/widgets/graphicsview/padnavigator/padnavigator.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PADNAVIGATOR_H
-#define PADNAVIGATOR_H
-
-#include <QGraphicsView>
-#include "ui_form.h"
-
-//! [0]
-class PadNavigator : public QGraphicsView
-{
- Q_OBJECT
-public:
- explicit PadNavigator(const QSize &size, QWidget *parent = nullptr);
-
-protected:
- void resizeEvent(QResizeEvent *event) override;
-
-private:
- Ui::Form form;
-};
-//! [0]
-
-#endif // PADNAVIGATOR_H
diff --git a/examples/widgets/graphicsview/padnavigator/padnavigator.pro b/examples/widgets/graphicsview/padnavigator/padnavigator.pro
deleted file mode 100644
index d957be4593..0000000000
--- a/examples/widgets/graphicsview/padnavigator/padnavigator.pro
+++ /dev/null
@@ -1,27 +0,0 @@
-SOURCES += main.cpp \
- roundrectitem.cpp \
- flippablepad.cpp \
- padnavigator.cpp \
- splashitem.cpp
-
-HEADERS += \
- roundrectitem.h \
- flippablepad.h \
- padnavigator.h \
- splashitem.h
-
-RESOURCES += \
- padnavigator.qrc
-
-FORMS += \
- form.ui
-
-QT += widgets
-requires(qtConfig(treewidget))
-qtHaveModule(opengl): QT += opengl openglwidgets
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/graphicsview/padnavigator
-INSTALLS += target
-
-CONFIG += console
diff --git a/examples/widgets/graphicsview/padnavigator/padnavigator.qrc b/examples/widgets/graphicsview/padnavigator/padnavigator.qrc
deleted file mode 100644
index b26ab92ae1..0000000000
--- a/examples/widgets/graphicsview/padnavigator/padnavigator.qrc
+++ /dev/null
@@ -1,13 +0,0 @@
-<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>
- </qresource>
-</RCC>
diff --git a/examples/widgets/graphicsview/padnavigator/roundrectitem.cpp b/examples/widgets/graphicsview/padnavigator/roundrectitem.cpp
deleted file mode 100644
index b4ea489069..0000000000
--- a/examples/widgets/graphicsview/padnavigator/roundrectitem.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "roundrectitem.h"
-
-#include <QGuiApplication>
-#include <QPainter>
-#include <QPalette>
-
-//! [0]
-RoundRectItem::RoundRectItem(const QRectF &bounds, const QColor &color,
- QGraphicsItem *parent)
- : QGraphicsObject(parent), fillRect(false), bounds(bounds)
-{
- gradient.setStart(bounds.topLeft());
- gradient.setFinalStop(bounds.bottomRight());
- gradient.setColorAt(0, color);
- gradient.setColorAt(1, color.darker(200));
- setCacheMode(ItemCoordinateCache);
-}
-//! [0]
-
-//! [1]
-QPixmap RoundRectItem::pixmap() const
-{
- return pix;
-}
-void RoundRectItem::setPixmap(const QPixmap &pixmap)
-{
- pix = pixmap;
- update();
-}
-//! [1]
-
-//! [2]
-QRectF RoundRectItem::boundingRect() const
-{
- return bounds.adjusted(0, 0, 2, 2);
-}
-//! [2]
-
-//! [3]
-void RoundRectItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget)
-{
- Q_UNUSED(option);
- Q_UNUSED(widget);
- painter->setPen(Qt::NoPen);
- painter->setBrush(QColor(0, 0, 0, 64));
- painter->drawRoundedRect(bounds.translated(2, 2), 25, 25, Qt::RelativeSize);
-//! [3]
-//! [4]
- if (fillRect)
- painter->setBrush(QGuiApplication::palette().brush(QPalette::Window));
- else
- painter->setBrush(gradient);
- painter->setPen(QPen(Qt::black, 1));
- painter->drawRoundedRect(bounds, 25,25, Qt::RelativeSize);
-//! [4]
-//! [5]
- if (!pix.isNull()) {
- painter->scale(1.95, 1.95);
- painter->drawPixmap(-pix.width() / 2, -pix.height() / 2, pix);
- }
-}
-//! [5]
-
-//! [6]
-bool RoundRectItem::fill() const
-{
- return fillRect;
-}
-void RoundRectItem::setFill(bool fill)
-{
- fillRect = fill;
- update();
-}
-//! [6]
diff --git a/examples/widgets/graphicsview/padnavigator/roundrectitem.h b/examples/widgets/graphicsview/padnavigator/roundrectitem.h
deleted file mode 100644
index 91b3e6542e..0000000000
--- a/examples/widgets/graphicsview/padnavigator/roundrectitem.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ROUNDRECTITEM_H
-#define ROUNDRECTITEM_H
-
-#include <QGraphicsObject>
-#include <QLinearGradient>
-
-//! [0]
-class RoundRectItem : public QGraphicsObject
-{
- Q_OBJECT
- Q_PROPERTY(bool fill READ fill WRITE setFill)
-public:
- RoundRectItem(const QRectF &bounds, const QColor &color,
- QGraphicsItem *parent = nullptr);
-
- QPixmap pixmap() const;
- void setPixmap(const QPixmap &pixmap);
-
- QRectF boundingRect() const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
-
- bool fill() const;
- void setFill(bool fill);
-//! [0]
-
-//! [1]
-private:
- QPixmap pix;
- bool fillRect;
- QRectF bounds;
- QLinearGradient gradient;
-};
-//! [1]
-
-#endif // ROUNDRECTITEM_H
diff --git a/examples/widgets/graphicsview/padnavigator/splashitem.cpp b/examples/widgets/graphicsview/padnavigator/splashitem.cpp
deleted file mode 100644
index 7c3dfba588..0000000000
--- a/examples/widgets/graphicsview/padnavigator/splashitem.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "splashitem.h"
-
-#include <QPainter>
-
-//! [0]
-SplashItem::SplashItem(QGraphicsItem *parent)
- : QGraphicsObject(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. Press any key to begin.");
- setCacheMode(DeviceCoordinateCache);
-}
-//! [0]
-
-//! [1]
-QRectF SplashItem::boundingRect() const
-{
- return QRectF(0, 0, 400, 175);
-}
-//! [1]
-
-//! [2]
-void SplashItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget)
-{
- Q_UNUSED(option);
- Q_UNUSED(widget);
- painter->setPen(QPen(Qt::black, 2));
- painter->setBrush(QColor(245, 245, 255, 220));
- painter->setClipRect(boundingRect());
- painter->drawRoundedRect(3, -100 + 3, 400 - 6, 250 - 6, 25, 25, Qt::RelativeSize);
-
- QRectF textRect = boundingRect().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);
-}
-//! [2]
diff --git a/examples/widgets/graphicsview/padnavigator/splashitem.h b/examples/widgets/graphicsview/padnavigator/splashitem.h
deleted file mode 100644
index b8e723db81..0000000000
--- a/examples/widgets/graphicsview/padnavigator/splashitem.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SPLASHITEM_H
-#define SPLASHITEM_H
-
-#include <QGraphicsObject>
-
-//! [0]
-class SplashItem : public QGraphicsObject
-{
- Q_OBJECT
-public:
- explicit SplashItem(QGraphicsItem *parent = nullptr);
-
- QRectF boundingRect() const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
-
-private:
- QString text;
-};
-//! [0]
-
-#endif // SPLASHITEM_H
diff --git a/examples/widgets/statemachine/CMakeLists.txt b/examples/widgets/statemachine/CMakeLists.txt
deleted file mode 100644
index 90a7b3e263..0000000000
--- a/examples/widgets/statemachine/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-# Generated from statemachine.pro.
-
-add_subdirectory(factorial)
-add_subdirectory(pingpong)
-if(TARGET Qt::Widgets)
- add_subdirectory(eventtransitions)
- add_subdirectory(rogue)
- add_subdirectory(trafficlight)
- add_subdirectory(twowaybutton)
-endif()
diff --git a/examples/widgets/statemachine/README b/examples/widgets/statemachine/README
deleted file mode 100644
index a0ac35a89b..0000000000
--- a/examples/widgets/statemachine/README
+++ /dev/null
@@ -1,6 +0,0 @@
-Qt is provided with a powerful hierchical finite state machine through
-the Qt State Machine classes.
-
-
-Documentation for these examples can be found via the Examples
-link in the main Qt documentation.
diff --git a/examples/widgets/statemachine/eventtransitions/CMakeLists.txt b/examples/widgets/statemachine/eventtransitions/CMakeLists.txt
deleted file mode 100644
index 642e6343db..0000000000
--- a/examples/widgets/statemachine/eventtransitions/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Generated from eventtransitions.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(eventtransitions LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/statemachine/eventtransitions")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-add_qt_gui_executable(eventtransitions
- main.cpp
-)
-target_link_libraries(eventtransitions PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS eventtransitions
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/statemachine/eventtransitions/eventtransitions.pro b/examples/widgets/statemachine/eventtransitions/eventtransitions.pro
deleted file mode 100644
index 07c8be73d4..0000000000
--- a/examples/widgets/statemachine/eventtransitions/eventtransitions.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-QT += widgets
-
-SOURCES = main.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/statemachine/eventtransitions
-INSTALLS += target
diff --git a/examples/widgets/statemachine/eventtransitions/main.cpp b/examples/widgets/statemachine/eventtransitions/main.cpp
deleted file mode 100644
index fe9518092f..0000000000
--- a/examples/widgets/statemachine/eventtransitions/main.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QEventTransition>
-#include <QPushButton>
-#include <QStateMachine>
-#include <QVBoxLayout>
-#include <QWidget>
-
-//! [0]
-class Window : public QWidget
-{
-public:
- Window(QWidget *parent = nullptr)
- : QWidget(parent)
- {
- QPushButton *button = new QPushButton(this);
- button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(button);
- layout->setContentsMargins(80, 80, 80, 80);
- setLayout(layout);
-//! [0]
-
-//! [1]
- QStateMachine *machine = new QStateMachine(this);
-
- QState *s1 = new QState();
- s1->assignProperty(button, "text", "Outside");
-
- QState *s2 = new QState();
- s2->assignProperty(button, "text", "Inside");
-//! [1]
-
-//! [2]
- QEventTransition *enterTransition = new QEventTransition(button, QEvent::Enter);
- enterTransition->setTargetState(s2);
- s1->addTransition(enterTransition);
-//! [2]
-
-//! [3]
- QEventTransition *leaveTransition = new QEventTransition(button, QEvent::Leave);
- leaveTransition->setTargetState(s1);
- s2->addTransition(leaveTransition);
-//! [3]
-
-//! [4]
- QState *s3 = new QState();
- s3->assignProperty(button, "text", "Pressing...");
-
- QEventTransition *pressTransition = new QEventTransition(button, QEvent::MouseButtonPress);
- pressTransition->setTargetState(s3);
- s2->addTransition(pressTransition);
-
- QEventTransition *releaseTransition = new QEventTransition(button, QEvent::MouseButtonRelease);
- releaseTransition->setTargetState(s2);
- s3->addTransition(releaseTransition);
-//! [4]
-
-//! [5]
- machine->addState(s1);
- machine->addState(s2);
- machine->addState(s3);
-
- machine->setInitialState(s1);
- machine->start();
- }
-};
-//! [5]
-
-//! [6]
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
- Window window;
- window.resize(300, 300);
- window.show();
-
- return app.exec();
-}
-//! [6]
diff --git a/examples/widgets/statemachine/factorial/CMakeLists.txt b/examples/widgets/statemachine/factorial/CMakeLists.txt
deleted file mode 100644
index 17904e3cd2..0000000000
--- a/examples/widgets/statemachine/factorial/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# Generated from factorial.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(factorial LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/statemachine/factorial")
-
-find_package(Qt6 COMPONENTS Core)
-
-add_executable(factorial
- main.cpp
-)
-target_link_libraries(factorial PUBLIC
- Qt::Core
-)
-
-install(TARGETS factorial
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/statemachine/factorial/factorial.pro b/examples/widgets/statemachine/factorial/factorial.pro
deleted file mode 100644
index bf285acf4d..0000000000
--- a/examples/widgets/statemachine/factorial/factorial.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-QT = core
-CONFIG += cmdline
-
-SOURCES += main.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/statemachine/factorial
-INSTALLS += target
-
-
diff --git a/examples/widgets/statemachine/factorial/main.cpp b/examples/widgets/statemachine/factorial/main.cpp
deleted file mode 100644
index e6cbdcae29..0000000000
--- a/examples/widgets/statemachine/factorial/main.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore>
-
-//! [0]
-class Factorial : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int x READ x WRITE setX)
- Q_PROPERTY(int fac READ fac WRITE setFac)
-public:
- using QObject::QObject;
-
- int x() const
- {
- return m_x;
- }
-
- void setX(int x)
- {
- if (x == m_x)
- return;
- m_x = x;
- emit xChanged(x);
- }
-
- int fac() const
- {
- return m_fac;
- }
-
- void setFac(int fac)
- {
- m_fac = fac;
- }
-
-Q_SIGNALS:
- void xChanged(int value);
-
-private:
- int m_x = -1;
- int m_fac = 1;
-};
-//! [0]
-
-//! [1]
-class FactorialLoopTransition : public QSignalTransition
-{
-public:
- FactorialLoopTransition(Factorial *fact)
- : QSignalTransition(fact, &Factorial::xChanged), m_fact(fact)
- {}
-
- bool eventTest(QEvent *e) override
- {
- if (!QSignalTransition::eventTest(e))
- return false;
- QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
- return se->arguments().at(0).toInt() > 1;
- }
-
- void onTransition(QEvent *e) override
- {
- QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
- int x = se->arguments().at(0).toInt();
- int fac = m_fact->property("fac").toInt();
- m_fact->setProperty("fac", x * fac);
- m_fact->setProperty("x", x - 1);
- }
-
-private:
- Factorial *m_fact;
-};
-//! [1]
-
-//! [2]
-class FactorialDoneTransition : public QSignalTransition
-{
-public:
- FactorialDoneTransition(Factorial *fact)
- : QSignalTransition(fact, &Factorial::xChanged), m_fact(fact)
- {}
-
- bool eventTest(QEvent *e) override
- {
- if (!QSignalTransition::eventTest(e))
- return false;
- QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
- return se->arguments().at(0).toInt() <= 1;
- }
-
- void onTransition(QEvent *) override
- {
- qInfo() << m_fact->property("fac").toInt();
- }
-
-private:
- Factorial *m_fact;
-};
-//! [2]
-
-//! [3]
-int main(int argc, char **argv)
-{
- QCoreApplication app(argc, argv);
- Factorial factorial;
- QStateMachine machine;
-//! [3]
-
-//! [4]
- QState *compute = new QState(&machine);
- compute->assignProperty(&factorial, "fac", 1);
- compute->assignProperty(&factorial, "x", 6);
- compute->addTransition(new FactorialLoopTransition(&factorial));
-//! [4]
-
-//! [5]
- QFinalState *done = new QFinalState(&machine);
- FactorialDoneTransition *doneTransition = new FactorialDoneTransition(&factorial);
- doneTransition->setTargetState(done);
- compute->addTransition(doneTransition);
-//! [5]
-
-//! [6]
- machine.setInitialState(compute);
- QObject::connect(&machine, &QStateMachine::finished, &app, QCoreApplication::quit);
- machine.start();
-
- return app.exec();
-}
-//! [6]
-
-#include "main.moc"
diff --git a/examples/widgets/statemachine/pingpong/CMakeLists.txt b/examples/widgets/statemachine/pingpong/CMakeLists.txt
deleted file mode 100644
index 68cb4acb44..0000000000
--- a/examples/widgets/statemachine/pingpong/CMakeLists.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-# Generated from pingpong.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(pingpong LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/statemachine/pingpong")
-
-find_package(Qt6 COMPONENTS Core)
-
-add_executable(pingpong
- main.cpp
-)
-target_link_libraries(pingpong PUBLIC
- Qt::Core
-)
-
-install(TARGETS pingpong
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/statemachine/pingpong/main.cpp b/examples/widgets/statemachine/pingpong/main.cpp
deleted file mode 100644
index c09060c502..0000000000
--- a/examples/widgets/statemachine/pingpong/main.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore>
-#include <stdio.h>
-
-//! [0]
-class PingEvent : public QEvent
-{
-public:
- PingEvent() : QEvent(QEvent::Type(QEvent::User+2))
- {}
-};
-
-class PongEvent : public QEvent
-{
-public:
- PongEvent() : QEvent(QEvent::Type(QEvent::User+3))
- {}
-};
-//! [0]
-
-//! [1]
-class Pinger : public QState
-{
-public:
- Pinger(QState *parent)
- : QState(parent) {}
-
-protected:
- void onEntry(QEvent *) override
- {
- machine()->postEvent(new PingEvent());
- fprintf(stdout, "ping?\n");
- }
-};
-//! [1]
-
-//! [3]
-class PongTransition : public QAbstractTransition
-{
-public:
- PongTransition() {}
-
-protected:
- bool eventTest(QEvent *e) override {
- return (e->type() == QEvent::User+3);
- }
- void onTransition(QEvent *) override
- {
- machine()->postDelayedEvent(new PingEvent(), 500);
- fprintf(stdout, "ping?\n");
- }
-};
-//! [3]
-
-//! [2]
-class PingTransition : public QAbstractTransition
-{
-public:
- PingTransition() {}
-
-protected:
- bool eventTest(QEvent *e) override {
- return (e->type() == QEvent::User+2);
- }
- void onTransition(QEvent *) override
- {
- machine()->postDelayedEvent(new PongEvent(), 500);
- fprintf(stdout, "pong!\n");
- }
-};
-//! [2]
-
-//! [4]
-int main(int argc, char **argv)
-{
- QCoreApplication app(argc, argv);
-
- QStateMachine machine;
- QState *group = new QState(QState::ParallelStates);
- group->setObjectName("group");
-//! [4]
-
-//! [5]
- Pinger *pinger = new Pinger(group);
- pinger->setObjectName("pinger");
- pinger->addTransition(new PongTransition());
-
- QState *ponger = new QState(group);
- ponger->setObjectName("ponger");
- ponger->addTransition(new PingTransition());
-//! [5]
-
-//! [6]
- machine.addState(group);
- machine.setInitialState(group);
- machine.start();
-
- return app.exec();
-}
-//! [6]
diff --git a/examples/widgets/statemachine/pingpong/pingpong.pro b/examples/widgets/statemachine/pingpong/pingpong.pro
deleted file mode 100644
index 18dee0400d..0000000000
--- a/examples/widgets/statemachine/pingpong/pingpong.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-QT = core
-CONFIG += cmdline
-
-SOURCES = main.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/statemachine/pingpong
-INSTALLS += target
-
-
diff --git a/examples/widgets/statemachine/rogue/CMakeLists.txt b/examples/widgets/statemachine/rogue/CMakeLists.txt
deleted file mode 100644
index 156b054311..0000000000
--- a/examples/widgets/statemachine/rogue/CMakeLists.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-# Generated from rogue.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(rogue LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/statemachine/rogue")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-add_qt_gui_executable(rogue
- main.cpp
- movementtransition.h
- window.cpp window.h
-)
-target_link_libraries(rogue PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS rogue
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/statemachine/rogue/main.cpp b/examples/widgets/statemachine/rogue/main.cpp
deleted file mode 100644
index 44ade770ee..0000000000
--- a/examples/widgets/statemachine/rogue/main.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "window.h"
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
-
- Window window;
- window.show();
-
- return app.exec();
-}
-
diff --git a/examples/widgets/statemachine/rogue/movementtransition.h b/examples/widgets/statemachine/rogue/movementtransition.h
deleted file mode 100644
index 74ffed6608..0000000000
--- a/examples/widgets/statemachine/rogue/movementtransition.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MOVEMENTTRANSITION_H
-#define MOVEMENTTRANSITION_H
-
-#include <QtWidgets>
-
-#include "window.h"
-
-//![0]
-class MovementTransition : public QEventTransition
-{
- Q_OBJECT
-
-public:
- MovementTransition(Window *window) :
- QEventTransition(window, QEvent::KeyPress) {
- this->window = window;
- }
-//![0]
-
-//![1]
-protected:
- bool eventTest(QEvent *event) override {
- if (event->type() == QEvent::StateMachineWrapped &&
- static_cast<QStateMachine::WrappedEvent *>(event)->event()->type() == QEvent::KeyPress) {
- QEvent *wrappedEvent = static_cast<QStateMachine::WrappedEvent *>(event)->event();
-
- QKeyEvent *keyEvent = static_cast<QKeyEvent *>(wrappedEvent);
- int key = keyEvent->key();
-
- return key == Qt::Key_2 || key == Qt::Key_8 || key == Qt::Key_6 ||
- key == Qt::Key_4 || key == Qt::Key_Down || key == Qt::Key_Up ||
- key == Qt::Key_Right || key == Qt::Key_Left;
- }
- return false;
- }
-//![1]
-
-//![2]
- void onTransition(QEvent *event) override {
- QKeyEvent *keyEvent = static_cast<QKeyEvent *>(
- static_cast<QStateMachine::WrappedEvent *>(event)->event());
-
- int key = keyEvent->key();
- switch (key) {
- case Qt::Key_Left:
- case Qt::Key_4:
- window->movePlayer(Window::Left);
- break;
- case Qt::Key_Up:
- case Qt::Key_8:
- window->movePlayer(Window::Up);
- break;
- case Qt::Key_Right:
- case Qt::Key_6:
- window->movePlayer(Window::Right);
- break;
- case Qt::Key_Down:
- case Qt::Key_2:
- window->movePlayer(Window::Down);
- break;
- default:
- ;
- }
- }
-//![2]
-
-private:
- Window *window;
-};
-
-#endif
-
diff --git a/examples/widgets/statemachine/rogue/rogue.pro b/examples/widgets/statemachine/rogue/rogue.pro
deleted file mode 100644
index cf9657c7d6..0000000000
--- a/examples/widgets/statemachine/rogue/rogue.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-QT += widgets
-
-HEADERS = window.h \
- movementtransition.h
-SOURCES = main.cpp \
- window.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/statemachine/rogue
-INSTALLS += target
diff --git a/examples/widgets/statemachine/rogue/window.cpp b/examples/widgets/statemachine/rogue/window.cpp
deleted file mode 100644
index a5363e2758..0000000000
--- a/examples/widgets/statemachine/rogue/window.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "window.h"
-#include "movementtransition.h"
-
-//![0]
-Window::Window()
-{
- pX = 5;
- pY = 5;
-//![0]
-
- QFontDatabase database;
- QFont font;
- if (database.families().contains("Monospace")) {
- font = QFont("Monospace");
- }
- else {
- const QStringList fontFamilies = database.families();
- for (const QString &family : fontFamilies ) {
- if (database.isFixedPitch(family)) {
- font = QFont(family);
- break;
- }
- }
- }
- font.setPointSize(12);
- setFont(font);
-
-//![1]
- setupMap();
- buildMachine();
-}
-//![1]
-
-void Window::setStatus(const QString &status)
-{
- myStatus = status;
- repaint();
-}
-
-QString Window::status() const
-{
- return myStatus;
-}
-
-void Window::paintEvent(QPaintEvent * /* event */)
-{
- QFontMetrics metrics(font());
- QPainter painter(this);
- int fontHeight = metrics.height();
- int fontWidth = metrics.horizontalAdvance('X');
- int yPos = fontHeight;
- int xPos;
-
- painter.fillRect(rect(), Qt::black);
- painter.setPen(Qt::white);
-
- painter.drawText(QPoint(0, yPos), status());
-
- for (int y = 0; y < HEIGHT; ++y) {
- yPos += fontHeight;
- xPos = 0;
-
- for (int x = 0; x < WIDTH; ++x) {
- if (y == pY && x == pX) {
- xPos += fontWidth;
- continue;
- }
-
- painter.setPen(Qt::white);
-
- double x1 = static_cast<double>(pX);
- double y1 = static_cast<double>(pY);
- double x2 = static_cast<double>(x);
- double y2 = static_cast<double>(y);
-
- if (x2<x1) {
- x2+=0.5;
- } else if (x2>x1) {
- x2-=0.5;
- }
-
- if (y2<y1) {
- y2+=0.5;
- } else if (y2>y1) {
- y2-=0.5;
- }
-
- double dx = x2 - x1;
- double dy = y2 - y1;
-
- double length = qSqrt(dx*dx+dy*dy);
-
- dx /= length;
- dy /= length;
-
- double xi = x1;
- double yi = y1;
-
- while (length > 0) {
- int cx = static_cast<int>(xi+0.5);
- int cy = static_cast<int>(yi+0.5);
-
- if (x2 == cx && y2 == cy)
- break;
-
- if (!(x1==cx && y1==cy)
- && (map[cx][cy] == '#' || (length-10) > 0)) {
- painter.setPen(QColor(60,60,60));
- break;
- }
-
- xi += dx;
- yi += dy;
- --length;
- }
-
- painter.drawText(QPoint(xPos, yPos), map[x][y]);
- xPos += fontWidth;
- }
- }
- painter.setPen(Qt::white);
- painter.drawText(QPoint(pX * fontWidth, (pY + 2) * fontHeight), QChar('@'));
-}
-
-QSize Window::sizeHint() const
-{
- QFontMetrics metrics(font());
-
- return QSize(metrics.horizontalAdvance('X') * WIDTH, metrics.height() * (HEIGHT + 1));
-}
-
-//![2]
-void Window::buildMachine()
-{
- machine = new QStateMachine;
-
- QState *inputState = new QState(machine);
- inputState->assignProperty(this, "status", "Move the rogue with 2, 4, 6, and 8");
-
- MovementTransition *transition = new MovementTransition(this);
- inputState->addTransition(transition);
-//![2]
-
-//![3]
- QState *quitState = new QState(machine);
- quitState->assignProperty(this, "status", "Really quit(y/n)?");
-
- QKeyEventTransition *yesTransition = new
- QKeyEventTransition(this, QEvent::KeyPress, Qt::Key_Y);
- yesTransition->setTargetState(new QFinalState(machine));
- quitState->addTransition(yesTransition);
-
- QKeyEventTransition *noTransition =
- new QKeyEventTransition(this, QEvent::KeyPress, Qt::Key_N);
- noTransition->setTargetState(inputState);
- quitState->addTransition(noTransition);
-//![3]
-
-//![4]
- QKeyEventTransition *quitTransition =
- new QKeyEventTransition(this, QEvent::KeyPress, Qt::Key_Q);
- quitTransition->setTargetState(quitState);
- inputState->addTransition(quitTransition);
-//![4]
-
-//![5]
- machine->setInitialState(inputState);
-
- connect(machine, &QStateMachine::finished,
- qApp, &QApplication::quit);
-
- machine->start();
-}
-//![5]
-
-void Window::movePlayer(Direction direction)
-{
- switch (direction) {
- case Left:
- if (map[pX - 1][pY] != '#')
- --pX;
- break;
- case Right:
- if (map[pX + 1][pY] != '#')
- ++pX;
- break;
- case Up:
- if (map[pX][pY - 1] != '#')
- --pY;
- break;
- case Down:
- if (map[pX][pY + 1] != '#')
- ++pY;
- break;
- }
- repaint();
-}
-
-void Window::setupMap()
-{
- for (int x = 0; x < WIDTH; ++x)
- for (int y = 0; y < HEIGHT; ++y) {
- if (x == 0 || x == WIDTH - 1 || y == 0 || y == HEIGHT - 1 || QRandomGenerator::global()->bounded(40) == 0)
- map[x][y] = '#';
- else
- map[x][y] = '.';
- }
-}
-
diff --git a/examples/widgets/statemachine/rogue/window.h b/examples/widgets/statemachine/rogue/window.h
deleted file mode 100644
index af34815ffd..0000000000
--- a/examples/widgets/statemachine/rogue/window.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WINDOW_H
-#define WINDOW_H
-
-#include <QWidget>
-
-QT_BEGIN_NAMESPACE
-class QState;
-class QStateMachine;
-class QTransition;
-QT_END_NAMESPACE
-
-#define WIDTH 35
-#define HEIGHT 20
-
-//![0]
-class Window : public QWidget
-{
- Q_OBJECT
- Q_PROPERTY(QString status READ status WRITE setStatus)
-
-public:
- enum Direction { Up, Down, Left, Right };
-
- Window();
-
- void movePlayer(Direction direction);
- void setStatus(const QString &status);
- QString status() const;
-
- QSize sizeHint() const override;
-
-protected:
- void paintEvent(QPaintEvent *event) override;
-//![0]
-
-//![1]
-private:
- void buildMachine();
- void setupMap();
-
- QChar map[WIDTH][HEIGHT];
- int pX, pY;
-
- QStateMachine *machine;
- QString myStatus;
-};
-//![1]
-
-#endif
-
diff --git a/examples/widgets/statemachine/statemachine.pro b/examples/widgets/statemachine/statemachine.pro
deleted file mode 100644
index 926e01cfda..0000000000
--- a/examples/widgets/statemachine/statemachine.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = \
- factorial \
- pingpong
-
-qtHaveModule(widgets) {
- SUBDIRS += \
- eventtransitions \
- rogue \
- trafficlight \
- twowaybutton
-}
diff --git a/examples/widgets/statemachine/trafficlight/CMakeLists.txt b/examples/widgets/statemachine/trafficlight/CMakeLists.txt
deleted file mode 100644
index ca2ec2313a..0000000000
--- a/examples/widgets/statemachine/trafficlight/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Generated from trafficlight.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(trafficlight LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/statemachine/trafficlight")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-add_qt_gui_executable(trafficlight
- main.cpp
-)
-target_link_libraries(trafficlight PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS trafficlight
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/statemachine/trafficlight/main.cpp b/examples/widgets/statemachine/trafficlight/main.cpp
deleted file mode 100644
index dd8bddcb37..0000000000
--- a/examples/widgets/statemachine/trafficlight/main.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QFinalState>
-#include <QPainter>
-#include <QStateMachine>
-#include <QTimer>
-#include <QVBoxLayout>
-#include <QWidget>
-
-//! [0]
-class LightWidget : public QWidget
-{
- Q_OBJECT
- Q_PROPERTY(bool on READ isOn WRITE setOn)
-public:
- LightWidget(const QColor &color, QWidget *parent = nullptr)
- : QWidget(parent), m_color(color), m_on(false) {}
-
- bool isOn() const
- { return m_on; }
- void setOn(bool on)
- {
- if (on == m_on)
- return;
- m_on = on;
- update();
- }
-
-public slots:
- void turnOff() { setOn(false); }
- void turnOn() { setOn(true); }
-
-protected:
- void paintEvent(QPaintEvent *) override
- {
- if (!m_on)
- return;
- QPainter painter(this);
- painter.setRenderHint(QPainter::Antialiasing);
- painter.setBrush(m_color);
- painter.drawEllipse(0, 0, width(), height());
- }
-
-private:
- QColor m_color;
- bool m_on;
-};
-//! [0]
-
-//! [1]
-class TrafficLightWidget : public QWidget
-{
-public:
- TrafficLightWidget(QWidget *parent = nullptr)
- : QWidget(parent)
- {
- QVBoxLayout *vbox = new QVBoxLayout(this);
- m_red = new LightWidget(Qt::red);
- vbox->addWidget(m_red);
- m_yellow = new LightWidget(Qt::yellow);
- vbox->addWidget(m_yellow);
- m_green = new LightWidget(Qt::green);
- vbox->addWidget(m_green);
- QPalette pal = palette();
- pal.setColor(QPalette::Window, Qt::black);
- setPalette(pal);
- setAutoFillBackground(true);
- }
-
- LightWidget *redLight() const
- { return m_red; }
- LightWidget *yellowLight() const
- { return m_yellow; }
- LightWidget *greenLight() const
- { return m_green; }
-
-private:
- LightWidget *m_red;
- LightWidget *m_yellow;
- LightWidget *m_green;
-};
-//! [1]
-
-//! [2]
-QState *createLightState(LightWidget *light, int duration, QState *parent = nullptr)
-{
- QState *lightState = new QState(parent);
- QTimer *timer = new QTimer(lightState);
- timer->setInterval(duration);
- timer->setSingleShot(true);
- QState *timing = new QState(lightState);
- QObject::connect(timing, &QAbstractState::entered, light, &LightWidget::turnOn);
- QObject::connect(timing, &QAbstractState::entered, timer, QOverload<>::of(&QTimer::start));
- QObject::connect(timing, &QAbstractState::exited, light, &LightWidget::turnOff);
- QFinalState *done = new QFinalState(lightState);
- timing->addTransition(timer, &QTimer::timeout, done);
- lightState->setInitialState(timing);
- return lightState;
-}
-//! [2]
-
-//! [3]
-class TrafficLight : public QWidget
-{
-public:
- TrafficLight(QWidget *parent = nullptr)
- : QWidget(parent)
- {
- QVBoxLayout *vbox = new QVBoxLayout(this);
- TrafficLightWidget *widget = new TrafficLightWidget;
- vbox->addWidget(widget);
- vbox->setContentsMargins(QMargins());
-
- QStateMachine *machine = new QStateMachine(this);
- QState *redGoingYellow = createLightState(widget->redLight(), 3000);
- redGoingYellow->setObjectName("redGoingYellow");
- QState *yellowGoingGreen = createLightState(widget->yellowLight(), 1000);
- yellowGoingGreen->setObjectName("yellowGoingGreen");
- redGoingYellow->addTransition(redGoingYellow, &QState::finished, yellowGoingGreen);
- QState *greenGoingYellow = createLightState(widget->greenLight(), 3000);
- greenGoingYellow->setObjectName("greenGoingYellow");
- yellowGoingGreen->addTransition(yellowGoingGreen, &QState::finished, greenGoingYellow);
- QState *yellowGoingRed = createLightState(widget->yellowLight(), 1000);
- yellowGoingRed->setObjectName("yellowGoingRed");
- greenGoingYellow->addTransition(greenGoingYellow, &QState::finished, yellowGoingRed);
- yellowGoingRed->addTransition(yellowGoingRed, &QState::finished, redGoingYellow);
-
- machine->addState(redGoingYellow);
- machine->addState(yellowGoingGreen);
- machine->addState(greenGoingYellow);
- machine->addState(yellowGoingRed);
- machine->setInitialState(redGoingYellow);
- machine->start();
- }
-};
-//! [3]
-
-//! [4]
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
- TrafficLight widget;
- widget.resize(110, 300);
- widget.show();
-
- return app.exec();
-}
-//! [4]
-
-#include "main.moc"
diff --git a/examples/widgets/statemachine/trafficlight/trafficlight.pro b/examples/widgets/statemachine/trafficlight/trafficlight.pro
deleted file mode 100644
index 85d9cda504..0000000000
--- a/examples/widgets/statemachine/trafficlight/trafficlight.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-QT += widgets
-
-SOURCES = main.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/statemachine/trafficlight
-INSTALLS += target
-
-
diff --git a/examples/widgets/statemachine/twowaybutton/CMakeLists.txt b/examples/widgets/statemachine/twowaybutton/CMakeLists.txt
deleted file mode 100644
index 91abfc0db0..0000000000
--- a/examples/widgets/statemachine/twowaybutton/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Generated from twowaybutton.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(twowaybutton LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/statemachine/twowaybutton")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-add_qt_gui_executable(twowaybutton
- main.cpp
-)
-target_link_libraries(twowaybutton PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS twowaybutton
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/statemachine/twowaybutton/main.cpp b/examples/widgets/statemachine/twowaybutton/main.cpp
deleted file mode 100644
index 3d4fef3bbe..0000000000
--- a/examples/widgets/statemachine/twowaybutton/main.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-//! [0]
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
- QPushButton button;
- QStateMachine machine;
-//! [0]
-
-//! [1]
- QState *off = new QState();
- off->assignProperty(&button, "text", "Off");
- off->setObjectName("off");
-
- QState *on = new QState();
- on->setObjectName("on");
- on->assignProperty(&button, "text", "On");
-//! [1]
-
-//! [2]
- off->addTransition(&button, &QAbstractButton::clicked, on);
- on->addTransition(&button, &QAbstractButton::clicked, off);
-//! [2]
-
-//! [3]
- machine.addState(off);
- machine.addState(on);
-//! [3]
-
-//! [4]
- machine.setInitialState(off);
- machine.start();
-//! [4]
-
-//! [5]
- button.resize(100, 50);
- button.show();
- return app.exec();
-}
-//! [5]
diff --git a/examples/widgets/statemachine/twowaybutton/twowaybutton.pro b/examples/widgets/statemachine/twowaybutton/twowaybutton.pro
deleted file mode 100644
index 22d19308ae..0000000000
--- a/examples/widgets/statemachine/twowaybutton/twowaybutton.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-QT += widgets
-
-SOURCES = main.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/statemachine/twowaybutton
-INSTALLS += target
-
-
diff --git a/examples/widgets/widgets.pro b/examples/widgets/widgets.pro
index 4452414668..2dbbefa141 100644
--- a/examples/widgets/widgets.pro
+++ b/examples/widgets/widgets.pro
@@ -18,7 +18,6 @@ SUBDIRS = \
painting \
richtext \
scroller \
- statemachine \
tools \
touch \
tutorials \
diff --git a/src/corelib/.prev_CMakeLists.txt b/src/corelib/.prev_CMakeLists.txt
index eb1ca0cc4b..747a0d75df 100644
--- a/src/corelib/.prev_CMakeLists.txt
+++ b/src/corelib/.prev_CMakeLists.txt
@@ -128,14 +128,6 @@ qt_add_module(Core
serialization/qxmlstreamgrammar.cpp serialization/qxmlstreamgrammar_p.h
serialization/qxmlstreamparser_p.h
serialization/qxmlutils.cpp serialization/qxmlutils_p.h
- statemachine/qabstractstate.cpp statemachine/qabstractstate.h statemachine/qabstractstate_p.h
- statemachine/qabstracttransition.cpp statemachine/qabstracttransition.h statemachine/qabstracttransition_p.h
- statemachine/qfinalstate.cpp statemachine/qfinalstate.h statemachine/qfinalstate_p.h
- statemachine/qhistorystate.cpp statemachine/qhistorystate.h statemachine/qhistorystate_p.h
- statemachine/qsignaleventgenerator_p.h
- statemachine/qsignaltransition.cpp statemachine/qsignaltransition.h statemachine/qsignaltransition_p.h
- statemachine/qstate.cpp statemachine/qstate.h statemachine/qstate_p.h
- statemachine/qstatemachine.cpp statemachine/qstatemachine.h statemachine/qstatemachine_p.h
text/qbytearray.cpp text/qbytearray.h text/qbytearray_p.h
text/qbytearrayalgorithms.h
text/qbytearraylist.cpp text/qbytearraylist.h
@@ -1001,11 +993,6 @@ qt_extend_target(Core CONDITION QT_FEATURE_cborstreamwriter
serialization/qcborstreamwriter.cpp serialization/qcborstreamwriter.h
)
-qt_extend_target(Core CONDITION QT_FEATURE_qeventtransition
- SOURCES
- statemachine/qeventtransition.cpp statemachine/qeventtransition.h statemachine/qeventtransition_p.h
-)
-
qt_extend_target(Core CONDITION QT_FEATURE_mimetype
SOURCES
mimetypes/qmimedatabase.cpp mimetypes/qmimedatabase.h mimetypes/qmimedatabase_p.h
diff --git a/src/corelib/.prev_configure.cmake b/src/corelib/.prev_configure.cmake
index ddbbbc56e8..6619762a29 100644
--- a/src/corelib/.prev_configure.cmake
+++ b/src/corelib/.prev_configure.cmake
@@ -872,17 +872,6 @@ qt_feature("animation" PUBLIC
CONDITION QT_FEATURE_properties AND QT_FEATURE_easingcurve
)
qt_feature_definition("animation" "QT_NO_ANIMATION" NEGATE VALUE "1")
-qt_feature("statemachine" PUBLIC
- SECTION "Utilities"
- LABEL "State machine"
- PURPOSE "Provides hierarchical finite state machines."
- CONDITION QT_FEATURE_properties
-)
-qt_feature_definition("statemachine" "QT_NO_STATEMACHINE" NEGATE VALUE "1")
-qt_feature("qeventtransition" PUBLIC
- LABEL "QEventTransition class"
- CONDITION QT_FEATURE_statemachine
-)
qt_feature("gestures" PUBLIC
SECTION "Utilities"
LABEL "Gesture"
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index 26364f4660..3411f4f8f6 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -150,14 +150,6 @@ qt_add_module(Core
serialization/qxmlstreamgrammar.cpp serialization/qxmlstreamgrammar_p.h
serialization/qxmlstreamparser_p.h
serialization/qxmlutils.cpp serialization/qxmlutils_p.h
- statemachine/qabstractstate.cpp statemachine/qabstractstate.h statemachine/qabstractstate_p.h
- statemachine/qabstracttransition.cpp statemachine/qabstracttransition.h statemachine/qabstracttransition_p.h
- statemachine/qfinalstate.cpp statemachine/qfinalstate.h statemachine/qfinalstate_p.h
- statemachine/qhistorystate.cpp statemachine/qhistorystate.h statemachine/qhistorystate_p.h
- statemachine/qsignaleventgenerator_p.h
- statemachine/qsignaltransition.cpp statemachine/qsignaltransition.h statemachine/qsignaltransition_p.h
- statemachine/qstate.cpp statemachine/qstate.h statemachine/qstate_p.h
- statemachine/qstatemachine.cpp statemachine/qstatemachine.h statemachine/qstatemachine_p.h
text/qbytearray.cpp text/qbytearray.h text/qbytearray_p.h
text/qbytearrayalgorithms.h
text/qbytearraylist.cpp text/qbytearraylist.h
@@ -1115,11 +1107,6 @@ qt_extend_target(Core CONDITION QT_FEATURE_cborstreamwriter
serialization/qcborstreamwriter.cpp serialization/qcborstreamwriter.h
)
-qt_extend_target(Core CONDITION QT_FEATURE_qeventtransition
- SOURCES
- statemachine/qeventtransition.cpp statemachine/qeventtransition.h statemachine/qeventtransition_p.h
-)
-
qt_extend_target(Core CONDITION QT_FEATURE_mimetype
SOURCES
mimetypes/qmimedatabase.cpp mimetypes/qmimedatabase.h mimetypes/qmimedatabase_p.h
diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake
index 31cdcb45dc..a6aecd2ae1 100644
--- a/src/corelib/configure.cmake
+++ b/src/corelib/configure.cmake
@@ -878,17 +878,6 @@ qt_feature("animation" PUBLIC
CONDITION QT_FEATURE_properties AND QT_FEATURE_easingcurve
)
qt_feature_definition("animation" "QT_NO_ANIMATION" NEGATE VALUE "1")
-qt_feature("statemachine" PUBLIC
- SECTION "Utilities"
- LABEL "State machine"
- PURPOSE "Provides hierarchical finite state machines."
- CONDITION QT_FEATURE_properties
-)
-qt_feature_definition("statemachine" "QT_NO_STATEMACHINE" NEGATE VALUE "1")
-qt_feature("qeventtransition" PUBLIC
- LABEL "QEventTransition class"
- CONDITION QT_FEATURE_statemachine
-)
qt_feature("gestures" PUBLIC
SECTION "Utilities"
LABEL "Gesture"
diff --git a/src/corelib/configure.json b/src/corelib/configure.json
index 4557212a76..8e2d4e859d 100644
--- a/src/corelib/configure.json
+++ b/src/corelib/configure.json
@@ -947,18 +947,6 @@
"condition": "features.properties && features.easingcurve",
"output": [ "publicFeature", "feature" ]
},
- "statemachine": {
- "label": "State machine",
- "purpose": "Provides hierarchical finite state machines.",
- "section": "Utilities",
- "condition": "features.properties",
- "output": [ "publicFeature", "feature" ]
- },
- "qeventtransition": {
- "label": "QEventTransition class",
- "condition": "features.statemachine",
- "output": [ "publicFeature" ]
- },
"gestures": {
"label": "Gesture",
"purpose": "Provides a framework for gestures.",
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 7a52cadf05..73479e2309 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -45,7 +45,6 @@ include(itemmodels/itemmodels.pri)
include(plugin/plugin.pri)
include(kernel/kernel.pri)
include(serialization/serialization.pri)
-include(statemachine/statemachine.pri)
include(mimetypes/mimetypes.pri)
include(platform/platform.pri)
diff --git a/src/corelib/doc/images/statemachine-button-history.png b/src/corelib/doc/images/statemachine-button-history.png
deleted file mode 100644
index 7f51cae3f2..0000000000
--- a/src/corelib/doc/images/statemachine-button-history.png
+++ /dev/null
Binary files differ
diff --git a/src/corelib/doc/images/statemachine-button-nested.png b/src/corelib/doc/images/statemachine-button-nested.png
deleted file mode 100644
index 762ac14df1..0000000000
--- a/src/corelib/doc/images/statemachine-button-nested.png
+++ /dev/null
Binary files differ
diff --git a/src/corelib/doc/images/statemachine-button.png b/src/corelib/doc/images/statemachine-button.png
deleted file mode 100644
index 10102bdf2c..0000000000
--- a/src/corelib/doc/images/statemachine-button.png
+++ /dev/null
Binary files differ
diff --git a/src/corelib/doc/images/statemachine-customevents.png b/src/corelib/doc/images/statemachine-customevents.png
deleted file mode 100644
index 62a42223ef..0000000000
--- a/src/corelib/doc/images/statemachine-customevents.png
+++ /dev/null
Binary files differ
diff --git a/src/corelib/doc/images/statemachine-customevents2.png b/src/corelib/doc/images/statemachine-customevents2.png
deleted file mode 100644
index 57b37ef1dd..0000000000
--- a/src/corelib/doc/images/statemachine-customevents2.png
+++ /dev/null
Binary files differ
diff --git a/src/corelib/doc/images/statemachine-examples.png b/src/corelib/doc/images/statemachine-examples.png
deleted file mode 100644
index b2ec66e19d..0000000000
--- a/src/corelib/doc/images/statemachine-examples.png
+++ /dev/null
Binary files differ
diff --git a/src/corelib/doc/images/statemachine-finished.png b/src/corelib/doc/images/statemachine-finished.png
deleted file mode 100644
index 0ac081d6ba..0000000000
--- a/src/corelib/doc/images/statemachine-finished.png
+++ /dev/null
Binary files differ
diff --git a/src/corelib/doc/images/statemachine-nonparallel.png b/src/corelib/doc/images/statemachine-nonparallel.png
deleted file mode 100644
index f9850a74a6..0000000000
--- a/src/corelib/doc/images/statemachine-nonparallel.png
+++ /dev/null
Binary files differ
diff --git a/src/corelib/doc/images/statemachine-parallel.png b/src/corelib/doc/images/statemachine-parallel.png
deleted file mode 100644
index a65c297f5b..0000000000
--- a/src/corelib/doc/images/statemachine-parallel.png
+++ /dev/null
Binary files differ
diff --git a/src/corelib/doc/snippets/code/src_corelib_statemachine_qstatemachine.cpp b/src/corelib/doc/snippets/code/src_corelib_statemachine_qstatemachine.cpp
deleted file mode 100644
index c756116de4..0000000000
--- a/src/corelib/doc/snippets/code/src_corelib_statemachine_qstatemachine.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [simple state machine]
-QPushButton button;
-
-QStateMachine machine;
-QState *s1 = new QState();
-s1->assignProperty(&button, "text", "Click me");
-
-QFinalState *s2 = new QFinalState();
-s1->addTransition(&button, &QPushButton::clicked, s2);
-
-machine.addState(s1);
-machine.addState(s2);
-machine.setInitialState(s1);
-machine.start();
-//! [simple state machine]
diff --git a/src/corelib/doc/snippets/statemachine/eventtest.cpp b/src/corelib/doc/snippets/statemachine/eventtest.cpp
deleted file mode 100644
index d7d4ce0d21..0000000000
--- a/src/corelib/doc/snippets/statemachine/eventtest.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-class MyTransition : public QAbstractTransition
-{
- Q_OBJECT
-public:
- MyTransition() {}
-
-protected:
-//![0]
- bool eventTest(QEvent *event) override
- {
- if (event->type() == QEvent::Wrapped) {
- QEvent *wrappedEvent = static_cast<QStateMachine::WrappedEvent *>(event)->event();
- if (wrappedEvent->type() == QEvent::KeyPress) {
- QKeyEvent *keyEvent = static_cast<QKeyEvent *>(wrappedEvent);
- // Do your event test
- }
- }
- return false;
- }
-//![0]
-
- void onTransition(QEvent *event) override
- {
-
- }
-};
-
-int main(int argv, char **args)
-{
- return 0;
-}
diff --git a/src/corelib/doc/snippets/statemachine/main.cpp b/src/corelib/doc/snippets/statemachine/main.cpp
deleted file mode 100644
index c399f4f199..0000000000
--- a/src/corelib/doc/snippets/statemachine/main.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
-
- QLabel *label = new QLabel;
- QPushButton *button = new QPushButton;
-
-//![0]
- QStateMachine machine;
- QState *s1 = new QState();
- QState *s2 = new QState();
- QState *s3 = new QState();
-//![0]
-
-//![4]
- s1->assignProperty(label, "text", "In state s1");
- s2->assignProperty(label, "text", "In state s2");
- s3->assignProperty(label, "text", "In state s3");
-//![4]
-
-//![5]
- QObject::connect(s3, &QState::entered, button, &QPushButton:showMaximized);
- QObject::connect(s3, &QState::exited, button, &QPushButton::showMinimized);
-//![5]
-
-//![1]
- s1->addTransition(button, &QPushButton::clicked, s2);
- s2->addTransition(button, &QPushButton::clicked, s3);
- s3->addTransition(button, &QPushButton::clicked, s1);
-//![1]
-
-//![2]
- machine.addState(s1);
- machine.addState(s2);
- machine.addState(s3);
- machine.setInitialState(s1);
-//![2]
-
-//![3]
- machine.start();
-//![3]
-
- label->show();
-
- return app.exec();
-}
diff --git a/src/corelib/doc/snippets/statemachine/main2.cpp b/src/corelib/doc/snippets/statemachine/main2.cpp
deleted file mode 100644
index dedd2d29bf..0000000000
--- a/src/corelib/doc/snippets/statemachine/main2.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
-
- QStateMachine machine;
-
-//![0]
- 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);
-//![0]
-
-//![2]
- s12->addTransition(quitButton, &QPushButton::clicked, s12);
-//![2]
-
-//![1]
- QFinalState *s2 = new QFinalState();
- s1->addTransition(quitButton, &QPushButton::clicked, s2);
- machine.addState(s2);
- machine.setInitialState(s1);
-
- QObject::connect(&machine, &QStateMachine::finished,
- QCoreApplication::instance(), &QCoreApplication::quit);
-//![1]
-
- QButton *interruptButton = new QPushButton("Interrupt Button");
- QWidget *mainWindow = new QWidget();
-
-//![3]
- QHistoryState *s1h = new QHistoryState(s1);
-
- QState *s3 = new QState();
- s3->assignProperty(label, "text", "In s3");
- QMessageBox *mbox = new QMessageBox(mainWindow);
- mbox->addButton(QMessageBox::Ok);
- mbox->setText("Interrupted!");
- mbox->setIcon(QMessageBox::Information);
- QObject::connect(s3, &QState::entered, mbox, &QMessageBox::exec);
- s3->addTransition(s1h);
- machine.addState(s3);
-
- s1->addTransition(interruptButton, &QPushButton::clicked, s3);
-//![3]
-
- return app.exec();
-}
-
diff --git a/src/corelib/doc/snippets/statemachine/main3.cpp b/src/corelib/doc/snippets/statemachine/main3.cpp
deleted file mode 100644
index b665565aef..0000000000
--- a/src/corelib/doc/snippets/statemachine/main3.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
-
-//![0]
- QState *s1 = new QState(QState::ParallelStates);
- // s11 and s12 will be entered in parallel
- QState *s11 = new QState(s1);
- QState *s12 = new QState(s1);
-//![0]
-
-//![1]
- s1->addTransition(s1, &QState::finished, s2);
-//![1]
-
- return app.exec();
-}
-
diff --git a/src/corelib/doc/snippets/statemachine/main4.cpp b/src/corelib/doc/snippets/statemachine/main4.cpp
deleted file mode 100644
index e21656b91c..0000000000
--- a/src/corelib/doc/snippets/statemachine/main4.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-
-//![0]
-struct StringEvent : public QEvent
-{
- StringEvent(const QString &val)
- : QEvent(QEvent::Type(QEvent::User+1)),
- value(val) {}
-
- QString value;
-};
-//![0]
-
-//![1]
-class StringTransition : public QAbstractTransition
-{
- Q_OBJECT
-
-public:
- StringTransition(const QString &value)
- : m_value(value) {}
-
-protected:
- bool eventTest(QEvent *e) override
- {
- if (e->type() != QEvent::Type(QEvent::User+1)) // StringEvent
- return false;
- StringEvent *se = static_cast<StringEvent*>(e);
- return (m_value == se->value);
- }
-
- void onTransition(QEvent *) override {}
-
-private:
- QString m_value;
-};
-//![1]
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
-
-//![2]
- QStateMachine machine;
- QState *s1 = new QState();
- QState *s2 = new QState();
- QFinalState *done = new QFinalState();
-
- StringTransition *t1 = new StringTransition("Hello");
- t1->setTargetState(s2);
- s1->addTransition(t1);
- StringTransition *t2 = new StringTransition("world");
- t2->setTargetState(done);
- s2->addTransition(t2);
-
- machine.addState(s1);
- machine.addState(s2);
- machine.addState(done);
- machine.setInitialState(s1);
-//![2]
-
-//![3]
- machine.postEvent(new StringEvent("Hello"));
- machine.postEvent(new StringEvent("world"));
-//![3]
-
- return app.exec();
-}
-
-#include "main4.moc"
-
diff --git a/src/corelib/doc/snippets/statemachine/main5.cpp b/src/corelib/doc/snippets/statemachine/main5.cpp
deleted file mode 100644
index d701f51e2b..0000000000
--- a/src/corelib/doc/snippets/statemachine/main5.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
- QWidget *button;
-
- {
-//![0]
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties);
-
- QState *s1 = new QState();
- s1->assignProperty(object, "fooBar", 1.0);
- machine.addState(s1);
- machine.setInitialState(s1);
-
- QState *s2 = new QState();
- machine.addState(s2);
-//![0]
- }
-
- {
-
-//![2]
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties);
-
- QState *s1 = new QState();
- s1->assignProperty(object, "fooBar", 1.0);
- machine.addState(s1);
- machine.setInitialState(s1);
-
- QState *s2 = new QState(s1);
- s2->assignProperty(object, "fooBar", 2.0);
- s1->setInitialState(s2);
-
- QState *s3 = new QState(s1);
-//![2]
-
- }
-
- {
-//![3]
- QState *s1 = new QState();
- QState *s2 = new QState();
-
- s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50));
- s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100));
-
- s1->addTransition(button, &QPushButton::clicked, s2);
-//![3]
-
- }
-
- {
-//![4]
- QState *s1 = new QState();
- QState *s2 = new QState();
-
- s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50));
- s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100));
-
- QSignalTransition *transition = s1->addTransition(button, &QPushButton::clicked, s2);
- transition->addAnimation(new QPropertyAnimation(button, "geometry"));
-//![4]
-
- }
-
- {
- QMainWindow *mainWindow = 0;
-
-//![5]
- QMessageBox *messageBox = new QMessageBox(mainWindow);
- messageBox->addButton(QMessageBox::Ok);
- messageBox->setText("Button geometry has been set!");
- messageBox->setIcon(QMessageBox::Information);
-
- QState *s1 = new QState();
-
- QState *s2 = new QState();
- s2->assignProperty(button, "geometry", QRectF(0, 0, 50, 50));
- connect(s2, &QState::entered, messageBox, SLOT(exec()));
-
- s1->addTransition(button, &QPushButton::clicked, s2);
-//![5]
- }
-
- {
- QMainWindow *mainWindow = 0;
-
-//![6]
- QMessageBox *messageBox = new QMessageBox(mainWindow);
- messageBox->addButton(QMessageBox::Ok);
- messageBox->setText("Button geometry has been set!");
- messageBox->setIcon(QMessageBox::Information);
-
- QState *s1 = new QState();
-
- QState *s2 = new QState();
- s2->assignProperty(button, "geometry", QRectF(0, 0, 50, 50));
-
- QState *s3 = new QState();
- connect(s3, &QState::entered, messageBox, SLOT(exec()));
-
- s1->addTransition(button, &QPushButton::clicked, s2);
- s2->addTransition(s2, &QState::propertiesAssigned, s3);
-//![6]
-
- }
-
- {
-
-//![7]
- QState *s1 = new QState();
- QState *s2 = new QState();
-
- s2->assignProperty(object, "fooBar", 2.0);
- s1->addTransition(s2);
-
- QStateMachine machine;
- machine.setInitialState(s1);
- machine.addDefaultAnimation(new QPropertyAnimation(object, "fooBar"));
-//![7]
-
- }
-
-
-
- return app.exec();
-}
-
diff --git a/src/corelib/doc/src/animation.qdoc b/src/corelib/doc/src/animation.qdoc
index 9cbe50d4a9..16569ded0b 100644
--- a/src/corelib/doc/src/animation.qdoc
+++ b/src/corelib/doc/src/animation.qdoc
@@ -326,47 +326,4 @@
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
- can associate one or more animations to a transition between states
- using a QSignalTransition or QEventTransition class. These classes
- are both derived from QAbstractTransition, which defines the
- convenience function \l{QAbstractTransition::}{addAnimation()} that
- enables the appending of one or more animations triggered when the
- transition occurs.
-
- 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);
- state1->assignProperty(button, "geometry", QRect(0, 0, 100, 30));
- machine->setInitialState(state1);
-
- QState *state2 = new QState(machine);
- state2->assignProperty(button, "geometry", QRect(250, 250, 100, 30));
-
- QSignalTransition *transition1 = state1->addTransition(button,
- &QPushButton::clicked, state2);
- transition1->addAnimation(new QPropertyAnimation(button, "geometry"));
-
- QSignalTransition *transition2 = state2->addTransition(button,
- &QPushButton::clicked, state1);
- transition2->addAnimation(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/src/corelib/doc/src/statemachine.qdoc b/src/corelib/doc/src/statemachine.qdoc
deleted file mode 100644
index 881a0785c6..0000000000
--- a/src/corelib/doc/src/statemachine.qdoc
+++ /dev/null
@@ -1,577 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \group statemachine
- \brief How to create and execute state graphs.
- \title State Machine Classes
-
- These \l{Qt Core} classes are part of the \l{The State Machine Framework}{
- State Machine Framework}.
-
-*/
-
-/*!
- \page statemachine-api.html
- \title The State Machine Framework
- \brief An overview of the State Machine framework for constructing and executing state graphs.
-
- \ingroup frameworks-technologies
-
- \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{http://www.wisdom.weizmann.ac.il/~dharel/SCANNED.PAPERS/Statecharts.pdf}{Statecharts: A visual formalism for complex systems}, 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 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 {QObject}s.
- Qt's event system is used to drive the state machines.
-
- The state graph in the State Machine framework is hierarchical. States can be nested inside of
- other states, and the current configuration of the state machine consists of the set of states
- which are currently active. All the states in a valid configuration of the state machine will
- have a common ancestor.
-
- \sa {The Declarative State Machine Framework}
-
- \section1 Classes in the State Machine Framework
-
- These classes are provided by qt for creating event-driven state machines.
-
- \annotatedlist statemachine
-
- \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:
-
- \image statemachine-button.png
- \omit
- \caption This is a caption
- \endomit
-
- The following snippet shows the code needed to create such a state machine.
- First, we create the state machine and states:
-
- \snippet statemachine/main.cpp 0
-
- Then, we create the transitions by using the QState::addTransition()
- function:
-
- \snippet statemachine/main.cpp 1
-
- Next, we add the states to the machine and set the machine's initial state:
-
- \snippet statemachine/main.cpp 2
-
- Finally, we start the state machine:
-
- \snippet statemachine/main.cpp 3
-
- The state machine executes asynchronously, i.e. it becomes part of your
- application's event loop.
-
- \section1 Doing Useful Work on State Entry and Exit
-
- The above state machine merely transitions from one state to another, it
- doesn't perform any operations. The QState::assignProperty() 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:
-
- \snippet statemachine/main.cpp 4
-
- When any of the states is entered, the label's text will be changed
- accordingly.
-
- The QState::entered() signal is emitted when the state is entered, and the
- QState::exited() signal is emitted when the state is exited. In the
- following snippet, the button's \l {QPushButton::}{showMaximized()} slot
- will be called when state \c s3 is entered, and the button's \l {QPushButton::}{showMinimized()}
- slot will be called when \c s3 is exited:
-
- \snippet statemachine/main.cpp 5
-
- Custom states can reimplement QAbstractState::onEntry() and
- QAbstractState::onExit().
-
- \section1 State Machines That Finish
-
- 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 (QFinalState object). When the state machine enters a top-level
- final state, the machine will emit the QStateMachine::finished() signal and
- halt.
-
- All you need to do to introduce a final state in the graph is create a
- QFinalState object and use it as the target of one or more transitions.
-
- \section1 Sharing Transitions By Grouping States
-
- 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 \l{QPushButton::}{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.
-
- \image 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).
-
- \snippet statemachine/main2.cpp 0
-
- \snippet statemachine/main2.cpp 1
-
- In this case we want the application to quit when the state machine is
- finished, so the machine's \l {QStateMachine::}{finished()} signal is connected to the
- application's \l {QCoreApplication::}{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.
-
- \snippet statemachine/main2.cpp 2
-
- A transition can have any state as its target, i.e. the target state does
- not have to be on the same level in the state hierarchy as the source state.
-
- \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.
-
- \image 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.
-
- \snippet statemachine/main2.cpp 3
-
- \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.
-
- \image 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.
-
- \image statemachine-parallel.png
- \omit
- \caption This is a caption
- \endomit
-
- To create a parallel state group, pass QState::ParallelStates to the QState
- constructor.
-
- \snippet statemachine/main3.cpp 0
-
- When a parallel state group is entered, all its child states will be
- simultaneously entered. Transitions within the individual child states
- operate normally. However, any of the child states may take a transition which exits the parent
- state. When this happens, the parent state and all of its child states are exited.
-
- The parallelism in the State Machine framework follows an interleaved semantics. All parallel
- operations will be executed in a single, atomic step of the event processing, so no event can
- interrupt the parallel operations. However, events will still be processed sequentially, since
- the machine itself is single threaded. As an example: Consider the situation where there are two
- transitions that exit the same parallel state group, and their conditions become true
- simultaneously. In this case, the event that is processed last of the two will not have any
- effect, since the first event will already have caused the machine to exit from the parallel
- state.
-
- \section1 Detecting that a Composite State has Finished
-
- A child state can be final (a QFinalState object); when a final child state
- is entered, the parent state emits the QState::finished() signal. The
- following diagram shows a composite state \c s1 which does some processing
- before entering a final state:
-
- \image statemachine-finished.png
- \omit
- \caption This is a caption
- \endomit
-
- When \c s1 's final state is entered, \c s1 will automatically emit
- \l {QState::}{finished()}. We use a signal transition to cause this event to trigger a
- state change:
-
- \snippet statemachine/main3.cpp 1
-
- Using final states in composite states is useful when you want to hide the
- internal details of a composite 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 completed its work. This is a very powerful abstraction and
- encapsulation mechanism when building complex (deeply nested) state
- machines. (In the above example, you could of course create a transition
- directly from \c s1 's \c done state rather than relying on \c s1 's
- \l {QState::}{finished()} signal, but with the consequence that implementation details of
- \c s1 are exposed and depended on).
-
- For parallel state groups, the QState::finished() signal is emitted when \e
- all the child states have entered final states.
-
- \section1 Targetless Transitions
-
- A transition need not have a target state. A transition without a target can
- be triggered the same way as any other transition; the difference is that
- when a targetless transition is triggered, it doesn't cause any state
- changes. This allows you to react to a signal or event when your machine is
- in a certain state, without having to leave that state. Example:
-
- \code
- QStateMachine machine;
- QState *s1 = new QState(&machine);
-
- QPushButton button;
- QSignalTransition *trans = new QSignalTransition(&button, &QPushButton::clicked);
- s1->addTransition(trans);
-
- QMessageBox msgBox;
- msgBox.setText("The button was clicked; carry on.");
- QObject::connect(trans, QSignalTransition::triggered, &msgBox, &QMessageBox::exec);
-
- machine.setInitialState(s1);
- \endcode
-
- The message box will be displayed each time the button is clicked, but the
- state machine will remain in its current state (s1). If the target state
- were explicitly set to s1, however, s1 would be exited and re-entered each
- time (e.g. the QAbstractState::entered() and QAbstractState::exited()
- signals would be emitted).
-
- \section1 Events, Transitions and Guards
-
- A QStateMachine runs its own event loop. For signal transitions
- (QSignalTransition objects), QStateMachine automatically posts a
- QStateMachine::SignalEvent to itself when it intercepts the corresponding
- signal; similarly, for QObject event transitions (QEventTransition objects)
- a QStateMachine::WrappedEvent is posted.
-
- You can post your own events to the state machine using
- QStateMachine::postEvent().
-
- When posting a custom event to the state machine, you typically also have
- one or more custom transitions that can be triggered from events of that
- type. To create such a transition, you subclass QAbstractTransition and
- reimplement QAbstractTransition::eventTest(), where you check if an event
- matches your event type (and optionally other criteria, e.g. attributes of
- the event object).
-
- Here we define our own custom event type, \c StringEvent, for posting
- strings to the state machine:
-
- \snippet statemachine/main4.cpp 0
-
- Next, we define a transition that only triggers when the event's string
- matches a particular string (a \e guarded transition):
-
- \snippet statemachine/main4.cpp 1
-
- In the \l {QAbstractTransition::}{eventTest()} reimplementation, we first check if the event type is the
- desired one; if so, we cast the event to a \c StringEvent and perform the
- string comparison.
-
- The following is a statechart that uses the custom event and transition:
-
- \image statemachine-customevents.png
- \omit
- \caption This is a caption
- \endomit
-
- Here's what the implementation of the statechart looks like:
-
- \snippet statemachine/main4.cpp 2
-
- Once the machine is started, we can post events to it.
-
- \snippet statemachine/main4.cpp 3
-
- An event that is not handled by any relevant transition will be silently
- consumed by the state machine. It can be useful to group states and provide
- a default handling of such events; for example, as illustrated in the
- following statechart:
-
- \image statemachine-customevents2.png
- \omit
- \caption This is a caption
- \endomit
-
- For deeply nested statecharts, you can add such "fallback" transitions at
- the level of granularity that's most appropriate.
-
- \section1 Using Restore Policy To Automatically Restore Properties
-
- In some state machines it can be useful to focus the attention on assigning properties in states,
- not on restoring them when the state is no longer active. If you know that a property should
- always be restored to its initial value when the machine enters a state that does not explicitly
- give the property a value, you can set the global restore policy to
- QStateMachine::RestoreProperties.
-
- \code
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties);
- \endcode
-
- When this restore policy is set, the machine will automatically restore all properties. If it
- enters a state where a given property is not set, it will first search the hierarchy of ancestors
- to see if the property is defined there. If it is, the property will be restored to the value
- defined by the closest ancestor. If not, it will be restored to its initial value (i.e. the
- value of the property before any property assignments in states were executed.)
-
- Take the following code:
-
- \snippet statemachine/main5.cpp 0
-
- Lets say the property \c fooBar is 0.0 when the machine starts. When the machine is in state
- \c s1, the property will be 1.0, since the state explicitly assigns this value to it. When the
- machine is in state \c s2, no value is explicitly defined for the property, so it will implicitly
- be restored to 0.0.
-
- If we are using nested states, the parent defines a value for the property which is inherited by
- all descendants that do not explicitly assign a value to the property.
-
- \snippet statemachine/main5.cpp 2
-
- Here \c s1 has two children: \c s2 and \c s3. When \c s2 is entered, the property \c fooBar
- will have the value 2.0, since this is explicitly defined for the state. When the machine is in
- state \c s3, no value is defined for the state, but \c s1 defines the property to be 1.0, so this
- is the value that will be assigned to \c fooBar.
-
- \section1 Animating Property Assignments
-
- The State Machine API connects with the Animation API in Qt to allow automatically animating
- properties as they are assigned in states.
-
- Say we have the following code:
-
- \snippet statemachine/main5.cpp 3
-
- Here we define two states of a user interface. In \c s1 the \c button is small, and in \c s2
- it is bigger. If we click the button to transition from \c s1 to \c s2, the geometry of the button
- will be set immediately when a given state has been entered. If we want the transition to be
- smooth, however, all we need to do is make a QPropertyAnimation and add this to the transition
- object.
-
- \snippet statemachine/main5.cpp 4
-
- Adding an animation for the property in question means that the property assignment will no
- longer take immediate effect when the state has been entered. Instead, the animation will start
- playing when the state has been entered and smoothly animate the property assignment. Since we
- do not set the start value or end value of the animation, these will be set implicitly. The
- start value of the animation will be the property's current value when the animation starts, and
- the end value will be set based on the property assignments defined for the state.
-
- If the global restore policy of the state machine is set to QStateMachine::RestoreProperties,
- it is possible to also add animations for the property restorations.
-
- \section1 Detecting That All Properties Have Been Set In A State
-
- When animations are used to assign properties, a state no longer defines the exact values that a
- property will have when the machine is in the given state. While the animation is running, the
- property can potentially have any value, depending on the animation.
-
- In some cases, it can be useful to be able to detect when the property has actually been assigned
- the value defined by a state.
-
- Say we have the following code:
-
- \snippet statemachine/main5.cpp 5
-
- When \c button is clicked, the machine will transition into state \c s2, which will set the
- geometry of the button, and then pop up a message box to alert the user that the geometry has
- been changed.
-
- In the normal case, where animations are not used, this will operate as expected. However, if
- an animation for the \c geometry of \c button is set on the transition between \c s1 and \c s2,
- the animation will be started when \c s2 is entered, but the \c geometry property will not
- actually reach its defined value before the animation is finished running. In this case, the
- message box will pop up before the geometry of the button has actually been set.
-
- To ensure that the message box does not pop up until the geometry actually reaches its final
- value, we can use the state's \l {QState::}{propertiesAssigned()} signal. The \l {QState::}{propertiesAssigned()} signal will be
- emitted when the property is assigned its final value, whether this is done immediately or
- after the animation has finished playing.
-
- \snippet statemachine/main5.cpp 6
-
- In this example, when \c button is clicked, the machine will enter \c s2. It will remain in state
- \c s2 until the \c geometry property has been set to \c QRect(0, 0, 50, 50). Then it will
- transition into \c s3. When \c s3 is entered, the message box will pop up. If the transition into
- \c s2 has an animation for the \c geometry property, then the machine will stay in \c s2 until the
- animation has finished playing. If there is no such animation, it will simply set the property and
- immediately enter state \c s3.
-
- Either way, when the machine is in state \c s3, you are guaranteed that the property \c geometry
- has been assigned the defined value.
-
- If the global restore policy is set to QStateMachine::RestoreProperties, the state will not emit
- the \l {QState::}{propertiesAssigned()} signal until these have been executed as well.
-
- \section1 What Happens If A State Is Exited Before The Animation Has Finished
-
- If a state has property assignments, and the transition into the state has animations for the
- properties, the state can potentially be exited before the properties have been assigned to the
- values defines by the state. This is true in particular when there are transitions out from the
- state that do not depend on the \l {QState::}{propertiesAssigned()} signal, as described in the previous section.
-
- The State Machine API guarantees that a property assigned by the state machine either:
- \list
- \li Has a value explicitly assigned to the property.
- \li Is currently being animated into a value explicitly assigned to the property.
- \endlist
-
- When a state is exited prior to the animation finishing, the behavior of the state machine depends
- on the target state of the transition. If the target state explicitly assigns a value to the
- property, no additional action will be taken. The property will be assigned the value defined by
- the target state.
-
- If the target state does not assign any value to the property, there are two
- options: By default, the property will be assigned the value defined by the state it is leaving
- (the value it would have been assigned if the animation had been permitted to finish playing). If
- a global restore policy is set, however, this will take precedence, and the property will be
- restored as usual.
-
- \section1 Default Animations
-
- As described earlier, you can add animations to transitions to make sure property assignments
- in the target state are animated. If you want a specific animation to be used for a given property
- regardless of which transition is taken, you can add it as a default animation to the state
- machine. This is in particular useful when the properties assigned (or restored) by specific
- states is not known when the machine is constructed.
-
- \code
- QState *s1 = new QState();
- QState *s2 = new QState();
-
- s2->assignProperty(object, "fooBar", 2.0);
- s1->addTransition(s2);
-
- QStateMachine machine;
- machine.setInitialState(s1);
- machine.addDefaultAnimation(new QPropertyAnimation(object, "fooBar"));
- \endcode
-
- When the machine is in state \c s2, the machine will play the default animation for the
- property \c fooBar since this property is assigned by \c s2.
-
- Note that animations explicitly set on transitions will take precedence over any default
- animation for the given property.
-
- \section1 Nesting State Machines
-
- QStateMachine is a subclass of QState. This allows for a state machine to be a child state of
- another machine. QStateMachine reimplements QState::onEntry() and calls QStateMachine::start(),
- so that when the child state machine is entered, it will automatically start running.
-
- The parent state machine treats the child machine as an \e atomic state in the state machine
- algorithm. The child state machine is self-contained; it maintains its own event queue and
- configuration. In particular, note that the \l{QStateMachine::}{configuration()}
- of the child machine is not part of the parent machine's configuration (only the child machine
- itself is).
-
- States of the child state machine cannot be specified as targets of transitions in the parent
- state machine; only the child state machine itself can. Conversely, states of the parent state
- machine cannot be specified as targets of transitions in the child state machine. The child
- state machine's \l{QState::}{finished}() signal can be used to trigger a transition
- in the parent machine.
-*/
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 303190ae69..ab1d500087 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -2207,6 +2207,22 @@ void QCoreApplicationPrivate::setApplicationFilePath(const QString &path)
QCoreApplicationPrivate::cachedApplicationFilePath = new QString(path);
}
+#ifndef QT_NO_QOBJECT
+QEvent *QCoreApplicationPrivate::cloneEvent(QEvent *e)
+{
+ switch (e->type()) {
+ case QEvent::None:
+ return new QEvent(*e);
+ case QEvent::Timer:
+ return new QTimerEvent(*static_cast<QTimerEvent*>(e));
+ default:
+ Q_ASSERT_X(false, "cloneEvent()", "not implemented");
+ break;
+ }
+ return nullptr;
+}
+#endif
+
/*!
Returns the directory that contains the application executable.
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index cb3a5a8a4f..08a7e974ea 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -74,6 +74,10 @@ typedef QList<QTranslator*> QTranslatorList;
class QAbstractEventDispatcher;
+#ifndef QT_NO_QOBJECT
+class QEvent;
+#endif
+
class Q_CORE_EXPORT QCoreApplicationPrivate
#ifndef QT_NO_QOBJECT
: public QObjectPrivate
@@ -197,6 +201,10 @@ public:
#ifdef QT_NO_QOBJECT
QCoreApplication *q_ptr;
#endif
+
+#ifndef QT_NO_QOBJECT
+ virtual QEvent *cloneEvent(QEvent *e);
+#endif
};
QT_END_NAMESPACE
diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp
deleted file mode 100644
index 10f54c3e18..0000000000
--- a/src/corelib/statemachine/qabstractstate.cpp
+++ /dev/null
@@ -1,239 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qabstractstate.h"
-#include "qabstractstate_p.h"
-#include "qstate.h"
-#include "qstate_p.h"
-#include "qstatemachine.h"
-#include "qstatemachine_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QAbstractState
- \inmodule QtCore
-
- \brief The QAbstractState class is the base class of states of a QStateMachine.
-
- \since 4.6
- \ingroup statemachine
-
- The QAbstractState class is the abstract base class of states that are part
- of a QStateMachine. It defines the interface that all state objects have in
- common. QAbstractState is part of \l{The State Machine Framework}.
-
- The entered() signal is emitted when the state has been entered. The
- exited() signal is emitted when the state has been exited.
-
- The parentState() function returns the state's parent state. The machine()
- function returns the state machine that the state is part of.
-
- \section1 Subclassing
-
- The onEntry() function is called when the state is entered; reimplement this
- function to perform custom processing when the state is entered.
-
- The onExit() function is called when the state is exited; reimplement this
- function to perform custom processing when the state is exited.
-*/
-
-/*!
- \property QAbstractState::active
- \since 5.4
-
- \brief the active property of this state. A state is active between
- entered() and exited() signals.
-*/
-
-
-QAbstractStatePrivate::QAbstractStatePrivate(StateType type)
- : stateType(type), isMachine(false), active(false), parentState(nullptr)
-{
-}
-
-QStateMachine *QAbstractStatePrivate::machine() const
-{
- QObject *par = parent;
- while (par != nullptr) {
- if (QStateMachine *mach = qobject_cast<QStateMachine*>(par))
- return mach;
- par = par->parent();
- }
- return nullptr;
-}
-
-void QAbstractStatePrivate::callOnEntry(QEvent *e)
-{
- Q_Q(QAbstractState);
- q->onEntry(e);
-}
-
-void QAbstractStatePrivate::callOnExit(QEvent *e)
-{
- Q_Q(QAbstractState);
- q->onExit(e);
-}
-
-void QAbstractStatePrivate::emitEntered()
-{
- Q_Q(QAbstractState);
- emit q->entered(QAbstractState::QPrivateSignal());
- if (!active) {
- active = true;
- emit q->activeChanged(true);
- }
-}
-
-void QAbstractStatePrivate::emitExited()
-{
- Q_Q(QAbstractState);
- if (active) {
- active = false;
- emit q->activeChanged(false);
- }
- emit q->exited(QAbstractState::QPrivateSignal());
-}
-
-/*!
- Constructs a new state with the given \a parent state.
-*/
-QAbstractState::QAbstractState(QState *parent)
- : QObject(*new QAbstractStatePrivate(QAbstractStatePrivate::AbstractState), parent)
-{
-}
-
-/*!
- \internal
-*/
-QAbstractState::QAbstractState(QAbstractStatePrivate &dd, QState *parent)
- : QObject(dd, parent)
-{
-}
-
-/*!
- Destroys this state.
-*/
-QAbstractState::~QAbstractState()
-{
-}
-
-/*!
- Returns this state's parent state, or \nullptr if the state has no
- parent state.
-*/
-QState *QAbstractState::parentState() const
-{
- Q_D(const QAbstractState);
- if (d->parentState != parent())
- d->parentState = qobject_cast<QState*>(parent());
- return d->parentState;
-}
-
-/*!
- Returns the state machine that this state is part of, or \nullptr if
- the state is not part of a state machine.
-*/
-QStateMachine *QAbstractState::machine() const
-{
- Q_D(const QAbstractState);
- return d->machine();
-}
-
-/*!
- Returns whether this state is active.
-
- \sa activeChanged(bool), entered(), exited()
-*/
-bool QAbstractState::active() const
-{
- Q_D(const QAbstractState);
- return d->active;
-}
-
-/*!
- \fn QAbstractState::onExit(QEvent *event)
-
- This function is called when the state is exited. The given \a event is what
- caused the state to be exited. Reimplement this function to perform custom
- processing when the state is exited.
-*/
-
-/*!
- \fn QAbstractState::onEntry(QEvent *event)
-
- This function is called when the state is entered. The given \a event is
- what caused the state to be entered. Reimplement this function to perform
- custom processing when the state is entered.
-*/
-
-/*!
- \fn QAbstractState::entered()
-
- This signal is emitted when the state has been entered (after onEntry() has
- been called).
-*/
-
-/*!
- \fn QAbstractState::exited()
-
- This signal is emitted when the state has been exited (after onExit() has
- been called).
-*/
-
-/*!
- \fn QAbstractState::activeChanged(bool active)
- \since 5.4
-
- This signal is emitted when the active property is changed with \a active as argument.
-
- \sa QAbstractState::active, entered(), exited()
-*/
-
-/*!
- \reimp
-*/
-bool QAbstractState::event(QEvent *e)
-{
- return QObject::event(e);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qabstractstate.cpp"
diff --git a/src/corelib/statemachine/qabstractstate.h b/src/corelib/statemachine/qabstractstate.h
deleted file mode 100644
index ffc2eaae13..0000000000
--- a/src/corelib/statemachine/qabstractstate.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTSTATE_H
-#define QABSTRACTSTATE_H
-
-#include <QtCore/qobject.h>
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-class QState;
-class QStateMachine;
-
-class QAbstractStatePrivate;
-class Q_CORE_EXPORT QAbstractState : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(bool active READ active NOTIFY activeChanged)
-public:
- ~QAbstractState();
-
- QState *parentState() const;
- QStateMachine *machine() const;
-
- bool active() const;
-
-Q_SIGNALS:
- void entered(QPrivateSignal);
- void exited(QPrivateSignal);
- void activeChanged(bool active);
-
-protected:
- QAbstractState(QState *parent = nullptr);
-
- virtual void onEntry(QEvent *event) = 0;
- virtual void onExit(QEvent *event) = 0;
-
- bool event(QEvent *e) override;
-
-protected:
- QAbstractState(QAbstractStatePrivate &dd, QState *parent);
-
-private:
- Q_DISABLE_COPY(QAbstractState)
- Q_DECLARE_PRIVATE(QAbstractState)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/qabstractstate_p.h b/src/corelib/statemachine/qabstractstate_p.h
deleted file mode 100644
index 11befc187e..0000000000
--- a/src/corelib/statemachine/qabstractstate_p.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTSTATE_P_H
-#define QABSTRACTSTATE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qobject_p.h>
-#include <QtCore/qabstractstate.h>
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-class QStateMachine;
-
-class QState;
-class QAbstractStatePrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QAbstractState)
-
-public:
- enum StateType {
- AbstractState,
- StandardState,
- FinalState,
- HistoryState
- };
-
- QAbstractStatePrivate(StateType type);
-
- static QAbstractStatePrivate *get(QAbstractState *q)
- { return q->d_func(); }
- static const QAbstractStatePrivate *get(const QAbstractState *q)
- { return q->d_func(); }
-
- QStateMachine *machine() const;
-
- void callOnEntry(QEvent *e);
- void callOnExit(QEvent *e);
-
- void emitEntered();
- void emitExited();
-
- uint stateType:30;
- uint isMachine:1;
- bool active:1;
- mutable QState *parentState;
-};
-
-QT_END_NAMESPACE
-
-#endif // QABSTRACTSTATE_P_H
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
deleted file mode 100644
index b1cbc1c516..0000000000
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ /dev/null
@@ -1,435 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qabstracttransition.h"
-#include "qabstracttransition_p.h"
-#include "qabstractstate.h"
-#include "qhistorystate.h"
-#include "qstate.h"
-#include "qstatemachine.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QAbstractTransition
- \inmodule QtCore
-
- \brief The QAbstractTransition class is the base class of transitions between QAbstractState objects.
-
- \since 4.6
- \ingroup statemachine
-
- The QAbstractTransition class is the abstract base class of transitions
- between states (QAbstractState objects) of a
- QStateMachine. QAbstractTransition is part of \l{The State Machine
- Framework}.
-
- The sourceState() function returns the source of the transition. The
- targetStates() function returns the targets of the transition. The machine()
- function returns the state machine that the transition is part of.
-
- The triggered() signal is emitted when the transition has been triggered.
-
- Transitions can cause animations to be played. Use the addAnimation()
- function to add an animation to the transition.
-
- \section1 Subclassing
-
- The eventTest() function is called by the state machine to determine whether
- an event should trigger the transition. In your reimplementation you
- typically check the event type and cast the event object to the proper type,
- and check that one or more properties of the event meet your criteria.
-
- The onTransition() function is called when the transition is triggered;
- reimplement this function to perform custom processing for the transition.
-*/
-
-/*!
- \property QAbstractTransition::sourceState
-
- \brief the source state (parent) of this transition
-*/
-
-/*!
- \property QAbstractTransition::targetState
-
- \brief the target state of this transition
-
- If a transition has no target state, the transition may still be
- triggered, but this will not cause the state machine's configuration to
- change (i.e. the current state will not be exited and re-entered).
-*/
-
-/*!
- \property QAbstractTransition::targetStates
-
- \brief the target states of this transition
-
- If multiple states are specified, all must be descendants of the same
- parallel group state.
-*/
-
-/*!
- \property QAbstractTransition::transitionType
-
- \brief indicates whether this transition is an internal transition, or an external transition.
-
- Internal and external transitions behave the same, except for the case of a transition whose
- source state is a compound state and whose target(s) is a descendant of the source. In such a
- case, an internal transition will not exit and re-enter its source state, while an external one
- will.
-
- By default, the type is an external transition.
-*/
-
-/*!
- \enum QAbstractTransition::TransitionType
-
- This enum specifies the kind of transition. By default, the type is an external transition.
-
- \value ExternalTransition Any state that is the source state of a transition (which is not a
- target-less transition) is left, and re-entered when necessary.
- \value InternalTransition If the target state of a transition is a sub-state of a compound state,
- and that compound state is the source state, an internal transition will
- not leave the source state.
-
- \sa QAbstractTransition::transitionType
-*/
-
-QAbstractTransitionPrivate::QAbstractTransitionPrivate()
- : transitionType(QAbstractTransition::ExternalTransition)
-{
-}
-
-QStateMachine *QAbstractTransitionPrivate::machine() const
-{
- if (QState *source = sourceState())
- return source->machine();
- Q_Q(const QAbstractTransition);
- if (QHistoryState *parent = qobject_cast<QHistoryState *>(q->parent()))
- return parent->machine();
- return nullptr;
-}
-
-bool QAbstractTransitionPrivate::callEventTest(QEvent *e)
-{
- Q_Q(QAbstractTransition);
- return q->eventTest(e);
-}
-
-void QAbstractTransitionPrivate::callOnTransition(QEvent *e)
-{
- Q_Q(QAbstractTransition);
- q->onTransition(e);
-}
-
-QState *QAbstractTransitionPrivate::sourceState() const
-{
- return qobject_cast<QState*>(parent);
-}
-
-void QAbstractTransitionPrivate::emitTriggered()
-{
- Q_Q(QAbstractTransition);
- emit q->triggered(QAbstractTransition::QPrivateSignal());
-}
-
-/*!
- Constructs a new QAbstractTransition object with the given \a sourceState.
-*/
-QAbstractTransition::QAbstractTransition(QState *sourceState)
- : QObject(*new QAbstractTransitionPrivate, sourceState)
-{
-}
-
-/*!
- \internal
-*/
-QAbstractTransition::QAbstractTransition(QAbstractTransitionPrivate &dd,
- QState *parent)
- : QObject(dd, parent)
-{
-}
-
-/*!
- Destroys this transition.
-*/
-QAbstractTransition::~QAbstractTransition()
-{
-}
-
-/*!
- Returns the source state of this transition, or \nullptr if this
- transition has no source state.
-*/
-QState *QAbstractTransition::sourceState() const
-{
- Q_D(const QAbstractTransition);
- return d->sourceState();
-}
-
-/*!
- Returns the target state of this transition, or \nullptr if the
- transition has no target.
-*/
-QAbstractState *QAbstractTransition::targetState() const
-{
- Q_D(const QAbstractTransition);
- if (d->targetStates.isEmpty())
- return nullptr;
- return d->targetStates.first().data();
-}
-
-/*!
- Sets the \a target state of this transition.
-*/
-void QAbstractTransition::setTargetState(QAbstractState* target)
-{
- Q_D(QAbstractTransition);
- if ((d->targetStates.size() == 1 && target == d->targetStates.at(0).data()) ||
- (d->targetStates.isEmpty() && target == nullptr)) {
- return;
- }
- if (!target)
- d->targetStates.clear();
- else
- setTargetStates(QList<QAbstractState*>() << target);
- emit targetStateChanged(QPrivateSignal());
-}
-
-/*!
- Returns the target states of this transition, or an empty list if this
- transition has no target states.
-*/
-QList<QAbstractState*> QAbstractTransition::targetStates() const
-{
- Q_D(const QAbstractTransition);
- QList<QAbstractState*> result;
- for (int i = 0; i < d->targetStates.size(); ++i) {
- QAbstractState *target = d->targetStates.at(i).data();
- if (target)
- result.append(target);
- }
- return result;
-}
-
-/*!
- Sets the target states of this transition to be the given \a targets.
-*/
-void QAbstractTransition::setTargetStates(const QList<QAbstractState*> &targets)
-{
- Q_D(QAbstractTransition);
-
- // Verify if any of the new target states is a null-pointer:
- for (int i = 0; i < targets.size(); ++i) {
- if (targets.at(i) == nullptr) {
- qWarning("QAbstractTransition::setTargetStates: target state(s) cannot be null");
- return;
- }
- }
-
- // First clean out any target states that got destroyed, but for which we still have a QPointer
- // around.
- for (int i = 0; i < d->targetStates.size(); ) {
- if (d->targetStates.at(i).isNull()) {
- d->targetStates.remove(i);
- } else {
- ++i;
- }
- }
-
- // Easy check: if both lists are empty, we're done.
- if (targets.isEmpty() && d->targetStates.isEmpty())
- return;
-
- bool sameList = true;
-
- if (targets.size() != d->targetStates.size()) {
- // If the sizes of the lists are different, we don't need to be smart: they're different. So
- // we can just set the new list as the targetStates.
- sameList = false;
- } else {
- QList<QPointer<QAbstractState>> copy(d->targetStates);
- for (int i = 0; i < targets.size(); ++i) {
- sameList &= copy.removeOne(targets.at(i));
- if (!sameList)
- break; // ok, we now know the lists are not the same, so stop the loop.
- }
-
- sameList &= copy.isEmpty();
- }
-
- if (sameList)
- return;
-
- d->targetStates.resize(targets.size());
- for (int i = 0; i < targets.size(); ++i) {
- d->targetStates[i] = targets.at(i);
- }
-
- emit targetStatesChanged(QPrivateSignal());
-}
-
-/*!
- Returns the type of the transition.
-*/
-QAbstractTransition::TransitionType QAbstractTransition::transitionType() const
-{
- Q_D(const QAbstractTransition);
- return d->transitionType;
-}
-
-/*!
- Sets the type of the transition to \a type.
-*/
-void QAbstractTransition::setTransitionType(TransitionType type)
-{
- Q_D(QAbstractTransition);
- d->transitionType = type;
-}
-
-/*!
- Returns the state machine that this transition is part of, or
- \nullptr if the transition is not part of a state machine.
-*/
-QStateMachine *QAbstractTransition::machine() const
-{
- Q_D(const QAbstractTransition);
- return d->machine();
-}
-
-#if QT_CONFIG(animation)
-
-/*!
- Adds the given \a animation to this transition.
- The transition does not take ownership of the animation.
-
- \sa removeAnimation(), animations()
-*/
-void QAbstractTransition::addAnimation(QAbstractAnimation *animation)
-{
- Q_D(QAbstractTransition);
- if (!animation) {
- qWarning("QAbstractTransition::addAnimation: cannot add null animation");
- return;
- }
- d->animations.append(animation);
-}
-
-/*!
- Removes the given \a animation from this transition.
-
- \sa addAnimation()
-*/
-void QAbstractTransition::removeAnimation(QAbstractAnimation *animation)
-{
- Q_D(QAbstractTransition);
- if (!animation) {
- qWarning("QAbstractTransition::removeAnimation: cannot remove null animation");
- return;
- }
- d->animations.removeOne(animation);
-}
-
-/*!
- Returns the list of animations associated with this transition, or an empty
- list if it has no animations.
-
- \sa addAnimation()
-*/
-QList<QAbstractAnimation*> QAbstractTransition::animations() const
-{
- Q_D(const QAbstractTransition);
- return d->animations;
-}
-
-#endif
-
-/*!
- \fn QAbstractTransition::eventTest(QEvent *event)
-
- This function is called to determine whether the given \a event should cause
- this transition to trigger. Reimplement this function and return true if the
- event should trigger the transition, otherwise return false.
-*/
-
-/*!
- \fn QAbstractTransition::onTransition(QEvent *event)
-
- This function is called when the transition is triggered. The given \a event
- is what caused the transition to trigger. Reimplement this function to
- perform custom processing when the transition is triggered.
-*/
-
-/*!
- \fn QAbstractTransition::triggered()
-
- This signal is emitted when the transition has been triggered (after
- onTransition() has been called).
-*/
-
-/*!
- \fn QAbstractTransition::targetStateChanged()
- \since 5.4
-
- This signal is emitted when the targetState property is changed.
-
- \sa QAbstractTransition::targetState
-*/
-
-/*!
- \fn QAbstractTransition::targetStatesChanged()
- \since 5.4
-
- This signal is emitted when the targetStates property is changed.
-
- \sa QAbstractTransition::targetStates
-*/
-
-/*!
- \reimp
-*/
-bool QAbstractTransition::event(QEvent *e)
-{
- return QObject::event(e);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qabstracttransition.cpp"
diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h
deleted file mode 100644
index 357e829b6a..0000000000
--- a/src/corelib/statemachine/qabstracttransition.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTTRANSITION_H
-#define QABSTRACTTRANSITION_H
-
-#include <QtCore/qobject.h>
-
-#include <QtCore/qlist.h>
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-class QEvent;
-class QAbstractState;
-class QState;
-class QStateMachine;
-
-#if QT_CONFIG(animation)
-class QAbstractAnimation;
-#endif
-
-class QAbstractTransitionPrivate;
-class Q_CORE_EXPORT QAbstractTransition : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QState* sourceState READ sourceState)
- Q_PROPERTY(QAbstractState* targetState READ targetState WRITE setTargetState NOTIFY targetStateChanged)
- Q_PROPERTY(QList<QAbstractState*> targetStates READ targetStates WRITE setTargetStates NOTIFY targetStatesChanged)
- Q_PROPERTY(TransitionType transitionType READ transitionType WRITE setTransitionType REVISION(1, 1))
-public:
- enum TransitionType {
- ExternalTransition,
- InternalTransition
- };
- Q_ENUM(TransitionType)
-
- QAbstractTransition(QState *sourceState = nullptr);
- virtual ~QAbstractTransition();
-
- QState *sourceState() const;
- QAbstractState *targetState() const;
- void setTargetState(QAbstractState* target);
- QList<QAbstractState*> targetStates() const;
- void setTargetStates(const QList<QAbstractState*> &targets);
-
- TransitionType transitionType() const;
- void setTransitionType(TransitionType type);
-
- QStateMachine *machine() const;
-
-#if QT_CONFIG(animation)
- void addAnimation(QAbstractAnimation *animation);
- void removeAnimation(QAbstractAnimation *animation);
- QList<QAbstractAnimation*> animations() const;
-#endif
-
-Q_SIGNALS:
- void triggered(QPrivateSignal);
- void targetStateChanged(QPrivateSignal);
- void targetStatesChanged(QPrivateSignal);
-
-protected:
- virtual bool eventTest(QEvent *event) = 0;
-
- virtual void onTransition(QEvent *event) = 0;
-
- bool event(QEvent *e) override;
-
-protected:
- QAbstractTransition(QAbstractTransitionPrivate &dd, QState *parent);
-
-private:
- Q_DISABLE_COPY(QAbstractTransition)
- Q_DECLARE_PRIVATE(QAbstractTransition)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h
deleted file mode 100644
index 435488848f..0000000000
--- a/src/corelib/statemachine/qabstracttransition_p.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTTRANSITION_P_H
-#define QABSTRACTTRANSITION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qobject_p.h>
-
-#include <QtCore/qlist.h>
-#include <QtCore/qsharedpointer.h>
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-class QAbstractState;
-class QState;
-class QStateMachine;
-
-class QAbstractTransition;
-class Q_CORE_EXPORT QAbstractTransitionPrivate
- : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QAbstractTransition)
-public:
- QAbstractTransitionPrivate();
-
- static QAbstractTransitionPrivate *get(QAbstractTransition *q)
- { return q->d_func(); }
-
- bool callEventTest(QEvent *e);
- virtual void callOnTransition(QEvent *e);
- QState *sourceState() const;
- QStateMachine *machine() const;
- void emitTriggered();
-
- QList<QPointer<QAbstractState>> targetStates;
- QAbstractTransition::TransitionType transitionType;
-
-#if QT_CONFIG(animation)
- QList<QAbstractAnimation*> animations;
-#endif
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp
deleted file mode 100644
index 5dcbcfff47..0000000000
--- a/src/corelib/statemachine/qeventtransition.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qeventtransition.h"
-#include "qeventtransition_p.h"
-#include "qstate.h"
-#include "qstate_p.h"
-#include "qstatemachine.h"
-#include "qstatemachine_p.h"
-#include <qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QEventTransition
- \inmodule QtCore
-
- \brief The QEventTransition class provides a QObject-specific transition for Qt events.
-
- \since 4.6
- \ingroup statemachine
-
- A QEventTransition object binds an event to a particular QObject.
- QEventTransition is part of \l{The State Machine Framework}.
-
- Example:
-
- \code
- QPushButton *button = ...;
- QState *s1 = ...;
- QState *s2 = ...;
- // If in s1 and the button receives an Enter event, transition to s2
- QEventTransition *enterTransition = new QEventTransition(button, QEvent::Enter);
- enterTransition->setTargetState(s2);
- s1->addTransition(enterTransition);
- // If in s2 and the button receives an Exit event, transition back to s1
- QEventTransition *leaveTransition = new QEventTransition(button, QEvent::Leave);
- leaveTransition->setTargetState(s1);
- s2->addTransition(leaveTransition);
- \endcode
-
- \section1 Subclassing
-
- When reimplementing the eventTest() function, you should first call the base
- implementation to verify that the event is a QStateMachine::WrappedEvent for
- the proper object and event type. You may then cast the event to a
- QStateMachine::WrappedEvent and get the original event by calling
- QStateMachine::WrappedEvent::event(), and perform additional checks on that
- object.
-
- \sa QState::addTransition()
-*/
-
-/*!
- \property QEventTransition::eventSource
-
- \brief the event source that this event transition is associated with
-*/
-
-/*!
- \property QEventTransition::eventType
-
- \brief the type of event that this event transition is associated with
-*/
-QEventTransitionPrivate::QEventTransitionPrivate()
-{
- object = nullptr;
- eventType = QEvent::None;
- registered = false;
-}
-
-QEventTransitionPrivate::~QEventTransitionPrivate()
-{
-}
-
-void QEventTransitionPrivate::unregister()
-{
- Q_Q(QEventTransition);
- if (!registered || !machine())
- return;
- QStateMachinePrivate::get(machine())->unregisterEventTransition(q);
-}
-
-void QEventTransitionPrivate::maybeRegister()
-{
- Q_Q(QEventTransition);
- if (QStateMachine *mach = machine())
- QStateMachinePrivate::get(mach)->maybeRegisterEventTransition(q);
-}
-
-/*!
- Constructs a new QEventTransition object with the given \a sourceState.
-*/
-QEventTransition::QEventTransition(QState *sourceState)
- : QAbstractTransition(*new QEventTransitionPrivate, sourceState)
-{
-}
-
-/*!
- Constructs a new QEventTransition object associated with events of the given
- \a type for the given \a object, and with the given \a sourceState.
-*/
-QEventTransition::QEventTransition(QObject *object, QEvent::Type type,
- QState *sourceState)
- : QAbstractTransition(*new QEventTransitionPrivate, sourceState)
-{
- Q_D(QEventTransition);
- d->registered = false;
- d->object = object;
- d->eventType = type;
- d->maybeRegister();
-}
-
-/*!
- \internal
-*/
-QEventTransition::QEventTransition(QEventTransitionPrivate &dd, QState *parent)
- : QAbstractTransition(dd, parent)
-{
-}
-
-/*!
- \internal
-*/
-QEventTransition::QEventTransition(QEventTransitionPrivate &dd, QObject *object,
- QEvent::Type type, QState *parent)
- : QAbstractTransition(dd, parent)
-{
- Q_D(QEventTransition);
- d->registered = false;
- d->object = object;
- d->eventType = type;
- d->maybeRegister();
-}
-
-/*!
- Destroys this QObject event transition.
-*/
-QEventTransition::~QEventTransition()
-{
-}
-
-/*!
- Returns the event type that this event transition is associated with.
-*/
-QEvent::Type QEventTransition::eventType() const
-{
- Q_D(const QEventTransition);
- return d->eventType;
-}
-
-/*!
- Sets the event \a type that this event transition is associated with.
-*/
-void QEventTransition::setEventType(QEvent::Type type)
-{
- Q_D(QEventTransition);
- if (d->eventType == type)
- return;
- d->unregister();
- d->eventType = type;
- d->maybeRegister();
-}
-
-/*!
- Returns the event source associated with this event transition.
-*/
-QObject *QEventTransition::eventSource() const
-{
- Q_D(const QEventTransition);
- return d->object;
-}
-
-/*!
- Sets the event source associated with this event transition to be the given
- \a object.
-*/
-void QEventTransition::setEventSource(QObject *object)
-{
- Q_D(QEventTransition);
- if (d->object == object)
- return;
- d->unregister();
- d->object = object;
- d->maybeRegister();
-}
-
-/*!
- \reimp
-*/
-bool QEventTransition::eventTest(QEvent *event)
-{
- Q_D(const QEventTransition);
- if (event->type() == QEvent::StateMachineWrapped) {
- QStateMachine::WrappedEvent *we = static_cast<QStateMachine::WrappedEvent*>(event);
- return (we->object() == d->object)
- && (we->event()->type() == d->eventType);
- }
- return false;
-}
-
-/*!
- \reimp
-*/
-void QEventTransition::onTransition(QEvent *event)
-{
- Q_UNUSED(event);
-}
-
-/*!
- \reimp
-*/
-bool QEventTransition::event(QEvent *e)
-{
- return QAbstractTransition::event(e);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qeventtransition.cpp"
diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h
deleted file mode 100644
index ff4a991162..0000000000
--- a/src/corelib/statemachine/qeventtransition.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QEVENTTRANSITION_H
-#define QEVENTTRANSITION_H
-
-#include <QtCore/qabstracttransition.h>
-#include <QtCore/qcoreevent.h>
-
-QT_REQUIRE_CONFIG(qeventtransition);
-
-QT_BEGIN_NAMESPACE
-
-class QEventTransitionPrivate;
-class Q_CORE_EXPORT QEventTransition : public QAbstractTransition
-{
- Q_OBJECT
- Q_PROPERTY(QObject* eventSource READ eventSource WRITE setEventSource)
- Q_PROPERTY(QEvent::Type eventType READ eventType WRITE setEventType)
-public:
- QEventTransition(QState *sourceState = nullptr);
- QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = nullptr);
- ~QEventTransition();
-
- QObject *eventSource() const;
- void setEventSource(QObject *object);
-
- QEvent::Type eventType() const;
- void setEventType(QEvent::Type type);
-
-protected:
- bool eventTest(QEvent *event) override;
- void onTransition(QEvent *event) override;
-
- bool event(QEvent *e) override;
-
-protected:
- QEventTransition(QEventTransitionPrivate &dd, QState *parent);
- QEventTransition(QEventTransitionPrivate &dd, QObject *object,
- QEvent::Type type, QState *parent);
-
-private:
- Q_DISABLE_COPY(QEventTransition)
- Q_DECLARE_PRIVATE(QEventTransition)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/qeventtransition_p.h b/src/corelib/statemachine/qeventtransition_p.h
deleted file mode 100644
index e30e12bc8d..0000000000
--- a/src/corelib/statemachine/qeventtransition_p.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QEVENTTRANSITION_P_H
-#define QEVENTTRANSITION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "private/qabstracttransition_p.h"
-
-QT_REQUIRE_CONFIG(qeventtransition);
-
-QT_BEGIN_NAMESPACE
-
-class QEventTransition;
-class Q_CORE_EXPORT QEventTransitionPrivate : public QAbstractTransitionPrivate
-{
- Q_DECLARE_PUBLIC(QEventTransition)
-public:
- QEventTransitionPrivate();
- ~QEventTransitionPrivate();
-
- static QEventTransitionPrivate *get(QEventTransition *q)
- { return q->d_func(); }
-
- void unregister();
- void maybeRegister();
-
- QObject *object;
- bool registered;
- QEvent::Type eventType;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/qfinalstate.cpp b/src/corelib/statemachine/qfinalstate.cpp
deleted file mode 100644
index d8bfd30974..0000000000
--- a/src/corelib/statemachine/qfinalstate.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qfinalstate_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QFinalState
- \inmodule QtCore
-
- \brief The QFinalState class provides a final state.
-
- \since 4.6
- \ingroup statemachine
-
- A final state is used to communicate that (part of) a QStateMachine has
- finished its work. When a final top-level state is entered, the state
- machine's \l{QStateMachine::finished()}{finished}() signal is emitted. In
- general, when a final substate (a child of a QState) is entered, the parent
- state's \l{QState::finished()}{finished}() signal is emitted. QFinalState
- is part of \l{The State Machine Framework}.
-
- To use a final state, you create a QFinalState object and add a transition
- to it from another state. Example:
-
- \code
- QPushButton button;
-
- QStateMachine machine;
- QState *s1 = new QState();
- QFinalState *s2 = new QFinalState();
- s1->addTransition(&button, SIGNAL(clicked()), s2);
- machine.addState(s1);
- machine.addState(s2);
-
- QObject::connect(&machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit()));
- machine.setInitialState(s1);
- machine.start();
- \endcode
-
- \sa QState::finished()
-*/
-
-QFinalStatePrivate::QFinalStatePrivate()
- : QAbstractStatePrivate(FinalState)
-{
-}
-
-QFinalStatePrivate::~QFinalStatePrivate()
-{
- // to prevent vtables being generated in every file that includes the private header
-}
-
-/*!
- Constructs a new QFinalState object with the given \a parent state.
-*/
-QFinalState::QFinalState(QState *parent)
- : QAbstractState(*new QFinalStatePrivate, parent)
-{
-}
-
-/*!
- \internal
- */
-QFinalState::QFinalState(QFinalStatePrivate &dd, QState *parent)
- : QAbstractState(dd, parent)
-{
-}
-
-
-/*!
- Destroys this final state.
-*/
-QFinalState::~QFinalState()
-{
-}
-
-/*!
- \reimp
-*/
-void QFinalState::onEntry(QEvent *event)
-{
- Q_UNUSED(event);
-}
-
-/*!
- \reimp
-*/
-void QFinalState::onExit(QEvent *event)
-{
- Q_UNUSED(event);
-}
-
-/*!
- \reimp
-*/
-bool QFinalState::event(QEvent *e)
-{
- return QAbstractState::event(e);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qfinalstate.cpp"
diff --git a/src/corelib/statemachine/qfinalstate.h b/src/corelib/statemachine/qfinalstate.h
deleted file mode 100644
index 1e52a0411d..0000000000
--- a/src/corelib/statemachine/qfinalstate.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QFINALSTATE_H
-#define QFINALSTATE_H
-
-#include <QtCore/qabstractstate.h>
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-class QFinalStatePrivate;
-class Q_CORE_EXPORT QFinalState : public QAbstractState
-{
- Q_OBJECT
-public:
- QFinalState(QState *parent = nullptr);
- ~QFinalState();
-
-protected:
- void onEntry(QEvent *event) override;
- void onExit(QEvent *event) override;
-
- bool event(QEvent *e) override;
-
-protected:
- explicit QFinalState(QFinalStatePrivate &dd, QState *parent);
-
-private:
- Q_DISABLE_COPY(QFinalState)
- Q_DECLARE_PRIVATE(QFinalState)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/qfinalstate_p.h b/src/corelib/statemachine/qfinalstate_p.h
deleted file mode 100644
index 65598f6c19..0000000000
--- a/src/corelib/statemachine/qfinalstate_p.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QFINALSTATE_P_H
-#define QFINALSTATE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qfinalstate.h"
-#include "private/qabstractstate_p.h"
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-class Q_CORE_EXPORT QFinalStatePrivate : public QAbstractStatePrivate
-{
- Q_DECLARE_PUBLIC(QFinalState)
-
-public:
- QFinalStatePrivate();
- ~QFinalStatePrivate();
-};
-
-QT_END_NAMESPACE
-
-#endif // QFINALSTATE_P_H
diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp
deleted file mode 100644
index e5b8075b96..0000000000
--- a/src/corelib/statemachine/qhistorystate.cpp
+++ /dev/null
@@ -1,334 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qhistorystate.h"
-#include "qhistorystate_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QHistoryState
- \inmodule QtCore
-
- \brief The QHistoryState class provides a means of returning to a previously active substate.
-
- \since 4.6
- \ingroup statemachine
-
- A history state is a pseudo-state that represents the child state that the
- parent state was in the last time the parent state was exited. A transition
- with a history state as its target is in fact a transition to one or more
- other child states of the parent state. QHistoryState is part of \l{The
- State Machine Framework}.
-
- Use the setDefaultState() function to set the state that should be entered
- if the parent state has never been entered. Example:
-
- \code
- QStateMachine machine;
-
- QState *s1 = new QState();
- QState *s11 = new QState(s1);
- QState *s12 = new QState(s1);
-
- QHistoryState *s1h = new QHistoryState(s1);
- s1h->setDefaultState(s11);
-
- machine.addState(s1);
-
- QState *s2 = new QState();
- machine.addState(s2);
-
- QPushButton *button = new QPushButton();
- // Clicking the button will cause the state machine to enter the child state
- // that s1 was in the last time s1 was exited, or the history state's default
- // state if s1 has never been entered.
- s1->addTransition(button, SIGNAL(clicked()), s1h);
- \endcode
-
- If more than one default state has to be entered, or if the transition to the default state(s)
- has to be acted upon, the defaultTransition should be set instead. Note that the eventTest()
- method of that transition will never be called: the selection and execution of the transition is
- done automatically when entering the history state.
-
- By default a history state is shallow, meaning that it won't remember nested
- states. This can be configured through the historyType property.
-*/
-
-/*!
- \property QHistoryState::defaultTransition
-
- \brief the default transition of this history state
-*/
-
-/*!
- \property QHistoryState::defaultState
-
- \brief the default state of this history state
-*/
-
-/*!
- \property QHistoryState::historyType
-
- \brief the type of history that this history state records
-
- The default value of this property is QHistoryState::ShallowHistory.
-*/
-
-/*!
- \enum QHistoryState::HistoryType
-
- This enum specifies the type of history that a QHistoryState records.
-
- \value ShallowHistory Only the immediate child states of the parent state
- are recorded. In this case a transition with the history state as its
- target will end up in the immediate child state that the parent was in the
- last time it was exited. This is the default.
-
- \value DeepHistory Nested states are recorded. In this case a transition
- with the history state as its target will end up in the most deeply nested
- descendant state the parent was in the last time it was exited.
-*/
-
-namespace {
-class DefaultStateTransition: public QAbstractTransition
-{
- Q_OBJECT
-
-public:
- DefaultStateTransition(QHistoryState *source, QAbstractState *target);
-
-protected:
- // It doesn't matter whether this transition matches any event or not. It is always associated
- // with a QHistoryState, and as soon as the state-machine detects that it enters a history
- // state, it will handle this transition as a special case. The history state itself is never
- // entered either: either the stored configuration will be used, or the target(s) of this
- // transition are used.
- bool eventTest(QEvent *event) override { Q_UNUSED(event); return false; }
- void onTransition(QEvent *event) override { Q_UNUSED(event); }
-};
-}
-
-QHistoryStatePrivate::QHistoryStatePrivate()
- : QAbstractStatePrivate(HistoryState)
- , defaultTransition(nullptr)
- , historyType(QHistoryState::ShallowHistory)
-{
-}
-
-DefaultStateTransition::DefaultStateTransition(QHistoryState *source, QAbstractState *target)
- : QAbstractTransition()
-{
- setParent(source);
- setTargetState(target);
-}
-
-/*!
- Constructs a new shallow history state with the given \a parent state.
-*/
-QHistoryState::QHistoryState(QState *parent)
- : QAbstractState(*new QHistoryStatePrivate, parent)
-{
-}
-/*!
- Constructs a new history state of the given \a type, with the given \a
- parent state.
-*/
-QHistoryState::QHistoryState(HistoryType type, QState *parent)
- : QAbstractState(*new QHistoryStatePrivate, parent)
-{
- Q_D(QHistoryState);
- d->historyType = type;
-}
-
-/*!
- Destroys this history state.
-*/
-QHistoryState::~QHistoryState()
-{
-}
-
-/*!
- Returns this history state's default transition. The default transition is
- taken when the history state has never been entered before. The target states
- of the default transition therefore make up the default state.
-
- \since 5.6
-*/
-QAbstractTransition *QHistoryState::defaultTransition() const
-{
- Q_D(const QHistoryState);
- return d->defaultTransition;
-}
-
-/*!
- Sets this history state's default transition to be the given \a transition.
- This will set the source state of the \a transition to the history state.
-
- Note that the eventTest method of the \a transition will never be called.
-
- \since 5.6
-*/
-void QHistoryState::setDefaultTransition(QAbstractTransition *transition)
-{
- Q_D(QHistoryState);
- if (d->defaultTransition != transition) {
- d->defaultTransition = transition;
- transition->setParent(this);
- emit defaultTransitionChanged(QHistoryState::QPrivateSignal());
- }
-}
-
-/*!
- Returns this history state's default state. The default state indicates the
- state to transition to if the parent state has never been entered before.
-*/
-QAbstractState *QHistoryState::defaultState() const
-{
- Q_D(const QHistoryState);
- return d->defaultTransition ? d->defaultTransition->targetState() : nullptr;
-}
-
-static inline bool isSoleEntry(const QList<QAbstractState*> &states, const QAbstractState * state)
-{
- return states.size() == 1 && states.first() == state;
-}
-
-/*!
- Sets this history state's default state to be the given \a state.
- \a state must be a sibling of this history state.
-
- Note that this function does not set \a state as the initial state
- of its parent.
-*/
-void QHistoryState::setDefaultState(QAbstractState *state)
-{
- Q_D(QHistoryState);
- if (state && state->parentState() != parentState()) {
- qWarning("QHistoryState::setDefaultState: state %p does not belong "
- "to this history state's group (%p)", state, parentState());
- return;
- }
- if (!d->defaultTransition || !isSoleEntry(d->defaultTransition->targetStates(), state)) {
- if (!d->defaultTransition || !qobject_cast<DefaultStateTransition*>(d->defaultTransition)) {
- d->defaultTransition = new DefaultStateTransition(this, state);
- emit defaultTransitionChanged(QHistoryState::QPrivateSignal());
- } else {
- d->defaultTransition->setTargetState(state);
- }
- emit defaultStateChanged(QHistoryState::QPrivateSignal());
- }
-}
-
-/*!
- Returns the type of history that this history state records.
-*/
-QHistoryState::HistoryType QHistoryState::historyType() const
-{
- Q_D(const QHistoryState);
- return d->historyType;
-}
-
-/*!
- Sets the \a type of history that this history state records.
-*/
-void QHistoryState::setHistoryType(HistoryType type)
-{
- Q_D(QHistoryState);
- if (d->historyType != type) {
- d->historyType = type;
- emit historyTypeChanged(QHistoryState::QPrivateSignal());
- }
-}
-
-/*!
- \reimp
-*/
-void QHistoryState::onEntry(QEvent *event)
-{
- Q_UNUSED(event);
-}
-
-/*!
- \reimp
-*/
-void QHistoryState::onExit(QEvent *event)
-{
- Q_UNUSED(event);
-}
-
-/*!
- \reimp
-*/
-bool QHistoryState::event(QEvent *e)
-{
- return QAbstractState::event(e);
-}
-
-/*!
- \fn QHistoryState::defaultStateChanged()
- \since 5.4
-
- This signal is emitted when the defaultState property is changed.
-
- \sa QHistoryState::defaultState
-*/
-
-/*!
- \fn QHistoryState::historyTypeChanged()
- \since 5.4
-
- This signal is emitted when the historyType property is changed.
-
- \sa QHistoryState::historyType
-*/
-
-/*!
- \fn QHistoryState::defaultTransitionChanged()
- \since 5.6
-
- This signal is emitted when the defaultTransition property is changed.
-
- \sa QHistoryState::defaultTransition
-*/
-
-QT_END_NAMESPACE
-
-#include "moc_qhistorystate.cpp"
-#include "qhistorystate.moc"
diff --git a/src/corelib/statemachine/qhistorystate.h b/src/corelib/statemachine/qhistorystate.h
deleted file mode 100644
index 44f4c5d6d4..0000000000
--- a/src/corelib/statemachine/qhistorystate.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QHISTORYSTATE_H
-#define QHISTORYSTATE_H
-
-#include <QtCore/qabstractstate.h>
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-class QAbstractTransition;
-class QHistoryStatePrivate;
-class Q_CORE_EXPORT QHistoryState : public QAbstractState
-{
- Q_OBJECT
- Q_PROPERTY(QAbstractState* defaultState READ defaultState WRITE setDefaultState NOTIFY defaultStateChanged)
- Q_PROPERTY(QAbstractTransition* defaultTransition READ defaultTransition WRITE setDefaultTransition NOTIFY defaultTransitionChanged)
- Q_PROPERTY(HistoryType historyType READ historyType WRITE setHistoryType NOTIFY historyTypeChanged)
-public:
- enum HistoryType {
- ShallowHistory,
- DeepHistory
- };
- Q_ENUM(HistoryType)
-
- QHistoryState(QState *parent = nullptr);
- QHistoryState(HistoryType type, QState *parent = nullptr);
- ~QHistoryState();
-
- QAbstractTransition *defaultTransition() const;
- void setDefaultTransition(QAbstractTransition *transition);
-
- QAbstractState *defaultState() const;
- void setDefaultState(QAbstractState *state);
-
- HistoryType historyType() const;
- void setHistoryType(HistoryType type);
-
-Q_SIGNALS:
- void defaultTransitionChanged(QPrivateSignal);
- void defaultStateChanged(QPrivateSignal);
- void historyTypeChanged(QPrivateSignal);
-
-protected:
- void onEntry(QEvent *event) override;
- void onExit(QEvent *event) override;
-
- bool event(QEvent *e) override;
-
-private:
- Q_DISABLE_COPY(QHistoryState)
- Q_DECLARE_PRIVATE(QHistoryState)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/qhistorystate_p.h b/src/corelib/statemachine/qhistorystate_p.h
deleted file mode 100644
index 18d571feb7..0000000000
--- a/src/corelib/statemachine/qhistorystate_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QHISTORYSTATE_P_H
-#define QHISTORYSTATE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "private/qabstractstate_p.h"
-#include <QtCore/qabstracttransition.h>
-#include <QtCore/qhistorystate.h>
-#include <QtCore/qlist.h>
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-class QHistoryStatePrivate : public QAbstractStatePrivate
-{
- Q_DECLARE_PUBLIC(QHistoryState)
-
-public:
- QHistoryStatePrivate();
-
- static QHistoryStatePrivate *get(QHistoryState *q)
- { return q->d_func(); }
-
- QAbstractTransition *defaultTransition;
- QHistoryState::HistoryType historyType;
- QList<QAbstractState*> configuration;
-};
-
-QT_END_NAMESPACE
-
-#endif // QHISTORYSTATE_P_H
diff --git a/src/corelib/statemachine/qsignaleventgenerator_p.h b/src/corelib/statemachine/qsignaleventgenerator_p.h
deleted file mode 100644
index a9d5b96920..0000000000
--- a/src/corelib/statemachine/qsignaleventgenerator_p.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSIGNALEVENTGENERATOR_P_H
-#define QSIGNALEVENTGENERATOR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/private/qglobal_p.h>
-#include <QtCore/qobject.h>
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-class QStateMachine;
-
-class QSignalEventGenerator : public QObject
-{
- Q_OBJECT
-public:
- QSignalEventGenerator(QStateMachine *parent);
-
-private Q_SLOTS:
- void execute(QMethodRawArguments a);
-
-private:
- Q_DISABLE_COPY_MOVE(QSignalEventGenerator)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp
deleted file mode 100644
index 8e57695fd7..0000000000
--- a/src/corelib/statemachine/qsignaltransition.cpp
+++ /dev/null
@@ -1,287 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsignaltransition.h"
-#include "qsignaltransition_p.h"
-#include "qstate.h"
-#include "qstate_p.h"
-#include "qstatemachine.h"
-#include "qstatemachine_p.h"
-#include <qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QSignalTransition
- \inmodule QtCore
-
- \brief The QSignalTransition class provides a transition based on a Qt signal.
-
- \since 4.6
- \ingroup statemachine
-
- Typically you would use the overload of QState::addTransition() that takes a
- sender and signal as arguments, rather than creating QSignalTransition
- objects directly. QSignalTransition is part of \l{The State Machine
- Framework}.
-
- You can subclass QSignalTransition and reimplement eventTest() to make a
- signal transition conditional; the event object passed to eventTest() will
- be a QStateMachine::SignalEvent object. Example:
-
- \code
- class CheckedTransition : public QSignalTransition
- {
- public:
- CheckedTransition(QCheckBox *check)
- : QSignalTransition(check, SIGNAL(stateChanged(int))) {}
- protected:
- bool eventTest(QEvent *e) {
- if (!QSignalTransition::eventTest(e))
- return false;
- QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
- return (se->arguments().at(0).toInt() == Qt::Checked);
- }
- };
-
- ...
-
- QCheckBox *check = new QCheckBox();
- check->setTristate(true);
-
- QState *s1 = new QState();
- QState *s2 = new QState();
- CheckedTransition *t1 = new CheckedTransition(check);
- t1->setTargetState(s2);
- s1->addTransition(t1);
- \endcode
-*/
-
-/*!
- \property QSignalTransition::senderObject
-
- \brief the sender object that this signal transition is associated with
-*/
-
-/*!
- \property QSignalTransition::signal
-
- \brief the signal that this signal transition is associated with
-*/
-
-QSignalTransitionPrivate::QSignalTransitionPrivate()
-{
- sender = nullptr;
- signalIndex = -1;
-}
-
-void QSignalTransitionPrivate::unregister()
-{
- Q_Q(QSignalTransition);
- if ((signalIndex == -1) || !machine())
- return;
- QStateMachinePrivate::get(machine())->unregisterSignalTransition(q);
-}
-
-void QSignalTransitionPrivate::maybeRegister()
-{
- Q_Q(QSignalTransition);
- if (QStateMachine *mach = machine())
- QStateMachinePrivate::get(mach)->maybeRegisterSignalTransition(q);
-}
-
-/*!
- Constructs a new signal transition with the given \a sourceState.
-*/
-QSignalTransition::QSignalTransition(QState *sourceState)
- : QAbstractTransition(*new QSignalTransitionPrivate, sourceState)
-{
-}
-
-/*!
- Constructs a new signal transition associated with the given \a signal of
- the given \a sender, and with the given \a sourceState.
-*/
-QSignalTransition::QSignalTransition(const QObject *sender, const char *signal,
- QState *sourceState)
- : QAbstractTransition(*new QSignalTransitionPrivate, sourceState)
-{
- Q_D(QSignalTransition);
- d->sender = sender;
- d->signal = signal;
- d->maybeRegister();
-}
-
-/*!
- \fn template <typename PointerToMemberFunction> QSignalTransition::QSignalTransition(const QObject *sender, PointerToMemberFunction signal, QState *sourceState)
- \since 5.7
- \overload
-
- Constructs a new signal transition associated with the given \a signal of
- the given \a sender object and with the given \a sourceState.
- This constructor is enabled if the compiler supports delegating constructors,
- as indicated by the presence of the macro Q_COMPILER_DELEGATING_CONSTRUCTORS.
-*/
-
-/*!
- Destroys this signal transition.
-*/
-QSignalTransition::~QSignalTransition()
-{
-}
-
-/*!
- Returns the sender object associated with this signal transition.
-*/
-QObject *QSignalTransition::senderObject() const
-{
- Q_D(const QSignalTransition);
- return const_cast<QObject *>(d->sender);
-}
-
-/*!
- Sets the \a sender object associated with this signal transition.
-*/
-void QSignalTransition::setSenderObject(const QObject *sender)
-{
- Q_D(QSignalTransition);
- if (sender == d->sender)
- return;
- d->unregister();
- d->sender = sender;
- d->maybeRegister();
- emit senderObjectChanged(QPrivateSignal());
-}
-
-/*!
- Returns the signal associated with this signal transition.
-*/
-QByteArray QSignalTransition::signal() const
-{
- Q_D(const QSignalTransition);
- return d->signal;
-}
-
-/*!
- Sets the \a signal associated with this signal transition.
-*/
-void QSignalTransition::setSignal(const QByteArray &signal)
-{
- Q_D(QSignalTransition);
- if (signal == d->signal)
- return;
- d->unregister();
- d->signal = signal;
- d->maybeRegister();
- emit signalChanged(QPrivateSignal());
-}
-
-/*!
- \reimp
-
- The default implementation returns \c true if the \a event is a
- QStateMachine::SignalEvent object and the event's sender and signal index
- match this transition, and returns \c false otherwise.
-*/
-bool QSignalTransition::eventTest(QEvent *event)
-{
- Q_D(const QSignalTransition);
- if (event->type() == QEvent::StateMachineSignal) {
- if (d->signalIndex == -1)
- return false;
- QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(event);
- return (se->sender() == d->sender)
- && (se->signalIndex() == d->signalIndex);
- }
- return false;
-}
-
-/*!
- \reimp
-*/
-void QSignalTransition::onTransition(QEvent *event)
-{
- Q_UNUSED(event);
-}
-
-/*!
- \reimp
-*/
-bool QSignalTransition::event(QEvent *e)
-{
- return QAbstractTransition::event(e);
-}
-
-/*!
- \fn QSignalTransition::senderObjectChanged()
- \since 5.4
-
- This signal is emitted when the senderObject property is changed.
-
- \sa QSignalTransition::senderObject
-*/
-
-/*!
- \fn QSignalTransition::signalChanged()
- \since 5.4
-
- This signal is emitted when the signal property is changed.
-
- \sa QSignalTransition::signal
-*/
-
-void QSignalTransitionPrivate::callOnTransition(QEvent *e)
-{
- Q_Q(QSignalTransition);
-
- if (e->type() == QEvent::StateMachineSignal) {
- QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent *>(e);
- int savedSignalIndex = se->m_signalIndex;
- se->m_signalIndex = originalSignalIndex;
- q->onTransition(e);
- se->m_signalIndex = savedSignalIndex;
- } else {
- q->onTransition(e);
- }
-}
-
-
-QT_END_NAMESPACE
-
-#include "moc_qsignaltransition.cpp"
diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h
deleted file mode 100644
index e785a18c73..0000000000
--- a/src/corelib/statemachine/qsignaltransition.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSIGNALTRANSITION_H
-#define QSIGNALTRANSITION_H
-
-#include <QtCore/qabstracttransition.h>
-#include <QtCore/qmetaobject.h>
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-class QSignalTransitionPrivate;
-class Q_CORE_EXPORT QSignalTransition : public QAbstractTransition
-{
- Q_OBJECT
- Q_PROPERTY(QObject* senderObject READ senderObject WRITE setSenderObject NOTIFY senderObjectChanged)
- Q_PROPERTY(QByteArray signal READ signal WRITE setSignal NOTIFY signalChanged)
-
-public:
- QSignalTransition(QState *sourceState = nullptr);
- QSignalTransition(const QObject *sender, const char *signal,
- QState *sourceState = nullptr);
-#ifdef Q_QDOC
- template<typename PointerToMemberFunction>
- QSignalTransition(const QObject *object, PointerToMemberFunction signal,
- QState *sourceState = nullptr);
-#elif defined(Q_COMPILER_DELEGATING_CONSTRUCTORS)
- template <typename Func>
- QSignalTransition(const typename QtPrivate::FunctionPointer<Func>::Object *obj,
- Func sig, QState *srcState = nullptr)
- : QSignalTransition(obj, QMetaMethod::fromSignal(sig).methodSignature().constData(), srcState)
- {
- }
-#endif
-
- ~QSignalTransition();
-
- QObject *senderObject() const;
- void setSenderObject(const QObject *sender);
-
- QByteArray signal() const;
- void setSignal(const QByteArray &signal);
-
-protected:
- bool eventTest(QEvent *event) override;
- void onTransition(QEvent *event) override;
-
- bool event(QEvent *e) override;
-
-Q_SIGNALS:
- void senderObjectChanged(QPrivateSignal);
- void signalChanged(QPrivateSignal);
-
-private:
- Q_DISABLE_COPY(QSignalTransition)
- Q_DECLARE_PRIVATE(QSignalTransition)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/qsignaltransition_p.h b/src/corelib/statemachine/qsignaltransition_p.h
deleted file mode 100644
index b3de334677..0000000000
--- a/src/corelib/statemachine/qsignaltransition_p.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSIGNALTRANSITION_P_H
-#define QSIGNALTRANSITION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "private/qabstracttransition_p.h"
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-class QSignalTransition;
-class QSignalTransitionPrivate : public QAbstractTransitionPrivate
-{
- Q_DECLARE_PUBLIC(QSignalTransition)
-public:
- QSignalTransitionPrivate();
-
- static QSignalTransitionPrivate *get(QSignalTransition *q)
- { return q->d_func(); }
-
- void unregister();
- void maybeRegister();
-
- void callOnTransition(QEvent *e) override;
-
- const QObject *sender;
- QByteArray signal;
- int signalIndex;
- int originalSignalIndex;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
deleted file mode 100644
index dd92bfe7ba..0000000000
--- a/src/corelib/statemachine/qstate.cpp
+++ /dev/null
@@ -1,603 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qstate_p.h"
-#include "qhistorystate.h"
-#include "qhistorystate_p.h"
-#include "qabstracttransition.h"
-#include "qabstracttransition_p.h"
-#include "qsignaltransition.h"
-#include "qstatemachine.h"
-#include "qstatemachine_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QState
- \inmodule QtCore
-
- \brief The QState class provides a general-purpose state for QStateMachine.
-
- \since 4.6
- \ingroup statemachine
-
- QState objects can have child states, and can have transitions to other
- states. QState is part of \l{The State Machine Framework}.
-
- The addTransition() function adds a transition. The removeTransition()
- function removes a transition. The transitions() function returns the
- state's outgoing transitions.
-
- The assignProperty() function is used for defining property assignments that
- should be performed when a state is entered.
-
- Top-level states must be passed a QStateMachine object as their parent
- state, or added to a state machine using QStateMachine::addState().
-
- \section1 States with Child States
-
- The childMode property determines how child states are treated. For
- non-parallel state groups, the setInitialState() function must be called to
- set the initial state. The child states are mutually exclusive states, and
- the state machine needs to know which child state to enter when the parent
- state is the target of a transition.
-
- The state emits the QState::finished() signal when a final child state
- (QFinalState) is entered.
-
- The setErrorState() sets the state's error state. The error state is the
- state that the state machine will transition to if an error is detected when
- attempting to enter the state (e.g. because no initial state has been set).
-
-*/
-
-/*!
- \property QState::initialState
-
- \brief the initial state of this state (one of its child states)
-*/
-
-/*!
- \property QState::errorState
-
- \brief the error state of this state
-*/
-
-/*!
- \property QState::childMode
-
- \brief the child mode of this state
-
- The default value of this property is QState::ExclusiveStates.
-*/
-
-/*!
- \enum QState::ChildMode
-
- This enum specifies how a state's child states are treated.
-
- \value ExclusiveStates The child states are mutually exclusive and an
- initial state must be set by calling QState::setInitialState().
-
- \value ParallelStates The child states are parallel. When the parent state
- is entered, all its child states are entered in parallel.
-*/
-
-/*!
- \enum QState::RestorePolicy
-
- This enum specifies the restore policy type. The restore policy
- takes effect when the machine enters a state which sets one or more
- properties. If the restore policy is set to RestoreProperties,
- the state machine will save the original value of the property before the
- new value is set.
-
- Later, when the machine either enters a state which does not set
- a value for the given property, the property will automatically be restored
- to its initial value.
-
- Only one initial value will be saved for any given property. If a value for a property has
- already been saved by the state machine, it will not be overwritten until the property has been
- successfully restored.
-
- \value DontRestoreProperties The state machine should not save the initial values of properties
- and restore them later.
- \value RestoreProperties The state machine should save the initial values of properties
- and restore them later.
-
- \sa QStateMachine::globalRestorePolicy, QState::assignProperty()
-*/
-
-QStatePrivate::QStatePrivate()
- : QAbstractStatePrivate(StandardState),
- errorState(nullptr), initialState(nullptr), childMode(QState::ExclusiveStates),
- childStatesListNeedsRefresh(true), transitionsListNeedsRefresh(true)
-{
-}
-
-QStatePrivate::~QStatePrivate()
-{
-}
-
-void QStatePrivate::emitFinished()
-{
- Q_Q(QState);
- emit q->finished(QState::QPrivateSignal());
-}
-
-void QStatePrivate::emitPropertiesAssigned()
-{
- Q_Q(QState);
- emit q->propertiesAssigned(QState::QPrivateSignal());
-}
-
-/*!
- Constructs a new state with the given \a parent state.
-*/
-QState::QState(QState *parent)
- : QAbstractState(*new QStatePrivate, parent)
-{
-}
-
-/*!
- Constructs a new state with the given \a childMode and the given \a parent
- state.
-*/
-QState::QState(ChildMode childMode, QState *parent)
- : QAbstractState(*new QStatePrivate, parent)
-{
- Q_D(QState);
- d->childMode = childMode;
-}
-
-/*!
- \internal
-*/
-QState::QState(QStatePrivate &dd, QState *parent)
- : QAbstractState(dd, parent)
-{
-}
-
-/*!
- Destroys this state.
-*/
-QState::~QState()
-{
-}
-
-QList<QAbstractState*> QStatePrivate::childStates() const
-{
- if (childStatesListNeedsRefresh) {
- childStatesList.clear();
- QList<QObject*>::const_iterator it;
- for (it = children.constBegin(); it != children.constEnd(); ++it) {
- QAbstractState *s = qobject_cast<QAbstractState*>(*it);
- if (!s || qobject_cast<QHistoryState*>(s))
- continue;
- childStatesList.append(s);
- }
- childStatesListNeedsRefresh = false;
- }
- return childStatesList;
-}
-
-QList<QHistoryState*> QStatePrivate::historyStates() const
-{
- QList<QHistoryState*> result;
- QList<QObject*>::const_iterator it;
- for (it = children.constBegin(); it != children.constEnd(); ++it) {
- QHistoryState *h = qobject_cast<QHistoryState*>(*it);
- if (h)
- result.append(h);
- }
- return result;
-}
-
-QList<QAbstractTransition*> QStatePrivate::transitions() const
-{
- if (transitionsListNeedsRefresh) {
- transitionsList.clear();
- QList<QObject*>::const_iterator it;
- for (it = children.constBegin(); it != children.constEnd(); ++it) {
- QAbstractTransition *t = qobject_cast<QAbstractTransition*>(*it);
- if (t)
- transitionsList.append(t);
- }
- transitionsListNeedsRefresh = false;
- }
- return transitionsList;
-}
-
-#ifndef QT_NO_PROPERTIES
-
-/*!
- Instructs this state to set the property with the given \a name of the given
- \a object to the given \a value when the state is entered.
-
- \sa propertiesAssigned()
-*/
-void QState::assignProperty(QObject *object, const char *name,
- const QVariant &value)
-{
- Q_D(QState);
- if (!object) {
- qWarning("QState::assignProperty: cannot assign property '%s' of null object", name);
- return;
- }
- for (int i = 0; i < d->propertyAssignments.size(); ++i) {
- QPropertyAssignment &assn = d->propertyAssignments[i];
- if (assn.hasTarget(object, name)) {
- assn.value = value;
- return;
- }
- }
- d->propertyAssignments.append(QPropertyAssignment(object, name, value));
-}
-
-#endif // QT_NO_PROPERTIES
-
-/*!
- Returns this state's error state.
-
- \sa QStateMachine::error()
-*/
-QAbstractState *QState::errorState() const
-{
- Q_D(const QState);
- return d->errorState;
-}
-
-/*!
- Sets this state's error state to be the given \a state. If the error state
- is not set, or if it is set to \nullptr, the state will inherit its parent's error
- state recursively. If no error state is set for the state itself or any of
- its ancestors, an error will cause the machine to stop executing and an error
- will be printed to the console.
-*/
-void QState::setErrorState(QAbstractState *state)
-{
- Q_D(QState);
- if (state != nullptr && qobject_cast<QStateMachine*>(state)) {
- qWarning("QStateMachine::setErrorState: root state cannot be error state");
- return;
- }
- if (state != nullptr && (!state->machine() || ((state->machine() != machine()) && !qobject_cast<QStateMachine*>(this)))) {
- qWarning("QState::setErrorState: error state cannot belong "
- "to a different state machine");
- return;
- }
-
- if (d->errorState != state) {
- d->errorState = state;
- emit errorStateChanged(QState::QPrivateSignal());
- }
-}
-
-/*!
- Adds the given \a transition. The transition has this state as the source.
- This state takes ownership of the transition.
-*/
-void QState::addTransition(QAbstractTransition *transition)
-{
- Q_D(QState);
- if (!transition) {
- qWarning("QState::addTransition: cannot add null transition");
- return ;
- }
-
- transition->setParent(this);
- const QList<QPointer<QAbstractState>> &targets = QAbstractTransitionPrivate::get(transition)->targetStates;
- for (int i = 0; i < targets.size(); ++i) {
- QAbstractState *t = targets.at(i).data();
- if (!t) {
- qWarning("QState::addTransition: cannot add transition to null state");
- return ;
- }
- if ((QAbstractStatePrivate::get(t)->machine() != d->machine())
- && QAbstractStatePrivate::get(t)->machine() && d->machine()) {
- qWarning("QState::addTransition: cannot add transition "
- "to a state in a different state machine");
- return ;
- }
- }
- if (QStateMachine *mach = machine())
- QStateMachinePrivate::get(mach)->maybeRegisterTransition(transition);
-}
-
-/*!
- \fn template <typename PointerToMemberFunction> QState::addTransition(const QObject *sender, PointerToMemberFunction signal, QAbstractState *target);
- \since 5.5
- \overload
-
- Adds a transition associated with the given \a signal of the given \a sender
- object, and returns the new QSignalTransition object. The transition has
- this state as the source, and the given \a target as the target state.
-*/
-
-/*!
- Adds a transition associated with the given \a signal of the given \a sender
- object, and returns the new QSignalTransition object. The transition has
- this state as the source, and the given \a target as the target state.
-*/
-QSignalTransition *QState::addTransition(const QObject *sender, const char *signal,
- QAbstractState *target)
-{
- if (!sender) {
- qWarning("QState::addTransition: sender cannot be null");
- return nullptr;
- }
- if (!signal) {
- qWarning("QState::addTransition: signal cannot be null");
- return nullptr;
- }
- if (!target) {
- qWarning("QState::addTransition: cannot add transition to null state");
- return nullptr;
- }
- int offset = (*signal == '0'+QSIGNAL_CODE) ? 1 : 0;
- const QMetaObject *meta = sender->metaObject();
- if (meta->indexOfSignal(signal+offset) == -1) {
- if (meta->indexOfSignal(QMetaObject::normalizedSignature(signal+offset)) == -1) {
- qWarning("QState::addTransition: no such signal %s::%s",
- meta->className(), signal+offset);
- return nullptr;
- }
- }
- QSignalTransition *trans = new QSignalTransition(sender, signal);
- trans->setTargetState(target);
- addTransition(trans);
- return trans;
-}
-
-namespace {
-
-// ### Make public?
-class UnconditionalTransition : public QAbstractTransition
-{
-public:
- UnconditionalTransition(QAbstractState *target)
- : QAbstractTransition()
- { setTargetState(target); }
-protected:
- void onTransition(QEvent *) override {}
- bool eventTest(QEvent *) override { return true; }
-};
-
-} // namespace
-
-/*!
- Adds an unconditional transition from this state to the given \a target
- state, and returns then new transition object.
-*/
-QAbstractTransition *QState::addTransition(QAbstractState *target)
-{
- if (!target) {
- qWarning("QState::addTransition: cannot add transition to null state");
- return nullptr;
- }
- UnconditionalTransition *trans = new UnconditionalTransition(target);
- addTransition(trans);
- return trans;
-}
-
-/*!
- Removes the given \a transition from this state. The state releases
- ownership of the transition.
-
- \sa addTransition()
-*/
-void QState::removeTransition(QAbstractTransition *transition)
-{
- Q_D(QState);
- if (!transition) {
- qWarning("QState::removeTransition: cannot remove null transition");
- return;
- }
- if (transition->sourceState() != this) {
- qWarning("QState::removeTransition: transition %p's source state (%p)"
- " is different from this state (%p)",
- transition, transition->sourceState(), this);
- return;
- }
- QStateMachinePrivate *mach = QStateMachinePrivate::get(d->machine());
- if (mach)
- mach->unregisterTransition(transition);
- transition->setParent(nullptr);
-}
-
-/*!
- \since 4.7
-
- Returns this state's outgoing transitions (i.e. transitions where
- this state is the \l{QAbstractTransition::sourceState()}{source
- state}), or an empty list if this state has no outgoing transitions.
-
- \sa addTransition()
-*/
-QList<QAbstractTransition*> QState::transitions() const
-{
- Q_D(const QState);
- return d->transitions();
-}
-
-/*!
- \reimp
-*/
-void QState::onEntry(QEvent *event)
-{
- Q_UNUSED(event);
-}
-
-/*!
- \reimp
-*/
-void QState::onExit(QEvent *event)
-{
- Q_UNUSED(event);
-}
-
-/*!
- Returns this state's initial state, or \nullptr if the state has no
- initial state.
-*/
-QAbstractState *QState::initialState() const
-{
- Q_D(const QState);
- return d->initialState;
-}
-
-/*!
- Sets this state's initial state to be the given \a state.
- \a state has to be a child of this state.
-*/
-void QState::setInitialState(QAbstractState *state)
-{
- Q_D(QState);
- if (d->childMode == QState::ParallelStates) {
- qWarning("QState::setInitialState: ignoring attempt to set initial state "
- "of parallel state group %p", this);
- return;
- }
- if (state && (state->parentState() != this)) {
- qWarning("QState::setInitialState: state %p is not a child of this state (%p)",
- state, this);
- return;
- }
- if (d->initialState != state) {
- d->initialState = state;
- emit initialStateChanged(QState::QPrivateSignal());
- }
-}
-
-/*!
- Returns the child mode of this state.
-*/
-QState::ChildMode QState::childMode() const
-{
- Q_D(const QState);
- return d->childMode;
-}
-
-/*!
- Sets the child \a mode of this state.
-*/
-void QState::setChildMode(ChildMode mode)
-{
- Q_D(QState);
-
- if (mode == QState::ParallelStates && d->initialState) {
- qWarning("QState::setChildMode: setting the child-mode of state %p to "
- "parallel removes the initial state", this);
- d->initialState = nullptr;
- emit initialStateChanged(QState::QPrivateSignal());
- }
-
- if (d->childMode != mode) {
- d->childMode = mode;
- emit childModeChanged(QState::QPrivateSignal());
- }
-}
-
-/*!
- \reimp
-*/
-bool QState::event(QEvent *e)
-{
- Q_D(QState);
- if ((e->type() == QEvent::ChildAdded) || (e->type() == QEvent::ChildRemoved)) {
- d->childStatesListNeedsRefresh = true;
- d->transitionsListNeedsRefresh = true;
- if ((e->type() == QEvent::ChildRemoved) && (static_cast<QChildEvent *>(e)->child() == d->initialState))
- d->initialState = nullptr;
- }
- return QAbstractState::event(e);
-}
-
-/*!
- \fn QState::finished()
-
- This signal is emitted when a final child state of this state is entered.
-
- \sa QFinalState
-*/
-
-/*!
- \fn QState::propertiesAssigned()
-
- This signal is emitted when all properties have been assigned their final value. If the state
- assigns a value to one or more properties for which an animation exists (either set on the
- transition or as a default animation on the state machine), then the signal will not be emitted
- until all such animations have finished playing.
-
- If there are no relevant animations, or no property assignments defined for the state, then
- the signal will be emitted immediately before the state is entered.
-
- \sa QState::assignProperty(), QAbstractTransition::addAnimation()
-*/
-
-/*!
- \fn QState::childModeChanged()
- \since 5.4
-
- This signal is emitted when the childMode property is changed.
-
- \sa QState::childMode
-*/
-
-/*!
- \fn QState::initialStateChanged()
- \since 5.4
-
- This signal is emitted when the initialState property is changed.
-
- \sa QState::initialState
-*/
-
-/*!
- \fn QState::errorStateChanged()
- \since 5.4
-
- This signal is emitted when the errorState property is changed.
-
- \sa QState::errorState
-*/
-
-QT_END_NAMESPACE
-
-#include "moc_qstate.cpp"
diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h
deleted file mode 100644
index 9f1f07dfcc..0000000000
--- a/src/corelib/statemachine/qstate.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSTATE_H
-#define QSTATE_H
-
-#include <QtCore/qabstractstate.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qmetaobject.h>
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-class QAbstractTransition;
-class QSignalTransition;
-
-class QStatePrivate;
-class Q_CORE_EXPORT QState : public QAbstractState
-{
- Q_OBJECT
- Q_PROPERTY(QAbstractState* initialState READ initialState WRITE setInitialState NOTIFY initialStateChanged)
- Q_PROPERTY(QAbstractState* errorState READ errorState WRITE setErrorState NOTIFY errorStateChanged)
- Q_PROPERTY(ChildMode childMode READ childMode WRITE setChildMode NOTIFY childModeChanged)
-public:
- enum ChildMode {
- ExclusiveStates,
- ParallelStates
- };
- Q_ENUM(ChildMode)
-
- enum RestorePolicy {
- DontRestoreProperties,
- RestoreProperties
- };
- Q_ENUM(RestorePolicy)
-
- QState(QState *parent = nullptr);
- QState(ChildMode childMode, QState *parent = nullptr);
- ~QState();
-
- QAbstractState *errorState() const;
- void setErrorState(QAbstractState *state);
-
- void addTransition(QAbstractTransition *transition);
- QSignalTransition *addTransition(const QObject *sender, const char *signal, QAbstractState *target);
-#ifdef Q_QDOC
- template<typename PointerToMemberFunction>
- QSignalTransition *addTransition(const QObject *sender, PointerToMemberFunction signal,
- QAbstractState *target);
-#else
- template <typename Func>
- QSignalTransition *addTransition(const typename QtPrivate::FunctionPointer<Func>::Object *obj,
- Func signal, QAbstractState *target)
- {
- const QMetaMethod signalMetaMethod = QMetaMethod::fromSignal(signal);
- return addTransition(obj, signalMetaMethod.methodSignature().constData(), target);
- }
-#endif // Q_QDOC
- QAbstractTransition *addTransition(QAbstractState *target);
- void removeTransition(QAbstractTransition *transition);
- QList<QAbstractTransition*> transitions() const;
-
- QAbstractState *initialState() const;
- void setInitialState(QAbstractState *state);
-
- ChildMode childMode() const;
- void setChildMode(ChildMode mode);
-
-#ifndef QT_NO_PROPERTIES
- void assignProperty(QObject *object, const char *name,
- const QVariant &value);
-#endif
-
-Q_SIGNALS:
- void finished(QPrivateSignal);
- void propertiesAssigned(QPrivateSignal);
- void childModeChanged(QPrivateSignal);
- void initialStateChanged(QPrivateSignal);
- void errorStateChanged(QPrivateSignal);
-
-protected:
- void onEntry(QEvent *event) override;
- void onExit(QEvent *event) override;
-
- bool event(QEvent *e) override;
-
-protected:
- QState(QStatePrivate &dd, QState *parent);
-
-private:
- Q_DISABLE_COPY(QState)
- Q_DECLARE_PRIVATE(QState)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/qstate_p.h b/src/corelib/statemachine/qstate_p.h
deleted file mode 100644
index 25393a04b4..0000000000
--- a/src/corelib/statemachine/qstate_p.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSTATE_P_H
-#define QSTATE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qstate.h"
-#include "private/qabstractstate_p.h"
-
-#include <QtCore/qlist.h>
-#include <QtCore/qbytearray.h>
-#include <QtCore/qpointer.h>
-#include <QtCore/qvariant.h>
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_PROPERTIES
-
-struct QPropertyAssignment
-{
- QPropertyAssignment()
- : object(nullptr), explicitlySet(true) {}
- QPropertyAssignment(QObject *o, const QByteArray &n,
- const QVariant &v, bool es = true)
- : object(o), propertyName(n), value(v), explicitlySet(es)
- {}
-
- bool objectDeleted() const { return !object; }
- void write() const { Q_ASSERT(object != nullptr); object->setProperty(propertyName, value); }
- bool hasTarget(QObject *o, const QByteArray &pn) const
- { return object == o && propertyName == pn; }
-
- QPointer<QObject> object;
- QByteArray propertyName;
- QVariant value;
- bool explicitlySet; // false means the property is being restored to its old value
-};
-Q_DECLARE_TYPEINFO(QPropertyAssignment, Q_MOVABLE_TYPE);
-
-#endif // QT_NO_PROPERTIES
-
-class QAbstractTransition;
-class QHistoryState;
-
-class QState;
-class Q_CORE_EXPORT QStatePrivate : public QAbstractStatePrivate
-{
- Q_DECLARE_PUBLIC(QState)
-public:
- QStatePrivate();
- ~QStatePrivate();
-
- static QStatePrivate *get(QState *q) { return q ? q->d_func() : nullptr; }
- static const QStatePrivate *get(const QState *q) { return q? q->d_func() : nullptr; }
-
- QList<QAbstractState*> childStates() const;
- QList<QHistoryState*> historyStates() const;
- QList<QAbstractTransition*> transitions() const;
-
- void emitFinished();
- void emitPropertiesAssigned();
-
- QAbstractState *errorState;
- QAbstractState *initialState;
- QState::ChildMode childMode;
- mutable bool childStatesListNeedsRefresh;
- mutable bool transitionsListNeedsRefresh;
- mutable QList<QAbstractState*> childStatesList;
- mutable QList<QAbstractTransition*> transitionsList;
-
-#ifndef QT_NO_PROPERTIES
- QList<QPropertyAssignment> propertyAssignments;
-#endif
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
deleted file mode 100644
index 873892552f..0000000000
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ /dev/null
@@ -1,3208 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qstatemachine.h"
-#include "qstate.h"
-#include "qstate_p.h"
-#include "qstatemachine_p.h"
-#include "qabstracttransition.h"
-#include "qabstracttransition_p.h"
-#include "qsignaltransition.h"
-#include "qsignaltransition_p.h"
-#include "qsignaleventgenerator_p.h"
-#include "qabstractstate.h"
-#include "qabstractstate_p.h"
-#include "qfinalstate.h"
-#include "qhistorystate.h"
-#include "qhistorystate_p.h"
-#include "private/qobject_p.h"
-#include "private/qthread_p.h"
-
-#if QT_CONFIG(qeventtransition)
-#include "qeventtransition.h"
-#include "qeventtransition_p.h"
-#endif
-
-#if QT_CONFIG(animation)
-#include "qpropertyanimation.h"
-#include "qanimationgroup.h"
-#include <private/qvariantanimation_p.h>
-#endif
-
-#include <QtCore/qmetaobject.h>
-#include <qdebug.h>
-
-#include <algorithm>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QStateMachine
- \inmodule QtCore
- \reentrant
-
- \brief The QStateMachine class provides a hierarchical finite state machine.
-
- \since 4.6
- \ingroup statemachine
-
- QStateMachine is based on the concepts and notation of
- \l{http://www.wisdom.weizmann.ac.il/~dharel/SCANNED.PAPERS/Statecharts.pdf}{Statecharts}.
- QStateMachine is part of \l{The State Machine Framework}.
-
- A state machine manages a set of states (classes that inherit from
- QAbstractState) and transitions (descendants of
- QAbstractTransition) between those states; these states and
- transitions define a state graph. Once a state graph has been
- built, the state machine can execute it. QStateMachine's
- execution algorithm is based on the \l{http://www.w3.org/TR/scxml/}{State Chart XML (SCXML)}
- algorithm. The framework's \l{The State Machine
- Framework}{overview} gives several state graphs and the code to
- build them.
-
- Use the addState() function to add a top-level state to the state machine.
- States are removed with the removeState() function. Removing states while
- the machine is running is discouraged.
-
- Before the machine can be started, the \l{initialState}{initial
- state} must be set. The initial state is the state that the
- machine enters when started. You can then start() the state
- machine. The started() signal is emitted when the initial state is
- entered.
-
- The machine is event driven and keeps its own event loop. Events
- are posted to the machine through postEvent(). Note that this
- means that it executes asynchronously, and that it will not
- progress without a running event loop. You will normally not have
- to post events to the machine directly as Qt's transitions, e.g.,
- QEventTransition and its subclasses, handle this. But for custom
- transitions triggered by events, postEvent() is useful.
-
- The state machine processes events and takes transitions until a
- top-level final state is entered; the state machine then emits the
- finished() signal. You can also stop() the state machine
- explicitly. The stopped() signal is emitted in this case.
-
- The following snippet shows a state machine that will finish when a button
- is clicked:
-
- \snippet code/src_corelib_statemachine_qstatemachine.cpp simple state machine
-
- This code example uses QState, which inherits QAbstractState. The
- QState class provides a state that you can use to set properties
- and invoke methods on \l{QObject}s when the state is entered or
- exited. It also contains convenience functions for adding
- transitions, e.g., \l{QSignalTransition}s as in this example. See
- the QState class description for further details.
-
- If an error is encountered, the machine will look for an
- \l{errorState}{error state}, and if one is available, it will
- enter this state. The types of errors possible are described by the
- \l{QStateMachine::}{Error} enum. After the error state is entered,
- the type of the error can be retrieved with error(). The execution
- of the state graph will not stop when the error state is entered. If
- no error state applies to the erroneous state, the machine will stop
- executing and an error message will be printed to the console.
-
- \note Important: setting the \l{ChildMode} of a state machine to parallel (\l{ParallelStates})
- results in an invalid state machine. It can only be set to (or kept as)
- \l{ExclusiveStates}.
-
- \sa QAbstractState, QAbstractTransition, QState, {The State Machine Framework}
-*/
-
-/*!
- \property QStateMachine::errorString
-
- \brief the error string of this state machine
-*/
-
-/*!
- \property QStateMachine::globalRestorePolicy
-
- \brief the restore policy for states of this state machine.
-
- The default value of this property is
- QState::DontRestoreProperties.
-*/
-
-/*!
- \property QStateMachine::running
- \since 5.4
-
- \brief the running state of this state machine
-
- \sa start(), stop(), started(), stopped(), runningChanged()
-*/
-
-#if QT_CONFIG(animation)
-/*!
- \property QStateMachine::animated
-
- \brief whether animations are enabled
-
- The default value of this property is \c true.
-
- \sa QAbstractTransition::addAnimation()
-*/
-#endif
-
-// #define QSTATEMACHINE_DEBUG
-// #define QSTATEMACHINE_RESTORE_PROPERTIES_DEBUG
-
-struct CalculationCache {
- struct TransitionInfo {
- QList<QAbstractState*> effectiveTargetStates;
- QSet<QAbstractState*> exitSet;
- QAbstractState *transitionDomain;
-
- bool effectiveTargetStatesIsKnown: 1;
- bool exitSetIsKnown : 1;
- bool transitionDomainIsKnown : 1;
-
- TransitionInfo()
- : transitionDomain(nullptr)
- , effectiveTargetStatesIsKnown(false)
- , exitSetIsKnown(false)
- , transitionDomainIsKnown(false)
- {}
- };
-
- typedef QHash<QAbstractTransition *, TransitionInfo> TransitionInfoCache;
- TransitionInfoCache cache;
-
- bool effectiveTargetStates(QAbstractTransition *t, QList<QAbstractState *> *targets) const
- {
- Q_ASSERT(targets);
-
- TransitionInfoCache::const_iterator cacheIt = cache.find(t);
- if (cacheIt == cache.end() || !cacheIt->effectiveTargetStatesIsKnown)
- return false;
-
- *targets = cacheIt->effectiveTargetStates;
- return true;
- }
-
- void insert(QAbstractTransition *t, const QList<QAbstractState *> &targets)
- {
- TransitionInfoCache::iterator cacheIt = cache.find(t);
- TransitionInfo &ti = cacheIt == cache.end()
- ? *cache.insert(t, TransitionInfo())
- : *cacheIt;
-
- Q_ASSERT(!ti.effectiveTargetStatesIsKnown);
- ti.effectiveTargetStates = targets;
- ti.effectiveTargetStatesIsKnown = true;
- }
-
- bool exitSet(QAbstractTransition *t, QSet<QAbstractState *> *exits) const
- {
- Q_ASSERT(exits);
-
- TransitionInfoCache::const_iterator cacheIt = cache.find(t);
- if (cacheIt == cache.end() || !cacheIt->exitSetIsKnown)
- return false;
-
- *exits = cacheIt->exitSet;
- return true;
- }
-
- void insert(QAbstractTransition *t, const QSet<QAbstractState *> &exits)
- {
- TransitionInfoCache::iterator cacheIt = cache.find(t);
- TransitionInfo &ti = cacheIt == cache.end()
- ? *cache.insert(t, TransitionInfo())
- : *cacheIt;
-
- Q_ASSERT(!ti.exitSetIsKnown);
- ti.exitSet = exits;
- ti.exitSetIsKnown = true;
- }
-
- bool transitionDomain(QAbstractTransition *t, QAbstractState **domain) const
- {
- Q_ASSERT(domain);
-
- TransitionInfoCache::const_iterator cacheIt = cache.find(t);
- if (cacheIt == cache.end() || !cacheIt->transitionDomainIsKnown)
- return false;
-
- *domain = cacheIt->transitionDomain;
- return true;
- }
-
- void insert(QAbstractTransition *t, QAbstractState *domain)
- {
- TransitionInfoCache::iterator cacheIt = cache.find(t);
- TransitionInfo &ti = cacheIt == cache.end()
- ? *cache.insert(t, TransitionInfo())
- : *cacheIt;
-
- Q_ASSERT(!ti.transitionDomainIsKnown);
- ti.transitionDomain = domain;
- ti.transitionDomainIsKnown = true;
- }
-};
-
-/* The function as described in http://www.w3.org/TR/2014/WD-scxml-20140529/ :
-
-function isDescendant(state1, state2)
-
-Returns 'true' if state1 is a descendant of state2 (a child, or a child of a child, or a child of a
-child of a child, etc.) Otherwise returns 'false'.
-*/
-static inline bool isDescendant(const QAbstractState *state1, const QAbstractState *state2)
-{
- Q_ASSERT(state1 != nullptr);
-
- for (QAbstractState *it = state1->parentState(); it != nullptr; it = it->parentState()) {
- if (it == state2)
- return true;
- }
-
- return false;
-}
-
-static bool containsDecendantOf(const QSet<QAbstractState *> &states, const QAbstractState *node)
-{
- for (QAbstractState *s : states)
- if (isDescendant(s, node))
- return true;
-
- return false;
-}
-
-static int descendantDepth(const QAbstractState *state, const QAbstractState *ancestor)
-{
- int depth = 0;
- for (const QAbstractState *it = state; it != nullptr; it = it->parentState()) {
- if (it == ancestor)
- break;
- ++depth;
- }
- return depth;
-}
-
-/* The function as described in http://www.w3.org/TR/2014/WD-scxml-20140529/ :
-
-function getProperAncestors(state1, state2)
-
-If state2 is null, returns the set of all ancestors of state1 in ancestry order (state1's parent
-followed by the parent's parent, etc. up to an including the <scxml> element). If state2 is
-non-null, returns in ancestry order the set of all ancestors of state1, up to but not including
-state2. (A "proper ancestor" of a state is its parent, or the parent's parent, or the parent's
-parent's parent, etc.))If state2 is state1's parent, or equal to state1, or a descendant of state1,
-this returns the empty set.
-*/
-static QList<QState *> getProperAncestors(const QAbstractState *state, const QAbstractState *upperBound)
-{
- Q_ASSERT(state != nullptr);
- QList<QState *> result;
- result.reserve(16);
- for (QState *it = state->parentState(); it && it != upperBound; it = it->parentState()) {
- result.append(it);
- }
- return result;
-}
-
-/* The function as described in http://www.w3.org/TR/2014/WD-scxml-20140529/ :
-
-function getEffectiveTargetStates(transition)
-
-Returns the states that will be the target when 'transition' is taken, dereferencing any history states.
-
-function getEffectiveTargetStates(transition)
- targets = new OrderedSet()
- for s in transition.target
- if isHistoryState(s):
- if historyValue[s.id]:
- targets.union(historyValue[s.id])
- else:
- targets.union(getEffectiveTargetStates(s.transition))
- else:
- targets.add(s)
- return targets
-*/
-static QList<QAbstractState *> getEffectiveTargetStates(QAbstractTransition *transition, CalculationCache *cache)
-{
- Q_ASSERT(cache);
-
- QList<QAbstractState *> targetsList;
- if (cache->effectiveTargetStates(transition, &targetsList))
- return targetsList;
-
- QSet<QAbstractState *> targets;
- const auto targetStates = transition->targetStates();
- for (QAbstractState *s : targetStates) {
- if (QHistoryState *historyState = QStateMachinePrivate::toHistoryState(s)) {
- QList<QAbstractState*> historyConfiguration = QHistoryStatePrivate::get(historyState)->configuration;
- if (!historyConfiguration.isEmpty()) {
- // There is a saved history, so apply that.
- targets.unite(QSet<QAbstractState *>(historyConfiguration.constBegin(), historyConfiguration.constEnd()));
- } else if (QAbstractTransition *defaultTransition = historyState->defaultTransition()) {
- // No saved history, take all default transition targets.
- const auto &targetStates = defaultTransition->targetStates();
- targets.unite(QSet<QAbstractState *>(targetStates.constBegin(), targetStates.constEnd()));
- } else {
- // Woops, we found a history state without a default state. That's not valid!
- QStateMachinePrivate *m = QStateMachinePrivate::get(historyState->machine());
- m->setError(QStateMachine::NoDefaultStateInHistoryStateError, historyState);
- }
- } else {
- targets.insert(s);
- }
- }
-
- targetsList = targets.values();
- cache->insert(transition, targetsList);
- return targetsList;
-}
-
-QStateMachinePrivate::QStateMachinePrivate()
-{
- isMachine = true;
-
- state = NotRunning;
- processing = false;
- processingScheduled = false;
- stop = false;
- stopProcessingReason = EventQueueEmpty;
- error = QStateMachine::NoError;
- globalRestorePolicy = QState::DontRestoreProperties;
- signalEventGenerator = nullptr;
-#if QT_CONFIG(animation)
- animated = true;
-#endif
-}
-
-QStateMachinePrivate::~QStateMachinePrivate()
-{
- qDeleteAll(internalEventQueue);
- qDeleteAll(externalEventQueue);
-
- for (QHash<int, DelayedEvent>::const_iterator it = delayedEvents.cbegin(), eit = delayedEvents.cend(); it != eit; ++it) {
- delete it.value().event;
- }
-}
-
-QState *QStateMachinePrivate::rootState() const
-{
- return const_cast<QStateMachine*>(q_func());
-}
-
-static QEvent *cloneEvent(QEvent *e)
-{
- switch (e->type()) {
- case QEvent::None:
- return new QEvent(*e);
- case QEvent::Timer:
- return new QTimerEvent(*static_cast<QTimerEvent*>(e));
- default:
- Q_ASSERT_X(false, "cloneEvent()", "not implemented");
- break;
- }
- return nullptr;
-}
-
-const QStateMachinePrivate::Handler qt_kernel_statemachine_handler = {
- cloneEvent
-};
-
-const QStateMachinePrivate::Handler *QStateMachinePrivate::handler = &qt_kernel_statemachine_handler;
-
-Q_CORE_EXPORT const QStateMachinePrivate::Handler *qcoreStateMachineHandler()
-{
- return &qt_kernel_statemachine_handler;
-}
-
-static int indexOfDescendant(QState *s, QAbstractState *desc)
-{
- QList<QAbstractState*> childStates = QStatePrivate::get(s)->childStates();
- for (int i = 0; i < childStates.size(); ++i) {
- QAbstractState *c = childStates.at(i);
- if ((c == desc) || isDescendant(desc, c)) {
- return i;
- }
- }
- return -1;
-}
-
-bool QStateMachinePrivate::transitionStateEntryLessThan(QAbstractTransition *t1, QAbstractTransition *t2)
-{
- QState *s1 = t1->sourceState(), *s2 = t2->sourceState();
- if (s1 == s2) {
- QList<QAbstractTransition*> transitions = QStatePrivate::get(s1)->transitions();
- return transitions.indexOf(t1) < transitions.indexOf(t2);
- } else if (isDescendant(s1, s2)) {
- return true;
- } else if (isDescendant(s2, s1)) {
- return false;
- } else {
- Q_ASSERT(s1->machine() != nullptr);
- QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine());
- QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2);
- Q_ASSERT(lca != nullptr);
- int s1Depth = descendantDepth(s1, lca);
- int s2Depth = descendantDepth(s2, lca);
- if (s1Depth == s2Depth)
- return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2));
- else
- return s1Depth > s2Depth;
- }
-}
-
-bool QStateMachinePrivate::stateEntryLessThan(QAbstractState *s1, QAbstractState *s2)
-{
- if (s1->parent() == s2->parent()) {
- return s1->parent()->children().indexOf(s1)
- < s2->parent()->children().indexOf(s2);
- } else if (isDescendant(s1, s2)) {
- return false;
- } else if (isDescendant(s2, s1)) {
- return true;
- } else {
- Q_ASSERT(s1->machine() != nullptr);
- QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine());
- QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2);
- Q_ASSERT(lca != nullptr);
- return (indexOfDescendant(lca, s1) < indexOfDescendant(lca, s2));
- }
-}
-
-bool QStateMachinePrivate::stateExitLessThan(QAbstractState *s1, QAbstractState *s2)
-{
- if (s1->parent() == s2->parent()) {
- return s2->parent()->children().indexOf(s2)
- < s1->parent()->children().indexOf(s1);
- } else if (isDescendant(s1, s2)) {
- return true;
- } else if (isDescendant(s2, s1)) {
- return false;
- } else {
- Q_ASSERT(s1->machine() != nullptr);
- QStateMachinePrivate *mach = QStateMachinePrivate::get(s1->machine());
- QState *lca = mach->findLCA(QList<QAbstractState*>() << s1 << s2);
- Q_ASSERT(lca != nullptr);
- return (indexOfDescendant(lca, s2) < indexOfDescendant(lca, s1));
- }
-}
-
-QState *QStateMachinePrivate::findLCA(const QList<QAbstractState*> &states, bool onlyCompound)
-{
- if (states.isEmpty())
- return nullptr;
- QList<QState *> ancestors = getProperAncestors(states.at(0), rootState()->parentState());
- for (int i = 0; i < ancestors.size(); ++i) {
- QState *anc = ancestors.at(i);
- if (onlyCompound && !isCompound(anc))
- continue;
-
- bool ok = true;
- for (int j = states.size() - 1; (j > 0) && ok; --j) {
- const QAbstractState *s = states.at(j);
- if (!isDescendant(s, anc))
- ok = false;
- }
- if (ok)
- return anc;
- }
-
- // Oops, this should never happen! The state machine itself is a common ancestor of all states,
- // no matter what. But, for the onlyCompound case: we probably have a state machine whose
- // childMode is set to parallel, which is illegal. However, we're stuck with it (and with
- // exposing this invalid/dangerous API to users), so recover in the least horrible way.
- setError(QStateMachine::StateMachineChildModeSetToParallelError, q_func());
- return q_func(); // make the statemachine the LCA/LCCA (which it should have been anyway)
-}
-
-QState *QStateMachinePrivate::findLCCA(const QList<QAbstractState*> &states)
-{
- return findLCA(states, true);
-}
-
-QList<QAbstractTransition*> QStateMachinePrivate::selectTransitions(QEvent *event, CalculationCache *cache)
-{
- Q_ASSERT(cache);
- Q_Q(const QStateMachine);
-
- QVarLengthArray<QAbstractState *> configuration_sorted;
- for (QAbstractState *s : qAsConst(configuration)) {
- if (isAtomic(s))
- configuration_sorted.append(s);
- }
- std::sort(configuration_sorted.begin(), configuration_sorted.end(), stateEntryLessThan);
-
- QList<QAbstractTransition*> enabledTransitions;
- const_cast<QStateMachine *>(q)->beginSelectTransitions(event);
- for (QAbstractState *state : qAsConst(configuration_sorted)) {
- QList<QState *> lst = getProperAncestors(state, nullptr);
- if (QState *grp = toStandardState(state))
- lst.prepend(grp);
- bool found = false;
- for (int j = 0; (j < lst.size()) && !found; ++j) {
- QState *s = lst.at(j);
- QList<QAbstractTransition*> transitions = QStatePrivate::get(s)->transitions();
- for (int k = 0; k < transitions.size(); ++k) {
- QAbstractTransition *t = transitions.at(k);
- if (QAbstractTransitionPrivate::get(t)->callEventTest(event)) {
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": selecting transition" << t;
-#endif
- enabledTransitions.append(t);
- found = true;
- break;
- }
- }
- }
- }
-
- if (!enabledTransitions.isEmpty()) {
- removeConflictingTransitions(enabledTransitions, cache);
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": enabled transitions after removing conflicts:" << enabledTransitions;
-#endif
- }
- const_cast<QStateMachine*>(q)->endSelectTransitions(event);
- return enabledTransitions;
-}
-
-/* The function as described in http://www.w3.org/TR/2014/WD-scxml-20140529/ :
-
-function removeConflictingTransitions(enabledTransitions):
- filteredTransitions = new OrderedSet()
- // toList sorts the transitions in the order of the states that selected them
- for t1 in enabledTransitions.toList():
- t1Preempted = false;
- transitionsToRemove = new OrderedSet()
- for t2 in filteredTransitions.toList():
- if computeExitSet([t1]).hasIntersection(computeExitSet([t2])):
- if isDescendant(t1.source, t2.source):
- transitionsToRemove.add(t2)
- else:
- t1Preempted = true
- break
- if not t1Preempted:
- for t3 in transitionsToRemove.toList():
- filteredTransitions.delete(t3)
- filteredTransitions.add(t1)
-
- return filteredTransitions
-
-Note: the implementation below does not build the transitionsToRemove, but removes them in-place.
-*/
-void QStateMachinePrivate::removeConflictingTransitions(QList<QAbstractTransition*> &enabledTransitions, CalculationCache *cache)
-{
- Q_ASSERT(cache);
-
- if (enabledTransitions.size() < 2)
- return; // There is no transition to conflict with.
-
- QList<QAbstractTransition*> filteredTransitions;
- filteredTransitions.reserve(enabledTransitions.size());
- std::sort(enabledTransitions.begin(), enabledTransitions.end(), transitionStateEntryLessThan);
-
- for (QAbstractTransition *t1 : qAsConst(enabledTransitions)) {
- bool t1Preempted = false;
- const QSet<QAbstractState*> exitSetT1 = computeExitSet_Unordered(t1, cache);
- QList<QAbstractTransition*>::iterator t2It = filteredTransitions.begin();
- while (t2It != filteredTransitions.end()) {
- QAbstractTransition *t2 = *t2It;
- if (t1 == t2) {
- // Special case: someone added the same transition object to a state twice. In this
- // case, t2 (which is already in the list) "preempts" t1.
- t1Preempted = true;
- break;
- }
-
- QSet<QAbstractState*> exitSetT2 = computeExitSet_Unordered(t2, cache);
- if (!exitSetT1.intersects(exitSetT2)) {
- // No conflict, no cry. Next patient please.
- ++t2It;
- } else {
- // Houston, we have a conflict. Check which transition can be removed.
- if (isDescendant(t1->sourceState(), t2->sourceState())) {
- // t1 preempts t2, so we can remove t2
- t2It = filteredTransitions.erase(t2It);
- } else {
- // t2 preempts t1, so there's no use in looking further and we don't need to add
- // t1 to the list.
- t1Preempted = true;
- break;
- }
- }
- }
- if (!t1Preempted)
- filteredTransitions.append(t1);
- }
-
- enabledTransitions = filteredTransitions;
-}
-
-void QStateMachinePrivate::microstep(QEvent *event, const QList<QAbstractTransition*> &enabledTransitions,
- CalculationCache *cache)
-{
- Q_ASSERT(cache);
-
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q_func() << ": begin microstep( enabledTransitions:" << enabledTransitions << ')';
- qDebug() << q_func() << ": configuration before exiting states:" << configuration;
-#endif
- QList<QAbstractState*> exitedStates = computeExitSet(enabledTransitions, cache);
- QHash<RestorableId, QVariant> pendingRestorables = computePendingRestorables(exitedStates);
-
- QSet<QAbstractState*> statesForDefaultEntry;
- QList<QAbstractState*> enteredStates = computeEntrySet(enabledTransitions, statesForDefaultEntry, cache);
-
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q_func() << ": computed exit set:" << exitedStates;
- qDebug() << q_func() << ": computed entry set:" << enteredStates;
-#endif
-
- QHash<QAbstractState *, QList<QPropertyAssignment>> assignmentsForEnteredStates =
- computePropertyAssignments(enteredStates, pendingRestorables);
- if (!pendingRestorables.isEmpty()) {
- // Add "implicit" assignments for restored properties to the first
- // (outermost) entered state
- Q_ASSERT(!enteredStates.isEmpty());
- QAbstractState *s = enteredStates.constFirst();
- assignmentsForEnteredStates[s] << restorablesToPropertyList(pendingRestorables);
- }
-
- exitStates(event, exitedStates, assignmentsForEnteredStates);
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q_func() << ": configuration after exiting states:" << configuration;
-#endif
-
- executeTransitionContent(event, enabledTransitions);
-
-#if QT_CONFIG(animation)
- QList<QAbstractAnimation *> selectedAnimations = selectAnimations(enabledTransitions);
-#endif
-
- enterStates(event, exitedStates, enteredStates, statesForDefaultEntry, assignmentsForEnteredStates
-#if QT_CONFIG(animation)
- , selectedAnimations
-#endif
- );
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q_func() << ": configuration after entering states:" << configuration;
- qDebug() << q_func() << ": end microstep";
-#endif
-}
-
-/* The function as described in http://www.w3.org/TR/2014/WD-scxml-20140529/ :
-
-procedure computeExitSet(enabledTransitions)
-
-For each transition t in enabledTransitions, if t is targetless then do nothing, else compute the
-transition's domain. (This will be the source state in the case of internal transitions) or the
-least common compound ancestor state of the source state and target states of t (in the case of
-external transitions. Add to the statesToExit set all states in the configuration that are
-descendants of the domain.
-
-function computeExitSet(transitions)
- statesToExit = new OrderedSet
- for t in transitions:
- if (t.target):
- domain = getTransitionDomain(t)
- for s in configuration:
- if isDescendant(s,domain):
- statesToExit.add(s)
- return statesToExit
-*/
-QList<QAbstractState*> QStateMachinePrivate::computeExitSet(const QList<QAbstractTransition*> &enabledTransitions,
- CalculationCache *cache)
-{
- Q_ASSERT(cache);
-
- QList<QAbstractState*> statesToExit_sorted = computeExitSet_Unordered(enabledTransitions, cache).values();
- std::sort(statesToExit_sorted.begin(), statesToExit_sorted.end(), stateExitLessThan);
- return statesToExit_sorted;
-}
-
-QSet<QAbstractState*> QStateMachinePrivate::computeExitSet_Unordered(const QList<QAbstractTransition*> &enabledTransitions,
- CalculationCache *cache)
-{
- Q_ASSERT(cache);
-
- QSet<QAbstractState*> statesToExit;
- for (QAbstractTransition *t : enabledTransitions)
- statesToExit.unite(computeExitSet_Unordered(t, cache));
- return statesToExit;
-}
-
-QSet<QAbstractState*> QStateMachinePrivate::computeExitSet_Unordered(QAbstractTransition *t,
- CalculationCache *cache)
-{
- Q_ASSERT(cache);
-
- QSet<QAbstractState*> statesToExit;
- if (cache->exitSet(t, &statesToExit))
- return statesToExit;
-
- QList<QAbstractState *> effectiveTargetStates = getEffectiveTargetStates(t, cache);
- QAbstractState *domain = getTransitionDomain(t, effectiveTargetStates, cache);
- if (domain == nullptr && !t->targetStates().isEmpty()) {
- // So we didn't find the least common ancestor for the source and target states of the
- // transition. If there were not target states, that would be fine: then the transition
- // will fire any events or signals, but not exit the state.
- //
- // However, there are target states, so it's either a node without a parent (or parent's
- // parent, etc), or the state belongs to a different state machine. Either way, this
- // makes the state machine invalid.
- if (error == QStateMachine::NoError)
- setError(QStateMachine::NoCommonAncestorForTransitionError, t->sourceState());
- QList<QAbstractState *> lst = pendingErrorStates.values();
- lst.prepend(t->sourceState());
-
- domain = findLCCA(lst);
- Q_ASSERT(domain != nullptr);
- }
-
- for (QAbstractState* s : qAsConst(configuration)) {
- if (isDescendant(s, domain))
- statesToExit.insert(s);
- }
-
- cache->insert(t, statesToExit);
- return statesToExit;
-}
-
-void QStateMachinePrivate::exitStates(QEvent *event, const QList<QAbstractState *> &statesToExit_sorted,
- const QHash<QAbstractState *, QList<QPropertyAssignment>> &assignmentsForEnteredStates)
-{
- for (int i = 0; i < statesToExit_sorted.size(); ++i) {
- QAbstractState *s = statesToExit_sorted.at(i);
- if (QState *grp = toStandardState(s)) {
- QList<QHistoryState*> hlst = QStatePrivate::get(grp)->historyStates();
- for (int j = 0; j < hlst.size(); ++j) {
- QHistoryState *h = hlst.at(j);
- QHistoryStatePrivate::get(h)->configuration.clear();
- QSet<QAbstractState*>::const_iterator it;
- for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) {
- QAbstractState *s0 = *it;
- if (QHistoryStatePrivate::get(h)->historyType == QHistoryState::DeepHistory) {
- if (isAtomic(s0) && isDescendant(s0, s))
- QHistoryStatePrivate::get(h)->configuration.append(s0);
- } else if (s0->parentState() == s) {
- QHistoryStatePrivate::get(h)->configuration.append(s0);
- }
- }
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q_func() << ": recorded" << ((QHistoryStatePrivate::get(h)->historyType == QHistoryState::DeepHistory) ? "deep" : "shallow")
- << "history for" << s << "in" << h << ':' << QHistoryStatePrivate::get(h)->configuration;
-#endif
- }
- }
- }
- for (int i = 0; i < statesToExit_sorted.size(); ++i) {
- QAbstractState *s = statesToExit_sorted.at(i);
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q_func() << ": exiting" << s;
-#endif
- QAbstractStatePrivate::get(s)->callOnExit(event);
-
-#if QT_CONFIG(animation)
- terminateActiveAnimations(s, assignmentsForEnteredStates);
-#else
- Q_UNUSED(assignmentsForEnteredStates);
-#endif
-
- configuration.remove(s);
- QAbstractStatePrivate::get(s)->emitExited();
- }
-}
-
-void QStateMachinePrivate::executeTransitionContent(QEvent *event, const QList<QAbstractTransition*> &enabledTransitions)
-{
- for (int i = 0; i < enabledTransitions.size(); ++i) {
- QAbstractTransition *t = enabledTransitions.at(i);
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q_func() << ": triggering" << t;
-#endif
- QAbstractTransitionPrivate::get(t)->callOnTransition(event);
- QAbstractTransitionPrivate::get(t)->emitTriggered();
- }
-}
-
-QList<QAbstractState*> QStateMachinePrivate::computeEntrySet(const QList<QAbstractTransition *> &enabledTransitions,
- QSet<QAbstractState *> &statesForDefaultEntry,
- CalculationCache *cache)
-{
- Q_ASSERT(cache);
-
- QSet<QAbstractState*> statesToEnter;
- if (pendingErrorStates.isEmpty()) {
- for (QAbstractTransition *t : enabledTransitions) {
- const auto targetStates = t->targetStates();
- for (QAbstractState *s : targetStates)
- addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry);
-
- const QList<QAbstractState *> effectiveTargetStates = getEffectiveTargetStates(t, cache);
- QAbstractState *ancestor = getTransitionDomain(t, effectiveTargetStates, cache);
- for (QAbstractState *s : effectiveTargetStates)
- addAncestorStatesToEnter(s, ancestor, statesToEnter, statesForDefaultEntry);
- }
- }
-
- // Did an error occur while selecting transitions? Then we enter the error state.
- if (!pendingErrorStates.isEmpty()) {
- statesToEnter.clear();
- statesToEnter = pendingErrorStates;
- statesForDefaultEntry = pendingErrorStatesForDefaultEntry;
- pendingErrorStates.clear();
- pendingErrorStatesForDefaultEntry.clear();
- }
-
- QList<QAbstractState*> statesToEnter_sorted = statesToEnter.values();
- std::sort(statesToEnter_sorted.begin(), statesToEnter_sorted.end(), stateEntryLessThan);
- return statesToEnter_sorted;
-}
-
-/* The algorithm as described in http://www.w3.org/TR/2014/WD-scxml-20140529/ :
-
-function getTransitionDomain(transition)
-
-Return the compound state such that 1) all states that are exited or entered as a result of taking
-'transition' are descendants of it 2) no descendant of it has this property.
-
-function getTransitionDomain(t)
- tstates = getEffectiveTargetStates(t)
- if not tstates:
- return null
- elif t.type == "internal" and isCompoundState(t.source) and tstates.every(lambda s: isDescendant(s,t.source)):
- return t.source
- else:
- return findLCCA([t.source].append(tstates))
-*/
-QAbstractState *QStateMachinePrivate::getTransitionDomain(QAbstractTransition *t,
- const QList<QAbstractState *> &effectiveTargetStates,
- CalculationCache *cache)
-{
- Q_ASSERT(cache);
-
- if (effectiveTargetStates.isEmpty())
- return nullptr;
-
- QAbstractState *domain = nullptr;
- if (cache->transitionDomain(t, &domain))
- return domain;
-
- if (t->transitionType() == QAbstractTransition::InternalTransition) {
- if (QState *tSource = t->sourceState()) {
- if (isCompound(tSource)) {
- bool allDescendants = true;
- for (QAbstractState *s : effectiveTargetStates) {
- if (!isDescendant(s, tSource)) {
- allDescendants = false;
- break;
- }
- }
-
- if (allDescendants)
- return tSource;
- }
- }
- }
-
- QList<QAbstractState *> states(effectiveTargetStates);
- if (QAbstractState *src = t->sourceState())
- states.prepend(src);
- domain = findLCCA(states);
- cache->insert(t, domain);
- return domain;
-}
-
-void QStateMachinePrivate::enterStates(QEvent *event, const QList<QAbstractState *> &exitedStates_sorted,
- const QList<QAbstractState *> &statesToEnter_sorted,
- const QSet<QAbstractState *> &statesForDefaultEntry,
- QHash<QAbstractState *, QList<QPropertyAssignment>> &propertyAssignmentsForState
-#if QT_CONFIG(animation)
- , const QList<QAbstractAnimation *> &selectedAnimations
-#endif
- )
-{
-#ifdef QSTATEMACHINE_DEBUG
- Q_Q(QStateMachine);
-#endif
- for (int i = 0; i < statesToEnter_sorted.size(); ++i) {
- QAbstractState *s = statesToEnter_sorted.at(i);
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": entering" << s;
-#endif
- configuration.insert(s);
- registerTransitions(s);
-
-#if QT_CONFIG(animation)
- initializeAnimations(s, selectedAnimations, exitedStates_sorted, propertyAssignmentsForState);
-#endif
-
- // Immediately set the properties that are not animated.
- {
- const auto assignments = propertyAssignmentsForState.value(s);
- for (const auto &assn : assignments) {
- if (globalRestorePolicy == QState::RestoreProperties) {
- if (assn.explicitlySet) {
- if (!hasRestorable(s, assn.object, assn.propertyName)) {
- QVariant value = savedValueForRestorable(exitedStates_sorted, assn.object, assn.propertyName);
- unregisterRestorables(exitedStates_sorted, assn.object, assn.propertyName);
- registerRestorable(s, assn.object, assn.propertyName, value);
- }
- } else {
- // The property is being restored, hence no need to
- // save the current value. Discard any saved values in
- // exited states, since those are now stale.
- unregisterRestorables(exitedStates_sorted, assn.object, assn.propertyName);
- }
- }
- assn.write();
- }
- }
-
- QAbstractStatePrivate::get(s)->callOnEntry(event);
- QAbstractStatePrivate::get(s)->emitEntered();
-
- // FIXME:
- // See the "initial transitions" comment in addDescendantStatesToEnter first, then implement:
-// if (statesForDefaultEntry.contains(s)) {
-// // ### executeContent(s.initial.transition.children())
-// }
- Q_UNUSED(statesForDefaultEntry);
-
- if (QHistoryState *h = toHistoryState(s))
- QAbstractTransitionPrivate::get(h->defaultTransition())->callOnTransition(event);
-
- // Emit propertiesAssigned signal if the state has no animated properties.
- {
- QState *ss = toStandardState(s);
- if (ss
- #if QT_CONFIG(animation)
- && !animationsForState.contains(s)
- #endif
- )
- QStatePrivate::get(ss)->emitPropertiesAssigned();
- }
-
- if (isFinal(s)) {
- QState *parent = s->parentState();
- if (parent) {
- if (parent != rootState()) {
- QFinalState *finalState = qobject_cast<QFinalState *>(s);
- Q_ASSERT(finalState);
- emitStateFinished(parent, finalState);
- }
- QState *grandparent = parent->parentState();
- if (grandparent && isParallel(grandparent)) {
- bool allChildStatesFinal = true;
- QList<QAbstractState*> childStates = QStatePrivate::get(grandparent)->childStates();
- for (int j = 0; j < childStates.size(); ++j) {
- QAbstractState *cs = childStates.at(j);
- if (!isInFinalState(cs)) {
- allChildStatesFinal = false;
- break;
- }
- }
- if (allChildStatesFinal && (grandparent != rootState())) {
- QFinalState *finalState = qobject_cast<QFinalState *>(s);
- Q_ASSERT(finalState);
- emitStateFinished(grandparent, finalState);
- }
- }
- }
- }
- }
- {
- QSet<QAbstractState*>::const_iterator it;
- for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) {
- if (isFinal(*it)) {
- QState *parent = (*it)->parentState();
- if (((parent == rootState())
- && (rootState()->childMode() == QState::ExclusiveStates))
- || ((parent->parentState() == rootState())
- && (rootState()->childMode() == QState::ParallelStates)
- && isInFinalState(rootState()))) {
- processing = false;
- stopProcessingReason = Finished;
- break;
- }
- }
- }
- }
-// qDebug() << "configuration:" << configuration.toList();
-}
-
-/* The algorithm as described in http://www.w3.org/TR/2014/WD-scxml-20140529/ has a bug. See
- * QTBUG-44963 for details. The algorithm here is as described in
- * http://www.w3.org/Voice/2013/scxml-irp/SCXML.htm as of Friday March 13, 2015.
-
-procedure addDescendantStatesToEnter(state,statesToEnter,statesForDefaultEntry, defaultHistoryContent):
- if isHistoryState(state):
- if historyValue[state.id]:
- for s in historyValue[state.id]:
- addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
- for s in historyValue[state.id]:
- addAncestorStatesToEnter(s, state.parent, statesToEnter, statesForDefaultEntry, defaultHistoryContent)
- else:
- defaultHistoryContent[state.parent.id] = state.transition.content
- for s in state.transition.target:
- addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
- for s in state.transition.target:
- addAncestorStatesToEnter(s, state.parent, statesToEnter, statesForDefaultEntry, defaultHistoryContent)
- else:
- statesToEnter.add(state)
- if isCompoundState(state):
- statesForDefaultEntry.add(state)
- for s in state.initial.transition.target:
- addDescendantStatesToEnter(s,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
- for s in state.initial.transition.target:
- addAncestorStatesToEnter(s, state, statesToEnter, statesForDefaultEntry, defaultHistoryContent)
- else:
- if isParallelState(state):
- for child in getChildStates(state):
- if not statesToEnter.some(lambda s: isDescendant(s,child)):
- addDescendantStatesToEnter(child,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
-*/
-void QStateMachinePrivate::addDescendantStatesToEnter(QAbstractState *state,
- QSet<QAbstractState*> &statesToEnter,
- QSet<QAbstractState*> &statesForDefaultEntry)
-{
- if (QHistoryState *h = toHistoryState(state)) {
- const QList<QAbstractState*> historyConfiguration = QHistoryStatePrivate::get(h)->configuration;
- if (!historyConfiguration.isEmpty()) {
- for (QAbstractState *s : historyConfiguration)
- addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry);
- for (QAbstractState *s : historyConfiguration)
- addAncestorStatesToEnter(s, state->parentState(), statesToEnter, statesForDefaultEntry);
-
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q_func() << ": restoring"
- << ((QHistoryStatePrivate::get(h)->historyType == QHistoryState::DeepHistory) ? "deep" : "shallow")
- << "history from" << state << ':' << historyConfiguration;
-#endif
- } else {
- QList<QAbstractState*> defaultHistoryContent;
- if (QAbstractTransition *t = QHistoryStatePrivate::get(h)->defaultTransition)
- defaultHistoryContent = t->targetStates();
-
- if (defaultHistoryContent.isEmpty()) {
- setError(QStateMachine::NoDefaultStateInHistoryStateError, h);
- } else {
- for (QAbstractState *s : qAsConst(defaultHistoryContent))
- addDescendantStatesToEnter(s, statesToEnter, statesForDefaultEntry);
- for (QAbstractState *s : qAsConst(defaultHistoryContent))
- addAncestorStatesToEnter(s, state->parentState(), statesToEnter, statesForDefaultEntry);
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q_func() << ": initial history targets for" << state << ':' << defaultHistoryContent;
-#endif
- }
- }
- } else {
- if (state == rootState()) {
- // Error has already been set by exitStates().
- Q_ASSERT(error != QStateMachine::NoError);
- return;
- }
- statesToEnter.insert(state);
- if (isCompound(state)) {
- statesForDefaultEntry.insert(state);
- if (QAbstractState *initial = toStandardState(state)->initialState()) {
- Q_ASSERT(initial->machine() == q_func());
-
- // FIXME:
- // Qt does not support initial transitions (which is a problem for parallel states).
- // The way it simulates this for other states, is by having a single initial state.
- // See also the FIXME in enterStates.
- statesForDefaultEntry.insert(initial);
-
- addDescendantStatesToEnter(initial, statesToEnter, statesForDefaultEntry);
- addAncestorStatesToEnter(initial, state, statesToEnter, statesForDefaultEntry);
- } else {
- setError(QStateMachine::NoInitialStateError, state);
- return;
- }
- } else if (isParallel(state)) {
- QState *grp = toStandardState(state);
- const auto childStates = QStatePrivate::get(grp)->childStates();
- for (QAbstractState *child : childStates) {
- if (!containsDecendantOf(statesToEnter, child))
- addDescendantStatesToEnter(child, statesToEnter, statesForDefaultEntry);
- }
- }
- }
-}
-
-
-/* The algorithm as described in http://www.w3.org/TR/2014/WD-scxml-20140529/ :
-
-procedure addAncestorStatesToEnter(state, ancestor, statesToEnter, statesForDefaultEntry, defaultHistoryContent)
- for anc in getProperAncestors(state,ancestor):
- statesToEnter.add(anc)
- if isParallelState(anc):
- for child in getChildStates(anc):
- if not statesToEnter.some(lambda s: isDescendant(s,child)):
- addDescendantStatesToEnter(child,statesToEnter,statesForDefaultEntry, defaultHistoryContent)
-*/
-void QStateMachinePrivate::addAncestorStatesToEnter(QAbstractState *s, QAbstractState *ancestor,
- QSet<QAbstractState*> &statesToEnter,
- QSet<QAbstractState*> &statesForDefaultEntry)
-{
- const auto properAncestors = getProperAncestors(s, ancestor);
- for (QState *anc : properAncestors) {
- if (!anc->parentState())
- continue;
- statesToEnter.insert(anc);
- if (isParallel(anc)) {
- const auto childStates = QStatePrivate::get(anc)->childStates();
- for (QAbstractState *child : childStates) {
- if (!containsDecendantOf(statesToEnter, child))
- addDescendantStatesToEnter(child, statesToEnter, statesForDefaultEntry);
- }
- }
- }
-}
-
-bool QStateMachinePrivate::isFinal(const QAbstractState *s)
-{
- return s && (QAbstractStatePrivate::get(s)->stateType == QAbstractStatePrivate::FinalState);
-}
-
-bool QStateMachinePrivate::isParallel(const QAbstractState *s)
-{
- const QState *ss = toStandardState(s);
- return ss && (QStatePrivate::get(ss)->childMode == QState::ParallelStates);
-}
-
-bool QStateMachinePrivate::isCompound(const QAbstractState *s) const
-{
- const QState *group = toStandardState(s);
- if (!group)
- return false;
- bool isMachine = QStatePrivate::get(group)->isMachine;
- // Don't treat the machine as compound if it's a sub-state of this machine
- if (isMachine && (group != rootState()))
- return false;
- return (!isParallel(group) && !QStatePrivate::get(group)->childStates().isEmpty());
-}
-
-bool QStateMachinePrivate::isAtomic(const QAbstractState *s) const
-{
- const QState *ss = toStandardState(s);
- return (ss && QStatePrivate::get(ss)->childStates().isEmpty())
- || isFinal(s)
- // Treat the machine as atomic if it's a sub-state of this machine
- || (ss && QStatePrivate::get(ss)->isMachine && (ss != rootState()));
-}
-
-QState *QStateMachinePrivate::toStandardState(QAbstractState *state)
-{
- if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::StandardState))
- return static_cast<QState*>(state);
- return nullptr;
-}
-
-const QState *QStateMachinePrivate::toStandardState(const QAbstractState *state)
-{
- if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::StandardState))
- return static_cast<const QState*>(state);
- return nullptr;
-}
-
-QFinalState *QStateMachinePrivate::toFinalState(QAbstractState *state)
-{
- if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::FinalState))
- return static_cast<QFinalState*>(state);
- return nullptr;
-}
-
-QHistoryState *QStateMachinePrivate::toHistoryState(QAbstractState *state)
-{
- if (state && (QAbstractStatePrivate::get(state)->stateType == QAbstractStatePrivate::HistoryState))
- return static_cast<QHistoryState*>(state);
- return nullptr;
-}
-
-bool QStateMachinePrivate::isInFinalState(QAbstractState* s) const
-{
- if (isCompound(s)) {
- QState *grp = toStandardState(s);
- QList<QAbstractState*> lst = QStatePrivate::get(grp)->childStates();
- for (int i = 0; i < lst.size(); ++i) {
- QAbstractState *cs = lst.at(i);
- if (isFinal(cs) && configuration.contains(cs))
- return true;
- }
- return false;
- } else if (isParallel(s)) {
- QState *grp = toStandardState(s);
- QList<QAbstractState*> lst = QStatePrivate::get(grp)->childStates();
- for (int i = 0; i < lst.size(); ++i) {
- QAbstractState *cs = lst.at(i);
- if (!isInFinalState(cs))
- return false;
- }
- return true;
- }
- else
- return false;
-}
-
-#ifndef QT_NO_PROPERTIES
-
-/*!
- \internal
- Returns \c true if the given state has saved the value of the given property,
- otherwise returns \c false.
-*/
-bool QStateMachinePrivate::hasRestorable(QAbstractState *state, QObject *object,
- const QByteArray &propertyName) const
-{
- RestorableId id(object, propertyName);
- return registeredRestorablesForState.value(state).contains(id);
-}
-
-/*!
- \internal
- Returns the value to save for the property identified by \a id.
- If an exited state (member of \a exitedStates_sorted) has saved a value for
- the property, the saved value from the last (outermost) state that will be
- exited is returned (in practice carrying the saved value on to the next
- state). Otherwise, the current value of the property is returned.
-*/
-QVariant QStateMachinePrivate::savedValueForRestorable(const QList<QAbstractState*> &exitedStates_sorted,
- QObject *object, const QByteArray &propertyName) const
-{
-#ifdef QSTATEMACHINE_RESTORE_PROPERTIES_DEBUG
- qDebug() << q_func() << ": savedValueForRestorable(" << exitedStates_sorted << object << propertyName << ')';
-#endif
- for (int i = exitedStates_sorted.size() - 1; i >= 0; --i) {
- QAbstractState *s = exitedStates_sorted.at(i);
- QHash<RestorableId, QVariant> restorables = registeredRestorablesForState.value(s);
- QHash<RestorableId, QVariant>::const_iterator it = restorables.constFind(RestorableId(object, propertyName));
- if (it != restorables.constEnd()) {
-#ifdef QSTATEMACHINE_RESTORE_PROPERTIES_DEBUG
- qDebug() << q_func() << ": using" << it.value() << "from" << s;
-#endif
- return it.value();
- }
- }
-#ifdef QSTATEMACHINE_RESTORE_PROPERTIES_DEBUG
- qDebug() << q_func() << ": falling back to current value";
-#endif
- return object->property(propertyName);
-}
-
-void QStateMachinePrivate::registerRestorable(QAbstractState *state, QObject *object, const QByteArray &propertyName,
- const QVariant &value)
-{
-#ifdef QSTATEMACHINE_RESTORE_PROPERTIES_DEBUG
- qDebug() << q_func() << ": registerRestorable(" << state << object << propertyName << value << ')';
-#endif
- RestorableId id(object, propertyName);
- QHash<RestorableId, QVariant> &restorables = registeredRestorablesForState[state];
- if (!restorables.contains(id))
- restorables.insert(id, value);
-#ifdef QSTATEMACHINE_RESTORE_PROPERTIES_DEBUG
- else
- qDebug() << q_func() << ": (already registered)";
-#endif
-}
-
-void QStateMachinePrivate::unregisterRestorables(const QList<QAbstractState *> &states, QObject *object,
- const QByteArray &propertyName)
-{
-#ifdef QSTATEMACHINE_RESTORE_PROPERTIES_DEBUG
- qDebug() << q_func() << ": unregisterRestorables(" << states << object << propertyName << ')';
-#endif
- RestorableId id(object, propertyName);
- for (int i = 0; i < states.size(); ++i) {
- QAbstractState *s = states.at(i);
- QHash<QAbstractState*, QHash<RestorableId, QVariant> >::iterator it;
- it = registeredRestorablesForState.find(s);
- if (it == registeredRestorablesForState.end())
- continue;
- QHash<RestorableId, QVariant> &restorables = it.value();
- const auto it2 = restorables.constFind(id);
- if (it2 == restorables.cend())
- continue;
-#ifdef QSTATEMACHINE_RESTORE_PROPERTIES_DEBUG
- qDebug() << q_func() << ": unregistered for" << s;
-#endif
- restorables.erase(it2);
- if (restorables.isEmpty())
- registeredRestorablesForState.erase(it);
- }
-}
-
-QList<QPropertyAssignment> QStateMachinePrivate::restorablesToPropertyList(const QHash<RestorableId, QVariant> &restorables) const
-{
- QList<QPropertyAssignment> result;
- QHash<RestorableId, QVariant>::const_iterator it;
- for (it = restorables.constBegin(); it != restorables.constEnd(); ++it) {
- const RestorableId &id = it.key();
- if (!id.object()) {
- // Property object was deleted
- continue;
- }
-#ifdef QSTATEMACHINE_RESTORE_PROPERTIES_DEBUG
- qDebug() << q_func() << ": restoring" << id.object() << id.proertyName() << "to" << it.value();
-#endif
- result.append(QPropertyAssignment(id.object(), id.propertyName(), it.value(), /*explicitlySet=*/false));
- }
- return result;
-}
-
-/*!
- \internal
- Computes the set of properties whose values should be restored given that
- the states \a statesToExit_sorted will be exited.
-
- If a particular (object, propertyName) pair occurs more than once (i.e.,
- because nested states are being exited), the value from the last (outermost)
- exited state takes precedence.
-
- The result of this function must be filtered according to the explicit
- property assignments (QState::assignProperty()) of the entered states
- before the property restoration is actually performed; i.e., if an entered
- state assigns to a property that would otherwise be restored, that property
- should not be restored after all, but the saved value from the exited state
- should be remembered by the entered state (see registerRestorable()).
-*/
-QHash<QStateMachinePrivate::RestorableId, QVariant> QStateMachinePrivate::computePendingRestorables(
- const QList<QAbstractState*> &statesToExit_sorted) const
-{
- QHash<QStateMachinePrivate::RestorableId, QVariant> restorables;
- for (int i = statesToExit_sorted.size() - 1; i >= 0; --i) {
- QAbstractState *s = statesToExit_sorted.at(i);
- QHash<QStateMachinePrivate::RestorableId, QVariant> rs = registeredRestorablesForState.value(s);
- QHash<QStateMachinePrivate::RestorableId, QVariant>::const_iterator it;
- for (it = rs.constBegin(); it != rs.constEnd(); ++it) {
- if (!restorables.contains(it.key()))
- restorables.insert(it.key(), it.value());
- }
- }
- return restorables;
-}
-
-/*!
- \internal
- Computes the ordered sets of property assignments for the states to be
- entered, \a statesToEnter_sorted. Also filters \a pendingRestorables (removes
- properties that should not be restored because they are assigned by an
- entered state).
-*/
-QHash<QAbstractState *, QList<QPropertyAssignment>> QStateMachinePrivate::computePropertyAssignments(
- const QList<QAbstractState*> &statesToEnter_sorted, QHash<RestorableId, QVariant> &pendingRestorables) const
-{
- QHash<QAbstractState *, QList<QPropertyAssignment>> assignmentsForState;
- for (int i = 0; i < statesToEnter_sorted.size(); ++i) {
- QState *s = toStandardState(statesToEnter_sorted.at(i));
- if (!s)
- continue;
-
- QList<QPropertyAssignment> &assignments = QStatePrivate::get(s)->propertyAssignments;
- for (int j = 0; j < assignments.size(); ++j) {
- const QPropertyAssignment &assn = assignments.at(j);
- if (assn.objectDeleted()) {
- assignments.removeAt(j--);
- } else {
- pendingRestorables.remove(RestorableId(assn.object, assn.propertyName));
- assignmentsForState[s].append(assn);
- }
- }
- }
- return assignmentsForState;
-}
-
-#endif // QT_NO_PROPERTIES
-
-QAbstractState *QStateMachinePrivate::findErrorState(QAbstractState *context)
-{
- // Find error state recursively in parent hierarchy if not set explicitly for context state
- QAbstractState *errorState = nullptr;
- if (context != nullptr) {
- QState *s = toStandardState(context);
- if (s != nullptr)
- errorState = s->errorState();
-
- if (errorState == nullptr)
- errorState = findErrorState(context->parentState());
- }
-
- return errorState;
-}
-
-void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractState *currentContext)
-{
- Q_Q(QStateMachine);
-
- error = errorCode;
- switch (errorCode) {
- case QStateMachine::NoInitialStateError:
- Q_ASSERT(currentContext != nullptr);
-
- errorString = QStateMachine::tr("Missing initial state in compound state '%1'")
- .arg(currentContext->objectName());
-
- break;
- case QStateMachine::NoDefaultStateInHistoryStateError:
- Q_ASSERT(currentContext != nullptr);
-
- errorString = QStateMachine::tr("Missing default state in history state '%1'")
- .arg(currentContext->objectName());
- break;
-
- case QStateMachine::NoCommonAncestorForTransitionError:
- Q_ASSERT(currentContext != nullptr);
-
- errorString = QStateMachine::tr("No common ancestor for targets and source of transition from state '%1'")
- .arg(currentContext->objectName());
- break;
-
- case QStateMachine::StateMachineChildModeSetToParallelError:
- Q_ASSERT(currentContext != nullptr);
-
- errorString = QStateMachine::tr("Child mode of state machine '%1' is not 'ExclusiveStates'.")
- .arg(currentContext->objectName());
- break;
-
- default:
- errorString = QStateMachine::tr("Unknown error");
- };
-
- pendingErrorStates.clear();
- pendingErrorStatesForDefaultEntry.clear();
-
- QAbstractState *currentErrorState = findErrorState(currentContext);
-
- // Avoid infinite loop if the error state itself has an error
- if (currentContext == currentErrorState)
- currentErrorState = nullptr;
-
- Q_ASSERT(currentErrorState != rootState());
-
- if (currentErrorState != nullptr) {
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": entering error state" << currentErrorState << "from" << currentContext;
-#endif
- pendingErrorStates.insert(currentErrorState);
- addDescendantStatesToEnter(currentErrorState, pendingErrorStates, pendingErrorStatesForDefaultEntry);
- addAncestorStatesToEnter(currentErrorState, rootState(), pendingErrorStates, pendingErrorStatesForDefaultEntry);
- pendingErrorStates -= configuration;
- } else {
- qWarning("Unrecoverable error detected in running state machine: %ls",
- qUtf16Printable(errorString));
- q->stop();
- }
-}
-
-#if QT_CONFIG(animation)
-
-QStateMachinePrivate::InitializeAnimationResult
-QStateMachinePrivate::initializeAnimation(QAbstractAnimation *abstractAnimation,
- const QPropertyAssignment &prop)
-{
- InitializeAnimationResult result;
- QAnimationGroup *group = qobject_cast<QAnimationGroup*>(abstractAnimation);
- if (group) {
- for (int i = 0; i < group->animationCount(); ++i) {
- QAbstractAnimation *animationChild = group->animationAt(i);
- const auto ret = initializeAnimation(animationChild, prop);
- result.handledAnimations << ret.handledAnimations;
- result.localResetEndValues << ret.localResetEndValues;
- }
- } else {
- QPropertyAnimation *animation = qobject_cast<QPropertyAnimation *>(abstractAnimation);
- if (animation != nullptr
- && prop.object == animation->targetObject()
- && prop.propertyName == animation->propertyName()) {
-
- // Only change end value if it is undefined
- if (!animation->endValue().isValid()) {
- animation->setEndValue(prop.value);
- result.localResetEndValues.append(animation);
- }
- result.handledAnimations.append(animation);
- }
- }
- return result;
-}
-
-void QStateMachinePrivate::_q_animationFinished()
-{
- Q_Q(QStateMachine);
- QAbstractAnimation *anim = qobject_cast<QAbstractAnimation*>(q->sender());
- Q_ASSERT(anim != nullptr);
- QObject::disconnect(anim, SIGNAL(finished()), q, SLOT(_q_animationFinished()));
- if (resetAnimationEndValues.contains(anim)) {
- qobject_cast<QVariantAnimation*>(anim)->setEndValue(QVariant()); // ### generalize
- resetAnimationEndValues.remove(anim);
- }
-
- QAbstractState *state = stateForAnimation.take(anim);
- Q_ASSERT(state != nullptr);
-
-#ifndef QT_NO_PROPERTIES
- // Set the final property value.
- QPropertyAssignment assn = propertyForAnimation.take(anim);
- assn.write();
- if (!assn.explicitlySet)
- unregisterRestorables(QList<QAbstractState*>() << state, assn.object, assn.propertyName);
-#endif
-
- QHash<QAbstractState*, QList<QAbstractAnimation*> >::iterator it;
- it = animationsForState.find(state);
- Q_ASSERT(it != animationsForState.end());
- QList<QAbstractAnimation*> &animations = it.value();
- animations.removeOne(anim);
- if (animations.isEmpty()) {
- animationsForState.erase(it);
- QStatePrivate::get(toStandardState(state))->emitPropertiesAssigned();
- }
-}
-
-QList<QAbstractAnimation *> QStateMachinePrivate::selectAnimations(const QList<QAbstractTransition *> &transitionList) const
-{
- QList<QAbstractAnimation *> selectedAnimations;
- if (animated) {
- for (int i = 0; i < transitionList.size(); ++i) {
- QAbstractTransition *transition = transitionList.at(i);
-
- selectedAnimations << transition->animations();
- selectedAnimations << defaultAnimationsForSource.values(transition->sourceState());
-
- QList<QAbstractState *> targetStates = transition->targetStates();
- for (int j=0; j<targetStates.size(); ++j)
- selectedAnimations << defaultAnimationsForTarget.values(targetStates.at(j));
- }
- selectedAnimations << defaultAnimations;
- }
- return selectedAnimations;
-}
-
-void QStateMachinePrivate::terminateActiveAnimations(QAbstractState *state,
- const QHash<QAbstractState *, QList<QPropertyAssignment>> &assignmentsForEnteredStates)
-{
- Q_Q(QStateMachine);
- QList<QAbstractAnimation*> animations = animationsForState.take(state);
- for (int i = 0; i < animations.size(); ++i) {
- QAbstractAnimation *anim = animations.at(i);
- QObject::disconnect(anim, SIGNAL(finished()), q, SLOT(_q_animationFinished()));
- stateForAnimation.remove(anim);
-
- // Stop the (top-level) animation.
- // ### Stopping nested animation has weird behavior.
- QAbstractAnimation *topLevelAnim = anim;
- while (QAnimationGroup *group = topLevelAnim->group())
- topLevelAnim = group;
- topLevelAnim->stop();
-
- if (resetAnimationEndValues.contains(anim)) {
- qobject_cast<QVariantAnimation*>(anim)->setEndValue(QVariant()); // ### generalize
- resetAnimationEndValues.remove(anim);
- }
- QPropertyAssignment assn = propertyForAnimation.take(anim);
- Q_ASSERT(assn.object != nullptr);
- // If there is no property assignment that sets this property,
- // set the property to its target value.
- bool found = false;
- for (auto it = assignmentsForEnteredStates.constBegin(); it != assignmentsForEnteredStates.constEnd(); ++it) {
- const QList<QPropertyAssignment> &assignments = it.value();
- for (int j = 0; j < assignments.size(); ++j) {
- if (assignments.at(j).hasTarget(assn.object, assn.propertyName)) {
- found = true;
- break;
- }
- }
- }
- if (!found) {
- assn.write();
- if (!assn.explicitlySet)
- unregisterRestorables(QList<QAbstractState*>() << state, assn.object, assn.propertyName);
- }
- }
-}
-
-void QStateMachinePrivate::initializeAnimations(QAbstractState *state, const QList<QAbstractAnimation *> &selectedAnimations,
- const QList<QAbstractState*> &exitedStates_sorted,
- QHash<QAbstractState *, QList<QPropertyAssignment>> &assignmentsForEnteredStates)
-{
- Q_Q(QStateMachine);
- if (!assignmentsForEnteredStates.contains(state))
- return;
- QList<QPropertyAssignment> &assignments = assignmentsForEnteredStates[state];
- for (int i = 0; i < selectedAnimations.size(); ++i) {
- QAbstractAnimation *anim = selectedAnimations.at(i);
- for (auto it = assignments.begin(); it != assignments.end(); ) {
- const QPropertyAssignment &assn = *it;
- const auto ret = initializeAnimation(anim, assn);
- if (!ret.handledAnimations.isEmpty()) {
- for (int j = 0; j < ret.handledAnimations.size(); ++j) {
- QAbstractAnimation *a = ret.handledAnimations.at(j);
- propertyForAnimation.insert(a, assn);
- stateForAnimation.insert(a, state);
- animationsForState[state].append(a);
- // ### connect to just the top-level animation?
- QObject::connect(a, SIGNAL(finished()), q, SLOT(_q_animationFinished()), Qt::UniqueConnection);
- }
- if ((globalRestorePolicy == QState::RestoreProperties)
- && !hasRestorable(state, assn.object, assn.propertyName)) {
- QVariant value = savedValueForRestorable(exitedStates_sorted, assn.object, assn.propertyName);
- unregisterRestorables(exitedStates_sorted, assn.object, assn.propertyName);
- registerRestorable(state, assn.object, assn.propertyName, value);
- }
- it = assignments.erase(it);
- } else {
- ++it;
- }
- for (int j = 0; j < ret.localResetEndValues.size(); ++j)
- resetAnimationEndValues.insert(ret.localResetEndValues.at(j));
- }
- // We require that at least one animation is valid.
- // ### generalize
- QList<QVariantAnimation*> variantAnims = anim->findChildren<QVariantAnimation*>();
- if (QVariantAnimation *va = qobject_cast<QVariantAnimation*>(anim))
- variantAnims.append(va);
-
- bool hasValidEndValue = false;
- for (int j = 0; j < variantAnims.size(); ++j) {
- if (variantAnims.at(j)->endValue().isValid()) {
- hasValidEndValue = true;
- break;
- }
- }
-
- if (hasValidEndValue) {
- if (anim->state() == QAbstractAnimation::Running) {
- // The animation is still running. This can happen if the
- // animation is a group, and one of its children just finished,
- // and that caused a state to emit its propertiesAssigned() signal, and
- // that triggered a transition in the machine.
- // Just stop the animation so it is correctly restarted again.
- anim->stop();
- }
- anim->start();
- }
-
- if (assignments.isEmpty()) {
- assignmentsForEnteredStates.remove(state);
- break;
- }
- }
-}
-
-#endif // animation
-
-QAbstractTransition *QStateMachinePrivate::createInitialTransition() const
-{
- class InitialTransition : public QAbstractTransition
- {
- public:
- InitialTransition(const QList<QAbstractState *> &targets)
- : QAbstractTransition()
- { setTargetStates(targets); }
- protected:
- bool eventTest(QEvent *) override { return true; }
- void onTransition(QEvent *) override {}
- };
-
- QState *root = rootState();
- Q_ASSERT(root != nullptr);
- QList<QAbstractState *> targets;
- switch (root->childMode()) {
- case QState::ExclusiveStates:
- targets.append(root->initialState());
- break;
- case QState::ParallelStates:
- targets = QStatePrivate::get(root)->childStates();
- break;
- }
- return new InitialTransition(targets);
-}
-
-void QStateMachinePrivate::clearHistory()
-{
- Q_Q(QStateMachine);
- QList<QHistoryState*> historyStates = q->findChildren<QHistoryState*>();
- for (int i = 0; i < historyStates.size(); ++i) {
- QHistoryState *h = historyStates.at(i);
- QHistoryStatePrivate::get(h)->configuration.clear();
- }
-}
-
-/*!
- \internal
-
- Registers all signal transitions whose sender object lives in another thread.
-
- Normally, signal transitions are lazily registered (when a state becomes
- active). But if the sender is in a different thread, the transition must be
- registered early to keep the state machine from "dropping" signals; e.g.,
- a second (transition-bound) signal could be emitted on the sender thread
- before the state machine gets to process the first signal.
-*/
-void QStateMachinePrivate::registerMultiThreadedSignalTransitions()
-{
- Q_Q(QStateMachine);
- QList<QSignalTransition*> transitions = rootState()->findChildren<QSignalTransition*>();
- for (int i = 0; i < transitions.size(); ++i) {
- QSignalTransition *t = transitions.at(i);
- if ((t->machine() == q) && t->senderObject() && (t->senderObject()->thread() != q->thread()))
- registerSignalTransition(t);
- }
-}
-
-void QStateMachinePrivate::_q_start()
-{
- Q_Q(QStateMachine);
- Q_ASSERT(state == Starting);
- // iterate over a copy, since we emit signals which may cause
- // 'configuration' to change, resulting in undefined behavior when
- // iterating at the same time:
- const auto config = configuration;
- for (QAbstractState *state : config) {
- QAbstractStatePrivate *abstractStatePrivate = QAbstractStatePrivate::get(state);
- abstractStatePrivate->active = false;
- emit state->activeChanged(false);
- }
- configuration.clear();
- qDeleteAll(internalEventQueue);
- internalEventQueue.clear();
- qDeleteAll(externalEventQueue);
- externalEventQueue.clear();
- clearHistory();
-
- registerMultiThreadedSignalTransitions();
-
- startupHook();
-
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": starting";
-#endif
- state = Running;
- processingScheduled = true; // we call _q_process() below
-
- QList<QAbstractTransition*> transitions;
- CalculationCache calculationCache;
- QAbstractTransition *initialTransition = createInitialTransition();
- transitions.append(initialTransition);
-
- QEvent nullEvent(QEvent::None);
- executeTransitionContent(&nullEvent, transitions);
- QList<QAbstractState*> exitedStates = QList<QAbstractState*>();
- QSet<QAbstractState*> statesForDefaultEntry;
- QList<QAbstractState*> enteredStates = computeEntrySet(transitions, statesForDefaultEntry, &calculationCache);
- QHash<RestorableId, QVariant> pendingRestorables;
- QHash<QAbstractState *, QList<QPropertyAssignment>> assignmentsForEnteredStates =
- computePropertyAssignments(enteredStates, pendingRestorables);
-#if QT_CONFIG(animation)
- QList<QAbstractAnimation *> selectedAnimations = selectAnimations(transitions);
-#endif
- // enterStates() will set stopProcessingReason to Finished if a final
- // state is entered.
- stopProcessingReason = EventQueueEmpty;
- enterStates(&nullEvent, exitedStates, enteredStates, statesForDefaultEntry,
- assignmentsForEnteredStates
-#if QT_CONFIG(animation)
- , selectedAnimations
-#endif
- );
- delete initialTransition;
-
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": initial configuration:" << configuration;
-#endif
-
- emit q->started(QStateMachine::QPrivateSignal());
- emit q->runningChanged(true);
-
- if (stopProcessingReason == Finished) {
- // The state machine immediately reached a final state.
- processingScheduled = false;
- state = NotRunning;
- unregisterAllTransitions();
- emitFinished();
- emit q->runningChanged(false);
- exitInterpreter();
- } else {
- _q_process();
- }
-}
-
-void QStateMachinePrivate::_q_process()
-{
- Q_Q(QStateMachine);
- Q_ASSERT(state == Running);
- Q_ASSERT(!processing);
- processing = true;
- processingScheduled = false;
- beginMacrostep();
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": starting the event processing loop";
-#endif
- bool didChange = false;
- while (processing) {
- if (stop) {
- processing = false;
- break;
- }
- QList<QAbstractTransition*> enabledTransitions;
- CalculationCache calculationCache;
-
- QEvent *e = new QEvent(QEvent::None);
- enabledTransitions = selectTransitions(e, &calculationCache);
- if (enabledTransitions.isEmpty()) {
- delete e;
- e = nullptr;
- }
- while (enabledTransitions.isEmpty() && ((e = dequeueInternalEvent()) != nullptr)) {
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": dequeued internal event" << e << "of type" << e->type();
-#endif
- enabledTransitions = selectTransitions(e, &calculationCache);
- if (enabledTransitions.isEmpty()) {
- delete e;
- e = nullptr;
- }
- }
- while (enabledTransitions.isEmpty() && ((e = dequeueExternalEvent()) != nullptr)) {
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": dequeued external event" << e << "of type" << e->type();
-#endif
- enabledTransitions = selectTransitions(e, &calculationCache);
- if (enabledTransitions.isEmpty()) {
- delete e;
- e = nullptr;
- }
- }
- if (enabledTransitions.isEmpty()) {
- if (isInternalEventQueueEmpty()) {
- processing = false;
- stopProcessingReason = EventQueueEmpty;
- noMicrostep();
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": no transitions enabled";
-#endif
- }
- } else {
- didChange = true;
- q->beginMicrostep(e);
- microstep(e, enabledTransitions, &calculationCache);
- q->endMicrostep(e);
- }
- delete e;
- }
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": finished the event processing loop";
-#endif
- if (stop) {
- stop = false;
- stopProcessingReason = Stopped;
- }
-
- switch (stopProcessingReason) {
- case EventQueueEmpty:
- processedPendingEvents(didChange);
- break;
- case Finished:
- state = NotRunning;
- cancelAllDelayedEvents();
- unregisterAllTransitions();
- emitFinished();
- emit q->runningChanged(false);
- break;
- case Stopped:
- state = NotRunning;
- cancelAllDelayedEvents();
- unregisterAllTransitions();
- emit q->stopped(QStateMachine::QPrivateSignal());
- emit q->runningChanged(false);
- break;
- }
- endMacrostep(didChange);
- if (stopProcessingReason == Finished)
- exitInterpreter();
-}
-
-void QStateMachinePrivate::_q_startDelayedEventTimer(int id, int delay)
-{
- Q_Q(QStateMachine);
- QMutexLocker locker(&delayedEventsMutex);
- QHash<int, DelayedEvent>::iterator it = delayedEvents.find(id);
- if (it != delayedEvents.end()) {
- DelayedEvent &e = it.value();
- Q_ASSERT(!e.timerId);
- e.timerId = q->startTimer(delay);
- if (!e.timerId) {
- qWarning("QStateMachine::postDelayedEvent: failed to start timer (id=%d, delay=%d)", id, delay);
- delete e.event;
- delayedEvents.erase(it);
- delayedEventIdFreeList.release(id);
- } else {
- timerIdToDelayedEventId.insert(e.timerId, id);
- }
- } else {
- // It's been cancelled already
- delayedEventIdFreeList.release(id);
- }
-}
-
-void QStateMachinePrivate::_q_killDelayedEventTimer(int id, int timerId)
-{
- Q_Q(QStateMachine);
- q->killTimer(timerId);
- QMutexLocker locker(&delayedEventsMutex);
- delayedEventIdFreeList.release(id);
-}
-
-void QStateMachinePrivate::postInternalEvent(QEvent *e)
-{
- QMutexLocker locker(&internalEventMutex);
- internalEventQueue.append(e);
-}
-
-void QStateMachinePrivate::postExternalEvent(QEvent *e)
-{
- QMutexLocker locker(&externalEventMutex);
- externalEventQueue.append(e);
-}
-
-QEvent *QStateMachinePrivate::dequeueInternalEvent()
-{
- QMutexLocker locker(&internalEventMutex);
- if (internalEventQueue.isEmpty())
- return nullptr;
- return internalEventQueue.takeFirst();
-}
-
-QEvent *QStateMachinePrivate::dequeueExternalEvent()
-{
- QMutexLocker locker(&externalEventMutex);
- if (externalEventQueue.isEmpty())
- return nullptr;
- return externalEventQueue.takeFirst();
-}
-
-bool QStateMachinePrivate::isInternalEventQueueEmpty()
-{
- QMutexLocker locker(&internalEventMutex);
- return internalEventQueue.isEmpty();
-}
-
-bool QStateMachinePrivate::isExternalEventQueueEmpty()
-{
- QMutexLocker locker(&externalEventMutex);
- return externalEventQueue.isEmpty();
-}
-
-void QStateMachinePrivate::processEvents(EventProcessingMode processingMode)
-{
- Q_Q(QStateMachine);
- if ((state != Running) || processing || processingScheduled)
- return;
- switch (processingMode) {
- case DirectProcessing:
- if (QThread::currentThread() == q->thread()) {
- _q_process();
- break;
- }
- // processing must be done in the machine thread, so:
- Q_FALLTHROUGH();
- case QueuedProcessing:
- processingScheduled = true;
- QMetaObject::invokeMethod(q, "_q_process", Qt::QueuedConnection);
- break;
- }
-}
-
-void QStateMachinePrivate::cancelAllDelayedEvents()
-{
- Q_Q(QStateMachine);
- QMutexLocker locker(&delayedEventsMutex);
- QHash<int, DelayedEvent>::const_iterator it;
- for (it = delayedEvents.constBegin(); it != delayedEvents.constEnd(); ++it) {
- const DelayedEvent &e = it.value();
- if (e.timerId) {
- timerIdToDelayedEventId.remove(e.timerId);
- q->killTimer(e.timerId);
- delayedEventIdFreeList.release(it.key());
- } else {
- // Cancellation will be detected in pending _q_startDelayedEventTimer() call
- }
- delete e.event;
- }
- delayedEvents.clear();
-}
-
-/*
- This function is called when the state machine is performing no
- microstep because no transition is enabled (i.e. an event is ignored).
-
- The default implementation does nothing.
-*/
-void QStateMachinePrivate::noMicrostep()
-{ }
-
-/*
- This function is called when the state machine has reached a stable
- state (no pending events), and has not finished yet.
- For each event the state machine receives it is guaranteed that
- 1) beginMacrostep is called
- 2) selectTransition is called at least once
- 3) begin/endMicrostep is called at least once or noMicrostep is called
- at least once (possibly both, but at least one)
- 4) the state machine either enters an infinite loop, or stops (runningChanged(false),
- and either finished or stopped are emitted), or processedPendingEvents() is called.
- 5) if the machine is not in an infinite loop endMacrostep is called
- 6) when the machine is finished and all processing (like signal emission) is done,
- exitInterpreter() is called. (This is the same name as the SCXML specification uses.)
-
- didChange is set to true if at least one microstep was performed, it is possible
- that the machine returned to exactly the same state as before, but some transitions
- were triggered.
-
- The default implementation does nothing.
-*/
-void QStateMachinePrivate::processedPendingEvents(bool didChange)
-{
- Q_UNUSED(didChange);
-}
-
-void QStateMachinePrivate::beginMacrostep()
-{ }
-
-void QStateMachinePrivate::endMacrostep(bool didChange)
-{
- Q_UNUSED(didChange);
-}
-
-void QStateMachinePrivate::exitInterpreter()
-{
-}
-
-void QStateMachinePrivate::emitStateFinished(QState *forState, QFinalState *guiltyState)
-{
- Q_UNUSED(guiltyState);
- Q_ASSERT(guiltyState);
-
-#ifdef QSTATEMACHINE_DEBUG
- Q_Q(QStateMachine);
- qDebug() << q << ": emitting finished signal for" << forState;
-#endif
-
- QStatePrivate::get(forState)->emitFinished();
-}
-
-void QStateMachinePrivate::startupHook()
-{
-}
-
-namespace _QStateMachine_Internal{
-
-class GoToStateTransition : public QAbstractTransition
-{
- Q_OBJECT
-public:
- GoToStateTransition(QAbstractState *target)
- : QAbstractTransition()
- { setTargetState(target); }
-protected:
- void onTransition(QEvent *) override { deleteLater(); }
- bool eventTest(QEvent *) override { return true; }
-};
-
-} // namespace
-// mingw compiler tries to export QObject::findChild<GoToStateTransition>(),
-// which doesn't work if its in an anonymous namespace.
-using namespace _QStateMachine_Internal;
-/*!
- \internal
-
- Causes this state machine to unconditionally transition to the given
- \a targetState.
-
- Provides a backdoor for using the state machine "imperatively"; i.e. rather
- than defining explicit transitions, you drive the machine's execution by
- calling this function. It breaks the whole integrity of the
- transition-driven model, but is provided for pragmatic reasons.
-*/
-void QStateMachinePrivate::goToState(QAbstractState *targetState)
-{
- if (!targetState) {
- qWarning("QStateMachine::goToState(): cannot go to null state");
- return;
- }
-
- if (configuration.contains(targetState))
- return;
-
- Q_ASSERT(state == Running);
- QState *sourceState = nullptr;
- QSet<QAbstractState*>::const_iterator it;
- for (it = configuration.constBegin(); it != configuration.constEnd(); ++it) {
- sourceState = toStandardState(*it);
- if (sourceState != nullptr)
- break;
- }
-
- Q_ASSERT(sourceState != nullptr);
- // Reuse previous GoToStateTransition in case of several calls to
- // goToState() in a row.
- GoToStateTransition *trans = sourceState->findChild<GoToStateTransition*>();
- if (!trans) {
- trans = new GoToStateTransition(targetState);
- sourceState->addTransition(trans);
- } else {
- trans->setTargetState(targetState);
- }
-
- processEvents(QueuedProcessing);
-}
-
-void QStateMachinePrivate::registerTransitions(QAbstractState *state)
-{
- QState *group = toStandardState(state);
- if (!group)
- return;
- QList<QAbstractTransition*> transitions = QStatePrivate::get(group)->transitions();
- for (int i = 0; i < transitions.size(); ++i) {
- QAbstractTransition *t = transitions.at(i);
- registerTransition(t);
- }
-}
-
-void QStateMachinePrivate::maybeRegisterTransition(QAbstractTransition *transition)
-{
- if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)) {
- maybeRegisterSignalTransition(st);
- }
-#if QT_CONFIG(qeventtransition)
- else if (QEventTransition *et = qobject_cast<QEventTransition*>(transition)) {
- maybeRegisterEventTransition(et);
- }
-#endif
-}
-
-void QStateMachinePrivate::registerTransition(QAbstractTransition *transition)
-{
- if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)) {
- registerSignalTransition(st);
- }
-#if QT_CONFIG(qeventtransition)
- else if (QEventTransition *oet = qobject_cast<QEventTransition*>(transition)) {
- registerEventTransition(oet);
- }
-#endif
-}
-
-void QStateMachinePrivate::unregisterTransition(QAbstractTransition *transition)
-{
- if (QSignalTransition *st = qobject_cast<QSignalTransition*>(transition)) {
- unregisterSignalTransition(st);
- }
-#if QT_CONFIG(qeventtransition)
- else if (QEventTransition *oet = qobject_cast<QEventTransition*>(transition)) {
- unregisterEventTransition(oet);
- }
-#endif
-}
-
-void QStateMachinePrivate::maybeRegisterSignalTransition(QSignalTransition *transition)
-{
- Q_Q(QStateMachine);
- if ((state == Running) && (configuration.contains(transition->sourceState())
- || (transition->senderObject() && (transition->senderObject()->thread() != q->thread())))) {
- registerSignalTransition(transition);
- }
-}
-
-void QStateMachinePrivate::registerSignalTransition(QSignalTransition *transition)
-{
- Q_Q(QStateMachine);
- if (QSignalTransitionPrivate::get(transition)->signalIndex != -1)
- return; // already registered
- const QObject *sender = QSignalTransitionPrivate::get(transition)->sender;
- if (!sender)
- return;
- QByteArray signal = QSignalTransitionPrivate::get(transition)->signal;
- if (signal.isEmpty())
- return;
- if (signal.startsWith('0'+QSIGNAL_CODE))
- signal.remove(0, 1);
- const QMetaObject *meta = sender->metaObject();
- int signalIndex = meta->indexOfSignal(signal);
- int originalSignalIndex = signalIndex;
- if (signalIndex == -1) {
- signalIndex = meta->indexOfSignal(QMetaObject::normalizedSignature(signal));
- if (signalIndex == -1) {
- qWarning("QSignalTransition: no such signal: %s::%s",
- meta->className(), signal.constData());
- return;
- }
- originalSignalIndex = signalIndex;
- }
- // The signal index we actually want to connect to is the one
- // that is going to be sent, i.e. the non-cloned original index.
- while (meta->method(signalIndex).attributes() & QMetaMethod::Cloned)
- --signalIndex;
-
- connectionsMutex.lock();
- QList<int> &connectedSignalIndexes = connections[sender];
- if (connectedSignalIndexes.size() <= signalIndex)
- connectedSignalIndexes.resize(signalIndex+1);
- if (connectedSignalIndexes.at(signalIndex) == 0) {
- if (!signalEventGenerator)
- signalEventGenerator = new QSignalEventGenerator(q);
- static const int generatorMethodOffset = QSignalEventGenerator::staticMetaObject.methodOffset();
- bool ok = QMetaObject::connect(sender, signalIndex, signalEventGenerator, generatorMethodOffset);
- if (!ok) {
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": FAILED to add signal transition from" << transition->sourceState()
- << ": ( sender =" << sender << ", signal =" << signal
- << ", targets =" << transition->targetStates() << ')';
-#endif
- return;
- }
- }
- ++connectedSignalIndexes[signalIndex];
- connectionsMutex.unlock();
-
- QSignalTransitionPrivate::get(transition)->signalIndex = signalIndex;
- QSignalTransitionPrivate::get(transition)->originalSignalIndex = originalSignalIndex;
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": added signal transition from" << transition->sourceState()
- << ": ( sender =" << sender << ", signal =" << signal
- << ", targets =" << transition->targetStates() << ')';
-#endif
-}
-
-void QStateMachinePrivate::unregisterSignalTransition(QSignalTransition *transition)
-{
- int signalIndex = QSignalTransitionPrivate::get(transition)->signalIndex;
- if (signalIndex == -1)
- return; // not registered
- const QObject *sender = QSignalTransitionPrivate::get(transition)->sender;
- QSignalTransitionPrivate::get(transition)->signalIndex = -1;
-
- connectionsMutex.lock();
- QList<int> &connectedSignalIndexes = connections[sender];
- Q_ASSERT(connectedSignalIndexes.size() > signalIndex);
- Q_ASSERT(connectedSignalIndexes.at(signalIndex) != 0);
- if (--connectedSignalIndexes[signalIndex] == 0) {
- Q_ASSERT(signalEventGenerator != nullptr);
- static const int generatorMethodOffset = QSignalEventGenerator::staticMetaObject.methodOffset();
- QMetaObject::disconnect(sender, signalIndex, signalEventGenerator, generatorMethodOffset);
- int sum = 0;
- for (int i = 0; i < connectedSignalIndexes.size(); ++i)
- sum += connectedSignalIndexes.at(i);
- if (sum == 0)
- connections.remove(sender);
- }
- connectionsMutex.unlock();
-}
-
-void QStateMachinePrivate::unregisterAllTransitions()
-{
- Q_Q(QStateMachine);
- {
- QList<QSignalTransition*> transitions = rootState()->findChildren<QSignalTransition*>();
- for (int i = 0; i < transitions.size(); ++i) {
- QSignalTransition *t = transitions.at(i);
- if (t->machine() == q)
- unregisterSignalTransition(t);
- }
- }
-#if QT_CONFIG(qeventtransition)
- {
- QList<QEventTransition*> transitions = rootState()->findChildren<QEventTransition*>();
- for (int i = 0; i < transitions.size(); ++i) {
- QEventTransition *t = transitions.at(i);
- if (t->machine() == q)
- unregisterEventTransition(t);
- }
- }
-#endif
-}
-
-#if QT_CONFIG(qeventtransition)
-void QStateMachinePrivate::maybeRegisterEventTransition(QEventTransition *transition)
-{
- if ((state == Running) && configuration.contains(transition->sourceState()))
- registerEventTransition(transition);
-}
-
-void QStateMachinePrivate::registerEventTransition(QEventTransition *transition)
-{
- Q_Q(QStateMachine);
- if (QEventTransitionPrivate::get(transition)->registered)
- return;
- if (transition->eventType() >= QEvent::User) {
- qWarning("QObject event transitions are not supported for custom types");
- return;
- }
- QObject *object = QEventTransitionPrivate::get(transition)->object;
- if (!object)
- return;
- QObjectPrivate *od = QObjectPrivate::get(object);
- if (!od->extraData || !od->extraData->eventFilters.contains(q))
- object->installEventFilter(q);
- ++qobjectEvents[object][transition->eventType()];
- QEventTransitionPrivate::get(transition)->registered = true;
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q << ": added event transition from" << transition->sourceState()
- << ": ( object =" << object << ", event =" << transition->eventType()
- << ", targets =" << transition->targetStates() << ')';
-#endif
-}
-
-void QStateMachinePrivate::unregisterEventTransition(QEventTransition *transition)
-{
- Q_Q(QStateMachine);
- if (!QEventTransitionPrivate::get(transition)->registered)
- return;
- QObject *object = QEventTransitionPrivate::get(transition)->object;
- QHash<QEvent::Type, int> &events = qobjectEvents[object];
- Q_ASSERT(events.value(transition->eventType()) > 0);
- if (--events[transition->eventType()] == 0) {
- events.remove(transition->eventType());
- int sum = 0;
- QHash<QEvent::Type, int>::const_iterator it;
- for (it = events.constBegin(); it != events.constEnd(); ++it)
- sum += it.value();
- if (sum == 0) {
- qobjectEvents.remove(object);
- object->removeEventFilter(q);
- }
- }
- QEventTransitionPrivate::get(transition)->registered = false;
-}
-
-void QStateMachinePrivate::handleFilteredEvent(QObject *watched, QEvent *event)
-{
- if (qobjectEvents.value(watched).contains(event->type())) {
- postInternalEvent(new QStateMachine::WrappedEvent(watched, handler->cloneEvent(event)));
- processEvents(DirectProcessing);
- }
-}
-#endif
-
-void QStateMachinePrivate::handleTransitionSignal(QObject *sender, int signalIndex,
- void **argv)
-{
-#ifndef QT_NO_DEBUG
- connectionsMutex.lock();
- Q_ASSERT(connections[sender].at(signalIndex) != 0);
- connectionsMutex.unlock();
-#endif
- const QMetaObject *meta = sender->metaObject();
- QMetaMethod method = meta->method(signalIndex);
- int argc = method.parameterCount();
- QList<QVariant> vargs;
- vargs.reserve(argc);
- for (int i = 0; i < argc; ++i) {
- auto type = method.parameterMetaType(i);
- vargs.append(QVariant(type, argv[i+1]));
- }
-
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << q_func() << ": sending signal event ( sender =" << sender
- << ", signal =" << method.methodSignature().constData() << ')';
-#endif
- postInternalEvent(new QStateMachine::SignalEvent(sender, signalIndex, vargs));
- processEvents(DirectProcessing);
-}
-
-/*!
- Constructs a new state machine with the given \a parent.
-*/
-QStateMachine::QStateMachine(QObject *parent)
- : QState(*new QStateMachinePrivate, /*parentState=*/nullptr)
-{
- // Can't pass the parent to the QState constructor, as it expects a QState
- // But this works as expected regardless of whether parent is a QState or not
- setParent(parent);
-}
-
-/*!
- \since 5.0
- \deprecated
-
- Constructs a new state machine with the given \a childMode
- and \a parent.
-
- \warning Do not set the \a childMode to anything else than \l{ExclusiveStates}, otherwise the
- state machine is invalid, and might work incorrectly.
-*/
-QStateMachine::QStateMachine(QState::ChildMode childMode, QObject *parent)
- : QState(*new QStateMachinePrivate, /*parentState=*/nullptr)
-{
- Q_D(QStateMachine);
- d->childMode = childMode;
- setParent(parent); // See comment in constructor above
-
- if (childMode != ExclusiveStates) {
- //### FIXME for Qt6: remove this constructor completely, and hide the childMode property.
- // Yes, the StateMachine itself is conceptually a state, but it should only expose a limited
- // number of properties. The execution algorithm (in the URL below) treats a state machine
- // as a state, but from an API point of view, it's questionable if the QStateMachine should
- // inherit from QState.
- //
- // See function findLCCA in https://www.w3.org/TR/2014/WD-scxml-20140529/#AlgorithmforSCXMLInterpretation
- // to see where setting childMode to parallel will break down.
- qWarning() << "Invalid childMode for QStateMachine" << this;
- }
-}
-
-/*!
- \internal
-*/
-QStateMachine::QStateMachine(QStateMachinePrivate &dd, QObject *parent)
- : QState(dd, /*parentState=*/nullptr)
-{
- setParent(parent);
-}
-
-/*!
- Destroys this state machine.
-*/
-QStateMachine::~QStateMachine()
-{
-}
-
-/*!
- \enum QStateMachine::EventPriority
-
- This enum type specifies the priority of an event posted to the state
- machine using postEvent().
-
- Events of high priority are processed before events of normal priority.
-
- \value NormalPriority The event has normal priority.
- \value HighPriority The event has high priority.
-*/
-
-/*! \enum QStateMachine::Error
-
- This enum type defines errors that can occur in the state machine at run time. When the state
- machine encounters an unrecoverable error at run time, it will set the error code returned
- by error(), the error message returned by errorString(), and enter an error state based on
- the context of the error.
-
- \value NoError No error has occurred.
- \value NoInitialStateError The machine has entered a QState with children which does not have an
- initial state set. The context of this error is the state which is missing an initial
- state.
- \value NoDefaultStateInHistoryStateError The machine has entered a QHistoryState which does not have
- a default state set. The context of this error is the QHistoryState which is missing a
- default state.
- \value NoCommonAncestorForTransitionError The machine has selected a transition whose source
- and targets are not part of the same tree of states, and thus are not part of the same
- state machine. Commonly, this could mean that one of the states has not been given
- any parent or added to any machine. The context of this error is the source state of
- the transition.
- \value StateMachineChildModeSetToParallelError The machine's \l childMode
- property was set to \l{QState::ParallelStates}. This is illegal.
- Only states may be declared as parallel, not the state machine
- itself. This enum value was added in Qt 5.14.
-
- \sa setErrorState()
-*/
-
-/*!
- Returns the error code of the last error that occurred in the state machine.
-*/
-QStateMachine::Error QStateMachine::error() const
-{
- Q_D(const QStateMachine);
- return d->error;
-}
-
-/*!
- Returns the error string of the last error that occurred in the state machine.
-*/
-QString QStateMachine::errorString() const
-{
- Q_D(const QStateMachine);
- return d->errorString;
-}
-
-/*!
- Clears the error string and error code of the state machine.
-*/
-void QStateMachine::clearError()
-{
- Q_D(QStateMachine);
- d->errorString.clear();
- d->error = NoError;
-}
-
-/*!
- Returns the restore policy of the state machine.
-
- \sa setGlobalRestorePolicy()
-*/
-QState::RestorePolicy QStateMachine::globalRestorePolicy() const
-{
- Q_D(const QStateMachine);
- return d->globalRestorePolicy;
-}
-
-/*!
- Sets the restore policy of the state machine to \a restorePolicy. The default
- restore policy is QState::DontRestoreProperties.
-
- \sa globalRestorePolicy()
-*/
-void QStateMachine::setGlobalRestorePolicy(QState::RestorePolicy restorePolicy)
-{
- Q_D(QStateMachine);
- d->globalRestorePolicy = restorePolicy;
-}
-
-/*!
- Adds the given \a state to this state machine. The state becomes a top-level
- state and the state machine takes ownership of the state.
-
- If the state is already in a different machine, it will first be removed
- from its old machine, and then added to this machine.
-
- \sa removeState(), setInitialState()
-*/
-void QStateMachine::addState(QAbstractState *state)
-{
- if (!state) {
- qWarning("QStateMachine::addState: cannot add null state");
- return;
- }
- if (QAbstractStatePrivate::get(state)->machine() == this) {
- qWarning("QStateMachine::addState: state has already been added to this machine");
- return;
- }
- state->setParent(this);
-}
-
-/*!
- Removes the given \a state from this state machine. The state machine
- releases ownership of the state.
-
- \sa addState()
-*/
-void QStateMachine::removeState(QAbstractState *state)
-{
- if (!state) {
- qWarning("QStateMachine::removeState: cannot remove null state");
- return;
- }
- if (QAbstractStatePrivate::get(state)->machine() != this) {
- qWarning("QStateMachine::removeState: state %p's machine (%p)"
- " is different from this machine (%p)",
- state, QAbstractStatePrivate::get(state)->machine(), this);
- return;
- }
- state->setParent(nullptr);
-}
-
-bool QStateMachine::isRunning() const
-{
- Q_D(const QStateMachine);
- return (d->state == QStateMachinePrivate::Running);
-}
-
-/*!
- Starts this state machine. The machine will reset its configuration and
- transition to the initial state. When a final top-level state (QFinalState)
- is entered, the machine will emit the finished() signal.
-
- \note A state machine will not run without a running event loop, such as
- the main application event loop started with QCoreApplication::exec() or
- QApplication::exec().
-
- \sa started(), finished(), stop(), initialState(), setRunning()
-*/
-void QStateMachine::start()
-{
- Q_D(QStateMachine);
-
- if ((childMode() == QState::ExclusiveStates) && (initialState() == nullptr)) {
- qWarning("QStateMachine::start: No initial state set for machine. Refusing to start.");
- return;
- }
-
- switch (d->state) {
- case QStateMachinePrivate::NotRunning:
- d->state = QStateMachinePrivate::Starting;
- QMetaObject::invokeMethod(this, "_q_start", Qt::QueuedConnection);
- break;
- case QStateMachinePrivate::Starting:
- break;
- case QStateMachinePrivate::Running:
- qWarning("QStateMachine::start(): already running");
- break;
- }
-}
-
-/*!
- Stops this state machine. The state machine will stop processing events and
- then emit the stopped() signal.
-
- \sa stopped(), start(), setRunning()
-*/
-void QStateMachine::stop()
-{
- Q_D(QStateMachine);
- switch (d->state) {
- case QStateMachinePrivate::NotRunning:
- break;
- case QStateMachinePrivate::Starting:
- // the machine will exit as soon as it enters the event processing loop
- d->stop = true;
- break;
- case QStateMachinePrivate::Running:
- d->stop = true;
- d->processEvents(QStateMachinePrivate::QueuedProcessing);
- break;
- }
-}
-
-void QStateMachine::setRunning(bool running)
-{
- if (running)
- start();
- else
- stop();
-}
-
-/*!
- \threadsafe
-
- Posts the given \a event of the given \a priority for processing by this
- state machine.
-
- This function returns immediately. The event is added to the state machine's
- event queue. Events are processed in the order posted. The state machine
- takes ownership of the event and deletes it once it has been processed.
-
- You can only post events when the state machine is running or when it is starting up.
-
- \sa postDelayedEvent()
-*/
-void QStateMachine::postEvent(QEvent *event, EventPriority priority)
-{
- Q_D(QStateMachine);
- switch (d->state) {
- case QStateMachinePrivate::Running:
- case QStateMachinePrivate::Starting:
- break;
- default:
- qWarning("QStateMachine::postEvent: cannot post event when the state machine is not running");
- return;
- }
- if (!event) {
- qWarning("QStateMachine::postEvent: cannot post null event");
- return;
- }
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << this << ": posting event" << event;
-#endif
- switch (priority) {
- case NormalPriority:
- d->postExternalEvent(event);
- break;
- case HighPriority:
- d->postInternalEvent(event);
- break;
- }
- d->processEvents(QStateMachinePrivate::QueuedProcessing);
-}
-
-/*!
- \threadsafe
-
- Posts the given \a event for processing by this state machine, with the
- given \a delay in milliseconds. Returns an identifier associated with the
- delayed event, or -1 if the event could not be posted.
-
- This function returns immediately. When the delay has expired, the event
- will be added to the state machine's event queue for processing. The state
- machine takes ownership of the event and deletes it once it has been
- processed.
-
- You can only post events when the state machine is running.
-
- \sa cancelDelayedEvent(), postEvent()
-*/
-int QStateMachine::postDelayedEvent(QEvent *event, int delay)
-{
- Q_D(QStateMachine);
- if (d->state != QStateMachinePrivate::Running) {
- qWarning("QStateMachine::postDelayedEvent: cannot post event when the state machine is not running");
- return -1;
- }
- if (!event) {
- qWarning("QStateMachine::postDelayedEvent: cannot post null event");
- return -1;
- }
- if (delay < 0) {
- qWarning("QStateMachine::postDelayedEvent: delay cannot be negative");
- return -1;
- }
-#ifdef QSTATEMACHINE_DEBUG
- qDebug() << this << ": posting event" << event << "with delay" << delay;
-#endif
- QMutexLocker locker(&d->delayedEventsMutex);
- int id = d->delayedEventIdFreeList.next();
- bool inMachineThread = (QThread::currentThread() == thread());
- int timerId = inMachineThread ? startTimer(delay) : 0;
- if (inMachineThread && !timerId) {
- qWarning("QStateMachine::postDelayedEvent: failed to start timer with interval %d", delay);
- d->delayedEventIdFreeList.release(id);
- return -1;
- }
- QStateMachinePrivate::DelayedEvent delayedEvent(event, timerId);
- d->delayedEvents.insert(id, delayedEvent);
- if (timerId) {
- d->timerIdToDelayedEventId.insert(timerId, id);
- } else {
- Q_ASSERT(!inMachineThread);
- QMetaObject::invokeMethod(this, "_q_startDelayedEventTimer",
- Qt::QueuedConnection,
- Q_ARG(int, id),
- Q_ARG(int, delay));
- }
- return id;
-}
-
-/*!
- \threadsafe
-
- Cancels the delayed event identified by the given \a id. The id should be a
- value returned by a call to postDelayedEvent(). Returns \c true if the event
- was successfully cancelled, otherwise returns \c false.
-
- \sa postDelayedEvent()
-*/
-bool QStateMachine::cancelDelayedEvent(int id)
-{
- Q_D(QStateMachine);
- if (d->state != QStateMachinePrivate::Running) {
- qWarning("QStateMachine::cancelDelayedEvent: the machine is not running");
- return false;
- }
- QMutexLocker locker(&d->delayedEventsMutex);
- QStateMachinePrivate::DelayedEvent e = d->delayedEvents.take(id);
- if (!e.event)
- return false;
- if (e.timerId) {
- d->timerIdToDelayedEventId.remove(e.timerId);
- bool inMachineThread = (QThread::currentThread() == thread());
- if (inMachineThread) {
- killTimer(e.timerId);
- d->delayedEventIdFreeList.release(id);
- } else {
- QMetaObject::invokeMethod(this, "_q_killDelayedEventTimer",
- Qt::QueuedConnection,
- Q_ARG(int, id),
- Q_ARG(int, e.timerId));
- }
- } else {
- // Cancellation will be detected in pending _q_startDelayedEventTimer() call
- }
- delete e.event;
- return true;
-}
-
-/*!
- Returns the maximal consistent set of states (including parallel and final
- states) that this state machine is currently in. If a state \c s is in the
- configuration, it is always the case that the parent of \c s is also in
- c. Note, however, that the machine itself is not an explicit member of the
- configuration.
-*/
-QSet<QAbstractState*> QStateMachine::configuration() const
-{
- Q_D(const QStateMachine);
- return d->configuration;
-}
-
-/*!
- \fn QStateMachine::started()
-
- This signal is emitted when the state machine has entered its initial state
- (QStateMachine::initialState).
-
- \sa QStateMachine::finished(), QStateMachine::start()
-*/
-
-/*!
- \fn QStateMachine::stopped()
-
- This signal is emitted when the state machine has stopped.
-
- \sa QStateMachine::stop(), QStateMachine::finished()
-*/
-
-/*!
- \reimp
-*/
-bool QStateMachine::event(QEvent *e)
-{
- Q_D(QStateMachine);
- if (e->type() == QEvent::Timer) {
- QTimerEvent *te = static_cast<QTimerEvent*>(e);
- int tid = te->timerId();
- if (d->state != QStateMachinePrivate::Running) {
- // This event has been cancelled already
- QMutexLocker locker(&d->delayedEventsMutex);
- Q_ASSERT(!d->timerIdToDelayedEventId.contains(tid));
- return true;
- }
- d->delayedEventsMutex.lock();
- int id = d->timerIdToDelayedEventId.take(tid);
- QStateMachinePrivate::DelayedEvent ee = d->delayedEvents.take(id);
- if (ee.event != nullptr) {
- Q_ASSERT(ee.timerId == tid);
- killTimer(tid);
- d->delayedEventIdFreeList.release(id);
- d->delayedEventsMutex.unlock();
- d->postExternalEvent(ee.event);
- d->processEvents(QStateMachinePrivate::DirectProcessing);
- return true;
- } else {
- d->delayedEventsMutex.unlock();
- }
- }
- return QState::event(e);
-}
-
-#if QT_CONFIG(qeventtransition)
-/*!
- \reimp
-*/
-bool QStateMachine::eventFilter(QObject *watched, QEvent *event)
-{
- Q_D(QStateMachine);
- d->handleFilteredEvent(watched, event);
- return false;
-}
-#endif
-
-/*!
- \internal
-
- This function is called when the state machine is about to select
- transitions based on the given \a event.
-
- The default implementation does nothing.
-*/
-void QStateMachine::beginSelectTransitions(QEvent *event)
-{
- Q_UNUSED(event);
-}
-
-/*!
- \internal
-
- This function is called when the state machine has finished selecting
- transitions based on the given \a event.
-
- The default implementation does nothing.
-*/
-void QStateMachine::endSelectTransitions(QEvent *event)
-{
- Q_UNUSED(event);
-}
-
-/*!
- \internal
-
- This function is called when the state machine is about to do a microstep.
-
- The default implementation does nothing.
-*/
-void QStateMachine::beginMicrostep(QEvent *event)
-{
- Q_UNUSED(event);
-}
-
-/*!
- \internal
-
- This function is called when the state machine has finished doing a
- microstep.
-
- The default implementation does nothing.
-*/
-void QStateMachine::endMicrostep(QEvent *event)
-{
- Q_UNUSED(event);
-}
-
-/*!
- \reimp
- This function will call start() to start the state machine.
-*/
-void QStateMachine::onEntry(QEvent *event)
-{
- start();
- QState::onEntry(event);
-}
-
-/*!
- \reimp
- This function will call stop() to stop the state machine and
- subsequently emit the stopped() signal.
-*/
-void QStateMachine::onExit(QEvent *event)
-{
- stop();
- QState::onExit(event);
-}
-
-#if QT_CONFIG(animation)
-
-/*!
- Returns whether animations are enabled for this state machine.
-*/
-bool QStateMachine::isAnimated() const
-{
- Q_D(const QStateMachine);
- return d->animated;
-}
-
-/*!
- Sets whether animations are \a enabled for this state machine.
-*/
-void QStateMachine::setAnimated(bool enabled)
-{
- Q_D(QStateMachine);
- d->animated = enabled;
-}
-
-/*!
- Adds a default \a animation to be considered for any transition.
-*/
-void QStateMachine::addDefaultAnimation(QAbstractAnimation *animation)
-{
- Q_D(QStateMachine);
- d->defaultAnimations.append(animation);
-}
-
-/*!
- Returns the list of default animations that will be considered for any transition.
-*/
-QList<QAbstractAnimation*> QStateMachine::defaultAnimations() const
-{
- Q_D(const QStateMachine);
- return d->defaultAnimations;
-}
-
-/*!
- Removes \a animation from the list of default animations.
-*/
-void QStateMachine::removeDefaultAnimation(QAbstractAnimation *animation)
-{
- Q_D(QStateMachine);
- d->defaultAnimations.removeAll(animation);
-}
-
-#endif // animation
-
-void QSignalEventGenerator::execute(QMethodRawArguments a)
-{
- auto machinePrivate = QStateMachinePrivate::get(qobject_cast<QStateMachine*>(parent()));
- if (machinePrivate->state != QStateMachinePrivate::Running)
- return;
- int signalIndex = senderSignalIndex();
- Q_ASSERT(signalIndex != -1);
- machinePrivate->handleTransitionSignal(sender(), signalIndex, a.arguments);
-}
-
-QSignalEventGenerator::QSignalEventGenerator(QStateMachine *parent)
- : QObject(parent)
-{
-}
-
-/*!
- \class QStateMachine::SignalEvent
- \inmodule QtCore
-
- \brief The SignalEvent class represents a Qt signal event.
-
- \since 4.6
- \ingroup statemachine
-
- A signal event is generated by a QStateMachine in response to a Qt
- signal. The QSignalTransition class provides a transition associated with a
- signal event. QStateMachine::SignalEvent is part of \l{The State Machine Framework}.
-
- The sender() function returns the object that generated the signal. The
- signalIndex() function returns the index of the signal. The arguments()
- function returns the arguments of the signal.
-
- \sa QSignalTransition
-*/
-
-/*!
- \internal
-
- Constructs a new SignalEvent object with the given \a sender, \a
- signalIndex and \a arguments.
-*/
-QStateMachine::SignalEvent::SignalEvent(QObject *sender, int signalIndex,
- const QList<QVariant> &arguments)
- : QEvent(QEvent::StateMachineSignal), m_sender(sender),
- m_signalIndex(signalIndex), m_arguments(arguments)
-{
-}
-
-/*!
- Destroys this SignalEvent.
-*/
-QStateMachine::SignalEvent::~SignalEvent()
-{
-}
-
-/*!
- \fn QStateMachine::SignalEvent::sender() const
-
- Returns the object that emitted the signal.
-
- \sa QObject::sender()
-*/
-
-/*!
- \fn QStateMachine::SignalEvent::signalIndex() const
-
- Returns the index of the signal.
-
- \sa QMetaObject::indexOfSignal(), QMetaObject::method()
-*/
-
-/*!
- \fn QStateMachine::SignalEvent::arguments() const
-
- Returns the arguments of the signal.
-*/
-
-
-/*!
- \class QStateMachine::WrappedEvent
- \inmodule QtCore
-
- \brief The WrappedEvent class inherits QEvent and holds a clone of an event associated with a QObject.
-
- \since 4.6
- \ingroup statemachine
-
- A wrapped event is generated by a QStateMachine in response to a Qt
- event. The QEventTransition class provides a transition associated with a
- such an event. QStateMachine::WrappedEvent is part of \l{The State Machine
- Framework}.
-
- The object() function returns the object that generated the event. The
- event() function returns a clone of the original event.
-
- \sa QEventTransition
-*/
-
-/*!
- \internal
-
- Constructs a new WrappedEvent object with the given \a object
- and \a event.
-
- The WrappedEvent object takes ownership of \a event.
-*/
-QStateMachine::WrappedEvent::WrappedEvent(QObject *object, QEvent *event)
- : QEvent(QEvent::StateMachineWrapped), m_object(object), m_event(event)
-{
-}
-
-/*!
- Destroys this WrappedEvent.
-*/
-QStateMachine::WrappedEvent::~WrappedEvent()
-{
- delete m_event;
-}
-
-/*!
- \fn QStateMachine::WrappedEvent::object() const
-
- Returns the object that the event is associated with.
-*/
-
-/*!
- \fn QStateMachine::WrappedEvent::event() const
-
- Returns a clone of the original event.
-*/
-
-/*!
- \fn QStateMachine::runningChanged(bool running)
- \since 5.4
-
- This signal is emitted when the running property is changed with \a running as argument.
-
- \sa QStateMachine::running
-*/
-
-/*!
- \fn QStateMachine::postDelayedEvent(QEvent *event, std::chrono::milliseconds delay)
- \since 5.15
- \overload
- \threadsafe
-
- Posts the given \a event for processing by this state machine, with the
- given \a delay in milliseconds. Returns an identifier associated with the
- delayed event, or -1 if the event could not be posted.
-
- This function returns immediately. When the delay has expired, the event
- will be added to the state machine's event queue for processing. The state
- machine takes ownership of the event and deletes it once it has been
- processed.
-
- You can only post events when the state machine is running.
-
- \sa cancelDelayedEvent(), postEvent()
-*/
-
-QT_END_NAMESPACE
-
-#include "qstatemachine.moc"
-#include "moc_qstatemachine.cpp"
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
deleted file mode 100644
index b3c87a959b..0000000000
--- a/src/corelib/statemachine/qstatemachine.h
+++ /dev/null
@@ -1,199 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSTATEMACHINE_H
-#define QSTATEMACHINE_H
-
-#include <QtCore/qstate.h>
-
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qobject.h>
-#include <QtCore/qset.h>
-#include <QtCore/qvariant.h>
-
-#if __has_include(<chrono>)
-# include <chrono>
-#endif
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-class QStateMachinePrivate;
-class QAbstractAnimation;
-class Q_CORE_EXPORT QStateMachine : public QState
-{
- Q_OBJECT
- Q_PROPERTY(QString errorString READ errorString)
- Q_PROPERTY(QState::RestorePolicy globalRestorePolicy READ globalRestorePolicy WRITE setGlobalRestorePolicy)
- Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
-#if QT_CONFIG(animation)
- Q_PROPERTY(bool animated READ isAnimated WRITE setAnimated)
-#endif
-public:
- class Q_CORE_EXPORT SignalEvent : public QEvent
- {
- public:
- SignalEvent(QObject *sender, int signalIndex,
- const QList<QVariant> &arguments);
- ~SignalEvent();
-
- inline QObject *sender() const { return m_sender; }
- inline int signalIndex() const { return m_signalIndex; }
- inline QList<QVariant> arguments() const { return m_arguments; }
-
- private:
- QObject *m_sender;
- int m_signalIndex;
- QList<QVariant> m_arguments;
-
- friend class QSignalTransitionPrivate;
- };
-
- class Q_CORE_EXPORT WrappedEvent : public QEvent
- {
- public:
- WrappedEvent(QObject *object, QEvent *event);
- ~WrappedEvent();
-
- inline QObject *object() const { return m_object; }
- inline QEvent *event() const { return m_event; }
-
- private:
- QObject *m_object;
- QEvent *m_event;
- };
-
- enum EventPriority {
- NormalPriority,
- HighPriority
- };
-
- enum Error {
- NoError,
- NoInitialStateError,
- NoDefaultStateInHistoryStateError,
- NoCommonAncestorForTransitionError,
- StateMachineChildModeSetToParallelError
- };
-
- explicit QStateMachine(QObject *parent = nullptr);
- explicit QStateMachine(QState::ChildMode childMode, QObject *parent = nullptr);
- ~QStateMachine();
-
- void addState(QAbstractState *state);
- void removeState(QAbstractState *state);
-
- Error error() const;
- QString errorString() const;
- void clearError();
-
- bool isRunning() const;
-
-#if QT_CONFIG(animation)
- bool isAnimated() const;
- void setAnimated(bool enabled);
-
- void addDefaultAnimation(QAbstractAnimation *animation);
- QList<QAbstractAnimation *> defaultAnimations() const;
- void removeDefaultAnimation(QAbstractAnimation *animation);
-#endif // animation
-
- QState::RestorePolicy globalRestorePolicy() const;
- void setGlobalRestorePolicy(QState::RestorePolicy restorePolicy);
-
- void postEvent(QEvent *event, EventPriority priority = NormalPriority);
- int postDelayedEvent(QEvent *event, int delay);
- bool cancelDelayedEvent(int id);
-
- QSet<QAbstractState*> configuration() const;
-
-#if QT_CONFIG(qeventtransition)
- bool eventFilter(QObject *watched, QEvent *event) override;
-#endif
-
-#if __has_include(<chrono>) || defined(Q_QDOC)
- int postDelayedEvent(QEvent *event, std::chrono::milliseconds delay)
- {
- return postDelayedEvent(event, int(delay.count()));
- }
-#endif
-
-public Q_SLOTS:
- void start();
- void stop();
- void setRunning(bool running);
-
-Q_SIGNALS:
- void started(QPrivateSignal);
- void stopped(QPrivateSignal);
- void runningChanged(bool running);
-
-
-protected:
- void onEntry(QEvent *event) override;
- void onExit(QEvent *event) override;
-
- virtual void beginSelectTransitions(QEvent *event);
- virtual void endSelectTransitions(QEvent *event);
-
- virtual void beginMicrostep(QEvent *event);
- virtual void endMicrostep(QEvent *event);
-
- bool event(QEvent *e) override;
-
-protected:
- QStateMachine(QStateMachinePrivate &dd, QObject *parent);
-
-private:
- Q_DISABLE_COPY(QStateMachine)
- Q_DECLARE_PRIVATE(QStateMachine)
- Q_PRIVATE_SLOT(d_func(), void _q_start())
- Q_PRIVATE_SLOT(d_func(), void _q_process())
-#if QT_CONFIG(animation)
- Q_PRIVATE_SLOT(d_func(), void _q_animationFinished())
-#endif
- Q_PRIVATE_SLOT(d_func(), void _q_startDelayedEventTimer(int, int))
- Q_PRIVATE_SLOT(d_func(), void _q_killDelayedEventTimer(int, int))
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h
deleted file mode 100644
index d73313570a..0000000000
--- a/src/corelib/statemachine/qstatemachine_p.h
+++ /dev/null
@@ -1,333 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSTATEMACHINE_P_H
-#define QSTATEMACHINE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "private/qstate_p.h"
-
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qhash.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qpair.h>
-#include <QtCore/qpointer.h>
-#include <QtCore/qset.h>
-#include <private/qfreelist_p.h>
-
-QT_REQUIRE_CONFIG(statemachine);
-
-QT_BEGIN_NAMESPACE
-
-class QEvent;
-#if QT_CONFIG(qeventtransition)
-class QEventTransition;
-#endif
-class QSignalEventGenerator;
-class QSignalTransition;
-class QAbstractState;
-class QAbstractTransition;
-class QFinalState;
-class QHistoryState;
-class QState;
-
-#if QT_CONFIG(animation)
-class QAbstractAnimation;
-#endif
-
-struct CalculationCache;
-class QStateMachine;
-class Q_CORE_EXPORT QStateMachinePrivate : public QStatePrivate
-{
- Q_DECLARE_PUBLIC(QStateMachine)
-public:
- enum State {
- NotRunning,
- Starting,
- Running
- };
- enum EventProcessingMode {
- DirectProcessing,
- QueuedProcessing
- };
- enum StopProcessingReason {
- EventQueueEmpty,
- Finished,
- Stopped
- };
-
- QStateMachinePrivate();
- ~QStateMachinePrivate();
-
- static QStateMachinePrivate *get(QStateMachine *q)
- { return q ? q->d_func() : nullptr; }
-
- QState *findLCA(const QList<QAbstractState*> &states, bool onlyCompound = false);
- QState *findLCCA(const QList<QAbstractState*> &states);
-
- static bool transitionStateEntryLessThan(QAbstractTransition *t1, QAbstractTransition *t2);
- static bool stateEntryLessThan(QAbstractState *s1, QAbstractState *s2);
- static bool stateExitLessThan(QAbstractState *s1, QAbstractState *s2);
-
- QAbstractState *findErrorState(QAbstractState *context);
- void setError(QStateMachine::Error error, QAbstractState *currentContext);
-
- // private slots
- void _q_start();
- void _q_process();
-#if QT_CONFIG(animation)
- void _q_animationFinished();
-#endif
- void _q_startDelayedEventTimer(int id, int delay);
- void _q_killDelayedEventTimer(int id, int timerId);
-
- QState *rootState() const;
-
- void clearHistory();
- QAbstractTransition *createInitialTransition() const;
-
- void removeConflictingTransitions(QList<QAbstractTransition*> &enabledTransitions, CalculationCache *cache);
- void microstep(QEvent *event, const QList<QAbstractTransition*> &transitionList, CalculationCache *cache);
- QList<QAbstractTransition *> selectTransitions(QEvent *event, CalculationCache *cache);
- virtual void noMicrostep();
- virtual void processedPendingEvents(bool didChange);
- virtual void beginMacrostep();
- virtual void endMacrostep(bool didChange);
- virtual void exitInterpreter();
- virtual void exitStates(QEvent *event, const QList<QAbstractState *> &statesToExit_sorted,
- const QHash<QAbstractState *, QList<QPropertyAssignment>> &assignmentsForEnteredStates);
- QList<QAbstractState*> computeExitSet(const QList<QAbstractTransition*> &enabledTransitions, CalculationCache *cache);
- QSet<QAbstractState*> computeExitSet_Unordered(const QList<QAbstractTransition*> &enabledTransitions, CalculationCache *cache);
- QSet<QAbstractState*> computeExitSet_Unordered(QAbstractTransition *t, CalculationCache *cache);
- void executeTransitionContent(QEvent *event, const QList<QAbstractTransition*> &transitionList);
- virtual void enterStates(QEvent *event, const QList<QAbstractState*> &exitedStates_sorted,
- const QList<QAbstractState*> &statesToEnter_sorted,
- const QSet<QAbstractState*> &statesForDefaultEntry,
- QHash<QAbstractState *, QList<QPropertyAssignment>> &propertyAssignmentsForState
-#if QT_CONFIG(animation)
- , const QList<QAbstractAnimation*> &selectedAnimations
-#endif
- );
- QList<QAbstractState*> computeEntrySet(const QList<QAbstractTransition*> &enabledTransitions,
- QSet<QAbstractState*> &statesForDefaultEntry, CalculationCache *cache);
- QAbstractState *getTransitionDomain(QAbstractTransition *t,
- const QList<QAbstractState *> &effectiveTargetStates,
- CalculationCache *cache);
- void addDescendantStatesToEnter(QAbstractState *state,
- QSet<QAbstractState*> &statesToEnter,
- QSet<QAbstractState*> &statesForDefaultEntry);
- void addAncestorStatesToEnter(QAbstractState *s, QAbstractState *ancestor,
- QSet<QAbstractState*> &statesToEnter,
- QSet<QAbstractState*> &statesForDefaultEntry);
-
- static QState *toStandardState(QAbstractState *state);
- static const QState *toStandardState(const QAbstractState *state);
- static QFinalState *toFinalState(QAbstractState *state);
- static QHistoryState *toHistoryState(QAbstractState *state);
-
- bool isInFinalState(QAbstractState *s) const;
- static bool isFinal(const QAbstractState *s);
- static bool isParallel(const QAbstractState *s);
- bool isCompound(const QAbstractState *s) const;
- bool isAtomic(const QAbstractState *s) const;
-
- void goToState(QAbstractState *targetState);
-
- void registerTransitions(QAbstractState *state);
- void maybeRegisterTransition(QAbstractTransition *transition);
- void registerTransition(QAbstractTransition *transition);
- void maybeRegisterSignalTransition(QSignalTransition *transition);
- void registerSignalTransition(QSignalTransition *transition);
- void unregisterSignalTransition(QSignalTransition *transition);
- void registerMultiThreadedSignalTransitions();
-#if QT_CONFIG(qeventtransition)
- void maybeRegisterEventTransition(QEventTransition *transition);
- void registerEventTransition(QEventTransition *transition);
- void unregisterEventTransition(QEventTransition *transition);
- void handleFilteredEvent(QObject *watched, QEvent *event);
-#endif
- void unregisterTransition(QAbstractTransition *transition);
- void unregisterAllTransitions();
- void handleTransitionSignal(QObject *sender, int signalIndex,
- void **args);
-
- void postInternalEvent(QEvent *e);
- void postExternalEvent(QEvent *e);
- QEvent *dequeueInternalEvent();
- QEvent *dequeueExternalEvent();
- bool isInternalEventQueueEmpty();
- bool isExternalEventQueueEmpty();
- void processEvents(EventProcessingMode processingMode);
- void cancelAllDelayedEvents();
-
- virtual void emitStateFinished(QState *forState, QFinalState *guiltyState);
- virtual void startupHook();
-
-#ifndef QT_NO_PROPERTIES
- class RestorableId {
- QPointer<QObject> guard;
- QObject *obj;
- QByteArray prop;
- friend size_t qHash(const RestorableId &key, size_t seed)
- noexcept(noexcept(qHash(std::declval<QByteArray>())))
- { return qHash(qMakePair(key.obj, key.prop), seed); }
- friend bool operator==(const RestorableId &lhs, const RestorableId &rhs) noexcept
- { return lhs.obj == rhs.obj && lhs.prop == rhs.prop; }
- friend bool operator!=(const RestorableId &lhs, const RestorableId &rhs) noexcept
- { return !operator==(lhs, rhs); }
- public:
- explicit RestorableId(QObject *o, QByteArray p) noexcept : guard(o), obj(o), prop(std::move(p)) {}
- QObject *object() const noexcept { return guard; }
- QByteArray propertyName() const noexcept { return prop; }
- };
- QHash<QAbstractState*, QHash<RestorableId, QVariant> > registeredRestorablesForState;
- bool hasRestorable(QAbstractState *state, QObject *object, const QByteArray &propertyName) const;
- QVariant savedValueForRestorable(const QList<QAbstractState*> &exitedStates_sorted,
- QObject *object, const QByteArray &propertyName) const;
- void registerRestorable(QAbstractState *state, QObject *object, const QByteArray &propertyName,
- const QVariant &value);
- void unregisterRestorables(const QList<QAbstractState*> &states, QObject *object,
- const QByteArray &propertyName);
- QList<QPropertyAssignment> restorablesToPropertyList(const QHash<RestorableId, QVariant> &restorables) const;
- QHash<RestorableId, QVariant> computePendingRestorables(const QList<QAbstractState*> &statesToExit_sorted) const;
- QHash<QAbstractState *, QList<QPropertyAssignment>> computePropertyAssignments(
- const QList<QAbstractState*> &statesToEnter_sorted,
- QHash<RestorableId, QVariant> &pendingRestorables) const;
-#endif
-
- State state;
- bool processing;
- bool processingScheduled;
- bool stop;
- StopProcessingReason stopProcessingReason;
- QSet<QAbstractState*> configuration;
- QList<QEvent*> internalEventQueue;
- QList<QEvent*> externalEventQueue;
- QMutex internalEventMutex;
- QMutex externalEventMutex;
-
- QStateMachine::Error error;
- QState::RestorePolicy globalRestorePolicy;
-
- QString errorString;
- QSet<QAbstractState *> pendingErrorStates;
- QSet<QAbstractState *> pendingErrorStatesForDefaultEntry;
-
-#if QT_CONFIG(animation)
- bool animated;
-
- struct InitializeAnimationResult {
- QList<QAbstractAnimation*> handledAnimations;
- QList<QAbstractAnimation*> localResetEndValues;
-
- void swap(InitializeAnimationResult &other) noexcept
- {
- qSwap(handledAnimations, other.handledAnimations);
- qSwap(localResetEndValues, other.localResetEndValues);
- }
- };
-
- InitializeAnimationResult
- initializeAnimation(QAbstractAnimation *abstractAnimation,
- const QPropertyAssignment &prop);
-
- QHash<QAbstractState*, QList<QAbstractAnimation*> > animationsForState;
- QHash<QAbstractAnimation*, QPropertyAssignment> propertyForAnimation;
- QHash<QAbstractAnimation*, QAbstractState*> stateForAnimation;
- QSet<QAbstractAnimation*> resetAnimationEndValues;
-
- QList<QAbstractAnimation *> defaultAnimations;
- QMultiHash<QAbstractState *, QAbstractAnimation *> defaultAnimationsForSource;
- QMultiHash<QAbstractState *, QAbstractAnimation *> defaultAnimationsForTarget;
-
- QList<QAbstractAnimation *> selectAnimations(const QList<QAbstractTransition *> &transitionList) const;
- void terminateActiveAnimations(QAbstractState *state,
- const QHash<QAbstractState *, QList<QPropertyAssignment>> &assignmentsForEnteredStates);
- void initializeAnimations(QAbstractState *state, const QList<QAbstractAnimation*> &selectedAnimations,
- const QList<QAbstractState *> &exitedStates_sorted,
- QHash<QAbstractState *, QList<QPropertyAssignment>> &assignmentsForEnteredStates);
-#endif // animation
-
- QSignalEventGenerator *signalEventGenerator;
-
- QHash<const QObject *, QList<int>> connections;
- QMutex connectionsMutex;
-#if QT_CONFIG(qeventtransition)
- QHash<QObject*, QHash<QEvent::Type, int> > qobjectEvents;
-#endif
- QFreeList<void> delayedEventIdFreeList;
- struct DelayedEvent {
- QEvent *event;
- int timerId;
- DelayedEvent(QEvent *e, int tid)
- : event(e), timerId(tid) {}
- DelayedEvent()
- : event(nullptr), timerId(0) {}
- };
- QHash<int, DelayedEvent> delayedEvents;
- QHash<int, int> timerIdToDelayedEventId;
- QMutex delayedEventsMutex;
-
- typedef QEvent* (*f_cloneEvent)(QEvent*);
- struct Handler {
- f_cloneEvent cloneEvent;
- };
-
- static const Handler *handler;
-};
-#if QT_CONFIG(animation)
-Q_DECLARE_SHARED(QStateMachinePrivate::InitializeAnimationResult)
-#endif
-
-Q_CORE_EXPORT const QStateMachinePrivate::Handler *qcoreStateMachineHandler();
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/corelib/statemachine/statemachine.pri b/src/corelib/statemachine/statemachine.pri
deleted file mode 100644
index ee701ebc37..0000000000
--- a/src/corelib/statemachine/statemachine.pri
+++ /dev/null
@@ -1,33 +0,0 @@
-!qtConfig(statemachine): return()
-
-HEADERS += $$PWD/qstatemachine.h \
- $$PWD/qstatemachine_p.h \
- $$PWD/qsignaleventgenerator_p.h \
- $$PWD/qabstractstate.h \
- $$PWD/qabstractstate_p.h \
- $$PWD/qstate.h \
- $$PWD/qstate_p.h \
- $$PWD/qfinalstate.h \
- $$PWD/qfinalstate_p.h \
- $$PWD/qhistorystate.h \
- $$PWD/qhistorystate_p.h \
- $$PWD/qabstracttransition.h \
- $$PWD/qabstracttransition_p.h \
- $$PWD/qsignaltransition.h \
- $$PWD/qsignaltransition_p.h
-
-SOURCES += $$PWD/qstatemachine.cpp \
- $$PWD/qabstractstate.cpp \
- $$PWD/qstate.cpp \
- $$PWD/qfinalstate.cpp \
- $$PWD/qhistorystate.cpp \
- $$PWD/qabstracttransition.cpp \
- $$PWD/qsignaltransition.cpp
-
-qtConfig(qeventtransition) {
- HEADERS += \
- $$PWD/qeventtransition.h \
- $$PWD/qeventtransition_p.h
- SOURCES += \
- $$PWD/qeventtransition.cpp
-}
diff --git a/src/gui/.prev_CMakeLists.txt b/src/gui/.prev_CMakeLists.txt
index c161cedeaa..8a93a8752a 100644
--- a/src/gui/.prev_CMakeLists.txt
+++ b/src/gui/.prev_CMakeLists.txt
@@ -39,6 +39,7 @@ qt_add_module(Gui
kernel/qgenericplugin.cpp kernel/qgenericplugin.h
kernel/qgenericpluginfactory.cpp kernel/qgenericpluginfactory.h
kernel/qguiapplication.cpp kernel/qguiapplication.h kernel/qguiapplication_p.h
+ kernel/qguistatemachine.cpp
kernel/qguivariant.cpp
kernel/qhighdpiscaling.cpp kernel/qhighdpiscaling_p.h
kernel/qinputdevice.cpp kernel/qinputdevice.h kernel/qinputdevice_p.h
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index d125d0dc0c..79f3bafcd5 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -90,6 +90,7 @@ qt_add_module(Gui
kernel/qgenericplugin.cpp kernel/qgenericplugin.h
kernel/qgenericpluginfactory.cpp kernel/qgenericpluginfactory.h
kernel/qguiapplication.cpp kernel/qguiapplication.h kernel/qguiapplication_p.h
+ kernel/qguistatemachine.cpp
kernel/qguivariant.cpp
kernel/qhighdpiscaling.cpp kernel/qhighdpiscaling_p.h
kernel/qinputdevice.cpp kernel/qinputdevice.h kernel/qinputdevice_p.h
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index c86489e9fa..011e0ce00d 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -128,7 +128,8 @@ SOURCES += \
kernel/qplatformgraphicsbufferhelper.cpp \
kernel/qinputdevicemanager.cpp \
kernel/qhighdpiscaling.cpp \
- kernel/qtestsupport_gui.cpp
+ kernel/qtestsupport_gui.cpp \
+ kernel/qguistatemachine.cpp
qtConfig(action) {
HEADERS += \
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 48fe62ad98..7019c55fac 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -331,6 +331,7 @@ public:
#endif
static void updatePalette();
+ QEvent *cloneEvent(QEvent *e) override;
protected:
virtual void notifyThemeChanged();
diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/gui/kernel/qguistatemachine.cpp
index b310da5781..dacfa7793a 100644
--- a/src/widgets/statemachine/qguistatemachine.cpp
+++ b/src/gui/kernel/qguistatemachine.cpp
@@ -37,19 +37,14 @@
**
****************************************************************************/
-#include <QtCore/qstatemachine.h>
-#include <private/qstatemachine_p.h>
#include <QtGui/qevent.h>
-#include <QtWidgets/qtwidgetsglobal.h>
-#if QT_CONFIG(graphicsview)
-#include <QtWidgets/qgraphicssceneevent.h>
-#endif
+#include <QtGui/qtguiglobal.h>
-QT_BEGIN_NAMESPACE
+#include "private/qguiapplication_p.h"
-Q_CORE_EXPORT const QStateMachinePrivate::Handler *qcoreStateMachineHandler();
+QT_BEGIN_NAMESPACE
-static QEvent *cloneEvent(QEvent *e)
+QEvent *QGuiApplicationPrivate::cloneEvent(QEvent *e)
{
switch (e->type()) {
case QEvent::MouseButtonPress:
@@ -226,10 +221,7 @@ static QEvent *cloneEvent(QEvent *e)
return new QHelpEvent(*static_cast<QHelpEvent*>(e));
case QEvent::WhatsThis:
return new QHelpEvent(*static_cast<QHelpEvent*>(e));
-#if QT_CONFIG(statustip)
- case QEvent::StatusTip:
- return new QStatusTipEvent(*static_cast<QStatusTipEvent*>(e));
-#endif // QT_CONFIG(statustip)
+
#ifndef QT_NO_ACTION
case QEvent::ActionChanged:
case QEvent::ActionAdded:
@@ -251,11 +243,6 @@ static QEvent *cloneEvent(QEvent *e)
return new QWhatsThisClickedEvent(*static_cast<QWhatsThisClickedEvent*>(e));
#endif // QT_CONFIG(whatsthis)
-#if QT_CONFIG(toolbar)
- case QEvent::ToolBarChange:
- return new QToolBarChangeEvent(*static_cast<QToolBarChangeEvent*>(e));
-#endif // QT_CONFIG(toolbar)
-
case QEvent::ApplicationActivate:
return new QEvent(*e);
case QEvent::ApplicationDeactivate:
@@ -288,87 +275,7 @@ static QEvent *cloneEvent(QEvent *e)
case QEvent::ZeroTimerEvent:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
-#if QT_CONFIG(graphicsview)
- case QEvent::GraphicsSceneMouseMove:
- case QEvent::GraphicsSceneMousePress:
- case QEvent::GraphicsSceneMouseRelease:
- case QEvent::GraphicsSceneMouseDoubleClick: {
- QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent*>(e);
- QGraphicsSceneMouseEvent *me2 = new QGraphicsSceneMouseEvent(me->type());
- me2->setWidget(me->widget());
- me2->setPos(me->pos());
- me2->setScenePos(me->scenePos());
- me2->setScreenPos(me->screenPos());
-// ### for all buttons
- me2->setButtonDownPos(Qt::LeftButton, me->buttonDownPos(Qt::LeftButton));
- me2->setButtonDownPos(Qt::RightButton, me->buttonDownPos(Qt::RightButton));
- me2->setButtonDownScreenPos(Qt::LeftButton, me->buttonDownScreenPos(Qt::LeftButton));
- me2->setButtonDownScreenPos(Qt::RightButton, me->buttonDownScreenPos(Qt::RightButton));
- me2->setLastPos(me->lastPos());
- me2->setLastScenePos(me->lastScenePos());
- me2->setLastScreenPos(me->lastScreenPos());
- me2->setButtons(me->buttons());
- me2->setButton(me->button());
- me2->setModifiers(me->modifiers());
- me2->setSource(me->source());
- me2->setFlags(me->flags());
- return me2;
- }
- case QEvent::GraphicsSceneContextMenu: {
- QGraphicsSceneContextMenuEvent *me = static_cast<QGraphicsSceneContextMenuEvent*>(e);
- QGraphicsSceneContextMenuEvent *me2 = new QGraphicsSceneContextMenuEvent(me->type());
- me2->setWidget(me->widget());
- me2->setPos(me->pos());
- me2->setScenePos(me->scenePos());
- me2->setScreenPos(me->screenPos());
- me2->setModifiers(me->modifiers());
- me2->setReason(me->reason());
- return me2;
- }
-
- case QEvent::GraphicsSceneHoverEnter:
- case QEvent::GraphicsSceneHoverMove:
- case QEvent::GraphicsSceneHoverLeave: {
- QGraphicsSceneHoverEvent *he = static_cast<QGraphicsSceneHoverEvent*>(e);
- QGraphicsSceneHoverEvent *he2 = new QGraphicsSceneHoverEvent(he->type());
- he2->setPos(he->pos());
- he2->setScenePos(he->scenePos());
- he2->setScreenPos(he->screenPos());
- he2->setLastPos(he->lastPos());
- he2->setLastScenePos(he->lastScenePos());
- he2->setLastScreenPos(he->lastScreenPos());
- he2->setModifiers(he->modifiers());
- return he2;
- }
- case QEvent::GraphicsSceneHelp:
- return new QHelpEvent(*static_cast<QHelpEvent*>(e));
- case QEvent::GraphicsSceneDragEnter:
- case QEvent::GraphicsSceneDragMove:
- case QEvent::GraphicsSceneDragLeave:
- case QEvent::GraphicsSceneDrop: {
- QGraphicsSceneDragDropEvent *dde = static_cast<QGraphicsSceneDragDropEvent*>(e);
- QGraphicsSceneDragDropEvent *dde2 = new QGraphicsSceneDragDropEvent(dde->type());
- dde2->setPos(dde->pos());
- dde2->setScenePos(dde->scenePos());
- dde2->setScreenPos(dde->screenPos());
- dde2->setButtons(dde->buttons());
- dde2->setModifiers(dde->modifiers());
- return dde2;
- }
- case QEvent::GraphicsSceneWheel: {
- QGraphicsSceneWheelEvent *we = static_cast<QGraphicsSceneWheelEvent*>(e);
- QGraphicsSceneWheelEvent *we2 = new QGraphicsSceneWheelEvent(we->type());
- we2->setPos(we->pos());
- we2->setScenePos(we->scenePos());
- we2->setScreenPos(we->screenPos());
- we2->setButtons(we->buttons());
- we2->setModifiers(we->modifiers());
- we2->setOrientation(we->orientation());
- we2->setDelta(we->delta());
- return we2;
- }
-#endif
case QEvent::KeyboardLayoutChange:
return new QEvent(*e);
@@ -399,23 +306,6 @@ static QEvent *cloneEvent(QEvent *e)
case QEvent::FutureCallOut:
Q_ASSERT_X(false, "cloneEvent()", "not implemented");
break;
-#if QT_CONFIG(graphicsview)
- case QEvent::GraphicsSceneResize: {
- QGraphicsSceneResizeEvent *re = static_cast<QGraphicsSceneResizeEvent*>(e);
- QGraphicsSceneResizeEvent *re2 = new QGraphicsSceneResizeEvent();
- re2->setOldSize(re->oldSize());
- re2->setNewSize(re->newSize());
- return re2;
- }
- case QEvent::GraphicsSceneMove: {
- QGraphicsSceneMoveEvent *me = static_cast<QGraphicsSceneMoveEvent*>(e);
- QGraphicsSceneMoveEvent *me2 = new QGraphicsSceneMoveEvent();
- me2->setWidget(me->widget());
- me2->setNewPos(me->newPos());
- me2->setOldPos(me->oldPos());
- return me2;
- }
-#endif
case QEvent::CursorChange:
return new QEvent(*e);
case QEvent::ToolTipChange:
@@ -449,25 +339,7 @@ static QEvent *cloneEvent(QEvent *e)
default:
;
}
- return qcoreStateMachineHandler()->cloneEvent(e);
-}
-
-const QStateMachinePrivate::Handler qt_gui_statemachine_handler = {
- cloneEvent
-};
-
-static const QStateMachinePrivate::Handler *qt_guistatemachine_last_handler = nullptr;
-void qRegisterGuiStateMachine()
-{
- qt_guistatemachine_last_handler = QStateMachinePrivate::handler;
- QStateMachinePrivate::handler = &qt_gui_statemachine_handler;
-}
-Q_CONSTRUCTOR_FUNCTION(qRegisterGuiStateMachine)
-
-void qUnregisterGuiStateMachine()
-{
- QStateMachinePrivate::handler = qt_guistatemachine_last_handler;
+ return QCoreApplicationPrivate::cloneEvent(e);
}
-Q_DESTRUCTOR_FUNCTION(qUnregisterGuiStateMachine)
QT_END_NAMESPACE
diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h
index 93141e747c..797bcf6e76 100644
--- a/src/tools/uic/qclass_lib_map.h
+++ b/src/tools/uic/qclass_lib_map.h
@@ -129,14 +129,6 @@ QT_CLASS_LIB(QtPlugin, QtCore, qplugin.h)
QT_CLASS_LIB(QtPluginInstanceFunction, QtCore, qplugin.h)
QT_CLASS_LIB(QPluginLoader, QtCore, qpluginloader.h)
QT_CLASS_LIB(QUuid, QtCore, quuid.h)
-QT_CLASS_LIB(QAbstractState, QtCore, qabstractstate.h)
-QT_CLASS_LIB(QAbstractTransition, QtCore, qabstracttransition.h)
-QT_CLASS_LIB(QEventTransition, QtCore, qeventtransition.h)
-QT_CLASS_LIB(QFinalState, QtCore, qfinalstate.h)
-QT_CLASS_LIB(QHistoryState, QtCore, qhistorystate.h)
-QT_CLASS_LIB(QSignalTransition, QtCore, qsignaltransition.h)
-QT_CLASS_LIB(QState, QtCore, qstate.h)
-QT_CLASS_LIB(QStateMachine, QtCore, qstatemachine.h)
QT_CLASS_LIB(QAtomicInt, QtCore, qatomic.h)
QT_CLASS_LIB(QAtomicPointer, QtCore, qatomic.h)
QT_CLASS_LIB(QBasicAtomicInt, QtCore, qbasicatomic.h)
@@ -771,8 +763,6 @@ QT_CLASS_LIB(QRgb, QtGui, qrgb.h)
QT_CLASS_LIB(QStylePainter, QtGui, qstylepainter.h)
QT_CLASS_LIB(QTransform, QtGui, qtransform.h)
QT_CLASS_LIB(QWMatrix, QtGui, qwmatrix.h)
-QT_CLASS_LIB(QKeyEventTransition, QtWidgets, qkeyeventtransition.h)
-QT_CLASS_LIB(QMouseEventTransition, QtWidgets, qmouseeventtransition.h)
QT_CLASS_LIB(QCommonStyle, QtWidgets, qcommonstyle.h)
QT_CLASS_LIB(QProxyStyle, QtWidgets, qproxystyle.h)
QT_CLASS_LIB(QStyle, QtWidgets, qstyle.h)
diff --git a/src/widgets/.prev_CMakeLists.txt b/src/widgets/.prev_CMakeLists.txt
index 971791c363..b0c3af801a 100644
--- a/src/widgets/.prev_CMakeLists.txt
+++ b/src/widgets/.prev_CMakeLists.txt
@@ -27,6 +27,7 @@ qt_add_module(Widgets
kernel/qtwidgetsglobal.h kernel/qtwidgetsglobal_p.h
kernel/qwidget.cpp kernel/qwidget.h kernel/qwidget_p.h
kernel/qwidgetrepaintmanager.cpp kernel/qwidgetrepaintmanager_p.h
+ kernel/qwidgetstatemachine.cpp
kernel/qwidgetsvariant.cpp
kernel/qwidgetwindow.cpp kernel/qwidgetwindow_p.h
kernel/qwindowcontainer.cpp kernel/qwindowcontainer_p.h
@@ -804,19 +805,6 @@ qt_extend_target(Widgets CONDITION NOT QT_FEATURE_xcb
util/qsystemtrayicon_qpa.cpp
)
-qt_extend_target(Widgets CONDITION QT_FEATURE_statemachine
- SOURCES
- statemachine/qguistatemachine.cpp
-)
-
-qt_extend_target(Widgets CONDITION QT_FEATURE_qeventtransition
- SOURCES
- statemachine/qbasickeyeventtransition.cpp statemachine/qbasickeyeventtransition_p.h
- statemachine/qbasicmouseeventtransition.cpp statemachine/qbasicmouseeventtransition_p.h
- statemachine/qkeyeventtransition.cpp statemachine/qkeyeventtransition.h
- statemachine/qmouseeventtransition.cpp statemachine/qmouseeventtransition.h
-)
-
qt_create_tracepoints(Widgets qtwidgets.tracepoints)
qt_add_docs(Widgets
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
index 84ed6f7fa9..915fd7a99f 100644
--- a/src/widgets/CMakeLists.txt
+++ b/src/widgets/CMakeLists.txt
@@ -27,6 +27,7 @@ qt_add_module(Widgets
kernel/qtwidgetsglobal.h kernel/qtwidgetsglobal_p.h
kernel/qwidget.cpp kernel/qwidget.h kernel/qwidget_p.h
kernel/qwidgetrepaintmanager.cpp kernel/qwidgetrepaintmanager_p.h
+ kernel/qwidgetstatemachine.cpp
kernel/qwidgetsvariant.cpp
kernel/qwidgetwindow.cpp kernel/qwidgetwindow_p.h
kernel/qwindowcontainer.cpp kernel/qwindowcontainer_p.h
@@ -806,19 +807,6 @@ qt_extend_target(Widgets CONDITION NOT QT_FEATURE_xcb
util/qsystemtrayicon_qpa.cpp
)
-qt_extend_target(Widgets CONDITION QT_FEATURE_statemachine
- SOURCES
- statemachine/qguistatemachine.cpp
-)
-
-qt_extend_target(Widgets CONDITION QT_FEATURE_qeventtransition
- SOURCES
- statemachine/qbasickeyeventtransition.cpp statemachine/qbasickeyeventtransition_p.h
- statemachine/qbasicmouseeventtransition.cpp statemachine/qbasicmouseeventtransition_p.h
- statemachine/qkeyeventtransition.cpp statemachine/qkeyeventtransition.h
- statemachine/qmouseeventtransition.cpp statemachine/qmouseeventtransition.h
-)
-
qt_create_tracepoints(Widgets qtwidgets.tracepoints)
qt_add_docs(Widgets
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri
index 462897b886..b00e220078 100644
--- a/src/widgets/kernel/kernel.pri
+++ b/src/widgets/kernel/kernel.pri
@@ -49,7 +49,8 @@ SOURCES += \
kernel/qwidgetsvariant.cpp \
kernel/qwidgetwindow.cpp \
kernel/qwindowcontainer.cpp \
- kernel/qtestsupport_widgets.cpp
+ kernel/qtestsupport_widgets.cpp \
+ kernel/qwidgetstatemachine.cpp
macx: {
HEADERS += kernel/qmacgesturerecognizer_p.h
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 55c05e08dd..fa64a3925d 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -525,10 +525,6 @@ void qt_init_tooltip_palette()
#endif
}
-#if QT_CONFIG(statemachine)
-void qRegisterGuiStateMachine();
-void qUnregisterGuiStateMachine();
-#endif
extern void qRegisterWidgetsVariant();
/*!
@@ -563,10 +559,6 @@ void QApplicationPrivate::initialize()
// Trigger default style if none was set already
Q_UNUSED(QApplication::style());
}
-#if QT_CONFIG(statemachine)
- // trigger registering of QStateMachine's GUI types
- qRegisterGuiStateMachine();
-#endif
if (qEnvironmentVariableIntValue("QT_USE_NATIVE_WINDOWS") > 0)
QCoreApplication::setAttribute(Qt::AA_NativeWindows);
@@ -746,11 +738,6 @@ QApplication::~QApplication()
QApplicationPrivate::enabledAnimations = QPlatformTheme::GeneralUiEffect;
QApplicationPrivate::widgetCount = false;
-
-#if QT_CONFIG(statemachine)
- // trigger unregistering of QStateMachine's GUI types
- qUnregisterGuiStateMachine();
-#endif
}
void qt_cleanup()
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 77182bf9dd..035d3e3220 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -258,6 +258,9 @@ public:
static void translateTouchCancel(const QPointingDevice *device, ulong timestamp);
QPixmap applyQIconStyleHelper(QIcon::Mode mode, const QPixmap& base) const override;
+
+ QEvent *cloneEvent(QEvent *e) override;
+
private:
static QApplicationPrivate *self;
static bool tryCloseAllWidgetWindows(QWindowList *processedWindows);
diff --git a/src/widgets/kernel/qwidgetstatemachine.cpp b/src/widgets/kernel/qwidgetstatemachine.cpp
new file mode 100644
index 0000000000..f5ed781671
--- /dev/null
+++ b/src/widgets/kernel/qwidgetstatemachine.cpp
@@ -0,0 +1,166 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWidgets module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui/qevent.h>
+#include <QtWidgets/qtwidgetsglobal.h>
+#if QT_CONFIG(graphicsview)
+#include <QtWidgets/qgraphicssceneevent.h>
+#endif
+
+#include "private/qapplication_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QEvent *QApplicationPrivate::cloneEvent(QEvent *e)
+{
+ switch (e->type()) {
+#if QT_CONFIG(statustip)
+ case QEvent::StatusTip:
+ return new QStatusTipEvent(*static_cast<QStatusTipEvent*>(e));
+#endif // QT_CONFIG(statustip)
+
+#if QT_CONFIG(toolbar)
+ case QEvent::ToolBarChange:
+ return new QToolBarChangeEvent(*static_cast<QToolBarChangeEvent*>(e));
+#endif // QT_CONFIG(toolbar)
+
+#if QT_CONFIG(graphicsview)
+ case QEvent::GraphicsSceneMouseMove:
+ case QEvent::GraphicsSceneMousePress:
+ case QEvent::GraphicsSceneMouseRelease:
+ case QEvent::GraphicsSceneMouseDoubleClick: {
+ QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent*>(e);
+ QGraphicsSceneMouseEvent *me2 = new QGraphicsSceneMouseEvent(me->type());
+ me2->setWidget(me->widget());
+ me2->setPos(me->pos());
+ me2->setScenePos(me->scenePos());
+ me2->setScreenPos(me->screenPos());
+// ### for all buttons
+ me2->setButtonDownPos(Qt::LeftButton, me->buttonDownPos(Qt::LeftButton));
+ me2->setButtonDownPos(Qt::RightButton, me->buttonDownPos(Qt::RightButton));
+ me2->setButtonDownScreenPos(Qt::LeftButton, me->buttonDownScreenPos(Qt::LeftButton));
+ me2->setButtonDownScreenPos(Qt::RightButton, me->buttonDownScreenPos(Qt::RightButton));
+ me2->setLastPos(me->lastPos());
+ me2->setLastScenePos(me->lastScenePos());
+ me2->setLastScreenPos(me->lastScreenPos());
+ me2->setButtons(me->buttons());
+ me2->setButton(me->button());
+ me2->setModifiers(me->modifiers());
+ me2->setSource(me->source());
+ me2->setFlags(me->flags());
+ return me2;
+ }
+
+ case QEvent::GraphicsSceneContextMenu: {
+ QGraphicsSceneContextMenuEvent *me = static_cast<QGraphicsSceneContextMenuEvent*>(e);
+ QGraphicsSceneContextMenuEvent *me2 = new QGraphicsSceneContextMenuEvent(me->type());
+ me2->setWidget(me->widget());
+ me2->setPos(me->pos());
+ me2->setScenePos(me->scenePos());
+ me2->setScreenPos(me->screenPos());
+ me2->setModifiers(me->modifiers());
+ me2->setReason(me->reason());
+ return me2;
+ }
+
+ case QEvent::GraphicsSceneHoverEnter:
+ case QEvent::GraphicsSceneHoverMove:
+ case QEvent::GraphicsSceneHoverLeave: {
+ QGraphicsSceneHoverEvent *he = static_cast<QGraphicsSceneHoverEvent*>(e);
+ QGraphicsSceneHoverEvent *he2 = new QGraphicsSceneHoverEvent(he->type());
+ he2->setPos(he->pos());
+ he2->setScenePos(he->scenePos());
+ he2->setScreenPos(he->screenPos());
+ he2->setLastPos(he->lastPos());
+ he2->setLastScenePos(he->lastScenePos());
+ he2->setLastScreenPos(he->lastScreenPos());
+ he2->setModifiers(he->modifiers());
+ return he2;
+ }
+ case QEvent::GraphicsSceneHelp:
+ return new QHelpEvent(*static_cast<QHelpEvent*>(e));
+ case QEvent::GraphicsSceneDragEnter:
+ case QEvent::GraphicsSceneDragMove:
+ case QEvent::GraphicsSceneDragLeave:
+ case QEvent::GraphicsSceneDrop: {
+ QGraphicsSceneDragDropEvent *dde = static_cast<QGraphicsSceneDragDropEvent*>(e);
+ QGraphicsSceneDragDropEvent *dde2 = new QGraphicsSceneDragDropEvent(dde->type());
+ dde2->setPos(dde->pos());
+ dde2->setScenePos(dde->scenePos());
+ dde2->setScreenPos(dde->screenPos());
+ dde2->setButtons(dde->buttons());
+ dde2->setModifiers(dde->modifiers());
+ return dde2;
+ }
+ case QEvent::GraphicsSceneWheel: {
+ QGraphicsSceneWheelEvent *we = static_cast<QGraphicsSceneWheelEvent*>(e);
+ QGraphicsSceneWheelEvent *we2 = new QGraphicsSceneWheelEvent(we->type());
+ we2->setPos(we->pos());
+ we2->setScenePos(we->scenePos());
+ we2->setScreenPos(we->screenPos());
+ we2->setButtons(we->buttons());
+ we2->setModifiers(we->modifiers());
+ we2->setOrientation(we->orientation());
+ we2->setDelta(we->delta());
+ return we2;
+ }
+
+ case QEvent::GraphicsSceneResize: {
+ QGraphicsSceneResizeEvent *re = static_cast<QGraphicsSceneResizeEvent*>(e);
+ QGraphicsSceneResizeEvent *re2 = new QGraphicsSceneResizeEvent();
+ re2->setOldSize(re->oldSize());
+ re2->setNewSize(re->newSize());
+ return re2;
+ }
+ case QEvent::GraphicsSceneMove: {
+ QGraphicsSceneMoveEvent *me = static_cast<QGraphicsSceneMoveEvent*>(e);
+ QGraphicsSceneMoveEvent *me2 = new QGraphicsSceneMoveEvent();
+ me2->setWidget(me->widget());
+ me2->setNewPos(me->newPos());
+ me2->setOldPos(me->oldPos());
+ return me2;
+ }
+#endif
+ default:
+ ;
+ }
+ return QApplicationPrivateBase::cloneEvent(e);
+}
+
+QT_END_NAMESPACE
diff --git a/src/widgets/statemachine/qbasickeyeventtransition.cpp b/src/widgets/statemachine/qbasickeyeventtransition.cpp
deleted file mode 100644
index c833e64822..0000000000
--- a/src/widgets/statemachine/qbasickeyeventtransition.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qbasickeyeventtransition_p.h"
-
-#include <QtGui/qevent.h>
-#include <qdebug.h>
-#include <private/qabstracttransition_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \internal
- \class QBasicKeyEventTransition
- \since 4.6
- \ingroup statemachine
-
- \brief The QBasicKeyEventTransition class provides a transition for Qt key events.
-*/
-
-class QBasicKeyEventTransitionPrivate : public QAbstractTransitionPrivate
-{
- Q_DECLARE_PUBLIC(QBasicKeyEventTransition)
-public:
- QBasicKeyEventTransitionPrivate();
-
- static QBasicKeyEventTransitionPrivate *get(QBasicKeyEventTransition *q);
-
- QEvent::Type eventType;
- int key;
- Qt::KeyboardModifiers modifierMask;
-};
-
-QBasicKeyEventTransitionPrivate::QBasicKeyEventTransitionPrivate()
-{
- eventType = QEvent::None;
- key = 0;
- modifierMask = Qt::NoModifier;
-}
-
-QBasicKeyEventTransitionPrivate *QBasicKeyEventTransitionPrivate::get(QBasicKeyEventTransition *q)
-{
- return q->d_func();
-}
-
-/*!
- Constructs a new key event transition with the given \a sourceState.
-*/
-QBasicKeyEventTransition::QBasicKeyEventTransition(QState *sourceState)
- : QAbstractTransition(*new QBasicKeyEventTransitionPrivate, sourceState)
-{
-}
-
-/*!
- Constructs a new event transition for events of the given \a type for the
- given \a key, with the given \a sourceState.
-*/
-QBasicKeyEventTransition::QBasicKeyEventTransition(QEvent::Type type, int key,
- QState *sourceState)
- : QAbstractTransition(*new QBasicKeyEventTransitionPrivate, sourceState)
-{
- Q_D(QBasicKeyEventTransition);
- d->eventType = type;
- d->key = key;
-}
-
-/*!
- Constructs a new event transition for events of the given \a type for the
- given \a key, with the given \a modifierMask and \a sourceState.
-*/
-QBasicKeyEventTransition::QBasicKeyEventTransition(QEvent::Type type, int key,
- Qt::KeyboardModifiers modifierMask,
- QState *sourceState)
- : QAbstractTransition(*new QBasicKeyEventTransitionPrivate, sourceState)
-{
- Q_D(QBasicKeyEventTransition);
- d->eventType = type;
- d->key = key;
- d->modifierMask = modifierMask;
-}
-
-/*!
- Destroys this event transition.
-*/
-QBasicKeyEventTransition::~QBasicKeyEventTransition()
-{
-}
-
-/*!
- Returns the event type that this key event transition is associated with.
-*/
-QEvent::Type QBasicKeyEventTransition::eventType() const
-{
- Q_D(const QBasicKeyEventTransition);
- return d->eventType;
-}
-
-/*!
- Sets the event \a type that this key event transition is associated with.
-*/
-void QBasicKeyEventTransition::setEventType(QEvent::Type type)
-{
- Q_D(QBasicKeyEventTransition);
- d->eventType = type;
-}
-
-/*!
- Returns the key that this key event transition checks for.
-*/
-int QBasicKeyEventTransition::key() const
-{
- Q_D(const QBasicKeyEventTransition);
- return d->key;
-}
-
-/*!
- Sets the key that this key event transition will check for.
-*/
-void QBasicKeyEventTransition::setKey(int key)
-{
- Q_D(QBasicKeyEventTransition);
- d->key = key;
-}
-
-/*!
- Returns the keyboard modifier mask that this key event transition checks
- for.
-*/
-Qt::KeyboardModifiers QBasicKeyEventTransition::modifierMask() const
-{
- Q_D(const QBasicKeyEventTransition);
- return d->modifierMask;
-}
-
-/*!
- Sets the keyboard modifier mask that this key event transition will check
- for.
-*/
-void QBasicKeyEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask)
-{
- Q_D(QBasicKeyEventTransition);
- d->modifierMask = modifierMask;
-}
-
-/*!
- \reimp
-*/
-bool QBasicKeyEventTransition::eventTest(QEvent *event)
-{
- Q_D(const QBasicKeyEventTransition);
- if (event->type() == d->eventType) {
- QKeyEvent *ke = static_cast<QKeyEvent*>(event);
- return (ke->key() == d->key)
- && ((ke->modifiers() & d->modifierMask) == d->modifierMask);
- }
- return false;
-}
-
-/*!
- \reimp
-*/
-void QBasicKeyEventTransition::onTransition(QEvent *)
-{
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qbasickeyeventtransition_p.cpp"
diff --git a/src/widgets/statemachine/qbasickeyeventtransition_p.h b/src/widgets/statemachine/qbasickeyeventtransition_p.h
deleted file mode 100644
index f23c078570..0000000000
--- a/src/widgets/statemachine/qbasickeyeventtransition_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBASICKEYEVENTTRANSITION_P_H
-#define QBASICKEYEVENTTRANSITION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qabstracttransition.h>
-#include <QtGui/qevent.h>
-
-QT_REQUIRE_CONFIG(qeventtransition);
-
-QT_BEGIN_NAMESPACE
-
-class QBasicKeyEventTransitionPrivate;
-class Q_AUTOTEST_EXPORT QBasicKeyEventTransition : public QAbstractTransition
-{
- Q_OBJECT
-public:
- QBasicKeyEventTransition(QState *sourceState = nullptr);
- QBasicKeyEventTransition(QEvent::Type type, int key, QState *sourceState = nullptr);
- QBasicKeyEventTransition(QEvent::Type type, int key,
- Qt::KeyboardModifiers modifierMask,
- QState *sourceState = nullptr);
- ~QBasicKeyEventTransition();
-
- QEvent::Type eventType() const;
- void setEventType(QEvent::Type type);
-
- int key() const;
- void setKey(int key);
-
- Qt::KeyboardModifiers modifierMask() const;
- void setModifierMask(Qt::KeyboardModifiers modifiers);
-
-protected:
- bool eventTest(QEvent *event) override;
- void onTransition(QEvent *) override;
-
-private:
- Q_DISABLE_COPY_MOVE(QBasicKeyEventTransition)
- Q_DECLARE_PRIVATE(QBasicKeyEventTransition)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition.cpp b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
deleted file mode 100644
index 460abe9f50..0000000000
--- a/src/widgets/statemachine/qbasicmouseeventtransition.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qbasicmouseeventtransition_p.h"
-#include <QtGui/qevent.h>
-#include <QtGui/qpainterpath.h>
-#include <qdebug.h>
-#include <private/qabstracttransition_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \internal
- \class QBasicMouseEventTransition
- \since 4.6
- \ingroup statemachine
-
- \brief The QBasicMouseEventTransition class provides a transition for Qt mouse events.
-*/
-
-class QBasicMouseEventTransitionPrivate : public QAbstractTransitionPrivate
-{
- Q_DECLARE_PUBLIC(QBasicMouseEventTransition)
-public:
- QBasicMouseEventTransitionPrivate();
-
- static QBasicMouseEventTransitionPrivate *get(QBasicMouseEventTransition *q);
-
- QEvent::Type eventType;
- Qt::MouseButton button;
- Qt::KeyboardModifiers modifierMask;
- QPainterPath path;
-};
-
-QBasicMouseEventTransitionPrivate::QBasicMouseEventTransitionPrivate()
-{
- eventType = QEvent::None;
- button = Qt::NoButton;
-}
-
-QBasicMouseEventTransitionPrivate *QBasicMouseEventTransitionPrivate::get(QBasicMouseEventTransition *q)
-{
- return q->d_func();
-}
-
-/*!
- Constructs a new mouse event transition with the given \a sourceState.
-*/
-QBasicMouseEventTransition::QBasicMouseEventTransition(QState *sourceState)
- : QAbstractTransition(*new QBasicMouseEventTransitionPrivate, sourceState)
-{
-}
-
-/*!
- Constructs a new mouse event transition for events of the given \a type.
-*/
-QBasicMouseEventTransition::QBasicMouseEventTransition(QEvent::Type type,
- Qt::MouseButton button,
- QState *sourceState)
- : QAbstractTransition(*new QBasicMouseEventTransitionPrivate, sourceState)
-{
- Q_D(QBasicMouseEventTransition);
- d->eventType = type;
- d->button = button;
-}
-
-/*!
- Destroys this mouse event transition.
-*/
-QBasicMouseEventTransition::~QBasicMouseEventTransition()
-{
-}
-
-/*!
- Returns the event type that this mouse event transition is associated with.
-*/
-QEvent::Type QBasicMouseEventTransition::eventType() const
-{
- Q_D(const QBasicMouseEventTransition);
- return d->eventType;
-}
-
-/*!
- Sets the event \a type that this mouse event transition is associated with.
-*/
-void QBasicMouseEventTransition::setEventType(QEvent::Type type)
-{
- Q_D(QBasicMouseEventTransition);
- d->eventType = type;
-}
-
-/*!
- Returns the button that this mouse event transition checks for.
-*/
-Qt::MouseButton QBasicMouseEventTransition::button() const
-{
- Q_D(const QBasicMouseEventTransition);
- return d->button;
-}
-
-/*!
- Sets the button that this mouse event transition will check for.
-*/
-void QBasicMouseEventTransition::setButton(Qt::MouseButton button)
-{
- Q_D(QBasicMouseEventTransition);
- d->button = button;
-}
-
-/*!
- Returns the keyboard modifier mask that this mouse event transition checks
- for.
-*/
-Qt::KeyboardModifiers QBasicMouseEventTransition::modifierMask() const
-{
- Q_D(const QBasicMouseEventTransition);
- return d->modifierMask;
-}
-
-/*!
- Sets the keyboard modifier mask that this mouse event transition will check
- for.
-*/
-void QBasicMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask)
-{
- Q_D(QBasicMouseEventTransition);
- d->modifierMask = modifierMask;
-}
-
-/*!
- Returns the hit test path for this mouse event transition.
-*/
-QPainterPath QBasicMouseEventTransition::hitTestPath() const
-{
- Q_D(const QBasicMouseEventTransition);
- return d->path;
-}
-
-/*!
- Sets the hit test path for this mouse event transition.
-*/
-void QBasicMouseEventTransition::setHitTestPath(const QPainterPath &path)
-{
- Q_D(QBasicMouseEventTransition);
- d->path = path;
-}
-
-/*!
- \reimp
-*/
-bool QBasicMouseEventTransition::eventTest(QEvent *event)
-{
- Q_D(const QBasicMouseEventTransition);
- if (event->type() == d->eventType) {
- QMouseEvent *me = static_cast<QMouseEvent*>(event);
- return (me->button() == d->button)
- && ((me->modifiers() & d->modifierMask) == d->modifierMask)
- && (d->path.isEmpty() || d->path.contains(me->position().toPoint()));
- }
- return false;
-}
-
-/*!
- \reimp
-*/
-void QBasicMouseEventTransition::onTransition(QEvent *)
-{
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qbasicmouseeventtransition_p.cpp"
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition_p.h b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
deleted file mode 100644
index dd619d189c..0000000000
--- a/src/widgets/statemachine/qbasicmouseeventtransition_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QBASICMOUSEEVENTTRANSITION_P_H
-#define QBASICMOUSEEVENTTRANSITION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qabstracttransition.h>
-#include <QtGui/qevent.h>
-
-QT_REQUIRE_CONFIG(qeventtransition);
-
-QT_BEGIN_NAMESPACE
-
-class QPainterPath;
-
-class QBasicMouseEventTransitionPrivate;
-class Q_AUTOTEST_EXPORT QBasicMouseEventTransition : public QAbstractTransition
-{
- Q_OBJECT
-public:
- QBasicMouseEventTransition(QState *sourceState = nullptr);
- QBasicMouseEventTransition(QEvent::Type type, Qt::MouseButton button,
- QState *sourceState = nullptr);
- ~QBasicMouseEventTransition();
-
- QEvent::Type eventType() const;
- void setEventType(QEvent::Type type);
-
- Qt::MouseButton button() const;
- void setButton(Qt::MouseButton button);
-
- Qt::KeyboardModifiers modifierMask() const;
- void setModifierMask(Qt::KeyboardModifiers modifiers);
-
- QPainterPath hitTestPath() const;
- void setHitTestPath(const QPainterPath &path);
-
-protected:
- bool eventTest(QEvent *event) override;
- void onTransition(QEvent *) override;
-
-private:
- Q_DISABLE_COPY_MOVE(QBasicMouseEventTransition)
- Q_DECLARE_PRIVATE(QBasicMouseEventTransition)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/widgets/statemachine/qkeyeventtransition.cpp b/src/widgets/statemachine/qkeyeventtransition.cpp
deleted file mode 100644
index 1578f294d5..0000000000
--- a/src/widgets/statemachine/qkeyeventtransition.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkeyeventtransition.h"
-#include "qbasickeyeventtransition_p.h"
-#include <QtCore/qstatemachine.h>
-#include <private/qeventtransition_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QKeyEventTransition
-
- \brief The QKeyEventTransition class provides a transition for key events.
-
- \since 4.6
- \ingroup statemachine
- \inmodule QtWidgets
-
- QKeyEventTransition is part of \l{The State Machine Framework}.
-
- \sa QState::addTransition()
-*/
-
-/*!
- \property QKeyEventTransition::key
-
- \brief the key that this key event transition is associated with
-*/
-
-/*!
- \property QKeyEventTransition::modifierMask
-
- \brief the keyboard modifier mask that this key event transition checks for
-*/
-
-class QKeyEventTransitionPrivate : public QEventTransitionPrivate
-{
- Q_DECLARE_PUBLIC(QKeyEventTransition)
-public:
- QKeyEventTransitionPrivate() {}
-
- QBasicKeyEventTransition *transition;
-};
-
-/*!
- Constructs a new key event transition with the given \a sourceState.
-*/
-QKeyEventTransition::QKeyEventTransition(QState *sourceState)
- : QEventTransition(*new QKeyEventTransitionPrivate, sourceState)
-{
- Q_D(QKeyEventTransition);
- d->transition = new QBasicKeyEventTransition();
-}
-
-/*!
- Constructs a new key event transition for events of the given \a type for
- the given \a object, with the given \a key and \a sourceState.
-*/
-QKeyEventTransition::QKeyEventTransition(QObject *object, QEvent::Type type,
- int key, QState *sourceState)
- : QEventTransition(*new QKeyEventTransitionPrivate, object, type, sourceState)
-{
- Q_D(QKeyEventTransition);
- d->transition = new QBasicKeyEventTransition(type, key);
-}
-
-/*!
- Destroys this key event transition.
-*/
-QKeyEventTransition::~QKeyEventTransition()
-{
- Q_D(QKeyEventTransition);
- delete d->transition;
-}
-
-/*!
- Returns the key that this key event transition checks for.
-*/
-int QKeyEventTransition::key() const
-{
- Q_D(const QKeyEventTransition);
- return d->transition->key();
-}
-
-/*!
- Sets the \a key that this key event transition will check for.
-*/
-void QKeyEventTransition::setKey(int key)
-{
- Q_D(QKeyEventTransition);
- d->transition->setKey(key);
-}
-
-/*!
- Returns the keyboard modifier mask that this key event transition checks
- for.
-*/
-Qt::KeyboardModifiers QKeyEventTransition::modifierMask() const
-{
- Q_D(const QKeyEventTransition);
- return d->transition->modifierMask();
-}
-
-/*!
- Sets the keyboard modifier mask that this key event transition will
- check for to \a modifierMask.
-*/
-void QKeyEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask)
-{
- Q_D(QKeyEventTransition);
- d->transition->setModifierMask(modifierMask);
-}
-
-/*!
- \reimp
-*/
-bool QKeyEventTransition::eventTest(QEvent *event)
-{
- Q_D(const QKeyEventTransition);
- if (!QEventTransition::eventTest(event))
- return false;
- QStateMachine::WrappedEvent *we = static_cast<QStateMachine::WrappedEvent*>(event);
- d->transition->setEventType(we->event()->type());
- return QAbstractTransitionPrivate::get(d->transition)->callEventTest(we->event());
-}
-
-/*!
- \reimp
-*/
-void QKeyEventTransition::onTransition(QEvent *event)
-{
- QEventTransition::onTransition(event);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qkeyeventtransition.cpp"
diff --git a/src/widgets/statemachine/qkeyeventtransition.h b/src/widgets/statemachine/qkeyeventtransition.h
deleted file mode 100644
index 676f5f7846..0000000000
--- a/src/widgets/statemachine/qkeyeventtransition.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QKEYEVENTTRANSITION_H
-#define QKEYEVENTTRANSITION_H
-
-#include <QtWidgets/qtwidgetsglobal.h>
-#include <QtCore/qeventtransition.h>
-
-QT_REQUIRE_CONFIG(qeventtransition);
-
-QT_BEGIN_NAMESPACE
-
-class QKeyEventTransitionPrivate;
-class Q_WIDGETS_EXPORT QKeyEventTransition : public QEventTransition
-{
- Q_OBJECT
- Q_PROPERTY(int key READ key WRITE setKey)
- Q_PROPERTY(Qt::KeyboardModifiers modifierMask READ modifierMask WRITE setModifierMask)
-public:
- QKeyEventTransition(QState *sourceState = nullptr);
- QKeyEventTransition(QObject *object, QEvent::Type type, int key,
- QState *sourceState = nullptr);
- ~QKeyEventTransition();
-
- int key() const;
- void setKey(int key);
-
- Qt::KeyboardModifiers modifierMask() const;
- void setModifierMask(Qt::KeyboardModifiers modifiers);
-
-protected:
- void onTransition(QEvent *event) override;
- bool eventTest(QEvent *event) override;
-
-private:
- Q_DISABLE_COPY(QKeyEventTransition)
- Q_DECLARE_PRIVATE(QKeyEventTransition)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/widgets/statemachine/qmouseeventtransition.cpp b/src/widgets/statemachine/qmouseeventtransition.cpp
deleted file mode 100644
index c58dae55a3..0000000000
--- a/src/widgets/statemachine/qmouseeventtransition.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmouseeventtransition.h"
-#include "qbasicmouseeventtransition_p.h"
-#include <QtCore/qstatemachine.h>
-#include <QtGui/qpainterpath.h>
-#include <private/qeventtransition_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMouseEventTransition
-
- \brief The QMouseEventTransition class provides a transition for mouse events.
-
- \since 4.6
- \ingroup statemachine
- \inmodule QtWidgets
-
- QMouseEventTransition is part of \l{The State Machine Framework}.
-
- \sa QState::addTransition()
-*/
-
-/*!
- \property QMouseEventTransition::button
-
- \brief the button that this mouse event transition is associated with
-*/
-
-/*!
- \property QMouseEventTransition::modifierMask
-
- \brief the keyboard modifier mask that this mouse event transition checks for
-*/
-
-class QMouseEventTransitionPrivate : public QEventTransitionPrivate
-{
- Q_DECLARE_PUBLIC(QMouseEventTransition)
-public:
- QMouseEventTransitionPrivate();
-
- QBasicMouseEventTransition *transition;
-};
-
-QMouseEventTransitionPrivate::QMouseEventTransitionPrivate()
-{
-}
-
-/*!
- Constructs a new mouse event transition with the given \a sourceState.
-*/
-QMouseEventTransition::QMouseEventTransition(QState *sourceState)
- : QEventTransition(*new QMouseEventTransitionPrivate, sourceState)
-{
- Q_D(QMouseEventTransition);
- d->transition = new QBasicMouseEventTransition();
-}
-
-/*!
- Constructs a new mouse event transition for events of the given \a type for
- the given \a object, with the given \a button and \a sourceState.
-*/
-QMouseEventTransition::QMouseEventTransition(QObject *object, QEvent::Type type,
- Qt::MouseButton button,
- QState *sourceState)
- : QEventTransition(*new QMouseEventTransitionPrivate, object, type, sourceState)
-{
- Q_D(QMouseEventTransition);
- d->transition = new QBasicMouseEventTransition(type, button);
-}
-
-/*!
- Destroys this mouse event transition.
-*/
-QMouseEventTransition::~QMouseEventTransition()
-{
- Q_D(QMouseEventTransition);
- delete d->transition;
-}
-
-/*!
- Returns the button that this mouse event transition checks for.
-*/
-Qt::MouseButton QMouseEventTransition::button() const
-{
- Q_D(const QMouseEventTransition);
- return d->transition->button();
-}
-
-/*!
- Sets the \a button that this mouse event transition will check for.
-*/
-void QMouseEventTransition::setButton(Qt::MouseButton button)
-{
- Q_D(QMouseEventTransition);
- d->transition->setButton(button);
-}
-
-/*!
- Returns the keyboard modifier mask that this mouse event transition checks
- for.
-*/
-Qt::KeyboardModifiers QMouseEventTransition::modifierMask() const
-{
- Q_D(const QMouseEventTransition);
- return d->transition->modifierMask();
-}
-
-/*!
- Sets the keyboard modifier mask that this mouse event transition will
- check for to \a modifierMask.
-*/
-void QMouseEventTransition::setModifierMask(Qt::KeyboardModifiers modifierMask)
-{
- Q_D(QMouseEventTransition);
- d->transition->setModifierMask(modifierMask);
-}
-
-/*!
- Returns the hit test path for this mouse event transition.
-*/
-QPainterPath QMouseEventTransition::hitTestPath() const
-{
- Q_D(const QMouseEventTransition);
- return d->transition->hitTestPath();
-}
-
-/*!
- Sets the hit test path for this mouse event transition to \a path.
- If a valid path has been set, the transition will only trigger if the mouse
- event position (QMouseEvent::pos()) is inside the path.
-
- \sa QPainterPath::contains()
-*/
-void QMouseEventTransition::setHitTestPath(const QPainterPath &path)
-{
- Q_D(QMouseEventTransition);
- d->transition->setHitTestPath(path);
-}
-
-/*!
- \reimp
-*/
-bool QMouseEventTransition::eventTest(QEvent *event)
-{
- Q_D(const QMouseEventTransition);
- if (!QEventTransition::eventTest(event))
- return false;
- QStateMachine::WrappedEvent *we = static_cast<QStateMachine::WrappedEvent*>(event);
- d->transition->setEventType(we->event()->type());
- return QAbstractTransitionPrivate::get(d->transition)->callEventTest(we->event());
-}
-
-/*!
- \reimp
-*/
-void QMouseEventTransition::onTransition(QEvent *event)
-{
- QEventTransition::onTransition(event);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qmouseeventtransition.cpp"
diff --git a/src/widgets/statemachine/qmouseeventtransition.h b/src/widgets/statemachine/qmouseeventtransition.h
deleted file mode 100644
index 41f738d894..0000000000
--- a/src/widgets/statemachine/qmouseeventtransition.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMOUSEEVENTTRANSITION_H
-#define QMOUSEEVENTTRANSITION_H
-
-#include <QtWidgets/qtwidgetsglobal.h>
-#include <QtCore/qeventtransition.h>
-
-QT_REQUIRE_CONFIG(qeventtransition);
-
-QT_BEGIN_NAMESPACE
-
-class QMouseEventTransitionPrivate;
-class QPainterPath;
-class Q_WIDGETS_EXPORT QMouseEventTransition : public QEventTransition
-{
- Q_OBJECT
- Q_PROPERTY(Qt::MouseButton button READ button WRITE setButton)
- Q_PROPERTY(Qt::KeyboardModifiers modifierMask READ modifierMask WRITE setModifierMask)
-public:
- QMouseEventTransition(QState *sourceState = nullptr);
- QMouseEventTransition(QObject *object, QEvent::Type type,
- Qt::MouseButton button, QState *sourceState = nullptr);
- ~QMouseEventTransition();
-
- Qt::MouseButton button() const;
- void setButton(Qt::MouseButton button);
-
- Qt::KeyboardModifiers modifierMask() const;
- void setModifierMask(Qt::KeyboardModifiers modifiers);
-
- QPainterPath hitTestPath() const;
- void setHitTestPath(const QPainterPath &path);
-
-protected:
- void onTransition(QEvent *event) override;
- bool eventTest(QEvent *event) override;
-
-private:
- Q_DISABLE_COPY(QMouseEventTransition)
- Q_DECLARE_PRIVATE(QMouseEventTransition)
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/widgets/statemachine/statemachine.pri b/src/widgets/statemachine/statemachine.pri
deleted file mode 100644
index 7b6407bde5..0000000000
--- a/src/widgets/statemachine/statemachine.pri
+++ /dev/null
@@ -1,16 +0,0 @@
-
-qtConfig(statemachine): \
- SOURCES += $$PWD/qguistatemachine.cpp
-
-qtConfig(qeventtransition) {
- HEADERS += \
- $$PWD/qkeyeventtransition.h \
- $$PWD/qmouseeventtransition.h \
- $$PWD/qbasickeyeventtransition_p.h \
- $$PWD/qbasicmouseeventtransition_p.h
- SOURCES += \
- $$PWD/qkeyeventtransition.cpp \
- $$PWD/qmouseeventtransition.cpp \
- $$PWD/qbasickeyeventtransition.cpp \
- $$PWD/qbasicmouseeventtransition.cpp
-}
diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro
index 2d5ba05d40..35fe21e788 100644
--- a/src/widgets/widgets.pro
+++ b/src/widgets/widgets.pro
@@ -24,7 +24,6 @@ include(accessible/accessible.pri)
include(itemviews/itemviews.pri)
include(graphicsview/graphicsview.pri)
include(util/util.pri)
-include(statemachine/statemachine.pri)
qtConfig(graphicseffect) {
include(effects/effects.pri)
diff --git a/tests/auto/corelib/.prev_CMakeLists.txt b/tests/auto/corelib/.prev_CMakeLists.txt
index 5d42ce2a6d..bbfc0e7f17 100644
--- a/tests/auto/corelib/.prev_CMakeLists.txt
+++ b/tests/auto/corelib/.prev_CMakeLists.txt
@@ -9,7 +9,6 @@ if(NOT UIKIT)
add_subdirectory(mimetypes)
add_subdirectory(plugin)
add_subdirectory(serialization)
- add_subdirectory(statemachine)
add_subdirectory(text)
add_subdirectory(thread)
add_subdirectory(time)
diff --git a/tests/auto/corelib/CMakeLists.txt b/tests/auto/corelib/CMakeLists.txt
index 5d42ce2a6d..bbfc0e7f17 100644
--- a/tests/auto/corelib/CMakeLists.txt
+++ b/tests/auto/corelib/CMakeLists.txt
@@ -9,7 +9,6 @@ if(NOT UIKIT)
add_subdirectory(mimetypes)
add_subdirectory(plugin)
add_subdirectory(serialization)
- add_subdirectory(statemachine)
add_subdirectory(text)
add_subdirectory(thread)
add_subdirectory(time)
diff --git a/tests/auto/corelib/corelib.pro b/tests/auto/corelib/corelib.pro
index bece87db4b..3d5fb3d8e4 100644
--- a/tests/auto/corelib/corelib.pro
+++ b/tests/auto/corelib/corelib.pro
@@ -11,7 +11,6 @@ SUBDIRS = \
mimetypes \
plugin \
serialization \
- statemachine \
text \
thread \
time \
diff --git a/tests/auto/corelib/statemachine/CMakeLists.txt b/tests/auto/corelib/statemachine/CMakeLists.txt
deleted file mode 100644
index 362bdbf113..0000000000
--- a/tests/auto/corelib/statemachine/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# Generated from statemachine.pro.
-
-add_subdirectory(qstate)
-add_subdirectory(qstatemachine)
diff --git a/tests/auto/corelib/statemachine/qstate/CMakeLists.txt b/tests/auto/corelib/statemachine/qstate/CMakeLists.txt
deleted file mode 100644
index 515db3c167..0000000000
--- a/tests/auto/corelib/statemachine/qstate/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-# Generated from qstate.pro.
-
-#####################################################################
-## tst_qstate Test:
-#####################################################################
-
-qt_add_test(tst_qstate
- SOURCES
- tst_qstate.cpp
-)
diff --git a/tests/auto/corelib/statemachine/qstate/qstate.pro b/tests/auto/corelib/statemachine/qstate/qstate.pro
deleted file mode 100644
index e2251ded9d..0000000000
--- a/tests/auto/corelib/statemachine/qstate/qstate.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qstate
-QT = core testlib
-SOURCES = tst_qstate.cpp
diff --git a/tests/auto/corelib/statemachine/qstate/tst_qstate.cpp b/tests/auto/corelib/statemachine/qstate/tst_qstate.cpp
deleted file mode 100644
index bbc3f890bd..0000000000
--- a/tests/auto/corelib/statemachine/qstate/tst_qstate.cpp
+++ /dev/null
@@ -1,374 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-
-#include "qstate.h"
-#include "qstatemachine.h"
-#include "qsignaltransition.h"
-
-class tst_QState : public QObject
-{
- Q_OBJECT
-
-private slots:
- void assignProperty();
- void assignPropertyTwice();
- void historyInitialState();
- void transitions();
- void privateSignals();
- void parallelStateAndInitialState();
-};
-
-class TestClass: public QObject
-{
- Q_OBJECT
-public:
- TestClass() : called(false) {}
- bool called;
-
-public slots:
- void slot() { called = true; }
-
-
-};
-
-void tst_QState::assignProperty()
-{
- QStateMachine machine;
-
- QObject object;
- object.setProperty("fooBar", 10);
-
- QState *s1 = new QState(&machine);
- s1->assignProperty(&object, "fooBar", 20);
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
-
- QCOMPARE(object.property("fooBar").toInt(), 20);
-}
-
-void tst_QState::assignPropertyTwice()
-{
- QStateMachine machine;
-
- QObject object;
- object.setProperty("fooBar", 10);
-
- QState *s1 = new QState(&machine);
- s1->assignProperty(&object, "fooBar", 20);
- s1->assignProperty(&object, "fooBar", 30);
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
-
- QCOMPARE(object.property("fooBar").toInt(), 30);
-}
-
-class EventTestTransition: public QAbstractTransition
-{
-public:
- EventTestTransition(QEvent::Type type, QState *targetState)
- : QAbstractTransition(), m_type(type)
- {
- setTargetState(targetState);
- }
-
-protected:
- bool eventTest(QEvent *e)
- {
- return e->type() == m_type;
- }
-
- void onTransition(QEvent *) {}
-
-private:
- QEvent::Type m_type;
-
-};
-
-void tst_QState::historyInitialState()
-{
- QStateMachine machine;
-
- QState *s1 = new QState(&machine);
-
- QState *s2 = new QState(&machine);
- QHistoryState *h1 = new QHistoryState(s2);
-
- s2->setInitialState(h1);
-
- QState *s3 = new QState(s2);
- h1->setDefaultState(s3);
-
- QState *s4 = new QState(s2);
-
- s1->addTransition(new EventTestTransition(QEvent::User, s2));
- s2->addTransition(new EventTestTransition(QEvent::User, s1));
- s3->addTransition(new EventTestTransition(QEvent::Type(QEvent::User+1), s4));
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.configuration().size(), 2);
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s3));
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.configuration().size(), 2);
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s3));
-
- machine.postEvent(new QEvent(QEvent::Type(QEvent::User+1)));
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.configuration().size(), 2);
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s4));
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.configuration().size(), 2);
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s4));
-}
-
-void tst_QState::transitions()
-{
- QState s1;
- QState s2;
-
- QVERIFY(s1.transitions().isEmpty());
-
- QAbstractTransition *t1 = s1.addTransition(this, SIGNAL(destroyed()), &s2);
- QAbstractTransition *t1_1 = s1.addTransition(this, &tst_QState::destroyed, &s2);
- QVERIFY(t1 != 0);
- QVERIFY(t1_1 != 0);
- QCOMPARE(s1.transitions().count(), 2);
- QCOMPARE(s1.transitions().first(), t1);
- QCOMPARE(s1.transitions().last(), t1_1);
- QVERIFY(s2.transitions().isEmpty());
-
- s1.removeTransition(t1);
- s1.removeTransition(t1_1);
- QVERIFY(s1.transitions().isEmpty());
-
- s1.addTransition(t1);
- QCOMPARE(s1.transitions().count(), 1);
- QCOMPARE(s1.transitions().first(), t1);
-
- QAbstractTransition *t2 = new QEventTransition(&s1);
- QCOMPARE(s1.transitions().count(), 2);
- QVERIFY(s1.transitions().contains(t1));
- QVERIFY(s1.transitions().contains(t2));
-
- // Transitions from child states should not be reported.
- QState *s21 = new QState(&s2);
- QAbstractTransition *t3 = s21->addTransition(this, SIGNAL(destroyed()), &s2);
- QVERIFY(s2.transitions().isEmpty());
- QCOMPARE(s21->transitions().count(), 1);
- QCOMPARE(s21->transitions().first(), t3);
-}
-
-class MyState : public QState
-{
- Q_OBJECT
-public:
- MyState(QState *parent = 0)
- : QState(parent)
- {
-
- }
-
- void emitPrivateSignals()
- {
- // These deliberately do not compile
-// emit entered();
-// emit exited();
-//
-// emit entered(QPrivateSignal());
-// emit exited(QPrivateSignal());
-//
-// emit entered(QAbstractState::QPrivateSignal());
-// emit exited(QAbstractState::QPrivateSignal());
- }
-
-};
-
-class MyTransition : public QSignalTransition
-{
- Q_OBJECT
-public:
- MyTransition(QObject * sender, const char * signal, QState *sourceState = 0)
- : QSignalTransition(sender, signal, sourceState)
- {
-
- }
-
- void emitPrivateSignals()
- {
- // These deliberately do not compile
-// emit triggered();
-//
-// emit triggered(QPrivateSignal());
-//
-// emit triggered(QAbstractTransition::QPrivateSignal());
- }
-};
-
-class SignalConnectionTester : public QObject
-{
- Q_OBJECT
-public:
- SignalConnectionTester(QObject *parent = 0)
- : QObject(parent), testPassed(false)
- {
-
- }
-
-public Q_SLOTS:
- void testSlot()
- {
- testPassed = true;
- }
-
-public:
- bool testPassed;
-};
-
-class TestTrigger : public QObject
-{
- Q_OBJECT
-public:
- TestTrigger(QObject *parent = 0)
- : QObject(parent)
- {
-
- }
-
- void emitTrigger()
- {
- emit trigger();
- }
-
-signals:
- void trigger();
-};
-
-void tst_QState::privateSignals()
-{
- QStateMachine machine;
-
- QState *s1 = new QState(&machine);
- MyState *s2 = new MyState(&machine);
-
- TestTrigger testTrigger;
-
- MyTransition *t1 = new MyTransition(&testTrigger, SIGNAL(trigger()), s1);
- s1->addTransition(t1);
- t1->setTargetState(s2);
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
-
- SignalConnectionTester s1Tester;
- SignalConnectionTester s2Tester;
- SignalConnectionTester t1Tester;
-
- QObject::connect(s1, &QState::exited, &s1Tester, &SignalConnectionTester::testSlot);
- QObject::connect(s2, &QState::entered, &s2Tester, &SignalConnectionTester::testSlot);
- QObject::connect(t1, &QSignalTransition::triggered, &t1Tester, &SignalConnectionTester::testSlot);
-
- testTrigger.emitTrigger();
-
- QCoreApplication::processEvents();
-
- QVERIFY(s1Tester.testPassed);
- QVERIFY(s2Tester.testPassed);
- QVERIFY(t1Tester.testPassed);
-
-}
-
-void tst_QState::parallelStateAndInitialState()
-{
- QStateMachine machine;
-
- { // setting an initial state on a parallel state:
- QState a(QState::ParallelStates, &machine);
- QState b(&a);
- QVERIFY(!a.initialState());
- const QString warning
- = QString::asprintf("QState::setInitialState: ignoring attempt to set initial state of parallel state group %p", &a);
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
- a.setInitialState(&b); // should produce a warning and do nothing.
- QVERIFY(!a.initialState());
- }
-
- { // setting the child-mode from ExclusiveStates to ParallelStates should remove the initial state:
- QState a(QState::ExclusiveStates, &machine);
- QState b(&a);
- a.setInitialState(&b);
- QCOMPARE(a.initialState(), &b);
- const QString warning
- = QString::asprintf("QState::setChildMode: setting the child-mode of state %p to "
- "parallel removes the initial state", &a);
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
- a.setChildMode(QState::ParallelStates); // should produce a warning and remove the initial state
- QVERIFY(!a.initialState());
- QCOMPARE(a.childMode(), QState::ParallelStates);
- }
-}
-
-QTEST_MAIN(tst_QState)
-#include "tst_qstate.moc"
diff --git a/tests/auto/corelib/statemachine/qstatemachine/CMakeLists.txt b/tests/auto/corelib/statemachine/qstatemachine/CMakeLists.txt
deleted file mode 100644
index 8cbe69dfdf..0000000000
--- a/tests/auto/corelib/statemachine/qstatemachine/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# Generated from qstatemachine.pro.
-
-#####################################################################
-## tst_qstatemachine Test:
-#####################################################################
-
-qt_add_test(tst_qstatemachine
- SOURCES
- tst_qstatemachine.cpp
- PUBLIC_LIBRARIES
- Qt::CorePrivate
-)
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(tst_qstatemachine CONDITION TARGET Qt::Widgets
- PUBLIC_LIBRARIES
- Qt::Widgets
-)
diff --git a/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro b/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro
deleted file mode 100644
index 4f16b2a9ca..0000000000
--- a/tests/auto/corelib/statemachine/qstatemachine/qstatemachine.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qstatemachine
-QT = core-private testlib
-qtHaveModule(widgets): QT += widgets
-SOURCES = tst_qstatemachine.cpp
diff --git a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
deleted file mode 100644
index d898d37bda..0000000000
--- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
+++ /dev/null
@@ -1,6868 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QtCore/QCoreApplication>
-#ifndef QT_NO_WIDGETS
-#include <QtWidgets/QPushButton>
-#include <QtWidgets/QGraphicsScene>
-#include <QtWidgets/QGraphicsSceneEvent>
-#include <QtWidgets/QGraphicsTextItem>
-#endif
-
-#include "qstatemachine.h"
-#include "qstate.h"
-#include "qhistorystate.h"
-#ifndef QT_NO_WIDGETS
-#include "qkeyeventtransition.h"
-#include "qmouseeventtransition.h"
-#endif
-#include "private/qstate_p.h"
-#include "private/qstatemachine_p.h"
-
-static int globalTick;
-
-// Run exec for a maximum of TIMEOUT msecs
-#define QCOREAPPLICATION_EXEC(TIMEOUT) \
-{ \
- QTimer timer; \
- timer.setSingleShot(true); \
- timer.setInterval(TIMEOUT); \
- timer.start(); \
- connect(&timer, SIGNAL(timeout()), QCoreApplication::instance(), SLOT(quit())); \
- QCoreApplication::exec(); \
-}
-
-#define TEST_RUNNING_CHANGED(RUNNING) \
-{ \
- QTRY_COMPARE(runningSpy.count(), 1); \
- QList<QVariant> runningArgs = runningSpy.takeFirst(); \
- QVERIFY(runningArgs.at(0).type() == QVariant::Bool); \
- QVERIFY(runningArgs.at(0).toBool() == RUNNING); \
- QCOMPARE(machine.isRunning(), runningArgs.at(0).toBool()); \
-}
-
-#define TEST_RUNNING_CHANGED_STARTED_STOPPED \
-{ \
- QTRY_COMPARE(runningSpy.count(), 2); \
- QList<QVariant> runningArgs = runningSpy.takeFirst(); \
- QVERIFY(runningArgs.at(0).type() == QVariant::Bool); \
- QVERIFY(runningArgs.at(0).toBool() == true); \
- runningArgs = runningSpy.takeFirst(); \
- QVERIFY(runningArgs.at(0).type() == QVariant::Bool); \
- QVERIFY(runningArgs.at(0).toBool() == false); \
- QCOMPARE(machine.isRunning(), runningArgs.at(0).toBool()); \
-}
-
-#define DEFINE_ACTIVE_SPY(VAR) \
- QSignalSpy VAR##_activeSpy(VAR, &QState::activeChanged); \
- QVERIFY(VAR##_activeSpy.isValid());
-
-#define TEST_ACTIVE_CHANGED(VAR, COUNT) \
-{ \
- QTRY_COMPARE(VAR##_activeSpy.count(), COUNT); \
- bool active = true; \
- foreach (const QList<QVariant> &activeArgs, static_cast<QList<QList<QVariant> > >(VAR##_activeSpy)) { \
- QVERIFY(activeArgs.at(0).type() == QVariant::Bool); \
- QVERIFY(activeArgs.at(0).toBool() == active); \
- active = !active; \
- } \
- QCOMPARE(VAR->active(), !active); \
-}
-
-class SignalEmitter : public QObject
-{
-Q_OBJECT
- public:
- SignalEmitter(QObject *parent = 0)
- : QObject(parent) {}
-public Q_SLOTS:
- void emitSignalWithNoArg()
- { emit signalWithNoArg(); }
- void emitSignalWithIntArg(int arg)
- { emit signalWithIntArg(arg); }
- void emitSignalWithStringArg(const QString &arg)
- { emit signalWithStringArg(arg); }
- void emitSignalWithDefaultArg()
- { emit signalWithDefaultArg(); }
-Q_SIGNALS:
- void signalWithNoArg();
- void signalWithIntArg(int);
- void signalWithStringArg(const QString &);
- void signalWithDefaultArg(int i = 42);
-};
-
-class tst_QStateMachine : public QObject
-{
- Q_OBJECT
-private slots:
- void rootState();
- void machineWithParent();
-#ifdef QT_BUILD_INTERNAL
- void addAndRemoveState();
-#endif
- void stateEntryAndExit();
- void assignProperty();
- void assignPropertyWithAnimation();
- void postEvent();
- void cancelDelayedEvent();
- void postDelayedEventAndStop();
- void postDelayedEventFromThread();
- void stopAndPostEvent();
- void stateFinished();
- void parallelStates();
- void parallelRootState();
- void allSourceToTargetConfigurations();
- void signalTransitions();
-#ifndef QT_NO_WIDGETS
- void eventTransitions();
- void graphicsSceneEventTransitions();
-#endif
- void historyStates();
- void startAndStop();
- void setRunning();
- void targetStateWithNoParent();
- void targetStateDeleted();
- void transitionToRootState();
- void transitionFromRootState();
- void transitionEntersParent();
-
- void defaultErrorState();
- void customGlobalErrorState();
- void customLocalErrorStateInBrokenState();
- void customLocalErrorStateInOtherState();
- void customLocalErrorStateInParentOfBrokenState();
- void customLocalErrorStateOverridesParent();
- void errorStateHasChildren();
- void errorStateHasErrors();
- void errorStateIsRootState();
- void errorStateEntersParentFirst();
- void customErrorStateIsNull();
- void clearError();
- void historyStateHasNowhereToGo();
- void historyStateAsInitialState();
- void historyStateAfterRestart();
- void brokenStateIsNeverEntered();
- void customErrorStateNotInGraph();
- void transitionToStateNotInGraph();
- void restoreProperties();
-
- void defaultGlobalRestorePolicy();
- void globalRestorePolicySetToRestore();
- void globalRestorePolicySetToDontRestore();
-
- void noInitialStateForInitialState();
-
- void transitionWithParent();
- void transitionsFromParallelStateWithNoChildren();
- void parallelStateTransition();
- void parallelStateAssignmentsDone();
- void nestedRestoreProperties();
- void nestedRestoreProperties2();
-
- void simpleAnimation();
- void twoAnimations();
- void twoAnimatedTransitions();
- void playAnimationTwice();
- void nestedTargetStateForAnimation();
- void propertiesAssignedSignalTransitionsReuseAnimationGroup();
- void animatedGlobalRestoreProperty();
- void specificTargetValueOfAnimation();
-
- void addDefaultAnimation();
- void addDefaultAnimationWithUnusedAnimation();
- void removeDefaultAnimation();
- void overrideDefaultAnimationWithSpecific();
-
- void nestedStateMachines();
- void goToState();
- void goToStateFromSourceWithTransition();
-
- void clonedSignals();
- void postEventFromOtherThread();
-#ifndef QT_NO_WIDGETS
- void eventFilterForApplication();
-#endif
- void eventClassesExported();
- void stopInTransitionToFinalState();
- void stopInEventTest_data();
- void stopInEventTest();
-
- void testIncrementReceivers();
- void initialStateIsEnteredBeforeStartedEmitted();
- void deletePropertyAssignmentObjectBeforeEntry();
- void deletePropertyAssignmentObjectBeforeRestore();
- void deleteInitialState();
- void setPropertyAfterRestore();
- void transitionWithNoTarget_data();
- void transitionWithNoTarget();
- void initialStateIsFinal();
-
- void restorePropertiesSimple();
- void restoreProperties2();
- void restoreProperties3();
- void restoreProperties4();
- void restorePropertiesSelfTransition();
- void changeStateWhileAnimatingProperty();
- void propertiesAreAssignedBeforeEntryCallbacks_data();
- void propertiesAreAssignedBeforeEntryCallbacks();
-
- void multiTargetTransitionInsideParallelStateGroup();
- void signalTransitionNormalizeSignature();
-#ifdef Q_COMPILER_DELEGATING_CONSTRUCTORS
- void createPointerToMemberSignalTransition();
-#endif
- void createSignalTransitionWhenRunning();
- void createEventTransitionWhenRunning();
- void signalTransitionSenderInDifferentThread();
- void signalTransitionSenderInDifferentThread2();
- void signalTransitionRegistrationThreadSafety();
- void childModeConstructor();
-
- void qtbug_44963();
- void qtbug_44783();
- void internalTransition();
- void conflictingTransition();
- void conflictingTransition2();
- void qtbug_46059();
- void qtbug_46703();
- void postEventFromBeginSelectTransitions();
- void dontProcessSlotsWhenMachineIsNotRunning();
-
- void cancelDelayedEventWithChrono();
- void postDelayedEventWithChronoAndStop();
- void postDelayedEventWithChronoFromThread();
-};
-
-class TestState : public QState
-{
-public:
- enum Event {
- Entry,
- Exit
- };
- TestState(QState *parent, const QString &objectName = QString())
- : QState(parent)
- { setObjectName(objectName); }
- TestState(ChildMode mode, const QString &objectName = QString())
- : QState(mode)
- { setObjectName(objectName); }
- QList<QPair<int, Event> > events;
-protected:
- virtual void onEntry(QEvent *) {
- events.append(qMakePair(globalTick++, Entry));
- }
- virtual void onExit(QEvent *) {
- events.append(qMakePair(globalTick++, Exit));
- }
-};
-
-class TestTransition : public QAbstractTransition
-{
-public:
- TestTransition(QAbstractState *target, const QString &objectName = QString())
- : QAbstractTransition()
- { setTargetState(target); setObjectName(objectName); }
- QList<int> triggers;
-protected:
- virtual bool eventTest(QEvent *) {
- return true;
- }
- virtual void onTransition(QEvent *) {
- triggers.append(globalTick++);
- }
-};
-
-class EventTransition : public QAbstractTransition
-{
-public:
- EventTransition(QEvent::Type type, QAbstractState *target, QState *parent = 0)
- : QAbstractTransition(parent), m_type(type)
- { setTargetState(target); }
- EventTransition(QEvent::Type type, const QList<QAbstractState *> &targets, QState *parent = 0)
- : QAbstractTransition(parent), m_type(type)
- { setTargetStates(targets); }
-protected:
- virtual bool eventTest(QEvent *e) {
- return (e->type() == m_type);
- }
- virtual void onTransition(QEvent *) {}
-private:
- QEvent::Type m_type;
-};
-
-void tst_QStateMachine::transitionToRootState()
-{
- QStateMachine machine;
- machine.setObjectName("machine");
-
- QState *initialState = new QState();
- DEFINE_ACTIVE_SPY(initialState);
- initialState->setObjectName("initial");
- machine.addState(initialState);
- machine.setInitialState(initialState);
-
- QAbstractTransition *trans = new EventTransition(QEvent::User, &machine);
- initialState->addTransition(trans);
- QCOMPARE(trans->sourceState(), initialState);
- QCOMPARE(trans->targetState(), static_cast<QAbstractState *>(&machine));
-
- machine.start();
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(initialState));
- TEST_ACTIVE_CHANGED(initialState, 1);
-
- machine.postEvent(new QEvent(QEvent::User));
- QTest::ignoreMessage(QtWarningMsg,
- "Unrecoverable error detected in running state machine: "
- "Child mode of state machine 'machine' is not 'ExclusiveStates'.");
- QCoreApplication::processEvents();
- QVERIFY(machine.configuration().isEmpty());
- QVERIFY(!machine.isRunning());
- TEST_ACTIVE_CHANGED(initialState, 2);
-}
-
-void tst_QStateMachine::transitionFromRootState()
-{
- QStateMachine machine;
- QState *root = &machine;
- QState *s1 = new QState(root);
- EventTransition *trans = new EventTransition(QEvent::User, s1);
- root->addTransition(trans);
- QCOMPARE(trans->sourceState(), root);
- QCOMPARE(trans->targetState(), static_cast<QAbstractState *>(s1));
-}
-
-void tst_QStateMachine::transitionEntersParent()
-{
- QStateMachine machine;
-
- QObject *entryController = new QObject(&machine);
- entryController->setObjectName("entryController");
- entryController->setProperty("greatGrandParentEntered", false);
- entryController->setProperty("grandParentEntered", false);
- entryController->setProperty("parentEntered", false);
- entryController->setProperty("stateEntered", false);
-
- QState *greatGrandParent = new QState();
- greatGrandParent->setObjectName("grandParent");
- greatGrandParent->assignProperty(entryController, "greatGrandParentEntered", true);
- machine.addState(greatGrandParent);
- machine.setInitialState(greatGrandParent);
-
- QState *grandParent = new QState(greatGrandParent);
- grandParent->setObjectName("grandParent");
- grandParent->assignProperty(entryController, "grandParentEntered", true);
-
- QState *parent = new QState(grandParent);
- parent->setObjectName("parent");
- parent->assignProperty(entryController, "parentEntered", true);
-
- QState *state = new QState(parent);
- state->setObjectName("state");
- state->assignProperty(entryController, "stateEntered", true);
-
- QState *initialStateOfGreatGrandParent = new QState(greatGrandParent);
- initialStateOfGreatGrandParent->setObjectName("initialStateOfGreatGrandParent");
- greatGrandParent->setInitialState(initialStateOfGreatGrandParent);
-
- initialStateOfGreatGrandParent->addTransition(new EventTransition(QEvent::User, state));
-
- machine.start();
- QCoreApplication::processEvents();
-
- QCOMPARE(entryController->property("greatGrandParentEntered").toBool(), true);
- QCOMPARE(entryController->property("grandParentEntered").toBool(), false);
- QCOMPARE(entryController->property("parentEntered").toBool(), false);
- QCOMPARE(entryController->property("stateEntered").toBool(), false);
- QCOMPARE(machine.configuration().count(), 2);
- QVERIFY(machine.configuration().contains(greatGrandParent));
- QVERIFY(machine.configuration().contains(initialStateOfGreatGrandParent));
-
- entryController->setProperty("greatGrandParentEntered", false);
- entryController->setProperty("grandParentEntered", false);
- entryController->setProperty("parentEntered", false);
- entryController->setProperty("stateEntered", false);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- QCOMPARE(entryController->property("greatGrandParentEntered").toBool(), false);
- QCOMPARE(entryController->property("grandParentEntered").toBool(), true);
- QCOMPARE(entryController->property("parentEntered").toBool(), true);
- QCOMPARE(entryController->property("stateEntered").toBool(), true);
- QCOMPARE(machine.configuration().count(), 4);
- QVERIFY(machine.configuration().contains(greatGrandParent));
- QVERIFY(machine.configuration().contains(grandParent));
- QVERIFY(machine.configuration().contains(parent));
- QVERIFY(machine.configuration().contains(state));
-}
-
-void tst_QStateMachine::defaultErrorState()
-{
- QStateMachine machine;
- QCOMPARE(machine.errorState(), reinterpret_cast<QAbstractState *>(0));
-
- QState *brokenState = new QState();
- brokenState->setObjectName("MyInitialState");
-
- machine.addState(brokenState);
- machine.setInitialState(brokenState);
-
- QState *childState = new QState(brokenState);
- childState->setObjectName("childState");
-
- QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: Missing initial state in compound state 'MyInitialState'");
-
- // initialState has no initial state
- machine.start();
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.error(), QStateMachine::NoInitialStateError);
- QCOMPARE(machine.errorString(), QString::fromLatin1("Missing initial state in compound state 'MyInitialState'"));
- QCOMPARE(machine.isRunning(), false);
-}
-
-class CustomErrorState: public QState
-{
-public:
- CustomErrorState(QStateMachine *machine, QState *parent = 0)
- : QState(parent), error(QStateMachine::NoError), m_machine(machine)
- {
- }
-
- void onEntry(QEvent *)
- {
- error = m_machine->error();
- errorString = m_machine->errorString();
- }
-
- QStateMachine::Error error;
- QString errorString;
-
-private:
- QStateMachine *m_machine;
-};
-
-void tst_QStateMachine::customGlobalErrorState()
-{
- QStateMachine machine;
-
- CustomErrorState *customErrorState = new CustomErrorState(&machine);
- customErrorState->setObjectName("customErrorState");
- machine.addState(customErrorState);
- machine.setErrorState(customErrorState);
-
- QState *initialState = new QState();
- initialState->setObjectName("initialState");
- machine.addState(initialState);
- machine.setInitialState(initialState);
-
- QState *brokenState = new QState();
- brokenState->setObjectName("brokenState");
- machine.addState(brokenState);
- QState *childState = new QState(brokenState);
- childState->setObjectName("childState");
-
- initialState->addTransition(new EventTransition(QEvent::Type(QEvent::User + 1), brokenState));
- machine.start();
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.errorState(), static_cast<QAbstractState*>(customErrorState));
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(initialState));
-
- machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1)));
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(initialState));
-
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.isRunning(), true);
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(customErrorState));
- QCOMPARE(customErrorState->error, QStateMachine::NoInitialStateError);
- QCOMPARE(customErrorState->errorString, QString::fromLatin1("Missing initial state in compound state 'brokenState'"));
- QCOMPARE(machine.error(), QStateMachine::NoInitialStateError);
- QCOMPARE(machine.errorString(), QString::fromLatin1("Missing initial state in compound state 'brokenState'"));
-}
-
-void tst_QStateMachine::customLocalErrorStateInBrokenState()
-{
- QStateMachine machine;
- CustomErrorState *customErrorState = new CustomErrorState(&machine);
- machine.addState(customErrorState);
-
- QState *initialState = new QState();
- initialState->setObjectName("initialState");
- machine.addState(initialState);
- machine.setInitialState(initialState);
-
- QState *brokenState = new QState();
- brokenState->setObjectName("brokenState");
- machine.addState(brokenState);
- brokenState->setErrorState(customErrorState);
-
- QState *childState = new QState(brokenState);
- childState->setObjectName("childState");
-
- initialState->addTransition(new EventTransition(QEvent::Type(QEvent::User + 1), brokenState));
-
- machine.start();
- QCoreApplication::processEvents();
-
- machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1)));
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.isRunning(), true);
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(customErrorState));
- QCOMPARE(customErrorState->error, QStateMachine::NoInitialStateError);
-}
-
-void tst_QStateMachine::customLocalErrorStateInOtherState()
-{
- QStateMachine machine;
- CustomErrorState *customErrorState = new CustomErrorState(&machine);
- machine.addState(customErrorState);
-
- QState *initialState = new QState();
- initialState->setObjectName("initialState");
- QTest::ignoreMessage(QtWarningMsg, "QState::setErrorState: error state cannot belong to a different state machine");
- initialState->setErrorState(customErrorState);
- machine.addState(initialState);
- machine.setInitialState(initialState);
-
- QState *brokenState = new QState();
- brokenState->setObjectName("brokenState");
-
- machine.addState(brokenState);
-
- QState *childState = new QState(brokenState);
- childState->setObjectName("childState");
-
- initialState->addTransition(new EventTransition(QEvent::Type(QEvent::User + 1), brokenState));
-
- QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: Missing initial state in compound state 'brokenState'");
- machine.start();
- QCoreApplication::processEvents();
-
- machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1)));
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.isRunning(), false);
-}
-
-void tst_QStateMachine::customLocalErrorStateInParentOfBrokenState()
-{
- QStateMachine machine;
- CustomErrorState *customErrorState = new CustomErrorState(&machine);
- machine.addState(customErrorState);
-
- QState *initialState = new QState();
- initialState->setObjectName("initialState");
- machine.addState(initialState);
- machine.setInitialState(initialState);
-
- QState *parentOfBrokenState = new QState();
- machine.addState(parentOfBrokenState);
- parentOfBrokenState->setObjectName("parentOfBrokenState");
- parentOfBrokenState->setErrorState(customErrorState);
-
- QState *brokenState = new QState(parentOfBrokenState);
- brokenState->setObjectName("brokenState");
- parentOfBrokenState->setInitialState(brokenState);
-
- QState *childState = new QState(brokenState);
- childState->setObjectName("childState");
-
- initialState->addTransition(new EventTransition(QEvent::Type(QEvent::User + 1), brokenState));
-
- machine.start();
- QCoreApplication::processEvents();
-
- machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1)));
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.isRunning(), true);
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(customErrorState));
-}
-
-void tst_QStateMachine::customLocalErrorStateOverridesParent()
-{
- QStateMachine machine;
- CustomErrorState *customErrorStateForParent = new CustomErrorState(&machine);
- machine.addState(customErrorStateForParent);
-
- CustomErrorState *customErrorStateForBrokenState = new CustomErrorState(&machine);
- machine.addState(customErrorStateForBrokenState);
-
- QState *initialState = new QState();
- initialState->setObjectName("initialState");
- machine.addState(initialState);
- machine.setInitialState(initialState);
-
- QState *parentOfBrokenState = new QState();
- machine.addState(parentOfBrokenState);
- parentOfBrokenState->setObjectName("parentOfBrokenState");
- parentOfBrokenState->setErrorState(customErrorStateForParent);
-
- QState *brokenState = new QState(parentOfBrokenState);
- brokenState->setObjectName("brokenState");
- brokenState->setErrorState(customErrorStateForBrokenState);
- parentOfBrokenState->setInitialState(brokenState);
-
- QState *childState = new QState(brokenState);
- childState->setObjectName("childState");
-
- initialState->addTransition(new EventTransition(QEvent::Type(QEvent::User + 1), brokenState));
-
- machine.start();
- QCoreApplication::processEvents();
-
- machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1)));
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(customErrorStateForBrokenState));
- QCOMPARE(customErrorStateForBrokenState->error, QStateMachine::NoInitialStateError);
- QCOMPARE(customErrorStateForParent->error, QStateMachine::NoError);
-}
-
-void tst_QStateMachine::errorStateHasChildren()
-{
- QStateMachine machine;
- CustomErrorState *customErrorState = new CustomErrorState(&machine);
- customErrorState->setObjectName("customErrorState");
- machine.addState(customErrorState);
-
- machine.setErrorState(customErrorState);
-
- QState *childOfErrorState = new QState(customErrorState);
- childOfErrorState->setObjectName("childOfErrorState");
- customErrorState->setInitialState(childOfErrorState);
-
- QState *initialState = new QState();
- initialState->setObjectName("initialState");
- machine.addState(initialState);
- machine.setInitialState(initialState);
-
- QState *brokenState = new QState();
- brokenState->setObjectName("brokenState");
- machine.addState(brokenState);
-
- QState *childState = new QState(brokenState);
- childState->setObjectName("childState");
-
- initialState->addTransition(new EventTransition(QEvent::Type(QEvent::User + 1), brokenState));
-
- machine.start();
- QCoreApplication::processEvents();
-
- machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1)));
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.isRunning(), true);
- QCOMPARE(machine.configuration().count(), 2);
- QVERIFY(machine.configuration().contains(customErrorState));
- QVERIFY(machine.configuration().contains(childOfErrorState));
-}
-
-
-void tst_QStateMachine::errorStateHasErrors()
-{
- QStateMachine machine;
- CustomErrorState *customErrorState = new CustomErrorState(&machine);
- customErrorState->setObjectName("customErrorState");
- machine.addState(customErrorState);
-
- machine.setErrorState(customErrorState);
-
- QState *childOfErrorState = new QState(customErrorState);
- childOfErrorState->setObjectName("childOfErrorState");
-
- QState *initialState = new QState();
- initialState->setObjectName("initialState");
- machine.addState(initialState);
- machine.setInitialState(initialState);
-
- QState *brokenState = new QState();
- brokenState->setObjectName("brokenState");
- machine.addState(brokenState);
-
- QState *childState = new QState(brokenState);
- childState->setObjectName("childState");
-
- initialState->addTransition(new EventTransition(QEvent::Type(QEvent::User + 1), brokenState));
-
- machine.start();
- QCoreApplication::processEvents();
-
- machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1)));
- QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: Missing initial state in compound state 'customErrorState'");
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.isRunning(), false);
- QCOMPARE(machine.error(), QStateMachine::NoInitialStateError);
- QCOMPARE(machine.errorString(), QString::fromLatin1("Missing initial state in compound state 'customErrorState'"));
-}
-
-void tst_QStateMachine::errorStateIsRootState()
-{
- QStateMachine machine;
- QTest::ignoreMessage(QtWarningMsg, "QStateMachine::setErrorState: root state cannot be error state");
- machine.setErrorState(&machine);
-
- QState *initialState = new QState();
- initialState->setObjectName("initialState");
- machine.addState(initialState);
- machine.setInitialState(initialState);
-
- QState *brokenState = new QState();
- brokenState->setObjectName("brokenState");
- machine.addState(brokenState);
-
- QState *childState = new QState(brokenState);
- childState->setObjectName("childState");
-
- initialState->addTransition(new EventTransition(QEvent::Type(QEvent::User + 1), brokenState));
-
- machine.start();
- QCoreApplication::processEvents();
-
- machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1)));
- QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: Missing initial state in compound state 'brokenState'");
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.isRunning(), false);
-}
-
-void tst_QStateMachine::errorStateEntersParentFirst()
-{
- QStateMachine machine;
-
- QObject *entryController = new QObject(&machine);
- entryController->setObjectName("entryController");
- entryController->setProperty("greatGrandParentEntered", false);
- entryController->setProperty("grandParentEntered", false);
- entryController->setProperty("parentEntered", false);
- entryController->setProperty("errorStateEntered", false);
-
- QState *greatGrandParent = new QState();
- greatGrandParent->setObjectName("greatGrandParent");
- greatGrandParent->assignProperty(entryController, "greatGrandParentEntered", true);
- machine.addState(greatGrandParent);
- machine.setInitialState(greatGrandParent);
-
- QState *grandParent = new QState(greatGrandParent);
- grandParent->setObjectName("grandParent");
- grandParent->assignProperty(entryController, "grandParentEntered", true);
-
- QState *parent = new QState(grandParent);
- parent->setObjectName("parent");
- parent->assignProperty(entryController, "parentEntered", true);
-
- QState *errorState = new QState(parent);
- errorState->setObjectName("errorState");
- errorState->assignProperty(entryController, "errorStateEntered", true);
- machine.setErrorState(errorState);
-
- QState *initialStateOfGreatGrandParent = new QState(greatGrandParent);
- initialStateOfGreatGrandParent->setObjectName("initialStateOfGreatGrandParent");
- greatGrandParent->setInitialState(initialStateOfGreatGrandParent);
-
- QState *brokenState = new QState(greatGrandParent);
- brokenState->setObjectName("brokenState");
-
- QState *childState = new QState(brokenState);
- childState->setObjectName("childState");
-
- initialStateOfGreatGrandParent->addTransition(new EventTransition(QEvent::User, brokenState));
-
- machine.start();
- QCoreApplication::processEvents();
-
- QCOMPARE(entryController->property("greatGrandParentEntered").toBool(), true);
- QCOMPARE(entryController->property("grandParentEntered").toBool(), false);
- QCOMPARE(entryController->property("parentEntered").toBool(), false);
- QCOMPARE(entryController->property("errorStateEntered").toBool(), false);
- QCOMPARE(machine.configuration().count(), 2);
- QVERIFY(machine.configuration().contains(greatGrandParent));
- QVERIFY(machine.configuration().contains(initialStateOfGreatGrandParent));
-
- entryController->setProperty("greatGrandParentEntered", false);
- entryController->setProperty("grandParentEntered", false);
- entryController->setProperty("parentEntered", false);
- entryController->setProperty("errorStateEntered", false);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- QCOMPARE(entryController->property("greatGrandParentEntered").toBool(), false);
- QCOMPARE(entryController->property("grandParentEntered").toBool(), true);
- QCOMPARE(entryController->property("parentEntered").toBool(), true);
- QCOMPARE(entryController->property("errorStateEntered").toBool(), true);
- QCOMPARE(machine.configuration().count(), 4);
- QVERIFY(machine.configuration().contains(greatGrandParent));
- QVERIFY(machine.configuration().contains(grandParent));
- QVERIFY(machine.configuration().contains(parent));
- QVERIFY(machine.configuration().contains(errorState));
-}
-
-void tst_QStateMachine::customErrorStateIsNull()
-{
- QStateMachine machine;
- machine.setErrorState(0);
-
- QState *initialState = new QState();
- machine.addState(initialState);
- machine.setInitialState(initialState);
-
- QState *brokenState = new QState();
- machine.addState(brokenState);
-
- new QState(brokenState);
- initialState->addTransition(new EventTransition(QEvent::User, brokenState));
-
- machine.start();
- QCoreApplication::processEvents();
-
- machine.postEvent(new QEvent(QEvent::User));
- QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: Missing initial state in compound state ''");
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.errorState(), reinterpret_cast<QAbstractState *>(0));
- QCOMPARE(machine.isRunning(), false);
-}
-
-void tst_QStateMachine::clearError()
-{
- QStateMachine machine;
- machine.setErrorState(new QState(&machine)); // avoid warnings
-
- QState *brokenState = new QState(&machine);
- brokenState->setObjectName("brokenState");
- machine.setInitialState(brokenState);
- new QState(brokenState);
-
- machine.start();
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.isRunning(), true);
- QCOMPARE(machine.error(), QStateMachine::NoInitialStateError);
- QCOMPARE(machine.errorString(), QString::fromLatin1("Missing initial state in compound state 'brokenState'"));
-
- machine.clearError();
-
- QCOMPARE(machine.error(), QStateMachine::NoError);
- QVERIFY(machine.errorString().isEmpty());
-}
-
-void tst_QStateMachine::historyStateAsInitialState()
-{
- QStateMachine machine;
-
- QHistoryState *hs = new QHistoryState(&machine);
- machine.setInitialState(hs);
-
- QState *s1 = new QState(&machine);
- hs->setDefaultState(s1);
-
- QState *s2 = new QState(&machine);
-
- QHistoryState *s2h = new QHistoryState(s2);
- s2->setInitialState(s2h);
-
- QState *s21 = new QState(s2);
- s2h->setDefaultState(s21);
-
- s1->addTransition(new EventTransition(QEvent::User, s2));
-
- machine.start();
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.configuration().size(), 2);
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s21));
-}
-
-void tst_QStateMachine::historyStateHasNowhereToGo()
-{
- QStateMachine machine;
-
- QState *initialState = new QState(&machine);
- initialState->setObjectName("initialState");
- machine.setInitialState(initialState);
- QState *errorState = new QState(&machine);
- errorState->setObjectName("errorState");
- machine.setErrorState(errorState); // avoid warnings
-
- QState *brokenState = new QState(&machine);
- brokenState->setObjectName("brokenState");
- brokenState->setInitialState(new QState(brokenState));
-
- QHistoryState *historyState = new QHistoryState(brokenState);
- historyState->setObjectName("historyState");
- EventTransition *t = new EventTransition(QEvent::User, historyState);
- t->setObjectName("initialState->historyState");
- initialState->addTransition(t);
-
- machine.start();
- QCoreApplication::processEvents();
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.isRunning(), true);
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(machine.errorState()));
- QCOMPARE(machine.error(), QStateMachine::NoDefaultStateInHistoryStateError);
- QCOMPARE(machine.errorString(), QString::fromLatin1("Missing default state in history state 'historyState'"));
-}
-
-void tst_QStateMachine::historyStateAfterRestart()
-{
- // QTBUG-8842
- QStateMachine machine;
-
- QState *s1 = new QState(&machine);
- machine.setInitialState(s1);
- QState *s2 = new QState(&machine);
- QState *s21 = new QState(s2);
- QState *s22 = new QState(s2);
- QHistoryState *s2h = new QHistoryState(s2);
- s2h->setDefaultState(s21);
- s1->addTransition(new EventTransition(QEvent::User, s2h));
- s21->addTransition(new EventTransition(QEvent::User, s22));
- s2->addTransition(new EventTransition(QEvent::User, s1));
-
- for (int x = 0; x < 2; ++x) {
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QVERIFY(startedSpy.isValid());
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 1);
- TEST_RUNNING_CHANGED(true);
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- // s1 -> s2h -> s21 (default state)
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().count(), 2);
- QVERIFY(machine.configuration().contains(s2));
- // This used to fail on the 2nd run because the
- // history had not been cleared.
- QVERIFY(machine.configuration().contains(s21));
-
- // s21 -> s22
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().count(), 2);
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s22));
-
- // s2 -> s1 (s22 saved in s2h)
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- // s1 -> s2h -> s22 (saved state)
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().count(), 2);
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s22));
-
- QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
- QVERIFY(stoppedSpy.isValid());
- machine.stop();
- QTRY_COMPARE(stoppedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
- }
-}
-
-void tst_QStateMachine::brokenStateIsNeverEntered()
-{
- QStateMachine machine;
-
- QObject *entryController = new QObject(&machine);
- entryController->setProperty("brokenStateEntered", false);
- entryController->setProperty("childStateEntered", false);
- entryController->setProperty("errorStateEntered", false);
-
- QState *initialState = new QState(&machine);
- machine.setInitialState(initialState);
-
- QState *errorState = new QState(&machine);
- errorState->assignProperty(entryController, "errorStateEntered", true);
- machine.setErrorState(errorState);
-
- QState *brokenState = new QState(&machine);
- brokenState->assignProperty(entryController, "brokenStateEntered", true);
- brokenState->setObjectName("brokenState");
-
- QState *childState = new QState(brokenState);
- childState->assignProperty(entryController, "childStateEntered", true);
-
- initialState->addTransition(new EventTransition(QEvent::User, brokenState));
-
- machine.start();
- QCoreApplication::processEvents();
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- QCOMPARE(entryController->property("errorStateEntered").toBool(), true);
- QCOMPARE(entryController->property("brokenStateEntered").toBool(), false);
- QCOMPARE(entryController->property("childStateEntered").toBool(), false);
-}
-
-void tst_QStateMachine::transitionToStateNotInGraph()
-{
- QStateMachine machine;
-
- QState *initialState = new QState(&machine);
- initialState->setObjectName("initialState");
- machine.setInitialState(initialState);
-
- QState independentState;
- independentState.setObjectName("independentState");
- initialState->addTransition(&independentState);
-
- machine.start();
- QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: "
- "Child mode of state machine '' is not 'ExclusiveStates'.");
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.isRunning(), false);
-}
-
-void tst_QStateMachine::customErrorStateNotInGraph()
-{
- QStateMachine machine;
-
- QState errorState;
- errorState.setObjectName("errorState");
- QTest::ignoreMessage(QtWarningMsg, "QState::setErrorState: error state cannot belong to a different state machine");
- machine.setErrorState(&errorState);
- QCOMPARE(machine.errorState(), reinterpret_cast<QAbstractState *>(0));
-
- QState *initialBrokenState = new QState(&machine);
- initialBrokenState->setObjectName("initialBrokenState");
- machine.setInitialState(initialBrokenState);
- new QState(initialBrokenState);
-
- machine.start();
- QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: Missing initial state in compound state 'initialBrokenState'");
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.isRunning(), false);
-}
-
-void tst_QStateMachine::restoreProperties()
-{
- QStateMachine machine;
- QCOMPARE(machine.globalRestorePolicy(), QState::DontRestoreProperties);
- machine.setGlobalRestorePolicy(QState::RestoreProperties);
-
- QObject *object = new QObject(&machine);
- object->setProperty("a", 1);
- object->setProperty("b", 2);
-
- QState *S1 = new QState();
- S1->setObjectName("S1");
- S1->assignProperty(object, "a", 3);
- machine.addState(S1);
-
- QState *S2 = new QState();
- S2->setObjectName("S2");
- S2->assignProperty(object, "b", 5);
- machine.addState(S2);
-
- QState *S3 = new QState();
- S3->setObjectName("S3");
- machine.addState(S3);
-
- QFinalState *S4 = new QFinalState();
- machine.addState(S4);
-
- S1->addTransition(new EventTransition(QEvent::User, S2));
- S2->addTransition(new EventTransition(QEvent::User, S3));
- S3->addTransition(S4);
-
- machine.setInitialState(S1);
- machine.start();
- QCoreApplication::processEvents();
-
- QCOMPARE(object->property("a").toInt(), 3);
- QCOMPARE(object->property("b").toInt(), 2);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- QCOMPARE(object->property("a").toInt(), 1);
- QCOMPARE(object->property("b").toInt(), 5);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- QCOMPARE(object->property("a").toInt(), 1);
- QCOMPARE(object->property("b").toInt(), 2);
-}
-
-void tst_QStateMachine::rootState()
-{
- QStateMachine machine;
- QCOMPARE(qobject_cast<QState*>(machine.parentState()), (QState*)0);
- QCOMPARE(machine.machine(), (QStateMachine*)0);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QCOMPARE(s1->parentState(), static_cast<QState*>(&machine));
-
- QState *s2 = new QState();
- DEFINE_ACTIVE_SPY(s2);
- s2->setParent(&machine);
- QCOMPARE(s2->parentState(), static_cast<QState*>(&machine));
- TEST_ACTIVE_CHANGED(s1, 0);
- TEST_ACTIVE_CHANGED(s2, 0);
-}
-
-void tst_QStateMachine::machineWithParent()
-{
- QObject object;
- QStateMachine *machine = new QStateMachine(&object);
- QCOMPARE(machine->parent(), &object);
- QCOMPARE(machine->parentState(), static_cast<QState*>(0));
-}
-
-#ifdef QT_BUILD_INTERNAL
-void tst_QStateMachine::addAndRemoveState()
-{
- QStateMachine machine;
- QStatePrivate *root_d = QStatePrivate::get(&machine);
- QCOMPARE(root_d->childStates().size(), 0);
-
- QTest::ignoreMessage(QtWarningMsg, "QStateMachine::addState: cannot add null state");
- machine.addState(0);
-
- QState *s1 = new QState();
- QCOMPARE(s1->parentState(), (QState*)0);
- QCOMPARE(s1->machine(), (QStateMachine*)0);
- machine.addState(s1);
- QCOMPARE(s1->machine(), static_cast<QStateMachine*>(&machine));
- QCOMPARE(s1->parentState(), static_cast<QState*>(&machine));
- QCOMPARE(root_d->childStates().size(), 1);
- QCOMPARE(root_d->childStates().at(0), (QAbstractState*)s1);
-
- QTest::ignoreMessage(QtWarningMsg, "QStateMachine::addState: state has already been added to this machine");
- machine.addState(s1);
-
- QState *s2 = new QState();
- QCOMPARE(s2->parentState(), (QState*)0);
- machine.addState(s2);
- QCOMPARE(s2->parentState(), static_cast<QState*>(&machine));
- QCOMPARE(root_d->childStates().size(), 2);
- QCOMPARE(root_d->childStates().at(0), (QAbstractState*)s1);
- QCOMPARE(root_d->childStates().at(1), (QAbstractState*)s2);
-
- QTest::ignoreMessage(QtWarningMsg, "QStateMachine::addState: state has already been added to this machine");
- machine.addState(s2);
-
- machine.removeState(s1);
- QCOMPARE(s1->parentState(), (QState*)0);
- QCOMPARE(root_d->childStates().size(), 1);
- QCOMPARE(root_d->childStates().at(0), (QAbstractState*)s2);
-
- machine.removeState(s2);
- QCOMPARE(s2->parentState(), (QState*)0);
- QCOMPARE(root_d->childStates().size(), 0);
-
- QTest::ignoreMessage(QtWarningMsg, "QStateMachine::removeState: cannot remove null state");
- machine.removeState(0);
-
- {
- QStateMachine machine2;
- {
- const QString warning
- = QString::asprintf("QStateMachine::removeState: state %p's machine (%p) is different from this machine (%p)",
- &machine2, (void*)0, &machine);
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
- machine.removeState(&machine2);
- }
- // ### check this behavior
- machine.addState(&machine2);
- QCOMPARE(machine2.parent(), (QObject*)&machine);
- }
-
- delete s1;
- delete s2;
- // ### how to deal with this?
- // machine.removeState(machine.errorState());
-}
-#endif
-
-void tst_QStateMachine::stateEntryAndExit()
-{
- // Two top-level states
- {
- QStateMachine machine;
-
- TestState *s1 = new TestState(&machine);
- QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: cannot add transition to null state");
- s1->addTransition((QAbstractState*)0);
- QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: cannot add null transition");
- s1->addTransition((QAbstractTransition*)0);
- QTest::ignoreMessage(QtWarningMsg, "QState::removeTransition: cannot remove null transition");
- s1->removeTransition((QAbstractTransition*)0);
-
- TestState *s2 = new TestState(&machine);
- QFinalState *s3 = new QFinalState(&machine);
-
- TestTransition *t = new TestTransition(s2);
- QCOMPARE(t->machine(), (QStateMachine*)0);
- QCOMPARE(t->sourceState(), (QState*)0);
- QCOMPARE(t->targetState(), (QAbstractState*)s2);
- QCOMPARE(t->targetStates().size(), 1);
- QCOMPARE(t->targetStates().at(0), (QAbstractState*)s2);
- t->setTargetState(0);
- QCOMPARE(t->targetState(), (QAbstractState*)0);
- QVERIFY(t->targetStates().isEmpty());
- t->setTargetState(s2);
- QCOMPARE(t->targetState(), (QAbstractState*)s2);
- QTest::ignoreMessage(QtWarningMsg, "QAbstractTransition::setTargetStates: target state(s) cannot be null");
- t->setTargetStates(QList<QAbstractState*>() << 0);
- QCOMPARE(t->targetState(), (QAbstractState*)s2);
- t->setTargetStates(QList<QAbstractState*>() << s2);
- QCOMPARE(t->targetState(), (QAbstractState*)s2);
- QCOMPARE(t->targetStates().size(), 1);
- QCOMPARE(t->targetStates().at(0), (QAbstractState*)s2);
- s1->addTransition(t);
- QCOMPARE(t->sourceState(), (QState*)s1);
- QCOMPARE(t->machine(), &machine);
-
- {
- QAbstractTransition *trans = s2->addTransition(s3);
- QVERIFY(trans != 0);
- QCOMPARE(trans->sourceState(), (QState*)s2);
- QCOMPARE(trans->targetState(), (QAbstractState*)s3);
- {
- const QString warning
- = QString::asprintf("QState::removeTransition: transition %p's source state (%p) is different from this state (%p)", trans, s2, s1);
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
- s1->removeTransition(trans);
- }
- s2->removeTransition(trans);
- QCOMPARE(trans->sourceState(), (QState*)0);
- QCOMPARE(trans->targetState(), (QAbstractState*)s3);
- s2->addTransition(trans);
- QCOMPARE(trans->sourceState(), (QState*)s2);
- }
-
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
-
- QVERIFY(startedSpy.isValid());
- QVERIFY(stoppedSpy.isValid());
- QVERIFY(finishedSpy.isValid());
- QVERIFY(runningSpy.isValid());
-
- machine.setInitialState(s1);
- QCOMPARE(machine.initialState(), (QAbstractState*)s1);
- {
- QString warning
- = QString::asprintf("QState::setInitialState: state %p is not a child of this state (%p)", &machine, &machine);
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
- machine.setInitialState(&machine);
- QCOMPARE(machine.initialState(), (QAbstractState*)s1);
- }
- QVERIFY(machine.configuration().isEmpty());
- globalTick = 0;
- QVERIFY(!machine.isRunning());
- QSignalSpy s1EnteredSpy(s1, &TestState::entered);
- QSignalSpy s1ExitedSpy(s1, &TestState::exited);
- QSignalSpy tTriggeredSpy(t, &TestTransition::triggered);
- QSignalSpy s2EnteredSpy(s2, &TestState::entered);
- QSignalSpy s2ExitedSpy(s2, &TestState::exited);
-
- QVERIFY(s1EnteredSpy.isValid());
- QVERIFY(s1ExitedSpy.isValid());
- QVERIFY(tTriggeredSpy.isValid());
- QVERIFY(s2EnteredSpy.isValid());
- QVERIFY(s2ExitedSpy.isValid());
-
- machine.start();
-
- QTRY_COMPARE(startedSpy.count(), 1);
- QTRY_COMPARE(finishedSpy.count(), 1);
- QTRY_COMPARE(stoppedSpy.count(), 0);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(s3));
-
- // s1 is entered
- QCOMPARE(s1->events.count(), 2);
- QCOMPARE(s1->events.at(0).first, 0);
- QCOMPARE(s1->events.at(0).second, TestState::Entry);
- // s1 is exited
- QCOMPARE(s1->events.at(1).first, 1);
- QCOMPARE(s1->events.at(1).second, TestState::Exit);
- // t is triggered
- QCOMPARE(t->triggers.count(), 1);
- QCOMPARE(t->triggers.at(0), 2);
- // s2 is entered
- QCOMPARE(s2->events.count(), 2);
- QCOMPARE(s2->events.at(0).first, 3);
- QCOMPARE(s2->events.at(0).second, TestState::Entry);
- // s2 is exited
- QCOMPARE(s2->events.at(1).first, 4);
- QCOMPARE(s2->events.at(1).second, TestState::Exit);
-
- QCOMPARE(s1EnteredSpy.count(), 1);
- QCOMPARE(s1ExitedSpy.count(), 1);
- QCOMPARE(tTriggeredSpy.count(), 1);
- QCOMPARE(s2EnteredSpy.count(), 1);
- QCOMPARE(s2ExitedSpy.count(), 1);
- }
- // Two top-level states, one has two child states
- {
- QStateMachine machine;
-
- TestState *s1 = new TestState(&machine, "s1");
- TestState *s11 = new TestState(s1, "s11");
- TestState *s12 = new TestState(s1, "s12");
- TestState *s2 = new TestState(&machine, "s2");
- QFinalState *s3 = new QFinalState(&machine);
- s3->setObjectName("s3");
- s1->setInitialState(s11);
- TestTransition *t1 = new TestTransition(s12, "t1");
- s11->addTransition(t1);
- TestTransition *t2 = new TestTransition(s2, "t2");
- s12->addTransition(t2);
- s2->addTransition(s3);
-
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(startedSpy.isValid());
- QVERIFY(finishedSpy.isValid());
- QVERIFY(runningSpy.isValid());
- machine.setInitialState(s1);
- globalTick = 0;
- machine.start();
-
- QTRY_COMPARE(startedSpy.count(), 1);
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(s3));
-
- // s1 is entered
- QCOMPARE(s1->events.count(), 2);
- QCOMPARE(s1->events.at(0).first, 0);
- QCOMPARE(s1->events.at(0).second, TestState::Entry);
- // s11 is entered
- QCOMPARE(s11->events.count(), 2);
- QCOMPARE(s11->events.at(0).first, 1);
- QCOMPARE(s11->events.at(0).second, TestState::Entry);
- // s11 is exited
- QCOMPARE(s11->events.at(1).first, 2);
- QCOMPARE(s11->events.at(1).second, TestState::Exit);
- // t1 is triggered
- QCOMPARE(t1->triggers.count(), 1);
- QCOMPARE(t1->triggers.at(0), 3);
- // s12 is entered
- QCOMPARE(s12->events.count(), 2);
- QCOMPARE(s12->events.at(0).first, 4);
- QCOMPARE(s12->events.at(0).second, TestState::Entry);
- // s12 is exited
- QCOMPARE(s12->events.at(1).first, 5);
- QCOMPARE(s12->events.at(1).second, TestState::Exit);
- // s1 is exited
- QCOMPARE(s1->events.at(1).first, 6);
- QCOMPARE(s1->events.at(1).second, TestState::Exit);
- // t2 is triggered
- QCOMPARE(t2->triggers.count(), 1);
- QCOMPARE(t2->triggers.at(0), 7);
- // s2 is entered
- QCOMPARE(s2->events.count(), 2);
- QCOMPARE(s2->events.at(0).first, 8);
- QCOMPARE(s2->events.at(0).second, TestState::Entry);
- // s2 is exited
- QCOMPARE(s2->events.at(1).first, 9);
- QCOMPARE(s2->events.at(1).second, TestState::Exit);
- }
-}
-
-void tst_QStateMachine::assignProperty()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
-
- QTest::ignoreMessage(QtWarningMsg, "QState::assignProperty: cannot assign property 'foo' of null object");
- s1->assignProperty(0, "foo", QVariant());
-
- s1->assignProperty(s1, "objectName", "s1");
- QFinalState *s2 = new QFinalState(&machine);
- s1->addTransition(s2);
- machine.setInitialState(s1);
- machine.start();
- QTRY_COMPARE(s1->objectName(), QString::fromLatin1("s1"));
- TEST_ACTIVE_CHANGED(s1, 2);
-
- s1->assignProperty(s1, "objectName", "foo");
- machine.start();
- QTRY_COMPARE(s1->objectName(), QString::fromLatin1("foo"));
- TEST_ACTIVE_CHANGED(s1, 4);
-
- s1->assignProperty(s1, "noSuchProperty", 123);
- machine.start();
- QTRY_COMPARE(s1->dynamicPropertyNames().size(), 1);
- QCOMPARE(s1->dynamicPropertyNames().at(0), QByteArray("noSuchProperty"));
- QCOMPARE(s1->objectName(), QString::fromLatin1("foo"));
- TEST_ACTIVE_CHANGED(s1, 6);
-
- {
- QSignalSpy propertiesAssignedSpy(s1, &QState::propertiesAssigned);
- QVERIFY(propertiesAssignedSpy.isValid());
- machine.start();
- QTRY_COMPARE(propertiesAssignedSpy.count(), 1);
- TEST_ACTIVE_CHANGED(s1, 8);
- }
-
- // nested states
- {
- QState *s11 = new QState(s1);
- DEFINE_ACTIVE_SPY(s11);
- QString str = QString::fromLatin1("set by nested state");
- s11->assignProperty(s11, "objectName", str);
- s1->setInitialState(s11);
- machine.start();
- QTRY_COMPARE(s11->objectName(), str);
- TEST_ACTIVE_CHANGED(s1, 10);
- TEST_ACTIVE_CHANGED(s11, 2);
- }
-}
-
-void tst_QStateMachine::assignPropertyWithAnimation()
-{
- // Single animation
- {
- QStateMachine machine;
- QVERIFY(machine.isAnimated());
- machine.setAnimated(false);
- QVERIFY(!machine.isAnimated());
- machine.setAnimated(true);
- QVERIFY(machine.isAnimated());
- QObject obj;
- obj.setProperty("foo", 321);
- obj.setProperty("bar", 654);
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->assignProperty(&obj, "foo", 123);
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(&obj, "foo", 456);
- s2->assignProperty(&obj, "bar", 789);
- QAbstractTransition *trans = s1->addTransition(s2);
- QVERIFY(trans->animations().isEmpty());
- QTest::ignoreMessage(QtWarningMsg, "QAbstractTransition::addAnimation: cannot add null animation");
- trans->addAnimation(0);
- QPropertyAnimation anim(&obj, "foo");
- anim.setDuration(250);
- trans->addAnimation(&anim);
- QCOMPARE(trans->animations().size(), 1);
- QCOMPARE(trans->animations().at(0), (QAbstractAnimation*)&anim);
- QCOMPARE(anim.parent(), (QObject*)0);
- QTest::ignoreMessage(QtWarningMsg, "QAbstractTransition::removeAnimation: cannot remove null animation");
- trans->removeAnimation(0);
- trans->removeAnimation(&anim);
- QVERIFY(trans->animations().isEmpty());
- trans->addAnimation(&anim);
- QCOMPARE(trans->animations().size(), 1);
- QCOMPARE(trans->animations().at(0), (QAbstractAnimation*)&anim);
- QFinalState *s3 = new QFinalState(&machine);
- s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
-
- machine.setInitialState(s1);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.start();
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- QCOMPARE(obj.property("foo").toInt(), 456);
- QCOMPARE(obj.property("bar").toInt(), 789);
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- }
- // Two animations
- {
- QStateMachine machine;
- QObject obj;
- obj.setProperty("foo", 321);
- obj.setProperty("bar", 654);
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->assignProperty(&obj, "foo", 123);
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(&obj, "foo", 456);
- s2->assignProperty(&obj, "bar", 789);
- QAbstractTransition *trans = s1->addTransition(s2);
- QPropertyAnimation anim(&obj, "foo");
- anim.setDuration(150);
- trans->addAnimation(&anim);
- QPropertyAnimation anim2(&obj, "bar");
- anim2.setDuration(150);
- trans->addAnimation(&anim2);
- QFinalState *s3 = new QFinalState(&machine);
- s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
-
- machine.setInitialState(s1);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(finishedSpy.isValid());
- QVERIFY(runningSpy.isValid());
- machine.start();
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- QCOMPARE(obj.property("foo").toInt(), 456);
- QCOMPARE(obj.property("bar").toInt(), 789);
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- }
- // Animation group
- {
- QStateMachine machine;
- QObject obj;
- obj.setProperty("foo", 321);
- obj.setProperty("bar", 654);
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->assignProperty(&obj, "foo", 123);
- s1->assignProperty(&obj, "bar", 321);
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(&obj, "foo", 456);
- s2->assignProperty(&obj, "bar", 654);
- s2->assignProperty(&obj, "baz", 789);
- QAbstractTransition *trans = s1->addTransition(s2);
- QSequentialAnimationGroup group;
- group.addAnimation(new QPropertyAnimation(&obj, "foo"));
- group.addAnimation(new QPropertyAnimation(&obj, "bar"));
- trans->addAnimation(&group);
- QFinalState *s3 = new QFinalState(&machine);
- s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
-
- machine.setInitialState(s1);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(finishedSpy.isValid());
- QVERIFY(runningSpy.isValid());
- machine.start();
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- QCOMPARE(obj.property("foo").toInt(), 456);
- QCOMPARE(obj.property("bar").toInt(), 654);
- QCOMPARE(obj.property("baz").toInt(), 789);
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- }
- // Nested states
- {
- QStateMachine machine;
- QObject obj;
- obj.setProperty("foo", 321);
- obj.setProperty("bar", 654);
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QCOMPARE(s1->childMode(), QState::ExclusiveStates);
- s1->setChildMode(QState::ParallelStates);
- QCOMPARE(s1->childMode(), QState::ParallelStates);
- s1->setChildMode(QState::ExclusiveStates);
- QCOMPARE(s1->childMode(), QState::ExclusiveStates);
- QCOMPARE(s1->initialState(), (QAbstractState*)0);
- s1->setObjectName("s1");
- s1->assignProperty(&obj, "foo", 123);
- s1->assignProperty(&obj, "bar", 456);
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->setObjectName("s2");
- s2->assignProperty(&obj, "foo", 321);
- QState *s21 = new QState(s2);
- DEFINE_ACTIVE_SPY(s21);
- s21->setObjectName("s21");
- s21->assignProperty(&obj, "bar", 654);
- QState *s22 = new QState(s2);
- DEFINE_ACTIVE_SPY(s22);
- s22->setObjectName("s22");
- s22->assignProperty(&obj, "bar", 789);
- s2->setInitialState(s21);
- QCOMPARE(s2->initialState(), (QAbstractState*)s21);
-
- QAbstractTransition *trans = s1->addTransition(s2);
- QPropertyAnimation anim(&obj, "foo");
- anim.setDuration(500);
- trans->addAnimation(&anim);
- QPropertyAnimation anim2(&obj, "bar");
- anim2.setDuration(250);
- trans->addAnimation(&anim2);
-
- s21->addTransition(s21, SIGNAL(propertiesAssigned()), s22);
-
- QFinalState *s3 = new QFinalState(&machine);
- s22->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
-
- machine.setInitialState(s1);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(finishedSpy.isValid());
- QVERIFY(runningSpy.isValid());
- machine.start();
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- QCOMPARE(obj.property("foo").toInt(), 321);
- QCOMPARE(obj.property("bar").toInt(), 789);
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s21, 2);
- TEST_ACTIVE_CHANGED(s22, 2);
- }
- // Aborted animation
- {
- QStateMachine machine;
- SignalEmitter emitter;
- QObject obj;
- obj.setProperty("foo", 321);
- obj.setProperty("bar", 654);
- QState *group = new QState(&machine);
- QState *s1 = new QState(group);
- DEFINE_ACTIVE_SPY(s1);
- group->setInitialState(s1);
- s1->assignProperty(&obj, "foo", 123);
- QState *s2 = new QState(group);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(&obj, "foo", 456);
- s2->assignProperty(&obj, "bar", 789);
- QAbstractTransition *trans = s1->addTransition(&emitter, SIGNAL(signalWithNoArg()), s2);
- QPropertyAnimation anim(&obj, "foo");
- anim.setDuration(8000);
- trans->addAnimation(&anim);
- QPropertyAnimation anim2(&obj, "bar");
- anim2.setDuration(8000);
- trans->addAnimation(&anim2);
- QState *s3 = new QState(group);
- DEFINE_ACTIVE_SPY(s3);
- s3->assignProperty(&obj, "foo", 911);
- s2->addTransition(&emitter, SIGNAL(signalWithNoArg()), s3);
-
- machine.setInitialState(group);
- machine.start();
- QTRY_COMPARE(machine.configuration().contains(s1), true);
- QSignalSpy propertiesAssignedSpy(s2, &QState::propertiesAssigned);
- QVERIFY(propertiesAssignedSpy.isValid());
- emitter.emitSignalWithNoArg();
- QTRY_COMPARE(machine.configuration().contains(s2), true);
- QVERIFY(propertiesAssignedSpy.isEmpty());
- emitter.emitSignalWithNoArg(); // will cause animations from s1-->s2 to abort
- QTRY_COMPARE(machine.configuration().contains(s3), true);
- QVERIFY(propertiesAssignedSpy.isEmpty());
- QCOMPARE(obj.property("foo").toInt(), 911);
- QCOMPARE(obj.property("bar").toInt(), 789);
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- QVERIFY(machine.isRunning());
- }
-}
-
-struct StringEvent : public QEvent
-{
-public:
- StringEvent(const QString &val)
- : QEvent(QEvent::Type(QEvent::User+2)),
- value(val) {}
-
- QString value;
-};
-
-class StringTransition : public QAbstractTransition
-{
-public:
- StringTransition(const QString &value, QAbstractState *target)
- : QAbstractTransition(), m_value(value)
- { setTargetState(target); }
-
-protected:
- virtual bool eventTest(QEvent *e)
- {
- if (e->type() != QEvent::Type(QEvent::User+2))
- return false;
- StringEvent *se = static_cast<StringEvent*>(e);
- return (m_value == se->value) && (!m_cond.isValid() || m_cond.match(m_value).hasMatch());
- }
- virtual void onTransition(QEvent *) {}
-
-private:
- QString m_value;
- QRegularExpression m_cond;
-};
-
-class StringEventPoster : public QState
-{
-public:
- StringEventPoster(const QString &value, QState *parent = 0)
- : QState(parent), m_value(value), m_delay(-1) {}
-
- void setString(const QString &value)
- { m_value = value; }
- void setDelay(int delay)
- { m_delay = delay; }
-
-protected:
- virtual void onEntry(QEvent *)
- {
- if (m_delay == -1)
- machine()->postEvent(new StringEvent(m_value));
- else
- machine()->postDelayedEvent(new StringEvent(m_value), m_delay);
- }
- virtual void onExit(QEvent *) {}
-
-private:
- QString m_value;
- int m_delay;
-};
-
-void tst_QStateMachine::postEvent()
-{
- for (int x = 0; x < 2; ++x) {
- QStateMachine machine;
- {
- QEvent e(QEvent::None);
- QTest::ignoreMessage(QtWarningMsg, "QStateMachine::postEvent: cannot post event when the state machine is not running");
- machine.postEvent(&e);
- }
- StringEventPoster *s1 = new StringEventPoster("a");
- DEFINE_ACTIVE_SPY(s1);
- if (x == 1)
- s1->setDelay(100);
- QFinalState *s2 = new QFinalState;
- s1->addTransition(new StringTransition("a", s2));
- machine.addState(s1);
- machine.addState(s2);
- machine.setInitialState(s1);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(finishedSpy.isValid());
- QVERIFY(runningSpy.isValid());
- machine.start();
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s2));
- TEST_ACTIVE_CHANGED(s1, 2);
-
- s1->setString("b");
- QFinalState *s3 = new QFinalState();
- machine.addState(s3);
- s1->addTransition(new StringTransition("b", s3));
- finishedSpy.clear();
- machine.start();
- QTRY_COMPARE(finishedSpy.count(), 1);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s3));
- TEST_ACTIVE_CHANGED(s1, 4);
- }
-}
-
-void tst_QStateMachine::cancelDelayedEvent()
-{
- QStateMachine machine;
- QTest::ignoreMessage(QtWarningMsg, "QStateMachine::cancelDelayedEvent: the machine is not running");
- QVERIFY(!machine.cancelDelayedEvent(-1));
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QFinalState *s2 = new QFinalState(&machine);
- s1->addTransition(new StringTransition("a", s2));
- machine.setInitialState(s1);
-
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(startedSpy.isValid());
- QVERIFY(runningSpy.isValid());
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 1);
- TEST_RUNNING_CHANGED(true);
- TEST_ACTIVE_CHANGED(s1, 1);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
- int id1 = machine.postDelayedEvent(new StringEvent("c"), 50000);
- QVERIFY(id1 != -1);
- int id2 = machine.postDelayedEvent(new StringEvent("b"), 25000);
- QVERIFY(id2 != -1);
- QVERIFY(id2 != id1);
- int id3 = machine.postDelayedEvent(new StringEvent("a"), 100);
- QVERIFY(id3 != -1);
- QVERIFY(id3 != id2);
- QVERIFY(machine.cancelDelayedEvent(id1));
- QVERIFY(!machine.cancelDelayedEvent(id1));
- QVERIFY(machine.cancelDelayedEvent(id2));
- QVERIFY(!machine.cancelDelayedEvent(id2));
-
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
- TEST_ACTIVE_CHANGED(s1, 2);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s2));
-}
-
-void tst_QStateMachine::postDelayedEventAndStop()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QFinalState *s2 = new QFinalState(&machine);
- s1->addTransition(new StringTransition("a", s2));
- machine.setInitialState(s1);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QVERIFY(startedSpy.isValid());
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 1);
- TEST_RUNNING_CHANGED(true);
- TEST_ACTIVE_CHANGED(s1, 1);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- int id1 = machine.postDelayedEvent(new StringEvent("a"), 0);
- QVERIFY(id1 != -1);
- QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
- QVERIFY(stoppedSpy.isValid());
- machine.stop();
- QTRY_COMPARE(stoppedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
- TEST_ACTIVE_CHANGED(s1, 1);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 2);
- TEST_RUNNING_CHANGED(true);
- TEST_ACTIVE_CHANGED(s1, 3);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- int id2 = machine.postDelayedEvent(new StringEvent("a"), 1000);
- QVERIFY(id2 != -1);
- machine.stop();
- QTRY_COMPARE(stoppedSpy.count(), 2);
- TEST_RUNNING_CHANGED(false);
- TEST_ACTIVE_CHANGED(s1, 3);
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 3);
- TEST_RUNNING_CHANGED(true);
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
- TEST_ACTIVE_CHANGED(s1, 5);
- QVERIFY(machine.isRunning());
-}
-
-class DelayedEventPosterThread : public QThread
-{
- Q_OBJECT
-public:
- DelayedEventPosterThread(QStateMachine *machine, QObject *parent = 0)
- : QThread(parent), firstEventWasCancelled(false),
- m_machine(machine)
- {
- moveToThread(this);
- QObject::connect(m_machine, SIGNAL(started()),
- this, SLOT(postEvent()));
- }
-
- mutable bool firstEventWasCancelled;
-
-private Q_SLOTS:
- void postEvent()
- {
- int id = m_machine->postDelayedEvent(new QEvent(QEvent::User), 1000);
- firstEventWasCancelled = m_machine->cancelDelayedEvent(id);
-
- m_machine->postDelayedEvent(new QEvent(QEvent::User), 1);
-
- quit();
- }
-private:
- QStateMachine *m_machine;
-};
-
-void tst_QStateMachine::postDelayedEventFromThread()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QFinalState *f = new QFinalState(&machine);
- s1->addTransition(new EventTransition(QEvent::User, f));
- machine.setInitialState(s1);
-
- DelayedEventPosterThread poster(&machine);
- poster.start();
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.start();
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- TEST_ACTIVE_CHANGED(s1, 2);
- QVERIFY(poster.firstEventWasCancelled);
-}
-
-void tst_QStateMachine::stopAndPostEvent()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QVERIFY(startedSpy.isValid());
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 1);
- TEST_RUNNING_CHANGED(true);
- TEST_ACTIVE_CHANGED(s1, 1);
- QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
- QVERIFY(stoppedSpy.isValid());
- machine.stop();
- QCOMPARE(stoppedSpy.count(), 0);
- machine.postEvent(new QEvent(QEvent::User));
- QTRY_COMPARE(stoppedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
- TEST_ACTIVE_CHANGED(s1, 1);
- QCoreApplication::processEvents();
-}
-
-void tst_QStateMachine::stateFinished()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QState *s1_1 = new QState(s1);
- DEFINE_ACTIVE_SPY(s1_1);
- QFinalState *s1_2 = new QFinalState(s1);
- s1_1->addTransition(s1_2);
- s1->setInitialState(s1_1);
- QFinalState *s2 = new QFinalState(&machine);
- s1->addTransition(s1, SIGNAL(finished()), s2);
- machine.setInitialState(s1);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.start();
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s1_1, 2);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s2));
-}
-
-void tst_QStateMachine::parallelStates()
-{
- QStateMachine machine;
-
- TestState *s1 = new TestState(QState::ParallelStates);
- QCOMPARE(s1->childMode(), QState::ParallelStates);
- TestState *s1_1 = new TestState(s1);
- QState *s1_1_1 = new QState(s1_1);
- QFinalState *s1_1_f = new QFinalState(s1_1);
- s1_1_1->addTransition(s1_1_f);
- s1_1->setInitialState(s1_1_1);
- TestState *s1_2 = new TestState(s1);
- QState *s1_2_1 = new QState(s1_2);
- QFinalState *s1_2_f = new QFinalState(s1_2);
- s1_2_1->addTransition(s1_2_f);
- s1_2->setInitialState(s1_2_1);
- {
- const QString warning
- = QString::asprintf("QState::setInitialState: ignoring attempt to set initial state of parallel state group %p", s1);
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
- s1->setInitialState(0);
- }
- machine.addState(s1);
-
- QFinalState *s2 = new QFinalState();
- machine.addState(s2);
-
- s1->addTransition(s1, SIGNAL(finished()), s2);
-
- machine.setInitialState(s1);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- globalTick = 0;
- machine.start();
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s2));
-
- QCOMPARE(s1->events.count(), 2);
- // s1 is entered
- QCOMPARE(s1->events.at(0).first, 0);
- QCOMPARE(s1->events.at(0).second, TestState::Entry);
- // s1_1 is entered
- QCOMPARE(s1_1->events.count(), 2);
- QCOMPARE(s1_1->events.at(0).first, 1);
- QCOMPARE(s1_1->events.at(0).second, TestState::Entry);
- // s1_2 is entered
- QCOMPARE(s1_2->events.at(0).first, 2);
- QCOMPARE(s1_2->events.at(0).second, TestState::Entry);
- // s1_2 is exited
- QCOMPARE(s1_2->events.at(1).first, 3);
- QCOMPARE(s1_2->events.at(1).second, TestState::Exit);
- // s1_1 is exited
- QCOMPARE(s1_1->events.at(1).first, 4);
- QCOMPARE(s1_1->events.at(1).second, TestState::Exit);
- // s1 is exited
- QCOMPARE(s1->events.at(1).first, 5);
- QCOMPARE(s1->events.at(1).second, TestState::Exit);
-}
-
-void tst_QStateMachine::parallelRootState()
-{
- QStateMachine machine;
- QState *root = &machine;
- QCOMPARE(root->childMode(), QState::ExclusiveStates);
- root->setChildMode(QState::ParallelStates);
- QCOMPARE(root->childMode(), QState::ParallelStates);
-
- QState *s1 = new QState(root);
- DEFINE_ACTIVE_SPY(s1);
- QFinalState *s1_f = new QFinalState(s1);
- s1->setInitialState(s1_f);
- QState *s2 = new QState(root);
- DEFINE_ACTIVE_SPY(s2);
- QFinalState *s2_f = new QFinalState(s2);
- s2->setInitialState(s2_f);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QVERIFY(startedSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.start();
- QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: "
- "Child mode of state machine '' is not 'ExclusiveStates'.");
- QTRY_COMPARE(startedSpy.count(), 1);
- QCOMPARE(machine.configuration().size(), 4);
- QVERIFY(machine.configuration().contains(s1));
- QVERIFY(machine.configuration().contains(s1_f));
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s2_f));
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 1);
- QVERIFY(!machine.isRunning());
-}
-
-void tst_QStateMachine::allSourceToTargetConfigurations()
-{
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s0);
- s0->setObjectName("s0");
- QState *s1 = new QState(s0);
- DEFINE_ACTIVE_SPY(s1);
- s1->setObjectName("s1");
- QState *s11 = new QState(s1);
- DEFINE_ACTIVE_SPY(s11);
- s11->setObjectName("s11");
- QState *s2 = new QState(s0);
- DEFINE_ACTIVE_SPY(s2);
- s2->setObjectName("s2");
- QState *s21 = new QState(s2);
- DEFINE_ACTIVE_SPY(s21);
- s21->setObjectName("s21");
- QState *s211 = new QState(s21);
- DEFINE_ACTIVE_SPY(s211);
- s211->setObjectName("s211");
- QFinalState *f = new QFinalState(&machine);
- f->setObjectName("f");
-
- s0->setInitialState(s1);
- s1->setInitialState(s11);
- s2->setInitialState(s21);
- s21->setInitialState(s211);
-
- s11->addTransition(new StringTransition("g", s211));
- s1->addTransition(new StringTransition("a", s1));
- s1->addTransition(new StringTransition("b", s11));
- s1->addTransition(new StringTransition("c", s2));
- s1->addTransition(new StringTransition("d", s0));
- s1->addTransition(new StringTransition("f", s211));
- s211->addTransition(new StringTransition("d", s21));
- s211->addTransition(new StringTransition("g", s0));
- s211->addTransition(new StringTransition("h", f));
- s21->addTransition(new StringTransition("b", s211));
- s2->addTransition(new StringTransition("c", s1));
- s2->addTransition(new StringTransition("f", s11));
- s0->addTransition(new StringTransition("e", s211));
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 1);
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s11, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s21, 0);
- TEST_ACTIVE_CHANGED(s211, 0);
-
- machine.postEvent(new StringEvent("a"));
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 1);
- TEST_ACTIVE_CHANGED(s1, 3);
- TEST_ACTIVE_CHANGED(s11, 3);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s21, 0);
- TEST_ACTIVE_CHANGED(s211, 0);
-
- machine.postEvent(new StringEvent("b"));
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 1);
- TEST_ACTIVE_CHANGED(s1, 5);
- TEST_ACTIVE_CHANGED(s11, 5);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s21, 0);
- TEST_ACTIVE_CHANGED(s211, 0);
-
- machine.postEvent(new StringEvent("c"));
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 1);
- TEST_ACTIVE_CHANGED(s1, 6);
- TEST_ACTIVE_CHANGED(s11, 6);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s21, 1);
- TEST_ACTIVE_CHANGED(s211, 1);
-
- machine.postEvent(new StringEvent("d"));
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 1);
- TEST_ACTIVE_CHANGED(s1, 6);
- TEST_ACTIVE_CHANGED(s11, 6);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s21, 3);
- TEST_ACTIVE_CHANGED(s211, 3);
-
- machine.postEvent(new StringEvent("e"));
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 3);
- TEST_ACTIVE_CHANGED(s1, 6);
- TEST_ACTIVE_CHANGED(s11, 6);
- TEST_ACTIVE_CHANGED(s2, 3);
- TEST_ACTIVE_CHANGED(s21, 5);
- TEST_ACTIVE_CHANGED(s211, 5);
-
- machine.postEvent(new StringEvent("f"));
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 3);
- TEST_ACTIVE_CHANGED(s1, 7);
- TEST_ACTIVE_CHANGED(s11, 7);
- TEST_ACTIVE_CHANGED(s2, 4);
- TEST_ACTIVE_CHANGED(s21, 6);
- TEST_ACTIVE_CHANGED(s211, 6);
-
- machine.postEvent(new StringEvent("g"));
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 3);
- TEST_ACTIVE_CHANGED(s1, 8);
- TEST_ACTIVE_CHANGED(s11, 8);
- TEST_ACTIVE_CHANGED(s2, 5);
- TEST_ACTIVE_CHANGED(s21, 7);
- TEST_ACTIVE_CHANGED(s211, 7);
-
- machine.postEvent(new StringEvent("h"));
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 4);
- TEST_ACTIVE_CHANGED(s1, 8);
- TEST_ACTIVE_CHANGED(s11, 8);
- TEST_ACTIVE_CHANGED(s2, 6);
- TEST_ACTIVE_CHANGED(s21, 8);
- TEST_ACTIVE_CHANGED(s211, 8);
-
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
-}
-
-class TestSignalTransition : public QSignalTransition
-{
-public:
- TestSignalTransition(QState *sourceState = 0)
- : QSignalTransition(sourceState),
- m_eventTestSender(0), m_eventTestSignalIndex(-1),
- m_transitionSender(0), m_transitionSignalIndex(-1)
- {}
- TestSignalTransition(QObject *sender, const char *signal,
- QAbstractState *target)
- : QSignalTransition(sender, signal),
- m_eventTestSender(0), m_eventTestSignalIndex(-1),
- m_transitionSender(0), m_transitionSignalIndex(-1)
- { setTargetState(target); }
- QObject *eventTestSenderReceived() const {
- return m_eventTestSender;
- }
- int eventTestSignalIndexReceived() const {
- return m_eventTestSignalIndex;
- }
- QVariantList eventTestArgumentsReceived() const {
- return m_eventTestArgs;
- }
- QObject *transitionSenderReceived() const {
- return m_transitionSender;
- }
- int transitionSignalIndexReceived() const {
- return m_transitionSignalIndex;
- }
- QVariantList transitionArgumentsReceived() const {
- return m_transitionArgs;
- }
-protected:
- bool eventTest(QEvent *e) {
- if (!QSignalTransition::eventTest(e))
- return false;
- QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
- m_eventTestSender = se->sender();
- m_eventTestSignalIndex = se->signalIndex();
- m_eventTestArgs = se->arguments();
- return true;
- }
- void onTransition(QEvent *e) {
- QSignalTransition::onTransition(e);
- QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
- m_transitionSender = se->sender();
- m_transitionSignalIndex = se->signalIndex();
- m_transitionArgs = se->arguments();
- }
-private:
- QObject *m_eventTestSender;
- int m_eventTestSignalIndex;
- QVariantList m_eventTestArgs;
- QObject *m_transitionSender;
- int m_transitionSignalIndex;
- QVariantList m_transitionArgs;
-};
-
-void tst_QStateMachine::signalTransitions()
-{
- {
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s0);
- QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: sender cannot be null");
- QCOMPARE(s0->addTransition(0, SIGNAL(noSuchSignal()), 0), (QSignalTransition*)0);
-
- SignalEmitter emitter;
- QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: signal cannot be null");
- QCOMPARE(s0->addTransition(&emitter, 0, 0), (QSignalTransition*)0);
-
- QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: cannot add transition to null state");
- QCOMPARE(s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), 0), (QSignalTransition*)0);
-
- QFinalState *s1 = new QFinalState(&machine);
- QTest::ignoreMessage(QtWarningMsg, "QState::addTransition: no such signal SignalEmitter::noSuchSignal()");
- QCOMPARE(s0->addTransition(&emitter, SIGNAL(noSuchSignal()), s1), (QSignalTransition*)0);
-
- QSignalTransition *trans = s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), s1);
- QVERIFY(trans != 0);
- QCOMPARE(trans->sourceState(), s0);
- QCOMPARE(trans->targetState(), (QAbstractState*)s1);
- QCOMPARE(trans->senderObject(), (QObject*)&emitter);
- QCOMPARE(trans->signal(), QByteArray(SIGNAL(signalWithNoArg())));
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
-
- emitter.emitSignalWithNoArg();
-
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- TEST_ACTIVE_CHANGED(s0, 2);
- emitter.emitSignalWithNoArg();
-
- trans->setSignal(SIGNAL(signalWithIntArg(int)));
- QCOMPARE(trans->signal(), QByteArray(SIGNAL(signalWithIntArg(int))));
- machine.start();
- QCoreApplication::processEvents();
- emitter.emitSignalWithIntArg(123);
- QTRY_COMPARE(finishedSpy.count(), 2);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- TEST_ACTIVE_CHANGED(s0, 4);
-
- machine.start();
- QCoreApplication::processEvents();
- trans->setSignal(SIGNAL(signalWithNoArg()));
- QCOMPARE(trans->signal(), QByteArray(SIGNAL(signalWithNoArg())));
- emitter.emitSignalWithNoArg();
- QTRY_COMPARE(finishedSpy.count(), 3);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- TEST_ACTIVE_CHANGED(s0, 6);
-
- SignalEmitter emitter2;
- machine.start();
- QCoreApplication::processEvents();
- trans->setSenderObject(&emitter2);
- emitter2.emitSignalWithNoArg();
- QTRY_COMPARE(finishedSpy.count(), 4);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- TEST_ACTIVE_CHANGED(s0, 8);
-
- machine.start();
- QCoreApplication::processEvents();
- QTest::ignoreMessage(QtWarningMsg, "QSignalTransition: no such signal: SignalEmitter::noSuchSignal()");
- trans->setSignal(SIGNAL(noSuchSignal()));
- QCOMPARE(trans->signal(), QByteArray(SIGNAL(noSuchSignal())));
- TEST_RUNNING_CHANGED(true);
- TEST_ACTIVE_CHANGED(s0, 9);
- QVERIFY(machine.isRunning());
- }
- {
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s0);
- QFinalState *s1 = new QFinalState(&machine);
- SignalEmitter emitter;
- QSignalTransition *trans = s0->addTransition(&emitter, "signalWithNoArg()", s1);
- QVERIFY(trans != 0);
- QCOMPARE(trans->sourceState(), s0);
- QCOMPARE(trans->targetState(), (QAbstractState*)s1);
- QCOMPARE(trans->senderObject(), (QObject*)&emitter);
- QCOMPARE(trans->signal(), QByteArray("signalWithNoArg()"));
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 1);
- emitter.emitSignalWithNoArg();
-
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- TEST_ACTIVE_CHANGED(s0, 2);
-
- trans->setSignal("signalWithIntArg(int)");
- QCOMPARE(trans->signal(), QByteArray("signalWithIntArg(int)"));
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 3);
- emitter.emitSignalWithIntArg(123);
- QTRY_COMPARE(finishedSpy.count(), 2);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- TEST_ACTIVE_CHANGED(s0, 4);
- }
- {
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s0);
- QFinalState *s1 = new QFinalState(&machine);
- SignalEmitter emitter;
- TestSignalTransition *trans = new TestSignalTransition(&emitter, SIGNAL(signalWithIntArg(int)), s1);
- s0->addTransition(trans);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 1);
- emitter.emitSignalWithIntArg(123);
-
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- TEST_ACTIVE_CHANGED(s0, 2);
- QCOMPARE(trans->eventTestSenderReceived(), (QObject*)&emitter);
- QCOMPARE(trans->eventTestSignalIndexReceived(), emitter.metaObject()->indexOfSignal("signalWithIntArg(int)"));
- QCOMPARE(trans->eventTestArgumentsReceived().size(), 1);
- QCOMPARE(trans->eventTestArgumentsReceived().at(0).toInt(), 123);
- QCOMPARE(trans->transitionSenderReceived(), (QObject*)&emitter);
- QCOMPARE(trans->transitionSignalIndexReceived(), emitter.metaObject()->indexOfSignal("signalWithIntArg(int)"));
- QCOMPARE(trans->transitionArgumentsReceived().size(), 1);
- QCOMPARE(trans->transitionArgumentsReceived().at(0).toInt(), 123);
- }
- {
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s0);
- QFinalState *s1 = new QFinalState(&machine);
- SignalEmitter emitter;
- TestSignalTransition *trans = new TestSignalTransition(&emitter, SIGNAL(signalWithStringArg(QString)), s1);
- s0->addTransition(trans);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 1);
-
- QString testString = QString::fromLatin1("hello");
- emitter.emitSignalWithStringArg(testString);
-
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- TEST_ACTIVE_CHANGED(s0, 2);
- QCOMPARE(trans->eventTestSenderReceived(), (QObject*)&emitter);
- QCOMPARE(trans->eventTestSignalIndexReceived(), emitter.metaObject()->indexOfSignal("signalWithStringArg(QString)"));
- QCOMPARE(trans->eventTestArgumentsReceived().size(), 1);
- QCOMPARE(trans->eventTestArgumentsReceived().at(0).toString(), testString);
- QCOMPARE(trans->transitionSenderReceived(), (QObject*)&emitter);
- QCOMPARE(trans->transitionSignalIndexReceived(), emitter.metaObject()->indexOfSignal("signalWithStringArg(QString)"));
- QCOMPARE(trans->transitionArgumentsReceived().size(), 1);
- QCOMPARE(trans->transitionArgumentsReceived().at(0).toString(), testString);
- }
- {
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s0);
- QFinalState *s1 = new QFinalState(&machine);
-
- TestSignalTransition *trans = new TestSignalTransition();
- QCOMPARE(trans->senderObject(), (QObject*)0);
- QCOMPARE(trans->signal(), QByteArray());
-
- SignalEmitter emitter;
- trans->setSenderObject(&emitter);
- QCOMPARE(trans->senderObject(), (QObject*)&emitter);
- trans->setSignal(SIGNAL(signalWithNoArg()));
- QCOMPARE(trans->signal(), QByteArray(SIGNAL(signalWithNoArg())));
- trans->setTargetState(s1);
- s0->addTransition(trans);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 1);
-
- emitter.emitSignalWithNoArg();
-
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- TEST_ACTIVE_CHANGED(s0, 2);
- }
- // Multiple transitions for same (object,signal)
- {
- QStateMachine machine;
- SignalEmitter emitter;
- QState *s0 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s0);
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QSignalTransition *t0 = s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), s1);
- QSignalTransition *t1 = s1->addTransition(&emitter, SIGNAL(signalWithNoArg()), s0);
-
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 1);
- TEST_ACTIVE_CHANGED(s1, 0);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s0));
-
- emitter.emitSignalWithNoArg();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 2);
- TEST_ACTIVE_CHANGED(s1, 1);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- s0->removeTransition(t0);
- emitter.emitSignalWithNoArg();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 3);
- TEST_ACTIVE_CHANGED(s1, 2);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s0));
-
- emitter.emitSignalWithNoArg();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 3);
- TEST_ACTIVE_CHANGED(s1, 2);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s0));
-
- s1->removeTransition(t1);
- emitter.emitSignalWithNoArg();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 3);
- TEST_ACTIVE_CHANGED(s1, 2);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s0));
-
- s0->addTransition(t0);
- s1->addTransition(t1);
- emitter.emitSignalWithNoArg();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 4);
- TEST_ACTIVE_CHANGED(s1, 3);
- QVERIFY(machine.isRunning());
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
- }
- // multiple signal transitions from same source
- {
- QStateMachine machine;
- SignalEmitter emitter;
- QState *s0 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s0);
- QFinalState *s1 = new QFinalState(&machine);
- s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), s1);
- QFinalState *s2 = new QFinalState(&machine);
- s0->addTransition(&emitter, SIGNAL(signalWithIntArg(int)), s2);
- QFinalState *s3 = new QFinalState(&machine);
- s0->addTransition(&emitter, SIGNAL(signalWithStringArg(QString)), s3);
-
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(startedSpy.isValid());
- QVERIFY(finishedSpy.isValid());
- QVERIFY(runningSpy.isValid());
- machine.setInitialState(s0);
-
- machine.start();
- TEST_ACTIVE_CHANGED(s0, 1);
- QTRY_COMPARE(startedSpy.count(), 1);
- TEST_RUNNING_CHANGED(true);
- emitter.emitSignalWithNoArg();
- TEST_ACTIVE_CHANGED(s0, 2);
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- machine.start();
- TEST_ACTIVE_CHANGED(s0, 3);
- QTRY_COMPARE(startedSpy.count(), 2);
- TEST_RUNNING_CHANGED(true);
- emitter.emitSignalWithIntArg(123);
- TEST_ACTIVE_CHANGED(s0, 4);
- QTRY_COMPARE(finishedSpy.count(), 2);
- TEST_RUNNING_CHANGED(false);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s2));
-
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 5);
- QTRY_COMPARE(startedSpy.count(), 3);
- TEST_RUNNING_CHANGED(true);
- emitter.emitSignalWithStringArg("hello");
- TEST_ACTIVE_CHANGED(s0, 6);
- QTRY_COMPARE(finishedSpy.count(), 3);
- TEST_RUNNING_CHANGED(false);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s3));
- }
- // signature normalization
- {
- QStateMachine machine;
- SignalEmitter emitter;
- QState *s0 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s0);
- QFinalState *s1 = new QFinalState(&machine);
- QSignalTransition *t0 = s0->addTransition(&emitter, SIGNAL(signalWithNoArg()), s1);
- QVERIFY(t0 != 0);
- QCOMPARE(t0->signal(), QByteArray(SIGNAL(signalWithNoArg())));
-
- QSignalTransition *t1 = s0->addTransition(&emitter, SIGNAL(signalWithStringArg(QString)), s1);
- QVERIFY(t1 != 0);
- QCOMPARE(t1->signal(), QByteArray(SIGNAL(signalWithStringArg(QString))));
-
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(startedSpy.isValid());
- QVERIFY(finishedSpy.isValid());
- QVERIFY(runningSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 1);
- QTRY_COMPARE(startedSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 0);
- TEST_RUNNING_CHANGED(true);
-
- emitter.emitSignalWithNoArg();
-
- TEST_ACTIVE_CHANGED(s0, 2);
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
- }
-}
-
-class TestEventTransition : public QEventTransition
-{
-public:
- TestEventTransition(QState *sourceState = 0)
- : QEventTransition(sourceState),
- m_eventSource(0), m_eventType(QEvent::None)
- {}
- TestEventTransition(QObject *object, QEvent::Type type,
- QAbstractState *target)
- : QEventTransition(object, type),
- m_eventSource(0), m_eventType(QEvent::None)
- { setTargetState(target); }
- QObject *eventSourceReceived() const {
- return m_eventSource;
- }
- QEvent::Type eventTypeReceived() const {
- return m_eventType;
- }
-protected:
- bool eventTest(QEvent *e) {
- if (!QEventTransition::eventTest(e))
- return false;
- QStateMachine::WrappedEvent *we = static_cast<QStateMachine::WrappedEvent*>(e);
- m_eventSource = we->object();
- m_eventType = we->event()->type();
- return true;
- }
-private:
- QObject *m_eventSource;
- QEvent::Type m_eventType;
-};
-
-#ifndef QT_NO_WIDGETS
-void tst_QStateMachine::eventTransitions()
-{
- QPushButton button;
- {
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- QFinalState *s1 = new QFinalState(&machine);
-
- QMouseEventTransition *trans;
- trans = new QMouseEventTransition(&button, QEvent::MouseButtonPress, Qt::LeftButton);
- QCOMPARE(trans->targetState(), (QAbstractState*)0);
- trans->setTargetState(s1);
- QCOMPARE(trans->eventType(), QEvent::MouseButtonPress);
- QCOMPARE(trans->button(), Qt::LeftButton);
- QCOMPARE(trans->targetState(), (QAbstractState*)s1);
- s0->addTransition(trans);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
-
- QTest::mousePress(&button, Qt::LeftButton);
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
-
- QTest::mousePress(&button, Qt::LeftButton);
-
- trans->setEventType(QEvent::MouseButtonRelease);
- QCOMPARE(trans->eventType(), QEvent::MouseButtonRelease);
- machine.start();
- QCoreApplication::processEvents();
- QTest::mouseRelease(&button, Qt::LeftButton);
- QTRY_COMPARE(finishedSpy.count(), 2);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
-
- machine.start();
- QCoreApplication::processEvents();
- trans->setEventType(QEvent::MouseButtonPress);
- QTest::mousePress(&button, Qt::LeftButton);
- QTRY_COMPARE(finishedSpy.count(), 3);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
-
- QPushButton button2;
- machine.start();
- QCoreApplication::processEvents();
- trans->setEventSource(&button2);
- QTest::mousePress(&button2, Qt::LeftButton);
- QTRY_COMPARE(finishedSpy.count(), 4);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- }
- for (int x = 0; x < 2; ++x) {
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- QFinalState *s1 = new QFinalState(&machine);
-
- QEventTransition *trans = 0;
- if (x == 0) {
- trans = new QEventTransition();
- QCOMPARE(trans->eventSource(), (QObject*)0);
- QCOMPARE(trans->eventType(), QEvent::None);
- trans->setEventSource(&button);
- trans->setEventType(QEvent::MouseButtonPress);
- trans->setTargetState(s1);
- } else if (x == 1) {
- trans = new QEventTransition(&button, QEvent::MouseButtonPress);
- trans->setTargetState(s1);
- }
- QCOMPARE(trans->eventSource(), (QObject*)&button);
- QCOMPARE(trans->eventType(), QEvent::MouseButtonPress);
- QCOMPARE(trans->targetState(), (QAbstractState*)s1);
- s0->addTransition(trans);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
-
- QTest::mousePress(&button, Qt::LeftButton);
- QCoreApplication::processEvents();
-
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- }
- {
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- QFinalState *s1 = new QFinalState(&machine);
-
- QMouseEventTransition *trans = new QMouseEventTransition();
- QCOMPARE(trans->eventSource(), (QObject*)0);
- QCOMPARE(trans->eventType(), QEvent::None);
- QCOMPARE(trans->button(), Qt::NoButton);
- trans->setEventSource(&button);
- trans->setEventType(QEvent::MouseButtonPress);
- trans->setButton(Qt::LeftButton);
- trans->setTargetState(s1);
- s0->addTransition(trans);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
- TEST_RUNNING_CHANGED(true);
- QTest::mousePress(&button, Qt::LeftButton);
- QCoreApplication::processEvents();
-
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
- }
-
- {
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- QFinalState *s1 = new QFinalState(&machine);
-
- QKeyEventTransition *trans = new QKeyEventTransition(&button, QEvent::KeyPress, Qt::Key_A);
- QCOMPARE(trans->eventType(), QEvent::KeyPress);
- QCOMPARE(trans->key(), (int)Qt::Key_A);
- trans->setTargetState(s1);
- s0->addTransition(trans);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
- TEST_RUNNING_CHANGED(true);
-
- QTest::keyPress(&button, Qt::Key_A);
- QCoreApplication::processEvents();
-
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
- }
- {
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- QFinalState *s1 = new QFinalState(&machine);
-
- QKeyEventTransition *trans = new QKeyEventTransition();
- QCOMPARE(trans->eventSource(), (QObject*)0);
- QCOMPARE(trans->eventType(), QEvent::None);
- QCOMPARE(trans->key(), 0);
- trans->setEventSource(&button);
- trans->setEventType(QEvent::KeyPress);
- trans->setKey(Qt::Key_A);
- trans->setTargetState(s1);
- s0->addTransition(trans);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
- TEST_RUNNING_CHANGED(true);
-
- QTest::keyPress(&button, Qt::Key_A);
- QCoreApplication::processEvents();
-
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
- }
- // Multiple transitions for same (object,event)
- {
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- QState *s1 = new QState(&machine);
- QEventTransition *t0 = new QEventTransition(&button, QEvent::MouseButtonPress);
- t0->setTargetState(s1);
- s0->addTransition(t0);
- QEventTransition *t1 = new QEventTransition(&button, QEvent::MouseButtonPress);
- t1->setTargetState(s0);
- s1->addTransition(t1);
-
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s0));
-
- QTest::mousePress(&button, Qt::LeftButton);
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- s0->removeTransition(t0);
- QTest::mousePress(&button, Qt::LeftButton);
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s0));
-
- QTest::mousePress(&button, Qt::LeftButton);
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s0));
-
- s1->removeTransition(t1);
- QTest::mousePress(&button, Qt::LeftButton);
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s0));
-
- s0->addTransition(t0);
- s1->addTransition(t1);
- QTest::mousePress(&button, Qt::LeftButton);
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
- }
- // multiple event transitions from same source
- {
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- QFinalState *s1 = new QFinalState(&machine);
- QFinalState *s2 = new QFinalState(&machine);
- QEventTransition *t0 = new QEventTransition(&button, QEvent::MouseButtonPress);
- t0->setTargetState(s1);
- s0->addTransition(t0);
- QEventTransition *t1 = new QEventTransition(&button, QEvent::MouseButtonRelease);
- t1->setTargetState(s2);
- s0->addTransition(t1);
-
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(startedSpy.isValid());
- QVERIFY(finishedSpy.isValid());
- QVERIFY(runningSpy.isValid());
- machine.setInitialState(s0);
-
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 1);
- TEST_RUNNING_CHANGED(true);
- QTest::mousePress(&button, Qt::LeftButton);
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 2);
- TEST_RUNNING_CHANGED(true);
- QTest::mouseRelease(&button, Qt::LeftButton);
- QTRY_COMPARE(finishedSpy.count(), 2);
- TEST_RUNNING_CHANGED(false);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s2));
- }
- // custom event
- {
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- QFinalState *s1 = new QFinalState(&machine);
-
- QEventTransition *trans = new QEventTransition(&button, QEvent::Type(QEvent::User+1));
- trans->setTargetState(s1);
- s0->addTransition(trans);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QVERIFY(startedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QTest::ignoreMessage(QtWarningMsg, "QObject event transitions are not supported for custom types");
- QTRY_COMPARE(startedSpy.count(), 1);
- TEST_RUNNING_CHANGED(true);
- }
- // custom transition
- {
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- QFinalState *s1 = new QFinalState(&machine);
-
- TestEventTransition *trans = new TestEventTransition(&button, QEvent::MouseButtonPress, s1);
- s0->addTransition(trans);
- QCOMPARE(trans->eventSourceReceived(), (QObject*)0);
- QCOMPARE(trans->eventTypeReceived(), QEvent::None);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.setInitialState(s0);
- machine.start();
- QCoreApplication::processEvents();
- TEST_RUNNING_CHANGED(true);
-
- QTest::mousePress(&button, Qt::LeftButton);
- QCoreApplication::processEvents();
-
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
-
- QCOMPARE(trans->eventSourceReceived(), (QObject*)&button);
- QCOMPARE(trans->eventTypeReceived(), QEvent::MouseButtonPress);
- }
-}
-
-void tst_QStateMachine::graphicsSceneEventTransitions()
-{
- QGraphicsScene scene;
- QGraphicsTextItem *textItem = scene.addText("foo");
-
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- QFinalState *s2 = new QFinalState(&machine);
- QEventTransition *t = new QEventTransition(textItem, QEvent::GraphicsSceneMouseMove);
- t->setTargetState(s2);
- s1->addTransition(t);
- machine.setInitialState(s1);
-
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(startedSpy.isValid());
- QVERIFY(finishedSpy.isValid());
- QVERIFY(runningSpy.isValid());
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 0);
- TEST_RUNNING_CHANGED(true);
- QGraphicsSceneMouseEvent mouseEvent(QEvent::GraphicsSceneMouseMove);
- scene.sendEvent(textItem, &mouseEvent);
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
-}
-#endif
-
-void tst_QStateMachine::historyStates()
-{
- for (int x = 0; x < 2; ++x) {
- QStateMachine machine;
- QState *root = &machine;
- QState *s0 = new QState(root);
- DEFINE_ACTIVE_SPY(s0);
- QState *s00 = new QState(s0);
- DEFINE_ACTIVE_SPY(s00);
- QState *s01 = new QState(s0);
- DEFINE_ACTIVE_SPY(s01);
- QHistoryState *s0h;
- if (x == 0) {
- s0h = new QHistoryState(s0);
- QCOMPARE(s0h->historyType(), QHistoryState::ShallowHistory);
- s0h->setHistoryType(QHistoryState::DeepHistory);
- } else {
- s0h = new QHistoryState(QHistoryState::DeepHistory, s0);
- }
- QCOMPARE(s0h->historyType(), QHistoryState::DeepHistory);
- s0h->setHistoryType(QHistoryState::ShallowHistory);
- QCOMPARE(s0h->historyType(), QHistoryState::ShallowHistory);
- QCOMPARE(s0h->defaultState(), (QAbstractState*)0);
- s0h->setDefaultState(s00);
- QCOMPARE(s0h->defaultState(), (QAbstractState*)s00);
- const QString warning
- = QString::asprintf("QHistoryState::setDefaultState: state %p does not belong to this history state's group (%p)", s0, s0);
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
- s0h->setDefaultState(s0);
- QState *s1 = new QState(root);
- DEFINE_ACTIVE_SPY(s1);
- QFinalState *s2 = new QFinalState(root);
-
- s00->addTransition(new StringTransition("a", s01));
- s0->addTransition(new StringTransition("b", s1));
- s1->addTransition(new StringTransition("c", s0h));
- s0->addTransition(new StringTransition("d", s2));
-
- root->setInitialState(s0);
- s0->setInitialState(s00);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 1);
- TEST_ACTIVE_CHANGED(s00, 1);
- TEST_ACTIVE_CHANGED(s01, 0);
- TEST_ACTIVE_CHANGED(s1, 0);
- QCOMPARE(machine.configuration().size(), 2);
- QVERIFY(machine.configuration().contains(s0));
- QVERIFY(machine.configuration().contains(s00));
-
- machine.postEvent(new StringEvent("a"));
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 1);
- TEST_ACTIVE_CHANGED(s00, 2);
- TEST_ACTIVE_CHANGED(s01, 1);
- TEST_ACTIVE_CHANGED(s1, 0);
- QCOMPARE(machine.configuration().size(), 2);
- QVERIFY(machine.configuration().contains(s0));
- QVERIFY(machine.configuration().contains(s01));
-
- machine.postEvent(new StringEvent("b"));
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 2);
- TEST_ACTIVE_CHANGED(s00, 2);
- TEST_ACTIVE_CHANGED(s01, 2);
- TEST_ACTIVE_CHANGED(s1, 1);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- machine.postEvent(new StringEvent("c"));
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 3);
- TEST_ACTIVE_CHANGED(s00, 2);
- TEST_ACTIVE_CHANGED(s01, 3);
- TEST_ACTIVE_CHANGED(s1, 2);
- QCOMPARE(machine.configuration().size(), 2);
- QVERIFY(machine.configuration().contains(s0));
- QVERIFY(machine.configuration().contains(s01));
-
- machine.postEvent(new StringEvent("d"));
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s0, 4);
- TEST_ACTIVE_CHANGED(s00, 2);
- TEST_ACTIVE_CHANGED(s01, 4);
- TEST_ACTIVE_CHANGED(s1, 2);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s2));
-
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- }
-}
-
-void tst_QStateMachine::startAndStop()
-{
- QStateMachine machine;
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
-
- QVERIFY(startedSpy.isValid());
- QVERIFY(stoppedSpy.isValid());
- QVERIFY(finishedSpy.isValid());
- QVERIFY(runningSpy.isValid());
-
- QVERIFY(!machine.isRunning());
- QTest::ignoreMessage(QtWarningMsg, "QStateMachine::start: No initial state set for machine. Refusing to start.");
- machine.start();
- QCOMPARE(startedSpy.count(), 0);
- QCOMPARE(stoppedSpy.count(), 0);
- QCOMPARE(finishedSpy.count(), 0);
- QCOMPARE(runningSpy.count(), 0);
- QVERIFY(!machine.isRunning());
- machine.stop();
- QCOMPARE(startedSpy.count(), 0);
- QCOMPARE(stoppedSpy.count(), 0);
- QCOMPARE(finishedSpy.count(), 0);
- QCOMPARE(runningSpy.count(), 0);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 1);
- QTRY_COMPARE(machine.isRunning(), true);
- QTRY_COMPARE(startedSpy.count(), 1);
- QCOMPARE(stoppedSpy.count(), 0);
- QCOMPARE(finishedSpy.count(), 0);
- TEST_RUNNING_CHANGED(true);
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- QTest::ignoreMessage(QtWarningMsg, "QStateMachine::start(): already running");
- machine.start();
- QCOMPARE(runningSpy.count(), 0);
-
- machine.stop();
- TEST_ACTIVE_CHANGED(s1, 1);
- QTRY_COMPARE(machine.isRunning(), false);
- QTRY_COMPARE(stoppedSpy.count(), 1);
- QCOMPARE(startedSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 0);
- TEST_RUNNING_CHANGED(false);
-
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 3);
- machine.stop();
- TEST_ACTIVE_CHANGED(s1, 3);
- QTRY_COMPARE(startedSpy.count(), 2);
- QTRY_COMPARE(stoppedSpy.count(), 2);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
-}
-
-void tst_QStateMachine::setRunning()
-{
- QStateMachine machine;
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
-
- QVERIFY(startedSpy.isValid());
- QVERIFY(stoppedSpy.isValid());
- QVERIFY(finishedSpy.isValid());
- QVERIFY(runningSpy.isValid());
-
- QVERIFY(!machine.isRunning());
- QTest::ignoreMessage(QtWarningMsg, "QStateMachine::start: No initial state set for machine. Refusing to start.");
- machine.setRunning(true);
- QCOMPARE(startedSpy.count(), 0);
- QCOMPARE(stoppedSpy.count(), 0);
- QCOMPARE(finishedSpy.count(), 0);
- QCOMPARE(runningSpy.count(), 0);
- QVERIFY(!machine.isRunning());
- machine.setRunning(false);
- QCOMPARE(startedSpy.count(), 0);
- QCOMPARE(stoppedSpy.count(), 0);
- QCOMPARE(finishedSpy.count(), 0);
- QCOMPARE(runningSpy.count(), 0);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
- machine.setRunning(true);
- TEST_ACTIVE_CHANGED(s1, 1);
- QTRY_COMPARE(machine.isRunning(), true);
- QTRY_COMPARE(startedSpy.count(), 1);
- QCOMPARE(stoppedSpy.count(), 0);
- QCOMPARE(finishedSpy.count(), 0);
- TEST_RUNNING_CHANGED(true);
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- QTest::ignoreMessage(QtWarningMsg, "QStateMachine::start(): already running");
- machine.setRunning(true);
- TEST_ACTIVE_CHANGED(s1, 1);
- QCOMPARE(runningSpy.count(), 0);
-
- machine.setRunning(false);
- TEST_ACTIVE_CHANGED(s1, 1);
- QTRY_COMPARE(machine.isRunning(), false);
- QTRY_COMPARE(stoppedSpy.count(), 1);
- QCOMPARE(startedSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 0);
- TEST_RUNNING_CHANGED(false);
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- machine.setRunning(false);
- QCOMPARE(runningSpy.count(), 0);
- TEST_ACTIVE_CHANGED(s1, 1);
-
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 3);
- machine.setRunning(false);
- TEST_ACTIVE_CHANGED(s1, 3);
- QTRY_COMPARE(startedSpy.count(), 2);
- QTRY_COMPARE(stoppedSpy.count(), 2);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- QState *s1_1 = new QState(s1);
- QFinalState *s1_2 = new QFinalState(s1);
- s1_1->addTransition(s1_2);
- s1->setInitialState(s1_1);
- QFinalState *s2 = new QFinalState(&machine);
- s1->addTransition(s1, SIGNAL(finished()), s2);
- machine.setRunning(false);
- QCOMPARE(runningSpy.count(), 0);
- machine.setRunning(true);
- TEST_ACTIVE_CHANGED(s1, 6);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- QTRY_COMPARE(startedSpy.count(), 3);
- QCOMPARE(stoppedSpy.count(), 2);
- QCOMPARE(finishedSpy.count(), 1);
-}
-
-void tst_QStateMachine::targetStateWithNoParent()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->setObjectName("s1");
- QState s2;
- s1->addTransition(&s2);
- machine.setInitialState(s1);
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
-
- QVERIFY(startedSpy.isValid());
- QVERIFY(stoppedSpy.isValid());
- QVERIFY(finishedSpy.isValid());
- QVERIFY(runningSpy.isValid());
-
- machine.start();
- QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: "
- "Child mode of state machine '' is not 'ExclusiveStates'.");
- TEST_ACTIVE_CHANGED(s1, 2);
- QTRY_COMPARE(startedSpy.count(), 1);
- QCOMPARE(machine.isRunning(), false);
- QCOMPARE(stoppedSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 0);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- QCOMPARE(machine.error(), QStateMachine::StateMachineChildModeSetToParallelError);
-}
-
-void tst_QStateMachine::targetStateDeleted()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- s1->setObjectName("s1");
- QState *s2 = new QState(&machine);
- QAbstractTransition *trans = s1->addTransition(s2);
- delete s2;
- QCOMPARE(trans->targetState(), (QAbstractState*)0);
- QVERIFY(trans->targetStates().isEmpty());
-}
-
-void tst_QStateMachine::defaultGlobalRestorePolicy()
-{
- QStateMachine machine;
-
- QObject *propertyHolder = new QObject(&machine);
- propertyHolder->setProperty("a", 1);
- propertyHolder->setProperty("b", 2);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->assignProperty(propertyHolder, "a", 3);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(propertyHolder, "b", 4);
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
-
- s1->addTransition(new EventTransition(QEvent::User, s2));
- s2->addTransition(new EventTransition(QEvent::User, s3));
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- QCOMPARE(propertyHolder->property("a").toInt(), 3);
- QCOMPARE(propertyHolder->property("b").toInt(), 2);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s3, 0);
- QCOMPARE(propertyHolder->property("a").toInt(), 3);
- QCOMPARE(propertyHolder->property("b").toInt(), 4);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- QVERIFY(machine.isRunning());
- QCOMPARE(propertyHolder->property("a").toInt(), 3);
- QCOMPARE(propertyHolder->property("b").toInt(), 4);
-}
-
-void tst_QStateMachine::noInitialStateForInitialState()
-{
- QStateMachine machine;
-
- QState *initialState = new QState(&machine);
- DEFINE_ACTIVE_SPY(initialState);
- initialState->setObjectName("initialState");
- machine.setInitialState(initialState);
-
- QState *childState = new QState(initialState);
- DEFINE_ACTIVE_SPY(childState);
- (void)childState;
-
- QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: "
- "Missing initial state in compound state 'initialState'");
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(initialState, 1);
- TEST_ACTIVE_CHANGED(childState, 0);
- QCOMPARE(machine.isRunning(), false);
- QCOMPARE(int(machine.error()), int(QStateMachine::NoInitialStateError));
-}
-
-void tst_QStateMachine::globalRestorePolicySetToDontRestore()
-{
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QState::DontRestoreProperties);
-
- QObject *propertyHolder = new QObject(&machine);
- propertyHolder->setProperty("a", 1);
- propertyHolder->setProperty("b", 2);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->assignProperty(propertyHolder, "a", 3);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(propertyHolder, "b", 4);
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
-
- s1->addTransition(new EventTransition(QEvent::User, s2));
- s2->addTransition(new EventTransition(QEvent::User, s3));
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- QCOMPARE(propertyHolder->property("a").toInt(), 3);
- QCOMPARE(propertyHolder->property("b").toInt(), 2);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s3, 0);
- QCOMPARE(propertyHolder->property("a").toInt(), 3);
- QCOMPARE(propertyHolder->property("b").toInt(), 4);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- QVERIFY(machine.isRunning());
- QCOMPARE(propertyHolder->property("a").toInt(), 3);
- QCOMPARE(propertyHolder->property("b").toInt(), 4);
-}
-
-void tst_QStateMachine::globalRestorePolicySetToRestore()
-{
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QState::RestoreProperties);
-
- QObject *propertyHolder = new QObject(&machine);
- propertyHolder->setProperty("a", 1);
- propertyHolder->setProperty("b", 2);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->assignProperty(propertyHolder, "a", 3);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(propertyHolder, "b", 4);
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
-
- s1->addTransition(new EventTransition(QEvent::User, s2));
- s2->addTransition(new EventTransition(QEvent::User, s3));
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- QCOMPARE(propertyHolder->property("a").toInt(), 3);
- QCOMPARE(propertyHolder->property("b").toInt(), 2);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s3, 0);
- QCOMPARE(propertyHolder->property("a").toInt(), 1);
- QCOMPARE(propertyHolder->property("b").toInt(), 4);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- QVERIFY(machine.isRunning());
- QCOMPARE(propertyHolder->property("a").toInt(), 1);
- QCOMPARE(propertyHolder->property("b").toInt(), 2);
-}
-
-void tst_QStateMachine::transitionWithParent()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- QState *s2 = new QState(&machine);
- EventTransition *trans = new EventTransition(QEvent::User, s2, s1);
- QCOMPARE(trans->sourceState(), s1);
- QCOMPARE(trans->targetState(), (QAbstractState*)s2);
- QCOMPARE(trans->targetStates().size(), 1);
- QCOMPARE(trans->targetStates().at(0), (QAbstractState*)s2);
-}
-
-void tst_QStateMachine::simpleAnimation()
-{
- QStateMachine machine;
-
- QObject *object = new QObject(&machine);
- object->setProperty("fooBar", 1.0);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(object, "fooBar", 2.0);
-
- EventTransition *et = new EventTransition(QEvent::User, s2);
- QPropertyAnimation *animation = new QPropertyAnimation(object, "fooBar", s2);
- et->addAnimation(animation);
- s1->addTransition(et);
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- s2->addTransition(animation, SIGNAL(finished()), s3);
- QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCOREAPPLICATION_EXEC(5000);
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- QVERIFY(machine.isRunning());
- QVERIFY(machine.configuration().contains(s3));
- QCOMPARE(object->property("fooBar").toDouble(), 2.0);
-}
-
-class SlotCalledCounter: public QObject
-{
- Q_OBJECT
-public:
- SlotCalledCounter() : counter(0) {}
-
- int counter;
-
-public slots:
- void slot() { counter++; }
-};
-
-void tst_QStateMachine::twoAnimations()
-{
- QStateMachine machine;
-
- QObject *object = new QObject(&machine);
- object->setProperty("foo", 1.0);
- object->setProperty("bar", 3.0);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(object, "foo", 2.0);
- s2->assignProperty(object, "bar", 10.0);
-
- QPropertyAnimation *animationFoo = new QPropertyAnimation(object, "foo", s2);
- QPropertyAnimation *animationBar = new QPropertyAnimation(object, "bar", s2);
- animationBar->setDuration(900);
-
- SlotCalledCounter counter;
- connect(animationFoo, SIGNAL(finished()), &counter, SLOT(slot()));
- connect(animationBar, SIGNAL(finished()), &counter, SLOT(slot()));
-
- EventTransition *et = new EventTransition(QEvent::User, s2);
- et->addAnimation(animationFoo);
- et->addAnimation(animationBar);
- s1->addTransition(et);
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
- s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCOREAPPLICATION_EXEC(5000);
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- QVERIFY(machine.isRunning());
-
- QVERIFY(machine.configuration().contains(s3));
- QCOMPARE(object->property("foo").toDouble(), 2.0);
- QCOMPARE(object->property("bar").toDouble(), 10.0);
-
- QCOMPARE(counter.counter, 2);
-}
-
-void tst_QStateMachine::twoAnimatedTransitions()
-{
- QStateMachine machine;
-
- QObject *object = new QObject(&machine);
- object->setProperty("foo", 1.0);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(object, "foo", 5.0);
- QPropertyAnimation *fooAnimation = new QPropertyAnimation(object, "foo", s2);
- EventTransition *trans = new EventTransition(QEvent::User, s2);
- s1->addTransition(trans);
- trans->addAnimation(fooAnimation);
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
- s2->addTransition(fooAnimation, SIGNAL(finished()), s3);
-
- QState *s4 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s4);
- s4->assignProperty(object, "foo", 2.0);
- QPropertyAnimation *fooAnimation2 = new QPropertyAnimation(object, "foo", s4);
- trans = new EventTransition(QEvent::User, s4);
- s3->addTransition(trans);
- trans->addAnimation(fooAnimation2);
-
- QState *s5 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s5);
- QObject::connect(s5, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
- s4->addTransition(fooAnimation2, SIGNAL(finished()), s5);
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- TEST_ACTIVE_CHANGED(s4, 0);
- TEST_ACTIVE_CHANGED(s5, 0);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCOREAPPLICATION_EXEC(5000);
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- TEST_ACTIVE_CHANGED(s4, 0);
- TEST_ACTIVE_CHANGED(s5, 0);
- QVERIFY(machine.configuration().contains(s3));
- QCOMPARE(object->property("foo").toDouble(), 5.0);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCOREAPPLICATION_EXEC(5000);
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 2);
- TEST_ACTIVE_CHANGED(s4, 2);
- TEST_ACTIVE_CHANGED(s5, 1);
- QVERIFY(machine.isRunning());
- QVERIFY(machine.configuration().contains(s5));
- QCOMPARE(object->property("foo").toDouble(), 2.0);
-}
-
-void tst_QStateMachine::playAnimationTwice()
-{
- QStateMachine machine;
-
- QObject *object = new QObject(&machine);
- object->setProperty("foo", 1.0);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(object, "foo", 5.0);
- QPropertyAnimation *fooAnimation = new QPropertyAnimation(object, "foo", s2);
- EventTransition *trans = new EventTransition(QEvent::User, s2);
- s1->addTransition(trans);
- trans->addAnimation(fooAnimation);
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
- s2->addTransition(fooAnimation, SIGNAL(finished()), s3);
-
- QState *s4 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s4);
- s4->assignProperty(object, "foo", 2.0);
- trans = new EventTransition(QEvent::User, s4);
- s3->addTransition(trans);
- trans->addAnimation(fooAnimation);
-
- QState *s5 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s5);
- QObject::connect(s5, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
- s4->addTransition(fooAnimation, SIGNAL(finished()), s5);
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- TEST_ACTIVE_CHANGED(s4, 0);
- TEST_ACTIVE_CHANGED(s5, 0);
- machine.postEvent(new QEvent(QEvent::User));
- QCOREAPPLICATION_EXEC(5000);
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- TEST_ACTIVE_CHANGED(s4, 0);
- TEST_ACTIVE_CHANGED(s5, 0);
- QVERIFY(machine.configuration().contains(s3));
- QCOMPARE(object->property("foo").toDouble(), 5.0);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCOREAPPLICATION_EXEC(5000);
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 2);
- TEST_ACTIVE_CHANGED(s4, 2);
- TEST_ACTIVE_CHANGED(s5, 1);
- QVERIFY(machine.isRunning());
- QVERIFY(machine.configuration().contains(s5));
- QCOMPARE(object->property("foo").toDouble(), 2.0);
-}
-
-void tst_QStateMachine::nestedTargetStateForAnimation()
-{
- QStateMachine machine;
-
- QObject *object = new QObject(&machine);
- object->setProperty("foo", 1.0);
- object->setProperty("bar", 3.0);
-
- SlotCalledCounter counter;
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
-
- s2->assignProperty(object, "foo", 2.0);
-
- QState *s2Child = new QState(s2);
- DEFINE_ACTIVE_SPY(s2Child);
- s2Child->assignProperty(object, "bar", 10.0);
- s2->setInitialState(s2Child);
-
- QState *s2Child2 = new QState(s2);
- DEFINE_ACTIVE_SPY(s2Child2);
- s2Child2->assignProperty(object, "bar", 11.0);
- QAbstractTransition *at = new EventTransition(QEvent::User, s2Child2);
- s2Child->addTransition(at);
-
- QPropertyAnimation *animation = new QPropertyAnimation(object, "bar", s2);
- animation->setDuration(2000);
- connect(animation, SIGNAL(finished()), &counter, SLOT(slot()));
- at->addAnimation(animation);
-
- at = new EventTransition(QEvent::User, s2);
- s1->addTransition(at);
-
- animation = new QPropertyAnimation(object, "foo", s2);
- connect(animation, SIGNAL(finished()), &counter, SLOT(slot()));
- at->addAnimation(animation);
-
- animation = new QPropertyAnimation(object, "bar", s2);
- connect(animation, SIGNAL(finished()), &counter, SLOT(slot()));
- at->addAnimation(animation);
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- s2->addTransition(s2Child, SIGNAL(propertiesAssigned()), s3);
-
- QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s2Child, 0);
- TEST_ACTIVE_CHANGED(s2Child2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- machine.postEvent(new QEvent(QEvent::User));
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s2Child, 1);
- TEST_ACTIVE_CHANGED(s2Child2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
-
- QCOREAPPLICATION_EXEC(5000);
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s2Child, 2);
- TEST_ACTIVE_CHANGED(s2Child2, 0);
- TEST_ACTIVE_CHANGED(s3, 1);
- QVERIFY(machine.isRunning());
- QVERIFY(machine.configuration().contains(s3));
- QCOMPARE(object->property("foo").toDouble(), 2.0);
- QCOMPARE(object->property("bar").toDouble(), 10.0);
- QCOMPARE(counter.counter, 2);
-}
-
-void tst_QStateMachine::propertiesAssignedSignalTransitionsReuseAnimationGroup()
-{
- QStateMachine machine;
- QObject *object = new QObject(&machine);
- object->setProperty("foo", 0);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->assignProperty(object, "foo", 123);
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(object, "foo", 456);
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- s3->assignProperty(object, "foo", 789);
- QFinalState *s4 = new QFinalState(&machine);
-
- QParallelAnimationGroup animationGroup;
- animationGroup.addAnimation(new QPropertyAnimation(object, "foo"));
- QSignalSpy animationFinishedSpy(&animationGroup, &QParallelAnimationGroup::finished);
- QVERIFY(animationFinishedSpy.isValid());
- s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2)->addAnimation(&animationGroup);
- s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3)->addAnimation(&animationGroup);
- s3->addTransition(s3, SIGNAL(propertiesAssigned()), s4);
-
- machine.setInitialState(s1);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy machineFinishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(machineFinishedSpy.isValid());
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 2);
- QTRY_COMPARE(machineFinishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- QVERIFY(!machine.isRunning());
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s4));
- QCOMPARE(object->property("foo").toInt(), 789);
- QCOMPARE(animationFinishedSpy.count(), 2);
-
-}
-
-void tst_QStateMachine::animatedGlobalRestoreProperty()
-{
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QState::RestoreProperties);
-
- QObject *object = new QObject(&machine);
- object->setProperty("foo", 1.0);
-
- SlotCalledCounter counter;
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(object, "foo", 2.0);
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
-
- QState *s4 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s4);
- QObject::connect(s4, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
-
- QAbstractTransition *at = new EventTransition(QEvent::User, s2);
- s1->addTransition(at);
- QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", s2);
- connect(pa, SIGNAL(finished()), &counter, SLOT(slot()));
- at->addAnimation(pa);
-
- at = s2->addTransition(pa, SIGNAL(finished()), s3);
- pa = new QPropertyAnimation(object, "foo", s3);
- connect(pa, SIGNAL(finished()), &counter, SLOT(slot()));
- at->addAnimation(pa);
-
- at = s3->addTransition(pa, SIGNAL(finished()), s4);
- pa = new QPropertyAnimation(object, "foo", s4);
- connect(pa, SIGNAL(finished()), &counter, SLOT(slot()));
- at->addAnimation(pa);
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- TEST_ACTIVE_CHANGED(s4, 0);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s3, 0);
- TEST_ACTIVE_CHANGED(s4, 0);
-
- QCOREAPPLICATION_EXEC(5000);
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 2);
- TEST_ACTIVE_CHANGED(s4, 1);
- QVERIFY(machine.isRunning());
- QVERIFY(machine.configuration().contains(s4));
- QCOMPARE(object->property("foo").toDouble(), 1.0);
- QCOMPARE(counter.counter, 2);
-}
-
-void tst_QStateMachine::specificTargetValueOfAnimation()
-{
- QStateMachine machine;
-
- QObject *object = new QObject(&machine);
- object->setProperty("foo", 1.0);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(object, "foo", 2.0);
-
- QPropertyAnimation *anim = new QPropertyAnimation(object, "foo");
- anim->setEndValue(10.0);
- EventTransition *trans = new EventTransition(QEvent::User, s2);
- s1->addTransition(trans);
- trans->addAnimation(anim);
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
- s2->addTransition(anim, SIGNAL(finished()), s3);
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s3, 0);
-
- QCOREAPPLICATION_EXEC(5000);
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- QVERIFY(machine.isRunning());
- QVERIFY(machine.configuration().contains(s3));
- QCOMPARE(object->property("foo").toDouble(), 2.0);
- QCOMPARE(anim->endValue().toDouble(), 10.0);
-
- delete anim;
-}
-
-void tst_QStateMachine::addDefaultAnimation()
-{
- QStateMachine machine;
-
- QObject *object = new QObject();
- object->setProperty("foo", 1.0);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(object, "foo", 2.0);
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
-
- s1->addTransition(new EventTransition(QEvent::User, s2));
-
- QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", &machine);
- machine.addDefaultAnimation(pa);
- s2->addTransition(pa, SIGNAL(finished()), s3);
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s3, 0);
-
- QCOREAPPLICATION_EXEC(5000);
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- QVERIFY(machine.isRunning());
- QVERIFY(machine.configuration().contains(s3));
- QCOMPARE(object->property("foo").toDouble(), 2.0);
-
- delete object;
-}
-
-void tst_QStateMachine::addDefaultAnimationWithUnusedAnimation()
-{
- QStateMachine machine;
-
- QObject *object = new QObject(&machine);
- object->setProperty("foo", 1.0);
- object->setProperty("bar", 2.0);
-
- SlotCalledCounter counter;
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(object, "foo", 2.0);
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
-
- s1->addTransition(new EventTransition(QEvent::User, s2));
-
- QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", &machine);
- connect(pa, SIGNAL(finished()), &counter, SLOT(slot()));
- machine.addDefaultAnimation(pa);
- s2->addTransition(pa, SIGNAL(finished()), s3);
-
- pa = new QPropertyAnimation(object, "bar", &machine);
- connect(pa, SIGNAL(finished()), &counter, SLOT(slot()));
- machine.addDefaultAnimation(pa);
-
- machine.setInitialState(s1);
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s3, 0);
-
- QCOREAPPLICATION_EXEC(5000);
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- QVERIFY(machine.isRunning());
- QVERIFY(machine.configuration().contains(s3));
- QCOMPARE(object->property("foo").toDouble(), 2.0);
- QCOMPARE(counter.counter, 1);
-}
-
-void tst_QStateMachine::removeDefaultAnimation()
-{
- QStateMachine machine;
-
- QObject propertyHolder;
- propertyHolder.setProperty("foo", 0);
-
- QCOMPARE(machine.defaultAnimations().size(), 0);
-
- QPropertyAnimation *anim = new QPropertyAnimation(&propertyHolder, "foo");
-
- machine.addDefaultAnimation(anim);
-
- QCOMPARE(machine.defaultAnimations().size(), 1);
- QVERIFY(machine.defaultAnimations().contains(anim));
-
- machine.removeDefaultAnimation(anim);
-
- QCOMPARE(machine.defaultAnimations().size(), 0);
-
- machine.addDefaultAnimation(anim);
-
- QPropertyAnimation *anim2 = new QPropertyAnimation(&propertyHolder, "foo");
- machine.addDefaultAnimation(anim2);
-
- QCOMPARE(machine.defaultAnimations().size(), 2);
- QVERIFY(machine.defaultAnimations().contains(anim));
- QVERIFY(machine.defaultAnimations().contains(anim2));
-
- machine.removeDefaultAnimation(anim);
-
- QCOMPARE(machine.defaultAnimations().size(), 1);
- QVERIFY(machine.defaultAnimations().contains(anim2));
-
- machine.removeDefaultAnimation(anim2);
- QCOMPARE(machine.defaultAnimations().size(), 0);
-
- delete anim;
- delete anim2;
-}
-
-void tst_QStateMachine::overrideDefaultAnimationWithSpecific()
-{
- QStateMachine machine;
-
- QObject *object = new QObject(&machine);
- object->setProperty("foo", 1.0);
-
- SlotCalledCounter counter;
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(object, "foo", 2.0);
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
-
- QAbstractTransition *at = new EventTransition(QEvent::User, s2);
- s1->addTransition(at);
-
- QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo");
- connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)), &counter, SLOT(slot()));
-
- QPropertyAnimation *moreSpecificAnimation = new QPropertyAnimation(object, "foo");
- s2->addTransition(moreSpecificAnimation, SIGNAL(finished()), s3);
- connect(moreSpecificAnimation, SIGNAL(stateChanged(QAbstractAnimation::State,QAbstractAnimation::State)), &counter, SLOT(slot()));
-
- machine.addDefaultAnimation(defaultAnimation);
- at->addAnimation(moreSpecificAnimation);
-
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s3, 0);
-
- QCOREAPPLICATION_EXEC(5000);
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- QVERIFY(machine.isRunning());
- QVERIFY(machine.configuration().contains(s3));
- QCOMPARE(counter.counter, 2); // specific animation started and stopped
-
- delete defaultAnimation;
- delete moreSpecificAnimation;
-}
-
-void tst_QStateMachine::parallelStateAssignmentsDone()
-{
- QStateMachine machine;
-
- QObject *propertyHolder = new QObject(&machine);
- propertyHolder->setProperty("foo", 123);
- propertyHolder->setProperty("bar", 456);
- propertyHolder->setProperty("zoot", 789);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
-
- QState *parallelState = new QState(QState::ParallelStates, &machine);
- parallelState->assignProperty(propertyHolder, "foo", 321);
-
- QState *s2 = new QState(parallelState);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(propertyHolder, "bar", 654);
-
- QState *s3 = new QState(parallelState);
- DEFINE_ACTIVE_SPY(s3);
- s3->assignProperty(propertyHolder, "zoot", 987);
-
- s1->addTransition(new EventTransition(QEvent::User, parallelState));
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
-
- QCOMPARE(propertyHolder->property("foo").toInt(), 123);
- QCOMPARE(propertyHolder->property("bar").toInt(), 456);
- QCOMPARE(propertyHolder->property("zoot").toInt(), 789);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s3, 1);
- QVERIFY(machine.isRunning());
- QCOMPARE(propertyHolder->property("foo").toInt(), 321);
- QCOMPARE(propertyHolder->property("bar").toInt(), 654);
- QCOMPARE(propertyHolder->property("zoot").toInt(), 987);
-}
-
-void tst_QStateMachine::transitionsFromParallelStateWithNoChildren()
-{
- QStateMachine machine;
-
- QState *parallelState = new QState(QState::ParallelStates, &machine);
- DEFINE_ACTIVE_SPY(parallelState);
- machine.setInitialState(parallelState);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- parallelState->addTransition(new EventTransition(QEvent::User, s1));
-
- machine.start();
- QCoreApplication::processEvents();
- TEST_ACTIVE_CHANGED(parallelState, 1);
- TEST_ACTIVE_CHANGED(s1, 0);
-
- QCOMPARE(1, machine.configuration().size());
- QVERIFY(machine.configuration().contains(parallelState));
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(parallelState, 2);
- TEST_ACTIVE_CHANGED(s1, 1);
- QVERIFY(machine.isRunning());
- QCOMPARE(1, machine.configuration().size());
- QVERIFY(machine.configuration().contains(s1));
-}
-
-void tst_QStateMachine::parallelStateTransition()
-{
- // This test checks if the parallel state is exited and re-entered if one compound state
- // is exited and subsequently re-entered. When the parallel state is exited, the other compound
- // state in the parallel state has to be exited too. When the parallel state is re-entered, the
- // other state also needs to be re-entered.
-
- QStateMachine machine;
-
- QState *parallelState = new QState(QState::ParallelStates, &machine);
- parallelState->setObjectName("parallelState");
- DEFINE_ACTIVE_SPY(parallelState);
- machine.setInitialState(parallelState);
-
- QState *s1 = new QState(parallelState);
- s1->setObjectName("s1");
- DEFINE_ACTIVE_SPY(s1);
- QState *s2 = new QState(parallelState);
- s2->setObjectName("s2");
- DEFINE_ACTIVE_SPY(s2);
-
- QState *s1InitialChild = new QState(s1);
- s1InitialChild->setObjectName("s1InitialChild");
- DEFINE_ACTIVE_SPY(s1InitialChild);
- s1->setInitialState(s1InitialChild);
-
- QState *s2InitialChild = new QState(s2);
- s2InitialChild->setObjectName("s2InitialChild");
- DEFINE_ACTIVE_SPY(s2InitialChild);
- s2->setInitialState(s2InitialChild);
-
- QState *s1OtherChild = new QState(s1);
- s1OtherChild->setObjectName("s1OtherChild");
- DEFINE_ACTIVE_SPY(s1OtherChild);
-
- // The following transition will exit s1 (which means that parallelState is also exited), and
- // subsequently re-entered (which means that parallelState is also re-entered).
- EventTransition *et = new EventTransition(QEvent::User, s1OtherChild);
- et->setObjectName("s1->s1OtherChild");
- s1->addTransition(et);
-
- machine.start();
- QCoreApplication::processEvents();
-
- // Initial entrance of the parallel state and its sub-states:
- TEST_ACTIVE_CHANGED(parallelState, 1);
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s1InitialChild, 1);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s2InitialChild, 1);
- TEST_ACTIVE_CHANGED(s1OtherChild, 0);
-
- QVERIFY(machine.configuration().contains(parallelState));
- QVERIFY(machine.configuration().contains(s1));
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s1InitialChild));
- QVERIFY(machine.configuration().contains(s2InitialChild));
- QCOMPARE(machine.configuration().size(), 5);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(parallelState, 3); // initial + exit + entry
- TEST_ACTIVE_CHANGED(s1, 3); // initial + exit + entry
- TEST_ACTIVE_CHANGED(s1InitialChild, 2); // initial + exit
- TEST_ACTIVE_CHANGED(s2, 3); // initial + exit due to parent exit + entry due to parent re-entry
- TEST_ACTIVE_CHANGED(s2InitialChild, 3); // initial + exit due to parent exit + re-entry due to parent re-entry
- TEST_ACTIVE_CHANGED(s1OtherChild, 1); // entry due to transition
- QVERIFY(machine.isRunning());
-
- // Check that s1InitialChild is not in the configuration, because although s1 is re-entered,
- // another child state (s1OtherChild) is active, so the initial child should not be activated.
- QVERIFY(machine.configuration().contains(parallelState));
- QVERIFY(machine.configuration().contains(s1));
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s1OtherChild));
- QVERIFY(machine.configuration().contains(s2InitialChild));
- QCOMPARE(machine.configuration().size(), 5);
-}
-
-void tst_QStateMachine::nestedRestoreProperties()
-{
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QState::RestoreProperties);
-
- QObject *propertyHolder = new QObject(&machine);
- propertyHolder->setProperty("foo", 1);
- propertyHolder->setProperty("bar", 2);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(propertyHolder, "foo", 3);
-
- QState *s21 = new QState(s2);
- DEFINE_ACTIVE_SPY(s21);
- s21->assignProperty(propertyHolder, "bar", 4);
- s2->setInitialState(s21);
-
- QState *s22 = new QState(s2);
- DEFINE_ACTIVE_SPY(s22);
- s22->assignProperty(propertyHolder, "bar", 5);
-
- s1->addTransition(new EventTransition(QEvent::User, s2));
- s21->addTransition(new EventTransition(QEvent::User, s22));
-
- machine.start();
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s21, 0);
- TEST_ACTIVE_CHANGED(s22, 0);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
- QCOMPARE(propertyHolder->property("foo").toInt(), 1);
- QCOMPARE(propertyHolder->property("bar").toInt(), 2);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s21, 1);
- TEST_ACTIVE_CHANGED(s22, 0);
- QCOMPARE(machine.configuration().size(), 2);
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s21));
- QCOMPARE(propertyHolder->property("foo").toInt(), 3);
- QCOMPARE(propertyHolder->property("bar").toInt(), 4);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s21, 2);
- TEST_ACTIVE_CHANGED(s22, 1);
- QVERIFY(machine.isRunning());
- QCOMPARE(machine.configuration().size(), 2);
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s22));
- QCOMPARE(propertyHolder->property("foo").toInt(), 3);
- QCOMPARE(propertyHolder->property("bar").toInt(), 5);
-}
-
-void tst_QStateMachine::nestedRestoreProperties2()
-{
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QState::RestoreProperties);
-
- QObject *propertyHolder = new QObject(&machine);
- propertyHolder->setProperty("foo", 1);
- propertyHolder->setProperty("bar", 2);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(propertyHolder, "foo", 3);
-
- QState *s21 = new QState(s2);
- DEFINE_ACTIVE_SPY(s21);
- s21->assignProperty(propertyHolder, "bar", 4);
- s2->setInitialState(s21);
-
- QState *s22 = new QState(s2);
- DEFINE_ACTIVE_SPY(s22);
- s22->assignProperty(propertyHolder, "foo", 6);
- s22->assignProperty(propertyHolder, "bar", 5);
-
- s1->addTransition(new EventTransition(QEvent::User, s2));
- s21->addTransition(new EventTransition(QEvent::User, s22));
- s22->addTransition(new EventTransition(QEvent::User, s21));
-
- machine.start();
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s21, 0);
- TEST_ACTIVE_CHANGED(s22, 0);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
- QCOMPARE(propertyHolder->property("foo").toInt(), 1);
- QCOMPARE(propertyHolder->property("bar").toInt(), 2);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s21, 1);
- TEST_ACTIVE_CHANGED(s22, 0);
- QCOMPARE(machine.configuration().size(), 2);
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s21));
- QCOMPARE(propertyHolder->property("foo").toInt(), 3);
- QCOMPARE(propertyHolder->property("bar").toInt(), 4);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s21, 2);
- TEST_ACTIVE_CHANGED(s22, 1);
- QCOMPARE(machine.configuration().size(), 2);
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s22));
- QCOMPARE(propertyHolder->property("foo").toInt(), 6);
- QCOMPARE(propertyHolder->property("bar").toInt(), 5);
-
- machine.postEvent(new QEvent(QEvent::User));
- QCoreApplication::processEvents();
-
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s21, 3);
- TEST_ACTIVE_CHANGED(s22, 2);
- QCOMPARE(machine.configuration().size(), 2);
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s21));
- QCOMPARE(propertyHolder->property("foo").toInt(), 3);
- QCOMPARE(propertyHolder->property("bar").toInt(), 4);
-
-}
-
-void tst_QStateMachine::nestedStateMachines()
-{
- QStateMachine machine;
- QState *group = new QState(&machine);
- DEFINE_ACTIVE_SPY(group);
- group->setChildMode(QState::ParallelStates);
- QStateMachine *subMachines[3];
- for (int i = 0; i < 3; ++i) {
- QState *subGroup = new QState(group);
- QStateMachine *subMachine = new QStateMachine(subGroup);
- {
- QState *initial = new QState(subMachine);
- QFinalState *done = new QFinalState(subMachine);
- initial->addTransition(new EventTransition(QEvent::User, done));
- subMachine->setInitialState(initial);
- }
- QFinalState *subMachineDone = new QFinalState(subGroup);
- subMachine->addTransition(subMachine, SIGNAL(finished()), subMachineDone);
- subGroup->setInitialState(subMachine);
- subMachines[i] = subMachine;
- }
- QFinalState *final = new QFinalState(&machine);
- group->addTransition(group, SIGNAL(finished()), final);
- machine.setInitialState(group);
-
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(startedSpy.isValid());
- QVERIFY(finishedSpy.isValid());
- QVERIFY(runningSpy.isValid());
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 1);
- TEST_RUNNING_CHANGED(true);
- QTRY_COMPARE(machine.configuration().count(), 1+2*3);
- QVERIFY(machine.configuration().contains(group));
- for (int i = 0; i < 3; ++i)
- QVERIFY(machine.configuration().contains(subMachines[i]));
-
- QCoreApplication::processEvents(); // starts the submachines
- TEST_ACTIVE_CHANGED(group, 1);
-
- for (int i = 0; i < 3; ++i)
- subMachines[i]->postEvent(new QEvent(QEvent::User));
-
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
- TEST_ACTIVE_CHANGED(group, 2);
-}
-
-void tst_QStateMachine::goToState()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- QState *s2 = new QState(&machine);
- machine.setInitialState(s1);
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QVERIFY(startedSpy.isValid());
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 1);
- TEST_RUNNING_CHANGED(true);
-
- QStateMachinePrivate::get(&machine)->goToState(s2);
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s2));
-
- QStateMachinePrivate::get(&machine)->goToState(s2);
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s2));
-
- QStateMachinePrivate::get(&machine)->goToState(s1);
- QStateMachinePrivate::get(&machine)->goToState(s2);
- QStateMachinePrivate::get(&machine)->goToState(s1);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s2));
-
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- // go to state in group
- QState *s2_1 = new QState(s2);
- s2->setInitialState(s2_1);
- QStateMachinePrivate::get(&machine)->goToState(s2_1);
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().size(), 2);
- QVERIFY(machine.configuration().contains(s2));
- QVERIFY(machine.configuration().contains(s2_1));
-}
-
-void tst_QStateMachine::goToStateFromSourceWithTransition()
-{
- // QTBUG-21813
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- s1->addTransition(new QSignalTransition);
- QState *s2 = new QState(&machine);
- machine.setInitialState(s1);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QVERIFY(startedSpy.isValid());
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 1);
- TEST_RUNNING_CHANGED(true);
-
- QStateMachinePrivate::get(&machine)->goToState(s2);
- QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s2));
-}
-
-class CloneSignalTransition : public QSignalTransition
-{
-public:
- CloneSignalTransition(QObject *sender, const char *signal, QAbstractState *target)
- : QSignalTransition(sender, signal)
- {
- setTargetState(target);
- }
-
- void onTransition(QEvent *e)
- {
- QSignalTransition::onTransition(e);
- QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
- eventSignalIndex = se->signalIndex();
- }
-
- int eventSignalIndex;
-};
-
-void tst_QStateMachine::clonedSignals()
-{
- SignalEmitter emitter;
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- CloneSignalTransition *t1 = new CloneSignalTransition(&emitter, SIGNAL(signalWithDefaultArg()), s2);
- s1->addTransition(t1);
-
- machine.setInitialState(s1);
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- machine.start();
- QVERIFY(startedSpy.wait());
-
- QSignalSpy transitionSpy(t1, &CloneSignalTransition::triggered);
- emitter.emitSignalWithDefaultArg();
- QTRY_COMPARE(transitionSpy.count(), 1);
-
- QCOMPARE(t1->eventSignalIndex, emitter.metaObject()->indexOfSignal("signalWithDefaultArg()"));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- QVERIFY(machine.isRunning());
-}
-
-class EventPosterThread : public QThread
-{
- Q_OBJECT
-public:
- EventPosterThread(QStateMachine *machine, QObject *parent = 0)
- : QThread(parent), m_machine(machine), m_count(0)
- {
- moveToThread(this);
- QObject::connect(m_machine, SIGNAL(started()),
- this, SLOT(postEvent()));
- }
-protected:
- virtual void run()
- {
- exec();
- }
-private Q_SLOTS:
- void postEvent()
- {
- m_machine->postEvent(new QEvent(QEvent::User));
- if (++m_count < 1000)
- QTimer::singleShot(0, this, SLOT(postEvent()));
- else
- quit();
- }
-private:
- QStateMachine *m_machine;
- int m_count;
-};
-
-void tst_QStateMachine::postEventFromOtherThread()
-{
- QStateMachine machine;
- EventPosterThread poster(&machine);
- StringEventPoster *s1 = new StringEventPoster("foo", &machine);
- s1->addTransition(new EventTransition(QEvent::User, s1));
- QFinalState *f = new QFinalState(&machine);
- s1->addTransition(&poster, SIGNAL(finished()), f);
- machine.setInitialState(s1);
-
- poster.start();
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.start();
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
-}
-
-#ifndef QT_NO_WIDGETS
-void tst_QStateMachine::eventFilterForApplication()
-{
- QStateMachine machine;
-
- QState *s1 = new QState(&machine);
- {
- machine.setInitialState(s1);
- }
-
- QState *s2 = new QState(&machine);
-
- QEventTransition *transition = new QEventTransition(QCoreApplication::instance(),
- QEvent::ApplicationActivate);
- transition->setTargetState(s2);
- s1->addTransition(transition);
-
- machine.start();
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- QCoreApplication::postEvent(QCoreApplication::instance(),
- new QEvent(QEvent::ApplicationActivate));
- QCoreApplication::processEvents();
-
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s2));
-}
-#endif
-
-void tst_QStateMachine::eventClassesExported()
-{
- // make sure this links
- QStateMachine::WrappedEvent *wrappedEvent = new QStateMachine::WrappedEvent(0, 0);
- Q_UNUSED(wrappedEvent);
- QStateMachine::SignalEvent *signalEvent = new QStateMachine::SignalEvent(0, 0, QList<QVariant>());
- Q_UNUSED(signalEvent);
-}
-
-void tst_QStateMachine::stopInTransitionToFinalState()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QFinalState *s2 = new QFinalState(&machine);
- QAbstractTransition *t1 = s1->addTransition(s2);
- machine.setInitialState(s1);
-
- QObject::connect(t1, SIGNAL(triggered()), &machine, SLOT(stop()));
- QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QSignalSpy s2EnteredSpy(s2, &QFinalState::entered);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(stoppedSpy.isValid());
- QVERIFY(finishedSpy.isValid());
- QVERIFY(s2EnteredSpy.isValid());
- QVERIFY(runningSpy.isValid());
- machine.start();
- // Stopping should take precedence over finished.
- QTRY_COMPARE(stoppedSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 0);
- QCOMPARE(s2EnteredSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s2));
- TEST_ACTIVE_CHANGED(s1, 2);
-}
-
-class StopInEventTestTransition : public QAbstractTransition
-{
-public:
- bool eventTest(QEvent *e)
- {
- if (e->type() == QEvent::User)
- machine()->stop();
- return false;
- }
- void onTransition(QEvent *)
- { }
-};
-
-void tst_QStateMachine::stopInEventTest_data()
-{
- QTest::addColumn<int>("eventPriority");
- QTest::newRow("NormalPriority") << int(QStateMachine::NormalPriority);
- QTest::newRow("HighPriority") << int(QStateMachine::HighPriority);
-}
-
-void tst_QStateMachine::stopInEventTest()
-{
- QFETCH(int, eventPriority);
-
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->addTransition(new StopInEventTestTransition());
- machine.setInitialState(s1);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QVERIFY(startedSpy.isValid());
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 1);
- QTRY_COMPARE(startedSpy.count(), 1);
- TEST_RUNNING_CHANGED(true);
-
- QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(stoppedSpy.isValid());
- QVERIFY(finishedSpy.isValid());
- machine.postEvent(new QEvent(QEvent::User), QStateMachine::EventPriority(eventPriority));
-
- QTRY_COMPARE(stoppedSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 0);
- TEST_RUNNING_CHANGED(false);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
- TEST_ACTIVE_CHANGED(s1, 1);
-}
-
-class IncrementReceiversTest : public QObject
-{
- Q_OBJECT
-signals:
- void mySignal();
-public:
- virtual void connectNotify(const QMetaMethod &signal)
- {
- signalList.append(signal);
- }
-
- QList<QMetaMethod> signalList;
-};
-
-void tst_QStateMachine::testIncrementReceivers()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
- QFinalState *s2 = new QFinalState(&machine);
-
- IncrementReceiversTest testObject;
- s1->addTransition(&testObject, SIGNAL(mySignal()), s2);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- machine.start();
- TEST_RUNNING_CHANGED(true);
-
- QMetaObject::invokeMethod(&testObject, "mySignal", Qt::QueuedConnection);
-
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
- QCOMPARE(testObject.signalList.size(), 1);
- QCOMPARE(testObject.signalList.at(0), QMetaMethod::fromSignal(&IncrementReceiversTest::mySignal));
- TEST_ACTIVE_CHANGED(s1, 2);
-}
-
-void tst_QStateMachine::initialStateIsEnteredBeforeStartedEmitted()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
- QFinalState *s2 = new QFinalState(&machine);
-
- // When started() is emitted, s1 should be the active state, and this
- // transition should trigger.
- s1->addTransition(&machine, SIGNAL(started()), s2);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- machine.start();
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- TEST_ACTIVE_CHANGED(s1, 2);
-}
-
-void tst_QStateMachine::deletePropertyAssignmentObjectBeforeEntry()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
-
- QObject *o1 = new QObject;
- s1->assignProperty(o1, "objectName", "foo");
- delete o1;
- QObject *o2 = new QObject;
- s1->assignProperty(o2, "objectName", "bar");
-
- machine.start();
- // Shouldn't crash
- QTRY_VERIFY(machine.configuration().contains(s1));
-
- QCOMPARE(o2->objectName(), QString::fromLatin1("bar"));
- delete o2;
- TEST_ACTIVE_CHANGED(s1, 1);
- QVERIFY(machine.isRunning());
-}
-
-void tst_QStateMachine::deletePropertyAssignmentObjectBeforeRestore()
-{
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QState::RestoreProperties);
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s1->addTransition(new EventTransition(QEvent::User, s2));
-
- QObject *o1 = new QObject;
- s1->assignProperty(o1, "objectName", "foo");
- QObject *o2 = new QObject;
- s1->assignProperty(o2, "objectName", "bar");
-
- QVERIFY(o1->objectName().isEmpty());
- QVERIFY(o2->objectName().isEmpty());
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- QTRY_VERIFY(machine.configuration().contains(s1));
- QCOMPARE(o1->objectName(), QString::fromLatin1("foo"));
- QCOMPARE(o2->objectName(), QString::fromLatin1("bar"));
-
- delete o1;
- machine.postEvent(new QEvent(QEvent::User));
- // Shouldn't crash
- QTRY_VERIFY(machine.configuration().contains(s2));
-
- QVERIFY(o2->objectName().isEmpty());
- delete o2;
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- QVERIFY(machine.isRunning());
-}
-
-void tst_QStateMachine::deleteInitialState()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- machine.setInitialState(s1);
- delete s1;
- QTest::ignoreMessage(QtWarningMsg, "QStateMachine::start: No initial state set for machine. Refusing to start.");
- machine.start();
- // Shouldn't crash
- QCoreApplication::processEvents();
-}
-
-void tst_QStateMachine::setPropertyAfterRestore()
-{
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QState::RestoreProperties);
-
- QObject *object = new QObject(&machine);
- object->setProperty("a", 1);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
- s1->assignProperty(object, "a", 2);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s1->addTransition(new EventTransition(QEvent::User, s2));
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- s3->assignProperty(object, "a", 4);
- s2->addTransition(new EventTransition(QEvent::User, s3));
-
- QState *s4 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s4);
- s3->addTransition(new EventTransition(QEvent::User, s4));
-
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- TEST_ACTIVE_CHANGED(s4, 0);
- QTRY_VERIFY(machine.configuration().contains(s1));
- QCOMPARE(object->property("a").toInt(), 2);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s3, 0);
- TEST_ACTIVE_CHANGED(s4, 0);
- QTRY_VERIFY(machine.configuration().contains(s2));
- QCOMPARE(object->property("a").toInt(), 1); // restored
-
- // Set property outside of state machine; this is the value
- // that should be remembered in the next transition
- object->setProperty("a", 3);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- TEST_ACTIVE_CHANGED(s4, 0);
- QTRY_VERIFY(machine.configuration().contains(s3));
- QCOMPARE(object->property("a").toInt(), 4);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 2);
- TEST_ACTIVE_CHANGED(s4, 1);
- QVERIFY(machine.isRunning());
- QTRY_VERIFY(machine.configuration().contains(s4));
- QCOMPARE(object->property("a").toInt(), 3); // restored
-
- delete object;
-}
-
-void tst_QStateMachine::transitionWithNoTarget_data()
-{
- QTest::addColumn<int>("restorePolicy");
- QTest::newRow("DontRestoreProperties") << int(QState::DontRestoreProperties);
- QTest::newRow("RestoreProperties") << int(QState::RestoreProperties);
-}
-
-void tst_QStateMachine::transitionWithNoTarget()
-{
- QFETCH(int, restorePolicy);
-
- QStateMachine machine;
- machine.setGlobalRestorePolicy(static_cast<QState::RestorePolicy>(restorePolicy));
-
- QObject *object = new QObject;
- object->setProperty("a", 1);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
- s1->assignProperty(object, "a", 2);
- EventTransition *t1 = new EventTransition(QEvent::User, /*target=*/0);
- s1->addTransition(t1);
-
- QSignalSpy s1EnteredSpy(s1, &QState::entered);
- QSignalSpy s1ExitedSpy(s1, &QState::exited);
- QSignalSpy t1TriggeredSpy(t1, &EventTransition::triggered);
-
- machine.start();
- QTRY_VERIFY(machine.configuration().contains(s1));
- QCOMPARE(s1EnteredSpy.count(), 1);
- QCOMPARE(s1ExitedSpy.count(), 0);
- QCOMPARE(t1TriggeredSpy.count(), 0);
- QCOMPARE(object->property("a").toInt(), 2);
-
- object->setProperty("a", 3);
-
- machine.postEvent(new QEvent(QEvent::User));
- QTRY_COMPARE(t1TriggeredSpy.count(), 1);
- QCOMPARE(s1EnteredSpy.count(), 1);
- QCOMPARE(s1ExitedSpy.count(), 0);
- // the assignProperty should not be re-executed, nor should the old value
- // be restored
- QCOMPARE(object->property("a").toInt(), 3);
-
- machine.postEvent(new QEvent(QEvent::User));
- QTRY_COMPARE(t1TriggeredSpy.count(), 2);
- QCOMPARE(s1EnteredSpy.count(), 1);
- QCOMPARE(s1ExitedSpy.count(), 0);
- QCOMPARE(object->property("a").toInt(), 3);
-
- delete object;
- TEST_ACTIVE_CHANGED(s1, 1);
- QVERIFY(machine.isRunning());
-}
-
-void tst_QStateMachine::initialStateIsFinal()
-{
- QStateMachine machine;
- QFinalState *f = new QFinalState(&machine);
- machine.setInitialState(f);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- machine.start();
- QTRY_VERIFY(machine.configuration().contains(f));
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
-}
-
-class PropertyObject : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int prop READ prop WRITE setProp)
-public:
- PropertyObject(QObject *parent = 0)
- : QObject(parent), m_propValue(0), m_propWriteCount(0)
- {}
- int prop() const { return m_propValue; }
- void setProp(int value) { m_propValue = value; ++m_propWriteCount; }
- int propWriteCount() const { return m_propWriteCount; }
-private:
- int m_propValue;
- int m_propWriteCount;
-};
-
-void tst_QStateMachine::restorePropertiesSimple()
-{
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QState::RestoreProperties);
-
- PropertyObject *po = new PropertyObject;
- po->setProp(2);
- QCOMPARE(po->propWriteCount(), 1);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->assignProperty(po, "prop", 4);
- machine.setInitialState(s1);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s1->addTransition(new EventTransition(QEvent::User, s2));
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- s3->assignProperty(po, "prop", 6);
- s2->addTransition(new EventTransition(QEvent::User, s3));
-
- QState *s4 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s4);
- s4->assignProperty(po, "prop", 8);
- s3->addTransition(new EventTransition(QEvent::User, s4));
-
- QState *s5 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s5);
- s4->addTransition(new EventTransition(QEvent::User, s5));
-
- QState *s6 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s6);
- s5->addTransition(new EventTransition(QEvent::User, s6));
-
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- TEST_ACTIVE_CHANGED(s4, 0);
- TEST_ACTIVE_CHANGED(s5, 0);
- TEST_ACTIVE_CHANGED(s6, 0);
- QTRY_VERIFY(machine.configuration().contains(s1));
- QCOMPARE(po->propWriteCount(), 2);
- QCOMPARE(po->prop(), 4);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s3, 0);
- TEST_ACTIVE_CHANGED(s4, 0);
- TEST_ACTIVE_CHANGED(s5, 0);
- TEST_ACTIVE_CHANGED(s6, 0);
- QTRY_VERIFY(machine.configuration().contains(s2));
- QCOMPARE(po->propWriteCount(), 3);
- QCOMPARE(po->prop(), 2); // restored
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- TEST_ACTIVE_CHANGED(s4, 0);
- TEST_ACTIVE_CHANGED(s5, 0);
- TEST_ACTIVE_CHANGED(s6, 0);
- QTRY_VERIFY(machine.configuration().contains(s3));
- QCOMPARE(po->propWriteCount(), 4);
- QCOMPARE(po->prop(), 6);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 2);
- TEST_ACTIVE_CHANGED(s4, 1);
- TEST_ACTIVE_CHANGED(s5, 0);
- TEST_ACTIVE_CHANGED(s6, 0);
- QTRY_VERIFY(machine.configuration().contains(s4));
- QCOMPARE(po->propWriteCount(), 5);
- QCOMPARE(po->prop(), 8);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 2);
- TEST_ACTIVE_CHANGED(s4, 2);
- TEST_ACTIVE_CHANGED(s5, 1);
- TEST_ACTIVE_CHANGED(s6, 0);
- QTRY_VERIFY(machine.configuration().contains(s5));
- QCOMPARE(po->propWriteCount(), 6);
- QCOMPARE(po->prop(), 2); // restored
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 2);
- TEST_ACTIVE_CHANGED(s4, 2);
- TEST_ACTIVE_CHANGED(s5, 2);
- TEST_ACTIVE_CHANGED(s6, 1);
- QVERIFY(machine.isRunning());
- QTRY_VERIFY(machine.configuration().contains(s6));
- QCOMPARE(po->propWriteCount(), 6);
-
- delete po;
-}
-
-void tst_QStateMachine::restoreProperties2()
-{
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QState::RestoreProperties);
-
- PropertyObject *po = new PropertyObject;
- po->setProp(2);
- QCOMPARE(po->propWriteCount(), 1);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->assignProperty(po, "prop", 4);
- machine.setInitialState(s1);
-
- QState *s11 = new QState(s1);
- DEFINE_ACTIVE_SPY(s11);
- s1->setInitialState(s11);
-
- QState *s12 = new QState(s1);
- DEFINE_ACTIVE_SPY(s12);
- s11->addTransition(new EventTransition(QEvent::User, s12));
-
- QState *s13 = new QState(s1);
- DEFINE_ACTIVE_SPY(s13);
- s13->assignProperty(po, "prop", 6);
- s12->addTransition(new EventTransition(QEvent::User, s13));
-
- QState *s14 = new QState(s1);
- DEFINE_ACTIVE_SPY(s14);
- s14->assignProperty(po, "prop", 8);
- s13->addTransition(new EventTransition(QEvent::User, s14));
-
- QState *s15 = new QState(s1);
- DEFINE_ACTIVE_SPY(s15);
- s14->addTransition(new EventTransition(QEvent::User, s15));
-
- QState *s16 = new QState(s1);
- DEFINE_ACTIVE_SPY(s16);
- s15->addTransition(new EventTransition(QEvent::User, s16));
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(po, "prop", 10);
- s16->addTransition(new EventTransition(QEvent::User, s2));
-
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- s2->addTransition(new EventTransition(QEvent::User, s3));
-
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s11, 1);
- TEST_ACTIVE_CHANGED(s12, 0);
- TEST_ACTIVE_CHANGED(s13, 0);
- TEST_ACTIVE_CHANGED(s14, 0);
- TEST_ACTIVE_CHANGED(s15, 0);
- TEST_ACTIVE_CHANGED(s16, 0);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- QTRY_VERIFY(machine.configuration().contains(s11));
- QCOMPARE(po->propWriteCount(), 2);
- QCOMPARE(po->prop(), 4);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s11, 2);
- TEST_ACTIVE_CHANGED(s12, 1);
- TEST_ACTIVE_CHANGED(s13, 0);
- TEST_ACTIVE_CHANGED(s14, 0);
- TEST_ACTIVE_CHANGED(s15, 0);
- TEST_ACTIVE_CHANGED(s16, 0);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- QTRY_VERIFY(machine.configuration().contains(s12));
- QCOMPARE(po->propWriteCount(), 2);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s11, 2);
- TEST_ACTIVE_CHANGED(s12, 2);
- TEST_ACTIVE_CHANGED(s13, 1);
- TEST_ACTIVE_CHANGED(s14, 0);
- TEST_ACTIVE_CHANGED(s15, 0);
- TEST_ACTIVE_CHANGED(s16, 0);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- QTRY_VERIFY(machine.configuration().contains(s13));
- QCOMPARE(po->propWriteCount(), 3);
- QCOMPARE(po->prop(), 6);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s11, 2);
- TEST_ACTIVE_CHANGED(s12, 2);
- TEST_ACTIVE_CHANGED(s13, 2);
- TEST_ACTIVE_CHANGED(s14, 1);
- TEST_ACTIVE_CHANGED(s15, 0);
- TEST_ACTIVE_CHANGED(s16, 0);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- QTRY_VERIFY(machine.configuration().contains(s14));
- QCOMPARE(po->propWriteCount(), 4);
- QCOMPARE(po->prop(), 8);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s11, 2);
- TEST_ACTIVE_CHANGED(s12, 2);
- TEST_ACTIVE_CHANGED(s13, 2);
- TEST_ACTIVE_CHANGED(s14, 2);
- TEST_ACTIVE_CHANGED(s15, 1);
- TEST_ACTIVE_CHANGED(s16, 0);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- QTRY_VERIFY(machine.configuration().contains(s15));
- QCOMPARE(po->propWriteCount(), 5);
- QCOMPARE(po->prop(), 4); // restored s1
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s11, 2);
- TEST_ACTIVE_CHANGED(s12, 2);
- TEST_ACTIVE_CHANGED(s13, 2);
- TEST_ACTIVE_CHANGED(s14, 2);
- TEST_ACTIVE_CHANGED(s15, 2);
- TEST_ACTIVE_CHANGED(s16, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s3, 0);
- QTRY_VERIFY(machine.configuration().contains(s16));
- QCOMPARE(po->propWriteCount(), 5);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s11, 2);
- TEST_ACTIVE_CHANGED(s12, 2);
- TEST_ACTIVE_CHANGED(s13, 2);
- TEST_ACTIVE_CHANGED(s14, 2);
- TEST_ACTIVE_CHANGED(s15, 2);
- TEST_ACTIVE_CHANGED(s16, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s3, 0);
- QTRY_VERIFY(machine.configuration().contains(s2));
- QCOMPARE(po->propWriteCount(), 6);
- QCOMPARE(po->prop(), 10);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s11, 2);
- TEST_ACTIVE_CHANGED(s12, 2);
- TEST_ACTIVE_CHANGED(s13, 2);
- TEST_ACTIVE_CHANGED(s14, 2);
- TEST_ACTIVE_CHANGED(s15, 2);
- TEST_ACTIVE_CHANGED(s16, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- QVERIFY(machine.isRunning());
- QTRY_VERIFY(machine.configuration().contains(s3));
- QCOMPARE(po->propWriteCount(), 7);
- QCOMPARE(po->prop(), 2); // restored original
-
- delete po;
-
-}
-
-void tst_QStateMachine::restoreProperties3()
-{
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QState::RestoreProperties);
-
- PropertyObject *po = new PropertyObject;
- po->setProp(2);
- QCOMPARE(po->propWriteCount(), 1);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->assignProperty(po, "prop", 4);
- machine.setInitialState(s1);
-
- QState *s11 = new QState(s1);
- DEFINE_ACTIVE_SPY(s11);
- s11->assignProperty(po, "prop", 6);
- s1->setInitialState(s11);
-
- QState *s12 = new QState(s1);
- DEFINE_ACTIVE_SPY(s12);
- s11->addTransition(new EventTransition(QEvent::User, s12));
-
- QState *s13 = new QState(s1);
- DEFINE_ACTIVE_SPY(s13);
- s13->assignProperty(po, "prop", 8);
- s12->addTransition(new EventTransition(QEvent::User, s13));
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s13->addTransition(new EventTransition(QEvent::User, s2));
-
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s11, 1);
- TEST_ACTIVE_CHANGED(s12, 0);
- TEST_ACTIVE_CHANGED(s13, 0);
- TEST_ACTIVE_CHANGED(s2, 0);
-
- QTRY_VERIFY(machine.configuration().contains(s11));
- QCOMPARE(po->propWriteCount(), 3);
- QCOMPARE(po->prop(), 6); // s11
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s11, 2);
- TEST_ACTIVE_CHANGED(s12, 1);
- TEST_ACTIVE_CHANGED(s13, 0);
- TEST_ACTIVE_CHANGED(s2, 0);
- QTRY_VERIFY(machine.configuration().contains(s12));
- QCOMPARE(po->propWriteCount(), 4);
- QCOMPARE(po->prop(), 4); // restored s1
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s11, 2);
- TEST_ACTIVE_CHANGED(s12, 2);
- TEST_ACTIVE_CHANGED(s13, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- QTRY_VERIFY(machine.configuration().contains(s13));
- QCOMPARE(po->propWriteCount(), 5);
- QCOMPARE(po->prop(), 8);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s11, 2);
- TEST_ACTIVE_CHANGED(s12, 2);
- TEST_ACTIVE_CHANGED(s13, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- QVERIFY(machine.isRunning());
- QTRY_VERIFY(machine.configuration().contains(s2));
- QCOMPARE(po->propWriteCount(), 6);
- QCOMPARE(po->prop(), 2); // restored original
-
- delete po;
-}
-
-// QTBUG-20362
-void tst_QStateMachine::restoreProperties4()
-{
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QState::RestoreProperties);
-
- PropertyObject *po1 = new PropertyObject;
- po1->setProp(2);
- QCOMPARE(po1->propWriteCount(), 1);
- PropertyObject *po2 = new PropertyObject;
- po2->setProp(4);
- QCOMPARE(po2->propWriteCount(), 1);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->setChildMode(QState::ParallelStates);
- machine.setInitialState(s1);
-
- QState *s11 = new QState(s1);
- DEFINE_ACTIVE_SPY(s11);
- QState *s111 = new QState(s11);
- DEFINE_ACTIVE_SPY(s111);
- s111->assignProperty(po1, "prop", 6);
- s11->setInitialState(s111);
-
- QState *s112 = new QState(s11);
- DEFINE_ACTIVE_SPY(s112);
- s112->assignProperty(po1, "prop", 8);
- s111->addTransition(new EventTransition(QEvent::User, s112));
-
- QState *s12 = new QState(s1);
- DEFINE_ACTIVE_SPY(s12);
- QState *s121 = new QState(s12);
- DEFINE_ACTIVE_SPY(s121);
- s121->assignProperty(po2, "prop", 10);
- s12->setInitialState(s121);
-
- QState *s122 = new QState(s12);
- DEFINE_ACTIVE_SPY(s122);
- s122->assignProperty(po2, "prop", 12);
- s121->addTransition(new EventTransition(static_cast<QEvent::Type>(QEvent::User+1), s122));
-
- QState *s2 = new QState(&machine);
- s112->addTransition(new EventTransition(QEvent::User, s2));
- DEFINE_ACTIVE_SPY(s2);
-
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s11, 1);
- TEST_ACTIVE_CHANGED(s111, 1);
- TEST_ACTIVE_CHANGED(s112, 0);
- TEST_ACTIVE_CHANGED(s12, 1);
- TEST_ACTIVE_CHANGED(s121, 1);
- TEST_ACTIVE_CHANGED(s122, 0);
- TEST_ACTIVE_CHANGED(s2, 0);
-
- QTRY_VERIFY(machine.configuration().contains(s1));
- QVERIFY(machine.configuration().contains(s11));
- QVERIFY(machine.configuration().contains(s111));
- QVERIFY(machine.configuration().contains(s12));
- QVERIFY(machine.configuration().contains(s121));
- QCOMPARE(po1->propWriteCount(), 2);
- QCOMPARE(po1->prop(), 6);
- QCOMPARE(po2->propWriteCount(), 2);
- QCOMPARE(po2->prop(), 10);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s11, 1);
- TEST_ACTIVE_CHANGED(s111, 2);
- TEST_ACTIVE_CHANGED(s112, 1);
- TEST_ACTIVE_CHANGED(s12, 1);
- TEST_ACTIVE_CHANGED(s121, 1);
- TEST_ACTIVE_CHANGED(s122, 0);
- TEST_ACTIVE_CHANGED(s2, 0);
- QTRY_VERIFY(machine.configuration().contains(s112));
- QCOMPARE(po1->propWriteCount(), 3);
- QCOMPARE(po1->prop(), 8);
- QCOMPARE(po2->propWriteCount(), 2);
-
- machine.postEvent(new QEvent(static_cast<QEvent::Type>(QEvent::User+1)));
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s11, 1);
- TEST_ACTIVE_CHANGED(s111, 2);
- TEST_ACTIVE_CHANGED(s112, 1);
- TEST_ACTIVE_CHANGED(s12, 1);
- TEST_ACTIVE_CHANGED(s121, 2);
- TEST_ACTIVE_CHANGED(s122, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- QTRY_VERIFY(machine.configuration().contains(s122));
- QCOMPARE(po1->propWriteCount(), 3);
- QCOMPARE(po2->propWriteCount(), 3);
- QCOMPARE(po2->prop(), 12);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s11, 2);
- TEST_ACTIVE_CHANGED(s111, 2);
- TEST_ACTIVE_CHANGED(s112, 2);
- TEST_ACTIVE_CHANGED(s12, 2);
- TEST_ACTIVE_CHANGED(s121, 2);
- TEST_ACTIVE_CHANGED(s122, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- QTRY_VERIFY(machine.configuration().contains(s2));
- QCOMPARE(po1->propWriteCount(), 4);
- QCOMPARE(po1->prop(), 2); // restored original
- QCOMPARE(po2->propWriteCount(), 4);
- QCOMPARE(po2->prop(), 4); // restored original
-
- delete po1;
- delete po2;
-}
-
-void tst_QStateMachine::restorePropertiesSelfTransition()
-{
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QState::RestoreProperties);
-
- PropertyObject *po = new PropertyObject;
- po->setProp(2);
- QCOMPARE(po->propWriteCount(), 1);
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->assignProperty(po, "prop", 4);
- s1->addTransition(new EventTransition(QEvent::User, s1));
- machine.setInitialState(s1);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s1->addTransition(new EventTransition(static_cast<QEvent::Type>(QEvent::User+1), s2));
-
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- QTRY_VERIFY(machine.configuration().contains(s1));
- QCOMPARE(po->propWriteCount(), 2);
- QCOMPARE(po->prop(), 4);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 3);
- TEST_ACTIVE_CHANGED(s2, 0);
- QTRY_COMPARE(po->propWriteCount(), 3);
- QCOMPARE(po->prop(), 4);
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 5);
- TEST_ACTIVE_CHANGED(s2, 0);
- QTRY_COMPARE(po->propWriteCount(), 4);
- QCOMPARE(po->prop(), 4);
-
- machine.postEvent(new QEvent(static_cast<QEvent::Type>(QEvent::User+1)));
- TEST_ACTIVE_CHANGED(s1, 6);
- TEST_ACTIVE_CHANGED(s2, 1);
- QTRY_VERIFY(machine.configuration().contains(s2));
- QCOMPARE(po->propWriteCount(), 5);
- QCOMPARE(po->prop(), 2); // restored
-
- delete po;
-}
-
-void tst_QStateMachine::changeStateWhileAnimatingProperty()
-{
- QStateMachine machine;
- machine.setGlobalRestorePolicy(QState::RestoreProperties);
-
- QObject *o1 = new QObject;
- o1->setProperty("x", 10.);
- QObject *o2 = new QObject;
- o2->setProperty("y", 20.);
-
- QState *group = new QState(&machine);
- DEFINE_ACTIVE_SPY(group);
- machine.setInitialState(group);
-
- QState *s0 = new QState(group);
- DEFINE_ACTIVE_SPY(s0);
- group->setInitialState(s0);
-
- QState *s1 = new QState(group);
- DEFINE_ACTIVE_SPY(s1);
- s1->assignProperty(o1, "x", 15.);
- QPropertyAnimation *a1 = new QPropertyAnimation(o1, "x", s1);
- a1->setDuration(800);
- machine.addDefaultAnimation(a1);
- group->addTransition(new EventTransition(QEvent::User, s1));
-
- QState *s2 = new QState(group);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(o2, "y", 25.);
- QPropertyAnimation *a2 = new QPropertyAnimation(o2, "y", s2);
- a2->setDuration(800);
- machine.addDefaultAnimation(a2);
- group->addTransition(new EventTransition(static_cast<QEvent::Type>(QEvent::User+1), s2));
-
- machine.start();
- TEST_ACTIVE_CHANGED(group, 1);
- TEST_ACTIVE_CHANGED(s0, 1);
- TEST_ACTIVE_CHANGED(s1, 0);
- TEST_ACTIVE_CHANGED(s2, 0);
- QTRY_VERIFY(machine.configuration().contains(s0));
-
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(group, 3);
- TEST_ACTIVE_CHANGED(s0, 2);
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- QTRY_VERIFY(machine.configuration().contains(s1));
- QCOREAPPLICATION_EXEC(400);
- machine.postEvent(new QEvent(static_cast<QEvent::Type>(QEvent::User+1)));
- TEST_ACTIVE_CHANGED(group, 5);
- TEST_ACTIVE_CHANGED(s0, 2);
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- QTRY_VERIFY(machine.configuration().contains(s2));
- QCOREAPPLICATION_EXEC(300);
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(group, 7);
- TEST_ACTIVE_CHANGED(s0, 2);
- TEST_ACTIVE_CHANGED(s1, 3);
- TEST_ACTIVE_CHANGED(s2, 2);
- QTRY_VERIFY(machine.configuration().contains(s1));
- QCOREAPPLICATION_EXEC(200);
- machine.postEvent(new QEvent(static_cast<QEvent::Type>(QEvent::User+1)));
- TEST_ACTIVE_CHANGED(group, 9);
- TEST_ACTIVE_CHANGED(s0, 2);
- TEST_ACTIVE_CHANGED(s1, 4);
- TEST_ACTIVE_CHANGED(s2, 3);
- QTRY_VERIFY(machine.configuration().contains(s2));
- QCOREAPPLICATION_EXEC(100);
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(group, 11);
- TEST_ACTIVE_CHANGED(s0, 2);
- TEST_ACTIVE_CHANGED(s1, 5);
- TEST_ACTIVE_CHANGED(s2, 4);
- QTRY_VERIFY(machine.configuration().contains(s1));
- QTRY_COMPARE(o1->property("x").toDouble(), 15.);
- QTRY_COMPARE(o2->property("y").toDouble(), 20.);
-
- delete o1;
- delete o2;
-}
-
-class AssignPropertyTestState : public QState
-{
- Q_OBJECT
-public:
- AssignPropertyTestState(QState *parent = 0)
- : QState(parent), onEntryPassed(false), enteredPassed(false)
- { QObject::connect(this, SIGNAL(entered()), this, SLOT(onEntered())); }
-
- virtual void onEntry(QEvent *)
- { onEntryPassed = property("wasAssigned").toBool(); }
-
- bool onEntryPassed;
- bool enteredPassed;
-
-private Q_SLOTS:
- void onEntered()
- { enteredPassed = property("wasAssigned").toBool(); }
-};
-
-void tst_QStateMachine::propertiesAreAssignedBeforeEntryCallbacks_data()
-{
- QTest::addColumn<int>("restorePolicy");
- QTest::newRow("DontRestoreProperties") << int(QState::DontRestoreProperties);
- QTest::newRow("RestoreProperties") << int(QState::RestoreProperties);
-}
-
-void tst_QStateMachine::propertiesAreAssignedBeforeEntryCallbacks()
-{
- QFETCH(int, restorePolicy);
-
- QStateMachine machine;
- machine.setGlobalRestorePolicy(static_cast<QState::RestorePolicy>(restorePolicy));
-
- AssignPropertyTestState *s1 = new AssignPropertyTestState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- s1->assignProperty(s1, "wasAssigned", true);
- machine.setInitialState(s1);
-
- AssignPropertyTestState *s2 = new AssignPropertyTestState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s2->assignProperty(s2, "wasAssigned", true);
- s1->addTransition(new EventTransition(QEvent::User, s2));
-
- QVERIFY(!s1->property("wasAssigned").toBool());
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- QTRY_VERIFY(machine.configuration().contains(s1));
-
- QVERIFY(s1->onEntryPassed);
- QVERIFY(s1->enteredPassed);
-
- QVERIFY(!s2->property("wasAssigned").toBool());
- machine.postEvent(new QEvent(QEvent::User));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- QTRY_VERIFY(machine.configuration().contains(s2));
-
- QVERIFY(s2->onEntryPassed);
- QVERIFY(s2->enteredPassed);
-}
-
-// QTBUG-25958
-void tst_QStateMachine::multiTargetTransitionInsideParallelStateGroup()
-{
- // TODO QTBUG-25958 was reopened, see https://codereview.qt-project.org/89775
- return;
-
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
-
- QState *s2 = new QState(QState::ParallelStates, &machine);
- DEFINE_ACTIVE_SPY(s2);
-
- QState *s21 = new QState(s2);
- DEFINE_ACTIVE_SPY(s21);
- QState *s211 = new QState(s21);
- DEFINE_ACTIVE_SPY(s211);
- QState *s212 = new QState(s21);
- DEFINE_ACTIVE_SPY(s212);
- s21->setInitialState(s212);
-
- QState *s22 = new QState(s2);
- DEFINE_ACTIVE_SPY(s22);
- QState *s221 = new QState(s22);
- DEFINE_ACTIVE_SPY(s221);
- QState *s222 = new QState(s22);
- DEFINE_ACTIVE_SPY(s222);
- s22->setInitialState(s222);
-
- QAbstractTransition *t1 = new EventTransition(QEvent::User, QList<QAbstractState *>() << s211 << s221);
- s1->addTransition(t1);
-
- machine.start();
- QTRY_VERIFY(machine.configuration().contains(s1));
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- TEST_ACTIVE_CHANGED(s21, 0);
- TEST_ACTIVE_CHANGED(s211, 0);
- TEST_ACTIVE_CHANGED(s212, 0);
- TEST_ACTIVE_CHANGED(s22, 0);
- TEST_ACTIVE_CHANGED(s221, 0);
- TEST_ACTIVE_CHANGED(s222, 0);
- machine.postEvent(new QEvent(QEvent::User));
- QTRY_VERIFY(machine.configuration().contains(s2));
- QCOMPARE(machine.configuration().size(), 5);
- QVERIFY(machine.configuration().contains(s21));
- QVERIFY(machine.configuration().contains(s211));
- QVERIFY(machine.configuration().contains(s22));
- QVERIFY(machine.configuration().contains(s221));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- TEST_ACTIVE_CHANGED(s21, 1);
- TEST_ACTIVE_CHANGED(s211, 1);
- TEST_ACTIVE_CHANGED(s212, 0);
- TEST_ACTIVE_CHANGED(s22, 1);
- TEST_ACTIVE_CHANGED(s221, 1);
- TEST_ACTIVE_CHANGED(s222, 0);
-}
-
-void tst_QStateMachine::signalTransitionNormalizeSignature()
-{
- QStateMachine machine;
- QState *s0 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s0);
- machine.setInitialState(s0);
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- SignalEmitter emitter;
- TestSignalTransition *t0 = new TestSignalTransition(&emitter, SIGNAL(signalWithNoArg()), s1);
- s0->addTransition(t0);
-
- machine.start();
- TEST_ACTIVE_CHANGED(s0, 1);
- TEST_ACTIVE_CHANGED(s1, 0);
- QTRY_VERIFY(machine.configuration().contains(s0));
- emitter.emitSignalWithNoArg();
- QTRY_VERIFY(machine.configuration().contains(s1));
-
- QCOMPARE(t0->eventTestSenderReceived(), (QObject*)&emitter);
- QCOMPARE(t0->eventTestSignalIndexReceived(), emitter.metaObject()->indexOfSignal("signalWithNoArg()"));
- QCOMPARE(t0->eventTestArgumentsReceived().size(), 0);
- QCOMPARE(t0->transitionSenderReceived(), (QObject*)&emitter);
- QCOMPARE(t0->transitionSignalIndexReceived(), emitter.metaObject()->indexOfSignal("signalWithNoArg()"));
- QCOMPARE(t0->transitionArgumentsReceived().size(), 0);
- TEST_ACTIVE_CHANGED(s0, 2);
- TEST_ACTIVE_CHANGED(s1, 1);
-}
-
-#ifdef Q_COMPILER_DELEGATING_CONSTRUCTORS
-void tst_QStateMachine::createPointerToMemberSignalTransition()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 1);
- QTRY_VERIFY(machine.configuration().contains(s1));
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- SignalEmitter emitter;
- QSignalTransition *t1 = new QSignalTransition(&emitter, &SignalEmitter::signalWithNoArg, s1);
- QCOMPARE(t1->sourceState(), s1);
- t1->setTargetState(s2);
- s1->addTransition(t1);
- emitter.emitSignalWithNoArg();
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- QTRY_VERIFY(machine.configuration().contains(s2));
-}
-#endif
-
-void tst_QStateMachine::createSignalTransitionWhenRunning()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 1);
- QTRY_VERIFY(machine.configuration().contains(s1));
- // Create by addTransition()
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- SignalEmitter emitter;
- QAbstractTransition *t1 = s1->addTransition(&emitter, SIGNAL(signalWithNoArg()), s2);
- QCOMPARE(t1->sourceState(), s1);
- emitter.emitSignalWithNoArg();
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 1);
- QTRY_VERIFY(machine.configuration().contains(s2));
-
- // Create by constructor that takes sender, signal, source (parent) state
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- QSignalTransition *t2 = new QSignalTransition(&emitter, SIGNAL(signalWithNoArg()), s2);
- QCOMPARE(t2->sourceState(), s2);
- t2->setTargetState(s3);
- emitter.emitSignalWithNoArg();
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 1);
- QTRY_VERIFY(machine.configuration().contains(s3));
-
- // Create by constructor that takes source (parent) state
- QState *s4 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s4);
- QSignalTransition *t3 = new QSignalTransition(s3);
- QCOMPARE(t3->sourceState(), s3);
- t3->setSenderObject(&emitter);
- t3->setSignal(SIGNAL(signalWithNoArg()));
- t3->setTargetState(s4);
- emitter.emitSignalWithNoArg();
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 2);
- TEST_ACTIVE_CHANGED(s4, 1);
- QTRY_VERIFY(machine.configuration().contains(s4));
-
- // Create by constructor without parent, then set the parent
- QState *s5 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s5);
- QSignalTransition *t4 = new QSignalTransition();
- t4->setSenderObject(&emitter);
- t4->setParent(s4);
- QCOMPARE(t4->sourceState(), s4);
- t4->setSignal(SIGNAL(signalWithNoArg()));
- t4->setTargetState(s5);
- emitter.emitSignalWithNoArg();
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 2);
- TEST_ACTIVE_CHANGED(s4, 2);
- TEST_ACTIVE_CHANGED(s5, 1);
- QTRY_VERIFY(machine.configuration().contains(s5));
-}
-
-void tst_QStateMachine::createEventTransitionWhenRunning()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 1);
- QTRY_VERIFY(machine.configuration().contains(s1));
-
- // Create by constructor that takes event source, type, source (parent) state
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- QObject object;
- QEventTransition *t1 = new QEventTransition(&object, QEvent::Timer, s1);
- QCOMPARE(t1->sourceState(), s1);
- t1->setTargetState(s2);
-
- object.startTimer(10); // Will cause QEvent::Timer to fire every 10ms
- QTRY_VERIFY(machine.configuration().contains(s2));
-
- // Create by constructor that takes source (parent) state
- QState *s3 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s3);
- QEventTransition *t2 = new QEventTransition(s2);
- QCOMPARE(t2->sourceState(), s2);
- t2->setEventSource(&object);
- t2->setEventType(QEvent::Timer);
- t2->setTargetState(s3);
- QTRY_VERIFY(machine.configuration().contains(s3));
-
- // Create by constructor without parent, then set the parent
- QState *s4 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s4);
- QEventTransition *t3 = new QEventTransition();
- t3->setEventSource(&object);
- t3->setParent(s3);
- QCOMPARE(t3->sourceState(), s3);
- t3->setEventType(QEvent::Timer);
- t3->setTargetState(s4);
- QTRY_VERIFY(machine.configuration().contains(s4));
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- TEST_ACTIVE_CHANGED(s3, 2);
- TEST_ACTIVE_CHANGED(s4, 1);
-}
-
-class SignalEmitterThread : public QThread
-{
- Q_OBJECT
-public:
- SignalEmitterThread(QObject *parent = 0)
- : QThread(parent)
- {
- moveToThread(this);
- }
-
-Q_SIGNALS:
- void signal1();
- void signal2();
-
-public Q_SLOTS:
- void emitSignals()
- {
- emit signal1();
- emit signal2();
- }
-};
-
-// QTBUG-19789
-void tst_QStateMachine::signalTransitionSenderInDifferentThread()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
-
- SignalEmitterThread thread;
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- s1->addTransition(&thread, SIGNAL(signal1()), s2);
-
- QFinalState *s3 = new QFinalState(&machine);
- s2->addTransition(&thread, SIGNAL(signal2()), s3);
-
- thread.start();
- QTRY_VERIFY(thread.isRunning());
-
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s2, 0);
- QTRY_VERIFY(machine.configuration().contains(s1));
-
- QMetaObject::invokeMethod(&thread, "emitSignals");
- // thread emits both signal1() and signal2(), so we should end in s3
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
- QTRY_VERIFY(!machine.isRunning());
- QTRY_VERIFY(machine.configuration().contains(s3));
-
- // Run the machine again; transitions should still be registered
- machine.start();
- TEST_ACTIVE_CHANGED(s1, 3);
- TEST_ACTIVE_CHANGED(s2, 2);
- QTRY_VERIFY(machine.configuration().contains(s1));
- QMetaObject::invokeMethod(&thread, "emitSignals");
- QTRY_VERIFY(machine.configuration().contains(s3));
-
- thread.quit();
- QTRY_VERIFY(thread.wait());
- TEST_ACTIVE_CHANGED(s1, 4);
- TEST_ACTIVE_CHANGED(s2, 4);
- QVERIFY(!machine.isRunning());
-}
-
-void tst_QStateMachine::signalTransitionSenderInDifferentThread2()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
-
- QState *s2 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s2);
- SignalEmitter emitter;
- // At the time of the transition creation, the machine and the emitter
- // are both in the same thread.
- s1->addTransition(&emitter, SIGNAL(signalWithNoArg()), s2);
-
- QFinalState *s3 = new QFinalState(&machine);
- s2->addTransition(&emitter, SIGNAL(signalWithDefaultArg()), s3);
-
- QThread thread;
- // Move the machine and its states to a secondary thread, but let the
- // SignalEmitter stay in the main thread.
- machine.moveToThread(&thread);
-
- thread.start();
- QTRY_VERIFY(thread.isRunning());
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 1);
- TEST_RUNNING_CHANGED(true);
-
- emitter.emitSignalWithNoArg();
- // The second emission should not get "lost".
- emitter.emitSignalWithDefaultArg();
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
-
- thread.quit();
- QTRY_VERIFY(thread.wait());
- TEST_ACTIVE_CHANGED(s1, 2);
- TEST_ACTIVE_CHANGED(s2, 2);
-}
-
-class SignalTransitionMutatorThread : public QThread
-{
-public:
- SignalTransitionMutatorThread(QSignalTransition *transition)
- : m_transition(transition)
- {}
- void run()
- {
- // Cause repeated registration and unregistration
- for (int i = 0; i < 50000; ++i) {
- m_transition->setSenderObject(this);
- m_transition->setSenderObject(0);
- }
- }
-private:
- QSignalTransition *m_transition;
-};
-
-// Should not crash:
-void tst_QStateMachine::signalTransitionRegistrationThreadSafety()
-{
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- machine.setInitialState(s1);
- machine.start();
- QTRY_VERIFY(machine.configuration().contains(s1));
-
- QSignalTransition *t1 = new QSignalTransition();
- t1->setSignal(SIGNAL(objectNameChanged(QString)));
- s1->addTransition(t1);
-
- QSignalTransition *t2 = new QSignalTransition();
- t2->setSignal(SIGNAL(objectNameChanged(QString)));
- s1->addTransition(t2);
-
- SignalTransitionMutatorThread thread(t1);
- thread.start();
- QTRY_VERIFY(thread.isRunning());
-
- // Cause repeated registration and unregistration
- for (int i = 0; i < 50000; ++i) {
- t2->setSenderObject(this);
- t2->setSenderObject(0);
- }
-
- thread.quit();
- QTRY_VERIFY(thread.wait());
- TEST_ACTIVE_CHANGED(s1, 1);
- QVERIFY(machine.isRunning());
-}
-
-void tst_QStateMachine::childModeConstructor()
-{
- {
- QStateMachine machine(QState::ExclusiveStates);
- QCOMPARE(machine.childMode(), QState::ExclusiveStates);
- QVERIFY(!machine.parent());
- QVERIFY(!machine.parentState());
- }
- {
- QStateMachine machine(QState::ParallelStates);
- QCOMPARE(machine.childMode(), QState::ParallelStates);
- QVERIFY(!machine.parent());
- QVERIFY(!machine.parentState());
- }
- {
- QStateMachine machine(QState::ExclusiveStates, this);
- QCOMPARE(machine.childMode(), QState::ExclusiveStates);
- QCOMPARE(machine.parent(), static_cast<QObject *>(this));
- QVERIFY(!machine.parentState());
- }
- {
- QStateMachine machine(QState::ParallelStates, this);
- QCOMPARE(machine.childMode(), QState::ParallelStates);
- QCOMPARE(machine.parent(), static_cast<QObject *>(this));
- QVERIFY(!machine.parentState());
- }
- QState state;
- {
- QStateMachine machine(QState::ExclusiveStates, &state);
- QCOMPARE(machine.childMode(), QState::ExclusiveStates);
- QCOMPARE(machine.parent(), static_cast<QObject *>(&state));
- QCOMPARE(machine.parentState(), &state);
- }
- {
- QStateMachine machine(QState::ParallelStates, &state);
- QCOMPARE(machine.childMode(), QState::ParallelStates);
- QCOMPARE(machine.parent(), static_cast<QObject *>(&state));
- QCOMPARE(machine.parentState(), &state);
- }
-}
-
-void tst_QStateMachine::qtbug_44963()
-{
- SignalEmitter emitter;
-
- QStateMachine machine;
- QState a(QState::ParallelStates, &machine);
- QHistoryState ha(QHistoryState::DeepHistory, &a);
- QState b(QState::ParallelStates, &a);
- QState c(QState::ParallelStates, &b);
- QState d(QState::ParallelStates, &c);
- QState e(QState::ParallelStates, &d);
- QState i(&e);
- QState i1(&i);
- QState i2(&i);
- QState j(&e);
- QState h(&d);
- QState g(&c);
- QState k(&a);
- QState l(&machine);
-
- machine.setInitialState(&a);
- ha.setDefaultState(&b);
- i.setInitialState(&i1);
- i1.addTransition(&emitter, SIGNAL(signalWithIntArg(int)), &i2)->setObjectName("i1->i2");
- i2.addTransition(&emitter, SIGNAL(signalWithDefaultArg(int)), &l)->setObjectName("i2->l");
- l.addTransition(&emitter, SIGNAL(signalWithNoArg()), &ha)->setObjectName("l->ha");
-
- a.setObjectName("a");
- ha.setObjectName("ha");
- b.setObjectName("b");
- c.setObjectName("c");
- d.setObjectName("d");
- e.setObjectName("e");
- i.setObjectName("i");
- i1.setObjectName("i1");
- i2.setObjectName("i2");
- j.setObjectName("j");
- h.setObjectName("h");
- g.setObjectName("g");
- k.setObjectName("k");
- l.setObjectName("l");
-
- machine.start();
-
- QTRY_COMPARE(machine.configuration().contains(&i1), true);
- QTRY_COMPARE(machine.configuration().contains(&i2), false);
- QTRY_COMPARE(machine.configuration().contains(&j), true);
- QTRY_COMPARE(machine.configuration().contains(&h), true);
- QTRY_COMPARE(machine.configuration().contains(&g), true);
- QTRY_COMPARE(machine.configuration().contains(&k), true);
- QTRY_COMPARE(machine.configuration().contains(&l), false);
-
- emitter.emitSignalWithIntArg(0);
-
- QTRY_COMPARE(machine.configuration().contains(&i1), false);
- QTRY_COMPARE(machine.configuration().contains(&i2), true);
- QTRY_COMPARE(machine.configuration().contains(&j), true);
- QTRY_COMPARE(machine.configuration().contains(&h), true);
- QTRY_COMPARE(machine.configuration().contains(&g), true);
- QTRY_COMPARE(machine.configuration().contains(&k), true);
- QTRY_COMPARE(machine.configuration().contains(&l), false);
-
- emitter.emitSignalWithDefaultArg();
-
- QTRY_COMPARE(machine.configuration().contains(&i1), false);
- QTRY_COMPARE(machine.configuration().contains(&i2), false);
- QTRY_COMPARE(machine.configuration().contains(&j), false);
- QTRY_COMPARE(machine.configuration().contains(&h), false);
- QTRY_COMPARE(machine.configuration().contains(&g), false);
- QTRY_COMPARE(machine.configuration().contains(&k), false);
- QTRY_COMPARE(machine.configuration().contains(&l), true);
-
- emitter.emitSignalWithNoArg();
-
- QTRY_COMPARE(machine.configuration().contains(&i1), false);
- QTRY_COMPARE(machine.configuration().contains(&i2), true);
- QTRY_COMPARE(machine.configuration().contains(&j), true);
- QTRY_COMPARE(machine.configuration().contains(&h), true);
- QTRY_COMPARE(machine.configuration().contains(&g), true);
- QTRY_COMPARE(machine.configuration().contains(&k), true);
- QTRY_COMPARE(machine.configuration().contains(&l), false);
-
- QVERIFY(machine.isRunning());
-}
-
-void tst_QStateMachine::qtbug_44783()
-{
- SignalEmitter emitter;
-
- QStateMachine machine;
- QState s(&machine);
- QState p(QState::ParallelStates, &s);
- QState p1(&p);
- QState p1_1(&p1);
- QState p1_2(&p1);
- QState p2(&p);
- QState s1(&machine);
-
- machine.setInitialState(&s);
- s.setInitialState(&p);
- p1.setInitialState(&p1_1);
- p1_1.addTransition(&emitter, SIGNAL(signalWithNoArg()), &p1_2)->setObjectName("p1_1->p1_2");
- p2.addTransition(&emitter, SIGNAL(signalWithNoArg()), &s1)->setObjectName("p2->s1");
-
- s.setObjectName("s");
- p.setObjectName("p");
- p1.setObjectName("p1");
- p1_1.setObjectName("p1_1");
- p1_2.setObjectName("p1_2");
- p2.setObjectName("p2");
- s1.setObjectName("s1");
-
- machine.start();
-
- QTRY_COMPARE(machine.configuration().contains(&s), true);
- QTRY_COMPARE(machine.configuration().contains(&p), true);
- QTRY_COMPARE(machine.configuration().contains(&p1), true);
- QTRY_COMPARE(machine.configuration().contains(&p1_1), true);
- QTRY_COMPARE(machine.configuration().contains(&p1_2), false);
- QTRY_COMPARE(machine.configuration().contains(&p2), true);
- QTRY_COMPARE(machine.configuration().contains(&s1), false);
-
- emitter.emitSignalWithNoArg();
-
- // Only one of the following two can be true, because the two possible transitions conflict.
- if (machine.configuration().contains(&s1)) {
- // the transition p2 -> s1 was taken, not p1_1 -> p1_2, so:
- // the parallel state exited, so none of the states inside it are active
- QTRY_COMPARE(machine.configuration().contains(&s), false);
- QTRY_COMPARE(machine.configuration().contains(&p), false);
- QTRY_COMPARE(machine.configuration().contains(&p1), false);
- QTRY_COMPARE(machine.configuration().contains(&p1_1), false);
- QTRY_COMPARE(machine.configuration().contains(&p1_2), false);
- QTRY_COMPARE(machine.configuration().contains(&p2), false);
- } else {
- // the transition p1_1 -> p1_2 was taken, not p2 -> s1, so:
- // the parallel state was not exited and the state is the same as the start state with one
- // difference: p1_1 inactive and p1_2 active:
- QTRY_COMPARE(machine.configuration().contains(&s), true);
- QTRY_COMPARE(machine.configuration().contains(&p), true);
- QTRY_COMPARE(machine.configuration().contains(&p1), true);
- QTRY_COMPARE(machine.configuration().contains(&p1_1), false);
- QTRY_COMPARE(machine.configuration().contains(&p1_2), true);
- QTRY_COMPARE(machine.configuration().contains(&p2), true);
- }
-
- QVERIFY(machine.isRunning());
-}
-
-void tst_QStateMachine::internalTransition()
-{
- SignalEmitter emitter;
-
- QStateMachine machine;
- QState *s = new QState(&machine);
- QState *s1 = new QState(s);
- QState *s11 = new QState(s1);
-
- DEFINE_ACTIVE_SPY(s);
- DEFINE_ACTIVE_SPY(s1);
- DEFINE_ACTIVE_SPY(s11);
-
- machine.setInitialState(s);
- s->setInitialState(s1);
- s1->setInitialState(s11);
- QSignalTransition *t = s1->addTransition(&emitter, SIGNAL(signalWithNoArg()), s11);
- t->setObjectName("s1->s11");
- t->setTransitionType(QAbstractTransition::InternalTransition);
-
- s->setObjectName("s");
- s1->setObjectName("s1");
- s11->setObjectName("s11");
-
- machine.start();
-
- QTRY_COMPARE(machine.configuration().contains(s), true);
- QTRY_COMPARE(machine.configuration().contains(s1), true);
- QTRY_COMPARE(machine.configuration().contains(s11), true);
- TEST_ACTIVE_CHANGED(s, 1);
- TEST_ACTIVE_CHANGED(s1, 1);
- TEST_ACTIVE_CHANGED(s11, 1);
-
- emitter.emitSignalWithNoArg();
-
- QTRY_COMPARE(machine.configuration().contains(s), true);
- QTRY_COMPARE(machine.configuration().contains(s1), true);
- QTRY_COMPARE(machine.configuration().contains(s11), true);
- TEST_ACTIVE_CHANGED(s11, 3);
- TEST_ACTIVE_CHANGED(s1, 1); // external transitions will return 3, internal transitions should return 1.
- TEST_ACTIVE_CHANGED(s, 1);
-}
-
-void tst_QStateMachine::conflictingTransition()
-{
- SignalEmitter emitter;
-
- QStateMachine machine;
- QState b(QState::ParallelStates, &machine);
- QState c(&b);
- QState d(QState::ParallelStates, &b);
- QState e(&d);
- QState e1(&e);
- QState e2(&e);
- QState f(&d);
- QState f1(&f);
- QState f2(&f);
- QState a1(&machine);
-
- machine.setInitialState(&b);
- e.setInitialState(&e1);
- f.setInitialState(&f1);
- c.addTransition(&emitter, SIGNAL(signalWithNoArg()), &a1)->setObjectName("c->a1");
- e1.addTransition(&emitter, SIGNAL(signalWithNoArg()), &e2)->setObjectName("e1->e2");
- f1.addTransition(&emitter, SIGNAL(signalWithNoArg()), &f2)->setObjectName("f1->f2");
-
- b.setObjectName("b");
- c.setObjectName("c");
- d.setObjectName("d");
- e.setObjectName("e");
- e1.setObjectName("e1");
- e2.setObjectName("e2");
- f.setObjectName("f");
- f1.setObjectName("f1");
- f2.setObjectName("f2");
- a1.setObjectName("a1");
-
- machine.start();
-
- QTRY_COMPARE(machine.configuration().contains(&b), true);
- QTRY_COMPARE(machine.configuration().contains(&c), true);
- QTRY_COMPARE(machine.configuration().contains(&d), true);
- QTRY_COMPARE(machine.configuration().contains(&e), true);
- QTRY_COMPARE(machine.configuration().contains(&e1), true);
- QTRY_COMPARE(machine.configuration().contains(&e2), false);
- QTRY_COMPARE(machine.configuration().contains(&f), true);
- QTRY_COMPARE(machine.configuration().contains(&f1), true);
- QTRY_COMPARE(machine.configuration().contains(&f2), false);
- QTRY_COMPARE(machine.configuration().contains(&a1), false);
-
- emitter.emitSignalWithNoArg();
-
- QTRY_COMPARE(machine.configuration().contains(&b), true);
- QTRY_COMPARE(machine.configuration().contains(&c), true);
- QTRY_COMPARE(machine.configuration().contains(&d), true);
- QTRY_COMPARE(machine.configuration().contains(&e), true);
- QTRY_COMPARE(machine.configuration().contains(&e1), false);
- QTRY_COMPARE(machine.configuration().contains(&e2), true);
- QTRY_COMPARE(machine.configuration().contains(&f), true);
- QTRY_COMPARE(machine.configuration().contains(&f1), false);
- QTRY_COMPARE(machine.configuration().contains(&f2), true);
- QTRY_COMPARE(machine.configuration().contains(&a1), false);
-
- QVERIFY(machine.isRunning());
-}
-
-void tst_QStateMachine::conflictingTransition2()
-{
- SignalEmitter emitter;
-
- QStateMachine machine;
- QState s0(&machine);
- QState p0(QState::ParallelStates, &s0);
- QState p0s1(&p0);
- QState p0s2(&p0);
- QState p0s3(&p0);
- QState s1(&machine);
-
- machine.setInitialState(&s0);
- s0.setInitialState(&p0);
-
- QSignalTransition *t1 = new QSignalTransition(&emitter, SIGNAL(signalWithNoArg()));
- p0s1.addTransition(t1);
- QSignalTransition *t2 = p0s2.addTransition(&emitter, SIGNAL(signalWithNoArg()), &p0s1);
- QSignalTransition *t3 = p0s3.addTransition(&emitter, SIGNAL(signalWithNoArg()), &s1);
- QSignalSpy t1Spy(t1, &QAbstractTransition::triggered);
- QSignalSpy t2Spy(t2, &QAbstractTransition::triggered);
- QSignalSpy t3Spy(t3, &QAbstractTransition::triggered);
- QVERIFY(t1Spy.isValid());
- QVERIFY(t2Spy.isValid());
- QVERIFY(t3Spy.isValid());
-
- s0.setObjectName("s0");
- p0.setObjectName("p0");
- p0s1.setObjectName("p0s1");
- p0s2.setObjectName("p0s2");
- p0s3.setObjectName("p0s3");
- s1.setObjectName("s1");
- t1->setObjectName("p0s1->p0s1");
- t2->setObjectName("p0s2->p0s1");
- t3->setObjectName("p0s3->s1");
-
- machine.start();
-
- QTRY_COMPARE(machine.configuration().contains(&s0), true);
- QTRY_COMPARE(machine.configuration().contains(&p0), true);
- QTRY_COMPARE(machine.configuration().contains(&p0s1), true);
- QTRY_COMPARE(machine.configuration().contains(&p0s2), true);
- QTRY_COMPARE(machine.configuration().contains(&p0s3), true);
- QTRY_COMPARE(machine.configuration().contains(&s1), false);
-
- QCOMPARE(t1Spy.count(), 0);
- QCOMPARE(t2Spy.count(), 0);
- QCOMPARE(t3Spy.count(), 0);
-
- emitter.emitSignalWithNoArg();
-
- QTRY_COMPARE(machine.configuration().contains(&s0), true);
- QTRY_COMPARE(machine.configuration().contains(&p0), true);
- QTRY_COMPARE(machine.configuration().contains(&p0s1), true);
- QTRY_COMPARE(machine.configuration().contains(&p0s2), true);
- QTRY_COMPARE(machine.configuration().contains(&p0s3), true);
- QTRY_COMPARE(machine.configuration().contains(&s1), false);
-
- QCOMPARE(t1Spy.count(), 1);
- QCOMPARE(t2Spy.count(), 1);
- QCOMPARE(t3Spy.count(), 0); // t3 got preempted by t2
-
- QVERIFY(machine.isRunning());
-}
-
-void tst_QStateMachine::qtbug_46059()
-{
- QStateMachine machine;
- QState a(&machine);
- QState b(&a);
- QState c(&a);
- QState success(&a);
- QState failure(&machine);
-
- machine.setInitialState(&a);
- a.setInitialState(&b);
- b.addTransition(new EventTransition(QEvent::Type(QEvent::User + 1), &c));
- c.addTransition(new EventTransition(QEvent::Type(QEvent::User + 2), &success));
- b.addTransition(new EventTransition(QEvent::Type(QEvent::User + 2), &failure));
-
- machine.start();
- QCoreApplication::processEvents();
-
- QTRY_COMPARE(machine.configuration().contains(&a), true);
- QTRY_COMPARE(machine.configuration().contains(&b), true);
- QTRY_COMPARE(machine.configuration().contains(&c), false);
- QTRY_COMPARE(machine.configuration().contains(&failure), false);
- QTRY_COMPARE(machine.configuration().contains(&success), false);
-
- machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 0)), QStateMachine::HighPriority);
- machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1)), QStateMachine::HighPriority);
- machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 2)), QStateMachine::NormalPriority);
- QCoreApplication::processEvents();
-
- QTRY_COMPARE(machine.configuration().contains(&a), true);
- QTRY_COMPARE(machine.configuration().contains(&b), false);
- QTRY_COMPARE(machine.configuration().contains(&c), false);
- QTRY_COMPARE(machine.configuration().contains(&failure), false);
- QTRY_COMPARE(machine.configuration().contains(&success), true);
-
- QVERIFY(machine.isRunning());
-}
-
-void tst_QStateMachine::qtbug_46703()
-{
- QStateMachine machine;
- QState root(&machine);
- QHistoryState h(&root);
- QState p(QState::ParallelStates, &root);
- QState a(&p);
- QState a1(&a);
- QState a2(&a);
- QState a3(&a);
- QState b(&p);
- QState b1(&b);
- QState b2(&b);
-
- machine.setObjectName("machine");
- root.setObjectName("root");
- h.setObjectName("h");
- p.setObjectName("p");
- a.setObjectName("a");
- a1.setObjectName("a1");
- a2.setObjectName("a2");
- a3.setObjectName("a3");
- b.setObjectName("b");
- b1.setObjectName("b1");
- b2.setObjectName("b2");
-
- machine.setInitialState(&root);
- root.setInitialState(&h);
- a.setInitialState(&a3);
- b.setInitialState(&b1);
- struct : public QAbstractTransition {
- virtual bool eventTest(QEvent *) { return false; }
- virtual void onTransition(QEvent *) {}
- } defaultTransition;
- defaultTransition.setTargetStates(QList<QAbstractState*>() << &a2 << &b2);
- h.setDefaultTransition(&defaultTransition);
-
- machine.start();
- QCoreApplication::processEvents();
-
- QTRY_COMPARE(machine.configuration().contains(&root), true);
- QTRY_COMPARE(machine.configuration().contains(&h), false);
- QTRY_COMPARE(machine.configuration().contains(&p), true);
- QTRY_COMPARE(machine.configuration().contains(&a), true);
- QTRY_COMPARE(machine.configuration().contains(&a1), false);
- QTRY_COMPARE(machine.configuration().contains(&a2), true);
- QTRY_COMPARE(machine.configuration().contains(&a3), false);
- QTRY_COMPARE(machine.configuration().contains(&b), true);
- QTRY_COMPARE(machine.configuration().contains(&b1), false);
- QTRY_COMPARE(machine.configuration().contains(&b2), true);
-
- QVERIFY(machine.isRunning());
-}
-
-void tst_QStateMachine::postEventFromBeginSelectTransitions()
-{
- class StateMachine : public QStateMachine {
- protected:
- void beginSelectTransitions(QEvent* e) override {
- if (e->type() == QEvent::Type(QEvent::User + 2))
- postEvent(new QEvent(QEvent::Type(QEvent::User + 1)), QStateMachine::HighPriority);
- }
- } machine;
- QState a(&machine);
- QState success(&machine);
-
- machine.setInitialState(&a);
- a.addTransition(new EventTransition(QEvent::Type(QEvent::User + 1), &success));
-
- machine.start();
-
- QTRY_COMPARE(machine.configuration().contains(&a), true);
- QTRY_COMPARE(machine.configuration().contains(&success), false);
-
- machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 2)), QStateMachine::NormalPriority);
-
- QTRY_COMPARE(machine.configuration().contains(&a), false);
- QTRY_COMPARE(machine.configuration().contains(&success), true);
-
- QVERIFY(machine.isRunning());
-}
-
-void tst_QStateMachine::dontProcessSlotsWhenMachineIsNotRunning()
-{
- QStateMachine machine;
- QState initialState;
- QFinalState finalState;
-
- struct Emitter : SignalEmitter
- {
- QThread thread;
- Emitter(QObject *parent = nullptr) : SignalEmitter(parent)
- {
- moveToThread(&thread);
- thread.start();
- }
- } emitter;
-
- initialState.addTransition(&emitter, &Emitter::signalWithNoArg, &finalState);
- machine.addState(&initialState);
- machine.addState(&finalState);
- machine.setInitialState(&initialState);
- connect(&machine, &QStateMachine::started, &emitter, [&]() {
- metaObject()->invokeMethod(&emitter, "emitSignalWithNoArg");
- metaObject()->invokeMethod(&emitter, "emitSignalWithNoArg");
- });
- connect(&machine, &QStateMachine::finished, &emitter.thread, &QThread::quit);
- machine.start();
- QSignalSpy emittedSpy(&emitter, &SignalEmitter::signalWithNoArg);
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QTRY_COMPARE_WITH_TIMEOUT(emittedSpy.count(), 2, 100);
- QTRY_COMPARE(finishedSpy.count(), 1);
- QTRY_VERIFY(emitter.thread.isFinished());
-}
-
-void tst_QStateMachine::cancelDelayedEventWithChrono()
-{
-#if __has_include(<chrono>)
- QStateMachine machine;
- QTest::ignoreMessage(QtWarningMsg,
- "QStateMachine::cancelDelayedEvent: the machine is not running");
- QVERIFY(!machine.cancelDelayedEvent(-1));
-
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QFinalState *s2 = new QFinalState(&machine);
- s1->addTransition(new StringTransition("a", s2));
- machine.setInitialState(s1);
-
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(startedSpy.isValid());
- QVERIFY(runningSpy.isValid());
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 1);
- TEST_RUNNING_CHANGED(true);
- TEST_ACTIVE_CHANGED(s1, 1);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
- int id1 = machine.postDelayedEvent(new StringEvent("c"), std::chrono::seconds{50});
- QVERIFY(id1 != -1);
- int id2 = machine.postDelayedEvent(new StringEvent("b"), std::chrono::seconds{25});
- QVERIFY(id2 != -1);
- QVERIFY(id2 != id1);
- int id3 = machine.postDelayedEvent(new StringEvent("a"), std::chrono::milliseconds{100});
- QVERIFY(id3 != -1);
- QVERIFY(id3 != id2);
- QVERIFY(machine.cancelDelayedEvent(id1));
- QVERIFY(!machine.cancelDelayedEvent(id1));
- QVERIFY(machine.cancelDelayedEvent(id2));
- QVERIFY(!machine.cancelDelayedEvent(id2));
-
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
- TEST_ACTIVE_CHANGED(s1, 2);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s2));
-#endif
-}
-
-void tst_QStateMachine::postDelayedEventWithChronoAndStop()
-{
-#if __has_include(<chrono>)
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QFinalState *s2 = new QFinalState(&machine);
- s1->addTransition(new StringTransition("a", s2));
- machine.setInitialState(s1);
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy startedSpy(&machine, &QStateMachine::started);
- QVERIFY(startedSpy.isValid());
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 1);
- TEST_RUNNING_CHANGED(true);
- TEST_ACTIVE_CHANGED(s1, 1);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- int id1 = machine.postDelayedEvent(new StringEvent("a"), std::chrono::milliseconds{0});
- QVERIFY(id1 != -1);
- QSignalSpy stoppedSpy(&machine, &QStateMachine::stopped);
- QVERIFY(stoppedSpy.isValid());
- machine.stop();
- QTRY_COMPARE(stoppedSpy.count(), 1);
- TEST_RUNNING_CHANGED(false);
- TEST_ACTIVE_CHANGED(s1, 1);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 2);
- TEST_RUNNING_CHANGED(true);
- TEST_ACTIVE_CHANGED(s1, 3);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
-
- int id2 = machine.postDelayedEvent(new StringEvent("a"), std::chrono::seconds{1});
- QVERIFY(id2 != -1);
- machine.stop();
- QTRY_COMPARE(stoppedSpy.count(), 2);
- TEST_RUNNING_CHANGED(false);
- TEST_ACTIVE_CHANGED(s1, 3);
- machine.start();
- QTRY_COMPARE(startedSpy.count(), 3);
- TEST_RUNNING_CHANGED(true);
- QTestEventLoop::instance().enterLoop(2);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(s1));
- TEST_ACTIVE_CHANGED(s1, 5);
- QVERIFY(machine.isRunning());
-#endif
-}
-
-class DelayedEventWithChronoPosterThread : public QThread
-{
- Q_OBJECT
-public:
- DelayedEventWithChronoPosterThread(QStateMachine *machine, QObject *parent = 0)
- : QThread(parent), firstEventWasCancelled(false), m_machine(machine)
- {
- moveToThread(this);
- QObject::connect(m_machine, SIGNAL(started()), this, SLOT(postEvent()));
- }
-
- mutable bool firstEventWasCancelled;
-
-private Q_SLOTS:
- void postEvent()
- {
-#if __has_include(<chrono>)
- int id = m_machine->postDelayedEvent(new QEvent(QEvent::User), std::chrono::seconds{1});
- firstEventWasCancelled = m_machine->cancelDelayedEvent(id);
-
- m_machine->postDelayedEvent(new QEvent(QEvent::User), std::chrono::milliseconds{1});
-
- quit();
-#endif
- }
-
-private:
- QStateMachine *m_machine;
-};
-
-void tst_QStateMachine::postDelayedEventWithChronoFromThread()
-{
-#if __has_include(<chrono>)
- QStateMachine machine;
- QState *s1 = new QState(&machine);
- DEFINE_ACTIVE_SPY(s1);
- QFinalState *f = new QFinalState(&machine);
- s1->addTransition(new EventTransition(QEvent::User, f));
- machine.setInitialState(s1);
-
- DelayedEventWithChronoPosterThread poster(&machine);
- poster.start();
-
- QSignalSpy runningSpy(&machine, &QStateMachine::runningChanged);
- QVERIFY(runningSpy.isValid());
- QSignalSpy finishedSpy(&machine, &QStateMachine::finished);
- QVERIFY(finishedSpy.isValid());
- machine.start();
- QTRY_COMPARE(finishedSpy.count(), 1);
- TEST_RUNNING_CHANGED_STARTED_STOPPED;
- TEST_ACTIVE_CHANGED(s1, 2);
- QVERIFY(poster.firstEventWasCancelled);
-#endif
-}
-
-QTEST_MAIN(tst_QStateMachine)
-#include "tst_qstatemachine.moc"
diff --git a/tests/auto/corelib/statemachine/statemachine.pro b/tests/auto/corelib/statemachine/statemachine.pro
deleted file mode 100644
index aa645ac9f4..0000000000
--- a/tests/auto/corelib/statemachine/statemachine.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-TEMPLATE=subdirs
-SUBDIRS=\
- qstate \
- qstatemachine
diff --git a/tests/auto/guiapplauncher/examples.txt b/tests/auto/guiapplauncher/examples.txt
index cf5cdbaa0a..d59e14bfed 100644
--- a/tests/auto/guiapplauncher/examples.txt
+++ b/tests/auto/guiapplauncher/examples.txt
@@ -1,10 +1,5 @@
-"animation/animatedtiles Example", "examples/widgets/animation/animatedtiles", "animatedtiles", 0, -1
"animation/appchooser Example", "examples/widgets/animation/appchooser", "appchooser", 10, -1
"animation/easing Example", "examples/widgets/animation/easing", "easing", 10, -1
-"animation/moveblocks Example", "examples/widgets/animation/moveblocks", "moveblocks", 10, -1
-"animation/states Example", "examples/widgets/animation/states", "states", 10, -1
-"animation/stickman Example", "examples/widgets/animation/stickman", "stickman", 10, -1
-"animation/sub-attaq Example", "examples/widgets/animation/sub-attaq", "sub-attaq", 0, -1
"designer/calculatorbuilder Example", "examples/widgets/designer/calculatorbuilder", "calculatorbuilder", 10, -1
"dialogs/standarddialogs Example", "examples/widgets/dialogs/standarddialogs", "standarddialogs", 10, -1
"draganddrop/dropsite Example", "examples/widgets/draganddrop/dropsite", "dropsite", 10, -1
@@ -23,7 +18,6 @@
"graphicsview/elasticnodes Example", "examples/widgets/graphicsview/elasticnodes", "elasticnodes", 10, -1
"graphicsview/embeddeddialogs Example", "examples/widgets/graphicsview/embeddeddialogs", "embeddeddialogs", 0, -1
"graphicsview/flowlayout Example", "examples/widgets/graphicsview/flowlayout", "flowlayout", 10, -1
-"graphicsview/padnavigator Example", "examples/widgets/graphicsview/padnavigator", "padnavigator", 0, -1
"graphicsview/portedasteroids Example", "examples/widgets/graphicsview/portedasteroids", "portedasteroids", 10, -1
"graphicsview/portedcanvas Example", "examples/widgets/graphicsview/portedcanvas", "portedcanvas", 10, -1
"graphicsview/weatheranchorlayout Example", "examples/widgets/graphicsview/weatheranchorlayout", "weatheranchorlayout", 10, -1
@@ -85,10 +79,6 @@
"richtext/textedit Example", "examples/widgets/richtext/textedit", "textedit", 0, -1
"richtext/textobject Example", "examples/widgets/richtext/textobject", "textobject", 10, -1
"sql/books Example", "examples/sql/books", "books", 0, -1
-"statemachine/eventtransitions Example", "examples/widgets/statemachine/eventtransitions", "eventtransitions", 10, -1
-"statemachine/rogue Example", "examples/widgets/statemachine/rogue", "rogue", 10, -1
-"statemachine/trafficlight Example", "examples/widgets/statemachine/trafficlight", "trafficlight", 0, -1
-"statemachine/twowaybutton Example", "examples/widgets/statemachine/twowaybutton", "twowaybutton", 10, -1
"tools/undo Example", "examples/widgets/tools/undo", "undo", 0, -1
"tutorials/addressbook/part7 Example", "examples/widgets/tutorials/addressbook/part7", "part7", 0, -1
"widgets/analogclock Example", "examples/widgets/widgets/analogclock", "analogclock", 6, -1